From patchwork Sun Mar 15 15:01:23 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Francesco Lattanzio X-Patchwork-Id: 12185 Received: from vger.kernel.org (vger.kernel.org [209.132.176.167]) by demeter.kernel.org (8.14.2/8.14.2) with ESMTP id n2FEx2qo016175 for ; Sun, 15 Mar 2009 14:59:02 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752721AbZCOO7C (ORCPT ); Sun, 15 Mar 2009 10:59:02 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1752799AbZCOO7C (ORCPT ); Sun, 15 Mar 2009 10:59:02 -0400 Received: from ey-out-2122.google.com ([74.125.78.24]:38088 "EHLO ey-out-2122.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752721AbZCOO67 (ORCPT ); Sun, 15 Mar 2009 10:58:59 -0400 Received: by ey-out-2122.google.com with SMTP id 25so826373eya.37 for ; Sun, 15 Mar 2009 07:58:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from :user-agent:mime-version:to:subject:content-type; bh=D93vvT23+fQh+UUsRs9nuPKhhdnzS67Nh2uUwcbZwlU=; b=wyruXk0aMqm5SnkvH+8F6wiAilW6NnjzZiElOqV3aicrRJ3eQs3pst4Mf01QDdCRPC 59F/yAVIK0gOVtSQQFiirAdXRGckxel2NBBzc6sCuT91W1vymcVMbBfMMoPb0tEDHsXp X+R6k/zKRTgLlE/3BoYdJ98rBgZdBVN0P3h60= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:user-agent:mime-version:to:subject :content-type; b=hmrWqfCH8Eh8B8ySLP3mpJ/a1QxPH6sUynaUTVQrKsRlVloCHFq0nzjlpS72CxXRrY WIV3LASXyls1bVGJP4CnjpHZ012rtM5Pv8+Edcsnp+CCaHvmNUhmKNHLM6EV/drBuY5k fm34qPaOUsFNhVY78+pjG17w3vfTCeajL5WIg= Received: by 10.216.45.207 with SMTP id p57mr1463247web.94.1237129135929; Sun, 15 Mar 2009 07:58:55 -0700 (PDT) Received: from ?10.0.0.2? (host117-103-dynamic.43-79-r.retail.telecomitalia.it [79.43.103.117]) by mx.google.com with ESMTPS id c4sm7691873nfi.20.2009.03.15.07.58.53 (version=TLSv1/SSLv3 cipher=RC4-MD5); Sun, 15 Mar 2009 07:58:55 -0700 (PDT) Message-ID: <49BD1843.7050502@gmail.com> Date: Sun, 15 Mar 2009 16:01:23 +0100 From: Francesco Lattanzio User-Agent: Thunderbird 2.0.0.19 (X11/20090213) MIME-Version: 1.0 To: Linux ACPI Subject: FSB scaling for ASUS EeePC 1000H Sender: linux-acpi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-acpi@vger.kernel.org The following patch (against the current "linux-acpi-2.6" source tree) adds the capability of the ASUS EeePC 1000H (and maybe other models as well) to scale the FSB frequency and core voltage. Do not confuse this with cpufreq (SpeedStep and other similar mechanisms): cpufreq changes the internal CPU clock multiplier (and eventually the core voltage too) leaving the FSB frequency untouched. A new file, "cpuclk_cfg", is added under "/sys/devices/platform/eeepc" through which is possible to select one of the available predefined CPU clock configuration (FSB frequency and core voltage). Reading from cpuclk_cfg returns two numbers: the first is the number of available "CPU clock configurations", the second is a non-negative number less than the first representing the current configuration. If the function is not supported (through ACPI) the string "" is returned instead. Writing a number to cpuclk_cfg allows to change the current CPU clock configuration. On the Eee PC 1000H there are three available clock configuration: 0 -> Super Performance Mode 1 -> High Performance Mode 2 -> Power Saving Mode The selected configuration is saved into the NVRAM and restored after a reboot. This fact allowed me to use use /proc/cpuinfo to measure the CPU clock (while keeping SpeedStep disabled, i.e. at its maximum multiplier value): 0 -> cpu MHz: 1709.760 / bogomips: 3420.00 1 -> cpu MHz: 1595.736 / bogomips: 3192.45 2 -> cpu MHz: 1254.026 / bogomips: 2509.55 The attached file is a dump of the DSDT taken from my EeePC 1000H I used as a reference to write the patch. Here is the patch: diff --git a/drivers/platform/x86/eeepc-laptop.c b/drivers/platform/x86/eeepc-laptop.c index 786ed86..d079d51 100644 --- a/drivers/platform/x86/eeepc-laptop.c +++ b/drivers/platform/x86/eeepc-laptop.c @@ -382,10 +382,40 @@ EEEPC_CREATE_DEVICE_ATTR(camera, CM_ASL_CAMERA); EEEPC_CREATE_DEVICE_ATTR(cardr, CM_ASL_CARDREADER); EEEPC_CREATE_DEVICE_ATTR(disp, CM_ASL_DISPLAYSWITCH); + +static ssize_t show_ckfg(struct device *dev, + struct device_attribute *attr, + char *buf) +{ + int n_of_cfgs,current_cfg; + current_cfg=get_acpi(CM_ASL_CPUFV); + if (current_cfg<0) + return sprintf(buf, "%s\n", ""); + n_of_cfgs=(current_cfg>>8)&0xff; + current_cfg&=0xff; + return sprintf(buf, "%d %d\n", n_of_cfgs, current_cfg); +} + +static ssize_t store_ckfg(struct device *dev, + struct device_attribute *attr, + const char *buf, size_t count) +{ + return store_sys_acpi(CM_ASL_CPUFV, buf, count); +} + +static struct device_attribute dev_attr_ckfg = { + .attr = { + .name = "cpuclk_cfg", + .mode = 0644 }, + .show = show_ckfg, + .store = store_ckfg +}; + static struct attribute *platform_attributes[] = { &dev_attr_camera.attr, &dev_attr_cardr.attr, &dev_attr_disp.attr, + &dev_attr_ckfg.attr, NULL };