On 08/31/2015 09:10 PM, Andreas Dannenberg wrote:
A missing/disconnected battery is now reported as dead rather than an unspecified failure via the charger's sysfs health property. $ cat health Dead
Poor cat :(
Signed-off-by: Andreas Dannenberg <dannenberg@xxxxxx> --- drivers/power/bq24257_charger.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/power/bq24257_charger.c b/drivers/power/bq24257_charger.c index db81356..0b34528 100644 --- a/drivers/power/bq24257_charger.c +++ b/drivers/power/bq24257_charger.c @@ -274,6 +274,10 @@ static int bq24257_power_supply_get_property(struct power_supply *psy, val->intval = POWER_SUPPLY_HEALTH_SAFETY_TIMER_EXPIRE; break; + case FAULT_NO_BAT: + val->intval = POWER_SUPPLY_HEALTH_DEAD; + break; +
I think the best thing to do would be to return -ENODEV as suggested by power_supply_sysfs.c:305. Also you should probably add the POWER_SUPPLY_PROP_PRESENT property check and set intval to 0 when there is no battery. Regards, Andrew
default: val->intval = POWER_SUPPLY_HEALTH_UNSPEC_FAILURE; break;
-- To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html