Lines Matching +full:en +full:- +full:csi +full:- +full:v2 +full:- +full:0
1 // SPDX-License-Identifier: GPL-2.0-only
3 * Copyright (C) ST-Ericsson SA 2010
11 * ab8500-ext supports the following regulators:
12 * - VextSupply3
29 REGULATOR_SUPPLY("vddi", "mcde_disp_sony_acx424akp.0"),
31 REGULATOR_SUPPLY("vdd1", "samsung_s6d16d0.0"),
35 REGULATOR_SUPPLY("vcc", "gpio-keys.0"),
37 REGULATOR_SUPPLY("vcc", "2-0029"),
39 REGULATOR_SUPPLY("vdd", "2-0018"),
41 REGULATOR_SUPPLY("vdd", "2-0019"),
43 REGULATOR_SUPPLY("vdd", "2-001e"),
45 REGULATOR_SUPPLY("avdd", "3-005c"),
46 REGULATOR_SUPPLY("avdd", "3-005d"),
48 REGULATOR_SUPPLY("vdd", "3-004b"),
50 REGULATOR_SUPPLY("vdd", "2-0068"),
52 REGULATOR_SUPPLY("vdd", "3-0029"),
54 REGULATOR_SUPPLY("vdd", "2-005c"),
56 REGULATOR_SUPPLY("vcpin", "spi8.0"),
62 /* On-board eMMC power */
65 REGULATOR_SUPPLY("vcc-N2158", "ab8500-codec.0"),
67 REGULATOR_SUPPLY("vcc-N2158", "ab8500-acc-det.0"),
68 /* AB8500 Tv-out device */
69 REGULATOR_SUPPLY("vcc-N2158", "mcde_tv_ab8500.4"),
71 REGULATOR_SUPPLY("vcc-N2158", "av8100_hdmi.3"),
75 REGULATOR_SUPPLY("v-SD-STM", "stm"),
81 /* TV-out DENC supply */
82 REGULATOR_SUPPLY("vtvout", "ab8500-denc.0"),
83 /* Internal general-purpose ADC */
84 REGULATOR_SUPPLY("vddadc", "ab8500-gpadc.0"),
86 REGULATOR_SUPPLY("vddadc", "ab8500-charger.0"),
87 /* AB8500 Tv-out device */
92 /* AB8500 audio-codec main supply */
93 REGULATOR_SUPPLY("vaud", "ab8500-codec.0"),
97 /* AB8500 audio-codec Mic1 supply */
98 REGULATOR_SUPPLY("vamic1", "ab8500-codec.0"),
102 /* AB8500 audio-codec Mic2 supply */
103 REGULATOR_SUPPLY("vamic2", "ab8500-codec.0"),
107 /* AB8500 audio-codec DMic supply */
108 REGULATOR_SUPPLY("vdmic", "ab8500-codec.0"),
113 REGULATOR_SUPPLY("v-intcore", NULL),
115 REGULATOR_SUPPLY("vddulpivio18", "ab8500-usb.0"),
117 REGULATOR_SUPPLY("v-intcore", "abx500-clk.0"),
125 REGULATOR_SUPPLY("vdddsi1v2", "dsilink.0"),
128 /* DB8500 CSI */
138 INIT_REGULATOR_REGISTER(AB8500_REGUREQUESTCTRL2, 0xf0, 0x00),
145 INIT_REGULATOR_REGISTER(AB8500_REGUREQUESTCTRL3, 0xff, 0x00),
150 INIT_REGULATOR_REGISTER(AB8500_REGUREQUESTCTRL4, 0x07, 0x00),
157 INIT_REGULATOR_REGISTER(AB8500_REGUSYSCLKREQ1HPVALID1, 0xe8, 0x00),
163 INIT_REGULATOR_REGISTER(AB8500_REGUSYSCLKREQ1HPVALID2, 0x70, 0x40),
170 INIT_REGULATOR_REGISTER(AB8500_REGUHWHPREQ1VALID1, 0xe8, 0x00),
176 INIT_REGULATOR_REGISTER(AB8500_REGUHWHPREQ1VALID2, 0x07, 0x00),
183 INIT_REGULATOR_REGISTER(AB8500_REGUHWHPREQ2VALID1, 0xe8, 0x00),
189 INIT_REGULATOR_REGISTER(AB8500_REGUHWHPREQ2VALID2, 0x07, 0x04),
194 INIT_REGULATOR_REGISTER(AB8500_REGUSWHPREQVALID1, 0xa0, 0x00),
202 INIT_REGULATOR_REGISTER(AB8500_REGUSWHPREQVALID2, 0x1f, 0x00),
212 INIT_REGULATOR_REGISTER(AB8500_REGUSYSCLKREQVALID1, 0xfe, 0x2a),
222 INIT_REGULATOR_REGISTER(AB8500_REGUSYSCLKREQVALID2, 0xfe, 0x20),
230 INIT_REGULATOR_REGISTER(AB8500_REGUMISC1, 0xfe, 0x10),
237 INIT_REGULATOR_REGISTER(AB8500_VAUDIOSUPPLY, 0x1e, 0x00),
239 * Vamic1_dzout = high-Z when Vamic1 is disabled
240 * Vamic2_dzout = high-Z when Vamic2 is disabled
242 INIT_REGULATOR_REGISTER(AB8500_REGUCTRL1VAMIC, 0x03, 0x00),
247 INIT_REGULATOR_REGISTER(AB8500_VPLLVANAREGU, 0x0f, 0x02),
252 INIT_REGULATOR_REGISTER(AB8500_VREFDDR, 0x03, 0x00),
256 * VextSupply3Regu = force HP (-> STBB2=LP and TPS=LP)
257 * ExtSupply2Bypass = ExtSupply12LPn ball is 0 when Ena is 0
258 * ExtSupply3Bypass = ExtSupply3LPn ball is 0 when Ena is 0
260 INIT_REGULATOR_REGISTER(AB8500_EXTSUPPLYREGU, 0xff, 0x13),
265 INIT_REGULATOR_REGISTER(AB8500_VAUX12REGU, 0x0f, 0x01),
269 INIT_REGULATOR_REGISTER(AB8500_VRF1VAUX3REGU, 0x03, 0x00),
273 INIT_REGULATOR_REGISTER(AB8500_VAUX1SEL, 0x0f, 0x0C),
277 INIT_REGULATOR_REGISTER(AB8500_VAUX2SEL, 0x0f, 0x0d),
281 INIT_REGULATOR_REGISTER(AB8500_VRF1VAUX3SEL, 0x07, 0x07),
285 INIT_REGULATOR_REGISTER(AB8500_REGUCTRL2SPARE, 0x01, 0x00),
294 INIT_REGULATOR_REGISTER(AB8500_REGUCTRLDISCH, 0xfc, 0x00),
300 INIT_REGULATOR_REGISTER(AB8500_REGUCTRLDISCH2, 0x16, 0x00),
307 .supply_regulator = "ab8500-ext-supply3",
309 .name = "V-DISPLAY",
319 /* supplies to the on-board eMMC */
321 .supply_regulator = "ab8500-ext-supply3",
323 .name = "V-eMMC1",
337 .supply_regulator = "ab8500-ext-supply3",
339 .name = "V-MMC-SD",
354 .name = "V-TVOUT",
360 /* supply for ab8500-vaudio, VAUDIO LDO */
363 .name = "V-AUD",
369 /* supply for v-anamic1 VAMic1-LDO */
372 .name = "V-AMIC1",
378 /* supply for v-amic2, VAMIC2 LDO, reuse constants for AMIC1 */
381 .name = "V-AMIC2",
387 /* supply for v-dmic, VDMIC LDO */
390 .name = "V-DMIC",
396 /* supply for v-intcore12, VINTCORE12 LDO */
399 .name = "V-INTCORE",
413 /* supply for U8500 CSI-DSI, VANA LDO */
416 .name = "V-CSI-DSI",
427 REGULATOR_SUPPLY("vinvsim", "sim-detect.0"),
437 .name = "ab8500-ext-supply1",
448 .name = "ab8500-ext-supply2",
456 .name = "ab8500-ext-supply3",
478 * struct ab8500_ext_regulator_info - ab8500 regulator information
486 * @update_val_hp: bits to set EN pin active (LPn pin deactive)
488 * @update_val_lp: bits to set EN pin active and LPn pin active
514 return -EINVAL; in ab8500_ext_regulator_enable()
521 if (info->cfg && info->cfg->hwreq) in ab8500_ext_regulator_enable()
522 regval = info->update_val_hp; in ab8500_ext_regulator_enable()
524 regval = info->update_val; in ab8500_ext_regulator_enable()
526 ret = abx500_mask_and_set_register_interruptible(info->dev, in ab8500_ext_regulator_enable()
527 info->update_bank, info->update_reg, in ab8500_ext_regulator_enable()
528 info->update_mask, regval); in ab8500_ext_regulator_enable()
529 if (ret < 0) { in ab8500_ext_regulator_enable()
536 "%s-enable (bank, reg, mask, value): 0x%02x, 0x%02x, 0x%02x, 0x%02x\n", in ab8500_ext_regulator_enable()
537 info->desc.name, info->update_bank, info->update_reg, in ab8500_ext_regulator_enable()
538 info->update_mask, regval); in ab8500_ext_regulator_enable()
540 return 0; in ab8500_ext_regulator_enable()
551 return -EINVAL; in ab8500_ext_regulator_disable()
557 if (info->cfg && info->cfg->hwreq) in ab8500_ext_regulator_disable()
558 regval = info->update_val_hw; in ab8500_ext_regulator_disable()
560 regval = 0; in ab8500_ext_regulator_disable()
562 ret = abx500_mask_and_set_register_interruptible(info->dev, in ab8500_ext_regulator_disable()
563 info->update_bank, info->update_reg, in ab8500_ext_regulator_disable()
564 info->update_mask, regval); in ab8500_ext_regulator_disable()
565 if (ret < 0) { in ab8500_ext_regulator_disable()
571 dev_dbg(rdev_get_dev(rdev), "%s-disable (bank, reg, mask, value):" in ab8500_ext_regulator_disable()
572 " 0x%02x, 0x%02x, 0x%02x, 0x%02x\n", in ab8500_ext_regulator_disable()
573 info->desc.name, info->update_bank, info->update_reg, in ab8500_ext_regulator_disable()
574 info->update_mask, regval); in ab8500_ext_regulator_disable()
576 return 0; in ab8500_ext_regulator_disable()
587 return -EINVAL; in ab8500_ext_regulator_is_enabled()
590 ret = abx500_get_register_interruptible(info->dev, in ab8500_ext_regulator_is_enabled()
591 info->update_bank, info->update_reg, ®val); in ab8500_ext_regulator_is_enabled()
592 if (ret < 0) { in ab8500_ext_regulator_is_enabled()
594 "couldn't read 0x%x register\n", info->update_reg); in ab8500_ext_regulator_is_enabled()
598 dev_dbg(rdev_get_dev(rdev), "%s-is_enabled (bank, reg, mask, value):" in ab8500_ext_regulator_is_enabled()
599 " 0x%02x, 0x%02x, 0x%02x, 0x%02x\n", in ab8500_ext_regulator_is_enabled()
600 info->desc.name, info->update_bank, info->update_reg, in ab8500_ext_regulator_is_enabled()
601 info->update_mask, regval); in ab8500_ext_regulator_is_enabled()
603 if (((regval & info->update_mask) == info->update_val_lp) || in ab8500_ext_regulator_is_enabled()
604 ((regval & info->update_mask) == info->update_val_hp)) in ab8500_ext_regulator_is_enabled()
607 return 0; in ab8500_ext_regulator_is_enabled()
613 int ret = 0; in ab8500_ext_regulator_set_mode()
619 return -EINVAL; in ab8500_ext_regulator_set_mode()
624 regval = info->update_val_hp; in ab8500_ext_regulator_set_mode()
627 regval = info->update_val_lp; in ab8500_ext_regulator_set_mode()
631 return -EINVAL; in ab8500_ext_regulator_set_mode()
634 /* If regulator is enabled and info->cfg->hwreq is set, the regulator in ab8500_ext_regulator_set_mode()
639 !(info->cfg && info->cfg->hwreq)) { in ab8500_ext_regulator_set_mode()
640 ret = abx500_mask_and_set_register_interruptible(info->dev, in ab8500_ext_regulator_set_mode()
641 info->update_bank, info->update_reg, in ab8500_ext_regulator_set_mode()
642 info->update_mask, regval); in ab8500_ext_regulator_set_mode()
643 if (ret < 0) { in ab8500_ext_regulator_set_mode()
650 "%s-set_mode (bank, reg, mask, value): " in ab8500_ext_regulator_set_mode()
651 "0x%x, 0x%x, 0x%x, 0x%x\n", in ab8500_ext_regulator_set_mode()
652 info->desc.name, info->update_bank, info->update_reg, in ab8500_ext_regulator_set_mode()
653 info->update_mask, regval); in ab8500_ext_regulator_set_mode()
656 info->update_val = regval; in ab8500_ext_regulator_set_mode()
658 return 0; in ab8500_ext_regulator_set_mode()
668 return -EINVAL; in ab8500_ext_regulator_get_mode()
671 if (info->update_val == info->update_val_hp) in ab8500_ext_regulator_get_mode()
673 else if (info->update_val == info->update_val_lp) in ab8500_ext_regulator_get_mode()
676 ret = -EINVAL; in ab8500_ext_regulator_get_mode()
684 struct regulation_constraints *regu_constraints = rdev->constraints; in ab8500_ext_set_voltage()
688 return -EINVAL; in ab8500_ext_set_voltage()
691 if (regu_constraints->min_uV == min_uV && in ab8500_ext_set_voltage()
692 regu_constraints->max_uV == max_uV) in ab8500_ext_set_voltage()
693 return 0; in ab8500_ext_set_voltage()
698 regu_constraints->min_uV, regu_constraints->max_uV); in ab8500_ext_set_voltage()
700 return -EINVAL; in ab8500_ext_set_voltage()
706 struct regulation_constraints *regu_constraints = rdev->constraints; in ab8500_ext_list_voltage()
710 return -EINVAL; in ab8500_ext_list_voltage()
713 if (regu_constraints->min_uV && regu_constraints->max_uV) { in ab8500_ext_list_voltage()
714 if (regu_constraints->min_uV == regu_constraints->max_uV) in ab8500_ext_list_voltage()
715 return regu_constraints->min_uV; in ab8500_ext_list_voltage()
717 return -EINVAL; in ab8500_ext_list_voltage()
742 .update_bank = 0x04,
743 .update_reg = 0x08,
744 .update_mask = 0x03,
745 .update_val = 0x01,
746 .update_val_hp = 0x01,
747 .update_val_lp = 0x03,
748 .update_val_hw = 0x02,
760 .update_bank = 0x04,
761 .update_reg = 0x08,
762 .update_mask = 0x0c,
763 .update_val = 0x04,
764 .update_val_hp = 0x04,
765 .update_val_lp = 0x0c,
766 .update_val_hw = 0x08,
778 .update_bank = 0x04,
779 .update_reg = 0x08,
780 .update_mask = 0x30,
781 .update_val = 0x10,
782 .update_val_hp = 0x10,
783 .update_val_lp = 0x30,
784 .update_val_hw = 0x20,
790 struct ab8500 *ab8500 = dev_get_drvdata(pdev->dev.parent); in ab8500_ext_regulator_probe()
797 dev_err(&pdev->dev, "null mfd parent\n"); in ab8500_ext_regulator_probe()
798 return -EINVAL; in ab8500_ext_regulator_probe()
802 if (pdata->num_ext_regulator != ARRAY_SIZE(ab8500_ext_regulator_info)) { in ab8500_ext_regulator_probe()
803 dev_err(&pdev->dev, "Configuration error: size mismatch.\n"); in ab8500_ext_regulator_probe()
804 return -EINVAL; in ab8500_ext_regulator_probe()
813 info->update_val = 0x30; in ab8500_ext_regulator_probe()
814 info->update_val_hp = 0x30; in ab8500_ext_regulator_probe()
815 info->update_val_lp = 0x10; in ab8500_ext_regulator_probe()
819 for (i = 0; i < ARRAY_SIZE(ab8500_ext_regulator_info); i++) { in ab8500_ext_regulator_probe()
822 /* assign per-regulator data */ in ab8500_ext_regulator_probe()
824 info->dev = &pdev->dev; in ab8500_ext_regulator_probe()
825 info->cfg = (struct ab8500_ext_regulator_cfg *) in ab8500_ext_regulator_probe()
826 pdata->ext_regulator[i].driver_data; in ab8500_ext_regulator_probe()
828 config.dev = &pdev->dev; in ab8500_ext_regulator_probe()
830 config.init_data = &pdata->ext_regulator[i]; in ab8500_ext_regulator_probe()
833 rdev = devm_regulator_register(&pdev->dev, &info->desc, in ab8500_ext_regulator_probe()
836 dev_err(&pdev->dev, "failed to register regulator %s\n", in ab8500_ext_regulator_probe()
837 info->desc.name); in ab8500_ext_regulator_probe()
841 dev_dbg(&pdev->dev, "%s-probed\n", info->desc.name); in ab8500_ext_regulator_probe()
844 return 0; in ab8500_ext_regulator_probe()
850 .name = "ab8500-ext-regulator",
872 MODULE_LICENSE("GPL v2");
875 MODULE_ALIAS("platform:ab8500-ext-regulator");