From: Charles Keepax <ckeepax@opensource.wolfsonmicro.com>
To: Linus Walleij <linus.walleij@linaro.org>
Cc: Lee Jones <lee.jones@linaro.org>,
Rob Herring <robh+dt@kernel.org>,
Mark Rutland <mark.rutland@arm.com>,
Alexandre Courbot <gnurou@gmail.com>,
"linux-gpio@vger.kernel.org" <linux-gpio@vger.kernel.org>,
"devicetree@vger.kernel.org" <devicetree@vger.kernel.org>,
"open list:WOLFSON MICROELECTRONICS DRIVERS"
<patches@opensource.wolfsonmicro.com>
Subject: Re: [PATCH 2/3] gpio: arizona: Add support for GPIOs that need to be maintained
Date: Tue, 23 May 2017 09:56:12 +0100 [thread overview]
Message-ID: <20170523085612.GM1594@localhost.localdomain> (raw)
In-Reply-To: <CACRpkdZHVWrHWBon+TubnV_B5mCAoOtmcJKyXt4C5iP01OSQuQ@mail.gmail.com>
On Tue, May 23, 2017 at 10:46:29AM +0200, Linus Walleij wrote:
> On Tue, May 16, 2017 at 5:31 PM, Charles Keepax
> <ckeepax@opensource.wolfsonmicro.com> wrote:
>
> > The Arizona devices only maintain the state of output GPIOs whilst the
> > CODEC is active, this can cause issues if the CODEC suspends whilst
> > something is relying on the state of one of its GPIOs. However, in
> > many systems the CODEC GPIOs are used for audio related features
> > and thus the state of the GPIOs is unimportant whilst the CODEC is
> > suspended. Often keeping the CODEC resumed in such a system would
> > incur a power impact that is unacceptable.
> >
> > Allow the user to select whether a GPIO output should keep the
> > CODEC resumed, by adding a flag through the second cell of the GPIO
> > specifier in device tree.
> >
> > Signed-off-by: Charles Keepax <ckeepax@opensource.wolfsonmicro.com>
>
> This adds the handling locally in the driver for a certain Arizona chip.
>
> And then the next time you have to duplicate the code again and again.
>
> That's not working, put this in the core.
>
> > static int arizona_gpio_direction_in(struct gpio_chip *chip, unsigned offset)
> > {
> > struct arizona_gpio *arizona_gpio = gpiochip_get_data(chip);
> > struct arizona *arizona = arizona_gpio->arizona;
> > + int status = arizona_gpio->status[offset];
>
> Don't use a local array for this.
>
> This should be something like gpiochip_get_sleep_persistance(chip, offset)
>
> > + if (change && !(status & GPIO_SLEEP_MAY_LOOSE_VALUE)) {
>
> That us a dt-binfings header define, that is not a Linux constant.
>
> Add FLAG_MAY_LOOSE_VALUE_DURING_SLEEP or something in
> drivers/gpio/gpiolib.h, store this inside the struct gpio_desc like all
> other flags and retrieve it from there.
>
> Augment the code in gpiolib.c and gpiolib-of.c to parse this and
> store it properly in the gpio_desc and use it as described above.
>
> Then it is reusable for others.
>
Apologies hadn't realised you wanted me to put so much of the
functionality into the core, will respin again.
Thanks,
Charles
next prev parent reply other threads:[~2017-05-23 8:55 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-05-16 15:31 [PATCH 1/3] gpio: Add new flags to control sleep status of GPIOs Charles Keepax
[not found] ` <1494948714-15203-1-git-send-email-ckeepax-yzvPICuk2AATkU/dhu1WVueM+bqZidxxQQ4Iyu8u01E@public.gmane.org>
2017-05-16 15:31 ` [PATCH 2/3] gpio: arizona: Add support for GPIOs that need to be maintained Charles Keepax
2017-05-23 8:46 ` Linus Walleij
2017-05-23 8:56 ` Charles Keepax [this message]
2017-05-23 8:39 ` [PATCH 1/3] gpio: Add new flags to control sleep status of GPIOs Linus Walleij
[not found] ` <CACRpkdbiyZ9jPnuaX9OuYjVbrUYxtpqO-XMqb75ScCEH-=kOEg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2017-05-23 8:51 ` Lee Jones
2017-05-23 13:38 ` Rob Herring
2017-05-16 15:31 ` [PATCH 3/3] mfd: arizona: Update GPIO binding for newly supported flag Charles Keepax
[not found] ` <1494948714-15203-3-git-send-email-ckeepax-yzvPICuk2AATkU/dhu1WVueM+bqZidxxQQ4Iyu8u01E@public.gmane.org>
2017-05-22 11:07 ` Lee Jones
2017-05-22 11:07 ` Lee Jones
2017-05-23 8:49 ` Linus Walleij
2017-05-23 9:00 ` Charles Keepax
2017-05-23 0:16 ` Rob Herring
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=20170523085612.GM1594@localhost.localdomain \
--to=ckeepax@opensource.wolfsonmicro.com \
--cc=devicetree@vger.kernel.org \
--cc=gnurou@gmail.com \
--cc=lee.jones@linaro.org \
--cc=linus.walleij@linaro.org \
--cc=linux-gpio@vger.kernel.org \
--cc=mark.rutland@arm.com \
--cc=patches@opensource.wolfsonmicro.com \
--cc=robh+dt@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).