From patchwork Fri Jun 19 12:52:09 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Corentin Chary X-Patchwork-Id: 31336 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 n5JCslIv015214 for ; Fri, 19 Jun 2009 12:54:52 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754594AbZFSMys (ORCPT ); Fri, 19 Jun 2009 08:54:48 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1753128AbZFSMys (ORCPT ); Fri, 19 Jun 2009 08:54:48 -0400 Received: from smtp21.orange.fr ([80.12.242.49]:23097 "EHLO smtp21.orange.fr" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754709AbZFSMyn (ORCPT ); Fri, 19 Jun 2009 08:54:43 -0400 Received: from me-wanadoo.net (localhost [127.0.0.1]) by mwinf2121.orange.fr (SMTP Server) with ESMTP id 54CEC1C000B5; Fri, 19 Jun 2009 14:54:45 +0200 (CEST) Received: from localhost.localdomain (ALyon-253-1-96-48.w86-206.abo.wanadoo.fr [86.206.191.48]) by mwinf2121.orange.fr (SMTP Server) with ESMTP id D2DA71C000AE; Fri, 19 Jun 2009 14:54:44 +0200 (CEST) X-ME-UUID: 20090619125444863.D2DA71C000AE@mwinf2121.orange.fr From: Corentin Chary To: lenb@kernel.org Cc: linux-acpi@vger.kernel.org, Corentin Chary Subject: [PATCH 7/9] eeepc-laptop: get the right value for CMSG Date: Fri, 19 Jun 2009 14:52:09 +0200 Message-Id: <1245415931-26466-7-git-send-email-corentincj@iksaif.net> X-Mailer: git-send-email 1.6.3.1 In-Reply-To: <1245415931-26466-6-git-send-email-corentincj@iksaif.net> References: <1245415931-26466-1-git-send-email-corentincj@iksaif.net> <1245415931-26466-2-git-send-email-corentincj@iksaif.net> <1245415931-26466-3-git-send-email-corentincj@iksaif.net> <1245415931-26466-4-git-send-email-corentincj@iksaif.net> <1245415931-26466-5-git-send-email-corentincj@iksaif.net> <1245415931-26466-6-git-send-email-corentincj@iksaif.net> Sender: linux-acpi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-acpi@vger.kernel.org CMSG is an ACPI method used to find features available on an Eee PC. But some features are never repported, even if present. If the getter of a feature is present, this patch will set the corresponding bit in cmsg. Signed-off-by: Corentin Chary --- drivers/platform/x86/eeepc-laptop.c | 23 +++++++++++++++++++++++ 1 files changed, 23 insertions(+), 0 deletions(-) diff --git a/drivers/platform/x86/eeepc-laptop.c b/drivers/platform/x86/eeepc-laptop.c index b1998f9..4d55c17 100644 --- a/drivers/platform/x86/eeepc-laptop.c +++ b/drivers/platform/x86/eeepc-laptop.c @@ -551,6 +551,28 @@ static int eeepc_setkeycode(struct input_dev *dev, int scancode, int keycode) return -EINVAL; } +static void cmsg_quirk(int cm, const char *name) +{ + int dummy; + + /* Some BIOSes do not report cm although it is avaliable. + Check if cm_getv[cm] works and, if yes, assume cm should be set. */ + if (!(ehotk->cm_supported & (1 << cm)) + && !read_acpi_int(ehotk->handle, cm_getv[cm], &dummy)) { + pr_info("%s (%x) not reported by BIOS," + " enabling anyway\n", name, 1 << cm); + ehotk->cm_supported |= 1 << cm; + } +} + +static void cmsg_quirks(void) +{ + cmsg_quirk(CM_ASL_LID, "LID"); + cmsg_quirk(CM_ASL_TYPE, "TYPE"); + cmsg_quirk(CM_ASL_PANELPOWER, "PANELPOWER"); + cmsg_quirk(CM_ASL_TPD, "TPD"); +} + static int eeepc_hotk_check(void) { const struct key_entry *key; @@ -574,6 +596,7 @@ static int eeepc_hotk_check(void) pr_err("Get control methods supported failed\n"); return -ENODEV; } else { + cmsg_quirks(); pr_info("Get control methods supported: 0x%x\n", ehotk->cm_supported); }