From: Marc Zyngier <maz@kernel.org>
To: Qianggui Song <qianggui.song@amlogic.com>
Cc: Thomas Gleixner <tglx@linutronix.de>,
Kevin Hilman <khilman@baylibre.com>,
Neil Armstrong <narmstrong@baylibre.com>,
Jerome Brunet <jbrunet@baylibre.com>,
Martin Blumenstingl <martin.blumenstingl@googlemail.com>,
<linux-kernel@vger.kernel.org>,
<linux-arm-kernel@lists.infradead.org>,
<linux-amlogic@lists.infradead.org>
Subject: Re: [PATCH 3/4] irqchip/meson-gpio: add select trigger type callback
Date: Sat, 08 Jan 2022 10:44:59 +0000 [thread overview]
Message-ID: <87sftytsk4.wl-maz@kernel.org> (raw)
In-Reply-To: <20220108084218.31877-4-qianggui.song@amlogic.com>
On Sat, 08 Jan 2022 08:42:17 +0000,
Qianggui Song <qianggui.song@amlogic.com> wrote:
>
> Due to some chips may use different registers and offset, provide
> a set trigger type call back.
>
> Signed-off-by: Qianggui Song <qianggui.song@amlogic.com>
> ---
> drivers/irqchip/irq-meson-gpio.c | 13 ++++++++++---
> 1 file changed, 10 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/irqchip/irq-meson-gpio.c b/drivers/irqchip/irq-meson-gpio.c
> index 6a7b4fb13452..98419428fcbd 100644
> --- a/drivers/irqchip/irq-meson-gpio.c
> +++ b/drivers/irqchip/irq-meson-gpio.c
> @@ -55,6 +55,8 @@ struct irq_ctl_ops {
> void (*gpio_irq_sel_pin)(struct meson_gpio_irq_controller *ctl,
> unsigned int channel, unsigned long hwirq);
> void (*gpio_irq_init)(struct meson_gpio_irq_controller *ctl);
> + unsigned int (*gpio_irq_sel_type)(struct meson_gpio_irq_controller *ctl,
> + unsigned int idx, u32 val);
> };
>
> struct meson_gpio_irq_params {
> @@ -68,16 +70,17 @@ struct meson_gpio_irq_params {
> struct irq_ctl_ops ops;
> };
>
> -#define INIT_MESON_COMMON(irqs, init, sel) \
> +#define INIT_MESON_COMMON(irqs, init, sel, type) \
> .nr_hwirq = irqs, \
> .ops = { \
> .gpio_irq_init = init, \
> .gpio_irq_sel_pin = sel, \
> + .gpio_irq_sel_type = type, \
> },
>
> #define INIT_MESON8_COMMON_DATA(irqs) \
> INIT_MESON_COMMON(irqs, meson_gpio_irq_init_dummy, \
> - meson8_gpio_irq_sel_pin) \
> + meson8_gpio_irq_sel_pin, NULL) \
> .edge_single_offset = 0, \
> .pol_low_offset = 16, \
> .pin_sel_mask = 0xff, \
> @@ -85,7 +88,7 @@ struct meson_gpio_irq_params {
>
> #define INIT_MESON_A1_COMMON_DATA(irqs) \
> INIT_MESON_COMMON(irqs, meson_a1_gpio_irq_init, \
> - meson_a1_gpio_irq_sel_pin) \
> + meson_a1_gpio_irq_sel_pin, NULL) \
> .support_edge_both = true, \
> .edge_both_offset = 16, \
> .edge_single_offset = 8, \
> @@ -279,6 +282,10 @@ static int meson_gpio_irq_type_setup(struct meson_gpio_irq_controller *ctl,
> */
> type &= IRQ_TYPE_SENSE_MASK;
>
> + /* Some controllers may have different calculation method*/
> + if (params->ops.gpio_irq_sel_type)
> + return params->ops.gpio_irq_sel_type(ctl, idx, type);
> +
No. If you are going to indirect these things, indirect them for all
implementations and keep the code clean.
M.
--
Without deviation from the norm, progress is not possible.
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
next prev parent reply other threads:[~2022-01-08 10:46 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-01-08 8:42 [PATCH 0/4] irqchip/meson-gpio: Add support for Meson-S4 SoC Qianggui Song
2022-01-08 8:42 ` [PATCH 1/4] dt-bindings: interrupt-controller: New binding for Meson-S4 SoCs Qianggui Song
2022-01-09 15:27 ` Christian Hewitt
2022-01-10 12:33 ` qianggui.song
2022-01-08 8:42 ` [PATCH 2/4] irqchip/meson-gpio: support more than 8 channels gpio irq line Qianggui Song
2022-01-08 10:37 ` Marc Zyngier
2022-01-10 12:27 ` qianggui.song
2022-01-08 8:42 ` [PATCH 3/4] irqchip/meson-gpio: add select trigger type callback Qianggui Song
2022-01-08 10:44 ` Marc Zyngier [this message]
2022-01-10 12:28 ` qianggui.song
2022-01-08 8:42 ` [PATCH 4/4] irqchip/meson-gpio: Add support for meson s4 SoCs Qianggui Song
2022-01-08 11:06 ` Marc Zyngier
2022-01-10 12:32 ` qianggui.song
2022-01-10 14:54 ` Marc Zyngier
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87sftytsk4.wl-maz@kernel.org \
--to=maz@kernel.org \
--cc=jbrunet@baylibre.com \
--cc=khilman@baylibre.com \
--cc=linux-amlogic@lists.infradead.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=martin.blumenstingl@googlemail.com \
--cc=narmstrong@baylibre.com \
--cc=qianggui.song@amlogic.com \
--cc=tglx@linutronix.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).