Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 21 Feb 2020 09:52:21 +0000 (UTC)
From:      Hans Petter Selasky <hselasky@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r358219 - head/sys/dev/acpica
Message-ID:  <202002210952.01L9qLUb059562@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: hselasky
Date: Fri Feb 21 09:52:20 2020
New Revision: 358219
URL: https://svnweb.freebsd.org/changeset/base/358219

Log:
  Make sure the ACPI lid state is updated during boot and after resume.
  While at it update the sysctl(9) description for the lid state.
  
  Differential Revision:	https://reviews.freebsd.org/D23724
  PR:		240881
  Submitted by:	Yuri Pankov <yuripv@yuripv.me>
  MFC after:	1 week
  Sponsored by:	Mellanox Technologies

Modified:
  head/sys/dev/acpica/acpi_lid.c

Modified: head/sys/dev/acpica/acpi_lid.c
==============================================================================
--- head/sys/dev/acpica/acpi_lid.c	Fri Feb 21 09:29:56 2020	(r358218)
+++ head/sys/dev/acpica/acpi_lid.c	Fri Feb 21 09:52:20 2020	(r358219)
@@ -124,13 +124,16 @@ acpi_lid_attach(device_t dev)
     if (acpi_parse_prw(sc->lid_handle, &prw) == 0)
 	AcpiEnableGpe(prw.gpe_handle, prw.gpe_bit);
 
+    /* Get the initial lid status, ignore failures */
+    (void) acpi_GetInteger(sc->lid_handle, "_LID", &sc->lid_status);
+
     /*
      * Export the lid status
      */
     SYSCTL_ADD_INT(device_get_sysctl_ctx(dev),
 	SYSCTL_CHILDREN(device_get_sysctl_tree(dev)), OID_AUTO,
 	"state", CTLFLAG_RD, &sc->lid_status, 0,
-	"Device set to wake the system");
+	"Device state (0 = closed, 1 = open)");
 
     return (0);
 }
@@ -144,6 +147,13 @@ acpi_lid_suspend(device_t dev)
 static int
 acpi_lid_resume(device_t dev)
 {
+    struct acpi_lid_softc	*sc;
+
+    sc = device_get_softc(dev);
+
+    /* Get lid status after resume, ignore failures */
+    (void) acpi_GetInteger(sc->lid_handle, "_LID", &sc->lid_status);
+
     return (0);
 }
 



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202002210952.01L9qLUb059562>