[PATCH] ARM: boards: protonic-imx6: prtvt7: Use the input system for key detection

Sascha Hauer s.hauer at pengutronix.de
Mon Mar 31 22:58:16 PDT 2025


On Mon, Mar 31, 2025 at 05:05:28PM +0200, Robin van der Gracht wrote:
> Static gpio mapping is deprecated. Instead query the gpio-keys driver for
> pressed keys.
> 
> Signed-off-by: Robin van der Gracht <robin at protonic.nl>
> ---
>  arch/arm/boards/protonic-imx6/board.c | 17 ++++++++++-------
>  1 file changed, 10 insertions(+), 7 deletions(-)
> 
> diff --git a/arch/arm/boards/protonic-imx6/board.c b/arch/arm/boards/protonic-imx6/board.c
> index 9292052d30..4bfae3d608 100644
> --- a/arch/arm/boards/protonic-imx6/board.c
> +++ b/arch/arm/boards/protonic-imx6/board.c
> @@ -13,6 +13,7 @@
>  #include <globalvar.h>
>  #include <gpio.h>
>  #include <i2c/i2c.h>
> +#include <input/input.h>
>  #include <mach/imx/bbu.h>
>  #include <mach/imx/imx6.h>
>  #include <mach/imx/ocotp-fusemap.h>
> @@ -740,19 +741,21 @@ static int prt_imx6_init_kvg_yaco(struct prt_imx6_priv *priv)
>  	return prt_imx6_init_kvg_power(priv, PW_MODE_KVG_WITH_YACO);
>  }
>  
> -#define GPIO_KEY_F6     (0xe0 + 5)
> -#define GPIO_KEY_CYCLE  (0xe0 + 2)
> -
>  static int prt_imx6_init_prtvt7(struct prt_imx6_priv *priv)
>  {
> -	/* This function relies heavely on the gpio-pca9539 driver */
> +	unsigned long *keys;
>  
> -	gpio_direction_input(GPIO_KEY_F6);
> -	gpio_direction_input(GPIO_KEY_CYCLE);

I added a

	of_devices_ensure_probed_by_compatible("gpio-keys");

here to be sure you don't depend on probe order.

Sascha

-- 
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |



More information about the barebox mailing list