Re: [PATCH 2/4] iio: imu: inv_mpu6050: add WoM event inside accel channels

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sun, 25 Feb 2024 16:00:25 +0000
inv.git-commit@xxxxxxx wrote:

> From: Jean-Baptiste Maneyrol <jean-baptiste.maneyrol@xxxxxxx>
> 
> Add WoM (mag_adaptive rising) event in accel channels for all
> chips >= MPU-6500. This requires to create new MPU-6500 channels
> as default and MPU-6050 channels for older chips.
> 
> Signed-off-by: Jean-Baptiste Maneyrol <jean-baptiste.maneyrol@xxxxxxx>
Trivial comment inline - otherwise looks good beyond question of 
event type.

Jonathan

> ---
>  drivers/iio/imu/inv_mpu6050/inv_mpu_core.c | 132 ++++++++++++++-------
>  1 file changed, 89 insertions(+), 43 deletions(-)
> 
> diff --git a/drivers/iio/imu/inv_mpu6050/inv_mpu_core.c b/drivers/iio/imu/inv_mpu6050/inv_mpu_core.c
> index fca7fc1ba4e2..d2544c758815 100644
> --- a/drivers/iio/imu/inv_mpu6050/inv_mpu_core.c
> +++ b/drivers/iio/imu/inv_mpu6050/inv_mpu_core.c
> @@ -1303,23 +1303,34 @@ static const struct iio_chan_spec_ext_info inv_ext_info[] = {
>  	{ }
>  };
>  
> -#define INV_MPU6050_CHAN(_type, _channel2, _index)                    \
> -	{                                                             \
> -		.type = _type,                                        \
> -		.modified = 1,                                        \
> -		.channel2 = _channel2,                                \
> -		.info_mask_shared_by_type = BIT(IIO_CHAN_INFO_SCALE), \
> -		.info_mask_separate = BIT(IIO_CHAN_INFO_RAW) |	      \
> -				      BIT(IIO_CHAN_INFO_CALIBBIAS),   \
> -		.scan_index = _index,                                 \
> -		.scan_type = {                                        \
> -				.sign = 's',                          \
> -				.realbits = 16,                       \
> -				.storagebits = 16,                    \
> -				.shift = 0,                           \
> -				.endianness = IIO_BE,                 \
> -			     },                                       \
> -		.ext_info = inv_ext_info,                             \
> +static const struct iio_event_spec inv_accel_events[] = {
> +	{
> +		.type = IIO_EV_TYPE_MAG_ADAPTIVE,
> +		.dir = IIO_EV_DIR_RISING,
> +		.mask_shared_by_type = BIT(IIO_EV_INFO_ENABLE) |
> +				       BIT(IIO_EV_INFO_VALUE),
> +	},
> +};
> +
> +#define INV_MPU6050_CHAN(_type, _channel2, _index, _events, _events_nb) \
> +	{                                                               \
> +		.type = _type,                                          \
> +		.modified = 1,                                          \
> +		.channel2 = _channel2,                                  \
> +		.info_mask_shared_by_type = BIT(IIO_CHAN_INFO_SCALE),   \
> +		.info_mask_separate = BIT(IIO_CHAN_INFO_RAW) |	        \
> +				      BIT(IIO_CHAN_INFO_CALIBBIAS),     \
> +		.event_spec = _events,                                  \
> +		.num_event_specs = _events_nb,                          \
> +		.scan_index = _index,                                   \
> +		.scan_type = {                                          \
> +				.sign = 's',                            \
Maybe take opportunity to tidy up these intents. One tab is enough.
			.sign = 's',

> +				.realbits = 16,                         \
> +				.storagebits = 16,                      \
> +				.shift = 0,                             \
> +				.endianness = IIO_BE,                   \
> +			     },                                         \
		},
> +		.ext_info = inv_ext_info,                               \
>  	}






[Index of Archives]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Input]     [Linux Kernel]     [Linux SCSI]     [X.org]

  Powered by Linux