[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20210206165234.26bf0421@archlinux>
Date: Sat, 6 Feb 2021 16:52:34 +0000
From: Jonathan Cameron <jic23@...nel.org>
To: Ye Xiang <xiang.ye@...el.com>
Cc: jikos@...nel.org, srinivas.pandruvada@...ux.intel.com,
linux-input@...r.kernel.org, linux-iio@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH 2/3] iio: hid-sensor-als: Add relative hysteresis
support
On Mon, 1 Feb 2021 15:43:57 +0800
Ye Xiang <xiang.ye@...el.com> wrote:
> Hid sensor als uses relative hysteresis, this patch adds the support.
>
> Signed-off-by: Ye Xiang <xiang.ye@...el.com>
Looks good to me.
Jonathan
> ---
> drivers/iio/light/hid-sensor-als.c | 14 ++++++++++++--
> 1 file changed, 12 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/iio/light/hid-sensor-als.c b/drivers/iio/light/hid-sensor-als.c
> index afcdb424bfb8..85c8a05b73cb 100644
> --- a/drivers/iio/light/hid-sensor-als.c
> +++ b/drivers/iio/light/hid-sensor-als.c
> @@ -54,7 +54,8 @@ static const struct iio_chan_spec als_channels[] = {
> .info_mask_shared_by_type = BIT(IIO_CHAN_INFO_OFFSET) |
> BIT(IIO_CHAN_INFO_SCALE) |
> BIT(IIO_CHAN_INFO_SAMP_FREQ) |
> - BIT(IIO_CHAN_INFO_HYSTERESIS),
> + BIT(IIO_CHAN_INFO_HYSTERESIS) |
> + BIT(IIO_CHAN_INFO_HYSTERESIS_RELATIVE),
> .scan_index = CHANNEL_SCAN_INDEX_INTENSITY,
> },
> {
> @@ -63,7 +64,8 @@ static const struct iio_chan_spec als_channels[] = {
> .info_mask_shared_by_type = BIT(IIO_CHAN_INFO_OFFSET) |
> BIT(IIO_CHAN_INFO_SCALE) |
> BIT(IIO_CHAN_INFO_SAMP_FREQ) |
> - BIT(IIO_CHAN_INFO_HYSTERESIS),
> + BIT(IIO_CHAN_INFO_HYSTERESIS) |
> + BIT(IIO_CHAN_INFO_HYSTERESIS_RELATIVE),
> .scan_index = CHANNEL_SCAN_INDEX_ILLUM,
> },
> IIO_CHAN_SOFT_TIMESTAMP(CHANNEL_SCAN_INDEX_TIMESTAMP)
> @@ -141,6 +143,10 @@ static int als_read_raw(struct iio_dev *indio_dev,
> ret_type = hid_sensor_read_raw_hyst_value(
> &als_state->common_attributes, val, val2);
> break;
> + case IIO_CHAN_INFO_HYSTERESIS_RELATIVE:
> + ret_type = hid_sensor_read_raw_hyst_rel_value(
> + &als_state->common_attributes, val, val2);
> + break;
> default:
> ret_type = -EINVAL;
> break;
> @@ -168,6 +174,10 @@ static int als_write_raw(struct iio_dev *indio_dev,
> ret = hid_sensor_write_raw_hyst_value(
> &als_state->common_attributes, val, val2);
> break;
> + case IIO_CHAN_INFO_HYSTERESIS_RELATIVE:
> + ret = hid_sensor_write_raw_hyst_rel_value(
> + &als_state->common_attributes, val, val2);
> + break;
> default:
> ret = -EINVAL;
> }
Powered by blists - more mailing lists