Commit 8543537c authored by Miquel Raynal's avatar Miquel Raynal Committed by Lee Jones

mfd: ti_am335x_tscadc: Simplify divisor calculation

Let's rewrite this on a single line, it does not hurt the readability
and saves a useless temporary variable.
Signed-off-by: default avatarMiquel Raynal <miquel.raynal@bootlin.com>
Reviewed-by: default avatarJonathan Cameron <Jonathan.Cameron@huawei.com>
Signed-off-by: default avatarLee Jones <lee.jones@linaro.org>
Link: https://lore.kernel.org/r/20211015081506.933180-16-miquel.raynal@bootlin.com
parent 235a96e9
...@@ -122,7 +122,6 @@ static int ti_tscadc_probe(struct platform_device *pdev) ...@@ -122,7 +122,6 @@ static int ti_tscadc_probe(struct platform_device *pdev)
const __be32 *cur; const __be32 *cur;
u32 val; u32 val;
int err, ctrl; int err, ctrl;
int clock_rate;
int tsc_wires = 0, adc_channels = 0, total_channels; int tsc_wires = 0, adc_channels = 0, total_channels;
int readouts = 0; int readouts = 0;
...@@ -212,11 +211,8 @@ static int ti_tscadc_probe(struct platform_device *pdev) ...@@ -212,11 +211,8 @@ static int ti_tscadc_probe(struct platform_device *pdev)
err = PTR_ERR(clk); err = PTR_ERR(clk);
goto err_disable_clk; goto err_disable_clk;
} }
clock_rate = clk_get_rate(clk);
tscadc->clk_div = clock_rate / ADC_CLK;
/* TSCADC_CLKDIV needs to be configured to the value minus 1 */ tscadc->clk_div = (clk_get_rate(clk) / ADC_CLK) - 1;
tscadc->clk_div--;
regmap_write(tscadc->regmap, REG_CLKDIV, tscadc->clk_div); regmap_write(tscadc->regmap, REG_CLKDIV, tscadc->clk_div);
/* Set the control register bits */ /* Set the control register bits */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment