From: Cristian Ciocaltea <cristian.ciocaltea@gmail.com>
To: Lee Jones <lee.jones@linaro.org>
Cc: "Mark Brown" <broonie@kernel.org>,
"Rob Herring" <robh+dt@kernel.org>,
"Dmitry Torokhov" <dmitry.torokhov@gmail.com>,
"Sebastian Reichel" <sre@kernel.org>,
"Manivannan Sadhasivam" <manivannan.sadhasivam@linaro.org>,
"Liam Girdwood" <lgirdwood@gmail.com>,
"Andreas Färber" <afaerber@suse.de>,
"Linus Walleij" <linus.walleij@linaro.org>,
linux-actions@lists.infradead.org, devicetree@vger.kernel.org,
linux-kernel@vger.kernel.org, linux-input@vger.kernel.org,
linux-pm@vger.kernel.org
Subject: Re: [PATCH v6 3/7] mfd: Add MFD driver for ATC260x PMICs
Date: Tue, 26 Jan 2021 12:15:37 +0200 [thread overview]
Message-ID: <20210126101537.GA1112736@BV030612LT> (raw)
In-Reply-To: <20210126081535.GB4903@dell>
On Tue, Jan 26, 2021 at 08:15:35AM +0000, Lee Jones wrote:
> On Mon, 25 Jan 2021, Cristian Ciocaltea wrote:
>
> > Hi Lee,
> >
> > On Mon, Jan 25, 2021 at 02:25:58PM +0000, Lee Jones wrote:
> > > On Wed, 20 Jan 2021, Cristian Ciocaltea wrote:
> > >
> > > > Add initial support for the Actions Semi ATC260x PMICs which integrates
> > > > Audio Codec, Power management, Clock generation and GPIO controller
> > > > blocks.
> > > >
> > > > For the moment this driver only supports Regulator, Poweroff and Onkey
> > > > functionalities for the ATC2603C and ATC2609A chip variants.
> >
> > [...]
> >
> > > > +static void regmap_lock_mutex(void *__mutex)
> > > > +{
> > > > + struct mutex *mutex = __mutex;
> > > > +
> > > > + /*
> > > > + * Using regmap within an atomic context (e.g. accessing a PMIC when
> > > > + * powering system down) is normally allowed only if the regmap type
> > > > + * is MMIO and the regcache type is either REGCACHE_NONE or
> > > > + * REGCACHE_FLAT. For slow buses like I2C and SPI, the regmap is
> > > > + * internally protected by a mutex which is acquired non-atomically.
> > > > + *
> > > > + * Let's improve this by using a customized locking scheme inspired
> > > > + * from I2C atomic transfer. See i2c_in_atomic_xfer_mode() for a
> > > > + * starting point.
> > > > + */
> > > > + if (system_state > SYSTEM_RUNNING && irqs_disabled())
> > > > + mutex_trylock(mutex);
> > > > + else
> > > > + mutex_lock(mutex);
> > > > +}
> > >
> > > Would this be useful to anyone else?
> >
> > If you refer to the locking scheme, it is currently required by the
> > power-off driver to handle atomic contexts.
>
> Right, but would this be helpful to any non-Actions drivers?
>
> If so, perhaps it should reside as a Regmap helper?
I got it now, thanks for the suggestion. As a matter of fact this was
my initial intention, but since I was not aware of any other use case
I decided to keep it private for the moment.
Most probably this hardware design is not specific to Actions only, so
it might be helpful to other drivers as well. Therefore I am going to
reconsider this and if/when it is accepted upstream, I will come back
with a separate update patch for this driver.
> > > For my own reference (apply this as-is to your sign-off block):
> >
> > Please note the patches "[4/7] regulator: ..." and "[5/7] power: ..."
> > have been already picked up by Mark and Sebastian, respectively, while
> > Dmitry suggested to merge "[6/7] input: ..." through MFD.
>
> That's fine.
>
> Please re-submit the patches which have not been applied already.
I have just submitted v7 with the two patches dropped.
> > > Acked-for-MFD-by: Lee Jones <lee.jones@linaro.org>
> > >
> >
> > Thanks,
> > Cristi
>
> --
> Lee Jones [李琼斯]
> Senior Technical Lead - Developer Services
> Linaro.org │ Open source software for Arm SoCs
> Follow Linaro: Facebook | Twitter | Blog
next prev parent reply other threads:[~2021-01-26 10:18 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-01-20 18:23 [PATCH v6 0/7] Add initial support for ATC260x PMICs Cristian Ciocaltea
2021-01-20 18:23 ` [PATCH v6 1/7] dt-bindings: input: Add reset-time-sec common property Cristian Ciocaltea
2021-01-20 18:23 ` [PATCH v6 2/7] dt-bindings: mfd: Add Actions Semi ATC260x PMIC binding Cristian Ciocaltea
2021-01-20 18:23 ` [PATCH v6 3/7] mfd: Add MFD driver for ATC260x PMICs Cristian Ciocaltea
2021-01-25 14:25 ` Lee Jones
2021-01-25 18:47 ` Cristian Ciocaltea
2021-01-26 8:15 ` Lee Jones
2021-01-26 10:15 ` Cristian Ciocaltea [this message]
2021-01-20 18:23 ` [PATCH v6 4/7] regulator: Add regulator " Cristian Ciocaltea
2021-01-25 19:23 ` Mark Brown
2021-01-25 20:50 ` Cristian Ciocaltea
2021-01-25 20:51 ` Mark Brown
2021-01-20 18:23 ` [PATCH v6 5/7] power: reset: Add poweroff " Cristian Ciocaltea
2021-01-20 18:23 ` [PATCH v6 6/7] input: atc260x: Add onkey " Cristian Ciocaltea
2021-01-20 18:23 ` [PATCH v6 7/7] MAINTAINERS: Add entry for ATC260x PMIC Cristian Ciocaltea
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=20210126101537.GA1112736@BV030612LT \
--to=cristian.ciocaltea@gmail.com \
--cc=afaerber@suse.de \
--cc=broonie@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=dmitry.torokhov@gmail.com \
--cc=lee.jones@linaro.org \
--cc=lgirdwood@gmail.com \
--cc=linus.walleij@linaro.org \
--cc=linux-actions@lists.infradead.org \
--cc=linux-input@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=manivannan.sadhasivam@linaro.org \
--cc=robh+dt@kernel.org \
--cc=sre@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;
as well as URLs for NNTP newsgroup(s).