diff mbox series

ipq40xx: google (gale) add reset button

Message ID 20230326132913.3263587-1-openwrt@aiyionpri.me
State Superseded, archived
Headers show
Series ipq40xx: google (gale) add reset button | expand

Commit Message

Jan-Niklas Burfeind March 26, 2023, 1:29 p.m. UTC
From: Jan-Niklas Burfeind <git@aiyionpri.me>

add the external button (GPIO 57) as reset button

Signed-off-by: Jan-Niklas Burfeind <git@aiyionpri.me>
---

Good afternoon everyone.
This is just a minor addition to the google wifi router
OpenWrt supports.

I hope I didn't miss anything.

Yours
aiyion


 .../files/arch/arm/boot/dts/qcom-ipq4019-wifi.dts      | 10 ++++++++++
 1 file changed, 10 insertions(+)

Comments

Brian Norris March 26, 2023, 6:03 p.m. UTC | #1
Hey,

On Sun, Mar 26, 2023 at 6:29 AM <openwrt@aiyionpri.me> wrote:
>
> From: Jan-Niklas Burfeind <git@aiyionpri.me>
>
> add the external button (GPIO 57) as reset button
>
> Signed-off-by: Jan-Niklas Burfeind <git@aiyionpri.me>
> ---
>
> Good afternoon everyone.
> This is just a minor addition to the google wifi router
> OpenWrt supports.
>
> I hope I didn't miss anything.
>
> Yours
> aiyion

Thanks for doing this! This looks pretty good, although I'd make a
small addition. See below:

>  .../files/arch/arm/boot/dts/qcom-ipq4019-wifi.dts      | 10 ++++++++++
>  1 file changed, 10 insertions(+)
>
> diff --git a/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4019-wifi.dts b/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4019-wifi.dts
> index 65f5933305..85ce73afb3 100644
> --- a/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4019-wifi.dts
> +++ b/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4019-wifi.dts
> @@ -49,6 +49,16 @@
>                         };
>                 };
>         };
> +
> +       keys {
> +               compatible = "gpio-keys";
> +
> +               reset {
> +                       label = "reset";
> +                       gpios = <&tlmm 57 GPIO_ACTIVE_LOW>;

Normally, you want a pinctrl setting too, to tell the pin controller
how to configure any biases, pull-ups/downs, etc. In this case, the
configuration is trivial, so it probably doesn't make much difference,
but for completeness, we should still add it. See how below we have
this pinmux definition already:

fw_pinmux {
  wp {
    pins = "gpio53";
    output-low;
  };
  recovery {
    pins = "gpio57";
    bias-none;
  };
  developer {
    pins = "gpio41";
    bias-none;
  };
};

So, you just need to add a phandle reference, and it'll look something like:

keys {
  compatible = "gpio-keys";
  pinctrl-0 = <&fw_pinmux>;
  pinctrl-names = "default";
  ...
};
...
fw_pinmux: fw_pinmux {
  recovery {
    ...
  };
};

You can see an approximately similar change I made recently here:

https://git.openwrt.org/?p=openwrt/openwrt.git;a=commitdiff;h=4c1d7787d460cd0798eb01a42c6a8a7fc96e2999

If you have trouble with that, I can play with it myself and send an
updated version 2.

Thanks,
Brian

> +                       linux,code = <KEY_RESTART>;
> +               };
> +       };
>  };
>
>  &tlmm {
> --
> 2.40.0
>
diff mbox series

Patch

diff --git a/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4019-wifi.dts b/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4019-wifi.dts
index 65f5933305..85ce73afb3 100644
--- a/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4019-wifi.dts
+++ b/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4019-wifi.dts
@@ -49,6 +49,16 @@ 
 			};
 		};
 	};
+
+	keys {
+		compatible = "gpio-keys";
+
+		reset {
+			label = "reset";
+			gpios = <&tlmm 57 GPIO_ACTIVE_LOW>;
+			linux,code = <KEY_RESTART>;
+		};
+	};
 };
 
 &tlmm {