s3c-hsudc: implement vbus_draw hook
authorHeiko Stübner <heiko@sntech.de>
Sun, 4 Sep 2011 19:56:02 +0000 (21:56 +0200)
committerGreg Kroah-Hartman <gregkh@suse.de>
Sun, 18 Sep 2011 08:33:06 +0000 (01:33 -0700)
When a transceiver is available use otg_set_power to submit
the target current to it.

Signed-off-by: Heiko Stuebner <heiko@sntech.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
drivers/usb/gadget/s3c-hsudc.c

index 25829b4398da9b2f28a591bb03952e02124da660..8d54f893cefe9df7c97363c1812b4f30bb822ff7 100644 (file)
@@ -1241,10 +1241,24 @@ static int s3c_hsudc_gadget_getframe(struct usb_gadget *gadget)
        return s3c_hsudc_read_frameno(to_hsudc(gadget));
 }
 
+static int s3c_hsudc_vbus_draw(struct usb_gadget *gadget, unsigned mA)
+{
+       struct s3c_hsudc *hsudc = the_controller;
+
+       if (!hsudc)
+               return -ENODEV;
+
+       if (hsudc->transceiver)
+               return otg_set_power(hsudc->transceiver, mA);
+
+       return -EOPNOTSUPP;
+}
+
 static struct usb_gadget_ops s3c_hsudc_gadget_ops = {
        .get_frame      = s3c_hsudc_gadget_getframe,
        .start          = s3c_hsudc_start,
        .stop           = s3c_hsudc_stop,
+       .vbus_draw      = s3c_hsudc_vbus_draw,
 };
 
 static int s3c_hsudc_probe(struct platform_device *pdev)