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.
 -----BEGIN PGP SIGNATURE-----
 
 iQFHBAABCgAxFiEEreZoqmdXGLWf4p/qJNaLcl1Uh9AFAluuL04THGJyb29uaWVA
 a2VybmVsLm9yZwAKCRAk1otyXVSH0GdVB/9AWbmIA8iNJDo/CETEZ9UiOvEFXSO8
 vRk+WcU4vtPo4qp27ylYRh9dKjWczEq8dKpe4YmaLjv4HX5MggLiwO1cLl44+q6y
 AKZYK1FvGR1yExP3adE4XEC03jD21909mkLCNRawCVh+Iorp4r5CA6ahNfzT0flI
 Eo5nKi4zN/0WSjxcoDdqUQ7oIivlmxiC8HYZyluS7f6UV0rcQXeqdXKqs6utPUxD
 w4MLQriPqG7R0g75XqoRB7hVcZBO4m/NRi6SMGQtF1WG1unpl+iCnxRa0WXHi1th
 nMg900nucgIe6gWBxMocWbyXsFj3+CrWlCB4BxVW8+pe8VyLFtYnPUA5
 =yAAv
 -----END PGP SIGNATURE-----
gpgsig -----BEGIN PGP SIGNATURE-----
 
 iQFHBAABCgAxFiEEreZoqmdXGLWf4p/qJNaLcl1Uh9AFAluuMasTHGJyb29uaWVA
 a2VybmVsLm9yZwAKCRAk1otyXVSH0NPZB/0X1e0JWK819dT5HWgNa6E2391fn1Qj
 eY89u0cJj+3gom3QyOKCupcjEIumPHVYjiCsIEVipH+vefcuzgyUkRHhBZsSFgyp
 90sVHKywg5pcxi6em/wuStzkXA84HjCVPJ4nDd6fnE6Ew7NDpP0/FPkpt7PwqlFy
 b56pg/iK6YFhgXLlJMi6k7TGb/NG9M0qZzrb5UvTIbqVw9IRsqQrLN6YSaqhUFwe
 hwonne4bMPl4DroVBGDz15djFv0Re7DxJuhAErJ/Fafzq5SX1zAPzkJ6peJnSdyF
 2fUv6596nhNKVqAvMF5514kBq+JeFB13YS4S2Xm2Dm/rQ1P9G8XSfzQG
 =YPYr
 -----END PGP SIGNATURE-----

Merge tag 'regulator-v4.19-rc5' into regulator-bd718xx

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.
This commit is contained in:
Mark Brown 2018-09-28 14:50:33 +01:00
commit 2e0fe4d0c6
6 changed files with 64 additions and 18 deletions

View File

@ -568,6 +568,25 @@ static int bd71837_probe(struct platform_device *pdev)
BD71837_REG_REGLOCK); BD71837_REG_REGLOCK);
} }
/*
* There is a HW quirk in BD71837. The shutdown sequence timings for
* bucks/LDOs which are controlled via register interface are changed.
* At PMIC poweroff the voltage for BUCK6/7 is cut immediately at the
* beginning of shut-down sequence. As bucks 6 and 7 are parent
* supplies for LDO5 and LDO6 - this causes LDO5/6 voltage
* monitoring to errorneously detect under voltage and force PMIC to
* emergency state instead of poweroff. In order to avoid this we
* disable voltage monitoring for LDO5 and LDO6
*/
err = regmap_update_bits(pmic->mfd->regmap, BD718XX_REG_MVRFLTMASK2,
BD718XX_LDO5_VRMON80 | BD718XX_LDO6_VRMON80,
BD718XX_LDO5_VRMON80 | BD718XX_LDO6_VRMON80);
if (err) {
dev_err(&pmic->pdev->dev,
"Failed to disable voltage monitoring\n");
goto err;
}
for (i = 0; i < ARRAY_SIZE(pmic_regulator_inits); i++) { for (i = 0; i < ARRAY_SIZE(pmic_regulator_inits); i++) {
struct regulator_desc *desc; struct regulator_desc *desc;

View File

@ -3161,7 +3161,7 @@ static inline int regulator_suspend_toggle(struct regulator_dev *rdev,
if (!rstate->changeable) if (!rstate->changeable)
return -EPERM; return -EPERM;
rstate->enabled = en; rstate->enabled = (en) ? ENABLE_IN_SUSPEND : DISABLE_IN_SUSPEND;
return 0; return 0;
} }
@ -4395,13 +4395,13 @@ regulator_register(const struct regulator_desc *regulator_desc,
!rdev->desc->fixed_uV) !rdev->desc->fixed_uV)
rdev->is_switch = true; rdev->is_switch = true;
dev_set_drvdata(&rdev->dev, rdev);
ret = device_register(&rdev->dev); ret = device_register(&rdev->dev);
if (ret != 0) { if (ret != 0) {
put_device(&rdev->dev); put_device(&rdev->dev);
goto unset_supplies; goto unset_supplies;
} }
dev_set_drvdata(&rdev->dev, rdev);
rdev_init_debugfs(rdev); rdev_init_debugfs(rdev);
/* try to resolve regulators supply since a new one was registered */ /* try to resolve regulators supply since a new one was registered */

View File

@ -213,8 +213,6 @@ static void of_get_regulation_constraints(struct device_node *np,
else if (of_property_read_bool(suspend_np, else if (of_property_read_bool(suspend_np,
"regulator-off-in-suspend")) "regulator-off-in-suspend"))
suspend_state->enabled = DISABLE_IN_SUSPEND; suspend_state->enabled = DISABLE_IN_SUSPEND;
else
suspend_state->enabled = DO_NOTHING_IN_SUSPEND;
if (!of_property_read_u32(np, "regulator-suspend-min-microvolt", if (!of_property_read_u32(np, "regulator-suspend-min-microvolt",
&pval)) &pval))

View File

@ -21,7 +21,7 @@
/* /*
* Regulator configuration * Regulator configuration
*/ */
/* DA9063 regulator IDs */ /* DA9063 and DA9063L regulator IDs */
enum { enum {
/* BUCKs */ /* BUCKs */
DA9063_ID_BCORE1, DA9063_ID_BCORE1,
@ -37,18 +37,20 @@ enum {
DA9063_ID_BMEM_BIO_MERGED, DA9063_ID_BMEM_BIO_MERGED,
/* When two BUCKs are merged, they cannot be reused separately */ /* When two BUCKs are merged, they cannot be reused separately */
/* LDOs */ /* LDOs on both DA9063 and DA9063L */
DA9063_ID_LDO1,
DA9063_ID_LDO2,
DA9063_ID_LDO3, DA9063_ID_LDO3,
DA9063_ID_LDO4,
DA9063_ID_LDO5,
DA9063_ID_LDO6,
DA9063_ID_LDO7, DA9063_ID_LDO7,
DA9063_ID_LDO8, DA9063_ID_LDO8,
DA9063_ID_LDO9, DA9063_ID_LDO9,
DA9063_ID_LDO10,
DA9063_ID_LDO11, DA9063_ID_LDO11,
/* DA9063-only LDOs */
DA9063_ID_LDO1,
DA9063_ID_LDO2,
DA9063_ID_LDO4,
DA9063_ID_LDO5,
DA9063_ID_LDO6,
DA9063_ID_LDO10,
}; };
/* Regulators platform data */ /* Regulators platform data */

View File

@ -78,9 +78,9 @@ enum {
BD71837_REG_TRANS_COND0 = 0x1F, BD71837_REG_TRANS_COND0 = 0x1F,
BD71837_REG_TRANS_COND1 = 0x20, BD71837_REG_TRANS_COND1 = 0x20,
BD71837_REG_VRFAULTEN = 0x21, BD71837_REG_VRFAULTEN = 0x21,
BD71837_REG_MVRFLTMASK0 = 0x22, BD718XX_REG_MVRFLTMASK0 = 0x22,
BD71837_REG_MVRFLTMASK1 = 0x23, BD718XX_REG_MVRFLTMASK1 = 0x23,
BD71837_REG_MVRFLTMASK2 = 0x24, BD718XX_REG_MVRFLTMASK2 = 0x24,
BD71837_REG_RCVCFG = 0x25, BD71837_REG_RCVCFG = 0x25,
BD71837_REG_RCVNUM = 0x26, BD71837_REG_RCVNUM = 0x26,
BD71837_REG_PWRONCONFIG0 = 0x27, BD71837_REG_PWRONCONFIG0 = 0x27,
@ -159,6 +159,33 @@ enum {
#define BUCK8_MASK 0x3F #define BUCK8_MASK 0x3F
#define BUCK8_DEFAULT 0x1E #define BUCK8_DEFAULT 0x1E
/* BD718XX Voltage monitoring masks */
#define BD718XX_BUCK1_VRMON80 0x1
#define BD718XX_BUCK1_VRMON130 0x2
#define BD718XX_BUCK2_VRMON80 0x4
#define BD718XX_BUCK2_VRMON130 0x8
#define BD718XX_1ST_NODVS_BUCK_VRMON80 0x1
#define BD718XX_1ST_NODVS_BUCK_VRMON130 0x2
#define BD718XX_2ND_NODVS_BUCK_VRMON80 0x4
#define BD718XX_2ND_NODVS_BUCK_VRMON130 0x8
#define BD718XX_3RD_NODVS_BUCK_VRMON80 0x10
#define BD718XX_3RD_NODVS_BUCK_VRMON130 0x20
#define BD718XX_4TH_NODVS_BUCK_VRMON80 0x40
#define BD718XX_4TH_NODVS_BUCK_VRMON130 0x80
#define BD718XX_LDO1_VRMON80 0x1
#define BD718XX_LDO2_VRMON80 0x2
#define BD718XX_LDO3_VRMON80 0x4
#define BD718XX_LDO4_VRMON80 0x8
#define BD718XX_LDO5_VRMON80 0x10
#define BD718XX_LDO6_VRMON80 0x20
/* BD71837 specific voltage monitoring masks */
#define BD71837_BUCK3_VRMON80 0x10
#define BD71837_BUCK3_VRMON130 0x20
#define BD71837_BUCK4_VRMON80 0x40
#define BD71837_BUCK4_VRMON130 0x80
#define BD71837_LDO7_VRMON80 0x40
/* BD71837_REG_IRQ bits */ /* BD71837_REG_IRQ bits */
#define IRQ_SWRST 0x40 #define IRQ_SWRST 0x40
#define IRQ_PWRON_S 0x20 #define IRQ_PWRON_S 0x20

View File

@ -48,9 +48,9 @@ struct regulator;
* DISABLE_IN_SUSPEND - turn off regulator in suspend states * DISABLE_IN_SUSPEND - turn off regulator in suspend states
* ENABLE_IN_SUSPEND - keep regulator on in suspend states * ENABLE_IN_SUSPEND - keep regulator on in suspend states
*/ */
#define DO_NOTHING_IN_SUSPEND (-1) #define DO_NOTHING_IN_SUSPEND 0
#define DISABLE_IN_SUSPEND 0 #define DISABLE_IN_SUSPEND 1
#define ENABLE_IN_SUSPEND 1 #define ENABLE_IN_SUSPEND 2
/* Regulator active discharge flags */ /* Regulator active discharge flags */
enum regulator_active_discharge { enum regulator_active_discharge {