lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20210126101537.GA1112736@BV030612LT>
Date:   Tue, 26 Jan 2021 12:15:37 +0200
From:   Cristian Ciocaltea <cristian.ciocaltea@...il.com>
To:     Lee Jones <lee.jones@...aro.org>
Cc:     Mark Brown <broonie@...nel.org>, Rob Herring <robh+dt@...nel.org>,
        Dmitry Torokhov <dmitry.torokhov@...il.com>,
        Sebastian Reichel <sre@...nel.org>,
        Manivannan Sadhasivam <manivannan.sadhasivam@...aro.org>,
        Liam Girdwood <lgirdwood@...il.com>,
        Andreas Färber <afaerber@...e.de>,
        Linus Walleij <linus.walleij@...aro.org>,
        linux-actions@...ts.infradead.org, devicetree@...r.kernel.org,
        linux-kernel@...r.kernel.org, linux-input@...r.kernel.org,
        linux-pm@...r.kernel.org
Subject: Re: [PATCH v6 3/7] mfd: Add MFD driver for ATC260x PMICs

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@...aro.org>
> > > 
> > 
> > Thanks,
> > Cristi
> 
> -- 
> Lee Jones [李琼斯]
> Senior Technical Lead - Developer Services
> Linaro.org │ Open source software for Arm SoCs
> Follow Linaro: Facebook | Twitter | Blog

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ