From owner-freebsd-acpi@FreeBSD.ORG Sun Mar 2 13:26:06 2008 Return-Path: Delivered-To: freebsd-acpi@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A3F051065677 for ; Sun, 2 Mar 2008 13:26:06 +0000 (UTC) (envelope-from avg@icyb.net.ua) Received: from falcon.cybervisiontech.com (falcon.cybervisiontech.com [217.20.163.9]) by mx1.freebsd.org (Postfix) with ESMTP id 22C7A8FC15 for ; Sun, 2 Mar 2008 13:26:05 +0000 (UTC) (envelope-from avg@icyb.net.ua) Received: from localhost (localhost [127.0.0.1]) by falcon.cybervisiontech.com (Postfix) with ESMTP id 5DAE674400D for ; Sun, 2 Mar 2008 15:26:03 +0200 (EET) X-Virus-Scanned: Debian amavisd-new at falcon.cybervisiontech.com Received: from falcon.cybervisiontech.com ([127.0.0.1]) by localhost (falcon.cybervisiontech.com [127.0.0.1]) (amavisd-new, port 10027) with ESMTP id LFFc0cTIWu3L for ; Sun, 2 Mar 2008 15:26:03 +0200 (EET) Received: from [91.193.172.111] (unknown [91.193.172.111]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by falcon.cybervisiontech.com (Postfix) with ESMTP id 8F777744002 for ; Sun, 2 Mar 2008 15:26:02 +0200 (EET) Message-ID: <47CAAADC.9080500@icyb.net.ua> Date: Sun, 02 Mar 2008 15:25:48 +0200 From: Andriy Gapon User-Agent: Thunderbird 2.0.0.9 (X11/20071208) MIME-Version: 1.0 To: freebsd-acpi@freebsd.org Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Subject: playing with _TZ X-BeenThere: freebsd-acpi@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: ACPI and power management development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 02 Mar 2008 13:26:06 -0000 I did what is described here a few years ago. My primary drive was to reduce noise level from a CPU fan when a machine was idle. This idea came to my mind when I was reading W83783S specification and noticed that the chip supports PWM control of fan speed. Also, while reading ACPI specification I came to understand that there are different approaches to active cooling. ACPI framework is built on a model where there are several fans and more of them get activated as more cooling is needed. But it is certainly possible to emulate those ACPI fans by setting different speed levels of a single fan. E.g. see section 10.6 of ACPI 2.0 specification. So this is what I decided to implement. In addition I decided to implement hysteresis as described in section 12.1.2.3 of the same specification. Also, I added a "RO" thermal zone to report chipset temperature. Finally I fixed all iasl compiler warning, dropped some unused code and added some comments. Of great help in this process were: 1. ACPI specification, for understanding Thermal Zone and ASL language (it is quite simple assembler-like one, but you still need a reference to understand some methods, be sure of operand order, etc. 2. mbmon code to see how it reads certain measurements via SMB, specifically for the HWM chip that I have 3. HWM chip W83783S specification, to understand details of what it can do and how 4. PIIX4 specification, to understand SMB controller operation Also, through experiments I determined some details about how W83783S was wired on my motherboard. For example, the chip has the following pins related to fan control: 1. FAN1-IN 2. FAN2-IN 3. FAN3-IN / PWM1-OUT 4. PWM2-OUT / SCI So some pins can be wired and configured for different functions. My motherboard (MP2-BX-X) has 3 fan connectors, one specifically designated for CPU fan. Turned out that FAN1-IN and PWM1-OUT are used to measure and regulate speed of the CPU fan. FAN2-IN reads speed of the first chassis fan. PWM2-OUT / SCI is configured to generate SMI. So the for third fan we can not neither nor control speed. I had to play quite a lot to determine the above. Also through the experiments I established a relation between PWM register value (0-0xff) and actual fan RPM speed (mbmon was of great help, as well as a small utility too read/write arbitrary registers of W83783S via SMB). Various temperature levels were also chosen through experiments and guessing. Here are the links to to the original and hacked DSDT ASLs: http://www.icyb.net.ua/~avg/bx.asl.gz http://www.icyb.net.ua/~avg/bx.orig.asl.gz Side-by-side diff would most probably be the most informative. Here's an example of hw.acpi.thermal: hw.acpi.thermal.min_runtime: 0 hw.acpi.thermal.polling_rate: 10 hw.acpi.thermal.user_override: 0 hw.acpi.thermal.tz0.temperature: 40.5C hw.acpi.thermal.tz0.active: 2 hw.acpi.thermal.tz0.passive_cooling: 1 hw.acpi.thermal.tz0.thermal_flags: 0 hw.acpi.thermal.tz0._PSV: 65.0C hw.acpi.thermal.tz0._HOT: -1 hw.acpi.thermal.tz0._CRT: 70.0C hw.acpi.thermal.tz0._ACx: 60.0C 53.0C 38.0C -1 -1 -1 -1 -1 -1 -1 hw.acpi.thermal.tz1.temperature: 32.0C hw.acpi.thermal.tz1.active: -1 hw.acpi.thermal.tz1.passive_cooling: 0 hw.acpi.thermal.tz1.thermal_flags: 0 hw.acpi.thermal.tz1._PSV: -1 hw.acpi.thermal.tz1._HOT: -1 hw.acpi.thermal.tz1._CRT: 52.0C hw.acpi.thermal.tz1._ACx: -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 BIG WARNING: should you ever decide to try to implement something like what I did on your system, you must understand that you can damage or destroy your hardware, or even come to personal harm. You must be very careful. You must be able to physically observe/monitor your hardware and you must be able interrupt your tests/experiments very quickly. You must know your hardware very well, you must know ACPI Thermal specification very well. You should not try any experiments if your hardware can not withstand some overheating for some time. I take no responsibility for any damage to your hardware or any personal harm that may result for your trying to follow my example. -- Andriy Gapon