From nobody@FreeBSD.org  Sat Aug 17 18:32:21 2013
Return-Path: <nobody@FreeBSD.org>
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1])
	(using TLSv1 with cipher ADH-AES256-SHA (256/256 bits))
	(No client certificate requested)
	by hub.freebsd.org (Postfix) with ESMTP id 23EEC60A
	for <freebsd-gnats-submit@FreeBSD.org>; Sat, 17 Aug 2013 18:32:21 +0000 (UTC)
	(envelope-from nobody@FreeBSD.org)
Received: from oldred.freebsd.org (oldred.freebsd.org [8.8.178.121])
	(using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits))
	(No client certificate requested)
	by mx1.freebsd.org (Postfix) with ESMTPS id EC6A32561
	for <freebsd-gnats-submit@FreeBSD.org>; Sat, 17 Aug 2013 18:32:20 +0000 (UTC)
Received: from oldred.freebsd.org ([127.0.1.6])
	by oldred.freebsd.org (8.14.5/8.14.7) with ESMTP id r7HIWKKW045942
	for <freebsd-gnats-submit@FreeBSD.org>; Sat, 17 Aug 2013 18:32:20 GMT
	(envelope-from nobody@oldred.freebsd.org)
Received: (from nobody@localhost)
	by oldred.freebsd.org (8.14.5/8.14.5/Submit) id r7HIWKMM045941;
	Sat, 17 Aug 2013 18:32:20 GMT
	(envelope-from nobody)
Message-Id: <201308171832.r7HIWKMM045941@oldred.freebsd.org>
Date: Sat, 17 Aug 2013 18:32:20 GMT
From: Matthias Petermann <matthias@petermann-it.de>
To: freebsd-gnats-submit@FreeBSD.org
Subject: Suspend to RAM not working correctly on Lenovo X121e (ACPI issue?)
X-Send-Pr-Version: www-3.1
X-GNATS-Notify:

>Number:         181358
>Category:       amd64
>Synopsis:       [suspend/resume] Suspend to RAM not working correctly on Lenovo X121e (ACPI issue?)
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-amd64
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Sat Aug 17 18:40:00 UTC 2013
>Closed-Date:    
>Last-Modified:  Tue Apr 22 05:33:37 UTC 2014
>Originator:     Matthias Petermann
>Release:        10.0-CURRENT
>Organization:
>Environment:
FreeBSD thinkpad.local 10.0-CURRENT FreeBSD 10.0-CURRENT #0 r252853:
Sat Jul 6 02:01:48 CEST 2013
>Description:
LCD remains dark after resume from suspend to ram (S3). 

I have FreeBSD 10.0-CURRENT installed permanently to my X121e and am willing to test / investigate at any time. Please advise if there is anything I could provide right now.

The affected model is a Lenovo X121e (Model 3045-79G, i3, HD3000). Details:

http://www.petermann-it.de/files/freebsd-pr-x121e-acpi/dmesg.txt
http://www.petermann-it.de/files/freebsd-pr-x121e-acpi/devinfo.txt
http://www.petermann-it.de/files/freebsd-pr-x121e-acpi/mpeterma-lenovo_x121e_i3.asl
http://www.petermann-it.de/files/freebsd-pr-x121e-acpi/sysctl_hw_acpi.txt
>How-To-Repeat:
# Supported Sleep states as reported by sysctl

   root@thinkpad:/usr/home/mpeterma # sysctl -a |grep supported
   hw.acpi.supported_sleep_state: S3 S4 S5

# S3, hw.acpi.reset_video=0

   root@thinkpad:/usr/home/mpeterma # sysctl hw.acpi.reset_video=0
    hw.acpi.reset_video: 0 -> 0
   root@thinkpad:/usr/home/mpeterma # acpiconf -s 3

Result: System suspends, no video after resume, black screen

# S3, hw.acpi.reset_video=1

   root@thinkpad:/usr/home/mpeterma # sysctl hw.acpi.reset_video=1
   hw.acpi.reset_video: 0 -> 1
   root@thinkpad:/usr/home/mpeterma # acpiconf -s 3

Result: system reboots immediately

# Adding more debug output

In ACPI Debugging guide it is recommended to recompile the ACPI module 
with additional debug mode. Anyway, when I try so, I get a warning:

   root@thinkpad:/home/mpeterma # cd /sys/modules/acpi/acpi
   root@thinkpad:/sys/modules/acpi/acpi # make clean
   make: "/usr/src/sys/modules/acpi/acpi/Makefile" line 4: "The ACPI 
module is deprecated, set FORCE_BUILD to force it"
   root@thinkpad:/sys/modules/acpi/acpi #

Is this still the way to go, or doesn't the guide reflect the state of 
FreeBSD 10?
>Fix:


>Release-Note:
>Audit-Trail:

From: Matthias Petermann <matthias@petermann-it.de>
To: bug-followup@FreeBSD.org, matthias@petermann-it.de
Cc:  
Subject: Re: amd64/181358: Suspend to RAM not working correctly on Lenovo
 X121e (ACPI issue?)
Date: Sat, 24 Aug 2013 21:31:03 +0200

 Today I did one further test. Following the guide [1] I tried:
 
 $ sysctl debug.acpi.suspend_bounce=1
 $ acpiconf -s 3
 
 I ended up with a blank screen (LCD backlight was on).
 
 [1] https://wiki.freebsd.org/SuspendResume
 

From: Matthias Petermann <matthias@petermann-it.de>
To: freebsd-amd64@freebsd.org, current@freebsd.org, 
 freebsd-acpi@freebsd.org, bug-followup@FreeBSD.org
Cc:  
Subject: amd64/181358: Suspend to RAM not working correctly on Lenovo X121e
 (ACPI issue?)
Date: Sat, 24 Aug 2013 23:38:29 +0200

 This is a multi-part message in MIME format.
 --------------000902030606040504060809
 Content-Type: text/plain; charset=ISO-8859-1; format=flowed
 Content-Transfer-Encoding: 7bit
 
 Hello,
 
 regarding the issue mentioned in the subject (Lenovo Thinkpad X121e not 
 able to resume after suspend to ram) there is finally some progress. I 
 found this few months old discussion[1] on freebsd-acpi (related to 
 Thinkpad X201):
 
 "I had a similar problem. After syncing with FreeBSD 10-CURRENT and 
 compiling a kernel without
 VESA support, I was able to get graphics to work on resume, but only 
 when running X. "
 
 This works for the X121e too! It is now able to suspend and resume 
 properly when running Xorg (with i915kms.ko). I'm really happy :-)
 
 There is only a (very minor) problem: after the first resume Xorg 
 graphics seem to slow down. When moving windows on the screen they leave 
 some traces behind and it takes some milliseconds until they are wiped 
 away and replaced with the background image.
 
 Kind regards,
 Matthias
 
 
 [1]
 
 http://freebsd.1045724.n5.nabble.com/Resume-failed-after-Suspend-on-Thinkpad-x201i-td5723622.html
 
 --------------000902030606040504060809--
>Unformatted:
