Received: by 2002:a05:6a10:9afc:0:0:0:0 with SMTP id t28csp2379688pxm; Fri, 25 Feb 2022 00:23:13 -0800 (PST) X-Google-Smtp-Source: ABdhPJx9EOlAHdXng93iK8Zouf1XaRdP7hqPK6gZgDbSRzPCNTR7HjE1pPmP6n5wO6Ozo7GN8Obw X-Received: by 2002:a63:d63:0:b0:36c:670d:b6c9 with SMTP id 35-20020a630d63000000b0036c670db6c9mr5218628pgn.343.1645777392986; Fri, 25 Feb 2022 00:23:12 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1645777392; cv=none; d=google.com; s=arc-20160816; b=e0Li0YD6p2gfgGvKd55aMbJNEAd8gbIqyuucS8CixiEelcrIKA+ezFbJPz0n0qmwJy sWsB6OT+iTxqgRqBlSZljp4kThtX1aGWUHToSJdwrDKG6GJPVWg+cmrag3i5thwZ4qAN Q+SOXTxBojao1/dg/tv0CGhR/SN1pTR8vivR3+EF3LsYQls2fbvgsJPPuvkAmBLkqmeR eSEpmCSZKAuYx+l71tNJl1vGV8fKQ/6Ab/VICxHlqvQoDgOggj+DyWIIpGVArs4Cc9e2 1rqU0EXm+yXLD33zc/IAPh8+jsWl+9ooZy8XsqRMEN7Lygkv1O0DU2sVETP5QcEsuQ9+ DV1A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=mic2b/7AJr1Z3/nEnmD5WJ8BpnJWoq+QYITXg8+nP1Q=; b=zSgUFN1zQKTk/H0l5+1+Li5EuR4RCZiV8XOWFD+sBZJt0exegEnwsVb8bFblOwWipG 70ca3LF80IB/RqjZ2MpoQviyxuQm5189krOVqONTTuLWWbbyq1jR/rh/8ObGHPcvIgZ8 yZ3IeVhcZLInGz5Lqa4qQPm1nhnMYl1VR0Bg+WKl0hD8ss9/7mV9IyGJqdQ9sNzp+rJj jLk66IkprZpON3lCQn2PddG20Gq7Pa5dmzwwcD8df8OMsYDLc5uj5FAiKCjEU/l2tVsB 1w+k3WH7Ldtwe/VBN453R5vmh2xNWinG52uyt6MLow+AuBmetq6s7VM5yzZtFCY+YqUq SLFg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id z14-20020a170902ccce00b0014fe6cc9916si1375820ple.206.2022.02.25.00.22.57; Fri, 25 Feb 2022 00:23:12 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237750AbiBYGID (ORCPT + 99 others); Fri, 25 Feb 2022 01:08:03 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47352 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237766AbiBYGHz (ORCPT ); Fri, 25 Feb 2022 01:07:55 -0500 Received: from mail-sz.amlogic.com (mail-sz.amlogic.com [211.162.65.117]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4620112B775 for ; Thu, 24 Feb 2022 22:07:22 -0800 (PST) Received: from droid09-sz.software.amlogic (10.28.8.19) by mail-sz.amlogic.com (10.28.11.5) with Microsoft SMTP Server id 15.1.2176.2; Fri, 25 Feb 2022 13:52:09 +0800 From: Qianggui Song To: Thomas Gleixner , Marc Zyngier CC: Qianggui Song , Kevin Hilman , Neil Armstrong , Jerome Brunet , Martin Blumenstingl , , , Subject: [PATCH v3 3/4] irqchip/meson-gpio: add select trigger type callback Date: Fri, 25 Feb 2022 13:52:05 +0800 Message-ID: <20220225055207.1048-4-qianggui.song@amlogic.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220225055207.1048-1-qianggui.song@amlogic.com> References: <20220225055207.1048-1-qianggui.song@amlogic.com> MIME-Version: 1.0 Content-Transfer-Encoding: 7BIT Content-Type: text/plain; charset=US-ASCII X-Originating-IP: [10.28.8.19] X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 --- drivers/irqchip/irq-meson-gpio.c | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/drivers/irqchip/irq-meson-gpio.c b/drivers/irqchip/irq-meson-gpio.c index 63841e1578f5..7b5863e36816 100644 --- a/drivers/irqchip/irq-meson-gpio.c +++ b/drivers/irqchip/irq-meson-gpio.c @@ -51,11 +51,15 @@ static void meson_a1_gpio_irq_sel_pin(struct meson_gpio_irq_controller *ctl, unsigned int channel, unsigned long hwirq); static void meson_a1_gpio_irq_init(struct meson_gpio_irq_controller *ctl); +static int meson8_gpio_irq_set_type(struct meson_gpio_irq_controller *ctl, + unsigned int type, u32 *channel_hwirq); 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); + int (*gpio_irq_set_type)(struct meson_gpio_irq_controller *ctl, + unsigned int type, u32 *channel_hwirq); }; struct meson_gpio_irq_params { @@ -69,16 +73,18 @@ 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_set_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, \ + meson8_gpio_irq_set_type) \ .edge_single_offset = 0, \ .pol_low_offset = 16, \ .pin_sel_mask = 0xff, \ @@ -86,7 +92,8 @@ 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, \ + meson8_gpio_irq_set_type) \ .support_edge_both = true, \ .edge_both_offset = 16, \ .edge_single_offset = 8, \ @@ -259,9 +266,8 @@ meson_gpio_irq_release_channel(struct meson_gpio_irq_controller *ctl, clear_bit(idx, ctl->channel_map); } -static int meson_gpio_irq_type_setup(struct meson_gpio_irq_controller *ctl, - unsigned int type, - u32 *channel_hwirq) +static int meson8_gpio_irq_set_type(struct meson_gpio_irq_controller *ctl, + unsigned int type, u32 *channel_hwirq) { u32 val = 0; unsigned int idx; @@ -326,7 +332,7 @@ static int meson_gpio_irq_set_type(struct irq_data *data, unsigned int type) u32 *channel_hwirq = irq_data_get_irq_chip_data(data); int ret; - ret = meson_gpio_irq_type_setup(ctl, type, channel_hwirq); + ret = ctl->params->ops.gpio_irq_set_type(ctl, type, channel_hwirq); if (ret) return ret; -- 2.34.1