add timestamp channel for hid-sensors
Subsystems (3)
v3 cover add timestamp channel for hid-sensors
This patch series add a timestamp channel for hid sensors, including gravity sensor, gyro sensor, magnetometer sensor, ambient light sensor, inclinometer sensor, and rotation sensor.
With this patch series, user can get the time when sensor yield a sample.
---
v3:
- hid-sensor-magn-3d: fix iio_val buffer len issue.
- hid-sensor-accel-3d: refine commit message
v2:
- remove unrelated changes.
Ye Xiang (6):
iio: hid-sensor-accel-3d: Add timestamp channel for gravity sensor
iio: hid-sensor-gyro-3d: Add timestamp channel
iio: hid-sensor-als: Add timestamp channel
iio: hid-sensor-magn-3d: Add timestamp channel
iio: hid-sensor-incl-3d: Add timestamp channel
iio: hid-sensor-rotation: Add timestamp channel
drivers/iio/accel/hid-sensor-accel-3d.c | 6 ++- drivers/iio/gyro/hid-sensor-gyro-3d.c | 40 +++++++++------- drivers/iio/light/hid-sensor-als.c | 39 ++++++++------- drivers/iio/magnetometer/hid-sensor-magn-3d.c | 48 ++++++++++++------- drivers/iio/orientation/hid-sensor-incl-3d.c | 43 ++++++++++------- drivers/iio/orientation/hid-sensor-rotation.c | 46 ++++++++++-------- 6 files changed, 134 insertions(+), 88 deletions(-)
Signature · 1 line
2.17.1
PATCH v3 1/6 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.
--- drivers/iio/accel/hid-sensor-accel-3d.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/iio/accel/hid-sensor-accel-3d.c +4 -2
@@ -23,6 +23,7 @@ enum accel_3d_channel { ACCEL_3D_CHANNEL_MAX, }; +#define CHANNEL_SCAN_INDEX_TIMESTAMP ACCEL_3D_CHANNEL_MAXstruct accel_3d_state {struct hid_sensor_hub_callbacks callbacks;struct hid_sensor_common common_attributes;
@@ -82,7 +83,7 @@ static const struct iio_chan_spec accel_3d_channels[] = {BIT (IIO_CHAN_INFO_HYSTERESIS ), .scan_index = CHANNEL_SCAN_INDEX_Z, }, - IIO_CHAN_SOFT_TIMESTAMP(3) +IIO_CHAN_SOFT_TIMESTAMP (CHANNEL_SCAN_INDEX_TIMESTAMP ) };/* Channel definitions */
@@ -117,7 +118,8 @@ static const struct iio_chan_spec gravity_channels[] = { BIT(IIO_CHAN_INFO_SAMP_FREQ) | BIT(IIO_CHAN_INFO_HYSTERESIS), .scan_index = CHANNEL_SCAN_INDEX_Z, - } + }, + IIO_CHAN_SOFT_TIMESTAMP(CHANNEL_SCAN_INDEX_TIMESTAMP), };/* Adjust channel real bits based on report descriptor */
Signature · 1 line
2.17.1
PATCH v3 2/6 iio: hid-sensor-gyro-3d: Add timestamp channel
In reply to Ye XiangEach sample has a timestamp field with this change. This timestamp may be from the sensor hub when present or local kernel timestamp. And the unit of timestamp is nanosecond.
--- drivers/iio/gyro/hid-sensor-gyro-3d.c | 40 ++++++++++++++++----------- 1 file changed, 24 insertions(+), 16 deletions(-)
drivers/iio/gyro/hid-sensor-gyro-3d.c +24 -16
@@ -23,15 +23,20 @@ enum gyro_3d_channel { GYRO_3D_CHANNEL_MAX, }; +#define CHANNEL_SCAN_INDEX_TIMESTAMP GYRO_3D_CHANNEL_MAXstruct gyro_3d_state {struct hid_sensor_hub_callbacks callbacks;struct hid_sensor_common common_attributes;struct hid_sensor_hub_attribute_info gyro[GYRO_3D_CHANNEL_MAX ]; -u32 gyro_val[GYRO_3D_CHANNEL_MAX ]; +struct { +u32 gyro_val[GYRO_3D_CHANNEL_MAX ]; +u64 timestamp__aligned(8) ; + } scan;int scale_pre_decml;int scale_post_decml;int scale_precision;int value_offset; +s64 timestamp; };static const u32 gyro_3d_addresses[GYRO_3D_CHANNEL_MAX ] = {
@@ -79,7 +84,8 @@ static const struct iio_chan_spec gyro_3d_channels[] = { BIT(IIO_CHAN_INFO_SAMP_FREQ) | BIT(IIO_CHAN_INFO_HYSTERESIS), .scan_index = CHANNEL_SCAN_INDEX_Z, - } + }, +IIO_CHAN_SOFT_TIMESTAMP (CHANNEL_SCAN_INDEX_TIMESTAMP) };/* Adjust channel real bits based on report descriptor */
@@ -185,14 +191,6 @@ static const struct iio_info gyro_3d_info = { .write_raw = &gyro_3d_write_raw, }; -/* Function to push data to buffer */ -static void hid_sensor_push_data (struct iio_dev *indio_dev,const void *data, -int len) -{ -dev_dbg (&indio_dev->dev,"hid_sensor_push_data\n" ); -iio_push_to_buffers (indio_dev, data); -} -/* Callback handler to send event after all samples are received and captured */ static int gyro_3d_proc_event(struct hid_sensor_hub_device *hsdev, unsigned usage_id,
@@ -202,10 +200,15 @@ static int gyro_3d_proc_event(struct hid_sensor_hub_device *hsdev,struct gyro_3d_state *gyro_state =iio_priv (indio_dev);dev_dbg (&indio_dev->dev,"gyro_3d_proc_event\n" ); -if (atomic_read (&gyro_state->common_attributes.data_ready)) -hid_sensor_push_data (indio_dev, - gyro_state->gyro_val, -sizeof (gyro_state->gyro_val)); +if (atomic_read (&gyro_state->common_attributes.data_ready)) { +if (!gyro_state->timestamp) + gyro_state->timestamp =iio_get_time_ns (indio_dev); + +iio_push_to_buffers_with_timestamp (indio_dev, &gyro_state->scan, + gyro_state->timestamp); + + gyro_state->timestamp =0 ; + }return 0 ; }
@@ -226,10 +229,15 @@ static int gyro_3d_capture_sample(struct hid_sensor_hub_device *hsdev,case HID_USAGE_SENSOR_ANGL_VELOCITY_Y_AXIS :case HID_USAGE_SENSOR_ANGL_VELOCITY_Z_AXIS : offset = usage_id -HID_USAGE_SENSOR_ANGL_VELOCITY_X_AXIS ; - gyro_state->gyro_val[CHANNEL_SCAN_INDEX_X + offset] = - *(u32 *)raw_data; + gyro_state->scan.gyro_val[CHANNEL_SCAN_INDEX_X + offset] = + *(u32 *)raw_data; ret =0 ;break ; +case HID_USAGE_SENSOR_TIME_TIMESTAMP : + gyro_state->timestamp = +hid_sensor_convert_timestamp (&gyro_state->common_attributes, + *(s64 *)raw_data); +break ;default :break ; }
Signature · 1 line
2.17.1
PATCH v3 3/6 iio: hid-sensor-als: Add timestamp channel
In reply to Ye XiangEach sample has a timestamp field with this change. This timestamp may be from the sensor hub when present or local kernel timestamp. And the unit of timestamp is nanosecond.
--- drivers/iio/light/hid-sensor-als.c | 39 ++++++++++++++++++------------ 1 file changed, 23 insertions(+), 16 deletions(-)
drivers/iio/light/hid-sensor-als.c +23 -16
@@ -22,15 +22,21 @@ enum {CHANNEL_SCAN_INDEX_MAX }; +#define CHANNEL_SCAN_INDEX_TIMESTAMP CHANNEL_SCAN_INDEX_MAX +struct als_state {struct hid_sensor_hub_callbacks callbacks;struct hid_sensor_common common_attributes;struct hid_sensor_hub_attribute_info als_illum; -u32 illum[CHANNEL_SCAN_INDEX_MAX ]; +struct { +u32 illum[CHANNEL_SCAN_INDEX_MAX ]; +u64 timestamp__aligned(8) ; + } scan;int scale_pre_decml;int scale_post_decml;int scale_precision;int value_offset; +s64 timestamp; };static const u32 als_sensitivity_addresses[] = {
@@ -59,7 +65,8 @@ static const struct iio_chan_spec als_channels[] = { BIT(IIO_CHAN_INFO_SAMP_FREQ) | BIT(IIO_CHAN_INFO_HYSTERESIS), .scan_index = CHANNEL_SCAN_INDEX_ILLUM, - } + }, +IIO_CHAN_SOFT_TIMESTAMP (CHANNEL_SCAN_INDEX_TIMESTAMP) };/* Adjust channel real bits based on report descriptor */
@@ -173,14 +180,6 @@ static const struct iio_info als_info = { .write_raw = &als_write_raw, }; -/* Function to push data to buffer */ -static void hid_sensor_push_data (struct iio_dev *indio_dev,const void *data, -int len) -{ -dev_dbg (&indio_dev->dev,"hid_sensor_push_data\n" ); -iio_push_to_buffers (indio_dev, data); -} -/* Callback handler to send event after all samples are received and captured */ static int als_proc_event(struct hid_sensor_hub_device *hsdev, unsigned usage_id,
@@ -190,10 +189,14 @@ static int als_proc_event(struct hid_sensor_hub_device *hsdev,struct als_state *als_state =iio_priv (indio_dev);dev_dbg (&indio_dev->dev,"als_proc_event\n" ); -if (atomic_read (&als_state->common_attributes.data_ready)) -hid_sensor_push_data (indio_dev, - &als_state->illum, -sizeof (als_state->illum)); +if (atomic_read (&als_state->common_attributes.data_ready)) { +if (!als_state->timestamp) + als_state->timestamp =iio_get_time_ns (indio_dev); + +iio_push_to_buffers_with_timestamp (indio_dev, &als_state->scan, + als_state->timestamp); + als_state->timestamp =0 ; + }return 0 ; }
@@ -211,10 +214,14 @@ static int als_capture_sample(struct hid_sensor_hub_device *hsdev,switch (usage_id) {case HID_USAGE_SENSOR_LIGHT_ILLUM : - als_state->illum[CHANNEL_SCAN_INDEX_INTENSITY ] = sample_data; - als_state->illum[CHANNEL_SCAN_INDEX_ILLUM ] = sample_data; + als_state->scan.illum[CHANNEL_SCAN_INDEX_INTENSITY ] = sample_data; + als_state->scan.illum[CHANNEL_SCAN_INDEX_ILLUM ] = sample_data; ret =0 ;break ; +case HID_USAGE_SENSOR_TIME_TIMESTAMP : + als_state->timestamp =hid_sensor_convert_timestamp (&als_state->common_attributes, + *(s64 *)raw_data); +break ;default :break ; }
Signature · 1 line
2.17.1
PATCH v3 4/6 iio: hid-sensor-magn-3d: Add timestamp channel
In reply to Ye XiangEach sample has a timestamp field with this change. This timestamp may be from the sensor hub when present or local kernel timestamp. And the unit of timestamp is nanosecond.
--- drivers/iio/magnetometer/hid-sensor-magn-3d.c | 48 ++++++++++++------- 1 file changed, 30 insertions(+), 18 deletions(-)
drivers/iio/magnetometer/hid-sensor-magn-3d.c +30 -18
@@ -24,6 +24,7 @@ enum magn_3d_channel {CHANNEL_SCAN_INDEX_NORTH_TRUE_TILT_COMP ,CHANNEL_SCAN_INDEX_NORTH_MAGN ,CHANNEL_SCAN_INDEX_NORTH_TRUE , +CHANNEL_SCAN_INDEX_TIMESTAMP , MAGN_3D_CHANNEL_MAX, };
@@ -47,6 +48,7 @@ struct magn_3d_state {struct common_attributes magn_flux_attr;struct common_attributes rot_attr; +s64 timestamp; };static const u32 magn_3d_addresses[MAGN_3D_CHANNEL_MAX ] = {
@@ -57,6 +59,7 @@ static const u32 magn_3d_addresses[MAGN_3D_CHANNEL_MAX] = {HID_USAGE_SENSOR_ORIENT_COMP_TRUE_NORTH ,HID_USAGE_SENSOR_ORIENT_MAGN_NORTH ,HID_USAGE_SENSOR_ORIENT_TRUE_NORTH , + HID_USAGE_SENSOR_TIME_TIMESTAMP, }; static const u32 magn_3d_sensitivity_addresses[] = {
@@ -132,7 +135,8 @@ static const struct iio_chan_spec magn_3d_channels[] = { BIT(IIO_CHAN_INFO_SCALE) | BIT(IIO_CHAN_INFO_SAMP_FREQ) | BIT(IIO_CHAN_INFO_HYSTERESIS), - } + }, +IIO_CHAN_SOFT_TIMESTAMP (7 ) };/* Adjust channel real bits based on report descriptor */
@@ -281,13 +285,6 @@ static const struct iio_info magn_3d_info = { .write_raw = &magn_3d_write_raw, }; -/* Function to push data to buffer */ -static void hid_sensor_push_data (struct iio_dev *indio_dev,const void *data) -{ -dev_dbg (&indio_dev->dev,"hid_sensor_push_data\n" ); -iio_push_to_buffers (indio_dev, data); -} -/* Callback handler to send event after all samples are received and captured */ static int magn_3d_proc_event(struct hid_sensor_hub_device *hsdev, unsigned usage_id,
@@ -297,8 +294,15 @@ static int magn_3d_proc_event(struct hid_sensor_hub_device *hsdev,struct magn_3d_state *magn_state =iio_priv (indio_dev);dev_dbg (&indio_dev->dev,"magn_3d_proc_event\n" ); -if (atomic_read (&magn_state->magn_flux_attributes.data_ready)) -hid_sensor_push_data (indio_dev, magn_state->iio_vals); +if (atomic_read (&magn_state->magn_flux_attributes.data_ready)) { +if (!magn_state->timestamp) + magn_state->timestamp =iio_get_time_ns (indio_dev); + +iio_push_to_buffers_with_timestamp (indio_dev, + magn_state->iio_vals, + magn_state->timestamp); + magn_state->timestamp =0 ; + }return 0 ; }
@@ -329,6 +333,11 @@ static int magn_3d_capture_sample(struct hid_sensor_hub_device *hsdev, offset = (usage_id -HID_USAGE_SENSOR_ORIENT_COMP_MAGN_NORTH ) +CHANNEL_SCAN_INDEX_NORTH_MAGN_TILT_COMP ;break ; +case HID_USAGE_SENSOR_TIME_TIMESTAMP : + magn_state->timestamp = +hid_sensor_convert_timestamp (&magn_state->magn_flux_attributes, + *(s64 *)raw_data); +return ret;default :return -EINVAL ; }
@@ -394,9 +403,10 @@ static int magn_3d_parse_report(struct platform_device *pdev,return -ENOMEM ; } - st->iio_vals =devm_kcalloc (&pdev->dev, attr_count, -sizeof (u32), -GFP_KERNEL ); +/* attr_count include timestamp channel, and the iio_vals should be aligned to 8byte */ + st->iio_vals =devm_kcalloc (&pdev->dev, + ((attr_count +1 ) %2 + (attr_count +1 ) /2 ) *2 , +sizeof (u32),GFP_KERNEL );if (!st->iio_vals) {dev_err (&pdev->dev,"failed to allocate space for iio values array\n" );
@@ -412,11 +422,13 @@ static int magn_3d_parse_report(struct platform_device *pdev, (_channels[*chan_count]).scan_index = *chan_count; (_channels[*chan_count]).address = i; -/* Set magn_val_addr to iio value address */ - st->magn_val_addr[i] = &(st->iio_vals[*chan_count]); -magn_3d_adjust_channel_bit_mask (_channels, - *chan_count, - st->magn[i].size); +if (i !=CHANNEL_SCAN_INDEX_TIMESTAMP ) { +/* Set magn_val_addr to iio value address */ + st->magn_val_addr[i] = &st->iio_vals[*chan_count]; +magn_3d_adjust_channel_bit_mask (_channels, + *chan_count, + st->magn[i].size); + } (*chan_count)++; } }
Signature · 1 line
2.17.1
PATCH v3 5/6 iio: hid-sensor-incl-3d: Add timestamp channel
In reply to Ye XiangEach sample has a timestamp field with this change. This timestamp may be from the sensor hub when present or local kernel timestamp. And the unit of timestamp is nanosecond.
--- drivers/iio/orientation/hid-sensor-incl-3d.c | 43 ++++++++++++-------- 1 file changed, 27 insertions(+), 16 deletions(-)
drivers/iio/orientation/hid-sensor-incl-3d.c +27 -16
@@ -24,15 +24,21 @@ enum incl_3d_channel { INCLI_3D_CHANNEL_MAX, }; +#define CHANNEL_SCAN_INDEX_TIMESTAMP INCLI_3D_CHANNEL_MAX +struct incl_3d_state {struct hid_sensor_hub_callbacks callbacks;struct hid_sensor_common common_attributes;struct hid_sensor_hub_attribute_info incl[INCLI_3D_CHANNEL_MAX ]; -u32 incl_val[INCLI_3D_CHANNEL_MAX ]; +struct { +u32 incl_val[INCLI_3D_CHANNEL_MAX ]; +u64 timestamp__aligned(8) ; + } scan;int scale_pre_decml;int scale_post_decml;int scale_precision;int value_offset; +s64 timestamp; };static const u32 incl_3d_addresses[INCLI_3D_CHANNEL_MAX ] = {
@@ -81,7 +87,8 @@ static const struct iio_chan_spec incl_3d_channels[] = { BIT(IIO_CHAN_INFO_SAMP_FREQ) | BIT(IIO_CHAN_INFO_HYSTERESIS), .scan_index = CHANNEL_SCAN_INDEX_Z, - } + }, + IIO_CHAN_SOFT_TIMESTAMP(CHANNEL_SCAN_INDEX_TIMESTAMP), };/* Adjust channel real bits based on report descriptor */
@@ -186,13 +193,6 @@ static const struct iio_info incl_3d_info = { .write_raw = &incl_3d_write_raw, }; -/* Function to push data to buffer */ -static void hid_sensor_push_data (struct iio_dev *indio_dev,u8 *data,int len) -{ -dev_dbg (&indio_dev->dev,"hid_sensor_push_data\n" ); -iio_push_to_buffers (indio_dev, (u8 *)data); -} -/* Callback handler to send event after all samples are received and captured */ static int incl_3d_proc_event(struct hid_sensor_hub_device *hsdev, unsigned usage_id,
@@ -202,10 +202,16 @@ static int incl_3d_proc_event(struct hid_sensor_hub_device *hsdev,struct incl_3d_state *incl_state =iio_priv (indio_dev);dev_dbg (&indio_dev->dev,"incl_3d_proc_event\n" ); -if (atomic_read (&incl_state->common_attributes.data_ready)) -hid_sensor_push_data (indio_dev, - (u8 *)incl_state->incl_val, -sizeof (incl_state->incl_val)); +if (atomic_read (&incl_state->common_attributes.data_ready)) { +if (!incl_state->timestamp) + incl_state->timestamp =iio_get_time_ns (indio_dev); + +iio_push_to_buffers_with_timestamp (indio_dev, + &incl_state->scan, + incl_state->timestamp); + + incl_state->timestamp =0 ; + }return 0 ; }
@@ -222,13 +228,18 @@ static int incl_3d_capture_sample(struct hid_sensor_hub_device *hsdev,switch (usage_id) {case HID_USAGE_SENSOR_ORIENT_TILT_X : - incl_state->incl_val[CHANNEL_SCAN_INDEX_X ] = *(u32 *)raw_data; + incl_state->scan.incl_val[CHANNEL_SCAN_INDEX_X ] = *(u32 *)raw_data;break ;case HID_USAGE_SENSOR_ORIENT_TILT_Y : - incl_state->incl_val[CHANNEL_SCAN_INDEX_Y ] = *(u32 *)raw_data; + incl_state->scan.incl_val[CHANNEL_SCAN_INDEX_Y ] = *(u32 *)raw_data;break ;case HID_USAGE_SENSOR_ORIENT_TILT_Z : - incl_state->incl_val[CHANNEL_SCAN_INDEX_Z ] = *(u32 *)raw_data; + incl_state->scan.incl_val[CHANNEL_SCAN_INDEX_Z ] = *(u32 *)raw_data; +break ; +case HID_USAGE_SENSOR_TIME_TIMESTAMP : + incl_state->timestamp = +hid_sensor_convert_timestamp (&incl_state->common_attributes, + *(s64 *)raw_data);break ;default : ret = -EINVAL ;
Signature · 1 line
2.17.1
PATCH v3 6/6 iio: hid-sensor-rotation: Add timestamp channel
In reply to Ye XiangEach sample has a timestamp field with this change. This timestamp may be from the sensor hub when present or local kernel timestamp. And the unit of timestamp is nanosecond.
--- drivers/iio/orientation/hid-sensor-rotation.c | 46 +++++++++++-------- 1 file changed, 26 insertions(+), 20 deletions(-)
drivers/iio/orientation/hid-sensor-rotation.c +26 -20
@@ -20,11 +20,15 @@ struct dev_rot_state {struct hid_sensor_hub_callbacks callbacks;struct hid_sensor_common common_attributes;struct hid_sensor_hub_attribute_info quaternion; -u32 sampled_vals[4 ]; +struct { +u32 sampled_vals[4 ]__aligned(16) ; +u64 timestamp__aligned(8) ; + } scan;int scale_pre_decml;int scale_post_decml;int scale_precision;int value_offset; +s64 timestamp; };static const u32 rotation_sensitivity_addresses[] = {
@@ -42,8 +46,10 @@ static const struct iio_chan_spec dev_rot_channels[] = { .info_mask_shared_by_type = BIT(IIO_CHAN_INFO_SAMP_FREQ) | BIT(IIO_CHAN_INFO_OFFSET) | BIT(IIO_CHAN_INFO_SCALE) | -BIT (IIO_CHAN_INFO_HYSTERESIS ) - } + BIT(IIO_CHAN_INFO_HYSTERESIS), + .scan_index = 0 + }, +IIO_CHAN_SOFT_TIMESTAMP (1 ) };/* Adjust channel real bits based on report descriptor */
@@ -75,7 +81,7 @@ static int dev_rot_read_raw(struct iio_dev *indio_dev,case IIO_CHAN_INFO_RAW :if (size >=4 ) {for (i =0 ; i <4 ; ++i) - vals[i] = rot_state->sampled_vals[i]; + vals[i] = rot_state->scan.sampled_vals[i]; ret_type =IIO_VAL_INT_MULTIPLE ; *val_len =4 ; }else
@@ -137,15 +143,6 @@ static const struct iio_info dev_rot_info = { .write_raw = &dev_rot_write_raw, }; -/* Function to push data to buffer */ -static void hid_sensor_push_data (struct iio_dev *indio_dev,u8 *data,int len) -{ -dev_dbg (&indio_dev->dev,"hid_sensor_push_data >>\n" ); -iio_push_to_buffers (indio_dev, (u8 *)data); -dev_dbg (&indio_dev->dev,"hid_sensor_push_data <<\n" ); - -} -/* Callback handler to send event after all samples are received and captured */ static int dev_rot_proc_event(struct hid_sensor_hub_device *hsdev, unsigned usage_id,
@@ -155,10 +152,15 @@ static int dev_rot_proc_event(struct hid_sensor_hub_device *hsdev,struct dev_rot_state *rot_state =iio_priv (indio_dev);dev_dbg (&indio_dev->dev,"dev_rot_proc_event\n" ); -if (atomic_read (&rot_state->common_attributes.data_ready)) -hid_sensor_push_data (indio_dev, - (u8 *)rot_state->sampled_vals, -sizeof (rot_state->sampled_vals)); +if (atomic_read (&rot_state->common_attributes.data_ready)) { +if (!rot_state->timestamp) + rot_state->timestamp =iio_get_time_ns (indio_dev); + +iio_push_to_buffers_with_timestamp (indio_dev, &rot_state->scan, + rot_state->timestamp); + + rot_state->timestamp =0 ; + }return 0 ; }
@@ -173,10 +175,14 @@ static int dev_rot_capture_sample(struct hid_sensor_hub_device *hsdev,struct dev_rot_state *rot_state =iio_priv (indio_dev);if (usage_id ==HID_USAGE_SENSOR_ORIENT_QUATERNION ) { -memcpy (rot_state->sampled_vals, raw_data, -sizeof (rot_state->sampled_vals)); +memcpy (&rot_state->scan.sampled_vals, raw_data, +sizeof (rot_state->scan.sampled_vals)); +dev_dbg (&indio_dev->dev,"Recd Quat len:%zu::%zu\n" , raw_len, -sizeof (rot_state->sampled_vals)); +sizeof (rot_state->scan.sampled_vals)); + }else if (usage_id ==HID_USAGE_SENSOR_TIME_TIMESTAMP ) { + rot_state->timestamp =hid_sensor_convert_timestamp (&rot_state->common_attributes, + *(s64 *)raw_data); }return 0 ;
Signature · 1 line
2.17.1
Srinivas Pandruvada
maintainerQuoted 7 lines · Ye Xiang
This patch series add a timestamp channel for hid sensors, including gravity sensor, gyro sensor, magnetometer sensor, ambient light sensor, inclinometer sensor, and rotation sensor.
With this patch series, user can get the time when sensor yield a sample.
I think this series is v1 for upstream not v3.
Thanks,
Srinivas
Quoted 26 lines
---
v3:
- hid-sensor-magn-3d: fixiio_valbuffer len issue.
- hid-sensor-accel-3d: refine commit messagev2:
- remove unrelated changes.Ye Xiang (6):
iio: hid-sensor-accel-3d: Add timestamp channel for gravity sensor
iio: hid-sensor-gyro-3d: Add timestamp channel
iio: hid-sensor-als: Add timestamp channel
iio: hid-sensor-magn-3d: Add timestamp channel
iio: hid-sensor-incl-3d: Add timestamp channel
iio: hid-sensor-rotation: Add timestamp channeldrivers/iio/accel/hid-sensor-accel-3d.c | 6 ++- drivers/iio/gyro/hid-sensor-gyro-3d.c | 40 +++++++++------- drivers/iio/light/hid-sensor-als.c | 39 ++++++++-------
drivers/iio/magnetometer/hid-sensor-magn-3d.c| 48 ++++++++++++----- --
drivers/iio/orientation/hid-sensor-incl-3d.c | 43 ++++++++++-------drivers/iio/orientation/hid-sensor-rotation.c| 46 ++++++++++------- -6 files changed, 134 insertions(+), 88 deletions(-)
Quoted 9 lines · Srinivas Pandruvada
Quoted 7 lines · Ye Xiang
This patch series add a timestamp channel for hid sensors, including gravity sensor, gyro sensor, magnetometer sensor, ambient light sensor, inclinometer sensor, and rotation sensor.
With this patch series, user can get the time when sensor yield a sample.
I think this series is v1 for upstream not v3.
Sorry, it's v1 for upstream. will resent it as v1. v3 is our internal review version.
Thanks
Ye Xiang
Quoted 30 lines
Quoted 28 lines
---
v3:
- hid-sensor-magn-3d: fixiio_valbuffer len issue.
- hid-sensor-accel-3d: refine commit messagev2:
- remove unrelated changes.Ye Xiang (6):
iio: hid-sensor-accel-3d: Add timestamp channel for gravity sensor
iio: hid-sensor-gyro-3d: Add timestamp channel
iio: hid-sensor-als: Add timestamp channel
iio: hid-sensor-magn-3d: Add timestamp channel
iio: hid-sensor-incl-3d: Add timestamp channel
iio: hid-sensor-rotation: Add timestamp channeldrivers/iio/accel/hid-sensor-accel-3d.c | 6 ++- drivers/iio/gyro/hid-sensor-gyro-3d.c | 40 +++++++++------- drivers/iio/light/hid-sensor-als.c | 39 ++++++++-------
drivers/iio/magnetometer/hid-sensor-magn-3d.c| 48 ++++++++++++----- --
drivers/iio/orientation/hid-sensor-incl-3d.c | 43 ++++++++++-------drivers/iio/orientation/hid-sensor-rotation.c| 46 ++++++++++------- -6 files changed, 134 insertions(+), 88 deletions(-)
Jonathan Cameron
maintainerQuoted 6 lines · Xiang
Quoted 5 lines · Srinivas Pandruvada
Quoted 4 lines · Ye Xiang
This patch series add a timestamp channel for hid sensors, including gravity sensor, gyro sensor, magnetometer sensor, ambient light sensor, inclinometer sensor, and rotation sensor.
Quoted 6 lines
Quoted 4 lines
Quoted 3 lines
With this patch series, user can get the time when sensor yield a sample.
I think this series is v1 for upstream not v3.
Sorry, it's v1 for upstream. will resent it as v1. v3 is our internal review version.
Future notice, if you make a mistake of this particular type - don't resend and carry on with future version numbers. Otherwise it gets really confusing
if we get to a public v3 version! Monotonic version numbers only :)
Not a bit problem though but if that does happen check I don't grab the wrong version.
Jonathan
Quoted 32 lines
Thanks
Ye XiangQuoted 30 lines
Quoted 28 lines
---
v3:
- hid-sensor-magn-3d: fixiio_valbuffer len issue.
- hid-sensor-accel-3d: refine commit messagev2:
- remove unrelated changes.Ye Xiang (6):
iio: hid-sensor-accel-3d: Add timestamp channel for gravity sensor
iio: hid-sensor-gyro-3d: Add timestamp channel
iio: hid-sensor-als: Add timestamp channel
iio: hid-sensor-magn-3d: Add timestamp channel
iio: hid-sensor-incl-3d: Add timestamp channel
iio: hid-sensor-rotation: Add timestamp channeldrivers/iio/accel/hid-sensor-accel-3d.c | 6 ++- drivers/iio/gyro/hid-sensor-gyro-3d.c | 40 +++++++++------- drivers/iio/light/hid-sensor-als.c | 39 ++++++++-------
drivers/iio/magnetometer/hid-sensor-magn-3d.c| 48 ++++++++++++----- --
drivers/iio/orientation/hid-sensor-incl-3d.c | 43 ++++++++++-------drivers/iio/orientation/hid-sensor-rotation.c| 46 ++++++++++------- -6 files changed, 134 insertions(+), 88 deletions(-)
Quoted 13 lines · Jonathan Cameron
Quoted 10 lines · Xiang
Quoted 9 lines · Srinivas Pandruvada
Quoted 7 lines · Ye Xiang
This patch series add a timestamp channel for hid sensors, including gravity sensor, gyro sensor, magnetometer sensor, ambient light sensor, inclinometer sensor, and rotation sensor.
With this patch series, user can get the time when sensor yield a sample.
I think this series is v1 for upstream not v3.
Quoted 8 lines
Quoted 2 lines
Sorry, it's v1 for upstream. will resent it as v1. v3 is our internal review version.
Future notice, if you make a mistake of this particular type - don't resend and carry on with future version numbers. Otherwise it gets really confusing
if we get to a public v3 version! Monotonic version numbers only :)Not a bit problem though but if that does happen check I don't grab the wrong version.
Got it. you grabed the right version v1 for test. thanks.
Thanks
Ye Xiang
Quoted 32 lines
Quoted 31 lines
Quoted 31 lines
Quoted 29 lines
---
v3:
- hid-sensor-magn-3d: fixiio_valbuffer len issue.
- hid-sensor-accel-3d: refine commit messagev2:
- remove unrelated changes.Ye Xiang (6):
iio: hid-sensor-accel-3d: Add timestamp channel for gravity sensor
iio: hid-sensor-gyro-3d: Add timestamp channel
iio: hid-sensor-als: Add timestamp channel
iio: hid-sensor-magn-3d: Add timestamp channel
iio: hid-sensor-incl-3d: Add timestamp channel
iio: hid-sensor-rotation: Add timestamp channeldrivers/iio/accel/hid-sensor-accel-3d.c | 6 ++- drivers/iio/gyro/hid-sensor-gyro-3d.c | 40 +++++++++------- drivers/iio/light/hid-sensor-als.c | 39 ++++++++-------
drivers/iio/magnetometer/hid-sensor-magn-3d.c| 48 ++++++++++++----- --
drivers/iio/orientation/hid-sensor-incl-3d.c | 43 ++++++++++-------drivers/iio/orientation/hid-sensor-rotation.c| 46 ++++++++++------- -6 files changed, 134 insertions(+), 88 deletions(-)