aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/usb')
-rw-r--r--drivers/usb/host/xhci.c70
1 files changed, 43 insertions, 27 deletions
diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c
index 4ceba145fa88..ad9ef056d368 100644
--- a/drivers/usb/host/xhci.c
+++ b/drivers/usb/host/xhci.c
@@ -3837,8 +3837,43 @@ int xhci_set_usb2_hardware_lpm(struct usb_hcd *hcd,
3837 return 0; 3837 return 0;
3838} 3838}
3839 3839
3840int xhci_update_device(struct usb_hcd *hcd, struct usb_device *udev)
3841{
3842 struct xhci_hcd *xhci = hcd_to_xhci(hcd);
3843 int ret;
3844
3845 ret = xhci_usb2_software_lpm_test(hcd, udev);
3846 if (!ret) {
3847 xhci_dbg(xhci, "software LPM test succeed\n");
3848 if (xhci->hw_lpm_support == 1) {
3849 udev->usb2_hw_lpm_capable = 1;
3850 ret = xhci_set_usb2_hardware_lpm(hcd, udev, 1);
3851 if (!ret)
3852 udev->usb2_hw_lpm_enabled = 1;
3853 }
3854 }
3855
3856 return 0;
3857}
3858
3859#else
3860
3861int xhci_set_usb2_hardware_lpm(struct usb_hcd *hcd,
3862 struct usb_device *udev, int enable)
3863{
3864 return 0;
3865}
3866
3867int xhci_update_device(struct usb_hcd *hcd, struct usb_device *udev)
3868{
3869 return 0;
3870}
3871
3872#endif /* CONFIG_USB_SUSPEND */
3873
3840/*---------------------- USB 3.0 Link PM functions ------------------------*/ 3874/*---------------------- USB 3.0 Link PM functions ------------------------*/
3841 3875
3876#ifdef CONFIG_PM
3842/* Service interval in nanoseconds = 2^(bInterval - 1) * 125us * 1000ns / 1us */ 3877/* Service interval in nanoseconds = 2^(bInterval - 1) * 125us * 1000ns / 1us */
3843static unsigned long long xhci_service_interval_to_ns( 3878static unsigned long long xhci_service_interval_to_ns(
3844 struct usb_endpoint_descriptor *desc) 3879 struct usb_endpoint_descriptor *desc)
@@ -4287,41 +4322,22 @@ int xhci_disable_usb3_lpm_timeout(struct usb_hcd *hcd,
4287 return ret; 4322 return ret;
4288 return 0; 4323 return 0;
4289} 4324}
4290/*-------------------------------------------------------------------------*/ 4325#else /* CONFIG_PM */
4291
4292int xhci_update_device(struct usb_hcd *hcd, struct usb_device *udev)
4293{
4294 struct xhci_hcd *xhci = hcd_to_xhci(hcd);
4295 int ret;
4296
4297 ret = xhci_usb2_software_lpm_test(hcd, udev);
4298 if (!ret) {
4299 xhci_dbg(xhci, "software LPM test succeed\n");
4300 if (xhci->hw_lpm_support == 1) {
4301 udev->usb2_hw_lpm_capable = 1;
4302 ret = xhci_set_usb2_hardware_lpm(hcd, udev, 1);
4303 if (!ret)
4304 udev->usb2_hw_lpm_enabled = 1;
4305 }
4306 }
4307 4326
4308 return 0; 4327int xhci_enable_usb3_lpm_timeout(struct usb_hcd *hcd,
4309} 4328 struct usb_device *udev, enum usb3_link_state state)
4310
4311#else
4312
4313int xhci_set_usb2_hardware_lpm(struct usb_hcd *hcd,
4314 struct usb_device *udev, int enable)
4315{ 4329{
4316 return 0; 4330 return USB3_LPM_DISABLED;
4317} 4331}
4318 4332
4319int xhci_update_device(struct usb_hcd *hcd, struct usb_device *udev) 4333int xhci_disable_usb3_lpm_timeout(struct usb_hcd *hcd,
4334 struct usb_device *udev, enum usb3_link_state state)
4320{ 4335{
4321 return 0; 4336 return 0;
4322} 4337}
4338#endif /* CONFIG_PM */
4323 4339
4324#endif /* CONFIG_USB_SUSPEND */ 4340/*-------------------------------------------------------------------------*/
4325 4341
4326/* Once a hub descriptor is fetched for a device, we need to update the xHC's 4342/* Once a hub descriptor is fetched for a device, we need to update the xHC's
4327 * internal data structures for the device. 4343 * internal data structures for the device.