diff options
author | Li Jun <jun.li@nxp.com> | 2016-02-18 21:04:45 -0500 |
---|---|---|
committer | Felipe Balbi <balbi@kernel.org> | 2016-03-04 08:14:37 -0500 |
commit | 2dfb46be1a231888e8d51b97573f592e408d5199 (patch) | |
tree | 086b970c61c0f51de5ad7440d447aba028d58267 /drivers/usb/chipidea | |
parent | c5348b621bd8a61fab3de9f69bf14c8545d7d642 (diff) |
usb: chipidea: otg: set host_request_flag for gadget
Set host_request_flag if the current peripheral wants to take host role
via changing a_bus_req or b_bus_req by user application.
Acked-by: Peter Chen <peter.chen@freescale.com>
Signed-off-by: Li Jun <jun.li@nxp.com>
Signed-off-by: Felipe Balbi <balbi@kernel.org>
Diffstat (limited to 'drivers/usb/chipidea')
-rw-r--r-- | drivers/usb/chipidea/otg_fsm.c | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/drivers/usb/chipidea/otg_fsm.c b/drivers/usb/chipidea/otg_fsm.c index ba90dc66703d..cb28e763f0b8 100644 --- a/drivers/usb/chipidea/otg_fsm.c +++ b/drivers/usb/chipidea/otg_fsm.c | |||
@@ -66,6 +66,11 @@ set_a_bus_req(struct device *dev, struct device_attribute *attr, | |||
66 | return count; | 66 | return count; |
67 | } | 67 | } |
68 | ci->fsm.a_bus_req = 1; | 68 | ci->fsm.a_bus_req = 1; |
69 | if (ci->fsm.otg->state == OTG_STATE_A_PERIPHERAL) { | ||
70 | ci->gadget.host_request_flag = 1; | ||
71 | mutex_unlock(&ci->fsm.lock); | ||
72 | return count; | ||
73 | } | ||
69 | } | 74 | } |
70 | 75 | ||
71 | ci_otg_queue_work(ci); | 76 | ci_otg_queue_work(ci); |
@@ -144,8 +149,14 @@ set_b_bus_req(struct device *dev, struct device_attribute *attr, | |||
144 | mutex_lock(&ci->fsm.lock); | 149 | mutex_lock(&ci->fsm.lock); |
145 | if (buf[0] == '0') | 150 | if (buf[0] == '0') |
146 | ci->fsm.b_bus_req = 0; | 151 | ci->fsm.b_bus_req = 0; |
147 | else if (buf[0] == '1') | 152 | else if (buf[0] == '1') { |
148 | ci->fsm.b_bus_req = 1; | 153 | ci->fsm.b_bus_req = 1; |
154 | if (ci->fsm.otg->state == OTG_STATE_B_PERIPHERAL) { | ||
155 | ci->gadget.host_request_flag = 1; | ||
156 | mutex_unlock(&ci->fsm.lock); | ||
157 | return count; | ||
158 | } | ||
159 | } | ||
149 | 160 | ||
150 | ci_otg_queue_work(ci); | 161 | ci_otg_queue_work(ci); |
151 | mutex_unlock(&ci->fsm.lock); | 162 | mutex_unlock(&ci->fsm.lock); |