Commit c20d7a9b authored by Mark Brown's avatar Mark Brown

Merge branch 'regulator-5.14' into regulator-5.15

parents d0f95e64 ccb2a74e
...@@ -366,9 +366,8 @@ static struct hi6421_regulator_info ...@@ -366,9 +366,8 @@ static struct hi6421_regulator_info
static int hi6421_regulator_enable(struct regulator_dev *rdev) static int hi6421_regulator_enable(struct regulator_dev *rdev)
{ {
struct hi6421_regulator_pdata *pdata; struct hi6421_regulator_pdata *pdata = rdev_get_drvdata(rdev);
pdata = dev_get_drvdata(rdev->dev.parent);
/* hi6421 spec requires regulator enablement must be serialized: /* hi6421 spec requires regulator enablement must be serialized:
* - Because when BUCK, LDO switching from off to on, it will have * - Because when BUCK, LDO switching from off to on, it will have
* a huge instantaneous current; so you can not turn on two or * a huge instantaneous current; so you can not turn on two or
...@@ -385,9 +384,10 @@ static int hi6421_regulator_enable(struct regulator_dev *rdev) ...@@ -385,9 +384,10 @@ static int hi6421_regulator_enable(struct regulator_dev *rdev)
static unsigned int hi6421_regulator_ldo_get_mode(struct regulator_dev *rdev) static unsigned int hi6421_regulator_ldo_get_mode(struct regulator_dev *rdev)
{ {
struct hi6421_regulator_info *info = rdev_get_drvdata(rdev); struct hi6421_regulator_info *info;
unsigned int reg_val; unsigned int reg_val;
info = container_of(rdev->desc, struct hi6421_regulator_info, desc);
regmap_read(rdev->regmap, rdev->desc->enable_reg, &reg_val); regmap_read(rdev->regmap, rdev->desc->enable_reg, &reg_val);
if (reg_val & info->mode_mask) if (reg_val & info->mode_mask)
return REGULATOR_MODE_IDLE; return REGULATOR_MODE_IDLE;
...@@ -397,9 +397,10 @@ static unsigned int hi6421_regulator_ldo_get_mode(struct regulator_dev *rdev) ...@@ -397,9 +397,10 @@ static unsigned int hi6421_regulator_ldo_get_mode(struct regulator_dev *rdev)
static unsigned int hi6421_regulator_buck_get_mode(struct regulator_dev *rdev) static unsigned int hi6421_regulator_buck_get_mode(struct regulator_dev *rdev)
{ {
struct hi6421_regulator_info *info = rdev_get_drvdata(rdev); struct hi6421_regulator_info *info;
unsigned int reg_val; unsigned int reg_val;
info = container_of(rdev->desc, struct hi6421_regulator_info, desc);
regmap_read(rdev->regmap, rdev->desc->enable_reg, &reg_val); regmap_read(rdev->regmap, rdev->desc->enable_reg, &reg_val);
if (reg_val & info->mode_mask) if (reg_val & info->mode_mask)
return REGULATOR_MODE_STANDBY; return REGULATOR_MODE_STANDBY;
...@@ -410,9 +411,10 @@ static unsigned int hi6421_regulator_buck_get_mode(struct regulator_dev *rdev) ...@@ -410,9 +411,10 @@ static unsigned int hi6421_regulator_buck_get_mode(struct regulator_dev *rdev)
static int hi6421_regulator_ldo_set_mode(struct regulator_dev *rdev, static int hi6421_regulator_ldo_set_mode(struct regulator_dev *rdev,
unsigned int mode) unsigned int mode)
{ {
struct hi6421_regulator_info *info = rdev_get_drvdata(rdev); struct hi6421_regulator_info *info;
unsigned int new_mode; unsigned int new_mode;
info = container_of(rdev->desc, struct hi6421_regulator_info, desc);
switch (mode) { switch (mode) {
case REGULATOR_MODE_NORMAL: case REGULATOR_MODE_NORMAL:
new_mode = 0; new_mode = 0;
...@@ -434,9 +436,10 @@ static int hi6421_regulator_ldo_set_mode(struct regulator_dev *rdev, ...@@ -434,9 +436,10 @@ static int hi6421_regulator_ldo_set_mode(struct regulator_dev *rdev,
static int hi6421_regulator_buck_set_mode(struct regulator_dev *rdev, static int hi6421_regulator_buck_set_mode(struct regulator_dev *rdev,
unsigned int mode) unsigned int mode)
{ {
struct hi6421_regulator_info *info = rdev_get_drvdata(rdev); struct hi6421_regulator_info *info;
unsigned int new_mode; unsigned int new_mode;
info = container_of(rdev->desc, struct hi6421_regulator_info, desc);
switch (mode) { switch (mode) {
case REGULATOR_MODE_NORMAL: case REGULATOR_MODE_NORMAL:
new_mode = 0; new_mode = 0;
...@@ -459,7 +462,9 @@ static unsigned int ...@@ -459,7 +462,9 @@ static unsigned int
hi6421_regulator_ldo_get_optimum_mode(struct regulator_dev *rdev, hi6421_regulator_ldo_get_optimum_mode(struct regulator_dev *rdev,
int input_uV, int output_uV, int load_uA) int input_uV, int output_uV, int load_uA)
{ {
struct hi6421_regulator_info *info = rdev_get_drvdata(rdev); struct hi6421_regulator_info *info;
info = container_of(rdev->desc, struct hi6421_regulator_info, desc);
if (load_uA > info->eco_microamp) if (load_uA > info->eco_microamp)
return REGULATOR_MODE_NORMAL; return REGULATOR_MODE_NORMAL;
...@@ -543,14 +548,13 @@ static int hi6421_regulator_probe(struct platform_device *pdev) ...@@ -543,14 +548,13 @@ static int hi6421_regulator_probe(struct platform_device *pdev)
if (!pdata) if (!pdata)
return -ENOMEM; return -ENOMEM;
mutex_init(&pdata->lock); mutex_init(&pdata->lock);
platform_set_drvdata(pdev, pdata);
for (i = 0; i < ARRAY_SIZE(hi6421_regulator_info); i++) { for (i = 0; i < ARRAY_SIZE(hi6421_regulator_info); i++) {
/* assign per-regulator data */ /* assign per-regulator data */
info = &hi6421_regulator_info[i]; info = &hi6421_regulator_info[i];
config.dev = pdev->dev.parent; config.dev = pdev->dev.parent;
config.driver_data = info; config.driver_data = pdata;
config.regmap = pmic->regmap; config.regmap = pmic->regmap;
rdev = devm_regulator_register(&pdev->dev, &info->desc, rdev = devm_regulator_register(&pdev->dev, &info->desc,
......
...@@ -73,14 +73,14 @@ static const unsigned int ldo34_voltages[] = { ...@@ -73,14 +73,14 @@ static const unsigned int ldo34_voltages[] = {
*/ */
#define HI6421V600_LDO(_id, vtable, ereg, emask, vreg, \ #define HI6421V600_LDO(_id, vtable, ereg, emask, vreg, \
odelay, etime, ecomask, ecoamp) \ odelay, etime, ecomask, ecoamp) \
[HI6421V600_##_id] = { \ [hi6421v600_##_id] = { \
.desc = { \ .desc = { \
.name = #_id, \ .name = #_id, \
.of_match = of_match_ptr(#_id), \ .of_match = of_match_ptr(#_id), \
.regulators_node = of_match_ptr("regulators"), \ .regulators_node = of_match_ptr("regulators"), \
.ops = &hi6421_spmi_ldo_rops, \ .ops = &hi6421_spmi_ldo_rops, \
.type = REGULATOR_VOLTAGE, \ .type = REGULATOR_VOLTAGE, \
.id = HI6421V600_##_id, \ .id = hi6421v600_##_id, \
.owner = THIS_MODULE, \ .owner = THIS_MODULE, \
.volt_table = vtable, \ .volt_table = vtable, \
.n_voltages = ARRAY_SIZE(vtable), \ .n_voltages = ARRAY_SIZE(vtable), \
...@@ -185,46 +185,46 @@ static const struct regulator_ops hi6421_spmi_ldo_rops = { ...@@ -185,46 +185,46 @@ static const struct regulator_ops hi6421_spmi_ldo_rops = {
/* HI6421v600 regulators with known registers */ /* HI6421v600 regulators with known registers */
enum hi6421_spmi_regulator_id { enum hi6421_spmi_regulator_id {
HI6421V600_LDO3, hi6421v600_ldo3,
HI6421V600_LDO4, hi6421v600_ldo4,
HI6421V600_LDO9, hi6421v600_ldo9,
HI6421V600_LDO15, hi6421v600_ldo15,
HI6421V600_LDO16, hi6421v600_ldo16,
HI6421V600_LDO17, hi6421v600_ldo17,
HI6421V600_LDO33, hi6421v600_ldo33,
HI6421V600_LDO34, hi6421v600_ldo34,
}; };
static struct hi6421_spmi_reg_info regulator_info[] = { static struct hi6421_spmi_reg_info regulator_info[] = {
HI6421V600_LDO(LDO3, ldo3_voltages, HI6421V600_LDO(ldo3, ldo3_voltages,
0x16, 0x01, 0x51, 0x16, 0x01, 0x51,
20000, 120, 20000, 120,
0, 0), 0, 0),
HI6421V600_LDO(LDO4, ldo4_voltages, HI6421V600_LDO(ldo4, ldo4_voltages,
0x17, 0x01, 0x52, 0x17, 0x01, 0x52,
20000, 120, 20000, 120,
0x10, 10000), 0x10, 10000),
HI6421V600_LDO(LDO9, ldo9_voltages, HI6421V600_LDO(ldo9, ldo9_voltages,
0x1c, 0x01, 0x57, 0x1c, 0x01, 0x57,
20000, 360, 20000, 360,
0x10, 10000), 0x10, 10000),
HI6421V600_LDO(LDO15, ldo15_voltages, HI6421V600_LDO(ldo15, ldo15_voltages,
0x21, 0x01, 0x5c, 0x21, 0x01, 0x5c,
20000, 360, 20000, 360,
0x10, 10000), 0x10, 10000),
HI6421V600_LDO(LDO16, ldo15_voltages, HI6421V600_LDO(ldo16, ldo15_voltages,
0x22, 0x01, 0x5d, 0x22, 0x01, 0x5d,
20000, 360, 20000, 360,
0x10, 10000), 0x10, 10000),
HI6421V600_LDO(LDO17, ldo17_voltages, HI6421V600_LDO(ldo17, ldo17_voltages,
0x23, 0x01, 0x5e, 0x23, 0x01, 0x5e,
20000, 120, 20000, 120,
0x10, 10000), 0x10, 10000),
HI6421V600_LDO(LDO33, ldo17_voltages, HI6421V600_LDO(ldo33, ldo17_voltages,
0x32, 0x01, 0x6d, 0x32, 0x01, 0x6d,
20000, 120, 20000, 120,
0, 0), 0, 0),
HI6421V600_LDO(LDO34, ldo34_voltages, HI6421V600_LDO(ldo34, ldo34_voltages,
0x33, 0x01, 0x6e, 0x33, 0x01, 0x6e,
20000, 120, 20000, 120,
0, 0), 0, 0),
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment