[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20200628082906.GB2561@latitude>
Date: Sun, 28 Jun 2020 10:29:06 +0200
From: Jonathan Neuschäfer <j.neuschaefer@....net>
To: Andreas Kemnade <andreas@...nade.info>
Cc: Jonathan Neuschäfer <j.neuschaefer@....net>,
linux-kernel@...r.kernel.org, Lee Jones <lee.jones@...aro.org>,
Rob Herring <robh+dt@...nel.org>,
Thierry Reding <thierry.reding@...il.com>,
Uwe Kleine-König
<u.kleine-koenig@...gutronix.de>,
Alessandro Zummo <a.zummo@...ertech.it>,
Alexandre Belloni <alexandre.belloni@...tlin.com>,
Shawn Guo <shawnguo@...nel.org>,
Sascha Hauer <s.hauer@...gutronix.de>,
Pengutronix Kernel Team <kernel@...gutronix.de>,
Fabio Estevam <festevam@...il.com>,
NXP Linux Team <linux-imx@....com>,
Sam Ravnborg <sam@...nborg.org>,
Linus Walleij <linus.walleij@...aro.org>,
Heiko Stuebner <heiko.stuebner@...obroma-systems.com>,
Stephan Gerhold <stephan@...hold.net>,
Lubomir Rintel <lkundrak@...sk>,
Mark Brown <broonie@...nel.org>, allen <allen.chen@....com.tw>,
Mauro Carvalho Chehab <mchehab+huawei@...nel.org>,
"David S. Miller" <davem@...emloft.net>,
devicetree@...r.kernel.org, linux-pwm@...r.kernel.org,
linux-rtc@...r.kernel.org, linux-arm-kernel@...ts.infradead.org,
Heiko Stuebner <heiko@...ech.de>,
Josua Mayer <josua.mayer@....eu>
Subject: Re: [RFC PATCH 04/10] mfd: Add base driver for Netronix embedded
controller
On Sat, Jun 27, 2020 at 10:17:38AM +0200, Andreas Kemnade wrote:
> On Sun, 21 Jun 2020 00:42:15 +0200
> Jonathan Neuschäfer <j.neuschaefer@....net> wrote:
>
> > Third-party hardware documentation is available at
> > https://github.com/neuschaefer/linux/wiki/Netronix-MSP430-embedded-controller
> >
> > The EC supports interrupts, but the driver doesn't make use of them so
> > far.
> >
> > Known problems:
> > - The reboot handler is installed in such a way that it directly calls
> > into the i2c subsystem to send the reboot command to the EC. This
> > means that the reboot handler may sleep, which is not allowed.
> >
> see
> https://patchwork.ozlabs.org/project/linux-i2c/patch/20190415213432.8972-3-contact@stefanchrist.eu/
>
> for a fix of such problems.
So far, regmap isn't involved here, but I'll remember it when I switch
to regmap.
Between when I first wrote this driver and now, the I2C has added
support for transfers in atomic contexts very late in the system's life
(exactly what happens when you reset a system via PMIC/EC), so this
problem seems to be gone from my driver, for now.
(See commit 63b96983a5ddf ("i2c: core: introduce callbacks for atomic transfers"))
[...]
> > +int ntxec_write8(struct ntxec *ec, u8 addr, u8 value)
> > +{
> > + return ntxec_write16(ec, addr, value << 8);
> > +}
> > +EXPORT_SYMBOL(ntxec_write8);
> > +
>
> do we really need both 16bit and 8bit accessors?
No, the hardware/firmware doesn't care.
> If not, then simply use regmap_i2c_init and set val_bits accordingly.
> Maybe just doing the << 8 in the constants?
Thanks, I'll try this approach.
The values are not always constants, for example in the PWM driver:
res |= ntxec_write8(pwm->ec, NTXEC_PERIOD_HIGH, period >> 8);
res |= ntxec_write8(pwm->ec, NTXEC_PERIOD_LOW, period);
res |= ntxec_write8(pwm->ec, NTXEC_DUTY_HIGH, duty >> 8);
res |= ntxec_write8(pwm->ec, NTXEC_DUTY_LOW, duty);
Jonathan
Download attachment "signature.asc" of type "application/pgp-signature" (834 bytes)
Powered by blists - more mailing lists