diff options
author | Mike Rapoport <mike@compulab.co.il> | 2009-02-02 01:57:52 -0500 |
---|---|---|
committer | Eric Miao <eric.miao@marvell.com> | 2009-02-02 04:40:16 -0500 |
commit | 432adf1898381bac5a9ef90262d8a91e16823b11 (patch) | |
tree | 57cb1a6ceb602a7145462dd9d8b92a2b54ac21c4 /arch/arm/mach-pxa/em-x270.c | |
parent | 6432f46c4ffd0a85cab5313bc989a6db32bc0eb4 (diff) |
[ARM] pxa/em-x270: introduce macors to to simplify da9030 subdev initialization
Signed-off-by: Mike Rapoport <mike@compulab.co.il>
Signed-off-by: Eric Miao <eric.miao@marvell.com>
Diffstat (limited to 'arch/arm/mach-pxa/em-x270.c')
-rw-r--r-- | arch/arm/mach-pxa/em-x270.c | 172 |
1 files changed, 50 insertions, 122 deletions
diff --git a/arch/arm/mach-pxa/em-x270.c b/arch/arm/mach-pxa/em-x270.c index 05f9e9e1224b..7d056cb2334e 100644 --- a/arch/arm/mach-pxa/em-x270.c +++ b/arch/arm/mach-pxa/em-x270.c | |||
@@ -784,136 +784,64 @@ static inline void em_x270_init_camera(void) {} | |||
784 | #endif | 784 | #endif |
785 | 785 | ||
786 | /* DA9030 related initializations */ | 786 | /* DA9030 related initializations */ |
787 | static struct regulator_consumer_supply ldo3_consumers[] = { | 787 | #define REGULATOR_CONSUMER(_name, _dev, _supply) \ |
788 | { | 788 | static struct regulator_consumer_supply _name##_consumers[] = { \ |
789 | .dev = NULL, | 789 | { \ |
790 | .supply = "vcc gps", | 790 | .dev = _dev, \ |
791 | }, | 791 | .supply = _supply, \ |
792 | }; | 792 | }, \ |
793 | 793 | } | |
794 | static struct regulator_consumer_supply ldo5_consumers[] = { | ||
795 | { | ||
796 | .dev = NULL, | ||
797 | .supply = "vcc cam", | ||
798 | }, | ||
799 | }; | ||
800 | |||
801 | static struct regulator_consumer_supply ldo10_consumers[] = { | ||
802 | { | ||
803 | .dev = &pxa_device_mci.dev, | ||
804 | .supply = "vcc sdio", | ||
805 | }, | ||
806 | }; | ||
807 | |||
808 | static struct regulator_consumer_supply ldo12_consumers[] = { | ||
809 | { | ||
810 | .dev = NULL, | ||
811 | .supply = "vcc usb", | ||
812 | }, | ||
813 | }; | ||
814 | |||
815 | static struct regulator_consumer_supply ldo19_consumers[] = { | ||
816 | { | ||
817 | .dev = NULL, | ||
818 | .supply = "vcc gprs", | ||
819 | }, | ||
820 | }; | ||
821 | |||
822 | static struct regulator_init_data ldo3_data = { | ||
823 | .constraints = { | ||
824 | .min_uV = 3200000, | ||
825 | .max_uV = 3200000, | ||
826 | .state_mem = { | ||
827 | .enabled = 0, | ||
828 | }, | ||
829 | }, | ||
830 | .num_consumer_supplies = ARRAY_SIZE(ldo3_consumers), | ||
831 | .consumer_supplies = ldo3_consumers, | ||
832 | }; | ||
833 | |||
834 | static struct regulator_init_data ldo5_data = { | ||
835 | .constraints = { | ||
836 | .min_uV = 3000000, | ||
837 | .max_uV = 3000000, | ||
838 | .state_mem = { | ||
839 | .enabled = 0, | ||
840 | }, | ||
841 | }, | ||
842 | .num_consumer_supplies = ARRAY_SIZE(ldo5_consumers), | ||
843 | .consumer_supplies = ldo5_consumers, | ||
844 | }; | ||
845 | |||
846 | static struct regulator_init_data ldo10_data = { | ||
847 | .constraints = { | ||
848 | .min_uV = 2000000, | ||
849 | .max_uV = 3200000, | ||
850 | .state_mem = { | ||
851 | .enabled = 0, | ||
852 | }, | ||
853 | .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE | REGULATOR_CHANGE_STATUS, | ||
854 | }, | ||
855 | .num_consumer_supplies = ARRAY_SIZE(ldo10_consumers), | ||
856 | .consumer_supplies = ldo10_consumers, | ||
857 | }; | ||
858 | |||
859 | static struct regulator_init_data ldo12_data = { | ||
860 | .constraints = { | ||
861 | .min_uV = 3000000, | ||
862 | .max_uV = 3000000, | ||
863 | .state_mem = { | ||
864 | .enabled = 0, | ||
865 | }, | ||
866 | }, | ||
867 | .num_consumer_supplies = ARRAY_SIZE(ldo12_consumers), | ||
868 | .consumer_supplies = ldo12_consumers, | ||
869 | }; | ||
870 | 794 | ||
871 | static struct regulator_init_data ldo19_data = { | 795 | REGULATOR_CONSUMER(ldo3, NULL, "vcc gps"); |
872 | .constraints = { | 796 | REGULATOR_CONSUMER(ldo5, NULL, "vcc cam"); |
873 | .min_uV = 3200000, | 797 | REGULATOR_CONSUMER(ldo10, &pxa_device_mci.dev, "vcc sdio"); |
874 | .max_uV = 3200000, | 798 | REGULATOR_CONSUMER(ldo12, NULL, "vcc usb"); |
875 | .state_mem = { | 799 | REGULATOR_CONSUMER(ldo19, NULL, "vcc gprs"); |
876 | .enabled = 0, | 800 | |
877 | }, | 801 | #define REGULATOR_INIT(_ldo, _min_uV, _max_uV, _ops_mask) \ |
878 | }, | 802 | static struct regulator_init_data _ldo##_data = { \ |
879 | .num_consumer_supplies = ARRAY_SIZE(ldo19_consumers), | 803 | .constraints = { \ |
880 | .consumer_supplies = ldo19_consumers, | 804 | .min_uV = _min_uV, \ |
881 | }; | 805 | .max_uV = _max_uV, \ |
806 | .state_mem = { \ | ||
807 | .enabled = 0, \ | ||
808 | }, \ | ||
809 | .valid_ops_mask = _ops_mask, \ | ||
810 | }, \ | ||
811 | .num_consumer_supplies = ARRAY_SIZE(_ldo##_consumers), \ | ||
812 | .consumer_supplies = _ldo##_consumers, \ | ||
813 | }; | ||
814 | |||
815 | REGULATOR_INIT(ldo3, 3200000, 3200000, REGULATOR_CHANGE_STATUS); | ||
816 | REGULATOR_INIT(ldo5, 3000000, 3000000, REGULATOR_CHANGE_STATUS); | ||
817 | REGULATOR_INIT(ldo10, 2000000, 3200000, | ||
818 | REGULATOR_CHANGE_STATUS | REGULATOR_CHANGE_VOLTAGE); | ||
819 | REGULATOR_INIT(ldo12, 3000000, 3000000, REGULATOR_CHANGE_STATUS); | ||
820 | REGULATOR_INIT(ldo19, 3200000, 3200000, REGULATOR_CHANGE_STATUS); | ||
882 | 821 | ||
883 | struct led_info em_x270_led_info = { | 822 | struct led_info em_x270_led_info = { |
884 | .name = "em-x270:orange", | 823 | .name = "em-x270:orange", |
885 | .default_trigger = "battery-charging-or-full", | 824 | .default_trigger = "battery-charging-or-full", |
886 | }; | 825 | }; |
887 | 826 | ||
888 | struct da903x_subdev_info em_x270_da9030_subdevs[] = { | 827 | #define DA9030_SUBDEV(_name, _id, _pdata) \ |
889 | { | 828 | { \ |
890 | .name = "da903x-regulator", | 829 | .name = "da903x-" #_name, \ |
891 | .id = DA9030_ID_LDO3, | 830 | .id = DA9030_ID_##_id, \ |
892 | .platform_data = &ldo3_data, | 831 | .platform_data = _pdata, \ |
893 | }, { | ||
894 | .name = "da903x-regulator", | ||
895 | .id = DA9030_ID_LDO5, | ||
896 | .platform_data = &ldo5_data, | ||
897 | }, { | ||
898 | .name = "da903x-regulator", | ||
899 | .id = DA9030_ID_LDO10, | ||
900 | .platform_data = &ldo10_data, | ||
901 | }, { | ||
902 | .name = "da903x-regulator", | ||
903 | .id = DA9030_ID_LDO12, | ||
904 | .platform_data = &ldo12_data, | ||
905 | }, { | ||
906 | .name = "da903x-regulator", | ||
907 | .id = DA9030_ID_LDO19, | ||
908 | .platform_data = &ldo19_data, | ||
909 | }, { | ||
910 | .name = "da903x-led", | ||
911 | .id = DA9030_ID_LED_PC, | ||
912 | .platform_data = &em_x270_led_info, | ||
913 | }, { | ||
914 | .name = "da903x-backlight", | ||
915 | .id = DA9030_ID_WLED, | ||
916 | } | 832 | } |
833 | |||
834 | #define DA9030_LDO(num) DA9030_SUBDEV(regulator, LDO##num, &ldo##num##_data) | ||
835 | |||
836 | struct da903x_subdev_info em_x270_da9030_subdevs[] = { | ||
837 | DA9030_LDO(3), | ||
838 | DA9030_LDO(5), | ||
839 | DA9030_LDO(10), | ||
840 | DA9030_LDO(12), | ||
841 | DA9030_LDO(19), | ||
842 | |||
843 | DA9030_SUBDEV(led, LED_PC, &em_x270_led_info), | ||
844 | DA9030_SUBDEV(backlight, WLED, &em_x270_led_info), | ||
917 | }; | 845 | }; |
918 | 846 | ||
919 | static struct da903x_platform_data em_x270_da9030_info = { | 847 | static struct da903x_platform_data em_x270_da9030_info = { |