All of lore.kernel.org
 help / color / mirror / Atom feed
From: Shawn Guo <shawn.guo@linaro.org>
To: Andy Shevchenko <andy.shevchenko@gmail.com>
Cc: Linus Walleij <linus.walleij@linaro.org>,
	Bjorn Andersson <bjorn.andersson@linaro.org>,
	"open list:GPIO SUBSYSTEM" <linux-gpio@vger.kernel.org>,
	linux-arm-msm@vger.kernel.org
Subject: Re: [PATCH] pinctrl: qcom: support gpio_chip .set_config call
Date: Tue, 2 Mar 2021 09:02:26 +0800	[thread overview]
Message-ID: <20210302010225.GG24428@dragon> (raw)
In-Reply-To: <CAHp75Vdi1WuZxhBKqGS7xnVzZpBrKwNbXbp5k0Y5ibZ4aAyBrg@mail.gmail.com>

On Mon, Mar 01, 2021 at 07:07:03PM +0200, Andy Shevchenko wrote:
> On Sun, Feb 28, 2021 at 4:55 AM Shawn Guo <shawn.guo@linaro.org> wrote:
> >
> > In case of ACPI boot, GPIO core does the right thing to parse GPIO pin
> > configs from ACPI table, and call into gpio_chip's .set_config hook for
> > setting them up.  It enables such support on qcom platform by using
> > generic config function, which in turn calls into .pin_config_set of
> > pinconf for setting up hardware.  For qcom platform, it's possible to
> > reuse pin group config functions for pin config hooks, because every pin
> > is maintained as a single group.
> >
> > This change fixes the problem that Touchpad of Lenovo Flex 5G laptop
> > doesn't work with ACPI boot, because PullUp config of Touchpad GpioInt
> > pin is not set up by kernel driver.
> 
> by the kernel
> 
> ...
> 
> >         .pin_config_group_get   = msm_config_group_get,
> >         .pin_config_group_set   = msm_config_group_set,
> > +       .pin_config_get         = msm_config_group_get,
> > +       .pin_config_set         = msm_config_group_set,
> 
> This can't be right. They have different semantics.

As mentioned in the commit log, this works considering every pin is
maintained as a single group on Qualcomm platform.  So configuring one
pin is essentially to configure the group containing the pin.  I can do
something like below, if you think that's easier to understand.

static int msm_config_pin_get(struct pinctrl_dev *pctldev, unsigned int pin,
                              unsigned long *config)
{
        return msm_config_group_get(pctldev, pin, config);
}

static int msm_config_pin_set(struct pinctrl_dev *pctldev, unsigned pin,
                              unsigned long *configs, unsigned num_configs)
{
        return msm_config_group_set(pctldev, pin, configs, num_configs);
}

static const struct pinconf_ops msm_pinconf_ops = {
	...
        .pin_config_get         = msm_config_pin_get,
        .pin_config_set         = msm_config_pin_set,
};

Shawn

  reply	other threads:[~2021-03-02  8:11 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-02-28  2:52 [PATCH] pinctrl: qcom: support gpio_chip .set_config call Shawn Guo
2021-03-01 17:07 ` Andy Shevchenko
2021-03-02  1:02   ` Shawn Guo [this message]
2021-03-02 10:27     ` Andy Shevchenko

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=20210302010225.GG24428@dragon \
    --to=shawn.guo@linaro.org \
    --cc=andy.shevchenko@gmail.com \
    --cc=bjorn.andersson@linaro.org \
    --cc=linus.walleij@linaro.org \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-gpio@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 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.