Skip to content

Commit 37d0be6

Browse files
committed
Merge tag 'gpio-fixes-for-v6.2-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/brgl/linux
Pull gpio fixes from Bartosz Golaszewski: - fix the -c option in the gpio-event-mode user-space example program - fix the irq number translation in gpio-ep93xx and make its irqchip immutable - add a missing spin_unlock in error path in gpio-mxc - fix a suspend breakage on System76 and Lenovo Gen2a introduced in GPIO ACPI * tag 'gpio-fixes-for-v6.2-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/brgl/linux: tools: gpio: fix -c option of gpio-event-mon gpio: ep93xx: remove unused variable gpio: ep93xx: Make irqchip immutable gpio: ep93xx: Fix port F hwirq numbers in handler gpio: mxc: Unlock on error path in mxc_flip_edge() gpiolib-acpi: Don't set GPIOs for wakeup in S3 mode
2 parents 4d1483a + 677d85e commit 37d0be6

File tree

4 files changed

+27
-18
lines changed

4 files changed

+27
-18
lines changed

drivers/gpio/gpio-ep93xx.c

Lines changed: 22 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
#include <linux/slab.h>
1818
#include <linux/gpio/driver.h>
1919
#include <linux/bitops.h>
20+
#include <linux/seq_file.h>
2021

2122
#define EP93XX_GPIO_F_INT_STATUS 0x5c
2223
#define EP93XX_GPIO_A_INT_STATUS 0xa0
@@ -40,7 +41,6 @@
4041
#define EP93XX_GPIO_F_IRQ_BASE 80
4142

4243
struct ep93xx_gpio_irq_chip {
43-
struct irq_chip ic;
4444
u8 irq_offset;
4545
u8 int_unmasked;
4646
u8 int_enabled;
@@ -148,7 +148,7 @@ static void ep93xx_gpio_f_irq_handler(struct irq_desc *desc)
148148
*/
149149
struct irq_chip *irqchip = irq_desc_get_chip(desc);
150150
unsigned int irq = irq_desc_get_irq(desc);
151-
int port_f_idx = ((irq + 1) & 7) ^ 4; /* {19..22,47..50} -> {0..7} */
151+
int port_f_idx = (irq & 7) ^ 4; /* {20..23,48..51} -> {0..7} */
152152
int gpio_irq = EP93XX_GPIO_F_IRQ_BASE + port_f_idx;
153153

154154
chained_irq_enter(irqchip, desc);
@@ -185,6 +185,7 @@ static void ep93xx_gpio_irq_mask_ack(struct irq_data *d)
185185
ep93xx_gpio_update_int_params(epg, eic);
186186

187187
writeb(port_mask, epg->base + eic->irq_offset + EP93XX_INT_EOI_OFFSET);
188+
gpiochip_disable_irq(gc, irqd_to_hwirq(d));
188189
}
189190

190191
static void ep93xx_gpio_irq_mask(struct irq_data *d)
@@ -195,6 +196,7 @@ static void ep93xx_gpio_irq_mask(struct irq_data *d)
195196

196197
eic->int_unmasked &= ~BIT(d->irq & 7);
197198
ep93xx_gpio_update_int_params(epg, eic);
199+
gpiochip_disable_irq(gc, irqd_to_hwirq(d));
198200
}
199201

200202
static void ep93xx_gpio_irq_unmask(struct irq_data *d)
@@ -203,6 +205,7 @@ static void ep93xx_gpio_irq_unmask(struct irq_data *d)
203205
struct ep93xx_gpio_irq_chip *eic = to_ep93xx_gpio_irq_chip(gc);
204206
struct ep93xx_gpio *epg = gpiochip_get_data(gc);
205207

208+
gpiochip_enable_irq(gc, irqd_to_hwirq(d));
206209
eic->int_unmasked |= BIT(d->irq & 7);
207210
ep93xx_gpio_update_int_params(epg, eic);
208211
}
@@ -320,15 +323,25 @@ static int ep93xx_gpio_set_config(struct gpio_chip *gc, unsigned offset,
320323
return 0;
321324
}
322325

323-
static void ep93xx_init_irq_chip(struct device *dev, struct irq_chip *ic)
326+
static void ep93xx_irq_print_chip(struct irq_data *data, struct seq_file *p)
324327
{
325-
ic->irq_ack = ep93xx_gpio_irq_ack;
326-
ic->irq_mask_ack = ep93xx_gpio_irq_mask_ack;
327-
ic->irq_mask = ep93xx_gpio_irq_mask;
328-
ic->irq_unmask = ep93xx_gpio_irq_unmask;
329-
ic->irq_set_type = ep93xx_gpio_irq_type;
328+
struct gpio_chip *gc = irq_data_get_irq_chip_data(data);
329+
330+
seq_printf(p, dev_name(gc->parent));
330331
}
331332

333+
static const struct irq_chip gpio_eic_irq_chip = {
334+
.name = "ep93xx-gpio-eic",
335+
.irq_ack = ep93xx_gpio_irq_ack,
336+
.irq_mask = ep93xx_gpio_irq_mask,
337+
.irq_unmask = ep93xx_gpio_irq_unmask,
338+
.irq_mask_ack = ep93xx_gpio_irq_mask_ack,
339+
.irq_set_type = ep93xx_gpio_irq_type,
340+
.irq_print_chip = ep93xx_irq_print_chip,
341+
.flags = IRQCHIP_IMMUTABLE,
342+
GPIOCHIP_IRQ_RESOURCE_HELPERS,
343+
};
344+
332345
static int ep93xx_gpio_add_bank(struct ep93xx_gpio_chip *egc,
333346
struct platform_device *pdev,
334347
struct ep93xx_gpio *epg,
@@ -350,21 +363,14 @@ static int ep93xx_gpio_add_bank(struct ep93xx_gpio_chip *egc,
350363

351364
girq = &gc->irq;
352365
if (bank->has_irq || bank->has_hierarchical_irq) {
353-
struct irq_chip *ic;
354-
355366
gc->set_config = ep93xx_gpio_set_config;
356367
egc->eic = devm_kcalloc(dev, 1,
357368
sizeof(*egc->eic),
358369
GFP_KERNEL);
359370
if (!egc->eic)
360371
return -ENOMEM;
361372
egc->eic->irq_offset = bank->irq;
362-
ic = &egc->eic->ic;
363-
ic->name = devm_kasprintf(dev, GFP_KERNEL, "gpio-irq-%s", bank->label);
364-
if (!ic->name)
365-
return -ENOMEM;
366-
ep93xx_init_irq_chip(dev, ic);
367-
girq->chip = ic;
373+
gpio_irq_chip_set_chip(girq, &gpio_eic_irq_chip);
368374
}
369375

370376
if (bank->has_irq) {

drivers/gpio/gpio-mxc.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -249,10 +249,11 @@ static void mxc_flip_edge(struct mxc_gpio_port *port, u32 gpio)
249249
} else {
250250
pr_err("mxc: invalid configuration for GPIO %d: %x\n",
251251
gpio, edge);
252-
return;
252+
goto unlock;
253253
}
254254
writel(val | (edge << (bit << 1)), reg);
255255

256+
unlock:
256257
raw_spin_unlock_irqrestore(&port->gc.bgpio_lock, flags);
257258
}
258259

drivers/gpio/gpiolib-acpi.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1104,7 +1104,8 @@ int acpi_dev_gpio_irq_wake_get_by(struct acpi_device *adev, const char *name, in
11041104
dev_dbg(&adev->dev, "IRQ %d already in use\n", irq);
11051105
}
11061106

1107-
if (wake_capable)
1107+
/* avoid suspend issues with GPIOs when systems are using S3 */
1108+
if (wake_capable && acpi_gbl_FADT.flags & ACPI_FADT_LOW_POWER_S0)
11081109
*wake_capable = info.wake_capable;
11091110

11101111
return irq;

tools/gpio/gpio-event-mon.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,7 @@ int monitor_device(const char *device_name,
8686
gpiotools_test_bit(values.bits, i));
8787
}
8888

89+
i = 0;
8990
while (1) {
9091
struct gpio_v2_line_event event;
9192

0 commit comments

Comments
 (0)