Skip to content

Commit 55aedef

Browse files
andy-shevlinusw
authored andcommitted
pinctrl: intel: Do pin translation when lock IRQ
Default GPIOLIB callbacks for request and release IRQ do not do a GPIO to pin translation which is necessary for Intel hardware, such as Intel Cannonlake. Absence of the translation prevents some pins to be locked as IRQ due to direction check. Introduce own callbacks to make translation possible to avoid above issue. Fixes: a60eac3 ("pinctrl: intel: Allow custom GPIO base for pad groups") Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Acked-by: Mika Westerberg <mika.westerberg@linux.intel.com> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
1 parent b4859f3 commit 55aedef

File tree

1 file changed

+30
-0
lines changed

1 file changed

+30
-0
lines changed

drivers/pinctrl/intel/pinctrl-intel.c

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -872,6 +872,34 @@ static int intel_gpio_to_pin(struct intel_pinctrl *pctrl, unsigned offset,
872872
return -EINVAL;
873873
}
874874

875+
static int intel_gpio_irq_reqres(struct irq_data *d)
876+
{
877+
struct gpio_chip *gc = irq_data_get_irq_chip_data(d);
878+
struct intel_pinctrl *pctrl = gpiochip_get_data(gc);
879+
int pin;
880+
881+
pin = intel_gpio_to_pin(pctrl, irqd_to_hwirq(d), NULL, NULL);
882+
if (pin >= 0) {
883+
if (gpiochip_lock_as_irq(gc, pin)) {
884+
dev_err(pctrl->dev, "unable to lock HW IRQ %d for IRQ\n",
885+
pin);
886+
return -EINVAL;
887+
}
888+
}
889+
return 0;
890+
}
891+
892+
static void intel_gpio_irq_relres(struct irq_data *d)
893+
{
894+
struct gpio_chip *gc = irq_data_get_irq_chip_data(d);
895+
struct intel_pinctrl *pctrl = gpiochip_get_data(gc);
896+
int pin;
897+
898+
pin = intel_gpio_to_pin(pctrl, irqd_to_hwirq(d), NULL, NULL);
899+
if (pin >= 0)
900+
gpiochip_unlock_as_irq(gc, pin);
901+
}
902+
875903
static void intel_gpio_irq_ack(struct irq_data *d)
876904
{
877905
struct gpio_chip *gc = irq_data_get_irq_chip_data(d);
@@ -1087,6 +1115,8 @@ static irqreturn_t intel_gpio_irq(int irq, void *data)
10871115

10881116
static struct irq_chip intel_gpio_irqchip = {
10891117
.name = "intel-gpio",
1118+
.irq_request_resources = intel_gpio_irq_reqres,
1119+
.irq_release_resources = intel_gpio_irq_relres,
10901120
.irq_enable = intel_gpio_irq_enable,
10911121
.irq_ack = intel_gpio_irq_ack,
10921122
.irq_mask = intel_gpio_irq_mask,

0 commit comments

Comments
 (0)