Commit 2983f296 authored by Shyam Sundar S K's avatar Shyam Sundar S K Committed by Linus Walleij

pinctrl/amd: Set the level based on ACPI tables

In the function amd_gpio_irq_set_type, read the values from
the ACPI table to set the level and drop the settings passed
by the client.

Cc: <stable@vger.kernel.org> # 4.8.x+
Reviewed-by: default avatarPankaj Sen <Pankaj.Sen@amd.com>
Reviewed-by: default avatarNitesh Kumar Agrawal <Nitesh-kumar.Agrawal@amd.com>
Reviewed-by: default avatarShah, Nehal-bakulchandra <Nehal-bakulchandra.Shah@amd.com>
Signed-off-by: default avatarShyam-sundar S-k <Shyam-sundar.S-k@amd.com>
Signed-off-by: default avatarLinus Walleij <linus.walleij@linaro.org>
parent 7ce7d89f
...@@ -382,26 +382,21 @@ static int amd_gpio_irq_set_type(struct irq_data *d, unsigned int type) ...@@ -382,26 +382,21 @@ static int amd_gpio_irq_set_type(struct irq_data *d, unsigned int type)
{ {
int ret = 0; int ret = 0;
u32 pin_reg; u32 pin_reg;
unsigned long flags; unsigned long flags, irq_flags;
bool level_trig;
u32 active_level;
struct gpio_chip *gc = irq_data_get_irq_chip_data(d); struct gpio_chip *gc = irq_data_get_irq_chip_data(d);
struct amd_gpio *gpio_dev = gpiochip_get_data(gc); struct amd_gpio *gpio_dev = gpiochip_get_data(gc);
spin_lock_irqsave(&gpio_dev->lock, flags); spin_lock_irqsave(&gpio_dev->lock, flags);
pin_reg = readl(gpio_dev->base + (d->hwirq)*4); pin_reg = readl(gpio_dev->base + (d->hwirq)*4);
/* /* Ignore the settings coming from the client and
* When level_trig is set EDGE and active_level is set HIGH in BIOS * read the values from the ACPI tables
* default settings, ignore incoming settings from client and use * while setting the trigger type
* BIOS settings to configure GPIO register.
*/ */
level_trig = !(pin_reg & (LEVEL_TRIGGER << LEVEL_TRIG_OFF));
active_level = pin_reg & (ACTIVE_LEVEL_MASK << ACTIVE_LEVEL_OFF);
if(level_trig && irq_flags = irq_get_trigger_type(d->irq);
((active_level >> ACTIVE_LEVEL_OFF) == ACTIVE_HIGH)) if (irq_flags != IRQ_TYPE_NONE)
type = IRQ_TYPE_EDGE_FALLING; type = irq_flags;
switch (type & IRQ_TYPE_SENSE_MASK) { switch (type & IRQ_TYPE_SENSE_MASK) {
case IRQ_TYPE_EDGE_RISING: case IRQ_TYPE_EDGE_RISING:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment