aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/power
diff options
context:
space:
mode:
authorKim, Milo <Milo.Kim@ti.com>2012-08-31 05:24:37 -0400
committerAnton Vorontsov <anton.vorontsov@linaro.org>2012-09-20 21:01:15 -0400
commitfaaae9bbb1f91f8bcd03bd9976620ac08d8b4454 (patch)
treeb133efdfdac441b3b1edad1d36838bc7e14c9741 /drivers/power
parentb1ad079680b24386d12aa99dd9afd4eb7093bbee (diff)
lp8727_charger: Use the definition rather than enum
Enum lp8727_chg_state can be removed because only one charger status is used - EOC(End Of Charge). To check whether the EOC is reached or not, use simple comparison rather than shift-operation. Signed-off-by: Milo(Woogyom) Kim <milo.kim@ti.com> Signed-off-by: Anton Vorontsov <anton.vorontsov@linaro.org>
Diffstat (limited to 'drivers/power')
-rw-r--r--drivers/power/lp8727_charger.c16
1 files changed, 5 insertions, 11 deletions
diff --git a/drivers/power/lp8727_charger.c b/drivers/power/lp8727_charger.c
index 1a5f4b27e001..32bf157f4815 100644
--- a/drivers/power/lp8727_charger.c
+++ b/drivers/power/lp8727_charger.c
@@ -55,6 +55,7 @@
55#define CHGSTAT (3 << 4) 55#define CHGSTAT (3 << 4)
56#define CHPORT (1 << 6) 56#define CHPORT (1 << 6)
57#define DCPORT (1 << 7) 57#define DCPORT (1 << 7)
58#define LP8727_STAT_EOC 0x30
58 59
59/* STATUS2 register */ 60/* STATUS2 register */
60#define TEMP_STAT (3 << 5) 61#define TEMP_STAT (3 << 5)
@@ -69,13 +70,6 @@ enum lp8727_dev_id {
69 ID_MAX, 70 ID_MAX,
70}; 71};
71 72
72enum lp8727_chg_stat {
73 PRECHG,
74 CC,
75 CV,
76 EOC,
77};
78
79enum lp8727_die_temp { 73enum lp8727_die_temp {
80 LP8788_TEMP_75C, 74 LP8788_TEMP_75C,
81 LP8788_TEMP_95C, 75 LP8788_TEMP_95C,
@@ -348,10 +342,10 @@ static int lp8727_battery_get_property(struct power_supply *psy,
348 case POWER_SUPPLY_PROP_STATUS: 342 case POWER_SUPPLY_PROP_STATUS:
349 if (lp8727_is_charger_attached(psy->name, pchg->devid)) { 343 if (lp8727_is_charger_attached(psy->name, pchg->devid)) {
350 lp8727_read_byte(pchg, STATUS1, &read); 344 lp8727_read_byte(pchg, STATUS1, &read);
351 if (((read & CHGSTAT) >> 4) == EOC) 345
352 val->intval = POWER_SUPPLY_STATUS_FULL; 346 val->intval = (read & CHGSTAT) == LP8727_STAT_EOC ?
353 else 347 POWER_SUPPLY_STATUS_FULL :
354 val->intval = POWER_SUPPLY_STATUS_CHARGING; 348 POWER_SUPPLY_STATUS_CHARGING;
355 } else { 349 } else {
356 val->intval = POWER_SUPPLY_STATUS_DISCHARGING; 350 val->intval = POWER_SUPPLY_STATUS_DISCHARGING;
357 } 351 }