linux-gpio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Tony Lindgren <tony@atomide.com>
To: Linus Walleij <linus.walleij@linaro.org>
Cc: "Niedermayr, BENEDIKT" <benedikt.niedermayr@siemens.com>,
	"linux-omap@vger.kernel.org" <linux-omap@vger.kernel.org>,
	"haojian.zhuang@linaro.org" <haojian.zhuang@linaro.org>,
	linux-gpio@vger.kernel.org
Subject: Re: Pinconf issues on AMxxx plattforms
Date: Fri, 5 May 2023 11:54:27 +0300	[thread overview]
Message-ID: <20230505085427.GR14287@atomide.com> (raw)
In-Reply-To: <CACRpkdaQe61Jk6WoCr8vYkGKJPMiM7D+iF0w9fKjoOxBWtinhg@mail.gmail.com>

* Linus Walleij <linus.walleij@linaro.org> [230504 08:31]:
> On Thu, May 4, 2023 at 7:35 AM Tony Lindgren <tony@atomide.com> wrote:
> > * Niedermayr, BENEDIKT <benedikt.niedermayr@siemens.com> [230503 08:38]:
> 
> > > We encountered some issues when accessing the gpiochardev interface on an
> > > AM65xx plaform.
> 
> Thank you for using contemporary APIs!
> 
> > > The pinctrl offers 3 different options for muxing:
> > >
> > > 1.  Using the generic kernel APIs:
> > >      Call pinctrl_select_state() function as stated
> > > in  Documentation/driver-api/pin-control.rst (section "Pin control requests
> > > from drivers").
> > >      This function will select a defined state which has been defined in DTB
> > > with "pinctrl-0", "pinctrl-1", "pinctrl-x"
> > > 2.  Mux pins with debugfs:
> > >      Write the desired pingroup and pinfunction into the "pinmux-select"
> > > file of the related pin controller.
> > > 3. Mux the GPIO function of a requested GPIO pin by calling the pinctrl
> > > drivers pcs_request_gpio() function.
> > >
> > > The problem now is that only option 1. will store the current mux
> > > information in the pinctrl subsystems core.
> > > The pinctrl-single driver highly depends on that information, which is not
> > > available at all wenn muxing with options 2&3.
> > >
> > > I was able to fix that for option 2 but not for option 3. The problem here
> > > is that the pcs_request_gpio() function just does not provide enough
> > > parameters with sufficient information for achieving that task.
> 
> The fact that 3) doesn't work has to do with how pinctrl-single has
> been engineered I think, what the pinctrl_ops .gpio_request_enable/
> .gpio_disable_free/.gpio_set_direction provide is a "shortcut"
> for drivers that want to take it, in case they can provide the right
> information.
> 
> The pinctrl-single driver only implements .gpio_request_enable()
> but often that is enough.
> 
> Then it is the callbacks for generic config that you said you already
> added to gpio-davinci.c, so that part should be fine, patches welcome!

Thanks for explaining. Sounds like pinctrl-single should possibly
implement the missing functions and update pinctrl core with the
changes when a gpio is requested.

Regards,

Tony

  reply	other threads:[~2023-05-05  8:54 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <aa493d62327f26e4c65d649a812346cdfb26771f.camel@siemens.com>
2023-05-04  5:35 ` Pinconf issues on AMxxx plattforms Tony Lindgren
2023-05-04  8:31   ` Linus Walleij
2023-05-05  8:54     ` Tony Lindgren [this message]
2023-05-05 13:28     ` Niedermayr, BENEDIKT
2023-05-05 12:59   ` Niedermayr, BENEDIKT

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=20230505085427.GR14287@atomide.com \
    --to=tony@atomide.com \
    --cc=benedikt.niedermayr@siemens.com \
    --cc=haojian.zhuang@linaro.org \
    --cc=linus.walleij@linaro.org \
    --cc=linux-gpio@vger.kernel.org \
    --cc=linux-omap@vger.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).