aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mfd
diff options
context:
space:
mode:
authorThierry Reding <thierry.reding@avionic-design.de>2012-09-18 04:29:50 -0400
committerSamuel Ortiz <sameo@linux.intel.com>2012-09-19 06:04:25 -0400
commitf78959cfa335196ba36d8c4651078f14dc07f2a8 (patch)
tree6e4504bb75fa5b686970df75196f77459e65ee2e /drivers/mfd
parent64b9e4d803b154a78a2e76bd466bb32ad6f383de (diff)
mfd: twl: Replace twl_has_*() macros by IS_ENABLED()
Instead of reinventing macros for the same purpose, use the standard macros. Signed-off-by: Thierry Reding <thierry.reding@avionic-design.de> Acked-by: Peter Ujfalusi <peter.ujfalusi@ti.com> Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
Diffstat (limited to 'drivers/mfd')
-rw-r--r--drivers/mfd/twl-core.c117
1 files changed, 25 insertions, 92 deletions
diff --git a/drivers/mfd/twl-core.c b/drivers/mfd/twl-core.c
index f162b68e78a8..e208d88d2180 100644
--- a/drivers/mfd/twl-core.c
+++ b/drivers/mfd/twl-core.c
@@ -63,70 +63,6 @@
63 63
64#define DRIVER_NAME "twl" 64#define DRIVER_NAME "twl"
65 65
66#if defined(CONFIG_KEYBOARD_TWL4030) || defined(CONFIG_KEYBOARD_TWL4030_MODULE)
67#define twl_has_keypad() true
68#else
69#define twl_has_keypad() false
70#endif
71
72#if defined(CONFIG_GPIO_TWL4030) || defined(CONFIG_GPIO_TWL4030_MODULE)
73#define twl_has_gpio() true
74#else
75#define twl_has_gpio() false
76#endif
77
78#if defined(CONFIG_REGULATOR_TWL4030) \
79 || defined(CONFIG_REGULATOR_TWL4030_MODULE)
80#define twl_has_regulator() true
81#else
82#define twl_has_regulator() false
83#endif
84
85#if defined(CONFIG_TWL4030_MADC) || defined(CONFIG_TWL4030_MADC_MODULE)
86#define twl_has_madc() true
87#else
88#define twl_has_madc() false
89#endif
90
91#ifdef CONFIG_TWL4030_POWER
92#define twl_has_power() true
93#else
94#define twl_has_power() false
95#endif
96
97#if defined(CONFIG_RTC_DRV_TWL4030) || defined(CONFIG_RTC_DRV_TWL4030_MODULE)
98#define twl_has_rtc() true
99#else
100#define twl_has_rtc() false
101#endif
102
103#if defined(CONFIG_TWL4030_USB) || defined(CONFIG_TWL4030_USB_MODULE) ||\
104 defined(CONFIG_TWL6030_USB) || defined(CONFIG_TWL6030_USB_MODULE)
105#define twl_has_usb() true
106#else
107#define twl_has_usb() false
108#endif
109
110#if defined(CONFIG_TWL4030_WATCHDOG) || \
111 defined(CONFIG_TWL4030_WATCHDOG_MODULE)
112#define twl_has_watchdog() true
113#else
114#define twl_has_watchdog() false
115#endif
116
117#if defined(CONFIG_MFD_TWL4030_AUDIO) || \
118 defined(CONFIG_MFD_TWL4030_AUDIO_MODULE)
119#define twl_has_codec() true
120#else
121#define twl_has_codec() false
122#endif
123
124#if defined(CONFIG_CHARGER_TWL4030) || defined(CONFIG_CHARGER_TWL4030_MODULE)
125#define twl_has_bci() true
126#else
127#define twl_has_bci() false
128#endif
129
130/* Triton Core internal information (BEGIN) */ 66/* Triton Core internal information (BEGIN) */
131 67
132/* Last - for index max*/ 68/* Last - for index max*/
@@ -134,13 +70,6 @@
134 70
135#define TWL_NUM_SLAVES 4 71#define TWL_NUM_SLAVES 4
136 72
137#if defined(CONFIG_INPUT_TWL4030_PWRBUTTON) \
138 || defined(CONFIG_INPUT_TWL4030_PWRBUTTON_MODULE)
139#define twl_has_pwrbutton() true
140#else
141#define twl_has_pwrbutton() false
142#endif
143
144#define SUB_CHIP_ID0 0 73#define SUB_CHIP_ID0 0
145#define SUB_CHIP_ID1 1 74#define SUB_CHIP_ID1 1
146#define SUB_CHIP_ID2 2 75#define SUB_CHIP_ID2 2
@@ -701,7 +630,7 @@ add_children(struct twl4030_platform_data *pdata, unsigned irq_base,
701 struct device *child; 630 struct device *child;
702 unsigned sub_chip_id; 631 unsigned sub_chip_id;
703 632
704 if (twl_has_gpio() && pdata->gpio) { 633 if (IS_ENABLED(CONFIG_GPIO_TWL4030) && pdata->gpio) {
705 child = add_child(SUB_CHIP_ID1, "twl4030_gpio", 634 child = add_child(SUB_CHIP_ID1, "twl4030_gpio",
706 pdata->gpio, sizeof(*pdata->gpio), 635 pdata->gpio, sizeof(*pdata->gpio),
707 false, irq_base + GPIO_INTR_OFFSET, 0); 636 false, irq_base + GPIO_INTR_OFFSET, 0);
@@ -709,7 +638,7 @@ add_children(struct twl4030_platform_data *pdata, unsigned irq_base,
709 return PTR_ERR(child); 638 return PTR_ERR(child);
710 } 639 }
711 640
712 if (twl_has_keypad() && pdata->keypad) { 641 if (IS_ENABLED(CONFIG_KEYBOARD_TWL4030) && pdata->keypad) {
713 child = add_child(SUB_CHIP_ID2, "twl4030_keypad", 642 child = add_child(SUB_CHIP_ID2, "twl4030_keypad",
714 pdata->keypad, sizeof(*pdata->keypad), 643 pdata->keypad, sizeof(*pdata->keypad),
715 true, irq_base + KEYPAD_INTR_OFFSET, 0); 644 true, irq_base + KEYPAD_INTR_OFFSET, 0);
@@ -717,7 +646,7 @@ add_children(struct twl4030_platform_data *pdata, unsigned irq_base,
717 return PTR_ERR(child); 646 return PTR_ERR(child);
718 } 647 }
719 648
720 if (twl_has_madc() && pdata->madc) { 649 if (IS_ENABLED(CONFIG_TWL4030_MADC) && pdata->madc) {
721 child = add_child(2, "twl4030_madc", 650 child = add_child(2, "twl4030_madc",
722 pdata->madc, sizeof(*pdata->madc), 651 pdata->madc, sizeof(*pdata->madc),
723 true, irq_base + MADC_INTR_OFFSET, 0); 652 true, irq_base + MADC_INTR_OFFSET, 0);
@@ -725,7 +654,7 @@ add_children(struct twl4030_platform_data *pdata, unsigned irq_base,
725 return PTR_ERR(child); 654 return PTR_ERR(child);
726 } 655 }
727 656
728 if (twl_has_rtc()) { 657 if (IS_ENABLED(CONFIG_RTC_DRV_TWL4030)) {
729 /* 658 /*
730 * REVISIT platform_data here currently might expose the 659 * REVISIT platform_data here currently might expose the
731 * "msecure" line ... but for now we just expect board 660 * "msecure" line ... but for now we just expect board
@@ -741,7 +670,8 @@ add_children(struct twl4030_platform_data *pdata, unsigned irq_base,
741 return PTR_ERR(child); 670 return PTR_ERR(child);
742 } 671 }
743 672
744 if (twl_has_usb() && pdata->usb && twl_class_is_4030()) { 673 if (IS_ENABLED(CONFIG_TWL4030_USB) && pdata->usb &&
674 twl_class_is_4030()) {
745 675
746 static struct regulator_consumer_supply usb1v5 = { 676 static struct regulator_consumer_supply usb1v5 = {
747 .supply = "usb1v5", 677 .supply = "usb1v5",
@@ -755,7 +685,7 @@ add_children(struct twl4030_platform_data *pdata, unsigned irq_base,
755 }; 685 };
756 686
757 /* First add the regulators so that they can be used by transceiver */ 687 /* First add the regulators so that they can be used by transceiver */
758 if (twl_has_regulator()) { 688 if (IS_ENABLED(CONFIG_REGULATOR_TWL4030)) {
759 /* this is a template that gets copied */ 689 /* this is a template that gets copied */
760 struct regulator_init_data usb_fixed = { 690 struct regulator_init_data usb_fixed = {
761 .constraints.valid_modes_mask = 691 .constraints.valid_modes_mask =
@@ -797,18 +727,19 @@ add_children(struct twl4030_platform_data *pdata, unsigned irq_base,
797 return PTR_ERR(child); 727 return PTR_ERR(child);
798 728
799 /* we need to connect regulators to this transceiver */ 729 /* we need to connect regulators to this transceiver */
800 if (twl_has_regulator() && child) { 730 if (IS_ENABLED(CONFIG_REGULATOR_TWL4030) && child) {
801 usb1v5.dev_name = dev_name(child); 731 usb1v5.dev_name = dev_name(child);
802 usb1v8.dev_name = dev_name(child); 732 usb1v8.dev_name = dev_name(child);
803 usb3v1[0].dev_name = dev_name(child); 733 usb3v1[0].dev_name = dev_name(child);
804 } 734 }
805 } 735 }
806 if (twl_has_usb() && pdata->usb && twl_class_is_6030()) { 736 if (IS_ENABLED(CONFIG_TWL6030_USB) && pdata->usb &&
737 twl_class_is_6030()) {
807 738
808 static struct regulator_consumer_supply usb3v3; 739 static struct regulator_consumer_supply usb3v3;
809 int regulator; 740 int regulator;
810 741
811 if (twl_has_regulator()) { 742 if (IS_ENABLED(CONFIG_REGULATOR_TWL4030)) {
812 /* this is a template that gets copied */ 743 /* this is a template that gets copied */
813 struct regulator_init_data usb_fixed = { 744 struct regulator_init_data usb_fixed = {
814 .constraints.valid_modes_mask = 745 .constraints.valid_modes_mask =
@@ -845,9 +776,10 @@ add_children(struct twl4030_platform_data *pdata, unsigned irq_base,
845 if (IS_ERR(child)) 776 if (IS_ERR(child))
846 return PTR_ERR(child); 777 return PTR_ERR(child);
847 /* we need to connect regulators to this transceiver */ 778 /* we need to connect regulators to this transceiver */
848 if (twl_has_regulator() && child) 779 if (IS_ENABLED(CONFIG_REGULATOR_TWL4030) && child)
849 usb3v3.dev_name = dev_name(child); 780 usb3v3.dev_name = dev_name(child);
850 } else if (twl_has_regulator() && twl_class_is_6030()) { 781 } else if (IS_ENABLED(CONFIG_REGULATOR_TWL4030) &&
782 twl_class_is_6030()) {
851 if (features & TWL6025_SUBCLASS) 783 if (features & TWL6025_SUBCLASS)
852 child = add_regulator(TWL6025_REG_LDOUSB, 784 child = add_regulator(TWL6025_REG_LDOUSB,
853 pdata->ldousb, features); 785 pdata->ldousb, features);
@@ -859,20 +791,21 @@ add_children(struct twl4030_platform_data *pdata, unsigned irq_base,
859 return PTR_ERR(child); 791 return PTR_ERR(child);
860 } 792 }
861 793
862 if (twl_has_watchdog() && twl_class_is_4030()) { 794 if (IS_ENABLED(CONFIG_TWL4030_WATCHDOG) && twl_class_is_4030()) {
863 child = add_child(0, "twl4030_wdt", NULL, 0, false, 0, 0); 795 child = add_child(0, "twl4030_wdt", NULL, 0, false, 0, 0);
864 if (IS_ERR(child)) 796 if (IS_ERR(child))
865 return PTR_ERR(child); 797 return PTR_ERR(child);
866 } 798 }
867 799
868 if (twl_has_pwrbutton() && twl_class_is_4030()) { 800 if (IS_ENABLED(CONFIG_INPUT_TWL4030_PWRBUTTON) && twl_class_is_4030()) {
869 child = add_child(1, "twl4030_pwrbutton", 801 child = add_child(1, "twl4030_pwrbutton",
870 NULL, 0, true, irq_base + 8 + 0, 0); 802 NULL, 0, true, irq_base + 8 + 0, 0);
871 if (IS_ERR(child)) 803 if (IS_ERR(child))
872 return PTR_ERR(child); 804 return PTR_ERR(child);
873 } 805 }
874 806
875 if (twl_has_codec() && pdata->audio && twl_class_is_4030()) { 807 if (IS_ENABLED(CONFIG_MFD_TWL4030_AUDIO) && pdata->audio &&
808 twl_class_is_4030()) {
876 sub_chip_id = twl_map[TWL_MODULE_AUDIO_VOICE].sid; 809 sub_chip_id = twl_map[TWL_MODULE_AUDIO_VOICE].sid;
877 child = add_child(sub_chip_id, "twl4030-audio", 810 child = add_child(sub_chip_id, "twl4030-audio",
878 pdata->audio, sizeof(*pdata->audio), 811 pdata->audio, sizeof(*pdata->audio),
@@ -882,7 +815,7 @@ add_children(struct twl4030_platform_data *pdata, unsigned irq_base,
882 } 815 }
883 816
884 /* twl4030 regulators */ 817 /* twl4030 regulators */
885 if (twl_has_regulator() && twl_class_is_4030()) { 818 if (IS_ENABLED(CONFIG_REGULATOR_TWL4030) && twl_class_is_4030()) {
886 child = add_regulator(TWL4030_REG_VPLL1, pdata->vpll1, 819 child = add_regulator(TWL4030_REG_VPLL1, pdata->vpll1,
887 features); 820 features);
888 if (IS_ERR(child)) 821 if (IS_ERR(child))
@@ -937,7 +870,7 @@ add_children(struct twl4030_platform_data *pdata, unsigned irq_base,
937 } 870 }
938 871
939 /* maybe add LDOs that are omitted on cost-reduced parts */ 872 /* maybe add LDOs that are omitted on cost-reduced parts */
940 if (twl_has_regulator() && !(features & TPS_SUBSET) 873 if (IS_ENABLED(CONFIG_REGULATOR_TWL4030) && !(features & TPS_SUBSET)
941 && twl_class_is_4030()) { 874 && twl_class_is_4030()) {
942 child = add_regulator(TWL4030_REG_VPLL2, pdata->vpll2, 875 child = add_regulator(TWL4030_REG_VPLL2, pdata->vpll2,
943 features); 876 features);
@@ -971,7 +904,7 @@ add_children(struct twl4030_platform_data *pdata, unsigned irq_base,
971 } 904 }
972 905
973 /* twl6030 regulators */ 906 /* twl6030 regulators */
974 if (twl_has_regulator() && twl_class_is_6030() && 907 if (IS_ENABLED(CONFIG_REGULATOR_TWL4030) && twl_class_is_6030() &&
975 !(features & TWL6025_SUBCLASS)) { 908 !(features & TWL6025_SUBCLASS)) {
976 child = add_regulator(TWL6030_REG_VDD1, pdata->vdd1, 909 child = add_regulator(TWL6030_REG_VDD1, pdata->vdd1,
977 features); 910 features);
@@ -1045,7 +978,7 @@ add_children(struct twl4030_platform_data *pdata, unsigned irq_base,
1045 } 978 }
1046 979
1047 /* 6030 and 6025 share this regulator */ 980 /* 6030 and 6025 share this regulator */
1048 if (twl_has_regulator() && twl_class_is_6030()) { 981 if (IS_ENABLED(CONFIG_REGULATOR_TWL4030) && twl_class_is_6030()) {
1049 child = add_regulator(TWL6030_REG_VANA, pdata->vana, 982 child = add_regulator(TWL6030_REG_VANA, pdata->vana,
1050 features); 983 features);
1051 if (IS_ERR(child)) 984 if (IS_ERR(child))
@@ -1053,7 +986,7 @@ add_children(struct twl4030_platform_data *pdata, unsigned irq_base,
1053 } 986 }
1054 987
1055 /* twl6025 regulators */ 988 /* twl6025 regulators */
1056 if (twl_has_regulator() && twl_class_is_6030() && 989 if (IS_ENABLED(CONFIG_REGULATOR_TWL4030) && twl_class_is_6030() &&
1057 (features & TWL6025_SUBCLASS)) { 990 (features & TWL6025_SUBCLASS)) {
1058 child = add_regulator(TWL6025_REG_LDO5, pdata->ldo5, 991 child = add_regulator(TWL6025_REG_LDO5, pdata->ldo5,
1059 features); 992 features);
@@ -1112,7 +1045,7 @@ add_children(struct twl4030_platform_data *pdata, unsigned irq_base,
1112 1045
1113 } 1046 }
1114 1047
1115 if (twl_has_bci() && pdata->bci && 1048 if (IS_ENABLED(CONFIG_CHARGER_TWL4030) && pdata->bci &&
1116 !(features & (TPS_SUBSET | TWL5031))) { 1049 !(features & (TPS_SUBSET | TWL5031))) {
1117 child = add_child(3, "twl4030_bci", 1050 child = add_child(3, "twl4030_bci",
1118 pdata->bci, sizeof(*pdata->bci), false, 1051 pdata->bci, sizeof(*pdata->bci), false,
@@ -1324,7 +1257,7 @@ twl_probe(struct i2c_client *client, const struct i2c_device_id *id)
1324 } 1257 }
1325 1258
1326 /* load power event scripts */ 1259 /* load power event scripts */
1327 if (twl_has_power() && pdata->power) 1260 if (IS_ENABLED(CONFIG_TWL4030_POWER) && pdata->power)
1328 twl4030_power_init(pdata->power); 1261 twl4030_power_init(pdata->power);
1329 1262
1330 /* Maybe init the T2 Interrupt subsystem */ 1263 /* Maybe init the T2 Interrupt subsystem */