From: Herman van Hazendonk <github.com@herrie.org>
To: linux-iio@vger.kernel.org
Cc: jic23@kernel.org, dlechner@baylibre.com, nuno.sa@analog.com,
robh@kernel.org, krzk+dt@kernel.org, conor+dt@kernel.org,
devicetree@vger.kernel.org,
Herman van Hazendonk <github.com@herrie.org>
Subject: [PATCH v2 0/2] iio: light: isl29018: overflow fix + cover-glass gain via DT
Date: Thu, 4 Jun 2026 08:49:23 +0200 [thread overview]
Message-ID: <20260604064925.3097108-1-github.com@herrie.org> (raw)
In-Reply-To: <20260604054723.2983181-1-github.com@herrie.org>
v2: split into two patches after review feedback on v1.
PATCH 1/2 fixes a pre-existing 32-bit overflow in isl29018_read_lux()
that the reviewer correctly identified: lux_data * scale.uscale can
reach ~64 billion at full-scale 16-bit readings (65535 × 976562),
overflowing UINT_MAX before the /1000000 division. A second overflow
occurs when the result is multiplied by calibscale and stored in the
signed int *lux. Both are fixed by widening intermediate arithmetic to
u64 and clamping the output.
PATCH 2/2 is unchanged from v1: it adds the "isil,cover-comp-gain" DT
property to seed calibscale at probe time, following the precedent set
by tsl2563.c (amstaos,cover-comp-gain). The default stays 1 so
existing systems are unaffected. The overflow fix in patch 1 is a
natural prerequisite because patch 2 makes large calibscale values
straightforward to deploy from firmware.
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 (2):
iio: light: isl29018: fix 32-bit overflow in isl29018_read_lux()
iio: light: isl29018: support cover-glass gain compensation via DT
.../bindings/iio/light/isl29018.yaml | 13 ++++++++++++
drivers/iio/light/isl29018.c | 20 ++++++++++++++-----
2 files changed, 28 insertions(+), 5 deletions(-)
base-commit: 944125b4c454b58d2fe6e35f1087a932b2050dff
--
2.43.0
next prev parent reply other threads:[~2026-06-04 6:49 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-06-04 5:47 [PATCH 0/1] iio: light: isl29018: cover-glass gain compensation via DT Herman van Hazendonk
2026-06-04 5:47 ` [PATCH 1/1] iio: light: isl29018: support " Herman van Hazendonk
2026-06-04 5:57 ` sashiko-bot
2026-06-04 7:17 ` Andy Shevchenko
2026-06-04 7:22 ` Joshua Crofts
2026-06-04 6:49 ` Herman van Hazendonk [this message]
2026-06-04 6:49 ` [PATCH v2 1/2] iio: light: isl29018: fix 32-bit overflow in isl29018_read_lux() Herman van Hazendonk
2026-06-04 6:58 ` sashiko-bot
2026-06-04 6:49 ` [PATCH v2 2/2] iio: light: isl29018: support cover-glass gain compensation via DT Herman van Hazendonk
2026-06-04 7:00 ` sashiko-bot
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=20260604064925.3097108-1-github.com@herrie.org \
--to=github.com@herrie.org \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=dlechner@baylibre.com \
--cc=jic23@kernel.org \
--cc=krzk+dt@kernel.org \
--cc=linux-iio@vger.kernel.org \
--cc=nuno.sa@analog.com \
--cc=robh@kernel.org \
/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