[PATCH v4 0/4] iio: cdc: add Texas Instruments FDC1004 driver
From: Victor Chernyakin
Date: Sat Oct 31 2026 - 11:13:57 EST
This series adds support for the FDC1004 4-channel I2C capacitive sensor.
This sensor can report single-ended measurements of any one of its
channels, as well as differential measurements between any pair
of them. It has a measurement range of +-15 pF and a resolution of 0.5 fF.
Patch 1 prepares iio_format_value to handle IIO_VAL_DECIMAL64_* formats
introduced in Patch 2.
Patch 2 adds higher-precision IIO_VAL_DECIMAL64_* formats, used
in the driver.
Patch 3 adds the devicetree bindings.
Patch 4 adds the driver itself.
Tested with the sensor connected over an i2c-tiny-usb adapter.
---
Changes in v4:
- Patch 1
- Moved the floor(log10(S64_MAX)) constant to iio.h, renamed it to IIO_INTLOG10_S64_MAX
- Added corresponding floor(log10(U64_MAX)) constant
- Patch 4
- Added "select REGMAP_I2C" to Kconfig
- Style/whitespace tweaks
- Link to v3: https://lore.kernel.org/SN1PR12MB252882C0E885BF3368E036E5A5612@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
---
Changes in v3:
Split Patch 1 into two patches.
- Patch 1
- Expanded the comment above abs_s64_no_overflow()
- Patch 4 (previously Patch 3)
- Added comment on what a negative capacitance bias is used for
- Reduced some line lengths by introducing a variable with a short name
- Joined consecutive assignments into single ones
- Fixed indentation
- Link to v2: https://lore.kernel.org/SN1PR12MB2528DD1E6067CC4C0B76746FA5622@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx/
---
Changes in v2:
- Patch 1
- Added tests
- Fixed overflow in iio_format_value on 10^scale and UB on abs(LLONG_MIN)
- Patch 2
- Made the power supply mandatory
- Patch 3
- Switched from direct I2C calls to regmap
- Added of device table
- Removed scan indexes
- Build up complex values incrementally
- Adjusted list of includes
- More designed initializers
- Various style/whitespace tweaks
- Link to v1: https://lore.kernel.org/SN1PR12MB25286BE4E1EA3B75F8E563A9A5652@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
---
Victor Chernyakin (4):
iio: prepare iio_format_value to handle higher-precision
IIO_VAL_DECIMAL64_* formats
iio: add IIO_VAL_DECIMAL64_{ATTO,ZEPTO,YOCTO} formats
dt-bindings: iio: cdc: add Texas Instruments FDC1004
iio: cdc: add Texas Instruments FDC1004 driver
.../bindings/iio/cdc/ti,fdc1004.yaml | 46 ++
MAINTAINERS | 6 +
drivers/iio/cdc/Kconfig | 11 +
drivers/iio/cdc/Makefile | 1 +
drivers/iio/cdc/fdc1004.c | 490 ++++++++++++++++++
drivers/iio/industrialio-core.c | 30 +-
drivers/iio/test/iio-test-format.c | 16 +
include/linux/iio/iio.h | 3 +
include/linux/iio/types.h | 3 +
9 files changed, 602 insertions(+), 4 deletions(-)
create mode 100644 Documentation/devicetree/bindings/iio/cdc/ti,fdc1004.yaml
create mode 100644 drivers/iio/cdc/fdc1004.c
--
2.53.0