Bug 84561

Summary: [ivb] Intel backlight does not adjust, but only turns on/off in kernel 3.16 on Samsung 880Z5E laptop
Product: ACPI Reporter: Vitaliy Filippov (vitalif)
Component: Power-VideoAssignee: Aaron Lu (aaron.lu)
Status: CLOSED CODE_FIX    
Severity: normal CC: aaron.lu, brent.saner, intel-gfx-bugs, laszlo.krekacs.list, scoppino.giuseppe, sluca691, tiwai, vovochka13
Priority: P1    
Hardware: All   
OS: Linux   
Kernel Version: 3.16.2 Subsystem:
Regression: Yes Bisected commit-id:
Attachments: acpidump
my dmidecode
np870z5e-x01hu dmidecode
hw details for samsung np510r5e
Add some samsung models to disable_native_backlight list

Description Vitaliy Filippov 2014-09-14 10:39:46 UTC
Hi!

After upgrading from kernel 3.14 to 3.16 on a Samsung 880Z5E laptop (with dual Intel HD 4000 and Radeon 8770M cards), the intermediate % of backlight don't work.

I.e. /sys/class/backlight/intel_backlight is there with max_brightness=4882 and type=raw, but all brightness levels > 0 result in full brightness, and brightness level = 0 results in the screen turned off. The same is on the brightness adjustment UI: 0% is "turned off", everything greater than 0% is full brightness.

(although when the screen is turned on after being turned off, the backlight turns on smoothly)

acpi_backlight=vendor and video.use_native_backlight=1 also don't work.

What other details do you need? acpidump, dmidecode?
Comment 1 Jani Nikula 2014-09-15 07:38:11 UTC
Please try video.use_native_backlight=0 instead.

What do you have in /sys/class/backlight in 3.14?
Comment 2 Vitaliy Filippov 2014-09-16 21:57:45 UTC
Oh, thank you! It's ok with use_native_backlight=0, and acpi_video0 and acpi_video1 appears in /sys/class/backlight along with intel_backlight.
Comment 3 Jani Nikula 2014-09-17 11:24:03 UTC
Aaron, another machine where intel_backlight doesn't work.
Comment 4 Aaron Lu 2014-09-19 02:29:07 UTC
Please attach acpidump, let's see how its ACPI video backlight interface works.
Comment 5 Vitaliy Filippov 2014-09-23 09:22:06 UTC
Created attachment 151581 [details]
acpidump
Comment 6 Vitaliy Filippov 2014-09-23 09:22:32 UTC
Posted it :)
Comment 7 Laszlo KREKACS 2014-10-14 14:04:57 UTC
I have a Samsung np870z5e-x01hu model laptop, so almost identical  to the reporter, and the bug is exactly the same on my side.
(my videocard is intelhd4000 + Radeon HD 8870)

I created an ubuntu bug about it, with all(?) the info attached here:
https://bugs.launchpad.net/ubuntu/+source/linux/+bug/1380824

(I'm also cross-referencing the two bug, for convenience).

My linux kernel version is:
Linux lasam 3.16.0-21-generic #28-Ubuntu SMP Mon Oct 6 16:00:43 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux

I tried all the below combination (one-by-one, reboot between each try, and check with cat /proc/cmdline):
$ vi /etc/default/grub
in line 11:
GRUB_CMDLINE_LINUX_DEFAULT="quiet splash video.use_native_backlight=1"
GRUB_CMDLINE_LINUX_DEFAULT="quiet splash video.use_native_backlight=0"
GRUB_CMDLINE_LINUX_DEFAULT="quiet splash acpi_backlight=vendor"
GRUB_CMDLINE_LINUX_DEFAULT="quiet splash acpi_osi=Linux acpi_backlight=vendor"
GRUB_CMDLINE_LINUX_DEFAULT="quiet splash video.use_bios_initial_backlight=0"
GRUB_CMDLINE_LINUX_DEFAULT="quiet splash acpi_backlight=Linux"
$ update-grub


None of it worked. Also neither the xorg.conf trick works.

Only the sofware workaround (gamma adjustement) works, but it is not a solution, only workaround:
xrandr --output LVDS-0 --brightness 0.5

Question to the original reporter:
What is your bios version? (sudo dmidecode -s bios-version)

Mine is P02ADH.
Comment 8 Laszlo KREKACS 2014-10-14 14:16:38 UTC
$ cat /proc/cmdline
BOOT_IMAGE=/boot/vmlinuz-3.16.0-21-generic.efi.signed root=UUID=ba121a25-b094-49f5-96bf-ade769938060 ro quiet splash video.use_native_backlight=0 vt.handoff=7

This one does not work. (worked for the reporter?)
Comment 9 Aaron Lu 2014-10-15 02:21:07 UTC
(In reply to Vitaliy Filippov from comment #6)
> Posted it :)

Sorry for the late reply.
From the ASL code, it seems to be EC that controls backlight:
Name (BRTM, One)
In _BCM:
If (LEqual (BRTM, One))
{
        Store (Arg0, ^^^LPCB.H_EC.BRIT)
        Store (Arg0, BRTL)
        Return (Zero)
}

Please attach your dmidecode:
# dmidecode > dmi.txt
Comment 10 Aaron Lu 2014-10-15 02:25:04 UTC
(In reply to Laszlo KREKACS from comment #8)
> $ cat /proc/cmdline
> BOOT_IMAGE=/boot/vmlinuz-3.16.0-21-generic.efi.signed
> root=UUID=ba121a25-b094-49f5-96bf-ade769938060 ro quiet splash
> video.use_native_backlight=0 vt.handoff=7
> 
> This one does not work. (worked for the reporter?)

On Vitaliy's system, the acpi_videoX interface works while the intel_backlight doesn't. Is your system the same? From your description, it seems none of the interfaces work. And since which kernel version you start to have this problem or you always have this problem?
Comment 11 Vitaliy Filippov 2014-10-15 07:50:44 UTC
(In reply to Laszlo KREKACS from comment #7)
> What is your bios version? (sudo dmidecode -s bios-version)

Mine is P02ADH.008.130604.SK

(In reply to Laszlo KREKACS from comment #8)

Yeah, "video.use_native_backlight=0" works for me. Check if you have acpi_video* in /sys/class/backlight...
Comment 12 Vitaliy Filippov 2014-10-15 07:51:30 UTC
Created attachment 153811 [details]
my dmidecode
Comment 13 Laszlo KREKACS 2014-10-15 12:34:54 UTC
Aaron:

> On Vitaliy's system, the acpi_videoX interface works while the
> intel_backlight 
> doesn't. Is your system the same? From your description, it seems none of the 
> interfaces work.  And since which kernel version you start to have this
> problem or you always have this problem?

It never worked by default (tested on ubuntu 13.10, 14.04, 14.10 beta)
I tried now with these kernel versions 
(all from ubuntu package, I'm on 14.10 beta atm):
3.11.0-17 NOT WORKING BY DEFAULT
3.11.0-18 NOT WORKING BY DEFAULT
3.13.0-36 NOT WORKING BY DEFAULT
3.16.0-21 NOT WORKING BY DEFAULT

I always checked against /sys/class/backlight/intel_backlight/brightness.

After using "video.use_native_backlight=0", and checking against:
echo "5" > /sys/class/backlight/acpi_video0/brightness #WORKS
echo "5" > /sys/class/backlight/acpi_video1/brightness #WORKS
echo "5" > /sys/class/backlight/acpi_video1/brightness #NOT WORKING

So I think my case is identical to Vitaliy's case.

Vitaliy:
I have the exact same BIOS version:
P02ADH.008.130604.SK
Comment 14 Laszlo KREKACS 2014-10-15 12:36:16 UTC
Created attachment 153841 [details]
np870z5e-x01hu dmidecode
Comment 15 Laszlo KREKACS 2014-10-15 17:38:21 UTC
I'm sorry for the typo I made in comment #13, here is it correctly:
After using "video.use_native_backlight=0", and checking against:
echo "5" > /sys/class/backlight/acpi_video0/brightness #WORKS
echo "5" > /sys/class/backlight/acpi_video1/brightness #WORKS
echo "5" > /sys/class/backlight/intel_backlight/brightness #NOT WORKING

Under ubuntu 14.10, the hotkeys indeed do control the brightness (along with OSD feedback), after I removed from /etc/X11/xorg.conf.d/xorg.conf file (with "video.use_native_backlight=0" in grub):

# Fix Backlight issue
# Section "Device"
# 	Identifier  "card0"
#	Driver      "intel"
#	Option      "Backlight"  "acpi_video0"
#	BusID       "PCI:0:2:0"
# EndSection

For me, with this workaround, the laptop is working as intended. 
But I will check back regularly, if there are help need for testing.

I'm glad I found this bug:)

OFFTOPIC: 
Vitaliy, can I contact you privately, since you have the same laptop as I, and you also using linux on it?
I have some issues left, what I want to solve with this laptop, namely:
- touchegg does not recognize 2,3 fingers swipe, only 4 fingers swipe
- three finger click is indeed the middle mouse button, but I can't use it for dragging (many program use it for panning, gimp, inkscape, Freecad to name a few).
I would gladly cooperate with someone.
Maybe together would be easier to hunt down these remaining issues.

Otherwise the laptop is in parity with Macbook Pro.
Comment 16 Aaron Lu 2014-11-18 01:24:32 UTC
Laszlo,

Do I understand correctly that as long as you add video.use_native_backlight=0 to your kernel cmdline, backlight adjust will work well?
Comment 17 Vladimir Perepechin 2014-11-18 01:39:38 UTC
Created attachment 157941 [details]
hw details for samsung  np510r5e

In my case (samsung np510r5e) backlight adjustment works almost fine with video.use_native_backlight=0

The only moment, that if backlight set to zero level - screen is still ON.
Comment 18 Aaron Lu 2014-11-18 04:34:48 UTC
(In reply to Vladimir Perepechin from comment #17)
> The only moment, that if backlight set to zero level - screen is still ON.

That is the property of the ACPI video interface, someone likes it and someone hates it. It's not a bug.

Please attach your acpidump, I need to check if your ACPI table claims it is Win8 compatible.
Comment 19 Vladimir Perepechin 2014-11-18 04:37:07 UTC
> Please attach your acpidump, I need to check if your ACPI table claims it is
> Win8 compatible.

It's already in attached archive.
And yep, this laptop comes with win8 by default.
Comment 20 brent s. 2014-12-06 20:56:28 UTC
Samsung NP680Z5E-X01US here, same behaviour. Looks like we have dupes of each other. Bug #84221

Vladimir and Vitaliy, does the behaviour you're experiencing match up to the symptoms and output I provide in that bug as well?
Comment 21 Vladimir Perepechin 2014-12-07 00:45:21 UTC
(In reply to brent s. from comment #20)
> Samsung NP680Z5E-X01US here, same behaviour. Looks like we have dupes of
> each other. Bug #84221
> 
> Vladimir and Vitaliy, does the behaviour you're experiencing match up to the
> symptoms and output I provide in that bug as well?

Yep, it looks like the same bug.
Comment 22 brent s. 2014-12-09 00:49:21 UTC
Per Bug #84221, the following patch restores backlight functionality for me:

diff --git drivers/acpi/video.c drivers/acpi/video.c
index 9d75ead..fcec2b1 100644
--- drivers/acpi/video.c
+++ drivers/acpi/video.c
@@ -504,6 +504,15 @@ static struct dmi_system_id video_dmi_table[] __initdata = {
                DMI_MATCH(DMI_PRODUCT_NAME, "HP ENVY 15 Notebook PC"),
                },
        },
+
+       {
+        .callback = video_disable_native_backlight,
+        .ident = "SAMSUNG 870Z5E/880Z5E/680Z5E",
+        .matches = {
+               DMI_MATCH(DMI_SYS_VENDOR, "SAMSUNG ELECTRONICS CO., LTD."),
+               DMI_MATCH(DMI_PRODUCT_NAME, "870Z5E/880Z5E/680Z5E"),
+               },
+       },      
        {}
 };
 

I'm assuming it will work for you based on the .ident/.matches (based on the dmidecode attached to the ticket). It essentially disables the "intel native backlight" functionality that was introduced in 3.16?.something?


Note that I'm testing this against a vanilla kernel (I'm using ArchLinux, not Ubuntu) and using the following .config:

https://projects.archlinux.org/svntogit/packages.git/plain/trunk/config.x86_64?h=packages/linux

Your userspace mileage may vary, as I don't know how well Ubuntu plays with a non-downstream-patched kernel.

Anyways, beerz for Aaron Lu for finding a fix, and I'm assuming it'll be pushed upstream soon.
Comment 23 Aaron Lu 2014-12-09 05:16:03 UTC
Created attachment 160151 [details]
Add some samsung models to disable_native_backlight list

Brent, Vitaliy, Laszlo and Vladimir,
Please test this patch on top v3.18, this patch adds two models:
870Z5E/880Z5E/680Z5E and 370R4E/370R4V/370R5E/3570RE/370R5V
Thanks.
Comment 24 brent s. 2014-12-10 23:27:47 UTC
Aaron-

Tested the patch you provided in this bug, it also works.

Vitaliy, Vladimir, Laszlo-
If you need help testing this patch to confirm, feel free to contact me on IRC (r00t^2 on freenode) or email (bts@square-r00t.net).
Comment 25 Aaron Lu 2014-12-19 02:46:57 UTC
Vladimir,

Can you please verify the patch in comment #23? Your DMI string is different( 370R4E/370R4V/370R5E/3570RE/370R5V)than others(870Z5E/880Z5E/680Z5E) so I need your confirm before I submit the patch, thanks.
Comment 26 Aaron Lu 2014-12-19 02:48:15 UTC
*** Bug 84221 has been marked as a duplicate of this bug. ***
Comment 27 Vladimir Perepechin 2014-12-19 02:53:09 UTC
(In reply to Aaron Lu from comment #25)
> Vladimir,
> 
> Can you please verify the patch in comment #23? Your DMI string is
> different( 370R4E/370R4V/370R5E/3570RE/370R5V)than
> others(870Z5E/880Z5E/680Z5E) so I need your confirm before I submit the
> patch, thanks.

Sorry, but compiling custom kernels - isn't my strong side.
And i have too few time for this.

But if this patch will switch video_disable_native_backlight to true - this will definitely solve my problem.
Comment 28 Aaron Lu 2014-12-19 03:18:44 UTC
(In reply to Vladimir Perepechin from comment #27)
> (In reply to Aaron Lu from comment #25)
> > Vladimir,
> > 
> > Can you please verify the patch in comment #23? Your DMI string is
> > different( 370R4E/370R4V/370R5E/3570RE/370R5V)than
> > others(870Z5E/880Z5E/680Z5E) so I need your confirm before I submit the
> > patch, thanks.
> 
> Sorry, but compiling custom kernels - isn't my strong side.
> And i have too few time for this.
> 
> But if this patch will switch video_disable_native_backlight to true - this
> will definitely solve my problem.

Yes, the only concern is I may make some mistake in the DMI section or some other place so a test is appreciated.

Anyway, if that's not possible, I'll go ahead and wait for complaints(hopefully none :-)
Comment 29 Aaron Lu 2014-12-22 07:18:54 UTC
Patch sent out with all of you cc-ed:
https://patchwork.kernel.org/patch/5526091/
Comment 30 Aaron Lu 2015-01-06 07:31:10 UTC
commit 7d0b93499f4879ddbc75d594f4ea216ba964f78e
Author: Aaron Lu <aaron.lu@intel.com>
Date:   Mon Dec 22 15:18:05 2014 +0800

    ACPI / video: Add some Samsung models to disable_native_backlight list
Comment 31 Giuseppe Scoppino 2015-04-17 13:20:02 UTC
I have a NP780 which has the same issue, hardware is identical to NP880Z5E.
Comment 32 Giuseppe Scoppino 2015-04-17 13:23:16 UTC
All these laptops most likely need the patch:

NP780Z5E (What I have), NP770Z5E, NP770Z7E
Comment 33 Luca Sica 2015-05-11 23:10:53 UTC
Hello,
Bug is affecting also Samsung Ativ Book 4 (model NP450R5E).

I quickly checked out the patch posted above but as written in the code (I am no expert) I assume it is only for the models specified earlier.

Anyways I found a quick workaround that should work with every NPXXX model.

I used the suggestion indicated above by Jani Nikula and so I have set the kernel parameter video.use_native_backlight=0 instead of value 1.

This let the kernel loading acpi_video0 but it didn't work yet. I manually edited 20-intel.conf with acpi_video0 instead of intel_backlight and I rebooted.
Well now it works perfectly!

Indeed it is a bug, but for now I hope this helps!

Bye
Comment 34 Vitaliy Filippov 2015-05-17 20:30:37 UTC
I just want to confirm that the original bug is fixed, everything is ok with 880z5e on newer kernels. Thanks :)