Re: [PATCH 5/5] staging: drivers: iio: adc: Adc MAX77541 ADC Support

From: Andy Shevchenko
Date: Wed Dec 07 2022 - 06:30:33 EST


On Wed, Dec 07, 2022 at 12:08:44PM +0300, Okan Sahin wrote:
> This patch add adc support for MAX77541.
>
> The MAX77541 has an 8-bit Successive Approximation Register (SAR) ADC
> with four multiplexers for supporting the telemetry feature

Same comment as per patch 2.

...

> +#include <linux/bitfield.h>
> +#include <linux/iio/iio.h>

> +#include <include/linux/mfd/max77541.h>

Hmm...

> +#include <linux/platform_device.h>
> +#include <linux/regmap.h>
> +#include <linux/regulator/driver.h>
> +#include <linux/regulator/of_regulator.h>

...

> +enum {
> + MAX77541_ADC_CH1_I = 0,
> + MAX77541_ADC_CH2_I,
> + MAX77541_ADC_CH3_I,
> + MAX77541_ADC_CH6_I,
> +
> + MAX77541_ADC_IRQMAX_I,

If it's a terminator, drop the trailing comma.

> +};

...

> + case MAX77541_ADC_TEMP:
> + *val = -273;

I believe we have definition for this in units.h. Can you use it?

> + *val2 = 0;
> + return IIO_VAL_INT_PLUS_MICRO;


> + }
> +}

...

> + *val = 0;
> +
> + if (reg_val == LOW_RANGE)
> + *val2 = 6250;
> + else if (reg_val == MID_RANGE)
> + *val2 = 12500;
> + else if (reg_val == HIGH_RANGE)
> + *val2 = 25000;
> + else
> + return -EINVAL;

Can it be provided as a table?

...

> + *val = 0;
> +
> + if (reg_val == LOW_RANGE)
> + *val2 = 6250;
> + else if (reg_val == MID_RANGE)
> + *val2 = 12500;
> + else if (reg_val == HIGH_RANGE)
> + *val2 = 25000;
> + else
> + return -EINVAL;

Ditto.

...

> +

Redundant blank line.

> +module_platform_driver(max77541_adc_driver);

--
With Best Regards,
Andy Shevchenko