Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

regulator: bd71828: Support ROHM BD72720

ROHM BD72720 is a power management IC which integrates 10 buck and 11 LDO
regulators. This PMIC has plenty of commonalities with the BD71828 and
BD71879.

The BD72720 does also have similar 'run-level'-concept as the BD71828 had.
It allows controlling the regulator's 'en masse', although only BUCK1
and LDO1 can utilize this in BD72720. Similar to BD71828, this 'en
masse' -control is not supported by this driver.

Support the voltage and enable/disable state control for the BD72720.

Signed-off-by: Matti Vaittinen <mazziesaccount@gmail.com>
Reviewed-by: Mark Brown <broonie@kernel.org>
Link: https://patch.msgid.link/88b82128648516d9dbb173044042f2a7a5dfdf1c.1765804226.git.mazziesaccount@gmail.com
Signed-off-by: Lee Jones <lee@kernel.org>

authored by

Matti Vaittinen and committed by
Lee Jones
f16a9d76 8dc33b7c

+993 -10
+4 -4
drivers/regulator/Kconfig
··· 241 241 will be called bd71815-regulator. 242 242 243 243 config REGULATOR_BD71828 244 - tristate "ROHM BD71828 Power Regulator" 244 + tristate "ROHM BD71828, BD72720 and BD73900 Power Regulators" 245 245 depends on MFD_ROHM_BD71828 246 246 select REGULATOR_ROHM 247 247 help 248 - This driver supports voltage regulators on ROHM BD71828 PMIC. 249 - This will enable support for the software controllable buck 250 - and LDO regulators. 248 + This driver supports voltage regulators on ROHM BD71828, 249 + BD71879, BD72720 and BD73900 PMICs. This will enable 250 + support for the software controllable buck and LDO regulators. 251 251 252 252 This driver can also be built as a module. If so, the module 253 253 will be called bd71828-regulator.
+989 -6
drivers/regulator/bd71828-regulator.c
··· 3 3 // bd71828-regulator.c ROHM BD71828GW-DS1 regulator driver 4 4 // 5 5 6 + #include <linux/cleanup.h> 6 7 #include <linux/delay.h> 7 8 #include <linux/err.h> 8 9 #include <linux/interrupt.h> 9 10 #include <linux/kernel.h> 10 11 #include <linux/mfd/rohm-bd71828.h> 12 + #include <linux/mfd/rohm-bd72720.h> 11 13 #include <linux/module.h> 14 + #include <linux/mod_devicetable.h> 12 15 #include <linux/of.h> 13 16 #include <linux/platform_device.h> 14 17 #include <linux/regmap.h> ··· 19 16 #include <linux/regulator/machine.h> 20 17 #include <linux/regulator/of_regulator.h> 21 18 19 + #define BD72720_MASK_LDON_HEAD GENMASK(2, 0) 22 20 struct reg_init { 23 21 unsigned int reg; 24 22 unsigned int mask; ··· 68 64 }, 69 65 }; 70 66 67 + #define BD72720_MASK_DVS_BUCK1_CTRL BIT(4) 68 + #define BD72720_MASK_DVS_LDO1_CTRL BIT(5) 69 + 70 + static const struct reg_init bd72720_buck1_inits[] = { 71 + { 72 + .reg = BD72720_REG_PS_CTRL_2, 73 + .mask = BD72720_MASK_DVS_BUCK1_CTRL, 74 + .val = 0, /* Disable "run-level" control */ 75 + }, 76 + }; 77 + 78 + static const struct reg_init bd72720_ldo1_inits[] = { 79 + { 80 + .reg = BD72720_REG_PS_CTRL_2, 81 + .mask = BD72720_MASK_DVS_LDO1_CTRL, 82 + .val = 0, /* Disable "run-level" control */ 83 + }, 84 + }; 85 + 86 + /* BD71828 Buck voltages */ 71 87 static const struct linear_range bd71828_buck1267_volts[] = { 72 88 REGULATOR_LINEAR_RANGE(500000, 0x00, 0xef, 6250), 73 89 REGULATOR_LINEAR_RANGE(2000000, 0xf0, 0xff, 0), ··· 108 84 REGULATOR_LINEAR_RANGE(3300000, 0x10, 0x1f, 0), 109 85 }; 110 86 87 + /* BD71828 LDO voltages */ 111 88 static const struct linear_range bd71828_ldo_volts[] = { 112 89 REGULATOR_LINEAR_RANGE(800000, 0x00, 0x31, 50000), 113 90 REGULATOR_LINEAR_RANGE(3300000, 0x32, 0x3f, 0), 114 91 }; 115 92 93 + /* BD72720 Buck voltages */ 94 + static const struct linear_range bd72720_buck1234_volts[] = { 95 + REGULATOR_LINEAR_RANGE(500000, 0x00, 0xc0, 6250), 96 + REGULATOR_LINEAR_RANGE(1700000, 0xc1, 0xff, 0), 97 + }; 98 + 99 + static const struct linear_range bd72720_buck589_volts[] = { 100 + REGULATOR_LINEAR_RANGE(500000, 0x00, 0x78, 10000), 101 + REGULATOR_LINEAR_RANGE(1700000, 0x79, 0xff, 0), 102 + }; 103 + 104 + static const struct linear_range bd72720_buck67_volts[] = { 105 + REGULATOR_LINEAR_RANGE(1500000, 0x00, 0xb4, 10000), 106 + REGULATOR_LINEAR_RANGE(3300000, 0xb5, 0xff, 0), 107 + }; 108 + 109 + /* 110 + * The BUCK10 on BD72720 has two modes of operation, depending on a LDON_HEAD 111 + * setting. When LDON_HEAD is 0x0, the behaviour is as with other bucks, eg. 112 + * voltage can be set to a values indicated below using the VSEL register. 113 + * 114 + * However, when LDON_HEAD is set to 0x1 ... 0x7, BUCK 10 voltage is, according 115 + * to the data-sheet, "automatically adjusted following LDON_HEAD setting and 116 + * clamped to BUCK10_VID setting". 117 + * 118 + * Again, reading the data-sheet shows a "typical connection" where the BUCK10 119 + * is used to supply the LDOs 1-4. My assumption is that in practice, this 120 + * means that the BUCK10 voltage will be adjusted based on the maximum output 121 + * of the LDO 1-4 (to minimize power loss). This makes sense. 122 + * 123 + * Auto-adjusting regulators aren't something I really like to model in the 124 + * driver though - and, if the auto-adjustment works as intended, then there 125 + * should really be no need to software to care about the buck10 voltages. 126 + * If enable/disable control is still needed, we can implement buck10 as a 127 + * regulator with only the enable/disable ops - and device-tree can be used 128 + * to model the supply-relations. I believe this could allow the regulator 129 + * framework to automagically disable the BUCK10 if all LDOs that are being 130 + * supplied by it are disabled. 131 + */ 132 + static const struct linear_range bd72720_buck10_volts[] = { 133 + REGULATOR_LINEAR_RANGE(500000, 0x00, 0xc0, 6250), 134 + REGULATOR_LINEAR_RANGE(1700000, 0xc1, 0xff, 0), 135 + }; 136 + 137 + /* BD72720 LDO voltages */ 138 + static const struct linear_range bd72720_ldo1234_volts[] = { 139 + REGULATOR_LINEAR_RANGE(500000, 0x00, 0x50, 6250), 140 + REGULATOR_LINEAR_RANGE(1000000, 0x51, 0x7f, 0), 141 + }; 142 + 143 + static const struct linear_range bd72720_ldo57891011_volts[] = { 144 + REGULATOR_LINEAR_RANGE(750000, 0x00, 0xff, 10000), 145 + }; 146 + 147 + static const struct linear_range bd72720_ldo6_volts[] = { 148 + REGULATOR_LINEAR_RANGE(600000, 0x00, 0x78, 10000), 149 + REGULATOR_LINEAR_RANGE(1800000, 0x79, 0x7f, 0), 150 + }; 151 + 116 152 static const unsigned int bd71828_ramp_delay[] = { 2500, 5000, 10000, 20000 }; 153 + 154 + /* 155 + * BD72720 supports setting both the ramp-up and ramp-down values 156 + * separately. Do we need to support ramp-down setting? 157 + */ 158 + static const unsigned int bd72720_ramp_delay[] = { 5000, 7500, 10000, 12500 }; 117 159 118 160 static int buck_set_hw_dvs_levels(struct device_node *np, 119 161 const struct regulator_desc *desc, ··· 259 169 .enable = regulator_enable_regmap, 260 170 .disable = regulator_disable_regmap, 261 171 .is_enabled = regulator_is_enabled_regmap, 172 + }; 173 + 174 + static const struct regulator_ops bd72720_regulator_ops = { 175 + .enable = regulator_enable_regmap, 176 + .disable = regulator_disable_regmap, 177 + .is_enabled = regulator_is_enabled_regmap, 178 + .list_voltage = regulator_list_voltage_linear_range, 179 + .set_voltage_sel = regulator_set_voltage_sel_regmap, 180 + .get_voltage_sel = regulator_get_voltage_sel_regmap, 181 + .set_voltage_time_sel = regulator_set_voltage_time_sel, 182 + .set_ramp_delay = regulator_set_ramp_delay_regmap, 183 + }; 184 + 185 + static const struct regulator_ops bd72720_buck10_ldon_head_op = { 186 + .enable = regulator_enable_regmap, 187 + .disable = regulator_disable_regmap, 188 + .is_enabled = regulator_is_enabled_regmap, 189 + .set_ramp_delay = regulator_set_ramp_delay_regmap, 262 190 }; 263 191 264 192 static const struct bd71828_regulator_data bd71828_rdata[] = { ··· 785 677 }, 786 678 }; 787 679 680 + #define BD72720_BUCK10_DESC_INDEX 10 681 + #define BD72720_NUM_BUCK_VOLTS 0x100 682 + #define BD72720_NUM_LDO_VOLTS 0x100 683 + #define BD72720_NUM_LDO12346_VOLTS 0x80 684 + 685 + static const struct bd71828_regulator_data bd72720_rdata[] = { 686 + { 687 + .desc = { 688 + .name = "buck1", 689 + .of_match = of_match_ptr("buck1"), 690 + .regulators_node = of_match_ptr("regulators"), 691 + .id = BD72720_BUCK1, 692 + .type = REGULATOR_VOLTAGE, 693 + 694 + /* 695 + * The BD72720 BUCK1 and LDO1 support GPIO toggled 696 + * sub-RUN states called RUN0, RUN1, RUN2 and RUN3. 697 + * The "operating mode" (sub-RUN states or normal) 698 + * can be changed by a register. 699 + * 700 + * When the sub-RUN states are used, the voltage and 701 + * enable state depend on a state specific 702 + * configuration. The voltage and enable configuration 703 + * for BUCK1 and LDO1 can be defined for each sub-RUN 704 + * state using BD72720_REG_[BUCK,LDO]1_VSEL_R[0,1,2,3] 705 + * voltage selection registers and the bits 706 + * BD72720_MASK_RUN_[0,1,2,3]_EN in the enable registers. 707 + * The PMIC will change both the BUCK1 and LDO1 voltages 708 + * to the states defined in these registers when 709 + * "DVS GPIOs" are toggled. 710 + * 711 + * If RUN 0 .. RUN 4 states are to be used, the normal 712 + * voltage configuration mechanisms do not apply 713 + * and we should overwrite the ops and ignore the 714 + * voltage setting/getting registers which are setup 715 + * here. This is not supported for now. If you need 716 + * this functionality, you may try merging functionality 717 + * from a downstream driver: 718 + * https://rohmsemiconductor.github.io/Linux-Kernel-PMIC-Drivers/BD72720/ 719 + */ 720 + .ops = &bd72720_regulator_ops, 721 + .linear_ranges = bd72720_buck1234_volts, 722 + .n_linear_ranges = ARRAY_SIZE(bd72720_buck1234_volts), 723 + .n_voltages = BD72720_NUM_BUCK_VOLTS, 724 + .enable_reg = BD72720_REG_BUCK1_ON, 725 + .enable_mask = BD72720_MASK_RUN_B_EN, 726 + .vsel_reg = BD72720_REG_BUCK1_VSEL_RB, 727 + .vsel_mask = BD72720_MASK_BUCK_VSEL, 728 + 729 + .ramp_delay_table = bd72720_ramp_delay, 730 + .n_ramp_values = ARRAY_SIZE(bd72720_ramp_delay), 731 + .ramp_reg = BD72720_REG_BUCK1_MODE, 732 + .ramp_mask = BD72720_MASK_RAMP_UP_DELAY, 733 + .owner = THIS_MODULE, 734 + .of_parse_cb = buck_set_hw_dvs_levels, 735 + }, 736 + .dvs = { 737 + .level_map = ROHM_DVS_LEVEL_RUN | ROHM_DVS_LEVEL_IDLE | 738 + ROHM_DVS_LEVEL_SUSPEND | 739 + ROHM_DVS_LEVEL_LPSR, /* Deep idle in data-sheet */ 740 + .run_reg = BD72720_REG_BUCK1_VSEL_RB, 741 + .run_mask = BD72720_MASK_BUCK_VSEL, 742 + .idle_reg = BD72720_REG_BUCK1_VSEL_I, 743 + .idle_mask = BD72720_MASK_BUCK_VSEL, 744 + .idle_on_mask = BD72720_MASK_IDLE_EN, 745 + .suspend_reg = BD72720_REG_BUCK1_VSEL_S, 746 + .suspend_mask = BD72720_MASK_BUCK_VSEL, 747 + .suspend_on_mask = BD72720_MASK_SUSPEND_EN, 748 + .lpsr_reg = BD72720_REG_BUCK1_VSEL_DI, 749 + .lpsr_mask = BD72720_MASK_BUCK_VSEL, 750 + .lpsr_on_mask = BD72720_MASK_DEEP_IDLE_EN, 751 + }, 752 + .reg_inits = bd72720_buck1_inits, 753 + .reg_init_amnt = ARRAY_SIZE(bd72720_buck1_inits), 754 + }, { 755 + .desc = { 756 + .name = "buck2", 757 + .of_match = of_match_ptr("buck2"), 758 + .regulators_node = of_match_ptr("regulators"), 759 + .id = BD72720_BUCK2, 760 + .type = REGULATOR_VOLTAGE, 761 + .ops = &bd72720_regulator_ops, 762 + .linear_ranges = bd72720_buck1234_volts, 763 + .n_linear_ranges = ARRAY_SIZE(bd72720_buck1234_volts), 764 + .n_voltages = BD72720_NUM_BUCK_VOLTS, 765 + .enable_reg = BD72720_REG_BUCK2_ON, 766 + .enable_mask = BD72720_MASK_RUN_B_EN, 767 + .vsel_reg = BD72720_REG_BUCK2_VSEL_R, 768 + .vsel_mask = BD72720_MASK_BUCK_VSEL, 769 + 770 + .ramp_delay_table = bd72720_ramp_delay, 771 + .n_ramp_values = ARRAY_SIZE(bd72720_ramp_delay), 772 + .ramp_reg = BD72720_REG_BUCK2_MODE, 773 + .ramp_mask = BD72720_MASK_RAMP_UP_DELAY, 774 + .owner = THIS_MODULE, 775 + .of_parse_cb = buck_set_hw_dvs_levels, 776 + }, 777 + .dvs = { 778 + .level_map = ROHM_DVS_LEVEL_RUN | ROHM_DVS_LEVEL_IDLE | 779 + ROHM_DVS_LEVEL_SUSPEND | 780 + ROHM_DVS_LEVEL_LPSR, 781 + .run_reg = BD72720_REG_BUCK2_VSEL_R, 782 + .run_mask = BD72720_MASK_BUCK_VSEL, 783 + .idle_reg = BD72720_REG_BUCK2_VSEL_I, 784 + .idle_mask = BD72720_MASK_BUCK_VSEL, 785 + .idle_on_mask = BD72720_MASK_IDLE_EN, 786 + .suspend_reg = BD72720_REG_BUCK2_VSEL_S, 787 + .suspend_mask = BD72720_MASK_BUCK_VSEL, 788 + .suspend_on_mask = BD72720_MASK_SUSPEND_EN, 789 + .lpsr_reg = BD72720_REG_BUCK2_VSEL_DI, 790 + .lpsr_mask = BD72720_MASK_BUCK_VSEL, 791 + .lpsr_on_mask = BD72720_MASK_DEEP_IDLE_EN, 792 + }, 793 + }, { 794 + .desc = { 795 + .name = "buck3", 796 + .of_match = of_match_ptr("buck3"), 797 + .regulators_node = of_match_ptr("regulators"), 798 + .id = BD72720_BUCK3, 799 + .type = REGULATOR_VOLTAGE, 800 + .ops = &bd72720_regulator_ops, 801 + .linear_ranges = bd72720_buck1234_volts, 802 + .n_linear_ranges = ARRAY_SIZE(bd72720_buck1234_volts), 803 + .n_voltages = BD72720_NUM_BUCK_VOLTS, 804 + .enable_reg = BD72720_REG_BUCK3_ON, 805 + .enable_mask = BD72720_MASK_RUN_B_EN, 806 + .vsel_reg = BD72720_REG_BUCK3_VSEL_R, 807 + .vsel_mask = BD72720_MASK_BUCK_VSEL, 808 + 809 + .ramp_delay_table = bd72720_ramp_delay, 810 + .n_ramp_values = ARRAY_SIZE(bd72720_ramp_delay), 811 + .ramp_reg = BD72720_REG_BUCK3_MODE, 812 + .ramp_mask = BD72720_MASK_RAMP_UP_DELAY, 813 + .owner = THIS_MODULE, 814 + .of_parse_cb = buck_set_hw_dvs_levels, 815 + }, 816 + .dvs = { 817 + .level_map = ROHM_DVS_LEVEL_RUN | ROHM_DVS_LEVEL_IDLE | 818 + ROHM_DVS_LEVEL_SUSPEND | 819 + ROHM_DVS_LEVEL_LPSR, 820 + .run_reg = BD72720_REG_BUCK3_VSEL_R, 821 + .run_mask = BD72720_MASK_BUCK_VSEL, 822 + .idle_reg = BD72720_REG_BUCK3_VSEL_I, 823 + .idle_mask = BD72720_MASK_BUCK_VSEL, 824 + .idle_on_mask = BD72720_MASK_IDLE_EN, 825 + .suspend_reg = BD72720_REG_BUCK3_VSEL_S, 826 + .suspend_mask = BD72720_MASK_BUCK_VSEL, 827 + .suspend_on_mask = BD72720_MASK_SUSPEND_EN, 828 + .lpsr_reg = BD72720_REG_BUCK3_VSEL_DI, 829 + .lpsr_mask = BD72720_MASK_BUCK_VSEL, 830 + .lpsr_on_mask = BD72720_MASK_DEEP_IDLE_EN, 831 + }, 832 + }, { 833 + .desc = { 834 + .name = "buck4", 835 + .of_match = of_match_ptr("buck4"), 836 + .regulators_node = of_match_ptr("regulators"), 837 + .id = BD72720_BUCK4, 838 + .type = REGULATOR_VOLTAGE, 839 + .ops = &bd72720_regulator_ops, 840 + .linear_ranges = bd72720_buck1234_volts, 841 + .n_linear_ranges = ARRAY_SIZE(bd72720_buck1234_volts), 842 + .n_voltages = BD72720_NUM_BUCK_VOLTS, 843 + .enable_reg = BD72720_REG_BUCK4_ON, 844 + .enable_mask = BD72720_MASK_RUN_B_EN, 845 + .vsel_reg = BD72720_REG_BUCK4_VSEL_R, 846 + .vsel_mask = BD72720_MASK_BUCK_VSEL, 847 + 848 + .ramp_delay_table = bd72720_ramp_delay, 849 + .n_ramp_values = ARRAY_SIZE(bd72720_ramp_delay), 850 + .ramp_reg = BD72720_REG_BUCK4_MODE, 851 + .ramp_mask = BD72720_MASK_RAMP_UP_DELAY, 852 + .owner = THIS_MODULE, 853 + .of_parse_cb = buck_set_hw_dvs_levels, 854 + }, 855 + .dvs = { 856 + .level_map = ROHM_DVS_LEVEL_RUN | ROHM_DVS_LEVEL_IDLE | 857 + ROHM_DVS_LEVEL_SUSPEND | 858 + ROHM_DVS_LEVEL_LPSR, 859 + .run_reg = BD72720_REG_BUCK4_VSEL_R, 860 + .run_mask = BD72720_MASK_BUCK_VSEL, 861 + .idle_reg = BD72720_REG_BUCK4_VSEL_I, 862 + .idle_mask = BD72720_MASK_BUCK_VSEL, 863 + .idle_on_mask = BD72720_MASK_IDLE_EN, 864 + .suspend_reg = BD72720_REG_BUCK4_VSEL_S, 865 + .suspend_mask = BD72720_MASK_BUCK_VSEL, 866 + .suspend_on_mask = BD72720_MASK_SUSPEND_EN, 867 + .lpsr_reg = BD72720_REG_BUCK4_VSEL_DI, 868 + .lpsr_mask = BD72720_MASK_BUCK_VSEL, 869 + .lpsr_on_mask = BD72720_MASK_DEEP_IDLE_EN, 870 + }, 871 + }, { 872 + .desc = { 873 + .name = "buck5", 874 + .of_match = of_match_ptr("buck5"), 875 + .regulators_node = of_match_ptr("regulators"), 876 + .id = BD72720_BUCK5, 877 + .type = REGULATOR_VOLTAGE, 878 + .ops = &bd72720_regulator_ops, 879 + .linear_ranges = bd72720_buck589_volts, 880 + .n_linear_ranges = ARRAY_SIZE(bd72720_buck589_volts), 881 + .n_voltages = BD72720_NUM_BUCK_VOLTS, 882 + .enable_reg = BD72720_REG_BUCK5_ON, 883 + .enable_mask = BD72720_MASK_RUN_B_EN, 884 + .vsel_reg = BD72720_REG_BUCK5_VSEL, 885 + .vsel_mask = BD72720_MASK_BUCK_VSEL, 886 + 887 + .ramp_delay_table = bd72720_ramp_delay, 888 + .n_ramp_values = ARRAY_SIZE(bd72720_ramp_delay), 889 + .ramp_reg = BD72720_REG_BUCK5_MODE, 890 + .ramp_mask = BD72720_MASK_RAMP_UP_DELAY, 891 + .owner = THIS_MODULE, 892 + .of_parse_cb = buck_set_hw_dvs_levels, 893 + }, 894 + .dvs = { 895 + .level_map = ROHM_DVS_LEVEL_RUN | ROHM_DVS_LEVEL_IDLE | 896 + ROHM_DVS_LEVEL_SUSPEND | 897 + ROHM_DVS_LEVEL_LPSR, 898 + .run_reg = BD72720_REG_BUCK5_VSEL, 899 + .run_mask = BD72720_MASK_BUCK_VSEL, 900 + .idle_on_mask = BD72720_MASK_IDLE_EN, 901 + .suspend_on_mask = BD72720_MASK_SUSPEND_EN, 902 + .lpsr_on_mask = BD72720_MASK_DEEP_IDLE_EN, 903 + }, 904 + }, { 905 + .desc = { 906 + .name = "buck6", 907 + .of_match = of_match_ptr("buck6"), 908 + .regulators_node = of_match_ptr("regulators"), 909 + .id = BD72720_BUCK6, 910 + .type = REGULATOR_VOLTAGE, 911 + .ops = &bd72720_regulator_ops, 912 + .linear_ranges = bd72720_buck67_volts, 913 + .n_linear_ranges = ARRAY_SIZE(bd72720_buck67_volts), 914 + .n_voltages = BD72720_NUM_BUCK_VOLTS, 915 + .enable_reg = BD72720_REG_BUCK6_ON, 916 + .enable_mask = BD72720_MASK_RUN_B_EN, 917 + .vsel_reg = BD72720_REG_BUCK6_VSEL, 918 + .vsel_mask = BD72720_MASK_BUCK_VSEL, 919 + 920 + .ramp_delay_table = bd72720_ramp_delay, 921 + .n_ramp_values = ARRAY_SIZE(bd72720_ramp_delay), 922 + .ramp_reg = BD72720_REG_BUCK6_MODE, 923 + .ramp_mask = BD72720_MASK_RAMP_UP_DELAY, 924 + .owner = THIS_MODULE, 925 + .of_parse_cb = buck_set_hw_dvs_levels, 926 + }, 927 + .dvs = { 928 + .level_map = ROHM_DVS_LEVEL_RUN | ROHM_DVS_LEVEL_IDLE | 929 + ROHM_DVS_LEVEL_SUSPEND | 930 + ROHM_DVS_LEVEL_LPSR, 931 + .run_reg = BD72720_REG_BUCK6_VSEL, 932 + .run_mask = BD72720_MASK_BUCK_VSEL, 933 + .idle_on_mask = BD72720_MASK_IDLE_EN, 934 + .suspend_on_mask = BD72720_MASK_SUSPEND_EN, 935 + .lpsr_on_mask = BD72720_MASK_DEEP_IDLE_EN, 936 + }, 937 + }, { 938 + .desc = { 939 + .name = "buck7", 940 + .of_match = of_match_ptr("buck7"), 941 + .regulators_node = of_match_ptr("regulators"), 942 + .id = BD72720_BUCK7, 943 + .type = REGULATOR_VOLTAGE, 944 + .ops = &bd72720_regulator_ops, 945 + .linear_ranges = bd72720_buck67_volts, 946 + .n_linear_ranges = ARRAY_SIZE(bd72720_buck67_volts), 947 + .n_voltages = BD72720_NUM_BUCK_VOLTS, 948 + .enable_reg = BD72720_REG_BUCK7_ON, 949 + .enable_mask = BD72720_MASK_RUN_B_EN, 950 + .vsel_reg = BD72720_REG_BUCK7_VSEL, 951 + .vsel_mask = BD72720_MASK_BUCK_VSEL, 952 + 953 + .ramp_delay_table = bd72720_ramp_delay, 954 + .n_ramp_values = ARRAY_SIZE(bd72720_ramp_delay), 955 + .ramp_reg = BD72720_REG_BUCK7_MODE, 956 + .ramp_mask = BD72720_MASK_RAMP_UP_DELAY, 957 + .owner = THIS_MODULE, 958 + .of_parse_cb = buck_set_hw_dvs_levels, 959 + }, 960 + .dvs = { 961 + .level_map = ROHM_DVS_LEVEL_RUN | ROHM_DVS_LEVEL_IDLE | 962 + ROHM_DVS_LEVEL_SUSPEND | 963 + ROHM_DVS_LEVEL_LPSR, 964 + .run_reg = BD72720_REG_BUCK7_VSEL, 965 + .run_mask = BD72720_MASK_BUCK_VSEL, 966 + .idle_on_mask = BD72720_MASK_IDLE_EN, 967 + .suspend_on_mask = BD72720_MASK_SUSPEND_EN, 968 + .lpsr_on_mask = BD72720_MASK_DEEP_IDLE_EN, 969 + }, 970 + }, { 971 + .desc = { 972 + .name = "buck8", 973 + .of_match = of_match_ptr("buck8"), 974 + .regulators_node = of_match_ptr("regulators"), 975 + .id = BD72720_BUCK8, 976 + .type = REGULATOR_VOLTAGE, 977 + .ops = &bd72720_regulator_ops, 978 + .linear_ranges = bd72720_buck589_volts, 979 + .n_linear_ranges = ARRAY_SIZE(bd72720_buck589_volts), 980 + .n_voltages = BD72720_NUM_BUCK_VOLTS, 981 + .enable_reg = BD72720_REG_BUCK8_ON, 982 + .enable_mask = BD72720_MASK_RUN_B_EN, 983 + .vsel_reg = BD72720_REG_BUCK8_VSEL, 984 + .vsel_mask = BD72720_MASK_BUCK_VSEL, 985 + 986 + .ramp_delay_table = bd72720_ramp_delay, 987 + .n_ramp_values = ARRAY_SIZE(bd72720_ramp_delay), 988 + .ramp_reg = BD72720_REG_BUCK8_MODE, 989 + .ramp_mask = BD72720_MASK_RAMP_UP_DELAY, 990 + .owner = THIS_MODULE, 991 + .of_parse_cb = buck_set_hw_dvs_levels, 992 + }, 993 + .dvs = { 994 + .level_map = ROHM_DVS_LEVEL_RUN | ROHM_DVS_LEVEL_IDLE | 995 + ROHM_DVS_LEVEL_SUSPEND | 996 + ROHM_DVS_LEVEL_LPSR, 997 + .run_reg = BD72720_REG_BUCK8_VSEL, 998 + .run_mask = BD72720_MASK_BUCK_VSEL, 999 + .idle_on_mask = BD72720_MASK_IDLE_EN, 1000 + .suspend_on_mask = BD72720_MASK_SUSPEND_EN, 1001 + .lpsr_on_mask = BD72720_MASK_DEEP_IDLE_EN, 1002 + }, 1003 + }, { 1004 + .desc = { 1005 + .name = "buck9", 1006 + .of_match = of_match_ptr("buck9"), 1007 + .regulators_node = of_match_ptr("regulators"), 1008 + .id = BD72720_BUCK9, 1009 + .type = REGULATOR_VOLTAGE, 1010 + .ops = &bd72720_regulator_ops, 1011 + .linear_ranges = bd72720_buck589_volts, 1012 + .n_linear_ranges = ARRAY_SIZE(bd72720_buck589_volts), 1013 + .n_voltages = BD72720_NUM_BUCK_VOLTS, 1014 + .enable_reg = BD72720_REG_BUCK9_ON, 1015 + .enable_mask = BD72720_MASK_RUN_B_EN, 1016 + .vsel_reg = BD72720_REG_BUCK9_VSEL, 1017 + .vsel_mask = BD72720_MASK_BUCK_VSEL, 1018 + 1019 + .ramp_delay_table = bd72720_ramp_delay, 1020 + .n_ramp_values = ARRAY_SIZE(bd72720_ramp_delay), 1021 + .ramp_reg = BD72720_REG_BUCK9_MODE, 1022 + .ramp_mask = BD72720_MASK_RAMP_UP_DELAY, 1023 + .owner = THIS_MODULE, 1024 + .of_parse_cb = buck_set_hw_dvs_levels, 1025 + }, 1026 + .dvs = { 1027 + .level_map = ROHM_DVS_LEVEL_RUN | ROHM_DVS_LEVEL_IDLE | 1028 + ROHM_DVS_LEVEL_SUSPEND | 1029 + ROHM_DVS_LEVEL_LPSR, 1030 + .run_reg = BD72720_REG_BUCK9_VSEL, 1031 + .run_mask = BD72720_MASK_BUCK_VSEL, 1032 + .idle_on_mask = BD72720_MASK_IDLE_EN, 1033 + .suspend_on_mask = BD72720_MASK_SUSPEND_EN, 1034 + .lpsr_on_mask = BD72720_MASK_DEEP_IDLE_EN, 1035 + }, 1036 + }, { 1037 + .desc = { 1038 + .name = "buck10", 1039 + .of_match = of_match_ptr("buck10"), 1040 + .regulators_node = of_match_ptr("regulators"), 1041 + .id = BD72720_BUCK10, 1042 + .type = REGULATOR_VOLTAGE, 1043 + .ops = &bd72720_regulator_ops, 1044 + .linear_ranges = bd72720_buck10_volts, 1045 + .n_linear_ranges = ARRAY_SIZE(bd72720_buck10_volts), 1046 + .n_voltages = BD72720_NUM_BUCK_VOLTS, 1047 + .enable_reg = BD72720_REG_BUCK10_ON, 1048 + .enable_mask = BD72720_MASK_RUN_B_EN, 1049 + .vsel_reg = BD72720_REG_BUCK10_VSEL, 1050 + .vsel_mask = BD72720_MASK_BUCK_VSEL, 1051 + 1052 + .ramp_delay_table = bd72720_ramp_delay, 1053 + .n_ramp_values = ARRAY_SIZE(bd72720_ramp_delay), 1054 + .ramp_reg = BD72720_REG_BUCK10_MODE, 1055 + .ramp_mask = BD72720_MASK_RAMP_UP_DELAY, 1056 + .owner = THIS_MODULE, 1057 + .of_parse_cb = buck_set_hw_dvs_levels, 1058 + }, 1059 + .dvs = { 1060 + .level_map = ROHM_DVS_LEVEL_RUN | ROHM_DVS_LEVEL_IDLE | 1061 + ROHM_DVS_LEVEL_SUSPEND | 1062 + ROHM_DVS_LEVEL_LPSR, 1063 + .run_reg = BD72720_REG_BUCK10_VSEL, 1064 + .run_mask = BD72720_MASK_BUCK_VSEL, 1065 + .idle_on_mask = BD72720_MASK_IDLE_EN, 1066 + .suspend_on_mask = BD72720_MASK_SUSPEND_EN, 1067 + .lpsr_on_mask = BD72720_MASK_DEEP_IDLE_EN, 1068 + }, 1069 + }, { 1070 + .desc = { 1071 + .name = "ldo1", 1072 + .of_match = of_match_ptr("ldo1"), 1073 + .regulators_node = of_match_ptr("regulators"), 1074 + .id = BD72720_LDO1, 1075 + .type = REGULATOR_VOLTAGE, 1076 + .ops = &bd72720_regulator_ops, 1077 + .linear_ranges = bd72720_ldo1234_volts, 1078 + .n_linear_ranges = ARRAY_SIZE(bd72720_ldo1234_volts), 1079 + .n_voltages = BD72720_NUM_LDO12346_VOLTS, 1080 + .enable_reg = BD72720_REG_LDO1_ON, 1081 + .enable_mask = BD72720_MASK_RUN_B_EN, 1082 + .vsel_reg = BD72720_REG_LDO1_VSEL_RB, 1083 + .vsel_mask = BD72720_MASK_LDO12346_VSEL, 1084 + 1085 + .ramp_delay_table = bd72720_ramp_delay, 1086 + .n_ramp_values = ARRAY_SIZE(bd72720_ramp_delay), 1087 + .ramp_reg = BD72720_REG_LDO1_MODE1, 1088 + .ramp_mask = BD72720_MASK_RAMP_UP_DELAY, 1089 + .owner = THIS_MODULE, 1090 + .of_parse_cb = buck_set_hw_dvs_levels, 1091 + }, 1092 + .dvs = { 1093 + .level_map = ROHM_DVS_LEVEL_RUN | ROHM_DVS_LEVEL_IDLE | 1094 + ROHM_DVS_LEVEL_SUSPEND | 1095 + ROHM_DVS_LEVEL_LPSR, 1096 + .run_reg = BD72720_REG_LDO1_VSEL_RB, 1097 + .run_mask = BD72720_MASK_LDO12346_VSEL, 1098 + .idle_reg = BD72720_REG_LDO1_VSEL_I, 1099 + .idle_mask = BD72720_MASK_LDO12346_VSEL, 1100 + .idle_on_mask = BD72720_MASK_IDLE_EN, 1101 + .suspend_reg = BD72720_REG_LDO1_VSEL_S, 1102 + .suspend_mask = BD72720_MASK_LDO12346_VSEL, 1103 + .suspend_on_mask = BD72720_MASK_SUSPEND_EN, 1104 + .lpsr_reg = BD72720_REG_LDO1_VSEL_DI, 1105 + .lpsr_mask = BD72720_MASK_LDO12346_VSEL, 1106 + .lpsr_on_mask = BD72720_MASK_DEEP_IDLE_EN, 1107 + }, 1108 + .reg_inits = bd72720_ldo1_inits, 1109 + .reg_init_amnt = ARRAY_SIZE(bd72720_ldo1_inits), 1110 + }, { 1111 + .desc = { 1112 + .name = "ldo2", 1113 + .of_match = of_match_ptr("ldo2"), 1114 + .regulators_node = of_match_ptr("regulators"), 1115 + .id = BD72720_LDO2, 1116 + .type = REGULATOR_VOLTAGE, 1117 + .ops = &bd72720_regulator_ops, 1118 + .linear_ranges = bd72720_ldo1234_volts, 1119 + .n_linear_ranges = ARRAY_SIZE(bd72720_ldo1234_volts), 1120 + .n_voltages = BD72720_NUM_LDO12346_VOLTS, 1121 + .enable_reg = BD72720_REG_LDO2_ON, 1122 + .enable_mask = BD72720_MASK_RUN_B_EN, 1123 + .vsel_reg = BD72720_REG_LDO2_VSEL_R, 1124 + .vsel_mask = BD72720_MASK_LDO12346_VSEL, 1125 + 1126 + .ramp_delay_table = bd72720_ramp_delay, 1127 + .n_ramp_values = ARRAY_SIZE(bd72720_ramp_delay), 1128 + .ramp_reg = BD72720_REG_LDO2_MODE, 1129 + .ramp_mask = BD72720_MASK_RAMP_UP_DELAY, 1130 + .owner = THIS_MODULE, 1131 + .of_parse_cb = buck_set_hw_dvs_levels, 1132 + }, 1133 + .dvs = { 1134 + .level_map = ROHM_DVS_LEVEL_RUN | ROHM_DVS_LEVEL_IDLE | 1135 + ROHM_DVS_LEVEL_SUSPEND | 1136 + ROHM_DVS_LEVEL_LPSR, 1137 + .run_reg = BD72720_REG_LDO2_VSEL_R, 1138 + .run_mask = BD72720_MASK_LDO12346_VSEL, 1139 + .idle_reg = BD72720_REG_LDO2_VSEL_I, 1140 + .idle_mask = BD72720_MASK_LDO12346_VSEL, 1141 + .idle_on_mask = BD72720_MASK_IDLE_EN, 1142 + .suspend_reg = BD72720_REG_LDO2_VSEL_S, 1143 + .suspend_mask = BD72720_MASK_LDO12346_VSEL, 1144 + .suspend_on_mask = BD72720_MASK_SUSPEND_EN, 1145 + .lpsr_reg = BD72720_REG_LDO2_VSEL_DI, 1146 + .lpsr_mask = BD72720_MASK_LDO12346_VSEL, 1147 + .lpsr_on_mask = BD72720_MASK_DEEP_IDLE_EN, 1148 + }, 1149 + }, { 1150 + .desc = { 1151 + .name = "ldo3", 1152 + .of_match = of_match_ptr("ldo3"), 1153 + .regulators_node = of_match_ptr("regulators"), 1154 + .id = BD72720_LDO3, 1155 + .type = REGULATOR_VOLTAGE, 1156 + .ops = &bd72720_regulator_ops, 1157 + .linear_ranges = bd72720_ldo1234_volts, 1158 + .n_linear_ranges = ARRAY_SIZE(bd72720_ldo1234_volts), 1159 + .n_voltages = BD72720_NUM_LDO12346_VOLTS, 1160 + .enable_reg = BD72720_REG_LDO3_ON, 1161 + .enable_mask = BD72720_MASK_RUN_B_EN, 1162 + .vsel_reg = BD72720_REG_LDO3_VSEL_R, 1163 + .vsel_mask = BD72720_MASK_LDO12346_VSEL, 1164 + 1165 + .ramp_delay_table = bd72720_ramp_delay, 1166 + .n_ramp_values = ARRAY_SIZE(bd72720_ramp_delay), 1167 + .ramp_reg = BD72720_REG_LDO3_MODE, 1168 + .ramp_mask = BD72720_MASK_RAMP_UP_DELAY, 1169 + .owner = THIS_MODULE, 1170 + .of_parse_cb = buck_set_hw_dvs_levels, 1171 + }, 1172 + .dvs = { 1173 + .level_map = ROHM_DVS_LEVEL_RUN | ROHM_DVS_LEVEL_IDLE | 1174 + ROHM_DVS_LEVEL_SUSPEND | 1175 + ROHM_DVS_LEVEL_LPSR, 1176 + .run_reg = BD72720_REG_LDO3_VSEL_R, 1177 + .run_mask = BD72720_MASK_LDO12346_VSEL, 1178 + .idle_reg = BD72720_REG_LDO3_VSEL_I, 1179 + .idle_mask = BD72720_MASK_LDO12346_VSEL, 1180 + .idle_on_mask = BD72720_MASK_IDLE_EN, 1181 + .suspend_reg = BD72720_REG_LDO3_VSEL_S, 1182 + .suspend_mask = BD72720_MASK_LDO12346_VSEL, 1183 + .suspend_on_mask = BD72720_MASK_SUSPEND_EN, 1184 + .lpsr_reg = BD72720_REG_LDO3_VSEL_DI, 1185 + .lpsr_mask = BD72720_MASK_LDO12346_VSEL, 1186 + .lpsr_on_mask = BD72720_MASK_DEEP_IDLE_EN, 1187 + }, 1188 + }, { 1189 + .desc = { 1190 + .name = "ldo4", 1191 + .of_match = of_match_ptr("ldo4"), 1192 + .regulators_node = of_match_ptr("regulators"), 1193 + .id = BD72720_LDO4, 1194 + .type = REGULATOR_VOLTAGE, 1195 + .ops = &bd72720_regulator_ops, 1196 + .linear_ranges = bd72720_ldo1234_volts, 1197 + .n_linear_ranges = ARRAY_SIZE(bd72720_ldo1234_volts), 1198 + .n_voltages = BD72720_NUM_LDO12346_VOLTS, 1199 + .enable_reg = BD72720_REG_LDO4_ON, 1200 + .enable_mask = BD72720_MASK_RUN_B_EN, 1201 + .vsel_reg = BD72720_REG_LDO4_VSEL_R, 1202 + .vsel_mask = BD72720_MASK_LDO12346_VSEL, 1203 + 1204 + .ramp_delay_table = bd72720_ramp_delay, 1205 + .n_ramp_values = ARRAY_SIZE(bd72720_ramp_delay), 1206 + .ramp_reg = BD72720_REG_LDO4_MODE, 1207 + .ramp_mask = BD72720_MASK_RAMP_UP_DELAY, 1208 + .owner = THIS_MODULE, 1209 + .of_parse_cb = buck_set_hw_dvs_levels, 1210 + }, 1211 + .dvs = { 1212 + .level_map = ROHM_DVS_LEVEL_RUN | ROHM_DVS_LEVEL_IDLE | 1213 + ROHM_DVS_LEVEL_SUSPEND | 1214 + ROHM_DVS_LEVEL_LPSR, 1215 + .run_reg = BD72720_REG_LDO4_VSEL_R, 1216 + .run_mask = BD72720_MASK_LDO12346_VSEL, 1217 + .idle_reg = BD72720_REG_LDO4_VSEL_I, 1218 + .idle_mask = BD72720_MASK_LDO12346_VSEL, 1219 + .idle_on_mask = BD72720_MASK_IDLE_EN, 1220 + .suspend_reg = BD72720_REG_LDO4_VSEL_S, 1221 + .suspend_mask = BD72720_MASK_LDO12346_VSEL, 1222 + .suspend_on_mask = BD72720_MASK_SUSPEND_EN, 1223 + .lpsr_reg = BD72720_REG_LDO4_VSEL_DI, 1224 + .lpsr_mask = BD72720_MASK_LDO12346_VSEL, 1225 + .lpsr_on_mask = BD72720_MASK_DEEP_IDLE_EN, 1226 + }, 1227 + }, { 1228 + .desc = { 1229 + .name = "ldo5", 1230 + .of_match = of_match_ptr("ldo5"), 1231 + .regulators_node = of_match_ptr("regulators"), 1232 + .id = BD72720_LDO5, 1233 + .type = REGULATOR_VOLTAGE, 1234 + .ops = &bd72720_regulator_ops, 1235 + .linear_ranges = bd72720_ldo57891011_volts, 1236 + .n_linear_ranges = ARRAY_SIZE(bd72720_ldo57891011_volts), 1237 + .n_voltages = BD72720_NUM_LDO_VOLTS, 1238 + .enable_reg = BD72720_REG_LDO5_ON, 1239 + .enable_mask = BD72720_MASK_RUN_B_EN, 1240 + .vsel_reg = BD72720_REG_LDO5_VSEL, 1241 + .vsel_mask = BD72720_MASK_LDO_VSEL, 1242 + 1243 + .ramp_delay_table = bd72720_ramp_delay, 1244 + .n_ramp_values = ARRAY_SIZE(bd72720_ramp_delay), 1245 + .ramp_reg = BD72720_REG_LDO5_MODE, 1246 + .ramp_mask = BD72720_MASK_RAMP_UP_DELAY, 1247 + .owner = THIS_MODULE, 1248 + .of_parse_cb = buck_set_hw_dvs_levels, 1249 + }, 1250 + .dvs = { 1251 + .level_map = ROHM_DVS_LEVEL_RUN | ROHM_DVS_LEVEL_IDLE | 1252 + ROHM_DVS_LEVEL_SUSPEND | 1253 + ROHM_DVS_LEVEL_LPSR, 1254 + .run_reg = BD72720_REG_LDO5_VSEL, 1255 + .run_mask = BD72720_MASK_LDO_VSEL, 1256 + .idle_on_mask = BD72720_MASK_IDLE_EN, 1257 + .suspend_on_mask = BD72720_MASK_SUSPEND_EN, 1258 + .lpsr_on_mask = BD72720_MASK_DEEP_IDLE_EN, 1259 + }, 1260 + }, { 1261 + .desc = { 1262 + .name = "ldo6", 1263 + .of_match = of_match_ptr("ldo6"), 1264 + .regulators_node = of_match_ptr("regulators"), 1265 + .id = BD72720_LDO6, 1266 + .type = REGULATOR_VOLTAGE, 1267 + .ops = &bd72720_regulator_ops, 1268 + .linear_ranges = bd72720_ldo6_volts, 1269 + .n_linear_ranges = ARRAY_SIZE(bd72720_ldo6_volts), 1270 + .n_voltages = BD72720_NUM_LDO12346_VOLTS, 1271 + .enable_reg = BD72720_REG_LDO6_ON, 1272 + .enable_mask = BD72720_MASK_RUN_B_EN, 1273 + .vsel_reg = BD72720_REG_LDO6_VSEL, 1274 + .vsel_mask = BD72720_MASK_LDO12346_VSEL, 1275 + 1276 + .ramp_delay_table = bd72720_ramp_delay, 1277 + .n_ramp_values = ARRAY_SIZE(bd72720_ramp_delay), 1278 + .ramp_reg = BD72720_REG_LDO6_MODE, 1279 + .ramp_mask = BD72720_MASK_RAMP_UP_DELAY, 1280 + .owner = THIS_MODULE, 1281 + .of_parse_cb = buck_set_hw_dvs_levels, 1282 + }, 1283 + .dvs = { 1284 + .level_map = ROHM_DVS_LEVEL_RUN | ROHM_DVS_LEVEL_IDLE | 1285 + ROHM_DVS_LEVEL_SUSPEND | 1286 + ROHM_DVS_LEVEL_LPSR, 1287 + .run_reg = BD72720_REG_LDO6_VSEL, 1288 + .run_mask = BD72720_MASK_LDO12346_VSEL, 1289 + .idle_on_mask = BD72720_MASK_IDLE_EN, 1290 + .suspend_on_mask = BD72720_MASK_SUSPEND_EN, 1291 + .lpsr_on_mask = BD72720_MASK_DEEP_IDLE_EN, 1292 + }, 1293 + }, { 1294 + .desc = { 1295 + .name = "ldo7", 1296 + .of_match = of_match_ptr("ldo7"), 1297 + .regulators_node = of_match_ptr("regulators"), 1298 + .id = BD72720_LDO7, 1299 + .type = REGULATOR_VOLTAGE, 1300 + .ops = &bd72720_regulator_ops, 1301 + .linear_ranges = bd72720_ldo57891011_volts, 1302 + .n_linear_ranges = ARRAY_SIZE(bd72720_ldo57891011_volts), 1303 + .n_voltages = BD72720_NUM_LDO_VOLTS, 1304 + .enable_reg = BD72720_REG_LDO7_ON, 1305 + .enable_mask = BD72720_MASK_RUN_B_EN, 1306 + .vsel_reg = BD72720_REG_LDO7_VSEL, 1307 + .vsel_mask = BD72720_MASK_LDO_VSEL, 1308 + 1309 + .ramp_delay_table = bd72720_ramp_delay, 1310 + .n_ramp_values = ARRAY_SIZE(bd72720_ramp_delay), 1311 + .ramp_reg = BD72720_REG_LDO7_MODE, 1312 + .ramp_mask = BD72720_MASK_RAMP_UP_DELAY, 1313 + .owner = THIS_MODULE, 1314 + .of_parse_cb = buck_set_hw_dvs_levels, 1315 + }, 1316 + .dvs = { 1317 + .level_map = ROHM_DVS_LEVEL_RUN | ROHM_DVS_LEVEL_IDLE | 1318 + ROHM_DVS_LEVEL_SUSPEND | 1319 + ROHM_DVS_LEVEL_LPSR, 1320 + .run_reg = BD72720_REG_LDO7_VSEL, 1321 + .run_mask = BD72720_MASK_LDO_VSEL, 1322 + .idle_on_mask = BD72720_MASK_IDLE_EN, 1323 + .suspend_on_mask = BD72720_MASK_SUSPEND_EN, 1324 + .lpsr_on_mask = BD72720_MASK_DEEP_IDLE_EN, 1325 + }, 1326 + }, { 1327 + .desc = { 1328 + .name = "ldo8", 1329 + .of_match = of_match_ptr("ldo8"), 1330 + .regulators_node = of_match_ptr("regulators"), 1331 + .id = BD72720_LDO8, 1332 + .type = REGULATOR_VOLTAGE, 1333 + .ops = &bd72720_regulator_ops, 1334 + .linear_ranges = bd72720_ldo57891011_volts, 1335 + .n_linear_ranges = ARRAY_SIZE(bd72720_ldo57891011_volts), 1336 + .n_voltages = BD72720_NUM_LDO_VOLTS, 1337 + .enable_reg = BD72720_REG_LDO8_ON, 1338 + .enable_mask = BD72720_MASK_RUN_B_EN, 1339 + .vsel_reg = BD72720_REG_LDO8_VSEL, 1340 + .vsel_mask = BD72720_MASK_LDO_VSEL, 1341 + 1342 + .ramp_delay_table = bd72720_ramp_delay, 1343 + .n_ramp_values = ARRAY_SIZE(bd72720_ramp_delay), 1344 + .ramp_reg = BD72720_REG_LDO8_MODE, 1345 + .ramp_mask = BD72720_MASK_RAMP_UP_DELAY, 1346 + .owner = THIS_MODULE, 1347 + .of_parse_cb = buck_set_hw_dvs_levels, 1348 + }, 1349 + .dvs = { 1350 + .level_map = ROHM_DVS_LEVEL_RUN | ROHM_DVS_LEVEL_IDLE | 1351 + ROHM_DVS_LEVEL_SUSPEND | 1352 + ROHM_DVS_LEVEL_LPSR, 1353 + .run_reg = BD72720_REG_LDO8_VSEL, 1354 + .run_mask = BD72720_MASK_LDO_VSEL, 1355 + .idle_on_mask = BD72720_MASK_IDLE_EN, 1356 + .suspend_on_mask = BD72720_MASK_SUSPEND_EN, 1357 + .lpsr_on_mask = BD72720_MASK_DEEP_IDLE_EN, 1358 + }, 1359 + }, { 1360 + .desc = { 1361 + .name = "ldo9", 1362 + .of_match = of_match_ptr("ldo9"), 1363 + .regulators_node = of_match_ptr("regulators"), 1364 + .id = BD72720_LDO9, 1365 + .type = REGULATOR_VOLTAGE, 1366 + .ops = &bd72720_regulator_ops, 1367 + .linear_ranges = bd72720_ldo57891011_volts, 1368 + .n_linear_ranges = ARRAY_SIZE(bd72720_ldo57891011_volts), 1369 + .n_voltages = BD72720_NUM_LDO_VOLTS, 1370 + .enable_reg = BD72720_REG_LDO9_ON, 1371 + .enable_mask = BD72720_MASK_RUN_B_EN, 1372 + .vsel_reg = BD72720_REG_LDO9_VSEL, 1373 + .vsel_mask = BD72720_MASK_LDO_VSEL, 1374 + 1375 + .ramp_delay_table = bd72720_ramp_delay, 1376 + .n_ramp_values = ARRAY_SIZE(bd72720_ramp_delay), 1377 + .ramp_reg = BD72720_REG_LDO9_MODE, 1378 + .ramp_mask = BD72720_MASK_RAMP_UP_DELAY, 1379 + .owner = THIS_MODULE, 1380 + .of_parse_cb = buck_set_hw_dvs_levels, 1381 + }, 1382 + .dvs = { 1383 + .level_map = ROHM_DVS_LEVEL_RUN | ROHM_DVS_LEVEL_IDLE | 1384 + ROHM_DVS_LEVEL_SUSPEND | 1385 + ROHM_DVS_LEVEL_LPSR, 1386 + .run_reg = BD72720_REG_LDO9_VSEL, 1387 + .run_mask = BD72720_MASK_LDO_VSEL, 1388 + .idle_on_mask = BD72720_MASK_IDLE_EN, 1389 + .suspend_on_mask = BD72720_MASK_SUSPEND_EN, 1390 + .lpsr_on_mask = BD72720_MASK_DEEP_IDLE_EN, 1391 + }, 1392 + }, { 1393 + .desc = { 1394 + .name = "ldo10", 1395 + .of_match = of_match_ptr("ldo10"), 1396 + .regulators_node = of_match_ptr("regulators"), 1397 + .id = BD72720_LDO10, 1398 + .type = REGULATOR_VOLTAGE, 1399 + .ops = &bd72720_regulator_ops, 1400 + .linear_ranges = bd72720_ldo57891011_volts, 1401 + .n_linear_ranges = ARRAY_SIZE(bd72720_ldo57891011_volts), 1402 + .n_voltages = BD72720_NUM_LDO_VOLTS, 1403 + .enable_reg = BD72720_REG_LDO10_ON, 1404 + .enable_mask = BD72720_MASK_RUN_B_EN, 1405 + .vsel_reg = BD72720_REG_LDO10_VSEL, 1406 + .vsel_mask = BD72720_MASK_LDO_VSEL, 1407 + 1408 + .ramp_delay_table = bd72720_ramp_delay, 1409 + .n_ramp_values = ARRAY_SIZE(bd72720_ramp_delay), 1410 + .ramp_reg = BD72720_REG_LDO10_MODE, 1411 + .ramp_mask = BD72720_MASK_RAMP_UP_DELAY, 1412 + .owner = THIS_MODULE, 1413 + .of_parse_cb = buck_set_hw_dvs_levels, 1414 + }, 1415 + .dvs = { 1416 + .level_map = ROHM_DVS_LEVEL_RUN | ROHM_DVS_LEVEL_IDLE | 1417 + ROHM_DVS_LEVEL_SUSPEND | 1418 + ROHM_DVS_LEVEL_LPSR, 1419 + .run_reg = BD72720_REG_LDO10_VSEL, 1420 + .run_mask = BD72720_MASK_LDO_VSEL, 1421 + .idle_on_mask = BD72720_MASK_IDLE_EN, 1422 + .suspend_on_mask = BD72720_MASK_SUSPEND_EN, 1423 + .lpsr_on_mask = BD72720_MASK_DEEP_IDLE_EN, 1424 + }, 1425 + }, { 1426 + .desc = { 1427 + .name = "ldo11", 1428 + .of_match = of_match_ptr("ldo11"), 1429 + .regulators_node = of_match_ptr("regulators"), 1430 + .id = BD72720_LDO11, 1431 + .type = REGULATOR_VOLTAGE, 1432 + .ops = &bd72720_regulator_ops, 1433 + .linear_ranges = bd72720_ldo57891011_volts, 1434 + .n_linear_ranges = ARRAY_SIZE(bd72720_ldo57891011_volts), 1435 + .n_voltages = BD72720_NUM_LDO_VOLTS, 1436 + .enable_reg = BD72720_REG_LDO11_ON, 1437 + .enable_mask = BD72720_MASK_RUN_B_EN, 1438 + .vsel_reg = BD72720_REG_LDO11_VSEL, 1439 + .vsel_mask = BD72720_MASK_LDO_VSEL, 1440 + 1441 + .ramp_delay_table = bd72720_ramp_delay, 1442 + .n_ramp_values = ARRAY_SIZE(bd72720_ramp_delay), 1443 + .ramp_reg = BD72720_REG_LDO11_MODE, 1444 + .ramp_mask = BD72720_MASK_RAMP_UP_DELAY, 1445 + .owner = THIS_MODULE, 1446 + .of_parse_cb = buck_set_hw_dvs_levels, 1447 + }, 1448 + .dvs = { 1449 + .level_map = ROHM_DVS_LEVEL_RUN | ROHM_DVS_LEVEL_IDLE | 1450 + ROHM_DVS_LEVEL_SUSPEND | 1451 + ROHM_DVS_LEVEL_LPSR, 1452 + .run_reg = BD72720_REG_LDO11_VSEL, 1453 + .run_mask = BD72720_MASK_LDO_VSEL, 1454 + .idle_on_mask = BD72720_MASK_IDLE_EN, 1455 + .suspend_on_mask = BD72720_MASK_SUSPEND_EN, 1456 + .lpsr_on_mask = BD72720_MASK_DEEP_IDLE_EN, 1457 + }, 1458 + }, 1459 + }; 1460 + 1461 + static int bd72720_buck10_ldon_head_mode(struct device *dev, 1462 + struct device_node *npreg, 1463 + struct regmap *regmap, 1464 + struct regulator_desc *buck10_desc) 1465 + { 1466 + struct device_node *np __free(device_node) = 1467 + of_get_child_by_name(npreg, "buck10"); 1468 + uint32_t ldon_head; 1469 + int ldon_val; 1470 + int ret; 1471 + 1472 + if (!np) { 1473 + dev_err(dev, "failed to find buck10 regulator node\n"); 1474 + return -ENODEV; 1475 + } 1476 + 1477 + ret = of_property_read_u32(np, "rohm,ldon-head-microvolt", &ldon_head); 1478 + if (ret == -EINVAL) 1479 + return 0; 1480 + if (ret) 1481 + return ret; 1482 + 1483 + /* 1484 + * LDON_HEAD mode means the BUCK10 is used to supply LDOs 1-4 and 1485 + * the BUCK 10 voltage is automatically set to follow LDO 1-4 1486 + * settings. Thus the BUCK10 should not allow voltage [g/s]etting. 1487 + */ 1488 + buck10_desc->ops = &bd72720_buck10_ldon_head_op; 1489 + 1490 + ldon_val = ldon_head / 50000 + 1; 1491 + if (ldon_head > 300000) { 1492 + dev_warn(dev, "Unsupported LDON_HEAD, clamping to 300 mV\n"); 1493 + ldon_val = 7; 1494 + } 1495 + 1496 + return regmap_update_bits(regmap, BD72720_REG_LDO1_MODE2, 1497 + BD72720_MASK_LDON_HEAD, ldon_val); 1498 + } 1499 + 1500 + static int bd72720_dt_parse(struct device *dev, 1501 + struct regulator_desc *buck10_desc, 1502 + struct regmap *regmap) 1503 + { 1504 + struct device_node *nproot __free(device_node) = 1505 + of_get_child_by_name(dev->parent->of_node, "regulators"); 1506 + 1507 + if (!nproot) { 1508 + dev_err(dev, "failed to find regulators node\n"); 1509 + return -ENODEV; 1510 + } 1511 + 1512 + return bd72720_buck10_ldon_head_mode(dev, nproot, regmap, buck10_desc); 1513 + } 1514 + 788 1515 static int bd71828_probe(struct platform_device *pdev) 789 1516 { 790 - int i, j, ret; 1517 + int i, j, ret, num_regulators; 791 1518 struct regulator_config config = { 792 1519 .dev = pdev->dev.parent, 793 1520 }; 1521 + enum rohm_chip_type chip = platform_get_device_id(pdev)->driver_data; 1522 + struct bd71828_regulator_data *rdata; 794 1523 795 1524 config.regmap = dev_get_regmap(pdev->dev.parent, NULL); 796 1525 if (!config.regmap) 797 1526 return -ENODEV; 798 1527 799 - for (i = 0; i < ARRAY_SIZE(bd71828_rdata); i++) { 800 - struct regulator_dev *rdev; 801 - const struct bd71828_regulator_data *rd; 1528 + switch (chip) { 1529 + case ROHM_CHIP_TYPE_BD72720: 1530 + rdata = devm_kmemdup(&pdev->dev, bd72720_rdata, 1531 + sizeof(bd72720_rdata), GFP_KERNEL); 1532 + if (!rdata) 1533 + return -ENOMEM; 802 1534 803 - rd = &bd71828_rdata[i]; 1535 + ret = bd72720_dt_parse(&pdev->dev, &rdata[BD72720_BUCK10_DESC_INDEX].desc, 1536 + config.regmap); 1537 + if (ret) 1538 + return ret; 1539 + 1540 + num_regulators = ARRAY_SIZE(bd72720_rdata); 1541 + break; 1542 + 1543 + case ROHM_CHIP_TYPE_BD71828: 1544 + rdata = devm_kmemdup(&pdev->dev, bd71828_rdata, 1545 + sizeof(bd71828_rdata), GFP_KERNEL); 1546 + if (!rdata) 1547 + return -ENOMEM; 1548 + 1549 + num_regulators = ARRAY_SIZE(bd71828_rdata); 1550 + 1551 + break; 1552 + default: 1553 + return dev_err_probe(&pdev->dev, -EINVAL, 1554 + "Unsupported device\n"); 1555 + } 1556 + 1557 + for (i = 0; i < num_regulators; i++) { 1558 + struct regulator_dev *rdev; 1559 + struct bd71828_regulator_data *rd; 1560 + 1561 + rd = &rdata[i]; 1562 + 1563 + config.driver_data = rd; 804 1564 rdev = devm_regulator_register(&pdev->dev, 805 1565 &rd->desc, &config); 806 1566 if (IS_ERR(rdev)) ··· 1690 714 return 0; 1691 715 } 1692 716 717 + static const struct platform_device_id bd71828_pmic_id[] = { 718 + { "bd71828-pmic", ROHM_CHIP_TYPE_BD71828 }, 719 + { "bd72720-pmic", ROHM_CHIP_TYPE_BD72720 }, 720 + { }, 721 + }; 722 + MODULE_DEVICE_TABLE(platform, bd71828_pmic_id); 723 + 1693 724 static struct platform_driver bd71828_regulator = { 1694 725 .driver = { 1695 726 .name = "bd71828-pmic", 1696 727 .probe_type = PROBE_PREFER_ASYNCHRONOUS, 1697 728 }, 1698 729 .probe = bd71828_probe, 730 + .id_table = bd71828_pmic_id, 1699 731 }; 1700 732 1701 733 module_platform_driver(bd71828_regulator); ··· 1711 727 MODULE_AUTHOR("Matti Vaittinen <matti.vaittinen@fi.rohmeurope.com>"); 1712 728 MODULE_DESCRIPTION("BD71828 voltage regulator driver"); 1713 729 MODULE_LICENSE("GPL"); 1714 - MODULE_ALIAS("platform:bd71828-pmic");