From: Shreeya Patel <shreeya.patel@collabora.com>
To: jic23@kernel.org
Cc: linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org, lars@metafoo.de
Subject: Re: [PATCH] iio: light: ltrf216a: Return floating point values
Date: Wed, 22 Nov 2023 01:05:41 +0530 [thread overview]
Message-ID: <06d3c2f7-50b4-b44d-fa75-8ca6a1a26d89@collabora.com> (raw)
In-Reply-To: <20231107192005.285534-1-shreeya.patel@collabora.com>
On 08/11/23 00:50, Shreeya Patel wrote:
> For better precision of input light intesity, return floating point
> values through sysfs instead of an integer value
Hi Jonathan,
Gentle ping for this patch. I am not sure if you got time to look at the
patches
after LPC but just making sure it doesn't get lost between bunch of
others :)
Thanks,
Shreeya Patel
>
> Signed-off-by: Shreeya Patel <shreeya.patel@collabora.com>
> ---
> drivers/iio/light/ltrf216a.c | 10 +++++-----
> 1 file changed, 5 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/iio/light/ltrf216a.c b/drivers/iio/light/ltrf216a.c
> index 8de4dd849936..68dc48420a88 100644
> --- a/drivers/iio/light/ltrf216a.c
> +++ b/drivers/iio/light/ltrf216a.c
> @@ -234,7 +234,7 @@ static int ltrf216a_read_data(struct ltrf216a_data *data, u8 addr)
> static int ltrf216a_get_lux(struct ltrf216a_data *data)
> {
> int ret, greendata;
> - u64 lux, div;
> + u64 lux;
>
> ret = ltrf216a_set_power_state(data, true);
> if (ret)
> @@ -246,10 +246,9 @@ static int ltrf216a_get_lux(struct ltrf216a_data *data)
>
> ltrf216a_set_power_state(data, false);
>
> - lux = greendata * 45 * LTRF216A_WIN_FAC * 100;
> - div = data->als_gain_fac * data->int_time_fac * 100;
> + lux = greendata * 45 * LTRF216A_WIN_FAC;
>
> - return div_u64(lux, div);
> + return lux;
> }
>
> static int ltrf216a_read_raw(struct iio_dev *indio_dev,
> @@ -279,7 +278,8 @@ static int ltrf216a_read_raw(struct iio_dev *indio_dev,
> if (ret < 0)
> return ret;
> *val = ret;
> - return IIO_VAL_INT;
> + *val2 = data->als_gain_fac * data->int_time_fac;
> + return IIO_VAL_FRACTIONAL;
> case IIO_CHAN_INFO_INT_TIME:
> mutex_lock(&data->lock);
> ret = ltrf216a_get_int_time(data, val, val2);
next prev parent reply other threads:[~2023-11-21 19:35 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-11-07 19:20 [PATCH] iio: light: ltrf216a: Return floating point values Shreeya Patel
2023-11-21 19:35 ` Shreeya Patel [this message]
2023-11-26 18:02 ` 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=06d3c2f7-50b4-b44d-fa75-8ca6a1a26d89@collabora.com \
--to=shreeya.patel@collabora.com \
--cc=jic23@kernel.org \
--cc=lars@metafoo.de \
--cc=linux-iio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox