* [PATCH 0/2] Add battery health reporting for WM8350
@ 2008-11-20 15:20 Mark Brown
2008-11-20 15:23 ` [PATCH 1/2] power_supply: Add cold to the POWER_SUPPLY_HEALTH report values Mark Brown
2008-11-24 19:27 ` [PATCH 0/2] Add battery health reporting for WM8350 Samuel Ortiz
0 siblings, 2 replies; 7+ messages in thread
From: Mark Brown @ 2008-11-20 15:20 UTC (permalink / raw)
To: Anton Vorontsov; +Cc: Samuel Ortiz, linux-kernel
This (brief) series adds a new power supply health state for reporting
excessively cold batteries then uses it when implementing battery health
reporting for the WM8350. I'm not 100% happy with the name for the new
state but I couldn't think of something consistent with the existing
OVERHEAT.
Since the WM8350 PMU driver is queued in the mfd tree it probably makes
sense to merge this via the same path?
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH 1/2] power_supply: Add cold to the POWER_SUPPLY_HEALTH report values
2008-11-20 15:20 [PATCH 0/2] Add battery health reporting for WM8350 Mark Brown
@ 2008-11-20 15:23 ` Mark Brown
2008-11-20 15:23 ` [PATCH 2/2] power_supply: Add battery health reporting for WM8350 Mark Brown
2008-11-25 11:25 ` [PATCH 1/2] power_supply: Add cold to the POWER_SUPPLY_HEALTH report values Anton Vorontsov
2008-11-24 19:27 ` [PATCH 0/2] Add battery health reporting for WM8350 Samuel Ortiz
1 sibling, 2 replies; 7+ messages in thread
From: Mark Brown @ 2008-11-20 15:23 UTC (permalink / raw)
To: Anton Vorontsov; +Cc: Samuel Ortiz, linux-kernel, Mark Brown
Some systems are able to report problems with batteries being under
temperature.
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
---
drivers/power/power_supply_sysfs.c | 2 +-
include/linux/power_supply.h | 1 +
2 files changed, 2 insertions(+), 1 deletions(-)
diff --git a/drivers/power/power_supply_sysfs.c b/drivers/power/power_supply_sysfs.c
index 23ae846..ac01e06 100644
--- a/drivers/power/power_supply_sysfs.c
+++ b/drivers/power/power_supply_sysfs.c
@@ -45,7 +45,7 @@ static ssize_t power_supply_show_property(struct device *dev,
};
static char *health_text[] = {
"Unknown", "Good", "Overheat", "Dead", "Over voltage",
- "Unspecified failure"
+ "Unspecified failure", "Cold",
};
static char *technology_text[] = {
"Unknown", "NiMH", "Li-ion", "Li-poly", "LiFe", "NiCd",
diff --git a/include/linux/power_supply.h b/include/linux/power_supply.h
index f9348cb..8ff25e0 100644
--- a/include/linux/power_supply.h
+++ b/include/linux/power_supply.h
@@ -45,6 +45,7 @@ enum {
POWER_SUPPLY_HEALTH_DEAD,
POWER_SUPPLY_HEALTH_OVERVOLTAGE,
POWER_SUPPLY_HEALTH_UNSPEC_FAILURE,
+ POWER_SUPPLY_HEALTH_COLD,
};
enum {
--
1.5.6.5
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH 2/2] power_supply: Add battery health reporting for WM8350
2008-11-20 15:23 ` [PATCH 1/2] power_supply: Add cold to the POWER_SUPPLY_HEALTH report values Mark Brown
@ 2008-11-20 15:23 ` Mark Brown
2008-11-25 11:26 ` Anton Vorontsov
2008-11-25 11:25 ` [PATCH 1/2] power_supply: Add cold to the POWER_SUPPLY_HEALTH report values Anton Vorontsov
1 sibling, 1 reply; 7+ messages in thread
From: Mark Brown @ 2008-11-20 15:23 UTC (permalink / raw)
To: Anton Vorontsov; +Cc: Samuel Ortiz, linux-kernel, Mark Brown
Implement support for reporting battery health in the WM8350 battery
interface. Since we are now able to report this via the classs remove
the diagnostics from the interrupt handler.
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
---
drivers/mfd/wm8350-regmap.c | 2 +-
drivers/power/wm8350_power.c | 33 +++++++++++++++++++++++++--------
include/linux/mfd/wm8350/core.h | 7 +++++++
3 files changed, 33 insertions(+), 9 deletions(-)
diff --git a/drivers/mfd/wm8350-regmap.c b/drivers/mfd/wm8350-regmap.c
index aaf394a..b43d64c 100644
--- a/drivers/mfd/wm8350-regmap.c
+++ b/drivers/mfd/wm8350-regmap.c
@@ -1314,7 +1314,7 @@ const struct wm8350_reg_access wm8350_reg_io_map[] = {
{ 0xFFFF, 0xFFFF, 0xFFFF }, /* R223 */
{ 0x0000, 0x0000, 0x0000 }, /* R224 */
{ 0x8F3F, 0x0000, 0xFFFF }, /* R225 - DCDC/LDO status */
- { 0x0000, 0x0000, 0x0000 }, /* R226 */
+ { 0x0000, 0x0000, 0xFFFF }, /* R226 - Charger status */
{ 0x0000, 0x0000, 0xFFFF }, /* R227 */
{ 0x0000, 0x0000, 0x0000 }, /* R228 */
{ 0x0000, 0x0000, 0x0000 }, /* R229 */
diff --git a/drivers/power/wm8350_power.c b/drivers/power/wm8350_power.c
index 74e7593..1b16bf3 100644
--- a/drivers/power/wm8350_power.c
+++ b/drivers/power/wm8350_power.c
@@ -190,22 +190,18 @@ static void wm8350_charger_handler(struct wm8350 *wm8350, int irq, void *data)
struct wm8350_charger_policy *policy = power->policy;
switch (irq) {
- case WM8350_IRQ_CHG_BAT_HOT:
- dev_err(wm8350->dev, "battery too hot\n");
- break;
- case WM8350_IRQ_CHG_BAT_COLD:
- dev_err(wm8350->dev, "battery too cold\n");
- break;
case WM8350_IRQ_CHG_BAT_FAIL:
dev_err(wm8350->dev, "battery failed\n");
break;
case WM8350_IRQ_CHG_TO:
dev_err(wm8350->dev, "charger timeout\n");
- break;
- case WM8350_IRQ_CHG_END:
power_supply_changed(&power->battery);
break;
+
+ case WM8350_IRQ_CHG_BAT_HOT:
+ case WM8350_IRQ_CHG_BAT_COLD:
case WM8350_IRQ_CHG_START:
+ case WM8350_IRQ_CHG_END:
power_supply_changed(&power->battery);
break;
@@ -308,6 +304,23 @@ static enum power_supply_property wm8350_usb_props[] = {
* Battery properties
*********************************************************************/
+static int wm8350_bat_check_health(struct wm8350 *wm8350)
+{
+ u16 reg;
+
+ if (wm8350_read_battery_uvolts(wm8350) < 2850000)
+ return POWER_SUPPLY_HEALTH_UNSPEC_FAILURE;
+
+ reg = wm8350_reg_read(wm8350, WM8350_CHARGER_OVERRIDES);
+ if (reg & WM8350_CHG_BATT_HOT_OVRDE)
+ return POWER_SUPPLY_HEALTH_OVERHEAT;
+
+ if (reg & WM8350_CHG_BATT_COLD_OVRDE)
+ return POWER_SUPPLY_HEALTH_COLD;
+
+ return POWER_SUPPLY_HEALTH_GOOD;
+}
+
static int wm8350_bat_get_property(struct power_supply *psy,
enum power_supply_property psp,
union power_supply_propval *val)
@@ -326,6 +339,9 @@ static int wm8350_bat_get_property(struct power_supply *psy,
case POWER_SUPPLY_PROP_VOLTAGE_NOW:
val->intval = wm8350_read_battery_uvolts(wm8350);
break;
+ case POWER_SUPPLY_PROP_HEALTH:
+ val->intval = wm8350_bat_check_health(wm8350);
+ break;
default:
ret = -EINVAL;
break;
@@ -338,6 +354,7 @@ static enum power_supply_property wm8350_bat_props[] = {
POWER_SUPPLY_PROP_STATUS,
POWER_SUPPLY_PROP_ONLINE,
POWER_SUPPLY_PROP_VOLTAGE_NOW,
+ POWER_SUPPLY_PROP_HEALTH,
};
/*********************************************************************
diff --git a/include/linux/mfd/wm8350/core.h b/include/linux/mfd/wm8350/core.h
index 0d37572..baf5530 100644
--- a/include/linux/mfd/wm8350/core.h
+++ b/include/linux/mfd/wm8350/core.h
@@ -58,6 +58,7 @@
#define WM8350_OVER_CURRENT_INT_STATUS_MASK 0x25
#define WM8350_GPIO_INT_STATUS_MASK 0x26
#define WM8350_COMPARATOR_INT_STATUS_MASK 0x27
+#define WM8350_CHARGER_OVERRIDES 0xE2
#define WM8350_MISC_OVERRIDES 0xE3
#define WM8350_COMPARATOR_OVERRIDES 0xE7
#define WM8350_STATE_MACHINE_STATUS 0xE9
@@ -533,6 +534,12 @@
#define WM8350_DC1_STS 0x0001
/*
+ * R226 (0xE2) - Charger status
+ */
+#define WM8350_CHG_BATT_HOT_OVRDE 0x8000
+#define WM8350_CHG_BATT_COLD_OVRDE 0x4000
+
+/*
* R227 (0xE3) - Misc Overrides
*/
#define WM8350_USB_LIMIT_OVRDE 0x0400
--
1.5.6.5
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH 0/2] Add battery health reporting for WM8350
2008-11-20 15:20 [PATCH 0/2] Add battery health reporting for WM8350 Mark Brown
2008-11-20 15:23 ` [PATCH 1/2] power_supply: Add cold to the POWER_SUPPLY_HEALTH report values Mark Brown
@ 2008-11-24 19:27 ` Samuel Ortiz
1 sibling, 0 replies; 7+ messages in thread
From: Samuel Ortiz @ 2008-11-24 19:27 UTC (permalink / raw)
To: Mark Brown; +Cc: Anton Vorontsov, linux-kernel
Hi Mark,
On Thu, Nov 20, 2008 at 03:20:44PM +0000, Mark Brown wrote:
> This (brief) series adds a new power supply health state for reporting
> excessively cold batteries then uses it when implementing battery health
> reporting for the WM8350. I'm not 100% happy with the name for the new
> state but I couldn't think of something consistent with the existing
> OVERHEAT.
>
> Since the WM8350 PMU driver is queued in the mfd tree it probably makes
> sense to merge this via the same path?
Fine with me. I'll wait for Anton's feedback on those patches.
Cheers,
Samuel.
--
Intel Open Source Technology Centre
http://oss.intel.com/
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 1/2] power_supply: Add cold to the POWER_SUPPLY_HEALTH report values
2008-11-20 15:23 ` [PATCH 1/2] power_supply: Add cold to the POWER_SUPPLY_HEALTH report values Mark Brown
2008-11-20 15:23 ` [PATCH 2/2] power_supply: Add battery health reporting for WM8350 Mark Brown
@ 2008-11-25 11:25 ` Anton Vorontsov
2008-12-01 0:08 ` Samuel Ortiz
1 sibling, 1 reply; 7+ messages in thread
From: Anton Vorontsov @ 2008-11-25 11:25 UTC (permalink / raw)
To: Mark Brown; +Cc: Samuel Ortiz, linux-kernel
On Thu, Nov 20, 2008 at 03:23:40PM +0000, Mark Brown wrote:
> Some systems are able to report problems with batteries being under
> temperature.
>
> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Looks good to me.
Acked-by: Anton Vorontsov <cbouatmailru@gmail.com>
> ---
> drivers/power/power_supply_sysfs.c | 2 +-
> include/linux/power_supply.h | 1 +
> 2 files changed, 2 insertions(+), 1 deletions(-)
>
> diff --git a/drivers/power/power_supply_sysfs.c b/drivers/power/power_supply_sysfs.c
> index 23ae846..ac01e06 100644
> --- a/drivers/power/power_supply_sysfs.c
> +++ b/drivers/power/power_supply_sysfs.c
> @@ -45,7 +45,7 @@ static ssize_t power_supply_show_property(struct device *dev,
> };
> static char *health_text[] = {
> "Unknown", "Good", "Overheat", "Dead", "Over voltage",
> - "Unspecified failure"
> + "Unspecified failure", "Cold",
> };
> static char *technology_text[] = {
> "Unknown", "NiMH", "Li-ion", "Li-poly", "LiFe", "NiCd",
> diff --git a/include/linux/power_supply.h b/include/linux/power_supply.h
> index f9348cb..8ff25e0 100644
> --- a/include/linux/power_supply.h
> +++ b/include/linux/power_supply.h
> @@ -45,6 +45,7 @@ enum {
> POWER_SUPPLY_HEALTH_DEAD,
> POWER_SUPPLY_HEALTH_OVERVOLTAGE,
> POWER_SUPPLY_HEALTH_UNSPEC_FAILURE,
> + POWER_SUPPLY_HEALTH_COLD,
> };
>
> enum {
> --
> 1.5.6.5
>
--
Anton Vorontsov
email: cbouatmailru@gmail.com
irc://irc.freenode.net/bd2
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 2/2] power_supply: Add battery health reporting for WM8350
2008-11-20 15:23 ` [PATCH 2/2] power_supply: Add battery health reporting for WM8350 Mark Brown
@ 2008-11-25 11:26 ` Anton Vorontsov
0 siblings, 0 replies; 7+ messages in thread
From: Anton Vorontsov @ 2008-11-25 11:26 UTC (permalink / raw)
To: Mark Brown; +Cc: Samuel Ortiz, linux-kernel
On Thu, Nov 20, 2008 at 03:23:41PM +0000, Mark Brown wrote:
> Implement support for reporting battery health in the WM8350 battery
> interface. Since we are now able to report this via the classs remove
> the diagnostics from the interrupt handler.
>
> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Acked-by: Anton Vorontsov <cbouatmailru@gmail.com>
> ---
> drivers/mfd/wm8350-regmap.c | 2 +-
> drivers/power/wm8350_power.c | 33 +++++++++++++++++++++++++--------
> include/linux/mfd/wm8350/core.h | 7 +++++++
> 3 files changed, 33 insertions(+), 9 deletions(-)
--
Anton Vorontsov
email: cbouatmailru@gmail.com
irc://irc.freenode.net/bd2
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 1/2] power_supply: Add cold to the POWER_SUPPLY_HEALTH report values
2008-11-25 11:25 ` [PATCH 1/2] power_supply: Add cold to the POWER_SUPPLY_HEALTH report values Anton Vorontsov
@ 2008-12-01 0:08 ` Samuel Ortiz
0 siblings, 0 replies; 7+ messages in thread
From: Samuel Ortiz @ 2008-12-01 0:08 UTC (permalink / raw)
To: Anton Vorontsov; +Cc: Mark Brown, linux-kernel
On Tue, Nov 25, 2008 at 02:25:12PM +0300, Anton Vorontsov wrote:
> On Thu, Nov 20, 2008 at 03:23:40PM +0000, Mark Brown wrote:
> > Some systems are able to report problems with batteries being under
> > temperature.
> >
> > Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
>
> Looks good to me.
>
> Acked-by: Anton Vorontsov <cbouatmailru@gmail.com>
Thanks guys, both patches applied.
Cheers,
Samuel.
> > ---
> > drivers/power/power_supply_sysfs.c | 2 +-
> > include/linux/power_supply.h | 1 +
> > 2 files changed, 2 insertions(+), 1 deletions(-)
> >
> > diff --git a/drivers/power/power_supply_sysfs.c b/drivers/power/power_supply_sysfs.c
> > index 23ae846..ac01e06 100644
> > --- a/drivers/power/power_supply_sysfs.c
> > +++ b/drivers/power/power_supply_sysfs.c
> > @@ -45,7 +45,7 @@ static ssize_t power_supply_show_property(struct device *dev,
> > };
> > static char *health_text[] = {
> > "Unknown", "Good", "Overheat", "Dead", "Over voltage",
> > - "Unspecified failure"
> > + "Unspecified failure", "Cold",
> > };
> > static char *technology_text[] = {
> > "Unknown", "NiMH", "Li-ion", "Li-poly", "LiFe", "NiCd",
> > diff --git a/include/linux/power_supply.h b/include/linux/power_supply.h
> > index f9348cb..8ff25e0 100644
> > --- a/include/linux/power_supply.h
> > +++ b/include/linux/power_supply.h
> > @@ -45,6 +45,7 @@ enum {
> > POWER_SUPPLY_HEALTH_DEAD,
> > POWER_SUPPLY_HEALTH_OVERVOLTAGE,
> > POWER_SUPPLY_HEALTH_UNSPEC_FAILURE,
> > + POWER_SUPPLY_HEALTH_COLD,
> > };
> >
> > enum {
> > --
> > 1.5.6.5
> >
>
> --
> Anton Vorontsov
> email: cbouatmailru@gmail.com
> irc://irc.freenode.net/bd2
--
Intel Open Source Technology Centre
http://oss.intel.com/
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2008-12-01 0:05 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-11-20 15:20 [PATCH 0/2] Add battery health reporting for WM8350 Mark Brown
2008-11-20 15:23 ` [PATCH 1/2] power_supply: Add cold to the POWER_SUPPLY_HEALTH report values Mark Brown
2008-11-20 15:23 ` [PATCH 2/2] power_supply: Add battery health reporting for WM8350 Mark Brown
2008-11-25 11:26 ` Anton Vorontsov
2008-11-25 11:25 ` [PATCH 1/2] power_supply: Add cold to the POWER_SUPPLY_HEALTH report values Anton Vorontsov
2008-12-01 0:08 ` Samuel Ortiz
2008-11-24 19:27 ` [PATCH 0/2] Add battery health reporting for WM8350 Samuel Ortiz
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox