summaryrefslogtreecommitdiff
path: root/drivers/usb
diff options
context:
space:
mode:
authorArtur Petrosyan <Arthur.Petrosyan@synopsys.com>2021-04-16 15:48:10 +0300
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2021-04-22 12:55:34 +0300
commit755d0effebb82caf397b719602b9e76b1d5e2831 (patch)
tree24dad62e177f267e77a52e6bb4fd9f1d949b3fd5 /drivers/usb
parentc3595df7a6115db74dfc23b0bac214c0ec62cad8 (diff)
downloadlinux-755d0effebb82caf397b719602b9e76b1d5e2831.tar.xz
usb: dwc2: Add hibernation entering flow by system suspend
Adds a new flow of entering hibernation when PC is hibernated or suspended. Acked-by: Minas Harutyunyan <Minas.Harutyunyan@synopsys.com> Signed-off-by: Artur Petrosyan <Arthur.Petrosyan@synopsys.com> Link: https://lore.kernel.org/r/20210416124811.BBFDBA005C@mailhost.synopsys.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/usb')
-rw-r--r--drivers/usb/dwc2/hcd.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/drivers/usb/dwc2/hcd.c b/drivers/usb/dwc2/hcd.c
index 093b1717df01..92848629cc61 100644
--- a/drivers/usb/dwc2/hcd.c
+++ b/drivers/usb/dwc2/hcd.c
@@ -4387,6 +4387,16 @@ static int _dwc2_hcd_suspend(struct usb_hcd *hcd)
clear_bit(HCD_FLAG_HW_ACCESSIBLE, &hcd->flags);
break;
case DWC2_POWER_DOWN_PARAM_HIBERNATION:
+ /* Enter hibernation */
+ spin_unlock_irqrestore(&hsotg->lock, flags);
+ ret = dwc2_enter_hibernation(hsotg, 1);
+ if (ret)
+ dev_err(hsotg->dev, "enter hibernation failed\n");
+ spin_lock_irqsave(&hsotg->lock, flags);
+
+ /* After entering suspend, hardware is not accessible */
+ clear_bit(HCD_FLAG_HW_ACCESSIBLE, &hcd->flags);
+ break;
case DWC2_POWER_DOWN_PARAM_NONE:
/*
* If not hibernation nor partial power down are supported,