Commit 4c261720 authored by Ye Xiang's avatar Ye Xiang Committed by Jonathan Cameron

iio: hid-sensor-accel-3d: Add timestamp channel for gravity sensor

The accel_3d sensor already has a timestamp channel, this patch just
replicate that for gravity sensor.
Signed-off-by: default avatarYe Xiang <xiang.ye@intel.com>
Link: https://lore.kernel.org/r/20210105093515.19135-2-xiang.ye@intel.comSigned-off-by: default avatarJonathan Cameron <Jonathan.Cameron@huawei.com>
parent cce4f160
...@@ -23,6 +23,7 @@ enum accel_3d_channel { ...@@ -23,6 +23,7 @@ enum accel_3d_channel {
ACCEL_3D_CHANNEL_MAX, ACCEL_3D_CHANNEL_MAX,
}; };
#define CHANNEL_SCAN_INDEX_TIMESTAMP ACCEL_3D_CHANNEL_MAX
struct accel_3d_state { struct accel_3d_state {
struct hid_sensor_hub_callbacks callbacks; struct hid_sensor_hub_callbacks callbacks;
struct hid_sensor_common common_attributes; struct hid_sensor_common common_attributes;
...@@ -75,7 +76,7 @@ static const struct iio_chan_spec accel_3d_channels[] = { ...@@ -75,7 +76,7 @@ static const struct iio_chan_spec accel_3d_channels[] = {
BIT(IIO_CHAN_INFO_HYSTERESIS), BIT(IIO_CHAN_INFO_HYSTERESIS),
.scan_index = CHANNEL_SCAN_INDEX_Z, .scan_index = CHANNEL_SCAN_INDEX_Z,
}, },
IIO_CHAN_SOFT_TIMESTAMP(3) IIO_CHAN_SOFT_TIMESTAMP(CHANNEL_SCAN_INDEX_TIMESTAMP)
}; };
/* Channel definitions */ /* Channel definitions */
...@@ -110,7 +111,8 @@ static const struct iio_chan_spec gravity_channels[] = { ...@@ -110,7 +111,8 @@ static const struct iio_chan_spec gravity_channels[] = {
BIT(IIO_CHAN_INFO_SAMP_FREQ) | BIT(IIO_CHAN_INFO_SAMP_FREQ) |
BIT(IIO_CHAN_INFO_HYSTERESIS), BIT(IIO_CHAN_INFO_HYSTERESIS),
.scan_index = CHANNEL_SCAN_INDEX_Z, .scan_index = CHANNEL_SCAN_INDEX_Z,
} },
IIO_CHAN_SOFT_TIMESTAMP(CHANNEL_SCAN_INDEX_TIMESTAMP),
}; };
/* Adjust channel real bits based on report descriptor */ /* Adjust channel real bits based on report descriptor */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment