Skip to content

Commit 5f21952

Browse files
diandersandersson
authored andcommitted
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 <[email protected]> Reviewed-by: Akash Asthana <[email protected]> Signed-off-by: Douglas Anderson <[email protected]> Acked-by: Mark Brown <[email protected]> Link: https://lore.kernel.org/r/20200709074037.v2.1.I0b701fc23eca911a5bde4ae4fa7f97543d7f960e@changeid Signed-off-by: Bjorn Andersson <[email protected]>
1 parent 68890e2 commit 5f21952

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

drivers/spi/spi-geni-qcom.c

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,7 @@ struct spi_geni_master {
7878
u32 fifo_width_bits;
7979
u32 tx_wm;
8080
unsigned long cur_speed_hz;
81+
unsigned long cur_sclk_hz;
8182
unsigned int cur_bits_per_word;
8283
unsigned int tx_rem_bytes;
8384
unsigned int rx_rem_bytes;
@@ -115,6 +116,9 @@ static int get_spi_clk_cfg(unsigned int speed_hz,
115116
ret = dev_pm_opp_set_rate(mas->dev, sclk_freq);
116117
if (ret)
117118
dev_err(mas->dev, "dev_pm_opp_set_rate failed %d\n", ret);
119+
else
120+
mas->cur_sclk_hz = sclk_freq;
121+
118122
return ret;
119123
}
120124

@@ -674,7 +678,11 @@ static int __maybe_unused spi_geni_runtime_resume(struct device *dev)
674678
if (ret)
675679
return ret;
676680

677-
return geni_se_resources_on(&mas->se);
681+
ret = geni_se_resources_on(&mas->se);
682+
if (ret)
683+
return ret;
684+
685+
return dev_pm_opp_set_rate(mas->dev, mas->cur_sclk_hz);
678686
}
679687

680688
static int __maybe_unused spi_geni_suspend(struct device *dev)

0 commit comments

Comments
 (0)