From: Jonathan Cameron <jic23-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
To: Sebastian Andrzej Siewior
<bigeasy-hfZtesqFncYOwBW4kG4KsQ@public.gmane.org>
Cc: linux-input-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
linux-iio-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
sameo-VuQAYsv1563Yd54FQh9/CA@public.gmane.org,
jic23-KWPb1pKIrIJaa/9Udqfwiw@public.gmane.org,
dmitry.torokhov-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org,
balbi-l0cyMroinI0@public.gmane.org
Subject: Re: [PATCH 5/5] iio/ti_am335x_adc: check if we found the value
Date: Sun, 02 Jun 2013 19:03:26 +0100 [thread overview]
Message-ID: <51AB88EE.3090602@kernel.org> (raw)
In-Reply-To: <1369847397-27451-6-git-send-email-bigeasy-hfZtesqFncYOwBW4kG4KsQ@public.gmane.org>
On 05/29/2013 06:09 PM, Sebastian Andrzej Siewior wrote:
> Usually we get all the values we wanted but it is possible, that te ADC
> unit is busy performing the conversation for the HW events. In that case
> -EBUSY is returned and the user may re-call the function.
>
> Signed-off-by: Sebastian Andrzej Siewior <bigeasy-hfZtesqFncYOwBW4kG4KsQ@public.gmane.org>
Acked-by: Jonathan Cameron <jic23-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
> ---
> drivers/iio/adc/ti_am335x_adc.c | 7 ++++++-
> 1 file changed, 6 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/iio/adc/ti_am335x_adc.c b/drivers/iio/adc/ti_am335x_adc.c
> index df2de4c..6a00874 100644
> --- a/drivers/iio/adc/ti_am335x_adc.c
> +++ b/drivers/iio/adc/ti_am335x_adc.c
> @@ -161,6 +161,7 @@ static int tiadc_read_raw(struct iio_dev *indio_dev,
> int i;
> unsigned int fifo1count, read;
> u32 step = UINT_MAX;
> + bool found = false;
>
> /*
> * When the sub-system is first enabled,
> @@ -185,10 +186,14 @@ static int tiadc_read_raw(struct iio_dev *indio_dev,
> fifo1count = tiadc_readl(adc_dev, REG_FIFO1CNT);
> for (i = 0; i < fifo1count; i++) {
> read = tiadc_readl(adc_dev, REG_FIFO1);
> - if (read >> 16 == step)
> + if (read >> 16 == step) {
> *val = read & 0xfff;
> + found = true;
> + }
> }
> tiadc_writel(adc_dev, REG_SE, STPENB_STEPENB);
> + if (found == false)
> + return -EBUSY;
>
> return IIO_VAL_INT;
> }
>
WARNING: multiple messages have this Message-ID (diff)
From: Jonathan Cameron <jic23@kernel.org>
To: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Cc: linux-input@vger.kernel.org, linux-iio@vger.kernel.org,
sameo@linux.intel.com, jic23@cam.ac.uk,
dmitry.torokhov@gmail.com, balbi@ti.com
Subject: Re: [PATCH 5/5] iio/ti_am335x_adc: check if we found the value
Date: Sun, 02 Jun 2013 19:03:26 +0100 [thread overview]
Message-ID: <51AB88EE.3090602@kernel.org> (raw)
In-Reply-To: <1369847397-27451-6-git-send-email-bigeasy@linutronix.de>
On 05/29/2013 06:09 PM, Sebastian Andrzej Siewior wrote:
> Usually we get all the values we wanted but it is possible, that te ADC
> unit is busy performing the conversation for the HW events. In that case
> -EBUSY is returned and the user may re-call the function.
>
> Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Acked-by: Jonathan Cameron <jic23@kernel.org>
> ---
> drivers/iio/adc/ti_am335x_adc.c | 7 ++++++-
> 1 file changed, 6 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/iio/adc/ti_am335x_adc.c b/drivers/iio/adc/ti_am335x_adc.c
> index df2de4c..6a00874 100644
> --- a/drivers/iio/adc/ti_am335x_adc.c
> +++ b/drivers/iio/adc/ti_am335x_adc.c
> @@ -161,6 +161,7 @@ static int tiadc_read_raw(struct iio_dev *indio_dev,
> int i;
> unsigned int fifo1count, read;
> u32 step = UINT_MAX;
> + bool found = false;
>
> /*
> * When the sub-system is first enabled,
> @@ -185,10 +186,14 @@ static int tiadc_read_raw(struct iio_dev *indio_dev,
> fifo1count = tiadc_readl(adc_dev, REG_FIFO1CNT);
> for (i = 0; i < fifo1count; i++) {
> read = tiadc_readl(adc_dev, REG_FIFO1);
> - if (read >> 16 == step)
> + if (read >> 16 == step) {
> *val = read & 0xfff;
> + found = true;
> + }
> }
> tiadc_writel(adc_dev, REG_SE, STPENB_STEPENB);
> + if (found == false)
> + return -EBUSY;
>
> return IIO_VAL_INT;
> }
>
next prev parent reply other threads:[~2013-06-02 18:03 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-05-29 17:09 am335x adc & tsc, second batch Sebastian Andrzej Siewior
2013-05-29 17:09 ` Sebastian Andrzej Siewior
2013-05-29 17:09 ` [PATCH 1/5] drivers/iio: am335x_adc: cleanup on missing DT nodes Sebastian Andrzej Siewior
[not found] ` <1369847397-27451-2-git-send-email-bigeasy-hfZtesqFncYOwBW4kG4KsQ@public.gmane.org>
2013-06-02 17:56 ` Jonathan Cameron
2013-06-02 17:56 ` Jonathan Cameron
[not found] ` <51AB8758.5010705-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
2013-06-04 10:38 ` Sebastian Andrzej Siewior
2013-06-04 10:38 ` Sebastian Andrzej Siewior
2013-05-29 17:09 ` [PATCH 3/5] input/ti_am335x_tsc: fold regbit_map() and simplfy Sebastian Andrzej Siewior
2013-05-29 17:09 ` Sebastian Andrzej Siewior
2013-06-04 16:53 ` Dmitry Torokhov
2013-06-04 16:53 ` Dmitry Torokhov
2013-05-29 17:09 ` [PATCH 4/5] iio/ti_am335x_adc: Allow to specify input line Sebastian Andrzej Siewior
[not found] ` <1369847397-27451-5-git-send-email-bigeasy-hfZtesqFncYOwBW4kG4KsQ@public.gmane.org>
2013-06-02 18:02 ` Jonathan Cameron
2013-06-02 18:02 ` Jonathan Cameron
[not found] ` <51AB88BE.6040109-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
2013-06-04 10:39 ` Sebastian Andrzej Siewior
2013-06-04 10:39 ` Sebastian Andrzej Siewior
[not found] ` <1369847397-27451-1-git-send-email-bigeasy-hfZtesqFncYOwBW4kG4KsQ@public.gmane.org>
2013-05-29 17:09 ` [PATCH 2/5] input/ti_am335x_adc: use only FIFO0 and clean up a little Sebastian Andrzej Siewior
2013-05-29 17:09 ` Sebastian Andrzej Siewior
2013-06-04 16:52 ` Dmitry Torokhov
2013-06-04 16:52 ` Dmitry Torokhov
2013-05-29 17:09 ` [PATCH 5/5] iio/ti_am335x_adc: check if we found the value Sebastian Andrzej Siewior
2013-05-29 17:09 ` Sebastian Andrzej Siewior
[not found] ` <1369847397-27451-6-git-send-email-bigeasy-hfZtesqFncYOwBW4kG4KsQ@public.gmane.org>
2013-06-02 18:03 ` Jonathan Cameron [this message]
2013-06-02 18:03 ` 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=51AB88EE.3090602@kernel.org \
--to=jic23-dgejt+ai2ygdnm+yrofe0a@public.gmane.org \
--cc=balbi-l0cyMroinI0@public.gmane.org \
--cc=bigeasy-hfZtesqFncYOwBW4kG4KsQ@public.gmane.org \
--cc=dmitry.torokhov-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
--cc=jic23-KWPb1pKIrIJaa/9Udqfwiw@public.gmane.org \
--cc=linux-iio-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=linux-input-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=sameo-VuQAYsv1563Yd54FQh9/CA@public.gmane.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.