diff options
author | Axel Lin <axel.lin@gmail.com> | 2012-03-13 02:53:58 -0400 |
---|---|---|
committer | Mark Brown <broonie@opensource.wolfsonmicro.com> | 2012-04-01 06:59:33 -0400 |
commit | 4533f80ef8da866564a29578a1a8b037c51c6fc6 (patch) | |
tree | f6e839384cc55eb44f2603256c01d56bca0a1a67 /drivers/regulator/max8997.c | |
parent | 6f43c3809ec35c04c03f428d8b71121c13d2434e (diff) |
regulator: Add MAX8997_VOLTAGE_REGULATOR and MAX8997_CURRENT_REGULATOR macros
MAX8997_VOLTAGE_REGULATOR macro has _name and _ops parameters so we can use it
for all regulators with REGULATOR_VOLTAGE type.
The MAX8997_VOLTAGE_REGULATOR now replaces regulator_desc_ldo and
regulator_desc_buck macros.
MAX8997_CURRENT_REGULATOR is for CHARGER and CHARGER_TOPOFF.
Signed-off-by: Axel Lin <axel.lin@gmail.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Diffstat (limited to 'drivers/regulator/max8997.c')
-rw-r--r-- | drivers/regulator/max8997.c | 135 |
1 files changed, 45 insertions, 90 deletions
diff --git a/drivers/regulator/max8997.c b/drivers/regulator/max8997.c index 35e7332fb93..6e7beee1c20 100644 --- a/drivers/regulator/max8997.c +++ b/drivers/regulator/max8997.c | |||
@@ -855,103 +855,58 @@ static struct regulator_ops max8997_charger_fixedstate_ops = { | |||
855 | .set_current_limit = max8997_set_voltage_ldobuck_wrap, | 855 | .set_current_limit = max8997_set_voltage_ldobuck_wrap, |
856 | }; | 856 | }; |
857 | 857 | ||
858 | #define regulator_desc_ldo(num) { \ | 858 | #define MAX8997_VOLTAGE_REGULATOR(_name, _ops) {\ |
859 | .name = "LDO"#num, \ | 859 | .name = #_name, \ |
860 | .id = MAX8997_LDO##num, \ | 860 | .id = MAX8997_##_name, \ |
861 | .ops = &max8997_ldo_ops, \ | 861 | .ops = &_ops, \ |
862 | .type = REGULATOR_VOLTAGE, \ | 862 | .type = REGULATOR_VOLTAGE, \ |
863 | .owner = THIS_MODULE, \ | 863 | .owner = THIS_MODULE, \ |
864 | } | 864 | } |
865 | #define regulator_desc_buck(num) { \ | 865 | |
866 | .name = "BUCK"#num, \ | 866 | #define MAX8997_CURRENT_REGULATOR(_name, _ops) {\ |
867 | .id = MAX8997_BUCK##num, \ | 867 | .name = #_name, \ |
868 | .ops = &max8997_buck_ops, \ | 868 | .id = MAX8997_##_name, \ |
869 | .type = REGULATOR_VOLTAGE, \ | 869 | .ops = &_ops, \ |
870 | .type = REGULATOR_CURRENT, \ | ||
870 | .owner = THIS_MODULE, \ | 871 | .owner = THIS_MODULE, \ |
871 | } | 872 | } |
872 | 873 | ||
873 | static struct regulator_desc regulators[] = { | 874 | static struct regulator_desc regulators[] = { |
874 | regulator_desc_ldo(1), | 875 | MAX8997_VOLTAGE_REGULATOR(LDO1, max8997_ldo_ops), |
875 | regulator_desc_ldo(2), | 876 | MAX8997_VOLTAGE_REGULATOR(LDO2, max8997_ldo_ops), |
876 | regulator_desc_ldo(3), | 877 | MAX8997_VOLTAGE_REGULATOR(LDO3, max8997_ldo_ops), |
877 | regulator_desc_ldo(4), | 878 | MAX8997_VOLTAGE_REGULATOR(LDO4, max8997_ldo_ops), |
878 | regulator_desc_ldo(5), | 879 | MAX8997_VOLTAGE_REGULATOR(LDO5, max8997_ldo_ops), |
879 | regulator_desc_ldo(6), | 880 | MAX8997_VOLTAGE_REGULATOR(LDO6, max8997_ldo_ops), |
880 | regulator_desc_ldo(7), | 881 | MAX8997_VOLTAGE_REGULATOR(LDO7, max8997_ldo_ops), |
881 | regulator_desc_ldo(8), | 882 | MAX8997_VOLTAGE_REGULATOR(LDO8, max8997_ldo_ops), |
882 | regulator_desc_ldo(9), | 883 | MAX8997_VOLTAGE_REGULATOR(LDO9, max8997_ldo_ops), |
883 | regulator_desc_ldo(10), | 884 | MAX8997_VOLTAGE_REGULATOR(LDO10, max8997_ldo_ops), |
884 | regulator_desc_ldo(11), | 885 | MAX8997_VOLTAGE_REGULATOR(LDO11, max8997_ldo_ops), |
885 | regulator_desc_ldo(12), | 886 | MAX8997_VOLTAGE_REGULATOR(LDO12, max8997_ldo_ops), |
886 | regulator_desc_ldo(13), | 887 | MAX8997_VOLTAGE_REGULATOR(LDO13, max8997_ldo_ops), |
887 | regulator_desc_ldo(14), | 888 | MAX8997_VOLTAGE_REGULATOR(LDO14, max8997_ldo_ops), |
888 | regulator_desc_ldo(15), | 889 | MAX8997_VOLTAGE_REGULATOR(LDO15, max8997_ldo_ops), |
889 | regulator_desc_ldo(16), | 890 | MAX8997_VOLTAGE_REGULATOR(LDO16, max8997_ldo_ops), |
890 | regulator_desc_ldo(17), | 891 | MAX8997_VOLTAGE_REGULATOR(LDO17, max8997_ldo_ops), |
891 | regulator_desc_ldo(18), | 892 | MAX8997_VOLTAGE_REGULATOR(LDO18, max8997_ldo_ops), |
892 | regulator_desc_ldo(21), | 893 | MAX8997_VOLTAGE_REGULATOR(LDO21, max8997_ldo_ops), |
893 | regulator_desc_buck(1), | 894 | MAX8997_VOLTAGE_REGULATOR(BUCK1, max8997_buck_ops), |
894 | regulator_desc_buck(2), | 895 | MAX8997_VOLTAGE_REGULATOR(BUCK2, max8997_buck_ops), |
895 | regulator_desc_buck(3), | 896 | MAX8997_VOLTAGE_REGULATOR(BUCK3, max8997_buck_ops), |
896 | regulator_desc_buck(4), | 897 | MAX8997_VOLTAGE_REGULATOR(BUCK4, max8997_buck_ops), |
897 | regulator_desc_buck(5), | 898 | MAX8997_VOLTAGE_REGULATOR(BUCK5, max8997_buck_ops), |
898 | { | 899 | MAX8997_VOLTAGE_REGULATOR(BUCK6, max8997_fixedvolt_ops), |
899 | .name = "BUCK6", | 900 | MAX8997_VOLTAGE_REGULATOR(BUCK7, max8997_buck_ops), |
900 | .id = MAX8997_BUCK6, | 901 | MAX8997_VOLTAGE_REGULATOR(EN32KHZ_AP, max8997_fixedvolt_ops), |
901 | .ops = &max8997_fixedvolt_ops, | 902 | MAX8997_VOLTAGE_REGULATOR(EN32KHZ_CP, max8997_fixedvolt_ops), |
902 | .type = REGULATOR_VOLTAGE, | 903 | MAX8997_VOLTAGE_REGULATOR(ENVICHG, max8997_fixedvolt_ops), |
903 | .owner = THIS_MODULE, | 904 | MAX8997_VOLTAGE_REGULATOR(ESAFEOUT1, max8997_safeout_ops), |
904 | }, | 905 | MAX8997_VOLTAGE_REGULATOR(ESAFEOUT2, max8997_safeout_ops), |
905 | regulator_desc_buck(7), | 906 | MAX8997_VOLTAGE_REGULATOR(CHARGER_CV, max8997_fixedstate_ops), |
906 | { | 907 | MAX8997_CURRENT_REGULATOR(CHARGER, max8997_charger_ops), |
907 | .name = "EN32KHz_AP", | 908 | MAX8997_CURRENT_REGULATOR(CHARGER_TOPOFF, |
908 | .id = MAX8997_EN32KHZ_AP, | 909 | max8997_charger_fixedstate_ops), |
909 | .ops = &max8997_fixedvolt_ops, | ||
910 | .type = REGULATOR_VOLTAGE, | ||
911 | .owner = THIS_MODULE, | ||
912 | }, { | ||
913 | .name = "EN32KHz_CP", | ||
914 | .id = MAX8997_EN32KHZ_CP, | ||
915 | .ops = &max8997_fixedvolt_ops, | ||
916 | .type = REGULATOR_VOLTAGE, | ||
917 | .owner = THIS_MODULE, | ||
918 | }, { | ||
919 | .name = "ENVICHG", | ||
920 | .id = MAX8997_ENVICHG, | ||
921 | .ops = &max8997_fixedvolt_ops, | ||
922 | .type = REGULATOR_VOLTAGE, | ||
923 | .owner = THIS_MODULE, | ||
924 | }, { | ||
925 | .name = "ESAFEOUT1", | ||
926 | .id = MAX8997_ESAFEOUT1, | ||
927 | .ops = &max8997_safeout_ops, | ||
928 | .type = REGULATOR_VOLTAGE, | ||
929 | .owner = THIS_MODULE, | ||
930 | }, { | ||
931 | .name = "ESAFEOUT2", | ||
932 | .id = MAX8997_ESAFEOUT2, | ||
933 | .ops = &max8997_safeout_ops, | ||
934 | .type = REGULATOR_VOLTAGE, | ||
935 | .owner = THIS_MODULE, | ||
936 | }, { | ||
937 | .name = "CHARGER_CV", | ||
938 | .id = MAX8997_CHARGER_CV, | ||
939 | .ops = &max8997_fixedstate_ops, | ||
940 | .type = REGULATOR_VOLTAGE, | ||
941 | .owner = THIS_MODULE, | ||
942 | }, { | ||
943 | .name = "CHARGER", | ||
944 | .id = MAX8997_CHARGER, | ||
945 | .ops = &max8997_charger_ops, | ||
946 | .type = REGULATOR_CURRENT, | ||
947 | .owner = THIS_MODULE, | ||
948 | }, { | ||
949 | .name = "CHARGER_TOPOFF", | ||
950 | .id = MAX8997_CHARGER_TOPOFF, | ||
951 | .ops = &max8997_charger_fixedstate_ops, | ||
952 | .type = REGULATOR_CURRENT, | ||
953 | .owner = THIS_MODULE, | ||
954 | }, | ||
955 | }; | 910 | }; |
956 | 911 | ||
957 | static __devinit int max8997_pmic_probe(struct platform_device *pdev) | 912 | static __devinit int max8997_pmic_probe(struct platform_device *pdev) |