Hi tech@,

Here is a diff to add the "machdep.lidsuspend" sysctl on Loongson.

This is another required step to activate suspend on lid close on the
Lemote Yeeloong.

Comments? OK?

Index: etc/etc.loongson/sysctl.conf
===================================================================
RCS file: /cvs/src/etc/etc.loongson/sysctl.conf,v
retrieving revision 1.2
diff -u -p -r1.2 sysctl.conf
--- etc/etc.loongson/sysctl.conf        24 Jun 2011 19:47:48 -0000      1.2
+++ etc/etc.loongson/sysctl.conf        14 Dec 2016 14:05:36 -0000
@@ -0,0 +1 @@
+#machdep.lidsuspend=0          # do not suspend laptop upon lid closing
Index: sys/arch/loongson/loongson/machdep.c
===================================================================
RCS file: /cvs/src/sys/arch/loongson/loongson/machdep.c,v
retrieving revision 1.69
diff -u -p -r1.69 machdep.c
--- sys/arch/loongson/loongson/machdep.c        11 Dec 2016 07:57:14 -0000      
1.69
+++ sys/arch/loongson/loongson/machdep.c        14 Dec 2016 14:06:28 -0000
@@ -116,6 +116,7 @@ int physmem;                /* Max supported memory, c
 int    ncpu = 1;               /* At least one CPU in the system. */
 int    nnodes = 1;             /* Number of NUMA nodes, only on 3A. */
 struct user *proc0paddr;
+int    lid_suspend = 1;
 
 const struct platform *sys_platform;
 struct cpu_hwinfo bootcpu_hwinfo;
@@ -1016,9 +1017,12 @@ cpu_sysctl(name, namelen, oldp, oldlenp,
                return ENOTDIR;         /* Overloaded */
 
        switch (name[0]) {
+       case CPU_LIDSUSPEND:
+               return (sysctl_int(oldp, oldlenp, newp, newlen, &lid_suspend));
        default:
-               return EOPNOTSUPP;
+               return (EOPNOTSUPP);
        }
+       /* NOTREACHED */
 }
 
 int    waittime = -1;
Index: sys/arch/mips64/include/cpu.h
===================================================================
RCS file: /cvs/src/sys/arch/mips64/include/cpu.h,v
retrieving revision 1.111
diff -u -p -r1.111 cpu.h
--- sys/arch/mips64/include/cpu.h       14 Aug 2016 08:23:52 -0000      1.111
+++ sys/arch/mips64/include/cpu.h       14 Dec 2016 14:06:28 -0000
@@ -361,12 +361,14 @@ void      cp0_calibrate(struct cpu_info *);
  */
 #define        CPU_ALLOWAPERTURE       1       /* allow mmap of /dev/xf86 */
                /*              2          formerly: keyboard reset */
-#define        CPU_MAXID               3       /* number of valid machdep ids 
*/
+#define        CPU_LIDSUSPEND          3       /* lid close causes a suspend */
+#define        CPU_MAXID               4       /* number of valid machdep ids 
*/
 
 #define        CTL_MACHDEP_NAMES {                     \
        { 0, 0 },                               \
        { "allowaperture", CTLTYPE_INT },       \
        { 0, 0 },                               \
+       { "lidsuspend", CTLTYPE_INT },          \
 }
 
 /*

Reply via email to