summaryrefslogtreecommitdiff
path: root/drivers/iio/adc/imx7d_adc.c
diff options
context:
space:
mode:
authorFabio Estevam <festevam@gmail.com>2019-06-03 16:34:31 -0300
committerJonathan Cameron <Jonathan.Cameron@huawei.com>2019-06-17 21:06:44 +0100
commit9ce92da84ff2eec3792edabbc3d3a654f2e2842a (patch)
tree3ea7879a8b6f077b0ae812d63f147f0cb15f17c9 /drivers/iio/adc/imx7d_adc.c
parentfe93116459717eb363713b2e272006a46e914733 (diff)
iio: imx7d_adc: Introduce a definition for the input clock
Since the input clock is always 24MHz, there is no need for storing this value into a variable. Use a definition instead, which is more appropriate in this case. Signed-off-by: Fabio Estevam <festevam@gmail.com> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Diffstat (limited to 'drivers/iio/adc/imx7d_adc.c')
-rw-r--r--drivers/iio/adc/imx7d_adc.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/drivers/iio/adc/imx7d_adc.c b/drivers/iio/adc/imx7d_adc.c
index 3327994fce3a..d77840718bc6 100644
--- a/drivers/iio/adc/imx7d_adc.c
+++ b/drivers/iio/adc/imx7d_adc.c
@@ -82,6 +82,7 @@
#define IMX7D_REG_ADC_INT_STATUS_CHANNEL_CONV_TIME_OUT 0xf0000
#define IMX7D_ADC_TIMEOUT msecs_to_jiffies(100)
+#define IMX7D_ADC_INPUT_CLK 24000000
enum imx7d_adc_clk_pre_div {
IMX7D_ADC_ANALOG_CLK_PRE_DIV_4,
@@ -276,13 +277,11 @@ static void imx7d_adc_channel_set(struct imx7d_adc *info)
static u32 imx7d_adc_get_sample_rate(struct imx7d_adc *info)
{
- /* input clock is always 24MHz */
- u32 input_clk = 24000000;
u32 analogue_core_clk;
u32 core_time_unit = info->adc_feature.core_time_unit;
u32 tmp;
- analogue_core_clk = input_clk / info->pre_div_num;
+ analogue_core_clk = IMX7D_ADC_INPUT_CLK / info->pre_div_num;
tmp = (core_time_unit + 1) * 6;
return analogue_core_clk / tmp;