Skip to content

Commit 8f05661

Browse files
committed
Mark writes: "regulator: Fixes for 4.19 A collection of fairly minor bug fixes here, a couple of driver specific ones plus two core fixes. There's one fix for the new suspend state code which fixes some confusion with constant values that are supposed to indicate noop operation and another fixing a race condition with the creation of sysfs files on new regulators." * tag 'regulator-v4.19-rc5' of https://git.kernel.org/pub/scm/linux/kernel/git/broonie/regulator: regulator: fix crash caused by null driver data regulator: Fix 'do-nothing' value for regulators without suspend state regulator: da9063: fix DT probing with constraints regulator: bd71837: Disable voltage monitoring for LDO3/4
2 parents f005de0 + fb6de92 commit 8f05661

File tree

5 files changed

+54
-10
lines changed

5 files changed

+54
-10
lines changed

drivers/regulator/bd71837-regulator.c

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -569,6 +569,25 @@ static int bd71837_probe(struct platform_device *pdev)
569569
BD71837_REG_REGLOCK);
570570
}
571571

572+
/*
573+
* There is a HW quirk in BD71837. The shutdown sequence timings for
574+
* bucks/LDOs which are controlled via register interface are changed.
575+
* At PMIC poweroff the voltage for BUCK6/7 is cut immediately at the
576+
* beginning of shut-down sequence. As bucks 6 and 7 are parent
577+
* supplies for LDO5 and LDO6 - this causes LDO5/6 voltage
578+
* monitoring to errorneously detect under voltage and force PMIC to
579+
* emergency state instead of poweroff. In order to avoid this we
580+
* disable voltage monitoring for LDO5 and LDO6
581+
*/
582+
err = regmap_update_bits(pmic->mfd->regmap, BD718XX_REG_MVRFLTMASK2,
583+
BD718XX_LDO5_VRMON80 | BD718XX_LDO6_VRMON80,
584+
BD718XX_LDO5_VRMON80 | BD718XX_LDO6_VRMON80);
585+
if (err) {
586+
dev_err(&pmic->pdev->dev,
587+
"Failed to disable voltage monitoring\n");
588+
goto err;
589+
}
590+
572591
for (i = 0; i < ARRAY_SIZE(pmic_regulator_inits); i++) {
573592

574593
struct regulator_desc *desc;

drivers/regulator/core.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3161,7 +3161,7 @@ static inline int regulator_suspend_toggle(struct regulator_dev *rdev,
31613161
if (!rstate->changeable)
31623162
return -EPERM;
31633163

3164-
rstate->enabled = en;
3164+
rstate->enabled = (en) ? ENABLE_IN_SUSPEND : DISABLE_IN_SUSPEND;
31653165

31663166
return 0;
31673167
}
@@ -4395,13 +4395,13 @@ regulator_register(const struct regulator_desc *regulator_desc,
43954395
!rdev->desc->fixed_uV)
43964396
rdev->is_switch = true;
43974397

4398+
dev_set_drvdata(&rdev->dev, rdev);
43984399
ret = device_register(&rdev->dev);
43994400
if (ret != 0) {
44004401
put_device(&rdev->dev);
44014402
goto unset_supplies;
44024403
}
44034404

4404-
dev_set_drvdata(&rdev->dev, rdev);
44054405
rdev_init_debugfs(rdev);
44064406

44074407
/* try to resolve regulators supply since a new one was registered */

drivers/regulator/of_regulator.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -213,8 +213,6 @@ static void of_get_regulation_constraints(struct device_node *np,
213213
else if (of_property_read_bool(suspend_np,
214214
"regulator-off-in-suspend"))
215215
suspend_state->enabled = DISABLE_IN_SUSPEND;
216-
else
217-
suspend_state->enabled = DO_NOTHING_IN_SUSPEND;
218216

219217
if (!of_property_read_u32(np, "regulator-suspend-min-microvolt",
220218
&pval))

include/linux/mfd/rohm-bd718x7.h

Lines changed: 30 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -78,9 +78,9 @@ enum {
7878
BD71837_REG_TRANS_COND0 = 0x1F,
7979
BD71837_REG_TRANS_COND1 = 0x20,
8080
BD71837_REG_VRFAULTEN = 0x21,
81-
BD71837_REG_MVRFLTMASK0 = 0x22,
82-
BD71837_REG_MVRFLTMASK1 = 0x23,
83-
BD71837_REG_MVRFLTMASK2 = 0x24,
81+
BD718XX_REG_MVRFLTMASK0 = 0x22,
82+
BD718XX_REG_MVRFLTMASK1 = 0x23,
83+
BD718XX_REG_MVRFLTMASK2 = 0x24,
8484
BD71837_REG_RCVCFG = 0x25,
8585
BD71837_REG_RCVNUM = 0x26,
8686
BD71837_REG_PWRONCONFIG0 = 0x27,
@@ -159,6 +159,33 @@ enum {
159159
#define BUCK8_MASK 0x3F
160160
#define BUCK8_DEFAULT 0x1E
161161

162+
/* BD718XX Voltage monitoring masks */
163+
#define BD718XX_BUCK1_VRMON80 0x1
164+
#define BD718XX_BUCK1_VRMON130 0x2
165+
#define BD718XX_BUCK2_VRMON80 0x4
166+
#define BD718XX_BUCK2_VRMON130 0x8
167+
#define BD718XX_1ST_NODVS_BUCK_VRMON80 0x1
168+
#define BD718XX_1ST_NODVS_BUCK_VRMON130 0x2
169+
#define BD718XX_2ND_NODVS_BUCK_VRMON80 0x4
170+
#define BD718XX_2ND_NODVS_BUCK_VRMON130 0x8
171+
#define BD718XX_3RD_NODVS_BUCK_VRMON80 0x10
172+
#define BD718XX_3RD_NODVS_BUCK_VRMON130 0x20
173+
#define BD718XX_4TH_NODVS_BUCK_VRMON80 0x40
174+
#define BD718XX_4TH_NODVS_BUCK_VRMON130 0x80
175+
#define BD718XX_LDO1_VRMON80 0x1
176+
#define BD718XX_LDO2_VRMON80 0x2
177+
#define BD718XX_LDO3_VRMON80 0x4
178+
#define BD718XX_LDO4_VRMON80 0x8
179+
#define BD718XX_LDO5_VRMON80 0x10
180+
#define BD718XX_LDO6_VRMON80 0x20
181+
182+
/* BD71837 specific voltage monitoring masks */
183+
#define BD71837_BUCK3_VRMON80 0x10
184+
#define BD71837_BUCK3_VRMON130 0x20
185+
#define BD71837_BUCK4_VRMON80 0x40
186+
#define BD71837_BUCK4_VRMON130 0x80
187+
#define BD71837_LDO7_VRMON80 0x40
188+
162189
/* BD71837_REG_IRQ bits */
163190
#define IRQ_SWRST 0x40
164191
#define IRQ_PWRON_S 0x20

include/linux/regulator/machine.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,9 +48,9 @@ struct regulator;
4848
* DISABLE_IN_SUSPEND - turn off regulator in suspend states
4949
* ENABLE_IN_SUSPEND - keep regulator on in suspend states
5050
*/
51-
#define DO_NOTHING_IN_SUSPEND (-1)
52-
#define DISABLE_IN_SUSPEND 0
53-
#define ENABLE_IN_SUSPEND 1
51+
#define DO_NOTHING_IN_SUSPEND 0
52+
#define DISABLE_IN_SUSPEND 1
53+
#define ENABLE_IN_SUSPEND 2
5454

5555
/* Regulator active discharge flags */
5656
enum regulator_active_discharge {

0 commit comments

Comments
 (0)