lkml.org 
[lkml]   [2021]   [Feb]   [6]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 2/3] iio: hid-sensor-als: Add relative hysteresis support
On Mon,  1 Feb 2021 15:43:57 +0800
Ye Xiang <xiang.ye@intel.com> wrote:

> Hid sensor als uses relative hysteresis, this patch adds the support.
>
> Signed-off-by: Ye Xiang <xiang.ye@intel.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;
> }

\
 
 \ /
  Last update: 2021-02-06 17:55    [W:0.106 / U:1.392 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site