Skip to content

Commit be43eea

Browse files
Cixi GengBartosz Golaszewski
authored andcommitted
gpio: pmic-eic-sprd: Make the irqchip immutable
Remove the irq_chip from pmic_eic structure, use the various calls by defining the statically irq_chip structure. Signed-off-by: Cixi Geng <[email protected]> Reviewed-by: Baolin Wang <[email protected]> Signed-off-by: Bartosz Golaszewski <[email protected]>
1 parent 2788938 commit be43eea

File tree

1 file changed

+18
-11
lines changed

1 file changed

+18
-11
lines changed

drivers/gpio/gpio-pmic-eic-sprd.c

Lines changed: 18 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,6 @@ enum {
4747
/**
4848
* struct sprd_pmic_eic - PMIC EIC controller
4949
* @chip: the gpio_chip structure.
50-
* @intc: the irq_chip structure.
5150
* @map: the regmap from the parent device.
5251
* @offset: the EIC controller's offset address of the PMIC.
5352
* @reg: the array to cache the EIC registers.
@@ -56,7 +55,6 @@ enum {
5655
*/
5756
struct sprd_pmic_eic {
5857
struct gpio_chip chip;
59-
struct irq_chip intc;
6058
struct regmap *map;
6159
u32 offset;
6260
u8 reg[CACHE_NR_REGS];
@@ -151,15 +149,21 @@ static void sprd_pmic_eic_irq_mask(struct irq_data *data)
151149
{
152150
struct gpio_chip *chip = irq_data_get_irq_chip_data(data);
153151
struct sprd_pmic_eic *pmic_eic = gpiochip_get_data(chip);
152+
u32 offset = irqd_to_hwirq(data);
154153

155154
pmic_eic->reg[REG_IE] = 0;
156155
pmic_eic->reg[REG_TRIG] = 0;
156+
157+
gpiochip_disable_irq(chip, offset);
157158
}
158159

159160
static void sprd_pmic_eic_irq_unmask(struct irq_data *data)
160161
{
161162
struct gpio_chip *chip = irq_data_get_irq_chip_data(data);
162163
struct sprd_pmic_eic *pmic_eic = gpiochip_get_data(chip);
164+
u32 offset = irqd_to_hwirq(data);
165+
166+
gpiochip_enable_irq(chip, offset);
163167

164168
pmic_eic->reg[REG_IE] = 1;
165169
pmic_eic->reg[REG_TRIG] = 1;
@@ -292,6 +296,17 @@ static irqreturn_t sprd_pmic_eic_irq_handler(int irq, void *data)
292296
return IRQ_HANDLED;
293297
}
294298

299+
static const struct irq_chip pmic_eic_irq_chip = {
300+
.name = "sprd-pmic-eic",
301+
.irq_mask = sprd_pmic_eic_irq_mask,
302+
.irq_unmask = sprd_pmic_eic_irq_unmask,
303+
.irq_set_type = sprd_pmic_eic_irq_set_type,
304+
.irq_bus_lock = sprd_pmic_eic_bus_lock,
305+
.irq_bus_sync_unlock = sprd_pmic_eic_bus_sync_unlock,
306+
.flags = IRQCHIP_SKIP_SET_WAKE | IRQCHIP_IMMUTABLE,
307+
GPIOCHIP_IRQ_RESOURCE_HELPERS,
308+
};
309+
295310
static int sprd_pmic_eic_probe(struct platform_device *pdev)
296311
{
297312
struct gpio_irq_chip *irq;
@@ -338,16 +353,8 @@ static int sprd_pmic_eic_probe(struct platform_device *pdev)
338353
pmic_eic->chip.set = sprd_pmic_eic_set;
339354
pmic_eic->chip.get = sprd_pmic_eic_get;
340355

341-
pmic_eic->intc.name = dev_name(&pdev->dev);
342-
pmic_eic->intc.irq_mask = sprd_pmic_eic_irq_mask;
343-
pmic_eic->intc.irq_unmask = sprd_pmic_eic_irq_unmask;
344-
pmic_eic->intc.irq_set_type = sprd_pmic_eic_irq_set_type;
345-
pmic_eic->intc.irq_bus_lock = sprd_pmic_eic_bus_lock;
346-
pmic_eic->intc.irq_bus_sync_unlock = sprd_pmic_eic_bus_sync_unlock;
347-
pmic_eic->intc.flags = IRQCHIP_SKIP_SET_WAKE;
348-
349356
irq = &pmic_eic->chip.irq;
350-
irq->chip = &pmic_eic->intc;
357+
gpio_irq_chip_set_chip(irq, &pmic_eic_irq_chip);
351358
irq->threaded = true;
352359

353360
ret = devm_gpiochip_add_data(&pdev->dev, &pmic_eic->chip, pmic_eic);

0 commit comments

Comments
 (0)