linux-acpi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Lukas Wunner <lukas@wunner.de>
To: Florian Echtler <floe@butterbrot.org>
Cc: linux-acpi <linux-acpi@vger.kernel.org>
Subject: Re: Notifications about ACPI events in userspace?
Date: Fri, 12 May 2017 12:06:52 +0200	[thread overview]
Message-ID: <20170512100652.GA22013@wunner.de> (raw)
In-Reply-To: <71a48bf5-54b5-6d7b-d574-e0aa6c1acb80@butterbrot.org>

On Fri, May 12, 2017 at 10:37:47AM +0200, Florian Echtler wrote:
> I'm currently adding support for the iMac's target display mode (TDM) to
> Linux.

Cool!


> When an external DisplayPort source is added/removed, the following ACPI
> code is invoked:
> 
>     Scope (\_SB.PCI0.LPCB.SMC)
>     {
>         Device (DPPT)
>         {
>             Name (_HID, EisaId ("APP000C"))  // _HID: Hardware ID
>             Name (_CID, "smc-dppt")  // _CID: Compatible ID
>         }
>     }
> 
>    Scope (\_SB.PCI0.LPCB.EC)
>     {
>         Method (_Q30, 0, NotSerialized)  // _Qxx: EC Query
>         {
>             Notify (\_SB.PCI0.LPCB.SMC.DPPT, 0x80) // Status Change
>         }
> 
>         Method (_Q31, 0, NotSerialized)  // _Qxx: EC Query
>         {
>             Notify (\_SB.PCI0.LPCB.SMC.DPPT, 0x81) // Information Change
>         }
>     }
> 
> 
> I've already verified that the method calls do indeed take place, by
> turning on EC debugging. The APP000C device does also exist in /sys.
> 
> However, I'm not seeing anything happening with either acpi_listen or
> kacpimon.
> Does this require any kernel changes, or could I subscribe to these
> events somehow?

You can subscribe to these events by calling acpi_install_notify_handler().
See drivers/platform/x86/apple-gmux.c for an example.  That's a driver for
APP000B, a custom chip found on dual-GPU MacBook Pros dubbed GMUX which is
responsible for multiplexing the panel between the GPUs.

I'm not sure what APP000C is, could be a similar custom controller, I'd have
to do some research first to know what it does.  Surely "DP" stands for
DisplayPort, but what does "PT" stand for?

Perhaps apple-gmux.c could serve as a template for an APP000C driver.
The code should be easy to understand, if you have questions just ask away.

Thanks,

Lukas

  reply	other threads:[~2017-05-12 10:06 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-05-12  8:37 Notifications about ACPI events in userspace? Florian Echtler
2017-05-12 10:06 ` Lukas Wunner [this message]
2017-05-12 11:05   ` Florian Echtler
2017-05-13 12:18     ` Lukas Wunner
2017-05-13 16:47       ` Florian Echtler
2017-05-14  8:11         ` Lukas Wunner
2017-05-14  9:25           ` Florian Echtler
2017-05-14 13:13             ` Lukas Wunner

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170512100652.GA22013@wunner.de \
    --to=lukas@wunner.de \
    --cc=floe@butterbrot.org \
    --cc=linux-acpi@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).