Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp541411imm; Sat, 8 Sep 2018 04:10:50 -0700 (PDT) X-Google-Smtp-Source: ANB0VdZjgg1lTGzd37fzl7dbzkGqZdaVAVspuVy2ElSw2DYneRJazo77QDOV0nakXHNzZ34NwoBN X-Received: by 2002:a17:902:bcc6:: with SMTP id o6-v6mr12492572pls.117.1536405050319; Sat, 08 Sep 2018 04:10:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1536405050; cv=none; d=google.com; s=arc-20160816; b=vdNUzPLKlm6lbWwxbLB5xW2zydwRj5uGHD6JcN/SKg6HcUNL+h5Ss0NkiHqueWCDv8 7UKCjFB3StQS3JxOJXIhBZB1h4cK4rsyvZqjuuNfLTxeFfACLfkhj0iNKuN/2ms70UsE QSM5c76F1dj8g7LL2A0+MAfBRXV3c3EYFKQF4x55l9T4I3ehYW3baP08vbfvoCxx6AiC 4sfVNP99TkEi4rOmRWU4gbHZDNpe8TakNZbAkC7snnGDcJXaQnBXEwYMltXi/VycWXU6 6YJ5HlTKGUWnvk0VMx1leGal41Uhz2tX/T8TDupmcoHy95v3/BRleSEPYTQuaTK4q/nV zE0Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from; bh=y60KeJWce+yZPQAuT+Lr8/gctxl6hDUnHS0+yV3Jtxg=; b=ZBMWaOyvtgoUZZSMDmyBQdyw4rkfGS/N1qBkohizgVIpQc3JBS8hcs3pvqJWH2h5jW VwGm+r+SBR3jZU4K/t8h3CvXsQ2TluoNaY4kKxowBBgDiSNnaa5YtNkjeNUzVLqh/l83 fKS5nG6JP7AJDzGBnICKaZgJSPGPGsTideXwuGjYTifA/fSWbjmwjN8B3sZWmB4SH2QD Hg7+FGC23fvgSRjJ9iwlSjxGUhv+iFEMnVzRGI64R1jIVE8BpE2RsAAG93d192CqVq3Y kvTrNhlh6kkofYvi1W+uF1O5LJKhor23fdlUS2RRHM8gzloRP9RRDsfd9vtjGDE1NiPI wTHQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id z22-v6si10263466pgv.323.2018.09.08.04.10.35; Sat, 08 Sep 2018 04:10:50 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726984AbeIHPxV (ORCPT + 99 others); Sat, 8 Sep 2018 11:53:21 -0400 Received: from mailgw02.mediatek.com ([210.61.82.184]:38749 "EHLO mailgw02.mediatek.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1726796AbeIHPxU (ORCPT ); Sat, 8 Sep 2018 11:53:20 -0400 X-UUID: 39da40fc9e774d5a9c986a6569122268-20180908 Received: from mtkcas07.mediatek.inc [(172.21.101.84)] by mailgw02.mediatek.com (envelope-from ) (mhqrelay.mediatek.com ESMTP with TLS) with ESMTP id 808543917; Sat, 08 Sep 2018 19:07:44 +0800 Received: from mtkcas09.mediatek.inc (172.21.101.178) by mtkmbs08n1.mediatek.inc (172.21.101.55) with Microsoft SMTP Server (TLS) id 15.0.1210.3; Sat, 8 Sep 2018 19:07:43 +0800 Received: from mtkswgap22.mediatek.inc (172.21.77.33) by mtkcas09.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.0.1210.3 via Frontend Transport; Sat, 8 Sep 2018 19:07:43 +0800 From: To: , CC: , , , Sean Wang Subject: [PATCH v2 22/22] pinctrl: mediatek: add eint support to MT8183 pinctrl driver Date: Sat, 8 Sep 2018 19:07:38 +0800 Message-ID: <17745498577a9d4492deee861d71a135de5b8473.1536404280.git.sean.wang@mediatek.com> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: References: MIME-Version: 1.0 Content-Type: text/plain X-MTK: N Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Sean Wang Just add eint support to MT8183 pinctrl driver as usual as happens on the other SoCs. Signed-off-by: Sean Wang --- drivers/pinctrl/mediatek/pinctrl-mt8183.c | 8 ++++++++ drivers/pinctrl/mediatek/pinctrl-paris.c | 22 ++++++++++++++++++++++ 2 files changed, 30 insertions(+) diff --git a/drivers/pinctrl/mediatek/pinctrl-mt8183.c b/drivers/pinctrl/mediatek/pinctrl-mt8183.c index 9d5aa27..6262fd3 100644 --- a/drivers/pinctrl/mediatek/pinctrl-mt8183.c +++ b/drivers/pinctrl/mediatek/pinctrl-mt8183.c @@ -492,11 +492,19 @@ static const char * const mt8183_pinctrl_register_base_names[] = { "iocfg6", "iocfg7", "iocfg8", }; +static const struct mtk_eint_hw mt8183_eint_hw = { + .port_mask = 7, + .ports = 6, + .ap_num = 212, + .db_cnt = 13, +}; + static const struct mtk_pin_soc mt8183_data = { .reg_cal = mt8183_reg_cals, .pins = mtk_pins_mt8183, .npins = ARRAY_SIZE(mtk_pins_mt8183), .ngrps = ARRAY_SIZE(mtk_pins_mt8183), + .eint_hw = &mt8183_eint_hw, .gpio_m = 0, .ies_present = true, .base_names = mt8183_pinctrl_register_base_names, diff --git a/drivers/pinctrl/mediatek/pinctrl-paris.c b/drivers/pinctrl/mediatek/pinctrl-paris.c index 50d6893..9f4224f 100644 --- a/drivers/pinctrl/mediatek/pinctrl-paris.c +++ b/drivers/pinctrl/mediatek/pinctrl-paris.c @@ -718,6 +718,22 @@ static int mtk_gpio_direction_output(struct gpio_chip *chip, unsigned int gpio, return pinctrl_gpio_direction_output(chip->base + gpio); } +static int mtk_gpio_to_irq(struct gpio_chip *chip, unsigned int offset) +{ + struct mtk_pinctrl *hw = gpiochip_get_data(chip); + const struct mtk_pin_desc *desc; + + if (!hw->eint) + return -ENOTSUPP; + + desc = (const struct mtk_pin_desc *)&hw->soc->pins[offset]; + + if (desc->eint.eint_n == EINT_NA) + return -ENOTSUPP; + + return mtk_eint_find_irq(hw->eint, desc->eint.eint_n); +} + static int mtk_gpio_set_config(struct gpio_chip *chip, unsigned int offset, unsigned long config) { @@ -751,6 +767,7 @@ static int mtk_build_gpiochip(struct mtk_pinctrl *hw, struct device_node *np) chip->direction_output = mtk_gpio_direction_output; chip->get = mtk_gpio_get; chip->set = mtk_gpio_set; + chip->to_irq = mtk_gpio_to_irq, chip->set_config = mtk_gpio_set_config, chip->base = -1; chip->ngpio = hw->soc->npins; @@ -871,6 +888,11 @@ int mtk_paris_pinctrl_probe(struct platform_device *pdev, if (err) return err; + err = mtk_build_eint(hw, pdev); + if (err) + dev_warn(&pdev->dev, + "Failed to add EINT, but pinctrl still can work\n"); + /* Build gpiochip should be after pinctrl_enable is done */ err = mtk_build_gpiochip(hw, pdev->dev.of_node); if (err) { -- 2.7.4