public inbox for linux-omap@vger.kernel.org
 help / color / mirror / Atom feed
* Please help creating gpio-switch on ams-delta
@ 2009-05-12 10:53 Janusz Krzysztofik
  2009-05-13 12:41 ` [RESOLVED] " Janusz Krzysztofik
  2009-05-14 18:12 ` Tony Lindgren
  0 siblings, 2 replies; 3+ messages in thread
From: Janusz Krzysztofik @ 2009-05-12 10:53 UTC (permalink / raw)
  To: linux-omap; +Cc: e3-hacking

[-- Attachment #1: Type: text/plain, Size: 1176 bytes --]

Hi,

I am playing with OMAP 5910 based Amstrad E3 videophone (ams-delta) 
machine. I am trying to expose GPIO 4, that hook switch hangs off, to 
userspace.

I can successfully access the pin by exporting it using gpiolib sysfs. I 
can check its value, following hook switch state changes. However, I 
would like the switch to generate events.

I have tried two methods: gpio-switch and gpio-keys. gpio-switch device 
is able to report the switch initial state correctly, gpio-keys device 
just initializes without errors. However, for both methods, after first 
switch change, the system stops responding, giving no error messages.

The code of goip-switch initialization sequence together with my 
platform device definition (attached) does not look any different to me 
than those for keyboard or modem (patches available from 
http://the.earth.li/pub/e3/2.6.19/), that both also use GPIO interrupts 
and do work for me.

Any hints?

Janusz

PS. This is my first post to linux-omap list, I don't know if you accept 
attachments. If not, next time I switch to a different mail user agent 
that allows me for inline file inclusion (or learn how to do it in my 
thunderbird).


[-- Attachment #2: ams-delta-gpio-switch.patch --]
[-- Type: text/x-patch, Size: 971 bytes --]

--- linux-2.6.27.22/arch/arm/mach-omap1/board-ams-delta.c.orig	2009-05-10 18:05:01.000000000 +0200
+++ linux-2.6.27.22/arch/arm/mach-omap1/board-ams-delta.c	2009-05-10 18:19:18.000000000 +0200
@@ -243,6 +243,17 @@ static struct uart_port ams_delta_modem_
 	.line		= 1
 };
 
+static struct omap_gpio_switch ams_delta_switches[] __initdata = {
+	/* Low when handset is picked up */
+	{
+		.name	= "handset",
+		.gpio	= AMS_DELTA_GPIO_PIN_HOOK_SWITCH,
+		.type	= OMAP_GPIO_SWITCH_TYPE_ACTIVITY,
+		.flags	= OMAP_GPIO_SWITCH_FLAG_INVERTED,
+		/* .notify	= ams_delta_handset_detect, */
+	},
+};
+
 static void __init ams_delta_init(void)
 {
 	printk("ams_delta_init\n\r");
@@ -259,6 +270,9 @@ static void __init ams_delta_init(void)
 
 	platform_add_devices(ams_delta_devices, ARRAY_SIZE(ams_delta_devices));
 
+	omap_register_gpio_switches(ams_delta_switches,
+			ARRAY_SIZE(ams_delta_switches));
+
 	early_serial_setup(&ams_delta_modem_port);
 
 #ifdef CONFIG_AMS_DELTA_FIQ

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [RESOLVED] Please help creating gpio-switch on ams-delta
  2009-05-12 10:53 Please help creating gpio-switch on ams-delta Janusz Krzysztofik
@ 2009-05-13 12:41 ` Janusz Krzysztofik
  2009-05-14 18:12 ` Tony Lindgren
  1 sibling, 0 replies; 3+ messages in thread
From: Janusz Krzysztofik @ 2009-05-13 12:41 UTC (permalink / raw)
  To: linux-omap; +Cc: e3-hacking

Janusz Krzysztofik napisał(a):
> I have tried two methods: gpio-switch and gpio-keys. gpio-switch device 
> is able to report the switch initial state correctly, gpio-keys device 
> just initializes without errors. However, for both methods, after first 
> switch change, the system stops responding, giving no error messages.
> 
> The code of goip-switch initialization sequence together with my 
> platform device definition (attached) does not look any different to me 
> than those for keyboard or modem (patches available from 
> http://the.earth.li/pub/e3/2.6.19/), that both also use GPIO interrupts 
> and do work for me.

Hi,

I have found that one of the patches, keyboard or modem, from 
http://the.earth.li/pub/e3/2.6.19, break gpio interrupt handling (as 
Jonathan McDowell said*, he found it conflicted with the FIQ keyboard 
patch). Without them, both gpio-switch and gpio-keys versions of a 
platform device for ams-delta hook switch do work for me. I can try to 
provide patches against omap git tree if there is any interest.

Thanks,
Janusz

* http://www.earth.li/pipermail/e3-hacking/2009-May/000868.html
--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Please help creating gpio-switch on ams-delta
  2009-05-12 10:53 Please help creating gpio-switch on ams-delta Janusz Krzysztofik
  2009-05-13 12:41 ` [RESOLVED] " Janusz Krzysztofik
@ 2009-05-14 18:12 ` Tony Lindgren
  1 sibling, 0 replies; 3+ messages in thread
From: Tony Lindgren @ 2009-05-14 18:12 UTC (permalink / raw)
  To: Janusz Krzysztofik; +Cc: linux-omap, e3-hacking

* Janusz Krzysztofik <jkrzyszt@tis.icnet.pl> [090512 03:54]:
> Hi,
>
> I am playing with OMAP 5910 based Amstrad E3 videophone (ams-delta)  
> machine. I am trying to expose GPIO 4, that hook switch hangs off, to  
> userspace.
>
> I can successfully access the pin by exporting it using gpiolib sysfs. I  
> can check its value, following hook switch state changes. However, I  
> would like the switch to generate events.
>
> I have tried two methods: gpio-switch and gpio-keys. gpio-switch device  
> is able to report the switch initial state correctly, gpio-keys device  
> just initializes without errors. However, for both methods, after first  
> switch change, the system stops responding, giving no error messages.
>
> The code of goip-switch initialization sequence together with my  
> platform device definition (attached) does not look any different to me  
> than those for keyboard or modem (patches available from  
> http://the.earth.li/pub/e3/2.6.19/), that both also use GPIO interrupts  
> and do work for me.
>
> Any hints?

Please don't use the gpio-switch any longer, that is not in the mainline
and will disappear.

There has been some discussion on LKML on doing it via the input layer.
No other tips right now from me :)

Tony

> Janusz
>
> PS. This is my first post to linux-omap list, I don't know if you accept  
> attachments. If not, next time I switch to a different mail user agent  
> that allows me for inline file inclusion (or learn how to do it in my  
> thunderbird).
>

> --- linux-2.6.27.22/arch/arm/mach-omap1/board-ams-delta.c.orig	2009-05-10 18:05:01.000000000 +0200
> +++ linux-2.6.27.22/arch/arm/mach-omap1/board-ams-delta.c	2009-05-10 18:19:18.000000000 +0200
> @@ -243,6 +243,17 @@ static struct uart_port ams_delta_modem_
>  	.line		= 1
>  };
>  
> +static struct omap_gpio_switch ams_delta_switches[] __initdata = {
> +	/* Low when handset is picked up */
> +	{
> +		.name	= "handset",
> +		.gpio	= AMS_DELTA_GPIO_PIN_HOOK_SWITCH,
> +		.type	= OMAP_GPIO_SWITCH_TYPE_ACTIVITY,
> +		.flags	= OMAP_GPIO_SWITCH_FLAG_INVERTED,
> +		/* .notify	= ams_delta_handset_detect, */
> +	},
> +};
> +
>  static void __init ams_delta_init(void)
>  {
>  	printk("ams_delta_init\n\r");
> @@ -259,6 +270,9 @@ static void __init ams_delta_init(void)
>  
>  	platform_add_devices(ams_delta_devices, ARRAY_SIZE(ams_delta_devices));
>  
> +	omap_register_gpio_switches(ams_delta_switches,
> +			ARRAY_SIZE(ams_delta_switches));
> +
>  	early_serial_setup(&ams_delta_modem_port);
>  
>  #ifdef CONFIG_AMS_DELTA_FIQ


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2009-05-14 18:13 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-05-12 10:53 Please help creating gpio-switch on ams-delta Janusz Krzysztofik
2009-05-13 12:41 ` [RESOLVED] " Janusz Krzysztofik
2009-05-14 18:12 ` Tony Lindgren

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox