From: Stephen Boyd <swboyd@chromium.org>
To: linux-kernel@vger.kernel.org
Cc: Rajendra Nayak <rnayak@codeaurora.org>,
linux-arm-msm@vger.kernel.org, linux-pm@vger.kernel.org,
linux-serial@vger.kernel.org, linux-spi@vger.kernel.org,
Ulf Hansson <ulf.hansson@linaro.org>,
Viresh Kumar <viresh.kumar@linaro.org>,
Doug Anderson <dianders@chromium.org>
Subject: [RFC/PATCH 4/5] spi: spi-geni-qcom: Use OPP API to set clk/perf state
Date: Mon, 28 Jan 2019 17:55:46 -0800 [thread overview]
Message-ID: <20190129015547.213276-5-swboyd@chromium.org> (raw)
In-Reply-To: <20190129015547.213276-1-swboyd@chromium.org>
From: Rajendra Nayak <rnayak@codeaurora.org>
geni spi needs to express a perforamnce state requirement on CX
depending on the frequency of the clock rates. Use OPP table from
DT to register with OPP framework and use dev_pm_opp_set_rate() to
set the clk/perf state.
Signed-off-by: Rajendra Nayak <rnayak@codeaurora.org>
Signed-off-by: Stephen Boyd <swboyd@chromium.org>
---
drivers/spi/spi-geni-qcom.c | 12 ++++++++++--
1 file changed, 10 insertions(+), 2 deletions(-)
diff --git a/drivers/spi/spi-geni-qcom.c b/drivers/spi/spi-geni-qcom.c
index fdb7cb88fb56..3ffb6b25b58d 100644
--- a/drivers/spi/spi-geni-qcom.c
+++ b/drivers/spi/spi-geni-qcom.c
@@ -116,9 +116,9 @@ static int get_spi_clk_cfg(unsigned int speed_hz,
dev_dbg(mas->dev, "req %u=>%u sclk %lu, idx %d, div %d\n", speed_hz,
actual_hz, sclk_freq, *clk_idx, *clk_div);
- ret = clk_set_rate(se->clk, sclk_freq);
+ ret = dev_pm_opp_set_rate(mas->dev, sclk_freq);
if (ret)
- dev_err(mas->dev, "clk_set_rate failed %d\n", ret);
+ dev_err(mas->dev, "dev_pm_opp_set_rate failed %d\n", ret);
return ret;
}
@@ -564,6 +564,12 @@ static int spi_geni_probe(struct platform_device *pdev)
if (!spi)
return -ENOMEM;
+ ret = dev_pm_opp_of_add_table(&pdev->dev);
+ if (ret < 0) {
+ dev_err(&pdev->dev, "failed to init OPP table: %d\n", ret);
+ return ret;
+ }
+
platform_set_drvdata(pdev, spi);
mas = spi_master_get_devdata(spi);
mas->irq = irq;
@@ -629,6 +635,8 @@ static int __maybe_unused spi_geni_runtime_suspend(struct device *dev)
struct spi_master *spi = dev_get_drvdata(dev);
struct spi_geni_master *mas = spi_master_get_devdata(spi);
+ /* Drop the performance state vote */
+ dev_pm_opp_set_rate(dev, 0);
return geni_se_resources_off(&mas->se);
}
--
Sent by a computer through tubes
next prev parent reply other threads:[~2019-01-29 1:56 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-01-29 1:55 [RFC/PATCH 0/5] DVFS in the OPP core Stephen Boyd
2019-01-29 1:55 ` [RFC/PATCH 1/5] OPP: Don't overwrite rounded clk rate Stephen Boyd
2019-01-29 1:55 ` [RFC/PATCH 2/5] OPP: Make dev_pm_opp_set_rate() with freq=0 as valid Stephen Boyd
2019-01-29 1:55 ` [RFC/PATCH 3/5] tty: serial: qcom_geni_serial: Use OPP API to set clk/perf state Stephen Boyd
2019-01-29 1:55 ` Stephen Boyd [this message]
2019-01-29 1:55 ` [RFC/PATCH 5/5] arm64: dts: sdm845: Add OPP table for all qup devices Stephen Boyd
2019-01-31 9:23 ` [RFC/PATCH 0/5] DVFS in the OPP core Viresh Kumar
2019-01-31 9:58 ` Rafael J. Wysocki
2019-01-31 10:06 ` Viresh Kumar
2019-01-31 10:36 ` Rafael J. Wysocki
2019-01-31 10:41 ` Viresh Kumar
2019-02-07 7:58 ` Stephen Boyd
2019-02-07 13:37 ` Ulf Hansson
2019-02-08 7:17 ` Viresh Kumar
2019-02-08 9:45 ` Ulf Hansson
2019-02-08 10:05 ` Viresh Kumar
2019-02-08 10:31 ` Ulf Hansson
2019-02-08 10:33 ` Viresh Kumar
2019-02-08 7:14 ` Viresh Kumar
2019-02-07 6:57 ` Rajendra Nayak
2019-02-07 19:47 ` Stephen Boyd
2019-02-08 4:39 ` 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=20190129015547.213276-5-swboyd@chromium.org \
--to=swboyd@chromium.org \
--cc=dianders@chromium.org \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=linux-serial@vger.kernel.org \
--cc=linux-spi@vger.kernel.org \
--cc=rnayak@codeaurora.org \
--cc=ulf.hansson@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).