aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMark Brown <broonie@opensource.wolfsonmicro.com>2008-11-24 14:20:30 -0500
committerSamuel Ortiz <samuel@sortiz.org>2009-01-04 06:17:38 -0500
commitd756f4a4446227ca9626087939a6769ca55ab036 (patch)
tree572e6788f3aa01c74c1c8ebb139b0d8a137cdd72
parent14431aa0c5a443d13d24e6f865a8838f97dab973 (diff)
mfd: Switch WM8350 revision detection to a feature based model
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>
-rw-r--r--drivers/mfd/wm8350-core.c6
-rw-r--r--drivers/power/wm8350_power.c2
-rw-r--r--include/linux/mfd/wm8350/core.h2
-rw-r--r--include/linux/mfd/wm8350/supply.h2
4 files changed, 5 insertions, 7 deletions
diff --git a/drivers/mfd/wm8350-core.c b/drivers/mfd/wm8350-core.c
index 60439bd3984d..764bf15ea684 100644
--- a/drivers/mfd/wm8350-core.c
+++ b/drivers/mfd/wm8350-core.c
@@ -1240,19 +1240,17 @@ int wm8350_device_init(struct wm8350 *wm8350, int irq,
1240 switch ((id2 & WM8350_CHIP_REV_MASK) >> 12) { 1240 switch ((id2 & WM8350_CHIP_REV_MASK) >> 12) {
1241 case WM8350_REV_E: 1241 case WM8350_REV_E:
1242 dev_info(wm8350->dev, "Found Rev E device\n"); 1242 dev_info(wm8350->dev, "Found Rev E device\n");
1243 wm8350->rev = WM8350_REV_E;
1244 break; 1243 break;
1245 case WM8350_REV_F: 1244 case WM8350_REV_F:
1246 dev_info(wm8350->dev, "Found Rev F device\n"); 1245 dev_info(wm8350->dev, "Found Rev F device\n");
1247 wm8350->rev = WM8350_REV_F;
1248 break; 1246 break;
1249 case WM8350_REV_G: 1247 case WM8350_REV_G:
1250 dev_info(wm8350->dev, "Found Rev G device\n"); 1248 dev_info(wm8350->dev, "Found Rev G device\n");
1251 wm8350->rev = WM8350_REV_G; 1249 wm8350->power.rev_g_coeff = 1;
1252 break; 1250 break;
1253 case WM8350_REV_H: 1251 case WM8350_REV_H:
1254 dev_info(wm8350->dev, "Found Rev H device\n"); 1252 dev_info(wm8350->dev, "Found Rev H device\n");
1255 wm8350->rev = WM8350_REV_H; 1253 wm8350->power.rev_g_coeff = 1;
1256 break; 1254 break;
1257 default: 1255 default:
1258 /* For safety we refuse to run on unknown hardware */ 1256 /* For safety we refuse to run on unknown hardware */
diff --git a/drivers/power/wm8350_power.c b/drivers/power/wm8350_power.c
index 9c0a847a1139..74e7593beffb 100644
--- a/drivers/power/wm8350_power.c
+++ b/drivers/power/wm8350_power.c
@@ -44,7 +44,7 @@ static int wm8350_read_usb_uvolts(struct wm8350 *wm8350)
44 44
45static inline int wm8350_charge_time_min(struct wm8350 *wm8350, int min) 45static inline int wm8350_charge_time_min(struct wm8350 *wm8350, int min)
46{ 46{
47 if (wm8350->rev < WM8350_REV_G) 47 if (!wm8350->power.rev_g_coeff)
48 return (((min - 30) / 15) & 0xf) << 8; 48 return (((min - 30) / 15) & 0xf) << 8;
49 else 49 else
50 return (((min - 30) / 30) & 0xf) << 8; 50 return (((min - 30) / 30) & 0xf) << 8;
diff --git a/include/linux/mfd/wm8350/core.h b/include/linux/mfd/wm8350/core.h
index d2614dfc9397..3c9735663f36 100644
--- a/include/linux/mfd/wm8350/core.h
+++ b/include/linux/mfd/wm8350/core.h
@@ -585,8 +585,6 @@ struct wm8350_irq {
585}; 585};
586 586
587struct wm8350 { 587struct wm8350 {
588 int rev; /* chip revision */
589
590 struct device *dev; 588 struct device *dev;
591 589
592 /* device IO */ 590 /* device IO */
diff --git a/include/linux/mfd/wm8350/supply.h b/include/linux/mfd/wm8350/supply.h
index 79721513fa9f..2b9479310bbd 100644
--- a/include/linux/mfd/wm8350/supply.h
+++ b/include/linux/mfd/wm8350/supply.h
@@ -127,6 +127,8 @@ struct wm8350_power {
127 struct power_supply usb; 127 struct power_supply usb;
128 struct power_supply ac; 128 struct power_supply ac;
129 struct wm8350_charger_policy *policy; 129 struct wm8350_charger_policy *policy;
130
131 int rev_g_coeff;
130}; 132};
131 133
132#endif 134#endif