The RTL9607C SoC has support for 3 GPIO banks with 32 GPIOs each and
the port order is reversed just like in RTL930x.
Signed-off-by: Rustam Adilov <adilov@disroot.org>
---
drivers/gpio/gpio-realtek-otto.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/drivers/gpio/gpio-realtek-otto.c b/drivers/gpio/gpio-realtek-otto.c
index 4cf91528f547..5e3152c2e51a 100644
--- a/drivers/gpio/gpio-realtek-otto.c
+++ b/drivers/gpio/gpio-realtek-otto.c
@@ -351,6 +351,10 @@ static const struct of_device_id realtek_gpio_of_match[] = {
{
.compatible = "realtek,rtl9310-gpio",
},
+ {
+ .compatible = "realtek,rtl9607-gpio",
+ .data = (void *)GPIO_PORTS_REVERSED,
+ },
{}
};
MODULE_DEVICE_TABLE(of, realtek_gpio_of_match);
--
2.53.0
Hi,
On Thu, 2026-03-05 at 21:11 +0500, Rustam Adilov wrote:
> The RTL9607C SoC has support for 3 GPIO banks with 32 GPIOs each and
> the port order is reversed just like in RTL930x.
>
> Signed-off-by: Rustam Adilov <adilov@disroot.org>
> ---
> drivers/gpio/gpio-realtek-otto.c | 4 ++++
> 1 file changed, 4 insertions(+)
>
> diff --git a/drivers/gpio/gpio-realtek-otto.c b/drivers/gpio/gpio-realtek-
> otto.c
> index 4cf91528f547..5e3152c2e51a 100644
> --- a/drivers/gpio/gpio-realtek-otto.c
> +++ b/drivers/gpio/gpio-realtek-otto.c
> @@ -351,6 +351,10 @@ static const struct of_device_id realtek_gpio_of_match[]
> = {
> {
> .compatible = "realtek,rtl9310-gpio",
> },
> + {
> + .compatible = "realtek,rtl9607-gpio",
> + .data = (void *)GPIO_PORTS_REVERSED,
> + },
> {}
> };
> MODULE_DEVICE_TABLE(of, realtek_gpio_of_match);
If I'm not mistaken, this SoC has a MIPS InterAptiv CPU like the RTL931x SoC
series. Were you able to validate that the interrupts are functioning as
expected?
Best,
Sander
On 2026-03-05 19:04, Sander Vanheule wrote:
> Hi,
>
> On Thu, 2026-03-05 at 21:11 +0500, Rustam Adilov wrote:
>> The RTL9607C SoC has support for 3 GPIO banks with 32 GPIOs each and
>> the port order is reversed just like in RTL930x.
>>
>> Signed-off-by: Rustam Adilov <adilov@disroot.org>
>> ---
>> drivers/gpio/gpio-realtek-otto.c | 4 ++++
>> 1 file changed, 4 insertions(+)
>>
>> diff --git a/drivers/gpio/gpio-realtek-otto.c
>> b/drivers/gpio/gpio-realtek-
>> otto.c
>> index 4cf91528f547..5e3152c2e51a 100644
>> --- a/drivers/gpio/gpio-realtek-otto.c
>> +++ b/drivers/gpio/gpio-realtek-otto.c
>> @@ -351,6 +351,10 @@ static const struct of_device_id
>> realtek_gpio_of_match[]
>> = {
>> {
>> .compatible = "realtek,rtl9310-gpio",
>> },
>> + {
>> + .compatible = "realtek,rtl9607-gpio",
>> + .data = (void *)GPIO_PORTS_REVERSED,
>> + },
>> {}
>> };
>> MODULE_DEVICE_TABLE(of, realtek_gpio_of_match);
>
> If I'm not mistaken, this SoC has a MIPS InterAptiv CPU like the
> RTL931x SoC
> series. Were you able to validate that the interrupts are functioning
> as
> expected?
>
> Best,
> Sander
Hi Sander,
Yes, this is correct. I played around with gpio-keys in OpenWrt (though
it
has its own gpio-button-hotplug but it should not change things) and can
verify that button presses and releases are working. I think this should
confirm that interrupts are functional.
Hi,
On Thu, 2026-03-05 at 19:54 +0000, adilov wrote:
> On 2026-03-05 19:04, Sander Vanheule wrote:
> > On Thu, 2026-03-05 at 21:11 +0500, Rustam Adilov wrote:,
> > > + {
> > > + .compatible = "realtek,rtl9607-gpio",
> > > + .data = (void *)GPIO_PORTS_REVERSED,
> > > + },
> > If I'm not mistaken, this SoC has a MIPS InterAptiv CPU like the
> > RTL931x SoC
> > series. Were you able to validate that the interrupts are functioning
> > as
> > expected?
> >
> > Best,
> > Sander
>
> Hi Sander,
>
> Yes, this is correct. I played around with gpio-keys in OpenWrt (though
> it
> has its own gpio-button-hotplug but it should not change things) and can
> verify that button presses and releases are working. I think this should
> confirm that interrupts are functional.
Thanks for the info. I was mainly wondering because there seemed to be some
initial confusion [1] about the port order. If you get the order wrong, you
would be getting spurious interrupts.
[1] https://forum.openwrt.org/t/240741/25
If the order is correct, you should see the key GPIO interrupt increase in
/proc/interrupts. So, assuming that's the case:
Reviewed-by: Sander Vanheule <sander@svanheule.net>
Best,
Sander
On 2026-03-05 21:49, Sander Vanheule wrote:
> Hi,
>
> On Thu, 2026-03-05 at 19:54 +0000, adilov wrote:
>> On 2026-03-05 19:04, Sander Vanheule wrote:
>> > On Thu, 2026-03-05 at 21:11 +0500, Rustam Adilov wrote:,
>> > > + {
>> > > + .compatible = "realtek,rtl9607-gpio",
>> > > + .data = (void *)GPIO_PORTS_REVERSED,
>> > > + },
>> > If I'm not mistaken, this SoC has a MIPS InterAptiv CPU like the
>> > RTL931x SoC
>> > series. Were you able to validate that the interrupts are functioning
>> > as
>> > expected?
>> >
>> > Best,
>> > Sander
>>
>> Hi Sander,
>>
>> Yes, this is correct. I played around with gpio-keys in OpenWrt (though
>> it
>> has its own gpio-button-hotplug but it should not change things) and can
>> verify that button presses and releases are working. I think this should
>> confirm that interrupts are functional.
>
> Thanks for the info. I was mainly wondering because there seemed to be some
> initial confusion [1] about the port order. If you get the order wrong, you
> would be getting spurious interrupts.
>
> [1] https://forum.openwrt.org/t/240741/25
>
> If the order is correct, you should see the key GPIO interrupt increase in
> /proc/interrupts. So, assuming that's the case:
>
> Reviewed-by: Sander Vanheule <sander@svanheule.net>
>
> Best,
> Sander
Thankfully i had saved the testing image so i quickly booted up my board and
yes, i can see that interrupts increase in /proc/interrupts.
Before button press:
CPU0 CPU1 CPU2 CPU3
....
27: 0 0 0 0 realtek-otto-gpio 5 keys
28: 0 0 0 0 realtek-otto-gpio 2 keys
29: 0 0 0 0 realtek-otto-gpio 4 keys
After the button press:
27: 0 0 0 0 realtek-otto-gpio 5 keys
28: 2 0 0 0 realtek-otto-gpio 2 keys
29: 0 0 0 0 realtek-otto-gpio 4 keys
It did increase by 2 which i pressume is from press and release actions.
Thank you for the review.
Best,
Rustam
© 2016 - 2026 Red Hat, Inc.