Received: by 2002:a25:e7d8:0:0:0:0:0 with SMTP id e207csp1923693ybh; Sun, 15 Mar 2020 14:36:13 -0700 (PDT) X-Google-Smtp-Source: ADFU+vvbtqIQJcC/B4YOK0P0iJMFhSqenLFmj0CvvkvEq3mZUWkODuW/1JyL+UGwdc3X7G4Wj78d X-Received: by 2002:a9d:2215:: with SMTP id o21mr19426115ota.113.1584308173445; Sun, 15 Mar 2020 14:36:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1584308173; cv=none; d=google.com; s=arc-20160816; b=jWSlNJtoPikkNficmTXzLuuLhkwq3Rtzl46zCQdhysxbFw2VmzmGy+r0/uUAAht1Sv Pd8EzejRyDX9VwN8b7LXNeCCSUHR5sru0G688mpR1PmN4PzLLGqnjy14yn73bpcBE4v4 4kClN9elKaXtXuO4msK4QQZIddUC+T+oU8wlfrvmlC9Ae3r+f8IvMw0xmGRhmBbvVWP/ y/LHBK+nr/VHAi6kjUQXKgZv5nme2ZnlBv5p8B7ZaGT5wL+1jFXBHdnqxCu5kmC5yA3m BkQk8xyRFBd4xNzNZZAhuVTgYch0/Bo9PGWp9TLcDYCI9DivOjzyS/Z1fXs1+s/Ju9zX aPPQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=LlUtZhTqAoP4FgVTpxw0WKoZrVtI5D8ySgOtKjWamcU=; b=FNHEtJVYC3L8bKLlWMBHUxnWDbZQyj/M7AZzW1903sfa/zg3h2Ujv82AoU1v3BVjvK 3MnR7KXyouRtqXBw/yJ5hN+8DOGl3/c+UflGkjptRueRtAqpnGiwM41kbv8sCs77ShZP JatN616wMh8UhrD3pt/dHzrcRn+y55sGVo101dT7V3zwea7zF0WvGU71eC+144OCKLWb 76mpGYcWyUlqsYNOZSOkmqnYJM3SQL9nOxpktiORpKkuBn8ECuUL6q5GYn0Zna2dLPC/ D88OHZvf1hU517t+0H9WnPiTW2R0vuzdAM+XAPcY9ShOKjBWrYj8vd5LK3K6OBYCQNQQ fpgA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=tTg+jil1; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id i124si8518546oib.172.2020.03.15.14.36.00; Sun, 15 Mar 2020 14:36:13 -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; dkim=pass header.i=@kernel.org header.s=default header.b=tTg+jil1; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729216AbgCOVfi (ORCPT + 99 others); Sun, 15 Mar 2020 17:35:38 -0400 Received: from mail.kernel.org ([198.145.29.99]:55560 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729166AbgCOVfi (ORCPT ); Sun, 15 Mar 2020 17:35:38 -0400 Received: from mail-io1-f44.google.com (mail-io1-f44.google.com [209.85.166.44]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id C9AF2206E9; Sun, 15 Mar 2020 21:35:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1584308136; bh=Zx2DjVwX1490TeydqsRds8Diw4sddjp+Y/m725JzRIU=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=tTg+jil1l80YsBBIyVAHuwZvSeoMzvCwLHv+dJ8yUmtygL8Q7D7Og1cPF63Gl0/Bu IiXGFBMpOHEdi6YhD2F3s3d4R12b1CLD+SpCkngdANGeIiULyXDwS71FgcjCTfDNrZ ijw0uT57sv+/nGD2lPI7uYGr85GTgU9OeZs2EMDM= Received: by mail-io1-f44.google.com with SMTP id o127so2685086iof.0; Sun, 15 Mar 2020 14:35:36 -0700 (PDT) X-Gm-Message-State: ANhLgQ2T2gp4AwzRMvpxOjliAySuoxUJeyyD5CZCyMtiB7RikWva2jiG 5wxS1oPacSlcHQbzXzbgnynOIK7JaXCulKBmICE= X-Received: by 2002:a02:c812:: with SMTP id p18mr1515254jao.67.1584308136032; Sun, 15 Mar 2020 14:35:36 -0700 (PDT) MIME-Version: 1.0 References: <1583825986-8189-1-git-send-email-light.hsieh@mediatek.com> <1583825986-8189-2-git-send-email-light.hsieh@mediatek.com> In-Reply-To: <1583825986-8189-2-git-send-email-light.hsieh@mediatek.com> From: Sean Wang Date: Sun, 15 Mar 2020 14:35:24 -0700 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH v4 1/2] pinctrl: make MediaTek pinctrl v2 driver ready for buidling loadable module To: Light Hsieh Cc: Linus Walleij , "moderated list:ARM/Mediatek SoC support" , "open list:GPIO SUBSYSTEM" , lkml , kuohong.wang@mediatek.com Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi, Light On Tue, Mar 10, 2020 at 12:39 AM wrote: > > From: Light Hsieh > Correct the prefix of the subject with "pinctrl: mediatek". > In the future we want to be able to build the MediaTek pinctrl driver, > based on paris, as kernel module. This patch allows pinctrl-paris.c, the > external interrupt controller mtk-eint.c, and pinctrl-mtk-common-v2.c to > be loadable as module. > > Signed-off-by: Light Hsieh > Reviewed-by: Matthias Brugger > --- > drivers/pinctrl/mediatek/Kconfig | 13 +++++++++++-- > drivers/pinctrl/mediatek/Makefile | 5 +++-- > drivers/pinctrl/mediatek/mtk-eint.c | 9 +++++++++ > drivers/pinctrl/mediatek/pinctrl-mtk-common-v2.c | 24 ++++++++++++++++++++++++ > drivers/pinctrl/mediatek/pinctrl-paris.c | 6 ++++++ > drivers/pinctrl/pinconf-generic.c | 1 + Separate the patches for the device driver and for the core respectively. > 6 files changed, 54 insertions(+), 4 deletions(-) > > diff --git a/drivers/pinctrl/mediatek/Kconfig b/drivers/pinctrl/mediatek/Kconfig > index 701f9af..4cd1109 100644 > --- a/drivers/pinctrl/mediatek/Kconfig > +++ b/drivers/pinctrl/mediatek/Kconfig > @@ -3,10 +3,12 @@ menu "MediaTek pinctrl drivers" > depends on ARCH_MEDIATEK || COMPILE_TEST > > config EINT_MTK > - bool "MediaTek External Interrupt Support" > + tristate "MediaTek External Interrupt Support" > depends on PINCTRL_MTK || PINCTRL_MTK_MOORE || PINCTRL_MTK_PARIS || COMPILE_TEST > select GPIOLIB > select IRQ_DOMAIN > + default y if PINCTRL_MTK || PINCTRL_MTK_MOORE > + default PINCTRL_MTK_PARIS > > config PINCTRL_MTK > bool > @@ -17,23 +19,30 @@ config PINCTRL_MTK > select EINT_MTK > select OF_GPIO > > +config PINCTRL_MTK_V2 > + tristate > + depends on PINCTRL_MTK_MOORE || PINCTRL_MTK_PARIS PINCTRL_MTK_V2 doesn't have to depend on PINCTRL_MTK_MOORE or PINCTRL_MTK_PARIS to work and it can build on it own so that lets us remove the dependency. > + > config PINCTRL_MTK_MOORE > bool > depends on OF > select GENERIC_PINCONF > select GENERIC_PINCTRL_GROUPS > select GENERIC_PINMUX_FUNCTIONS > + select EINT_MTK The original design of PINCTRL_MTK_MOORE doesn't have to work with EINT_MTK coupled tightly so that let us remove the reverse dependency. > select GPIOLIB > select OF_GPIO > + select PINCTRL_MTK_V2 > > config PINCTRL_MTK_PARIS > - bool > + tristate > depends on OF > select PINMUX > select GENERIC_PINCONF > select GPIOLIB > select EINT_MTK > select OF_GPIO > + select PINCTRL_MTK_V2 > > # For ARMv7 SoCs > config PINCTRL_MT2701 > diff --git a/drivers/pinctrl/mediatek/Makefile b/drivers/pinctrl/mediatek/Makefile > index a74325a..4b71328 100644 > --- a/drivers/pinctrl/mediatek/Makefile > +++ b/drivers/pinctrl/mediatek/Makefile > @@ -2,8 +2,9 @@ > # Core > obj-$(CONFIG_EINT_MTK) += mtk-eint.o > obj-$(CONFIG_PINCTRL_MTK) += pinctrl-mtk-common.o > -obj-$(CONFIG_PINCTRL_MTK_MOORE) += pinctrl-moore.o pinctrl-mtk-common-v2.o > -obj-$(CONFIG_PINCTRL_MTK_PARIS) += pinctrl-paris.o pinctrl-mtk-common-v2.o > +obj-$(CONFIG_PINCTRL_MTK_V2) += pinctrl-mtk-common-v2.o > +obj-$(CONFIG_PINCTRL_MTK_MOORE) += pinctrl-moore.o > +obj-$(CONFIG_PINCTRL_MTK_PARIS) += pinctrl-paris.o > > # SoC Drivers > obj-$(CONFIG_PINCTRL_MT2701) += pinctrl-mt2701.o > diff --git a/drivers/pinctrl/mediatek/mtk-eint.c b/drivers/pinctrl/mediatek/mtk-eint.c > index 7e526bcf..99703a8 100644 > --- a/drivers/pinctrl/mediatek/mtk-eint.c > +++ b/drivers/pinctrl/mediatek/mtk-eint.c > @@ -9,6 +9,7 @@ > * > */ > > +#include Sort in alphabetical order, please. > #include > #include > #include > @@ -379,6 +380,7 @@ int mtk_eint_do_suspend(struct mtk_eint *eint) > > return 0; > } > +EXPORT_SYMBOL_GPL(mtk_eint_do_suspend); > > int mtk_eint_do_resume(struct mtk_eint *eint) > { > @@ -386,6 +388,7 @@ int mtk_eint_do_resume(struct mtk_eint *eint) > > return 0; > } > +EXPORT_SYMBOL_GPL(mtk_eint_do_resume); > > int mtk_eint_set_debounce(struct mtk_eint *eint, unsigned long eint_num, > unsigned int debounce) > @@ -440,6 +443,7 @@ int mtk_eint_set_debounce(struct mtk_eint *eint, unsigned long eint_num, > > return 0; > } > +EXPORT_SYMBOL_GPL(mtk_eint_set_debounce); > > int mtk_eint_find_irq(struct mtk_eint *eint, unsigned long eint_n) > { > @@ -451,6 +455,7 @@ int mtk_eint_find_irq(struct mtk_eint *eint, unsigned long eint_n) > > return irq; > } > +EXPORT_SYMBOL_GPL(mtk_eint_find_irq); > > int mtk_eint_do_init(struct mtk_eint *eint) > { > @@ -495,3 +500,7 @@ int mtk_eint_do_init(struct mtk_eint *eint) > > return 0; > } > +EXPORT_SYMBOL_GPL(mtk_eint_do_init); > + > +MODULE_LICENSE("GPL v2"); > +MODULE_DESCRIPTION("MediaTek EINT Driver"); > diff --git a/drivers/pinctrl/mediatek/pinctrl-mtk-common-v2.c b/drivers/pinctrl/mediatek/pinctrl-mtk-common-v2.c > index 1da9425..cdf2d69 100644 > --- a/drivers/pinctrl/mediatek/pinctrl-mtk-common-v2.c > +++ b/drivers/pinctrl/mediatek/pinctrl-mtk-common-v2.c > @@ -6,6 +6,7 @@ > * > */ > > +#include Sort in alphabetical order, please. > #include > #include > #include > @@ -206,6 +207,7 @@ int mtk_hw_set_value(struct mtk_pinctrl *hw, const struct mtk_pin_desc *desc, > > return 0; > } > +EXPORT_SYMBOL_GPL(mtk_hw_set_value); > > int mtk_hw_get_value(struct mtk_pinctrl *hw, const struct mtk_pin_desc *desc, > int field, int *value) > @@ -225,6 +227,7 @@ int mtk_hw_get_value(struct mtk_pinctrl *hw, const struct mtk_pin_desc *desc, > > return 0; > } > +EXPORT_SYMBOL_GPL(mtk_hw_get_value); > > static int mtk_xt_find_eint_num(struct mtk_pinctrl *hw, unsigned long eint_n) > { > @@ -363,6 +366,7 @@ int mtk_build_eint(struct mtk_pinctrl *hw, struct platform_device *pdev) > > return mtk_eint_do_init(hw->eint); > } > +EXPORT_SYMBOL_GPL(mtk_build_eint); > > /* Revision 0 */ > int mtk_pinconf_bias_disable_set(struct mtk_pinctrl *hw, > @@ -382,6 +386,7 @@ int mtk_pinconf_bias_disable_set(struct mtk_pinctrl *hw, > > return 0; > } > +EXPORT_SYMBOL_GPL(mtk_pinconf_bias_disable_set); > > int mtk_pinconf_bias_disable_get(struct mtk_pinctrl *hw, > const struct mtk_pin_desc *desc, int *res) > @@ -404,6 +409,7 @@ int mtk_pinconf_bias_disable_get(struct mtk_pinctrl *hw, > > return 0; > } > +EXPORT_SYMBOL_GPL(mtk_pinconf_bias_disable_get); > > int mtk_pinconf_bias_set(struct mtk_pinctrl *hw, > const struct mtk_pin_desc *desc, bool pullup) > @@ -423,6 +429,7 @@ int mtk_pinconf_bias_set(struct mtk_pinctrl *hw, > > return 0; > } > +EXPORT_SYMBOL_GPL(mtk_pinconf_bias_set); > > int mtk_pinconf_bias_get(struct mtk_pinctrl *hw, > const struct mtk_pin_desc *desc, bool pullup, int *res) > @@ -442,6 +449,7 @@ int mtk_pinconf_bias_get(struct mtk_pinctrl *hw, > > return 0; > } > +EXPORT_SYMBOL_GPL(mtk_pinconf_bias_get); > > /* Revision 1 */ > int mtk_pinconf_bias_disable_set_rev1(struct mtk_pinctrl *hw, > @@ -456,6 +464,7 @@ int mtk_pinconf_bias_disable_set_rev1(struct mtk_pinctrl *hw, > > return 0; > } > +EXPORT_SYMBOL_GPL(mtk_pinconf_bias_disable_set_rev1); > > int mtk_pinconf_bias_disable_get_rev1(struct mtk_pinctrl *hw, > const struct mtk_pin_desc *desc, int *res) > @@ -473,6 +482,7 @@ int mtk_pinconf_bias_disable_get_rev1(struct mtk_pinctrl *hw, > > return 0; > } > +EXPORT_SYMBOL_GPL(mtk_pinconf_bias_disable_get_rev1); > > int mtk_pinconf_bias_set_rev1(struct mtk_pinctrl *hw, > const struct mtk_pin_desc *desc, bool pullup) > @@ -492,6 +502,7 @@ int mtk_pinconf_bias_set_rev1(struct mtk_pinctrl *hw, > > return 0; > } > +EXPORT_SYMBOL_GPL(mtk_pinconf_bias_set_rev1); > > int mtk_pinconf_bias_get_rev1(struct mtk_pinctrl *hw, > const struct mtk_pin_desc *desc, bool pullup, > @@ -517,6 +528,7 @@ int mtk_pinconf_bias_get_rev1(struct mtk_pinctrl *hw, > > return 0; > } > +EXPORT_SYMBOL_GPL(mtk_pinconf_bias_set_gev1); That should be EXPORT_SYMBOL_GPL(mtk_pinconf_bias_get_rev1); > > /* Combo for the following pull register type: > * 1. PU + PD > @@ -717,6 +729,7 @@ int mtk_pinconf_bias_set_combo(struct mtk_pinctrl *hw, > out: > return err; > } > +EXPORT_SYMBOL_GPL(mtk_pinconf_bias_set_combo); > > int mtk_pinconf_bias_get_combo(struct mtk_pinctrl *hw, > const struct mtk_pin_desc *desc, > @@ -737,6 +750,7 @@ int mtk_pinconf_bias_get_combo(struct mtk_pinctrl *hw, > out: > return err; > } > +EXPORT_SYMBOL_GPL(mtk_pinconf_bias_get_combo); > > /* Revision 0 */ > int mtk_pinconf_drive_set(struct mtk_pinctrl *hw, > @@ -766,6 +780,7 @@ int mtk_pinconf_drive_set(struct mtk_pinctrl *hw, > > return err; > } > +EXPORT_SYMBOL_GPL(mtk_pinconf_drive_set); > > int mtk_pinconf_drive_get(struct mtk_pinctrl *hw, > const struct mtk_pin_desc *desc, int *val) > @@ -790,6 +805,7 @@ int mtk_pinconf_drive_get(struct mtk_pinctrl *hw, > > return 0; > } > +EXPORT_SYMBOL_GPL(mtk_pinconf_drive_get); > > /* Revision 1 */ > int mtk_pinconf_drive_set_rev1(struct mtk_pinctrl *hw, > @@ -811,6 +827,7 @@ int mtk_pinconf_drive_set_rev1(struct mtk_pinctrl *hw, > > return err; > } > +EXPORT_SYMBOL_GPL(mtk_pinconf_drive_set_rev1); > > int mtk_pinconf_drive_get_rev1(struct mtk_pinctrl *hw, > const struct mtk_pin_desc *desc, int *val) > @@ -828,18 +845,21 @@ int mtk_pinconf_drive_get_rev1(struct mtk_pinctrl *hw, > > return 0; > } > +EXPORT_SYMBOL_GPL(mtk_pinconf_drive_get_rev1); > > int mtk_pinconf_drive_set_raw(struct mtk_pinctrl *hw, > const struct mtk_pin_desc *desc, u32 arg) > { > return mtk_hw_set_value(hw, desc, PINCTRL_PIN_REG_DRV, arg); > } > +EXPORT_SYMBOL_GPL(mtk_pinconf_drive_set_raw); > > int mtk_pinconf_drive_get_raw(struct mtk_pinctrl *hw, > const struct mtk_pin_desc *desc, int *val) > { > return mtk_hw_get_value(hw, desc, PINCTRL_PIN_REG_DRV, val); > } > +EXPORT_SYMBOL_GPL(mtk_pinconf_drive_get_raw); > > int mtk_pinconf_adv_pull_set(struct mtk_pinctrl *hw, > const struct mtk_pin_desc *desc, bool pullup, > @@ -880,6 +900,7 @@ int mtk_pinconf_adv_pull_set(struct mtk_pinctrl *hw, > > return err; > } > +EXPORT_SYMBOL_GPL(mtk_pinconf_adv_pull_set); > > int mtk_pinconf_adv_pull_get(struct mtk_pinctrl *hw, > const struct mtk_pin_desc *desc, bool pullup, > @@ -922,6 +943,7 @@ int mtk_pinconf_adv_pull_get(struct mtk_pinctrl *hw, > > return 0; > } > +EXPORT_SYMBOL_GPL(mtk_pinconf_adv_pull_get); > > int mtk_pinconf_adv_drive_set(struct mtk_pinctrl *hw, > const struct mtk_pin_desc *desc, u32 arg) > @@ -948,6 +970,7 @@ int mtk_pinconf_adv_drive_set(struct mtk_pinctrl *hw, > > return err; > } > +EXPORT_SYMBOL_GPL(mtk_pinconf_adv_drive_set); > > int mtk_pinconf_adv_drive_get(struct mtk_pinctrl *hw, > const struct mtk_pin_desc *desc, u32 *val) > @@ -971,3 +994,4 @@ int mtk_pinconf_adv_drive_get(struct mtk_pinctrl *hw, > > return 0; > } > +EXPORT_SYMBOL_GPL(mtk_pinconf_adv_drive_get); > diff --git a/drivers/pinctrl/mediatek/pinctrl-paris.c b/drivers/pinctrl/mediatek/pinctrl-paris.c > index 83bf29c..028a3de 100644 > --- a/drivers/pinctrl/mediatek/pinctrl-paris.c > +++ b/drivers/pinctrl/mediatek/pinctrl-paris.c > @@ -9,6 +9,7 @@ > * Hongzhou.Yang > */ > > +#include Sort in alphabetical order, please. > #include > #include > #include "pinctrl-paris.h" > @@ -633,6 +634,7 @@ ssize_t mtk_pctrl_show_one_pin(struct mtk_pinctrl *hw, > > return len; > } > +EXPORT_SYMBOL_GPL(mtk_pctrl_show_one_pin); > > #define PIN_DBG_BUF_SZ 96 > static void mtk_pctrl_dbg_show(struct pinctrl_dev *pctldev, struct seq_file *s, > @@ -1037,3 +1039,7 @@ static int mtk_paris_pinctrl_resume(struct device *device) > .suspend_noirq = mtk_paris_pinctrl_suspend, > .resume_noirq = mtk_paris_pinctrl_resume, > }; > +EXPORT_SYMBOL_GPL(mtk_paris_pinctrl_probe); > + > +MODULE_LICENSE("GPL v2"); > +MODULE_DESCRIPTION("MediaTek Pinctrl Common Driver V2 Paris"); > diff --git a/drivers/pinctrl/pinconf-generic.c b/drivers/pinctrl/pinconf-generic.c > index 9eb8630..dfef471 100644 > --- a/drivers/pinctrl/pinconf-generic.c > +++ b/drivers/pinctrl/pinconf-generic.c > @@ -286,6 +286,7 @@ int pinconf_generic_parse_dt_config(struct device_node *np, > kfree(cfg); > return ret; > } > +EXPORT_SYMBOL_GPL(pinconf_generic_parse_dt_config); > The change probably has been done in b88d145191ad ("pinctrl: Export some needed symbols at module load time"). > int pinconf_generic_dt_subnode_to_map(struct pinctrl_dev *pctldev, > struct device_node *np, struct pinctrl_map **map, > -- > 1.8.1.1.dirty