From: Lee Jones <lee.jones@linaro.org>
To: Vignesh R <vigneshr@ti.com>
Cc: Jonathan Cameron <jic23@kernel.org>,
Hartmut Knaack <knaack.h@gmx.de>,
Lars-Peter Clausen <lars@metafoo.de>,
Peter Meerwald-Stadler <pmeerw@pmeerw.net>,
"Andrew F . Davis" <afd@ti.com>,
linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-omap@vger.kernel.org
Subject: Re: [PATCH 2/2] iio: adc: ti_am335x_adc: Increase timeout value waiting for ADC sample
Date: Tue, 9 Aug 2016 10:35:02 +0100 [thread overview]
Message-ID: <20160809093502.GV5243@dell> (raw)
In-Reply-To: <20160808110501.29586-3-vigneshr@ti.com>
On Mon, 08 Aug 2016, Vignesh R wrote:
> Now that open delay and sample delay for each channel is configurable
> via DT, the default IDLE_TIMEOUT value is not enough as this is
> calculated based on hardcoded macros. This results in driver returning
> EBUSY sometimes. Fix this by increasing the timeout
> value based on maximum value possible to open delay and sample delays
> for each channel.
>
> Signed-off-by: Vignesh R <vigneshr@ti.com>
> ---
> drivers/iio/adc/ti_am335x_adc.c | 2 +-
> include/linux/mfd/ti_am335x_tscadc.h | 8 ++++----
Acked-by: Lee Jones <lee.jones@linaro.org>
> 2 files changed, 5 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/iio/adc/ti_am335x_adc.c b/drivers/iio/adc/ti_am335x_adc.c
> index bed9977a1863..c3cfacca2541 100644
> --- a/drivers/iio/adc/ti_am335x_adc.c
> +++ b/drivers/iio/adc/ti_am335x_adc.c
> @@ -381,7 +381,7 @@ static int tiadc_read_raw(struct iio_dev *indio_dev,
>
> am335x_tsc_se_set_once(adc_dev->mfd_tscadc, step_en);
>
> - timeout = jiffies + usecs_to_jiffies
> + timeout = jiffies + msecs_to_jiffies
> (IDLE_TIMEOUT * adc_dev->channels);
> /* Wait for Fifo threshold interrupt */
> while (1) {
> diff --git a/include/linux/mfd/ti_am335x_tscadc.h b/include/linux/mfd/ti_am335x_tscadc.h
> index 2567a87872b0..7f55b8b41032 100644
> --- a/include/linux/mfd/ti_am335x_tscadc.h
> +++ b/include/linux/mfd/ti_am335x_tscadc.h
> @@ -138,16 +138,16 @@
> /*
> * time in us for processing a single channel, calculated as follows:
> *
> - * num cycles = open delay + (sample delay + conv time) * averaging
> + * max num cycles = open delay + (sample delay + conv time) * averaging
> *
> - * num cycles: 152 + (1 + 13) * 16 = 376
> + * max num cycles: 262143 + (255 + 13) * 16 = 266431
> *
> * clock frequency: 26MHz / 8 = 3.25MHz
> * clock period: 1 / 3.25MHz = 308ns
> *
> - * processing time: 376 * 308ns = 116us
> + * max processing time: 266431 * 308ns = 83ms(approx)
> */
> -#define IDLE_TIMEOUT 116 /* microsec */
> +#define IDLE_TIMEOUT 83 /* milliseconds */
>
> #define TSCADC_CELLS 2
>
--
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog
WARNING: multiple messages have this Message-ID (diff)
From: Lee Jones <lee.jones-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
To: Vignesh R <vigneshr-l0cyMroinI0@public.gmane.org>
Cc: Jonathan Cameron <jic23-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>,
Hartmut Knaack <knaack.h-Mmb7MZpHnFY@public.gmane.org>,
Lars-Peter Clausen <lars-Qo5EllUWu/uELgA04lAiVw@public.gmane.org>,
Peter Meerwald-Stadler
<pmeerw-jW+XmwGofnusTnJN9+BGXg@public.gmane.org>,
"Andrew F . Davis" <afd-l0cyMroinI0@public.gmane.org>,
linux-iio-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
linux-omap-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Subject: Re: [PATCH 2/2] iio: adc: ti_am335x_adc: Increase timeout value waiting for ADC sample
Date: Tue, 9 Aug 2016 10:35:02 +0100 [thread overview]
Message-ID: <20160809093502.GV5243@dell> (raw)
In-Reply-To: <20160808110501.29586-3-vigneshr-l0cyMroinI0@public.gmane.org>
On Mon, 08 Aug 2016, Vignesh R wrote:
> Now that open delay and sample delay for each channel is configurable
> via DT, the default IDLE_TIMEOUT value is not enough as this is
> calculated based on hardcoded macros. This results in driver returning
> EBUSY sometimes. Fix this by increasing the timeout
> value based on maximum value possible to open delay and sample delays
> for each channel.
>
> Signed-off-by: Vignesh R <vigneshr-l0cyMroinI0@public.gmane.org>
> ---
> drivers/iio/adc/ti_am335x_adc.c | 2 +-
> include/linux/mfd/ti_am335x_tscadc.h | 8 ++++----
Acked-by: Lee Jones <lee.jones-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
> 2 files changed, 5 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/iio/adc/ti_am335x_adc.c b/drivers/iio/adc/ti_am335x_adc.c
> index bed9977a1863..c3cfacca2541 100644
> --- a/drivers/iio/adc/ti_am335x_adc.c
> +++ b/drivers/iio/adc/ti_am335x_adc.c
> @@ -381,7 +381,7 @@ static int tiadc_read_raw(struct iio_dev *indio_dev,
>
> am335x_tsc_se_set_once(adc_dev->mfd_tscadc, step_en);
>
> - timeout = jiffies + usecs_to_jiffies
> + timeout = jiffies + msecs_to_jiffies
> (IDLE_TIMEOUT * adc_dev->channels);
> /* Wait for Fifo threshold interrupt */
> while (1) {
> diff --git a/include/linux/mfd/ti_am335x_tscadc.h b/include/linux/mfd/ti_am335x_tscadc.h
> index 2567a87872b0..7f55b8b41032 100644
> --- a/include/linux/mfd/ti_am335x_tscadc.h
> +++ b/include/linux/mfd/ti_am335x_tscadc.h
> @@ -138,16 +138,16 @@
> /*
> * time in us for processing a single channel, calculated as follows:
> *
> - * num cycles = open delay + (sample delay + conv time) * averaging
> + * max num cycles = open delay + (sample delay + conv time) * averaging
> *
> - * num cycles: 152 + (1 + 13) * 16 = 376
> + * max num cycles: 262143 + (255 + 13) * 16 = 266431
> *
> * clock frequency: 26MHz / 8 = 3.25MHz
> * clock period: 1 / 3.25MHz = 308ns
> *
> - * processing time: 376 * 308ns = 116us
> + * max processing time: 266431 * 308ns = 83ms(approx)
> */
> -#define IDLE_TIMEOUT 116 /* microsec */
> +#define IDLE_TIMEOUT 83 /* milliseconds */
>
> #define TSCADC_CELLS 2
>
--
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog
next prev parent reply other threads:[~2016-08-09 9:33 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-08-08 11:04 [PATCH 0/2] ADC: Fix bugs related to oneshot read Vignesh R
2016-08-08 11:04 ` Vignesh R
2016-08-08 11:05 ` [PATCH 1/2] iio: adc: ti_am335x_adc: Protect FIFO1 from concurrent access Vignesh R
2016-08-08 11:05 ` Vignesh R
2016-08-09 9:51 ` Matt Ranostay
2016-08-09 9:51 ` Matt Ranostay
2016-08-09 9:57 ` Vignesh R
2016-08-09 9:57 ` Vignesh R
2016-08-15 15:45 ` Jonathan Cameron
2016-08-17 11:13 ` Vignesh R
2016-08-08 11:05 ` [PATCH 2/2] iio: adc: ti_am335x_adc: Increase timeout value waiting for ADC sample Vignesh R
2016-08-08 11:05 ` Vignesh R
2016-08-09 9:35 ` Lee Jones [this message]
2016-08-09 9:35 ` Lee Jones
2016-08-15 15:47 ` Jonathan Cameron
2016-08-17 11:11 ` Vignesh R
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=20160809093502.GV5243@dell \
--to=lee.jones@linaro.org \
--cc=afd@ti.com \
--cc=jic23@kernel.org \
--cc=knaack.h@gmx.de \
--cc=lars@metafoo.de \
--cc=linux-iio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-omap@vger.kernel.org \
--cc=pmeerw@pmeerw.net \
--cc=vigneshr@ti.com \
/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.