2022-08-05 12:54:45

by Johan Hovold

[permalink] [raw]
Subject: [PATCH 0/2] clk: gcc-sc8280xp: fix broken suspend

The Qualcomm PCIe driver currently does not implement suspend at all so
we need to mark the GDSCs as always-on to prevent genpd from disabling
them.

Similarly, the Qualcomm dwc3 USB suspend implementation is also
incomplete and the controller doesn't currently survive a suspend cycle
unless the GDSC is kept on. Note that this has nothing to with whether
wakeup is enabled or not (cf. [1]).

With these two workarounds, we have somewhat functional suspend on the
SC8280XP reference design and Lenovo Thinkpad X13s until the missing
driver support is in place (even USB remote wakeup works with [2]
applied).

Johan

[1] https://lore.kernel.org/all/[email protected]/
[2] https://lore.kernel.org/all/[email protected]/


Johan Hovold (2):
clk: gcc-sc8280xp: keep PCIe power-domains always-on
clk: gcc-sc8280xp: keep USB power-domains always-on

drivers/clk/qcom/gcc-sc8280xp.c | 21 ++++++++++++++++-----
1 file changed, 16 insertions(+), 5 deletions(-)

--
2.35.1



2022-08-05 12:55:23

by Johan Hovold

[permalink] [raw]
Subject: [PATCH 1/2] clk: gcc-sc8280xp: keep PCIe power-domains always-on

The Qualcomm PCIe driver does not yet implement suspend so to keep the
PCIe power domains always-on for now to avoid crashing during resume.

Signed-off-by: Johan Hovold <[email protected]>
---
drivers/clk/qcom/gcc-sc8280xp.c | 14 +++++++++-----
1 file changed, 9 insertions(+), 5 deletions(-)

diff --git a/drivers/clk/qcom/gcc-sc8280xp.c b/drivers/clk/qcom/gcc-sc8280xp.c
index a2f3ffcc5849..eaeada42e13a 100644
--- a/drivers/clk/qcom/gcc-sc8280xp.c
+++ b/drivers/clk/qcom/gcc-sc8280xp.c
@@ -6768,6 +6768,10 @@ static struct gdsc pcie_1_tunnel_gdsc = {
.flags = VOTABLE,
};

+/*
+ * The Qualcomm PCIe driver does not yet implement suspend so to keep the
+ * PCIe power domains always-on for now.
+ */
static struct gdsc pcie_2a_gdsc = {
.gdscr = 0x9d004,
.collapse_ctrl = 0x52128,
@@ -6776,7 +6780,7 @@ static struct gdsc pcie_2a_gdsc = {
.name = "pcie_2a_gdsc",
},
.pwrsts = PWRSTS_OFF_ON,
- .flags = VOTABLE,
+ .flags = VOTABLE | ALWAYS_ON,
};

static struct gdsc pcie_2b_gdsc = {
@@ -6787,7 +6791,7 @@ static struct gdsc pcie_2b_gdsc = {
.name = "pcie_2b_gdsc",
},
.pwrsts = PWRSTS_OFF_ON,
- .flags = VOTABLE,
+ .flags = VOTABLE | ALWAYS_ON,
};

static struct gdsc pcie_3a_gdsc = {
@@ -6798,7 +6802,7 @@ static struct gdsc pcie_3a_gdsc = {
.name = "pcie_3a_gdsc",
},
.pwrsts = PWRSTS_OFF_ON,
- .flags = VOTABLE,
+ .flags = VOTABLE | ALWAYS_ON,
};

static struct gdsc pcie_3b_gdsc = {
@@ -6809,7 +6813,7 @@ static struct gdsc pcie_3b_gdsc = {
.name = "pcie_3b_gdsc",
},
.pwrsts = PWRSTS_OFF_ON,
- .flags = VOTABLE,
+ .flags = VOTABLE | ALWAYS_ON,
};

static struct gdsc pcie_4_gdsc = {
@@ -6820,7 +6824,7 @@ static struct gdsc pcie_4_gdsc = {
.name = "pcie_4_gdsc",
},
.pwrsts = PWRSTS_OFF_ON,
- .flags = VOTABLE,
+ .flags = VOTABLE | ALWAYS_ON,
};

static struct gdsc ufs_card_gdsc = {
--
2.35.1


2022-08-06 15:16:46

by Manivannan Sadhasivam

[permalink] [raw]
Subject: Re: [PATCH 1/2] clk: gcc-sc8280xp: keep PCIe power-domains always-on

On Fri, Aug 05, 2022 at 02:12:49PM +0200, Johan Hovold wrote:
> The Qualcomm PCIe driver does not yet implement suspend so to keep the
> PCIe power domains always-on for now to avoid crashing during resume.
>
> Signed-off-by: Johan Hovold <[email protected]>

Reviewed-by: Manivannan Sadhasivam <[email protected]>

Thanks,
Mani

> ---
> drivers/clk/qcom/gcc-sc8280xp.c | 14 +++++++++-----
> 1 file changed, 9 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/clk/qcom/gcc-sc8280xp.c b/drivers/clk/qcom/gcc-sc8280xp.c
> index a2f3ffcc5849..eaeada42e13a 100644
> --- a/drivers/clk/qcom/gcc-sc8280xp.c
> +++ b/drivers/clk/qcom/gcc-sc8280xp.c
> @@ -6768,6 +6768,10 @@ static struct gdsc pcie_1_tunnel_gdsc = {
> .flags = VOTABLE,
> };
>
> +/*
> + * The Qualcomm PCIe driver does not yet implement suspend so to keep the
> + * PCIe power domains always-on for now.
> + */
> static struct gdsc pcie_2a_gdsc = {
> .gdscr = 0x9d004,
> .collapse_ctrl = 0x52128,
> @@ -6776,7 +6780,7 @@ static struct gdsc pcie_2a_gdsc = {
> .name = "pcie_2a_gdsc",
> },
> .pwrsts = PWRSTS_OFF_ON,
> - .flags = VOTABLE,
> + .flags = VOTABLE | ALWAYS_ON,
> };
>
> static struct gdsc pcie_2b_gdsc = {
> @@ -6787,7 +6791,7 @@ static struct gdsc pcie_2b_gdsc = {
> .name = "pcie_2b_gdsc",
> },
> .pwrsts = PWRSTS_OFF_ON,
> - .flags = VOTABLE,
> + .flags = VOTABLE | ALWAYS_ON,
> };
>
> static struct gdsc pcie_3a_gdsc = {
> @@ -6798,7 +6802,7 @@ static struct gdsc pcie_3a_gdsc = {
> .name = "pcie_3a_gdsc",
> },
> .pwrsts = PWRSTS_OFF_ON,
> - .flags = VOTABLE,
> + .flags = VOTABLE | ALWAYS_ON,
> };
>
> static struct gdsc pcie_3b_gdsc = {
> @@ -6809,7 +6813,7 @@ static struct gdsc pcie_3b_gdsc = {
> .name = "pcie_3b_gdsc",
> },
> .pwrsts = PWRSTS_OFF_ON,
> - .flags = VOTABLE,
> + .flags = VOTABLE | ALWAYS_ON,
> };
>
> static struct gdsc pcie_4_gdsc = {
> @@ -6820,7 +6824,7 @@ static struct gdsc pcie_4_gdsc = {
> .name = "pcie_4_gdsc",
> },
> .pwrsts = PWRSTS_OFF_ON,
> - .flags = VOTABLE,
> + .flags = VOTABLE | ALWAYS_ON,
> };
>
> static struct gdsc ufs_card_gdsc = {
> --
> 2.35.1
>

--
மணிவண்ணன் சதாசிவம்