From patchwork Mon Feb 2 00:31:38 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonathan Woithe X-Patchwork-Id: 5030 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 n120WGFK006332 for ; Mon, 2 Feb 2009 00:32:16 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752478AbZBBAcP (ORCPT ); Sun, 1 Feb 2009 19:32:15 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1752709AbZBBAcO (ORCPT ); Sun, 1 Feb 2009 19:32:14 -0500 Received: from adelphi.physics.adelaide.edu.au ([129.127.102.1]:46373 "EHLO adelphi.physics.adelaide.edu.au" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751667AbZBBAcM (ORCPT ); Sun, 1 Feb 2009 19:32:12 -0500 Received: from turbo.physics.adelaide.edu.au (IDENT:0@turbo [129.127.102.108]) by adelphi.physics.adelaide.edu.au (8.13.7/8.13.7/UofA-Physics-1.0) with ESMTP id n120VeJG025296; Mon, 2 Feb 2009 11:01:40 +1030 Received: from turbo.physics.adelaide.edu.au (IDENT:7157@localhost [127.0.0.1]) by turbo.physics.adelaide.edu.au (8.13.4/8.13.4) with ESMTP id n120VevU032222; Mon, 2 Feb 2009 11:01:40 +1030 Received: (from jwoithe@localhost) by turbo.physics.adelaide.edu.au (8.13.4/8.13.4/Submit) id n120Vceb032221; Mon, 2 Feb 2009 11:01:38 +1030 From: Jonathan Woithe Message-Id: <200902020031.n120Vceb032221@turbo.physics.adelaide.edu.au> Subject: Re: [PATCH RFT] fujitsu-laptop: Use RFKILL support bitmask from firmware To: tony@linx.net (Tony Vroon) Date: Mon, 2 Feb 2009 11:01:38 +1030 (CST) Cc: jwoithe@physics.adelaide.edu.au (Jonathan Woithe), stepheng+linux@gildea.com (Stephen Gildea), nokos@gmx.net (Peter Gruber), jules@panic.cs-bristol.org.uk (Julian Brown), linux-acpi@vger.kernel.org In-Reply-To: <20090118015303.DF36D10077@gold.linx.net> from "Tony Vroon" at Jan 18, 2009 01:53:03 AM X-Mailer: ELM [version 2.5 PL6] MIME-Version: 1.0 Sender: linux-acpi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-acpi@vger.kernel.org Hi Tony > Jonathan, your platform is of particular importance as you are the only > tester on a platform with no S000 function in the DSDT. Please confirm you > still get a unknown status in the platform files. With debugging on full, > you should see the 0x1000 0x4 0x0 0x0 call disappear from your trace > entirely. I can confirm that this patch does not break the S7020 - I still get "unknown" in the status platform files, as expected. Acked-by: Jonathan Woithe Patch reproduced below for convenience. Regards jonathan Up until now, we polled the rfkill status for every incoming FUJ02E3 ACPI event. It turns out that the firmware has a bitmask which indicates what rfkill-related state it can report. The rfkill_supported bitmask is now used to avoid polling for rfkill at all in the notification handler if there is no support. Also, it is used in the platform device callbacks. As before we register all callbacks and report "unknown" if the firmware does not give us status updates for that particular bit. This was fed through checkpatch.pl and tested on the S6420 platform. Jonathan, your platform is of particular importance as you are the only tester on a platform with no S000 function in the DSDT. Please confirm you still get a unknown status in the platform files. With debugging on full, you should see the 0x1000 0x4 0x0 0x0 call disappear from your trace entirely. Signed-off-by: Tony Vroon Acked-by: Jonathan Woithe --- To unsubscribe from this list: send the line "unsubscribe linux-acpi" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html --- linux-2.6/drivers/platform/x86/fujitsu-laptop.c.orig 2009-01-18 01:05:55.000000000 +0000 +++ linux-2.6/drivers/platform/x86/fujitsu-laptop.c 2009-01-18 01:21:27.000000000 +0000 @@ -166,6 +166,7 @@ struct platform_device *pf_device; struct kfifo *fifo; spinlock_t fifo_lock; + int rfkill_supported; int rfkill_state; int logolamp_registered; int kblamps_registered; @@ -526,7 +527,7 @@ show_lid_state(struct device *dev, struct device_attribute *attr, char *buf) { - if (fujitsu_hotkey->rfkill_state == UNSUPPORTED_CMD) + if (!(fujitsu_hotkey->rfkill_supported & 0x100)) return sprintf(buf, "unknown\n"); if (fujitsu_hotkey->rfkill_state & 0x100) return sprintf(buf, "open\n"); @@ -538,7 +539,7 @@ show_dock_state(struct device *dev, struct device_attribute *attr, char *buf) { - if (fujitsu_hotkey->rfkill_state == UNSUPPORTED_CMD) + if (!(fujitsu_hotkey->rfkill_supported & 0x200)) return sprintf(buf, "unknown\n"); if (fujitsu_hotkey->rfkill_state & 0x200) return sprintf(buf, "docked\n"); @@ -550,7 +551,7 @@ show_radios_state(struct device *dev, struct device_attribute *attr, char *buf) { - if (fujitsu_hotkey->rfkill_state == UNSUPPORTED_CMD) + if (!(fujitsu_hotkey->rfkill_supported & 0x20)) return sprintf(buf, "unknown\n"); if (fujitsu_hotkey->rfkill_state & 0x20) return sprintf(buf, "on\n"); @@ -928,8 +929,17 @@ ; /* No action, result is discarded */ vdbg_printk(FUJLAPTOP_DBG_INFO, "Discarded %i ringbuffer entries\n", i); - fujitsu_hotkey->rfkill_state = - call_fext_func(FUNC_RFKILL, 0x4, 0x0, 0x0); + fujitsu_hotkey->rfkill_supported = + call_fext_func(FUNC_RFKILL, 0x0, 0x0, 0x0); + + /* Make sure our bitmask of supported functions is cleared if the + RFKILL function block is not implemented, like on the S7020. */ + if (fujitsu_hotkey->rfkill_supported == UNSUPPORTED_CMD) + fujitsu_hotkey->rfkill_supported = 0; + + if (fujitsu_hotkey->rfkill_supported) + fujitsu_hotkey->rfkill_state = + call_fext_func(FUNC_RFKILL, 0x4, 0x0, 0x0); /* Suspect this is a keymap of the application panel, print it */ printk(KERN_INFO "fujitsu-laptop: BTNI: [0x%x]\n", @@ -1005,8 +1015,9 @@ input = fujitsu_hotkey->input; - fujitsu_hotkey->rfkill_state = - call_fext_func(FUNC_RFKILL, 0x4, 0x0, 0x0); + if (fujitsu_hotkey->rfkill_supported) + fujitsu_hotkey->rfkill_state = + call_fext_func(FUNC_RFKILL, 0x4, 0x0, 0x0); switch (event) { case ACPI_FUJITSU_NOTIFY_CODE1: