Loading drivers/usb/pd/policy_engine.c +10 −18 Original line number Diff line number Diff line Loading @@ -1974,6 +1974,10 @@ static void usbpd_sm(struct work_struct *w) switch (pd->current_state) { case PE_UNKNOWN: val.intval = 0; power_supply_set_property(pd->usb_psy, POWER_SUPPLY_PROP_PD_IN_HARD_RESET, &val); if (pd->current_pr == PR_SINK) { usbpd_set_state(pd, PE_SNK_STARTUP); } else if (pd->current_pr == PR_SRC) { Loading Loading @@ -2140,8 +2144,11 @@ static void usbpd_sm(struct work_struct *w) case PE_SRC_TRANSITION_TO_DEFAULT: if (pd->vconn_enabled) regulator_disable(pd->vconn); pd->vconn_enabled = false; if (pd->vbus_enabled) regulator_disable(pd->vbus); pd->vbus_enabled = false; if (pd->current_dr != DR_DFP) { extcon_set_cable_state_(pd->extcon, EXTCON_USB, 0); Loading @@ -2149,24 +2156,9 @@ static void usbpd_sm(struct work_struct *w) pd_phy_update_roles(pd->current_dr, pd->current_pr); } msleep(SRC_RECOVER_TIME); pd->vbus_enabled = false; enable_vbus(pd); if (pd->vconn_enabled) { ret = regulator_enable(pd->vconn); if (ret) { usbpd_err(&pd->dev, "Unable to enable vconn\n"); pd->vconn_enabled = false; } } val.intval = 0; power_supply_set_property(pd->usb_psy, POWER_SUPPLY_PROP_PD_IN_HARD_RESET, &val); usbpd_set_state(pd, PE_SRC_STARTUP); /* PE_UNKNOWN will turn on VBUS and go back to PE_SRC_STARTUP */ pd->current_state = PE_UNKNOWN; kick_sm(pd, SRC_RECOVER_TIME); break; case PE_SRC_HARD_RESET: Loading drivers/usb/pd/qpnp-pdphy.c +2 −13 Original line number Diff line number Diff line Loading @@ -112,7 +112,6 @@ struct usb_pdphy { int tx_status; u8 frame_filter_val; bool in_test_data_mode; bool rx_busy; enum data_role data_role; enum power_role power_role; Loading Loading @@ -490,7 +489,7 @@ int pd_phy_write(u16 hdr, const u8 *data, size_t data_len, enum pd_sop_type sop) } ret = pdphy_reg_read(pdphy, &val, USB_PDPHY_RX_ACKNOWLEDGE, 1); if (ret || val || pdphy->rx_busy) { if (ret || val) { dev_err(pdphy->dev, "%s: RX message pending\n", __func__); return -EBUSY; } Loading Loading @@ -668,15 +667,6 @@ static int pd_phy_bist_mode(u8 bist_mode) BIST_MODE_MASK | BIST_ENABLE, bist_mode | BIST_ENABLE); } static irqreturn_t pdphy_msg_rx_irq(int irq, void *data) { struct usb_pdphy *pdphy = data; pdphy->rx_busy = true; return IRQ_WAKE_THREAD; } static irqreturn_t pdphy_msg_rx_irq_thread(int irq, void *data) { u8 size, rx_status, frame_type; Loading Loading @@ -733,7 +723,6 @@ static irqreturn_t pdphy_msg_rx_irq_thread(int irq, void *data) false); pdphy->rx_bytes += size + 1; done: pdphy->rx_busy = false; return IRQ_HANDLED; } Loading Loading @@ -819,7 +808,7 @@ static int pdphy_probe(struct platform_device *pdev) return ret; ret = pdphy_request_irq(pdphy, pdev->dev.of_node, &pdphy->msg_rx_irq, "msg-rx", pdphy_msg_rx_irq, &pdphy->msg_rx_irq, "msg-rx", NULL, pdphy_msg_rx_irq_thread, (IRQF_TRIGGER_RISING | IRQF_ONESHOT)); if (ret < 0) return ret; Loading Loading
drivers/usb/pd/policy_engine.c +10 −18 Original line number Diff line number Diff line Loading @@ -1974,6 +1974,10 @@ static void usbpd_sm(struct work_struct *w) switch (pd->current_state) { case PE_UNKNOWN: val.intval = 0; power_supply_set_property(pd->usb_psy, POWER_SUPPLY_PROP_PD_IN_HARD_RESET, &val); if (pd->current_pr == PR_SINK) { usbpd_set_state(pd, PE_SNK_STARTUP); } else if (pd->current_pr == PR_SRC) { Loading Loading @@ -2140,8 +2144,11 @@ static void usbpd_sm(struct work_struct *w) case PE_SRC_TRANSITION_TO_DEFAULT: if (pd->vconn_enabled) regulator_disable(pd->vconn); pd->vconn_enabled = false; if (pd->vbus_enabled) regulator_disable(pd->vbus); pd->vbus_enabled = false; if (pd->current_dr != DR_DFP) { extcon_set_cable_state_(pd->extcon, EXTCON_USB, 0); Loading @@ -2149,24 +2156,9 @@ static void usbpd_sm(struct work_struct *w) pd_phy_update_roles(pd->current_dr, pd->current_pr); } msleep(SRC_RECOVER_TIME); pd->vbus_enabled = false; enable_vbus(pd); if (pd->vconn_enabled) { ret = regulator_enable(pd->vconn); if (ret) { usbpd_err(&pd->dev, "Unable to enable vconn\n"); pd->vconn_enabled = false; } } val.intval = 0; power_supply_set_property(pd->usb_psy, POWER_SUPPLY_PROP_PD_IN_HARD_RESET, &val); usbpd_set_state(pd, PE_SRC_STARTUP); /* PE_UNKNOWN will turn on VBUS and go back to PE_SRC_STARTUP */ pd->current_state = PE_UNKNOWN; kick_sm(pd, SRC_RECOVER_TIME); break; case PE_SRC_HARD_RESET: Loading
drivers/usb/pd/qpnp-pdphy.c +2 −13 Original line number Diff line number Diff line Loading @@ -112,7 +112,6 @@ struct usb_pdphy { int tx_status; u8 frame_filter_val; bool in_test_data_mode; bool rx_busy; enum data_role data_role; enum power_role power_role; Loading Loading @@ -490,7 +489,7 @@ int pd_phy_write(u16 hdr, const u8 *data, size_t data_len, enum pd_sop_type sop) } ret = pdphy_reg_read(pdphy, &val, USB_PDPHY_RX_ACKNOWLEDGE, 1); if (ret || val || pdphy->rx_busy) { if (ret || val) { dev_err(pdphy->dev, "%s: RX message pending\n", __func__); return -EBUSY; } Loading Loading @@ -668,15 +667,6 @@ static int pd_phy_bist_mode(u8 bist_mode) BIST_MODE_MASK | BIST_ENABLE, bist_mode | BIST_ENABLE); } static irqreturn_t pdphy_msg_rx_irq(int irq, void *data) { struct usb_pdphy *pdphy = data; pdphy->rx_busy = true; return IRQ_WAKE_THREAD; } static irqreturn_t pdphy_msg_rx_irq_thread(int irq, void *data) { u8 size, rx_status, frame_type; Loading Loading @@ -733,7 +723,6 @@ static irqreturn_t pdphy_msg_rx_irq_thread(int irq, void *data) false); pdphy->rx_bytes += size + 1; done: pdphy->rx_busy = false; return IRQ_HANDLED; } Loading Loading @@ -819,7 +808,7 @@ static int pdphy_probe(struct platform_device *pdev) return ret; ret = pdphy_request_irq(pdphy, pdev->dev.of_node, &pdphy->msg_rx_irq, "msg-rx", pdphy_msg_rx_irq, &pdphy->msg_rx_irq, "msg-rx", NULL, pdphy_msg_rx_irq_thread, (IRQF_TRIGGER_RISING | IRQF_ONESHOT)); if (ret < 0) return ret; Loading