usb: pd: Send extcon notification as soon as APSD detection is done
In some targets, it is observed that the time difference between vbus being provided by exerciser and the terminations being applied is more than 1 second causing failures of Type-C compliance testcases 4.10.2 and 4.10.3 When policy engine's psy changed work gets kicked in first time from vbus present interrupt callback of charger driver, we kick in usb pd sm work and it keeps running. Since apsd is not yet done, we don't queue peripheral work. When apsd is done and charger driver invokes power supply changed work, policy engine bails out as sm work is already running although the charger type is detected as SDP/CDP and were supposed to send an extcon notification. As a result the extcon is sent when the sm work hits enter snk startup call and it recognises that apsd is done and charger type is SDP or CDP and sends extcon. This is results in a delay of roughly 1.3 seconds from the moment vbus got detected to the moment we provide extcon notification to dwc3-msm. To avoid this, check for charger type and provide extcon if haven't done already in the psy_changed_notifier_work. This reduces the time delay to around 0.5 seconds helping resolve compliance issue. Change-Id: I02c9a4a6b21ca75d43fd68f2447a7388210a4856 Signed-off-by: Krishna Kurapati <quic_kriskura@quicinc.com>
This commit is contained in:
parent
bfa0380f01
commit
34312149a8
@ -3753,6 +3753,7 @@ static void psy_changed_notifier_work(struct work_struct *w)
|
||||
union power_supply_propval val;
|
||||
enum power_supply_typec_mode typec_mode;
|
||||
int ret;
|
||||
int usb_extcon_state;
|
||||
|
||||
ret = usbpd_get_psy_iio_property(pd,
|
||||
POWER_SUPPLY_PROP_TYPEC_MODE, &val);
|
||||
@ -3790,7 +3791,6 @@ static void psy_changed_notifier_work(struct work_struct *w)
|
||||
pd->typec_mode = typec_mode;
|
||||
queue_work(pd->wq, &pd->start_periph_work);
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
@ -3823,8 +3823,28 @@ static void psy_changed_notifier_work(struct work_struct *w)
|
||||
return;
|
||||
}
|
||||
|
||||
if (pd->typec_mode == typec_mode)
|
||||
if (pd->typec_mode == typec_mode) {
|
||||
if (!((pd->current_dr == DR_NONE) || (pd->current_dr == DR_UFP)))
|
||||
return;
|
||||
|
||||
usb_extcon_state = extcon_get_state(pd->extcon, EXTCON_USB);
|
||||
|
||||
if (usb_extcon_state == 0) {
|
||||
ret = usbpd_get_psy_iio_property(pd, POWER_SUPPLY_PROP_REAL_TYPE,
|
||||
&val);
|
||||
if (ret) {
|
||||
usbpd_err(&pd->dev, "Unable to read USB PROP_REAL_TYPE: %d\n",
|
||||
ret);
|
||||
return;
|
||||
}
|
||||
|
||||
if (val.intval == POWER_SUPPLY_TYPE_USB ||
|
||||
val.intval == POWER_SUPPLY_TYPE_USB_CDP ||
|
||||
val.intval == QTI_POWER_SUPPLY_TYPE_USB_FLOAT)
|
||||
queue_work(pd->wq, &pd->start_periph_work);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
pd->typec_mode = typec_mode;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user