Re: [PATCH v8 4/4] iio: cdc: add Texas Instruments FDC1004 driver

From: Andy Shevchenko

Date: Tue Nov 10 2026 - 16:18:21 EST


On Tue, Nov 10, 2026 at 02:24:22PM -0600, Victor Chernyakin wrote:
> The FDC1004 is a high-precision 4-channel capacitive sensor that talks
> over I2C. It can report the values of each of its 4 channels individually,
> as well as the difference between any two of them.
>
> This initial driver allows performing single reads and configuring
> the sensor's various settings (sample frequency, calibration
> gain/offset, etc.). It could be extended with support for triggered
> buffers, repeated measurement mode, and/or power management.

Basically a single nit-pick below (add a comment) and I'm totally fine with
this to go (we may polish it later on).

Reviewed-by: Andy Shevchenko <andriy.shevchenko@xxxxxxxxx>

...

> +static const struct regmap_config fdc1004_regmap_config = {
> + .name = "fdc1004",
> + .reg_bits = 8,
> + .val_bits = 16,

Add a relatively short summary here as a comment on why the below is true.

> + .use_single_read = true,
> + .val_format_endian = REGMAP_ENDIAN_BIG,
> + .max_register = FDC1004_REG_GAIN_CAL_CINn(3),
> + .rd_table = &fdc1004_readable_reg_table,
> + .wr_table = &fdc1004_writeable_reg_table,
> + .volatile_table = &fdc1004_volatile_reg_table,
> + .cache_type = REGCACHE_MAPLE,
> +};

...

> +static const int fdc1004_calibbias_decomposed[] = {
> + lower_32_bits(fdc1004_calibbias[0]), upper_32_bits(fdc1004_calibbias[0]),
> + lower_32_bits(fdc1004_calibbias[1]), upper_32_bits(fdc1004_calibbias[1]),
> + lower_32_bits(fdc1004_calibbias[2]), upper_32_bits(fdc1004_calibbias[2]),
> +};
> +
> +static const int fdc1004_calibscale_decomposed[] = {
> + lower_32_bits(fdc1004_calibscale[0]), upper_32_bits(fdc1004_calibscale[0]),
> + lower_32_bits(fdc1004_calibscale[1]), upper_32_bits(fdc1004_calibscale[1]),
> + lower_32_bits(fdc1004_calibscale[2]), upper_32_bits(fdc1004_calibscale[2]),
> +};

Can we prepare them dynamically at runtime? Use global variables and a macro
from once.h to make the populate function a singleton, so we don't have as many
copies as devices on the system that are driven by this code. We can probably
do this later, though.

--
With Best Regards,
Andy Shevchenko