Skip to content

Commit be6692b

Browse files
Qianggui SongMarc Zyngier
authored andcommitted
irqchip/meson-gpio: add select trigger type callback
Due to some chips may use different registers and offset, provide a set trigger type call back and add one for old controller. Signed-off-by: Qianggui Song <qianggui.song@amlogic.com> Signed-off-by: Marc Zyngier <maz@kernel.org> Link: https://lore.kernel.org/r/20220225055207.1048-4-qianggui.song@amlogic.com
1 parent cc31107 commit be6692b

1 file changed

Lines changed: 13 additions & 7 deletions

File tree

drivers/irqchip/irq-meson-gpio.c

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -51,11 +51,15 @@ static void meson_a1_gpio_irq_sel_pin(struct meson_gpio_irq_controller *ctl,
5151
unsigned int channel,
5252
unsigned long hwirq);
5353
static void meson_a1_gpio_irq_init(struct meson_gpio_irq_controller *ctl);
54+
static int meson8_gpio_irq_set_type(struct meson_gpio_irq_controller *ctl,
55+
unsigned int type, u32 *channel_hwirq);
5456

5557
struct irq_ctl_ops {
5658
void (*gpio_irq_sel_pin)(struct meson_gpio_irq_controller *ctl,
5759
unsigned int channel, unsigned long hwirq);
5860
void (*gpio_irq_init)(struct meson_gpio_irq_controller *ctl);
61+
int (*gpio_irq_set_type)(struct meson_gpio_irq_controller *ctl,
62+
unsigned int type, u32 *channel_hwirq);
5963
};
6064

6165
struct meson_gpio_irq_params {
@@ -69,24 +73,27 @@ struct meson_gpio_irq_params {
6973
struct irq_ctl_ops ops;
7074
};
7175

72-
#define INIT_MESON_COMMON(irqs, init, sel) \
76+
#define INIT_MESON_COMMON(irqs, init, sel, type) \
7377
.nr_hwirq = irqs, \
7478
.ops = { \
7579
.gpio_irq_init = init, \
7680
.gpio_irq_sel_pin = sel, \
81+
.gpio_irq_set_type = type, \
7782
},
7883

7984
#define INIT_MESON8_COMMON_DATA(irqs) \
8085
INIT_MESON_COMMON(irqs, meson_gpio_irq_init_dummy, \
81-
meson8_gpio_irq_sel_pin) \
86+
meson8_gpio_irq_sel_pin, \
87+
meson8_gpio_irq_set_type) \
8288
.edge_single_offset = 0, \
8389
.pol_low_offset = 16, \
8490
.pin_sel_mask = 0xff, \
8591
.nr_channels = 8, \
8692

8793
#define INIT_MESON_A1_COMMON_DATA(irqs) \
8894
INIT_MESON_COMMON(irqs, meson_a1_gpio_irq_init, \
89-
meson_a1_gpio_irq_sel_pin) \
95+
meson_a1_gpio_irq_sel_pin, \
96+
meson8_gpio_irq_set_type) \
9097
.support_edge_both = true, \
9198
.edge_both_offset = 16, \
9299
.edge_single_offset = 8, \
@@ -259,9 +266,8 @@ meson_gpio_irq_release_channel(struct meson_gpio_irq_controller *ctl,
259266
clear_bit(idx, ctl->channel_map);
260267
}
261268

262-
static int meson_gpio_irq_type_setup(struct meson_gpio_irq_controller *ctl,
263-
unsigned int type,
264-
u32 *channel_hwirq)
269+
static int meson8_gpio_irq_set_type(struct meson_gpio_irq_controller *ctl,
270+
unsigned int type, u32 *channel_hwirq)
265271
{
266272
u32 val = 0;
267273
unsigned int idx;
@@ -326,7 +332,7 @@ static int meson_gpio_irq_set_type(struct irq_data *data, unsigned int type)
326332
u32 *channel_hwirq = irq_data_get_irq_chip_data(data);
327333
int ret;
328334

329-
ret = meson_gpio_irq_type_setup(ctl, type, channel_hwirq);
335+
ret = ctl->params->ops.gpio_irq_set_type(ctl, type, channel_hwirq);
330336
if (ret)
331337
return ret;
332338

0 commit comments

Comments
 (0)