lp872x: remove platform_data based probing and adjustments
Subsystems (2)
v2 cover lp872x: remove platform_data based probing and adjustments
Upgrade schema. Consolidate driver file, remove platform_data based probing and add missing regulator/chip supplies.
---
Changes in v2:
- dt changes applied to new schema
- read dvs vsel and state into local values first
- use dev_err_probe in lp872x_init_dvs()
- rely on ti,general-config and remove ti,update-config prop
---
Svyatoslav Ryhel (7):
regulator: dt-bindings: ti,lp872x: Deprecate ti,dvs-gpio and
ti,update-config
regulator: dt-bindings: ti,lp872x: Document input supplies
regulator: lp872x: Fold driver header into driver file
regulator: lp872x: Remove redundant regmap wrappers
regulator: lp872x: Remove platform_data based probing
regulator: lp872x: Add support for input and regulator power supplies
regulator: lp872x: Use macro to fill regulator descriptor
.../bindings/regulator/ti,lp872x.yaml | 18 + drivers/regulator/lp872x.c | 672 ++++++------------ include/linux/regulator/lp872x.h | 86 --- 3 files changed, 229 insertions(+), 547 deletions(-) delete mode 100644 include/linux/regulator/lp872x.h
Signature · 1 line
2.53.0
PATCH v2 1/7 regulator: dt-bindings: ti,lp872x: Deprecate ti,dvs-gpio and ti,update-config
Mark ti,dvs-gpio as deprecated in favor of using dvs-gpio property. The ti,dvs-gpio is not used in any of existing in kernel device trees anyway, so this should not break any tree. Mark ti,update-config deprecated in favor of using the presence of the ti,general-config property as a trigger to update.
--- Documentation/devicetree/bindings/regulator/ti,lp872x.yaml | 6 ++++++ 1 file changed, 6 insertions(+)
Documentation/devicetree/bindings/regulator/ti,lp872x.yaml +6 -0
@@ -47,10 +47,12 @@ properties: ti,update-config: type: boolean + deprecated: true description: define it when LP872X_GENERAL_CFG register should be set ti,dvs-gpio: maxItems: 1 + deprecated: true description: GPIO specifier for external DVS pin control of LP872x devices. ti,dvs-vsel:
@@ -67,6 +69,10 @@ properties: maxItems: 1 description: GPIO specifier for EN pin control of LP872x devices. + dvs-gpios: + description: GPIO specifier for external DVS pin control. + maxItems: 1 + buck: type: object $ref: regulator.yaml#
Signature · 1 line
2.53.0
[email protected]
AI reviewRe: [PATCH v2 1/7] regulator: dt-bindings: ti,lp872x: Deprecate ti,dvs-gpio and ti,update-config
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider: - [Low] dt-bindings: regulator: ti,lp872x: Deprecated ti,update-config remains in example --
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Low] dt-bindings: regulator: ti,lp872x: Deprecated ti,update-config remains in example --
commit 308202c795df4f41c7d2f8aff005747332d2dc21
Author: Svyatoslav Ryhel <[email protected]>
regulator: dt-bindings: ti,lp872x: Deprecate ti,dvs-gpio and ti,update-config
This commit marks ti,dvs-gpio and ti,update-config as deprecated in favor of using dvs-gpios and the presence of ti,general-config as a trigger to update.
Documentation/devicetree/bindings/regulator/ti,lp872x.yaml properties: · line 51
Quoted 10 lines
Documentation/devicetree/bindings/regulator/ti,lp872x.yaml +1
-0@@ -47,10 +47,12 @@ properties: ti,update-config: type: boolean + deprecated: true description: define it when LP872X_GENERAL_CFG register should be set
[Severity: Low]
Does this deprecated property need to be removed from the example block in this binding?
Documentation/devicetree/bindings/regulator/ti,lp872x.yaml:examples
examples:
- |
#include <dt-bindings/gpio/gpio.h>
i2c {
...
pmic@7a {
compatible = "ti,lp8725";
reg = <0x7a>;
/* Enable BUCK1,2, no DVS, normal LDO mode, timestep is 256usec */
ti,general-config = /bits/ 8 <0xdd>;
ti,update-config;Leaving deprecated properties in the example might encourage developers to copy deprecated code into new device trees.
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=1
PATCH v2 2/7 regulator: dt-bindings: ti,lp872x: Document input supplies
In reply to Svyatoslav RyhelDocument input supplies of TI LP8720 and LP8725.
--- .../devicetree/bindings/regulator/ti,lp872x.yaml | 12 ++++++++++++ 1 file changed, 12 insertions(+)
Documentation/devicetree/bindings/regulator/ti,lp872x.yaml +12 -0
@@ -81,6 +81,16 @@ properties: Single BUCK regulator for LP8720. patternProperties: + "^(vbatt|vin([1-3]|b|lilo[1-2]))-supply$": + $ref: /schemas/types.yaml#/definitions/phandle + description: | + vbatt - input supply for ldo1 and all internal circuitry (lp8720 only). + vin1 - input supply for ldo2 - ldo3 (lp8720) or ldo1 (lp8725). + vin2 - input supply for ldo4 - ldo5 (lp8720) or ldo2 - ldo3 (lp8725). + vin3 - input supply for ldo4 - ldo5 (lp8725). + vinb - input supply for buck. + vinlilo1 and vinlilo2 - input supply for lilo1 and lilo2. + "^(buck[1-2]?|ldo[1-5]|lilo[1-2])$": type: object $ref: regulator.yaml#
@@ -101,6 +111,7 @@ allOf: reg: const: 0x7d patternProperties: + "^(vin(3|lilo[1-2]))-supply$": false "^(buck[1-2]|lilo[1-2])$": false - if:
@@ -112,6 +123,7 @@ allOf: properties: reg: const: 0x7a + vbatt-supply: false buck: false additionalProperties: false
Signature · 1 line
2.53.0
PATCH v2 3/7 regulator: lp872x: Fold driver header into driver file
In reply to Svyatoslav RyhelRemove need in header file in preparation for pdata probing removal.
--- drivers/regulator/lp872x.c | 54 +++++++++++++++++++- include/linux/regulator/lp872x.h | 86 -------------------------------- 2 files changed, 53 insertions(+), 87 deletions(-) delete mode 100644 include/linux/regulator/lp872x.h
drivers/regulator/lp872x.c +53 -1
@@ -12,10 +12,10 @@#include <linux/err.h> #include <linux/gpio/consumer.h> #include <linux/delay.h> -#include <linux/regulator/lp872x.h> #include <linux/regulator/driver.h> #include <linux/platform_device.h> #include <linux/of.h> +#include <linux/regulator/machine.h> #include <linux/regulator/of_regulator.h> /* Registers : LP8720/8725 shared */
@@ -92,11 +92,63 @@/* dump registers in regmap-debugfs */ #define MAX_REGISTERS 0x0F +#define LP872X_MAX_REGULATORS 9 + +#define LP8720_ENABLE_DELAY 200 +#define LP8725_ENABLE_DELAY 30000 +enum lp872x_id {LP8720 ,LP8725 , }; +enum lp872x_regulator_id { +LP8720_ID_BASE , +LP8720_ID_LDO1 =LP8720_ID_BASE , +LP8720_ID_LDO2 , +LP8720_ID_LDO3 , +LP8720_ID_LDO4 , +LP8720_ID_LDO5 , +LP8720_ID_BUCK , + +LP8725_ID_BASE , +LP8725_ID_LDO1 =LP8725_ID_BASE , +LP8725_ID_LDO2 , +LP8725_ID_LDO3 , +LP8725_ID_LDO4 , +LP8725_ID_LDO5 , +LP8725_ID_LILO1 , +LP8725_ID_LILO2 , +LP8725_ID_BUCK1 , +LP8725_ID_BUCK2 , + +LP872X_ID_MAX , +}; + +enum lp872x_dvs_sel { +SEL_V1 , +SEL_V2 , +}; + +struct lp872x_dvs { +struct gpio_desc *gpio; +enum lp872x_dvs_sel vsel; +enum gpiod_flags init_state; +}; + +struct lp872x_regulator_data { +enum lp872x_regulator_id id; +struct regulator_init_data *init_data; +}; + +struct lp872x_platform_data { +u8 general_config; +bool update_config; +struct lp872x_regulator_data regulator_data[LP872X_MAX_REGULATORS ]; +struct lp872x_dvs *dvs; +struct gpio_desc *enable_gpio; +}; +struct lp872x {struct regmap *regmap;struct device *dev;
include/linux/regulator/lp872x.h deleted +0 -86
86 lines not on this page · raw message
Signature · 1 line
2.53.0
PATCH v2 4/7 regulator: lp872x: Remove redundant regmap wrappers
In reply to Svyatoslav RyhelRemove lp872x_read_byte(), lp872x_write_byte(), and lp872x_update_bits() helpers which are just wrappers around the same regmap helpers.
--- drivers/regulator/lp872x.c | 66 ++++++++++++-------------------------- 1 file changed, 20 insertions(+), 46 deletions(-)
drivers/regulator/lp872x.c +20 -46
@@ -204,36 +204,10 @@ static const unsigned int lp8725_buck_uA[] = { 460000, 780000, 1050000, 1370000, }; -static int lp872x_read_byte (struct lp872x *lp,u8 addr,u8 *data) -{ -int ret; -unsigned int val; - - ret =regmap_read (lp->regmap, addr, &val); -if (ret <0 ) { -dev_err (lp->dev,"failed to read 0x%.2x\n" , addr); -return ret; - } - - *data = (u8 )val; -return 0 ; -} - -static inline int lp872x_write_byte (struct lp872x *lp,u8 addr,u8 data) -{ -return regmap_write (lp->regmap, addr, data); -} - -static inline int lp872x_update_bits (struct lp872x *lp,u8 addr, -unsigned int mask,u8 data) -{ -return regmap_update_bits (lp->regmap, addr, mask, data); -} -static int lp872x_get_timestep_usec (struct lp872x *lp) {enum lp872x_id chip = lp->chipid; -u8 val, mask, shift; +u32 val, mask, shift;int *time_usec, size, ret;int lp8720_time_usec[] = {25 ,50 };int lp8725_time_usec[] = {32 ,64 ,128 ,256 };
@@ -255,7 +229,7 @@ static int lp872x_get_timestep_usec(struct lp872x *lp)return -EINVAL ; } - ret =lp872x_read_byte (lp,LP872X_GENERAL_CFG , &val); + ret =regmap_read (lp->regmap,LP872X_GENERAL_CFG , &val);if (ret)return ret;
@@ -272,7 +246,7 @@ static int lp872x_regulator_enable_time(struct regulator_dev *rdev)enum lp872x_regulator_id rid =rdev_get_id (rdev);int time_step_us =lp872x_get_timestep_usec (lp);int ret; -u8 addr, val; +u32 addr, val;if (time_step_us <0 )return time_step_us;
@@ -291,7 +265,7 @@ static int lp872x_regulator_enable_time(struct regulator_dev *rdev)return -EINVAL ; } - ret =lp872x_read_byte (lp, addr, &val); + ret =regmap_read (lp->regmap, addr, &val);if (ret)return ret;
@@ -313,9 +287,9 @@ static void lp872x_set_dvs(struct lp872x *lp, enum lp872x_dvs_sel dvs_sel,static u8 lp872x_select_buck_vout_addr (struct lp872x *lp,enum lp872x_regulator_id buck) { -u8 val, addr; +u32 val, addr; -if (lp872x_read_byte (lp,LP872X_GENERAL_CFG , &val)) +if (regmap_read (lp->regmap,LP872X_GENERAL_CFG , &val))return 0 ;switch (buck) {
@@ -324,7 +298,7 @@ static u8 lp872x_select_buck_vout_addr(struct lp872x *lp, addr = (lp->dvs_pin ==GPIOD_OUT_HIGH ) ?LP8720_BUCK_VOUT1 :LP8720_BUCK_VOUT2 ; }else { -if (lp872x_read_byte (lp,LP8720_ENABLE , &val)) +if (regmap_read (lp->regmap,LP8720_ENABLE , &val))return 0 ; addr = val & LP8720_DVS_SEL_M ?
@@ -369,7 +343,7 @@ static int lp872x_buck_set_voltage_sel(struct regulator_dev *rdev, {struct lp872x *lp =rdev_get_drvdata (rdev);enum lp872x_regulator_id buck =rdev_get_id (rdev); -u8 addr, mask =LP872X_VOUT_M ; +u32 addr, mask =LP872X_VOUT_M ;struct lp872x_dvs *dvs = lp->pdata ? lp->pdata->dvs :NULL ;if (dvs && dvs->gpio)
@@ -379,21 +353,21 @@ static int lp872x_buck_set_voltage_sel(struct regulator_dev *rdev,if (!lp872x_is_valid_buck_addr (addr))return -EINVAL ; -return lp872x_update_bits (lp, addr, mask, selector); +return regmap_update_bits (lp->regmap, addr, mask, selector); }static int lp872x_buck_get_voltage_sel (struct regulator_dev *rdev) {struct lp872x *lp =rdev_get_drvdata (rdev);enum lp872x_regulator_id buck =rdev_get_id (rdev); -u8 addr, val; +u32 addr, val;int ret; addr =lp872x_select_buck_vout_addr (lp, buck);if (!lp872x_is_valid_buck_addr (addr))return -EINVAL ; - ret =lp872x_read_byte (lp, addr, &val); + ret =regmap_read (lp->regmap, addr, &val);if (ret)return ret;
@@ -404,7 +378,7 @@ static int lp872x_buck_set_mode(struct regulator_dev *rdev, unsigned int mode) {struct lp872x *lp =rdev_get_drvdata (rdev);enum lp872x_regulator_id buck =rdev_get_id (rdev); -u8 addr, mask, shift, val; +u32 addr, mask, shift, val;switch (buck) {case LP8720_ID_BUCK :
@@ -433,14 +407,14 @@ static int lp872x_buck_set_mode(struct regulator_dev *rdev, unsigned int mode)else return -EINVAL ; -return lp872x_update_bits (lp, addr, mask, val); +return regmap_update_bits (lp->regmap, addr, mask, val); }static unsigned int lp872x_buck_get_mode (struct regulator_dev *rdev) {struct lp872x *lp =rdev_get_drvdata (rdev);enum lp872x_regulator_id buck =rdev_get_id (rdev); -u8 addr, mask, val; +u32 addr, mask, val;int ret;switch (buck) {
@@ -460,7 +434,7 @@ static unsigned int lp872x_buck_get_mode(struct regulator_dev *rdev)return -EINVAL ; } - ret =lp872x_read_byte (lp, addr, &val); + ret =regmap_read (lp->regmap, addr, &val);if (ret)return ret;
@@ -728,8 +702,8 @@ static int lp872x_init_dvs(struct lp872x *lp) {struct lp872x_dvs *dvs = lp->pdata ? lp->pdata->dvs :NULL ;enum gpiod_flags pinstate; -u8 mask[] = {LP8720_EXT_DVS_M ,LP8725_DVS1_M |LP8725_DVS2_M }; -u8 default_dvs_mode[] = {LP8720_DEFAULT_DVS ,LP8725_DEFAULT_DVS }; +u32 mask[] = {LP8720_EXT_DVS_M ,LP8725_DVS1_M |LP8725_DVS2_M }; +u32 default_dvs_mode[] = {LP8720_DEFAULT_DVS ,LP8725_DEFAULT_DVS };if (!dvs) goto set_default_dvs_mode;
@@ -750,8 +724,8 @@ static int lp872x_init_dvs(struct lp872x *lp)return 0 ; set_default_dvs_mode: -return lp872x_update_bits (lp,LP872X_GENERAL_CFG , mask[lp->chipid], - default_dvs_mode[lp->chipid]); +return regmap_update_bits (lp->regmap,LP872X_GENERAL_CFG , mask[lp->chipid], + default_dvs_mode[lp->chipid]); }static int lp872x_hw_enable (struct lp872x *lp)
@@ -786,7 +760,7 @@ static int lp872x_config(struct lp872x *lp)if (!pdata || !pdata->update_config) goto init_dvs; - ret =lp872x_write_byte (lp,LP872X_GENERAL_CFG , pdata->general_config); + ret =regmap_write (lp->regmap,LP872X_GENERAL_CFG , pdata->general_config);if (ret)return ret;
Signature · 1 line
2.53.0
PATCH v2 5/7 regulator: lp872x: Remove platform_data based probing
In reply to Svyatoslav RyhelThe platform_data-based probing is tightly integrated into the lp872x driver structure itself; removing just the platform data support is impossible without remodeling major parts of the probe sequence.
The lp872x_platform_data structure was removed, and its contents were incorporated into the driver private structure and lp872x_chip_info (which holds differences between the LP8720 and LP8725). The lp872x_populate_pdata_from_dt() helper was removed: general Device Tree parsing code was integrated directly into the probe function, and DVS-related code was consolidated into lp872x_init_dvs(). lp872x_hw_enable() and lp872x_config() helpers were folded into probe(). i2c_client_get_device_id() was switched to i2c_get_match_data(). Finally, of_regulator_match structures were dropped, and lp872x_regulator_register() was upgraded to rely on the core regulator registration framework.
--- drivers/regulator/lp872x.c | 327 +++++++++++-------------------------- 1 file changed, 91 insertions(+), 236 deletions(-)
drivers/regulator/lp872x.c +91 -236
@@ -14,7 +14,7 @@#include <linux/delay.h> #include <linux/regulator/driver.h> #include <linux/platform_device.h> -#include <linux/of.h> +#include <linux/property.h> #include <linux/regulator/machine.h> #include <linux/regulator/of_regulator.h>
@@ -92,8 +92,6 @@/* dump registers in regmap-debugfs */ #define MAX_REGISTERS 0x0F -#define LP872X_MAX_REGULATORS 9 -#define LP8720_ENABLE_DELAY 200#define LP8725_ENABLE_DELAY 30000
@@ -130,31 +128,22 @@ enum lp872x_dvs_sel { SEL_V2, }; -struct lp872x_dvs { -struct gpio_desc *gpio; -enum lp872x_dvs_sel vsel; -enum gpiod_flags init_state; -}; - -struct lp872x_regulator_data { -enum lp872x_regulator_id id; -struct regulator_init_data *init_data; -}; - -struct lp872x_platform_data { -u8 general_config; -bool update_config; -struct lp872x_regulator_data regulator_data[LP872X_MAX_REGULATORS ]; -struct lp872x_dvs *dvs; -struct gpio_desc *enable_gpio; +struct lp872x_chip_info { +const struct regulator_desc *rdesc; +int num_regulators; +enum lp872x_id chipid; };struct lp872x {struct regmap *regmap;struct device *dev; -enum lp872x_id chipid; -struct lp872x_platform_data *pdata; -int num_regulators; + +struct gpio_desc *enable_gpio; +struct gpio_desc *dvs_gpio; + +const struct lp872x_chip_info *info; + +enum lp872x_dvs_sel vsel;enum gpiod_flags dvs_pin; };
@@ -206,7 +195,7 @@ static const unsigned int lp8725_buck_uA[] = {static int lp872x_get_timestep_usec (struct lp872x *lp) { -enum lp872x_id chip = lp->chipid; +enum lp872x_id chip = lp->info->chipid;u32 val, mask, shift;int *time_usec, size, ret;int lp8720_time_usec[] = {25 ,50 };
@@ -344,10 +333,9 @@ static int lp872x_buck_set_voltage_sel(struct regulator_dev *rdev,struct lp872x *lp =rdev_get_drvdata (rdev);enum lp872x_regulator_id buck =rdev_get_id (rdev);u32 addr, mask =LP872X_VOUT_M ; -struct lp872x_dvs *dvs = lp->pdata ? lp->pdata->dvs :NULL ; -if (dvs && dvs->gpio) -lp872x_set_dvs (lp, dvs->vsel, dvs->gpio); +if (lp->dvs_gpio) +lp872x_set_dvs (lp, lp->vsel, lp->dvs_gpio); addr =lp872x_select_buck_vout_addr (lp, buck);if (!lp872x_is_valid_buck_addr (addr))
@@ -700,110 +688,47 @@ static const struct regulator_desc lp8725_regulator_desc[] = {static int lp872x_init_dvs (struct lp872x *lp) { -struct lp872x_dvs *dvs = lp->pdata ? lp->pdata->dvs :NULL ; -enum gpiod_flags pinstate; +struct device *dev = lp->dev;u32 mask[] = {LP8720_EXT_DVS_M ,LP8725_DVS1_M |LP8725_DVS2_M };u32 default_dvs_mode[] = {LP8720_DEFAULT_DVS ,LP8725_DEFAULT_DVS }; +u8 state =1 ; +u8 vsel =SEL_V1 ; -if (!dvs) - goto set_default_dvs_mode; +device_property_read_u8 (dev,"ti,dvs-vsel" , &vsel); + lp->vsel = vsel; -if (!dvs->gpio) - goto set_default_dvs_mode; +device_property_read_u8 (dev,"ti,dvs-state" , &state); + lp->dvs_pin = state ?GPIOD_OUT_HIGH :GPIOD_OUT_LOW ; - pinstate = dvs->init_state; - dvs->gpio =devm_gpiod_get_optional (lp->dev,"ti,dvs" , pinstate); + lp->dvs_gpio =devm_gpiod_get_optional (dev,"dvs" , lp->dvs_pin); +if (IS_ERR (lp->dvs_gpio)) +return dev_err_probe (dev,PTR_ERR (lp->dvs_gpio), +"Failed to request DVS GPIO\n" ); -if (IS_ERR (dvs->gpio)) { -dev_err (lp->dev,"gpio request err: %ld\n" ,PTR_ERR (dvs->gpio)); -return PTR_ERR (dvs->gpio); - } - - lp->dvs_pin = pinstate; +if (!lp->dvs_gpio) +return regmap_update_bits (lp->regmap,LP872X_GENERAL_CFG , + mask[lp->info->chipid], + default_dvs_mode[lp->info->chipid]);return 0 ; - -set_default_dvs_mode: -return regmap_update_bits (lp->regmap,LP872X_GENERAL_CFG , mask[lp->chipid], - default_dvs_mode[lp->chipid]); -} - -static int lp872x_hw_enable (struct lp872x *lp) -{ -if (!lp->pdata) -return -EINVAL ; - -if (!lp->pdata->enable_gpio) -return 0 ; - -/* Always set enable GPIO high. */ - lp->pdata->enable_gpio =devm_gpiod_get_optional (lp->dev,"enable" ,GPIOD_OUT_HIGH ); -if (IS_ERR (lp->pdata->enable_gpio)) { -dev_err (lp->dev,"gpio request err: %ld\n" ,PTR_ERR (lp->pdata->enable_gpio)); -return PTR_ERR (lp->pdata->enable_gpio); - } - -/* Each chip has a different enable delay. */ -if (lp->chipid ==LP8720 ) -usleep_range (LP8720_ENABLE_DELAY ,1.5 *LP8720_ENABLE_DELAY ); -else -usleep_range (LP8725_ENABLE_DELAY ,1.5 *LP8725_ENABLE_DELAY ); - -return 0 ; -} - -static int lp872x_config (struct lp872x *lp) -{ -struct lp872x_platform_data *pdata = lp->pdata; -int ret; - -if (!pdata || !pdata->update_config) - goto init_dvs; - - ret =regmap_write (lp->regmap,LP872X_GENERAL_CFG , pdata->general_config); -if (ret) -return ret; - -init_dvs: -return lp872x_init_dvs (lp); -} - -static struct regulator_init_data -*lp872x_find_regulator_init_data (int id,struct lp872x *lp) -{ -struct lp872x_platform_data *pdata = lp->pdata; -int i; - -if (!pdata) -return NULL ; - -for (i =0 ; i < lp->num_regulators; i++) { -if (pdata->regulator_data[i].id == id) -return pdata->regulator_data[i].init_data; - } - -return NULL ; }static int lp872x_regulator_register (struct lp872x *lp) { -const struct regulator_desc *desc; +const struct regulator_desc *desc = lp->info->rdesc; +int num_regulators = lp->info->num_regulators;struct regulator_config cfg = { }; +struct device *dev = lp->dev;struct regulator_dev *rdev; -int i; - -for (i =0 ; i < lp->num_regulators; i++) { - desc = (lp->chipid ==LP8720 ) ? &lp8720_regulator_desc[i] : - &lp8725_regulator_desc[i]; - cfg.dev = lp->dev; - cfg.init_data =lp872x_find_regulator_init_data (desc->id, lp); - cfg.driver_data = lp; - cfg.regmap = lp->regmap; + cfg.dev = dev; + cfg.driver_data = lp; + cfg.regmap = lp->regmap; - rdev =devm_regulator_register (lp->dev, desc, &cfg); +for (int i =0 ; i < num_regulators; i++) { + rdev =devm_regulator_register (dev, &desc[i], &cfg);if (IS_ERR (rdev)) { -dev_err (lp->dev,"regulator register err" ); +dev_err (dev,"regulator register err" );return PTR_ERR (rdev); } }
@@ -817,152 +742,82 @@ static const struct regmap_config lp872x_regmap_config = { .max_register = MAX_REGISTERS, }; -#ifdef CONFIG_OF - -#define LP872X_VALID_OPMODE (REGULATOR_MODE_FAST | REGULATOR_MODE_NORMAL) - -static struct of_regulator_match lp8720_matches[] = { - { .name ="ldo1" , .driver_data = (void *)LP8720_ID_LDO1 , }, - { .name ="ldo2" , .driver_data = (void *)LP8720_ID_LDO2 , }, - { .name ="ldo3" , .driver_data = (void *)LP8720_ID_LDO3 , }, - { .name ="ldo4" , .driver_data = (void *)LP8720_ID_LDO4 , }, - { .name ="ldo5" , .driver_data = (void *)LP8720_ID_LDO5 , }, - { .name ="buck" , .driver_data = (void *)LP8720_ID_BUCK , }, -}; - -static struct of_regulator_match lp8725_matches[] = { - { .name ="ldo1" , .driver_data = (void *)LP8725_ID_LDO1 , }, - { .name ="ldo2" , .driver_data = (void *)LP8725_ID_LDO2 , }, - { .name ="ldo3" , .driver_data = (void *)LP8725_ID_LDO3 , }, - { .name ="ldo4" , .driver_data = (void *)LP8725_ID_LDO4 , }, - { .name ="ldo5" , .driver_data = (void *)LP8725_ID_LDO5 , }, - { .name ="lilo1" , .driver_data = (void *)LP8725_ID_LILO1 , }, - { .name ="lilo2" , .driver_data = (void *)LP8725_ID_LILO2 , }, - { .name ="buck1" , .driver_data = (void *)LP8725_ID_BUCK1 , }, - { .name ="buck2" , .driver_data = (void *)LP8725_ID_BUCK2 , }, -}; - -static struct lp872x_platform_data -*lp872x_populate_pdata_from_dt (struct device *dev,enum lp872x_id which) -{ -struct device_node *np = dev->of_node; -struct lp872x_platform_data *pdata; -struct of_regulator_match *match; -int num_matches; -int count; -int i; -u8 dvs_state; - - pdata =devm_kzalloc (dev,sizeof (*pdata),GFP_KERNEL ); -if (!pdata) -return ERR_PTR (-ENOMEM ); - -of_property_read_u8 (np,"ti,general-config" , &pdata->general_config); - pdata->update_config =of_property_read_bool (np,"ti,update-config" ); - - pdata->dvs =devm_kzalloc (dev,sizeof (struct lp872x_dvs ),GFP_KERNEL ); -if (!pdata->dvs) -return ERR_PTR (-ENOMEM ); - -of_property_read_u8 (np,"ti,dvs-vsel" , (u8 *)&pdata->dvs->vsel); -of_property_read_u8 (np,"ti,dvs-state" , &dvs_state); - pdata->dvs->init_state = dvs_state ?GPIOD_OUT_HIGH :GPIOD_OUT_LOW ; - -if (of_get_child_count (np) ==0 ) - goto out; - -switch (which) { -case LP8720 : - match = lp8720_matches; - num_matches =ARRAY_SIZE (lp8720_matches); -break ; -case LP8725 : - match = lp8725_matches; - num_matches =ARRAY_SIZE (lp8725_matches); -break ; -default : - goto out; - } - - count =of_regulator_match (dev, np, match, num_matches); -if (count <=0 ) - goto out; - -for (i =0 ; i < num_matches; i++) { - pdata->regulator_data[i].id = - (uintptr_t )match[i].driver_data; - pdata->regulator_data[i].init_data = match[i].init_data; - } -out: -return pdata; -} -#else -static struct lp872x_platform_data -*lp872x_populate_pdata_from_dt (struct device *dev,enum lp872x_id which) -{ -return NULL ; -} -#endif -static int lp872x_probe (struct i2c_client *cl) { -const struct i2c_device_id *id =i2c_client_get_device_id (cl); +struct device *dev = &cl->dev;struct lp872x *lp; -struct lp872x_platform_data *pdata;int ret; -static const int lp872x_num_regulators[] = { - [LP8720 ] =LP8720_NUM_REGULATORS , - [LP8725 ] =LP8725_NUM_REGULATORS , - }; - -if (cl->dev.of_node) { - pdata =lp872x_populate_pdata_from_dt (&cl->dev, - (enum lp872x_id )id->driver_data); -if (IS_ERR (pdata)) -return PTR_ERR (pdata); - }else { - pdata =dev_get_platdata (&cl->dev); - } - lp =devm_kzalloc (&cl->dev,sizeof (struct lp872x ),GFP_KERNEL ); + lp =devm_kzalloc (dev,sizeof (*lp),GFP_KERNEL );if (!lp)return -ENOMEM ; - lp->num_regulators = lp872x_num_regulators[id->driver_data]; + lp->info =i2c_get_match_data (cl); +if (!lp->info) +return -ENODEV ; lp->regmap =devm_regmap_init_i2c (cl, &lp872x_regmap_config); -if (IS_ERR (lp->regmap)) { - ret =PTR_ERR (lp->regmap); -dev_err (&cl->dev,"regmap init i2c err: %d\n" , ret); -return ret; - } +if (IS_ERR (lp->regmap)) +return dev_err_probe (dev,PTR_ERR (lp->regmap), +"Failed to init regmap\n" ); - lp->dev = &cl->dev; - lp->pdata = pdata; - lp->chipid = id->driver_data; + lp->dev = dev;i2c_set_clientdata (cl, lp); - ret =lp872x_hw_enable (lp); -if (ret) -return ret; +/* Always set enable GPIO high. */ + lp->enable_gpio =devm_gpiod_get_optional (dev,"enable" ,GPIOD_OUT_HIGH ); +if (IS_ERR (lp->enable_gpio)) +return dev_err_probe (dev,PTR_ERR (lp->enable_gpio), +"Failed to request gpio\n" ); + +/* Each chip has a different enable delay. */ +if (lp->info->chipid ==LP8720 ) +usleep_range (LP8720_ENABLE_DELAY ,1.5 *LP8720_ENABLE_DELAY ); +else +usleep_range (LP8725_ENABLE_DELAY ,1.5 *LP8725_ENABLE_DELAY ); + +if (device_property_present (dev,"ti,general-config" )) { +u8 general_config; + + ret =device_property_read_u8 (dev,"ti,general-config" , + &general_config); +if (ret) +return dev_err_probe (dev, ret,"Failed to read general config\n" ); - ret =lp872x_config (lp); + ret =regmap_write (lp->regmap,LP872X_GENERAL_CFG , general_config); +if (ret) +return ret; + } + + ret =lp872x_init_dvs (lp);if (ret)return ret;return lp872x_regulator_register (lp); } -static const struct of_device_id lp872x_dt_ids[]__maybe_unused = { - { .compatible ="ti,lp8720" , }, - { .compatible ="ti,lp8725" , }, +static const struct lp872x_chip_info lp8720_data = { + .rdesc = lp8720_regulator_desc, + .num_regulators =LP8720_NUM_REGULATORS , + .chipid =LP8720 , +}; + +static const struct lp872x_chip_info lp8725_data = { + .rdesc = lp8725_regulator_desc, + .num_regulators =LP8725_NUM_REGULATORS , + .chipid =LP8725 , +}; + +static const struct of_device_id lp872x_dt_ids[] = { + { .compatible ="ti,lp8720" , .data = &lp8720_data }, + { .compatible ="ti,lp8725" , .data = &lp8725_data }, { } };MODULE_DEVICE_TABLE (of, lp872x_dt_ids);static const struct i2c_device_id lp872x_ids[] = { - { .name ="lp8720" , .driver_data =LP8720 }, - { .name ="lp8725" , .driver_data =LP8725 }, + { .name ="lp8720" , .driver_data = (kernel_ulong_t)&lp8720_data }, + { .name ="lp8725" , .driver_data = (kernel_ulong_t)&lp8725_data }, { } };MODULE_DEVICE_TABLE (i2c, lp872x_ids);
@@ -971,7 +826,7 @@ static struct i2c_driver lp872x_driver = { .driver = { .name = "lp872x", .probe_type = PROBE_PREFER_ASYNCHRONOUS, - .of_match_table = of_match_ptr(lp872x_dt_ids), + .of_match_table = lp872x_dt_ids, }, .probe = lp872x_probe, .id_table = lp872x_ids,
Signature · 1 line
2.53.0
[email protected]
AI reviewRe: [PATCH v2 5/7] regulator: lp872x: Remove platform_data based probing
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider: - [High] gpio: gpiod_set_value() called with enum gpiod_flags instead of logical integer --
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] gpio: gpiod_set_value() called with enum gpiod_flags instead of logical integer --
commit 66e7cc15bc21448dbaf8906353d687e2f61e221f
Author: Svyatoslav Ryhel <[email protected]>
regulator: lp872x: Remove platform_data based probing
The platform_data-based probing is tightly integrated into the lp872x driver structure itself; removing just the platform data support is impossible without remodeling major parts of the probe sequence. The lp872x_platform_data structure was removed, and its contents were incorporated into the driver private structure and lp872x_chip_info.
Quoted 4 lines
drivers/regulator/lp872x.c +0
-0
[ ... ]
drivers/regulator/lp872x.c static int lp872x_buck_set_voltage_sel(struct regulator_dev *rdev, · line 341
Quoted 13 lines
drivers/regulator/lp872x.c +2
-3@@ -344,10 +333,9 @@ static int lp872x_buck_set_voltage_sel(struct regulator_dev *rdev,struct lp872x *lp =rdev_get_drvdata (rdev);enum lp872x_regulator_id buck =rdev_get_id (rdev);u32 addr, mask =LP872X_VOUT_M ; -struct lp872x_dvs *dvs = lp->pdata ? lp->pdata->dvs :NULL ; -if (dvs && dvs->gpio) -lp872x_set_dvs (lp, dvs->vsel, dvs->gpio); +if (lp->dvs_gpio) +lp872x_set_dvs (lp, lp->vsel, lp->dvs_gpio); addr =lp872x_select_buck_vout_addr (lp, buck);if (!lp872x_is_valid_buck_addr (addr))
[Severity: High]
This problem wasn't introduced by this patch, but the modification of the caller in lp872x_buck_set_voltage_sel() retains a broken data path under the new driver structure.
Does lp872x_set_dvs() incorrectly pass enum gpiod_flags to gpiod_set_value()?
Looking at lp872x_set_dvs(), it assigns enum values to state:
state = dvs_sel == SEL_V1 ? GPIOD_OUT_HIGH : GPIOD_OUT_LOW; gpiod_set_value(gpio, state);
Because both GPIOD_OUT_HIGH and GPIOD_OUT_LOW evaluate to non-zero values, gpiod_set_value() will always drive the GPIO high, breaking the dynamic voltage scaling (DVS) state selection.
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=5
PATCH v2 6/7 regulator: lp872x: Add support for input and regulator power supplies
In reply to Svyatoslav RyhelThe LP872x support dedicated main power supply input usually shared with parent power supply for one of internal regulators (ldo1).
Add support for retrieving and managing these supply regulators using the regulator framework to ensure proper power supply dependencies and power-up sequencing.
--- drivers/regulator/lp872x.c | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+)
drivers/regulator/lp872x.c +22 -0
@@ -471,6 +471,7 @@ static const struct regulator_ops lp8725_buck_ops = {static const struct regulator_desc lp8720_regulator_desc[] = { { .name ="ldo1" , + .supply_name ="vbatt" , .of_match =of_match_ptr ("ldo1" ), .id =LP8720_ID_LDO1 , .ops = &lp872x_ldo_ops,
@@ -485,6 +486,7 @@ static const struct regulator_desc lp8720_regulator_desc[] = { }, { .name = "ldo2", + .supply_name = "vin1", .of_match = of_match_ptr("ldo2"), .id = LP8720_ID_LDO2, .ops = &lp872x_ldo_ops,
@@ -499,6 +501,7 @@ static const struct regulator_desc lp8720_regulator_desc[] = { }, { .name = "ldo3", + .supply_name = "vin1", .of_match = of_match_ptr("ldo3"), .id = LP8720_ID_LDO3, .ops = &lp872x_ldo_ops,
@@ -513,6 +516,7 @@ static const struct regulator_desc lp8720_regulator_desc[] = { }, { .name = "ldo4", + .supply_name = "vin2", .of_match = of_match_ptr("ldo4"), .id = LP8720_ID_LDO4, .ops = &lp872x_ldo_ops,
@@ -527,6 +531,7 @@ static const struct regulator_desc lp8720_regulator_desc[] = { }, { .name = "ldo5", + .supply_name = "vin2", .of_match = of_match_ptr("ldo5"), .id = LP8720_ID_LDO5, .ops = &lp872x_ldo_ops,
@@ -541,6 +546,7 @@ static const struct regulator_desc lp8720_regulator_desc[] = { }, { .name = "buck", + .supply_name = "vinb", .of_match = of_match_ptr("buck"), .id = LP8720_ID_BUCK, .ops = &lp8720_buck_ops,
@@ -556,6 +562,7 @@ static const struct regulator_desc lp8720_regulator_desc[] = {static const struct regulator_desc lp8725_regulator_desc[] = { { .name ="ldo1" , + .supply_name ="vin1" , .of_match =of_match_ptr ("ldo1" ), .id =LP8725_ID_LDO1 , .ops = &lp872x_ldo_ops,
@@ -570,6 +577,7 @@ static const struct regulator_desc lp8725_regulator_desc[] = { }, { .name = "ldo2", + .supply_name = "vin2", .of_match = of_match_ptr("ldo2"), .id = LP8725_ID_LDO2, .ops = &lp872x_ldo_ops,
@@ -584,6 +592,7 @@ static const struct regulator_desc lp8725_regulator_desc[] = { }, { .name = "ldo3", + .supply_name = "vin2", .of_match = of_match_ptr("ldo3"), .id = LP8725_ID_LDO3, .ops = &lp872x_ldo_ops,
@@ -598,6 +607,7 @@ static const struct regulator_desc lp8725_regulator_desc[] = { }, { .name = "ldo4", + .supply_name = "vin3", .of_match = of_match_ptr("ldo4"), .id = LP8725_ID_LDO4, .ops = &lp872x_ldo_ops,
@@ -612,6 +622,7 @@ static const struct regulator_desc lp8725_regulator_desc[] = { }, { .name = "ldo5", + .supply_name = "vin3", .of_match = of_match_ptr("ldo5"), .id = LP8725_ID_LDO5, .ops = &lp872x_ldo_ops,
@@ -626,6 +637,7 @@ static const struct regulator_desc lp8725_regulator_desc[] = { }, { .name = "lilo1", + .supply_name = "vinlilo1", .of_match = of_match_ptr("lilo1"), .id = LP8725_ID_LILO1, .ops = &lp872x_ldo_ops,
@@ -640,6 +652,7 @@ static const struct regulator_desc lp8725_regulator_desc[] = { }, { .name = "lilo2", + .supply_name = "vinlilo2", .of_match = of_match_ptr("lilo2"), .id = LP8725_ID_LILO2, .ops = &lp872x_ldo_ops,
@@ -654,6 +667,7 @@ static const struct regulator_desc lp8725_regulator_desc[] = { }, { .name = "buck1", + .supply_name = "vinb", .of_match = of_match_ptr("buck1"), .id = LP8725_ID_BUCK1, .ops = &lp8725_buck_ops,
@@ -670,6 +684,7 @@ static const struct regulator_desc lp8725_regulator_desc[] = { }, { .name = "buck2", + .supply_name = "vinb", .of_match = of_match_ptr("buck2"), .id = LP8725_ID_BUCK2, .ops = &lp8725_buck_ops,
@@ -745,6 +760,7 @@ static const struct regmap_config lp872x_regmap_config = {static int lp872x_probe (struct i2c_client *cl) {struct device *dev = &cl->dev; +const char *in_supply_name;struct lp872x *lp;int ret;
@@ -761,6 +777,12 @@ static int lp872x_probe(struct i2c_client *cl)return dev_err_probe (dev,PTR_ERR (lp->regmap),"Failed to init regmap\n" ); +/* LDO0 parent supplies chip itself */ + in_supply_name = lp->info->rdesc[0 ].supply_name; + ret =devm_regulator_get_enable (dev, in_supply_name); +if (ret) +return dev_err_probe (dev, ret,"Failed to enable supply regulator\n" ); + lp->dev = dev;i2c_set_clientdata (cl, lp);
Signature · 1 line
2.53.0
PATCH v2 7/7 regulator: lp872x: Use macro to fill regulator descriptor
In reply to Svyatoslav RyhelSwitch to using the macro for filling the LP872x regulator descriptor to improve readability.
--- drivers/regulator/lp872x.c | 275 ++++++++----------------------------- 1 file changed, 61 insertions(+), 214 deletions(-)
drivers/regulator/lp872x.c +61 -214
@@ -468,82 +468,59 @@ static const struct regulator_ops lp8725_buck_ops = { .get_current_limit = regulator_get_current_limit_regmap, }; +#define LP872X_LDO (_id, match, supply, _volt_table, _vsel_reg, \ + _enable_reg, _enable_mask) { \ + .name = (match), \ + .supply_name = (supply), \ + .of_match = (match), \ + .id = _id, \ + .ops = &lp872x_ldo_ops, \ + .n_voltages = ARRAY_SIZE(_volt_table), \ + .volt_table = _volt_table, \ + .type = REGULATOR_VOLTAGE, \ + .owner = THIS_MODULE, \ + .vsel_reg = _vsel_reg, \ + .vsel_mask = LP872X_VOUT_M, \ + .enable_reg = _enable_reg, \ + .enable_mask = _enable_mask, \ +} + +#define LP8720_LDO (ids, match, supply, _volt_table) \ + LP872X_LDO(LP8720_ID_##ids, match, supply, _volt_table, \ + LP872X_##ids##_VOUT, LP8720_ENABLE, LP872X_EN_##ids##_M) + +#define LP8725_LDO (ids, match, supply) \ + LP872X_LDO(LP8725_ID_##ids, match, supply, lp872x_ldo_vtbl, \ + LP872X_##ids##_VOUT, LP8725_LDO_CTRL, LP872X_EN_##ids##_M) + +#define LP8725_LILO (ids, match, supply) \ + LP872X_LDO(LP8725_ID_##ids, match, supply, lp8725_lilo_vtbl, \ + LP8725_##ids##_VOUT, LP8725_LDO_CTRL, LP8725_EN_##ids##_M) + +#define LP8725_BUCK (ids, match) { \ + .name = (match), \ + .supply_name = "vinb", \ + .of_match = (match), \ + .id = LP8725_ID_##ids, \ + .ops = &lp8725_buck_ops, \ + .n_voltages = ARRAY_SIZE(lp8725_buck_vtbl), \ + .volt_table = lp8725_buck_vtbl, \ + .type = REGULATOR_VOLTAGE, \ + .owner = THIS_MODULE, \ + .enable_reg = LP872X_GENERAL_CFG, \ + .enable_mask = LP8725_##ids##_EN_M, \ + .curr_table = lp8725_buck_uA, \ + .n_current_limits = ARRAY_SIZE(lp8725_buck_uA), \ + .csel_reg = LP8725_##ids##_VOUT2, \ + .csel_mask = LP8725_BUCK_CL_M, \ +} +static const struct regulator_desc lp8720_regulator_desc[] = { - { - .name ="ldo1" , - .supply_name ="vbatt" , - .of_match =of_match_ptr ("ldo1" ), - .id =LP8720_ID_LDO1 , - .ops = &lp872x_ldo_ops, - .n_voltages =ARRAY_SIZE (lp872x_ldo_vtbl), - .volt_table = lp872x_ldo_vtbl, - .type =REGULATOR_VOLTAGE , - .owner =THIS_MODULE , - .vsel_reg =LP872X_LDO1_VOUT , - .vsel_mask =LP872X_VOUT_M , - .enable_reg =LP8720_ENABLE , - .enable_mask =LP872X_EN_LDO1_M , - }, - { - .name ="ldo2" , - .supply_name ="vin1" , - .of_match =of_match_ptr ("ldo2" ), - .id =LP8720_ID_LDO2 , - .ops = &lp872x_ldo_ops, - .n_voltages =ARRAY_SIZE (lp872x_ldo_vtbl), - .volt_table = lp872x_ldo_vtbl, - .type =REGULATOR_VOLTAGE , - .owner =THIS_MODULE , - .vsel_reg =LP872X_LDO2_VOUT , - .vsel_mask =LP872X_VOUT_M , - .enable_reg =LP8720_ENABLE , - .enable_mask =LP872X_EN_LDO2_M , - }, - { - .name ="ldo3" , - .supply_name ="vin1" , - .of_match =of_match_ptr ("ldo3" ), - .id =LP8720_ID_LDO3 , - .ops = &lp872x_ldo_ops, - .n_voltages =ARRAY_SIZE (lp872x_ldo_vtbl), - .volt_table = lp872x_ldo_vtbl, - .type =REGULATOR_VOLTAGE , - .owner =THIS_MODULE , - .vsel_reg =LP872X_LDO3_VOUT , - .vsel_mask =LP872X_VOUT_M , - .enable_reg =LP8720_ENABLE , - .enable_mask =LP872X_EN_LDO3_M , - }, - { - .name ="ldo4" , - .supply_name ="vin2" , - .of_match =of_match_ptr ("ldo4" ), - .id =LP8720_ID_LDO4 , - .ops = &lp872x_ldo_ops, - .n_voltages =ARRAY_SIZE (lp8720_ldo4_vtbl), - .volt_table = lp8720_ldo4_vtbl, - .type =REGULATOR_VOLTAGE , - .owner =THIS_MODULE , - .vsel_reg =LP872X_LDO4_VOUT , - .vsel_mask =LP872X_VOUT_M , - .enable_reg =LP8720_ENABLE , - .enable_mask =LP872X_EN_LDO4_M , - }, - { - .name ="ldo5" , - .supply_name ="vin2" , - .of_match =of_match_ptr ("ldo5" ), - .id =LP8720_ID_LDO5 , - .ops = &lp872x_ldo_ops, - .n_voltages =ARRAY_SIZE (lp872x_ldo_vtbl), - .volt_table = lp872x_ldo_vtbl, - .type =REGULATOR_VOLTAGE , - .owner =THIS_MODULE , - .vsel_reg =LP872X_LDO5_VOUT , - .vsel_mask =LP872X_VOUT_M , - .enable_reg =LP8720_ENABLE , - .enable_mask =LP872X_EN_LDO5_M , - }, +LP8720_LDO (LDO1 ,"ldo1" ,"vbatt" , lp872x_ldo_vtbl), +LP8720_LDO (LDO2 ,"ldo2" ,"vin1" , lp872x_ldo_vtbl), +LP8720_LDO (LDO3 ,"ldo3" ,"vin1" , lp872x_ldo_vtbl), +LP8720_LDO (LDO4 ,"ldo4" ,"vin2" , lp8720_ldo4_vtbl), +LP8720_LDO (LDO5 ,"ldo5" ,"vin2" , lp872x_ldo_vtbl), { .name ="buck" , .supply_name ="vinb" ,
@@ -560,145 +537,15 @@ static const struct regulator_desc lp8720_regulator_desc[] = { };static const struct regulator_desc lp8725_regulator_desc[] = { - { - .name ="ldo1" , - .supply_name ="vin1" , - .of_match =of_match_ptr ("ldo1" ), - .id =LP8725_ID_LDO1 , - .ops = &lp872x_ldo_ops, - .n_voltages =ARRAY_SIZE (lp872x_ldo_vtbl), - .volt_table = lp872x_ldo_vtbl, - .type =REGULATOR_VOLTAGE , - .owner =THIS_MODULE , - .vsel_reg =LP872X_LDO1_VOUT , - .vsel_mask =LP872X_VOUT_M , - .enable_reg =LP8725_LDO_CTRL , - .enable_mask =LP872X_EN_LDO1_M , - }, - { - .name ="ldo2" , - .supply_name ="vin2" , - .of_match =of_match_ptr ("ldo2" ), - .id =LP8725_ID_LDO2 , - .ops = &lp872x_ldo_ops, - .n_voltages =ARRAY_SIZE (lp872x_ldo_vtbl), - .volt_table = lp872x_ldo_vtbl, - .type =REGULATOR_VOLTAGE , - .owner =THIS_MODULE , - .vsel_reg =LP872X_LDO2_VOUT , - .vsel_mask =LP872X_VOUT_M , - .enable_reg =LP8725_LDO_CTRL , - .enable_mask =LP872X_EN_LDO2_M , - }, - { - .name ="ldo3" , - .supply_name ="vin2" , - .of_match =of_match_ptr ("ldo3" ), - .id =LP8725_ID_LDO3 , - .ops = &lp872x_ldo_ops, - .n_voltages =ARRAY_SIZE (lp872x_ldo_vtbl), - .volt_table = lp872x_ldo_vtbl, - .type =REGULATOR_VOLTAGE , - .owner =THIS_MODULE , - .vsel_reg =LP872X_LDO3_VOUT , - .vsel_mask =LP872X_VOUT_M , - .enable_reg =LP8725_LDO_CTRL , - .enable_mask =LP872X_EN_LDO3_M , - }, - { - .name ="ldo4" , - .supply_name ="vin3" , - .of_match =of_match_ptr ("ldo4" ), - .id =LP8725_ID_LDO4 , - .ops = &lp872x_ldo_ops, - .n_voltages =ARRAY_SIZE (lp872x_ldo_vtbl), - .volt_table = lp872x_ldo_vtbl, - .type =REGULATOR_VOLTAGE , - .owner =THIS_MODULE , - .vsel_reg =LP872X_LDO4_VOUT , - .vsel_mask =LP872X_VOUT_M , - .enable_reg =LP8725_LDO_CTRL , - .enable_mask =LP872X_EN_LDO4_M , - }, - { - .name ="ldo5" , - .supply_name ="vin3" , - .of_match =of_match_ptr ("ldo5" ), - .id =LP8725_ID_LDO5 , - .ops = &lp872x_ldo_ops, - .n_voltages =ARRAY_SIZE (lp872x_ldo_vtbl), - .volt_table = lp872x_ldo_vtbl, - .type =REGULATOR_VOLTAGE , - .owner =THIS_MODULE , - .vsel_reg =LP872X_LDO5_VOUT , - .vsel_mask =LP872X_VOUT_M , - .enable_reg =LP8725_LDO_CTRL , - .enable_mask =LP872X_EN_LDO5_M , - }, - { - .name ="lilo1" , - .supply_name ="vinlilo1" , - .of_match =of_match_ptr ("lilo1" ), - .id =LP8725_ID_LILO1 , - .ops = &lp872x_ldo_ops, - .n_voltages =ARRAY_SIZE (lp8725_lilo_vtbl), - .volt_table = lp8725_lilo_vtbl, - .type =REGULATOR_VOLTAGE , - .owner =THIS_MODULE , - .vsel_reg =LP8725_LILO1_VOUT , - .vsel_mask =LP872X_VOUT_M , - .enable_reg =LP8725_LDO_CTRL , - .enable_mask =LP8725_EN_LILO1_M , - }, - { - .name ="lilo2" , - .supply_name ="vinlilo2" , - .of_match =of_match_ptr ("lilo2" ), - .id =LP8725_ID_LILO2 , - .ops = &lp872x_ldo_ops, - .n_voltages =ARRAY_SIZE (lp8725_lilo_vtbl), - .volt_table = lp8725_lilo_vtbl, - .type =REGULATOR_VOLTAGE , - .owner =THIS_MODULE , - .vsel_reg =LP8725_LILO2_VOUT , - .vsel_mask =LP872X_VOUT_M , - .enable_reg =LP8725_LDO_CTRL , - .enable_mask =LP8725_EN_LILO2_M , - }, - { - .name ="buck1" , - .supply_name ="vinb" , - .of_match =of_match_ptr ("buck1" ), - .id =LP8725_ID_BUCK1 , - .ops = &lp8725_buck_ops, - .n_voltages =ARRAY_SIZE (lp8725_buck_vtbl), - .volt_table = lp8725_buck_vtbl, - .type =REGULATOR_VOLTAGE , - .owner =THIS_MODULE , - .enable_reg =LP872X_GENERAL_CFG , - .enable_mask =LP8725_BUCK1_EN_M , - .curr_table = lp8725_buck_uA, - .n_current_limits =ARRAY_SIZE (lp8725_buck_uA), - .csel_reg =LP8725_BUCK1_VOUT2 , - .csel_mask =LP8725_BUCK_CL_M , - }, - { - .name ="buck2" , - .supply_name ="vinb" , - .of_match =of_match_ptr ("buck2" ), - .id =LP8725_ID_BUCK2 , - .ops = &lp8725_buck_ops, - .n_voltages =ARRAY_SIZE (lp8725_buck_vtbl), - .volt_table = lp8725_buck_vtbl, - .type =REGULATOR_VOLTAGE , - .owner =THIS_MODULE , - .enable_reg =LP872X_GENERAL_CFG , - .enable_mask =LP8725_BUCK2_EN_M , - .curr_table = lp8725_buck_uA, - .n_current_limits =ARRAY_SIZE (lp8725_buck_uA), - .csel_reg =LP8725_BUCK2_VOUT2 , - .csel_mask =LP8725_BUCK_CL_M , - }, +LP8725_LDO (LDO1 ,"ldo1" ,"vin1" ), +LP8725_LDO (LDO2 ,"ldo2" ,"vin2" ), +LP8725_LDO (LDO3 ,"ldo3" ,"vin2" ), +LP8725_LDO (LDO4 ,"ldo4" ,"vin3" ), +LP8725_LDO (LDO5 ,"ldo5" ,"vin3" ), +LP8725_LILO (LILO1 ,"lilo1" ,"vinlilo1" ), +LP8725_LILO (LILO2 ,"lilo2" ,"vinlilo2" ), +LP8725_BUCK (BUCK1 ,"buck1" ), +LP8725_BUCK (BUCK2 ,"buck2" ), };static int lp872x_init_dvs (struct lp872x *lp)
Signature · 1 line
2.53.0
Mark Brown
maintainerQuoted 4 lines · Svyatoslav Ryhel
lp872x: remove
platform_databased probing and adjustmentsUpgrade schema. Consolidate driver file, remove
platform_databased probing and add missing regulator/chip supplies.
Applied to
https://git.kernel.org/pub/scm/linux/kernel/git/broonie/regulator.git for-7.4
Thanks!
[1/7] regulator: dt-bindings: ti,lp872x: Deprecate ti,dvs-gpio and ti,update-config
https://git.kernel.org/broonie/misc/c/c299083f5d00 [2/7] regulator: dt-bindings: ti,lp872x: Document input supplies https://git.kernel.org/broonie/misc/c/3fa475838a7c [3/7] regulator: lp872x: Fold driver header into driver file https://git.kernel.org/broonie/misc/c/2411d590ac10 [4/7] regulator: lp872x: Remove redundant regmap wrappers https://git.kernel.org/broonie/misc/c/67b4e8a9426b [5/7] regulator: lp872x: Remove platform_data based probing https://git.kernel.org/broonie/misc/c/58f1f2c36970 [6/7] regulator: lp872x: Add support for input and regulator power supplies https://git.kernel.org/broonie/misc/c/646e25232f75 [7/7] regulator: lp872x: Use macro to fill regulator descriptor https://git.kernel.org/broonie/misc/c/399bc14dec56
All being well this means that it will be integrated into the linux-next tree (usually sometime in the next 24 hours) and sent to Linus during the next merge window (or sooner if it is a bug fix), however if problems are discovered then the patch may be dropped or reverted.
You may get further e-mails resulting from automated or manual testing and review of the tree, please engage with people reporting problems and send followup patches addressing any issues that are reported if needed.
If any updates are required or you are submitting further changes they should be sent as incremental updates against current git, existing patches will not be replaced.
Please add any relevant lists and maintainers to the CCs when replying to this mail.
Thanks,
Mark