Bug 100041 - MacbookPro12,1 (early 2015): intel i915 iris 6100 with eDP : acpi_video backlight exists and is broken
Summary: MacbookPro12,1 (early 2015): intel i915 iris 6100 with eDP : acpi_video backl...
Status: RESOLVED CODE_FIX
Alias: None
Product: Drivers
Classification: Unclassified
Component: Video(DRI - Intel) (show other bugs)
Hardware: All Linux
: P1 normal
Assignee: intel-gfx-bugs@lists.freedesktop.org
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-06-17 13:23 UTC by Tormen
Modified: 2015-06-19 10:08 UTC (History)
4 users (show)

See Also:
Kernel Version: 4.0.4
Subsystem:
Regression: No
Bisected commit-id:


Attachments
drivers/acpi/video.c (56.23 KB, text/x-csrc)
2015-06-18 12:48 UTC, Tormen
Details
Working patch (kernel 4.0.4) for the described problem. (2.58 KB, patch)
2015-06-18 17:53 UTC, Tormen
Details | Diff

Description Tormen 2015-06-17 13:23:18 UTC
//// THE SETUP ///////////////

On the MacbookPro12,1 (early 2015 Retina display version) with the graphics adapter:

00:02.0 0300: 8086:162b (rev 09) (prog-if 00 [VGA controller])
        Subsystem: 106b:013f

00:02.0 VGA compatible controller: Intel Corporation Broadwell-U Integrated Graphics (rev 09) (prog-if 00 [VGA controller])
        Subsystem: Apple Inc. Device 013f
        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 57
        Region 0: Memory at c0000000 (64-bit, non-prefetchable) [size=16M]
        Region 2: Memory at b0000000 (64-bit, prefetchable) [size=256M]
        Region 4: I/O ports at 3000 [size=64]
        Expansion ROM at <unassigned> [disabled]
        Capabilities: <access denied>
        Kernel driver in use: i915

//// THE PROBLEM ///////////////

If the kernel 4.0.4 is booted without any relevant kernel cmdline paramters:

There are:
  /sys/devices/pci0000:00/0000:00:02.0/backlight/acpi_video0
  and 
  /sys/devices/pci0000:00/0000:00:02.0/drm/card0/card0-eDP-1/intel_backlight

The latter (intel_backlight) works and controls the brightness of the laptops internal screen using a brightness scale from 0 to 1388 (adjustable  in steps of 1 ;).

But the former (acpi_video0), which is used by the X brightness keys, has no effect: It has a scale from 0-100 and changing it's values (trough echo under /sys/ or using the XF86 brightness up/down keys, has no visible effect.



Using acpi_backlight=vendor fixes the problem in that it removes:
  /sys/devices/pci0000:00/0000:00:02.0/backlight/acpi_video0
and leaves only:
  /sys/devices/pci0000:00/0000:00:02.0/drm/card0/card0-eDP-1/intel_backlight
to be found and used by X.


Please let me know if you need more information, debug, logfiles, etc.

Tormen.
Comment 1 Jani Nikula 2015-06-17 13:27:56 UTC
CC Aaron, Hans
Comment 2 Hans de Goede 2015-06-17 13:30:19 UTC
This should be fixed by this commit which is queued up for merging into 4.2 :

https://git.kernel.org/cgit/linux/kernel/git/rafael/linux-pm.git/commit/?h=linux-next&id=7f5c1882add891f7420a327e908f206fafed3670
Comment 3 Tormen 2015-06-17 16:54:32 UTC
Super. Thanks for the quick feedback !

I'll try the patch and report back !

Tormen
Comment 4 Tormen 2015-06-18 08:29:51 UTC
Hi.

Compiling the kernel, it complained about missing function "video_enable_native_backlight".

As all the other exceptions used "video_disable_native_backlight", I gave this a shot. But this does not fix the problem: Using the new kernel while removing the kernel cmdline parameter "acpi_backlight=vendor", brings back:

/sys/devices/pci0000:00/0000:00:02.0/drm/card0/card0-eDP-1/intel_backlight/brightness
/sys/devices/pci0000:00/0000:00:02.0/backlight/acpi_video0/brightness

Was this function maybe added in a more recent kernel version than 4.0.4 ?


Not sure if important, but dmidecode shows 2 "Product Names":

Handle 0x0006, DMI type 1, 27 bytes
System Information
        Manufacturer: Apple Inc.
        Product Name: MacBookPro12,1
        Version: 1.0
        Serial Number: C02PP2V8FVH8
        UUID: 25EF0280-EC82-42B0-8FB6-10ADCCC67C02
        Wake-up Type: Power Switch
        SKU Number:  
        Family: MacBook Pro

Handle 0x0007, DMI type 2, 17 bytes
Base Board Information
        Manufacturer: Apple Inc.
        Product Name: Mac-E43C1C25D4880AD6
        Version: MacBookPro12,1
        Serial Number: C0251830058GDVN1K
        Asset Tag:  
        Features:
                Board is a hosting board
        Location In Chassis:  
        Chassis Handle: 0x0008
        Type: Motherboard
        Contained Object Handles: 0
Comment 5 Hans de Goede 2015-06-18 08:40:28 UTC
Hi,

If you want to build a kernel with the patch fixing this you will also need this patch as per-requisite:

https://git.kernel.org/cgit/linux/kernel/git/rafael/linux-pm.git/commit/drivers/acpi/video.c?h=linux-next&id=64491882d399011bb0a4603e8cf481b65f0d3c5d

Regards,

Hans
Comment 6 Tormen 2015-06-18 10:20:31 UTC
Hi and thanks a lot again for the quick reply.

Unfortunately I think there is a 3rd patch missing:

drivers/acpi/video.c: In function ‘video_enable_native_backlight’:
drivers/acpi/video.c:423:31: error: ‘NATIVE_BACKLIGHT_ON’ undeclared (first use in this function)
    use_native_backlight_dmi = NATIVE_BACKLIGHT_ON;
                               ^
drivers/acpi/video.c:423:31: note: each undeclared identifier is reported only once for each function it appears in
scripts/Makefile.build:281: recipe for target 'drivers/acpi/video.o' failed

Tormen
Comment 7 Hans de Goede 2015-06-18 10:29:45 UTC
Hi,

(In reply to Tormen from comment #6)
> Hi and thanks a lot again for the quick reply.
> 
> Unfortunately I think there is a 3rd patch missing:
> 
> drivers/acpi/video.c: In function ‘video_enable_native_backlight’:
> drivers/acpi/video.c:423:31: error: ‘NATIVE_BACKLIGHT_ON’ undeclared (first
> use in this function)
>     use_native_backlight_dmi = NATIVE_BACKLIGHT_ON;

Ah yes, just change the NATIVE_BACKLIGHT_ON to 1 that should do the trick.

Regards.

Hans
Comment 8 Tormen 2015-06-18 12:46:16 UTC
Hi,

Thanks again for your ultra-fast reply ! :))

Tried it... but it does not work.
I'll attach my video.c file.

Do you need maybe:
   kernel config ? 
   dmesg ?
   lspci -vvvnk ?

cat /proc/cmdline
\boot\vmlinuz-4.0.4-desktop-banana05 ro root=UUID=7446ae27-f2a4-41a0-b8d3-fdce0e298a30  hid_apple.iso_layout=0 quiet splash=silent  initrd=boot\initrd-4.0.4-desktop-banana05

find /sys -name brightness
/sys/devices/pci0000:00/0000:00:02.0/drm/card0/card0-eDP-1/intel_backlight/brightness
/sys/devices/pci0000:00/0000:00:02.0/backlight/acpi_video0/brightness
/sys/devices/platform/applesmc.768/leds/smc::kbd_backlight/brightness

I am not sure about the different kernel parameters:
For me I could fix the problem using "acpi_backlight=vendor".
But the patch I think is based on:
 video.use_native_backlight
?

I guess I could try forcing this parameter to a certain value first ?
I think I read that there are the possible values: 0, 1 and -1 ?

Tormen
Comment 9 Tormen 2015-06-18 12:48:33 UTC
Created attachment 180301 [details]
drivers/acpi/video.c
Comment 11 Tormen 2015-06-18 17:52:22 UTC
Hi,

Success :)

Any idea when this will be accepted upstream ? (kernel version ?)

find /sys -name brightness
/sys/devices/pci0000:00/0000:00:02.0/drm/card0/card0-eDP-1/intel_backlight/brightness
/sys/devices/platform/applesmc.768/leds/smc::kbd_backlight/brightness

cat /proc/cmdline 
\boot\vmlinuz-4.0.4-desktop-banana05 ro root=UUID=7446ae27-f2a4-41a0-b8d3-fdce0e298a30  hid_apple.iso_layout=0 quiet splash=silent  initrd=boot\initrd-4.0.4-desktop-banana05

So with all 3 patches it works. To make life easier for people having the same problem I'll upload my patch (integrating the 3) that applies to a 4.0.4 kernel.


Thanks a lot,

Tormen
Comment 12 Tormen 2015-06-18 17:53:59 UTC
Created attachment 180311 [details]
Working patch (kernel 4.0.4) for the described problem.

This patch integrates the 3 patches that Hans had pointed to.
Comment 13 Hans de Goede 2015-06-19 10:08:49 UTC
(In reply to Tormen from comment #11)
> Hi,
> 
> Success :)

Good.

> Any idea when this will be accepted upstream ? (kernel version ?)

The patches are queued up in linux-pm for merging into 4.2

Regards,

Hans

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