diff options
author | David Phillips <david@yeah.nah.nz> | 2021-05-09 12:48:32 +1200 |
---|---|---|
committer | David Phillips <david@yeah.nah.nz> | 2021-05-09 12:48:32 +1200 |
commit | 53902683d1b514dca78e1d6f084673e845ba8934 (patch) | |
tree | 2db0ffa7958c53c291af68059b7b6e5712dc7a18 /cds9k-mfd-spi.c | |
parent | 55dce174c05af46ab0f86da7de0c4447be038973 (diff) | |
download | cds9k-53902683d1b514dca78e1d6f084673e845ba8934.tar.xz |
Rename top-level CDS9K regmap driver
Diffstat (limited to 'cds9k-mfd-spi.c')
-rw-r--r-- | cds9k-mfd-spi.c | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/cds9k-mfd-spi.c b/cds9k-mfd-spi.c new file mode 100644 index 0000000..6118196 --- /dev/null +++ b/cds9k-mfd-spi.c @@ -0,0 +1,48 @@ +#include <linux/spi/spi.h> +#include <linux/module.h> +#include <linux/of_platform.h> +#include <linux/regmap.h> + +static const struct regmap_config simple_regmap_config = { + .reg_bits = 8, + .val_bits = 16, + .pad_bits = 8, +}; + +static int david_cds9k_probe(struct spi_device *spi) +{ + const struct regmap_config *config; + struct regmap *regmap; + + printk("Bing bong\n"); + + config = device_get_match_data(&spi->dev); + if (!config) + config = &simple_regmap_config; + + regmap = devm_regmap_init_spi(spi, config); + if (IS_ERR(regmap)) + return PTR_ERR(regmap); + + return devm_of_platform_populate(&spi->dev); +} + + +static const struct of_device_id david_cds9k_of_match[] = { + { .compatible = "david,cds9k" }, + {} +}; +MODULE_DEVICE_TABLE(of, david_cds9k_of_match); + +static struct spi_driver david_cds9k_spi_driver = { + .probe = david_cds9k_probe, + .driver = { + .name = "david_cds9k", + .of_match_table = david_cds9k_of_match, + }, +}; +module_spi_driver(david_cds9k_spi_driver); + +MODULE_AUTHOR("David Phillips <david@yeah.nah.nz>"); +MODULE_DESCRIPTION("MFD driver for the CDS9K board controller"); +MODULE_LICENSE("GPL v2"); |