mfd: tps65912: Driver rewrite with DT support
Subsystems (4)
v6 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] v2: [2] v3: [3] v4: [4] v5: [5]
Changes from v5:
- Small formatting changes to DT Docs
- Converted to_tps65912_gpio from macro to inline function
Changes from v4:
- Use mfd core to add sub-devices
Changes from v3:
- Reorganized regulator driver and related DT node
- Other small fixes as discussed in v3 thread
Changes from v2:
- Split the series further into subsystems
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
[2] http://www.spinics.net/lists/devicetree/msg95003.html
[3] http://www.spinics.net/lists/devicetree/msg95133.html
[4] http://www.spinics.net/lists/devicetree/msg96109.html
[5] http://www.spinics.net/lists/devicetree/msg100601.html
Andrew F. Davis (5):
Documentation: tps65912: Add DT bindings for the TPS65912 PMIC
mfd: tps65912: Remove old driver in preparation for new driver
mfd: tps65912: Add driver for the TPS65912 PMIC
regulator: tps65912: Add regulator driver for the TPS65912 PMIC
gpio: tps65912: Add GPIO driver for the TPS65912 PMIC
.../devicetree/bindings/gpio/gpio-tps65912.txt | 16 + Documentation/devicetree/bindings/mfd/tps65912.txt | 51 ++ .../bindings/regulator/tps65912-regulator.txt | 28 + drivers/gpio/Kconfig | 2 +- drivers/gpio/gpio-tps65912.c | 292 ++++----- drivers/mfd/Kconfig | 22 +- drivers/mfd/Makefile | 3 +- drivers/mfd/tps65912-core.c | 297 ++++----- drivers/mfd/tps65912-i2c.c | 220 +++---- drivers/mfd/tps65912-irq.c | 217 ------- drivers/mfd/tps65912-spi.c | 221 +++---- drivers/regulator/Kconfig | 2 +- drivers/regulator/tps65912-regulator.c | 711 +++++---------------- include/linux/mfd/tps65912.h | 211 +++--- 14 files changed, 815 insertions(+), 1478 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 (69%) rewrite drivers/mfd/tps65912-core.c (95%) 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 · 6 lines
1.9.1 -- 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
PATCH v6 1/5 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 | 51 ++++++++++++++++++++++ .../bindings/regulator/tps65912-regulator.txt | 28 ++++++++++++ 3 files changed, 95 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 ../gpio/gpio.txt for more information. + +Example: + + gpio4: gpio { + compatible = "ti,tps65912-gpio"; + gpio-controller; + #gpio-cells = <2>; + };
Documentation/devicetree/bindings/mfd/tps65912.txt new file +51 -0
51 lines not on this page · raw message
Documentation/devicetree/bindings/regulator/tps65912-regulator.txt new file +28 -0
@@ -0,0 +1,28 @@ +* TPS65912 regulator bindings + +Required properties: + - compatible : Should be "ti,tps65912-regulator". + - list of regulators provided by this controller, must be named + after their hardware counterparts: dcdc[1-4] and ldo[1-10]. + +Each regulator is defined using the standard binding for regulators. + +Example: + + regulator { + compatible = "ti,tps65912-regulator"; + + dcdc1 { + regulator-name = "vdd_core"; + regulator-min-microvolt = <912000>; + regulator-max-microvolt = <1144000>; + regulator-boot-on; + regulator-always-on; + }; + + ldo1 { + regulator-name = "ldo1"; + regulator-min-microvolt = <1900000>; + regulator-max-microvolt = <1900000>; + }; + };
Signature · 1 line
1.9.1
PATCH v6 2/5 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 v6 3/5 mfd: tps65912: Add driver for the TPS65912 PMIC
In reply to Andrew F. DavisThis patch adds support for TPS65912 PMIC MFD core. It provides communication through the I2C and SPI interfaces. It contains the following components:
- Regulators
- GPIO controller
--- drivers/mfd/Kconfig | 26 ++++ drivers/mfd/Makefile | 3 + drivers/mfd/tps65912-core.c | 122 +++++++++++++++ drivers/mfd/tps65912-i2c.c | 81 ++++++++++ drivers/mfd/tps65912-spi.c | 80 ++++++++++ include/linux/mfd/tps65912.h | 345 +++++++++++++++++++++++++++++++++++++++++++ 6 files changed, 657 insertions(+) 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 include/linux/mfd/tps65912.h
drivers/mfd/Kconfig +26 -0
@@ -1167,6 +1167,32 @@ config MFD_TPS65910 if you say yes here you get support for the TPS65910 series of Power Management chips. +config MFD_TPS65912 + tristate + select MFD_CORE + select REGMAP + select REGMAP_IRQ + +config MFD_TPS65912_I2C + tristate "TI TPS65912 Power Management chip with I2C" + select MFD_TPS65912 + select REGMAP_I2C + depends on I2C + depends on OF || COMPILE_TEST + 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 + depends on OF || COMPILE_TEST + 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 +122 -0
122 lines not on this page · raw message
drivers/mfd/tps65912-i2c.c new file +81 -0
81 lines not on this page · raw message
drivers/mfd/tps65912-spi.c new file +80 -0
80 lines not on this page · raw message
include/linux/mfd/tps65912.h new file +345 -0
345 lines not on this page · raw message
Signature · 1 line
1.9.1
PATCH v6 4/5 regulator: tps65912: Add regulator driver for the TPS65912 PMIC
In reply to Andrew F. DavisThis patch adds support for TPS65912 PMIC regulators.
The regulators set consists of 4 DCDCs and 10 LDOs. The output voltages are configurable and are meant to supply power to the main processor and other components.
--- drivers/regulator/Kconfig | 6 ++ drivers/regulator/Makefile | 1 + drivers/regulator/tps65912-regulator.c | 170 +++++++++++++++++++++++++++++++++ 3 files changed, 177 insertions(+) create mode 100644 drivers/regulator/tps65912-regulator.c
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 +170 -0
170 lines not on this page · raw message
Signature · 1 line
1.9.1
PATCH v6 5/5 gpio: tps65912: Add GPIO driver for the TPS65912 PMIC
In reply to Andrew F. DavisThis patch adds support for the TPS65912 PMIC GPIOs.
TPS65912 has five configurable GPIOs that can be used for several purposes.
--- drivers/gpio/Kconfig | 6 ++ drivers/gpio/Makefile | 1 + drivers/gpio/gpio-tps65912.c | 139 +++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 146 insertions(+) create mode 100644 drivers/gpio/gpio-tps65912.c
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 +139 -0
139 lines not on this page · raw message
Signature · 1 line
1.9.1
Re: [PATCH v6 1/5] Documentation: tps65912: Add DT bindings for the TPS65912 PMIC
In reply to Andrew F. DavisQuoted 4 lines · Andrew F. Davis
The TPS65912 PMIC contains several regulators and a GPIO controller. Add bindings for the TPS65912 PMIC.
Signed-off-by Andrew F. Davis <[email protected]>
Quoted 8 lines
--- .../devicetree/bindings/gpio/gpio-tps65912.txt | 16 +++++++ Documentation/devicetree/bindings/mfd/tps65912.txt | 51 ++++++++++++++++++++++ .../bindings/regulator/tps65912-regulator.txt | 28 ++++++++++++ 3 files changed, 95 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
Quoted 117 lines
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 ../gpio/gpio.txt for more information. + +Example: + + gpio4: gpio { + compatible = "ti,tps65912-gpio"; + gpio-controller; + #gpio-cells = <2>; + };Documentation/devicetree/bindings/mfd/tps65912.txt new file +51
-0@@ -0,0 +1,51 @@ +* TPS65912 Power Management Integrated Circuit bindings + +Required properties: + - compatible : Should be "ti,tps65912". + - reg : Slave address or chip select number (I2C / SPI). + - interrupt-parent : The parent interrupt controller. + - interrupts : The interrupt line the device is connected to. + - interrupt-controller : Marks the device node as an interrupt controller. + - #interrupt-cells : The number of cells to describe an IRQ, this should be 2. + The first cell is the IRQ number. + The second cell is the flags, encoded as the trigger masks from + ../interrupt-controller/interrupts.txt. + +Additional nodes defined in: + - Regulators: ../regulator/tps65912-regulator.txt + - GPIO: ../gpio/gpio-tps65912.txt. + +Example: + + pmic: tps65912@2d { + compatible = "ti,tps65912"; + reg = <0x2d>; + interrupt-parent = <&gpio1>; + interrupts = <28 IRQ_TYPE_LEVEL_LOW>; + interrupt-controller; + #interrupt-cells = <2>; + + regulators { + compatible = "ti,tps65912-regulator"; + + dcdc1 { + regulator-name = "vdd_core"; + regulator-min-microvolt = <912000>; + regulator-max-microvolt = <1144000>; + regulator-boot-on; + regulator-always-on; + }; + + ldo1 { + regulator-name = "ldo1"; + regulator-min-microvolt = <1900000>; + regulator-max-microvolt = <1900000>; + }; + }; + + gpio4: gpio { + compatible = "ti,tps65912-gpio"; + gpio-controller; + #gpio-cells = <2>; + }; + };Documentation/devicetree/bindings/regulator/tps65912-regulator.txt new file +28
-0@@ -0,0 +1,28 @@ +* TPS65912 regulator bindings + +Required properties: + - compatible : Should be "ti,tps65912-regulator". + - list of regulators provided by this controller, must be named + after their hardware counterparts: dcdc[1-4] and ldo[1-10]. + +Each regulator is defined using the standard binding for regulators. + +Example: + + regulator { + compatible = "ti,tps65912-regulator"; + + dcdc1 { + regulator-name = "vdd_core"; + regulator-min-microvolt = <912000>; + regulator-max-microvolt = <1144000>; + regulator-boot-on; + regulator-always-on; + }; + + ldo1 { + regulator-name = "ldo1"; + regulator-min-microvolt = <1900000>; + regulator-max-microvolt = <1900000>; + }; + };Signature · 1 line
1.9.1