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 <yur...@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);
 }
 
_______________________________________________
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to