aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mfd/wm831x-core.c
diff options
context:
space:
mode:
authorMark Brown <broonie@opensource.wolfsonmicro.com>2009-10-01 10:41:04 -0400
committerSamuel Ortiz <sameo@linux.intel.com>2009-12-13 13:20:42 -0500
commit894362f53164f93d609559e196378b4d0710c2dd (patch)
tree344a0132c55767f1f47844ef7c83c37877c83f3e /drivers/mfd/wm831x-core.c
parent29f02646f0fa2b3c3a91f9145653e6a6ae8e7eb1 (diff)
mfd: Refactor WM831x chip identification
Better support future device revisions by moving some of the output around and making the chip ID enumeration be the value expected in the ID register. Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com> Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
Diffstat (limited to 'drivers/mfd/wm831x-core.c')
-rw-r--r--drivers/mfd/wm831x-core.c58
1 files changed, 18 insertions, 40 deletions
diff --git a/drivers/mfd/wm831x-core.c b/drivers/mfd/wm831x-core.c
index 7f27576ca04..8504c6ef4a1 100644
--- a/drivers/mfd/wm831x-core.c
+++ b/drivers/mfd/wm831x-core.c
@@ -90,9 +90,9 @@ int wm831x_isinkv_values[WM831X_ISINK_MAX_ISEL + 1] = {
90EXPORT_SYMBOL_GPL(wm831x_isinkv_values); 90EXPORT_SYMBOL_GPL(wm831x_isinkv_values);
91 91
92enum wm831x_parent { 92enum wm831x_parent {
93 WM8310 = 0, 93 WM8310 = 0x8310,
94 WM8311 = 1, 94 WM8311 = 0x8311,
95 WM8312 = 2, 95 WM8312 = 0x8312,
96}; 96};
97 97
98static int wm831x_reg_locked(struct wm831x *wm831x, unsigned short reg) 98static int wm831x_reg_locked(struct wm831x *wm831x, unsigned short reg)
@@ -1282,50 +1282,28 @@ static int wm831x_device_init(struct wm831x *wm831x, unsigned long id, int irq)
1282 goto err; 1282 goto err;
1283 } 1283 }
1284 1284
1285 /* Some engineering samples do not have the ID set, rely on
1286 * the device being registered correctly.
1287 */
1288 if (ret == 0) {
1289 dev_info(wm831x->dev, "Device is an engineering sample\n");
1290 ret = id;
1291 }
1292
1285 switch (ret) { 1293 switch (ret) {
1286 case 0x8310: 1294 case WM8310:
1287 parent = WM8310; 1295 parent = WM8310;
1288 switch (rev) { 1296 dev_info(wm831x->dev, "WM8310 revision %c\n", 'A' + rev);
1289 case 0:
1290 dev_info(wm831x->dev, "WM8310 revision %c\n",
1291 'A' + rev);
1292 break;
1293 }
1294 break; 1297 break;
1295 1298
1296 case 0x8311: 1299 case WM8311:
1297 parent = WM8311; 1300 parent = WM8311;
1298 switch (rev) { 1301 dev_info(wm831x->dev, "WM8311 revision %c\n", 'A' + rev);
1299 case 0:
1300 dev_info(wm831x->dev, "WM8311 revision %c\n",
1301 'A' + rev);
1302 break;
1303 }
1304 break; 1302 break;
1305 1303
1306 case 0x8312: 1304 case WM8312:
1307 parent = WM8312; 1305 parent = WM8312;
1308 switch (rev) { 1306 dev_info(wm831x->dev, "WM8312 revision %c\n", 'A' + rev);
1309 case 0:
1310 dev_info(wm831x->dev, "WM8312 revision %c\n",
1311 'A' + rev);
1312 break;
1313 }
1314 break;
1315
1316 case 0:
1317 /* Some engineering samples do not have the ID set,
1318 * rely on the device being registered correctly.
1319 * This will need revisiting for future devices with
1320 * multiple dies.
1321 */
1322 parent = id;
1323 switch (rev) {
1324 case 0:
1325 dev_info(wm831x->dev, "WM831%d ES revision %c\n",
1326 parent, 'A' + rev);
1327 break;
1328 }
1329 break; 1307 break;
1330 1308
1331 default: 1309 default:
@@ -1338,7 +1316,7 @@ static int wm831x_device_init(struct wm831x *wm831x, unsigned long id, int irq)
1338 * current parts. 1316 * current parts.
1339 */ 1317 */
1340 if (parent != id) 1318 if (parent != id)
1341 dev_warn(wm831x->dev, "Device was registered as a WM831%lu\n", 1319 dev_warn(wm831x->dev, "Device was registered as a WM%lx\n",
1342 id); 1320 id);
1343 1321
1344 /* Bootstrap the user key */ 1322 /* Bootstrap the user key */