patjak / mba6x_bl

MacBook Air 6,1 and 6,2 (mid 2013) backlight driver
GNU General Public License v2.0
125 stars 21 forks source link

Patch *KIND OF WORKS* in xubuntu 14.10 (kernel 3.16 or 3.17) but causes new problems #19

Open flyingfalling opened 9 years ago

flyingfalling commented 9 years ago

Thank you so much for your contributions.

I had great success installing the mba6x_bl driver on 3.14 and was using it for a while. The other day I tried to install xubuntu 14.10 (kernel 3.16) and adding the mba6x_bl driver caused several symptoms. I have installed all together about 5 times and tried different combinations of kernel parameters (acpi_backlight=vendor and video.somethingsomethingvendor=1) etc.. I also tried adding/removing the xorg.conf telling it to use the mba6x_backlight driver. I also tried kernel 3.17.

1) In xubuntu 14.10 (kernel 3.16.0), before installing the mba6x_bl driver, I was able to control the backlight normally with the f1/f2 keys (however it would either be all on or all off after suspending, which is what this driver is supposed to fix) 2) after installing the driver, F1/F2 no longer works to change the backlight even before I suspend (the brightness indicator "popup" correctly shows the brightness going up or down but the actual brightness does not change). 3) Furthermore, when booting, as soon as it hits the DM, the brightness seems to be set extremely low, roughly 5%. Using my keybindings, I am able to log in and use xbacklight +100 to increase it, however the F1/F2 keys do not work. 4) Trying to get around this problem by binding F1/F2 as hotkeys to xbacklight -10/xbacklight+10 in userspace does not work. I assume something else (the mba6x driver or whatever driver exists before installing that) is grabbing those keys first and taking priority... this is true either with or without the mba6x_bl driver installed. 5) These problems PERSIST even after removing the mba6x_bl driver! (no longer being able to control the brightness with F1/F2, and the low brightness at login time). The only solution I've found to get back to being able to control the backlight with F1/F2 before suspend is to do a clean install of the OS since I have no idea what has been fudged so I can reverse it.

Anyway, I have no idea if these issues are related to the kernel version or to other changes in xubuntu (e.g. now using systemd). I know that certain power-management things seem to have changed as it no longer seems to recognize i915 kernel parameters.

EDIT: by the way I tried both using the .deb package as well as installing from source from this git repo.

EDIT: xbacklight does NOT work by default after suspend, however it DOES work after installing your driver. So, I have installed your driver, and am grappling with 1) The backlight F1/F2 keys no longer work after installing your driver, the only way to change the brightness either before or after suspend is by in terminal doing xbacklight +10/-10 etc. 2) the "SUPER LOW BRIGHTNESS" by default for the "xubuntu" splash screen and then the login screen, and then after login still low, and I have to basically open a terminal blind and do xbacklight +199

patjak commented 9 years ago

Hi I promote vendor backlight over ACPI backlight in the driver and set the type to "firmware" so both i915 and ACPI should step aside (unless things have changed). Nevertheless your utils for setting the brightness could potentially pick anything in /sys/class/backlight. Can you adjust the backlight (with mba6x_bl loaded) directly with something like

echo 200 >  /sys/class/backlight/mba6x_backlight/brightness?

A long shot but perhaps it gets loaded too late. Have you tried putting mba6x_bl in your initramfs?

Cheers

flyingfalling commented 9 years ago

Hi Jakob,

Thanks for your response. Yes, I am able to control by command like: sudo echo "200" | sudo tee /sys/class/backlight/mba6x_backlight/brightness

In this case, the values seem to vary between 0 and 255 (unsigned char?) (255 is max brightness).

I want to note that thanks to your driver, I am able to control backlight even after suspend using command such as above, or xbacklight. However it causes the 2 main problems of super-low brightness after reboot or cold boot, and the F1/F2 keys no longer are grabbed by your driver for some reason (this is probably because there is some place in xubuntu I have to tell it to use your driver instead of the native intel_backlight one?) 1) F1/F2 no longer work (I think the original program is still grabbing those keys) 2) At boot time, when it first loads the DM (for login, during the "ubuntu" splash etc.) the brightness is set very low. Maybe this is because your driver sets brightness to 100, but in terms of intel driver 100 is very low compared to max of 2700 or whatever? I have no idea, I'm just guessing haha. One time (randomly) when I rebooted, it had normal brightness, but I can not reproduce that one time (I tried leaving the /sys/class/backlight/mba6x_backlight/brightness set to various values before shutdown but it seems unrelated)

flyingfalling commented 9 years ago

By the way, dmesg doesn't seem to say anything useful, everything seems to be working... I want to make it clear that at boot, the screen is not "completely blank" as the other issue says, rather it is just very very low brightness (like 5%) so I can barely see the outline of things, but can't read text etc.

riveale@rvmba:~$ dmesg | grep mba [ 5.391929] mba6x_bl: Found LP8550 backlight driver [ 661.506174] mba6x_bl: Invalid response at reg: 0x1 (len: 24) [ 661.854101] mba6x_bl: Invalid response at reg: 0x1 (len: 24) [ 662.190084] mba6x_bl: Invalid response at reg: 0x1 (len: 24) [ 662.291643] mba6x_bl: set brightness retries = 3 riveale@rvmba:~$

patjak commented 9 years ago

I've push a patch to the master branch that might make a difference. Please try and report back.

flyingfalling commented 9 years ago

Dear Patrik,

Thanks for the update and thank you again for your work on this driver! I installed the new driver update and I unfortunately I still see the very low (almost black) brightness after a cold boot. After logging in (more or less blindly), I can use xbacklight to make it brighter.

Here's a pastebin of dmesg after the boot (I logged in and then used xbacklight to increase the brightness). Not sure what might be relevant to you so I just put everything without any greps.

http://pastebin.com/iQMyR9FM

patjak commented 9 years ago

You don't need acpi_backlight=vendor. If I add that parameter to my system the wrong backlight is picked and mba6x_bl no longer works. I don't remember what effect acpi_osi=Linux have on the backlight but I'm not using it so you can try removing that as well.

flyingfalling commented 9 years ago

Thanks for the tip, I have tried both with and without both of those and it doesn't seem to fix things. If I remove those kernel arguments, then it sometimes binds the buttons (i.e. F1 and F2 work correctly), but in those cases after suspending I get the "only max or minimum brightness" bug (I guess the intel driver is somehow getting grabbed first?). So, I cannot change the brightness after suspend, even if I use xbacklight. I tried adding/removing the xorg.conf file to no avail.

In (random) cases where the mba6xbl driver correctly binds, the F1/F2 do not work and the login screen brightness and xubuntu splash screen before it are at like 10% brightness, but after that I can use xbacklight to change the brightness. However, using F1/F2 do not change anything. This happens both after reboots or after cold boots (power cycle).

Anyway, I'm going to try a couple more things to see if any patterns arise...

riveale@rvmba:~$ dmesg | grep mba6 [ 5.622634] mba6x_bl: Found LP8550 backlight driver [ 59.206089] Modules linked in: nvram btusb snd_hda_codec_hdmi snd_hda_codec_cirrus snd_hda_codec_generic hid_generic joydev bcm5974 intel_rapl x86_pkg_temp_thermal intel_powerclamp coretemp mba6x_bl(OE) kvm_intel kvm crct10dif_pclmul crc32_pclmul ghash_clmulni_intel snd_hda_intel applesmc input_polldev snd_hda_controller aesni_intel bnep rfcomm aes_x86_64 lrw gf128mul bluetooth glue_helper 6lowpan_iphc ablk_helper cryptd snd_hda_codec snd_hwdep snd_pcm snd_seq_midi wl(POE) snd_seq_midi_event snd_rawmidi i915 snd_seq mei_me sbs snd_seq_device snd_timer sbshc mei snd drm_kms_helper mac_hid apple_bl video cfg80211 spi_pxa2xx_platform drm i2c_algo_bit lpc_ich soundcore shpchp binfmt_misc parport_pc ppdev lp nls_iso8859_1 parport hid_apple usbhid hid ahci uas libahci usb_storage riveale@rvmba:~$

flyingfalling commented 9 years ago

OK, I did about 30 reboot cycles and shutdown/boot cycles to see if there was any pattern. I could not find any other than the fact that in "failed" cases, dmesg never says anything about mba6xbl driver being loaded, except in the lsmod (I'm not sure what "OE" means?).

However, if I do the kernel argument of vendor and osi=linux like I was doing before, the driver is correctly bound every time, although it pretty much always has the initial dark (extremely low brightness) screen.

"UNBOUND" CASES

riveale@rvmba:~$ lsmod | grep mba
mba6x_bl               13042  0 
video                  20521  2 i915,mba6x_bl

(before suspend -- nothing)

riveale@rvmba:~$ cat brightfromreboot_f1f2works.txt  | grep mba
riveale@rvmba:~$ 
riveale@rvmba:~$ cat brightfromreboot_f1f2works.txt  | grep backlight
riveale@rvmba:~$

(after suspend)

riveale@rvmba:~$ dmesg | grep mba
[  391.514352] Modules linked in: nvram btusb snd_hda_codec_cirrus snd_hda_codec_generic snd_hda_codec_hdmi hid_generic joydev uas usb_storage bcm5974 intel_rapl x86_pkg_temp_thermal mba6x_bl(OE) intel_powerclamp coretemp kvm_intel kvm applesmc crct10dif_pclmul input_polldev crc32_pclmul ghash_clmulni_intel aesni_intel wl(POE) aes_x86_64 lrw gf128mul snd_hda_intel glue_helper ablk_helper rfcomm cryptd snd_hda_controller snd_hda_codec bnep snd_hwdep snd_pcm bluetooth 6lowpan_iphc snd_seq_midi snd_seq_midi_event cfg80211 snd_rawmidi i915 lpc_ich snd_seq snd_seq_device snd_timer drm_kms_helper drm sbs i2c_algo_bit snd mei_me sbshc mei spi_pxa2xx_platform video apple_bl shpchp soundcore mac_hid binfmt_misc parport_pc ppdev lp nls_iso8859_1 parport hid_apple usbhid hid ahci libahci

"BOUND" CASES

However, in "working" cases, it looks something like this (after suspend):

riveale@rvmba:~$ cat coldboot_noxorg_worked_lowbright_aftersuspend.txt  | grep mba
[    5.746555] mba6x_bl: Found LP8550 backlight driver
[   53.478190] mba6x_bl: Invalid response at reg: 0x1 (len: 24)
[   54.127269] mba6x_bl: Invalid response at reg: 0x1 (len: 24)
[   54.525273] mba6x_bl: set brightness retries = 2
[   56.943389] mba6x_bl: Invalid response at reg: 0x1 (len: 24)
[   57.575259] mba6x_bl: Invalid response at reg: 0x1 (len: 24)
[   57.959227] mba6x_bl: set brightness retries = 2

(before suspend)

riveale@rvmba:~$ cat coldboot_noxorg_worked_lowbright.txt  | grep mba
[    5.746555] mba6x_bl: Found LP8550 backlight driver

In working (bound) cases, any initial command to decrease brightness will first increase it to a visible level!

One observation that may be a hint is that when there is super-low brightness at the splash/login screen, after logging in, it seems that ANY brightness command brings the backlight to a visible level! In other words even if the first thing I call is "xbacklight -10", that still brings the backlight up to about 60% (from 5% or whatever it was at), and after that it changes normally at 10% intervals.

So, next I'm going to try to see what happens in low brightness cases where I manually check the brightneses...

EDIT

I also just verified that in cases where the mba6x driver doesn't bind the backlight, the /sys/class/backlight/mba6xbl directory does not exist. Only the /sys/class/backlight/intel_backlight/ exists.

EDIT 2

After a "successful bind", I grepped the raw brightnesses. The first one is done while the screen is BLACK (<5%) right after I login. But it still thinks it's at 150! So something is weird!

riveale@rvmba:~$ sh printbl.sh MBA6X: 150 INTEL: 2777 riveale@rvmba:~$ sh printbl.sh ^C riveale@rvmba:~$ sh printbl.sh MBA6X: 200 INTEL: 2777 riveale@rvmba:~$ sh printbl.sh MBA6X: 255 INTEL: 2777 riveale@rvmba:~$

patjak commented 9 years ago

In the unbound case after suspend you're getting an Oops or a Warning. Can you post the full dmesg when that happens?

flyingfalling commented 9 years ago

Here is the relevant part around 2 suspends (lid close -> lid open).

Full pastebin http://pastebin.com/tnPu8YgF

Edit: It looks to me like all the errors/warnings are related to the wireless or to the ata SSD, none to the backlight?

Relevant part...:

[   94.963653] ata1: SATA link up 6.0 Gbps (SStatus 133 SControl 300)
[   94.964143] ata1.00: unexpected _GTF length (8)
[   94.964682] ata1.00: unexpected _GTF length (8)
[   94.964735] ata1.00: configured for UDMA/133
[   95.065448] ata1: exception Emask 0x10 SAct 0x0 SErr 0x10000 action 0xe frozen
[   95.065450] ata1: irq_stat 0x00400000, PHY RDY changed
[   95.065453] ata1: SError: { PHYRdyChg }
[   95.065458] ata1: hard resetting link
[   95.137216] PM: resume of devices complete after 508.925 msecs
[   95.137639] PM: Finishing wakeup.
[   95.137642] Restarting tasks ... done.
[   95.169238] cfg80211: World regulatory domain updated:
[   95.169246] cfg80211:  DFS Master region: unset
[   95.169249] cfg80211:   (start_freq - end_freq @ bandwidth), (max_antenna_gain, max_eirp), (dfs_cac_time)
[   95.169256] cfg80211:   (2402000 KHz - 2472000 KHz @ 40000 KHz), (300 mBi, 2000 mBm), (N/A)
[   95.169261] cfg80211:   (2457000 KHz - 2482000 KHz @ 40000 KHz), (300 mBi, 2000 mBm), (N/A)
[   95.169266] cfg80211:   (2474000 KHz - 2494000 KHz @ 20000 KHz), (300 mBi, 2000 mBm), (N/A)
[   95.169271] cfg80211:   (5170000 KHz - 5250000 KHz @ 40000 KHz), (300 mBi, 2000 mBm), (N/A)
[   95.169275] cfg80211:   (5735000 KHz - 5835000 KHz @ 40000 KHz), (300 mBi, 2000 mBm), (N/A)
[   95.788195] ata1: SATA link up 6.0 Gbps (SStatus 133 SControl 300)
[   95.788696] ata1.00: unexpected _GTF length (8)
[   95.789344] ata1.00: unexpected _GTF length (8)
[   95.789430] ata1.00: configured for UDMA/133
[   95.789511] ata1: EH complete
[   95.852215] [drm] Enabling RC6 states: RC6 on, RC6p off, RC6pp off
[   95.917398] ata1: exception Emask 0x10 SAct 0x0 SErr 0x10000 action 0xe frozen
[   95.917408] ata1: irq_stat 0x00400000, PHY RDY changed
[   95.917414] ata1: SError: { PHYRdyChg }
[   95.917424] ata1: hard resetting link
[   96.640743] ata1: SATA link up 6.0 Gbps (SStatus 133 SControl 300)
[   96.641383] ata1.00: unexpected _GTF length (8)
[   96.642027] ata1.00: unexpected _GTF length (8)
[   96.642100] ata1.00: configured for UDMA/133
[   96.642167] ata1: EH complete
[   96.787776] systemd-logind[895]: Lid opened.
[   96.787858] systemd-logind[895]: Operation finished.
[  100.498702] systemd-logind[895]: New session c3 of user lightdm.
[  100.503643] ERROR @wl_inform_single_bss : cfg80211_inform_bss_frame error
[  104.085851] ERROR @wl_inform_single_bss : cfg80211_inform_bss_frame error
[  108.649155] ERROR @wl_inform_single_bss : cfg80211_inform_bss_frame error
[  124.815380] ERROR @wl_inform_single_bss : cfg80211_inform_bss_frame error
[  155.962016] cfg80211: Calling CRDA to update world regulatory domain
[  155.989359] cfg80211: World regulatory domain updated:
[  155.989365] cfg80211:  DFS Master region: unset
[  155.989367] cfg80211:   (start_freq - end_freq @ bandwidth), (max_antenna_gain, max_eirp), (dfs_cac_time)
[  155.989371] cfg80211:   (2402000 KHz - 2472000 KHz @ 40000 KHz), (300 mBi, 2000 mBm), (N/A)
[  155.989375] cfg80211:   (2457000 KHz - 2482000 KHz @ 40000 KHz), (300 mBi, 2000 mBm), (N/A)
[  155.989377] cfg80211:   (2474000 KHz - 2494000 KHz @ 20000 KHz), (300 mBi, 2000 mBm), (N/A)
[  155.989380] cfg80211:   (5170000 KHz - 5250000 KHz @ 40000 KHz), (300 mBi, 2000 mBm), (N/A)
[  155.989382] cfg80211:   (5735000 KHz - 5835000 KHz @ 40000 KHz), (300 mBi, 2000 mBm), (N/A)
[  171.764293] chromium-browse[3685]: segfault at 1f8 ip 00007f0985c3b63f sp 00007fff4a4214d0 error 4 in i965_dri.so[7f09858e8000+51c000]
[  172.656554] chromium-browse[3776]: segfault at 1f8 ip 00007f0fedac163f sp 00007fff80bddca0 error 4 in i965_dri.so[7f0fed76e000+51c000]
[  173.569605] chromium-browse[3799]: segfault at 1f8 ip 00007f51e915063f sp 00007fff6d6f3270 error 4 in i965_dri.so[7f51e8dfd000+51c000]
[  205.366984] ERROR @wl_inform_single_bss : cfg80211_inform_bss_frame error
[  211.608459] ERROR @wl_inform_single_bss : cfg80211_inform_bss_frame error
[  391.514298] ------------[ cut here ]------------
[  391.514348] WARNING: CPU: 1 PID: 550 at /home/apw/COD/linux/net/wireless/sme.c:791 cfg80211_roamed+0x97/0xa0 [cfg80211]()
[  391.514352] Modules linked in: nvram btusb snd_hda_codec_cirrus snd_hda_codec_generic snd_hda_codec_hdmi hid_generic joydev uas usb_storage bcm5974 intel_rapl x86_pkg_temp_thermal mba6x_bl(OE) intel_powerclamp coretemp kvm_intel kvm applesmc crct10dif_pclmul input_polldev crc32_pclmul ghash_clmulni_intel aesni_intel wl(POE) aes_x86_64 lrw gf128mul snd_hda_intel glue_helper ablk_helper rfcomm cryptd snd_hda_controller snd_hda_codec bnep snd_hwdep snd_pcm bluetooth 6lowpan_iphc snd_seq_midi snd_seq_midi_event cfg80211 snd_rawmidi i915 lpc_ich snd_seq snd_seq_device snd_timer drm_kms_helper drm sbs i2c_algo_bit snd mei_me sbshc mei spi_pxa2xx_platform video apple_bl shpchp soundcore mac_hid binfmt_misc parport_pc ppdev lp nls_iso8859_1 parport hid_apple usbhid hid ahci libahci
[  391.514435] CPU: 1 PID: 550 Comm: wl_event_handle Tainted: P           OE 3.16.7-031607-generic #201411141035
[  391.514439] Hardware name: Apple Inc. MacBookAir6,2/Mac-7DF21CB3ED6977E5, BIOS MBA61.88Z.0099.B12.1405241030 05/24/2014
[  391.514442]  0000000000000317 ffff88008ba17db0 ffffffff8278a714 0000000000000007
[  391.514447]  0000000000000000 ffff88008ba17df0 ffffffff8207210c ffff8801668c3e9a
[  391.514453]  ffff8801668c4000 ffff880066158540 0000000000000088 ffff8800661586c0
[  391.514458] Call Trace:
[  391.514471]  [<ffffffff8278a714>] dump_stack+0x46/0x58
[  391.514481]  [<ffffffff8207210c>] warn_slowpath_common+0x8c/0xc0
[  391.514486]  [<ffffffff8207215a>] warn_slowpath_null+0x1a/0x20
[  391.514510]  [<ffffffffc058a417>] cfg80211_roamed+0x97/0xa0 [cfg80211]
[  391.514589]  [<ffffffffc08ea91b>] wl_notify_roaming_status+0xcb/0x150 [wl]
[  391.514656]  [<ffffffffc08e7652>] wl_event_handler+0x62/0x260 [wl]
[  391.514718]  [<ffffffffc08e75f0>] ? wl_free_wdev.isra.23+0x80/0x80 [wl]
[  391.514726]  [<ffffffff82096509>] kthread+0xc9/0xe0
[  391.514732]  [<ffffffff82096440>] ? flush_kthread_worker+0xb0/0xb0
[  391.514738]  [<ffffffff82797ffc>] ret_from_fork+0x7c/0xb0
[  391.514744]  [<ffffffff82096440>] ? flush_kthread_worker+0xb0/0xb0
[  391.514748] ---[ end trace 1b7bfd743ae493b9 ]---
[  416.865343] cfg80211: Calling CRDA to update world regulatory domain
[  416.893571] cfg80211: World regulatory domain updated:
[  416.893577] cfg80211:  DFS Master region: unset
[  416.893580] cfg80211:   (start_freq - end_freq @ bandwidth), (max_antenna_gain, max_eirp), (dfs_cac_time)
[  416.893584] cfg80211:   (2402000 KHz - 2472000 KHz @ 40000 KHz), (300 mBi, 2000 mBm), (N/A)
[  416.893588] cfg80211:   (2457000 KHz - 2482000 KHz @ 40000 KHz), (300 mBi, 2000 mBm), (N/A)
[  416.893591] cfg80211:   (2474000 KHz - 2494000 KHz @ 20000 KHz), (300 mBi, 2000 mBm), (N/A)
[  416.893593] cfg80211:   (5170000 KHz - 5250000 KHz @ 40000 KHz), (300 mBi, 2000 mBm), (N/A)
[  416.893596] cfg80211:   (5735000 KHz - 5835000 KHz @ 40000 KHz), (300 mBi, 2000 mBm), (N/A)
[  419.829222] ERROR @wl_inform_single_bss : cfg80211_inform_bss_frame error
[  461.928580] systemd-logind[895]: Lid closed.
[  462.856539] ata1: exception Emask 0x10 SAct 0x0 SErr 0x50000 action 0xe frozen
[  462.856545] ata1: irq_stat 0x00400000, PHY RDY changed
[  462.856549] ata1: SError: { PHYRdyChg CommWake }
[  462.856555] ata1: hard resetting link
[  463.578360] ata1: SATA link up 6.0 Gbps (SStatus 133 SControl 300)
[  463.578775] ata1.00: unexpected _GTF length (8)
[  463.581891] ata1.00: unexpected _GTF length (8)
[  463.581935] ata1.00: configured for UDMA/133
[  463.581976] ata1: EH complete
[  463.588365] PM: Syncing filesystems ... done.
[  463.591189] PM: Preparing system for mem sleep
[  463.591315] Freezing user space processes ... (elapsed 0.001 seconds) done.
[  463.592955] Freezing remaining freezable tasks ... (elapsed 0.001 seconds) done.
[  463.594096] PM: Entering mem sleep
[  463.594143] Suspending console(s) (use no_console_suspend to debug)
[  463.594402] sd 0:0:0:0: [sda] Synchronizing SCSI cache
[  463.594484] sd 0:0:0:0: [sda] Stopping disk
[  463.600852] cfg80211: Calling CRDA to update world regulatory domain
[  463.939612] PM: suspend of devices complete after 345.487 msecs
[  463.954208] PM: late suspend of devices complete after 14.598 msecs
[  463.954768] xhci_hcd 0000:00:14.0: System wakeup enabled by ACPI
[  463.970210] PM: noirq suspend of devices complete after 16.005 msecs
[  463.970467] ACPI: Preparing to enter system sleep state S3
[  463.971270] PM: Saving platform NVS memory
[  463.971438] Disabling non-boot CPUs ...
[  463.971478] intel_pstate CPU 1 exiting
[  463.972638] kvm: disabling virtualization on CPU1
[  464.074184] smpboot: CPU 1 is now offline
[  464.074462] intel_pstate CPU 2 exiting
[  464.075595] kvm: disabling virtualization on CPU2
[  464.178117] smpboot: CPU 2 is now offline
[  464.178388] intel_pstate CPU 3 exiting
[  464.178480] Broke affinity for irq 59
[  464.178482] Broke affinity for irq 60
[  464.178483] Broke affinity for irq 61
[  464.178485] Broke affinity for irq 62
[  464.179491] kvm: disabling virtualization on CPU3
[  464.282093] smpboot: CPU 3 is now offline
[  464.284608] ACPI: Low-level resume complete
[  464.284709] PM: Restoring platform NVS memory
[  464.285451] Enabling non-boot CPUs ...
[  464.285553] x86: Booting SMP configuration:
[  464.285556] smpboot: Booting Node 0 Processor 1 APIC 0x2
[  464.302826] kvm: enabling virtualization on CPU1
[  464.305862] Intel pstate controlling: cpu 1
[  464.306020] CPU1 is up
[  464.306088] smpboot: Booting Node 0 Processor 2 APIC 0x1
[  464.318727] kvm: enabling virtualization on CPU2
[  464.321053] Intel pstate controlling: cpu 2
[  464.321113] CPU2 is up
[  464.321138] smpboot: Booting Node 0 Processor 3 APIC 0x3
[  464.334366] kvm: enabling virtualization on CPU3
[  464.336870] Intel pstate controlling: cpu 3
[  464.336949] CPU3 is up
[  464.344178] ACPI: Waking up from system sleep state S3
[  466.373168] xhci_hcd 0000:00:14.0: System wakeup disabled by ACPI
[  466.408193] PM: noirq resume of devices complete after 35.181 msecs
[  466.408654] PM: early resume of devices complete after 0.426 msecs
[  466.408822] mei_me 0000:00:16.0: irq 65 for MSI/MSI-X
[  466.408916] snd_hda_intel 0000:00:03.0: irq 67 for MSI/MSI-X
[  466.409159] snd_hda_intel 0000:00:1b.0: irq 68 for MSI/MSI-X
[  466.424190] sd 0:0:0:0: [sda] Starting disk
[  466.567748] cfg80211: Calling CRDA to update world regulatory domain
[  466.744007] ata1: SATA link up 6.0 Gbps (SStatus 133 SControl 300)
[  466.744483] ata1.00: unexpected _GTF length (8)
[  466.745088] ata1.00: unexpected _GTF length (8)
[  466.745174] ata1.00: configured for UDMA/133
[  466.845946] ata1: exception Emask 0x10 SAct 0x0 SErr 0x10000 action 0xe frozen
[  466.845948] ata1: irq_stat 0x00400000, PHY RDY changed
[  466.845950] ata1: SError: { PHYRdyChg }
[  466.845954] ata1: hard resetting link
[  466.925301] PM: resume of devices complete after 516.871 msecs
[  466.925598] PM: Finishing wakeup.
[  466.925600] Restarting tasks ... done.
[  466.962280] cfg80211: World regulatory domain updated:
[  466.962288] cfg80211:  DFS Master region: unset
[  466.962292] cfg80211:   (start_freq - end_freq @ bandwidth), (max_antenna_gain, max_eirp), (dfs_cac_time)
[  466.962298] cfg80211:   (2402000 KHz - 2472000 KHz @ 40000 KHz), (300 mBi, 2000 mBm), (N/A)
[  466.962303] cfg80211:   (2457000 KHz - 2482000 KHz @ 40000 KHz), (300 mBi, 2000 mBm), (N/A)
[  466.962307] cfg80211:   (2474000 KHz - 2494000 KHz @ 20000 KHz), (300 mBi, 2000 mBm), (N/A)
[  466.962311] cfg80211:   (5170000 KHz - 5250000 KHz @ 40000 KHz), (300 mBi, 2000 mBm), (N/A)
[  466.962316] cfg80211:   (5735000 KHz - 5835000 KHz @ 40000 KHz), (300 mBi, 2000 mBm), (N/A)
[  467.567688] ata1: SATA link up 6.0 Gbps (SStatus 133 SControl 300)
[  467.568249] ata1.00: unexpected _GTF length (8)
[  467.568997] ata1.00: unexpected _GTF length (8)
[  467.569103] ata1.00: configured for UDMA/133
[  467.569206] ata1: EH complete
[  467.694904] ata1: exception Emask 0x10 SAct 0x0 SErr 0x10000 action 0xe frozen
[  467.694909] ata1: irq_stat 0x00400000, PHY RDY changed
[  467.694912] ata1: SError: { PHYRdyChg }
[  467.694916] ata1: hard resetting link
[  467.731637] [drm] Enabling RC6 states: RC6 on, RC6p off, RC6pp off
[  468.415397] ata1: SATA link up 6.0 Gbps (SStatus 133 SControl 300)
[  468.415959] ata1.00: unexpected _GTF length (8)
[  468.416506] ata1.00: unexpected _GTF length (8)
[  468.416555] ata1.00: configured for UDMA/133
[  468.416602] ata1: EH complete
[  468.563318] systemd-logind[895]: Operation finished.
[  468.565371] systemd-logind[895]: Lid opened.
[  471.145513] systemd-logind[895]: New session c4 of user lightdm.
[  472.142588] ERROR @wl_inform_single_bss : cfg80211_inform_bss_frame error
patjak commented 9 years ago

I can't make heads or tails of this. Your system seems very unpredictable and it might some other weirdness causing this issues. Either way, I'm going to rewrite the driver to directly access the smbus instead of using the ACPI methods. Hopefully that will work better and most of the issues we have will go away. I'll keep you posted.

flyingfalling commented 9 years ago

Hi Patrik,

Thanks for the note. I'll keep an eye out for any updates then. Sounds like you're getting similar (?) problems with dark screen at login time now, so maybe that will be much easier for you to figure out. I don't think I'm running anything weird except that I'm on ubuntu 14.10 and I'm using the latest 3.16 kernel (3.16.7). Same was happening for previous versions of 3.16 as well down to 3.16.0.

Richard

patjak commented 9 years ago

I've pushed a fix (works for me at least) for the blackscreen on boot problem. Check out the "notify" branch.

I've also started experiencing the case where the driver is loaded but doesn't register (unbound). It doesn't happen very often and it seems totally random.

agimenez commented 9 years ago

Hi @patjak, MBA 6,2 user here.

I have tried the notify branchd and I'm experiencing the super-low brightness at boot. Even when I log out from my X session and return to the Display manager greeter the brightness is reset to a very low setting.

The sysfs files have the previously "echoed" values (I'm trying just by echoing brightness values manually), but the screen is almost black. If I re-echo the same brightness value, then the screen shows up the correct setting again.

I just installed the driver and rebootes, did not modify the xorg.conf configuration, does that fix the problem or is some work still going on?

Should you need me to perform further tests or provide logfiles, be free to ask.

Thanks and regards, L. Alberto

arselzer commented 9 years ago

I tried the patch on Linux 3.17 and had some problems. I commented on issue https://github.com/patjak/mba6x_bl/issues/14#issuecomment-68518965, sorry for that. Also experiencing low brightness at boot, but the backlight not turning off when closing the laptop is a bigger issue IMO. Thanks for your great work.

patjak commented 9 years ago

@AlexanderSelzer sound like you have a different issue with suspend/resume. Try the following as root and then try suspending again:

echo XHC1 > /proc/acpi/wakeup
arselzer commented 9 years ago

I installed the latest kernel quite recently, which seems to have introduced the problems. It looked like it was related.

Now I installed the module from the notify branch again and rebooted. Screen goes dark after entering the disk decryption password. Increasing the brightness to its maximum turns the screen on again, and brightness controls work. When suspending, the Apple is lit up for 4 - 30 seconds, goes dark again and lights up again after a few seconds. It looks like it only does this once.

After writing XHC1 to /proc/acpi/wakeup and suspending again, the light shuts down immediately, but when closing it the next time after that the same thing as before happens, except the light does not flash afterwards.

Then after writing XHC1 to the file again, the flashing started to reappear. Then after again writing to it, it works fine one time, but reappears the next time. There seem to be some loose patterns, but it is not reliable enough to say much.

There are three things that can happen on suspend:

  1. backlight is on for a variable time while suspending, flashes one(?) time and goes off
  2. backlight goes off after less than a second and stays off (wanted behaviour)
  3. backlight is on for a variable amount of time, but does not flash and stays off (better, but not best)
agimenez commented 9 years ago

Hi,

I've been observing that one of your issues happened to me, but quite randomly as well: After closing the lid the system did not suspend and the "backlight apple" was on as well. After a couple retries it just started working.

Right now I'm not able to reproduce, the first time I have closed the lid, it suspended and the apple went off, but it's true that the second try needed about 5-10 seconds and the first one was almost instant.

Maybe the problem is with suspending itself you might want to debug your powersave settings or tools?

Regards, L. Alberto

arselzer commented 9 years ago

@agimenez thanks, good to know I'm not alone. What version of Linux are you using? The problem did not always occur for me. I think it might have been introduced in 3.17 or 3.17.x

Here is my dmesg log after waking up, might be interesting (especially Invalid response at reg: 0x1).

[73200.799192] ACPI: Waking up from system sleep state S3
[73202.815733] xhci_hcd 0000:00:14.0: System wakeup disabled by ACPI
[73202.848473] PM: noirq resume of devices complete after 32.874 msecs
[73202.868632] PM: early resume of devices complete after 20.147 msecs
[73202.868965] mei_me 0000:00:16.0: irq 49 for MSI/MSI-X
[73202.869021] snd_hda_intel 0000:00:03.0: irq 50 for MSI/MSI-X
[73202.869138] snd_hda_intel 0000:00:1b.0: irq 52 for MSI/MSI-X
[73202.870643] rtc_cmos 00:02: System wakeup disabled by ACPI
[73202.881751] sd 0:0:0:0: [sda] Starting disk
[73203.033424] cfg80211: Calling CRDA to update world regulatory domain
[73203.037565] PM: resume of devices complete after 169.012 msecs
[73203.037680] PM: Finishing wakeup.
[73203.037681] Restarting tasks ... done.
[73203.201612] ata1: SATA link up 6.0 Gbps (SStatus 133 SControl 300)
[73203.202013] ata1.00: unexpected _GTF length (8)
[73203.202469] ata1.00: unexpected _GTF length (8)
[73203.202472] ata1.00: configured for UDMA/133
[73203.604742] mba6x_bl: Invalid response at reg: 0x1 (len: 24)
[73203.943078] mba6x_bl: set brightness retries = 1
[73207.009806] usb usb2-port3: Cannot enable. Maybe the USB cable is bad?
[73207.199131] cfg80211: Calling CRDA to update world regulatory domain
arselzer commented 9 years ago

The backlight is now blinking on and off repeatedly while the laptop is closed, since I plugged in an Android phone. Currently there is nothing in the USB port. It said usb usb2-port3: Cannot enable. Maybe the USB cable is bad? three times, while the backlight lit up three times., Testing it again, after it lighting up 4 times, it printed the message four times, and then said unable to enumerate USB device. Googling the issue I found people with different versions of Linux on many different devices from as early as 2006 reporting the error message, but there doesn't seem to be a clear fix.

I think it looks very much like the suspend and backlight flashing problem was not caused by mba6x_bl, but by something related to USB and possibly another bug in Linux.

@agimenez you could try to check if the message also appears in your log, since you have the same or similar problems.

Thanks a lot.

flyingfalling commented 9 years ago

Just wanted to echo that I've been seeing the "apple light goes out, then relights, then goes off again" for about 4 months now, ever since updating past 3.14 (?) kernel. However, it does suspend correctly after the second flash so I've been ignoring it.

I'm currently on 3.16.7. I tried 3.17 and installed from source the broadcomm wireless driver, however I was having problems with the backlight driver so that's why I'm only using 3.16 for now...

agimenez commented 9 years ago

@AlexanderSelzer Hi, sorry for the delay!

I have checked and I don't have any of your messages, (invalid response/bad cable/unable to enumerate). I'm on 3.16.0, stock Debian Jessie version.

Right now everything is working for me using the notify branch, have you tried that? Hope that helps!

L. Alberto

arselzer commented 9 years ago

@agimenez It works well enough (notify branch), though the invalid response errors are still showing. The only (really minor) issue is the backlight only turning on after pressing a key. Also, I am using Linux 3.18, so the differences might be related to that . The bad cable message is gone, but I am now very certain that the backlight flashing while suspended problem only occurs when USB devices were plugged in, and might be worthy of some other bug report on a different driver or so.

guikubivan commented 3 years ago

In case this helps anyone using XFCE, what fixed the keyboard keys for display brightness for me was installing xfce4-power-manager. Just installing that worked, but there is also a toggle setting there to "Handle display brightness keys".