mfd: lp873x: Add lp873x PMIC support
Subsystems (3)
v5 cover mfd: lp873x: Add lp873x PMIC support
The LP873X chip is a power management IC for Portable Navigation Systems
and Tablet Computing devices. It contains the following components:
- Regulators.
- Configurable General Purpose Output Signals(GPO).
PMIC interacts with the main processor through i2c. PMIC has couple of LDOs(Linear Regulators), couple of BUCKs (Step-Down DC-DC Converter Cores) and GPOs(General Purpose Output Signals).
The regulator patch is already queued:
http://marc.info/?l=linux-kernel&m=146298767110771&w=2
Hence posting the remaining patches of the series with the comments fixed on mfd driver.
Chnages in v4:
Added GPO driver support.
Keerthy (3):
Documentation: mfd: LP873X: Add information for the mfd driver
mfd: lp873x: Add lp873x PMIC support
gpio: lp873x: Add support for General Purpose Outputs
Documentation/devicetree/bindings/mfd/lp873x.txt | 59 +++++ drivers/gpio/Kconfig | 10 + drivers/gpio/Makefile | 1 + drivers/gpio/gpio-lp873x.c | 185 ++++++++++++++++ drivers/mfd/Kconfig | 14 ++ drivers/mfd/Makefile | 2 + drivers/mfd/lp873x.c | 99 +++++++++ include/linux/mfd/lp873x.h | 264 +++++++++++++++++++++++ 8 files changed, 634 insertions(+) create mode 100644 Documentation/devicetree/bindings/mfd/lp873x.txt create mode 100644 drivers/gpio/gpio-lp873x.c create mode 100644 drivers/mfd/lp873x.c create mode 100644 include/linux/mfd/lp873x.h
Signature · 1 line
1.9.1
PATCH v5 1/3 Documentation: mfd: LP873X: Add information for the mfd driver
The lp873x series of PMICs have a bunch of regulators and a couple of GPO(General Purpose Outputs).
Add information for the mfd and regulator drivers.
---
Changes in v4:
* Added the GPIO properties.
Changes in v3:
* Changed the example node lable to pmic from lp8733.
Documentation/devicetree/bindings/mfd/lp873x.txt | 59 ++++++++++++++++++++++++ 1 file changed, 59 insertions(+) create mode 100644 Documentation/devicetree/bindings/mfd/lp873x.txt
Documentation/devicetree/bindings/mfd/lp873x.txt new file +59 -0
@@ -0,0 +1,59 @@ +TI LP873X MFD driver + +Required properties: + - compatible: "ti,lp8732", "ti,lp8733" + - reg: I2C slave address. + - 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. + - regulators: : List of child nodes that specify the regulator + initialization data. +Example: + +pmic: lp8733@60 { + compatible = "ti,lp8733"; + reg = <0x60>; + gpio-controller; + #gpio-cells = <2>; + + regulators { + lp8733_buck0: buck0 { + regulator-name = "lp8733-buck0"; + regulator-min-microvolt = <800000>; + regulator-max-microvolt = <1400000>; + regulator-min-microamp = <1500000>; + regulator-max-microamp = <4000000>; + regulator-ramp-delay = <10000>; + regulator-always-on; + regulator-boot-on; + }; + + lp8733_buck1: buck1 { + regulator-name = "lp8733-buck1"; + regulator-min-microvolt = <800000>; + regulator-max-microvolt = <1400000>; + regulator-min-microamp = <1500000>; + regulator-max-microamp = <4000000>; + regulator-ramp-delay = <10000>; + regulator-boot-on; + regulator-always-on; + }; + + lp8733_ldo0: ldo0 { + regulator-name = "lp8733-ldo0"; + regulator-min-microvolt = <800000>; + regulator-max-microvolt = <3000000>; + regulator-boot-on; + regulator-always-on; + }; + + lp8733_ldo1: ldo1 { + regulator-name = "lp8733-ldo1"; + regulator-min-microvolt = <800000>; + regulator-max-microvolt = <3000000>; + regulator-always-on; + regulator-boot-on; + }; + }; +};
Signature · 1 line
1.9.1
PATCH v5 2/3 mfd: lp873x: Add lp873x PMIC support
In reply to KeerthyThe LP873X chip is a power management IC for Portable Navigation Systems
and Tablet Computing devices. It contains the following components:
- Regulators.
- Configurable General Purpose Output Signals(GPO).
PMIC interacts with the main processor through i2c. PMIC has couple of LDOs(Linear Regulators), couple of BUCKs (Step-Down DC-DC Converter Cores) and GPOs(General Purpose Output Signals).
---
Changes in v4:
* Added Author.
* Added the mfd_cell for gpio.
Changes in v3:
* Reordered the probe code.
* Fixed Typo in Kconfig description.
* Removed unused member from struct lp873x.
drivers/mfd/Kconfig | 14 +++ drivers/mfd/Makefile | 2 + drivers/mfd/lp873x.c | 99 +++++++++++++++++ include/linux/mfd/lp873x.h | 264 +++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 379 insertions(+) create mode 100644 drivers/mfd/lp873x.c create mode 100644 include/linux/mfd/lp873x.h
drivers/mfd/Kconfig +14 -0
@@ -1221,6 +1221,20 @@ config MFD_TPS65217 This driver can also be built as a module. If so, the module will be called tps65217. +config MFD_LP873X + tristate "TI LP873X Power Management IC" + depends on I2C + select MFD_CORE + select REGMAP_I2C + help + If you say yes here then you get support for the LP873X series of + power management integrated circuits(PMIC). + These include voltage regulators, Thermal protection, Configurable + general purpose outputs(GPO) that are used in portable devices. + + This driver can also be built as a module. If so, the module + will be called lp873x. + config MFD_TPS65218 tristate "TI TPS65218 Power Management chips" depends on I2C
drivers/mfd/Makefile +2 -0
@@ -22,6 +22,8 @@ obj-$(CONFIG_HTC_EGPIO) += htc-egpio.o obj-$(CONFIG_HTC_PASIC3) += htc-pasic3.o obj-$(CONFIG_HTC_I2CPLD) += htc-i2cpld.o +obj-$(CONFIG_MFD_LP873X) += lp873x.o + obj-$(CONFIG_MFD_DAVINCI_VOICECODEC) += davinci_voicecodec.o obj-$(CONFIG_MFD_DM355EVM_MSP) += dm355evm_msp.o obj-$(CONFIG_MFD_TI_AM335X_TSCADC) += ti_am335x_tscadc.o
drivers/mfd/lp873x.c new file +99 -0
99 lines not on this page · raw message
include/linux/mfd/lp873x.h new file +264 -0
264 lines not on this page · raw message
Signature · 1 line
1.9.1
PATCH v5 3/3 gpio: lp873x: Add support for General Purpose Outputs
In reply to KeerthyAdd driver for lp873x PMIC family GPOs. Two GPOs are supported and can be configured in Open-drain output or Push-pull output.
---
Changes in v5:
* Corrected a return value for lp873x_gpio_direction_output.
drivers/gpio/Kconfig | 10 +++ drivers/gpio/Makefile | 1 + drivers/gpio/gpio-lp873x.c | 185 +++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 196 insertions(+) create mode 100644 drivers/gpio/gpio-lp873x.c
drivers/gpio/Kconfig +10 -0
@@ -871,6 +871,16 @@ config GPIO_LP3943 LP3943 can be used as a GPIO expander which provides up to 16 GPIOs. Open drain outputs are required for this usage. +config GPIO_LP873X + tristate "TI LP873X GPO" + depends on MFD_LP873X + help + This driver supports the GPO on TI Lp873x PMICs. 2 GPOs are present + on LP873X PMICs. + + This driver can also be built as a module. If so, the module will be + called gpio-lp873x. + config GPIO_MAX77620 tristate "GPIO support for PMIC MAX77620 and MAX20024" depends on MFD_MAX77620
drivers/gpio/Makefile +1 -0
@@ -56,6 +56,7 @@ obj-$(CONFIG_GPIO_LOONGSON) += gpio-loongson.o obj-$(CONFIG_GPIO_LP3943) += gpio-lp3943.o obj-$(CONFIG_GPIO_LPC18XX) += gpio-lpc18xx.o obj-$(CONFIG_ARCH_LPC32XX) += gpio-lpc32xx.o +obj-$(CONFIG_GPIO_LP873X) += gpio-lp873x.o obj-$(CONFIG_GPIO_LYNXPOINT) += gpio-lynxpoint.o obj-$(CONFIG_GPIO_MAX730X) += gpio-max730x.o obj-$(CONFIG_GPIO_MAX7300) += gpio-max7300.o
drivers/gpio/gpio-lp873x.c new file +185 -0
185 lines not on this page · raw message
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
Re: [PATCH v5 3/3] gpio: lp873x: Add support for General Purpose Outputs
Quoted 4 lines · Keerthy
Add driver for lp873x PMIC family GPOs. Two GPOs are supported and can be configured in Open-drain output or Push-pull output.
Signed-off-by Keerthy <[email protected]>
Looks all right to me.
Quoted 1 line
+#include <
linux/mfd/lp873x.h>
I guess this means Lee must merge this.
Yours,
Linus Walleij
Re: [PATCH v5 3/3] gpio: lp873x: Add support for General Purpose Outputs
Quoted 7 lines · Linus Walleij
Quoted 4 lines · Keerthy
Add driver for lp873x PMIC family GPOs. Two GPOs are supported and can be configured in Open-drain output or Push-pull output.
Signed-off-by Keerthy <[email protected]>
Quoted 7 lines
Looks all right to me.
Quoted 1 line
+#include <
linux/mfd/lp873x.h>I guess this means Lee must merge this.
Acked-by Linus Walleij <[email protected]>
Thanks Linus!
Quoted 4 lines
Yours,
Linus Walleij
Quoted 37 lines · Keerthy
The LP873X chip is a power management IC for Portable Navigation Systems
and Tablet Computing devices. It contains the following components:- Regulators.
- Configurable General Purpose Output Signals(GPO).PMIC interacts with the main processor through i2c. PMIC has couple of LDOs(Linear Regulators), couple of BUCKs (Step-Down DC-DC Converter Cores) and GPOs(General Purpose Output Signals).
Signed-off-by Keerthy <[email protected]>---
Changes in v4:
* Added Author.
* Added themfd_cellfor gpio.Changes in v3:
* Reordered the probe code.
* Fixed Typo inKconfigdescription.
* Removed unused member from struct lp873x.drivers/mfd/Kconfig | 14 +++ drivers/mfd/Makefile | 2 + drivers/mfd/lp873x.c | 99 +++++++++++++++++ include/linux/mfd/lp873x.h | 264 +++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 379 insertions(+) create mode 100644 drivers/mfd/lp873x.c create mode 100644 include/linux/mfd/lp873x.hdrivers/mfd/Kconfig +0
-0
drivers/mfd/Kconfig config MFD_TPS65217 · line 1224
Quoted 4 lines
drivers/mfd/Kconfig +1
-0@@ -1221,6 +1221,20 @@ config MFD_TPS65217 This driver can also be built as a module. If so, the module will be called tps65217. +config MFD_LP873X
Nicer as MFD_TI_LP873X I think.
drivers/mfd/Kconfig config MFD_TPS65217 · line 1231
Quoted 7 lines
drivers/mfd/Kconfig +7
-0+ tristate "TI LP873X Power Management IC" + depends on I2C + select MFD_CORE + select REGMAP_I2C + help + If you say yes here then you get support for the LP873X series of + power management integrated circuits(PMIC).
Power Management Integrated Circuits (PMIC).
drivers/mfd/Kconfig config MFD_TPS65217 · line 1233
Quoted 2 lines
drivers/mfd/Kconfig +2
-0+ These include voltage regulators, Thermal protection, Configurable + general purpose outputs(GPO) that are used in portable devices.
Some here. Please standardise your capitalisation.
Quoted 67 lines
drivers/mfd/Kconfig +3
-0+ This driver can also be built as a module. If so, the module + will be called lp873x. + config MFD_TPS65218 tristate "TI TPS65218 Power Management chips" depends on I2Cdrivers/mfd/Makefile +2
-0@@ -22,6 +22,8 @@ obj-$(CONFIG_HTC_EGPIO) += htc-egpio.o obj-$(CONFIG_HTC_PASIC3) += htc-pasic3.o obj-$(CONFIG_HTC_I2CPLD) += htc-i2cpld.o +obj-$(CONFIG_MFD_LP873X) += lp873x.o + obj-$(CONFIG_MFD_DAVINCI_VOICECODEC) += davinci_voicecodec.o obj-$(CONFIG_MFD_DM355EVM_MSP) += dm355evm_msp.o obj-$(CONFIG_MFD_TI_AM335X_TSCADC) += ti_am335x_tscadc.odrivers/mfd/lp873x.c new file +42
-0@@ -0,0 +1,99 @@ +/* +* Copyright (C) 2016 Texas Instruments Incorporated - http://www.ti.com/ +* +* Author: Keerthy <[email protected]> +* +* This program is free software; you can redistribute it and/or +* modify it under the terms of the GNU General Public License as +* published by the Free Software Foundation version 2. +* +* This program is distributed "as is" WITHOUT ANY WARRANTY of any +* kind, whether express or implied; without even the implied warranty +* of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +*/ + +#include <linux/interrupt.h> +#include <linux/mfd/core.h> +#include <linux/module.h> +#include <linux/of_device.h> +#include <linux/regmap.h> + +#include <linux/mfd/lp873x.h> + +static const struct regmap_config lp873x_regmap_config = { + .reg_bits =8 , + .val_bits =8 , + .max_register =LP873X_REG_MAX , +}; + +static const struct mfd_cell lp873x_cells[] = { + { .name ="lp873x-regulator" , }, + { .name ="lp873x-gpio" , }, +}; + +static int lp873x_probe (struct i2c_client *client, +const struct i2c_device_id *ids) +{ +struct lp873x *lp873; +int ret; +unsigned int otpid; + + lp873 =devm_kzalloc (&client->dev,sizeof (*lp873),GFP_KERNEL );
drivers/mfd/lp873x.c line 52
Quoted 10 lines
drivers/mfd/lp873x.c new file +10
-0+if (!lp873) +return -ENOMEM ; + + lp873->dev = &client->dev; + + lp873->regmap =devm_regmap_init_i2c (client, &lp873x_regmap_config); +if (IS_ERR (lp873->regmap)) { + ret =PTR_ERR (lp873->regmap); +dev_err (lp873->dev,"Failed to initialize register map: %d\n" , + ret);
Nit: I'd prefer you break after "->dev,".
drivers/mfd/lp873x.c line 56
Quoted 4 lines
drivers/mfd/lp873x.c new file +4
-0+return ret; + } + +mutex_init (&lp873->lp873_lock);
How many locks do you have in 'struct lp873x'?
I suggest that 'lock' will do fine.
Quoted 15 lines
drivers/mfd/lp873x.c new file +15
-0+ ret =regmap_read (lp873->regmap,LP873X_REG_OTP_REV , &otpid); +if (ret) { +dev_err (lp873->dev,"Failed to read OTP ID\n" ); +return ret; + } + + lp873->rev = otpid &LP873X_OTP_REV_OTP_ID ; +i2c_set_clientdata (client, lp873); + ret =mfd_add_devices (lp873->dev,PLATFORM_DEVID_AUTO , lp873x_cells, +ARRAY_SIZE (lp873x_cells),NULL ,0 ,NULL ); + +return ret; +} + +static const struct of_device_id of_lp873x_match_table[] = {
drivers/mfd/lp873x.c line 82
Quoted 10 lines
drivers/mfd/lp873x.c new file +10
-0+ { .compatible = "ti,lp8733", }, + { .compatible = "ti,lp8732", }, + {} +}; +MODULE_DEVICE_TABLE (of, of_lp873x_match_table); + +static const struct i2c_device_id lp873x_id_table[] = { + {"lp873x" ,LP873X }, + {"lp8732" ,LP873X }, + { "lp8733", LP873X },
Do you use these IDs at any point?
[...]
Signature · 4 lines
Lee Jones Linaro STMicroelectronics Landing Team Lead Linaro.org │ Open source software for ARM SoCs Follow Linaro: Facebook | Twitter | Blog
Re: [PATCH v5 1/3] Documentation: mfd: LP873X: Add information for the mfd driver
In reply to KeerthyQuoted 3 lines · Keerthy
The lp873x series of PMICs have a bunch of regulators and a couple of GPO(General Purpose Outputs).
Add information for the mfd and regulator drivers.
Nit: s/mfd/MFD/
Quoted 22 lines
Acked-by Rob Herring <[email protected]>Signed-off-by Keerthy <[email protected]>---
Changes in v4:
* Added the GPIO properties.
Changes in v3:
* Changed the example node lable to pmic from lp8733.
Documentation/devicetree/bindings/mfd/lp873x.txt | 59 ++++++++++++++++++++++++ 1 file changed, 59 insertions(+) create mode 100644 Documentation/devicetree/bindings/mfd/lp873x.txtDocumentation/devicetree/bindings/mfd/lp873x.txt new file +0
-0
Documentation/devicetree/bindings/mfd/lp873x.txt line 1
Quoted 1 line
Documentation/devicetree/bindings/mfd/lp873x.txt new file +1
-0@@ -0,0 +1,59 @@ +TI LP873X MFD driver
"PMIC MFD" or "MFD PMIC"
Documentation/devicetree/bindings/mfd/lp873x.txt line 11
Quoted 9 lines
Documentation/devicetree/bindings/mfd/lp873x.txt new file +9
-0+Required properties: + - compatible: "ti,lp8732", "ti,lp8733" + - reg: I2C slave address. + - 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. + - regulators: : List of child nodes that specify the regulator + initialization data.
Please standardise your formatting here. Sometimes you do ":", other times you do " :", and oddly ": :".
Quoted 48 lines
Documentation/devicetree/bindings/mfd/lp873x.txt new file +48
-0+Example: + +pmic: lp8733@60 { + compatible = "ti,lp8733"; + reg = <0x60>; + gpio-controller; + #gpio-cells = <2>; + + regulators { + lp8733_buck0: buck0 { + regulator-name = "lp8733-buck0"; + regulator-min-microvolt = <800000>; + regulator-max-microvolt = <1400000>; + regulator-min-microamp = <1500000>; + regulator-max-microamp = <4000000>; + regulator-ramp-delay = <10000>; + regulator-always-on; + regulator-boot-on; + }; + + lp8733_buck1: buck1 { + regulator-name = "lp8733-buck1"; + regulator-min-microvolt = <800000>; + regulator-max-microvolt = <1400000>; + regulator-min-microamp = <1500000>; + regulator-max-microamp = <4000000>; + regulator-ramp-delay = <10000>; + regulator-boot-on; + regulator-always-on; + }; + + lp8733_ldo0: ldo0 { + regulator-name = "lp8733-ldo0"; + regulator-min-microvolt = <800000>; + regulator-max-microvolt = <3000000>; + regulator-boot-on; + regulator-always-on; + }; + + lp8733_ldo1: ldo1 { + regulator-name = "lp8733-ldo1"; + regulator-min-microvolt = <800000>; + regulator-max-microvolt = <3000000>; + regulator-always-on; + regulator-boot-on; + }; + }; +};
Signature · 4 lines
Lee Jones Linaro STMicroelectronics Landing Team Lead Linaro.org │ Open source software for ARM SoCs Follow Linaro: Facebook | Twitter | Blog
Quoted 46 lines · Lee Jones
Quoted 37 lines · Keerthy
The LP873X chip is a power management IC for Portable Navigation Systems
and Tablet Computing devices. It contains the following components:- Regulators.
- Configurable General Purpose Output Signals(GPO).PMIC interacts with the main processor through i2c. PMIC has couple of LDOs(Linear Regulators), couple of BUCKs (Step-Down DC-DC Converter Cores) and GPOs(General Purpose Output Signals).
Signed-off-by Keerthy <[email protected]>---
Changes in v4:
* Added Author.
* Added themfd_cellfor gpio.Changes in v3:
* Reordered the probe code.
* Fixed Typo inKconfigdescription.
* Removed unused member from struct lp873x.drivers/mfd/Kconfig | 14 +++ drivers/mfd/Makefile | 2 + drivers/mfd/lp873x.c | 99 +++++++++++++++++ include/linux/mfd/lp873x.h | 264 +++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 379 insertions(+)create mode 100644
drivers/mfd/lp873x.c
create mode 100644include/linux/mfd/lp873x.hdrivers/mfd/Kconfig +0
-0drivers/mfd/Kconfig config MFD_TPS65217 · line 1224
Quoted 4 lines
drivers/mfd/Kconfig +1
-0@@ -1221,6 +1221,20 @@ config MFD_TPS65217 This driver can also be built as a module. If so, the module will be called tps65217. +config MFD_LP873XNicer as
MFD_TI_LP873XI think.
Quoted 9 lines
drivers/mfd/Kconfig config MFD_TPS65217 · line 1231
Quoted 7 lines
drivers/mfd/Kconfig +7
-0+ tristate "TI LP873X Power Management IC" + depends on I2C + select MFD_CORE + select REGMAP_I2C + help + If you say yes here then you get support for the LP873X series of + power management integrated circuits(PMIC).Power Management Integrated Circuits (PMIC).
Okay
Quoted 5 lines
drivers/mfd/Kconfig config MFD_TPS65217 · line 1233
Quoted 3 lines
drivers/mfd/Kconfig +2
-0+ These include voltage regulators, Thermal protection, Configurable + general purpose outputs(GPO) that are used in portable devices.Some here. Please standardise your capitalisation.
Okay
Quoted 72 lines
Quoted 72 lines
drivers/mfd/Kconfig +3
-0+ This driver can also be built as a module. If so, the module + will be called lp873x. + config MFD_TPS65218 tristate "TI TPS65218 Power Management chips" depends on I2Cdrivers/mfd/Makefile +2
-0@@ -22,6 +22,8 @@ obj-$(CONFIG_HTC_EGPIO) += htc-egpio.o obj-$(CONFIG_HTC_PASIC3) += htc-pasic3.o obj-$(CONFIG_HTC_I2CPLD) += htc-i2cpld.o +obj-$(CONFIG_MFD_LP873X) += lp873x.o + obj-$(CONFIG_MFD_DAVINCI_VOICECODEC) += davinci_voicecodec.o obj-$(CONFIG_MFD_DM355EVM_MSP) += dm355evm_msp.o obj-$(CONFIG_MFD_TI_AM335X_TSCADC) += ti_am335x_tscadc.odrivers/mfd/lp873x.c new file +46
-0@@ -0,0 +1,99 @@ +/* +* Copyright (C) 2016 Texas Instruments Incorporated - http://www.ti.com/ +* +* Author: Keerthy <[email protected]> +* +* This program is free software; you can redistribute it and/or +* modify it under the terms of the GNU General Public License as +* published by the Free Software Foundation version 2. +* +* This program is distributed "as is" WITHOUT ANY WARRANTY of any +* kind, whether express or implied; without even the implied warranty +* of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +*/ + +#include <linux/interrupt.h> +#include <linux/mfd/core.h> +#include <linux/module.h> +#include <linux/of_device.h> +#include <linux/regmap.h> + +#include <linux/mfd/lp873x.h> + +static const struct regmap_config lp873x_regmap_config = { + .reg_bits =8 , + .val_bits =8 , + .max_register =LP873X_REG_MAX , +}; + +static const struct mfd_cell lp873x_cells[] = { + { .name ="lp873x-regulator" , }, + { .name ="lp873x-gpio" , }, +}; + +static int lp873x_probe (struct i2c_client *client, +const struct i2c_device_id *ids) +{ +struct lp873x *lp873; +int ret; +unsigned int otpid; + + lp873 =devm_kzalloc (&client->dev,sizeof (*lp873),GFP_KERNEL ); +if (!lp873) +return -ENOMEM ; + + lp873->dev = &client->dev;
Quoted 8 lines
drivers/mfd/lp873x.c line 52
Quoted 6 lines
drivers/mfd/lp873x.c new file +6
-0+ + lp873->regmap =devm_regmap_init_i2c (client, &lp873x_regmap_config); +if (IS_ERR (lp873->regmap)) { + ret =PTR_ERR (lp873->regmap); +dev_err (lp873->dev,"Failed to initialize register map: %d\n" , + ret);Nit: I'd prefer you break after "->dev,".
Okay
Quoted 9 lines
drivers/mfd/lp873x.c line 56
Quoted 5 lines
drivers/mfd/lp873x.c new file +4
-0+return ret; + } + +mutex_init (&lp873->lp873_lock);How many locks do you have in 'struct lp873x'?
I suggest that 'lock' will do fine.
Okay.
Quoted 20 lines
Quoted 20 lines
drivers/mfd/lp873x.c new file +19
-0+ ret =regmap_read (lp873->regmap,LP873X_REG_OTP_REV , &otpid); +if (ret) { +dev_err (lp873->dev,"Failed to read OTP ID\n" ); +return ret; + } + + lp873->rev = otpid &LP873X_OTP_REV_OTP_ID ; +i2c_set_clientdata (client, lp873); + ret =mfd_add_devices (lp873->dev,PLATFORM_DEVID_AUTO , lp873x_cells, +ARRAY_SIZE (lp873x_cells),NULL ,0 ,NULL ); + +return ret; +} + +static const struct of_device_id of_lp873x_match_table[] = { + { .compatible ="ti,lp8733" , }, + { .compatible ="ti,lp8732" , }, + {} +};
Quoted 8 lines
drivers/mfd/lp873x.c line 82
Quoted 6 lines
drivers/mfd/lp873x.c new file +6
-0+MODULE_DEVICE_TABLE (of, of_lp873x_match_table); + +static const struct i2c_device_id lp873x_id_table[] = { + {"lp873x" ,LP873X }, + {"lp8732" ,LP873X }, + {"lp8733" ,LP873X },Do you use these IDs at any point?
I have lp8733 and lp8732 at the moment. They are register exact but different parts none the less. Hence having separate strings. As of now no differences seen in gpio/regulator modules so not using them anywhere.
Quoted 3 lines
[...]
Re: [PATCH v5 1/3] Documentation: mfd: LP873X: Add information for the mfd driver
In reply to Lee JonesQuoted 7 lines · Lee Jones
Quoted 3 lines · Keerthy
The lp873x series of PMICs have a bunch of regulators and a couple of GPO(General Purpose Outputs).
Add information for the mfd and regulator drivers.Nit: s/mfd/MFD/
Okay.
Quoted 27 lines
Quoted 23 lines
Acked-by Rob Herring <[email protected]>Signed-off-by Keerthy <[email protected]>---
Changes in v4:
* Added the GPIO properties.
Changes in v3:
* Changed the example node lable to pmic from lp8733.
Documentation/devicetree/bindings/mfd/lp873x.txt | 59 ++++++++++++++++++++++++ 1 file changed, 59 insertions(+)create mode 100644
Documentation/devicetree/bindings/mfd/lp873x.txtDocumentation/devicetree/bindings/mfd/lp873x.txt new file +0
-0Documentation/devicetree/bindings/mfd/lp873x.txt line 1
Quoted 1 line
Documentation/devicetree/bindings/mfd/lp873x.txt new file +1
-0@@ -0,0 +1,59 @@ +TI LP873X MFD driver"PMIC MFD" or "MFD PMIC"
Quoted 12 lines
Documentation/devicetree/bindings/mfd/lp873x.txt line 11
Quoted 9 lines
Documentation/devicetree/bindings/mfd/lp873x.txt new file +9
-0+Required properties: + - compatible: "ti,lp8732", "ti,lp8733" + - reg: I2C slave address. + - 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. + - regulators: : List of child nodes that specify the regulator + initialization data.Please standardise your formatting here. Sometimes you do ":", other times you do " :", and oddly ": :".
Okay sure.
Quoted 50 lines
Quoted 49 lines
Documentation/devicetree/bindings/mfd/lp873x.txt new file +48
-0+Example: + +pmic: lp8733@60 { + compatible = "ti,lp8733"; + reg = <0x60>; + gpio-controller; + #gpio-cells = <2>; + + regulators { + lp8733_buck0: buck0 { + regulator-name = "lp8733-buck0"; + regulator-min-microvolt = <800000>; + regulator-max-microvolt = <1400000>; + regulator-min-microamp = <1500000>; + regulator-max-microamp = <4000000>; + regulator-ramp-delay = <10000>; + regulator-always-on; + regulator-boot-on; + }; + + lp8733_buck1: buck1 { + regulator-name = "lp8733-buck1"; + regulator-min-microvolt = <800000>; + regulator-max-microvolt = <1400000>; + regulator-min-microamp = <1500000>; + regulator-max-microamp = <4000000>; + regulator-ramp-delay = <10000>; + regulator-boot-on; + regulator-always-on; + }; + + lp8733_ldo0: ldo0 { + regulator-name = "lp8733-ldo0"; + regulator-min-microvolt = <800000>; + regulator-max-microvolt = <3000000>; + regulator-boot-on; + regulator-always-on; + }; + + lp8733_ldo1: ldo1 { + regulator-name = "lp8733-ldo1"; + regulator-min-microvolt = <800000>; + regulator-max-microvolt = <3000000>; + regulator-always-on; + regulator-boot-on; + }; + }; +};
Quoted 191 lines · Keerthy
Quoted 46 lines · Lee Jones
Quoted 37 lines · Keerthy
The LP873X chip is a power management IC for Portable Navigation Systems
and Tablet Computing devices. It contains the following components:- Regulators.
- Configurable General Purpose Output Signals(GPO).PMIC interacts with the main processor through i2c. PMIC has couple of LDOs(Linear Regulators), couple of BUCKs (Step-Down DC-DC Converter Cores) and GPOs(General Purpose Output Signals).
Signed-off-by Keerthy <[email protected]>---
Changes in v4:
* Added Author.
* Added themfd_cellfor gpio.Changes in v3:
* Reordered the probe code.
* Fixed Typo inKconfigdescription.
* Removed unused member from struct lp873x.drivers/mfd/Kconfig | 14 +++ drivers/mfd/Makefile | 2 + drivers/mfd/lp873x.c | 99 +++++++++++++++++ include/linux/mfd/lp873x.h | 264 +++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 379 insertions(+)create mode 100644
drivers/mfd/lp873x.c
create mode 100644include/linux/mfd/lp873x.hdrivers/mfd/Kconfig +0
-0drivers/mfd/Kconfig config MFD_TPS65217 · line 1224
Quoted 4 lines
drivers/mfd/Kconfig +1
-0@@ -1221,6 +1221,20 @@ config MFD_TPS65217 This driver can also be built as a module. If so, the module will be called tps65217. +config MFD_LP873XNicer as
MFD_TI_LP873XI think.Quoted 9 lines
drivers/mfd/Kconfig config MFD_TPS65217 · line 1231
Quoted 7 lines
drivers/mfd/Kconfig +7
-0+ tristate "TI LP873X Power Management IC" + depends on I2C + select MFD_CORE + select REGMAP_I2C + help + If you say yes here then you get support for the LP873X series of + power management integrated circuits(PMIC).Power Management Integrated Circuits (PMIC).
Okay
Quoted 5 lines
drivers/mfd/Kconfig config MFD_TPS65217 · line 1233
Quoted 3 lines
drivers/mfd/Kconfig +2
-0+ These include voltage regulators, Thermal protection, Configurable + general purpose outputs(GPO) that are used in portable devices.Some here. Please standardise your capitalisation.
Okay
Quoted 72 lines
Quoted 72 lines
drivers/mfd/Kconfig +3
-0+ This driver can also be built as a module. If so, the module + will be called lp873x. + config MFD_TPS65218 tristate "TI TPS65218 Power Management chips" depends on I2Cdrivers/mfd/Makefile +2
-0@@ -22,6 +22,8 @@ obj-$(CONFIG_HTC_EGPIO) += htc-egpio.o obj-$(CONFIG_HTC_PASIC3) += htc-pasic3.o obj-$(CONFIG_HTC_I2CPLD) += htc-i2cpld.o +obj-$(CONFIG_MFD_LP873X) += lp873x.o + obj-$(CONFIG_MFD_DAVINCI_VOICECODEC) += davinci_voicecodec.o obj-$(CONFIG_MFD_DM355EVM_MSP) += dm355evm_msp.o obj-$(CONFIG_MFD_TI_AM335X_TSCADC) += ti_am335x_tscadc.odrivers/mfd/lp873x.c new file +46
-0@@ -0,0 +1,99 @@ +/* +* Copyright (C) 2016 Texas Instruments Incorporated - http://www.ti.com/ +* +* Author: Keerthy <[email protected]> +* +* This program is free software; you can redistribute it and/or +* modify it under the terms of the GNU General Public License as +* published by the Free Software Foundation version 2. +* +* This program is distributed "as is" WITHOUT ANY WARRANTY of any +* kind, whether express or implied; without even the implied warranty +* of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +*/ + +#include <linux/interrupt.h> +#include <linux/mfd/core.h> +#include <linux/module.h> +#include <linux/of_device.h> +#include <linux/regmap.h> + +#include <linux/mfd/lp873x.h> + +static const struct regmap_config lp873x_regmap_config = { + .reg_bits =8 , + .val_bits =8 , + .max_register =LP873X_REG_MAX , +}; + +static const struct mfd_cell lp873x_cells[] = { + { .name ="lp873x-regulator" , }, + { .name ="lp873x-gpio" , }, +}; + +static int lp873x_probe (struct i2c_client *client, +const struct i2c_device_id *ids) +{ +struct lp873x *lp873; +int ret; +unsigned int otpid; + + lp873 =devm_kzalloc (&client->dev,sizeof (*lp873),GFP_KERNEL ); +if (!lp873) +return -ENOMEM ; + + lp873->dev = &client->dev;Quoted 8 lines
drivers/mfd/lp873x.c line 52
Quoted 6 lines
drivers/mfd/lp873x.c new file +6
-0+ + lp873->regmap =devm_regmap_init_i2c (client, &lp873x_regmap_config); +if (IS_ERR (lp873->regmap)) { + ret =PTR_ERR (lp873->regmap); +dev_err (lp873->dev,"Failed to initialize register map: %d\n" , + ret);Nit: I'd prefer you break after "->dev,".
Okay
Quoted 9 lines
drivers/mfd/lp873x.c line 56
Quoted 5 lines
drivers/mfd/lp873x.c new file +4
-0+return ret; + } + +mutex_init (&lp873->lp873_lock);How many locks do you have in 'struct lp873x'?
I suggest that 'lock' will do fine.
Okay.
Quoted 20 lines
Quoted 20 lines
drivers/mfd/lp873x.c new file +19
-0+ ret =regmap_read (lp873->regmap,LP873X_REG_OTP_REV , &otpid); +if (ret) { +dev_err (lp873->dev,"Failed to read OTP ID\n" ); +return ret; + } + + lp873->rev = otpid &LP873X_OTP_REV_OTP_ID ; +i2c_set_clientdata (client, lp873); + ret =mfd_add_devices (lp873->dev,PLATFORM_DEVID_AUTO , lp873x_cells, +ARRAY_SIZE (lp873x_cells),NULL ,0 ,NULL ); + +return ret; +} + +static const struct of_device_id of_lp873x_match_table[] = { + { .compatible ="ti,lp8733" , }, + { .compatible ="ti,lp8732" , }, + {} +};Quoted 8 lines
drivers/mfd/lp873x.c line 82
Quoted 6 lines
drivers/mfd/lp873x.c new file +6
-0+MODULE_DEVICE_TABLE (of, of_lp873x_match_table); + +static const struct i2c_device_id lp873x_id_table[] = { + {"lp873x" ,LP873X }, + {"lp8732" ,LP873X }, + {"lp8733" ,LP873X },Do you use these IDs at any point?
Quoted 3 lines
I have lp8733 and lp8732 at the moment. They are register exact but different parts none the less. Hence having separate strings. As of now no differences seen in gpio/regulator modules so not using them anywhere.
I have a patch-set pending on the I2C list that removes all unused 'struct i2c_device_id' tables. To identify which ones are in use and which ones can be removed, it would help if you could remove the unused .id field.
Signature · 4 lines
Lee Jones Linaro STMicroelectronics Landing Team Lead Linaro.org │ Open source software for ARM SoCs Follow Linaro: Facebook | Twitter | Blog
Quoted 192 lines · Lee Jones
Quoted 191 lines · Keerthy
Quoted 46 lines · Lee Jones
Quoted 37 lines · Keerthy
The LP873X chip is a power management IC for Portable Navigation Systems
and Tablet Computing devices. It contains the following components:- Regulators.
- Configurable General Purpose Output Signals(GPO).PMIC interacts with the main processor through i2c. PMIC has couple of LDOs(Linear Regulators), couple of BUCKs (Step-Down DC-DC Converter Cores) and GPOs(General Purpose Output Signals).
Signed-off-by Keerthy <[email protected]>---
Changes in v4:
* Added Author.
* Added themfd_cellfor gpio.Changes in v3:
* Reordered the probe code.
* Fixed Typo inKconfigdescription.
* Removed unused member from struct lp873x.drivers/mfd/Kconfig | 14 +++ drivers/mfd/Makefile | 2 + drivers/mfd/lp873x.c | 99 +++++++++++++++++ include/linux/mfd/lp873x.h | 264 +++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 379 insertions(+)create mode 100644
drivers/mfd/lp873x.c
create mode 100644include/linux/mfd/lp873x.hdrivers/mfd/Kconfig +0
-0drivers/mfd/Kconfig config MFD_TPS65217 · line 1224
Quoted 4 lines
drivers/mfd/Kconfig +1
-0@@ -1221,6 +1221,20 @@ config MFD_TPS65217 This driver can also be built as a module. If so, the module will be called tps65217. +config MFD_LP873XNicer as
MFD_TI_LP873XI think.Quoted 9 lines
drivers/mfd/Kconfig config MFD_TPS65217 · line 1231
Quoted 7 lines
drivers/mfd/Kconfig +7
-0+ tristate "TI LP873X Power Management IC" + depends on I2C + select MFD_CORE + select REGMAP_I2C + help + If you say yes here then you get support for the LP873X series of + power management integrated circuits(PMIC).Power Management Integrated Circuits (PMIC).
Okay
Quoted 5 lines
drivers/mfd/Kconfig config MFD_TPS65217 · line 1233
Quoted 3 lines
drivers/mfd/Kconfig +2
-0+ These include voltage regulators, Thermal protection, Configurable + general purpose outputs(GPO) that are used in portable devices.Some here. Please standardise your capitalisation.
Okay
Quoted 72 lines
Quoted 72 lines
drivers/mfd/Kconfig +3
-0+ This driver can also be built as a module. If so, the module + will be called lp873x. + config MFD_TPS65218 tristate "TI TPS65218 Power Management chips" depends on I2Cdrivers/mfd/Makefile +2
-0@@ -22,6 +22,8 @@ obj-$(CONFIG_HTC_EGPIO) += htc-egpio.o obj-$(CONFIG_HTC_PASIC3) += htc-pasic3.o obj-$(CONFIG_HTC_I2CPLD) += htc-i2cpld.o +obj-$(CONFIG_MFD_LP873X) += lp873x.o + obj-$(CONFIG_MFD_DAVINCI_VOICECODEC) += davinci_voicecodec.o obj-$(CONFIG_MFD_DM355EVM_MSP) += dm355evm_msp.o obj-$(CONFIG_MFD_TI_AM335X_TSCADC) += ti_am335x_tscadc.odrivers/mfd/lp873x.c new file +46
-0@@ -0,0 +1,99 @@ +/* +* Copyright (C) 2016 Texas Instruments Incorporated - http://www.ti.com/ +* +* Author: Keerthy <[email protected]> +* +* This program is free software; you can redistribute it and/or +* modify it under the terms of the GNU General Public License as +* published by the Free Software Foundation version 2. +* +* This program is distributed "as is" WITHOUT ANY WARRANTY of any +* kind, whether express or implied; without even the implied warranty +* of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +*/ + +#include <linux/interrupt.h> +#include <linux/mfd/core.h> +#include <linux/module.h> +#include <linux/of_device.h> +#include <linux/regmap.h> + +#include <linux/mfd/lp873x.h> + +static const struct regmap_config lp873x_regmap_config = { + .reg_bits =8 , + .val_bits =8 , + .max_register =LP873X_REG_MAX , +}; + +static const struct mfd_cell lp873x_cells[] = { + { .name ="lp873x-regulator" , }, + { .name ="lp873x-gpio" , }, +}; + +static int lp873x_probe (struct i2c_client *client, +const struct i2c_device_id *ids) +{ +struct lp873x *lp873; +int ret; +unsigned int otpid; + + lp873 =devm_kzalloc (&client->dev,sizeof (*lp873),GFP_KERNEL ); +if (!lp873) +return -ENOMEM ; + + lp873->dev = &client->dev;Quoted 8 lines
drivers/mfd/lp873x.c line 52
Quoted 6 lines
drivers/mfd/lp873x.c new file +6
-0+ + lp873->regmap =devm_regmap_init_i2c (client, &lp873x_regmap_config); +if (IS_ERR (lp873->regmap)) { + ret =PTR_ERR (lp873->regmap); +dev_err (lp873->dev,"Failed to initialize register map: %d\n" , + ret);Nit: I'd prefer you break after "->dev,".
Okay
Quoted 9 lines
drivers/mfd/lp873x.c line 56
Quoted 5 lines
drivers/mfd/lp873x.c new file +4
-0+return ret; + } + +mutex_init (&lp873->lp873_lock);How many locks do you have in 'struct lp873x'?
I suggest that 'lock' will do fine.
Okay.
Quoted 28 lines
Quoted 16 lines
drivers/mfd/lp873x.c new file +15
-0+ ret =regmap_read (lp873->regmap,LP873X_REG_OTP_REV , &otpid); +if (ret) { +dev_err (lp873->dev,"Failed to read OTP ID\n" ); +return ret; + } + + lp873->rev = otpid &LP873X_OTP_REV_OTP_ID ; +i2c_set_clientdata (client, lp873); + ret =mfd_add_devices (lp873->dev,PLATFORM_DEVID_AUTO , lp873x_cells, +ARRAY_SIZE (lp873x_cells),NULL ,0 ,NULL ); + +return ret; +} + +static const struct of_device_id of_lp873x_match_table[] = {drivers/mfd/lp873x.c line 82
Quoted 10 lines
drivers/mfd/lp873x.c new file +10
-0+ { .compatible = "ti,lp8733", }, + { .compatible = "ti,lp8732", }, + {} +}; +MODULE_DEVICE_TABLE (of, of_lp873x_match_table); + +static const struct i2c_device_id lp873x_id_table[] = { + {"lp873x" ,LP873X }, + {"lp8732" ,LP873X }, + { "lp8733", LP873X },Do you use these IDs at any point?
Quoted 8 lines
Quoted 3 lines
I have lp8733 and lp8732 at the moment. They are register exact but different parts none the less. Hence having separate strings. As of now no differences seen in gpio/regulator modules so not using them anywhere.
I have a patch-set pending on the I2C list that removes all unused 'struct
i2c_device_id' tables. To identify which ones are in use and which ones can be removed, it would help if you could remove the unused .id field.
I guess you are referring to this:
http://www.gossamer-threads.com/lists/linux/kernel/2457552
I applied the above series and i see that by using driver_new in lp873x
MFD driver i no longer need the mandatory i2c_device_id. Thanks.
I will send a series on top of your i2c set v5 without any unused device_id. I will add a dependency on your set.
Thanks and Regards,
Keerthy
Quoted 1 line
--
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
Quoted 36 lines · Keerthy
Quoted 35 lines · Lee Jones
Quoted 34 lines · Keerthy
Quoted 33 lines · Lee Jones
Quoted 31 lines · Keerthy
The LP873X chip is a power management IC for Portable Navigation Systems
and Tablet Computing devices. It contains the following components:- Regulators.
- Configurable General Purpose Output Signals(GPO).PMIC interacts with the main processor through i2c. PMIC has couple of LDOs(Linear Regulators), couple of BUCKs (Step-Down DC-DC Converter Cores) and GPOs(General Purpose Output Signals).
Signed-off-by Keerthy <[email protected]>---
Changes in v4:
* Added Author.
* Added themfd_cellfor gpio.Changes in v3:
* Reordered the probe code.
* Fixed Typo inKconfigdescription.
* Removed unused member from struct lp873x.drivers/mfd/Kconfig | 14 +++ drivers/mfd/Makefile | 2 + drivers/mfd/lp873x.c | 99 +++++++++++++++++ include/linux/mfd/lp873x.h | 264 +++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 379 insertions(+)create mode 100644
drivers/mfd/lp873x.c
create mode 100644include/linux/mfd/lp873x.h
[...]
Quoted 16 lines
Quoted 7 lines
Quoted 7 lines
Quoted 6 lines
drivers/mfd/lp873x.c line 82
Quoted 4 lines
drivers/mfd/lp873x.c new file +4
-0+static const struct i2c_device_id lp873x_id_table[] = { + {"lp873x" ,LP873X }, + {"lp8732" ,LP873X }, + {"lp8733" ,LP873X },Do you use these IDs at any point?
Quoted 8 lines
Quoted 3 lines
I have lp8733 and lp8732 at the moment. They are register exact but different parts none the less. Hence having separate strings. As of now no differences seen in gpio/regulator modules so not using them anywhere.
I have a patch-set pending on the I2C list that removes all unused 'struct
i2c_device_id' tables. To identify which ones are in use and which ones can be removed, it would help if you could remove the unused .id field.
Quoted 8 lines
I guess you are referring to this:
http://www.gossamer-threads.com/lists/linux/kernel/2457552
I applied the above series and i see that by using
driver_newin lp873x MFD driver i no longer need the mandatoryi2c_device_id. Thanks. I will send a series on top of your i2c set v5 without any unuseddevice_id. I will add a dependency on your set.
I would not do that if I were you. That set has been pending for years. I'm just saying, when that patch-set is accepted, it will be easier to identify removable tables if they do not contain populated, but unused .id entries.
Signature · 4 lines
Lee Jones Linaro STMicroelectronics Landing Team Lead Linaro.org │ Open source software for ARM SoCs Follow Linaro: Facebook | Twitter | Blog