From 8238cd4ec173799d72fa42a887cfa5e4e8473787 Mon Sep 17 00:00:00 2001 From: Weixin Zhou Date: Mon, 11 Jan 2021 19:27:37 +0800 Subject: [PATCH] power: rk817_charger: fix shutdown invalid by long press key if the GATE pin does not control the external PMOS to reduce the conduction resistance, the VCC_SYS can be shutdown int power off mode. Signed-off-by: Weixin Zhou Change-Id: I7312d19d608f7e7a015fca6f2b954d2b851af47d --- drivers/power/supply/rk817_charger.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/drivers/power/supply/rk817_charger.c b/drivers/power/supply/rk817_charger.c index 8d79f5aa0a07..b7e4f7627bdb 100644 --- a/drivers/power/supply/rk817_charger.c +++ b/drivers/power/supply/rk817_charger.c @@ -282,6 +282,7 @@ struct charger_platform_data { int sample_res; int otg5v_suspend_enable; bool extcon; + int gate_function_disable; }; struct rk817_charger { @@ -1306,7 +1307,9 @@ static void rk817_charge_pre_init(struct rk817_charger *charge) rk817_charge_otg_disable(charge); rk817_charge_field_write(charge, OTG_EN, OTG_DISABLE); rk817_charge_set_otg_in(charge, OFFLINE); - rk817_charge_sys_can_sd_disable(charge); + + if (!charge->pdata->gate_function_disable) + rk817_charge_sys_can_sd_disable(charge); rk817_charge_usb_to_sys_enable(charge); rk817_charge_enable_charge(charge); @@ -1420,6 +1423,11 @@ static int rk817_charge_parse_dt(struct rk817_charger *charge) dev_err(dev, "otg5v_suspend_enable missing!\n"); } + ret = of_property_read_u32(np, "gate_function_disable", + &pdata->gate_function_disable); + if (ret < 0) + dev_err(dev, "gate_function_disable missing!\n"); + if (!is_battery_exist(charge)) pdata->virtual_power = 1;