Skip to content

Commit 1890205

Browse files
committed
Merge tag 'gpio-fixes-for-v6.2' of git://git.kernel.org/pub/scm/linux/kernel/git/brgl/linux
Pull gpio fixes from Bartosz Golaszewski: - fix a potential Kconfig issue with gpio-mlxbf2 not selecting GPIOLIB_IRQCHIP - another immutable irqchip conversion, this time for gpio-vf610 - fix a wakeup issue on Clevo NH5xAx * tag 'gpio-fixes-for-v6.2' of git://git.kernel.org/pub/scm/linux/kernel/git/brgl/linux: gpio: mlxbf2: select GPIOLIB_IRQCHIP gpiolib: acpi: Add a ignore wakeup quirk for Clevo NH5xAx gpio: vf610: make irq_chip immutable gpiolib: acpi: remove redundant declaration
2 parents 88d3558 + b8b3b0b commit 1890205

File tree

4 files changed

+36
-19
lines changed

4 files changed

+36
-19
lines changed

drivers/gpio/Kconfig

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1531,6 +1531,7 @@ config GPIO_MLXBF2
15311531
tristate "Mellanox BlueField 2 SoC GPIO"
15321532
depends on (MELLANOX_PLATFORM && ARM64 && ACPI) || (64BIT && COMPILE_TEST)
15331533
select GPIO_GENERIC
1534+
select GPIOLIB_IRQCHIP
15341535
help
15351536
Say Y here if you want GPIO support on Mellanox BlueField 2 SoC.
15361537

drivers/gpio/gpio-vf610.c

Lines changed: 23 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@ struct fsl_gpio_soc_data {
3030

3131
struct vf610_gpio_port {
3232
struct gpio_chip gc;
33-
struct irq_chip ic;
3433
void __iomem *base;
3534
void __iomem *gpio_base;
3635
const struct fsl_gpio_soc_data *sdata;
@@ -207,20 +206,24 @@ static int vf610_gpio_irq_set_type(struct irq_data *d, u32 type)
207206

208207
static void vf610_gpio_irq_mask(struct irq_data *d)
209208
{
210-
struct vf610_gpio_port *port =
211-
gpiochip_get_data(irq_data_get_irq_chip_data(d));
212-
void __iomem *pcr_base = port->base + PORT_PCR(d->hwirq);
209+
struct gpio_chip *gc = irq_data_get_irq_chip_data(d);
210+
struct vf610_gpio_port *port = gpiochip_get_data(gc);
211+
irq_hw_number_t gpio_num = irqd_to_hwirq(d);
212+
void __iomem *pcr_base = port->base + PORT_PCR(gpio_num);
213213

214214
vf610_gpio_writel(0, pcr_base);
215+
gpiochip_disable_irq(gc, gpio_num);
215216
}
216217

217218
static void vf610_gpio_irq_unmask(struct irq_data *d)
218219
{
219-
struct vf610_gpio_port *port =
220-
gpiochip_get_data(irq_data_get_irq_chip_data(d));
221-
void __iomem *pcr_base = port->base + PORT_PCR(d->hwirq);
220+
struct gpio_chip *gc = irq_data_get_irq_chip_data(d);
221+
struct vf610_gpio_port *port = gpiochip_get_data(gc);
222+
irq_hw_number_t gpio_num = irqd_to_hwirq(d);
223+
void __iomem *pcr_base = port->base + PORT_PCR(gpio_num);
222224

223-
vf610_gpio_writel(port->irqc[d->hwirq] << PORT_PCR_IRQC_OFFSET,
225+
gpiochip_enable_irq(gc, gpio_num);
226+
vf610_gpio_writel(port->irqc[gpio_num] << PORT_PCR_IRQC_OFFSET,
224227
pcr_base);
225228
}
226229

@@ -237,6 +240,17 @@ static int vf610_gpio_irq_set_wake(struct irq_data *d, u32 enable)
237240
return 0;
238241
}
239242

243+
static const struct irq_chip vf610_irqchip = {
244+
.name = "gpio-vf610",
245+
.irq_ack = vf610_gpio_irq_ack,
246+
.irq_mask = vf610_gpio_irq_mask,
247+
.irq_unmask = vf610_gpio_irq_unmask,
248+
.irq_set_type = vf610_gpio_irq_set_type,
249+
.irq_set_wake = vf610_gpio_irq_set_wake,
250+
.flags = IRQCHIP_IMMUTABLE,
251+
GPIOCHIP_IRQ_RESOURCE_HELPERS,
252+
};
253+
240254
static void vf610_gpio_disable_clk(void *data)
241255
{
242256
clk_disable_unprepare(data);
@@ -249,7 +263,6 @@ static int vf610_gpio_probe(struct platform_device *pdev)
249263
struct vf610_gpio_port *port;
250264
struct gpio_chip *gc;
251265
struct gpio_irq_chip *girq;
252-
struct irq_chip *ic;
253266
int i;
254267
int ret;
255268

@@ -315,14 +328,6 @@ static int vf610_gpio_probe(struct platform_device *pdev)
315328
gc->direction_output = vf610_gpio_direction_output;
316329
gc->set = vf610_gpio_set;
317330

318-
ic = &port->ic;
319-
ic->name = "gpio-vf610";
320-
ic->irq_ack = vf610_gpio_irq_ack;
321-
ic->irq_mask = vf610_gpio_irq_mask;
322-
ic->irq_unmask = vf610_gpio_irq_unmask;
323-
ic->irq_set_type = vf610_gpio_irq_set_type;
324-
ic->irq_set_wake = vf610_gpio_irq_set_wake;
325-
326331
/* Mask all GPIO interrupts */
327332
for (i = 0; i < gc->ngpio; i++)
328333
vf610_gpio_writel(0, port->base + PORT_PCR(i));
@@ -331,7 +336,7 @@ static int vf610_gpio_probe(struct platform_device *pdev)
331336
vf610_gpio_writel(~0, port->base + PORT_ISFR);
332337

333338
girq = &gc->irq;
334-
girq->chip = ic;
339+
gpio_irq_chip_set_chip(girq, &vf610_irqchip);
335340
girq->parent_handler = vf610_gpio_irq_handler;
336341
girq->num_parents = 1;
337342
girq->parents = devm_kcalloc(&pdev->dev, 1,

drivers/gpio/gpiolib-acpi.c

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1637,6 +1637,18 @@ static const struct dmi_system_id gpiolib_acpi_quirks[] __initconst = {
16371637
.ignore_wake = "ELAN0415:00@9",
16381638
},
16391639
},
1640+
{
1641+
/*
1642+
* Spurious wakeups from TP_ATTN# pin
1643+
* Found in BIOS 1.7.7
1644+
*/
1645+
.matches = {
1646+
DMI_MATCH(DMI_BOARD_NAME, "NH5xAx"),
1647+
},
1648+
.driver_data = &(struct acpi_gpiolib_dmi_quirk) {
1649+
.ignore_wake = "SYNA1202:00@16",
1650+
},
1651+
},
16401652
{} /* Terminating entry */
16411653
};
16421654

drivers/gpio/gpiolib-acpi.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414

1515
#include <linux/gpio/consumer.h>
1616

17-
struct acpi_device;
1817
struct device;
1918
struct fwnode_handle;
2019

0 commit comments

Comments
 (0)