mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-10 22:40:54 -04:00
Initialize usb state when registering the usb notification
If power supply supplier registered brfore touchscreen, ps_notify_callback will not receive PSY_EVENT_PROP_ADDED event, and will cause miss to set TP into charger state. So check PS state in probe. NO_PROP_NEEDED: <only needed for bo branch> Change-Id: Ib2c190fe06bc9167a5e0108304e34389aa16ff5b Reviewed-on: https://gerrit.mot.com/1685838 SLTApproved: Slta Waiver SME-Granted: SME Approvals Granted Tested-by: Jira Key Reviewed-by: Jichao Zou <zoujc@motorola.com> Reviewed-by: Konstantin Makariev <kmakariev@motorola.com> Submit-Approved: Jira Key
This commit is contained in:
parent
e5ce10d03d
commit
40eb7e6dd7
1 changed files with 16 additions and 1 deletions
|
|
@ -309,7 +309,7 @@ static int ts_mmi_refresh_rate_cb(struct notifier_block *nb,
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int ts_mmi_ps_get_state(struct power_supply *psy, bool *present)
|
||||
static inline int ts_mmi_ps_get_state(struct power_supply *psy, bool *present)
|
||||
{
|
||||
union power_supply_propval pval = {0};
|
||||
int ret;
|
||||
|
|
@ -424,10 +424,25 @@ int ts_mmi_notifiers_register(struct ts_mmi_dev *touch_cdev)
|
|||
goto FIFO_ALLOC_FAILED;
|
||||
|
||||
if (touch_cdev->pdata.usb_detection) {
|
||||
struct power_supply *psy = NULL;
|
||||
bool present;
|
||||
touch_cdev->ps_notif.notifier_call = ts_mmi_charger_cb;
|
||||
ret = power_supply_reg_notifier(&touch_cdev->ps_notif);
|
||||
if (ret)
|
||||
goto PS_NOTIF_REGISTER_FAILED;
|
||||
|
||||
psy = power_supply_get_by_name("usb");
|
||||
if (psy) {
|
||||
ret = ts_mmi_ps_get_state(psy, &present);
|
||||
if (!ret) {
|
||||
touch_cdev->ps_is_present = present;
|
||||
kfifo_put(&touch_cdev->cmd_pipe, TS_MMI_DO_PS);
|
||||
schedule_delayed_work(&touch_cdev->work, 0);
|
||||
}
|
||||
power_supply_put(psy);
|
||||
dev_info(DEV_MMI, "%s: USB initial status=%d\n",
|
||||
__func__, touch_cdev->ps_is_present);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
|||
Loading…
Reference in a new issue