mirror of
https://github.com/torvalds/linux.git
synced 2024-11-23 12:42:02 +00:00
iio: adc: stm32-dfsdm: add check on spi-max-frequency
spi-max-frequency is requested for SPI master mode (only), to tune output clock. It may happen requested frequency isn't reachable. Add explicit check, so probe fails with error in this case. Otherwise, output clock may simply be silently turned off (conversions fail). Signed-off-by: Fabrice Gasnier <fabrice.gasnier@st.com> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
This commit is contained in:
parent
dfa105b1f6
commit
4cfcb2bfdd
@ -219,6 +219,11 @@ static int stm32_dfsdm_parse_of(struct platform_device *pdev,
|
||||
}
|
||||
|
||||
priv->spi_clk_out_div = div_u64_rem(clk_freq, spi_freq, &rem) - 1;
|
||||
if (!priv->spi_clk_out_div) {
|
||||
/* spi_clk_out_div == 0 means ckout is OFF */
|
||||
dev_err(&pdev->dev, "spi-max-frequency not achievable\n");
|
||||
return -EINVAL;
|
||||
}
|
||||
priv->dfsdm.spi_master_freq = spi_freq;
|
||||
|
||||
if (rem) {
|
||||
|
Loading…
Reference in New Issue
Block a user