mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Arnav Kapoor <kapoorarnav43@gmail.com>
To: Jonathan Cameron <jic23@kernel.org>
Cc: "David Lechner" <dlechner@baylibre.com>,
	"Nuno Sá" <nuno.sa@analog.com>,
	"Andy Shevchenko" <andy@kernel.org>,
	"Andy Shevchenko" <andriy.shevchenko@intel.com>,
	linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org,
	"Arnav Kapoor" <kapoorarnav43@gmail.com>
Subject: [PATCH v2 0/4] iio: proximity: aw96103: fix diff sign, missing config, async config lifetime and event values
Date: Sat, 28 Nov 2026 17:21:37 +0530	[thread overview]
Message-ID: <20261128115144.557411-1-kapoorarnav43@gmail.com> (raw)

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/20261126053033.603086-1-kapoorarnav43@gmail.com/

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
-- 
2.53.0


             reply	other threads:[~2026-11-28 11:51 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-28 11:51 Arnav Kapoor [this message]
2026-11-28 11:51 ` [PATCH v2 1/4] iio: proximity: aw96103: report negative proximity diff values Arnav Kapoor
2026-11-28 11:51 ` [PATCH v2 2/4] iio: proximity: aw96103: use the default configuration without firmware Arnav Kapoor
2026-11-28 11:51 ` [PATCH v2 3/4] iio: proximity: aw96103: wait for the configuration load before freeing Arnav Kapoor
2026-11-28 11:51 ` [PATCH v2 4/4] iio: proximity: aw96103: reject out-of-range debounce and hysteresis values Arnav Kapoor

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20261128115144.557411-1-kapoorarnav43@gmail.com \
    --to=kapoorarnav43@gmail.com \
    --cc=andriy.shevchenko@intel.com \
    --cc=andy@kernel.org \
    --cc=dlechner@baylibre.com \
    --cc=jic23@kernel.org \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=nuno.sa@analog.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®