Re: acpi and sysctl

Previous thread: EkonomiTürk Haber Ajansı by EkonomiTürk Haber Ajansı on Sunday, December 19, 2010 - 7:04 am. (1 message)

Next thread: [jordan@cvs.openbsd.org: ACPI new fulltask diff] by Marco Peereboom on Sunday, December 19, 2010 - 9:14 am. (1 message)
From: Christopher Zimmermann
Date: Sunday, December 19, 2010 - 8:12 am

Hi,

I've finally found some time to work on the fan control support for my
thinkpad.
But I'm having problems calling to acpiec_write() from sysctl or
timeout_set(9) context. (Assertion failure in acpiec_gpehandler()).
According to dev/acpi/acpiec.c:229 this function is meant to be called
only from "acpi thread context".
Now how am I supposed to talk to the acpi controller?
One solution would be to use the aml_register_notify(..., ACPIDEV_POLL)
callback mechanism already in use by the acpithinkpad(4) driver to
somehow get into acpi thread context. The problem is that this callback
mechanism is hardcoded to 10s intervals. But I need intervals <1s to
implement a workaround described on
http://www.thinkwiki.org/wiki/How_to_control_fan_speed#Disengaged_.28full-speed.29_mode

any help is appreciated. I'm stuck here.

Christopher



this is what I've got so far:

Index: arch/i386/i386/machdep.c
===================================================================
RCS file: /cvs/src/sys/arch/i386/i386/machdep.c,v
retrieving revision 1.485
diff -u -p -r1.485 machdep.c
--- arch/i386/i386/machdep.c	2 Oct 2010 23:31:34 -0000	1.485
+++ arch/i386/i386/machdep.c	19 Dec 2010 15:11:09 -0000
@@ -243,6 +243,7 @@ void	via_update_sensor(void *args);
 #endif
 int kbd_reset;
 int lid_suspend;
+int fan_control;

 /*
  * safepri is a safe priority for sleep to set for a spin-wait
@@ -3416,6 +3417,8 @@ cpu_sysctl(int *name, u_int namelen, voi
 		return (sysctl_rdint(oldp, oldlenp, newp, i386_has_xcrypt));
 	case CPU_LIDSUSPEND:
 		return (sysctl_int(oldp, oldlenp, newp, newlen, &lid_suspend));
+	case CPU_FANCONTROL:
+		return (sysctl_int(oldp, oldlenp, newp, newlen, &fan_control));
 	default:
 		return (EOPNOTSUPP);
 	}
Index: arch/i386/include/cpu.h
===================================================================
RCS file: /cvs/src/sys/arch/i386/include/cpu.h,v
retrieving revision 1.117
diff -u -p -r1.117 cpu.h
--- arch/i386/include/cpu.h	2 Oct 2010 23:13:28 -0000	1.117
+++ ...
From: Marco Peereboom
Date: Sunday, December 19, 2010 - 9:12 am

You are not supposed to talk directly to the ec device.

Jordan has a diff floating around for acpi tasklets.  This really should
be the way to get this done.  I'll forward the diff to tech with the
caveat that it isn't finalized yet.

I would prefer for this fan stuff to be automatic instead of by hand

Previous thread: EkonomiTürk Haber Ajansı by EkonomiTürk Haber Ajansı on Sunday, December 19, 2010 - 7:04 am. (1 message)

Next thread: [jordan@cvs.openbsd.org: ACPI new fulltask diff] by Marco Peereboom on Sunday, December 19, 2010 - 9:14 am. (1 message)