mirror of
https://github.com/torvalds/linux.git
synced 2024-11-15 08:31:55 +00:00
pinctrl: qcom spmi-mpp: Convert to immutable irq_chip
Convert the driver to immutable irq-chip with a bit of intuition. Signed-off-by: Linus Walleij <linus.walleij@linaro.org> Link: https://lore.kernel.org/r/20230414-immutable-irqchips-2-v1-4-6b59a5186b00@linaro.org
This commit is contained in:
parent
35d008679a
commit
9890a043b3
@ -143,7 +143,6 @@ struct pmic_mpp_state {
|
||||
struct regmap *map;
|
||||
struct pinctrl_dev *ctrl;
|
||||
struct gpio_chip chip;
|
||||
struct irq_chip irq;
|
||||
};
|
||||
|
||||
static const struct pinconf_generic_params pmic_mpp_bindings[] = {
|
||||
@ -823,6 +822,33 @@ static int pmic_mpp_child_to_parent_hwirq(struct gpio_chip *chip,
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void pmic_mpp_irq_mask(struct irq_data *d)
|
||||
{
|
||||
struct gpio_chip *gc = irq_data_get_irq_chip_data(d);
|
||||
|
||||
irq_chip_mask_parent(d);
|
||||
gpiochip_disable_irq(gc, irqd_to_hwirq(d));
|
||||
}
|
||||
|
||||
static void pmic_mpp_irq_unmask(struct irq_data *d)
|
||||
{
|
||||
struct gpio_chip *gc = irq_data_get_irq_chip_data(d);
|
||||
|
||||
gpiochip_enable_irq(gc, irqd_to_hwirq(d));
|
||||
irq_chip_unmask_parent(d);
|
||||
}
|
||||
|
||||
static const struct irq_chip pmic_mpp_irq_chip = {
|
||||
.name = "spmi-mpp",
|
||||
.irq_ack = irq_chip_ack_parent,
|
||||
.irq_mask = pmic_mpp_irq_mask,
|
||||
.irq_unmask = pmic_mpp_irq_unmask,
|
||||
.irq_set_type = irq_chip_set_type_parent,
|
||||
.irq_set_wake = irq_chip_set_wake_parent,
|
||||
.flags = IRQCHIP_MASK_ON_SUSPEND | IRQCHIP_IMMUTABLE,
|
||||
GPIOCHIP_IRQ_RESOURCE_HELPERS,
|
||||
};
|
||||
|
||||
static int pmic_mpp_probe(struct platform_device *pdev)
|
||||
{
|
||||
struct irq_domain *parent_domain;
|
||||
@ -915,16 +941,8 @@ static int pmic_mpp_probe(struct platform_device *pdev)
|
||||
if (!parent_domain)
|
||||
return -ENXIO;
|
||||
|
||||
state->irq.name = "spmi-mpp",
|
||||
state->irq.irq_ack = irq_chip_ack_parent,
|
||||
state->irq.irq_mask = irq_chip_mask_parent,
|
||||
state->irq.irq_unmask = irq_chip_unmask_parent,
|
||||
state->irq.irq_set_type = irq_chip_set_type_parent,
|
||||
state->irq.irq_set_wake = irq_chip_set_wake_parent,
|
||||
state->irq.flags = IRQCHIP_MASK_ON_SUSPEND,
|
||||
|
||||
girq = &state->chip.irq;
|
||||
girq->chip = &state->irq;
|
||||
gpio_irq_chip_set_chip(girq, &pmic_mpp_irq_chip);
|
||||
girq->default_type = IRQ_TYPE_NONE;
|
||||
girq->handler = handle_level_irq;
|
||||
girq->fwnode = dev_fwnode(state->dev);
|
||||
|
Loading…
Reference in New Issue
Block a user