From: Rajendra Nayak <rnayak@codeaurora.org>
To: Douglas Anderson <dianders@chromium.org>,
Mark Brown <broonie@kernel.org>, Andy Gross <agross@kernel.org>,
Bjorn Andersson <bjorn.andersson@linaro.org>
Cc: linux-arm-msm@vger.kernel.org, akashast@codeaurora.org,
georgi.djakov@linaro.org, swboyd@chromium.org,
mkshah@codeaurora.org, ctheegal@codeaurora.org, mka@chromium.org,
linux-kernel@vger.kernel.org, linux-spi@vger.kernel.org
Subject: Re: [PATCH] spi: spi-geni-qcom: Set the clock properly at runtime resume
Date: Thu, 9 Jul 2020 14:25:38 +0530 [thread overview]
Message-ID: <23e53f2b-02b0-2c9b-a165-4ca5a2c84a89@codeaurora.org> (raw)
In-Reply-To: <20200708163922.1.I0b701fc23eca911a5bde4ae4fa7f97543d7f960e@changeid>
On 7/9/2020 5:09 AM, Douglas Anderson wrote:
> In the patch ("spi: spi-geni-qcom: Avoid clock setting if not needed")
> we avoid a whole pile of clock code. As part of that, we should have
> restored the clock at runtime resume. Do that.
>
> It turns out that, at least with today's configurations, this doesn't
> actually matter. That's because none of the current device trees have
> an OPP table for geni SPI yet. That makes dev_pm_opp_set_rate(dev, 0)
> a no-op. This is why it wasn't noticed in the testing of the original
> patch. It's still a good idea to fix, though.
good catch, without this (and with OPP tables added) we would end up removing
the performance vote on suspend and never put it back unless the rate changes.
Perhaps a similar change would be needed for spi-qcom-qspi too?
>
> Signed-off-by: Douglas Anderson <dianders@chromium.org>
> ---
> Sending this as a separate patch even though I think the patch it's
> fixing [1] hasn't landed yet. I'd be happy if this was squashed into
> that patch when landing if that suits everyone, but it could land on
> its own too.
>
> Like the patch it's fixing, this needs to target the Qualcomm tree in
> order to avoid merge conflicts.
>
> [1] https://lore.kernel.org/r/20200701174506.1.Icfdcee14649fc0a6c38e87477b28523d4e60bab3@changeid
>
> drivers/spi/spi-geni-qcom.c | 12 +++++++++++-
> 1 file changed, 11 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/spi/spi-geni-qcom.c b/drivers/spi/spi-geni-qcom.c
> index 97fac5ea6afd..e5ece1bcc4ad 100644
> --- a/drivers/spi/spi-geni-qcom.c
> +++ b/drivers/spi/spi-geni-qcom.c
> @@ -79,6 +79,7 @@ struct spi_geni_master {
> u32 tx_wm;
> u32 last_mode;
> unsigned long cur_speed_hz;
> + unsigned long cur_sclk_hz;
> unsigned int cur_bits_per_word;
> unsigned int tx_rem_bytes;
> unsigned int rx_rem_bytes;
> @@ -116,6 +117,9 @@ static int get_spi_clk_cfg(unsigned int speed_hz,
> ret = dev_pm_opp_set_rate(mas->dev, sclk_freq);
> if (ret)
> dev_err(mas->dev, "dev_pm_opp_set_rate failed %d\n", ret);
> + else
> + mas->cur_sclk_hz = sclk_freq;
> +
> return ret;
> }
>
> @@ -670,7 +674,13 @@ static int __maybe_unused spi_geni_runtime_resume(struct device *dev)
> if (ret)
> return ret;
>
> - return geni_se_resources_on(&mas->se);
> + ret = geni_se_resources_on(&mas->se);
> + if (ret)
> + return ret;
> +
> + dev_pm_opp_set_rate(mas->dev, mas->cur_sclk_hz);
> +
> + return 0;
> }
>
> static int __maybe_unused spi_geni_suspend(struct device *dev)
>
--
QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a member
of Code Aurora Forum, hosted by The Linux Foundation
next prev parent reply other threads:[~2020-07-09 8:55 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-07-08 23:39 [PATCH] spi: spi-geni-qcom: Set the clock properly at runtime resume Douglas Anderson
2020-07-09 7:30 ` Akash Asthana
2020-07-09 14:35 ` Doug Anderson
2020-07-09 8:55 ` Rajendra Nayak [this message]
2020-07-09 14:44 ` Doug Anderson
2020-07-09 11:22 ` Mark Brown
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=23e53f2b-02b0-2c9b-a165-4ca5a2c84a89@codeaurora.org \
--to=rnayak@codeaurora.org \
--cc=agross@kernel.org \
--cc=akashast@codeaurora.org \
--cc=bjorn.andersson@linaro.org \
--cc=broonie@kernel.org \
--cc=ctheegal@codeaurora.org \
--cc=dianders@chromium.org \
--cc=georgi.djakov@linaro.org \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-spi@vger.kernel.org \
--cc=mka@chromium.org \
--cc=mkshah@codeaurora.org \
--cc=swboyd@chromium.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;
as well as URLs for NNTP newsgroup(s).