Commit d756f4a4 authored by Mark Brown's avatar Mark Brown Committed by Samuel Ortiz

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: default avatarMark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: default avatarSamuel Ortiz <sameo@openedhand.com>
parent 14431aa0
...@@ -1240,19 +1240,17 @@ int wm8350_device_init(struct wm8350 *wm8350, int irq, ...@@ -1240,19 +1240,17 @@ int wm8350_device_init(struct wm8350 *wm8350, int irq,
switch ((id2 & WM8350_CHIP_REV_MASK) >> 12) { switch ((id2 & WM8350_CHIP_REV_MASK) >> 12) {
case WM8350_REV_E: case WM8350_REV_E:
dev_info(wm8350->dev, "Found Rev E device\n"); dev_info(wm8350->dev, "Found Rev E device\n");
wm8350->rev = WM8350_REV_E;
break; break;
case WM8350_REV_F: case WM8350_REV_F:
dev_info(wm8350->dev, "Found Rev F device\n"); dev_info(wm8350->dev, "Found Rev F device\n");
wm8350->rev = WM8350_REV_F;
break; break;
case WM8350_REV_G: case WM8350_REV_G:
dev_info(wm8350->dev, "Found Rev G device\n"); dev_info(wm8350->dev, "Found Rev G device\n");
wm8350->rev = WM8350_REV_G; wm8350->power.rev_g_coeff = 1;
break; break;
case WM8350_REV_H: case WM8350_REV_H:
dev_info(wm8350->dev, "Found Rev H device\n"); dev_info(wm8350->dev, "Found Rev H device\n");
wm8350->rev = WM8350_REV_H; wm8350->power.rev_g_coeff = 1;
break; break;
default: default:
/* For safety we refuse to run on unknown hardware */ /* For safety we refuse to run on unknown hardware */
......
...@@ -44,7 +44,7 @@ static int wm8350_read_usb_uvolts(struct wm8350 *wm8350) ...@@ -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) 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; return (((min - 30) / 15) & 0xf) << 8;
else else
return (((min - 30) / 30) & 0xf) << 8; return (((min - 30) / 30) & 0xf) << 8;
......
...@@ -585,8 +585,6 @@ struct wm8350_irq { ...@@ -585,8 +585,6 @@ struct wm8350_irq {
}; };
struct wm8350 { struct wm8350 {
int rev; /* chip revision */
struct device *dev; struct device *dev;
/* device IO */ /* device IO */
......
...@@ -127,6 +127,8 @@ struct wm8350_power { ...@@ -127,6 +127,8 @@ struct wm8350_power {
struct power_supply usb; struct power_supply usb;
struct power_supply ac; struct power_supply ac;
struct wm8350_charger_policy *policy; struct wm8350_charger_policy *policy;
int rev_g_coeff;
}; };
#endif #endif
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment