Bug 105051
Summary: | Radeon sets max_brightness to -1, breaking GNOME backlight control on Macbook Pro mid-2015 11,5 | ||
---|---|---|---|
Product: | Drivers | Reporter: | Tim Sammut (tim.sammut) |
Component: | Platform_x86 | Assignee: | drivers_platform_x86 (drivers_platform_x86) |
Status: | NEW --- | ||
Severity: | normal | CC: | alexdeucher, andrea.lazzarotto, berglh, bonbons, brice, dvhart, fortizc, frode.nordahl, gergnz, lance, lkocman, lukas, mail, mark.einon, michael.findlater, muhammadamir7002, multigab2000, nick, pgier, robert.abraham86, ronald, soren, stesen, szg00000, vsimonianpress |
Priority: | P1 | ||
Hardware: | All | ||
OS: | Linux | ||
Kernel Version: | 4.2.1 | Subsystem: | |
Regression: | No | Bisected commit-id: | |
Attachments: |
dmesg output
tentative patch to apple-gmux attachment-1754-0.html diff updated for kernel 4.6 |
Description
Tim Sammut
2015-09-26 21:01:07 UTC
Radeon hardware supports 256 levels of brightness (0-255). The backlight integer property max_brightness is thus set to RADEON_MAX_BL_LEVEL (0xff). It sounds like GNOME is misinterpreting the value. I have a similar problem. gmux_backlight/max_brightness is set to -1. But i also have a radeon_bl entry in /sys/class/backlight which has the correct values. But no matter which value i echo into /sys/class/backlight/radeon_bl/brightness i am on max brightness, except i echo 0. in this case the backlight turns off. so i can only choose between backlight off or on max brightness. it works perfectly fine on 4.0.x kernel though. i will happily provide any information you need. (In reply to Robert Abraham from comment #2) > > it works perfectly fine on 4.0.x kernel though. The radeon backlight code hasn't really changed since it was added so presumably something else did. Can you bisect? Since this is a mac, it's possible the GPU driver does not actually control the backlight. Everything is a one off on macs. (In reply to Alex Deucher from comment #1) > Radeon hardware supports 256 levels of brightness (0-255). The backlight > integer property max_brightness is thus set to RADEON_MAX_BL_LEVEL (0xff). > It sounds like GNOME is misinterpreting the value. Hi Alex, thanks. I don't think is a GNOME issue. This is via /sys and you can see the max_brightness = -1 here: $ for F in /sys/class/backlight/*/{type,max_brightness}; do echo $F: $(cat $F); done | sort /sys/class/backlight/gmux_backlight/max_brightness: -1 /sys/class/backlight/gmux_backlight/type: platform /sys/class/backlight/radeon_bl0/max_brightness: 255 /sys/class/backlight/radeon_bl0/type: raw Manually adjusting the brightness via `echo $level > /sys/class/backlight/gmux_backlight/brightness` works, but GNOME control of brightness and the on-screen display do not. > The radeon backlight code hasn't really changed since it was added so > presumably something else did. Can you bisect? Since this is a mac, > it's possible the GPU driver does not actually control the backlight. > Everything is a one off on macs. Yeah, but probably not for 3+ weeks... sorry. (In reply to Robert Abraham from comment #2) > But i also have a radeon_bl entry in /sys/class/backlight which has the > correct values. > But no matter which value i echo into > /sys/class/backlight/radeon_bl/brightness i am on max brightness, except i > echo 0. in this case the backlight turns off. > > so i can only choose between backlight off or on max brightness. > it works perfectly fine on 4.0.x kernel though. Just for the record, this is precise how my machine behaves as well. commit 4eebd5a4e72697aac25a8a57d3f888a9d5f80370 breaks the backlight for me. Perhaps the radeon driver should just not attempt to register a backlight interface on Macs since they seem to use the gmux for backlight control. Some one with more knowledge of mac hw should probably comment on how they should be handled. (In reply to Robert Abraham from comment #6) > commit > 4eebd5a4e72697aac25a8a57d3f888a9d5f80370 > > breaks the backlight for me. That's an apple-gmux change, not a radeon driver change. Please reassign the component of this bug report accordingly. (In reply to Michel Dänzer from comment #8) > > That's an apple-gmux change, not a radeon driver change. Please reassign the > component of this bug report accordingly. Thanks, I'd be happy to, but I don't see where to but it and looking at other apple_gmux bugs seem scattered. Help!? It may be easier to contact the apple-gmux developers via e-mail. The scripts/get_maintainer.pl script should be useful for that. (In reply to Robert Abraham from comment #6) > commit > 4eebd5a4e72697aac25a8a57d3f888a9d5f80370 > > breaks the backlight for me. Yep, me too. Reverting that change against a 4.2.1 kernel completely fixes the issues. Brightness adjusts and OSD appears. (In reply to Michel Dänzer from comment #8) > > That's an apple-gmux change, not a radeon driver change. Please reassign the > component of this bug report accordingly. Hi. I changed the component based on the output of scripts/get_maintainer.pl, but I do not appear to be able to reassign the bug. Is anyone watching this bug able to reassign it? Only the original filer or an admin can change it as far as I know. I can confirm the problem with 4eebd5a4e72697aac25a8a57d3f888a9d5f80370. I have a MPB 11,5 with AMD/Intel graphics. I recompile the module (a previous version of 4eebd5a4e72697aac25a8a57d3f888a9d5f80370) and brightness adjusts is working again. I see two problems: 1) If someone uses gpu-switch (https://github.com/0xbb/gpu-switch) with this bug screen seem not work, after severals reboots (with different kernels) I can access a terminal and execute gpu-switch -d and then screen seems work again. 2) If you use a Intel card (swiched with gpu-switch) the OSD (activated with functions keys) is so slow and chromium have the same problem (temporary fix is deactivate chromium hw acceleration) is this a intel driver bug? Thanks for reporting, we're following up on the platform-drivers-x86 mailing list. How does the system behave when both GPUs are visible to system (might need explicit GPU selection in Xorg configuration for proper results)? The issue very probably lies in the fact that backlight is controlled via VGA registers on intel GPU which is hidden away (and thus apple_gmux locks on the wrong GPU causing VGA IO to return -1 (0xff)). With Intel GPU hidden it is near impossible to force VGA IO to be locked on hidden intel GPU. I'm also experiencing this behaviour on a MacBookPro11,3 (late 2014 MBP Retina) which uses an nVidia GPU. max_brightness is -1 and the brightness is stuck at 100%, no matter what the change to the brightness file using sysfs. [root@vartan-MacBookPro gmux_backlight]# dmesg | grep DMI: [ 0.000000] DMI: Apple Inc. MacBookPro11,3/Mac-2BD1B31983FE1663, BIOS MBP112.88Z.0138.B15.1506050548 06/05/2015 [root@vartan-MacBookPro gmux_backlight]# uname -a Linux vartan-MacBookPro 4.2.3-300.fc23.x86_64 #1 SMP Mon Oct 5 15:42:54 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux [root@vartan-MacBookPro gmux_backlight]# ls -hlaF /sys/class/backlight total 0 drwxr-xr-x. 2 root root 0 Nov 3 18:08 ./ drwxr-xr-x. 52 root root 0 Nov 3 18:08 ../ lrwxrwxrwx. 1 root root 0 Nov 3 17:16 gmux_backlight -> ../../devices/pnp0/00:03/backlight/gmux_backlight/ [root@vartan-MacBookPro gmux_backlight]# cat /sys/class/backlight/gmux_backlight/max_brightness -1 [root@vartan-MacBookPro gmux_backlight]# dmesg | grep gmux [ 3.689216] apple_gmux: Found gmux version 4.0.8 [indexed] [ 3.689237] apple_gmux: locked IO for PCI:0000:01:00.0 [ 159.426189] apple-gmux 00:03: System wakeup disabled by ACPI Created attachment 192601 [details]
tentative patch to apple-gmux
This patch causes apple-gmux to only try to lock IO for integrated GPU and report a warning if just the discrete GPU was found.
When no integrated GPU was found user may still suffer from lost backlight when e.g. binary blob thinks it should call vgaarb.
@Bruno Prémont: "The issue very probably lies in the fact that backlight is controlled via VGA registers on intel GPU which is hidden away" No. On MacBook Pros with dual GPUs, backlight brightness is regulated by a separate PWM module under the control of gmux. That's because either GPU may be suspended to save power and is thus not available to generate the PWM signal. Your commit 4eebd5a4e726 contains the line "Fixes: ce027dac592c0ada241ce0f95ae65856828ac450 # nvidia interaction". However that commit does not exist in Linus' git repo. The hash is wrong, it should be 86fd887b7fe3. The issue addressed by 4eebd5a4e726 (https://bugzilla.kernel.org/show_bug.cgi?id= 86121) seems to be caused by a bug in the proprietary nvidia driver. (It didn't occur with nouveau as per that bugzilla entry.) Apparently the nvidia driver locks the IO ports of gmux. It has no business mucking around with gmux' IO ports so this seems to be an issue for nvidia to fix. Hence I wonder why you tried to fix this in apple-gmux in the first place. As to the Intel GPU being invisible on the MacBookPro11,3 and newer, Bruno Bierbaumer has instructions and patches to solve this: https://github.com/0xbb/gpu-switch/ The registers controlling backlight, even if they happen to be related to gmux are still linked to VGA IO space as touching that IO space (by calling vgaarb to switch between GPUs) does cause gmux backlight to not work any more. nvidia drivers tries to associate VGA IO-space to nvidia GPU which on those Macs happens to affect gmux. My idea was to let gmux try to prevent vgaarb to switch over which failed miserably once the Intel GPU became hidden. The protection is not only aimed at nvidia kernel side driver but also at X which may call vgaarb to switch between GPUs. I can live with reverting 4eebd5a4e726 though leaving a warning in dmesg about the interaction between vgaarb and gmux's backlight in that case would be careful (so next user trying to play with nvidia driver or X arbitration between GPUs [when both are visible and to be used in parallel] have been warned). The commit ID ce027dac592c0ada241ce0f95ae65856828ac450 seems to come from linux-stable tree rather than Linus'. Sorry for that confusion. I hope this isn't superfluous info, but I decided to test this against a fresh installation of Fedora rawhide, which is using their build of the 4.4 kernel, on a MacBookPro11,3 and the problem is persisting. No proprietary graphics drivers were installed. To all those affected, please give patch in attachment 192601 [details] a run and report back if it lets your backlight work as expected and also if it does print out the warning.
When reporting your results, please include the output of `lspci -nn`.
If you know how to change which GPU is visible on boot (intel, nvidia/radeon or both) giving it a run for all 3 cases and reporting the 3 results would be much appreciated (be prepared to get access to your system via ssh if X does not start properly)!
If you even have the option to switch at runtime reporting on side-effects to backlight or apple-gmux in general may be useful.
Patch applied to 4.2.8-300.fc23.x86_64 on macbookpro Mid 2015, and works as expected - GNOME can modify the backlight brightness. I'm at work, so haven't attempted changing the GPU. The warning is printed: apple_gmux: Found only discrete GPU 0000:01:00.0, integrated GPU is hidden, unable to protect backlight behind VGA IO lspci -nn output: 00:00.0 Host bridge [0600]: Intel Corporation Crystal Well DRAM Controller [8086:0d04] (rev 08) 00:01.0 PCI bridge [0604]: Intel Corporation Crystal Well PCI Express x16 Controller [8086:0d01] (rev 08) 00:01.1 PCI bridge [0604]: Intel Corporation Crystal Well PCI Express x8 Controller [8086:0d05] (rev 08) 00:01.2 PCI bridge [0604]: Intel Corporation Crystal Well PCI Express x4 Controller [8086:0d09] (rev 08) 00:14.0 USB controller [0c03]: Intel Corporation 8 Series/C220 Series Chipset Family USB xHCI [8086:8c31] (rev 05) 00:16.0 Communication controller [0780]: Intel Corporation 8 Series/C220 Series Chipset Family MEI Controller #1 [8086:8c3a] (rev 04) 00:1b.0 Audio device [0403]: Intel Corporation 8 Series/C220 Series Chipset High Definition Audio Controller [8086:8c20] (rev 05) 00:1c.0 PCI bridge [0604]: Intel Corporation 8 Series/C220 Series Chipset Family PCI Express Root Port #1 [8086:8c10] (rev d5) 00:1c.2 PCI bridge [0604]: Intel Corporation 8 Series/C220 Series Chipset Family PCI Express Root Port #3 [8086:8c14] (rev d5) 00:1c.3 PCI bridge [0604]: Intel Corporation 8 Series/C220 Series Chipset Family PCI Express Root Port #4 [8086:8c16] (rev d5) 00:1f.0 ISA bridge [0601]: Intel Corporation HM87 Express LPC Controller [8086:8c4b] (rev 05) 00:1f.3 SMBus [0c05]: Intel Corporation 8 Series/C220 Series Chipset Family SMBus Controller [8086:8c22] (rev 05) 00:1f.6 Signal processing controller [1180]: Intel Corporation 8 Series Chipset Family Thermal Management Controller [8086:8c24] (rev 05) 01:00.0 VGA compatible controller [0300]: Advanced Micro Devices, Inc. [AMD/ATI] Venus XT [Radeon HD 8870M / R9 M270X/M370X] [1002:6821] (rev 83) 01:00.1 Audio device [0403]: Advanced Micro Devices, Inc. [AMD/ATI] Cape Verde/Pitcairn HDMI Audio [Radeon HD 7700/7800 Series] [1002:aab0] 02:00.0 SATA controller [0106]: Samsung Electronics Co Ltd Device [144d:a801] (rev 01) 04:00.0 Network controller [0280]: Broadcom Corporation BCM43602 802.11ac Wireless LAN SoC [14e4:43ba] (rev 01) 05:00.0 Multimedia controller [0480]: Broadcom Corporation 720p FaceTime HD Camera [14e4:1570] 06:00.0 PCI bridge [0604]: Intel Corporation DSL5520 Thunderbolt [Falcon Ridge] [8086:156d] 07:00.0 PCI bridge [0604]: Intel Corporation DSL5520 Thunderbolt [Falcon Ridge] [8086:156d] 07:03.0 PCI bridge [0604]: Intel Corporation DSL5520 Thunderbolt [Falcon Ridge] [8086:156d] 07:04.0 PCI bridge [0604]: Intel Corporation DSL5520 Thunderbolt [Falcon Ridge] [8086:156d] 07:05.0 PCI bridge [0604]: Intel Corporation DSL5520 Thunderbolt [Falcon Ridge] [8086:156d] 07:06.0 PCI bridge [0604]: Intel Corporation DSL5520 Thunderbolt [Falcon Ridge] [8086:156d] 08:00.0 System peripheral [0880]: Intel Corporation DSL5520 Thunderbolt [Falcon Ridge] [8086:156c] (In reply to Mark Einon from comment #23) > Patch applied to 4.2.8-300.fc23.x86_64 on macbookpro Mid 2015, and works as > expected - GNOME can modify the backlight brightness. I'm at work, so > haven't attempted changing the GPU. > > The warning is printed: > apple_gmux: Found only discrete GPU 0000:01:00.0, integrated GPU is hidden, > unable to protect backlight behind VGA IO > > lspci -nn output: > 00:00.0 Host bridge [0600]: Intel Corporation Crystal Well DRAM Controller > [8086:0d04] (rev 08) > 00:01.0 PCI bridge [0604]: Intel Corporation Crystal Well PCI Express x16 > Controller [8086:0d01] (rev 08) > 00:01.1 PCI bridge [0604]: Intel Corporation Crystal Well PCI Express x8 > Controller [8086:0d05] (rev 08) > 00:01.2 PCI bridge [0604]: Intel Corporation Crystal Well PCI Express x4 > Controller [8086:0d09] (rev 08) > 00:14.0 USB controller [0c03]: Intel Corporation 8 Series/C220 Series > Chipset Family USB xHCI [8086:8c31] (rev 05) > 00:16.0 Communication controller [0780]: Intel Corporation 8 Series/C220 > Series Chipset Family MEI Controller #1 [8086:8c3a] (rev 04) > 00:1b.0 Audio device [0403]: Intel Corporation 8 Series/C220 Series Chipset > High Definition Audio Controller [8086:8c20] (rev 05) > 00:1c.0 PCI bridge [0604]: Intel Corporation 8 Series/C220 Series Chipset > Family PCI Express Root Port #1 [8086:8c10] (rev d5) > 00:1c.2 PCI bridge [0604]: Intel Corporation 8 Series/C220 Series Chipset > Family PCI Express Root Port #3 [8086:8c14] (rev d5) > 00:1c.3 PCI bridge [0604]: Intel Corporation 8 Series/C220 Series Chipset > Family PCI Express Root Port #4 [8086:8c16] (rev d5) > 00:1f.0 ISA bridge [0601]: Intel Corporation HM87 Express LPC Controller > [8086:8c4b] (rev 05) > 00:1f.3 SMBus [0c05]: Intel Corporation 8 Series/C220 Series Chipset Family > SMBus Controller [8086:8c22] (rev 05) > 00:1f.6 Signal processing controller [1180]: Intel Corporation 8 Series > Chipset Family Thermal Management Controller [8086:8c24] (rev 05) > 01:00.0 VGA compatible controller [0300]: Advanced Micro Devices, Inc. > [AMD/ATI] Venus XT [Radeon HD 8870M / R9 M270X/M370X] [1002:6821] (rev 83) > 01:00.1 Audio device [0403]: Advanced Micro Devices, Inc. [AMD/ATI] Cape > Verde/Pitcairn HDMI Audio [Radeon HD 7700/7800 Series] [1002:aab0] > 02:00.0 SATA controller [0106]: Samsung Electronics Co Ltd Device > [144d:a801] (rev 01) > 04:00.0 Network controller [0280]: Broadcom Corporation BCM43602 802.11ac > Wireless LAN SoC [14e4:43ba] (rev 01) > 05:00.0 Multimedia controller [0480]: Broadcom Corporation 720p FaceTime HD > Camera [14e4:1570] > 06:00.0 PCI bridge [0604]: Intel Corporation DSL5520 Thunderbolt [Falcon > Ridge] [8086:156d] > 07:00.0 PCI bridge [0604]: Intel Corporation DSL5520 Thunderbolt [Falcon > Ridge] [8086:156d] > 07:03.0 PCI bridge [0604]: Intel Corporation DSL5520 Thunderbolt [Falcon > Ridge] [8086:156d] > 07:04.0 PCI bridge [0604]: Intel Corporation DSL5520 Thunderbolt [Falcon > Ridge] [8086:156d] > 07:05.0 PCI bridge [0604]: Intel Corporation DSL5520 Thunderbolt [Falcon > Ridge] [8086:156d] > 07:06.0 PCI bridge [0604]: Intel Corporation DSL5520 Thunderbolt [Falcon > Ridge] [8086:156d] > 08:00.0 System peripheral [0880]: Intel Corporation DSL5520 Thunderbolt > [Falcon Ridge] [8086:156c] Hi Mark, could you please state here or off-list how did you succeeded to switch this particular GPU? Lubos (In reply to Lubos Kocman from comment #24) > > Hi Mark, > > could you please state here or off-list how did you succeeded to switch this > particular GPU? I've not attempted to switch the GPU, the Raedon GPU is used by default. Mark I'd like to try this patch on the same MacBookPro 11,5 revision. Can someone point me to some general instructions on how to compile the kernel with this patch. I'm running Ubuntu and have cloned git://git.launchpad.net/~ubuntu-kernel-test/ubuntu/+source/linux/+git/mainline-crack. I can find the file to patch, but running patch with the files specified doesn't work. Am I meant to manually edit the file and apply the diff? Sorry for the beginner questions, just trying to help out.. I suspect that you need more information to answer your question than this bug report can contain. The Google or IRC services should be able to help you - you don't necessarily have to run a specific ubuntu flavour Linux kernel. Also, unless you are using a gnome specific version of ubuntu, you won't be running gnome. Created attachment 210251 [details] attachment-1754-0.html I'm running Ubuntu Gnome. Iv guess I'll try to find something on IRC. Any network/channels particularly suited to this request? On 22 Mar 2016 10:22 pm, <bugzilla-daemon@bugzilla.kernel.org> wrote: > https://bugzilla.kernel.org/show_bug.cgi?id=105051 > > --- Comment #27 from Mark Einon <mark.einon@gmail.com> --- > I suspect that you need more information to answer your question than this > bug > report can contain. The Google or IRC services should be able to help you > - you > don't necessarily have to run a specific ubuntu flavour Linux kernel. > > Also, unless you are using a gnome specific version of ubuntu, you won't be > running gnome. > > -- > You are receiving this mail because: > You are on the CC list for the bug. > I managed to test the patch on 4.5.0 and the brightness control works fine on the retina display with the Radeon and Gnome Shell 3.16.4. I'll try to find time to test the gpu-switch and report back. I did notice that the thunderbolt cinema display still does not work with the brightness adjustment, but I'm assuming this is a separate issue for another day as it can be controlled using acdcontrol and adjusting the appropriate /dev/usb/hiddev device. 00:00.0 Host bridge [0600]: Intel Corporation Crystal Well DRAM Controller [8086:0d04] (rev 08) 00:01.0 PCI bridge [0604]: Intel Corporation Crystal Well PCI Express x16 Controller [8086:0d01] (rev 08) 00:01.1 PCI bridge [0604]: Intel Corporation Crystal Well PCI Express x8 Controller [8086:0d05] (rev 08) 00:01.2 PCI bridge [0604]: Intel Corporation Crystal Well PCI Express x4 Controller [8086:0d09] (rev 08) 00:14.0 USB controller [0c03]: Intel Corporation 8 Series/C220 Series Chipset Family USB xHCI [8086:8c31] (rev 05) 00:16.0 Communication controller [0780]: Intel Corporation 8 Series/C220 Series Chipset Family MEI Controller #1 [8086:8c3a] (rev 04) 00:1b.0 Audio device [0403]: Intel Corporation 8 Series/C220 Series Chipset High Definition Audio Controller [8086:8c20] (rev 05) 00:1c.0 PCI bridge [0604]: Intel Corporation 8 Series/C220 Series Chipset Family PCI Express Root Port #1 [8086:8c10] (rev d5) 00:1c.2 PCI bridge [0604]: Intel Corporation 8 Series/C220 Series Chipset Family PCI Express Root Port #3 [8086:8c14] (rev d5) 00:1c.3 PCI bridge [0604]: Intel Corporation 8 Series/C220 Series Chipset Family PCI Express Root Port #4 [8086:8c16] (rev d5) 00:1f.0 ISA bridge [0601]: Intel Corporation HM87 Express LPC Controller [8086:8c4b] (rev 05) 00:1f.3 SMBus [0c05]: Intel Corporation 8 Series/C220 Series Chipset Family SMBus Controller [8086:8c22] (rev 05) 00:1f.6 Signal processing controller [1180]: Intel Corporation 8 Series Chipset Family Thermal Management Controller [8086:8c24] (rev 05) 01:00.0 VGA compatible controller [0300]: Advanced Micro Devices, Inc. [AMD/ATI] Venus XT [Radeon HD 8870M / R9 M270X/M370X] [1002:6821] (rev 83) 01:00.1 Audio device [0403]: Advanced Micro Devices, Inc. [AMD/ATI] Cape Verde/Pitcairn HDMI Audio [Radeon HD 7700/7800 Series] [1002:aab0] 02:00.0 SATA controller [0106]: Samsung Electronics Co Ltd Device [144d:a801] (rev 01) 04:00.0 Network controller [0280]: Broadcom Corporation BCM43602 802.11ac Wireless LAN SoC [14e4:43ba] (rev 01) 05:00.0 Multimedia controller [0480]: Broadcom Corporation 720p FaceTime HD Camera [14e4:1570] 06:00.0 PCI bridge [0604]: Intel Corporation Device [8086:156d] 07:00.0 PCI bridge [0604]: Intel Corporation Device [8086:156d] 07:03.0 PCI bridge [0604]: Intel Corporation Device [8086:156d] 07:04.0 PCI bridge [0604]: Intel Corporation Device [8086:156d] 07:05.0 PCI bridge [0604]: Intel Corporation Device [8086:156d] 07:06.0 PCI bridge [0604]: Intel Corporation Device [8086:156d] 08:00.0 System peripheral [0880]: Intel Corporation Device [8086:156c] 09:00.0 PCI bridge [0604]: Intel Corporation Device [8086:1513] 0a:00.0 PCI bridge [0604]: Intel Corporation Device [8086:1513] 0a:01.0 PCI bridge [0604]: Intel Corporation Device [8086:1513] 0a:02.0 PCI bridge [0604]: Intel Corporation Device [8086:1513] 0a:04.0 PCI bridge [0604]: Intel Corporation Device [8086:1513] 0a:05.0 PCI bridge [0604]: Intel Corporation Device [8086:1513] 0b:00.0 PCI bridge [0604]: Pericom Semiconductor Device [12d8:400c] (rev 02) 0c:03.0 PCI bridge [0604]: Pericom Semiconductor Device [12d8:400c] (rev 02) 0d:00.0 USB controller [0c03]: Pericom Semiconductor PI7C9X442SL USB OHCI Controller [12d8:400e] (rev 01) 0d:00.1 USB controller [0c03]: Pericom Semiconductor PI7C9X442SL USB OHCI Controller [12d8:400e] (rev 01) 0d:00.2 USB controller [0c03]: Pericom Semiconductor PI7C9X442SL USB EHCI Controller [12d8:400f] (rev 03) 0e:00.0 Ethernet controller [0200]: Broadcom Corporation NetXtreme BCM57761 Gigabit Ethernet PCIe [14e4:16b0] (rev 10) 0f:00.0 FireWire (IEEE 1394) [0c00]: LSI Corporation FW643 [TrueFire] PCIe 1394b Controller [11c1:5901] (rev 08) I was not able to enter recovery mode or get a GDM when using gpu-switch. Just failed to get a display at all. The tool specifically says it has not been tested with the MacBookPro 11,5 and I can confirm it did not work changing to integrated on this machine. I need to boot OS X to restore the firmware to default to the dedicated adaptor. For the meantime, I'm enjoying brightness control for the first time in about 6 months with the kernel patch ;) I'm not able to gpu-switch at all, I've tried a couple of methods now. I would like to stop having to patch new kernels with this fix. Anyway we can get this moving forward? Any additional testing I can do? Thanks :) Created attachment 218051 [details]
diff updated for kernel 4.6
This patch works on the 4.6 kernel apple-gmux.c driver to enable brightness control in gnome shell with the MacBook 11,5. Still unable to enable intel graphics to test if that still works with this patch.
Can anyone please provide a link on how to patch the apple-gmux.c driver or tell me how it can be done. Using 4.4 kernel. Would be very nice (In reply to Gabriel from comment #33) > Can anyone please provide a link on how to patch the apple-gmux.c driver or > tell me how it can be done. > Using 4.4 kernel. Would be very nice Ok, this is (I believe) the easiest way: 1.- Get the apple_gmux.c from kernel source 2.- Put it in a directory and use the patch (patch apple-gmux.c < file.patch) 3.- Create a Makefile with this: obj-m += apple-gmux.o all: make -C /lib/modules/$(shell uname -r)/build M=$(PWD) modules clean: make -C /lib/modules/$(shell uname -r)/build M=$(PWD) clean 4.- make 5.- Test it: (as root) Remove the old module rmmod apple-gmux Insert your patched module: insmod ./apple-gmux.ko 6.- If works copy your module to /lib/modules/(KERNEL_VERSION)/kernel/drivers/platform/x86/ Note: When you load your module the brightness controls should appear, but sometimes not working, in this case copy your module to /lib/modules... and reboot ;) I patched, compiled and installed in running kernel the apple-gmux module. The following is the output from dmesg and lspci -nn [ 1263.464746] [Firmware Bug]: ACPI(GFX0) defines _DOD but not _DOS [ 1263.464822] ACPI: Video Device [GFX0] (multi-head: yes rom: yes post: no) [ 1263.523156] acpi device:02: registered as cooling_device9 [ 1263.523202] input: Video Bus as /devices/LNXSYSTM:00/LNXSYBUS:00/PNP0A08:00/device:01/LNXVIDEO:00/input/input19 [ 1263.525388] apple_gmux: gmux device not present or IO disabled gregc@squawkencluck:~/Scratch/dev/patches$ lspci -nn 00:00.0 Host bridge [0600]: Intel Corporation Crystal Well DRAM Controller [8086:0d04] (rev 08) 00:01.0 PCI bridge [0604]: Intel Corporation Crystal Well PCI Express x16 Controller [8086:0d01] (rev 08) 00:01.1 PCI bridge [0604]: Intel Corporation Crystal Well PCI Express x8 Controller [8086:0d05] (rev 08) 00:01.2 PCI bridge [0604]: Intel Corporation Crystal Well PCI Express x4 Controller [8086:0d09] (rev 08) 00:14.0 USB controller [0c03]: Intel Corporation 8 Series/C220 Series Chipset Family USB xHCI [8086:8c31] (rev 05) 00:16.0 Communication controller [0780]: Intel Corporation 8 Series/C220 Series Chipset Family MEI Controller #1 [8086:8c3a] (rev 04) 00:1b.0 Audio device [0403]: Intel Corporation 8 Series/C220 Series Chipset High Definition Audio Controller [8086:8c20] (rev 05) 00:1c.0 PCI bridge [0604]: Intel Corporation 8 Series/C220 Series Chipset Family PCI Express Root Port #1 [8086:8c10] (rev d5) 00:1c.2 PCI bridge [0604]: Intel Corporation 8 Series/C220 Series Chipset Family PCI Express Root Port #3 [8086:8c14] (rev d5) 00:1c.3 PCI bridge [0604]: Intel Corporation 8 Series/C220 Series Chipset Family PCI Express Root Port #4 [8086:8c16] (rev d5) 00:1f.0 ISA bridge [0601]: Intel Corporation HM87 Express LPC Controller [8086:8c4b] (rev 05) 00:1f.3 SMBus [0c05]: Intel Corporation 8 Series/C220 Series Chipset Family SMBus Controller [8086:8c22] (rev 05) 00:1f.6 Signal processing controller [1180]: Intel Corporation 8 Series Chipset Family Thermal Management Controller [8086:8c24] (rev 05) 01:00.0 VGA compatible controller [0300]: Advanced Micro Devices, Inc. [AMD/ATI] Venus XT [Radeon HD 8870M / R9 M270X/M370X] [1002:6821] (rev 83) 01:00.1 Audio device [0403]: Advanced Micro Devices, Inc. [AMD/ATI] Cape Verde/Pitcairn HDMI Audio [Radeon HD 7700/7800 Series] [1002:aab0] 02:00.0 SATA controller [0106]: Samsung Electronics Co Ltd Device [144d:a801] (rev 01) 04:00.0 Network controller [0280]: Broadcom Corporation BCM43602 802.11ac Wireless LAN SoC [14e4:43ba] (rev 01) 05:00.0 Multimedia controller [0480]: Broadcom Corporation 720p FaceTime HD Camera [14e4:1570] 06:00.0 PCI bridge [0604]: Intel Corporation DSL5520 Thunderbolt [Falcon Ridge] [8086:156d] 07:00.0 PCI bridge [0604]: Intel Corporation DSL5520 Thunderbolt [Falcon Ridge] [8086:156d] 07:03.0 PCI bridge [0604]: Intel Corporation DSL5520 Thunderbolt [Falcon Ridge] [8086:156d] 07:04.0 PCI bridge [0604]: Intel Corporation DSL5520 Thunderbolt [Falcon Ridge] [8086:156d] 07:05.0 PCI bridge [0604]: Intel Corporation DSL5520 Thunderbolt [Falcon Ridge] [8086:156d] 07:06.0 PCI bridge [0604]: Intel Corporation DSL5520 Thunderbolt [Falcon Ridge] [8086:156d] 08:00.0 System peripheral [0880]: Intel Corporation DSL5520 Thunderbolt [Falcon Ridge] [8086:156c] Kernel version: 4.4.0-34-generic #53-Ubuntu Flipping the gpu with gpu-switch has worked to let gmux work now. As per the readme at gpu-switch the integrated gpu is hidden. Trying to use it useless, as I Xorg can't initialise and kms is upset. dmesg doesn't show locked now: [ 12.659742] apple_gmux: module verification failed: signature and/or required key missing - tainting kernel [ 12.660350] apple_gmux: Found gmux version 4.0.20 [indexed] [ 12.660396] apple_gmux: Found only discrete GPU 0000:01:00.0, integrated GPU is hidden, unable to protect backlight behind VGA IO confirmed patch works on 4.8, steps to reproduce the fix. # grab copy of source curl -O https://cdn.kernel.org/pub/linux/kernel/v4.x/linux-4.8.7.tar.xz tar xf linux-4.8.7.tar.xz cd linux-4.8.7/drivers/platform/x86 # patch it curl -o file.patch https://bugzilla.kernel.org/attachment.cgi?id=218051 patch apple-gmux.c < file.patch # build it echo ' obj-m += apple-gmux.o all: make -C /lib/modules/$(shell uname -r)/build M=$(PWD) modules clean: make -C /lib/modules/$(shell uname -r)/build M=$(PWD) clean ' > Makefile make # install targetDir="/lib/modules/$(uname -r)/kernel/drivers/platform/x86" sudo cp ${targetDir}/apple-gmux.ko ${targetDir}/apple-gmux.ko.backup sudo cp apple-gmux.ko ${targetDir} reboot The instructions provided by Lance in comment #37 worked perfectly for me on a MacBook Pro with a **NVIDIA card**. Therefore the fix doesn't depend on Radeon, it works also for NVIDIA-based models. Also, it was possible to get the backlight to persist after a reboot by adding the kernel parameter "acpi_backlight=vendor". This was done on Fedora 25, with kernel 4.8.11. I just had to tweak the directions a bit to take into account xz compression for the apple_gmux module. I would just like to add a note about that I have been able to work around this bug without the patch mentioned in comment #37 by altering the module load order. The brightness control can be restored by adding the apple_gmux driver to initramfs and adding it to the modprobe= kernel parameter. Detailed instructions: - Add 'apple_gmux' to /etc/initramfs-tools/modules - Add 'modprobe=apple_gmux' to GRUB_CMDLINE_LINUX_DEFAULT line in /etc/default/grub - Run 'sudo update-initramfs -k all -u' - Run 'sudo update-grub' - Reboot system For this test I am running kernel from Ubuntu Yakkety kernel (4.8.0 w/Ubuntu patches, I have confirmed that they do not ship the above mentioned patch) on a MacBook Pro 10,1 with the nvidia proprietary drivers. I also confirm the modifications specified in the patch (comment #37) works on 4.4.0 as well (Linux Mint). On a MacBook Pro with a Radeon card. My eyes and I really thank you for the patch guys! xD I also have just applied the patch (comment #37) on a MacBook Pro 11,5 (17", Ubuntu 16.04). Works perfectly. Thanks so much! I can also confirm that the patch works nicely on kernels 4.9 through 4.12 on MacBookPro13,3. Test this Linux 4.12.0 (Fedora Core 26). Works perfectly. Will test on Linux 4.13-rc4 this week and update. Re: previous message My apologies, ommited the test system: Running MacBook Pro 11,5 Apple Inc. Radeon R9 M370X Mac Edition Patch worked for me on 4.10 and 4.12 MacBookPro11,5 AMD Radeon R9 M370X Hopefully this can get added to mainline soon. Patch has been working for me also on Fedora 26 and 27 several different kernel versions. Model: MacBookPro11,5 Kernel: 4.14.6 Should be fixed in v4.16-rc1 with http://git.kernel.org/linus/d6fa7588fd7a Somebody mark this RESOLVED FIXED please. |