.. | .. |
---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-only |
---|
1 | 2 | /* |
---|
2 | 3 | * Copyright (c) 2014, Sony Mobile Communications AB. |
---|
3 | 4 | * Copyright (c) 2012-2013, The Linux Foundation. All rights reserved. |
---|
4 | | - * |
---|
5 | | - * This program is free software; you can redistribute it and/or modify |
---|
6 | | - * it under the terms of the GNU General Public License version 2 and |
---|
7 | | - * only version 2 as published by the Free Software Foundation. |
---|
8 | | - * |
---|
9 | | - * This program is distributed in the hope that it will be useful, |
---|
10 | | - * but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
11 | | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
---|
12 | | - * GNU General Public License for more details. |
---|
13 | 5 | */ |
---|
14 | 6 | |
---|
15 | 7 | #include <linux/module.h> |
---|
.. | .. |
---|
156 | 148 | /* |
---|
157 | 149 | * Physically available PMIC regulator voltage ranges |
---|
158 | 150 | */ |
---|
159 | | -static const struct regulator_linear_range pldo_ranges[] = { |
---|
| 151 | +static const struct linear_range pldo_ranges[] = { |
---|
160 | 152 | REGULATOR_LINEAR_RANGE( 750000, 0, 59, 12500), |
---|
161 | 153 | REGULATOR_LINEAR_RANGE(1500000, 60, 123, 25000), |
---|
162 | 154 | REGULATOR_LINEAR_RANGE(3100000, 124, 160, 50000), |
---|
163 | 155 | }; |
---|
164 | 156 | |
---|
165 | | -static const struct regulator_linear_range nldo_ranges[] = { |
---|
| 157 | +static const struct linear_range nldo_ranges[] = { |
---|
166 | 158 | REGULATOR_LINEAR_RANGE( 750000, 0, 63, 12500), |
---|
167 | 159 | }; |
---|
168 | 160 | |
---|
169 | | -static const struct regulator_linear_range nldo1200_ranges[] = { |
---|
| 161 | +static const struct linear_range nldo1200_ranges[] = { |
---|
170 | 162 | REGULATOR_LINEAR_RANGE( 375000, 0, 59, 6250), |
---|
171 | 163 | REGULATOR_LINEAR_RANGE( 750000, 60, 123, 12500), |
---|
172 | 164 | }; |
---|
173 | 165 | |
---|
174 | | -static const struct regulator_linear_range smps_ranges[] = { |
---|
| 166 | +static const struct linear_range smps_ranges[] = { |
---|
175 | 167 | REGULATOR_LINEAR_RANGE( 375000, 0, 29, 12500), |
---|
176 | 168 | REGULATOR_LINEAR_RANGE( 750000, 30, 89, 12500), |
---|
177 | 169 | REGULATOR_LINEAR_RANGE(1500000, 90, 153, 25000), |
---|
178 | 170 | }; |
---|
179 | 171 | |
---|
180 | | -static const struct regulator_linear_range ftsmps_ranges[] = { |
---|
| 172 | +static const struct linear_range ftsmps_ranges[] = { |
---|
181 | 173 | REGULATOR_LINEAR_RANGE( 350000, 0, 6, 50000), |
---|
182 | 174 | REGULATOR_LINEAR_RANGE( 700000, 7, 63, 12500), |
---|
183 | 175 | REGULATOR_LINEAR_RANGE(1500000, 64, 100, 50000), |
---|
184 | 176 | }; |
---|
185 | 177 | |
---|
186 | | -static const struct regulator_linear_range smb208_ranges[] = { |
---|
| 178 | +static const struct linear_range smb208_ranges[] = { |
---|
187 | 179 | REGULATOR_LINEAR_RANGE( 375000, 0, 29, 12500), |
---|
188 | 180 | REGULATOR_LINEAR_RANGE( 750000, 30, 89, 12500), |
---|
189 | 181 | REGULATOR_LINEAR_RANGE(1500000, 90, 153, 25000), |
---|
190 | 182 | REGULATOR_LINEAR_RANGE(3100000, 154, 234, 25000), |
---|
191 | 183 | }; |
---|
192 | 184 | |
---|
193 | | -static const struct regulator_linear_range ncp_ranges[] = { |
---|
| 185 | +static const struct linear_range ncp_ranges[] = { |
---|
194 | 186 | REGULATOR_LINEAR_RANGE(1500000, 0, 31, 50000), |
---|
195 | 187 | }; |
---|
196 | 188 | |
---|
.. | .. |
---|
415 | 407 | return ret; |
---|
416 | 408 | } |
---|
417 | 409 | |
---|
418 | | -static struct regulator_ops uV_ops = { |
---|
| 410 | +static const struct regulator_ops uV_ops = { |
---|
419 | 411 | .list_voltage = regulator_list_voltage_linear_range, |
---|
420 | 412 | |
---|
421 | 413 | .set_voltage_sel = rpm_reg_set_uV_sel, |
---|
.. | .. |
---|
428 | 420 | .set_load = rpm_reg_set_load, |
---|
429 | 421 | }; |
---|
430 | 422 | |
---|
431 | | -static struct regulator_ops mV_ops = { |
---|
| 423 | +static const struct regulator_ops mV_ops = { |
---|
432 | 424 | .list_voltage = regulator_list_voltage_linear_range, |
---|
433 | 425 | |
---|
434 | 426 | .set_voltage_sel = rpm_reg_set_mV_sel, |
---|
.. | .. |
---|
441 | 433 | .set_load = rpm_reg_set_load, |
---|
442 | 434 | }; |
---|
443 | 435 | |
---|
444 | | -static struct regulator_ops switch_ops = { |
---|
| 436 | +static const struct regulator_ops switch_ops = { |
---|
445 | 437 | .enable = rpm_reg_switch_enable, |
---|
446 | 438 | .disable = rpm_reg_switch_disable, |
---|
447 | 439 | .is_enabled = rpm_reg_is_enabled, |
---|
.. | .. |
---|
606 | 598 | .desc.linear_ranges = smps_ranges, |
---|
607 | 599 | .desc.n_linear_ranges = ARRAY_SIZE(smps_ranges), |
---|
608 | 600 | .desc.n_voltages = 154, |
---|
609 | | - .desc.ops = &uV_ops, |
---|
610 | | - .parts = &rpm8960_smps_parts, |
---|
611 | | - .supports_force_mode_auto = true, |
---|
612 | | - .supports_force_mode_bypass = false, |
---|
613 | | -}; |
---|
614 | | - |
---|
615 | | -static const struct qcom_rpm_reg pm8921_ftsmps = { |
---|
616 | | - .desc.linear_ranges = ftsmps_ranges, |
---|
617 | | - .desc.n_linear_ranges = ARRAY_SIZE(ftsmps_ranges), |
---|
618 | | - .desc.n_voltages = 101, |
---|
619 | 601 | .desc.ops = &uV_ops, |
---|
620 | 602 | .parts = &rpm8960_smps_parts, |
---|
621 | 603 | .supports_force_mode_auto = true, |
---|
.. | .. |
---|
820 | 802 | }; |
---|
821 | 803 | |
---|
822 | 804 | static const struct rpm_regulator_data rpm_pm8058_regulators[] = { |
---|
| 805 | + { "s0", QCOM_RPM_PM8058_SMPS0, &pm8058_smps, "vdd_s0" }, |
---|
| 806 | + { "s1", QCOM_RPM_PM8058_SMPS1, &pm8058_smps, "vdd_s1" }, |
---|
| 807 | + { "s2", QCOM_RPM_PM8058_SMPS2, &pm8058_smps, "vdd_s2" }, |
---|
| 808 | + { "s3", QCOM_RPM_PM8058_SMPS3, &pm8058_smps, "vdd_s3" }, |
---|
| 809 | + { "s4", QCOM_RPM_PM8058_SMPS4, &pm8058_smps, "vdd_s4" }, |
---|
| 810 | + |
---|
823 | 811 | { "l0", QCOM_RPM_PM8058_LDO0, &pm8058_nldo, "vdd_l0_l1_lvs" }, |
---|
824 | 812 | { "l1", QCOM_RPM_PM8058_LDO1, &pm8058_nldo, "vdd_l0_l1_lvs" }, |
---|
825 | 813 | { "l2", QCOM_RPM_PM8058_LDO2, &pm8058_pldo, "vdd_l2_l11_l12" }, |
---|
.. | .. |
---|
847 | 835 | { "l24", QCOM_RPM_PM8058_LDO24, &pm8058_nldo, "vdd_l23_l24_l25" }, |
---|
848 | 836 | { "l25", QCOM_RPM_PM8058_LDO25, &pm8058_nldo, "vdd_l23_l24_l25" }, |
---|
849 | 837 | |
---|
850 | | - { "s0", QCOM_RPM_PM8058_SMPS0, &pm8058_smps, "vdd_s0" }, |
---|
851 | | - { "s1", QCOM_RPM_PM8058_SMPS1, &pm8058_smps, "vdd_s1" }, |
---|
852 | | - { "s2", QCOM_RPM_PM8058_SMPS2, &pm8058_smps, "vdd_s2" }, |
---|
853 | | - { "s3", QCOM_RPM_PM8058_SMPS3, &pm8058_smps, "vdd_s3" }, |
---|
854 | | - { "s4", QCOM_RPM_PM8058_SMPS4, &pm8058_smps, "vdd_s4" }, |
---|
855 | | - |
---|
856 | 838 | { "lvs0", QCOM_RPM_PM8058_LVS0, &pm8058_switch, "vdd_l0_l1_lvs" }, |
---|
857 | 839 | { "lvs1", QCOM_RPM_PM8058_LVS1, &pm8058_switch, "vdd_l0_l1_lvs" }, |
---|
858 | 840 | |
---|
.. | .. |
---|
861 | 843 | }; |
---|
862 | 844 | |
---|
863 | 845 | static const struct rpm_regulator_data rpm_pm8901_regulators[] = { |
---|
| 846 | + { "s0", QCOM_RPM_PM8901_SMPS0, &pm8901_ftsmps, "vdd_s0" }, |
---|
| 847 | + { "s1", QCOM_RPM_PM8901_SMPS1, &pm8901_ftsmps, "vdd_s1" }, |
---|
| 848 | + { "s2", QCOM_RPM_PM8901_SMPS2, &pm8901_ftsmps, "vdd_s2" }, |
---|
| 849 | + { "s3", QCOM_RPM_PM8901_SMPS3, &pm8901_ftsmps, "vdd_s3" }, |
---|
| 850 | + { "s4", QCOM_RPM_PM8901_SMPS4, &pm8901_ftsmps, "vdd_s4" }, |
---|
| 851 | + |
---|
864 | 852 | { "l0", QCOM_RPM_PM8901_LDO0, &pm8901_nldo, "vdd_l0" }, |
---|
865 | 853 | { "l1", QCOM_RPM_PM8901_LDO1, &pm8901_pldo, "vdd_l1" }, |
---|
866 | 854 | { "l2", QCOM_RPM_PM8901_LDO2, &pm8901_pldo, "vdd_l2" }, |
---|
.. | .. |
---|
868 | 856 | { "l4", QCOM_RPM_PM8901_LDO4, &pm8901_pldo, "vdd_l4" }, |
---|
869 | 857 | { "l5", QCOM_RPM_PM8901_LDO5, &pm8901_pldo, "vdd_l5" }, |
---|
870 | 858 | { "l6", QCOM_RPM_PM8901_LDO6, &pm8901_pldo, "vdd_l6" }, |
---|
871 | | - |
---|
872 | | - { "s0", QCOM_RPM_PM8901_SMPS0, &pm8901_ftsmps, "vdd_s0" }, |
---|
873 | | - { "s1", QCOM_RPM_PM8901_SMPS1, &pm8901_ftsmps, "vdd_s1" }, |
---|
874 | | - { "s2", QCOM_RPM_PM8901_SMPS2, &pm8901_ftsmps, "vdd_s2" }, |
---|
875 | | - { "s3", QCOM_RPM_PM8901_SMPS3, &pm8901_ftsmps, "vdd_s3" }, |
---|
876 | | - { "s4", QCOM_RPM_PM8901_SMPS4, &pm8901_ftsmps, "vdd_s4" }, |
---|
877 | 859 | |
---|
878 | 860 | { "lvs0", QCOM_RPM_PM8901_LVS0, &pm8901_switch, "lvs0_in" }, |
---|
879 | 861 | { "lvs1", QCOM_RPM_PM8901_LVS1, &pm8901_switch, "lvs1_in" }, |
---|
.. | .. |
---|
933 | 915 | { } |
---|
934 | 916 | }; |
---|
935 | 917 | |
---|
| 918 | +static const struct rpm_regulator_data rpm_smb208_regulators[] = { |
---|
| 919 | + { "s1a", QCOM_RPM_SMB208_S1a, &smb208_smps, "vin_s1a" }, |
---|
| 920 | + { "s1b", QCOM_RPM_SMB208_S1b, &smb208_smps, "vin_s1b" }, |
---|
| 921 | + { "s2a", QCOM_RPM_SMB208_S2a, &smb208_smps, "vin_s2a" }, |
---|
| 922 | + { "s2b", QCOM_RPM_SMB208_S2b, &smb208_smps, "vin_s2b" }, |
---|
| 923 | + { } |
---|
| 924 | +}; |
---|
| 925 | + |
---|
936 | 926 | static const struct of_device_id rpm_of_match[] = { |
---|
937 | 927 | { .compatible = "qcom,rpm-pm8018-regulators", |
---|
938 | 928 | .data = &rpm_pm8018_regulators }, |
---|
939 | 929 | { .compatible = "qcom,rpm-pm8058-regulators", .data = &rpm_pm8058_regulators }, |
---|
940 | 930 | { .compatible = "qcom,rpm-pm8901-regulators", .data = &rpm_pm8901_regulators }, |
---|
941 | 931 | { .compatible = "qcom,rpm-pm8921-regulators", .data = &rpm_pm8921_regulators }, |
---|
| 932 | + { .compatible = "qcom,rpm-smb208-regulators", .data = &rpm_smb208_regulators }, |
---|
942 | 933 | { } |
---|
943 | 934 | }; |
---|
944 | 935 | MODULE_DEVICE_TABLE(of, rpm_of_match); |
---|