[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <e4159c2b-4081-4a4b-9a53-d6d559a3196c@gmail.com>
Date: Wed, 23 Apr 2025 12:58:55 +0800
From: Nick Chan <towinchenmi@...il.com>
To: Sasha Finkelstein <fnkl.kernel@...il.com>, Rob Herring <robh@...nel.org>
Cc: Sven Peter <sven@...npeter.dev>, Janne Grunau <j@...nau.net>,
Alyssa Rosenzweig <alyssa@...enzweig.io>, Neal Gompa <neal@...pa.dev>,
Srinivas Kandagatla <srinivas.kandagatla@...aro.org>,
Krzysztof Kozlowski <krzk+dt@...nel.org>, Conor Dooley
<conor+dt@...nel.org>, asahi@...ts.linux.dev,
linux-arm-kernel@...ts.infradead.org, devicetree@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH v2 1/3] dt-bindings: spmi: Add generic SPMI NVMEM
Sasha Finkelstein 於 2025/4/22 夜晚9:44 寫道:
> On Tue, 22 Apr 2025 at 15:36, Rob Herring <robh@...nel.org> wrote:
>>> +title: Generic SPMI NVMEM
>> What makes this generic?
>>
>> A generic driver is great, but "generic" or "simple" bindings are
>> generally a mistake.
> There is nothing apple-specific in that driver, just re-exporting
> several registers as cells. If you think that it is a mistake, I can
> rename it to apple-pmic, or something similar.
>
>>> + - const: spmi-nvmem
>> What happens when there's some other feature of the PMIC exposed that's
>> not nvmem?
> If you have a PMIC that needs more features exposed, then you'd have to
> use a different driver. Or am i not understanding the question correctly?
I think the problem is what happens if more functionalities needed to be exposed from the M1 SoC's
PMIC. (right now I do not believe anything else is needed from it)
It would be multiple drivers. A simple-mfd-spmi driver (like drivers/mfd/simple-mfd-i2c.c
but SPMI) that exports a regmap and a generic driver that reexports regmap (any regmap,
not necessarily SPMI) as nvmem cells, plus extra drivers that uses the regmap exposed by
the mfd driver for extra functionalities.
To make this submission more generic and extensible, what would be submitted should be a
simple-mfd-spmi driver and a generic regmap nvmem driver. For specific examples, see below:
The PMICs from dialog semiconductor on older Apple SoCs definitely needs such functionalities.
On Apple A11 SoC there is a RTC clock device on the PMIC and the SMC on there does not have
RTC functionalities. To make the RTC clock work there a driver would read a counter that could
count a maximum of 194 days from the SPMI PMIC, and then access the PMIC nvmem cells that
held the rest of the time. In this case these drivers are needed:
(1) simple-mfd-spmi (2) rtc driver (3) generic regmap nvmem driver.
On Apple A7-A10X SoC a similar PMIC also exist, but is over I2C instead of SPMI, those devices do not
have a SMC. To make the rtc clock work there three drivers are needed:
(1) simple-mfd-i2c (already exists) (2) rtc driver (same one as above) (3) generic regmap nvmem driver
The PMICs on A7-A10X SoCs are also known to have WLED output for backlight, shutdown controls and
some sort of pinctrl needed for things like bluetooth.
In both cases a combination of (1) and (3) is more generic and applies to more than one bus types, and
allow extra functionalities other than nvmem to be added.
>
Nick Chan
Powered by blists - more mailing lists