From: Stephen Warren <swarren@nvidia.com>
To: Linus Walleij <linus.walleij@linaro.org>
Cc: Linus Walleij <linus.walleij@stericsson.com>,
"B29396@freescale.com" <B29396@freescale.com>,
"s.hauer@pengutronix.de" <s.hauer@pengutronix.de>,
"dongas86@gmail.com" <dongas86@gmail.com>,
"shawn.guo@linaro.org" <shawn.guo@linaro.org>,
"thomas.abraham@linaro.org" <thomas.abraham@linaro.org>,
"tony@atomide.com" <tony@atomide.com>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: RE: [PATCH V2 1/2] pinctrl: Introduce PINCTRL_STATE_DEFAULT, define hogs as that state
Date: Wed, 29 Feb 2012 11:21:53 -0800 [thread overview]
Message-ID: <74CDBE0F657A3D45AFBB94109FB122FF17BDDF2125@HQMAIL01.nvidia.com> (raw)
In-Reply-To: <74CDBE0F657A3D45AFBB94109FB122FF17BDDF209D@HQMAIL01.nvidia.com>
Stephen Warren wrote at Wednesday, February 29, 2012 10:42 AM:
> Linus Walleij wrote at Wednesday, February 29, 2012 9:41 AM:
> > Aha now I see the problem here...
> >
> > On Tue, Feb 28, 2012 at 12:55 AM, Stephen Warren <swarren@nvidia.com> wrote:
> >
> > > This provides a single centralized name for the default state.
> > (...)
> > > -/* Hog a single map entry and add to the hoglist */
> > > -static int pinctrl_hog_map(struct pinctrl_dev *pctldev,
> > (...)
> > > -static int pinctrl_hog_maps(struct pinctrl_dev *pctldev)
> > (...)
> > > - pinctrl_hog_maps(pctldev);
> > > + pctldev->p = pinctrl_get(pctldev->dev, PINCTRL_STATE_DEFAULT);
> > > + if (!IS_ERR(pctldev->p))
> > > + pinctrl_enable(pctldev->p);
> >
> > So what happens here is that my hogs will try to activate three different
> > functions in the same struct pinctrl *p.
> >
> > This fails the sanity check in pinmux.c:
> >
> > /*
> > * If the function selector is already set, it needs to be identical,
> > * we support several groups with one function but not several
> > * functions with one or several groups in the same pinmux.
> > */
> > if (p->func_selector != UINT_MAX &&
> > p->func_selector != func_selector) {
> > dev_err(pctldev->dev,
> > "dual function defines in the map for device %s\n",
> > devname);
> > return -EINVAL;
> > }
> > p->func_selector = func_selector;
>
> Oh right, I'd forgotten about that check at this stage in the patch
> series.
>
> Later in the series, this restriction is removed; each setting in a state
> is completely independent, and could easily program a different function
> onto each group, or the same function. At this stage in the series, a
> struct pinctrl can't represent everything that a set of mapping table
> entries can, but later struct pinctrl is fully capable.
>
> I guess the solution here is to just make this patch introduce the
> PINCTRL_STATE_DEFAULT define, but defer most usage of it until later
> in the series when this restriction is removed.
Actually, it looks very easy to move the func_selector field out of
struct pinctrl into struct pinmux_group, which would solve this problem
in what I consider the correct way. I'll code up a patch to do that and
stack it before this current patch.
--
nvpublic
next prev parent reply other threads:[~2012-02-29 19:22 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-02-27 23:55 Stephen Warren
2012-02-27 23:55 ` [PATCH V2 2/2] pinctrl: Assume map table entries can't have a NULL name field Stephen Warren
2012-02-28 9:35 ` Dong Aisheng
2012-02-28 9:30 ` [PATCH V2 1/2] pinctrl: Introduce PINCTRL_STATE_DEFAULT, define hogs as that state Dong Aisheng
2012-02-28 17:26 ` Stephen Warren
2012-02-29 2:31 ` Dong Aisheng
2012-02-29 16:14 ` Linus Walleij
2012-02-29 16:40 ` Linus Walleij
2012-02-29 17:41 ` Stephen Warren
2012-02-29 19:21 ` Stephen Warren [this message]
2012-02-29 19:42 ` 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=74CDBE0F657A3D45AFBB94109FB122FF17BDDF2125@HQMAIL01.nvidia.com \
--to=swarren@nvidia.com \
--cc=B29396@freescale.com \
--cc=dongas86@gmail.com \
--cc=linus.walleij@linaro.org \
--cc=linus.walleij@stericsson.com \
--cc=linux-kernel@vger.kernel.org \
--cc=s.hauer@pengutronix.de \
--cc=shawn.guo@linaro.org \
--cc=thomas.abraham@linaro.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
all inboxes | Powered by JetHome®