On 2/17/25 19:14, Dario Binacchi wrote:
> It is pointless to use the custom compatible "st,button1" when
> stm32746g-eval.dts and stm32f769-disco.dts already contain the
> "gpio-keys" compatible, which is specifically used for button
> management. In the case of stm32f746-disco.dts, since it lacks the
> "gpio-keys" compatible, it was decided to translate "st,button1"
> into its "gpio-keys" version in stm32f746-disco-u-boot.dtsi.
> 
> Signed-off-by: Dario Binacchi <dario.binac...@amarulasolutions.com>
> ---
> 
>  arch/arm/dts/stm32746g-eval-u-boot.dtsi    |  5 -----
>  arch/arm/dts/stm32f746-disco-u-boot.dtsi   | 11 ++++++++---
>  arch/arm/dts/stm32f769-disco-u-boot.dtsi   |  5 -----
>  board/st/stm32f746-disco/stm32f746-disco.c | 15 ---------------
>  4 files changed, 8 insertions(+), 28 deletions(-)
> 
> diff --git a/arch/arm/dts/stm32746g-eval-u-boot.dtsi 
> b/arch/arm/dts/stm32746g-eval-u-boot.dtsi
> index 1c288acec992..f64329287357 100644
> --- a/arch/arm/dts/stm32746g-eval-u-boot.dtsi
> +++ b/arch/arm/dts/stm32746g-eval-u-boot.dtsi
> @@ -23,11 +23,6 @@
>               spi0 = &qspi;
>       };
>  
> -     button1 {
> -             compatible = "st,button1";
> -             button-gpio = <&gpioc 13 0>;
> -     };
> -
>       led1 {
>               compatible = "st,led1";
>               led-gpio = <&gpiof 10 0>;
> diff --git a/arch/arm/dts/stm32f746-disco-u-boot.dtsi 
> b/arch/arm/dts/stm32f746-disco-u-boot.dtsi
> index 1b42d6cbbc19..e0e2f9e23773 100644
> --- a/arch/arm/dts/stm32f746-disco-u-boot.dtsi
> +++ b/arch/arm/dts/stm32f746-disco-u-boot.dtsi
> @@ -23,9 +23,14 @@
>               spi0 = &qspi;
>       };
>  
> -     button1 {
> -             compatible = "st,button1";
> -             button-gpio = <&gpioi 11 0>;
> +     gpio-keys {
> +             compatible = "gpio-keys";
> +             autorepeat;
> +             button-0 {
> +                     label = "User";
> +                     linux,code = <KEY_HOME>;
> +                     gpios = <&gpioi 11 GPIO_ACTIVE_HIGH>;
> +             };

No need to add gpio-keys node as CONFIG_BUTTON_GPIO is not enable in 
configs/stm32f746-disco_defconfig

Thanks
Patrice

>       };
>  
>       led1 {
> diff --git a/arch/arm/dts/stm32f769-disco-u-boot.dtsi 
> b/arch/arm/dts/stm32f769-disco-u-boot.dtsi
> index add55c96e21f..a50fba64dcd2 100644
> --- a/arch/arm/dts/stm32f769-disco-u-boot.dtsi
> +++ b/arch/arm/dts/stm32f769-disco-u-boot.dtsi
> @@ -23,11 +23,6 @@
>               spi0 = &qspi;
>       };
>  
> -     button1 {
> -             compatible = "st,button1";
> -             button-gpio = <&gpioa 0 0>;
> -     };
> -
>       led1 {
>               compatible = "st,led1";
>               led-gpio = <&gpioj 5 0>;
> diff --git a/board/st/stm32f746-disco/stm32f746-disco.c 
> b/board/st/stm32f746-disco/stm32f746-disco.c
> index 8966a09501ed..65a39d965c72 100644
> --- a/board/st/stm32f746-disco/stm32f746-disco.c
> +++ b/board/st/stm32f746-disco/stm32f746-disco.c
> @@ -94,21 +94,6 @@ int board_late_init(void)
>               dm_gpio_set_value(&gpio, 1);
>       }
>  
> -     /* read button 1*/
> -     node = fdt_node_offset_by_compatible(gd->fdt_blob, 0, "st,button1");
> -     if (node < 0)
> -             return -1;
> -
> -     gpio_request_by_name_nodev(offset_to_ofnode(node), "button-gpio", 0,
> -                                &gpio, GPIOD_IS_IN);
> -
> -     if (dm_gpio_is_valid(&gpio)) {
> -             if (dm_gpio_get_value(&gpio))
> -                     puts("usr button is at HIGH LEVEL\n");
> -             else
> -                     puts("usr button is at LOW LEVEL\n");
> -     }
> -
>       return 0;
>  }
>  


Reply via email to