From: Fabio Estevam <festevam@gmail.com>
To: jic23@kernel.org
Cc: andrew.smirnov@gmail.com, linux-iio@vger.kernel.org,
Fabio Estevam <festevam@gmail.com>
Subject: [PATCH 2/4] iio: imx7d_adc: Introduce a definition for the input clock
Date: Mon, 3 Jun 2019 16:34:31 -0300 [thread overview]
Message-ID: <20190603193433.6394-2-festevam@gmail.com> (raw)
In-Reply-To: <20190603193433.6394-1-festevam@gmail.com>
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>
---
drivers/iio/adc/imx7d_adc.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/drivers/iio/adc/imx7d_adc.c b/drivers/iio/adc/imx7d_adc.c
index 23c7b0ee945f..bffc172e7635 100644
--- a/drivers/iio/adc/imx7d_adc.c
+++ b/drivers/iio/adc/imx7d_adc.c
@@ -78,6 +78,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,
@@ -272,13 +273,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;
--
2.17.1
next prev parent reply other threads:[~2019-06-03 19:35 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-06-03 19:34 [PATCH 1/4] iio: imx7d_adc: Remove unneeded error message Fabio Estevam
2019-06-03 19:34 ` Fabio Estevam [this message]
2019-06-08 12:59 ` [PATCH 2/4] iio: imx7d_adc: Introduce a definition for the input clock Jonathan Cameron
2019-06-03 19:34 ` [PATCH 3/4] iio: imx7d_adc: Fit into a single line Fabio Estevam
2019-06-08 13:00 ` Jonathan Cameron
2019-06-03 19:34 ` [PATCH 4/4] iio: imx7d_adc: Remove unneeded 'average_en' member Fabio Estevam
2019-06-08 13:01 ` Jonathan Cameron
2019-06-08 12:58 ` [PATCH 1/4] iio: imx7d_adc: Remove unneeded error message Jonathan Cameron
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20190603193433.6394-2-festevam@gmail.com \
--to=festevam@gmail.com \
--cc=andrew.smirnov@gmail.com \
--cc=jic23@kernel.org \
--cc=linux-iio@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.