From: Rajendra Nayak <quic_rjendra@quicinc.com>
To: <andersson@kernel.org>, <agross@kernel.org>,
<konrad.dybcio@somainline.org>, <mturquette@baylibre.com>,
<sboyd@kernel.org>, <mka@chromium.org>
Cc: <johan+linaro@kernel.org>, <quic_kriskura@quicinc.com>,
<dianders@chromium.org>, <linux-clk@vger.kernel.org>,
<linux-arm-msm@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
AngeloGioacchino Del Regno
<angelogioacchino.delregno@somainline.org>,
Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>,
"Krishna chaitanya chundru" <quic_krichai@quicinc.com>
Subject: Re: [PATCH 1/3] clk: qcom: gdsc: Fix the handling of PWRSTS_RET support
Date: Wed, 14 Sep 2022 09:37:29 +0530 [thread overview]
Message-ID: <273d4d8d-8ffd-8d7f-ef82-4287d6256fcc@quicinc.com> (raw)
In-Reply-To: <20220901101756.28164-1-quic_rjendra@quicinc.com>
On 9/1/2022 3:47 PM, Rajendra Nayak wrote:
> GDSCs cannot be transitioned into a Retention state in SW.
> When either the RETAIN_MEM bit, or both the RETAIN_MEM and
> RETAIN_PERIPH bits are set, and the GDSC is left ON, the HW
> takes care of retaining the memory/logic for the domain when
> the parent domain transitions to low power state.
> The existing logic handling the PWRSTS_RET seems to set the
> RETAIN_MEM/RETAIN_PERIPH bits but then explicitly turns the
> GDSC OFF as part of _gdsc_disable(). Fix that by leaving the
> GDSC in ON state.
Any thoughts on this patch? We now have at-least one more user,
PCIe [1] that wants to follow in the footsteps of USB and use RET
state to support wake-ups from low power state.
[1] https://lore.kernel.org/lkml/20220913164233.GF25849@workstation/
>
> Signed-off-by: Rajendra Nayak <quic_rjendra@quicinc.com>
> Cc: AngeloGioacchino Del Regno <angelogioacchino.delregno@somainline.org>
> ---
> There are a few existing users of PWRSTS_RET and I am not
> sure if they would be impacted with this change
>
> 1. mdss_gdsc in mmcc-msm8974.c, I am expecting that the
> gdsc is actually transitioning to OFF and might be left
> ON as part of this change, atleast till we hit system wide
> low power state.
> If we really leak more power because of this
> change, the right thing to do would be to update .pwrsts for
> mdss_gdsc to PWRSTS_OFF_ON instead of PWRSTS_RET_ON
> I dont have a msm8974 hardware, so if anyone who has can report
> any issues I can take a look further on how to fix it.
>
> 2. gpu_gx_gdsc in gpucc-msm8998.c and
> gpu_gx_gdsc in gpucc-sdm660.c
> Both of these seem to add support for 3 power state
> OFF, RET and ON, however I dont see any logic in gdsc
> driver to handle 3 different power states.
> So I am expecting that these are infact just transitioning
> between ON and OFF and RET state is never really used.
> The ideal fix for them would be to just update their resp.
> .pwrsts to PWRSTS_OFF_ON only.
>
> drivers/clk/qcom/gdsc.c | 10 ++++++++++
> drivers/clk/qcom/gdsc.h | 5 +++++
> 2 files changed, 15 insertions(+)
>
> diff --git a/drivers/clk/qcom/gdsc.c b/drivers/clk/qcom/gdsc.c
> index d3244006c661..ccf63771e852 100644
> --- a/drivers/clk/qcom/gdsc.c
> +++ b/drivers/clk/qcom/gdsc.c
> @@ -368,6 +368,16 @@ static int _gdsc_disable(struct gdsc *sc)
> if (sc->pwrsts & PWRSTS_OFF)
> gdsc_clear_mem_on(sc);
>
> + /*
> + * If the GDSC supports only a Retention state, apart from ON,
> + * leave it in ON state.
> + * There is no SW control to transition the GDSC into
> + * Retention state. This happens in HW when the parent
> + * domain goes down to a Low power state
> + */
> + if (sc->pwrsts == PWRSTS_RET_ON)
> + return 0;
> +
> ret = gdsc_toggle_logic(sc, GDSC_OFF);
> if (ret)
> return ret;
> diff --git a/drivers/clk/qcom/gdsc.h b/drivers/clk/qcom/gdsc.h
> index 5de48c9439b2..981a12c8502d 100644
> --- a/drivers/clk/qcom/gdsc.h
> +++ b/drivers/clk/qcom/gdsc.h
> @@ -49,6 +49,11 @@ struct gdsc {
> const u8 pwrsts;
> /* Powerdomain allowable state bitfields */
> #define PWRSTS_OFF BIT(0)
> +/*
> + * There is no SW control to transition a GDSC into
> + * PWRSTS_RET. This happens in HW when the parent
> + * domain goes down to a low power state
> + */
> #define PWRSTS_RET BIT(1)
> #define PWRSTS_ON BIT(2)
> #define PWRSTS_OFF_ON (PWRSTS_OFF | PWRSTS_ON)
prev parent reply other threads:[~2022-09-14 4:07 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-09-01 10:17 [PATCH 1/3] clk: qcom: gdsc: Fix the handling of PWRSTS_RET support Rajendra Nayak
2022-09-01 10:17 ` [PATCH 2/3] clk: qcom: gcc-sc7180: Update the .pwrsts for usb gdsc Rajendra Nayak
2022-09-01 16:04 ` Matthias Kaehlcke
2022-09-01 10:17 ` [PATCH 3/3] clk: qcom: gcc-sc7280: " Rajendra Nayak
2022-09-01 16:04 ` Matthias Kaehlcke
2022-09-14 7:12 ` Johan Hovold
2022-09-14 21:23 ` Matthias Kaehlcke
2022-09-15 7:25 ` Rajendra Nayak
2022-09-15 13:29 ` Rajendra Nayak
2022-09-15 16:43 ` Matthias Kaehlcke
2022-09-14 7:09 ` Johan Hovold
2022-09-14 8:37 ` Krishna Kurapati PSSNV
2022-09-14 8:53 ` Johan Hovold
2022-09-14 8:58 ` Rajendra Nayak
2022-09-14 9:07 ` Johan Hovold
2022-09-14 11:42 ` Krishna Kurapati PSSNV
2022-09-12 15:40 ` [PATCH 1/3] clk: qcom: gdsc: Fix the handling of PWRSTS_RET support Matthias Kaehlcke
2022-09-14 4:07 ` Rajendra Nayak [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=273d4d8d-8ffd-8d7f-ef82-4287d6256fcc@quicinc.com \
--to=quic_rjendra@quicinc.com \
--cc=agross@kernel.org \
--cc=andersson@kernel.org \
--cc=angelogioacchino.delregno@somainline.org \
--cc=dianders@chromium.org \
--cc=johan+linaro@kernel.org \
--cc=konrad.dybcio@somainline.org \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-clk@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=manivannan.sadhasivam@linaro.org \
--cc=mka@chromium.org \
--cc=mturquette@baylibre.com \
--cc=quic_krichai@quicinc.com \
--cc=quic_kriskura@quicinc.com \
--cc=sboyd@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox