Re: [PATCH V1 2/6] iio: accel: sca3300: Add interface for operation modes.

From: Andy Shevchenko
Date: Mon Jan 24 2022 - 08:05:04 EST


On Mon, Jan 24, 2022 at 11:39 AM LI Qingwu
<Qing-wu.Li@xxxxxxxxxxxxxxxxxxxxxxx> wrote:
>
> The acceleration scale and the frequency were set via operation modes,
> the scal and frequency are both non-uniqueness,

scale

> this leads to logic confusion for setting scale.and.frequency.
> it getting worse if add more different sensor types into the driver.

It gets
if you add

> The commit add an interface for set and get the operation modes.
> the following interfaces added:

> in_accel_op_mode_available
> in_op_mode

Please indent them by let's say 2 spaces.

> SCA3300 operation modes table:
> | Mode | Full-scale | low pass filter frequency |
> | ---- | ---------- | ------------------------- |
> | 1 | ± 3 g | 70 Hz |
> | 2 | ± 6 g | 70 Hz |
> | 3 | ± 1.5 g | 70 Hz |
> | 4 | ± 1.5 g | 10 Hz |

...

> +static const char * const sca3300_op_modes[] = {
> + [OP_MOD_1] = "1",
> + [OP_MOD_2] = "2",
> + [OP_MOD_3] = "3",

> + [OP_MOD_4] = "4"

+ Comma.

> +};

...

> + int mode;
> + int ret;
> + struct sca3300_data *data = iio_priv(indio_dev);

Here and everywhere else, can we keep reversed xmas tree order?

struct sca3300_data *data = iio_priv(indio_dev);
int mode;
int ret;

--
With Best Regards,
Andy Shevchenko