All of lore.kernel.org
 help / color / mirror / Atom feed
From: Drew Fustini <drew@beagleboard.org>
To: Geert Uytterhoeven <geert@linux-m68k.org>
Cc: Linus Walleij <linus.walleij@linaro.org>,
	"open list:GPIO SUBSYSTEM" <linux-gpio@vger.kernel.org>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	Tony Lindgren <tony@atomide.com>,
	Andy Shevchenko <andy.shevchenko@gmail.com>,
	Alexandre Belloni <alexandre.belloni@bootlin.com>,
	Pantelis Antoniou <pantelis.antoniou@konsulko.com>,
	Jason Kridner <jkridner@beagleboard.org>,
	Robert Nelson <robertcnelson@beagleboard.org>,
	Joe Perches <joe@perches.com>,
	Dan Carpenter <dan.carpenter@oracle.com>,
	Jonathan Corbet <corbet@lwn.net>,
	"open list:DOCUMENTATION" <linux-doc@vger.kernel.org>
Subject: Re: [PATCH v7 2/3] pinctrl: pinmux: Add pinmux-select debugfs file
Date: Sat, 20 Feb 2021 10:28:27 -0800	[thread overview]
Message-ID: <20210220182827.GA70861@x1> (raw)
In-Reply-To: <CAMuHMdXNz8ZbFXRgYCGuAd1+Cz8xTvMc-rkwXXiE-E-Fb5XXNA@mail.gmail.com>

On Fri, Feb 19, 2021 at 10:06:51AM +0100, Geert Uytterhoeven wrote:
> Hi Drew,
> 
> On Wed, Feb 17, 2021 at 11:15 PM Drew Fustini <drew@beagleboard.org> wrote:
> > Add "pinmux-select" to debugfs which will activate a function and group:
> >
> >   echo "<function-name group-name>" > pinmux-select
> >
> > The write operation pinmux_select() handles this by checking that the
> > names map to valid selectors and then calling ops->set_mux().
> >
> > The existing "pinmux-functions" debugfs file lists the pin functions
> > registered for the pin controller. For example:
> >
> >   function: pinmux-uart0, groups = [ pinmux-uart0-pins ]
> >   function: pinmux-mmc0, groups = [ pinmux-mmc0-pins ]
> >   function: pinmux-mmc1, groups = [ pinmux-mmc1-pins ]
> >   function: pinmux-i2c0, groups = [ pinmux-i2c0-pins ]
> >   function: pinmux-i2c1, groups = [ pinmux-i2c1-pins ]
> >   function: pinmux-spi1, groups = [ pinmux-spi1-pins ]
> >
> > To activate function pinmux-i2c1 and group pinmux-i2c1-pins:
> >
> >   echo "pinmux-i2c1 pinmux-i2c1-pins" > pinmux-select
> >
> > Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
> > Reviewed-by: Tony Lindgren <tony@atomide.com>
> > Signed-off-by: Drew Fustini <drew@beagleboard.org>
> 
> Thanks for your patch!
> 
> On R-Car M2-W, which does not use pinctrl-single, I have:
> 
>     # cat pinmux-functions
>     ...
>     function 14: i2c2, groups = [ i2c2 i2c2_b i2c2_c i2c2_d ]
>     ...
>     function 51: ssi, groups = [ ssi0_data ssi0_data_b ssi0129_ctrl
> ssi0129_ctrl_b ssi1_data ssi1_data_b ssi1_ctrl ssi1_ctrl_b ssi2_data
> ssi2_ctrl ssi3_data ssi34_ctrl ssi4_data ssi4_ctrl ssi5_data ssi5_ctrl
> ssi6_data ssi6_ctrl ssi7_data ssi7_data_b ssi78_ctrl ssi78_ctrl_b
> ssi8_data ssi8_data_b ssi9_data ssi9_data_b ssi9_ctrl ssi9_ctrl_b ]
>     ...
> 
> On the Koelsch board:
> 
>     # cd /sys/kernel/debug/pinctrl/e6060000.pinctrl-sh-pfc/
>     # echo ssi ssi2_ctrl > pinmux-select # Configure i2c2 pins for ssi
>     # i2cdetect -y -a 2                  # Fails
>     # echo i2c2 i2c2 > pinmux-select     # Restore i2c2
>     # i2cdetect -y -a 2                  # Works again
> 
> The order of the 2 parameters looks a bit odd to me, as the operation
> configures the pins from "group" to be used for "function".
> See also arch/arm/boot/dts/r8a7791-koelsch.dts
> For the i2c2 example it's not that obvious, but for ssi it is.
> Might feel different for pinctrl-single, and perhaps I just need to get
> used to it ;-)

Thank you for comments and testing.

Regarding the order of "<function-name> <group-name>", I can change it
to "<group-name function-name>" if that seems more natural.

pinctrl-single does not actually use the group selector in pcs_set_mux()
so it essentially does not matter for pinctrl-single.

-Drew

> 
> Anyway:
> Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
> Tested-by: Geert Uytterhoeven <geert+renesas@glider.be>
> 
> Gr{oetje,eeting}s,
> 
>                         Geert
> 
> 
> --
> Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org
> 
> In personal conversations with technical people, I call myself a hacker. But
> when I'm talking to journalists I just say "programmer" or something like that.
>                                 -- Linus Torvalds

  reply	other threads:[~2021-02-20 18:29 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-02-17 22:14 [PATCH v7 0/3] pinctrl: pinmux: Add pinmux-select debugfs file Drew Fustini
2021-02-17 22:14 ` [PATCH v7 1/3] pinctrl: use to octal permissions for debugfs files Drew Fustini
2021-02-17 22:14 ` [PATCH v7 2/3] pinctrl: pinmux: Add pinmux-select debugfs file Drew Fustini
2021-02-19  9:06   ` Geert Uytterhoeven
2021-02-20 18:28     ` Drew Fustini [this message]
2021-02-17 22:14 ` [PATCH v7 3/3] docs/pinctrl: document debugfs files Drew Fustini
2021-02-19  9:20   ` Geert Uytterhoeven

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=20210220182827.GA70861@x1 \
    --to=drew@beagleboard.org \
    --cc=alexandre.belloni@bootlin.com \
    --cc=andy.shevchenko@gmail.com \
    --cc=corbet@lwn.net \
    --cc=dan.carpenter@oracle.com \
    --cc=geert@linux-m68k.org \
    --cc=jkridner@beagleboard.org \
    --cc=joe@perches.com \
    --cc=linus.walleij@linaro.org \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-gpio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=pantelis.antoniou@konsulko.com \
    --cc=robertcnelson@beagleboard.org \
    --cc=tony@atomide.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.