1 // SPDX-License-Identifier: GPL-2.0
2 // Copyright (C) 2018 ROHM Semiconductors
3 // bd71837-regulator.c ROHM BD71837MWV/BD71847MWV regulator driver
5 #include <linux/delay.h>
7 #include <linux/interrupt.h>
8 #include <linux/kernel.h>
9 #include <linux/mfd/rohm-bd718x7.h>
10 #include <linux/module.h>
12 #include <linux/platform_device.h>
13 #include <linux/regulator/driver.h>
14 #include <linux/regulator/machine.h>
15 #include <linux/regulator/of_regulator.h>
16 #include <linux/slab.h>
20 * BUCK1RAMPRATE[1:0] BUCK1 DVS ramp rate setting
21 * 00: 10.00mV/usec 10mV 1uS
22 * 01: 5.00mV/usec 10mV 2uS
23 * 10: 2.50mV/usec 10mV 4uS
24 * 11: 1.25mV/usec 10mV 8uS
26 static int bd718xx_buck1234_set_ramp_delay(struct regulator_dev
*rdev
,
29 int id
= rdev_get_id(rdev
);
30 unsigned int ramp_value
;
32 dev_dbg(&rdev
->dev
, "Buck[%d] Set Ramp = %d\n", id
+ 1,
36 ramp_value
= BUCK_RAMPRATE_1P25MV
;
39 ramp_value
= BUCK_RAMPRATE_2P50MV
;
42 ramp_value
= BUCK_RAMPRATE_5P00MV
;
45 ramp_value
= BUCK_RAMPRATE_10P00MV
;
48 ramp_value
= BUCK_RAMPRATE_10P00MV
;
50 "%s: ramp_delay: %d not supported, setting 10000mV//us\n",
51 rdev
->desc
->name
, ramp_delay
);
54 return regmap_update_bits(rdev
->regmap
, BD718XX_REG_BUCK1_CTRL
+ id
,
55 BUCK_RAMPRATE_MASK
, ramp_value
<< 6);
58 /* Bucks 1 to 4 support DVS. PWM mode is used when voltage is changed.
59 * Bucks 5 to 8 and LDOs can use PFM and must be disabled when voltage
60 * is changed. Hence we return -EBUSY for these if voltage is changed
61 * when BUCK/LDO is enabled.
63 static int bd718xx_set_voltage_sel_restricted(struct regulator_dev
*rdev
,
66 if (regulator_is_enabled_regmap(rdev
))
69 return regulator_set_voltage_sel_regmap(rdev
, sel
);
72 static int bd718xx_set_voltage_sel_pickable_restricted(
73 struct regulator_dev
*rdev
, unsigned int sel
)
75 if (regulator_is_enabled_regmap(rdev
))
78 return regulator_set_voltage_sel_pickable_regmap(rdev
, sel
);
81 static const struct regulator_ops bd718xx_pickable_range_ldo_ops
= {
82 .enable
= regulator_enable_regmap
,
83 .disable
= regulator_disable_regmap
,
84 .is_enabled
= regulator_is_enabled_regmap
,
85 .list_voltage
= regulator_list_voltage_pickable_linear_range
,
86 .set_voltage_sel
= bd718xx_set_voltage_sel_pickable_restricted
,
87 .get_voltage_sel
= regulator_get_voltage_sel_pickable_regmap
,
90 static const struct regulator_ops bd718xx_pickable_range_buck_ops
= {
91 .enable
= regulator_enable_regmap
,
92 .disable
= regulator_disable_regmap
,
93 .is_enabled
= regulator_is_enabled_regmap
,
94 .list_voltage
= regulator_list_voltage_pickable_linear_range
,
95 .set_voltage_sel
= bd718xx_set_voltage_sel_pickable_restricted
,
96 .get_voltage_sel
= regulator_get_voltage_sel_pickable_regmap
,
97 .set_voltage_time_sel
= regulator_set_voltage_time_sel
,
100 static const struct regulator_ops bd718xx_ldo_regulator_ops
= {
101 .enable
= regulator_enable_regmap
,
102 .disable
= regulator_disable_regmap
,
103 .is_enabled
= regulator_is_enabled_regmap
,
104 .list_voltage
= regulator_list_voltage_linear_range
,
105 .set_voltage_sel
= bd718xx_set_voltage_sel_restricted
,
106 .get_voltage_sel
= regulator_get_voltage_sel_regmap
,
109 static const struct regulator_ops bd718xx_ldo_regulator_nolinear_ops
= {
110 .enable
= regulator_enable_regmap
,
111 .disable
= regulator_disable_regmap
,
112 .is_enabled
= regulator_is_enabled_regmap
,
113 .list_voltage
= regulator_list_voltage_table
,
114 .set_voltage_sel
= bd718xx_set_voltage_sel_restricted
,
115 .get_voltage_sel
= regulator_get_voltage_sel_regmap
,
118 static const struct regulator_ops bd718xx_buck_regulator_ops
= {
119 .enable
= regulator_enable_regmap
,
120 .disable
= regulator_disable_regmap
,
121 .is_enabled
= regulator_is_enabled_regmap
,
122 .list_voltage
= regulator_list_voltage_linear_range
,
123 .set_voltage_sel
= bd718xx_set_voltage_sel_restricted
,
124 .get_voltage_sel
= regulator_get_voltage_sel_regmap
,
125 .set_voltage_time_sel
= regulator_set_voltage_time_sel
,
128 static const struct regulator_ops bd718xx_buck_regulator_nolinear_ops
= {
129 .enable
= regulator_enable_regmap
,
130 .disable
= regulator_disable_regmap
,
131 .is_enabled
= regulator_is_enabled_regmap
,
132 .list_voltage
= regulator_list_voltage_table
,
133 .map_voltage
= regulator_map_voltage_ascend
,
134 .set_voltage_sel
= bd718xx_set_voltage_sel_restricted
,
135 .get_voltage_sel
= regulator_get_voltage_sel_regmap
,
136 .set_voltage_time_sel
= regulator_set_voltage_time_sel
,
139 static const struct regulator_ops bd718xx_dvs_buck_regulator_ops
= {
140 .enable
= regulator_enable_regmap
,
141 .disable
= regulator_disable_regmap
,
142 .is_enabled
= regulator_is_enabled_regmap
,
143 .list_voltage
= regulator_list_voltage_linear_range
,
144 .set_voltage_sel
= regulator_set_voltage_sel_regmap
,
145 .get_voltage_sel
= regulator_get_voltage_sel_regmap
,
146 .set_voltage_time_sel
= regulator_set_voltage_time_sel
,
147 .set_ramp_delay
= bd718xx_buck1234_set_ramp_delay
,
151 * BD71837 BUCK1/2/3/4
153 * 0.70 to 1.30V (10mV step)
155 static const struct regulator_linear_range bd718xx_dvs_buck_volts
[] = {
156 REGULATOR_LINEAR_RANGE(700000, 0x00, 0x3C, 10000),
157 REGULATOR_LINEAR_RANGE(1300000, 0x3D, 0x3F, 0),
162 * 0.7V to 1.35V (range 0)
164 * 0.675 to 1.325 (range 1)
166 static const struct regulator_linear_range bd71837_buck5_volts
[] = {
167 /* Ranges when VOLT_SEL bit is 0 */
168 REGULATOR_LINEAR_RANGE(700000, 0x00, 0x03, 100000),
169 REGULATOR_LINEAR_RANGE(1050000, 0x04, 0x05, 50000),
170 REGULATOR_LINEAR_RANGE(1200000, 0x06, 0x07, 150000),
171 /* Ranges when VOLT_SEL bit is 1 */
172 REGULATOR_LINEAR_RANGE(675000, 0x0, 0x3, 100000),
173 REGULATOR_LINEAR_RANGE(1025000, 0x4, 0x5, 50000),
174 REGULATOR_LINEAR_RANGE(1175000, 0x6, 0x7, 150000),
178 * Range selector for first 3 linear ranges is 0x0
179 * and 0x1 for last 3 ranges.
181 static const unsigned int bd71837_buck5_volt_range_sel
[] = {
182 0x0, 0x0, 0x0, 0x80, 0x80, 0x80
188 static const struct regulator_linear_range bd71847_buck3_volts
[] = {
189 /* Ranges when VOLT_SEL bits are 00 */
190 REGULATOR_LINEAR_RANGE(700000, 0x00, 0x03, 100000),
191 REGULATOR_LINEAR_RANGE(1050000, 0x04, 0x05, 50000),
192 REGULATOR_LINEAR_RANGE(1200000, 0x06, 0x07, 150000),
193 /* Ranges when VOLT_SEL bits are 01 */
194 REGULATOR_LINEAR_RANGE(550000, 0x0, 0x7, 50000),
195 /* Ranges when VOLT_SEL bits are 11 */
196 REGULATOR_LINEAR_RANGE(675000, 0x0, 0x3, 100000),
197 REGULATOR_LINEAR_RANGE(1025000, 0x4, 0x5, 50000),
198 REGULATOR_LINEAR_RANGE(1175000, 0x6, 0x7, 150000),
201 static const unsigned int bd71847_buck3_volt_range_sel
[] = {
202 0x0, 0x0, 0x0, 0x40, 0x80, 0x80, 0x80
205 static const struct regulator_linear_range bd71847_buck4_volts
[] = {
206 REGULATOR_LINEAR_RANGE(3000000, 0x00, 0x03, 100000),
207 REGULATOR_LINEAR_RANGE(2600000, 0x00, 0x03, 100000),
210 static const unsigned int bd71847_buck4_volt_range_sel
[] = { 0x0, 0x40 };
214 * 3.0V to 3.3V (step 100mV)
216 static const struct regulator_linear_range bd71837_buck6_volts
[] = {
217 REGULATOR_LINEAR_RANGE(3000000, 0x00, 0x03, 100000),
226 * 011 = 1.8V (Initial)
232 static const unsigned int bd718xx_3rd_nodvs_buck_volts
[] = {
233 1605000, 1695000, 1755000, 1800000, 1845000, 1905000, 1950000, 1995000
238 * 0.8V to 1.40V (step 10mV)
240 static const struct regulator_linear_range bd718xx_4th_nodvs_buck_volts
[] = {
241 REGULATOR_LINEAR_RANGE(800000, 0x00, 0x3C, 10000),
246 * 3.0 to 3.3V (100mV step)
248 static const struct regulator_linear_range bd718xx_ldo1_volts
[] = {
249 REGULATOR_LINEAR_RANGE(3000000, 0x00, 0x03, 100000),
250 REGULATOR_LINEAR_RANGE(1600000, 0x00, 0x03, 100000),
253 static const unsigned int bd718xx_ldo1_volt_range_sel
[] = { 0x0, 0x20 };
259 static const unsigned int ldo_2_volts
[] = {
265 * 1.8 to 3.3V (100mV step)
267 static const struct regulator_linear_range bd718xx_ldo3_volts
[] = {
268 REGULATOR_LINEAR_RANGE(1800000, 0x00, 0x0F, 100000),
273 * 0.9 to 1.8V (100mV step)
275 static const struct regulator_linear_range bd718xx_ldo4_volts
[] = {
276 REGULATOR_LINEAR_RANGE(900000, 0x00, 0x09, 100000),
281 * 1.8 to 3.3V (100mV step)
283 static const struct regulator_linear_range bd71837_ldo5_volts
[] = {
284 REGULATOR_LINEAR_RANGE(1800000, 0x00, 0x0F, 100000),
289 * 1.8 to 3.3V (100mV step)
291 static const struct regulator_linear_range bd71847_ldo5_volts
[] = {
292 REGULATOR_LINEAR_RANGE(1800000, 0x00, 0x0F, 100000),
293 REGULATOR_LINEAR_RANGE(800000, 0x00, 0x0F, 100000),
296 static const unsigned int bd71847_ldo5_volt_range_sel
[] = { 0x0, 0x20 };
300 * 0.9 to 1.8V (100mV step)
302 static const struct regulator_linear_range bd718xx_ldo6_volts
[] = {
303 REGULATOR_LINEAR_RANGE(900000, 0x00, 0x09, 100000),
308 * 1.8 to 3.3V (100mV step)
310 static const struct regulator_linear_range bd71837_ldo7_volts
[] = {
311 REGULATOR_LINEAR_RANGE(1800000, 0x00, 0x0F, 100000),
319 struct bd718xx_regulator_data
{
320 struct regulator_desc desc
;
321 const struct rohm_dvs_config dvs
;
322 const struct reg_init init
;
323 const struct reg_init
*additional_inits
;
324 int additional_init_amnt
;
328 * There is a HW quirk in BD71837. The shutdown sequence timings for
329 * bucks/LDOs which are controlled via register interface are changed.
330 * At PMIC poweroff the voltage for BUCK6/7 is cut immediately at the
331 * beginning of shut-down sequence. As bucks 6 and 7 are parent
332 * supplies for LDO5 and LDO6 - this causes LDO5/6 voltage
333 * monitoring to errorneously detect under voltage and force PMIC to
334 * emergency state instead of poweroff. In order to avoid this we
335 * disable voltage monitoring for LDO5 and LDO6
337 static const struct reg_init bd71837_ldo5_inits
[] = {
339 .reg
= BD718XX_REG_MVRFLTMASK2
,
340 .mask
= BD718XX_LDO5_VRMON80
,
341 .val
= BD718XX_LDO5_VRMON80
,
345 static const struct reg_init bd71837_ldo6_inits
[] = {
347 .reg
= BD718XX_REG_MVRFLTMASK2
,
348 .mask
= BD718XX_LDO6_VRMON80
,
349 .val
= BD718XX_LDO6_VRMON80
,
353 static int buck_set_hw_dvs_levels(struct device_node
*np
,
354 const struct regulator_desc
*desc
,
355 struct regulator_config
*cfg
)
357 struct bd718xx_regulator_data
*data
;
359 data
= container_of(desc
, struct bd718xx_regulator_data
, desc
);
361 return rohm_regulator_set_dvs_levels(&data
->dvs
, np
, desc
, cfg
->regmap
);
364 static const struct bd718xx_regulator_data bd71847_regulators
[] = {
368 .of_match
= of_match_ptr("BUCK1"),
369 .regulators_node
= of_match_ptr("regulators"),
371 .ops
= &bd718xx_dvs_buck_regulator_ops
,
372 .type
= REGULATOR_VOLTAGE
,
373 .n_voltages
= BD718XX_DVS_BUCK_VOLTAGE_NUM
,
374 .linear_ranges
= bd718xx_dvs_buck_volts
,
376 ARRAY_SIZE(bd718xx_dvs_buck_volts
),
377 .vsel_reg
= BD718XX_REG_BUCK1_VOLT_RUN
,
378 .vsel_mask
= DVS_BUCK_RUN_MASK
,
379 .enable_reg
= BD718XX_REG_BUCK1_CTRL
,
380 .enable_mask
= BD718XX_BUCK_EN
,
381 .owner
= THIS_MODULE
,
382 .of_parse_cb
= buck_set_hw_dvs_levels
,
385 .level_map
= ROHM_DVS_LEVEL_RUN
| ROHM_DVS_LEVEL_IDLE
|
386 ROHM_DVS_LEVEL_SUSPEND
,
387 .run_reg
= BD718XX_REG_BUCK1_VOLT_RUN
,
388 .run_mask
= DVS_BUCK_RUN_MASK
,
389 .idle_reg
= BD718XX_REG_BUCK1_VOLT_IDLE
,
390 .idle_mask
= DVS_BUCK_RUN_MASK
,
391 .suspend_reg
= BD718XX_REG_BUCK1_VOLT_SUSP
,
392 .suspend_mask
= DVS_BUCK_RUN_MASK
,
395 .reg
= BD718XX_REG_BUCK1_CTRL
,
396 .mask
= BD718XX_BUCK_SEL
,
397 .val
= BD718XX_BUCK_SEL
,
403 .of_match
= of_match_ptr("BUCK2"),
404 .regulators_node
= of_match_ptr("regulators"),
406 .ops
= &bd718xx_dvs_buck_regulator_ops
,
407 .type
= REGULATOR_VOLTAGE
,
408 .n_voltages
= BD718XX_DVS_BUCK_VOLTAGE_NUM
,
409 .linear_ranges
= bd718xx_dvs_buck_volts
,
410 .n_linear_ranges
= ARRAY_SIZE(bd718xx_dvs_buck_volts
),
411 .vsel_reg
= BD718XX_REG_BUCK2_VOLT_RUN
,
412 .vsel_mask
= DVS_BUCK_RUN_MASK
,
413 .enable_reg
= BD718XX_REG_BUCK2_CTRL
,
414 .enable_mask
= BD718XX_BUCK_EN
,
415 .owner
= THIS_MODULE
,
416 .of_parse_cb
= buck_set_hw_dvs_levels
,
419 .level_map
= ROHM_DVS_LEVEL_RUN
| ROHM_DVS_LEVEL_IDLE
,
420 .run_reg
= BD718XX_REG_BUCK2_VOLT_RUN
,
421 .run_mask
= DVS_BUCK_RUN_MASK
,
422 .idle_reg
= BD718XX_REG_BUCK2_VOLT_IDLE
,
423 .idle_mask
= DVS_BUCK_RUN_MASK
,
426 .reg
= BD718XX_REG_BUCK2_CTRL
,
427 .mask
= BD718XX_BUCK_SEL
,
428 .val
= BD718XX_BUCK_SEL
,
434 .of_match
= of_match_ptr("BUCK3"),
435 .regulators_node
= of_match_ptr("regulators"),
437 .ops
= &bd718xx_pickable_range_buck_ops
,
438 .type
= REGULATOR_VOLTAGE
,
439 .n_voltages
= BD71847_BUCK3_VOLTAGE_NUM
,
440 .linear_ranges
= bd71847_buck3_volts
,
442 ARRAY_SIZE(bd71847_buck3_volts
),
443 .vsel_reg
= BD718XX_REG_1ST_NODVS_BUCK_VOLT
,
444 .vsel_mask
= BD718XX_1ST_NODVS_BUCK_MASK
,
445 .vsel_range_reg
= BD718XX_REG_1ST_NODVS_BUCK_VOLT
,
446 .vsel_range_mask
= BD71847_BUCK3_RANGE_MASK
,
447 .linear_range_selectors
= bd71847_buck3_volt_range_sel
,
448 .enable_reg
= BD718XX_REG_1ST_NODVS_BUCK_CTRL
,
449 .enable_mask
= BD718XX_BUCK_EN
,
450 .owner
= THIS_MODULE
,
453 .reg
= BD718XX_REG_1ST_NODVS_BUCK_CTRL
,
454 .mask
= BD718XX_BUCK_SEL
,
455 .val
= BD718XX_BUCK_SEL
,
461 .of_match
= of_match_ptr("BUCK4"),
462 .regulators_node
= of_match_ptr("regulators"),
464 .ops
= &bd718xx_pickable_range_buck_ops
,
465 .type
= REGULATOR_VOLTAGE
,
466 .n_voltages
= BD71847_BUCK4_VOLTAGE_NUM
,
467 .linear_ranges
= bd71847_buck4_volts
,
469 ARRAY_SIZE(bd71847_buck4_volts
),
470 .enable_reg
= BD718XX_REG_2ND_NODVS_BUCK_CTRL
,
471 .vsel_reg
= BD718XX_REG_2ND_NODVS_BUCK_VOLT
,
472 .vsel_mask
= BD71847_BUCK4_MASK
,
473 .vsel_range_reg
= BD718XX_REG_2ND_NODVS_BUCK_VOLT
,
474 .vsel_range_mask
= BD71847_BUCK4_RANGE_MASK
,
475 .linear_range_selectors
= bd71847_buck4_volt_range_sel
,
476 .enable_mask
= BD718XX_BUCK_EN
,
477 .owner
= THIS_MODULE
,
480 .reg
= BD718XX_REG_2ND_NODVS_BUCK_CTRL
,
481 .mask
= BD718XX_BUCK_SEL
,
482 .val
= BD718XX_BUCK_SEL
,
488 .of_match
= of_match_ptr("BUCK5"),
489 .regulators_node
= of_match_ptr("regulators"),
491 .ops
= &bd718xx_buck_regulator_nolinear_ops
,
492 .type
= REGULATOR_VOLTAGE
,
493 .volt_table
= &bd718xx_3rd_nodvs_buck_volts
[0],
494 .n_voltages
= ARRAY_SIZE(bd718xx_3rd_nodvs_buck_volts
),
495 .vsel_reg
= BD718XX_REG_3RD_NODVS_BUCK_VOLT
,
496 .vsel_mask
= BD718XX_3RD_NODVS_BUCK_MASK
,
497 .enable_reg
= BD718XX_REG_3RD_NODVS_BUCK_CTRL
,
498 .enable_mask
= BD718XX_BUCK_EN
,
499 .owner
= THIS_MODULE
,
502 .reg
= BD718XX_REG_3RD_NODVS_BUCK_CTRL
,
503 .mask
= BD718XX_BUCK_SEL
,
504 .val
= BD718XX_BUCK_SEL
,
510 .of_match
= of_match_ptr("BUCK6"),
511 .regulators_node
= of_match_ptr("regulators"),
513 .ops
= &bd718xx_buck_regulator_ops
,
514 .type
= REGULATOR_VOLTAGE
,
515 .n_voltages
= BD718XX_4TH_NODVS_BUCK_VOLTAGE_NUM
,
516 .linear_ranges
= bd718xx_4th_nodvs_buck_volts
,
518 ARRAY_SIZE(bd718xx_4th_nodvs_buck_volts
),
519 .vsel_reg
= BD718XX_REG_4TH_NODVS_BUCK_VOLT
,
520 .vsel_mask
= BD718XX_4TH_NODVS_BUCK_MASK
,
521 .enable_reg
= BD718XX_REG_4TH_NODVS_BUCK_CTRL
,
522 .enable_mask
= BD718XX_BUCK_EN
,
523 .owner
= THIS_MODULE
,
526 .reg
= BD718XX_REG_4TH_NODVS_BUCK_CTRL
,
527 .mask
= BD718XX_BUCK_SEL
,
528 .val
= BD718XX_BUCK_SEL
,
534 .of_match
= of_match_ptr("LDO1"),
535 .regulators_node
= of_match_ptr("regulators"),
537 .ops
= &bd718xx_pickable_range_ldo_ops
,
538 .type
= REGULATOR_VOLTAGE
,
539 .n_voltages
= BD718XX_LDO1_VOLTAGE_NUM
,
540 .linear_ranges
= bd718xx_ldo1_volts
,
541 .n_linear_ranges
= ARRAY_SIZE(bd718xx_ldo1_volts
),
542 .vsel_reg
= BD718XX_REG_LDO1_VOLT
,
543 .vsel_mask
= BD718XX_LDO1_MASK
,
544 .vsel_range_reg
= BD718XX_REG_LDO1_VOLT
,
545 .vsel_range_mask
= BD718XX_LDO1_RANGE_MASK
,
546 .linear_range_selectors
= bd718xx_ldo1_volt_range_sel
,
547 .enable_reg
= BD718XX_REG_LDO1_VOLT
,
548 .enable_mask
= BD718XX_LDO_EN
,
549 .owner
= THIS_MODULE
,
552 .reg
= BD718XX_REG_LDO1_VOLT
,
553 .mask
= BD718XX_LDO_SEL
,
554 .val
= BD718XX_LDO_SEL
,
560 .of_match
= of_match_ptr("LDO2"),
561 .regulators_node
= of_match_ptr("regulators"),
563 .ops
= &bd718xx_ldo_regulator_nolinear_ops
,
564 .type
= REGULATOR_VOLTAGE
,
565 .volt_table
= &ldo_2_volts
[0],
566 .vsel_reg
= BD718XX_REG_LDO2_VOLT
,
567 .vsel_mask
= BD718XX_LDO2_MASK
,
568 .n_voltages
= ARRAY_SIZE(ldo_2_volts
),
569 .enable_reg
= BD718XX_REG_LDO2_VOLT
,
570 .enable_mask
= BD718XX_LDO_EN
,
571 .owner
= THIS_MODULE
,
574 .reg
= BD718XX_REG_LDO2_VOLT
,
575 .mask
= BD718XX_LDO_SEL
,
576 .val
= BD718XX_LDO_SEL
,
582 .of_match
= of_match_ptr("LDO3"),
583 .regulators_node
= of_match_ptr("regulators"),
585 .ops
= &bd718xx_ldo_regulator_ops
,
586 .type
= REGULATOR_VOLTAGE
,
587 .n_voltages
= BD718XX_LDO3_VOLTAGE_NUM
,
588 .linear_ranges
= bd718xx_ldo3_volts
,
589 .n_linear_ranges
= ARRAY_SIZE(bd718xx_ldo3_volts
),
590 .vsel_reg
= BD718XX_REG_LDO3_VOLT
,
591 .vsel_mask
= BD718XX_LDO3_MASK
,
592 .enable_reg
= BD718XX_REG_LDO3_VOLT
,
593 .enable_mask
= BD718XX_LDO_EN
,
594 .owner
= THIS_MODULE
,
597 .reg
= BD718XX_REG_LDO3_VOLT
,
598 .mask
= BD718XX_LDO_SEL
,
599 .val
= BD718XX_LDO_SEL
,
605 .of_match
= of_match_ptr("LDO4"),
606 .regulators_node
= of_match_ptr("regulators"),
608 .ops
= &bd718xx_ldo_regulator_ops
,
609 .type
= REGULATOR_VOLTAGE
,
610 .n_voltages
= BD718XX_LDO4_VOLTAGE_NUM
,
611 .linear_ranges
= bd718xx_ldo4_volts
,
612 .n_linear_ranges
= ARRAY_SIZE(bd718xx_ldo4_volts
),
613 .vsel_reg
= BD718XX_REG_LDO4_VOLT
,
614 .vsel_mask
= BD718XX_LDO4_MASK
,
615 .enable_reg
= BD718XX_REG_LDO4_VOLT
,
616 .enable_mask
= BD718XX_LDO_EN
,
617 .owner
= THIS_MODULE
,
620 .reg
= BD718XX_REG_LDO4_VOLT
,
621 .mask
= BD718XX_LDO_SEL
,
622 .val
= BD718XX_LDO_SEL
,
628 .of_match
= of_match_ptr("LDO5"),
629 .regulators_node
= of_match_ptr("regulators"),
631 .ops
= &bd718xx_pickable_range_ldo_ops
,
632 .type
= REGULATOR_VOLTAGE
,
633 .n_voltages
= BD71847_LDO5_VOLTAGE_NUM
,
634 .linear_ranges
= bd71847_ldo5_volts
,
635 .n_linear_ranges
= ARRAY_SIZE(bd71847_ldo5_volts
),
636 .vsel_reg
= BD718XX_REG_LDO5_VOLT
,
637 .vsel_mask
= BD71847_LDO5_MASK
,
638 .vsel_range_reg
= BD718XX_REG_LDO5_VOLT
,
639 .vsel_range_mask
= BD71847_LDO5_RANGE_MASK
,
640 .linear_range_selectors
= bd71847_ldo5_volt_range_sel
,
641 .enable_reg
= BD718XX_REG_LDO5_VOLT
,
642 .enable_mask
= BD718XX_LDO_EN
,
643 .owner
= THIS_MODULE
,
646 .reg
= BD718XX_REG_LDO5_VOLT
,
647 .mask
= BD718XX_LDO_SEL
,
648 .val
= BD718XX_LDO_SEL
,
654 .of_match
= of_match_ptr("LDO6"),
655 .regulators_node
= of_match_ptr("regulators"),
657 .ops
= &bd718xx_ldo_regulator_ops
,
658 .type
= REGULATOR_VOLTAGE
,
659 .n_voltages
= BD718XX_LDO6_VOLTAGE_NUM
,
660 .linear_ranges
= bd718xx_ldo6_volts
,
661 .n_linear_ranges
= ARRAY_SIZE(bd718xx_ldo6_volts
),
662 /* LDO6 is supplied by buck5 */
663 .supply_name
= "buck5",
664 .vsel_reg
= BD718XX_REG_LDO6_VOLT
,
665 .vsel_mask
= BD718XX_LDO6_MASK
,
666 .enable_reg
= BD718XX_REG_LDO6_VOLT
,
667 .enable_mask
= BD718XX_LDO_EN
,
668 .owner
= THIS_MODULE
,
671 .reg
= BD718XX_REG_LDO6_VOLT
,
672 .mask
= BD718XX_LDO_SEL
,
673 .val
= BD718XX_LDO_SEL
,
678 static const struct bd718xx_regulator_data bd71837_regulators
[] = {
682 .of_match
= of_match_ptr("BUCK1"),
683 .regulators_node
= of_match_ptr("regulators"),
685 .ops
= &bd718xx_dvs_buck_regulator_ops
,
686 .type
= REGULATOR_VOLTAGE
,
687 .n_voltages
= BD718XX_DVS_BUCK_VOLTAGE_NUM
,
688 .linear_ranges
= bd718xx_dvs_buck_volts
,
689 .n_linear_ranges
= ARRAY_SIZE(bd718xx_dvs_buck_volts
),
690 .vsel_reg
= BD718XX_REG_BUCK1_VOLT_RUN
,
691 .vsel_mask
= DVS_BUCK_RUN_MASK
,
692 .enable_reg
= BD718XX_REG_BUCK1_CTRL
,
693 .enable_mask
= BD718XX_BUCK_EN
,
694 .owner
= THIS_MODULE
,
695 .of_parse_cb
= buck_set_hw_dvs_levels
,
698 .level_map
= ROHM_DVS_LEVEL_RUN
| ROHM_DVS_LEVEL_IDLE
|
699 ROHM_DVS_LEVEL_SUSPEND
,
700 .run_reg
= BD718XX_REG_BUCK1_VOLT_RUN
,
701 .run_mask
= DVS_BUCK_RUN_MASK
,
702 .idle_reg
= BD718XX_REG_BUCK1_VOLT_IDLE
,
703 .idle_mask
= DVS_BUCK_RUN_MASK
,
704 .suspend_reg
= BD718XX_REG_BUCK1_VOLT_SUSP
,
705 .suspend_mask
= DVS_BUCK_RUN_MASK
,
708 .reg
= BD718XX_REG_BUCK1_CTRL
,
709 .mask
= BD718XX_BUCK_SEL
,
710 .val
= BD718XX_BUCK_SEL
,
716 .of_match
= of_match_ptr("BUCK2"),
717 .regulators_node
= of_match_ptr("regulators"),
719 .ops
= &bd718xx_dvs_buck_regulator_ops
,
720 .type
= REGULATOR_VOLTAGE
,
721 .n_voltages
= BD718XX_DVS_BUCK_VOLTAGE_NUM
,
722 .linear_ranges
= bd718xx_dvs_buck_volts
,
723 .n_linear_ranges
= ARRAY_SIZE(bd718xx_dvs_buck_volts
),
724 .vsel_reg
= BD718XX_REG_BUCK2_VOLT_RUN
,
725 .vsel_mask
= DVS_BUCK_RUN_MASK
,
726 .enable_reg
= BD718XX_REG_BUCK2_CTRL
,
727 .enable_mask
= BD718XX_BUCK_EN
,
728 .owner
= THIS_MODULE
,
729 .of_parse_cb
= buck_set_hw_dvs_levels
,
732 .level_map
= ROHM_DVS_LEVEL_RUN
| ROHM_DVS_LEVEL_IDLE
,
733 .run_reg
= BD718XX_REG_BUCK2_VOLT_RUN
,
734 .run_mask
= DVS_BUCK_RUN_MASK
,
735 .idle_reg
= BD718XX_REG_BUCK2_VOLT_IDLE
,
736 .idle_mask
= DVS_BUCK_RUN_MASK
,
739 .reg
= BD718XX_REG_BUCK2_CTRL
,
740 .mask
= BD718XX_BUCK_SEL
,
741 .val
= BD718XX_BUCK_SEL
,
747 .of_match
= of_match_ptr("BUCK3"),
748 .regulators_node
= of_match_ptr("regulators"),
750 .ops
= &bd718xx_dvs_buck_regulator_ops
,
751 .type
= REGULATOR_VOLTAGE
,
752 .n_voltages
= BD718XX_DVS_BUCK_VOLTAGE_NUM
,
753 .linear_ranges
= bd718xx_dvs_buck_volts
,
754 .n_linear_ranges
= ARRAY_SIZE(bd718xx_dvs_buck_volts
),
755 .vsel_reg
= BD71837_REG_BUCK3_VOLT_RUN
,
756 .vsel_mask
= DVS_BUCK_RUN_MASK
,
757 .enable_reg
= BD71837_REG_BUCK3_CTRL
,
758 .enable_mask
= BD718XX_BUCK_EN
,
759 .owner
= THIS_MODULE
,
760 .of_parse_cb
= buck_set_hw_dvs_levels
,
763 .level_map
= ROHM_DVS_LEVEL_RUN
,
764 .run_reg
= BD71837_REG_BUCK3_VOLT_RUN
,
765 .run_mask
= DVS_BUCK_RUN_MASK
,
768 .reg
= BD71837_REG_BUCK3_CTRL
,
769 .mask
= BD718XX_BUCK_SEL
,
770 .val
= BD718XX_BUCK_SEL
,
776 .of_match
= of_match_ptr("BUCK4"),
777 .regulators_node
= of_match_ptr("regulators"),
779 .ops
= &bd718xx_dvs_buck_regulator_ops
,
780 .type
= REGULATOR_VOLTAGE
,
781 .n_voltages
= BD718XX_DVS_BUCK_VOLTAGE_NUM
,
782 .linear_ranges
= bd718xx_dvs_buck_volts
,
783 .n_linear_ranges
= ARRAY_SIZE(bd718xx_dvs_buck_volts
),
784 .vsel_reg
= BD71837_REG_BUCK4_VOLT_RUN
,
785 .vsel_mask
= DVS_BUCK_RUN_MASK
,
786 .enable_reg
= BD71837_REG_BUCK4_CTRL
,
787 .enable_mask
= BD718XX_BUCK_EN
,
788 .owner
= THIS_MODULE
,
789 .of_parse_cb
= buck_set_hw_dvs_levels
,
792 .level_map
= ROHM_DVS_LEVEL_RUN
,
793 .run_reg
= BD71837_REG_BUCK4_VOLT_RUN
,
794 .run_mask
= DVS_BUCK_RUN_MASK
,
797 .reg
= BD71837_REG_BUCK4_CTRL
,
798 .mask
= BD718XX_BUCK_SEL
,
799 .val
= BD718XX_BUCK_SEL
,
805 .of_match
= of_match_ptr("BUCK5"),
806 .regulators_node
= of_match_ptr("regulators"),
808 .ops
= &bd718xx_pickable_range_buck_ops
,
809 .type
= REGULATOR_VOLTAGE
,
810 .n_voltages
= BD71837_BUCK5_VOLTAGE_NUM
,
811 .linear_ranges
= bd71837_buck5_volts
,
813 ARRAY_SIZE(bd71837_buck5_volts
),
814 .vsel_reg
= BD718XX_REG_1ST_NODVS_BUCK_VOLT
,
815 .vsel_mask
= BD71837_BUCK5_MASK
,
816 .vsel_range_reg
= BD718XX_REG_1ST_NODVS_BUCK_VOLT
,
817 .vsel_range_mask
= BD71837_BUCK5_RANGE_MASK
,
818 .linear_range_selectors
= bd71837_buck5_volt_range_sel
,
819 .enable_reg
= BD718XX_REG_1ST_NODVS_BUCK_CTRL
,
820 .enable_mask
= BD718XX_BUCK_EN
,
821 .owner
= THIS_MODULE
,
824 .reg
= BD718XX_REG_1ST_NODVS_BUCK_CTRL
,
825 .mask
= BD718XX_BUCK_SEL
,
826 .val
= BD718XX_BUCK_SEL
,
832 .of_match
= of_match_ptr("BUCK6"),
833 .regulators_node
= of_match_ptr("regulators"),
835 .ops
= &bd718xx_buck_regulator_ops
,
836 .type
= REGULATOR_VOLTAGE
,
837 .n_voltages
= BD71837_BUCK6_VOLTAGE_NUM
,
838 .linear_ranges
= bd71837_buck6_volts
,
840 ARRAY_SIZE(bd71837_buck6_volts
),
841 .vsel_reg
= BD718XX_REG_2ND_NODVS_BUCK_VOLT
,
842 .vsel_mask
= BD71837_BUCK6_MASK
,
843 .enable_reg
= BD718XX_REG_2ND_NODVS_BUCK_CTRL
,
844 .enable_mask
= BD718XX_BUCK_EN
,
845 .owner
= THIS_MODULE
,
848 .reg
= BD718XX_REG_2ND_NODVS_BUCK_CTRL
,
849 .mask
= BD718XX_BUCK_SEL
,
850 .val
= BD718XX_BUCK_SEL
,
856 .of_match
= of_match_ptr("BUCK7"),
857 .regulators_node
= of_match_ptr("regulators"),
859 .ops
= &bd718xx_buck_regulator_nolinear_ops
,
860 .type
= REGULATOR_VOLTAGE
,
861 .volt_table
= &bd718xx_3rd_nodvs_buck_volts
[0],
862 .n_voltages
= ARRAY_SIZE(bd718xx_3rd_nodvs_buck_volts
),
863 .vsel_reg
= BD718XX_REG_3RD_NODVS_BUCK_VOLT
,
864 .vsel_mask
= BD718XX_3RD_NODVS_BUCK_MASK
,
865 .enable_reg
= BD718XX_REG_3RD_NODVS_BUCK_CTRL
,
866 .enable_mask
= BD718XX_BUCK_EN
,
867 .owner
= THIS_MODULE
,
870 .reg
= BD718XX_REG_3RD_NODVS_BUCK_CTRL
,
871 .mask
= BD718XX_BUCK_SEL
,
872 .val
= BD718XX_BUCK_SEL
,
878 .of_match
= of_match_ptr("BUCK8"),
879 .regulators_node
= of_match_ptr("regulators"),
881 .ops
= &bd718xx_buck_regulator_ops
,
882 .type
= REGULATOR_VOLTAGE
,
883 .n_voltages
= BD718XX_4TH_NODVS_BUCK_VOLTAGE_NUM
,
884 .linear_ranges
= bd718xx_4th_nodvs_buck_volts
,
886 ARRAY_SIZE(bd718xx_4th_nodvs_buck_volts
),
887 .vsel_reg
= BD718XX_REG_4TH_NODVS_BUCK_VOLT
,
888 .vsel_mask
= BD718XX_4TH_NODVS_BUCK_MASK
,
889 .enable_reg
= BD718XX_REG_4TH_NODVS_BUCK_CTRL
,
890 .enable_mask
= BD718XX_BUCK_EN
,
891 .owner
= THIS_MODULE
,
894 .reg
= BD718XX_REG_4TH_NODVS_BUCK_CTRL
,
895 .mask
= BD718XX_BUCK_SEL
,
896 .val
= BD718XX_BUCK_SEL
,
902 .of_match
= of_match_ptr("LDO1"),
903 .regulators_node
= of_match_ptr("regulators"),
905 .ops
= &bd718xx_pickable_range_ldo_ops
,
906 .type
= REGULATOR_VOLTAGE
,
907 .n_voltages
= BD718XX_LDO1_VOLTAGE_NUM
,
908 .linear_ranges
= bd718xx_ldo1_volts
,
909 .n_linear_ranges
= ARRAY_SIZE(bd718xx_ldo1_volts
),
910 .vsel_reg
= BD718XX_REG_LDO1_VOLT
,
911 .vsel_mask
= BD718XX_LDO1_MASK
,
912 .vsel_range_reg
= BD718XX_REG_LDO1_VOLT
,
913 .vsel_range_mask
= BD718XX_LDO1_RANGE_MASK
,
914 .linear_range_selectors
= bd718xx_ldo1_volt_range_sel
,
915 .enable_reg
= BD718XX_REG_LDO1_VOLT
,
916 .enable_mask
= BD718XX_LDO_EN
,
917 .owner
= THIS_MODULE
,
920 .reg
= BD718XX_REG_LDO1_VOLT
,
921 .mask
= BD718XX_LDO_SEL
,
922 .val
= BD718XX_LDO_SEL
,
928 .of_match
= of_match_ptr("LDO2"),
929 .regulators_node
= of_match_ptr("regulators"),
931 .ops
= &bd718xx_ldo_regulator_nolinear_ops
,
932 .type
= REGULATOR_VOLTAGE
,
933 .volt_table
= &ldo_2_volts
[0],
934 .vsel_reg
= BD718XX_REG_LDO2_VOLT
,
935 .vsel_mask
= BD718XX_LDO2_MASK
,
936 .n_voltages
= ARRAY_SIZE(ldo_2_volts
),
937 .enable_reg
= BD718XX_REG_LDO2_VOLT
,
938 .enable_mask
= BD718XX_LDO_EN
,
939 .owner
= THIS_MODULE
,
942 .reg
= BD718XX_REG_LDO2_VOLT
,
943 .mask
= BD718XX_LDO_SEL
,
944 .val
= BD718XX_LDO_SEL
,
950 .of_match
= of_match_ptr("LDO3"),
951 .regulators_node
= of_match_ptr("regulators"),
953 .ops
= &bd718xx_ldo_regulator_ops
,
954 .type
= REGULATOR_VOLTAGE
,
955 .n_voltages
= BD718XX_LDO3_VOLTAGE_NUM
,
956 .linear_ranges
= bd718xx_ldo3_volts
,
957 .n_linear_ranges
= ARRAY_SIZE(bd718xx_ldo3_volts
),
958 .vsel_reg
= BD718XX_REG_LDO3_VOLT
,
959 .vsel_mask
= BD718XX_LDO3_MASK
,
960 .enable_reg
= BD718XX_REG_LDO3_VOLT
,
961 .enable_mask
= BD718XX_LDO_EN
,
962 .owner
= THIS_MODULE
,
965 .reg
= BD718XX_REG_LDO3_VOLT
,
966 .mask
= BD718XX_LDO_SEL
,
967 .val
= BD718XX_LDO_SEL
,
973 .of_match
= of_match_ptr("LDO4"),
974 .regulators_node
= of_match_ptr("regulators"),
976 .ops
= &bd718xx_ldo_regulator_ops
,
977 .type
= REGULATOR_VOLTAGE
,
978 .n_voltages
= BD718XX_LDO4_VOLTAGE_NUM
,
979 .linear_ranges
= bd718xx_ldo4_volts
,
980 .n_linear_ranges
= ARRAY_SIZE(bd718xx_ldo4_volts
),
981 .vsel_reg
= BD718XX_REG_LDO4_VOLT
,
982 .vsel_mask
= BD718XX_LDO4_MASK
,
983 .enable_reg
= BD718XX_REG_LDO4_VOLT
,
984 .enable_mask
= BD718XX_LDO_EN
,
985 .owner
= THIS_MODULE
,
988 .reg
= BD718XX_REG_LDO4_VOLT
,
989 .mask
= BD718XX_LDO_SEL
,
990 .val
= BD718XX_LDO_SEL
,
996 .of_match
= of_match_ptr("LDO5"),
997 .regulators_node
= of_match_ptr("regulators"),
999 .ops
= &bd718xx_ldo_regulator_ops
,
1000 .type
= REGULATOR_VOLTAGE
,
1001 .n_voltages
= BD71837_LDO5_VOLTAGE_NUM
,
1002 .linear_ranges
= bd71837_ldo5_volts
,
1003 .n_linear_ranges
= ARRAY_SIZE(bd71837_ldo5_volts
),
1004 /* LDO5 is supplied by buck6 */
1005 .supply_name
= "buck6",
1006 .vsel_reg
= BD718XX_REG_LDO5_VOLT
,
1007 .vsel_mask
= BD71837_LDO5_MASK
,
1008 .enable_reg
= BD718XX_REG_LDO5_VOLT
,
1009 .enable_mask
= BD718XX_LDO_EN
,
1010 .owner
= THIS_MODULE
,
1013 .reg
= BD718XX_REG_LDO5_VOLT
,
1014 .mask
= BD718XX_LDO_SEL
,
1015 .val
= BD718XX_LDO_SEL
,
1017 .additional_inits
= bd71837_ldo5_inits
,
1018 .additional_init_amnt
= ARRAY_SIZE(bd71837_ldo5_inits
),
1023 .of_match
= of_match_ptr("LDO6"),
1024 .regulators_node
= of_match_ptr("regulators"),
1026 .ops
= &bd718xx_ldo_regulator_ops
,
1027 .type
= REGULATOR_VOLTAGE
,
1028 .n_voltages
= BD718XX_LDO6_VOLTAGE_NUM
,
1029 .linear_ranges
= bd718xx_ldo6_volts
,
1030 .n_linear_ranges
= ARRAY_SIZE(bd718xx_ldo6_volts
),
1031 /* LDO6 is supplied by buck7 */
1032 .supply_name
= "buck7",
1033 .vsel_reg
= BD718XX_REG_LDO6_VOLT
,
1034 .vsel_mask
= BD718XX_LDO6_MASK
,
1035 .enable_reg
= BD718XX_REG_LDO6_VOLT
,
1036 .enable_mask
= BD718XX_LDO_EN
,
1037 .owner
= THIS_MODULE
,
1040 .reg
= BD718XX_REG_LDO6_VOLT
,
1041 .mask
= BD718XX_LDO_SEL
,
1042 .val
= BD718XX_LDO_SEL
,
1044 .additional_inits
= bd71837_ldo6_inits
,
1045 .additional_init_amnt
= ARRAY_SIZE(bd71837_ldo6_inits
),
1050 .of_match
= of_match_ptr("LDO7"),
1051 .regulators_node
= of_match_ptr("regulators"),
1053 .ops
= &bd718xx_ldo_regulator_ops
,
1054 .type
= REGULATOR_VOLTAGE
,
1055 .n_voltages
= BD71837_LDO7_VOLTAGE_NUM
,
1056 .linear_ranges
= bd71837_ldo7_volts
,
1057 .n_linear_ranges
= ARRAY_SIZE(bd71837_ldo7_volts
),
1058 .vsel_reg
= BD71837_REG_LDO7_VOLT
,
1059 .vsel_mask
= BD71837_LDO7_MASK
,
1060 .enable_reg
= BD71837_REG_LDO7_VOLT
,
1061 .enable_mask
= BD718XX_LDO_EN
,
1062 .owner
= THIS_MODULE
,
1065 .reg
= BD71837_REG_LDO7_VOLT
,
1066 .mask
= BD718XX_LDO_SEL
,
1067 .val
= BD718XX_LDO_SEL
,
1072 static int bd718xx_probe(struct platform_device
*pdev
)
1074 struct bd718xx
*mfd
;
1075 struct regulator_config config
= { 0 };
1078 const struct bd718xx_regulator_data
*reg_data
;
1079 unsigned int num_reg_data
;
1080 enum rohm_chip_type chip
= platform_get_device_id(pdev
)->driver_data
;
1082 mfd
= dev_get_drvdata(pdev
->dev
.parent
);
1084 dev_err(&pdev
->dev
, "No MFD driver data\n");
1090 case ROHM_CHIP_TYPE_BD71837
:
1091 reg_data
= bd71837_regulators
;
1092 num_reg_data
= ARRAY_SIZE(bd71837_regulators
);
1094 case ROHM_CHIP_TYPE_BD71847
:
1095 reg_data
= bd71847_regulators
;
1096 num_reg_data
= ARRAY_SIZE(bd71847_regulators
);
1099 dev_err(&pdev
->dev
, "Unsupported chip type\n");
1104 /* Register LOCK release */
1105 err
= regmap_update_bits(mfd
->chip
.regmap
, BD718XX_REG_REGLOCK
,
1106 (REGLOCK_PWRSEQ
| REGLOCK_VREG
), 0);
1108 dev_err(&pdev
->dev
, "Failed to unlock PMIC (%d)\n", err
);
1111 dev_dbg(&pdev
->dev
, "Unlocked lock register 0x%x\n",
1112 BD718XX_REG_REGLOCK
);
1115 use_snvs
= of_property_read_bool(pdev
->dev
.parent
->of_node
,
1116 "rohm,reset-snvs-powered");
1119 * Change the next stage from poweroff to be READY instead of SNVS
1120 * for all reset types because OTP loading at READY will clear SEL
1121 * bit allowing HW defaults for power rails to be used
1124 err
= regmap_update_bits(mfd
->chip
.regmap
,
1125 BD718XX_REG_TRANS_COND1
,
1126 BD718XX_ON_REQ_POWEROFF_MASK
|
1127 BD718XX_SWRESET_POWEROFF_MASK
|
1128 BD718XX_WDOG_POWEROFF_MASK
|
1129 BD718XX_KEY_L_POWEROFF_MASK
,
1130 BD718XX_POWOFF_TO_RDY
);
1132 dev_err(&pdev
->dev
, "Failed to change reset target\n");
1136 "Changed all resets from SVNS to READY\n");
1140 for (i
= 0; i
< num_reg_data
; i
++) {
1142 const struct regulator_desc
*desc
;
1143 struct regulator_dev
*rdev
;
1144 const struct bd718xx_regulator_data
*r
;
1149 config
.dev
= pdev
->dev
.parent
;
1150 config
.regmap
= mfd
->chip
.regmap
;
1152 rdev
= devm_regulator_register(&pdev
->dev
, desc
, &config
);
1155 "failed to register %s regulator\n",
1157 err
= PTR_ERR(rdev
);
1162 * Regulator register gets the regulator constraints and
1163 * applies them (set_machine_constraints). This should have
1164 * turned the control register(s) to correct values and we
1165 * can now switch the control from PMIC state machine to the
1166 * register interface
1168 * At poweroff transition PMIC HW disables EN bit for
1169 * regulators but leaves SEL bit untouched. So if state
1170 * transition from POWEROFF is done to SNVS - then all power
1171 * rails controlled by SW (having SEL bit set) stay disabled
1172 * as EN is cleared. This will result boot failure if any
1173 * crucial systems are powered by these rails. We don't
1174 * enable SW control for crucial regulators if snvs state is
1177 if (!use_snvs
|| !rdev
->constraints
->always_on
||
1178 !rdev
->constraints
->boot_on
) {
1179 err
= regmap_update_bits(mfd
->chip
.regmap
, r
->init
.reg
,
1180 r
->init
.mask
, r
->init
.val
);
1183 "Failed to take control for (%s)\n",
1188 for (j
= 0; j
< r
->additional_init_amnt
; j
++) {
1189 err
= regmap_update_bits(mfd
->chip
.regmap
,
1190 r
->additional_inits
[j
].reg
,
1191 r
->additional_inits
[j
].mask
,
1192 r
->additional_inits
[j
].val
);
1195 "Buck (%s) initialization failed\n",
1206 static const struct platform_device_id bd718x7_pmic_id
[] = {
1207 { "bd71837-pmic", ROHM_CHIP_TYPE_BD71837
},
1208 { "bd71847-pmic", ROHM_CHIP_TYPE_BD71847
},
1211 MODULE_DEVICE_TABLE(platform
, bd718x7_pmic_id
);
1213 static struct platform_driver bd718xx_regulator
= {
1215 .name
= "bd718xx-pmic",
1217 .probe
= bd718xx_probe
,
1218 .id_table
= bd718x7_pmic_id
,
1221 module_platform_driver(bd718xx_regulator
);
1223 MODULE_AUTHOR("Matti Vaittinen <matti.vaittinen@fi.rohmeurope.com>");
1224 MODULE_DESCRIPTION("BD71837/BD71847 voltage regulator driver");
1225 MODULE_LICENSE("GPL");
1226 MODULE_ALIAS("platform:bd718xx-pmic");