* [PATCH] mfd: Switch WM8350 revision detection to a feature based model
@ 2008-11-18 15:22 Mark Brown
2008-11-18 15:24 ` Mark Brown
0 siblings, 1 reply; 2+ messages in thread
From: Mark Brown @ 2008-11-18 15:22 UTC (permalink / raw)
To: Samuel Ortiz; +Cc: linux-kernel, Mark Brown
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>
---
drivers/mfd/wm8350-core.c | 6 ++----
drivers/power/wm8350_power.c | 2 +-
include/linux/mfd/wm8350/core.h | 8 --------
include/linux/mfd/wm8350/supply.h | 2 ++
4 files changed, 5 insertions(+), 13 deletions(-)
diff --git a/drivers/mfd/wm8350-core.c b/drivers/mfd/wm8350-core.c
index 3734f20..7dece8e 100644
--- a/drivers/mfd/wm8350-core.c
+++ b/drivers/mfd/wm8350-core.c
@@ -1225,19 +1225,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 */
diff --git a/drivers/power/wm8350_power.c b/drivers/power/wm8350_power.c
index 9c0a847..74e7593 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)
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;
diff --git a/include/linux/mfd/wm8350/core.h b/include/linux/mfd/wm8350/core.h
index 8e11539..349d439 100644
--- a/include/linux/mfd/wm8350/core.h
+++ b/include/linux/mfd/wm8350/core.h
@@ -558,12 +558,6 @@
#define WM8350_IRQ_WKUP_ONKEY 48
#define WM8350_IRQ_WKUP_GP_WAKEUP 49
-/* wm8350 chip revisions */
-#define WM8350_REV_E 0x4
-#define WM8350_REV_F 0x5
-#define WM8350_REV_G 0x6
-#define WM8350_REV_H 0x7
-
#define WM8350_NUM_IRQ 63
struct wm8350_reg_access {
@@ -585,8 +579,6 @@ struct wm8350_irq {
};
struct wm8350 {
- int rev; /* chip revision */
-
struct device *dev;
/* device IO */
diff --git a/include/linux/mfd/wm8350/supply.h b/include/linux/mfd/wm8350/supply.h
index 293fff2..8713533 100644
--- a/include/linux/mfd/wm8350/supply.h
+++ b/include/linux/mfd/wm8350/supply.h
@@ -130,6 +130,8 @@ struct wm8350_power {
struct power_supply usb;
struct power_supply ac;
struct wm8350_charger_policy *policy;
+
+ int rev_g_coeff;
};
#endif
--
1.5.6.5
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] mfd: Switch WM8350 revision detection to a feature based model
2008-11-18 15:22 [PATCH] mfd: Switch WM8350 revision detection to a feature based model Mark Brown
@ 2008-11-18 15:24 ` Mark Brown
0 siblings, 0 replies; 2+ messages in thread
From: Mark Brown @ 2008-11-18 15:24 UTC (permalink / raw)
To: Samuel Ortiz; +Cc: linux-kernel
On Tue, Nov 18, 2008 at 03:22:17PM +0000, Mark Brown wrote:
> Rather than check for chip revisions in the WM8350 drivers have the core
> code set flags for relevant differences.
Gah, ignore this - it's broken. Sorry.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2008-11-18 15:24 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-11-18 15:22 [PATCH] mfd: Switch WM8350 revision detection to a feature based model Mark Brown
2008-11-18 15:24 ` Mark Brown
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox