linux-iio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jonathan Cameron <jic23@kernel.org>
To: Beomho Seo <beomho.seo@samsung.com>, linux-iio@vger.kernel.org
Cc: Kevin Tsai <ktsai@capellamicro.com>,
	Myungjoo Ham <myungjoo.ham@samsung.com>,
	Jaehoon Chung <jh80.chung@samsung.com>
Subject: Re: [PATCH v2 2/2] iio: cm32181:  Change cm32181 ambient light sensor driver
Date: Tue, 18 Feb 2014 10:23:20 +0000	[thread overview]
Message-ID: <53033498.3080106@kernel.org> (raw)
In-Reply-To: <52FDEA23.1010807@samsung.com>

On 14/02/14 10:04, Beomho Seo wrote:
>
> Integration time of cm32181 is guessed about milliseconds.
> But cm32181_read_als_it function return IIO_VAL_INT.
> So fixed to return IIO_VAL_INT_PLUS_MICRO.
> Next, add .write_raw_get_fmt callback function for call iio_str_to_fixpoint.
>
> v2: cm32181_write_als_id function fixed as it was.
>
> Cc: Kevin Tsai <ktsai@capellamicro.com>
> Signed-off-by: Beomho Seo <beomho.seo@samsung.com>
Applied to the fixes-togreg branch but with the *get_fmt call dropped as
again it is simply returning the default value.

Thanks for these two.

Jonathan
> ---
>   drivers/iio/light/cm32181.c |   24 ++++++++++++++++--------
>   1 file changed, 16 insertions(+), 8 deletions(-)
>
> diff --git a/drivers/iio/light/cm32181.c b/drivers/iio/light/cm32181.c
> index f17b4e6..27c293c 100644
> --- a/drivers/iio/light/cm32181.c
> +++ b/drivers/iio/light/cm32181.c
> @@ -103,13 +103,13 @@ static int cm32181_reg_init(struct cm32181_chip *cm32181)
>   /**
>    *  cm32181_read_als_it() - Get sensor integration time (ms)
>    *  @cm32181:	pointer of struct cm32181
> - *  @val:	pointer of int to load the als_it value.
> + *  @val2:	pointer of int to load the als_it value.
>    *
>    *  Report the current integartion time by millisecond.
>    *
> - *  Return: IIO_VAL_INT for success, otherwise -EINVAL.
> + *  Return: IIO_VAL_INT_PLUS_MICRO for success, otherwise -EINVAL.
>    */
> -static int cm32181_read_als_it(struct cm32181_chip *cm32181, int *val)
> +static int cm32181_read_als_it(struct cm32181_chip *cm32181, int *val2)
>   {
>   	u16 als_it;
>   	int i;
> @@ -119,8 +119,8 @@ static int cm32181_read_als_it(struct cm32181_chip *cm32181, int *val)
>   	als_it >>= CM32181_CMD_ALS_IT_SHIFT;
>   	for (i = 0; i < ARRAY_SIZE(als_it_bits); i++) {
>   		if (als_it == als_it_bits[i]) {
> -			*val = als_it_value[i];
> -			return IIO_VAL_INT;
> +			*val2 = als_it_value[i];
> +			return IIO_VAL_INT_PLUS_MICRO;
>   		}
>   	}
>
> @@ -221,7 +221,7 @@ static int cm32181_read_raw(struct iio_dev *indio_dev,
>   		*val = cm32181->calibscale;
>   		return IIO_VAL_INT;
>   	case IIO_CHAN_INFO_INT_TIME:
> -		ret = cm32181_read_als_it(cm32181, val);
> +		ret = cm32181_read_als_it(cm32181, val2);
>   		return ret;
>   	}
>
> @@ -240,13 +240,20 @@ static int cm32181_write_raw(struct iio_dev *indio_dev,
>   		cm32181->calibscale = val;
>   		return val;
>   	case IIO_CHAN_INFO_INT_TIME:
> -		ret = cm32181_write_als_it(cm32181, val);
> +		ret = cm32181_write_als_it(cm32181, val2);
>   		return ret;
>   	}
>
>   	return -EINVAL;
>   }
>
> +static int cm32181_write_raw_get_fmt(struct iio_dev *indio_dev,
> +				struct iio_chan_spec const *chan,
> +				long mask)
> +{
> +	return IIO_VAL_INT_PLUS_MICRO;
> +}
> +
>   /**
>    * cm32181_get_it_available() - Get available ALS IT value
>    * @dev:	pointer of struct device.
> @@ -264,7 +271,7 @@ static ssize_t cm32181_get_it_available(struct device *dev,
>
>   	n = ARRAY_SIZE(als_it_value);
>   	for (i = 0, len = 0; i < n; i++)
> -		len += sprintf(buf + len, "%d ", als_it_value[i]);
> +		len += sprintf(buf + len, "0.%06u ", als_it_value[i]);
>   	return len + sprintf(buf + len, "\n");
>   }
>
> @@ -294,6 +301,7 @@ static const struct iio_info cm32181_info = {
>   	.driver_module		= THIS_MODULE,
>   	.read_raw		= &cm32181_read_raw,
>   	.write_raw		= &cm32181_write_raw,
> +	.write_raw_get_fmt	= &cm32181_write_raw_get_fmt,
>   	.attrs			= &cm32181_attribute_group,
>   };
>


      reply	other threads:[~2014-02-18 10:22 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-02-14 10:04 [PATCH v2 2/2] iio: cm32181: Change cm32181 ambient light sensor driver Beomho Seo
2014-02-18 10:23 ` Jonathan Cameron [this message]

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=53033498.3080106@kernel.org \
    --to=jic23@kernel.org \
    --cc=beomho.seo@samsung.com \
    --cc=jh80.chung@samsung.com \
    --cc=ktsai@capellamicro.com \
    --cc=linux-iio@vger.kernel.org \
    --cc=myungjoo.ham@samsung.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;
as well as URLs for NNTP newsgroup(s).