Re: [PATCH V8 5/5] iio: accel: sca3300: Add inclination channels

From: Jonathan Cameron
Date: Sat May 28 2022 - 13:14:42 EST


On Mon, 23 May 2022 06:23:12 +0000
LI Qingwu <Qing-wu.Li@xxxxxxxxxxxxxxxxxxxxxxx> wrote:

> Different from SCA3300, SCL3300 can output inclination angles.
> Angles are formed from acceleration with following equations:
> ANG_X = atan2(accx , sqrt(pow(accy , 2) + pow(accz , 2)))
> ANG_Y = atan2(accy , sqrt(pow(accx , 2) + pow(accz , 2)))
> ANG_Z = atan2(accz , sqrt(pow(accx , 2) + pow(accy , 2)))
>
> The commit adds the output of the raw value, scale
> and scale_available of angles.
>
> New interfaces:
> in_incli_scale
> in_incli_scale_available
> in_incli_x_raw
> in_incli_y_raw
> in_incli_z_raw
> Data converted by application of scale to degrees.
>
> Signed-off-by: LI Qingwu <Qing-wu.Li@xxxxxxxxxxxxxxxxxxxxxxx>
> ---

Hi,

One comment inline.

> struct sca3300_chip_info {
> const char *name;
> const unsigned long *scan_masks;
> @@ -123,12 +167,16 @@ struct sca3300_chip_info {
> u8 num_accel_scales;
> const int (*accel_scale)[2];
> const int *accel_scale_map;
> + const int (*incli_scale)[2];
> + const int *incli_scale_map;
> + u8 num_incli_scales;
> u8 num_freqs;
> const int *freq_table;
> const int *freq_map;
> const int *avail_modes_table;
> u8 num_avail_modes;
> u8 chip_id;
> + bool angle;

"angle" is a bit vague. Perhaps "angle_supported"?

Otherwise this looks good to me.

Thanks,

Jonathan