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

Robin van der Gracht robin at protonic.nl
Mon Mar 31 23:27:57 PDT 2025


On 01-04-2025 07:58, Sascha Hauer wrote:
> 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
Ack. Thanks.

Robin



More information about the barebox mailing list