Skip to content

Commit a335366

Browse files
committed
Merge tag 'gpio-fixes-for-v6.0-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/brgl/linux
Pull gpio fixes from Bartosz Golaszewski: - fix the level-low interrupt type support in gpio-mpc8xxx - convert another two drivers to using immutable irq chips - MAINTAINERS update * tag 'gpio-fixes-for-v6.0-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/brgl/linux: gpio: mt7621: Make the irqchip immutable gpio: ixp4xx: Make irqchip immutable MAINTAINERS: Update HiSilicon GPIO Driver maintainer gpio: mpc8xxx: Fix support for IRQ_TYPE_LEVEL_LOW flow_type in mpc85xx
2 parents 6879c2d + 09eed5a commit a335366

File tree

4 files changed

+31
-10
lines changed

4 files changed

+31
-10
lines changed

MAINTAINERS

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9122,7 +9122,7 @@ S: Maintained
91229122
F: drivers/dma/hisi_dma.c
91239123

91249124
HISILICON GPIO DRIVER
9125-
M: Luo Jiaxing <luojiaxing@huawei.com>
9125+
M: Jay Fang <f.fangjian@huawei.com>
91269126
91279127
S: Maintained
91289128
F: drivers/gpio/gpio-hisi.c

drivers/gpio/gpio-ixp4xx.c

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,14 @@ static void ixp4xx_gpio_irq_ack(struct irq_data *d)
6363
__raw_writel(BIT(d->hwirq), g->base + IXP4XX_REG_GPIS);
6464
}
6565

66+
static void ixp4xx_gpio_mask_irq(struct irq_data *d)
67+
{
68+
struct gpio_chip *gc = irq_data_get_irq_chip_data(d);
69+
70+
irq_chip_mask_parent(d);
71+
gpiochip_disable_irq(gc, d->hwirq);
72+
}
73+
6674
static void ixp4xx_gpio_irq_unmask(struct irq_data *d)
6775
{
6876
struct gpio_chip *gc = irq_data_get_irq_chip_data(d);
@@ -72,6 +80,7 @@ static void ixp4xx_gpio_irq_unmask(struct irq_data *d)
7280
if (!(g->irq_edge & BIT(d->hwirq)))
7381
ixp4xx_gpio_irq_ack(d);
7482

83+
gpiochip_enable_irq(gc, d->hwirq);
7584
irq_chip_unmask_parent(d);
7685
}
7786

@@ -149,12 +158,14 @@ static int ixp4xx_gpio_irq_set_type(struct irq_data *d, unsigned int type)
149158
return irq_chip_set_type_parent(d, IRQ_TYPE_LEVEL_HIGH);
150159
}
151160

152-
static struct irq_chip ixp4xx_gpio_irqchip = {
161+
static const struct irq_chip ixp4xx_gpio_irqchip = {
153162
.name = "IXP4GPIO",
154163
.irq_ack = ixp4xx_gpio_irq_ack,
155-
.irq_mask = irq_chip_mask_parent,
164+
.irq_mask = ixp4xx_gpio_mask_irq,
156165
.irq_unmask = ixp4xx_gpio_irq_unmask,
157166
.irq_set_type = ixp4xx_gpio_irq_set_type,
167+
.flags = IRQCHIP_IMMUTABLE,
168+
GPIOCHIP_IRQ_RESOURCE_HELPERS,
158169
};
159170

160171
static int ixp4xx_gpio_child_to_parent_hwirq(struct gpio_chip *gc,
@@ -263,7 +274,7 @@ static int ixp4xx_gpio_probe(struct platform_device *pdev)
263274
g->gc.owner = THIS_MODULE;
264275

265276
girq = &g->gc.irq;
266-
girq->chip = &ixp4xx_gpio_irqchip;
277+
gpio_irq_chip_set_chip(girq, &ixp4xx_gpio_irqchip);
267278
girq->fwnode = g->fwnode;
268279
girq->parent_domain = parent;
269280
girq->child_to_parent_hwirq = ixp4xx_gpio_child_to_parent_hwirq;

drivers/gpio/gpio-mpc8xxx.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -169,6 +169,7 @@ static int mpc8xxx_irq_set_type(struct irq_data *d, unsigned int flow_type)
169169

170170
switch (flow_type) {
171171
case IRQ_TYPE_EDGE_FALLING:
172+
case IRQ_TYPE_LEVEL_LOW:
172173
raw_spin_lock_irqsave(&mpc8xxx_gc->lock, flags);
173174
gc->write_reg(mpc8xxx_gc->regs + GPIO_ICR,
174175
gc->read_reg(mpc8xxx_gc->regs + GPIO_ICR)

drivers/gpio/gpio-mt7621.c

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,8 @@ mediatek_gpio_irq_unmask(struct irq_data *d)
112112
unsigned long flags;
113113
u32 rise, fall, high, low;
114114

115+
gpiochip_enable_irq(gc, d->hwirq);
116+
115117
spin_lock_irqsave(&rg->lock, flags);
116118
rise = mtk_gpio_r32(rg, GPIO_REG_REDGE);
117119
fall = mtk_gpio_r32(rg, GPIO_REG_FEDGE);
@@ -143,6 +145,8 @@ mediatek_gpio_irq_mask(struct irq_data *d)
143145
mtk_gpio_w32(rg, GPIO_REG_HLVL, high & ~BIT(pin));
144146
mtk_gpio_w32(rg, GPIO_REG_LLVL, low & ~BIT(pin));
145147
spin_unlock_irqrestore(&rg->lock, flags);
148+
149+
gpiochip_disable_irq(gc, d->hwirq);
146150
}
147151

148152
static int
@@ -204,6 +208,16 @@ mediatek_gpio_xlate(struct gpio_chip *chip,
204208
return gpio % MTK_BANK_WIDTH;
205209
}
206210

211+
static const struct irq_chip mt7621_irq_chip = {
212+
.name = "mt7621-gpio",
213+
.irq_mask_ack = mediatek_gpio_irq_mask,
214+
.irq_mask = mediatek_gpio_irq_mask,
215+
.irq_unmask = mediatek_gpio_irq_unmask,
216+
.irq_set_type = mediatek_gpio_irq_type,
217+
.flags = IRQCHIP_IMMUTABLE,
218+
GPIOCHIP_IRQ_RESOURCE_HELPERS,
219+
};
220+
207221
static int
208222
mediatek_gpio_bank_probe(struct device *dev, int bank)
209223
{
@@ -238,11 +252,6 @@ mediatek_gpio_bank_probe(struct device *dev, int bank)
238252
return -ENOMEM;
239253

240254
rg->chip.offset = bank * MTK_BANK_WIDTH;
241-
rg->irq_chip.name = dev_name(dev);
242-
rg->irq_chip.irq_unmask = mediatek_gpio_irq_unmask;
243-
rg->irq_chip.irq_mask = mediatek_gpio_irq_mask;
244-
rg->irq_chip.irq_mask_ack = mediatek_gpio_irq_mask;
245-
rg->irq_chip.irq_set_type = mediatek_gpio_irq_type;
246255

247256
if (mtk->gpio_irq) {
248257
struct gpio_irq_chip *girq;
@@ -262,7 +271,7 @@ mediatek_gpio_bank_probe(struct device *dev, int bank)
262271
}
263272

264273
girq = &rg->chip.irq;
265-
girq->chip = &rg->irq_chip;
274+
gpio_irq_chip_set_chip(girq, &mt7621_irq_chip);
266275
/* This will let us handle the parent IRQ in the driver */
267276
girq->parent_handler = NULL;
268277
girq->num_parents = 0;

0 commit comments

Comments
 (0)