linux-rockchip.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v3 0/2] rockchip pinctrl for acpi
@ 2022-09-20  3:34 Jianqun Xu
  2022-09-20  3:34 ` [PATCH v3 1/2] pinctrl: rockchip: find gpiochip by gpio label Jianqun Xu
  2022-09-20  3:34 ` [PATCH v3 2/2] pinctrl: rockchip: get match data by device_get_match_data Jianqun Xu
  0 siblings, 2 replies; 5+ messages in thread
From: Jianqun Xu @ 2022-09-20  3:34 UTC (permalink / raw)
  To: jbx6244, heiko, linus.walleij, andriy.shevchenko
  Cc: brgl, linux-gpio, linux-rockchip, Jianqun Xu

These patch fixes to support acpi by:
1. populate gpio platform before pinctrl to probe
2. get gpiochip by finding from gpiochip list
3. get match data by device api

Jianqun Xu (2):
  pinctrl: rockchip: find gpiochip by gpio label
  pinctrl: rockchip: get match data by device_get_match_data

 drivers/pinctrl/pinctrl-rockchip.c | 55 ++++++++++++++++++++----------
 drivers/pinctrl/pinctrl-rockchip.h |  2 +-
 2 files changed, 38 insertions(+), 19 deletions(-)

-- 
v3:
 - fix 'gpio' to 'GPIO', 'rockchip' to 'Rockchip'
 - use gpiochip_find_by_name

v2:
- add a second patch to support acpi

2.25.1


_______________________________________________
Linux-rockchip mailing list
Linux-rockchip@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-rockchip

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH v3 1/2] pinctrl: rockchip: find gpiochip by gpio label
  2022-09-20  3:34 [PATCH v3 0/2] rockchip pinctrl for acpi Jianqun Xu
@ 2022-09-20  3:34 ` Jianqun Xu
  2022-09-21 18:00   ` kernel test robot
  2022-09-21 20:22   ` kernel test robot
  2022-09-20  3:34 ` [PATCH v3 2/2] pinctrl: rockchip: get match data by device_get_match_data Jianqun Xu
  1 sibling, 2 replies; 5+ messages in thread
From: Jianqun Xu @ 2022-09-20  3:34 UTC (permalink / raw)
  To: jbx6244, heiko, linus.walleij, andriy.shevchenko
  Cc: brgl, linux-gpio, linux-rockchip, Jianqun Xu

Currently the pinctrl device acts as parent for the GPIO devices for
Rockchip platform, the pinctrl driver probes first and then populate the
GPIO platform lastly.

This patch makes the pinctrl to populate GPIO platform firstly and then
do probe after GPIO probed successfully. Also get the gpiochip by label.

Signed-off-by: Jianqun Xu <jay.xu@rock-chips.com>
---
 drivers/pinctrl/pinctrl-rockchip.c | 41 ++++++++++++++++++++++--------
 drivers/pinctrl/pinctrl-rockchip.h |  2 +-
 2 files changed, 31 insertions(+), 12 deletions(-)

diff --git a/drivers/pinctrl/pinctrl-rockchip.c b/drivers/pinctrl/pinctrl-rockchip.c
index a91061f9c2ac..de86b2bc6380 100644
--- a/drivers/pinctrl/pinctrl-rockchip.c
+++ b/drivers/pinctrl/pinctrl-rockchip.c
@@ -2726,7 +2726,7 @@ static int rockchip_pinconf_set(struct pinctrl_dev *pctldev, unsigned int pin,
 {
 	struct rockchip_pinctrl *info = pinctrl_dev_get_drvdata(pctldev);
 	struct rockchip_pin_bank *bank = pin_to_bank(info, pin);
-	struct gpio_chip *gpio = &bank->gpio_chip;
+	struct gpio_chip *gpio = bank->gpio_chip;
 	enum pin_config_param param;
 	u32 arg;
 	int i;
@@ -2832,7 +2832,7 @@ static int rockchip_pinconf_get(struct pinctrl_dev *pctldev, unsigned int pin,
 {
 	struct rockchip_pinctrl *info = pinctrl_dev_get_drvdata(pctldev);
 	struct rockchip_pin_bank *bank = pin_to_bank(info, pin);
-	struct gpio_chip *gpio = &bank->gpio_chip;
+	struct gpio_chip *gpio = bank->gpio_chip;
 	enum pin_config_param param = pinconf_to_config_param(*config);
 	u16 arg;
 	int rc;
@@ -3291,16 +3291,20 @@ static SIMPLE_DEV_PM_OPS(rockchip_pinctrl_dev_pm_ops, rockchip_pinctrl_suspend,
 
 static int rockchip_pinctrl_probe(struct platform_device *pdev)
 {
-	struct rockchip_pinctrl *info;
 	struct device *dev = &pdev->dev;
-	struct device_node *np = dev->of_node, *node;
+	struct fwnode_handle *fwnode = dev_fwnode(dev);
+	struct rockchip_pinctrl *info;
 	struct rockchip_pin_ctrl *ctrl;
+	struct device_node *np, *node;
 	struct resource *res;
 	void __iomem *base;
-	int ret;
+	int ret, i;
 
-	if (!dev->of_node)
-		return dev_err_probe(dev, -ENODEV, "device tree node not found\n");
+	if (is_of_node(fwnode)) {
+		ret = of_platform_populate(to_of_node(fwnode), NULL, NULL, NULL);
+		if (ret)
+			return dev_err_probe(dev, ret, "failed to register gpio device\n");
+	}
 
 	info = devm_kzalloc(dev, sizeof(*info), GFP_KERNEL);
 	if (!info)
@@ -3358,11 +3362,26 @@ static int rockchip_pinctrl_probe(struct platform_device *pdev)
 	if (ret)
 		return ret;
 
-	platform_set_drvdata(pdev, info);
+	for (i = 0; i < ctrl->nr_banks; i++) {
+		struct gpio_chip *gc;
+		struct rockchip_pin_bank *bank = &ctrl->pin_banks[i];
 
-	ret = of_platform_populate(np, NULL, NULL, &pdev->dev);
-	if (ret)
-		return dev_err_probe(dev, ret, "failed to register gpio device\n");
+		gc = gpiochip_find_by_name((void *)ctrl->pin_banks[i].name);
+		if (!gc) {
+			dev_err(dev, "fail to find gpiochip\n");
+			return ret;
+		}
+
+		ret = gpiochip_add_pin_range(gc, dev_name(dev), 0, gc->base, gc->ngpio);
+		if (ret) {
+			dev_err(dev, "fail to add pin range\n");
+			return ret;
+		}
+		bank->gpio_chip = gc;
+	}
+
+	platform_set_drvdata(pdev, info);
+	dev_info(dev, "probed %pfw\n", fwnode);
 
 	return 0;
 }
diff --git a/drivers/pinctrl/pinctrl-rockchip.h b/drivers/pinctrl/pinctrl-rockchip.h
index 4759f336941e..2be12e76b2c4 100644
--- a/drivers/pinctrl/pinctrl-rockchip.h
+++ b/drivers/pinctrl/pinctrl-rockchip.h
@@ -330,7 +330,7 @@ struct rockchip_pin_bank {
 	struct device_node		*of_node;
 	struct rockchip_pinctrl		*drvdata;
 	struct irq_domain		*domain;
-	struct gpio_chip		gpio_chip;
+	struct gpio_chip		*gpio_chip;
 	struct pinctrl_gpio_range	grange;
 	raw_spinlock_t			slock;
 	const struct rockchip_gpio_regs	*gpio_regs;
-- 
2.25.1


_______________________________________________
Linux-rockchip mailing list
Linux-rockchip@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-rockchip

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH v3 2/2] pinctrl: rockchip: get match data by device_get_match_data
  2022-09-20  3:34 [PATCH v3 0/2] rockchip pinctrl for acpi Jianqun Xu
  2022-09-20  3:34 ` [PATCH v3 1/2] pinctrl: rockchip: find gpiochip by gpio label Jianqun Xu
@ 2022-09-20  3:34 ` Jianqun Xu
  1 sibling, 0 replies; 5+ messages in thread
From: Jianqun Xu @ 2022-09-20  3:34 UTC (permalink / raw)
  To: jbx6244, heiko, linus.walleij, andriy.shevchenko
  Cc: brgl, linux-gpio, linux-rockchip, Jianqun Xu

This patch fixes to use device_get_match_data to get match data, instead
of of_match_node to adapt for the acpi.

Signed-off-by: Jianqun Xu <jay.xu@rock-chips.com>
---
 drivers/pinctrl/pinctrl-rockchip.c | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/drivers/pinctrl/pinctrl-rockchip.c b/drivers/pinctrl/pinctrl-rockchip.c
index de86b2bc6380..51122b77fd01 100644
--- a/drivers/pinctrl/pinctrl-rockchip.c
+++ b/drivers/pinctrl/pinctrl-rockchip.c
@@ -3033,11 +3033,15 @@ static int rockchip_pinctrl_parse_dt(struct platform_device *pdev,
 					      struct rockchip_pinctrl *info)
 {
 	struct device *dev = &pdev->dev;
-	struct device_node *np = dev->of_node;
-	struct device_node *child;
+	struct fwnode_handle *fwnode = dev_fwnode(dev);
+	struct device_node *np, *child;
 	int ret;
 	int i;
 
+	if (!is_of_node(fwnode))
+		return 0;
+
+	np = to_of_node(fwnode);
 	rockchip_pinctrl_child_count(info, np);
 
 	dev_dbg(dev, "nfunctions = %d\n", info->nfunctions);
@@ -3129,15 +3133,11 @@ static struct rockchip_pin_ctrl *rockchip_pinctrl_get_soc_data(
 						struct platform_device *pdev)
 {
 	struct device *dev = &pdev->dev;
-	struct device_node *node = dev->of_node;
-	const struct of_device_id *match;
 	struct rockchip_pin_ctrl *ctrl;
 	struct rockchip_pin_bank *bank;
 	int grf_offs, pmu_offs, drv_grf_offs, drv_pmu_offs, i, j;
 
-	match = of_match_node(rockchip_pinctrl_dt_match, node);
-	ctrl = (struct rockchip_pin_ctrl *)match->data;
-
+	ctrl = (struct rockchip_pin_ctrl *)device_get_match_data(dev);
 	grf_offs = ctrl->grf_mux_offset;
 	pmu_offs = ctrl->pmu_mux_offset;
 	drv_pmu_offs = ctrl->pmu_drv_offset;
-- 
2.25.1


_______________________________________________
Linux-rockchip mailing list
Linux-rockchip@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-rockchip

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH v3 1/2] pinctrl: rockchip: find gpiochip by gpio label
  2022-09-20  3:34 ` [PATCH v3 1/2] pinctrl: rockchip: find gpiochip by gpio label Jianqun Xu
@ 2022-09-21 18:00   ` kernel test robot
  2022-09-21 20:22   ` kernel test robot
  1 sibling, 0 replies; 5+ messages in thread
From: kernel test robot @ 2022-09-21 18:00 UTC (permalink / raw)
  To: Jianqun Xu, jbx6244, heiko, linus.walleij, andriy.shevchenko
  Cc: llvm, kbuild-all, brgl, linux-gpio, linux-rockchip, Jianqun Xu

Hi Jianqun,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on rockchip/for-next]
[also build test ERROR on linus/master v6.0-rc6 next-20220921]
[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#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/Jianqun-Xu/rockchip-pinctrl-for-acpi/20220920-113519
base:   https://git.kernel.org/pub/scm/linux/kernel/git/mmind/linux-rockchip.git for-next
config: hexagon-randconfig-r031-20220920 (https://download.01.org/0day-ci/archive/20220922/202209220126.z3IFhBHk-lkp@intel.com/config)
compiler: clang version 16.0.0 (https://github.com/llvm/llvm-project 791a7ae1ba3efd6bca96338e10ffde557ba83920)
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
        # https://github.com/intel-lab-lkp/linux/commit/576939e7212366aa2cc7f5bb44f4f70bad577b4d
        git remote add linux-review https://github.com/intel-lab-lkp/linux
        git fetch --no-tags linux-review Jianqun-Xu/rockchip-pinctrl-for-acpi/20220920-113519
        git checkout 576939e7212366aa2cc7f5bb44f4f70bad577b4d
        # save the config file
        mkdir build_dir && cp config build_dir/.config
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=hexagon SHELL=/bin/bash drivers/pinctrl/

If you fix the issue, kindly add following tag where applicable
| Reported-by: kernel test robot <lkp@intel.com>

All errors (new ones prefixed by >>):

>> drivers/pinctrl/pinctrl-rockchip.c:3094:8: error: call to undeclared function 'gpiochip_find_by_name'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
                   gc = gpiochip_find_by_name((void *)ctrl->pin_banks[i].name);
                        ^
>> drivers/pinctrl/pinctrl-rockchip.c:3094:6: error: incompatible integer to pointer conversion assigning to 'struct gpio_chip *' from 'int' [-Wint-conversion]
                   gc = gpiochip_find_by_name((void *)ctrl->pin_banks[i].name);
                      ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   2 errors generated.


vim +/gpiochip_find_by_name +3094 drivers/pinctrl/pinctrl-rockchip.c

  3013	
  3014	static SIMPLE_DEV_PM_OPS(rockchip_pinctrl_dev_pm_ops, rockchip_pinctrl_suspend,
  3015				 rockchip_pinctrl_resume);
  3016	
  3017	static int rockchip_pinctrl_probe(struct platform_device *pdev)
  3018	{
  3019		struct device *dev = &pdev->dev;
  3020		struct fwnode_handle *fwnode = dev_fwnode(dev);
  3021		struct rockchip_pinctrl *info;
  3022		struct rockchip_pin_ctrl *ctrl;
  3023		struct device_node *np, *node;
  3024		struct resource *res;
  3025		void __iomem *base;
  3026		int ret, i;
  3027	
  3028		if (is_of_node(fwnode)) {
  3029			ret = of_platform_populate(to_of_node(fwnode), NULL, NULL, NULL);
  3030			if (ret)
  3031				return dev_err_probe(dev, ret, "failed to register gpio device\n");
  3032		}
  3033	
  3034		info = devm_kzalloc(dev, sizeof(*info), GFP_KERNEL);
  3035		if (!info)
  3036			return -ENOMEM;
  3037	
  3038		info->dev = dev;
  3039	
  3040		ctrl = rockchip_pinctrl_get_soc_data(info, pdev);
  3041		if (!ctrl)
  3042			return dev_err_probe(dev, -EINVAL, "driver data not available\n");
  3043		info->ctrl = ctrl;
  3044	
  3045		node = of_parse_phandle(np, "rockchip,grf", 0);
  3046		if (node) {
  3047			info->regmap_base = syscon_node_to_regmap(node);
  3048			of_node_put(node);
  3049			if (IS_ERR(info->regmap_base))
  3050				return PTR_ERR(info->regmap_base);
  3051		} else {
  3052			base = devm_platform_get_and_ioremap_resource(pdev, 0, &res);
  3053			if (IS_ERR(base))
  3054				return PTR_ERR(base);
  3055	
  3056			rockchip_regmap_config.max_register = resource_size(res) - 4;
  3057			rockchip_regmap_config.name = "rockchip,pinctrl";
  3058			info->regmap_base =
  3059				devm_regmap_init_mmio(dev, base, &rockchip_regmap_config);
  3060	
  3061			/* to check for the old dt-bindings */
  3062			info->reg_size = resource_size(res);
  3063	
  3064			/* Honor the old binding, with pull registers as 2nd resource */
  3065			if (ctrl->type == RK3188 && info->reg_size < 0x200) {
  3066				base = devm_platform_get_and_ioremap_resource(pdev, 1, &res);
  3067				if (IS_ERR(base))
  3068					return PTR_ERR(base);
  3069	
  3070				rockchip_regmap_config.max_register = resource_size(res) - 4;
  3071				rockchip_regmap_config.name = "rockchip,pinctrl-pull";
  3072				info->regmap_pull =
  3073					devm_regmap_init_mmio(dev, base, &rockchip_regmap_config);
  3074			}
  3075		}
  3076	
  3077		/* try to find the optional reference to the pmu syscon */
  3078		node = of_parse_phandle(np, "rockchip,pmu", 0);
  3079		if (node) {
  3080			info->regmap_pmu = syscon_node_to_regmap(node);
  3081			of_node_put(node);
  3082			if (IS_ERR(info->regmap_pmu))
  3083				return PTR_ERR(info->regmap_pmu);
  3084		}
  3085	
  3086		ret = rockchip_pinctrl_register(pdev, info);
  3087		if (ret)
  3088			return ret;
  3089	
  3090		for (i = 0; i < ctrl->nr_banks; i++) {
  3091			struct gpio_chip *gc;
  3092			struct rockchip_pin_bank *bank = &ctrl->pin_banks[i];
  3093	
> 3094			gc = gpiochip_find_by_name((void *)ctrl->pin_banks[i].name);
  3095			if (!gc) {
  3096				dev_err(dev, "fail to find gpiochip\n");
  3097				return ret;
  3098			}
  3099	
  3100			ret = gpiochip_add_pin_range(gc, dev_name(dev), 0, gc->base, gc->ngpio);
  3101			if (ret) {
  3102				dev_err(dev, "fail to add pin range\n");
  3103				return ret;
  3104			}
  3105			bank->gpio_chip = gc;
  3106		}
  3107	
  3108		platform_set_drvdata(pdev, info);
  3109		dev_info(dev, "probed %pfw\n", fwnode);
  3110	
  3111		return 0;
  3112	}
  3113	

-- 
0-DAY CI Kernel Test Service
https://01.org/lkp

_______________________________________________
Linux-rockchip mailing list
Linux-rockchip@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-rockchip

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH v3 1/2] pinctrl: rockchip: find gpiochip by gpio label
  2022-09-20  3:34 ` [PATCH v3 1/2] pinctrl: rockchip: find gpiochip by gpio label Jianqun Xu
  2022-09-21 18:00   ` kernel test robot
@ 2022-09-21 20:22   ` kernel test robot
  1 sibling, 0 replies; 5+ messages in thread
From: kernel test robot @ 2022-09-21 20:22 UTC (permalink / raw)
  To: Jianqun Xu, jbx6244, heiko, linus.walleij, andriy.shevchenko
  Cc: kbuild-all, brgl, linux-gpio, linux-rockchip, Jianqun Xu

Hi Jianqun,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on rockchip/for-next]
[also build test WARNING on linus/master v6.0-rc6 next-20220921]
[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#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/Jianqun-Xu/rockchip-pinctrl-for-acpi/20220920-113519
base:   https://git.kernel.org/pub/scm/linux/kernel/git/mmind/linux-rockchip.git for-next
config: loongarch-randconfig-r002-20220921 (https://download.01.org/0day-ci/archive/20220922/202209220454.AeRchWGY-lkp@intel.com/config)
compiler: loongarch64-linux-gcc (GCC) 12.1.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
        # https://github.com/intel-lab-lkp/linux/commit/576939e7212366aa2cc7f5bb44f4f70bad577b4d
        git remote add linux-review https://github.com/intel-lab-lkp/linux
        git fetch --no-tags linux-review Jianqun-Xu/rockchip-pinctrl-for-acpi/20220920-113519
        git checkout 576939e7212366aa2cc7f5bb44f4f70bad577b4d
        # save the config file
        mkdir build_dir && cp config build_dir/.config
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.1.0 make.cross W=1 O=build_dir ARCH=loongarch SHELL=/bin/bash drivers/gpio/ drivers/pinctrl/

If you fix the issue, kindly add following tag where applicable
| Reported-by: kernel test robot <lkp@intel.com>

All warnings (new ones prefixed by >>):

   drivers/pinctrl/pinctrl-rockchip.c: In function 'rockchip_pinctrl_probe':
   drivers/pinctrl/pinctrl-rockchip.c:3094:22: error: implicit declaration of function 'gpiochip_find_by_name' [-Werror=implicit-function-declaration]
    3094 |                 gc = gpiochip_find_by_name((void *)ctrl->pin_banks[i].name);
         |                      ^~~~~~~~~~~~~~~~~~~~~
>> drivers/pinctrl/pinctrl-rockchip.c:3094:20: warning: assignment to 'struct gpio_chip *' from 'int' makes pointer from integer without a cast [-Wint-conversion]
    3094 |                 gc = gpiochip_find_by_name((void *)ctrl->pin_banks[i].name);
         |                    ^
   cc1: some warnings being treated as errors


vim +3094 drivers/pinctrl/pinctrl-rockchip.c

  3013	
  3014	static SIMPLE_DEV_PM_OPS(rockchip_pinctrl_dev_pm_ops, rockchip_pinctrl_suspend,
  3015				 rockchip_pinctrl_resume);
  3016	
  3017	static int rockchip_pinctrl_probe(struct platform_device *pdev)
  3018	{
  3019		struct device *dev = &pdev->dev;
  3020		struct fwnode_handle *fwnode = dev_fwnode(dev);
  3021		struct rockchip_pinctrl *info;
  3022		struct rockchip_pin_ctrl *ctrl;
  3023		struct device_node *np, *node;
  3024		struct resource *res;
  3025		void __iomem *base;
  3026		int ret, i;
  3027	
  3028		if (is_of_node(fwnode)) {
  3029			ret = of_platform_populate(to_of_node(fwnode), NULL, NULL, NULL);
  3030			if (ret)
  3031				return dev_err_probe(dev, ret, "failed to register gpio device\n");
  3032		}
  3033	
  3034		info = devm_kzalloc(dev, sizeof(*info), GFP_KERNEL);
  3035		if (!info)
  3036			return -ENOMEM;
  3037	
  3038		info->dev = dev;
  3039	
  3040		ctrl = rockchip_pinctrl_get_soc_data(info, pdev);
  3041		if (!ctrl)
  3042			return dev_err_probe(dev, -EINVAL, "driver data not available\n");
  3043		info->ctrl = ctrl;
  3044	
  3045		node = of_parse_phandle(np, "rockchip,grf", 0);
  3046		if (node) {
  3047			info->regmap_base = syscon_node_to_regmap(node);
  3048			of_node_put(node);
  3049			if (IS_ERR(info->regmap_base))
  3050				return PTR_ERR(info->regmap_base);
  3051		} else {
  3052			base = devm_platform_get_and_ioremap_resource(pdev, 0, &res);
  3053			if (IS_ERR(base))
  3054				return PTR_ERR(base);
  3055	
  3056			rockchip_regmap_config.max_register = resource_size(res) - 4;
  3057			rockchip_regmap_config.name = "rockchip,pinctrl";
  3058			info->regmap_base =
  3059				devm_regmap_init_mmio(dev, base, &rockchip_regmap_config);
  3060	
  3061			/* to check for the old dt-bindings */
  3062			info->reg_size = resource_size(res);
  3063	
  3064			/* Honor the old binding, with pull registers as 2nd resource */
  3065			if (ctrl->type == RK3188 && info->reg_size < 0x200) {
  3066				base = devm_platform_get_and_ioremap_resource(pdev, 1, &res);
  3067				if (IS_ERR(base))
  3068					return PTR_ERR(base);
  3069	
  3070				rockchip_regmap_config.max_register = resource_size(res) - 4;
  3071				rockchip_regmap_config.name = "rockchip,pinctrl-pull";
  3072				info->regmap_pull =
  3073					devm_regmap_init_mmio(dev, base, &rockchip_regmap_config);
  3074			}
  3075		}
  3076	
  3077		/* try to find the optional reference to the pmu syscon */
  3078		node = of_parse_phandle(np, "rockchip,pmu", 0);
  3079		if (node) {
  3080			info->regmap_pmu = syscon_node_to_regmap(node);
  3081			of_node_put(node);
  3082			if (IS_ERR(info->regmap_pmu))
  3083				return PTR_ERR(info->regmap_pmu);
  3084		}
  3085	
  3086		ret = rockchip_pinctrl_register(pdev, info);
  3087		if (ret)
  3088			return ret;
  3089	
  3090		for (i = 0; i < ctrl->nr_banks; i++) {
  3091			struct gpio_chip *gc;
  3092			struct rockchip_pin_bank *bank = &ctrl->pin_banks[i];
  3093	
> 3094			gc = gpiochip_find_by_name((void *)ctrl->pin_banks[i].name);
  3095			if (!gc) {
  3096				dev_err(dev, "fail to find gpiochip\n");
  3097				return ret;
  3098			}
  3099	
  3100			ret = gpiochip_add_pin_range(gc, dev_name(dev), 0, gc->base, gc->ngpio);
  3101			if (ret) {
  3102				dev_err(dev, "fail to add pin range\n");
  3103				return ret;
  3104			}
  3105			bank->gpio_chip = gc;
  3106		}
  3107	
  3108		platform_set_drvdata(pdev, info);
  3109		dev_info(dev, "probed %pfw\n", fwnode);
  3110	
  3111		return 0;
  3112	}
  3113	

-- 
0-DAY CI Kernel Test Service
https://01.org/lkp

_______________________________________________
Linux-rockchip mailing list
Linux-rockchip@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-rockchip

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2022-09-21 20:23 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-09-20  3:34 [PATCH v3 0/2] rockchip pinctrl for acpi Jianqun Xu
2022-09-20  3:34 ` [PATCH v3 1/2] pinctrl: rockchip: find gpiochip by gpio label Jianqun Xu
2022-09-21 18:00   ` kernel test robot
2022-09-21 20:22   ` kernel test robot
2022-09-20  3:34 ` [PATCH v3 2/2] pinctrl: rockchip: get match data by device_get_match_data Jianqun Xu

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).