usb/gadget: set vbus draw current limitation when in unconfig state
authorWu, Hao <hao.wu@intel.com>
Mon, 7 May 2012 13:30:26 +0000 (21:30 +0800)
committerbuildbot <buildbot@intel.com>
Wed, 9 May 2012 14:32:43 +0000 (07:32 -0700)
BZ: 33225

This patch sets vbus draw current limitation in unconfig state,
no smaller than suspended state.

Change-Id: I28970325a20f9d220123f9d0e99cae90dcd80294
Signed-off-by: Wu, Hao <hao.wu@intel.com>
Reviewed-on: http://android.intel.com:8080/47679
Reviewed-by: Tang, Richard <richard.tang@intel.com>
Reviewed-by: Tang, Jianqiang <jianqiang.tang@intel.com>
Reviewed-by: Zhuang, Jin Can <jin.can.zhuang@intel.com>
Reviewed-by: Meng, Zhe <zhe.meng@intel.com>
Tested-by: Meng, Zhe <zhe.meng@intel.com>
Reviewed-by: buildbot <buildbot@intel.com>
Tested-by: buildbot <buildbot@intel.com>
drivers/usb/gadget/composite.c

index d3d9759..db014e8 100644 (file)
@@ -737,6 +737,11 @@ static int set_config(struct usb_composite_dev *cdev,
        unsigned                power = gadget_is_otg(gadget) ? 8 : 100;
        int                     tmp;
 
+#if defined(CONFIG_USB_GADGET_SUSPEND_VBUS_DRAW)
+       if (power < CONFIG_USB_GADGET_SUSPEND_VBUS_DRAW)
+               power = CONFIG_USB_GADGET_SUSPEND_VBUS_DRAW;
+#endif
+
        if (cdev->config)
                reset_config(cdev);