diff options
-rw-r--r-- | drivers/power/bq2419x-charger.c | 15 | ||||
-rw-r--r-- | include/linux/power/bq2419x-charger.h | 1 |
2 files changed, 16 insertions, 0 deletions
diff --git a/drivers/power/bq2419x-charger.c b/drivers/power/bq2419x-charger.c index 42c432544306..04e4e1058a6e 100644 --- a/drivers/power/bq2419x-charger.c +++ b/drivers/power/bq2419x-charger.c @@ -79,6 +79,7 @@ struct bq2419x_chip { int gpio_otg_iusb; int wdt_refresh_timeout; int wdt_time_sec; + int auto_recharge_time_power_off; bool emulate_input_disconnected; struct mutex mutex; @@ -1263,6 +1264,7 @@ static struct bq2419x_platform_data *bq2419x_dt_parse(struct i2c_client *client) int temp_range_len, chg_current_lim_len, chg_voltage_lim_len; int wdt_timeout; int chg_restart_time; + int auto_recharge_time_power_off; int temp_polling_time; struct regulator_init_data *batt_init_data; struct bq2419x_charger_platform_data *chg_pdata; @@ -1341,6 +1343,13 @@ static struct bq2419x_platform_data *bq2419x_dt_parse(struct i2c_client *client) pdata->bcharger_pdata->wdt_timeout = wdt_timeout; ret = of_property_read_u32(batt_reg_node, + "ti,auto-recharge-time-power-off", + &auto_recharge_time_power_off); + if (!ret) + pdata->bcharger_pdata->auto_recharge_time_power_off = + auto_recharge_time_power_off; + + ret = of_property_read_u32(batt_reg_node, "ti,auto-recharge-time", &chg_restart_time); if (!ret) pdata->bcharger_pdata->chg_restart_time = @@ -1536,6 +1545,8 @@ static int bq2419x_probe(struct i2c_client *client, goto skip_bcharger_init; } + bq2419x->auto_recharge_time_power_off = + pdata->bcharger_pdata->auto_recharge_time_power_off; bq2419x->wdt_time_sec = pdata->bcharger_pdata->wdt_timeout; bq2419x->chg_restart_time = pdata->bcharger_pdata->chg_restart_time; bq2419x->battery_presense = true; @@ -1643,6 +1654,10 @@ static void bq2419x_shutdown(struct i2c_client *client) if (bq2419x->cable_connected && bq2419x->in_current_limit > 500 && bq2419x->wdt_refresh_timeout) { + if ((bq2419x->chg_status == BATTERY_CHARGING_DONE) + && bq2419x->auto_recharge_time_power_off) + bq2419x->wdt_refresh_timeout = + bq2419x->auto_recharge_time_power_off; ret = battery_charging_system_reset_after(bq2419x->bc_dev, bq2419x->wdt_refresh_timeout); if (ret < 0) diff --git a/include/linux/power/bq2419x-charger.h b/include/linux/power/bq2419x-charger.h index 128d2a1e74c1..02f6b0fe55d1 100644 --- a/include/linux/power/bq2419x-charger.h +++ b/include/linux/power/bq2419x-charger.h @@ -141,6 +141,7 @@ struct bq2419x_charger_platform_data { int num_consumer_supplies; struct regulator_consumer_supply *consumer_supplies; int chg_restart_time; + int auto_recharge_time_power_off; const char *tz_name; /* Thermal zone name */ bool disable_suspend_during_charging; bool enable_thermal_monitor; /* TRUE if FuelGauge provides temp */ |