Using gpio_keys with regmapped gpio?
Hi,
I have a SPI gpio expander chip that is using the regmap framework. There are some pushbuttons that I'd like to use the gpio_keys framework for but only the first button press creates an input event.
It seems like my problem occurs because I'm only getting events on a button press. The input_get_disposition() function toggles a local copy of the button state [__change_bit(code, dev->key);] in the input.c file. I think this function also needs to be called when the button is released to toggle the dev->key state and re-arm for the next button press.
I tried enabling autorepeat but that causes an infinite loop in the input_repeat_key() function.
In both cases, it seems like the button press condition must be cleared when the button is released. This seems like it should be common for all GPIOs so I'm probably missing something.
Which brings up my next question. Can the gpio_keys framework be used with a regmapped gpio? I haven't been able to find any examples of gpio_keys with an external gpio expander and maybe this isn't valid usage.
Thanks,
Thor
--
To unsubscribe from this list: send the line "unsubscribe linux-spi" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
A message that is not in the archive (sent off-list or not yet received): 551AFC2F.3060300-yzvPICuk2ABMcg4IHK0kFoH6Mc4MB0Vx@public.gmane.org
Quoted 3 lines · Thor Thayer
Which brings up my next question. Can the
gpio_keysframework be used with a regmapped gpio? I haven't been able to find any examples ofgpio_keyswith an external gpio expander and maybe this isn't valid usage.
Why would there be any problem doing that? I suspect a lack of examples is more to do with it being rare to build hardware like that (usually on SoC GPIOs are fairly abundant and much more performant) than anything else.
Quoted 7 lines · Thor Thayer
Hi,
I have a SPI gpio expander chip that is using the regmap framework. There are some pushbuttons that I'd like to use the
gpio_keysframework for but only the first button press creates an input event.
Quoted 6 lines
It seems like my problem occurs because I'm only getting events on a button press. The
input_get_disposition()function toggles a local copy of the button state [__change_bit(code, dev->key);] in theinput.cfile. I think this function also needs to be called when the button is released to toggle thedev->keystate and re-arm for the next button press.
Yes.
Quoted 7 lines
I tried enabling autorepeat but that causes an infinite loop in the
input_repeat_key()function.In both cases, it seems like the button press condition must be cleared when the button is released. This seems like it should be common for all GPIOs so I'm probably missing something.
It sounds like your expander does not generate interrupt when the button is released and so gpio-keys driver is not aware of it.
Thanks.
Signature · 5 lines
Dmitry -- To unsubscribe from this list: send the line "unsubscribe linux-spi" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Quoted 21 lines · Dmitry Torokhov
Quoted 7 lines · Thor Thayer
Hi,
I have a SPI gpio expander chip that is using the regmap framework. There are some pushbuttons that I'd like to use the
gpio_keysframework for but only the first button press creates an input event.Quoted 6 lines
It seems like my problem occurs because I'm only getting events on a button press. The
input_get_disposition()function toggles a local copy of the button state [__change_bit(code, dev->key);] in theinput.cfile. I think this function also needs to be called when the button is released to toggle thedev->keystate and re-arm for the next button press.Yes.
Quoted 4 lines
I tried enabling autorepeat but that causes an infinite loop in the
input_repeat_key()function.
Quoted 9 lines
Quoted 3 lines
In both cases, it seems like the button press condition must be cleared when the button is released. This seems like it should be common for all GPIOs so I'm probably missing something.
It sounds like your expander does not generate interrupt when the button is released and so gpio-keys driver is not aware of it.
Thanks.
Thanks for the quick reply. Is giving an interrupt on both press and release a requirement for gpio-keys? or is there another setup that I'm not aware of?
How does the gpio-key framework work with register mapped GPIOs that are rising-edge or falling-edge triggered? I tend to think of these IRQ states as the general case for GPIO.
Thanks
--
To unsubscribe from this list: send the line "unsubscribe linux-spi" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
A message that is not in the archive (sent off-list or not yet received): 551B0C43.5000101-yzvPICuk2ABMcg4IHK0kFoH6Mc4MB0Vx@public.gmane.org
Quoted 35 lines · Thor Thayer
Quoted 32 lines · Dmitry Torokhov
Quoted 8 lines · Thor Thayer
Hi,
I have a SPI gpio expander chip that is using the regmap framework. There are some pushbuttons that I'd like to use the
gpio_keysframework for but only the first button press creates an input event.Quoted 6 lines
It seems like my problem occurs because I'm only getting events on a button press. The
input_get_disposition()function toggles a local copy of the button state [__change_bit(code, dev->key);] in theinput.cfile. I think this function also needs to be called when the button is released to toggle thedev->keystate and re-arm for the next button press.Yes.
Quoted 7 lines
I tried enabling autorepeat but that causes an infinite loop in the
input_repeat_key()function.In both cases, it seems like the button press condition must be cleared when the button is released. This seems like it should be common for all GPIOs so I'm probably missing something.
It sounds like your expander does not generate interrupt when the button is released and so gpio-keys driver is not aware of it.
Quoted 7 lines
Quoted 2 lines
Thanks.
Thanks for the quick reply. Is giving an interrupt on both press and release a requirement for gpio-keys? or is there another setup that I'm not aware of?
Yes.
Quoted 3 lines
How does the gpio-key framework work with register mapped GPIOs that are rising-edge or falling-edge triggered? I tend to think of these IRQ states as the general case for GPIO.
I am not sure why it matters if it is register mapped gpio or not. The driver needs to know when the key is pressed and released, so it expects to get an interrupt when gpio changes state.
Thanks.
Signature · 5 lines
Dmitry -- To unsubscribe from this list: send the line "unsubscribe linux-spi" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
A message that is not in the archive (sent off-list or not yet received): CAKdAkRTwPwSThinV-t6UN3LMY8-XXYJ1dB+11U9SZ=zZT4Kt7g-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org
Quoted 40 lines · Dmitry Torokhov
Quoted 38 lines · Thor Thayer
Quoted 34 lines · Dmitry Torokhov
Quoted 8 lines · Thor Thayer
Hi,
I have a SPI gpio expander chip that is using the regmap framework. There are some pushbuttons that I'd like to use the
gpio_keysframework for but only the first button press creates an input event.Quoted 6 lines
It seems like my problem occurs because I'm only getting events on a button press. The
input_get_disposition()function toggles a local copy of the button state [__change_bit(code, dev->key);] in theinput.cfile. I think this function also needs to be called when the button is released to toggle thedev->keystate and re-arm for the next button press.Yes.
Quoted 7 lines
I tried enabling autorepeat but that causes an infinite loop in the
input_repeat_key()function.In both cases, it seems like the button press condition must be cleared when the button is released. This seems like it should be common for all GPIOs so I'm probably missing something.
It sounds like your expander does not generate interrupt when the button is released and so gpio-keys driver is not aware of it.
Thanks.
Quoted 6 lines
Quoted 4 lines
Thanks for the quick reply. Is giving an interrupt on both press and release a requirement for gpio-keys? or is there another setup that I'm not aware of?
Yes.
And by that I meant "Yes, it is a requirement".
Thanks.
Signature · 5 lines
Dmitry -- To unsubscribe from this list: send the line "unsubscribe linux-spi" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Hi Thor,
Quoted 3 lines · Thor Thayer
Which brings up my next question. Can the
gpio_keysframework be used with a regmapped gpio? I haven't been able to find any examples ofgpio_keyswith an external gpio expander and maybe this isn't valid usage.
Kzm9g uses gpio-keys with a PCF8575 i2c GPIO expander, cfr. arch/arm/boot/dts/sh73a0-kzm9g.dts. It doesn't use regmap, though.
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]
In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
--
To unsubscribe from this list: send the line "unsubscribe linux-spi" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html