Skip to content

Commit 0f9f7c6

Browse files
M-Vaittinenbroonie
authored andcommitted
regulator: bd71828: Don't overwrite runtime voltages
Some of the regulators on the BD71828 have common voltage setting for RUN/SUSPEND/IDLE/LPSR states. The enable control can be set for each state though. The driver allows setting the voltage values for these states via device-tree. As a side effect, setting the voltages for SUSPEND/IDLE/LPSR will also change the RUN level voltage which is not desired and can break the system. The comment in code reflects this behaviour, but it is likely to not make people any happier. The right thing to do is to allow setting the enable/disable state at SUSPEND/IDLE/LPSR via device-tree, but to disallow setting state specific voltages for those regulators. BUCK1 is a bit different. It only shares the SUSPEND and LPSR state voltages. The former behaviour of allowing to silently overwrite the SUSPEND state voltage by LPSR state voltage is also changed here so that the SUSPEND voltage is prioritized over LPSR voltage. Prevent setting PMIC state specific voltages for regulators which do not support it. Signed-off-by: Matti Vaittinen <[email protected]> Fixes: 522498f ("regulator: bd71828: Basic support for ROHM bd71828 PMIC regulators") Link: https://msgid.link/r/e1883ae1e3ae5668f1030455d4750923561f3d68.1715848512.git.mazziesaccount@gmail.com Signed-off-by: Mark Brown <[email protected]>
1 parent 4e70b26 commit 0f9f7c6

File tree

1 file changed

+2
-56
lines changed

1 file changed

+2
-56
lines changed

drivers/regulator/bd71828-regulator.c

Lines changed: 2 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -206,14 +206,11 @@ static const struct bd71828_regulator_data bd71828_rdata[] = {
206206
.suspend_reg = BD71828_REG_BUCK1_SUSP_VOLT,
207207
.suspend_mask = BD71828_MASK_BUCK1267_VOLT,
208208
.suspend_on_mask = BD71828_MASK_SUSP_EN,
209-
.lpsr_on_mask = BD71828_MASK_LPSR_EN,
210209
/*
211210
* LPSR voltage is same as SUSPEND voltage. Allow
212-
* setting it so that regulator can be set enabled at
213-
* LPSR state
211+
* only enabling/disabling regulator for LPSR state
214212
*/
215-
.lpsr_reg = BD71828_REG_BUCK1_SUSP_VOLT,
216-
.lpsr_mask = BD71828_MASK_BUCK1267_VOLT,
213+
.lpsr_on_mask = BD71828_MASK_LPSR_EN,
217214
},
218215
.reg_inits = buck1_inits,
219216
.reg_init_amnt = ARRAY_SIZE(buck1_inits),
@@ -288,13 +285,7 @@ static const struct bd71828_regulator_data bd71828_rdata[] = {
288285
ROHM_DVS_LEVEL_SUSPEND |
289286
ROHM_DVS_LEVEL_LPSR,
290287
.run_reg = BD71828_REG_BUCK3_VOLT,
291-
.idle_reg = BD71828_REG_BUCK3_VOLT,
292-
.suspend_reg = BD71828_REG_BUCK3_VOLT,
293-
.lpsr_reg = BD71828_REG_BUCK3_VOLT,
294288
.run_mask = BD71828_MASK_BUCK3_VOLT,
295-
.idle_mask = BD71828_MASK_BUCK3_VOLT,
296-
.suspend_mask = BD71828_MASK_BUCK3_VOLT,
297-
.lpsr_mask = BD71828_MASK_BUCK3_VOLT,
298289
.idle_on_mask = BD71828_MASK_IDLE_EN,
299290
.suspend_on_mask = BD71828_MASK_SUSP_EN,
300291
.lpsr_on_mask = BD71828_MASK_LPSR_EN,
@@ -329,13 +320,7 @@ static const struct bd71828_regulator_data bd71828_rdata[] = {
329320
ROHM_DVS_LEVEL_SUSPEND |
330321
ROHM_DVS_LEVEL_LPSR,
331322
.run_reg = BD71828_REG_BUCK4_VOLT,
332-
.idle_reg = BD71828_REG_BUCK4_VOLT,
333-
.suspend_reg = BD71828_REG_BUCK4_VOLT,
334-
.lpsr_reg = BD71828_REG_BUCK4_VOLT,
335323
.run_mask = BD71828_MASK_BUCK4_VOLT,
336-
.idle_mask = BD71828_MASK_BUCK4_VOLT,
337-
.suspend_mask = BD71828_MASK_BUCK4_VOLT,
338-
.lpsr_mask = BD71828_MASK_BUCK4_VOLT,
339324
.idle_on_mask = BD71828_MASK_IDLE_EN,
340325
.suspend_on_mask = BD71828_MASK_SUSP_EN,
341326
.lpsr_on_mask = BD71828_MASK_LPSR_EN,
@@ -370,13 +355,7 @@ static const struct bd71828_regulator_data bd71828_rdata[] = {
370355
ROHM_DVS_LEVEL_SUSPEND |
371356
ROHM_DVS_LEVEL_LPSR,
372357
.run_reg = BD71828_REG_BUCK5_VOLT,
373-
.idle_reg = BD71828_REG_BUCK5_VOLT,
374-
.suspend_reg = BD71828_REG_BUCK5_VOLT,
375-
.lpsr_reg = BD71828_REG_BUCK5_VOLT,
376358
.run_mask = BD71828_MASK_BUCK5_VOLT,
377-
.idle_mask = BD71828_MASK_BUCK5_VOLT,
378-
.suspend_mask = BD71828_MASK_BUCK5_VOLT,
379-
.lpsr_mask = BD71828_MASK_BUCK5_VOLT,
380359
.idle_on_mask = BD71828_MASK_IDLE_EN,
381360
.suspend_on_mask = BD71828_MASK_SUSP_EN,
382361
.lpsr_on_mask = BD71828_MASK_LPSR_EN,
@@ -493,13 +472,7 @@ static const struct bd71828_regulator_data bd71828_rdata[] = {
493472
ROHM_DVS_LEVEL_SUSPEND |
494473
ROHM_DVS_LEVEL_LPSR,
495474
.run_reg = BD71828_REG_LDO1_VOLT,
496-
.idle_reg = BD71828_REG_LDO1_VOLT,
497-
.suspend_reg = BD71828_REG_LDO1_VOLT,
498-
.lpsr_reg = BD71828_REG_LDO1_VOLT,
499475
.run_mask = BD71828_MASK_LDO_VOLT,
500-
.idle_mask = BD71828_MASK_LDO_VOLT,
501-
.suspend_mask = BD71828_MASK_LDO_VOLT,
502-
.lpsr_mask = BD71828_MASK_LDO_VOLT,
503476
.idle_on_mask = BD71828_MASK_IDLE_EN,
504477
.suspend_on_mask = BD71828_MASK_SUSP_EN,
505478
.lpsr_on_mask = BD71828_MASK_LPSR_EN,
@@ -533,13 +506,7 @@ static const struct bd71828_regulator_data bd71828_rdata[] = {
533506
ROHM_DVS_LEVEL_SUSPEND |
534507
ROHM_DVS_LEVEL_LPSR,
535508
.run_reg = BD71828_REG_LDO2_VOLT,
536-
.idle_reg = BD71828_REG_LDO2_VOLT,
537-
.suspend_reg = BD71828_REG_LDO2_VOLT,
538-
.lpsr_reg = BD71828_REG_LDO2_VOLT,
539509
.run_mask = BD71828_MASK_LDO_VOLT,
540-
.idle_mask = BD71828_MASK_LDO_VOLT,
541-
.suspend_mask = BD71828_MASK_LDO_VOLT,
542-
.lpsr_mask = BD71828_MASK_LDO_VOLT,
543510
.idle_on_mask = BD71828_MASK_IDLE_EN,
544511
.suspend_on_mask = BD71828_MASK_SUSP_EN,
545512
.lpsr_on_mask = BD71828_MASK_LPSR_EN,
@@ -573,13 +540,7 @@ static const struct bd71828_regulator_data bd71828_rdata[] = {
573540
ROHM_DVS_LEVEL_SUSPEND |
574541
ROHM_DVS_LEVEL_LPSR,
575542
.run_reg = BD71828_REG_LDO3_VOLT,
576-
.idle_reg = BD71828_REG_LDO3_VOLT,
577-
.suspend_reg = BD71828_REG_LDO3_VOLT,
578-
.lpsr_reg = BD71828_REG_LDO3_VOLT,
579543
.run_mask = BD71828_MASK_LDO_VOLT,
580-
.idle_mask = BD71828_MASK_LDO_VOLT,
581-
.suspend_mask = BD71828_MASK_LDO_VOLT,
582-
.lpsr_mask = BD71828_MASK_LDO_VOLT,
583544
.idle_on_mask = BD71828_MASK_IDLE_EN,
584545
.suspend_on_mask = BD71828_MASK_SUSP_EN,
585546
.lpsr_on_mask = BD71828_MASK_LPSR_EN,
@@ -614,13 +575,7 @@ static const struct bd71828_regulator_data bd71828_rdata[] = {
614575
ROHM_DVS_LEVEL_SUSPEND |
615576
ROHM_DVS_LEVEL_LPSR,
616577
.run_reg = BD71828_REG_LDO4_VOLT,
617-
.idle_reg = BD71828_REG_LDO4_VOLT,
618-
.suspend_reg = BD71828_REG_LDO4_VOLT,
619-
.lpsr_reg = BD71828_REG_LDO4_VOLT,
620578
.run_mask = BD71828_MASK_LDO_VOLT,
621-
.idle_mask = BD71828_MASK_LDO_VOLT,
622-
.suspend_mask = BD71828_MASK_LDO_VOLT,
623-
.lpsr_mask = BD71828_MASK_LDO_VOLT,
624579
.idle_on_mask = BD71828_MASK_IDLE_EN,
625580
.suspend_on_mask = BD71828_MASK_SUSP_EN,
626581
.lpsr_on_mask = BD71828_MASK_LPSR_EN,
@@ -655,13 +610,7 @@ static const struct bd71828_regulator_data bd71828_rdata[] = {
655610
ROHM_DVS_LEVEL_SUSPEND |
656611
ROHM_DVS_LEVEL_LPSR,
657612
.run_reg = BD71828_REG_LDO5_VOLT,
658-
.idle_reg = BD71828_REG_LDO5_VOLT,
659-
.suspend_reg = BD71828_REG_LDO5_VOLT,
660-
.lpsr_reg = BD71828_REG_LDO5_VOLT,
661613
.run_mask = BD71828_MASK_LDO_VOLT,
662-
.idle_mask = BD71828_MASK_LDO_VOLT,
663-
.suspend_mask = BD71828_MASK_LDO_VOLT,
664-
.lpsr_mask = BD71828_MASK_LDO_VOLT,
665614
.idle_on_mask = BD71828_MASK_IDLE_EN,
666615
.suspend_on_mask = BD71828_MASK_SUSP_EN,
667616
.lpsr_on_mask = BD71828_MASK_LPSR_EN,
@@ -720,9 +669,6 @@ static const struct bd71828_regulator_data bd71828_rdata[] = {
720669
.suspend_reg = BD71828_REG_LDO7_VOLT,
721670
.lpsr_reg = BD71828_REG_LDO7_VOLT,
722671
.run_mask = BD71828_MASK_LDO_VOLT,
723-
.idle_mask = BD71828_MASK_LDO_VOLT,
724-
.suspend_mask = BD71828_MASK_LDO_VOLT,
725-
.lpsr_mask = BD71828_MASK_LDO_VOLT,
726672
.idle_on_mask = BD71828_MASK_IDLE_EN,
727673
.suspend_on_mask = BD71828_MASK_SUSP_EN,
728674
.lpsr_on_mask = BD71828_MASK_LPSR_EN,

0 commit comments

Comments
 (0)