From: Jonathan Cameron <jic23@kernel.org>
To: Alexander Koch <mail@alexanderkoch.net>
Cc: knaack.h@gmx.de, lars@metafoo.de, pmeerw@pmeerw.net,
mhornung.linux@gmail.com, dannenberg@ti.com, balbi@ti.com,
fengguang.wu@intel.com, linux-iio@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2 1/3] iio: light: opt3001: extract int. time constants
Date: Sun, 24 Jan 2016 15:01:07 +0000 [thread overview]
Message-ID: <56A4E733.6060309@kernel.org> (raw)
In-Reply-To: <1452960878-1727-2-git-send-email-mail@alexanderkoch.net>
On 16/01/16 16:14, Alexander Koch wrote:
> Extract integration times as #define constants. This prepares using them
> for delay/timeout length determination.
>
> Signed-off-by: Alexander Koch <mail@alexanderkoch.net>
> Signed-off-by: Michael Hornung <mhornung.linux@gmail.com>
Applied to the togreg branch of iio.git - initially pushed out as testing
for the autobuilders to play with it.
> ---
> drivers/iio/light/opt3001.c | 15 +++++++++------
> 1 file changed, 9 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/iio/light/opt3001.c b/drivers/iio/light/opt3001.c
> index 01e111e..aefbd79 100644
> --- a/drivers/iio/light/opt3001.c
> +++ b/drivers/iio/light/opt3001.c
> @@ -65,6 +65,9 @@
> #define OPT3001_REG_EXPONENT(n) ((n) >> 12)
> #define OPT3001_REG_MANTISSA(n) ((n) & 0xfff)
>
> +#define OPT3001_INT_TIME_LONG 800000
> +#define OPT3001_INT_TIME_SHORT 100000
> +
> /*
> * Time to wait for conversion result to be ready. The device datasheet
> * worst-case max value is 880ms. Add some slack to be on the safe side.
> @@ -325,13 +328,13 @@ static int opt3001_set_int_time(struct opt3001 *opt, int time)
> reg = ret;
>
> switch (time) {
> - case 100000:
> + case OPT3001_INT_TIME_SHORT:
> reg &= ~OPT3001_CONFIGURATION_CT;
> - opt->int_time = 100000;
> + opt->int_time = OPT3001_INT_TIME_SHORT;
> break;
> - case 800000:
> + case OPT3001_INT_TIME_LONG:
> reg |= OPT3001_CONFIGURATION_CT;
> - opt->int_time = 800000;
> + opt->int_time = OPT3001_INT_TIME_LONG;
> break;
> default:
> return -EINVAL;
> @@ -597,9 +600,9 @@ static int opt3001_configure(struct opt3001 *opt)
>
> /* Reflect status of the device's integration time setting */
> if (reg & OPT3001_CONFIGURATION_CT)
> - opt->int_time = 800000;
> + opt->int_time = OPT3001_INT_TIME_LONG;
> else
> - opt->int_time = 100000;
> + opt->int_time = OPT3001_INT_TIME_SHORT;
>
> /* Ensure device is in shutdown initially */
> opt3001_set_mode(opt, ®, OPT3001_CONFIGURATION_M_SHUTDOWN);
>
next prev parent reply other threads:[~2016-01-24 15:01 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-01-16 16:14 [PATCH v2 0/3] iio: light: opt3001: Enable operation w/o IRQ Alexander Koch
2016-01-16 16:14 ` [PATCH v2 1/3] iio: light: opt3001: extract int. time constants Alexander Koch
2016-01-24 15:01 ` Jonathan Cameron [this message]
2016-01-29 17:59 ` Andreas Dannenberg
2016-01-16 16:14 ` [PATCH v2 2/3] iio: light: opt3001: trivial type refactoring Alexander Koch
2016-01-24 15:02 ` Jonathan Cameron
2016-01-29 18:00 ` Andreas Dannenberg
2016-01-16 16:14 ` [PATCH v2 3/3] iio: light: opt3001: enable operation w/o IRQ Alexander Koch
2016-01-18 17:07 ` Martin Kepplinger
2016-01-23 18:55 ` Alexander Koch
2016-01-24 14:55 ` Jonathan Cameron
2016-01-24 15:07 ` Jonathan Cameron
2016-01-29 18:01 ` Andreas Dannenberg
2016-01-30 16:27 ` Jonathan Cameron
2016-01-29 18:05 ` [PATCH v2 0/3] iio: light: opt3001: Enable " Andreas Dannenberg
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=56A4E733.6060309@kernel.org \
--to=jic23@kernel.org \
--cc=balbi@ti.com \
--cc=dannenberg@ti.com \
--cc=fengguang.wu@intel.com \
--cc=knaack.h@gmx.de \
--cc=lars@metafoo.de \
--cc=linux-iio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mail@alexanderkoch.net \
--cc=mhornung.linux@gmail.com \
--cc=pmeerw@pmeerw.net \
/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.