gpio: 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 <cixi.geng1@unisoc.com>
Reviewed-by: Baolin Wang <baolin.wang@linux.alibaba.com>
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
This commit is contained in:
Cixi Geng 2022-12-29 22:55:43 +08:00 committed by Bartosz Golaszewski
parent 90fee3dd5b
commit 2788938b79

View File

@ -91,7 +91,6 @@ enum sprd_eic_type {
struct sprd_eic { struct sprd_eic {
struct gpio_chip chip; struct gpio_chip chip;
struct irq_chip intc;
void __iomem *base[SPRD_EIC_MAX_BANK]; void __iomem *base[SPRD_EIC_MAX_BANK];
enum sprd_eic_type type; enum sprd_eic_type type;
spinlock_t lock; spinlock_t lock;
@ -255,6 +254,8 @@ static void sprd_eic_irq_mask(struct irq_data *data)
default: default:
dev_err(chip->parent, "Unsupported EIC type.\n"); dev_err(chip->parent, "Unsupported EIC type.\n");
} }
gpiochip_disable_irq(chip, offset);
} }
static void sprd_eic_irq_unmask(struct irq_data *data) static void sprd_eic_irq_unmask(struct irq_data *data)
@ -263,6 +264,8 @@ static void sprd_eic_irq_unmask(struct irq_data *data)
struct sprd_eic *sprd_eic = gpiochip_get_data(chip); struct sprd_eic *sprd_eic = gpiochip_get_data(chip);
u32 offset = irqd_to_hwirq(data); u32 offset = irqd_to_hwirq(data);
gpiochip_enable_irq(chip, offset);
switch (sprd_eic->type) { switch (sprd_eic->type) {
case SPRD_EIC_DEBOUNCE: case SPRD_EIC_DEBOUNCE:
sprd_eic_update(chip, offset, SPRD_EIC_DBNC_IE, 1); sprd_eic_update(chip, offset, SPRD_EIC_DBNC_IE, 1);
@ -564,6 +567,15 @@ static void sprd_eic_irq_handler(struct irq_desc *desc)
chained_irq_exit(ic, desc); chained_irq_exit(ic, desc);
} }
static const struct irq_chip sprd_eic_irq = {
.name = "sprd-eic",
.irq_ack = sprd_eic_irq_ack,
.irq_mask = sprd_eic_irq_mask,
.irq_unmask = sprd_eic_irq_unmask,
.irq_set_type = sprd_eic_irq_set_type,
.flags = IRQCHIP_SKIP_SET_WAKE | IRQCHIP_IMMUTABLE,
GPIOCHIP_IRQ_RESOURCE_HELPERS,
};
static int sprd_eic_probe(struct platform_device *pdev) static int sprd_eic_probe(struct platform_device *pdev)
{ {
const struct sprd_eic_variant_data *pdata; const struct sprd_eic_variant_data *pdata;
@ -626,15 +638,8 @@ static int sprd_eic_probe(struct platform_device *pdev)
break; break;
} }
sprd_eic->intc.name = dev_name(&pdev->dev);
sprd_eic->intc.irq_ack = sprd_eic_irq_ack;
sprd_eic->intc.irq_mask = sprd_eic_irq_mask;
sprd_eic->intc.irq_unmask = sprd_eic_irq_unmask;
sprd_eic->intc.irq_set_type = sprd_eic_irq_set_type;
sprd_eic->intc.flags = IRQCHIP_SKIP_SET_WAKE;
irq = &sprd_eic->chip.irq; irq = &sprd_eic->chip.irq;
irq->chip = &sprd_eic->intc; gpio_irq_chip_set_chip(irq, &sprd_eic_irq);
irq->handler = handle_bad_irq; irq->handler = handle_bad_irq;
irq->default_type = IRQ_TYPE_NONE; irq->default_type = IRQ_TYPE_NONE;
irq->parent_handler = sprd_eic_irq_handler; irq->parent_handler = sprd_eic_irq_handler;