mfd: Read CUST_ID from the wm8994 device
authorMark Brown <broonie@opensource.wolfsonmicro.com>
Mon, 7 May 2012 09:03:22 +0000 (10:03 +0100)
committerSamuel Ortiz <sameo@linux.intel.com>
Mon, 7 May 2012 09:32:08 +0000 (11:32 +0200)
Read CUST_ID from the device and log it for diagnostics.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
drivers/mfd/wm8994-core.c
include/linux/mfd/wm8994/core.h
include/linux/mfd/wm8994/registers.h

index 9d7ca1e978fad30775d1de8b6913333a137118c6..60e617549eddd0e35da9af1999ebd978ea64bc9e 100644 (file)
@@ -500,7 +500,8 @@ static __devinit int wm8994_device_init(struct wm8994 *wm8994, int irq)
                        ret);
                goto err_enable;
        }
-       wm8994->revision = ret;
+       wm8994->revision = ret & WM8994_CHIP_REV_MASK;
+       wm8994->cust_id = (ret & WM8994_CUST_ID_MASK) >> WM8994_CUST_ID_SHIFT;
 
        switch (wm8994->type) {
        case WM8994:
@@ -553,8 +554,8 @@ static __devinit int wm8994_device_init(struct wm8994 *wm8994, int irq)
                break;
        }
 
-       dev_info(wm8994->dev, "%s revision %c\n", devname,
-                'A' + wm8994->revision);
+       dev_info(wm8994->dev, "%s revision %c CUST_ID %02x\n", devname,
+                'A' + wm8994->revision, wm8994->cust_id);
 
        switch (wm8994->type) {
        case WM1811:
index 9eff2a351ec5cb77951e6bf64c902e14c78f40ce..d41bc7b8a86a724d073806d391dc53a68b74d9a2 100644 (file)
@@ -57,6 +57,7 @@ struct wm8994 {
 
        enum wm8994_type type;
        int revision;
+       int cust_id;
 
        struct device *dev;
        struct regmap *regmap;
index 86e6a032a07833f3dbee4f8d399a6e63e61ef93a..053548961c15df6c81b1e6128e056f2806806cbc 100644 (file)
 /*
  * R256 (0x100) - Chip Revision
  */
+#define WM8994_CUST_ID_MASK                     0xFF00  /* CUST_ID - [15:8] */
+#define WM8994_CUST_ID_SHIFT                         8  /* CUST_ID - [15:8] */
+#define WM8994_CUST_ID_WIDTH                         8  /* CUST_ID - [15:8] */
 #define WM8994_CHIP_REV_MASK                    0x000F  /* CHIP_REV - [3:0] */
 #define WM8994_CHIP_REV_SHIFT                        0  /* CHIP_REV - [3:0] */
 #define WM8994_CHIP_REV_WIDTH                        4  /* CHIP_REV - [3:0] */