* Using gpio_keys with regmapped gpio?
@ 2015-03-31 19:57 Thor Thayer
[not found] ` <551AFC2F.3060300-yzvPICuk2ABMcg4IHK0kFoH6Mc4MB0Vx@public.gmane.org>
0 siblings, 1 reply; 7+ messages in thread
From: Thor Thayer @ 2015-03-31 19:57 UTC (permalink / raw)
To: Mark Brown, dmitry.torokhov-Re5JQEeQqe8AvxtiuMwx3w,
linux-input-u79uwXL29TY76Z2rM5mHXA,
linux-spi-u79uwXL29TY76Z2rM5mHXA
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 majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Using gpio_keys with regmapped gpio?
[not found] ` <551AFC2F.3060300-yzvPICuk2ABMcg4IHK0kFoH6Mc4MB0Vx@public.gmane.org>
@ 2015-03-31 20:04 ` Mark Brown
2015-03-31 20:17 ` Dmitry Torokhov
2015-04-03 7:13 ` Geert Uytterhoeven
2 siblings, 0 replies; 7+ messages in thread
From: Mark Brown @ 2015-03-31 20:04 UTC (permalink / raw)
To: Thor Thayer
Cc: dmitry.torokhov-Re5JQEeQqe8AvxtiuMwx3w,
linux-input-u79uwXL29TY76Z2rM5mHXA,
linux-spi-u79uwXL29TY76Z2rM5mHXA
[-- Attachment #1: Type: text/plain, Size: 503 bytes --]
On Tue, Mar 31, 2015 at 02:57:35PM -0500, Thor Thayer wrote:
> 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.
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.
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 473 bytes --]
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Using gpio_keys with regmapped gpio?
[not found] ` <551AFC2F.3060300-yzvPICuk2ABMcg4IHK0kFoH6Mc4MB0Vx@public.gmane.org>
2015-03-31 20:04 ` Mark Brown
@ 2015-03-31 20:17 ` Dmitry Torokhov
2015-03-31 21:06 ` Thor Thayer
2015-04-03 7:13 ` Geert Uytterhoeven
2 siblings, 1 reply; 7+ messages in thread
From: Dmitry Torokhov @ 2015-03-31 20:17 UTC (permalink / raw)
To: Thor Thayer
Cc: Mark Brown, linux-input-u79uwXL29TY76Z2rM5mHXA,
linux-spi-u79uwXL29TY76Z2rM5mHXA
On Tue, Mar 31, 2015 at 02:57:35PM -0500, Thor Thayer wrote:
> 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.
Yes.
>
> 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.
--
Dmitry
--
To unsubscribe from this list: send the line "unsubscribe linux-spi" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Using gpio_keys with regmapped gpio?
2015-03-31 20:17 ` Dmitry Torokhov
@ 2015-03-31 21:06 ` Thor Thayer
[not found] ` <551B0C43.5000101-yzvPICuk2ABMcg4IHK0kFoH6Mc4MB0Vx@public.gmane.org>
0 siblings, 1 reply; 7+ messages in thread
From: Thor Thayer @ 2015-03-31 21:06 UTC (permalink / raw)
To: Dmitry Torokhov
Cc: Mark Brown, linux-input-u79uwXL29TY76Z2rM5mHXA,
linux-spi-u79uwXL29TY76Z2rM5mHXA
On 03/31/2015 03:17 PM, Dmitry Torokhov wrote:
> On Tue, Mar 31, 2015 at 02:57:35PM -0500, Thor Thayer wrote:
>> 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.
>
> Yes.
>
>>
>> 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.
>
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 majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Using gpio_keys with regmapped gpio?
[not found] ` <551B0C43.5000101-yzvPICuk2ABMcg4IHK0kFoH6Mc4MB0Vx@public.gmane.org>
@ 2015-04-01 15:59 ` Dmitry Torokhov
[not found] ` <CAKdAkRTwPwSThinV-t6UN3LMY8-XXYJ1dB+11U9SZ=zZT4Kt7g-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
0 siblings, 1 reply; 7+ messages in thread
From: Dmitry Torokhov @ 2015-04-01 15:59 UTC (permalink / raw)
To: Thor Thayer
Cc: Mark Brown, linux-input-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
linux-spi-u79uwXL29TY76Z2rM5mHXA
On Tue, Mar 31, 2015 at 2:06 PM, Thor Thayer
<tthayer-yzvPICuk2ABMcg4IHK0kFoH6Mc4MB0Vx@public.gmane.org> wrote:
>
>
> On 03/31/2015 03:17 PM, Dmitry Torokhov wrote:
>>
>> On Tue, Mar 31, 2015 at 02:57:35PM -0500, Thor Thayer wrote:
>>>
>>> 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.
>>
>>
>> Yes.
>>
>>>
>>> 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.
>>
>
> 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.
> 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.
--
Dmitry
--
To unsubscribe from this list: send the line "unsubscribe linux-spi" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Using gpio_keys with regmapped gpio?
[not found] ` <CAKdAkRTwPwSThinV-t6UN3LMY8-XXYJ1dB+11U9SZ=zZT4Kt7g-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
@ 2015-04-01 16:00 ` Dmitry Torokhov
0 siblings, 0 replies; 7+ messages in thread
From: Dmitry Torokhov @ 2015-04-01 16:00 UTC (permalink / raw)
To: Thor Thayer
Cc: Mark Brown, linux-input-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
linux-spi-u79uwXL29TY76Z2rM5mHXA
On Wed, Apr 1, 2015 at 8:59 AM, Dmitry Torokhov
<dmitry.torokhov-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
> On Tue, Mar 31, 2015 at 2:06 PM, Thor Thayer
> <tthayer-yzvPICuk2ABMcg4IHK0kFoH6Mc4MB0Vx@public.gmane.org> wrote:
>>
>>
>> On 03/31/2015 03:17 PM, Dmitry Torokhov wrote:
>>>
>>> On Tue, Mar 31, 2015 at 02:57:35PM -0500, Thor Thayer wrote:
>>>>
>>>> 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.
>>>
>>>
>>> Yes.
>>>
>>>>
>>>> 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.
>>>
>>
>> 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.
--
Dmitry
--
To unsubscribe from this list: send the line "unsubscribe linux-spi" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Using gpio_keys with regmapped gpio?
[not found] ` <551AFC2F.3060300-yzvPICuk2ABMcg4IHK0kFoH6Mc4MB0Vx@public.gmane.org>
2015-03-31 20:04 ` Mark Brown
2015-03-31 20:17 ` Dmitry Torokhov
@ 2015-04-03 7:13 ` Geert Uytterhoeven
2 siblings, 0 replies; 7+ messages in thread
From: Geert Uytterhoeven @ 2015-04-03 7:13 UTC (permalink / raw)
To: tthayer-yzvPICuk2ABMcg4IHK0kFoH6Mc4MB0Vx
Cc: Mark Brown, Dmitry Torokhov,
linux-input-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, linux-spi
Hi Thor,
On Tue, Mar 31, 2015 at 9:57 PM, Thor Thayer
<tthayer-yzvPICuk2ABMcg4IHK0kFoH6Mc4MB0Vx@public.gmane.org> wrote:
> 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.
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 -- geert-Td1EMuHUCqxL1ZNQvxDV9g@public.gmane.org
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 majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2015-04-03 7:13 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-03-31 19:57 Using gpio_keys with regmapped gpio? Thor Thayer
[not found] ` <551AFC2F.3060300-yzvPICuk2ABMcg4IHK0kFoH6Mc4MB0Vx@public.gmane.org>
2015-03-31 20:04 ` Mark Brown
2015-03-31 20:17 ` Dmitry Torokhov
2015-03-31 21:06 ` Thor Thayer
[not found] ` <551B0C43.5000101-yzvPICuk2ABMcg4IHK0kFoH6Mc4MB0Vx@public.gmane.org>
2015-04-01 15:59 ` Dmitry Torokhov
[not found] ` <CAKdAkRTwPwSThinV-t6UN3LMY8-XXYJ1dB+11U9SZ=zZT4Kt7g-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2015-04-01 16:00 ` Dmitry Torokhov
2015-04-03 7:13 ` Geert Uytterhoeven
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).