[PATCH v2 4/6] usb: chipidea: set host request flag via sys input.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This patch sets host request flag in sys input when a A device
set a_bus_req or a B device set b_bus_req in peripheral role.

Signed-off-by: Li Jun <b47624@xxxxxxxxxxxxx>
---
 drivers/usb/chipidea/otg_fsm.c |   12 +++++++++++-
 1 files changed, 11 insertions(+), 1 deletions(-)

diff --git a/drivers/usb/chipidea/otg_fsm.c b/drivers/usb/chipidea/otg_fsm.c
index be319f3..613eb86 100644
--- a/drivers/usb/chipidea/otg_fsm.c
+++ b/drivers/usb/chipidea/otg_fsm.c
@@ -79,6 +79,10 @@ set_a_bus_req(struct device *dev, struct device_attribute *attr,
 			if (ci->fsm->a_bus_drop)
 				goto end;
 			ci->fsm->a_bus_req = 1;
+			if (ci->transceiver->state == OTG_STATE_A_PERIPHERAL) {
+				ci->gadget.host_request_flag = 1;
+				goto end;
+			}
 		}
 
 		disable_irq_nosync(ci->irq);
@@ -171,12 +175,18 @@ set_b_bus_req(struct device *dev, struct device_attribute *attr,
 	if (ci->transceiver && ci->transceiver->otg && ci->fsm) {
 		if (buf[0] == '0')
 			ci->fsm->b_bus_req = 0;
-		else if (buf[0] == '1')
+		else if (buf[0] == '1') {
 			ci->fsm->b_bus_req = 1;
+			if (ci->transceiver->state == OTG_STATE_B_PERIPHERAL) {
+				ci->gadget.host_request_flag = 1;
+				goto end;
+			}
+		}
 
 		disable_irq_nosync(ci->irq);
 		queue_work(ci->wq, &ci->work);
 	}
+end:
 	mutex_unlock(&ci->fsm->lock);
 
 	return count;
-- 
1.7.8


--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux