From 53902683d1b514dca78e1d6f084673e845ba8934 Mon Sep 17 00:00:00 2001 From: David Phillips Date: Sun, 9 May 2021 12:48:32 +1200 Subject: Rename top-level CDS9K regmap driver --- Makefile | 2 +- cds9k-mfd-spi.c | 48 ++++++++++++++++++++++++++++++++++++++++++++++++ simple-mfd-spi.c | 48 ------------------------------------------------ 3 files changed, 49 insertions(+), 49 deletions(-) create mode 100644 cds9k-mfd-spi.c delete mode 100644 simple-mfd-spi.c diff --git a/Makefile b/Makefile index 5e23f84..8e49ff6 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,4 @@ -obj-m := simple-mfd-spi.o +obj-m := cds9k-mfd-spi.o obj-m += cds9k-gpio.o SRC := $(shell pwd) 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 +#include +#include +#include + +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 "); +MODULE_DESCRIPTION("MFD driver for the CDS9K board controller"); +MODULE_LICENSE("GPL v2"); diff --git a/simple-mfd-spi.c b/simple-mfd-spi.c deleted file mode 100644 index 6118196..0000000 --- a/simple-mfd-spi.c +++ /dev/null @@ -1,48 +0,0 @@ -#include -#include -#include -#include - -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 "); -MODULE_DESCRIPTION("MFD driver for the CDS9K board controller"); -MODULE_LICENSE("GPL v2"); -- cgit v1.1