Skip to content

iio: proximity: aw96103: fix diff sign, missing config, async config lifetime and event values

Arnav Kapoor linux-iio lkml 2 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v2 Latest4 patches 2 repliesIn review
  2. v14 patches 2 repliesSuperseded

Changes in v2 from the cover letter

- 1: declare data as unsigned int (the regmap_read() type) and keep the (int) cast, now before the division (Andy)
- 4: kept the explicit range check rather than FIELD_FIT() (Jonathan):
on 32-bit, FIELD_FIT() shifts the value in a 32-bit unsigned long, so high bits fall off and e.g. 16777216 or INT_MIN pass as fitting the OUTDEB field and are written as 0 (1020 such int values for GENMASK(9, 8), 16380 for GENMASK(13, 12)); on 64-bit it is exact.
- Dropped the Cc to Wang Shuaijie: the MAINTAINERS address bounces (554, recipient doesn't exist).

Patches in v2 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/4iio: proximity: aw96103: report negative proximity diff valuesdrivers/iio/proximity/aw96103.c+2 -20 replies
2/4iio: proximity: aw96103: use the default configuration without firmwaredrivers/iio/proximity/aw96103.c+6 -50 replies
3/4iio: proximity: aw96103: wait for the configuration load before freeingdrivers/iio/proximity/aw96103.c+21 -10 replies
4/4iio: proximity: aw96103: reject out-of-range debounce and hysteresis valuesdrivers/iio/proximity/aw96103.c+6 -00 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v2 yet.

Read the v2 thread

Cover letter [PATCH v2 0/4] iio: proximity: aw96103: fix diff sign, missing config, async config lifetime and event values

Four fixes for the AW96103/AW96105 capacitive proximity driver.

1: the DIFF registers are signed S21.10 (as documented in Awinic's
aw_sar driver), but are divided as unsigned, so negative diffs read back as about 4 million.
2: without aw96103_0.bin the driver never loads its built-in defaults,
so the scan and the interrupts are never enabled.
3: nothing waits for the request_firmware_nowait() callback, which
uses the devm-allocated driver data; a probe failure after the request (e.g. no interrupt) or an early unbind frees it first.
4: out-of-range debounce and hysteresis values are masked into their
2-bit fields instead of being rejected.

Changes in v2:
- 1: declare data as unsigned int (the regmap_read() type) and keep the (int) cast, now before the division (Andy)
- 4: kept the explicit range check rather than FIELD_FIT() (Jonathan):
on 32-bit, FIELD_FIT() shifts the value in a 32-bit unsigned long, so high bits fall off and e.g. 16777216 or INT_MIN pass as fitting the OUTDEB field and are written as 0 (1020 such int values for GENMASK(9, 8), 16380 for GENMASK(13, 12)); on 64-bit it is exact.
- Dropped the Cc to Wang Shuaijie: the MAINTAINERS address bounces (554, recipient doesn't exist).

v1: https://lore.kernel.org/all/[email protected]/

Patch 3 makes unbind wait for the callback, which can take as long as the firmware loader's fallback timeout if a user-mode helper fallback is configured.

Applies to both fixes-togreg and testing.
Compile-tested only (W=1 for every patch, checkpatch --strict clean); I don't have AW96103 hardware.

Arnav Kapoor (4):
iio: proximity: aw96103: report negative proximity diff values
iio: proximity: aw96103: use the default configuration without
firmware
iio: proximity: aw96103: wait for the configuration load before
freeing
iio: proximity: aw96103: reject out-of-range debounce and hysteresis
values

 drivers/iio/proximity/aw96103.c | 43 +++++++++++++++++++++++++++------
 1 file changed, 35 insertions(+), 8 deletions(-)

base-commit: 69bf7489f01ffa3c3269d09eb8a0668b1bdfa053

Signature · 1 line
2.53.0