Bug 82141

Summary: _DOS value not restored properly at ACPI video module unload
Product: ACPI Reporter: Rafal (fatwildcat)
Component: Power-VideoAssignee: Aaron Lu (aaron.lu)
Status: CLOSED MOVED    
Severity: low CC: aaron.lu
Priority: P1    
Hardware: All   
OS: Linux   
Kernel Version: 3.16.0 Subsystem:
Regression: No Bisected commit-id:

Description Rafal 2014-08-11 06:32:44 UTC
File drivers/acpi/video.c, function acpi_video_bus_stop_devices contains the following code:
    return acpi_video_bus_DOS(video, 0,
                  acpi_osi_is_win8() ? 0 : 1);

As I understand, the function is invoked at module unload and it should restore default value of _DOS, which, according to specification, is equal to 1. That is, the function should be rather invoked as:

    return acpi_video_bus_DOS(video, 1, 0);
Comment 1 Aaron Lu 2014-08-12 07:41:08 UTC
Seems reasonable, but do you see any real effect of this change? i.e. is there any broken case with the current code?

BTW, bugzilla is not a place for discussion of such things, the mailing list is:
linux-acpi@vger.kernel.org
Comment 2 Rafal 2014-08-13 19:15:40 UTC
Honestly, I have found this strange function call during investigation of another (a real) problem. In real life the module gets never unloaded on my machine. But I wanted to load/unload the module several times during my investigations.

The misbehavior of the call is not surprising. My laptop has a button which switches video output. When pressed once, the laptop screen goes black and monitor is turned on. Pressing again, they go opposite. When the module is loaded, the switching stops to work. Instead, an event file appears in /dev/input, which reports the button pressing. As I understand, the system has the ability to read the press events and respond appropriately.

When the module is unloaded, the event file disappears, but the button pressing still does not have any effect. Although, when the above function call is changed, the screens switching starts to work back.

The above function is invoked twice. First time - at module loading. The first call, as I understand, causes to stop automatic switching of video output and start of pressing reporting by ACPI BIOS. The second call is at module unloading. I think the intention of the second call was to revert changes made at module loading, although currently it does not.

Especially the value of 1 of the second parameter for older BIOS versions looks strange. ACPI version 1.0 does not accept non-zero value of the bit #2.
Comment 3 Aaron Lu 2014-08-14 01:33:09 UTC
That sounds reasonable and should be in the patch's changelog, once that is done, please submit the patch to linux-acpi@vger.kernel.org for merge, thanks!