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: bd96801: Support ROHM BD96805 PMIC

The ROHM BD96805 is from the software perspective almost identical to
the ROHM BD96801. The main difference is different voltage tuning
ranges.

Add support differentiating these PMICs and provide correct voltages
for both models.

Signed-off-by: Matti Vaittinen <mazziesaccount@gmail.com>
Reviewed-by: Mark Brown <broonie@kernel.org>
Link: https://lore.kernel.org/r/eab1369557b14a9762c41a5429d1ac87a4644d9e.1744090658.git.mazziesaccount@gmail.com
Signed-off-by: Lee Jones <lee@kernel.org>

authored by

Matti Vaittinen and committed by
Lee Jones
7baf818d 6a309b48

+208
+208
drivers/regulator/bd96801-regulator.c
··· 83 83 #define BD96801_LDO6_VSEL_REG 0x26 84 84 #define BD96801_LDO7_VSEL_REG 0x27 85 85 #define BD96801_BUCK_VSEL_MASK 0x1F 86 + #define BD96805_BUCK_VSEL_MASK 0x3f 86 87 #define BD96801_LDO_VSEL_MASK 0xff 87 88 88 89 #define BD96801_MASK_RAMP_DELAY 0xc0 ··· 91 90 #define BD96801_BUCK_INT_VOUT_MASK 0xff 92 91 93 92 #define BD96801_BUCK_VOLTS 256 93 + #define BD96805_BUCK_VOLTS 64 94 94 #define BD96801_LDO_VOLTS 256 95 95 96 96 #define BD96801_OVP_MASK 0x03 ··· 165 163 /* BD96802 uses same voltage ranges for bucks as BD96801 */ 166 164 #define bd96802_tune_volts bd96801_tune_volts 167 165 #define bd96802_buck_init_volts bd96801_buck_init_volts 166 + 167 + /* 168 + * On BD96805 we have similar "negative tuning range" as on BD96801, except 169 + * that the max tuning is -310 ... +310 mV (instead of the 150mV). We use same 170 + * approach as with the BD96801 ranges. 171 + */ 172 + static const struct linear_range bd96805_tune_volts[] = { 173 + REGULATOR_LINEAR_RANGE(310000, 0x00, 0x1F, 10000), 174 + REGULATOR_LINEAR_RANGE(0, 0x20, 0x3F, 10000), 175 + }; 176 + 177 + static const struct linear_range bd96805_buck_init_volts[] = { 178 + REGULATOR_LINEAR_RANGE(500000 - 310000, 0x00, 0xc8, 5000), 179 + REGULATOR_LINEAR_RANGE(1550000 - 310000, 0xc9, 0xec, 50000), 180 + REGULATOR_LINEAR_RANGE(3300000 - 310000, 0xed, 0xff, 0), 181 + }; 182 + 168 183 static const struct linear_range bd96801_ldo_int_volts[] = { 169 184 REGULATOR_LINEAR_RANGE(300000, 0x00, 0x78, 25000), 170 185 REGULATOR_LINEAR_RANGE(3300000, 0x79, 0xff, 0), ··· 778 759 .num_regulators = 7, 779 760 }; 780 761 762 + static const struct bd96801_pmic_data bd96805_data = { 763 + .regulator_data = { 764 + { 765 + .desc = { 766 + .name = "buck1", 767 + .of_match = of_match_ptr("buck1"), 768 + .regulators_node = of_match_ptr("regulators"), 769 + .id = BD96801_BUCK1, 770 + .ops = &bd96801_buck_ops, 771 + .type = REGULATOR_VOLTAGE, 772 + .linear_ranges = bd96805_tune_volts, 773 + .n_linear_ranges = ARRAY_SIZE(bd96805_tune_volts), 774 + .n_voltages = BD96805_BUCK_VOLTS, 775 + .enable_reg = BD96801_REG_ENABLE, 776 + .enable_mask = BD96801_BUCK1_EN_MASK, 777 + .enable_is_inverted = true, 778 + .vsel_reg = BD96801_BUCK1_VSEL_REG, 779 + .vsel_mask = BD96805_BUCK_VSEL_MASK, 780 + .ramp_reg = BD96801_BUCK1_VSEL_REG, 781 + .ramp_mask = BD96801_MASK_RAMP_DELAY, 782 + .ramp_delay_table = &buck_ramp_table[0], 783 + .n_ramp_values = ARRAY_SIZE(buck_ramp_table), 784 + .owner = THIS_MODULE, 785 + }, 786 + .init_ranges = bd96805_buck_init_volts, 787 + .num_ranges = ARRAY_SIZE(bd96805_buck_init_volts), 788 + .irq_desc = { 789 + .irqinfo = (struct bd96801_irqinfo *)&buck1_irqinfo[0], 790 + .num_irqs = ARRAY_SIZE(buck1_irqinfo), 791 + }, 792 + }, { 793 + .desc = { 794 + .name = "buck2", 795 + .of_match = of_match_ptr("buck2"), 796 + .regulators_node = of_match_ptr("regulators"), 797 + .id = BD96801_BUCK2, 798 + .ops = &bd96801_buck_ops, 799 + .type = REGULATOR_VOLTAGE, 800 + .linear_ranges = bd96805_tune_volts, 801 + .n_linear_ranges = ARRAY_SIZE(bd96805_tune_volts), 802 + .n_voltages = BD96805_BUCK_VOLTS, 803 + .enable_reg = BD96801_REG_ENABLE, 804 + .enable_mask = BD96801_BUCK2_EN_MASK, 805 + .enable_is_inverted = true, 806 + .vsel_reg = BD96801_BUCK2_VSEL_REG, 807 + .vsel_mask = BD96805_BUCK_VSEL_MASK, 808 + .ramp_reg = BD96801_BUCK2_VSEL_REG, 809 + .ramp_mask = BD96801_MASK_RAMP_DELAY, 810 + .ramp_delay_table = &buck_ramp_table[0], 811 + .n_ramp_values = ARRAY_SIZE(buck_ramp_table), 812 + .owner = THIS_MODULE, 813 + }, 814 + .irq_desc = { 815 + .irqinfo = (struct bd96801_irqinfo *)&buck2_irqinfo[0], 816 + .num_irqs = ARRAY_SIZE(buck2_irqinfo), 817 + }, 818 + .init_ranges = bd96805_buck_init_volts, 819 + .num_ranges = ARRAY_SIZE(bd96805_buck_init_volts), 820 + }, { 821 + .desc = { 822 + .name = "buck3", 823 + .of_match = of_match_ptr("buck3"), 824 + .regulators_node = of_match_ptr("regulators"), 825 + .id = BD96801_BUCK3, 826 + .ops = &bd96801_buck_ops, 827 + .type = REGULATOR_VOLTAGE, 828 + .linear_ranges = bd96805_tune_volts, 829 + .n_linear_ranges = ARRAY_SIZE(bd96805_tune_volts), 830 + .n_voltages = BD96805_BUCK_VOLTS, 831 + .enable_reg = BD96801_REG_ENABLE, 832 + .enable_mask = BD96801_BUCK3_EN_MASK, 833 + .enable_is_inverted = true, 834 + .vsel_reg = BD96801_BUCK3_VSEL_REG, 835 + .vsel_mask = BD96805_BUCK_VSEL_MASK, 836 + .ramp_reg = BD96801_BUCK3_VSEL_REG, 837 + .ramp_mask = BD96801_MASK_RAMP_DELAY, 838 + .ramp_delay_table = &buck_ramp_table[0], 839 + .n_ramp_values = ARRAY_SIZE(buck_ramp_table), 840 + .owner = THIS_MODULE, 841 + }, 842 + .irq_desc = { 843 + .irqinfo = (struct bd96801_irqinfo *)&buck3_irqinfo[0], 844 + .num_irqs = ARRAY_SIZE(buck3_irqinfo), 845 + }, 846 + .init_ranges = bd96805_buck_init_volts, 847 + .num_ranges = ARRAY_SIZE(bd96805_buck_init_volts), 848 + }, { 849 + .desc = { 850 + .name = "buck4", 851 + .of_match = of_match_ptr("buck4"), 852 + .regulators_node = of_match_ptr("regulators"), 853 + .id = BD96801_BUCK4, 854 + .ops = &bd96801_buck_ops, 855 + .type = REGULATOR_VOLTAGE, 856 + .linear_ranges = bd96805_tune_volts, 857 + .n_linear_ranges = ARRAY_SIZE(bd96805_tune_volts), 858 + .n_voltages = BD96805_BUCK_VOLTS, 859 + .enable_reg = BD96801_REG_ENABLE, 860 + .enable_mask = BD96801_BUCK4_EN_MASK, 861 + .enable_is_inverted = true, 862 + .vsel_reg = BD96801_BUCK4_VSEL_REG, 863 + .vsel_mask = BD96805_BUCK_VSEL_MASK, 864 + .ramp_reg = BD96801_BUCK4_VSEL_REG, 865 + .ramp_mask = BD96801_MASK_RAMP_DELAY, 866 + .ramp_delay_table = &buck_ramp_table[0], 867 + .n_ramp_values = ARRAY_SIZE(buck_ramp_table), 868 + .owner = THIS_MODULE, 869 + }, 870 + .irq_desc = { 871 + .irqinfo = (struct bd96801_irqinfo *)&buck4_irqinfo[0], 872 + .num_irqs = ARRAY_SIZE(buck4_irqinfo), 873 + }, 874 + .init_ranges = bd96805_buck_init_volts, 875 + .num_ranges = ARRAY_SIZE(bd96805_buck_init_volts), 876 + }, { 877 + .desc = { 878 + .name = "ldo5", 879 + .of_match = of_match_ptr("ldo5"), 880 + .regulators_node = of_match_ptr("regulators"), 881 + .id = BD96801_LDO5, 882 + .ops = &bd96801_ldo_ops, 883 + .type = REGULATOR_VOLTAGE, 884 + .linear_ranges = bd96801_ldo_int_volts, 885 + .n_linear_ranges = ARRAY_SIZE(bd96801_ldo_int_volts), 886 + .n_voltages = BD96801_LDO_VOLTS, 887 + .enable_reg = BD96801_REG_ENABLE, 888 + .enable_mask = BD96801_LDO5_EN_MASK, 889 + .enable_is_inverted = true, 890 + .vsel_reg = BD96801_LDO5_VSEL_REG, 891 + .vsel_mask = BD96801_LDO_VSEL_MASK, 892 + .owner = THIS_MODULE, 893 + }, 894 + .irq_desc = { 895 + .irqinfo = (struct bd96801_irqinfo *)&ldo5_irqinfo[0], 896 + .num_irqs = ARRAY_SIZE(ldo5_irqinfo), 897 + }, 898 + .ldo_vol_lvl = BD96801_LDO5_VOL_LVL_REG, 899 + }, { 900 + .desc = { 901 + .name = "ldo6", 902 + .of_match = of_match_ptr("ldo6"), 903 + .regulators_node = of_match_ptr("regulators"), 904 + .id = BD96801_LDO6, 905 + .ops = &bd96801_ldo_ops, 906 + .type = REGULATOR_VOLTAGE, 907 + .linear_ranges = bd96801_ldo_int_volts, 908 + .n_linear_ranges = ARRAY_SIZE(bd96801_ldo_int_volts), 909 + .n_voltages = BD96801_LDO_VOLTS, 910 + .enable_reg = BD96801_REG_ENABLE, 911 + .enable_mask = BD96801_LDO6_EN_MASK, 912 + .enable_is_inverted = true, 913 + .vsel_reg = BD96801_LDO6_VSEL_REG, 914 + .vsel_mask = BD96801_LDO_VSEL_MASK, 915 + .owner = THIS_MODULE, 916 + }, 917 + .irq_desc = { 918 + .irqinfo = (struct bd96801_irqinfo *)&ldo6_irqinfo[0], 919 + .num_irqs = ARRAY_SIZE(ldo6_irqinfo), 920 + }, 921 + .ldo_vol_lvl = BD96801_LDO6_VOL_LVL_REG, 922 + }, { 923 + .desc = { 924 + .name = "ldo7", 925 + .of_match = of_match_ptr("ldo7"), 926 + .regulators_node = of_match_ptr("regulators"), 927 + .id = BD96801_LDO7, 928 + .ops = &bd96801_ldo_ops, 929 + .type = REGULATOR_VOLTAGE, 930 + .linear_ranges = bd96801_ldo_int_volts, 931 + .n_linear_ranges = ARRAY_SIZE(bd96801_ldo_int_volts), 932 + .n_voltages = BD96801_LDO_VOLTS, 933 + .enable_reg = BD96801_REG_ENABLE, 934 + .enable_mask = BD96801_LDO7_EN_MASK, 935 + .enable_is_inverted = true, 936 + .vsel_reg = BD96801_LDO7_VSEL_REG, 937 + .vsel_mask = BD96801_LDO_VSEL_MASK, 938 + .owner = THIS_MODULE, 939 + }, 940 + .irq_desc = { 941 + .irqinfo = (struct bd96801_irqinfo *)&ldo7_irqinfo[0], 942 + .num_irqs = ARRAY_SIZE(ldo7_irqinfo), 943 + }, 944 + .ldo_vol_lvl = BD96801_LDO7_VOL_LVL_REG, 945 + }, 946 + }, 947 + .num_regulators = 7, 948 + }; 949 + 781 950 static int initialize_pmic_data(struct platform_device *pdev, 782 951 struct bd96801_pmic_data *pdata) 783 952 { ··· 1263 1056 static const struct platform_device_id bd96801_pmic_id[] = { 1264 1057 { "bd96801-regulator", (kernel_ulong_t)&bd96801_data }, 1265 1058 { "bd96802-regulator", (kernel_ulong_t)&bd96802_data }, 1059 + { "bd96805-regulator", (kernel_ulong_t)&bd96805_data }, 1266 1060 { }, 1267 1061 }; 1268 1062 MODULE_DEVICE_TABLE(platform, bd96801_pmic_id);