From: Matthias Kaehlcke <mka@chromium.org>
To: Mark Brown <broonie@kernel.org>
Cc: Rajendra Nayak <rnayak@codeaurora.org>,
bjorn.andersson@linaro.org, agross@kernel.org,
robdclark@gmail.com, robdclark@chromium.org,
stanimir.varbanov@linaro.org, viresh.kumar@linaro.org,
sboyd@kernel.org, linux-arm-msm@vger.kernel.org,
linux-kernel@vger.kernel.org, Alok Chauhan <alokc@codeaurora.org>,
Akash Asthana <akashast@codeaurora.org>,
linux-spi@vger.kernel.org
Subject: Re: [PATCH v6 6/6] spi: spi-qcom-qspi: Use OPP API to set clk/perf state
Date: Wed, 24 Jun 2020 10:09:33 -0700 [thread overview]
Message-ID: <20200624170933.GB39073@google.com> (raw)
In-Reply-To: <1592222564-13556-7-git-send-email-rnayak@codeaurora.org>
Hi Mark,
do you plan to land this in your tree?
I know you hate contentless pings, but since you acked this patch and
usually don't seem to do that when patches go through your tree I want
to make sure we aren't in a situation where everybody thinks that the
patch will go through someone else's tree.
Thanks
Matthias
On Mon, Jun 15, 2020 at 05:32:44PM +0530, Rajendra Nayak wrote:
> QSPI needs to vote on a performance state of a power domain depending on
> the clock rate. Add support for it by specifying the perf state/clock rate
> as an OPP table in device tree.
>
> Signed-off-by: Rajendra Nayak <rnayak@codeaurora.org>
> Reviewed-by: Matthias Kaehlcke <mka@chromium.org>
> Acked-by: Mark Brown <broonie@kernel.org>
> Cc: Alok Chauhan <alokc@codeaurora.org>
> Cc: Akash Asthana <akashast@codeaurora.org>
> Cc: linux-spi@vger.kernel.org
> ---
> No functional change in v6, rebased over 5.8-rc1
>
> drivers/spi/spi-qcom-qspi.c | 28 +++++++++++++++++++++++++++-
> 1 file changed, 27 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/spi/spi-qcom-qspi.c b/drivers/spi/spi-qcom-qspi.c
> index 3c4f83b..ef51982 100644
> --- a/drivers/spi/spi-qcom-qspi.c
> +++ b/drivers/spi/spi-qcom-qspi.c
> @@ -8,6 +8,7 @@
> #include <linux/of.h>
> #include <linux/of_platform.h>
> #include <linux/pm_runtime.h>
> +#include <linux/pm_opp.h>
> #include <linux/spi/spi.h>
> #include <linux/spi/spi-mem.h>
>
> @@ -139,6 +140,8 @@ struct qcom_qspi {
> struct device *dev;
> struct clk_bulk_data *clks;
> struct qspi_xfer xfer;
> + struct opp_table *opp_table;
> + bool has_opp_table;
> /* Lock to protect xfer and IRQ accessed registers */
> spinlock_t lock;
> };
> @@ -235,7 +238,7 @@ static int qcom_qspi_transfer_one(struct spi_master *master,
> speed_hz = xfer->speed_hz;
>
> /* In regular operation (SBL_EN=1) core must be 4x transfer clock */
> - ret = clk_set_rate(ctrl->clks[QSPI_CLK_CORE].clk, speed_hz * 4);
> + ret = dev_pm_opp_set_rate(ctrl->dev, speed_hz * 4);
> if (ret) {
> dev_err(ctrl->dev, "Failed to set core clk %d\n", ret);
> return ret;
> @@ -481,6 +484,20 @@ static int qcom_qspi_probe(struct platform_device *pdev)
> master->handle_err = qcom_qspi_handle_err;
> master->auto_runtime_pm = true;
>
> + ctrl->opp_table = dev_pm_opp_set_clkname(&pdev->dev, "core");
> + if (IS_ERR(ctrl->opp_table)) {
> + ret = PTR_ERR(ctrl->opp_table);
> + goto exit_probe_master_put;
> + }
> + /* OPP table is optional */
> + ret = dev_pm_opp_of_add_table(&pdev->dev);
> + if (!ret) {
> + ctrl->has_opp_table = true;
> + } else if (ret != -ENODEV) {
> + dev_err(&pdev->dev, "invalid OPP table in device tree\n");
> + goto exit_probe_master_put;
> + }
> +
> pm_runtime_enable(dev);
>
> ret = spi_register_master(master);
> @@ -488,6 +505,9 @@ static int qcom_qspi_probe(struct platform_device *pdev)
> return 0;
>
> pm_runtime_disable(dev);
> + if (ctrl->has_opp_table)
> + dev_pm_opp_of_remove_table(&pdev->dev);
> + dev_pm_opp_put_clkname(ctrl->opp_table);
>
> exit_probe_master_put:
> spi_master_put(master);
> @@ -498,11 +518,15 @@ static int qcom_qspi_probe(struct platform_device *pdev)
> static int qcom_qspi_remove(struct platform_device *pdev)
> {
> struct spi_master *master = platform_get_drvdata(pdev);
> + struct qcom_qspi *ctrl = spi_master_get_devdata(master);
>
> /* Unregister _before_ disabling pm_runtime() so we stop transfers */
> spi_unregister_master(master);
>
> pm_runtime_disable(&pdev->dev);
> + if (ctrl->has_opp_table)
> + dev_pm_opp_of_remove_table(&pdev->dev);
> + dev_pm_opp_put_clkname(ctrl->opp_table);
>
> return 0;
> }
> @@ -512,6 +536,8 @@ static int __maybe_unused qcom_qspi_runtime_suspend(struct device *dev)
> struct spi_master *master = dev_get_drvdata(dev);
> struct qcom_qspi *ctrl = spi_master_get_devdata(master);
>
> + /* Drop the performance state vote */
> + dev_pm_opp_set_rate(dev, 0);
> clk_bulk_disable_unprepare(QSPI_NUM_CLKS, ctrl->clks);
>
> return 0;
> --
> 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-06-24 17:09 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <1592222564-13556-1-git-send-email-rnayak@codeaurora.org>
2020-06-15 12:02 ` [PATCH v6 2/6] spi: spi-geni-qcom: Use OPP API to set clk/perf state Rajendra Nayak
2020-06-15 12:02 ` [PATCH v6 6/6] spi: spi-qcom-qspi: " Rajendra Nayak
2020-06-24 17:09 ` Matthias Kaehlcke [this message]
2020-06-24 17:15 ` Mark Brown
2020-06-24 17:39 ` Matthias Kaehlcke
2020-06-24 17:44 ` Mark Brown
2020-06-24 17:55 ` Matthias Kaehlcke
2020-06-24 18:00 ` Mark Brown
2020-06-24 18:12 ` Matthias Kaehlcke
2020-06-24 18:15 ` Mark Brown
2020-06-25 15:25 ` Matthias Kaehlcke
2020-06-29 11:30 ` Rajendra Nayak
2020-06-29 10:57 ` 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=20200624170933.GB39073@google.com \
--to=mka@chromium.org \
--cc=agross@kernel.org \
--cc=akashast@codeaurora.org \
--cc=alokc@codeaurora.org \
--cc=bjorn.andersson@linaro.org \
--cc=broonie@kernel.org \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-spi@vger.kernel.org \
--cc=rnayak@codeaurora.org \
--cc=robdclark@chromium.org \
--cc=robdclark@gmail.com \
--cc=sboyd@kernel.org \
--cc=stanimir.varbanov@linaro.org \
--cc=viresh.kumar@linaro.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).