From 4c2fe1dc2a638fff19d0b5a8856d21d9895bc3c1 Mon Sep 17 00:00:00 2001 From: Bernie Moreno-BERNIEM Date: Wed, 12 May 2021 14:29:17 -0500 Subject: [PATCH] power:fet_control: Charge path gpio too slow Schedule chrg cable ps-notification to update work after 3secs, to allow cable status update. This will improve gpio timing to within 3secs, vs waiting for next reg schedulked work, which could be 30s Change-Id: I5c9d252c9d23be6bad085fb7bd9b3b892f5ea2e8 Signed-off-by: Bernie Moreno-BERNIEM Reviewed-on: https://gerrit.mot.com/1947523 SME-Granted: SME Approvals Granted SLTApproved: Slta Waiver Tested-by: Jira Key Reviewed-by: Ling Jin Submit-Approved: Jira Key --- drivers/power/fet-control/fet_control.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/drivers/power/fet-control/fet_control.c b/drivers/power/fet-control/fet_control.c index 38f64eaa925e..31183f033702 100755 --- a/drivers/power/fet-control/fet_control.c +++ b/drivers/power/fet-control/fet_control.c @@ -226,7 +226,7 @@ static void update_work(struct work_struct *work) int main_dischg = 1; int hb_sched_time = HBDLY_DISCHARGE_MS; bool weakchrg = 0; - const char * usb_types[] = {"UNKNOWN","SDP","DCP"}; + const char * usb_types[] = {"UNKNOWN","SDP","DCP","CDP","ACA","Type-C","PD","PD_DRP"}; usbtype = get_ps_int_prop(data->usb_psy, POWER_SUPPLY_PROP_USB_TYPE); @@ -312,8 +312,9 @@ static void update_work(struct work_struct *work) battplus_state = 0; balance_state = 1; flip_chrg_en_state = 1; + pr_info("FASTCHG: battfets-OPEN\n"); } - pr_debug("Flip chrg_en state: %d\n", flip_chrg_en_state); + pr_info("Flip chrg_en state: %d\n", flip_chrg_en_state); /* Update GPIO controls */ update_state_gpio(fet_control_data.battplus_en_gpio, battplus_state); @@ -356,8 +357,15 @@ static int ps_notify_callback(struct notifier_block *nb, } data->ps_is_present = present_ps; + /* FETS OPEN prior to reading Vbatt levels */ + battplus_state = 0; + balance_state = 1; + update_state_gpio(fet_control_data.battplus_en_gpio, battplus_state); + update_state_gpio(fet_control_data.balance_en_n_gpio, balance_state); + pr_info("VBATT CHK... battfets-OPEN\n"); + cancel_delayed_work(&data->update); - schedule_delayed_work(&data->update, msecs_to_jiffies(1)); + schedule_delayed_work(&data->update, msecs_to_jiffies(3000)); } return 0;