public inbox for linux-arm-kernel@lists.infradead.org
 help / color / mirror / Atom feed
From: maxime.ripard@free-electrons.com (Maxime Ripard)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v3 12/12] ARM: dtsi: axp81x: set pinmux for GPIO0/1 when used as LDOs
Date: Wed, 11 Oct 2017 14:00:36 +0200	[thread overview]
Message-ID: <20171011120036.bvw5dpz4myngtwu7@flea> (raw)
In-Reply-To: <CAGb2v65-_MjUsfTHMoyzvczs_280p7NXEsStSaoR6wnvTCq5+A@mail.gmail.com>

On Tue, Oct 10, 2017 at 03:09:11AM +0000, Chen-Yu Tsai wrote:
> On Wed, Oct 4, 2017 at 3:35 PM, Quentin Schulz
> <quentin.schulz@free-electrons.com> wrote:
> > Hi Chen-Yu, Linus,
> >
> > On 03/10/2017 17:08, Chen-Yu Tsai wrote:
> >> On Tue, Oct 3, 2017 at 10:47 PM, Maxime Ripard
> >> <maxime.ripard@free-electrons.com> wrote:
> >>> Hi Linus,
> >>>
> >>> On Tue, Oct 03, 2017 at 09:27:17AM +0000, Linus Walleij wrote:
> >>>> On Mon, Oct 2, 2017 at 2:08 PM, Quentin Schulz
> >>>> <quentin.schulz@free-electrons.com> wrote:
> >>>>
> >>>>> On AXP813/818, GPIO0 and GPIO1 can be used as LDO as (respectively)
> >>>>> ldo_io0 and ldo_io1.
> >>>> (...)
> >>>>> +               gpio0_ldo: gpio0_ldo {
> >>>>> +                       pins = "GPIO0";
> >>>>> +                       function = "ldo";
> >>>>> +               };
> >>>> (...)
> >>>>> +                       pinctrl-names = "default";
> >>>>> +                       pinctrl-0 = <&gpio0_ldo>;
> >>>>>                         /* Disable by default to avoid conflicts with GPIO */
> >>>>>                         status = "disabled";
> >>>>
> >>>> So this is still by default disabled, but you make the default
> >>>> mode something called "ldo".
> >>>>
> >>>> And I think that is to be understood as a low-dropout regulator?
> >>>>
> >>>> So is the idea that this should be represented as a regulator
> >>>> in the end?
> >>>>
> >>>> Then I think the state name should not be "default" rather
> >>>> something like "regulator" and "default" should be the GPIO
> >>>> mode, as I guess something like that exists.
> >>>>
> >>>> Activating a regulator using pin control "default" mode is
> >>>> not very pretty. It would probably be unintuitive and end
> >>>> up wasting power because people will get confused about
> >>>> what is going on.
> >>>
> >>> That's not really it. The PMIC has pins that can be muxed either to
> >>> (regular) GPIOs, an ADC or to an LDO regulator.
> >>>
> >>> This is just muxing, the regulator will be enabled and disabled
> >>> separately through another register. If it wasn't the case, it would
> >>> indeed be very messy.
> >>
> >> No. Actually they are controlled in the same register, so it is
> >> very messy. The muxing options are:
> >>
> >>     - 0: drive low
> >>     - 1: drive high
> >>     - 2: input with interrupt triggering
> >>     - 3: LDO on
> >>     - 4: LDO off
> >>     - 5~7: floating (or ADC)
> >>
> >
> > Just to be a little more precise,
> >      - 0: drive low
> >      - 1: drive high
> >      - 2: input with interrupt triggering
> >      - 3: LDO on
> >      - 4: LDO off
> >      - 5~7: floating (or ADC)
> >
> > for AXP813, and
> >      - 0: drive low
> >      - 1: drive high
> >      - 2: input with interrupt triggering
> >      - 3: LDO on
> >      - 4: ADC
> >      - 5~7: floating
> >
> > for AXP209.
> >
> > So I think what you suggested Linus is not really relevant here as the
> > regulator framework will take care of disabling the regulator when
> > needed (for AXP813 via the ldo_off "muxing" selected by the regulator
> > framework).
> 
> Linus is suggesting that we use (switching between) pinctrl states to
> control the regulator, as opposed to overriding the register value
> directly. That would be nice, as both subsystems would have the same
> idea of what's actually happening in the hardware.
> 
> As Linus mentioned, having the LDO on or off as the default pinctrl state
> is not pretty. It also means as soon as the device is brought up, the
> regulator state gets overridden. That would not work well for regulators
> that have/want the "always-on" or "boot-on" properties.

What about not enforcing any muxing state when we want to mux to the
"ldo" function? We just leave it to whatever value it is, that way we
keep it under the regulator framework's control, and we don't disrupt
anything when the pin is requested.

Maxime

-- 
Maxime Ripard, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 801 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20171011/b470338f/attachment.sig>

  reply	other threads:[~2017-10-11 12:00 UTC|newest]

Thread overview: 37+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-10-02 12:08 [PATCH v3 00/12] add pinmuxing support for pins in AXP209 and AXP813 PMICs Quentin Schulz
2017-10-02 12:08 ` [PATCH v3 01/12] pinctrl: move gpio-axp209 to pinctrl Quentin Schulz
2017-10-02 20:18   ` Maxime Ripard
2017-10-03  9:01     ` Chen-Yu Tsai
2017-10-02 12:08 ` [PATCH v3 02/12] pinctrl: axp209: add pinctrl features Quentin Schulz
2017-10-02 20:37   ` Maxime Ripard
2017-10-10 18:15   ` Rob Herring
2017-10-02 12:08 ` [PATCH v3 03/12] pinctrl: axp209: rename everything from gpio to pctl Quentin Schulz
2017-10-02 12:08 ` [PATCH v3 04/12] pinctrl: axp209: add programmable gpio_status_offset Quentin Schulz
2017-10-02 20:38   ` Maxime Ripard
2017-10-03  9:01     ` Chen-Yu Tsai
2017-10-02 12:08 ` [PATCH v3 05/12] pinctrl: axp209: add support for AXP813 GPIOs Quentin Schulz
2017-10-02 20:38   ` Maxime Ripard
2017-10-10 18:33   ` Rob Herring
2017-10-02 12:08 ` [PATCH v3 06/12] mfd: axp20x: add pinctrl cell for AXP813 Quentin Schulz
2017-10-02 20:39   ` Maxime Ripard
2017-10-02 12:08 ` [PATCH v3 07/12] ARM: dts: sun8i: a711: include axp81x dtsi Quentin Schulz
2017-10-02 20:40   ` Maxime Ripard
2017-10-02 12:08 ` [PATCH v3 08/12] ARM: dts: sun8i: bananapi-m3: " Quentin Schulz
2017-10-02 12:08 ` [PATCH v3 09/12] ARM: dts: sun8i: h8homlet-v2: " Quentin Schulz
2017-10-02 12:08 ` [PATCH v3 10/12] ARM: dts: sun8i: cubietruck-plus: " Quentin Schulz
2017-10-02 12:08 ` [PATCH v3 11/12] ARM: dtsi: axp81x: add GPIO DT node Quentin Schulz
2017-10-02 12:08 ` [PATCH v3 12/12] ARM: dtsi: axp81x: set pinmux for GPIO0/1 when used as LDOs Quentin Schulz
2017-10-02 20:42   ` Maxime Ripard
2017-10-03  2:06     ` Chen-Yu Tsai
2017-10-03  9:18       ` Russell King - ARM Linux
2017-10-03 14:43         ` Maxime Ripard
2017-10-03  9:27   ` Linus Walleij
2017-10-03 14:47     ` Maxime Ripard
2017-10-03 15:08       ` Chen-Yu Tsai
2017-10-04  7:35         ` Quentin Schulz
2017-10-10  3:09           ` Chen-Yu Tsai
2017-10-11 12:00             ` Maxime Ripard [this message]
2017-10-11 19:09               ` Linus Walleij
2017-10-12  2:22                 ` Chen-Yu Tsai
2017-10-11  7:43           ` Linus Walleij
2017-10-07 10:48 ` [PATCH v3 00/12] add pinmuxing support for pins in AXP209 and AXP813 PMICs Linus Walleij

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=20171011120036.bvw5dpz4myngtwu7@flea \
    --to=maxime.ripard@free-electrons.com \
    --cc=linux-arm-kernel@lists.infradead.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