public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Matthias Kaehlcke <mka@chromium.org>
To: Rajendra Nayak <quic_rjendra@quicinc.com>
Cc: Bjorn Andersson <andersson@kernel.org>,
	Andy Gross <agross@kernel.org>,
	Konrad Dybcio <konrad.dybcio@somainline.org>,
	Michael Turquette <mturquette@baylibre.com>,
	Stephen Boyd <sboyd@kernel.org>,
	Johan Hovold <johan+linaro@kernel.org>,
	linux-clk@vger.kernel.org,
	Krishna Kurapati <quic_kriskura@quicinc.com>,
	linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org,
	Douglas Anderson <dianders@chromium.org>,
	Bjorn Andersson <bjorn.andersson@linaro.org>
Subject: Re: [PATCH v2 1/2] clk: qcom: gcc-sc7180: Keep the USB GDSC always on
Date: Tue, 30 Aug 2022 11:43:57 -0700	[thread overview]
Message-ID: <Yw5abfBHQSl62pB9@google.com> (raw)
In-Reply-To: <5ff21b1e-3af9-36ef-e13e-fa33f526d0e3@quicinc.com>

On Mon, Aug 29, 2022 at 01:42:02PM +0530, Rajendra Nayak wrote:
> 
> On 8/26/2022 8:10 AM, Bjorn Andersson wrote:
> > On Thu, Aug 25, 2022 at 06:21:58PM -0700, Matthias Kaehlcke wrote:
> > > When the GDSC is disabled during system suspend USB is broken on
> > > sc7180 when the system resumes. Mark the GDSC as always on to
> > > make sure USB still works after system suspend.
> > > 
> > > Signed-off-by: Matthias Kaehlcke <mka@chromium.org>
> > 
> > Rajendra, where you able to find some time to look into take the GDSC
> > into retention state? Do you suggest that I merge these two patches for
> > now?
> > 
> 
> Hi Bjorn, based on my experiments to support retention on sc7280 these are
> some of my findings
> 
> On Platforms which support CX retention (for example sc7180/sc7280) instead of
> CX PowerCollapse (PC), We can leave the GDSC turned ON. When CX transitions to RET state
> the GDSC goes into retention too (some controller state is retained) and USB wakeups work.
> 
> On platforms which support CX PC, just leaving the GDSC
> turned ON will not help since the GDSC will also transition to OFF state
> when we enter CX PC, hence wake-ups from USB won't work.
> For such platforms we need to make sure gdsc_force_mem_on() is called
> and cxcs (* @cxcs: offsets of branch registers to toggle mem/periph bits in)
> are populated correctly, while leaving the GDSC turned ON.
> This will make sure usb gdsc transitions from being powered by CX to MX
> when CX hits PC and we still get USB wakeups to work.
> So in short we could do the same thing that this patch does on those
> platforms too with additionally populating the right cxcs entries and it
> should just work fine.
> 
> Now the problem that I see with this approach is not with getting USB wakeups
> to work in suspend, but with supporting performance state voting when
> USB is active.
> The last conclusion we had on that [1] was to model usb_gdsc as a subdomain of CX,
> so if we do that and we model usb_gdsc as something that supports ALWAYS_ON,
> we would _never_ drop the CX vote and prevent CX from going down (either to ret
> or pc)
> 
> The only way I think we can solve both the USB wakeups and performance state
> needs (with usb_gdsc as a subdomain of CX) is if we can model a RET state for gdsc
> which sets the mem/periph bits while leaving the GDSC ON (Today the RET state sets
> the mem/periph bits but turns the GDSC OFF)
> 
> That would mean a change in gdsc.c like this
> ---
> 
> diff --git a/drivers/clk/qcom/gdsc.c b/drivers/clk/qcom/gdsc.c
> index d3244006c661..0fe017ba901b 100644
> --- a/drivers/clk/qcom/gdsc.c
> +++ b/drivers/clk/qcom/gdsc.c
> @@ -368,6 +368,10 @@ static int _gdsc_disable(struct gdsc *sc)
>         if (sc->pwrsts & PWRSTS_OFF)
>                 gdsc_clear_mem_on(sc);
> 
> +       /* If the GDSC supports RET, do not explicitly power it off */
> +       if (sc->pwrsts & PWRSTS_RET)
> +               return 0;
> +
>         ret = gdsc_toggle_logic(sc, GDSC_OFF);
>         if (ret)
>                 return ret;
> 
> 
> So with that change, we would then not need the ALWAYS_ON flag set for usb gdsc,
> instead we would update the .pwrsts to PWRSTS_RET_ON instead of PWRSTS_OFF_ON,
> and that should make both usb wake-ups to work and we can still have the usb_gdsc as
> a subdomain of CX for performance state voting.

Krishna and I confirmed that this works from the USB side for sc7180 and sc7280.

  reply	other threads:[~2022-08-30 18:44 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-08-26  1:21 [PATCH v2 1/2] clk: qcom: gcc-sc7180: Keep the USB GDSC always on Matthias Kaehlcke
2022-08-26  1:21 ` [PATCH v2 2/2] clk: qcom: gcc-sc7280: Keep the USB GDSCs " Matthias Kaehlcke
2022-08-26  7:16   ` Johan Hovold
2022-08-26 15:12     ` Matthias Kaehlcke
2022-08-26  2:40 ` [PATCH v2 1/2] clk: qcom: gcc-sc7180: Keep the USB GDSC " Bjorn Andersson
2022-08-29  8:12   ` Rajendra Nayak
2022-08-30 18:43     ` Matthias Kaehlcke [this message]
2022-08-30 21:35     ` Stephen Boyd
2022-09-01  5:46       ` Rajendra Nayak

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=Yw5abfBHQSl62pB9@google.com \
    --to=mka@chromium.org \
    --cc=agross@kernel.org \
    --cc=andersson@kernel.org \
    --cc=bjorn.andersson@linaro.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=mturquette@baylibre.com \
    --cc=quic_kriskura@quicinc.com \
    --cc=quic_rjendra@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