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>,
"Gwendal Grignou" <gwendal@chromium.org>,
"Stephen Boyd" <swboyd@chromium.org>,
linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [RFC PATCH] iio: proximity: sx9360: fix hardware gain encoding
Date: Fri, 13 Nov 2026 03:40:25 +0530 [thread overview]
Message-ID: <20261112221025.509996-1-kapoorarnav43@gmail.com> (raw)
In-Reply-To: <20261107191409.0e4acaad@jic23-hlaptop>
On Sat, Nov 07, 2026 at 07:14:09PM +0000, Jonathan Cameron wrote:
> The default value is odd. Do we have any idea what is in that top bit?
> I'm going to guess something harmless and that perhaps the gain value
> due to writing a 0 is either rejected, or actually mapped to same as 1.
>
> You are correct that we really need someone with datasheet access to
> sanity check this sone.
I still don't have the datasheet, but I found the vendor driver, which
is the closest thing I have. Samsung's Android kernels carry an sx9360
driver with a Semtech copyright, for example:
https://github.com/TeamWin/android_kernel_samsung_d2q/blob/master/drivers/sensors/sx9360.c
It decodes the same field like this:
gain = (gain & 0x38) >> 3;
if (gain > 0 && gain < 5)
/* prints "x%u", 1 << (gain - 1) */
else
/* prints "Reserved" */
so codes 1 to 4 are gains 1 to 8 and 0 is reserved, which is what the
RFC does. Its init table writes 0x09 to PROXCTRL0_PHR and _PHM, i.e.
gain code 1 (x1) with bit 7 clear. That doesn't say what bit 7 does,
but the vendor's own default doesn't set it, so I think 0x80 is the
same typo as in sx9324 rather than something intentional. It also
doesn't say what the hardware does with code 0.
Sashiko flagged the same off-by-one on v2 and v3 of the write_gain()
series, though that is by the same analogy with the sx9324 fix, so it
isn't independent evidence.
If this is enough to go on, I'll respin the RFC as a patch on top of
v3 of that series, which needs SX9360_REG_PROX_CTRL0_GAIN_8 to become
0x4. Gwendal, Stephen, a confirmation from the datasheet would still
be very welcome.
Thanks,
Arnav
prev parent reply other threads:[~2026-11-12 22:10 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-07 11:23 Arnav Kapoor
2026-11-07 19:14 ` Jonathan Cameron
2026-11-12 22:10 ` Arnav Kapoor [this message]
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=20261112221025.509996-1-kapoorarnav43@gmail.com \
--to=kapoorarnav43@gmail.com \
--cc=andriy.shevchenko@intel.com \
--cc=andy@kernel.org \
--cc=dlechner@baylibre.com \
--cc=gwendal@chromium.org \
--cc=jic23@kernel.org \
--cc=linux-iio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=nuno.sa@analog.com \
--cc=swboyd@chromium.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
all inboxes | Powered by JetHome®