All of lore.kernel.org
 help / color / mirror / Atom feed
* About GPIO interrupt function with sysfs
@ 2011-02-18  0:34 Tomoya MORINAGA
  2011-02-18  0:42 ` Grant Likely
  2011-03-03 18:53 ` Grant Likely
  0 siblings, 2 replies; 11+ messages in thread
From: Tomoya MORINAGA @ 2011-02-18  0:34 UTC (permalink / raw)
  To: 'Grant Likely', linux-kernel
  Cc: 'Ewe, Kok Howg', 'Lai, Mee Sim',
	'Toshiharu Okada'

Hi,

I have a question.
Can our GPIO driver (pch_gpio) have interrupt function?

With Best Regards,
-----------------------------------------
Tomoya MORINAGA
OKI SEMICONDUCTOR CO., LTD.


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

* Re: About GPIO interrupt function with sysfs
  2011-02-18  0:34 About GPIO interrupt function with sysfs Tomoya MORINAGA
@ 2011-02-18  0:42 ` Grant Likely
  2011-02-18  1:26   ` Tomoya MORINAGA
  2011-03-02  6:38   ` Tomoya MORINAGA
  2011-03-03 18:53 ` Grant Likely
  1 sibling, 2 replies; 11+ messages in thread
From: Grant Likely @ 2011-02-18  0:42 UTC (permalink / raw)
  To: Tomoya MORINAGA
  Cc: linux-kernel, Ewe, Kok Howg, Lai, Mee Sim, Toshiharu Okada

On Thu, Feb 17, 2011 at 5:34 PM, Tomoya MORINAGA
<morinaga526@dsn.okisemi.com> wrote:
> Hi,
>
> I have a question.
> Can our GPIO driver (pch_gpio) have interrupt function?

yes.

g.

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

* RE: About GPIO interrupt function with sysfs
  2011-02-18  0:42 ` Grant Likely
@ 2011-02-18  1:26   ` Tomoya MORINAGA
  2011-03-02  6:38   ` Tomoya MORINAGA
  1 sibling, 0 replies; 11+ messages in thread
From: Tomoya MORINAGA @ 2011-02-18  1:26 UTC (permalink / raw)
  To: 'Grant Likely'
  Cc: linux-kernel, 'Ewe, Kok Howg', 'Lai, Mee Sim',
	'Toshiharu Okada'

Hi Grant,

Thank you for your information.
It seems use "edge" file,
using poll/select usermode application can detect the interrupt.

Thanks,
-----------------------------------------
Tomoya MORINAGA
OKI SEMICONDUCTOR CO., LTD.


> -----Original Message-----
> From: linux-kernel-owner@vger.kernel.org 
> [mailto:linux-kernel-owner@vger.kernel.org] On Behalf Of Grant Likely
> Sent: Friday, February 18, 2011 9:43 AM
> To: Tomoya MORINAGA
> Cc: linux-kernel@vger.kernel.org; Ewe, Kok Howg; Lai, Mee 
> Sim; Toshiharu Okada
> Subject: Re: About GPIO interrupt function with sysfs
> 
> On Thu, Feb 17, 2011 at 5:34 PM, Tomoya MORINAGA 
> <morinaga526@dsn.okisemi.com> wrote:
> > Hi,
> >
> > I have a question.
> > Can our GPIO driver (pch_gpio) have interrupt function?
> 
> yes.
> 
> g.
> --
> To unsubscribe from this list: send the line "unsubscribe 
> linux-kernel" in the body of a message to 
> majordomo@vger.kernel.org More majordomo info at  
> http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at  http://www.tux.org/lkml/
> 


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

* RE: About GPIO interrupt function with sysfs
  2011-02-18  0:42 ` Grant Likely
  2011-02-18  1:26   ` Tomoya MORINAGA
@ 2011-03-02  6:38   ` Tomoya MORINAGA
  2011-03-03 18:56     ` Grant Likely
  2011-03-10 15:52     ` Rabin Vincent
  1 sibling, 2 replies; 11+ messages in thread
From: Tomoya MORINAGA @ 2011-03-02  6:38 UTC (permalink / raw)
  To: 'Grant Likely'
  Cc: linux-kernel, 'Ewe, Kok Howg', 'Lai, Mee Sim',
	'Toshiharu Okada'

Hi Grant,

On Friday, February 18, 2011 9:43 AM, Grant Likely wrote:
> > Can our GPIO driver (pch_gpio) have interrupt function?
> 
> yes.
Need your help.

I try to add interrupt function to GPIO driver of Intel EG20T PCH(pch_gpio.c).

However, executing "echo xxx > export", there is not "edge" file in /sys/class/gpio/gpioxxx/.

Seeing source code in gpio_export@gpiolib.c, like below

int gpio_export(unsigned gpio, bool direction_may_change)
{
snip...

	if (!status && gpio_to_irq(gpio) >= 0
			&& (direction_may_change
				|| !test_bit(FLAG_IS_OUT,
					&desc->flags))) {
		status = device_create_file(dev,
				&dev_attr_edge);
		printk("%s:device_create_file!!! status=0x%x\n", __func__, status);
	}

snip...
}

The above "device_create_file(dev, &dev_attr_edge);" is not executed.

Seeing gpio_to_irq@arch/x86/include/asm/gpio.h, like below.

static inline int gpio_to_irq(unsigned int gpio)
{
	return -ENOSYS;
}

Thus,  device_create_file for "edge" is never executed.

Could you tell me how to create "edge" file ?

With Best Regards,
-----------------------------------------
Tomoya MORINAGA
OKI SEMICONDUCTOR CO., LTD.


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

* Re: About GPIO interrupt function with sysfs
  2011-02-18  0:34 About GPIO interrupt function with sysfs Tomoya MORINAGA
  2011-02-18  0:42 ` Grant Likely
@ 2011-03-03 18:53 ` Grant Likely
  1 sibling, 0 replies; 11+ messages in thread
From: Grant Likely @ 2011-03-03 18:53 UTC (permalink / raw)
  To: Tomoya MORINAGA
  Cc: linux-kernel, 'Ewe, Kok Howg', 'Lai, Mee Sim',
	'Toshiharu Okada'

On Fri, Feb 18, 2011 at 09:34:03AM +0900, Tomoya MORINAGA wrote:
> Hi,
> 
> I have a question.
> Can our GPIO driver (pch_gpio) have interrupt function?

Yes, but you cannot use it from userspace via sysfs.  It is only useful for in-kernel users.

g.


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

* Re: About GPIO interrupt function with sysfs
  2011-03-02  6:38   ` Tomoya MORINAGA
@ 2011-03-03 18:56     ` Grant Likely
  2011-03-04  0:06       ` Tomoya MORINAGA
  2011-03-10 15:52     ` Rabin Vincent
  1 sibling, 1 reply; 11+ messages in thread
From: Grant Likely @ 2011-03-03 18:56 UTC (permalink / raw)
  To: Tomoya MORINAGA
  Cc: linux-kernel, 'Ewe, Kok Howg', 'Lai, Mee Sim',
	'Toshiharu Okada'

On Wed, Mar 02, 2011 at 03:38:13PM +0900, Tomoya MORINAGA wrote:
> Hi Grant,
> 
> On Friday, February 18, 2011 9:43 AM, Grant Likely wrote:
> > > Can our GPIO driver (pch_gpio) have interrupt function?
> > 
> > yes.
> Need your help.
> 
> I try to add interrupt function to GPIO driver of Intel EG20T PCH(pch_gpio.c).
> 
> However, executing "echo xxx > export", there is not "edge" file in /sys/class/gpio/gpioxxx/.
> 
> Seeing source code in gpio_export@gpiolib.c, like below
> 
> int gpio_export(unsigned gpio, bool direction_may_change)
> {
> snip...
> 
> 	if (!status && gpio_to_irq(gpio) >= 0
> 			&& (direction_may_change
> 				|| !test_bit(FLAG_IS_OUT,
> 					&desc->flags))) {
> 		status = device_create_file(dev,
> 				&dev_attr_edge);
> 		printk("%s:device_create_file!!! status=0x%x\n", __func__, status);
> 	}
> 
> snip...
> }

Hmmm, I haven't looked at that code yet.  I didn't realize that the
irq data was exported to userspace (ignore my last email).

> 
> The above "device_create_file(dev, &dev_attr_edge);" is not executed.
> 
> Seeing gpio_to_irq@arch/x86/include/asm/gpio.h, like below.
> 
> static inline int gpio_to_irq(unsigned int gpio)
> {
> 	return -ENOSYS;
> }
> 
> Thus,  device_create_file for "edge" is never executed.
> 
> Could you tell me how to create "edge" file ?

I don't know.  I'll need to dig into that code before I can answer.  I
suggest digging into it yourself to figure out the answer as I cannot
promise that I'll get to it anytime soon.

g.

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

* RE: About GPIO interrupt function with sysfs
  2011-03-03 18:56     ` Grant Likely
@ 2011-03-04  0:06       ` Tomoya MORINAGA
  2011-03-10 15:13         ` Lai, Mee Sim
  0 siblings, 1 reply; 11+ messages in thread
From: Tomoya MORINAGA @ 2011-03-04  0:06 UTC (permalink / raw)
  To: 'Grant Likely'
  Cc: linux-kernel, 'Ewe, Kok Howg', 'Lai, Mee Sim',
	'Toshiharu Okada'

Hi Grant, 

On Friday, March 04, 2011 3:57 AM, Grant Likely wrote:
> I don't know.  I'll need to dig into that code before I can 
> answer.  I suggest digging into it yourself to figure out the 
> answer as I cannot promise that I'll get to it anytime soon.

Seeing "gpio_to_irq" of another architecture (e.g. ARM), there is significant code in it.
In addition, you can see "Not implemented, yet" description in "arch/x86/include/asm/gpio.h"
Thus, I suspect that x86 GPIO sysfs can't support interrupt function at present.

Thanks,
-----------------------------------------
Tomoya MORINAGA
OKI SEMICONDUCTOR CO., LTD.


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

* RE: About GPIO interrupt function with sysfs
  2011-03-04  0:06       ` Tomoya MORINAGA
@ 2011-03-10 15:13         ` Lai, Mee Sim
  2011-03-17 18:51           ` Grant Likely
  0 siblings, 1 reply; 11+ messages in thread
From: Lai, Mee Sim @ 2011-03-10 15:13 UTC (permalink / raw)
  To: Tomoya MORINAGA, 'Grant Likely'
  Cc: linux-kernel@vger.kernel.org, Ewe, Kok Howg,
	'Toshiharu Okada'

Hi Grant,
Is there any update on this? thanks!

Thanks & Regards,
Michelle Lai Mee Sim
Software Platform Application Engineer
inet:82532218

-----Original Message-----
From: Tomoya MORINAGA [mailto:tomoya-linux@dsn.okisemi.com] 
Sent: Friday, March 04, 2011 8:06 AM
To: 'Grant Likely'
Cc: linux-kernel@vger.kernel.org; Ewe, Kok Howg; Lai, Mee Sim; 'Toshiharu Okada'
Subject: RE: About GPIO interrupt function with sysfs

Hi Grant, 

On Friday, March 04, 2011 3:57 AM, Grant Likely wrote:
> I don't know.  I'll need to dig into that code before I can 
> answer.  I suggest digging into it yourself to figure out the 
> answer as I cannot promise that I'll get to it anytime soon.

Seeing "gpio_to_irq" of another architecture (e.g. ARM), there is significant code in it.
In addition, you can see "Not implemented, yet" description in "arch/x86/include/asm/gpio.h"
Thus, I suspect that x86 GPIO sysfs can't support interrupt function at present.

Thanks,
-----------------------------------------
Tomoya MORINAGA
OKI SEMICONDUCTOR CO., LTD.


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

* Re: About GPIO interrupt function with sysfs
  2011-03-02  6:38   ` Tomoya MORINAGA
  2011-03-03 18:56     ` Grant Likely
@ 2011-03-10 15:52     ` Rabin Vincent
  2011-03-11  0:07       ` Tomoya MORINAGA
  1 sibling, 1 reply; 11+ messages in thread
From: Rabin Vincent @ 2011-03-10 15:52 UTC (permalink / raw)
  To: Tomoya MORINAGA
  Cc: Grant Likely, linux-kernel, Ewe, Kok Howg, Lai, Mee Sim,
	Toshiharu Okada

On Wed, Mar 2, 2011 at 12:08, Tomoya MORINAGA
<tomoya-linux@dsn.okisemi.com> wrote:
> Seeing gpio_to_irq@arch/x86/include/asm/gpio.h, like below.
>
> static inline int gpio_to_irq(unsigned int gpio)
> {
>        return -ENOSYS;
> }

That's not what is in latest mainline:

commit 718c45bd1aa80c4e23a0ee204c973e3014e94708
Author: Alek Du <alek.du@intel.com>
Date:   Tue Jan 11 10:55:32 2011 +0000

    x86/gpio: Implement x86 gpio_to_irq convert function

    We need this for x86 MID platforms where GPIO interrupts are
    used. No special magic is needed so the default 1:1 behaviour
    will do nicely.

    Signed-off-by: Alek Du <alek.du@intel.com>
    Signed-off-by: Jacob Pan <jacob.jun.pan@intel.com>
    Signed-off-by: Alan Cox <alan@linux.intel.com>
    LKML-Reference: <20110111105439.24448.69863.stgit@bob.linux.org.uk>
    Signed-off-by: Ingo Molnar <mingo@elte.hu>

diff --git a/arch/x86/include/asm/gpio.h b/arch/x86/include/asm/gpio.h
index 49dbfdf..91d915a 100644
--- a/arch/x86/include/asm/gpio.h
+++ b/arch/x86/include/asm/gpio.h
@@ -38,12 +38,9 @@ static inline int gpio_cansleep(unsigned int gpio)
 	return __gpio_cansleep(gpio);
 }

-/*
- * Not implemented, yet.
- */
 static inline int gpio_to_irq(unsigned int gpio)
 {
-	return -ENOSYS;
+	return __gpio_to_irq(gpio);
 }

 static inline int irq_to_gpio(unsigned int irq)

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

* RE: About GPIO interrupt function with sysfs
  2011-03-10 15:52     ` Rabin Vincent
@ 2011-03-11  0:07       ` Tomoya MORINAGA
  0 siblings, 0 replies; 11+ messages in thread
From: Tomoya MORINAGA @ 2011-03-11  0:07 UTC (permalink / raw)
  To: 'Rabin Vincent'
  Cc: 'Grant Likely', linux-kernel, 'Ewe, Kok Howg',
	'Lai, Mee Sim', 'Toshiharu Okada'

Hi  Rabin,

Friday, March 11, 2011 12:52 AM, Rabin Vincent wrote:
> That's not what is in latest mainline:

Thank you for your information.
I could confirm the latest mainline (2.6.38-rc8) "gpio_to_irq" has meaningful processing.
(I have used the latest stable kernel "2.6.37" series. )

Thanks!
-----------------------------------------
Tomoya MORINAGA
OKI SEMICONDUCTOR CO., LTD.


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

* Re: About GPIO interrupt function with sysfs
  2011-03-10 15:13         ` Lai, Mee Sim
@ 2011-03-17 18:51           ` Grant Likely
  0 siblings, 0 replies; 11+ messages in thread
From: Grant Likely @ 2011-03-17 18:51 UTC (permalink / raw)
  To: Lai, Mee Sim
  Cc: Tomoya MORINAGA, linux-kernel@vger.kernel.org, Ewe, Kok Howg,
	'Toshiharu Okada'

On Thu, Mar 10, 2011 at 11:13:05PM +0800, Lai, Mee Sim wrote:
> Hi Grant,
> Is there any update on this? thanks!

Nope, nor did I make any promises that I would have the time to do so.
Sorry.

g.

> 
> Thanks & Regards,
> Michelle Lai Mee Sim
> Software Platform Application Engineer
> inet:82532218
> 
> -----Original Message-----
> From: Tomoya MORINAGA [mailto:tomoya-linux@dsn.okisemi.com] 
> Sent: Friday, March 04, 2011 8:06 AM
> To: 'Grant Likely'
> Cc: linux-kernel@vger.kernel.org; Ewe, Kok Howg; Lai, Mee Sim; 'Toshiharu Okada'
> Subject: RE: About GPIO interrupt function with sysfs
> 
> Hi Grant, 
> 
> On Friday, March 04, 2011 3:57 AM, Grant Likely wrote:
> > I don't know.  I'll need to dig into that code before I can 
> > answer.  I suggest digging into it yourself to figure out the 
> > answer as I cannot promise that I'll get to it anytime soon.
> 
> Seeing "gpio_to_irq" of another architecture (e.g. ARM), there is significant code in it.
> In addition, you can see "Not implemented, yet" description in "arch/x86/include/asm/gpio.h"
> Thus, I suspect that x86 GPIO sysfs can't support interrupt function at present.
> 
> Thanks,
> -----------------------------------------
> Tomoya MORINAGA
> OKI SEMICONDUCTOR CO., LTD.
> 

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

end of thread, other threads:[~2011-03-17 18:51 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-02-18  0:34 About GPIO interrupt function with sysfs Tomoya MORINAGA
2011-02-18  0:42 ` Grant Likely
2011-02-18  1:26   ` Tomoya MORINAGA
2011-03-02  6:38   ` Tomoya MORINAGA
2011-03-03 18:56     ` Grant Likely
2011-03-04  0:06       ` Tomoya MORINAGA
2011-03-10 15:13         ` Lai, Mee Sim
2011-03-17 18:51           ` Grant Likely
2011-03-10 15:52     ` Rabin Vincent
2011-03-11  0:07       ` Tomoya MORINAGA
2011-03-03 18:53 ` Grant Likely

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.