mfd: tps65912: Driver rewrite with DT support
Subsystems (4)
v2 cover mfd: tps65912: Driver rewrite with DT support
In an effort to cleanup this driver and add Device Tree support the driver has been rewritten based on new driver styles and modern kernel driver helpers. This has nearly halved the lines of code while keeping all previous functionality.
Platform file based initialization has been dropped as there is no examples of this use in the kernel.
v1 can be found here: [1]
Changes from v1:
- Split the rewrite into delete/create patches
- several small fixes as discussed in v1 thread
[1] http://www.spinics.net/lists/devicetree/msg93863.html
Andrew F. Davis (3):
Documentation: tps65912: Add DT bindings for the TPS65912 PMIC
mfd: tps65912: Remove old driver in preparation for new driver
mfd: tps65912: Rewrite driver adding DT support and using regmap
.../devicetree/bindings/gpio/gpio-tps65912.txt | 16 + Documentation/devicetree/bindings/mfd/tps65912.txt | 42 ++ .../bindings/regulator/tps65912-regulator.txt | 32 + drivers/gpio/Kconfig | 2 +- drivers/gpio/gpio-tps65912.c | 291 ++++---- drivers/mfd/Kconfig | 20 +- drivers/mfd/Makefile | 3 +- drivers/mfd/tps65912-core.c | 289 +++----- drivers/mfd/tps65912-i2c.c | 225 +++--- drivers/mfd/tps65912-irq.c | 217 ------ drivers/mfd/tps65912-spi.c | 226 +++--- drivers/regulator/Kconfig | 2 +- drivers/regulator/tps65912-regulator.c | 781 +++++++-------------- include/linux/mfd/tps65912.h | 255 ++++--- 14 files changed, 925 insertions(+), 1476 deletions(-) create mode 100644 Documentation/devicetree/bindings/gpio/gpio-tps65912.txt create mode 100644 Documentation/devicetree/bindings/mfd/tps65912.txt create mode 100644 Documentation/devicetree/bindings/regulator/tps65912-regulator.txt rewrite drivers/gpio/gpio-tps65912.c (68%) rewrite drivers/mfd/tps65912-core.c (96%) rewrite drivers/mfd/tps65912-i2c.c (93%) delete mode 100644 drivers/mfd/tps65912-irq.c
rewrite drivers/mfd/tps65912-spi.c (92%) rewrite drivers/regulator/tps65912-regulator.c (94%)
Signature · 1 line
1.9.1
PATCH v2 1/3 Documentation: tps65912: Add DT bindings for the TPS65912 PMIC
The TPS65912 PMIC contains several regulators and a GPIO controller. Add bindings for the TPS65912 PMIC.
--- .../devicetree/bindings/gpio/gpio-tps65912.txt | 16 +++++++++ Documentation/devicetree/bindings/mfd/tps65912.txt | 42 ++++++++++++++++++++++ .../bindings/regulator/tps65912-regulator.txt | 32 +++++++++++++++++ 3 files changed, 90 insertions(+) create mode 100644 Documentation/devicetree/bindings/gpio/gpio-tps65912.txt create mode 100644 Documentation/devicetree/bindings/mfd/tps65912.txt create mode 100644 Documentation/devicetree/bindings/regulator/tps65912-regulator.txt
Documentation/devicetree/bindings/gpio/gpio-tps65912.txt new file +16 -0
@@ -0,0 +1,16 @@ +* TPS65912 GPIO Controller bindings + +Required properties: + - compatible : Should be "ti,tps65912-gpio". + - gpio-controller : Marks the device node as a GPIO Controller. + - #gpio-cells : Should be two. The first cell is the pin number and + the second cell is used to specify flags. + See include/dt-bindings/gpio/gpio.h for possible values. + +Example: + + gpio4: tps65912_gpio { + compatible = "ti,tps65912-gpio"; + gpio-controller; + #gpio-cells = <2>; + };
Documentation/devicetree/bindings/mfd/tps65912.txt new file +42 -0
42 lines not on this page · raw message
Documentation/devicetree/bindings/regulator/tps65912-regulator.txt new file +32 -0
@@ -0,0 +1,32 @@ +* TPS65912 regulator bindings + +Required properties: + - compatible: Should be: + - "ti,tps65912-dcdc1" for DCDC1 + - "ti,tps65912-dcdc2" for DCDC2 + - "ti,tps65912-dcdc3" for DCDC3 + - "ti,tps65912-dcdc4" for DCDC4 + - "ti,tps65912-ldo1" for LDO1 + - "ti,tps65912-ldo2" for LDO2 + - "ti,tps65912-ldo3" for LDO3 + - "ti,tps65912-ldo4" for LDO4 + - "ti,tps65912-ldo5" for LDO5 + - "ti,tps65912-ldo6" for LDO6 + - "ti,tps65912-ldo7" for LDO7 + - "ti,tps65912-ldo8" for LDO8 + - "ti,tps65912-ldo9" for LDO9 + - "ti,tps65912-ldo10" for LDO10 + +Optional properties: + - Any optional property defined in ../regulator/regulator.txt + +Example: + + xyz: regulator@0 { + compatible = "ti,tps65912-dcdc1"; + regulator-name = "vdd_core"; + regulator-min-microvolt = <912000>; + regulator-max-microvolt = <1144000>; + regulator-boot-on; + regulator-always-on; + };
Signature · 1 line
1.9.1
PATCH v2 2/3 mfd: tps65912: Remove old driver in preparation for new driver
In reply to Andrew F. DavisThe old tps65912 driver is being replaced, delete old driver.
--- drivers/gpio/Kconfig | 6 - drivers/gpio/Makefile | 1 - drivers/gpio/gpio-tps65912.c | 153 ---------- drivers/mfd/Kconfig | 26 -- drivers/mfd/Makefile | 4 - drivers/mfd/tps65912-core.c | 175 ----------- drivers/mfd/tps65912-i2c.c | 139 --------- drivers/mfd/tps65912-irq.c | 217 ------------- drivers/mfd/tps65912-spi.c | 141 --------- drivers/regulator/Kconfig | 6 - drivers/regulator/Makefile | 1 - drivers/regulator/tps65912-regulator.c | 541 --------------------------------- include/linux/mfd/tps65912.h | 328 -------------------- 13 files changed, 1738 deletions(-) delete mode 100644 drivers/gpio/gpio-tps65912.c delete mode 100644 drivers/mfd/tps65912-core.c delete mode 100644 drivers/mfd/tps65912-i2c.c delete mode 100644 drivers/mfd/tps65912-irq.c delete mode 100644 drivers/mfd/tps65912-spi.c delete mode 100644 drivers/regulator/tps65912-regulator.c delete mode 100644 include/linux/mfd/tps65912.h
drivers/gpio/Kconfig +0 -6
@@ -838,12 +838,6 @@ config GPIO_TPS65910 Select this option to enable GPIO driver for the TPS65910 chip family. -config GPIO_TPS65912 - tristate "TI TPS65912 GPIO" - depends on (MFD_TPS65912_I2C || MFD_TPS65912_SPI) - help - This driver supports TPS65912 gpio chip - config GPIO_TWL4030 tristate "TWL4030, TWL5030, and TPS659x0 GPIOs" depends on TWL4030_CORE
drivers/gpio/Makefile +0 -1
@@ -96,7 +96,6 @@ obj-$(CONFIG_GPIO_TIMBERDALE) += gpio-timberdale.o obj-$(CONFIG_GPIO_PALMAS) += gpio-palmas.o obj-$(CONFIG_GPIO_TPS6586X) += gpio-tps6586x.o obj-$(CONFIG_GPIO_TPS65910) += gpio-tps65910.o -obj-$(CONFIG_GPIO_TPS65912) += gpio-tps65912.o obj-$(CONFIG_GPIO_TS5500) += gpio-ts5500.o obj-$(CONFIG_GPIO_TWL4030) += gpio-twl4030.o obj-$(CONFIG_GPIO_TWL6040) += gpio-twl6040.o
drivers/gpio/gpio-tps65912.c deleted +0 -153
153 lines not on this page · raw message
drivers/mfd/Kconfig +0 -26
@@ -1167,32 +1167,6 @@ config MFD_TPS65910 if you say yes here you get support for the TPS65910 series of Power Management chips. -config MFD_TPS65912 - bool "TI TPS65912 Power Management chip" - depends on GPIOLIB - select MFD_CORE - help - If you say yes here you get support for the TPS65912 series of - PM chips. - -config MFD_TPS65912_I2C - bool "TI TPS65912 Power Management chip with I2C" - select MFD_CORE - select MFD_TPS65912 - depends on I2C=y && GPIOLIB - help - If you say yes here you get support for the TPS65912 series of - PM chips with I2C interface. - -config MFD_TPS65912_SPI - bool "TI TPS65912 Power Management chip with SPI" - select MFD_CORE - select MFD_TPS65912 - depends on SPI_MASTER && GPIOLIB - help - If you say yes here you get support for the TPS65912 series of - PM chips with SPI interface. - config MFD_TPS80031 bool "TI TPS80031/TPS80032 Power Management chips" depends on I2C=y
drivers/mfd/Makefile +0 -4
@@ -69,10 +69,6 @@ obj-$(CONFIG_TPS6507X) += tps6507x.o obj-$(CONFIG_MFD_TPS65217) += tps65217.o obj-$(CONFIG_MFD_TPS65218) += tps65218.o obj-$(CONFIG_MFD_TPS65910) += tps65910.o -tps65912-objs := tps65912-core.o tps65912-irq.o -obj-$(CONFIG_MFD_TPS65912) += tps65912.o -obj-$(CONFIG_MFD_TPS65912_I2C) += tps65912-i2c.o -obj-$(CONFIG_MFD_TPS65912_SPI) += tps65912-spi.o obj-$(CONFIG_MFD_TPS80031) += tps80031.o obj-$(CONFIG_MENELAUS) += menelaus.o
drivers/mfd/tps65912-core.c deleted +0 -175
175 lines not on this page · raw message
drivers/mfd/tps65912-i2c.c deleted +0 -139
139 lines not on this page · raw message
drivers/mfd/tps65912-irq.c deleted +0 -217
217 lines not on this page · raw message
drivers/mfd/tps65912-spi.c deleted +0 -141
141 lines not on this page · raw message
drivers/regulator/Kconfig +0 -6
@@ -727,12 +727,6 @@ config REGULATOR_TPS65910 help This driver supports TPS65910/TPS65911 voltage regulator chips. -config REGULATOR_TPS65912 - tristate "TI TPS65912 Power regulator" - depends on (MFD_TPS65912_I2C || MFD_TPS65912_SPI) - help - This driver supports TPS65912 voltage regulator chip. - config REGULATOR_TPS80031 tristate "TI TPS80031/TPS80032 power regualtor driver" depends on MFD_TPS80031
drivers/regulator/Makefile +0 -1
@@ -91,7 +91,6 @@ obj-$(CONFIG_REGULATOR_TPS65218) += tps65218-regulator.o obj-$(CONFIG_REGULATOR_TPS6524X) += tps6524x-regulator.o obj-$(CONFIG_REGULATOR_TPS6586X) += tps6586x-regulator.o obj-$(CONFIG_REGULATOR_TPS65910) += tps65910-regulator.o -obj-$(CONFIG_REGULATOR_TPS65912) += tps65912-regulator.o obj-$(CONFIG_REGULATOR_TPS80031) += tps80031-regulator.o obj-$(CONFIG_REGULATOR_TWL4030) += twl-regulator.o obj-$(CONFIG_REGULATOR_VEXPRESS) += vexpress.o
drivers/regulator/tps65912-regulator.c deleted +0 -541
541 lines not on this page · raw message
include/linux/mfd/tps65912.h deleted +0 -328
328 lines not on this page · raw message
Signature · 1 line
1.9.1
PATCH v2 3/3 mfd: tps65912: Rewrite driver adding DT support and using regmap
In reply to Andrew F. DavisThe old driver does not support DT. Rewrite the driver adding DT support and use modern kernel features such as regmap and related helpers.
--- drivers/gpio/Kconfig | 6 + drivers/gpio/Makefile | 1 + drivers/gpio/gpio-tps65912.c | 138 ++++++++++++ drivers/mfd/Kconfig | 24 ++ drivers/mfd/Makefile | 3 + drivers/mfd/tps65912-core.c | 114 ++++++++++ drivers/mfd/tps65912-i2c.c | 86 ++++++++ drivers/mfd/tps65912-spi.c | 85 +++++++ drivers/regulator/Kconfig | 6 + drivers/regulator/Makefile | 1 + drivers/regulator/tps65912-regulator.c | 240 ++++++++++++++++++++ include/linux/mfd/tps65912.h | 393 +++++++++++++++++++++++++++++++++ 12 files changed, 1097 insertions(+) create mode 100644 drivers/gpio/gpio-tps65912.c create mode 100644 drivers/mfd/tps65912-core.c create mode 100644 drivers/mfd/tps65912-i2c.c create mode 100644 drivers/mfd/tps65912-spi.c create mode 100644 drivers/regulator/tps65912-regulator.c create mode 100644 include/linux/mfd/tps65912.h
drivers/gpio/Kconfig +6 -0
@@ -838,6 +838,12 @@ config GPIO_TPS65910 Select this option to enable GPIO driver for the TPS65910 chip family. +config GPIO_TPS65912 + tristate "TI TPS65912 GPIO" + depends on MFD_TPS65912 + help + This driver supports TPS65912 gpio chip + config GPIO_TWL4030 tristate "TWL4030, TWL5030, and TPS659x0 GPIOs" depends on TWL4030_CORE
drivers/gpio/Makefile +1 -0
@@ -96,6 +96,7 @@ obj-$(CONFIG_GPIO_TIMBERDALE) += gpio-timberdale.o obj-$(CONFIG_GPIO_PALMAS) += gpio-palmas.o obj-$(CONFIG_GPIO_TPS6586X) += gpio-tps6586x.o obj-$(CONFIG_GPIO_TPS65910) += gpio-tps65910.o +obj-$(CONFIG_GPIO_TPS65912) += gpio-tps65912.o obj-$(CONFIG_GPIO_TS5500) += gpio-ts5500.o obj-$(CONFIG_GPIO_TWL4030) += gpio-twl4030.o obj-$(CONFIG_GPIO_TWL6040) += gpio-twl6040.o
drivers/gpio/gpio-tps65912.c new file +138 -0
138 lines not on this page · raw message
drivers/mfd/Kconfig +24 -0
@@ -1167,6 +1167,30 @@ config MFD_TPS65910 if you say yes here you get support for the TPS65910 series of Power Management chips. +config MFD_TPS65912 + tristate + select REGMAP + select REGMAP_IRQ + select MFD_CORE + +config MFD_TPS65912_I2C + tristate "TI TPS65912 Power Management chip with I2C" + select MFD_TPS65912 + select REGMAP_I2C + depends on I2C + help + If you say yes here you get support for the TPS65912 series of + PM chips with I2C interface. + +config MFD_TPS65912_SPI + tristate "TI TPS65912 Power Management chip with SPI" + select MFD_TPS65912 + select REGMAP_SPI + depends on SPI_MASTER + help + If you say yes here you get support for the TPS65912 series of + PM chips with SPI interface. + config MFD_TPS80031 bool "TI TPS80031/TPS80032 Power Management chips" depends on I2C=y
drivers/mfd/Makefile +3 -0
@@ -69,6 +69,9 @@ obj-$(CONFIG_TPS6507X) += tps6507x.o obj-$(CONFIG_MFD_TPS65217) += tps65217.o obj-$(CONFIG_MFD_TPS65218) += tps65218.o obj-$(CONFIG_MFD_TPS65910) += tps65910.o +obj-$(CONFIG_MFD_TPS65912) += tps65912-core.o +obj-$(CONFIG_MFD_TPS65912_I2C) += tps65912-i2c.o +obj-$(CONFIG_MFD_TPS65912_SPI) += tps65912-spi.o obj-$(CONFIG_MFD_TPS80031) += tps80031.o obj-$(CONFIG_MENELAUS) += menelaus.o
drivers/mfd/tps65912-core.c new file +114 -0
114 lines not on this page · raw message
drivers/mfd/tps65912-i2c.c new file +86 -0
86 lines not on this page · raw message
drivers/mfd/tps65912-spi.c new file +85 -0
85 lines not on this page · raw message
drivers/regulator/Kconfig +6 -0
@@ -727,6 +727,12 @@ config REGULATOR_TPS65910 help This driver supports TPS65910/TPS65911 voltage regulator chips. +config REGULATOR_TPS65912 + tristate "TI TPS65912 Power regulator" + depends on MFD_TPS65912 + help + This driver supports TPS65912 voltage regulator chip. + config REGULATOR_TPS80031 tristate "TI TPS80031/TPS80032 power regualtor driver" depends on MFD_TPS80031
drivers/regulator/Makefile +1 -0
@@ -91,6 +91,7 @@ obj-$(CONFIG_REGULATOR_TPS65218) += tps65218-regulator.o obj-$(CONFIG_REGULATOR_TPS6524X) += tps6524x-regulator.o obj-$(CONFIG_REGULATOR_TPS6586X) += tps6586x-regulator.o obj-$(CONFIG_REGULATOR_TPS65910) += tps65910-regulator.o +obj-$(CONFIG_REGULATOR_TPS65912) += tps65912-regulator.o obj-$(CONFIG_REGULATOR_TPS80031) += tps80031-regulator.o obj-$(CONFIG_REGULATOR_TWL4030) += twl-regulator.o obj-$(CONFIG_REGULATOR_VEXPRESS) += vexpress.o
drivers/regulator/tps65912-regulator.c new file +240 -0
240 lines not on this page · raw message
include/linux/mfd/tps65912.h new file +393 -0
393 lines not on this page · raw message
Signature · 1 line
1.9.1
Mark Brown
maintainerRe: [PATCH v2 3/3] mfd: tps65912: Rewrite driver adding DT support and using regmap
Quoted 4 lines · Andrew F. Davis
drivers/gpio/Kconfig | 6 + drivers/gpio/Makefile | 1 + drivers/gpio/gpio-tps65912.c | 138 ++++++++++++ drivers/mfd/Kconfig | 24 ++
Quoted 8 lines
drivers/mfd/Makefile | 3 + drivers/mfd/tps65912-core.c | 114 ++++++++++ drivers/mfd/tps65912-i2c.c | 86 ++++++++ drivers/mfd/tps65912-spi.c | 85 +++++++ drivers/regulator/Kconfig | 6 + drivers/regulator/Makefile | 1 + drivers/regulator/tps65912-regulator.c | 240 ++++++++++++++++++++ include/linux/mfd/tps65912.h | 393 +++++++++++++++++++++++++++++++++
Please submit this like a normal driver, not as one enormous patch covering every subsystem.
Re: [PATCH v2 3/3] mfd: tps65912: Rewrite driver adding DT support and using regmap
Quoted 15 lines · Mark Brown
Quoted 4 lines · Andrew F. Davis
drivers/gpio/Kconfig | 6 + drivers/gpio/Makefile | 1 + drivers/gpio/gpio-tps65912.c | 138 ++++++++++++ drivers/mfd/Kconfig | 24 ++Quoted 8 lines
drivers/mfd/Makefile | 3 + drivers/mfd/tps65912-core.c | 114 ++++++++++ drivers/mfd/tps65912-i2c.c | 86 ++++++++ drivers/mfd/tps65912-spi.c | 85 +++++++ drivers/regulator/Kconfig | 6 + drivers/regulator/Makefile | 1 + drivers/regulator/tps65912-regulator.c | 240 ++++++++++++++++++++ include/linux/mfd/tps65912.h | 393 +++++++++++++++++++++++++++++++++
Quoted 3 lines
Please submit this like a normal driver, not as one enormous patch covering every subsystem.
OK, I'll break-out the regulator and gpio into their own patches and send this series again, sorry about the noise.
Andrew
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html