From: Ryan Brue <ryanbrue.dev@gmail.com>
To: Andy Shevchenko <andriy.shevchenko@intel.com>
Cc: "Jonathan Cameron" <jic23@kernel.org>,
"David Lechner" <dlechner@baylibre.com>,
"Nuno Sá" <nuno.sa@analog.com>,
"Andy Shevchenko" <andy@kernel.org>,
"Rob Herring" <robh@kernel.org>,
"Krzysztof Kozlowski" <krzk+dt@kernel.org>,
"Conor Dooley" <conor+dt@kernel.org>,
"Matthias Brugger" <matthias.bgg@gmail.com>,
"AngeloGioacchino Del Regno"
<angelogioacchino.delregno@collabora.com>,
"Lee Jones" <lee@kernel.org>,
linux-iio@vger.kernel.org, devicetree@vger.kernel.org,
linux-kernel@vger.kernel.org,
linux-arm-kernel@lists.infradead.org,
linux-mediatek@lists.infradead.org, mfd@lists.linux.dev,
"Roman Vivchar" <rva333@protonmail.com>,
"Luca Leonardo Scorcia" <l.scorcia@gmail.com>
Subject: Re: [PATCH 0/3] iio: adc: add mt6397 PMIC AUXADC support
Date: Thu, 17 Sep 2026 15:24:05 -0500 [thread overview]
Message-ID: <2d1b80f2-53f6-4ed6-81bf-e35c0a9efb26@gmail.com> (raw)
In-Reply-To: <aqpmgliQW7FW53o5@ashevche-desk.local>
On 9/16/26 4:50 AM, Andy Shevchenko wrote:
> On Tue, Sep 15, 2026 at 11:15:25PM -0500, Ryan Brue wrote:
>> The MediaTek mt6397 PMIC has a 10-bit AUXADC that nothing in-tree can
>> reach. On boards built around it that ADC is the only path to the battery:
>> the SoC's AUXADC is wired to board thermistors, and the charger ICs these
>> boards use have no ADC at all, so without it there is no pack voltage and
>> no state of charge.
> This doesn't explain why a brand new driver? Perhaps we have existing code that
> may be updated to support this device?
I considered adding mt6397 support to either mt6323-auxadc or
mt6359-auxadc, and both had problems.
Both mt6323-auxadc and mt6359-auxadc select channels through a request
register (1 bit per channel), while mt6397 uses a 4-bit numeric field
CHSEL in CON1 (10:7), and then pulses a START bit (CON1 bit 0). That was
the biggest reason I made the new driver.
For mt6323-auxadc, which is the closest I could find to the mt6397
(CON0..CON27), it has 13 more registers than the mt6397 (CON0..CON14).
It uses CON22 for its request register, and reads the result value from
the same register as the ready bit. We don't do that - the mt6397 has a
factory calibrated value for each channel at 0x16 higher than the raw
value. mt6323 also has a 1800 mV / 15 bit scale / resolution while we
have 1200 mV / 10 bits. We also have some per-channel preparation that
we have to do before the burst, that the mt6323 doesn't have to do.
For mt6359-auxadc, it has a more generic framework for describing the
AUXADC, but it assumes requests are channel-per-bit, and so we would
have to basically ignore req_idx, req_mask, rdy_idx, and rdy_mask.
We also have our own software sampling, which the vendor does too
(Amazon Fire OS based on Linux 3.18). We'd have to have our own sampling
callback to do it.
I drafted two other versions of these patches adding mt6397 support to
both of those drivers, but the differences meant I had to add a lot of
extra boilerplate to each driver and to me it didn't make sense.
In v2 I will add the justification to the cover letter and commits for
why I chose a new driver.
If you'd like me to instead send the exploratory patches I made adapting
mt6323-auxadc or mt6359-auxadc, let me know. I'm fine if it ends up
seeming like we should adapt one of the existing drivers, but I think
the mechanism for controlling this AUXADC is unique and merits its own
driver.
Thanks again for the review, I am going through each one, and sorry for
the delay. I'm rather new to kernel development.
Best regards,
Ryan
next prev parent reply other threads:[~2026-09-17 20:24 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-16 4:15 Ryan Brue
2026-09-16 4:15 ` [PATCH 1/3] dt-bindings: iio: adc: mediatek,mt6359-auxadc: add mt6397 PMIC AUXADC Ryan Brue
2026-09-16 4:15 ` [PATCH 2/3] iio: adc: mt6397-auxadc: add mt6397 PMIC AUXADC driver Ryan Brue
2026-09-16 9:55 ` Andy Shevchenko
2026-09-17 21:01 ` Ryan Brue
2026-09-17 21:06 ` Ryan Brue
2026-09-17 3:48 ` Jonathan Cameron
2026-09-17 23:00 ` Ryan Brue
2026-09-16 4:15 ` [PATCH 3/3] mfd: mt6397-core: Add mt6397 AUXADC support Ryan Brue
2026-09-16 9:50 ` [PATCH 0/3] iio: adc: add mt6397 PMIC " Andy Shevchenko
2026-09-17 20:24 ` Ryan Brue [this message]
2026-09-18 6:42 ` Andy Shevchenko
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=2d1b80f2-53f6-4ed6-81bf-e35c0a9efb26@gmail.com \
--to=ryanbrue.dev@gmail.com \
--cc=andriy.shevchenko@intel.com \
--cc=andy@kernel.org \
--cc=angelogioacchino.delregno@collabora.com \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=dlechner@baylibre.com \
--cc=jic23@kernel.org \
--cc=krzk+dt@kernel.org \
--cc=l.scorcia@gmail.com \
--cc=lee@kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-iio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mediatek@lists.infradead.org \
--cc=matthias.bgg@gmail.com \
--cc=mfd@lists.linux.dev \
--cc=nuno.sa@analog.com \
--cc=robh@kernel.org \
--cc=rva333@protonmail.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®