Skip to content

Commit 0de6219

Browse files
committed
Merge tag 'regulator-fix-v7.0-merge-window' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/regulator
Pull regulator fixes from Mark Brown: "A few driver specific fixes, plus a patch from Bjorn which removes a fixed limit on regulator names that was breaking some Qualcomm systems" * tag 'regulator-fix-v7.0-merge-window' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/regulator: regulator: s2mps11: fix pctrlsel macro usage in s2mpg10_of_parse_cb() regulator: s2mps11: drop redundant sanity checks in s2mpg10_of_parse_cb() regulator: core: Remove regulator supply_name length limit regulator: mt6363: Fix interrmittent timeout
2 parents 3f6eb5a + 09ad01a commit 0de6219

3 files changed

Lines changed: 18 additions & 25 deletions

File tree

drivers/regulator/core.c

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1965,8 +1965,6 @@ static const struct file_operations constraint_flags_fops = {
19651965
#endif
19661966
};
19671967

1968-
#define REG_STR_SIZE 64
1969-
19701968
static void link_and_create_debugfs(struct regulator *regulator, struct regulator_dev *rdev,
19711969
struct device *dev)
19721970
{
@@ -2014,15 +2012,7 @@ static struct regulator *create_regulator(struct regulator_dev *rdev,
20142012
lockdep_assert_held_once(&rdev->mutex.base);
20152013

20162014
if (dev) {
2017-
char buf[REG_STR_SIZE];
2018-
int size;
2019-
2020-
size = snprintf(buf, REG_STR_SIZE, "%s-%s",
2021-
dev->kobj.name, supply_name);
2022-
if (size >= REG_STR_SIZE)
2023-
return NULL;
2024-
2025-
supply_name = kstrdup(buf, GFP_KERNEL);
2015+
supply_name = kasprintf(GFP_KERNEL, "%s-%s", dev->kobj.name, supply_name);
20262016
if (supply_name == NULL)
20272017
return NULL;
20282018
} else {

drivers/regulator/mt6363-regulator.c

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -861,7 +861,7 @@ static int mt6363_regulator_probe(struct platform_device *pdev)
861861
struct irq_domain *domain;
862862
struct irq_fwspec fwspec;
863863
struct spmi_device *sdev;
864-
int i, ret;
864+
int i, ret, val;
865865

866866
config.regmap = mt6363_spmi_register_regmap(dev);
867867
if (IS_ERR(config.regmap))
@@ -870,6 +870,13 @@ static int mt6363_regulator_probe(struct platform_device *pdev)
870870
config.dev = dev;
871871
sdev = to_spmi_device(dev->parent);
872872

873+
/*
874+
* The first read may fail if the bootloader sets sleep mode: wake up
875+
* this PMIC with W/R on the SPMI bus and ignore the first result.
876+
* This matches the MT6373 driver behavior.
877+
*/
878+
regmap_read(config.regmap, MT6363_TOP_TRAP, &val);
879+
873880
interrupt_parent = of_irq_find_parent(dev->of_node);
874881
if (!interrupt_parent)
875882
return dev_err_probe(dev, -EINVAL, "Cannot find IRQ parent\n");

drivers/regulator/s2mps11.c

Lines changed: 9 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -440,15 +440,15 @@ static int s2mpg10_of_parse_cb(struct device_node *np,
440440
[S2MPG10_EXTCTRL_LDO20M_EN] = S2MPG10_PCTRLSEL_LDO20M_EN,
441441
};
442442
static const u32 ext_control_s2mpg11[] = {
443-
[S2MPG11_EXTCTRL_PWREN] = S2MPG10_PCTRLSEL_PWREN,
444-
[S2MPG11_EXTCTRL_PWREN_MIF] = S2MPG10_PCTRLSEL_PWREN_MIF,
445-
[S2MPG11_EXTCTRL_AP_ACTIVE_N] = S2MPG10_PCTRLSEL_AP_ACTIVE_N,
446-
[S2MPG11_EXTCTRL_G3D_EN] = S2MPG10_PCTRLSEL_CPUCL1_EN,
447-
[S2MPG11_EXTCTRL_G3D_EN2] = S2MPG10_PCTRLSEL_CPUCL1_EN2,
448-
[S2MPG11_EXTCTRL_AOC_VDD] = S2MPG10_PCTRLSEL_CPUCL2_EN,
449-
[S2MPG11_EXTCTRL_AOC_RET] = S2MPG10_PCTRLSEL_CPUCL2_EN2,
450-
[S2MPG11_EXTCTRL_UFS_EN] = S2MPG10_PCTRLSEL_TPU_EN,
451-
[S2MPG11_EXTCTRL_LDO13S_EN] = S2MPG10_PCTRLSEL_TPU_EN2,
443+
[S2MPG11_EXTCTRL_PWREN] = S2MPG11_PCTRLSEL_PWREN,
444+
[S2MPG11_EXTCTRL_PWREN_MIF] = S2MPG11_PCTRLSEL_PWREN_MIF,
445+
[S2MPG11_EXTCTRL_AP_ACTIVE_N] = S2MPG11_PCTRLSEL_AP_ACTIVE_N,
446+
[S2MPG11_EXTCTRL_G3D_EN] = S2MPG11_PCTRLSEL_G3D_EN,
447+
[S2MPG11_EXTCTRL_G3D_EN2] = S2MPG11_PCTRLSEL_G3D_EN2,
448+
[S2MPG11_EXTCTRL_AOC_VDD] = S2MPG11_PCTRLSEL_AOC_VDD,
449+
[S2MPG11_EXTCTRL_AOC_RET] = S2MPG11_PCTRLSEL_AOC_RET,
450+
[S2MPG11_EXTCTRL_UFS_EN] = S2MPG11_PCTRLSEL_UFS_EN,
451+
[S2MPG11_EXTCTRL_LDO13S_EN] = S2MPG11_PCTRLSEL_LDO13S_EN,
452452
};
453453
u32 ext_control;
454454

@@ -478,8 +478,6 @@ static int s2mpg10_of_parse_cb(struct device_node *np,
478478
return -EINVAL;
479479
}
480480

481-
if (ext_control > ARRAY_SIZE(ext_control_s2mpg10))
482-
return -EINVAL;
483481
ext_control = ext_control_s2mpg10[ext_control];
484482
break;
485483

@@ -503,8 +501,6 @@ static int s2mpg10_of_parse_cb(struct device_node *np,
503501
return -EINVAL;
504502
}
505503

506-
if (ext_control > ARRAY_SIZE(ext_control_s2mpg11))
507-
return -EINVAL;
508504
ext_control = ext_control_s2mpg11[ext_control];
509505
break;
510506

0 commit comments

Comments
 (0)