Re: [PATCH 1/2] vga_switcheroo: add power support for windows 10 machines.

From: Dave Airlie
Date: Wed Mar 09 2016 - 17:01:20 EST

On 10 March 2016 at 00:33, Lukas Wunner <lukas@xxxxxxxxx> wrote:
> Hi Dave,
> On Wed, Mar 09, 2016 at 04:14:04PM +1000, Dave Airlie wrote:
>> From: Dave Airlie <airlied@xxxxxxxxxx>
>> Windows 10 seems to have standardised power control for the
>> optimus/powerxpress laptops using PR3 power resource hooks.
> What happened to the Optimus DSM, does this still work? If not,
> echoing OFF to the vgaswitcheroo sysfs file won't power down the
> GPU now, right? (If runtime pm is disabled in nouveau.)

No it doesn't work, hence why I had to go dig through this method. When
you report Windows 2013 ACPI support to the BIOS it disables the PS3 method,
and relies on hitting the PR3 method. Unlike ATPX I couldn't find any
indicator bit
in the optimus DSM to say which method to use. So we get to try both methods.

I've confirmed on my older machine that if there are no PR3 methods, then it
has no effect.

> How about implementing an additional vga_switcheroo handler somewhere
> in drivers/acpi/, which looks for the PR3 hooks and registers with
> vga_switcheroo if found. The ->power_state callback of that handler
> would then invoke acpi_device_set_power().

I've nothing to trigger off when to register in that case. I'm not
sure if the PR3
hooks alone are enough to tell you whether you should be using this method.
The ATPX guys have a bit we need to read to know if we should be using this

> In any case this patch should be amended with kerneldoc for
> vga_switcheroo_init_parent_pr3_ops(), I've spent considerable time
> last year to document everything and kindly ask that this water not
> be muddied again. ;-)
> One small nit, the headers are sorted alphabetically yet acpi.h is
> added at the end.

I'll add those in v2.