Bug 12174 - No backlight control on Samsung x360
Summary: No backlight control on Samsung x360
Status: RESOLVED CODE_FIX
Alias: None
Product: Drivers
Classification: Unclassified
Component: Other (show other bugs)
Hardware: All Linux
: P1 normal
Assignee: drivers_other
URL:
Keywords:
Depends on:
Blocks: 56331
  Show dependency tree
 
Reported: 2008-12-07 07:11 UTC by Matthias Heinz
Modified: 2013-04-09 06:23 UTC (History)
13 users (show)

See Also:
Kernel Version: 2.6.28-rc8
Subsystem:
Regression: Yes
Bisected commit-id:


Attachments
decompiled acpidump (267.49 KB, text/plain)
2008-12-13 13:53 UTC, Matthias Heinz
Details
acpidump samsung x360 (157.58 KB, text/plain)
2008-12-18 09:44 UTC, Matthias Heinz
Details
ACPI Dump before updating my BIOS (157.58 KB, text/plain)
2009-01-01 20:31 UTC, Mark Hayes
Details
ACPI Dump after updating my BIOS (157.58 KB, text/plain)
2009-01-01 20:32 UTC, Mark Hayes
Details
standard config of used debian kernel (89.49 KB, application/octet-stream)
2009-02-11 13:45 UTC, Matthias Heinz
Details
lsmod output of the 2.6.26 debian standard kernel (2.89 KB, application/octet-stream)
2009-02-11 13:45 UTC, Matthias Heinz
Details

Description Matthias Heinz 2008-12-07 07:11:57 UTC
Latest working kernel version: 2.6.26
Earliest failing kernel version:
Distribution: Debian/Unstable+Experimental
Hardware Environment:Samsung x360, GMA X4500
Problem Description:

I cant control the brightness of the backlight with a 
2.6.28-rc7. It worked under mysterious circumstances with a 2.6.26. 
Mysterious, because i had to use /proc/acpi/video/NVID/LCD/brightness to set 
it, which obviously belongs to a nvidia driver (but theres nothing from 
nvidia in here...)

I have no hardware brightness control here, the keys for brightness up/down and disable backlight just send keycodes like:
atkbd.c: Unknown key pressed (translated set 2, code 0x83 on isa0060/serio0).
atkbd.c: Use 'setkeycodes e003 <keycode>' to make it known.


Some output you might be interessted in:
# lspci -vxxx -s 00:02.0
00:02.0 VGA compatible controller: Intel Corporation Mobile 4 Series Chipset 
Integrated Graphics Controller (rev 07) (prog-if 00 [VGA controller])
        Subsystem: Samsung Electronics Co Ltd Device c03e
        Flags: bus master, fast devsel, latency 0, IRQ 316
        Memory at fc000000 (64-bit, non-prefetchable) [size=4M]
        Memory at d0000000 (64-bit, prefetchable) [size=256M]
        I/O ports at 1800 [size=8]
        Capabilities: [90] Message Signalled Interrupts: Mask- 64bit- 
Queue=0/0 Enable+
        Capabilities: [d0] Power Management version 3
00: 86 80 42 2a 07 04 90 00 07 00 00 03 00 00 80 00
10: 04 00 00 fc 00 00 00 00 0c 00 00 d0 00 00 00 00
20: 01 18 00 00 00 00 00 00 00 00 00 00 4d 14 3e c0
30: 00 00 00 00 90 00 00 00 00 00 00 00 0b 01 00 00
40: 00 00 00 00 48 00 00 00 09 00 0a 11 88 70 00 1e
50: 01 80 50 03 19 00 00 00 00 00 00 00 00 00 00 be
60: 00 00 00 00 00 00 02 00 00 00 00 00 00 00 00 00
70: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
80: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
90: 05 d0 01 00 0c 30 e0 fe 81 41 00 00 00 00 00 00
a0: 00 00 00 00 09 00 06 20 00 00 00 00 00 00 00 00
b0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
c0: 00 00 00 00 00 00 00 00 00 00 00 00 40 01 00 00
d0: 01 00 23 00 00 00 00 00 00 00 00 00 34 00 00 00
e0: 00 00 00 00 00 00 00 00 00 80 00 1a 41 20 00 00
f0: 09 08 34 07 ff 00 00 00 a0 0f 07 00 20 10 b6 bd

# cat /proc/dri/0/i915_gem_interrupt
Interrupt enable:    00000053
Interrupt identity:  00000000
Interrupt mask:      fffedfae
Pipe A stat:         00040000
Pipe B stat:         00400206
Interrupts received: 41
Current sequence:    180
Waiter sequence:     0
IRQ sequence:        92

Matthew Garrett asked me to do this:
> Does writing a value into the /sys/class/backlight
> interface result in an interrupt in the i915_gem_interrupts file?

Before:
# cat /proc/dri/0/i915_gem_interrupt
Interrupt enable:    00000053
Interrupt identity:  00000000
Interrupt mask:      fffedfae
Pipe A stat:         00040000
Pipe B stat:         00400206
Interrupts received: 336
Current sequence:    13742
Waiter sequence:     0
IRQ sequence:        260

after
# echo 5 >  /sys/class/backlight/acpi_video0/brightness
# cat /proc/dri/0/i915_gem_interrupt
Interrupt enable:    00000053
Interrupt identity:  00000000
Interrupt mask:      fffedfae
Pipe A stat:         00040000
Pipe B stat:         00400206
Interrupts received: 336
Current sequence:    13836
Waiter sequence:     0
IRQ sequence:        260


Best regards,
Matthias
Comment 1 Matthias Heinz 2008-12-13 13:53:38 UTC
Created attachment 19283 [details]
decompiled acpidump

According to the acpidump output NVID belongs to the laptop and this is really a regression.
Comment 2 Thomas Renninger 2008-12-18 05:15:03 UTC
I expect the NVID is an ACPI graphics dummy device if an external nvidia card is added to the board.
Since .28 these dummy devices are ignored.

The ACPI graphics device which should get used on your machine is:
Device (GFX0)
{
    Name (_ADR, 0x00020000)
(compare _ADR with lspci above, it matches the slot (00:02)

This device has opregion support which also got added with .28:
drivers/gpu/drm/i915/i915_opregion.c

Strange is that the NVID device has brightness change functions (_BCM,..),
but the GFX0 has not.
Better provide acpidump, maybe these are hidden in a SSDT.

Best you also update your BIOS first (or even better, provide acpidump, then update, then provide new acpidump. It could be interesting for someone what they changed in their ACPI tables...).
Comment 3 Matthias Heinz 2008-12-18 09:44:39 UTC
Created attachment 19361 [details]
acpidump samsung x360

Here is the acpidump.

Actually there really seems to be a bios update available, but its not possible for me to flash the bios, because that file doesnt work with Linux. Shame on samsung.
Comment 4 Mike Lothian 2008-12-18 14:47:21 UTC
I'm also having very similar issues with a Samsung R510 laptop

It's currently being worked on in another bug. Least your laptop doesn't reboot when you try and manually change the brightness

It could be worth while to create a small partition for Vista on the laptop just for updating the bios. The restore disk should have came with it and it's just vista without the crapware and using a tool like PartedMagic LiveCD means you won't loose your files in linux

Hope this is some help

A fellow frustrated Samsung customer
Comment 5 Matthias Heinz 2008-12-18 14:55:24 UTC
I will see if I can find anyone with a usb cd drive, because this laptop ships without one.

And it should be possible for me the resize my ext3 partition. I'd even install Windows to help getting Linux support for this laptop.
Comment 6 Mark Hayes 2009-01-01 20:31:30 UTC
Created attachment 19599 [details]
ACPI Dump before updating my BIOS

As requested by Matthias, I am enclosing an ACPI Dump before and after updating my BIOS.  I'm running a Samsung X360-34P with Vista and Ubuntu 8.10.
Comment 7 Mark Hayes 2009-01-01 20:32:42 UTC
Created attachment 19600 [details]
ACPI Dump after updating my BIOS

See markh.acpidump.before_bios_update
Comment 8 Matthias Heinz 2009-01-02 00:41:07 UTC
Thanks!

As far as I can see there is just one change:

-RSD PTR @ 0xf72c0
+RSD PTR @ 0xf7250

Tell me if I'm wrong, but this doesn't look like its the backlight control.
Comment 9 Mark Hayes 2009-01-02 07:53:40 UTC
Yes, that's the only change when diff'ing the 2 files.

Someone else said that brightness could be adjusted in grub, but when I do that, it is overridden (set to full bright) as Ubuntu starts up.  If you know how to avoid that problem, I would appreciate any tips.  It would be nice to at least be able to set the brightness at boot time.
Comment 10 John F 2009-01-04 04:42:21 UTC
Hello, I have the same problem. I am running Kubuntu Intrepid Ibex. Please let me know if I can provide some information to help.
Comment 11 Matthias Heinz 2009-01-04 06:09:51 UTC
For the record:
This bug only affects kernel 2.6.28. With older versions the backlight can be controled via /sys/class/backlight/NVID/brightness iirc. The NVID interface was removed for 2.6.28.

The brightness keys don't send acpi commands, they send just normal keycodes (if you bind some keycodes for it). If you wanna use them, configure your windowmanager to.
Comment 12 Zhang Rui 2009-02-04 17:14:30 UTC
does "/proc/acpi/video/GFX0/DD04/brightness" work for you in 2.6.28 and 2.6.26?

do you know which driver creates the "/sys/class/backlight/NVID/brightness" for you? please check if it's still loaded. Because thomas' patch doesn't remove it.

this is an ACPI video problem to me. Move it to the ACPI category.
Comment 13 Matthias Heinz 2009-02-07 13:06:01 UTC
"/proc/acpi/video/GFX0/DD04/brightness" does not work. Neither in 2.6.28 nor in 2.6.26.


The /sys/class/backlight/NVID/* is created by the "video" driver (just in 2.6.26, not in .28)
Comment 14 Thomas Renninger 2009-02-08 02:59:25 UTC
The /sys/class/backlight/NVID/* is created by the "video" driver (just in
2.6.26, not in .28)
> which is correct as you have an intel card, right?

The "/proc/acpi/video/GFX0/DD04/brightness" seem to be the correct one and it has Opregion support. Matthew pointed out that there were several issues ruled out lately related to i915 irq management AFAIK.
According to your output in the description, the irq was not incremented when you tried to the modify brightness level. I recommend to try latest .29-rcX kernel, make sure you have the Intel i915 drm and related compile options set and eventually the right module loaded (if compiled as module), again look at the /proc/dri/0/i915_gem_interrupt file then.
Comment 15 Zhang Rui 2009-02-08 18:20:20 UTC
> The /sys/class/backlight/NVID/* is created by the "video" driver
no, it's not.
the ACPI video drivers only create /sys/class/backlight/acpi_videoX/ directories.
/sys/class/backlight/NVID/ must be created by some platform drivers, which may actual work on this laptop.
Comment 16 Matthias Heinz 2009-02-11 13:36:12 UTC
Thomas:
I tried 2.6.29-rc4, doesn't work.

#  cat /proc/dri/0/i915_gem_interrupt
Interrupt enable:    00000053
Interrupt identity:  00000000
Interrupt mask:      fffedfae
Pipe A stat:         00000000
Pipe B stat:         00400206
Interrupts received: 318
Current sequence:    0
Waiter sequence:     0
IRQ sequence:        0

# cat /proc/acpi/video/GFX0/DD04/brightness
levels:  10 20 35 50 65 85
current: 85

# echo 10 > /proc/acpi/video/GFX0/DD04/brightness

#  cat /proc/dri/0/i915_gem_interrupt
Interrupt enable:    00000053
Interrupt identity:  00000000
Interrupt mask:      fffedfae
Pipe A stat:         00000000
Pipe B stat:         00400206
Interrupts received: 318
Current sequence:    0
Waiter sequence:     0
IRQ sequence:        0

With
CONFIG_DRM_I915=y
Comment 17 Matthias Heinz 2009-02-11 13:45:05 UTC
Created attachment 20203 [details]
standard config of used debian kernel

This is the config of the debian prebuild kernel i use. With this kernel i get the NVID entries.
Comment 18 Matthias Heinz 2009-02-11 13:45:39 UTC
Created attachment 20204 [details]
lsmod output of the 2.6.26 debian standard kernel
Comment 19 Matthias Heinz 2009-02-11 13:46:54 UTC
Zhang Rui: There's no other driver that could create the NVID entries, just the video driver is loaded. But remember, this is from a 2.6.26 kernel.
Comment 20 Matthias Heinz 2009-02-15 14:15:22 UTC
Tried 2.6.29-rc5, no change.
Comment 21 Zhang Rui 2009-02-25 18:15:53 UTC
(In reply to comment #13)
> 
> The /sys/class/backlight/NVID/* is created by the "video" driver (just in
> 2.6.26, not in .28)
> 
hah, you must mean /proc/acpi/video/NVID/, right?

the NVID I/F changes the backlight in a legacy but working way.
the GFX0 I/F needs the IGD OpRegion support. But unfortunately it doesn't work on this laptop.

I have a similar problem on a sony laptop.
i915_gem_interrupt doesn't increase when I poking the sysfs backlight interface,
and no backlight change.
But the problem got fixed by upgrading the X to the latest git tree.
can you please give this a try?

Matthew, thomas,
does the IGD OpRegion support require a newer X?
Comment 22 Matthias Heinz 2009-02-26 00:22:17 UTC
Why should i need X to change my backlight? This makes no sense to me. There're still people out there using framebuffer and just terminals to work, no X to take control over the backlight. Backlight control must not depend on X.

And I'm using already Xorg 1.5.99.902 on the laptop.

btw: I tried 2.6.29-rc6, no change.
Comment 23 Peter Alm 2009-02-28 03:37:47 UTC
FWIW you need to be logged in to the desktop to control the brightness in windows vista. It does not work at the login screen etc
Comment 24 Matthias Heinz 2009-02-28 04:24:17 UTC
There's an easy explanation for this: The brightness keys just send normal keycodes. The drivers for those keys have to be loaded in W*nd*ws. (It's just a setkeycode in linux)
Comment 25 Zhang Rui 2009-03-27 03:13:25 UTC
this is a i915 problem as there is no interrupt when changing the backlight via IGD Opregion mechanism.
re-assign to Video-drm category.
Comment 26 Gordon Jin 2009-09-18 03:00:18 UTC
Does this still exist in 2.6.31?
Comment 27 Matthias Heinz 2009-09-18 08:40:09 UTC
$ uname -a
Linux Harmony 2.6.31-2009.09.10 #1 SMP PREEMPT Thu Sep 10 11:09:26 CEST 2009 i686 GNU/Linux

$ cat /proc/acpi/video/GFX0/DD04/brightness
levels:  5 10 20 35 50 65 85 100

$ echo 10 > /proc/acpi/video/GFX0/DD04/brightness

$ cat /proc/acpi/video/GFX0/DD04/brightness
levels:  5 10 20 35 50 65 85 100
current: 10

And no change to the brightness. Therefore the answer is yes, it still exists in 2.6.31

(and someday I will write Samsung an email, hoping that they tell me how they wired this thing)
Comment 28 zhenyuw 2009-12-28 05:34:50 UTC
Please try new 'samsung-laptop' kernel driver for backlight control on samsung, and recent xf86-video-intel release which contains support for adjust backlight through randr.
Comment 29 Matthias Heinz 2009-12-28 16:25:35 UTC
Tried samsung-laptop and it does not work. But I'm trying to get in contact with Greg Kroah.
Comment 30 Matthias Heinz 2009-12-29 09:43:42 UTC
Ok, I just received an answer from him.

The samsung-laptop driver is only for laptops with a special BIOS, which Samsung made for machines comming with Linux and that more changes are needed to get this to work.

Anyone with connections to Samsung here?
Comment 31 Liaz 2010-01-29 10:38:20 UTC
Hello
I solved the problem using compiz :
I use it in french so I try to translate the settings :
accessibility > Opacity, brightness and saturation > brightness > 
Here I set keyboard commands to up and down brightness, and at the end of the setting page I configured "specific settings for windows" this way : 
new > windows : any , value : 70. 

Hope this might be helpfull. 
Regards
Liaz
Comment 32 Matthias Heinz 2010-02-02 20:10:12 UTC
I guess this uses the so called "legacy mode" to change the brightness. This is one way, but only works within X.
Comment 33 Liaz 2010-02-03 05:11:26 UTC
no idea what is the "legacy mode" :)
i'm very not good at linux - simple user recently arrived from windows so ... ;)
But to me compiz was exactly what I was waiting for :)
Comment 34 darkbasic 2010-02-19 22:27:35 UTC
With 2.6.33-rc8-git4 and x11-drivers/xf86-video-intel there is still no way to adjust screen brightness.
Since I do not use compiz I cannot believe there is no way to achieve a decent power saving :(
Please fix it.
Comment 35 darkbasic 2010-02-19 22:28:58 UTC
I meant xf86-video-intel-2.10.0, sorry for the double email.
Comment 36 Matthias Heinz 2010-02-20 09:21:02 UTC
Well, to me it looks like this bug will never get closed in the intel driver, because it may be a BIOS problem. There are netbooks from Samsung and they need a special driver (called samsung-laptop) to control the backlight. It is very likely that we've got the same problem here. So, if somebody knows someone from Samsung, it would be very nice to ask, if we could get some documentation (also the wifi and led control depends on this).

Has anyone still windows running on the laptop? How is the control there? I guess you need a special driver for the brightness up/down-keys.
Comment 37 Liaz 2010-02-20 18:01:13 UTC
I still have a windows session (vista) and the control works perfectly well with the Fn up/down controling
Comment 38 darkbasic 2010-02-20 19:19:47 UTC
I opened a bug on freedesktop (https://bugs.freedesktop.org/show_bug.cgi?id=26664) and I found a trick to change brightness:

# lspci | grep VGA
00:02.0 VGA compatible controller: Intel Corporation Mobile 4 Series Chipset
Integrated Graphics Controller (rev 07)
# setpci -s 00:02.0 F4.B=xx (a value between 00 and FF, where FF is 100%)

It would be awesome being able to change brightness in a STANDARD way like xrandr, otherwise it will not work with powerdevil (kde's power manager) except with a suid script.
Comment 39 darkbasic 2010-02-26 22:59:53 UTC
I found this in /var/log/messages:
[    0.148830] [Firmware Bug]: ACPI: ACPI brightness control misses _BQC function
Comment 40 Jesse Barnes 2010-07-23 19:55:02 UTC
Sounds like a platform bug then, or a dupe of https://bugs.freedesktop.org/show_bug.cgi?id=26664.
Comment 41 darkbasic 2010-07-23 20:06:44 UTC
Unfortunately I still not tested that patch (there are much more serious bugs which bore me like https://bugs.freedesktop.org/show_bug.cgi?id=27169). Is it merged into 2.6.35-rc5?

Darkbasic
Comment 42 Jesse Barnes 2010-07-23 20:28:35 UTC
No, Matthew hasn't pushed it yet pending some other backlight driver work.
Comment 43 Jesse Barnes 2010-07-23 20:28:56 UTC
Oops didn't mean to close this one.
Comment 44 xonatius 2010-12-20 00:19:41 UTC
Try https://github.com/xonatius/samsung-backlight if bug is still present.
Comment 45 darkbasic 2011-02-03 11:12:08 UTC
Your patch works, thank you very much!
Comment 46 Matthias Heinz 2011-03-23 17:59:24 UTC
Hi,

do you know if this patch will go into the mainline kernel and when?


Regards,
Matthias
Comment 47 Matthias Heinz 2011-06-15 09:58:09 UTC
Backlightcontrol works since 2.6.39.

Note You need to log in before you can comment on or make changes to this bug.