diff options
Diffstat (limited to 'drivers/mfd/wm8350-core.c')
-rw-r--r-- | drivers/mfd/wm8350-core.c | 86 |
1 files changed, 70 insertions, 16 deletions
diff --git a/drivers/mfd/wm8350-core.c b/drivers/mfd/wm8350-core.c index 2188d759cbde..fa505ac76c84 100644 --- a/drivers/mfd/wm8350-core.c +++ b/drivers/mfd/wm8350-core.c | |||
@@ -1133,35 +1133,75 @@ EXPORT_SYMBOL_GPL(wm8350_read_auxadc); | |||
1133 | /* | 1133 | /* |
1134 | * Cache is always host endian. | 1134 | * Cache is always host endian. |
1135 | */ | 1135 | */ |
1136 | static int wm8350_create_cache(struct wm8350 *wm8350, int mode) | 1136 | static int wm8350_create_cache(struct wm8350 *wm8350, int type, int mode) |
1137 | { | 1137 | { |
1138 | int i, ret = 0; | 1138 | int i, ret = 0; |
1139 | u16 value; | 1139 | u16 value; |
1140 | const u16 *reg_map; | 1140 | const u16 *reg_map; |
1141 | 1141 | ||
1142 | switch (mode) { | 1142 | switch (type) { |
1143 | #ifdef CONFIG_MFD_WM8350_CONFIG_MODE_0 | ||
1144 | case 0: | 1143 | case 0: |
1145 | reg_map = wm8350_mode0_defaults; | 1144 | switch (mode) { |
1146 | break; | 1145 | #ifdef CONFIG_MFD_WM8350_CONFIG_MODE_0 |
1146 | case 0: | ||
1147 | reg_map = wm8350_mode0_defaults; | ||
1148 | break; | ||
1147 | #endif | 1149 | #endif |
1148 | #ifdef CONFIG_MFD_WM8350_CONFIG_MODE_1 | 1150 | #ifdef CONFIG_MFD_WM8350_CONFIG_MODE_1 |
1149 | case 1: | 1151 | case 1: |
1150 | reg_map = wm8350_mode1_defaults; | 1152 | reg_map = wm8350_mode1_defaults; |
1151 | break; | 1153 | break; |
1152 | #endif | 1154 | #endif |
1153 | #ifdef CONFIG_MFD_WM8350_CONFIG_MODE_2 | 1155 | #ifdef CONFIG_MFD_WM8350_CONFIG_MODE_2 |
1154 | case 2: | 1156 | case 2: |
1155 | reg_map = wm8350_mode2_defaults; | 1157 | reg_map = wm8350_mode2_defaults; |
1156 | break; | 1158 | break; |
1157 | #endif | 1159 | #endif |
1158 | #ifdef CONFIG_MFD_WM8350_CONFIG_MODE_3 | 1160 | #ifdef CONFIG_MFD_WM8350_CONFIG_MODE_3 |
1159 | case 3: | 1161 | case 3: |
1160 | reg_map = wm8350_mode3_defaults; | 1162 | reg_map = wm8350_mode3_defaults; |
1161 | break; | 1163 | break; |
1162 | #endif | 1164 | #endif |
1165 | default: | ||
1166 | dev_err(wm8350->dev, | ||
1167 | "WM8350 configuration mode %d not supported\n", | ||
1168 | mode); | ||
1169 | return -EINVAL; | ||
1170 | } | ||
1171 | |||
1172 | case 2: | ||
1173 | switch (mode) { | ||
1174 | #ifdef CONFIG_MFD_WM8352_CONFIG_MODE_0 | ||
1175 | case 0: | ||
1176 | reg_map = wm8352_mode0_defaults; | ||
1177 | break; | ||
1178 | #endif | ||
1179 | #ifdef CONFIG_MFD_WM8352_CONFIG_MODE_1 | ||
1180 | case 1: | ||
1181 | reg_map = wm8352_mode1_defaults; | ||
1182 | break; | ||
1183 | #endif | ||
1184 | #ifdef CONFIG_MFD_WM8352_CONFIG_MODE_2 | ||
1185 | case 2: | ||
1186 | reg_map = wm8352_mode2_defaults; | ||
1187 | break; | ||
1188 | #endif | ||
1189 | #ifdef CONFIG_MFD_WM8352_CONFIG_MODE_3 | ||
1190 | case 3: | ||
1191 | reg_map = wm8352_mode3_defaults; | ||
1192 | break; | ||
1193 | #endif | ||
1194 | default: | ||
1195 | dev_err(wm8350->dev, | ||
1196 | "WM8352 configuration mode %d not supported\n", | ||
1197 | mode); | ||
1198 | return -EINVAL; | ||
1199 | } | ||
1200 | break; | ||
1201 | |||
1163 | default: | 1202 | default: |
1164 | dev_err(wm8350->dev, "Configuration mode %d not supported\n", | 1203 | dev_err(wm8350->dev, |
1204 | "WM835x configuration mode %d not supported\n", | ||
1165 | mode); | 1205 | mode); |
1166 | return -EINVAL; | 1206 | return -EINVAL; |
1167 | } | 1207 | } |
@@ -1284,13 +1324,27 @@ int wm8350_device_init(struct wm8350 *wm8350, int irq, | |||
1284 | } | 1324 | } |
1285 | break; | 1325 | break; |
1286 | 1326 | ||
1327 | case 2: | ||
1328 | switch (chip_rev) { | ||
1329 | case 0: | ||
1330 | dev_info(wm8350->dev, "WM8352 Rev A\n"); | ||
1331 | wm8350->power.rev_g_coeff = 1; | ||
1332 | break; | ||
1333 | |||
1334 | default: | ||
1335 | dev_err(wm8350->dev, "Unknown WM8352 CHIP_REV\n"); | ||
1336 | ret = -ENODEV; | ||
1337 | goto err; | ||
1338 | } | ||
1339 | break; | ||
1340 | |||
1287 | default: | 1341 | default: |
1288 | dev_err(wm8350->dev, "Unknown MASK_REV\n"); | 1342 | dev_err(wm8350->dev, "Unknown MASK_REV\n"); |
1289 | ret = -ENODEV; | 1343 | ret = -ENODEV; |
1290 | goto err; | 1344 | goto err; |
1291 | } | 1345 | } |
1292 | 1346 | ||
1293 | ret = wm8350_create_cache(wm8350, mode); | 1347 | ret = wm8350_create_cache(wm8350, mask_rev, mode); |
1294 | if (ret < 0) { | 1348 | if (ret < 0) { |
1295 | dev_err(wm8350->dev, "Failed to create register cache\n"); | 1349 | dev_err(wm8350->dev, "Failed to create register cache\n"); |
1296 | return ret; | 1350 | return ret; |