mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-08-21 16:29:59 +00:00
iio: hid-sensor-als: Add relative hysteresis support
Hid sensor als use relative hysteresis, this patch adds the support. Signed-off-by: Ye Xiang <xiang.ye@intel.com> Link: https://lore.kernel.org/r/20210207070048.23935-3-xiang.ye@intel.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
This commit is contained in:
parent
1c71a2863a
commit
84dbc231a6
1 changed files with 12 additions and 2 deletions
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue