All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 RESEND 0/2] rockchip pinctrl for acpi
@ 2022-09-17  6:09 ` Jianqun Xu
  0 siblings, 0 replies; 17+ messages in thread
From: Jianqun Xu @ 2022-09-17  6:09 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 name from gpio module
  pinctrl: rockchip: get match data by device_get_match_data

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

-- 
v2:
- add a second patch to support acpi

2.25.1


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

* [PATCH v2 RESEND 0/2] rockchip pinctrl for acpi
@ 2022-09-17  6:09 ` Jianqun Xu
  0 siblings, 0 replies; 17+ messages in thread
From: Jianqun Xu @ 2022-09-17  6:09 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 name from gpio module
  pinctrl: rockchip: get match data by device_get_match_data

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

-- 
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] 17+ messages in thread

* [PATCH v2 1/2] pinctrl: rockchip: find gpiochip by name from gpio module
  2022-09-17  6:09 ` Jianqun Xu
@ 2022-09-17  6:09   ` Jianqun Xu
  -1 siblings, 0 replies; 17+ messages in thread
From: Jianqun Xu @ 2022-09-17  6:09 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. And get gpiochips througth a
find function by the gpio label.

Signed-off-by: Jianqun Xu <jay.xu@rock-chips.com>
---
v2 RESEND:
- first version RESEND

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

diff --git a/drivers/pinctrl/pinctrl-rockchip.c b/drivers/pinctrl/pinctrl-rockchip.c
index a91061f9c2ac..5b828798bfa5 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;
@@ -3289,18 +3289,29 @@ static int __maybe_unused rockchip_pinctrl_resume(struct device *dev)
 static SIMPLE_DEV_PM_OPS(rockchip_pinctrl_dev_pm_ops, rockchip_pinctrl_suspend,
 			 rockchip_pinctrl_resume);
 
+static int gpiochip_match_name(struct gpio_chip *gc, void *data)
+{
+	const char *name = data;
+
+	return !strcmp(gc->label, name);
+}
+
 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(np, 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 +3369,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((void *)ctrl->pin_banks[i].name, gpiochip_match_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


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

* [PATCH v2 1/2] pinctrl: rockchip: find gpiochip by name from gpio module
@ 2022-09-17  6:09   ` Jianqun Xu
  0 siblings, 0 replies; 17+ messages in thread
From: Jianqun Xu @ 2022-09-17  6:09 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. And get gpiochips througth a
find function by the gpio label.

Signed-off-by: Jianqun Xu <jay.xu@rock-chips.com>
---
v2 RESEND:
- first version RESEND

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

diff --git a/drivers/pinctrl/pinctrl-rockchip.c b/drivers/pinctrl/pinctrl-rockchip.c
index a91061f9c2ac..5b828798bfa5 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;
@@ -3289,18 +3289,29 @@ static int __maybe_unused rockchip_pinctrl_resume(struct device *dev)
 static SIMPLE_DEV_PM_OPS(rockchip_pinctrl_dev_pm_ops, rockchip_pinctrl_suspend,
 			 rockchip_pinctrl_resume);
 
+static int gpiochip_match_name(struct gpio_chip *gc, void *data)
+{
+	const char *name = data;
+
+	return !strcmp(gc->label, name);
+}
+
 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(np, 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 +3369,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((void *)ctrl->pin_banks[i].name, gpiochip_match_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] 17+ messages in thread

* [PATCH v2 2/2] pinctrl: rockchip: get match data by device_get_match_data
  2022-09-17  6:09 ` Jianqun Xu
@ 2022-09-17  6:09   ` Jianqun Xu
  -1 siblings, 0 replies; 17+ messages in thread
From: Jianqun Xu @ 2022-09-17  6:09 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>
---
v2 RESEND:
- use fwnode instead of of node
- add a second patch to this serail

 drivers/pinctrl/pinctrl-rockchip.c | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/drivers/pinctrl/pinctrl-rockchip.c b/drivers/pinctrl/pinctrl-rockchip.c
index 5b828798bfa5..0ecb84d8dd2a 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(&pdev->dev);
 	grf_offs = ctrl->grf_mux_offset;
 	pmu_offs = ctrl->pmu_mux_offset;
 	drv_pmu_offs = ctrl->pmu_drv_offset;
@@ -3308,7 +3308,7 @@ static int rockchip_pinctrl_probe(struct platform_device *pdev)
 	int ret, i;
 
 	if (is_of_node(fwnode)) {
-		ret = of_platform_populate(np, NULL, NULL, NULL);
+		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");
 	}
-- 
2.25.1


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

* [PATCH v2 2/2] pinctrl: rockchip: get match data by device_get_match_data
@ 2022-09-17  6:09   ` Jianqun Xu
  0 siblings, 0 replies; 17+ messages in thread
From: Jianqun Xu @ 2022-09-17  6:09 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>
---
v2 RESEND:
- use fwnode instead of of node
- add a second patch to this serail

 drivers/pinctrl/pinctrl-rockchip.c | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/drivers/pinctrl/pinctrl-rockchip.c b/drivers/pinctrl/pinctrl-rockchip.c
index 5b828798bfa5..0ecb84d8dd2a 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(&pdev->dev);
 	grf_offs = ctrl->grf_mux_offset;
 	pmu_offs = ctrl->pmu_mux_offset;
 	drv_pmu_offs = ctrl->pmu_drv_offset;
@@ -3308,7 +3308,7 @@ static int rockchip_pinctrl_probe(struct platform_device *pdev)
 	int ret, i;
 
 	if (is_of_node(fwnode)) {
-		ret = of_platform_populate(np, NULL, NULL, NULL);
+		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");
 	}
-- 
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] 17+ messages in thread

* Re: [PATCH v2 RESEND 0/2] rockchip pinctrl for acpi
  2022-09-17  6:09 ` Jianqun Xu
@ 2022-09-20  9:26   ` Linus Walleij
  -1 siblings, 0 replies; 17+ messages in thread
From: Linus Walleij @ 2022-09-20  9:26 UTC (permalink / raw)
  To: Jianqun Xu
  Cc: jbx6244, heiko, andriy.shevchenko, brgl, linux-gpio, linux-rockchip

On Sat, Sep 17, 2022 at 8:09 AM Jianqun Xu <jay.xu@rock-chips.com> wrote:

> 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 name from gpio module
>   pinctrl: rockchip: get match data by device_get_match_data

These look OK to me but I would feel better if Heiko or Andy ACK:ed
them so I give them a few more days to comment.

Yours,
Linus Walleij

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

* Re: [PATCH v2 RESEND 0/2] rockchip pinctrl for acpi
@ 2022-09-20  9:26   ` Linus Walleij
  0 siblings, 0 replies; 17+ messages in thread
From: Linus Walleij @ 2022-09-20  9:26 UTC (permalink / raw)
  To: Jianqun Xu
  Cc: jbx6244, heiko, andriy.shevchenko, brgl, linux-gpio, linux-rockchip

On Sat, Sep 17, 2022 at 8:09 AM Jianqun Xu <jay.xu@rock-chips.com> wrote:

> 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 name from gpio module
>   pinctrl: rockchip: get match data by device_get_match_data

These look OK to me but I would feel better if Heiko or Andy ACK:ed
them so I give them a few more days to comment.

Yours,
Linus Walleij

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

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

* Re: [PATCH v2 RESEND 0/2] rockchip pinctrl for acpi
  2022-09-20  9:26   ` Linus Walleij
@ 2022-09-23 10:26     ` Heiko Stuebner
  -1 siblings, 0 replies; 17+ messages in thread
From: Heiko Stuebner @ 2022-09-23 10:26 UTC (permalink / raw)
  To: Jianqun Xu, Linus Walleij
  Cc: jbx6244, andriy.shevchenko, brgl, linux-gpio, linux-rockchip

Am Dienstag, 20. September 2022, 11:26:26 CEST schrieb Linus Walleij:
> On Sat, Sep 17, 2022 at 8:09 AM Jianqun Xu <jay.xu@rock-chips.com> wrote:
> 
> > 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 name from gpio module
> >   pinctrl: rockchip: get match data by device_get_match_data
> 
> These look OK to me but I would feel better if Heiko or Andy ACK:ed
> them so I give them a few more days to comment.

Right now I'm actually quite confused as I seem to have a bunch
of pinctrl/gpio-acpi patchsets of varying lengths in my inbox.

There is a "v2", a "v8", a 20-patchset without version.
It's all quite confusing.


Heiko



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

* Re: [PATCH v2 RESEND 0/2] rockchip pinctrl for acpi
@ 2022-09-23 10:26     ` Heiko Stuebner
  0 siblings, 0 replies; 17+ messages in thread
From: Heiko Stuebner @ 2022-09-23 10:26 UTC (permalink / raw)
  To: Jianqun Xu, Linus Walleij
  Cc: jbx6244, andriy.shevchenko, brgl, linux-gpio, linux-rockchip

Am Dienstag, 20. September 2022, 11:26:26 CEST schrieb Linus Walleij:
> On Sat, Sep 17, 2022 at 8:09 AM Jianqun Xu <jay.xu@rock-chips.com> wrote:
> 
> > 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 name from gpio module
> >   pinctrl: rockchip: get match data by device_get_match_data
> 
> These look OK to me but I would feel better if Heiko or Andy ACK:ed
> them so I give them a few more days to comment.

Right now I'm actually quite confused as I seem to have a bunch
of pinctrl/gpio-acpi patchsets of varying lengths in my inbox.

There is a "v2", a "v8", a 20-patchset without version.
It's all quite confusing.


Heiko



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

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

* Re: [PATCH v2 RESEND 0/2] rockchip pinctrl for acpi
  2022-09-23 10:26     ` Heiko Stuebner
@ 2022-09-23 10:33       ` Andy Shevchenko
  -1 siblings, 0 replies; 17+ messages in thread
From: Andy Shevchenko @ 2022-09-23 10:33 UTC (permalink / raw)
  To: Heiko Stuebner
  Cc: Jianqun Xu, Linus Walleij, jbx6244, brgl, linux-gpio, linux-rockchip

On Fri, Sep 23, 2022 at 12:26:06PM +0200, Heiko Stuebner wrote:
> Am Dienstag, 20. September 2022, 11:26:26 CEST schrieb Linus Walleij:
> > On Sat, Sep 17, 2022 at 8:09 AM Jianqun Xu <jay.xu@rock-chips.com> wrote:
> > 
> > > 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 name from gpio module
> > >   pinctrl: rockchip: get match data by device_get_match_data
> > 
> > These look OK to me but I would feel better if Heiko or Andy ACK:ed
> > them so I give them a few more days to comment.
> 
> Right now I'm actually quite confused as I seem to have a bunch
> of pinctrl/gpio-acpi patchsets of varying lengths in my inbox.
> 
> There is a "v2", a "v8", a 20-patchset without version.
> It's all quite confusing.

With the LKP complains on top of almost each series...

That's why I stopped considering them seriously (like some RFC is going on)
and no more reviewing.

I can suggest the author to create a branch on a public tree and collect all
series together (like topic branches that are merged one-by-one to the main
topic branch) and start again.

-- 
With Best Regards,
Andy Shevchenko



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

* Re: [PATCH v2 RESEND 0/2] rockchip pinctrl for acpi
@ 2022-09-23 10:33       ` Andy Shevchenko
  0 siblings, 0 replies; 17+ messages in thread
From: Andy Shevchenko @ 2022-09-23 10:33 UTC (permalink / raw)
  To: Heiko Stuebner
  Cc: Jianqun Xu, Linus Walleij, jbx6244, brgl, linux-gpio, linux-rockchip

On Fri, Sep 23, 2022 at 12:26:06PM +0200, Heiko Stuebner wrote:
> Am Dienstag, 20. September 2022, 11:26:26 CEST schrieb Linus Walleij:
> > On Sat, Sep 17, 2022 at 8:09 AM Jianqun Xu <jay.xu@rock-chips.com> wrote:
> > 
> > > 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 name from gpio module
> > >   pinctrl: rockchip: get match data by device_get_match_data
> > 
> > These look OK to me but I would feel better if Heiko or Andy ACK:ed
> > them so I give them a few more days to comment.
> 
> Right now I'm actually quite confused as I seem to have a bunch
> of pinctrl/gpio-acpi patchsets of varying lengths in my inbox.
> 
> There is a "v2", a "v8", a 20-patchset without version.
> It's all quite confusing.

With the LKP complains on top of almost each series...

That's why I stopped considering them seriously (like some RFC is going on)
and no more reviewing.

I can suggest the author to create a branch on a public tree and collect all
series together (like topic branches that are merged one-by-one to the main
topic branch) and start again.

-- 
With Best Regards,
Andy Shevchenko



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

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

* Re: Re: [PATCH v2 RESEND 0/2] rockchip pinctrl for acpi
  2022-09-23 10:26     ` Heiko Stuebner
  (?)
  (?)
@ 2022-09-23 10:35     ` jay.xu
  2022-09-23 10:50         ` Heiko Stuebner
  -1 siblings, 1 reply; 17+ messages in thread
From: jay.xu @ 2022-09-23 10:35 UTC (permalink / raw)
  To: Heiko Stübner, linus.walleij
  Cc: Johan Jonker, Andy Shevchenko, Bartosz Golaszewski, linux-gpio,
	open list:ARM/Rockchip SoC...

Hi heiko

--------------
jay.xu@rock-chips.com
>Am Dienstag, 20. September 2022, 11:26:26 CEST schrieb Linus Walleij:
>> On Sat, Sep 17, 2022 at 8:09 AM Jianqun Xu <jay.xu@rock-chips.com> wrote:
>>
>> > 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 name from gpio module
>> >   pinctrl: rockchip: get match data by device_get_match_data
>>
>> These look OK to me but I would feel better if Heiko or Andy ACK:ed
>> them so I give them a few more days to comment.
>
>Right now I'm actually quite confused as I seem to have a bunch
>of pinctrl/gpio-acpi patchsets of varying lengths in my inbox.
>
>There is a "v2", a "v8", a 20-patchset without version.
>It's all quite confusing.
> 
From v2 to v8, I summit fixes in one patch, and them sugguested by Andy, I try to separate them
into small patches 20-patchset.

The heart change is 

current
1. pinctrl register first
2. gpiochip register and find pinctrl device to add pin range

this patch fix to
1. gpiochip register itself
2. pinctrl register and find all gpiochips and add pin range

Please help to review directly to 20-patchset, I will add some suggested-by and acked-by later


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

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

* Re: [PATCH v2 RESEND 0/2] rockchip pinctrl for acpi
  2022-09-23 10:35     ` jay.xu
@ 2022-09-23 10:50         ` Heiko Stuebner
  0 siblings, 0 replies; 17+ messages in thread
From: Heiko Stuebner @ 2022-09-23 10:50 UTC (permalink / raw)
  To: linus. walleij, jay.xu
  Cc: Johan Jonker, Andy Shevchenko, Bartosz Golaszewski, linux-gpio,
	open list:ARM/Rockchip SoC...

Hi Jay,

Am Freitag, 23. September 2022, 12:35:36 CEST schrieb jay.xu@rock-chips.com:
> Hi heiko
> 
> --------------
> jay.xu@rock-chips.com
> >Am Dienstag, 20. September 2022, 11:26:26 CEST schrieb Linus Walleij:
> >> On Sat, Sep 17, 2022 at 8:09 AM Jianqun Xu <jay.xu@rock-chips.com> wrote:
> >>
> >> > 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 name from gpio module
> >> >   pinctrl: rockchip: get match data by device_get_match_data
> >>
> >> These look OK to me but I would feel better if Heiko or Andy ACK:ed
> >> them so I give them a few more days to comment.
> >
> >Right now I'm actually quite confused as I seem to have a bunch
> >of pinctrl/gpio-acpi patchsets of varying lengths in my inbox.
> >
> >There is a "v2", a "v8", a 20-patchset without version.
> >It's all quite confusing.
> > 
> From v2 to v8, I summit fixes in one patch, and them sugguested by Andy, I try to separate them
> into small patches 20-patchset.
> 
> The heart change is 
> 
> current
> 1. pinctrl register first
> 2. gpiochip register and find pinctrl device to add pin range
> 
> this patch fix to
> 1. gpiochip register itself
> 2. pinctrl register and find all gpiochips and add pin range
> 
> Please help to review directly to 20-patchset, I will add some suggested-by and acked-by later

ok, I'll drop all the other acpi/pinctrl/gpio sets and move to the 20-patch-series.

Thanks for the clarification
Heiko



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

* Re: [PATCH v2 RESEND 0/2] rockchip pinctrl for acpi
@ 2022-09-23 10:50         ` Heiko Stuebner
  0 siblings, 0 replies; 17+ messages in thread
From: Heiko Stuebner @ 2022-09-23 10:50 UTC (permalink / raw)
  To: linus. walleij, jay.xu
  Cc: Johan Jonker, Andy Shevchenko, Bartosz Golaszewski, linux-gpio,
	open list:ARM/Rockchip SoC...

Hi Jay,

Am Freitag, 23. September 2022, 12:35:36 CEST schrieb jay.xu@rock-chips.com:
> Hi heiko
> 
> --------------
> jay.xu@rock-chips.com
> >Am Dienstag, 20. September 2022, 11:26:26 CEST schrieb Linus Walleij:
> >> On Sat, Sep 17, 2022 at 8:09 AM Jianqun Xu <jay.xu@rock-chips.com> wrote:
> >>
> >> > 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 name from gpio module
> >> >   pinctrl: rockchip: get match data by device_get_match_data
> >>
> >> These look OK to me but I would feel better if Heiko or Andy ACK:ed
> >> them so I give them a few more days to comment.
> >
> >Right now I'm actually quite confused as I seem to have a bunch
> >of pinctrl/gpio-acpi patchsets of varying lengths in my inbox.
> >
> >There is a "v2", a "v8", a 20-patchset without version.
> >It's all quite confusing.
> > 
> From v2 to v8, I summit fixes in one patch, and them sugguested by Andy, I try to separate them
> into small patches 20-patchset.
> 
> The heart change is 
> 
> current
> 1. pinctrl register first
> 2. gpiochip register and find pinctrl device to add pin range
> 
> this patch fix to
> 1. gpiochip register itself
> 2. pinctrl register and find all gpiochips and add pin range
> 
> Please help to review directly to 20-patchset, I will add some suggested-by and acked-by later

ok, I'll drop all the other acpi/pinctrl/gpio sets and move to the 20-patch-series.

Thanks for the clarification
Heiko



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

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

* [PATCH v2 2/2] pinctrl: rockchip: get match data by device_get_match_data
  2022-09-17  3:32 [PATCH v2 " Jianqun Xu
@ 2022-09-17  3:32   ` Jianqun Xu
  0 siblings, 0 replies; 17+ messages in thread
From: Jianqun Xu @ 2022-09-17  3:32 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>
---
v2:
 - use fwnode instead of of node
 - add a second patch to this serail

 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 5b828798bfa5..11b9634063bb 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(&pdev->dev);
 	grf_offs = ctrl->grf_mux_offset;
 	pmu_offs = ctrl->pmu_mux_offset;
 	drv_pmu_offs = ctrl->pmu_drv_offset;
-- 
2.25.1


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

* [PATCH v2 2/2] pinctrl: rockchip: get match data by device_get_match_data
@ 2022-09-17  3:32   ` Jianqun Xu
  0 siblings, 0 replies; 17+ messages in thread
From: Jianqun Xu @ 2022-09-17  3:32 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>
---
v2:
 - use fwnode instead of of node
 - add a second patch to this serail

 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 5b828798bfa5..11b9634063bb 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(&pdev->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] 17+ messages in thread

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

Thread overview: 17+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-09-17  6:09 [PATCH v2 RESEND 0/2] rockchip pinctrl for acpi Jianqun Xu
2022-09-17  6:09 ` Jianqun Xu
2022-09-17  6:09 ` [PATCH v2 1/2] pinctrl: rockchip: find gpiochip by name from gpio module Jianqun Xu
2022-09-17  6:09   ` Jianqun Xu
2022-09-17  6:09 ` [PATCH v2 2/2] pinctrl: rockchip: get match data by device_get_match_data Jianqun Xu
2022-09-17  6:09   ` Jianqun Xu
2022-09-20  9:26 ` [PATCH v2 RESEND 0/2] rockchip pinctrl for acpi Linus Walleij
2022-09-20  9:26   ` Linus Walleij
2022-09-23 10:26   ` Heiko Stuebner
2022-09-23 10:26     ` Heiko Stuebner
2022-09-23 10:33     ` Andy Shevchenko
2022-09-23 10:33       ` Andy Shevchenko
2022-09-23 10:35     ` jay.xu
2022-09-23 10:50       ` Heiko Stuebner
2022-09-23 10:50         ` Heiko Stuebner
  -- strict thread matches above, loose matches on Subject: below --
2022-09-17  3:32 [PATCH v2 " Jianqun Xu
2022-09-17  3:32 ` [PATCH v2 2/2] pinctrl: rockchip: get match data by device_get_match_data Jianqun Xu
2022-09-17  3:32   ` Jianqun Xu

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.