Skip to content

Commit d9be8d5

Browse files
Sandeep Maheswaramgregkh
authored andcommitted
usb: dwc3: qcom: Keep power domain on to retain controller status
If dwc3 is wakeup capable, keep the power domain always ON so that wakeup from system suspend can be supported. Otherwise, keep the power domain ON only during runtime suspend to support wakeup from runtime suspend. Reviewed-by: Pavankumar Kondeti <[email protected]> Signed-off-by: Sandeep Maheswaram <[email protected]> Signed-off-by: Krishna Kurapati <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent 6895ea5 commit d9be8d5

File tree

1 file changed

+21
-7
lines changed

1 file changed

+21
-7
lines changed

drivers/usb/dwc3/dwc3-qcom.c

Lines changed: 21 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
#include <linux/of_platform.h>
1818
#include <linux/platform_device.h>
1919
#include <linux/phy/phy.h>
20+
#include <linux/pm_domain.h>
2021
#include <linux/usb/of.h>
2122
#include <linux/reset.h>
2223
#include <linux/iopoll.h>
@@ -756,12 +757,13 @@ dwc3_qcom_create_urs_usb_platdev(struct device *dev)
756757

757758
static int dwc3_qcom_probe(struct platform_device *pdev)
758759
{
759-
struct device_node *np = pdev->dev.of_node;
760-
struct device *dev = &pdev->dev;
761-
struct dwc3_qcom *qcom;
762-
struct resource *res, *parent_res = NULL;
763-
int ret, i;
764-
bool ignore_pipe_clk;
760+
struct device_node *np = pdev->dev.of_node;
761+
struct device *dev = &pdev->dev;
762+
struct dwc3_qcom *qcom;
763+
struct resource *res, *parent_res = NULL;
764+
int ret, i;
765+
bool ignore_pipe_clk;
766+
struct generic_pm_domain *genpd;
765767

766768
qcom = devm_kzalloc(&pdev->dev, sizeof(*qcom), GFP_KERNEL);
767769
if (!qcom)
@@ -770,6 +772,8 @@ static int dwc3_qcom_probe(struct platform_device *pdev)
770772
platform_set_drvdata(pdev, qcom);
771773
qcom->dev = &pdev->dev;
772774

775+
genpd = pd_to_genpd(qcom->dev->pm_domain);
776+
773777
if (has_acpi_companion(dev)) {
774778
qcom->acpi_pdata = acpi_device_get_match_data(dev);
775779
if (!qcom->acpi_pdata) {
@@ -877,7 +881,17 @@ static int dwc3_qcom_probe(struct platform_device *pdev)
877881
if (ret)
878882
goto interconnect_exit;
879883

880-
device_init_wakeup(&pdev->dev, 1);
884+
if (device_can_wakeup(&qcom->dwc3->dev)) {
885+
/*
886+
* Setting GENPD_FLAG_ALWAYS_ON flag takes care of keeping
887+
* genpd on in both runtime suspend and system suspend cases.
888+
*/
889+
genpd->flags |= GENPD_FLAG_ALWAYS_ON;
890+
device_init_wakeup(&pdev->dev, true);
891+
} else {
892+
genpd->flags |= GENPD_FLAG_RPM_ALWAYS_ON;
893+
}
894+
881895
qcom->is_suspended = false;
882896
pm_runtime_set_active(dev);
883897
pm_runtime_enable(dev);

0 commit comments

Comments
 (0)