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 <berniem@motorola.com>
Reviewed-on: https://gerrit.mot.com/1947523
SME-Granted: SME Approvals Granted
SLTApproved: Slta Waiver
Tested-by: Jira Key
Reviewed-by: Ling Jin <lingjin@motorola.com>
Submit-Approved: Jira Key
This commit is contained in:
Bernie Moreno-BERNIEM 2021-05-12 14:29:17 -05:00 • committed by Bernie Moreno
commit 4c2fe1dc2a

View file

@ -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;