UNSOLVED

mmirg

updated

10 years ago

M

mmirg

26 Posts

0

9263

July 10th, 2016 20:00

No backlight control when resuming from suspend-to-ram

I'm having difficulty resuming my Precision 5510 after suspending.  I have currently replaced the default Ubuntu installation with Gentoo on my laptop.  I'm currently using the Intel GPU for primary graphics output and the Nvidia through bumblebee as needed.

I'm able to put the laptop to sleep either with a lid trigger or by calling pm-suspend (I'm using openRC instead of systemd so I'm still using pm-utils to suspend.)  The machine goes to sleep reliably and will wake up but with odd behavior of the backlight upon resuming.  Adjusting the backlight with the hotkeys, a slider widget or by directly echoing values into /sys/class/backlight/intel_backlight/brightness will not adjust the backlight.  The hotkeys will still trigger the OSD to react as if brightness is being lowered.  However, once I hit the bottom of the brightness scale or echo "0" into the sysfs node, the backlight will turn off and can be turned on again.

Unfortunately, there's a second side effect that I've seen from this odd suspend behavior.  Once I have suspended and resumed the computer, I won't be able to use the hotkeys to adjust brightness after rebooting the computer.  Echoing into sysfs or using GUI widget slider will adjust the backlight but the hotkeys will not react or trigger events in X (including when I test with xev).  However, the backlight and keys still work because I am able to adjust the backlight during POST and the bootloader, it is only after the kernel initializes that I lose control.  I am yet to be able to isolate how it is that I regain hotkey usage again, but after some combination of suspends, resumes and reboots, I'm usually able to get things working again, but it's a frustrating procedure since I can't reproduce it reliably.

Does anyone have any thoughts on what might be going on here or how I might be able to properly re-initialize the backlight?  This seems to be the only problem that I am still having and it is quite vexing.  This doesn't seem to happen with systemd based suspend and resume, but I'm yet to test it exhaustively.  Has anyone else encountered a similar issue?

I'm on the most recent BIOS and am booting using legacy boot instead of EFI should that be relevant.  I've also tried the different quirks available to pm-utils to no avail and have also tried passing "acpi_osi=Linux/!Windows 2012 and acpi_backlight=vendor/native/video in all combinations but to no avail.  vbetool stops functioning after I resume from suspend and will respond to any attempted usage with "Real mode call failed".

  • gregbunk

    36 Posts

    3617

    0

    Posted July 11th, 2016 04:00

    Similar problems here.  It will also spontaneously reboot after resume from time to time.

    I believe that the BIOS is corrupting itself on resume.  You can check this by running dmidecode as root before the first suspend, then after resume.  You will note that it works perfectly before a resume, but that the tables are corrupted after resume.

  • mmirg

    26 Posts

    3617

    0

    Posted July 11th, 2016 21:00

    Yes, I noticed that and saw your other thread on this issue as well.  I just received my laptop so it came with a newer BIOS revision than the 1.2 version that you previously mentioned, does suspend and resume work properly for you with the older firmware?  Since I effectively can't get the USB-C port to do anything (save for charge my Nexus 6P), I guess the Thunderbolt improvements in the newer BIOS revisions are largely moot from a user standpoint.  

  • gregbunk

    36 Posts

    3617

    0

    Posted July 12th, 2016 05:00

    Suspend and resume is more stable with the older BIOS, though it still corrupts itself and will spontaneously reboot on resume.  That said, I very, very rarely (never?) saw a resume that left me with a blank screen, and that is very common with 1.2.10.

    Neither is fully stable.  

  • MortenS

    1 Message

    3617

    4

    Posted September 10th, 2016 15:00

    I see same problem with brightness after resume not working.

    In /sys/class/backlight/intel_backlight I can still turn on off display with the bl_power or by setting brightness to 0. All other values (up to 12 supported) just gives full brightness. This i with bios 1.2.10 on Linux 4.7.2-1-ARCH on Arch Linux.

    My Dell Precision 5510 is an intel i5-6440HQ without discrete graphic (No Nvidia).

    In a bug reported 2013-07-26 I found a reference to a temporary workaround:
    https://bugzilla.kernel.org/show_bug.cgi?id=60635
    https://bugs.freedesktop.org/show_bug.cgi?id=97486

    On my PC: after fresh poweron:

    $ sudo intel_reg read 0xc2000

    (0x000c2000): 0x00000001

    After suspend/resume where brightness is not working the value of the register had changed to 0's. Running the following solved the problem an it is possible to adjust the brightness:

    $ sudo intel_reg write  0xc2000 0x00000001

    A patch for the kernel is discussed here: https://patchwork.freedesktop.org/patch/109407/

    But as it is not yet finalized it could take until kernel 4.9 before we see it in the Linux kernel.

  • pdimarco

    2 Posts

    3617

    0

    Posted September 14th, 2016 09:00

    So I actually only ran into this problem once, I usually am unable to resume from sleep because of other issues mentioned on this board. But one peculiarity I did see when I hit it was I was able to adjust brightness by some means but not others. So my normal means is:

    "xbacklight -inc 10" and "xbacklight -dec 10"

    But those weren't working. But when I did this via xrandr, that did work. Something like:

    "xrandr --output eDP1 --brightness 0.7

    Of course I can't recreate because I usually have to reboot :(. Though I saw this on Dell Precision 5510 with nvidia quadro 1000m and bios 1.2.14.

  • mmirg

    26 Posts

    3617

    0

    Posted September 15th, 2016 08:00

    Thanks for finding and sharing that patch.  I can confirm that the patch seems to fix my suspend and resume issues with respect to the backlight.  I'm able to consistently resume and still have my screen on and can control my backlight.

  • cregganna

    1 Rookie

    5 Posts

    3621

    2

    Posted September 18th, 2016 03:00

    Indeed - this was the issue with my Dell Precision 5510 currently running Ubuntu 16.04.1 (But was present on the as-delivered 14.04). My BIOS is currently: "DMI: Dell Inc. Precision 5510/08R8KJ, BIOS 1.2.14 08/31/2016". I'm currently on kernel 4.6.0-040600-generic.

    Unfortunately Suspend does not complete if I'm connected to the WD15 docking station but this is at least some progress - Honestly it is frustrating that these issues exist on a box that is being sold pre-installed with Ubuntu OS.

    Following MortenS's reply I wrote a script for:

    /usr/lib/pm-utils/sleep.d/97fixbacklight - (Don't forget to chmod 755)

    ======================8<======================
    #!/bin/sh
    # From patchwork.freedesktop.org/.../
    # and en.community.dell.com/.../19985320
    # Suspend Resume fails to restore PWM_GRANUALITY
    # Tony.Jewell@Cregganna.Com
    
    #. "${PM_FUNCTIONS}"
    
    INTEL_REG=/usr/bin/intel_reg
    ADDR="0x000c2000"
    SAVE_FILE=/var/lib/pm-utils/save_intel_reg_pwm_granuality
    
    [ -x "$INTEL_REG" ] || exit 0
    
    case "$1" in
            hibernate|suspend)
    		echo "$0: Saving Intel Register PWM_GRANUALITY"
    		"$INTEL_REG" read "$ADDR" \
    			| (read addr value && echo "$value") \
    			>"$SAVE_FILE"
    	sync
    	;;
    	thaw|resume)
    		value=`cat "$SAVE_FILE" 2>/dev/null`
    		if [ -n "$value" ]
    		then
    			echo "$0: Restoring Intel Register PWM_GRANUALITY $value"
    			"$INTEL_REG" write "$ADDR" "$value"
    			rm "$SAVE_FILE"
    		fi
    	;;
    esac
    ======================8<======================
    
  • hsahmed

    2 Posts

    3621

    2

    Posted September 18th, 2016 07:00

    Thanks CREGGANNA for your script. I have modified it slightly to make it work with systems using systemd instead of pm-utils for sleep/hibernate

    Save the following script as /usr/lib/systemd/system-sleep/fixbacklight (and chmod 755)

    #!/bin/sh
    # From patchwork.freedesktop.org/.../
    # and en.community.dell.com/.../19985320
    # Suspend Resume fails to restore PWM_GRANUALITY
    # Based on script by Tony.Jewell@Cregganna.Com
    
    INTEL_REG=/usr/bin/intel_reg
    ADDR="0x000c2000"
    SAVE_FILE=/var/lib/systemd/save_intel_reg_pwm_granuality
    
    [ -x "$INTEL_REG" ] || exit 0
    
    case "$1" in
            pre)
    		echo "$0: Saving Intel Register PWM_GRANUALITY"
    		"$INTEL_REG" read "$ADDR" \
    			| (read addr value && echo "$value") \
    			>"$SAVE_FILE"
    	sync
    	;;
    	post)
    		value=`cat "$SAVE_FILE" 2>/dev/null`
    		if [ -n "$value" ]
    		then
    			echo "$0: Restoring Intel Register PWM_GRANUALITY $value"
    			"$INTEL_REG" write "$ADDR" "$value"
    			rm "$SAVE_FILE"
    		fi
    	;;
    esac
    
  • cregganna

    1 Rookie

    5 Posts

    3621

    1

    Posted September 18th, 2016 10:00

    Thanks HSAHMED - on my system I think that would go in:

    /lib/systemd/system-sleep/fixbacklight

    not in

    /usr/lib/systemd/system-sleep/fixbacklight 

  • 1093

    0

    Posted September 20th, 2016 18:00

    @hsahmed and @creggann I wanted to let you know that the systemd fixbacklight script, saved to /lib/systemd/system-sleep/fixbacklight has worked perfectly for me. I have been fighting this issue since the beginning of August. I have spent a couple weekends, 2 reinstalls, and several additional evenings trying things.

    My system is the Dell M5510 running Ubuntu 16.04.