diff options
| author | Gregory Herrero <gregory.herrero@intel.com> | 2015-01-09 07:39:02 -0500 |
|---|---|---|
| committer | Felipe Balbi <balbi@ti.com> | 2015-01-12 16:34:23 -0500 |
| commit | 83d982234ee65900521e763161f409b29f89b8f6 (patch) | |
| tree | 70637ef3ebcb0d035c4fa45339010efe69ef6426 /drivers/usb/dwc2 | |
| parent | 48b20bcb3b2e9b15be1ebb9b574b003cffb033d5 (diff) | |
usb: dwc2: gadget: add vbus_session support
Enable phy driver to report vbus session. This allows us to remove
D+ pullup when vbus is not present.
Tested-by: Robert Baldyga <r.baldyga@samsung.com>
Acked-by: Paul Zimmerman <paulz@synopsys.com>
Signed-off-by: Gregory Herrero <gregory.herrero@intel.com>
Signed-off-by: Mian Yousaf Kaukab <yousaf.kaukab@intel.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
Diffstat (limited to 'drivers/usb/dwc2')
| -rw-r--r-- | drivers/usb/dwc2/gadget.c | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/drivers/usb/dwc2/gadget.c b/drivers/usb/dwc2/gadget.c index e3bb525ae54d..65ec0f2dfab1 100644 --- a/drivers/usb/dwc2/gadget.c +++ b/drivers/usb/dwc2/gadget.c | |||
| @@ -3009,11 +3009,35 @@ static int s3c_hsotg_pullup(struct usb_gadget *gadget, int is_on) | |||
| 3009 | return 0; | 3009 | return 0; |
| 3010 | } | 3010 | } |
| 3011 | 3011 | ||
| 3012 | static int s3c_hsotg_vbus_session(struct usb_gadget *gadget, int is_active) | ||
| 3013 | { | ||
| 3014 | struct dwc2_hsotg *hsotg = to_hsotg(gadget); | ||
| 3015 | unsigned long flags; | ||
| 3016 | |||
| 3017 | dev_dbg(hsotg->dev, "%s: is_active: %d\n", __func__, is_active); | ||
| 3018 | spin_lock_irqsave(&hsotg->lock, flags); | ||
| 3019 | |||
| 3020 | if (is_active) { | ||
| 3021 | /* Kill any ep0 requests as controller will be reinitialized */ | ||
| 3022 | kill_all_requests(hsotg, hsotg->eps_out[0], -ECONNRESET); | ||
| 3023 | s3c_hsotg_core_init_disconnected(hsotg); | ||
| 3024 | if (hsotg->enabled) | ||
| 3025 | s3c_hsotg_core_connect(hsotg); | ||
| 3026 | } else { | ||
| 3027 | s3c_hsotg_core_disconnect(hsotg); | ||
| 3028 | s3c_hsotg_disconnect(hsotg); | ||
| 3029 | } | ||
| 3030 | |||
| 3031 | spin_unlock_irqrestore(&hsotg->lock, flags); | ||
| 3032 | return 0; | ||
| 3033 | } | ||
| 3034 | |||
| 3012 | static const struct usb_gadget_ops s3c_hsotg_gadget_ops = { | 3035 | static const struct usb_gadget_ops s3c_hsotg_gadget_ops = { |
| 3013 | .get_frame = s3c_hsotg_gadget_getframe, | 3036 | .get_frame = s3c_hsotg_gadget_getframe, |
| 3014 | .udc_start = s3c_hsotg_udc_start, | 3037 | .udc_start = s3c_hsotg_udc_start, |
| 3015 | .udc_stop = s3c_hsotg_udc_stop, | 3038 | .udc_stop = s3c_hsotg_udc_stop, |
| 3016 | .pullup = s3c_hsotg_pullup, | 3039 | .pullup = s3c_hsotg_pullup, |
| 3040 | .vbus_session = s3c_hsotg_vbus_session, | ||
| 3017 | }; | 3041 | }; |
| 3018 | 3042 | ||
| 3019 | /** | 3043 | /** |
