Bug 108971

Summary: [Samsung NP530U4E-K02PL] Cannot change backlight
Product: ACPI Reporter: adam bk (adamdd55)
Component: Power-VideoAssignee: Aaron Lu (aaron.lu)
Status: CLOSED CODE_FIX    
Severity: normal CC: aaron.lu, jani.nikula
Priority: P1    
Hardware: Intel   
OS: Linux   
Kernel Version: 4.4.0-040400rc3-generic Subsystem:
Regression: No Bisected commit-id:
Attachments: acpidump output
dmesg
dmesg when acpi_backlight=video drm.debug=0xe
dmesg with acpi_video0
dmesg intel backlight
dmidecode
quirk to use acpi_video

Description adam bk 2015-12-07 01:18:11 UTC
Created attachment 196491 [details]
acpidump output

It is not possible to change screen backlight. A workaround is to add
a flag acpi_osi=
Comment 1 Aaron Lu 2015-12-07 02:43:09 UTC
dmesg and lspci please, and please also list /sys/class/backlight, thanks.
Comment 2 adam bk 2015-12-07 08:33:44 UTC
/sys/class/backlight
acpi_video0 -> ../../devices/pci0000:00/0000:00:02.0/backlight/acpi_video0
intel_backlight -> ../../devices/pci0000:00/0000:00:02.0/drm/card0/card0-LVDS-1/intel_backlight

lspci:
00:00.0 Host bridge: Intel Corporation 3rd Gen Core processor DRAM Controller (rev 09)
00:02.0 VGA compatible controller: Intel Corporation 3rd Gen Core processor Graphics Controller (rev 09)
00:14.0 USB controller: Intel Corporation 7 Series/C210 Series Chipset Family USB xHCI Host Controller (rev 04)
00:16.0 Communication controller: Intel Corporation 7 Series/C210 Series Chipset Family MEI Controller #1 (rev 04)
00:1a.0 USB controller: Intel Corporation 7 Series/C210 Series Chipset Family USB Enhanced Host Controller #2 (rev 04)
00:1b.0 Audio device: Intel Corporation 7 Series/C210 Series Chipset Family High Definition Audio Controller (rev 04)
00:1c.0 PCI bridge: Intel Corporation 7 Series/C210 Series Chipset Family PCI Express Root Port 1 (rev c4)
00:1c.3 PCI bridge: Intel Corporation 7 Series/C210 Series Chipset Family PCI Express Root Port 4 (rev c4)
00:1d.0 USB controller: Intel Corporation 7 Series/C210 Series Chipset Family USB Enhanced Host Controller #1 (rev 04)
00:1f.0 ISA bridge: Intel Corporation HM76 Express Chipset LPC Controller (rev 04)
00:1f.2 SATA controller: Intel Corporation 7 Series Chipset Family 6-port SATA Controller [AHCI mode] (rev 04)
00:1f.3 SMBus: Intel Corporation 7 Series/C210 Series Chipset Family SMBus Controller (rev 04)
01:00.0 Network controller: Intel Corporation Centrino Advanced-N 6235 (rev 24)
02:00.0 Ethernet controller: Realtek Semiconductor Co., Ltd. RTL8111/8168/8411 PCI Express Gigabit Ethernet Controller (rev 06)
Comment 3 adam bk 2015-12-07 08:34:43 UTC
Created attachment 196521 [details]
dmesg
Comment 4 Aaron Lu 2015-12-07 09:03:44 UTC
The firmware claims to support Win8, so the ACPI video driver will not register acpi_videoX interface if you do not add any acpi_osi kernel cmdline options and the intel_backlight is supposed to provide this functionality.

Please test if manually change backlight through intel_backlight works:
# cd /sys/class/backlight/intel_backlight
# cat max_brightness
XXX
# echo some_value_smaller_than_max > brightness
see if backlight changes.
Comment 5 adam bk 2015-12-07 21:03:22 UTC
There is no change in backlight when I change the value in intel_backlight/brightness
It may help or not, but previously I was testing it with ubuntu-patched kernels in similar way, here is the track, https://bugs.launchpad.net/ubuntu/+source/linux/+bug/1516320

Let me know if I can help you somehow with it.
Comment 6 Aaron Lu 2015-12-08 02:26:21 UTC
The acpi_osi= cmdline option is a big hammer and may affect many things, so please test:
1 acpi_backlight=video cmdline option alone, see if acpi_videoX interface works;
2 acpi_osi="!Windows 2012" cmdline option alone, see if acpi_videoX interface works.
Thanks.
Comment 7 adam bk 2015-12-08 21:22:59 UTC
In both cases, backlight works properly.
Comment 8 Aaron Lu 2015-12-09 02:26:33 UTC
If case 1 acpi_videoX interface works, then intel_backlight interface should also work since in the Win8 case(the firmware default case if we do not pass any acpi_osi= string), the acpi_videoX interface's backlight control is relayed to GPU driver. Can you please double check: boot with "acpi_backlight=video drm.debug=0xe" cmdline option, and manually change brightness file of both acpi_videoX and intel_backlight see if backlight change works, and after the test, capture dmesg and upload it, thanks.
Comment 9 adam bk 2015-12-09 22:23:20 UTC
When I boot with acpi_backlight=video drm.debug=0xe
I can change backlight with /sys/class/backlight/acpi_video0/brightness

however manipulating with /sys/class/backlight/intel_backlight
doesn't make any effect.

Dmesg is as attachment - dmesg_20151209.txt
Comment 10 adam bk 2015-12-09 22:24:45 UTC
Created attachment 196981 [details]
dmesg when acpi_backlight=video drm.debug=0xe
Comment 11 Aaron Lu 2015-12-10 02:08:28 UTC
The dmesg doesn't seem have drm.debug=0xe cmdline option set, and it seems to be taken right after boot? Can you please capture two dmesgs that:
1 with "acpi_backlight=video drm.debug=0xe" cmdline option, after boot, adjust backlight level through acpi_videoX interface and then capture the dmesg;
2 with "acpi_backlight=video drm.debug=0xe" cmdline option, after boot, adjust backlight level through intel_backlight interface and then capture the dmesg.
Thanks.
Comment 12 adam bk 2015-12-10 08:45:37 UTC
Created attachment 196991 [details]
dmesg with acpi_video0
Comment 13 adam bk 2015-12-10 08:45:57 UTC
Created attachment 197001 [details]
dmesg intel backlight
Comment 14 adam bk 2015-12-10 08:49:02 UTC
Sorry, I probably missed update-grub that time... 

It is done in both cases (but I can't see acpi output in dmesg like for intel backlight) - here are these changes 
/sys/class/backlight/acpi_video0# cat max_brightness 
95
/sys/class/backlight/acpi_video0# echo 30 > brightness 
/sys/class/backlight/acpi_video0# echo 18 > brightness 
/sys/class/backlight/acpi_video0# echo 42 > brightness

It works in acpi, but doesn't work in intel_backlight.
Comment 15 Aaron Lu 2015-12-11 03:41:22 UTC
Thanks for the log.
So from the log, the GPU driver did modify the backlight:
[   97.100108] [drm:intel_backlight_device_update_status] updating intel_backlight, brightness=3000/4650
[   97.100120] [drm:intel_panel_actually_set_backlight] set backlight PWM = 3414
But it just doesn't work.

Jani,
Do you want to take a look at it? If no clue, I can add a quirk to force the firmware interface for this laptop(its firmware claims Win8). Thanks.
Comment 16 Aaron Lu 2015-12-24 01:52:34 UTC
Adam,

Please attach your dmi info:
# dmidecode > dmi.info

I'll quirk your laptop to use acpi_video interface by default.
Comment 17 adam bk 2015-12-25 13:51:47 UTC
Created attachment 198311 [details]
dmidecode
Comment 18 Aaron Lu 2015-12-28 02:25:11 UTC
Created attachment 198361 [details]
quirk to use acpi_video

Patch is prepared on top of latest linus git tree, may also apply cleanly on older kernels.
Comment 19 adam bk 2015-12-29 17:46:20 UTC
I have built a new kernel with this patch, rebooted without flags, it works - I can change backlight in /sys/class/backlight/acpi_video0
Comment 20 Aaron Lu 2015-12-30 05:24:52 UTC
Patch sent out with all of you CC-ed.
https://patchwork.kernel.org/patch/7931931/
Comment 21 Aaron Lu 2016-01-14 06:20:53 UTC
commit 49eb5208220a9eef7529decbdefd95e4b94a928b
Author: Aaron Lu <aaron.lu@intel.com>
Date:   Wed Dec 30 13:11:24 2015 +0800

    ACPI / video: Add a quirk to force acpi-video backlight on SAMSUNG 530U4E/540U4E