* [PATCH v4 1/4] gpio: rockchip: explan the format of the GPIO version ID
2024-11-11 2:34 [PATCH v4 0/4] gpio: rockchip: Update the GPIO driver Ye Zhang
@ 2024-11-11 2:34 ` Ye Zhang
2024-11-11 9:46 ` Andy Shevchenko
` (2 more replies)
2024-11-11 2:34 ` [PATCH v4 2/4] gpio: rockchip: change the GPIO version judgment logic Ye Zhang
` (2 subsequent siblings)
3 siblings, 3 replies; 15+ messages in thread
From: Ye Zhang @ 2024-11-11 2:34 UTC (permalink / raw)
To: Ye Zhang, linus.walleij, brgl, heiko, linux-gpio, linux-arm-kernel
Cc: linux-rockchip, linux-kernel, mika.westerberg, andriy.shevchenko,
tao.huang, finley.xiao, tim.chen, elaine.zhang
Remove redundant comments and provide a detailed explanation of the
GPIO version ID.
Signed-off-by: Ye Zhang <ye.zhang@rock-chips.com>
---
drivers/gpio/gpio-rockchip.c | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/drivers/gpio/gpio-rockchip.c b/drivers/gpio/gpio-rockchip.c
index 365ab947983c..71672d654491 100644
--- a/drivers/gpio/gpio-rockchip.c
+++ b/drivers/gpio/gpio-rockchip.c
@@ -26,9 +26,15 @@
#include "../pinctrl/core.h"
#include "../pinctrl/pinctrl-rockchip.h"
+/*
+ * Version ID Register
+ * Bits [31:24] - Major Version
+ * Bits [23:16] - Minor Version
+ * Bits [15:0] - SVN Number
+ */
#define GPIO_TYPE_V1 (0) /* GPIO Version ID reserved */
-#define GPIO_TYPE_V2 (0x01000C2B) /* GPIO Version ID 0x01000C2B */
-#define GPIO_TYPE_V2_1 (0x0101157C) /* GPIO Version ID 0x0101157C */
+#define GPIO_TYPE_V2 (0x01000C2B)
+#define GPIO_TYPE_V2_1 (0x0101157C)
static const struct rockchip_gpio_regs gpio_regs_v1 = {
.port_dr = 0x00,
--
2.34.1
^ permalink raw reply [flat|nested] 15+ messages in thread* Re: [PATCH v4 1/4] gpio: rockchip: explan the format of the GPIO version ID
2024-11-11 2:34 ` [PATCH v4 1/4] gpio: rockchip: explan the format of the GPIO version ID Ye Zhang
@ 2024-11-11 9:46 ` Andy Shevchenko
2024-11-11 22:24 ` Sebastian Reichel
2024-11-13 13:23 ` Linus Walleij
2 siblings, 0 replies; 15+ messages in thread
From: Andy Shevchenko @ 2024-11-11 9:46 UTC (permalink / raw)
To: Ye Zhang
Cc: linus.walleij, brgl, heiko, linux-gpio, linux-arm-kernel,
linux-rockchip, linux-kernel, mika.westerberg, tao.huang,
finley.xiao, tim.chen, elaine.zhang
On Mon, Nov 11, 2024 at 10:34:09AM +0800, Ye Zhang wrote:
> Remove redundant comments and provide a detailed explanation of the
> GPIO version ID.
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
--
With Best Regards,
Andy Shevchenko
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH v4 1/4] gpio: rockchip: explan the format of the GPIO version ID
2024-11-11 2:34 ` [PATCH v4 1/4] gpio: rockchip: explan the format of the GPIO version ID Ye Zhang
2024-11-11 9:46 ` Andy Shevchenko
@ 2024-11-11 22:24 ` Sebastian Reichel
2024-11-13 13:23 ` Linus Walleij
2 siblings, 0 replies; 15+ messages in thread
From: Sebastian Reichel @ 2024-11-11 22:24 UTC (permalink / raw)
To: Ye Zhang
Cc: linus.walleij, brgl, heiko, linux-gpio, linux-arm-kernel,
linux-rockchip, linux-kernel, mika.westerberg, andriy.shevchenko,
tao.huang, finley.xiao, tim.chen, elaine.zhang
[-- Attachment #1: Type: text/plain, Size: 1270 bytes --]
Hi,
On Mon, Nov 11, 2024 at 10:34:09AM +0800, Ye Zhang wrote:
> Remove redundant comments and provide a detailed explanation of the
> GPIO version ID.
>
> Signed-off-by: Ye Zhang <ye.zhang@rock-chips.com>
> ---
Reviewed-by: Sebastian Reichel <sebastian.reichel@collabora.com>
-- Sebastian
> drivers/gpio/gpio-rockchip.c | 10 ++++++++--
> 1 file changed, 8 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/gpio/gpio-rockchip.c b/drivers/gpio/gpio-rockchip.c
> index 365ab947983c..71672d654491 100644
> --- a/drivers/gpio/gpio-rockchip.c
> +++ b/drivers/gpio/gpio-rockchip.c
> @@ -26,9 +26,15 @@
> #include "../pinctrl/core.h"
> #include "../pinctrl/pinctrl-rockchip.h"
>
> +/*
> + * Version ID Register
> + * Bits [31:24] - Major Version
> + * Bits [23:16] - Minor Version
> + * Bits [15:0] - SVN Number
> + */
> #define GPIO_TYPE_V1 (0) /* GPIO Version ID reserved */
> -#define GPIO_TYPE_V2 (0x01000C2B) /* GPIO Version ID 0x01000C2B */
> -#define GPIO_TYPE_V2_1 (0x0101157C) /* GPIO Version ID 0x0101157C */
> +#define GPIO_TYPE_V2 (0x01000C2B)
> +#define GPIO_TYPE_V2_1 (0x0101157C)
>
> static const struct rockchip_gpio_regs gpio_regs_v1 = {
> .port_dr = 0x00,
> --
> 2.34.1
>
>
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
^ permalink raw reply [flat|nested] 15+ messages in thread* Re: [PATCH v4 1/4] gpio: rockchip: explan the format of the GPIO version ID
2024-11-11 2:34 ` [PATCH v4 1/4] gpio: rockchip: explan the format of the GPIO version ID Ye Zhang
2024-11-11 9:46 ` Andy Shevchenko
2024-11-11 22:24 ` Sebastian Reichel
@ 2024-11-13 13:23 ` Linus Walleij
2 siblings, 0 replies; 15+ messages in thread
From: Linus Walleij @ 2024-11-13 13:23 UTC (permalink / raw)
To: Ye Zhang
Cc: brgl, heiko, linux-gpio, linux-arm-kernel, linux-rockchip,
linux-kernel, mika.westerberg, andriy.shevchenko, tao.huang,
finley.xiao, tim.chen, elaine.zhang
On Mon, Nov 11, 2024 at 3:34 AM Ye Zhang <ye.zhang@rock-chips.com> wrote:
> Remove redundant comments and provide a detailed explanation of the
> GPIO version ID.
>
> Signed-off-by: Ye Zhang <ye.zhang@rock-chips.com>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Yours,
Linus Walleij
^ permalink raw reply [flat|nested] 15+ messages in thread
* [PATCH v4 2/4] gpio: rockchip: change the GPIO version judgment logic
2024-11-11 2:34 [PATCH v4 0/4] gpio: rockchip: Update the GPIO driver Ye Zhang
2024-11-11 2:34 ` [PATCH v4 1/4] gpio: rockchip: explan the format of the GPIO version ID Ye Zhang
@ 2024-11-11 2:34 ` Ye Zhang
2024-11-11 9:48 ` Andy Shevchenko
2024-11-11 23:01 ` Sebastian Reichel
2024-11-11 2:34 ` [PATCH v4 3/4] gpio: rockchip: support new version GPIO Ye Zhang
2024-11-11 2:34 ` [PATCH v4 4/4] gpio: rockchip: Set input direction when request irq Ye Zhang
3 siblings, 2 replies; 15+ messages in thread
From: Ye Zhang @ 2024-11-11 2:34 UTC (permalink / raw)
To: Ye Zhang, linus.walleij, brgl, heiko, linux-gpio, linux-arm-kernel
Cc: linux-rockchip, linux-kernel, mika.westerberg, andriy.shevchenko,
tao.huang, finley.xiao, tim.chen, elaine.zhang
Have a list of valid IDs and default to -ENODEV.
Signed-off-by: Ye Zhang <ye.zhang@rock-chips.com>
---
drivers/gpio/gpio-rockchip.c | 16 +++++++++++-----
1 file changed, 11 insertions(+), 5 deletions(-)
diff --git a/drivers/gpio/gpio-rockchip.c b/drivers/gpio/gpio-rockchip.c
index 71672d654491..f05b92e0e977 100644
--- a/drivers/gpio/gpio-rockchip.c
+++ b/drivers/gpio/gpio-rockchip.c
@@ -667,8 +667,13 @@ static int rockchip_get_bank_data(struct rockchip_pin_bank *bank)
clk_prepare_enable(bank->clk);
id = readl(bank->reg_base + gpio_regs_v2.version_id);
- /* If not gpio v2, that is default to v1. */
- if (id == GPIO_TYPE_V2 || id == GPIO_TYPE_V2_1) {
+ switch (id) {
+ case GPIO_TYPE_V1:
+ bank->gpio_regs = &gpio_regs_v1;
+ bank->gpio_type = GPIO_TYPE_V1;
+ break;
+ case GPIO_TYPE_V2:
+ case GPIO_TYPE_V2_1:
bank->gpio_regs = &gpio_regs_v2;
bank->gpio_type = GPIO_TYPE_V2;
bank->db_clk = of_clk_get(bank->of_node, 1);
@@ -677,9 +682,10 @@ static int rockchip_get_bank_data(struct rockchip_pin_bank *bank)
clk_disable_unprepare(bank->clk);
return -EINVAL;
}
- } else {
- bank->gpio_regs = &gpio_regs_v1;
- bank->gpio_type = GPIO_TYPE_V1;
+ break;
+ default:
+ dev_err(bank->dev, "cannot get the version ID\n");
+ return -ENODEV;
}
return 0;
--
2.34.1
^ permalink raw reply [flat|nested] 15+ messages in thread* Re: [PATCH v4 2/4] gpio: rockchip: change the GPIO version judgment logic
2024-11-11 2:34 ` [PATCH v4 2/4] gpio: rockchip: change the GPIO version judgment logic Ye Zhang
@ 2024-11-11 9:48 ` Andy Shevchenko
2024-11-11 23:01 ` Sebastian Reichel
1 sibling, 0 replies; 15+ messages in thread
From: Andy Shevchenko @ 2024-11-11 9:48 UTC (permalink / raw)
To: Ye Zhang
Cc: linus.walleij, brgl, heiko, linux-gpio, linux-arm-kernel,
linux-rockchip, linux-kernel, mika.westerberg, tao.huang,
finley.xiao, tim.chen, elaine.zhang
On Mon, Nov 11, 2024 at 10:34:10AM +0800, Ye Zhang wrote:
> Have a list of valid IDs and default to -ENODEV.
...
> - /* If not gpio v2, that is default to v1. */
> - if (id == GPIO_TYPE_V2 || id == GPIO_TYPE_V2_1) {
> + switch (id) {
> + case GPIO_TYPE_V1:
If you leave the V2 case first...
> + bank->gpio_regs = &gpio_regs_v1;
> + bank->gpio_type = GPIO_TYPE_V1;
> + break;
> + case GPIO_TYPE_V2:
> + case GPIO_TYPE_V2_1:
...and the v1 case last, the whole diff will be much more understandable and
reviewable.
> bank->gpio_regs = &gpio_regs_v2;
> bank->gpio_type = GPIO_TYPE_V2;
> bank->db_clk = of_clk_get(bank->of_node, 1);
> @@ -677,9 +682,10 @@ static int rockchip_get_bank_data(struct rockchip_pin_bank *bank)
> clk_disable_unprepare(bank->clk);
> return -EINVAL;
> }
> - } else {
> - bank->gpio_regs = &gpio_regs_v1;
> - bank->gpio_type = GPIO_TYPE_V1;
> + break;
> + default:
> + dev_err(bank->dev, "cannot get the version ID\n");
> + return -ENODEV;
> }
--
With Best Regards,
Andy Shevchenko
^ permalink raw reply [flat|nested] 15+ messages in thread* Re: [PATCH v4 2/4] gpio: rockchip: change the GPIO version judgment logic
2024-11-11 2:34 ` [PATCH v4 2/4] gpio: rockchip: change the GPIO version judgment logic Ye Zhang
2024-11-11 9:48 ` Andy Shevchenko
@ 2024-11-11 23:01 ` Sebastian Reichel
1 sibling, 0 replies; 15+ messages in thread
From: Sebastian Reichel @ 2024-11-11 23:01 UTC (permalink / raw)
To: Ye Zhang
Cc: linus.walleij, brgl, heiko, linux-gpio, linux-arm-kernel,
linux-rockchip, linux-kernel, mika.westerberg, andriy.shevchenko,
tao.huang, finley.xiao, tim.chen, elaine.zhang
[-- Attachment #1: Type: text/plain, Size: 1986 bytes --]
Hi,
On Mon, Nov 11, 2024 at 10:34:10AM +0800, Ye Zhang wrote:
> Have a list of valid IDs and default to -ENODEV.
>
> Signed-off-by: Ye Zhang <ye.zhang@rock-chips.com>
> ---
> drivers/gpio/gpio-rockchip.c | 16 +++++++++++-----
> 1 file changed, 11 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/gpio/gpio-rockchip.c b/drivers/gpio/gpio-rockchip.c
> index 71672d654491..f05b92e0e977 100644
> --- a/drivers/gpio/gpio-rockchip.c
> +++ b/drivers/gpio/gpio-rockchip.c
> @@ -667,8 +667,13 @@ static int rockchip_get_bank_data(struct rockchip_pin_bank *bank)
> clk_prepare_enable(bank->clk);
> id = readl(bank->reg_base + gpio_regs_v2.version_id);
>
> - /* If not gpio v2, that is default to v1. */
> - if (id == GPIO_TYPE_V2 || id == GPIO_TYPE_V2_1) {
> + switch (id) {
> + case GPIO_TYPE_V1:
> + bank->gpio_regs = &gpio_regs_v1;
> + bank->gpio_type = GPIO_TYPE_V1;
> + break;
> + case GPIO_TYPE_V2:
> + case GPIO_TYPE_V2_1:
> bank->gpio_regs = &gpio_regs_v2;
> bank->gpio_type = GPIO_TYPE_V2;
> bank->db_clk = of_clk_get(bank->of_node, 1);
> @@ -677,9 +682,10 @@ static int rockchip_get_bank_data(struct rockchip_pin_bank *bank)
> clk_disable_unprepare(bank->clk);
> return -EINVAL;
> }
> - } else {
> - bank->gpio_regs = &gpio_regs_v1;
> - bank->gpio_type = GPIO_TYPE_V1;
> + break;
> + default:
> + dev_err(bank->dev, "cannot get the version ID\n");
I think this would be a better error message:
dev_err(bank->dev, "unsupported version ID: 0x%08x\n", id);
But it can be improved later on. Just like the next patch I think
this should go into the 6.13 kernel as soon as possible to fix
handling of the Rockchip RK3576, which currently initializes its
GPIO controller using the v1 register layer instead of the v2
register layout.
Reviewed-by: Sebastian Reichel <sebastian.reichel@collabora.com>
-- Sebastian
> + return -ENODEV;
> }
>
> return 0;
> --
> 2.34.1
>
>
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
^ permalink raw reply [flat|nested] 15+ messages in thread
* [PATCH v4 3/4] gpio: rockchip: support new version GPIO
2024-11-11 2:34 [PATCH v4 0/4] gpio: rockchip: Update the GPIO driver Ye Zhang
2024-11-11 2:34 ` [PATCH v4 1/4] gpio: rockchip: explan the format of the GPIO version ID Ye Zhang
2024-11-11 2:34 ` [PATCH v4 2/4] gpio: rockchip: change the GPIO version judgment logic Ye Zhang
@ 2024-11-11 2:34 ` Ye Zhang
2024-11-11 9:48 ` Andy Shevchenko
` (2 more replies)
2024-11-11 2:34 ` [PATCH v4 4/4] gpio: rockchip: Set input direction when request irq Ye Zhang
3 siblings, 3 replies; 15+ messages in thread
From: Ye Zhang @ 2024-11-11 2:34 UTC (permalink / raw)
To: Ye Zhang, linus.walleij, brgl, heiko, linux-gpio, linux-arm-kernel
Cc: linux-rockchip, linux-kernel, mika.westerberg, andriy.shevchenko,
tao.huang, finley.xiao, tim.chen, elaine.zhang
Support the next version GPIO controller on SoCs like rk3576.
Signed-off-by: Ye Zhang <ye.zhang@rock-chips.com>
---
drivers/gpio/gpio-rockchip.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/gpio/gpio-rockchip.c b/drivers/gpio/gpio-rockchip.c
index f05b92e0e977..b7a43e492965 100644
--- a/drivers/gpio/gpio-rockchip.c
+++ b/drivers/gpio/gpio-rockchip.c
@@ -35,6 +35,7 @@
#define GPIO_TYPE_V1 (0) /* GPIO Version ID reserved */
#define GPIO_TYPE_V2 (0x01000C2B)
#define GPIO_TYPE_V2_1 (0x0101157C)
+#define GPIO_TYPE_V2_2 (0x010219C8)
static const struct rockchip_gpio_regs gpio_regs_v1 = {
.port_dr = 0x00,
@@ -674,6 +675,7 @@ static int rockchip_get_bank_data(struct rockchip_pin_bank *bank)
break;
case GPIO_TYPE_V2:
case GPIO_TYPE_V2_1:
+ case GPIO_TYPE_V2_2:
bank->gpio_regs = &gpio_regs_v2;
bank->gpio_type = GPIO_TYPE_V2;
bank->db_clk = of_clk_get(bank->of_node, 1);
--
2.34.1
^ permalink raw reply [flat|nested] 15+ messages in thread* Re: [PATCH v4 3/4] gpio: rockchip: support new version GPIO
2024-11-11 2:34 ` [PATCH v4 3/4] gpio: rockchip: support new version GPIO Ye Zhang
@ 2024-11-11 9:48 ` Andy Shevchenko
2024-11-11 22:27 ` Sebastian Reichel
2024-11-13 13:24 ` Linus Walleij
2 siblings, 0 replies; 15+ messages in thread
From: Andy Shevchenko @ 2024-11-11 9:48 UTC (permalink / raw)
To: Ye Zhang
Cc: linus.walleij, brgl, heiko, linux-gpio, linux-arm-kernel,
linux-rockchip, linux-kernel, mika.westerberg, tao.huang,
finley.xiao, tim.chen, elaine.zhang
On Mon, Nov 11, 2024 at 10:34:11AM +0800, Ye Zhang wrote:
> Support the next version GPIO controller on SoCs like rk3576.
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
--
With Best Regards,
Andy Shevchenko
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH v4 3/4] gpio: rockchip: support new version GPIO
2024-11-11 2:34 ` [PATCH v4 3/4] gpio: rockchip: support new version GPIO Ye Zhang
2024-11-11 9:48 ` Andy Shevchenko
@ 2024-11-11 22:27 ` Sebastian Reichel
2024-11-13 13:24 ` Linus Walleij
2 siblings, 0 replies; 15+ messages in thread
From: Sebastian Reichel @ 2024-11-11 22:27 UTC (permalink / raw)
To: Ye Zhang
Cc: linus.walleij, brgl, heiko, linux-gpio, linux-arm-kernel,
linux-rockchip, linux-kernel, mika.westerberg, andriy.shevchenko,
tao.huang, finley.xiao, tim.chen, elaine.zhang
[-- Attachment #1: Type: text/plain, Size: 1321 bytes --]
Hi,
On Mon, Nov 11, 2024 at 10:34:11AM +0800, Ye Zhang wrote:
> Support the next version GPIO controller on SoCs like rk3576.
>
> Signed-off-by: Ye Zhang <ye.zhang@rock-chips.com>
> ---
Reviewed-by: Sebastian Reichel <sebastian.reichel@collabora.com>
This is needed for 6.13, which introduces RK3576 support and
currently (linux-next) tries to use the GPIO controller in V1
mode.
-- Sebastian
> drivers/gpio/gpio-rockchip.c | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/drivers/gpio/gpio-rockchip.c b/drivers/gpio/gpio-rockchip.c
> index f05b92e0e977..b7a43e492965 100644
> --- a/drivers/gpio/gpio-rockchip.c
> +++ b/drivers/gpio/gpio-rockchip.c
> @@ -35,6 +35,7 @@
> #define GPIO_TYPE_V1 (0) /* GPIO Version ID reserved */
> #define GPIO_TYPE_V2 (0x01000C2B)
> #define GPIO_TYPE_V2_1 (0x0101157C)
> +#define GPIO_TYPE_V2_2 (0x010219C8)
>
> static const struct rockchip_gpio_regs gpio_regs_v1 = {
> .port_dr = 0x00,
> @@ -674,6 +675,7 @@ static int rockchip_get_bank_data(struct rockchip_pin_bank *bank)
> break;
> case GPIO_TYPE_V2:
> case GPIO_TYPE_V2_1:
> + case GPIO_TYPE_V2_2:
> bank->gpio_regs = &gpio_regs_v2;
> bank->gpio_type = GPIO_TYPE_V2;
> bank->db_clk = of_clk_get(bank->of_node, 1);
> --
> 2.34.1
>
>
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
^ permalink raw reply [flat|nested] 15+ messages in thread* Re: [PATCH v4 3/4] gpio: rockchip: support new version GPIO
2024-11-11 2:34 ` [PATCH v4 3/4] gpio: rockchip: support new version GPIO Ye Zhang
2024-11-11 9:48 ` Andy Shevchenko
2024-11-11 22:27 ` Sebastian Reichel
@ 2024-11-13 13:24 ` Linus Walleij
2 siblings, 0 replies; 15+ messages in thread
From: Linus Walleij @ 2024-11-13 13:24 UTC (permalink / raw)
To: Ye Zhang
Cc: brgl, heiko, linux-gpio, linux-arm-kernel, linux-rockchip,
linux-kernel, mika.westerberg, andriy.shevchenko, tao.huang,
finley.xiao, tim.chen, elaine.zhang
On Mon, Nov 11, 2024 at 3:34 AM Ye Zhang <ye.zhang@rock-chips.com> wrote:
> Support the next version GPIO controller on SoCs like rk3576.
>
> Signed-off-by: Ye Zhang <ye.zhang@rock-chips.com>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Yours,
Linus Walleij
^ permalink raw reply [flat|nested] 15+ messages in thread
* [PATCH v4 4/4] gpio: rockchip: Set input direction when request irq
2024-11-11 2:34 [PATCH v4 0/4] gpio: rockchip: Update the GPIO driver Ye Zhang
` (2 preceding siblings ...)
2024-11-11 2:34 ` [PATCH v4 3/4] gpio: rockchip: support new version GPIO Ye Zhang
@ 2024-11-11 2:34 ` Ye Zhang
2024-11-11 23:02 ` Sebastian Reichel
2024-11-13 13:25 ` Linus Walleij
3 siblings, 2 replies; 15+ messages in thread
From: Ye Zhang @ 2024-11-11 2:34 UTC (permalink / raw)
To: Ye Zhang, linus.walleij, brgl, heiko, linux-gpio, linux-arm-kernel
Cc: linux-rockchip, linux-kernel, mika.westerberg, andriy.shevchenko,
tao.huang, finley.xiao, tim.chen, elaine.zhang
Since the GPIO can only generate interrupts when its direction is set to
input, it is set to input before requesting the interrupt resources.
Signed-off-by: Ye Zhang <ye.zhang@rock-chips.com>
---
drivers/gpio/gpio-rockchip.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/drivers/gpio/gpio-rockchip.c b/drivers/gpio/gpio-rockchip.c
index b7a43e492965..40c2476699aa 100644
--- a/drivers/gpio/gpio-rockchip.c
+++ b/drivers/gpio/gpio-rockchip.c
@@ -476,8 +476,11 @@ static int rockchip_irq_reqres(struct irq_data *d)
{
struct irq_chip_generic *gc = irq_data_get_irq_chip_data(d);
struct rockchip_pin_bank *bank = gc->private;
+ irq_hw_number_t hwirq = irqd_to_hwirq(d);
- return gpiochip_reqres_irq(&bank->gpio_chip, d->hwirq);
+ rockchip_gpio_direction_input(&bank->gpio_chip, hwirq);
+
+ return gpiochip_reqres_irq(&bank->gpio_chip, hwirq);
}
static void rockchip_irq_relres(struct irq_data *d)
--
2.34.1
^ permalink raw reply [flat|nested] 15+ messages in thread* Re: [PATCH v4 4/4] gpio: rockchip: Set input direction when request irq
2024-11-11 2:34 ` [PATCH v4 4/4] gpio: rockchip: Set input direction when request irq Ye Zhang
@ 2024-11-11 23:02 ` Sebastian Reichel
2024-11-13 13:25 ` Linus Walleij
1 sibling, 0 replies; 15+ messages in thread
From: Sebastian Reichel @ 2024-11-11 23:02 UTC (permalink / raw)
To: Ye Zhang
Cc: linus.walleij, brgl, heiko, linux-gpio, linux-arm-kernel,
linux-rockchip, linux-kernel, mika.westerberg, andriy.shevchenko,
tao.huang, finley.xiao, tim.chen, elaine.zhang
[-- Attachment #1: Type: text/plain, Size: 1184 bytes --]
Hi,
On Mon, Nov 11, 2024 at 10:34:12AM +0800, Ye Zhang wrote:
> Since the GPIO can only generate interrupts when its direction is set to
> input, it is set to input before requesting the interrupt resources.
>
> Signed-off-by: Ye Zhang <ye.zhang@rock-chips.com>
> ---
Reviewed-by: Sebastian Reichel <sebastian.reichel@collabora.com>
-- Sebastian
> drivers/gpio/gpio-rockchip.c | 5 ++++-
> 1 file changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/gpio/gpio-rockchip.c b/drivers/gpio/gpio-rockchip.c
> index b7a43e492965..40c2476699aa 100644
> --- a/drivers/gpio/gpio-rockchip.c
> +++ b/drivers/gpio/gpio-rockchip.c
> @@ -476,8 +476,11 @@ static int rockchip_irq_reqres(struct irq_data *d)
> {
> struct irq_chip_generic *gc = irq_data_get_irq_chip_data(d);
> struct rockchip_pin_bank *bank = gc->private;
> + irq_hw_number_t hwirq = irqd_to_hwirq(d);
>
> - return gpiochip_reqres_irq(&bank->gpio_chip, d->hwirq);
> + rockchip_gpio_direction_input(&bank->gpio_chip, hwirq);
> +
> + return gpiochip_reqres_irq(&bank->gpio_chip, hwirq);
> }
>
> static void rockchip_irq_relres(struct irq_data *d)
> --
> 2.34.1
>
>
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
^ permalink raw reply [flat|nested] 15+ messages in thread* Re: [PATCH v4 4/4] gpio: rockchip: Set input direction when request irq
2024-11-11 2:34 ` [PATCH v4 4/4] gpio: rockchip: Set input direction when request irq Ye Zhang
2024-11-11 23:02 ` Sebastian Reichel
@ 2024-11-13 13:25 ` Linus Walleij
1 sibling, 0 replies; 15+ messages in thread
From: Linus Walleij @ 2024-11-13 13:25 UTC (permalink / raw)
To: Ye Zhang
Cc: brgl, heiko, linux-gpio, linux-arm-kernel, linux-rockchip,
linux-kernel, mika.westerberg, andriy.shevchenko, tao.huang,
finley.xiao, tim.chen, elaine.zhang
On Mon, Nov 11, 2024 at 3:34 AM Ye Zhang <ye.zhang@rock-chips.com> wrote:
> Since the GPIO can only generate interrupts when its direction is set to
> input, it is set to input before requesting the interrupt resources.
>
> Signed-off-by: Ye Zhang <ye.zhang@rock-chips.com>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Yours,
Linus Walleij
^ permalink raw reply [flat|nested] 15+ messages in thread