power_supply: bq25700: set default input voltage ane current when shutdown
authorShunqing Chen <csq@rock-chips.com>
Fri, 6 Jan 2017 07:07:33 +0000 (15:07 +0800)
committerHuang, Tao <huangtao@rock-chips.com>
Mon, 9 Jan 2017 07:55:24 +0000 (15:55 +0800)
Change-Id: Ibeeab7bf882e232be7285deee995c5a0dc3f641c
Signed-off-by: Shunqing Chen <csq@rock-chips.com>
drivers/power/bq25700_charger.c

index fca588c6c7b036161e3b0f4546581350d69bcfa3..eb0230d798ea372ad601a3913da42db43588087f 100644 (file)
@@ -1729,6 +1729,17 @@ irq_fail:
        return ret;
 }
 
+void bq25700_shutdown(struct i2c_client *client)
+{
+       int vol_idx;
+       struct bq25700_device *charger = i2c_get_clientdata(client);
+
+       vol_idx = bq25700_find_idx(DEFAULT_INPUTVOL, TBL_INPUTVOL);
+       bq25700_field_write(charger, INPUT_VOLTAGE, vol_idx);
+       bq25700_field_write(charger, INPUT_CURRENT,
+                           charger->init_data.input_current_sdp);
+}
+
 #ifdef CONFIG_PM_SLEEP
 static int bq25700_pm_suspend(struct device *dev)
 {
@@ -1763,6 +1774,7 @@ static const struct of_device_id bq25700_of_match[] = {
 
 static struct i2c_driver bq25700_driver = {
        .probe          = bq25700_probe,
+       .shutdown       = bq25700_shutdown,
        .id_table       = bq25700_i2c_ids,
        .driver = {
                .name           = "bq25700-charger",