Devicetree
 help / color / mirror / Atom feed
* [PATCH v2 0/7] iio: temperature: ltc2983: Add support for ADT7604
@ 2026-05-14 14:46 Liviu Stan
  2026-05-14 14:46 ` [PATCH v2 1/7] iio: temperature: ltc2983: Fix macro parenthesization and rename Liviu Stan
                   ` (6 more replies)
  0 siblings, 7 replies; 12+ messages in thread
From: Liviu Stan @ 2026-05-14 14:46 UTC (permalink / raw)
  To: Jonathan Cameron, David Lechner, Nuno Sá, Andy Shevchenko,
	Michael Hennerich, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
	Antoniu Miclaus, Liviu Stan, Francesco Lavra, linux-iio,
	linux-kernel, linux, devicetree

This series adds support for the ADT7604 multi-sensor temperature
measurement and leak detection system to the existing ltc2983 driver.

The ADT7604 shares the same die as the LTC2984, reusing its register
map and SPI interface. It repurposes the custom RTD sensor type (18)
as a copper trace resistance sensor and the custom thermistor type (27)
as a leak detector, removing thermocouple, diode and direct ADC support.

Patches 1-4 fix pre-existing bugs in the ltc2983 driver: macro
parenthesization and renaming, inconsistent use of the local device
pointer, inconsistent channel wording in log messages, and missing
fwnode_property_present() guards for optional properties.

Patch 5 adds IIO_COVERAGE_PERCENT, a new channel type for sensors
reporting fractional surface coverage as a percentage.

Patch 6 updates the device tree bindings: adds adi,adt7604 compatible,
copper-trace@ and leak-detector@ sensor node types with their respective
properties, and an ADT7604 example.

Patch 7 updates the driver: introduces two new software sensor type
values (LTC2983_SENSOR_COPPER_TRACE = 32, LTC2983_SENSOR_LEAK_DETECTOR
= 33) with dedicated structs and parser functions rather than extending
the existing RTD and thermistor paths. The hardware configuration bits
are fully hardcoded for both sensor types, and several RTD/thermistor
DT properties have no meaning for them. A u64 supported_sensors bitmask
in ltc2983_chip_info gates sensor type validation per chip, replacing
the has_temp bool pattern. BIT_ULL() is used for the new type values
at bits 32 and 33 to avoid shifting beyond 32 bits on 32-bit builds.

Tested on EVAL-ADT7604-AZ connected to Raspberry Pi 5 via SPI.

Changes in v2:
- Patches 1-4: new prerequisite fix patches addressing review comments
  on the v1 driver patch.
- Patch 5: new IIO_COVERAGE_PERCENT channel type; replaces the v1
  IIO_TEMP workaround for leak detector coverage output.
- Patch 6 (binding):
  - Title shortened to "LTC2983 and similar".
  - Description device list alphabetised and converted to a bullet list.
  - Separate copper-trace@ and leak-detector@ node types retained
    (rather than extending rtd@/thermistor@); rationale added to the
    commit message.
  - "ADT7604 only" wording replaced with "some parts only".
- Patch 7 (driver):
  - New software sensor type values LTC2983_SENSOR_COPPER_TRACE = 32
    and LTC2983_SENSOR_LEAK_DETECTOR = 33 map to hardware register
    values 18 and 27 internally; v1 exposed 18 and 27 directly as
    adi,sensor-type values.
  - Added n_iio_chan to struct ltc2983_sensor; used in
    ltc2983_parse_fw() and ltc2983_setup() to count and assign IIO
    channels, removing to_rtd()/to_thermistor() casts from the common
    path.
  - New sensor types with dedicated structs and functions;
    ltc2983_rtd_new() and ltc2983_thermistor_new() are left unchanged.
  - has_copper_trace bool replaced by u64 supported_sensors bitmask.
  - Both sensor types now share the same 1/1024 resistance scale
    (result in ohms); v1 used different scales and incorrectly
    described the copper trace result as being in mohms. Since the
    sense resistor value is specified in ohms, the output will be in
    ohms for both sensor types.
  - Leak detector coverage output changed from IIO_TEMP to
    IIO_COVERAGE_PERCENT.
  - is_sub_ohm replaces sub_ohm in ltc2983_copper_trace struct.
  - switch() used for IIO_CHAN_INFO_RAW base register selection.
  - Unsupported sensor type validation uses BIT_ULL() checks against
    the supported_sensors bitmask.

Liviu Stan (7):
  iio: temperature: ltc2983: Fix macro parenthesization and rename
  iio: temperature: ltc2983: Use local device pointer consistently
  iio: temperature: ltc2983: Fix inconsistent channel wording in
    messages
  iio: temperature: ltc2983: Use fwnode_property_present() for optional
    properties
  iio: core: Add IIO_COVERAGE_PERCENT channel type
  dt-bindings: iio: temperature: Add ADT7604 support to adi,ltc2983
  iio: temperature: ltc2983: Add support for ADT7604

 Documentation/ABI/testing/sysfs-bus-iio       |  10 +
 .../bindings/iio/temperature/adi,ltc2983.yaml | 194 ++++++-
 drivers/iio/industrialio-core.c               |   1 +
 drivers/iio/temperature/ltc2983.c             | 532 +++++++++++++++---
 include/uapi/linux/iio/types.h                |   1 +
 tools/iio/iio_event_monitor.c                 |   1 +
 6 files changed, 666 insertions(+), 73 deletions(-)

-- 
2.43.0


^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2026-05-14 20:04 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-05-14 14:46 [PATCH v2 0/7] iio: temperature: ltc2983: Add support for ADT7604 Liviu Stan
2026-05-14 14:46 ` [PATCH v2 1/7] iio: temperature: ltc2983: Fix macro parenthesization and rename Liviu Stan
2026-05-14 19:32   ` sashiko-bot
2026-05-14 14:46 ` [PATCH v2 2/7] iio: temperature: ltc2983: Use local device pointer consistently Liviu Stan
2026-05-14 19:39   ` sashiko-bot
2026-05-14 14:46 ` [PATCH v2 3/7] iio: temperature: ltc2983: Fix inconsistent channel wording in messages Liviu Stan
2026-05-14 19:47   ` sashiko-bot
2026-05-14 14:46 ` [PATCH v2 4/7] iio: temperature: ltc2983: Use fwnode_property_present() for optional properties Liviu Stan
2026-05-14 20:04   ` sashiko-bot
2026-05-14 14:46 ` [PATCH v2 5/7] iio: core: Add IIO_COVERAGE_PERCENT channel type Liviu Stan
2026-05-14 14:46 ` [PATCH v2 6/7] dt-bindings: iio: temperature: Add ADT7604 support to adi,ltc2983 Liviu Stan
2026-05-14 14:46 ` [PATCH v2 7/7] iio: temperature: ltc2983: Add support for ADT7604 Liviu Stan

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox