summaryrefslogtreecommitdiff
path: root/drivers/usb/cdns3
diff options
context:
space:
mode:
authorPeter Chen <peter.chen@nxp.com>2018-04-13 16:12:52 +0800
committerLeonard Crestez <leonard.crestez@nxp.com>2018-08-24 12:41:33 +0300
commit510d2870bc22ce31273433875e5482e7499677fd (patch)
tree2e190e3730445f82488881f848697728191edc27 /drivers/usb/cdns3
parentd68ac930961e650ca08be3a25d45f634007be074 (diff)
MLK-17631-5 usb: cdns3: gadget: set selfpower flag for usb_gadget
Implement selfpower setting between USB gadget core and controller driver Reviewed-by: Jun Li <jun.li@nxp.com> Signed-off-by: Peter Chen <peter.chen@nxp.com>
Diffstat (limited to 'drivers/usb/cdns3')
-rw-r--r--drivers/usb/cdns3/gadget.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/drivers/usb/cdns3/gadget.c b/drivers/usb/cdns3/gadget.c
index 180bee126302..52375a91ee06 100644
--- a/drivers/usb/cdns3/gadget.c
+++ b/drivers/usb/cdns3/gadget.c
@@ -493,7 +493,7 @@ static int cdns_req_ep0_get_status(struct usb_ss_dev *usb_ss,
usb_status |= 1uL << USB_DEVICE_REMOTE_WAKEUP;
/* self powered */
- usb_status |= 1uL << USB_DEVICE_SELF_POWERED;
+ usb_status |= usb_ss->gadget.is_selfpowered;
}
break;
@@ -1910,9 +1910,14 @@ static int usb_ss_gadget_set_selfpowered(struct usb_gadget *gadget,
int is_selfpowered)
{
struct usb_ss_dev *usb_ss = gadget_to_usb_ss(gadget);
+ unsigned long flags;
dev_dbg(&usb_ss->dev, "usb_ss_gadget_set_selfpowered: %d\n",
is_selfpowered);
+
+ spin_lock_irqsave(&usb_ss->lock, flags);
+ gadget->is_selfpowered = !!is_selfpowered;
+ spin_unlock_irqrestore(&usb_ss->lock, flags);
return 0;
}