#define CHGSTAT (3 << 4)
#define CHPORT (1 << 6)
#define DCPORT (1 << 7)
+#define LP8727_STAT_EOC 0x30
/* STATUS2 register */
#define TEMP_STAT (3 << 5)
ID_MAX,
};
-enum lp8727_chg_stat {
- PRECHG,
- CC,
- CV,
- EOC,
-};
-
enum lp8727_die_temp {
LP8788_TEMP_75C,
LP8788_TEMP_95C,
case POWER_SUPPLY_PROP_STATUS:
if (lp8727_is_charger_attached(psy->name, pchg->devid)) {
lp8727_read_byte(pchg, STATUS1, &read);
- if (((read & CHGSTAT) >> 4) == EOC)
- val->intval = POWER_SUPPLY_STATUS_FULL;
- else
- val->intval = POWER_SUPPLY_STATUS_CHARGING;
+
+ val->intval = (read & CHGSTAT) == LP8727_STAT_EOC ?
+ POWER_SUPPLY_STATUS_FULL :
+ POWER_SUPPLY_STATUS_CHARGING;
} else {
val->intval = POWER_SUPPLY_STATUS_DISCHARGING;
}