Hi,
I have a question.
Can our GPIO driver (pch_gpio) have interrupt function?
With Best Regards,
-----------------------------------------
Tomoya MORINAGA
OKI SEMICONDUCTOR CO., LTD.
On Thu, Feb 17, 2011 at 5:34 PM, Tomoya MORINAGA
<[email protected]> wrote:
> Hi,
>
> I have a question.
> Can our GPIO driver (pch_gpio) have interrupt function?
yes.
g.
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: [email protected]
> [mailto:[email protected]] On Behalf Of Grant Likely
> Sent: Friday, February 18, 2011 9:43 AM
> To: Tomoya MORINAGA
> Cc: [email protected]; 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
> <[email protected]> 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
> [email protected] More majordomo info at
> http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at http://www.tux.org/lkml/
>
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 [email protected], 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.
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.
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 [email protected], 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.
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.
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:[email protected]]
Sent: Friday, March 04, 2011 8:06 AM
To: 'Grant Likely'
Cc: [email protected]; 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.
On Wed, Mar 2, 2011 at 12:08, Tomoya MORINAGA
<[email protected]> 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 <[email protected]>
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 <[email protected]>
Signed-off-by: Jacob Pan <[email protected]>
Signed-off-by: Alan Cox <[email protected]>
LKML-Reference: <[email protected]>
Signed-off-by: Ingo Molnar <[email protected]>
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)
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.
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:[email protected]]
> Sent: Friday, March 04, 2011 8:06 AM
> To: 'Grant Likely'
> Cc: [email protected]; 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.
>