summaryrefslogtreecommitdiffstats
path: root/drivers/spi/spi-geni-qcom.c
diff options
context:
space:
mode:
authorDouglas Anderson <dianders@chromium.org>2020-07-09 16:40:49 +0200
committerBjorn Andersson <bjorn.andersson@linaro.org>2020-07-14 01:30:01 +0200
commit5f219524ec6eae3591f9d7cfbf4d30fc457f1eec (patch)
treee0c52ad5da2331cb1739bbd7ea3da96d74129651 /drivers/spi/spi-geni-qcom.c
parentspi: spi-geni-qcom: Avoid clock setting if not needed (diff)
downloadlinux-5f219524ec6eae3591f9d7cfbf4d30fc457f1eec.tar.xz
linux-5f219524ec6eae3591f9d7cfbf4d30fc457f1eec.zip
spi: spi-geni-qcom: Set the clock properly at runtime resume
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. Reviewed-by: Rajendra Nayak <rnayak@codeaurora.org> Reviewed-by: Akash Asthana <akashast@codeaurora.org> Signed-off-by: Douglas Anderson <dianders@chromium.org> Acked-by: Mark Brown <broonie@kernel.org> Link: https://lore.kernel.org/r/20200709074037.v2.1.I0b701fc23eca911a5bde4ae4fa7f97543d7f960e@changeid Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
Diffstat (limited to 'drivers/spi/spi-geni-qcom.c')
-rw-r--r--drivers/spi/spi-geni-qcom.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/drivers/spi/spi-geni-qcom.c b/drivers/spi/spi-geni-qcom.c
index bb4cdda2dec8..cbc1ff3203e6 100644
--- a/drivers/spi/spi-geni-qcom.c
+++ b/drivers/spi/spi-geni-qcom.c
@@ -78,6 +78,7 @@ struct spi_geni_master {
u32 fifo_width_bits;
u32 tx_wm;
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;
@@ -115,6 +116,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;
}
@@ -674,7 +678,11 @@ 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;
+
+ return dev_pm_opp_set_rate(mas->dev, mas->cur_sclk_hz);
}
static int __maybe_unused spi_geni_suspend(struct device *dev)