Make pinctrl-rockchip driver to be tristate module, support to build as
a module, this is useful for GKI.
Signed-off-by: Jianqun Xu <[email protected]>
---
drivers/pinctrl/Kconfig | 2 +-
drivers/pinctrl/pinctrl-rockchip.c | 7 +++++++
2 files changed, 8 insertions(+), 1 deletion(-)
diff --git a/drivers/pinctrl/Kconfig b/drivers/pinctrl/Kconfig
index 8828613c4e0e..dd4874e2ac67 100644
--- a/drivers/pinctrl/Kconfig
+++ b/drivers/pinctrl/Kconfig
@@ -207,7 +207,7 @@ config PINCTRL_OXNAS
select MFD_SYSCON
config PINCTRL_ROCKCHIP
- bool
+ tristate "Rockchip gpio and pinctrl driver"
select PINMUX
select GENERIC_PINCONF
select GENERIC_IRQ_CHIP
diff --git a/drivers/pinctrl/pinctrl-rockchip.c b/drivers/pinctrl/pinctrl-rockchip.c
index 77c1e6744f6c..ec509ef8bd8d 100644
--- a/drivers/pinctrl/pinctrl-rockchip.c
+++ b/drivers/pinctrl/pinctrl-rockchip.c
@@ -16,10 +16,12 @@
*/
#include <linux/init.h>
+#include <linux/module.h>
#include <linux/platform_device.h>
#include <linux/io.h>
#include <linux/bitops.h>
#include <linux/gpio/driver.h>
+#include <linux/of_device.h>
#include <linux/of_address.h>
#include <linux/of_irq.h>
#include <linux/pinctrl/machine.h>
@@ -4259,6 +4261,7 @@ static const struct of_device_id rockchip_pinctrl_dt_match[] = {
.data = &rk3399_pin_ctrl },
{},
};
+MODULE_DEVICE_TABLE(of, rockchip_pinctrl_dt_match);
static struct platform_driver rockchip_pinctrl_driver = {
.probe = rockchip_pinctrl_probe,
@@ -4274,3 +4277,7 @@ static int __init rockchip_pinctrl_drv_register(void)
return platform_driver_register(&rockchip_pinctrl_driver);
}
postcore_initcall(rockchip_pinctrl_drv_register);
+
+MODULE_DESCRIPTION("ROCKCHIP Pin Controller Driver");
+MODULE_LICENSE("GPL");
+MODULE_ALIAS("platform:pinctrl-rockchip");
--
2.17.1
Hi Jianqun,
Thank you for the patch! Yet something to improve:
[auto build test ERROR on rockchip/for-next]
[also build test ERROR on pinctrl/devel v5.8-rc5 next-20200717]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]
url: https://github.com/0day-ci/linux/commits/Jianqun-Xu/pinctrl-rockchip-prepare-work-for-split-driver/20200717-112906
base: https://git.kernel.org/pub/scm/linux/kernel/git/mmind/linux-rockchip.git for-next
config: alpha-randconfig-r014-20200719 (attached as .config)
compiler: alpha-linux-gcc (GCC) 9.3.0
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross ARCH=alpha
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <[email protected]>
All errors (new ones prefixed by >>):
drivers/pinctrl/pinctrl-rockchip.c: In function 'rockchip_pinctrl_parse_groups':
>> drivers/pinctrl/pinctrl-rockchip.c:2879:9: error: implicit declaration of function 'pinconf_generic_parse_dt_config'; did you mean 'pinconf_generic_dump_config'? [-Werror=implicit-function-declaration]
2879 | ret = pinconf_generic_parse_dt_config(np_config, NULL,
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| pinconf_generic_dump_config
drivers/pinctrl/pinctrl-rockchip.c: In function 'rockchip_gpiolib_register':
>> drivers/pinctrl/pinctrl-rockchip.c:3471:5: error: 'struct gpio_chip' has no member named 'of_node'
3471 | gc->of_node = bank->of_node;
| ^~
drivers/pinctrl/pinctrl-rockchip.c: In function 'rockchip_pinctrl_get_soc_data':
drivers/pinctrl/pinctrl-rockchip.c:3575:8: warning: duplicate 'const' declaration specifier [-Wduplicate-decl-specifier]
3575 | const const struct rockchip_pin_ctrl *ctrl;
| ^~~~~
drivers/pinctrl/pinctrl-rockchip.c: In function 'rockchip_pinctrl_probe':
drivers/pinctrl/pinctrl-rockchip.c:3753:8: warning: duplicate 'const' declaration specifier [-Wduplicate-decl-specifier]
3753 | const const struct rockchip_pin_ctrl *ctrl;
| ^~~~~
At top level:
drivers/pinctrl/pinctrl-rockchip.c:2802:34: warning: 'rockchip_bank_match' defined but not used [-Wunused-const-variable=]
2802 | static const struct of_device_id rockchip_bank_match[] = {
| ^~~~~~~~~~~~~~~~~~~
cc1: some warnings being treated as errors
vim +2879 drivers/pinctrl/pinctrl-rockchip.c
d3e5116119bd02 Heiko St?bner 2013-06-10 2821
d3e5116119bd02 Heiko St?bner 2013-06-10 2822 static int rockchip_pinctrl_parse_groups(struct device_node *np,
d3e5116119bd02 Heiko St?bner 2013-06-10 2823 struct rockchip_pin_group *grp,
d3e5116119bd02 Heiko St?bner 2013-06-10 2824 struct rockchip_pinctrl *info,
d3e5116119bd02 Heiko St?bner 2013-06-10 2825 u32 index)
d3e5116119bd02 Heiko St?bner 2013-06-10 2826 {
d3e5116119bd02 Heiko St?bner 2013-06-10 2827 struct rockchip_pin_bank *bank;
d3e5116119bd02 Heiko St?bner 2013-06-10 2828 int size;
d3e5116119bd02 Heiko St?bner 2013-06-10 2829 const __be32 *list;
d3e5116119bd02 Heiko St?bner 2013-06-10 2830 int num;
d3e5116119bd02 Heiko St?bner 2013-06-10 2831 int i, j;
d3e5116119bd02 Heiko St?bner 2013-06-10 2832 int ret;
d3e5116119bd02 Heiko St?bner 2013-06-10 2833
94f4e54cecaf3e Rob Herring 2018-08-27 2834 dev_dbg(info->dev, "group(%d): %pOFn\n", index, np);
d3e5116119bd02 Heiko St?bner 2013-06-10 2835
d3e5116119bd02 Heiko St?bner 2013-06-10 2836 /* Initialise group */
d3e5116119bd02 Heiko St?bner 2013-06-10 2837 grp->name = np->name;
d3e5116119bd02 Heiko St?bner 2013-06-10 2838
d3e5116119bd02 Heiko St?bner 2013-06-10 2839 /*
d3e5116119bd02 Heiko St?bner 2013-06-10 2840 * the binding format is rockchip,pins = <bank pin mux CONFIG>,
d3e5116119bd02 Heiko St?bner 2013-06-10 2841 * do sanity check and calculate pins number
d3e5116119bd02 Heiko St?bner 2013-06-10 2842 */
d3e5116119bd02 Heiko St?bner 2013-06-10 2843 list = of_get_property(np, "rockchip,pins", &size);
d3e5116119bd02 Heiko St?bner 2013-06-10 2844 /* we do not check return since it's safe node passed down */
d3e5116119bd02 Heiko St?bner 2013-06-10 2845 size /= sizeof(*list);
d3e5116119bd02 Heiko St?bner 2013-06-10 2846 if (!size || size % 4) {
d3e5116119bd02 Heiko St?bner 2013-06-10 2847 dev_err(info->dev, "wrong pins number or pins and configs should be by 4\n");
d3e5116119bd02 Heiko St?bner 2013-06-10 2848 return -EINVAL;
d3e5116119bd02 Heiko St?bner 2013-06-10 2849 }
d3e5116119bd02 Heiko St?bner 2013-06-10 2850
d3e5116119bd02 Heiko St?bner 2013-06-10 2851 grp->npins = size / 4;
d3e5116119bd02 Heiko St?bner 2013-06-10 2852
a86854d0c599b3 Kees Cook 2018-06-12 2853 grp->pins = devm_kcalloc(info->dev, grp->npins, sizeof(unsigned int),
d3e5116119bd02 Heiko St?bner 2013-06-10 2854 GFP_KERNEL);
a86854d0c599b3 Kees Cook 2018-06-12 2855 grp->data = devm_kcalloc(info->dev,
a86854d0c599b3 Kees Cook 2018-06-12 2856 grp->npins,
d3e5116119bd02 Heiko St?bner 2013-06-10 2857 sizeof(struct rockchip_pin_config),
d3e5116119bd02 Heiko St?bner 2013-06-10 2858 GFP_KERNEL);
d3e5116119bd02 Heiko St?bner 2013-06-10 2859 if (!grp->pins || !grp->data)
d3e5116119bd02 Heiko St?bner 2013-06-10 2860 return -ENOMEM;
d3e5116119bd02 Heiko St?bner 2013-06-10 2861
d3e5116119bd02 Heiko St?bner 2013-06-10 2862 for (i = 0, j = 0; i < size; i += 4, j++) {
d3e5116119bd02 Heiko St?bner 2013-06-10 2863 const __be32 *phandle;
d3e5116119bd02 Heiko St?bner 2013-06-10 2864 struct device_node *np_config;
d3e5116119bd02 Heiko St?bner 2013-06-10 2865
d3e5116119bd02 Heiko St?bner 2013-06-10 2866 num = be32_to_cpu(*list++);
d3e5116119bd02 Heiko St?bner 2013-06-10 2867 bank = bank_num_to_bank(info, num);
d3e5116119bd02 Heiko St?bner 2013-06-10 2868 if (IS_ERR(bank))
d3e5116119bd02 Heiko St?bner 2013-06-10 2869 return PTR_ERR(bank);
d3e5116119bd02 Heiko St?bner 2013-06-10 2870
d3e5116119bd02 Heiko St?bner 2013-06-10 2871 grp->pins[j] = bank->pin_base + be32_to_cpu(*list++);
d3e5116119bd02 Heiko St?bner 2013-06-10 2872 grp->data[j].func = be32_to_cpu(*list++);
d3e5116119bd02 Heiko St?bner 2013-06-10 2873
d3e5116119bd02 Heiko St?bner 2013-06-10 2874 phandle = list++;
d3e5116119bd02 Heiko St?bner 2013-06-10 2875 if (!phandle)
d3e5116119bd02 Heiko St?bner 2013-06-10 2876 return -EINVAL;
d3e5116119bd02 Heiko St?bner 2013-06-10 2877
d3e5116119bd02 Heiko St?bner 2013-06-10 2878 np_config = of_find_node_by_phandle(be32_to_cpup(phandle));
dd4d01f7bad886 Soren Brinkmann 2015-01-09 @2879 ret = pinconf_generic_parse_dt_config(np_config, NULL,
d3e5116119bd02 Heiko St?bner 2013-06-10 2880 &grp->data[j].configs, &grp->data[j].nconfigs);
d3e5116119bd02 Heiko St?bner 2013-06-10 2881 if (ret)
d3e5116119bd02 Heiko St?bner 2013-06-10 2882 return ret;
d3e5116119bd02 Heiko St?bner 2013-06-10 2883 }
d3e5116119bd02 Heiko St?bner 2013-06-10 2884
d3e5116119bd02 Heiko St?bner 2013-06-10 2885 return 0;
d3e5116119bd02 Heiko St?bner 2013-06-10 2886 }
d3e5116119bd02 Heiko St?bner 2013-06-10 2887
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/[email protected]