From: Li Jun Date: Sat, 27 Sep 2014 13:33:29 +0000 (+0800) Subject: MLK-9638-6 usb: common: otg: test: clear otg_hnp_reqd flag when it's invalid X-Git-Tag: C0P2-H0.0--20200415~4655 X-Git-Url: https://git.somdevices.com/?a=commitdiff_plain;h=abff36d7a2b9e67dde92e7c81ce5adb2d4d9833c;p=linux.git MLK-9638-6 usb: common: otg: test: clear otg_hnp_reqd flag when it's invalid This patch clears otg_hnp_reqd feature related flags when the HNP test ends. There are two otg fsm paths to end this feature request: - b_peripheral --> b_wait_acon --> b_idle: we clear them when entering b_idle; - b_peripheral --> b_wait_acon --> b_host --> b_peripheral : we clear them when leaving b_host. Acked-by: Peter Chen Signed-off-by: Li Jun (cherry picked from commit 39d25f04ed047e15f23b44e8465ce46257547df7) (cherry picked from commit f92c4e5794a278946d3f4e7c8bc30e3e43a80c28) --- diff --git a/drivers/usb/common/usb-otg-fsm.c b/drivers/usb/common/usb-otg-fsm.c index 3478b1653460..279cb8fc633b 100644 --- a/drivers/usb/common/usb-otg-fsm.c +++ b/drivers/usb/common/usb-otg-fsm.c @@ -85,6 +85,10 @@ static void otg_leave_state(struct otg_fsm *fsm, enum usb_otg_state old_state) fsm->b_ase0_brst_tmout = 0; break; case OTG_STATE_B_HOST: + if (fsm->otg_hnp_reqd) { + fsm->otg_hnp_reqd = 0; + fsm->b_bus_req = 0; + } break; case OTG_STATE_A_IDLE: fsm->adp_prb = 0; @@ -229,6 +233,10 @@ static int otg_set_state(struct otg_fsm *fsm, enum usb_otg_state new_state) otg_start_adp_sns(fsm); otg_set_protocol(fsm, PROTO_UNDEF); otg_add_timer(fsm, B_SE0_SRP); + if (fsm->otg_hnp_reqd) { + fsm->otg_hnp_reqd = 0; + fsm->b_bus_req = 0; + } break; case OTG_STATE_B_SRP_INIT: otg_start_pulse(fsm);