]> pilppa.com Git - linux-2.6-omap-h63xx.git/commitdiff
mfd: Switch WM8350 revision detection to a feature based model
authorMark Brown <broonie@opensource.wolfsonmicro.com>
Mon, 24 Nov 2008 19:20:30 +0000 (20:20 +0100)
committerSamuel Ortiz <samuel@sortiz.org>
Sun, 4 Jan 2009 11:17:38 +0000 (12:17 +0100)
Rather than check for chip revisions in the WM8350 drivers have the core
code set flags for relevant differences.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: Samuel Ortiz <sameo@openedhand.com>
drivers/mfd/wm8350-core.c
drivers/power/wm8350_power.c
include/linux/mfd/wm8350/core.h
include/linux/mfd/wm8350/supply.h

index 60439bd3984dc74e77ff2b9f8b94be47067f9b1a..764bf15ea684d442eb1f5b9e97b02f06ea947ecd 100644 (file)
@@ -1240,19 +1240,17 @@ int wm8350_device_init(struct wm8350 *wm8350, int irq,
                switch ((id2 & WM8350_CHIP_REV_MASK) >> 12) {
                case WM8350_REV_E:
                        dev_info(wm8350->dev, "Found Rev E device\n");
-                       wm8350->rev = WM8350_REV_E;
                        break;
                case WM8350_REV_F:
                        dev_info(wm8350->dev, "Found Rev F device\n");
-                       wm8350->rev = WM8350_REV_F;
                        break;
                case WM8350_REV_G:
                        dev_info(wm8350->dev, "Found Rev G device\n");
-                       wm8350->rev = WM8350_REV_G;
+                       wm8350->power.rev_g_coeff = 1;
                        break;
                case WM8350_REV_H:
                        dev_info(wm8350->dev, "Found Rev H device\n");
-                       wm8350->rev = WM8350_REV_H;
+                       wm8350->power.rev_g_coeff = 1;
                        break;
                default:
                        /* For safety we refuse to run on unknown hardware */
index 9c0a847a1139619847c1a3994ce99ad6433b4496..74e7593beffbeea168b8e07d3ca3901e9a1301b4 100644 (file)
@@ -44,7 +44,7 @@ static int wm8350_read_usb_uvolts(struct wm8350 *wm8350)
 
 static inline int wm8350_charge_time_min(struct wm8350 *wm8350, int min)
 {
-       if (wm8350->rev < WM8350_REV_G)
+       if (!wm8350->power.rev_g_coeff)
                return (((min - 30) / 15) & 0xf) << 8;
        else
                return (((min - 30) / 30) & 0xf) << 8;
index d2614dfc93973043b2976b156aabb837f77a1b2c..3c9735663f3654bef09f26a9c61bb57cd95ffcfb 100644 (file)
@@ -585,8 +585,6 @@ struct wm8350_irq {
 };
 
 struct wm8350 {
-       int rev;                /* chip revision */
-
        struct device *dev;
 
        /* device IO */
index 79721513fa9f30b750245ed30186b764e9bd7d52..2b9479310bbd32e81f54af29b51eff7bdf3922d4 100644 (file)
@@ -127,6 +127,8 @@ struct wm8350_power {
        struct power_supply usb;
        struct power_supply ac;
        struct wm8350_charger_policy *policy;
+
+       int rev_g_coeff;
 };
 
 #endif