[v1,2/4] gpio: gpio-rockchip: add compatible string per SoC

Message ID 1510c02c-f640-9924-e42e-fa34e28a580f@gmail.com
State New
Headers
Series [v1,1/4] dt-bindings: gpio: rockchip,gpio-bank: add compatible string per SoC |

Commit Message

Johan Jonker Jan. 18, 2023, 12:14 p.m. UTC
  Currently all Rockchip gpio nodes have the same compatible.
Replace all the compatibles in gpio nodes to be able to
give them a consistent ID independent from probe order or alias.

Signed-off-by: Johan Jonker <jbx6244@gmail.com>
---

For now only add new compatibles.
No changes to rockchip_gpio_probe() function yet.
---
 drivers/gpio/gpio-rockchip.c | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

--
2.20.1
  

Comments

Bartosz Golaszewski Jan. 18, 2023, 2:14 p.m. UTC | #1
On Wed, Jan 18, 2023 at 1:14 PM Johan Jonker <jbx6244@gmail.com> wrote:
>
> Currently all Rockchip gpio nodes have the same compatible.
> Replace all the compatibles in gpio nodes to be able to
> give them a consistent ID independent from probe order or alias.
>
> Signed-off-by: Johan Jonker <jbx6244@gmail.com>
> ---
>
> For now only add new compatibles.
> No changes to rockchip_gpio_probe() function yet.
> ---
>  drivers/gpio/gpio-rockchip.c | 15 +++++++++++++++
>  1 file changed, 15 insertions(+)
>
> diff --git a/drivers/gpio/gpio-rockchip.c b/drivers/gpio/gpio-rockchip.c
> index e5de15a2a..493207de1 100644
> --- a/drivers/gpio/gpio-rockchip.c
> +++ b/drivers/gpio/gpio-rockchip.c
> @@ -790,7 +790,22 @@ static int rockchip_gpio_remove(struct platform_device *pdev)
>
>  static const struct of_device_id rockchip_gpio_match[] = {
>         { .compatible = "rockchip,gpio-bank", },
> +       { .compatible = "rockchip,px30-gpio-bank", },
> +       { .compatible = "rockchip,rk3036-gpio-bank", },
> +       { .compatible = "rockchip,rk3066a-gpio-bank", },
> +       { .compatible = "rockchip,rk3128-gpio-bank", },
> +       { .compatible = "rockchip,rk3188-gpio-bank", },
>         { .compatible = "rockchip,rk3188-gpio-bank0" },
> +       { .compatible = "rockchip,rk3228-gpio-bank", },
> +       { .compatible = "rockchip,rk3288-gpio-bank", },
> +       { .compatible = "rockchip,rk3328-gpio-bank", },
> +       { .compatible = "rockchip,rk3308-gpio-bank", },
> +       { .compatible = "rockchip,rk3368-gpio-bank", },
> +       { .compatible = "rockchip,rk3399-gpio-bank", },
> +       { .compatible = "rockchip,rk3568-gpio-bank", },
> +       { .compatible = "rockchip,rk3588-gpio-bank", },
> +       { .compatible = "rockchip,rv1108-gpio-bank", },
> +       { .compatible = "rockchip,rv1126-gpio-bank", },
>         { },
>  };
>
> --
> 2.20.1
>

If they don't have any additional data associated with each compatible
- why not just use "rockchip,gpio-bank" as the fallback in DT?

Bart
  
Krzysztof Kozlowski Jan. 18, 2023, 3:35 p.m. UTC | #2
On 18/01/2023 13:14, Johan Jonker wrote:
> Currently all Rockchip gpio nodes have the same compatible.
> Replace all the compatibles in gpio nodes to be able to
> give them a consistent ID independent from probe order or alias.
> 
> Signed-off-by: Johan Jonker <jbx6244@gmail.com>
> ---
> 
> For now only add new compatibles.
> No changes to rockchip_gpio_probe() function yet.
> ---
>  drivers/gpio/gpio-rockchip.c | 15 +++++++++++++++
>  1 file changed, 15 insertions(+)
> 
> diff --git a/drivers/gpio/gpio-rockchip.c b/drivers/gpio/gpio-rockchip.c
> index e5de15a2a..493207de1 100644
> --- a/drivers/gpio/gpio-rockchip.c
> +++ b/drivers/gpio/gpio-rockchip.c
> @@ -790,7 +790,22 @@ static int rockchip_gpio_remove(struct platform_device *pdev)
> 
>  static const struct of_device_id rockchip_gpio_match[] = {
>  	{ .compatible = "rockchip,gpio-bank", },
> +	{ .compatible = "rockchip,px30-gpio-bank", },
> +	{ .compatible = "rockchip,rk3036-gpio-bank", },
> +	{ .compatible = "rockchip,rk3066a-gpio-bank", },
> +	{ .compatible = "rockchip,rk3128-gpio-bank", },
> +	{ .compatible = "rockchip,rk3188-gpio-bank", },
>  	{ .compatible = "rockchip,rk3188-gpio-bank0" },
> +	{ .compatible = "rockchip,rk3228-gpio-bank", },
> +	{ .compatible = "rockchip,rk3288-gpio-bank", },
> +	{ .compatible = "rockchip,rk3328-gpio-bank", },
> +	{ .compatible = "rockchip,rk3308-gpio-bank", },
> +	{ .compatible = "rockchip,rk3368-gpio-bank", },
> +	{ .compatible = "rockchip,rk3399-gpio-bank", },
> +	{ .compatible = "rockchip,rk3568-gpio-bank", },
> +	{ .compatible = "rockchip,rk3588-gpio-bank", },
> +	{ .compatible = "rockchip,rv1108-gpio-bank", },
> +	{ .compatible = "rockchip,rv1126-gpio-bank", },

No, this list is useless. Entire patch should be dropped. Just use fallback.


Best regards,
Krzysztof
  

Patch

diff --git a/drivers/gpio/gpio-rockchip.c b/drivers/gpio/gpio-rockchip.c
index e5de15a2a..493207de1 100644
--- a/drivers/gpio/gpio-rockchip.c
+++ b/drivers/gpio/gpio-rockchip.c
@@ -790,7 +790,22 @@  static int rockchip_gpio_remove(struct platform_device *pdev)

 static const struct of_device_id rockchip_gpio_match[] = {
 	{ .compatible = "rockchip,gpio-bank", },
+	{ .compatible = "rockchip,px30-gpio-bank", },
+	{ .compatible = "rockchip,rk3036-gpio-bank", },
+	{ .compatible = "rockchip,rk3066a-gpio-bank", },
+	{ .compatible = "rockchip,rk3128-gpio-bank", },
+	{ .compatible = "rockchip,rk3188-gpio-bank", },
 	{ .compatible = "rockchip,rk3188-gpio-bank0" },
+	{ .compatible = "rockchip,rk3228-gpio-bank", },
+	{ .compatible = "rockchip,rk3288-gpio-bank", },
+	{ .compatible = "rockchip,rk3328-gpio-bank", },
+	{ .compatible = "rockchip,rk3308-gpio-bank", },
+	{ .compatible = "rockchip,rk3368-gpio-bank", },
+	{ .compatible = "rockchip,rk3399-gpio-bank", },
+	{ .compatible = "rockchip,rk3568-gpio-bank", },
+	{ .compatible = "rockchip,rk3588-gpio-bank", },
+	{ .compatible = "rockchip,rv1108-gpio-bank", },
+	{ .compatible = "rockchip,rv1126-gpio-bank", },
 	{ },
 };