linux-gpio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Drew Fustini <drew@beagleboard.org>
To: Andy Shevchenko <andy.shevchenko@gmail.com>
Cc: "open list:GPIO SUBSYSTEM" <linux-gpio@vger.kernel.org>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	Linus Walleij <linus.walleij@linaro.org>,
	Tony Lindgren <tony@atomide.com>
Subject: Re: [RFC PATCH] pinctrl: add helper to expose pinctrl state in debugfs
Date: Sat, 19 Dec 2020 12:18:42 -0800	[thread overview]
Message-ID: <20201219201842.GA30242@x1> (raw)
In-Reply-To: <CAHp75VfbEE0t2g=uzux5=dhgAHwv15OKpVr+xrF19VskO7HnTw@mail.gmail.com>

On Fri, Dec 18, 2020 at 06:00:49PM +0200, Andy Shevchenko wrote:
> On Wed, Dec 16, 2020 at 12:42 AM Drew Fustini <drew@beagleboard.org> wrote:
> > On Tue, Dec 15, 2020 at 09:39:18PM +0200, Andy Shevchenko wrote:
> > > On Tue, Dec 15, 2020 at 9:36 PM Andy Shevchenko
> > > <andy.shevchenko@gmail.com> wrote:
> > > > On Mon, Dec 14, 2020 at 11:44 PM Drew Fustini <drew@beagleboard.org> wrote:
> > > > > On Mon, Dec 14, 2020 at 07:55:12PM +0200, Andy Shevchenko wrote:
> > >
> > > ...
> > >
> > > > > With regards to parent directory, I did discover there is
> > > > > debugfs_lookup(), so I can get the dentry for "pinctrl" and create new
> > > > > subdirectory inside of it.  This is the structure now:
> > > > >
> > > > > /sys/kernel/debug/pinctrl/pinctrl_state/ocp:P2_35_pinmux/state
> > > > > /sys/kernel/debug/pinctrl/pinctrl_state/ocp:P2_34_pinmux/state
> > > > > /sys/kernel/debug/pinctrl/pinctrl_state/ocp:P2_33_pinmux/state
> > > > > /sys/kernel/debug/pinctrl/pinctrl_state/ocp:P2_32_pinmux/state
> > > > > etc..
> > >
> > > Missed part to comment.
> > >
> > > I was talking about
> > >
> > > /sys/kernel/debug/pinctrl/<$PINCTRL>/mux/<$PIN> (maybe folder, maybe node)
> >
> > Thanks for the example.
> >
> > What would the value be "<$PINCTRL>"?  The name of the driver?
> 
> The name of the device instance. This is already done in the pin control code.

Ah, so for the BeagleBone, that would be 44e10800.pinmux-pinctrl-single:

/sys/kernel/debug/pinctrl/44e10800.pinmux-pinctrl-single/

> 
> > The "ocp:Px_yy_pinmux" directory name comes from dev_name(dev). Is that
> > the name you were referencing in "<$PIN>"?
> 
> No, the <$PIN> is an actual pin on this controller. However, I think
> we probably don't need this, just supply it as tuple of the parameters
> to be set: like
> echo $PIN $STATE > .../<$PINCTRL>/mux or alike.

Do you mean not having a debugfs file for each pin, but instead just using the
existing combined file?

/sys/kernel/debug/pinctrl/44e10800.pinmux-pinctrl-single/pinmux-pins

There is one line in there for each pin in the pinctrl-single instance.

For example:

pin 105 (PIN105): ocp:P2_34_pinmux (GPIO UNCLAIMED) function pinmux_P2_34_default_pin group pinmux_P2_34_default_pin

So maybe one solution to changing pinctrl state could to:

echo "105 gpio_pu" > /sys/kernel/debug/pinctrl/44e10800.pinmux-pinctrl-single/pinmux-pins

I'll make an attempt at implementing that.

> 
> -- 
> With Best Regards,
> Andy Shevchenko

  reply	other threads:[~2020-12-19 20:19 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-12-11  4:26 [RFC PATCH] pinctrl: add helper to expose pinctrl state in debugfs Drew Fustini
2020-12-11 21:15 ` Andy Shevchenko
2020-12-11 23:43   ` Drew Fustini
2020-12-14 17:55     ` Andy Shevchenko
2020-12-14 21:44       ` Drew Fustini
2020-12-15 19:36         ` Andy Shevchenko
2020-12-15 19:39           ` Andy Shevchenko
2020-12-15 22:42             ` Drew Fustini
2020-12-18 16:00               ` Andy Shevchenko
2020-12-19 20:18                 ` Drew Fustini [this message]
2020-12-15 22:37           ` Drew Fustini

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=20201219201842.GA30242@x1 \
    --to=drew@beagleboard.org \
    --cc=andy.shevchenko@gmail.com \
    --cc=linus.walleij@linaro.org \
    --cc=linux-gpio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.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 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).