Bug 57151

Summary: Backlight controls do not work
Product: Drivers Reporter: leoni.massimiliano1
Component: Video(DRI - Intel)Assignee: intel-gfx-bugs (intel-gfx-bugs)
Status: RESOLVED DUPLICATE    
Severity: normal CC: aaron.lu, intel-gfx-bugs
Priority: P1    
Hardware: All   
OS: Linux   
Kernel Version: >=3.8.5 Subsystem:
Regression: No Bisected commit-id:
Attachments: lspci -v output

Description leoni.massimiliano1 2013-04-26 22:27:04 UTC
I'm on a Dell XPS 13 running Archlinux with Intel chipset ad Intel Graphics HD 4000 video card.

With kernel versions <= 3.8.4, all backlight controls work properly: the slider in the battery plasma widget, hot keys on the keyboard and also echoing directly into /sys/class/backlight/acpi_video0/...

If I update to a version >= 3.8.5 [tested up to 3.8.8] backlight goes crazy and sets brightness to 100% at startup; moreover, none of the mentioned controls will work and thus it will be impossible to reduce brightness.


The other day, a strange thing happened: I was in the described situation and was trying to manually set the brightness with echo.
Now, in my /sys/class/backlight/ there are two directories, acpi_video0 and intel_backlight.
I tried to echo a value into intel_backlight/brightness and the screen started flashing, as if it was trying to repeatedly update both the value in acpi_video0 and the one in intel_backlight.
After a couple more echoes, backlight controls [all of them] simply started working properly, until the following reboot. I didn't try to reproduce this last episode.
Comment 1 Aaron Lu 2013-04-27 06:09:40 UTC
There is no code change in acpi video driver from 3.8.4 to 3.8.5. The following commit from graphics driver looks suspicious:
0e7a2fe01333f72c1cec1cd4d5293a62c770fa4f, can you please revert that commit and test? Thanks.
Comment 2 leoni.massimiliano1 2013-04-28 09:03:29 UTC
Ehm.... I'm sorry but I'm not sure how to do this :)
Which repository should I clone? Is there a guide somewhere?
Comment 3 leoni.massimiliano1 2013-04-29 19:07:53 UTC
I have an update!

I found out that, with one of the "problematic" kernels - I'm on 3.8.10 right now -, if I do

$ su
$ echo 0 > /sys/class/backlight/intel_backlight/brightness 

it completely restores correct behavior, i.e. plasma widget and special keys work and brightness can be adjusted. The problem is still present on following boots.


Oddly, if I do

$ sudo echo 0 > /sys/class/backlight/intel_backlight/brightness 

it says

bash: /sys/class/backlight/intel_backlight/brightness: access denied.

A friend suggested this could be a kernel bug, and may be the key to the solution.
Is this any helpful?
Comment 4 Aaron Lu 2013-05-02 01:04:02 UTC
Hi,

Sorry for the late reply.

Please follow the below steps:
1 clone linux stable git tree
$ git clone http://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable.git
2 checkout 3.8 branch
$ git checkout linux-3.8.y
3 set local tree to commit 5016d9ac0938789e7aaba86be3e6fbf24e7b7bee
$ git reset --hard 5016d9ac0938789e7aaba86be3e6fbf24e7b7bee
then build kernel and see if everything works OK
4 if yes, set local tree to commit 0e7a2fe01333f72c1cec1cd4d5293a62c770fa4f
$ git reset --hard 0e7a2fe01333f72c1cec1cd4d5293a62c770fa4f
then build kernel again and see if everything works OK.

Thanks.
Comment 5 leoni.massimiliano1 2013-05-04 08:30:14 UTC
Ok,.... I'm not very used to compiling the kernel, so I'm finding it somewhat difficult: when I try make menuconfig, it asks me a lot of questions I don't know how to answer :)
Comment 6 Aaron Lu 2013-05-06 07:12:32 UTC
I think you can use your installed kernel's config file.
$ cd linux_git_tree_you_have_cloned
$ cp /boot/config-3.8.4 .config
$ make oldconfig
Then build kernel.
Comment 7 leoni.massimiliano1 2013-05-06 08:01:17 UTC
You are very kind helping me like this :)
However, I have no /boot/config-3.8.4 file [I use GRUB2, I think].
Comment 8 Aaron Lu 2013-05-06 08:50:56 UTC
Attach the following command output as root:
# lspci -v > lspci.out

Then I can provide the config file for you to use.
Comment 9 leoni.massimiliano1 2013-05-06 12:38:03 UTC
Created attachment 100811 [details]
lspci -v output

Here it is :)
Comment 10 leoni.massimiliano1 2013-05-06 12:40:03 UTC
P.s. Can I compile the kernel on a different machine and then install the package on this one?
I have a desktop which can compile faster and on a HDD [I have an SSD on this one].
Comment 11 Aaron Lu 2013-05-10 05:47:25 UTC
Hi,

I've built the kernel for you. No initrd is required, so your root= command line will need to use /dev/sda? instead of UUID=.

URL here, since bugzilla doesn't allow upload a file more than 1000KB:
https://www.dropbox.com/s/sgxikmdkzmhhjzp/vmlinuz-bad
https://www.dropbox.com/s/u6e1qfoktenynlr/vmlinuz-good
Comment 12 leoni.massimiliano1 2013-05-11 08:06:01 UTC
Ok, I did some testing and here's the result.

I took each of the files you shared and copied them into /boot/vmlinuz-linux, then rebooted.

With vmlinuz-good, backlight controls worked; with vmlinuz-bad, they didn't, so I guess you found the core of the problem!

[Maybe unnecessary to tell, with both of them I had some issues like networkmanager and kmix not working, but I think this is because you compiled it away from my hardware]

Did I do well? Is there anything else I can do? :)
Thanks a lot for your support!
Comment 13 Aaron Lu 2013-05-12 12:36:46 UTC
Thanks for the test, I'll move this bug to drm/intel category and I think they know what happened.

Hi DRM guys,

Looks like the following commit:

commit 0e7a2fe01333f72c1cec1cd4d5293a62c770fa4f
Author: Daniel Vetter <daniel.vetter@ffwll.ch>
Date:   Fri Mar 22 15:44:46 2013 +0100

    Revert "drm/i915: write backlight harder"

breaks backlight functionality of leoni's system, please kindly take a look, thanks.
Comment 14 leoni.massimiliano1 2013-05-12 13:49:02 UTC
Awesome, I love the way bugreporting works :)
Thank you all for this!
Comment 15 Jani Nikula 2013-05-13 07:10:14 UTC
The original commit "drm/i915: write backlight harder" fixed the issue on Dell XPS 13, but unfortunately it regressed other machines and had to be reverted.

*** This bug has been marked as a duplicate of bug 47941 ***