Re: machine with a zzz problem with lidsuspend=1

2015-01-27 Thread Raf Czlonka
On Tue, Jan 27, 2015 at 01:00:18PM GMT, Raf Czlonka wrote:

 When I suspend it with 'machdep.lidsuspend=1' and then 'startx' (hadn't
 actually tried while in X), all I get is black screen. I can change the
 ttys just fine but every time I do Ctrl+Alt+5, the screen turns black.
 I have to exit 'cwm' (Ctrl+Alt+Shift+q), which then quits X and drops me
 to the tty I ran 'startx' on. After starting X and quitting 'cwm'
 several times, I eventually get to see X/cwm.

 From what I had observed, this doesn't happen after running 'zzz' with
 'machdep.lidsuspend=0' but I will double-check this evening (GMT).

OK, I have ran some more tests and this is what I have observed:

1. It doesn't matter whether 'machdep.lidsuspend' is set to 0 or 1 and
whether I use the lid or 'zzz' to suspend the laptop - as long as I run
'zzz' or close the lid while on tty (and X is *not* running) and then
run 'startx' I *always* get black screen.

2. When the system resumes it always displays the console/ttyC0 with USB
resume info - however, I cannot interact with console and the
key-presses are being passed to the tty I ran 'zzz'/suspended from.

3. I eventually get to see X/cwm after I do a bit of a dance - while
on ttyC3, 'startx', then Ctrl+Alt+F4 (back onto the tty I ran the
command but can be any other tty), back to X (still black) with
Ctrl+Alt+F5 and then quit 'cwm' (Ctrl+Alt+Shift+q), after I'm back on a
tty running 'startx' brings X/cwm just fine (i.e. the screen is not all
black any more.

For some reason, backlight/inverter, does not kick in while X starts
after suspend, unless I do the Ctrl+Alt+... dance described above.

Stuart, sorry to piggyback of your initial email - at first, I thought
it might be the same thing - now, I'm not so sure.

Given the description given here and the info (dmesg and acpidump) in my
initial email, shall I still post it to bugs@ again?

Cheers,

Raf



Re: machine with a zzz problem with lidsuspend=1

2015-01-27 Thread Mark Kettenis
 Date: Tue, 27 Jan 2015 20:40:03 +
 From: Raf Czlonka rczlo...@gmail.com
 
 On Tue, Jan 27, 2015 at 01:00:18PM GMT, Raf Czlonka wrote:
 
  When I suspend it with 'machdep.lidsuspend=1' and then 'startx' (hadn't
  actually tried while in X), all I get is black screen. I can change the
  ttys just fine but every time I do Ctrl+Alt+5, the screen turns black.
  I have to exit 'cwm' (Ctrl+Alt+Shift+q), which then quits X and drops me
  to the tty I ran 'startx' on. After starting X and quitting 'cwm'
  several times, I eventually get to see X/cwm.
 
  From what I had observed, this doesn't happen after running 'zzz' with
  'machdep.lidsuspend=0' but I will double-check this evening (GMT).
 
 OK, I have ran some more tests and this is what I have observed:
 
 1. It doesn't matter whether 'machdep.lidsuspend' is set to 0 or 1 and
 whether I use the lid or 'zzz' to suspend the laptop - as long as I run
 'zzz' or close the lid while on tty (and X is *not* running) and then
 run 'startx' I *always* get black screen.

Known problem.  Fixed with newer x86-video-intel driver.  But we
didn't manage to get a newer driver tested this release cycle.  The
fact that there hasn't been an official release of the driver doesn't
help.



Re: machine with a zzz problem with lidsuspend=1

2015-01-27 Thread Raf Czlonka
On Tue, Jan 27, 2015 at 10:08:51PM GMT, Mark Kettenis wrote:

 Known problem.  Fixed with newer x86-video-intel driver.  But we
 didn't manage to get a newer driver tested this release cycle.  The
 fact that there hasn't been an official release of the driver doesn't
 help.

Thanks for letting me know, Mark - I didn't realise it was old news.

Well, at the end of the day, annoying as it might be, it's not something
I can't live with... for now anyway.

Ta,

Raf

P.S. Once again Stuart, sorry for stealing the thread.



Re: machine with a zzz problem with lidsuspend=1

2015-01-26 Thread Mark Kettenis
 Date: Mon, 26 Jan 2015 21:17:33 +
 From: Stuart Henderson s...@spacehopper.org
 
 This machine (server-ish hw used as a desktop) used to suspend and
 resume nicely, but following the lidsuspend change no longer resumes
 (machine powers up, screen stays black).
 
 It works correctly if machdep.lidsuspend is set to 0.  I can run like
 that without a problem but it would be nicer to fix it, does anyone have
 ideas where to poke?
 
 Note: it has a LID0 device (unsure what it's connected to; there is a
 chassis intrusion switch but operating that doesn't change the state
 of acpibtn1.indicator0). It does not have a _LID method in the dsdt.

Really Stuart, you looked at the cpidump output, but didn't include it
in your report?



Re: machine with a zzz problem with lidsuspend=1

2015-01-26 Thread Stuart Henderson
On 2015/01/26 23:18, Mark Kettenis wrote:
  Date: Mon, 26 Jan 2015 21:17:33 +
  From: Stuart Henderson s...@spacehopper.org
  
  This machine (server-ish hw used as a desktop) used to suspend and
  resume nicely, but following the lidsuspend change no longer resumes
  (machine powers up, screen stays black).
  
  It works correctly if machdep.lidsuspend is set to 0.  I can run like
  that without a problem but it would be nicer to fix it, does anyone have
  ideas where to poke?
  
  Note: it has a LID0 device (unsure what it's connected to; there is a
  chassis intrusion switch but operating that doesn't change the state
  of acpibtn1.indicator0). It does not have a _LID method in the dsdt.
 
 Really Stuart, you looked at the cpidump output, but didn't include it
 in your report?

It's a bit long to in-line in a list mail. I've put the disassembled
versions and a tar of the acpidump output files at http://junkpile.org/t20/

e.g.

http://junkpile.org/t20/t20.DSDT.dsl
http://junkpile.org/t20/t20.tgz



Re: machine with a zzz problem with lidsuspend=1

2015-01-26 Thread Mike Larkin
On Tue, Jan 27, 2015 at 12:11:35AM +0100, Mark Kettenis wrote:
  Date: Mon, 26 Jan 2015 22:30:02 +
  From: Stuart Henderson s...@spacehopper.org
  
  On 2015/01/26 23:18, Mark Kettenis wrote:
Date: Mon, 26 Jan 2015 21:17:33 +
From: Stuart Henderson s...@spacehopper.org

This machine (server-ish hw used as a desktop) used to suspend and
resume nicely, but following the lidsuspend change no longer resumes
(machine powers up, screen stays black).

It works correctly if machdep.lidsuspend is set to 0.  I can run like
that without a problem but it would be nicer to fix it, does anyone have
ideas where to poke?

Note: it has a LID0 device (unsure what it's connected to; there is a
chassis intrusion switch but operating that doesn't change the state
of acpibtn1.indicator0). It does not have a _LID method in the dsdt.
 
 Can you try the diff below?

If this works, ok mlarkin@. It matches some other fixes that went in
previously.

-ml

 
 Index: acpibtn.c
 ===
 RCS file: /home/cvs/src/sys/dev/acpi/acpibtn.c,v
 retrieving revision 1.40
 diff -u -p -r1.40 acpibtn.c
 --- acpibtn.c 24 Nov 2014 03:54:06 -  1.40
 +++ acpibtn.c 26 Jan 2015 23:09:53 -
 @@ -55,7 +55,6 @@ struct acpibtn_softc {
  #define ACPIBTN_SLEEP3
  };
  
 -int  acpibtn_getsta(struct acpibtn_softc *);
  int  acpibtn_setpsw(struct acpibtn_softc *, int);
  
  struct acpi_lid {
 @@ -157,10 +156,19 @@ acpibtn_attach(struct device *parent, st
   struct acpi_attach_args *aa = aux;
   struct acpi_lid *lid;
   int64_t lid_open;
 + int64_t st;
  
   sc-sc_acpi = (struct acpi_softc *)parent;
   sc-sc_devnode = aa-aaa_node;
  
 + printf(: %s\n, sc-sc_devnode-name);
 +
 + if (aml_evalinteger(sc-sc_acpi, sc-sc_devnode, _STA, 0, NULL, st))
 + st = STA_PRESENT | STA_ENABLED | STA_DEV_OK;
 + if ((st  (STA_PRESENT | STA_ENABLED | STA_DEV_OK)) !=
 + (STA_PRESENT | STA_ENABLED | STA_DEV_OK))
 + return;
 +
   if (!strcmp(aa-aaa_dev, ACPI_DEV_LD)) {
   sc-sc_btn_type = ACPIBTN_LID;
  
 @@ -174,10 +182,6 @@ acpibtn_attach(struct device *parent, st
   else if (!strcmp(aa-aaa_dev, ACPI_DEV_SBD))
   sc-sc_btn_type = ACPIBTN_SLEEP;
  
 - acpibtn_getsta(sc);
 -
 - printf(: %s\n, sc-sc_devnode-name);
 -
   if (sc-sc_btn_type == ACPIBTN_LID) {
   strlcpy(sc-sc_sensdev.xname, DEVNAME(sc),
   sizeof(sc-sc_sensdev.xname));
 @@ -194,17 +198,6 @@ acpibtn_attach(struct device *parent, st
  
   aml_register_notify(sc-sc_devnode, aa-aaa_dev, acpibtn_notify,
   sc, ACPIDEV_NOPOLL);
 -}
 -
 -int
 -acpibtn_getsta(struct acpibtn_softc *sc)
 -{
 - if (aml_evalname(sc-sc_acpi, sc-sc_devnode, _STA, 0, NULL, NULL) != 
 0) {
 - dnprintf(20, %s: no _STA\n, DEVNAME(sc));
 - /* XXX not all buttons have _STA so FALLTROUGH */
 - }
 -
 - return (0);
  }
  
  int
 



Re: machine with a zzz problem with lidsuspend=1

2015-01-26 Thread Mark Kettenis
 Date: Mon, 26 Jan 2015 22:30:02 +
 From: Stuart Henderson s...@spacehopper.org
 
 On 2015/01/26 23:18, Mark Kettenis wrote:
   Date: Mon, 26 Jan 2015 21:17:33 +
   From: Stuart Henderson s...@spacehopper.org
   
   This machine (server-ish hw used as a desktop) used to suspend and
   resume nicely, but following the lidsuspend change no longer resumes
   (machine powers up, screen stays black).
   
   It works correctly if machdep.lidsuspend is set to 0.  I can run like
   that without a problem but it would be nicer to fix it, does anyone have
   ideas where to poke?
   
   Note: it has a LID0 device (unsure what it's connected to; there is a
   chassis intrusion switch but operating that doesn't change the state
   of acpibtn1.indicator0). It does not have a _LID method in the dsdt.

Can you try the diff below?

Index: acpibtn.c
===
RCS file: /home/cvs/src/sys/dev/acpi/acpibtn.c,v
retrieving revision 1.40
diff -u -p -r1.40 acpibtn.c
--- acpibtn.c   24 Nov 2014 03:54:06 -  1.40
+++ acpibtn.c   26 Jan 2015 23:09:53 -
@@ -55,7 +55,6 @@ struct acpibtn_softc {
 #define ACPIBTN_SLEEP  3
 };
 
-intacpibtn_getsta(struct acpibtn_softc *);
 intacpibtn_setpsw(struct acpibtn_softc *, int);
 
 struct acpi_lid {
@@ -157,10 +156,19 @@ acpibtn_attach(struct device *parent, st
struct acpi_attach_args *aa = aux;
struct acpi_lid *lid;
int64_t lid_open;
+   int64_t st;
 
sc-sc_acpi = (struct acpi_softc *)parent;
sc-sc_devnode = aa-aaa_node;
 
+   printf(: %s\n, sc-sc_devnode-name);
+
+   if (aml_evalinteger(sc-sc_acpi, sc-sc_devnode, _STA, 0, NULL, st))
+   st = STA_PRESENT | STA_ENABLED | STA_DEV_OK;
+   if ((st  (STA_PRESENT | STA_ENABLED | STA_DEV_OK)) !=
+   (STA_PRESENT | STA_ENABLED | STA_DEV_OK))
+   return;
+
if (!strcmp(aa-aaa_dev, ACPI_DEV_LD)) {
sc-sc_btn_type = ACPIBTN_LID;
 
@@ -174,10 +182,6 @@ acpibtn_attach(struct device *parent, st
else if (!strcmp(aa-aaa_dev, ACPI_DEV_SBD))
sc-sc_btn_type = ACPIBTN_SLEEP;
 
-   acpibtn_getsta(sc);
-
-   printf(: %s\n, sc-sc_devnode-name);
-
if (sc-sc_btn_type == ACPIBTN_LID) {
strlcpy(sc-sc_sensdev.xname, DEVNAME(sc),
sizeof(sc-sc_sensdev.xname));
@@ -194,17 +198,6 @@ acpibtn_attach(struct device *parent, st
 
aml_register_notify(sc-sc_devnode, aa-aaa_dev, acpibtn_notify,
sc, ACPIDEV_NOPOLL);
-}
-
-int
-acpibtn_getsta(struct acpibtn_softc *sc)
-{
-   if (aml_evalname(sc-sc_acpi, sc-sc_devnode, _STA, 0, NULL, NULL) != 
0) {
-   dnprintf(20, %s: no _STA\n, DEVNAME(sc));
-   /* XXX not all buttons have _STA so FALLTROUGH */
-   }
-
-   return (0);
 }
 
 int