Bug 63111

Summary: i915 video: Initial brightness is zero
Product: ACPI Reporter: Kirill Tkhai (tkhai)
Component: Power-VideoAssignee: acpi_power-video
Status: CLOSED CODE_FIX    
Severity: normal CC: aaron.lu
Priority: P1    
Hardware: All   
OS: Linux   
Kernel Version: 3.11 Subsystem:
Regression: No Bisected commit-id:
Attachments: dmidecode
dmesg
patch
acpidump

Description Kirill Tkhai 2013-10-16 00:46:09 UTC
Created attachment 111171 [details]
dmidecode

Hi, ACPI Developers!

The problem is that on my HP 250 G1 initial brightness of video is zero:

$ cat /sys/class/backlight/acpi_video0/brightness
0

$ cat /sys/class/backlight/intel_backlight/brightness
0

This can be fixed with video.use_bios_initial_backlight=0 parameter advised by Jani Nikula here:

https://bugs.freedesktop.org/show_bug.cgi?id=70256

He directed me to your bugzilla.

Regards,
Kirill
Comment 1 Kirill Tkhai 2013-10-16 00:47:25 UTC
 lspci is:
 00:02.0 VGA compatible controller: Intel Corporation 2nd Generation Core Processor Family Integrated Graphics Controller (rev 09) (prog-if 00 [VGA controller])
         Subsystem: Hewlett-Packard Company Device 1854
         Control: I/O+ Mem+ BusMaster+ SpecCycle- MemWINV- VGASnoop- ParErr- Stepping- SERR- FastB2B- DisINTx+
         Status: Cap+ 66MHz- UDF- FastB2B+ ParErr- DEVSEL=fast >TAbort- <TAbort- <MAbort- >SERR- <PERR- INTx-
         Latency: 0
         Interrupt: pin A routed to IRQ 42
         Region 0: Memory at c2000000 (64-bit, non-prefetchable) [size=4M]
         Region 2: Memory at b0000000 (64-bit, prefetchable) [size=256M]
         Region 4: I/O ports at 4000 [size=64]
         Expansion ROM at <unassigned> [disabled]
         Capabilities: [90] MSI: Enable+ Count=1/1 Maskable- 64bit-
                 Address: fee0f00c  Data: 41b1
         Capabilities: [d0] Power Management version 2
                 Flags: PMEClk- DSI+ D1- D2- AuxCurrent=0mA PME(D0-,D1-,D2-,D3hot-,D3cold-)
                 Status: D0 NoSoftRst- PME-Enable- DSel=0 DScale=0 PME-
         Capabilities: [a4] PCI Advanced Features
                 AFCap: TP+ FLR+
                 AFCtrl: FLR-
                 AFStatus: TP-
         Kernel driver in use: i915
Comment 2 Kirill Tkhai 2013-10-16 00:49:39 UTC
Created attachment 111181 [details]
dmesg
Comment 3 Aaron Lu 2013-10-17 07:16:31 UTC
Thanks for reporting.

Possible to prepare a patch for this? You can reference driver/acpi/video.c, check video_dmi_table for callback video_ignore_initial_backlight, add your system there should be enough.
Comment 4 Kirill Tkhai 2013-10-17 17:18:05 UTC
Created attachment 111471 [details]
patch
Comment 5 Kirill Tkhai 2013-10-17 17:19:59 UTC
(In reply to Aaron Lu from comment #3)
>You can reference driver/acpi/video.c,

Intresting, there are many HP's laptops, as I see..
Comment 6 Aaron Lu 2013-10-18 00:50:43 UTC
Thanks for the patch, please send it to linux ACPI mailing list for merge: linux-acpi@vger.kernel.org and cc ACPI maintainer "Rafael J. Wysocki" <rjw@rjwysocki.net>.
Comment 7 Kirill Tkhai 2013-10-18 11:58:59 UTC
I've just done this
Comment 8 Aaron Lu 2013-10-24 07:06:11 UTC
Patch sent to mailing list for merge:
https://patchwork.kernel.org/patch/3066081/
Comment 9 Aaron Lu 2013-10-28 02:23:03 UTC
Please also attach acpidump here, I want to take a look, thanks.
# acpidump > acpidump.txt
Comment 10 Kirill Tkhai 2013-10-28 02:28:30 UTC
Created attachment 112471 [details]
acpidump
Comment 11 Aaron Lu 2013-10-28 03:13:52 UTC
The ASL code initialize initial brightness level to 100, but only for OS that is pre-vista. Don't know why it does this...

The _INI method is run during the ACPI device is first discovered.
Method (_INI, 0, NotSerialized)  // _INI: Initialize
{
	If (LLess (OSYS, 0x07D6))
	{
		Store (0x64, BRTL)
	}
	... ...
}

The _BQC method is used to tell the current brightness level
Method (_BQC, 0, NotSerialized)  // _BQC: Brightness Query Current
{
	Return (BRTL)
}

Since it is not initialized in _INI(as we report to firmware we are Windows 2012), the video module thought the initial brightness level is 0 and then set level 0. The cmdline option use_bios_initial_backlight=0 is used to tell video module that the initial backlight level firmware reported is wrong and do not use it.
Comment 12 Kirill Tkhai 2013-10-28 04:04:10 UTC
I'm very far from ACPI logic, so your answer on this binary acpidump really sounds like a magic for me ;)

Thanks for your Reviewed-by.

(In reply to Aaron Lu from comment #11)
> The ASL code initialize initial brightness level to 100, but only for OS
> that is pre-vista. Don't know why it does this...

May be in case of this notebook vista prints something ugly on the screen during short period of initial initialization (just "to finding a mare's nest" -- if google translator does not lie about this idiom :)
Comment 13 Aaron Lu 2013-10-29 05:33:29 UTC
commit e37f14a5fb85522f3bbf88ece6134c4e610ed598
Author: Kirill Tkhai <tkhai@yandex.ru>
Date:   Fri Oct 18 15:56:44 2013 +0400

    ACPI / video: Ignore BIOS initial backlight value for HP 250 G1

Entered maintainer's linux-next branch.
Comment 14 Aaron Lu 2013-11-05 05:09:29 UTC
It turned out there are more systems share this problem:
https://bugzilla.kernel.org/show_bug.cgi?id=61231
https://bugzilla.kernel.org/show_bug.cgi?id=64031

To avoid adding too many systems to the quirk table, I made a patch to fix the initial brightness level 0 problem, see here:
https://bugzilla.kernel.org/show_bug.cgi?id=61231#c10

Can you please test it too? If it can also solve your problem, we can save an entry in DMI table, thanks.
Comment 15 Kirill Tkhai 2013-11-05 19:07:59 UTC
Yes, the patches solve the problem.
Comment 16 Aaron Lu 2013-11-15 06:11:34 UTC
commit 2c62333a408f5badd2d2ffd7177f95deeccc5ca4
Author: Aaron Lu <aaron.lu@intel.com>
Date:   Wed Nov 6 09:07:10 2013 +0800

    ACPI / video: Quirk initial backlight level 0

Entered Linus' tree.