[PATCH v3 0/3] iio: light: isl29018: overflow/precision fix + cover-glass gain via DT

From: Herman van Hazendonk

Date: Thu Jun 04 2026 - 06:11:51 EST


v3:
- Split the DT binding into its own commit per maintainer feedback
on v2 (binding must precede the driver patch that consumes the
new property). The series is now 3 patches in dependency order:
precision fix -> binding -> driver.

- PATCH 1/3: tighten the precision fix. v2 widened the intermediate
arithmetic to u64 but still discarded the sub-lux remainder before
applying calibscale, which collapsed to zero on low ranges with
large cover-glass gain. v3 keeps the remainder via div_u64_rem()
so even small counts contribute. Switching from '/' and '%' on
u64 to div_u64()/div_u64_rem() also restores the ARM32 build,
which v2 broke with __aeabi_uldivmod.

- PATCH 3/3 (driver) addresses Andy's review of v2:
* hoist 'struct device *dev = &client->dev;' so subsequent
device_property_*() and devm_*() calls are uniform;
* guard the property read with device_property_present() and
surface the failure with dev_err_probe(), rather than silently
falling back when device_property_read_u32() returns -EINVAL
on a malformed value;
* the silent fallback (calibscale = 1) only applies when the
property is genuinely absent, which matches the tsl2563.c
precedent.

PATCH 2/3 is the new standalone binding commit; the schema, default,
and rationale are unchanged from v2.

A follow-up DTS patch enabling this for the HP TouchPad will be sent
separately to the ARM/DTS tree once the driver change is upstream.

Herman van Hazendonk (3):
iio: light: isl29018: fix overflow and precision in
isl29018_read_lux()
dt-bindings: iio: light: isl29018: add isil,cover-comp-gain
iio: light: isl29018: support cover-glass gain compensation via DT

.../bindings/iio/light/isl29018.yaml | 13 ++++++++
drivers/iio/light/isl29018.c | 31 ++++++++++++++-----
2 files changed, 37 insertions(+), 7 deletions(-)


base-commit: 944125b4c454b58d2fe6e35f1087a932b2050dff
--
2.43.0