Notifications about ACPI events in userspace?

Florian Echtler floe at butterbrot.org
Sun May 14 09:25:48 UTC 2017


On 14.05.2017 10:11, Lukas Wunner wrote:
> On Sat, May 13, 2017 at 06:47:16PM +0200, Florian Echtler wrote:
>> On 13.05.2017 14:18, Lukas Wunner wrote:
>>>
>>> Then you could switch back and forth via the vga_switcheroo interface.
>>
>> Hm... since there's no power switching of any kind involved, would that
>> still make sense?
> 
> The handler's ->power_state hook would be a no-op.  Obviously not pretty,
> but we just don't have a better abstraction yet.  We represent an egress
> connector on a graphics card as a drm_connector in sysfs.  What we might
> need is a representation of a sink (display) in sysfs with symlinks to the
> sources.  Such a source could be a drm_connector or something else
> entirely (a GPU on another machine in your case).

OK, I think it's the closest thing that's already in the kernel, and before I
add yet another custom sysfs node, vga_switcheroo is probably the easiest route
to get things up and running.

>> AFAICT, the alternative (which maybe would be more sensible, the more I
>> think about it) would be to export applesmc_{read,write}_key as public
>> symbols and just access them from a standalone driver for the APP000C
>> ACPI device. Since that should only be present on a Mac that actually
>> supports TDM, there's also no risk of writing to arbitrary SMC keys on
>> unsupported devices.
> 
> That might make sense if you feel the driver will grow large enough to
> make applesmc.c look messy, or if you feel it just doesn't fit there.

Everything else in applesmc.c is hwmon-related, IMHO it would be a kludge. So
for applesmc, I'd just need a tiny patch to export the main key access
functions, and everything else can (hopefully) be encapsulated in an "apple-tdm"
driver.

> I guess the only reason why Apple integrated the functionality into the
> SMC is because they wanted to support TDM when the machine is powered off.
> The SMC is powered even in S5 (if the iMac is connected to AC), it just
> needs to monitor HPD on the external port and turn on the backlight if
> something is plugged in.  (I'm not sure if TDM is actually supported
> during poweroff but technically it would seem to be supported.)

Hm, interesting, I hadn't yet thought of that. This would of course be
excellent, because right now it looks like a waste of power to run the whole
machine just because of the display.

Does the SMC have control over the backlight? Do you know which keys are
responsible? IIRC the apple_bl.c driver didn't work on my iMac anyway...

Best, Florian
-- 
SENT FROM MY DEC VT50 TERMINAL

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 181 bytes
Desc: OpenPGP digital signature
URL: <https://lists.freedesktop.org/archives/dri-devel/attachments/20170514/3ffb3f80/attachment-0001.sig>


More information about the dri-devel mailing list