From: Naveen Krishna Chatradhi <ch.naveen@samsung.com>
To: linux-iio@vger.kernel.org
Cc: linux-kernel@vger.kernel.org, linux-samsung-soc@vger.kernel.org,
dianders@chromium.org, gregkh@linuxfoundation.org,
naveenkrishna.ch@gmail.com, lars@metafoo.de, cpgs@samsung.com,
grundler@chromium.org
Subject: [PATCH 3/5] iio: exynos_adc: reduce timeout and use wait_for_completion_timeout
Date: Fri, 25 Apr 2014 15:44:45 +0530 [thread overview]
Message-ID: <1398420888-5506-4-git-send-email-ch.naveen@samsung.com> (raw)
In-Reply-To: <1398420888-5506-1-git-send-email-ch.naveen@samsung.com>
ADC module on Exynos5 SoCs runs at 600KSPS. At this conversion rate,
waiting for 1000 msecs is wasteful (incase of h/w failure).
Hence, reduce the time out to 100msecs and use
wait_for_completion_timeout() instead of
wait_for_completion_interruptible_timeout()
Also, handle the return values in exynos_raw_read() call.
Change-Id: Icb8cade162094b2777c9f3c77120635deef5947c
Signed-off-by: Naveen Krishna Chatradhi <ch.naveen@samsung.com>
---
This change is a part of the patch reviewd at https://lkml.org/lkml/2013/11/5/92
drivers/iio/adc/exynos_adc.c | 18 +++++++++++-------
1 file changed, 11 insertions(+), 7 deletions(-)
diff --git a/drivers/iio/adc/exynos_adc.c b/drivers/iio/adc/exynos_adc.c
index a2b8b1a..4d2467a 100644
--- a/drivers/iio/adc/exynos_adc.c
+++ b/drivers/iio/adc/exynos_adc.c
@@ -82,7 +82,7 @@ enum adc_version {
#define ADC_CON_EN_START (1u << 0)
#define ADC_DATX_MASK 0xFFF
-#define EXYNOS_ADC_TIMEOUT (msecs_to_jiffies(1000))
+#define EXYNOS_ADC_TIMEOUT (msecs_to_jiffies(100))
struct exynos_adc {
void __iomem *regs;
@@ -121,6 +121,7 @@ static int exynos_read_raw(struct iio_dev *indio_dev,
struct exynos_adc *info = iio_priv(indio_dev);
unsigned long timeout;
u32 con1, con2;
+ int ret;
if (mask != IIO_CHAN_INFO_RAW)
return -EINVAL;
@@ -145,16 +146,19 @@ static int exynos_read_raw(struct iio_dev *indio_dev,
ADC_V1_CON(info->regs));
}
- timeout = wait_for_completion_interruptible_timeout
+ timeout = wait_for_completion_timeout
(&info->completion, EXYNOS_ADC_TIMEOUT);
- *val = info->value;
+ if (timeout == 0) {
+ ret = -ETIMEDOUT;
+ } else {
+ *val = info->value;
+ *val2 = 0;
+ ret = IIO_VAL_INT;
+ }
mutex_unlock(&indio_dev->mlock);
- if (timeout == 0)
- return -ETIMEDOUT;
-
- return IIO_VAL_INT;
+ return ret;
}
static irqreturn_t exynos_adc_isr(int irq, void *dev_id)
--
1.7.9.5
next prev parent reply other threads:[~2014-04-25 10:18 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-04-25 10:14 [PATCH 0/5] iio: exynos_adc: fix minor nits in the driver Naveen Krishna Chatradhi
2014-04-25 10:14 ` [PATCH 1/5] iio: exynos_adc: use indio_dev->dev structure to handle child nodes Naveen Krishna Chatradhi
2014-04-25 15:46 ` Doug Anderson
2014-04-26 12:53 ` Jonathan Cameron
2014-04-26 13:51 ` Naveen Krishna Ch
2014-04-25 10:14 ` [PATCH 2/5] iio: exynos_adc: rearrange clock and regulator enable/disable calls Naveen Krishna Chatradhi
2014-04-25 16:06 ` Doug Anderson
2014-04-25 10:14 ` Naveen Krishna Chatradhi [this message]
2014-04-25 16:28 ` [PATCH 3/5] iio: exynos_adc: reduce timeout and use wait_for_completion_timeout Doug Anderson
2014-04-25 10:14 ` [PATCH 4/5] iio: exynos_adc: do a soft reset in case of timeout Naveen Krishna Chatradhi
2014-04-25 16:29 ` Doug Anderson
2014-04-25 10:14 ` [PATCH 5/5] iio: exynos_adc: do a reinit_completion before the conversion Naveen Krishna Chatradhi
2014-04-25 16:32 ` Doug Anderson
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=1398420888-5506-4-git-send-email-ch.naveen@samsung.com \
--to=ch.naveen@samsung.com \
--cc=cpgs@samsung.com \
--cc=dianders@chromium.org \
--cc=gregkh@linuxfoundation.org \
--cc=grundler@chromium.org \
--cc=lars@metafoo.de \
--cc=linux-iio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-samsung-soc@vger.kernel.org \
--cc=naveenkrishna.ch@gmail.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®