public inbox for linux-acpi@vger.kernel.org
 help / color / mirror / Atom feed
* Driver for handling SCI interrupt.
@ 2012-02-06  3:25 Daniel Toussaint
  2012-02-06 14:57 ` Matthew Garrett
  0 siblings, 1 reply; 4+ messages in thread
From: Daniel Toussaint @ 2012-02-06  3:25 UTC (permalink / raw)
  To: linux-acpi

Dear list,

I am working on an Intel (ICH8) based system. A custom device on the system
emits interrupts to a GPI on the ICH8 chip. Currently, as a test, I have
from userspace configured the GPI we use to send a SCI. This seems to work,
because I get a "IRQ9 , nobody cared" message from the kernel.
My questions now are :
How do I go about and create an ACPI based driver to catch this event ? Or am
I searching in the wrong direction.
If I am right, and the driver has to go through ACPI, are changes to the
ACPI tables in BIOS required ?

Greetings,

Daniel

--
Gtalk: daniel.toussaint@gmail.com
Skype: supertoussi
Cell: +886-915-680-291

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

* Re: Driver for handling SCI interrupt.
  2012-02-06  3:25 Driver for handling SCI interrupt Daniel Toussaint
@ 2012-02-06 14:57 ` Matthew Garrett
  2012-02-09  5:24   ` Daniel Toussaint
  0 siblings, 1 reply; 4+ messages in thread
From: Matthew Garrett @ 2012-02-06 14:57 UTC (permalink / raw)
  To: Daniel Toussaint; +Cc: linux-acpi

On Mon, Feb 06, 2012 at 11:25:20AM +0800, Daniel Toussaint wrote:

> I am working on an Intel (ICH8) based system. A custom device on the system
> emits interrupts to a GPI on the ICH8 chip. Currently, as a test, I have
> from userspace configured the GPI we use to send a SCI. This seems to work,
> because I get a "IRQ9 , nobody cared" message from the kernel.
> My questions now are :
> How do I go about and create an ACPI based driver to catch this event ? Or am
> I searching in the wrong direction.
> If I am right, and the driver has to go through ACPI, are changes to the
> ACPI tables in BIOS required ?

The ACPI tables should declare the device and its resources, along with 
a unique _HID() to allow the driver to bind to it. There should also be 
a _Lxx or_Exx (depending on whether it's level or edge triggered) method 
for the appropriate GPE (which is the GPIO number + 0x10 on ICH8, I 
believe) which sends a Notify to the ACPI device. It's then trivial to 
write a small Linux acpi driver which will get the notifications.

-- 
Matthew Garrett | mjg59@srcf.ucam.org

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

* Re: Driver for handling SCI interrupt.
  2012-02-06 14:57 ` Matthew Garrett
@ 2012-02-09  5:24   ` Daniel Toussaint
  2012-02-09 12:36     ` Matthew Garrett
  0 siblings, 1 reply; 4+ messages in thread
From: Daniel Toussaint @ 2012-02-09  5:24 UTC (permalink / raw)
  To: Matthew Garrett; +Cc: linux-acpi

Thanks very much for the very helpful info.
I have added the GPE to my DSDT and now I can see the GPE counter in
/sys/firmware/acpi/interrupts increasing whenever I send an SCI.
Further more, I  found the function acpi_install_gpe_handler in the
kernel, and used it successfully to install a handler in a temporary
driver I created.
My custom device is an I2C device that I will read input from ,
whenever my gpe event occurs. Now my question is : this seems to work
without declaring a new device in the DSDT , with an HID - as you
mentioned - so can I get away with doing things this way , or would it
be bad practice ?
Thanks,


On Mon, Feb 6, 2012 at 10:57 PM, Matthew Garrett <mjg59@srcf.ucam.org> wrote:
> On Mon, Feb 06, 2012 at 11:25:20AM +0800, Daniel Toussaint wrote:
>
>> I am working on an Intel (ICH8) based system. A custom device on the system
>> emits interrupts to a GPI on the ICH8 chip. Currently, as a test, I have
>> from userspace configured the GPI we use to send a SCI. This seems to work,
>> because I get a "IRQ9 , nobody cared" message from the kernel.
>> My questions now are :
>> How do I go about and create an ACPI based driver to catch this event ? Or am
>> I searching in the wrong direction.
>> If I am right, and the driver has to go through ACPI, are changes to the
>> ACPI tables in BIOS required ?
>
> The ACPI tables should declare the device and its resources, along with
> a unique _HID() to allow the driver to bind to it. There should also be
> a _Lxx or_Exx (depending on whether it's level or edge triggered) method
> for the appropriate GPE (which is the GPIO number + 0x10 on ICH8, I
> believe) which sends a Notify to the ACPI device. It's then trivial to
> write a small Linux acpi driver which will get the notifications.
>
> --
> Matthew Garrett | mjg59@srcf.ucam.org



-- 
Gtalk: daniel.toussaint@gmail.com
Skype: supertoussi
Cell: +886-915-680-291

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

* Re: Driver for handling SCI interrupt.
  2012-02-09  5:24   ` Daniel Toussaint
@ 2012-02-09 12:36     ` Matthew Garrett
  0 siblings, 0 replies; 4+ messages in thread
From: Matthew Garrett @ 2012-02-09 12:36 UTC (permalink / raw)
  To: Daniel Toussaint; +Cc: linux-acpi

On Thu, Feb 09, 2012 at 01:24:02PM +0800, Daniel Toussaint wrote:
> Thanks very much for the very helpful info.
> I have added the GPE to my DSDT and now I can see the GPE counter in
> /sys/firmware/acpi/interrupts increasing whenever I send an SCI.
> Further more, I  found the function acpi_install_gpe_handler in the
> kernel, and used it successfully to install a handler in a temporary
> driver I created.
> My custom device is an I2C device that I will read input from ,
> whenever my gpe event occurs. Now my question is : this seems to work
> without declaring a new device in the DSDT , with an HID - as you
> mentioned - so can I get away with doing things this way , or would it
> be bad practice ?

Well, if it works, you can obviously do it without any further 
modification :) It would arguably be more "correct" to define it as a 
full ACPI device - that way you can have module autoloading and 
automatic resource discovery. But if you're happy with a static 
configuration then just go with what you have now.

-- 
Matthew Garrett | mjg59@srcf.ucam.org

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

end of thread, other threads:[~2012-02-09 12:36 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-02-06  3:25 Driver for handling SCI interrupt Daniel Toussaint
2012-02-06 14:57 ` Matthew Garrett
2012-02-09  5:24   ` Daniel Toussaint
2012-02-09 12:36     ` Matthew Garrett

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