Loading drivers/usb/dwc3/dwc3-msm.c +8 −32 Original line number Diff line number Diff line Loading @@ -255,7 +255,6 @@ struct dwc3_msm { struct notifier_block id_nb; struct notifier_block eud_event_nb; struct notifier_block host_restart_nb; struct notifier_block self_power_nb; struct notifier_block host_nb; bool xhci_ss_compliance_enable; Loading Loading @@ -297,8 +296,6 @@ static void dwc3_msm_notify_event(struct dwc3 *dwc, unsigned int event, unsigned int value); static int dwc3_restart_usb_host_mode(struct notifier_block *nb, unsigned long event, void *ptr); static int dwc3_notify_pd_status(struct notifier_block *nb, unsigned long event, void *ptr); /** * Loading Loading @@ -2703,6 +2700,14 @@ static void dwc3_resume_work(struct work_struct *w) ORIENTATION_CC2 : ORIENTATION_CC1; dbg_event(0xFF, "cc_state", mdwc->typec_orientation); ret = extcon_get_property(mdwc->extcon_vbus, EXTCON_USB, EXTCON_PROP_USB_PD_CONTRACT, &val); if (!ret) dwc->gadget.self_powered = val.intval; else dwc->gadget.self_powered = 0; } /* Loading Loading @@ -3057,19 +3062,12 @@ static int dwc3_msm_extcon_register(struct dwc3_msm *mdwc, int start_idx) if (!IS_ERR(edev)) { mdwc->extcon_vbus = edev; mdwc->vbus_nb.notifier_call = dwc3_msm_vbus_notifier; mdwc->self_power_nb.notifier_call = dwc3_notify_pd_status; ret = extcon_register_notifier(edev, EXTCON_USB, &mdwc->vbus_nb); if (ret < 0) { dev_err(mdwc->dev, "failed to register notifier for USB\n"); return ret; } ret = extcon_register_blocking_notifier(edev, EXTCON_USB, &mdwc->self_power_nb); if (ret < 0) { dev_err(mdwc->dev, "failed to register blocking notifier\n"); goto err1; } } /* Loading Loading @@ -4171,28 +4169,6 @@ static int dwc3_otg_start_peripheral(struct dwc3_msm *mdwc, int on) return 0; } static int dwc3_notify_pd_status(struct notifier_block *nb, unsigned long event, void *ptr) { struct dwc3_msm *mdwc; struct dwc3 *dwc; int ret = 0; union extcon_property_value val; mdwc = container_of(nb, struct dwc3_msm, self_power_nb); dwc = platform_get_drvdata(mdwc->dwc3); ret = extcon_get_property(mdwc->extcon_vbus, EXTCON_USB, EXTCON_PROP_USB_PD_CONTRACT, &val); if (!ret) dwc->gadget.self_powered = val.intval; else dwc->gadget.self_powered = 0; return ret; } /* speed: 0 - USB_SPEED_HIGH, 1 - USB_SPEED_SUPER */ static int dwc3_restart_usb_host_mode(struct notifier_block *nb, unsigned long event, void *ptr) Loading drivers/usb/pd/policy_engine.c +3 −23 Original line number Diff line number Diff line Loading @@ -530,23 +530,11 @@ static inline void start_usb_peripheral(struct usbpd *pd) val.intval = 1; extcon_set_property(pd->extcon, EXTCON_USB, EXTCON_PROP_USB_SS, val); extcon_set_state_sync(pd->extcon, EXTCON_USB, 1); } static void notify_pd_contract_status(struct usbpd *pd) { int ret = 0; union extcon_property_value val; if (!pd) return; val.intval = pd->in_explicit_contract; val.intval = pd->typec_mode > POWER_SUPPLY_TYPEC_SOURCE_DEFAULT ? 1 : 0; extcon_set_property(pd->extcon, EXTCON_USB, EXTCON_PROP_USB_PD_CONTRACT, val); ret = extcon_blocking_sync(pd->extcon, EXTCON_USB, 0); if (ret) usbpd_err(&pd->dev, "err(%d) while notifying pd status", ret); extcon_set_state_sync(pd->extcon, EXTCON_USB, 1); } /** Loading Loading @@ -1268,7 +1256,6 @@ static void usbpd_set_state(struct usbpd *pd, enum usbpd_state next_state) case PE_SRC_READY: pd->in_explicit_contract = true; notify_pd_contract_status(pd); if (pd->vdm_tx) kick_sm(pd, 0); Loading Loading @@ -1415,7 +1402,6 @@ static void usbpd_set_state(struct usbpd *pd, enum usbpd_state next_state) case PE_SNK_READY: pd->in_explicit_contract = true; notify_pd_contract_status(pd); if (pd->vdm_tx) kick_sm(pd, 0); Loading Loading @@ -1451,7 +1437,6 @@ static void usbpd_set_state(struct usbpd *pd, enum usbpd_state next_state) POWER_SUPPLY_PROP_PD_CURRENT_MAX, &val); pd->in_explicit_contract = false; notify_pd_contract_status(pd); /* * need to update PR bit in message header so that Loading Loading @@ -2031,7 +2016,6 @@ static void usbpd_sm(struct work_struct *w) pd->in_pr_swap = false; pd->pd_connected = false; pd->in_explicit_contract = false; notify_pd_contract_status(pd); pd->hard_reset_recvd = false; pd->caps_count = 0; pd->hard_reset_count = 0; Loading Loading @@ -2115,7 +2099,6 @@ static void usbpd_sm(struct work_struct *w) POWER_SUPPLY_PROP_PR_SWAP, &val); pd->in_explicit_contract = false; notify_pd_contract_status(pd); pd->selected_pdo = pd->requested_pdo = 0; pd->rdo = 0; rx_msg_cleanup(pd); Loading Loading @@ -2339,7 +2322,6 @@ static void usbpd_sm(struct work_struct *w) pd_send_hard_reset(pd); pd->in_explicit_contract = false; notify_pd_contract_status(pd); pd->rdo = 0; rx_msg_cleanup(pd); reset_vdm_state(pd); Loading Loading @@ -2790,7 +2772,6 @@ static void usbpd_sm(struct work_struct *w) pd_send_hard_reset(pd); pd->in_explicit_contract = false; notify_pd_contract_status(pd); pd->selected_pdo = pd->requested_pdo = 0; pd->rdo = 0; reset_vdm_state(pd); Loading Loading @@ -2822,7 +2803,6 @@ static void usbpd_sm(struct work_struct *w) power_supply_set_property(pd->usb_psy, POWER_SUPPLY_PROP_PR_SWAP, &val); pd->in_explicit_contract = false; notify_pd_contract_status(pd); if (pd->vbus_enabled) { regulator_disable(pd->vbus); Loading Loading
drivers/usb/dwc3/dwc3-msm.c +8 −32 Original line number Diff line number Diff line Loading @@ -255,7 +255,6 @@ struct dwc3_msm { struct notifier_block id_nb; struct notifier_block eud_event_nb; struct notifier_block host_restart_nb; struct notifier_block self_power_nb; struct notifier_block host_nb; bool xhci_ss_compliance_enable; Loading Loading @@ -297,8 +296,6 @@ static void dwc3_msm_notify_event(struct dwc3 *dwc, unsigned int event, unsigned int value); static int dwc3_restart_usb_host_mode(struct notifier_block *nb, unsigned long event, void *ptr); static int dwc3_notify_pd_status(struct notifier_block *nb, unsigned long event, void *ptr); /** * Loading Loading @@ -2703,6 +2700,14 @@ static void dwc3_resume_work(struct work_struct *w) ORIENTATION_CC2 : ORIENTATION_CC1; dbg_event(0xFF, "cc_state", mdwc->typec_orientation); ret = extcon_get_property(mdwc->extcon_vbus, EXTCON_USB, EXTCON_PROP_USB_PD_CONTRACT, &val); if (!ret) dwc->gadget.self_powered = val.intval; else dwc->gadget.self_powered = 0; } /* Loading Loading @@ -3057,19 +3062,12 @@ static int dwc3_msm_extcon_register(struct dwc3_msm *mdwc, int start_idx) if (!IS_ERR(edev)) { mdwc->extcon_vbus = edev; mdwc->vbus_nb.notifier_call = dwc3_msm_vbus_notifier; mdwc->self_power_nb.notifier_call = dwc3_notify_pd_status; ret = extcon_register_notifier(edev, EXTCON_USB, &mdwc->vbus_nb); if (ret < 0) { dev_err(mdwc->dev, "failed to register notifier for USB\n"); return ret; } ret = extcon_register_blocking_notifier(edev, EXTCON_USB, &mdwc->self_power_nb); if (ret < 0) { dev_err(mdwc->dev, "failed to register blocking notifier\n"); goto err1; } } /* Loading Loading @@ -4171,28 +4169,6 @@ static int dwc3_otg_start_peripheral(struct dwc3_msm *mdwc, int on) return 0; } static int dwc3_notify_pd_status(struct notifier_block *nb, unsigned long event, void *ptr) { struct dwc3_msm *mdwc; struct dwc3 *dwc; int ret = 0; union extcon_property_value val; mdwc = container_of(nb, struct dwc3_msm, self_power_nb); dwc = platform_get_drvdata(mdwc->dwc3); ret = extcon_get_property(mdwc->extcon_vbus, EXTCON_USB, EXTCON_PROP_USB_PD_CONTRACT, &val); if (!ret) dwc->gadget.self_powered = val.intval; else dwc->gadget.self_powered = 0; return ret; } /* speed: 0 - USB_SPEED_HIGH, 1 - USB_SPEED_SUPER */ static int dwc3_restart_usb_host_mode(struct notifier_block *nb, unsigned long event, void *ptr) Loading
drivers/usb/pd/policy_engine.c +3 −23 Original line number Diff line number Diff line Loading @@ -530,23 +530,11 @@ static inline void start_usb_peripheral(struct usbpd *pd) val.intval = 1; extcon_set_property(pd->extcon, EXTCON_USB, EXTCON_PROP_USB_SS, val); extcon_set_state_sync(pd->extcon, EXTCON_USB, 1); } static void notify_pd_contract_status(struct usbpd *pd) { int ret = 0; union extcon_property_value val; if (!pd) return; val.intval = pd->in_explicit_contract; val.intval = pd->typec_mode > POWER_SUPPLY_TYPEC_SOURCE_DEFAULT ? 1 : 0; extcon_set_property(pd->extcon, EXTCON_USB, EXTCON_PROP_USB_PD_CONTRACT, val); ret = extcon_blocking_sync(pd->extcon, EXTCON_USB, 0); if (ret) usbpd_err(&pd->dev, "err(%d) while notifying pd status", ret); extcon_set_state_sync(pd->extcon, EXTCON_USB, 1); } /** Loading Loading @@ -1268,7 +1256,6 @@ static void usbpd_set_state(struct usbpd *pd, enum usbpd_state next_state) case PE_SRC_READY: pd->in_explicit_contract = true; notify_pd_contract_status(pd); if (pd->vdm_tx) kick_sm(pd, 0); Loading Loading @@ -1415,7 +1402,6 @@ static void usbpd_set_state(struct usbpd *pd, enum usbpd_state next_state) case PE_SNK_READY: pd->in_explicit_contract = true; notify_pd_contract_status(pd); if (pd->vdm_tx) kick_sm(pd, 0); Loading Loading @@ -1451,7 +1437,6 @@ static void usbpd_set_state(struct usbpd *pd, enum usbpd_state next_state) POWER_SUPPLY_PROP_PD_CURRENT_MAX, &val); pd->in_explicit_contract = false; notify_pd_contract_status(pd); /* * need to update PR bit in message header so that Loading Loading @@ -2031,7 +2016,6 @@ static void usbpd_sm(struct work_struct *w) pd->in_pr_swap = false; pd->pd_connected = false; pd->in_explicit_contract = false; notify_pd_contract_status(pd); pd->hard_reset_recvd = false; pd->caps_count = 0; pd->hard_reset_count = 0; Loading Loading @@ -2115,7 +2099,6 @@ static void usbpd_sm(struct work_struct *w) POWER_SUPPLY_PROP_PR_SWAP, &val); pd->in_explicit_contract = false; notify_pd_contract_status(pd); pd->selected_pdo = pd->requested_pdo = 0; pd->rdo = 0; rx_msg_cleanup(pd); Loading Loading @@ -2339,7 +2322,6 @@ static void usbpd_sm(struct work_struct *w) pd_send_hard_reset(pd); pd->in_explicit_contract = false; notify_pd_contract_status(pd); pd->rdo = 0; rx_msg_cleanup(pd); reset_vdm_state(pd); Loading Loading @@ -2790,7 +2772,6 @@ static void usbpd_sm(struct work_struct *w) pd_send_hard_reset(pd); pd->in_explicit_contract = false; notify_pd_contract_status(pd); pd->selected_pdo = pd->requested_pdo = 0; pd->rdo = 0; reset_vdm_state(pd); Loading Loading @@ -2822,7 +2803,6 @@ static void usbpd_sm(struct work_struct *w) power_supply_set_property(pd->usb_psy, POWER_SUPPLY_PROP_PR_SWAP, &val); pd->in_explicit_contract = false; notify_pd_contract_status(pd); if (pd->vbus_enabled) { regulator_disable(pd->vbus); Loading