aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLee Jones <lee.jones@linaro.org>2013-02-25 09:42:00 -0500
committerLee Jones <lee.jones@linaro.org>2013-03-06 23:27:41 -0500
commit4b106fb9895c7edba2acd41c152e8f6edf724651 (patch)
tree89d7f013dd6d0d97d6b244d2c62f2f06e23465bc
parentc0eda9aef1c0ef7bb2812b739ddf400405568bef (diff)
mfd: ab8500-core: Rework MFD sub-device initialisation structures
Here we're separating Battery Management devices into their own structure, removing the common device structure & redistribute them amongst the individual platform structs and completing the population of them. Signed-off-by: Lee Jones <lee.jones@linaro.org> Acked-by: Samuel Ortiz <sameo@linux.intel.com>
-rw-r--r--drivers/mfd/ab8500-core.c243
1 files changed, 182 insertions, 61 deletions
diff --git a/drivers/mfd/ab8500-core.c b/drivers/mfd/ab8500-core.c
index cdf6c1e59bc3..23db4fcea496 100644
--- a/drivers/mfd/ab8500-core.c
+++ b/drivers/mfd/ab8500-core.c
@@ -658,7 +658,7 @@ static struct resource ab8500_gpadc_resources[] = {
658 }, 658 },
659}; 659};
660 660
661static struct resource ab8540_gpadc_resources[] = { 661static struct resource ab8505_gpadc_resources[] = {
662 { 662 {
663 .name = "SW_CONV_END", 663 .name = "SW_CONV_END",
664 .start = AB8500_INT_GP_SW_ADC_CONV_END, 664 .start = AB8500_INT_GP_SW_ADC_CONV_END,
@@ -1001,7 +1001,42 @@ static struct resource ab8500_temp_resources[] = {
1001 }, 1001 },
1002}; 1002};
1003 1003
1004static struct mfd_cell abx500_common_devs[] = { 1004static struct mfd_cell ab8500_bm_devs[] = {
1005 {
1006 .name = "ab8500-charger",
1007 .of_compatible = "stericsson,ab8500-charger",
1008 .num_resources = ARRAY_SIZE(ab8500_charger_resources),
1009 .resources = ab8500_charger_resources,
1010 .platform_data = &ab8500_bm_data,
1011 .pdata_size = sizeof(ab8500_bm_data),
1012 },
1013 {
1014 .name = "ab8500-btemp",
1015 .of_compatible = "stericsson,ab8500-btemp",
1016 .num_resources = ARRAY_SIZE(ab8500_btemp_resources),
1017 .resources = ab8500_btemp_resources,
1018 .platform_data = &ab8500_bm_data,
1019 .pdata_size = sizeof(ab8500_bm_data),
1020 },
1021 {
1022 .name = "ab8500-fg",
1023 .of_compatible = "stericsson,ab8500-fg",
1024 .num_resources = ARRAY_SIZE(ab8500_fg_resources),
1025 .resources = ab8500_fg_resources,
1026 .platform_data = &ab8500_bm_data,
1027 .pdata_size = sizeof(ab8500_bm_data),
1028 },
1029 {
1030 .name = "ab8500-chargalg",
1031 .of_compatible = "stericsson,ab8500-chargalg",
1032 .num_resources = ARRAY_SIZE(ab8500_chargalg_resources),
1033 .resources = ab8500_chargalg_resources,
1034 .platform_data = &ab8500_bm_data,
1035 .pdata_size = sizeof(ab8500_bm_data),
1036 },
1037};
1038
1039static struct mfd_cell ab8500_devs[] = {
1005#ifdef CONFIG_DEBUG_FS 1040#ifdef CONFIG_DEBUG_FS
1006 { 1041 {
1007 .name = "ab8500-debug", 1042 .name = "ab8500-debug",
@@ -1023,6 +1058,11 @@ static struct mfd_cell abx500_common_devs[] = {
1023 .of_compatible = "stericsson,abx500-clk", 1058 .of_compatible = "stericsson,abx500-clk",
1024 }, 1059 },
1025 { 1060 {
1061 .name = "ab8500-gpadc",
1062 .num_resources = ARRAY_SIZE(ab8500_gpadc_resources),
1063 .resources = ab8500_gpadc_resources,
1064 },
1065 {
1026 .name = "ab8500-rtc", 1066 .name = "ab8500-rtc",
1027 .of_compatible = "stericsson,ab8500-rtc", 1067 .of_compatible = "stericsson,ab8500-rtc",
1028 .num_resources = ARRAY_SIZE(ab8500_rtc_resources), 1068 .num_resources = ARRAY_SIZE(ab8500_rtc_resources),
@@ -1035,6 +1075,7 @@ static struct mfd_cell abx500_common_devs[] = {
1035 .resources = ab8500_av_acc_detect_resources, 1075 .resources = ab8500_av_acc_detect_resources,
1036 }, 1076 },
1037 { 1077 {
1078
1038 .name = "ab8500-poweron-key", 1079 .name = "ab8500-poweron-key",
1039 .of_compatible = "stericsson,ab8500-poweron-key", 1080 .of_compatible = "stericsson,ab8500-poweron-key",
1040 .num_resources = ARRAY_SIZE(ab8500_poweronkey_db_resources), 1081 .num_resources = ARRAY_SIZE(ab8500_poweronkey_db_resources),
@@ -1064,62 +1105,38 @@ static struct mfd_cell abx500_common_devs[] = {
1064 .of_compatible = "stericsson,ab8500-denc", 1105 .of_compatible = "stericsson,ab8500-denc",
1065 }, 1106 },
1066 { 1107 {
1108 .name = "ab8500-gpio",
1109 .of_compatible = "stericsson,ab8500-gpio",
1110 },
1111 {
1067 .name = "abx500-temp", 1112 .name = "abx500-temp",
1068 .of_compatible = "stericsson,abx500-temp", 1113 .of_compatible = "stericsson,abx500-temp",
1069 .num_resources = ARRAY_SIZE(ab8500_temp_resources), 1114 .num_resources = ARRAY_SIZE(ab8500_temp_resources),
1070 .resources = ab8500_temp_resources, 1115 .resources = ab8500_temp_resources,
1071 }, 1116 },
1072};
1073
1074static struct mfd_cell ab8500_bm_devs[] = {
1075 {
1076 .name = "ab8500-charger",
1077 .of_compatible = "stericsson,ab8500-charger",
1078 .num_resources = ARRAY_SIZE(ab8500_charger_resources),
1079 .resources = ab8500_charger_resources,
1080 .platform_data = &ab8500_bm_data,
1081 .pdata_size = sizeof(ab8500_bm_data),
1082 },
1083 { 1117 {
1084 .name = "ab8500-btemp", 1118 .name = "ab8500-usb",
1085 .of_compatible = "stericsson,ab8500-btemp", 1119 .num_resources = ARRAY_SIZE(ab8500_usb_resources),
1086 .num_resources = ARRAY_SIZE(ab8500_btemp_resources), 1120 .resources = ab8500_usb_resources,
1087 .resources = ab8500_btemp_resources,
1088 .platform_data = &ab8500_bm_data,
1089 .pdata_size = sizeof(ab8500_bm_data),
1090 },
1091 {
1092 .name = "ab8500-fg",
1093 .of_compatible = "stericsson,ab8500-fg",
1094 .num_resources = ARRAY_SIZE(ab8500_fg_resources),
1095 .resources = ab8500_fg_resources,
1096 .platform_data = &ab8500_bm_data,
1097 .pdata_size = sizeof(ab8500_bm_data),
1098 }, 1121 },
1099 { 1122 {
1100 .name = "ab8500-chargalg", 1123 .name = "ab8500-codec",
1101 .of_compatible = "stericsson,ab8500-chargalg",
1102 .num_resources = ARRAY_SIZE(ab8500_chargalg_resources),
1103 .resources = ab8500_chargalg_resources,
1104 .platform_data = &ab8500_bm_data,
1105 .pdata_size = sizeof(ab8500_bm_data),
1106 }, 1124 },
1107}; 1125};
1108 1126
1109static struct mfd_cell ab8500_devs[] = { 1127static struct mfd_cell ab9540_devs[] = {
1128#ifdef CONFIG_DEBUG_FS
1110 { 1129 {
1111 .name = "pinctrl-ab8500", 1130 .name = "ab8500-debug",
1112 .of_compatible = "stericsson,ab8500-gpio", 1131 .num_resources = ARRAY_SIZE(ab8500_debug_resources),
1132 .resources = ab8500_debug_resources,
1113 }, 1133 },
1134#endif
1114 { 1135 {
1115 .name = "ab8500-usb", 1136 .name = "ab8500-sysctrl",
1116 .of_compatible = "stericsson,ab8500-usb",
1117 .num_resources = ARRAY_SIZE(ab8500_usb_resources),
1118 .resources = ab8500_usb_resources,
1119 }, 1137 },
1120 { 1138 {
1121 .name = "ab8500-codec", 1139 .name = "ab8500-regulator",
1122 .of_compatible = "stericsson,ab8500-codec",
1123 }, 1140 },
1124 { 1141 {
1125 .name = "ab8500-gpadc", 1142 .name = "ab8500-gpadc",
@@ -1127,9 +1144,33 @@ static struct mfd_cell ab8500_devs[] = {
1127 .num_resources = ARRAY_SIZE(ab8500_gpadc_resources), 1144 .num_resources = ARRAY_SIZE(ab8500_gpadc_resources),
1128 .resources = ab8500_gpadc_resources, 1145 .resources = ab8500_gpadc_resources,
1129 }, 1146 },
1130}; 1147 {
1131 1148 .name = "ab8500-rtc",
1132static struct mfd_cell ab9540_devs[] = { 1149 .num_resources = ARRAY_SIZE(ab8500_rtc_resources),
1150 .resources = ab8500_rtc_resources,
1151 },
1152 {
1153 .name = "ab8500-acc-det",
1154 .num_resources = ARRAY_SIZE(ab8500_av_acc_detect_resources),
1155 .resources = ab8500_av_acc_detect_resources,
1156 },
1157 {
1158 .name = "ab8500-poweron-key",
1159 .num_resources = ARRAY_SIZE(ab8500_poweronkey_db_resources),
1160 .resources = ab8500_poweronkey_db_resources,
1161 },
1162 {
1163 .name = "ab8500-pwm",
1164 .id = 1,
1165 },
1166 {
1167 .name = "ab8500-leds",
1168 },
1169 {
1170 .name = "abx500-temp",
1171 .num_resources = ARRAY_SIZE(ab8500_temp_resources),
1172 .resources = ab8500_temp_resources,
1173 },
1133 { 1174 {
1134 .name = "pinctrl-ab9540", 1175 .name = "pinctrl-ab9540",
1135 .of_compatible = "stericsson,ab9540-gpio", 1176 .of_compatible = "stericsson,ab9540-gpio",
@@ -1143,11 +1184,6 @@ static struct mfd_cell ab9540_devs[] = {
1143 .name = "ab9540-codec", 1184 .name = "ab9540-codec",
1144 }, 1185 },
1145 { 1186 {
1146 .name = "ab8500-gpadc",
1147 .num_resources = ARRAY_SIZE(ab8500_gpadc_resources),
1148 .resources = ab8500_gpadc_resources,
1149 },
1150 {
1151 .name = "ab-iddet", 1187 .name = "ab-iddet",
1152 .num_resources = ARRAY_SIZE(ab8505_iddet_resources), 1188 .num_resources = ARRAY_SIZE(ab8505_iddet_resources),
1153 .resources = ab8505_iddet_resources, 1189 .resources = ab8505_iddet_resources,
@@ -1156,6 +1192,57 @@ static struct mfd_cell ab9540_devs[] = {
1156 1192
1157/* Device list for ab8505 */ 1193/* Device list for ab8505 */
1158static struct mfd_cell ab8505_devs[] = { 1194static struct mfd_cell ab8505_devs[] = {
1195#ifdef CONFIG_DEBUG_FS
1196 {
1197 .name = "ab8500-debug",
1198 .num_resources = ARRAY_SIZE(ab8500_debug_resources),
1199 .resources = ab8500_debug_resources,
1200 },
1201#endif
1202 {
1203 .name = "ab8500-sysctrl",
1204 },
1205 {
1206 .name = "ab8500-regulator",
1207 },
1208 {
1209 .name = "ab8500-gpadc",
1210 .num_resources = ARRAY_SIZE(ab8505_gpadc_resources),
1211 .resources = ab8505_gpadc_resources,
1212 },
1213 {
1214 .name = "ab8500-rtc",
1215 .num_resources = ARRAY_SIZE(ab8500_rtc_resources),
1216 .resources = ab8500_rtc_resources,
1217 },
1218 {
1219 .name = "ab8500-acc-det",
1220 .num_resources = ARRAY_SIZE(ab8500_av_acc_detect_resources),
1221 .resources = ab8500_av_acc_detect_resources,
1222 },
1223 {
1224 .name = "ab8500-poweron-key",
1225 .num_resources = ARRAY_SIZE(ab8500_poweronkey_db_resources),
1226 .resources = ab8500_poweronkey_db_resources,
1227 },
1228 {
1229 .name = "ab8500-pwm",
1230 .id = 1,
1231 },
1232 {
1233 .name = "ab8500-leds",
1234 },
1235 {
1236 .name = "ab8500-gpio",
1237 },
1238 {
1239 .name = "ab8500-usb",
1240 .num_resources = ARRAY_SIZE(ab8500_usb_resources),
1241 .resources = ab8500_usb_resources,
1242 },
1243 {
1244 .name = "ab8500-codec",
1245 },
1159 { 1246 {
1160 .name = "ab-iddet", 1247 .name = "ab-iddet",
1161 .num_resources = ARRAY_SIZE(ab8505_iddet_resources), 1248 .num_resources = ARRAY_SIZE(ab8505_iddet_resources),
@@ -1164,6 +1251,51 @@ static struct mfd_cell ab8505_devs[] = {
1164}; 1251};
1165 1252
1166static struct mfd_cell ab8540_devs[] = { 1253static struct mfd_cell ab8540_devs[] = {
1254#ifdef CONFIG_DEBUG_FS
1255 {
1256 .name = "ab8500-debug",
1257 .num_resources = ARRAY_SIZE(ab8500_debug_resources),
1258 .resources = ab8500_debug_resources,
1259 },
1260#endif
1261 {
1262 .name = "ab8500-sysctrl",
1263 },
1264 {
1265 .name = "ab8500-regulator",
1266 },
1267 {
1268 .name = "ab8500-gpadc",
1269 .num_resources = ARRAY_SIZE(ab8505_gpadc_resources),
1270 .resources = ab8505_gpadc_resources,
1271 },
1272 {
1273 .name = "ab8500-rtc",
1274 .num_resources = ARRAY_SIZE(ab8500_rtc_resources),
1275 .resources = ab8500_rtc_resources,
1276 },
1277 {
1278 .name = "ab8500-acc-det",
1279 .num_resources = ARRAY_SIZE(ab8500_av_acc_detect_resources),
1280 .resources = ab8500_av_acc_detect_resources,
1281 },
1282 {
1283 .name = "ab8500-poweron-key",
1284 .num_resources = ARRAY_SIZE(ab8500_poweronkey_db_resources),
1285 .resources = ab8500_poweronkey_db_resources,
1286 },
1287 {
1288 .name = "ab8500-pwm",
1289 .id = 1,
1290 },
1291 {
1292 .name = "ab8500-leds",
1293 },
1294 {
1295 .name = "abx500-temp",
1296 .num_resources = ARRAY_SIZE(ab8500_temp_resources),
1297 .resources = ab8500_temp_resources,
1298 },
1167 { 1299 {
1168 .name = "ab8500-gpio", 1300 .name = "ab8500-gpio",
1169 }, 1301 },
@@ -1176,11 +1308,6 @@ static struct mfd_cell ab8540_devs[] = {
1176 .name = "ab8540-codec", 1308 .name = "ab8540-codec",
1177 }, 1309 },
1178 { 1310 {
1179 .name = "ab8500-gpadc",
1180 .num_resources = ARRAY_SIZE(ab8540_gpadc_resources),
1181 .resources = ab8540_gpadc_resources,
1182 },
1183 {
1184 .name = "ab-iddet", 1311 .name = "ab-iddet",
1185 .num_resources = ARRAY_SIZE(ab8505_iddet_resources), 1312 .num_resources = ARRAY_SIZE(ab8505_iddet_resources),
1186 .resources = ab8505_iddet_resources, 1313 .resources = ab8505_iddet_resources,
@@ -1528,12 +1655,6 @@ static int ab8500_probe(struct platform_device *pdev)
1528 return ret; 1655 return ret;
1529 } 1656 }
1530 1657
1531 ret = mfd_add_devices(ab8500->dev, 0, abx500_common_devs,
1532 ARRAY_SIZE(abx500_common_devs), NULL,
1533 ab8500->irq_base, ab8500->domain);
1534 if (ret)
1535 return ret;
1536
1537 if (is_ab9540(ab8500)) 1658 if (is_ab9540(ab8500))
1538 ret = mfd_add_devices(ab8500->dev, 0, ab9540_devs, 1659 ret = mfd_add_devices(ab8500->dev, 0, ab9540_devs,
1539 ARRAY_SIZE(ab9540_devs), NULL, 1660 ARRAY_SIZE(ab9540_devs), NULL,