From: Dmitry Torokhov <dmitry.torokhov@gmail.com>
To: "Agrawal, Nitesh-kumar" <Nitesh-kumar.Agrawal@amd.com>
Cc: "linus.walleij@linaro.org" <linus.walleij@linaro.org>,
"Sen, Pankaj" <Pankaj.Sen@amd.com>,
"S-k, Shyam-sundar" <Shyam-sundar.S-k@amd.com>,
"linux-gpio@vger.kernel.org" <linux-gpio@vger.kernel.org>
Subject: Re: pinctrl/amd: Configure GPIO register using BIOS settings
Date: Wed, 27 Sep 2017 23:58:16 -0700 [thread overview]
Message-ID: <20170928065816.GA28901@dtor-ws> (raw)
In-Reply-To: <CY1PR12MB0042D650A9FCDC4B1676FB0EDCFA0@CY1PR12MB0042.namprd12.prod.outlook.com>
On Fri, Sep 09, 2016 at 03:18:09PM +0000, Agrawal, Nitesh-kumar wrote:
> In the function amd_gpio_irq_set_type, use the settings provided by
> the BIOS,when the LevelTrig is Edge and activeLevel is HIGH, to configure
> the GPIO registers. Ignore the settings from client.
>
> Reviewed-by: Pankaj Sen <Pankaj.Sen@amd.com>
> Signed-off-by: Nitesh Kumar Agrawal <Nitesh-kumar.Agrawal@amd.com>
Just found this patch in the tree. Can you please explain why it is
needed (the patch description unfortunately tells what the patch does,
but not why).
I would expect that we either allow reprogramming the trigger as client
wishes or would error out and let the upper layers know. Silently
"fixing" the settings is wrong course of action in my opinion.
If this was trying to work around Elan touchpad drivers not working on
AMD platforms it needs to be solved in Elan driver, not here.
Thanks!
> ---
> drivers/pinctrl/pinctrl-amd.c | 14 ++++++++++++++
> 1 file changed, 14 insertions(+)
>
> diff --git a/drivers/pinctrl/pinctrl-amd.c b/drivers/pinctrl/pinctrl-amd.c
> index 828148d..6408dda 100644
> --- a/drivers/pinctrl/pinctrl-amd.c
> +++ b/drivers/pinctrl/pinctrl-amd.c
> @@ -384,6 +384,8 @@ static int amd_gpio_irq_set_type(struct irq_data *d, unsigned int type)
> {
> int ret = 0;
> u32 pin_reg;
> + bool level_trig;
> + u32 active_level;
> unsigned long flags;
> struct gpio_chip *gc = irq_data_get_irq_chip_data(d);
> struct amd_gpio *gpio_dev = gpiochip_get_data(gc);
> @@ -391,6 +393,18 @@ static int amd_gpio_irq_set_type(struct irq_data *d, unsigned int type)
> spin_lock_irqsave(&gpio_dev->lock, flags);
> pin_reg = readl(gpio_dev->base + (d->hwirq)*4);
>
> + /*
> + * Use the settings provided by the BIOS, when the LevelTrig is
> + * EDGE and the activeLevel is HIGH, ignore the settings coming
> + * from the client to configure the GPIO register.
> + */
> + level_trig = !(pin_reg & (LEVEL_TRIGGER << LEVEL_TRIG_OFF));
> + active_level = pin_reg & (ACTIVE_LEVEL_MASK << ACTIVE_LEVEL_OFF);
> +
> + if (level_trig && ((active_level >> ACTIVE_LEVEL_OFF) == ACTIVE_HIGH)) {
> + type = IRQ_TYPE_EDGE_FALLING;
> + }
> +
> switch (type & IRQ_TYPE_SENSE_MASK) {
> case IRQ_TYPE_EDGE_RISING:
> pin_reg &= ~BIT(LEVEL_TRIG_OFF);
--
Dmitry
next prev parent reply other threads:[~2017-09-28 6:58 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-09-09 15:18 [PATCH] pinctrl/amd: Configure GPIO register using BIOS settings Agrawal, Nitesh-kumar
2016-09-13 8:24 ` Linus Walleij
2017-09-28 6:58 ` Dmitry Torokhov [this message]
2017-09-28 7:46 ` Agrawal, Nitesh-kumar
2017-09-28 17:07 ` Dmitry Torokhov
2017-10-03 4:52 ` Agrawal, Nitesh-kumar
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=20170928065816.GA28901@dtor-ws \
--to=dmitry.torokhov@gmail.com \
--cc=Nitesh-kumar.Agrawal@amd.com \
--cc=Pankaj.Sen@amd.com \
--cc=Shyam-sundar.S-k@amd.com \
--cc=linus.walleij@linaro.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.