From patchwork Thu Jun 25 11:25:41 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Corentin Chary X-Patchwork-Id: 32369 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 n5PBN81Y019557 for ; Thu, 25 Jun 2009 11:23:14 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752218AbZFYLXI (ORCPT ); Thu, 25 Jun 2009 07:23:08 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1752004AbZFYLXI (ORCPT ); Thu, 25 Jun 2009 07:23:08 -0400 Received: from iksaif.net ([88.191.73.63]:54906 "EHLO iksaif.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752218AbZFYLXD (ORCPT ); Thu, 25 Jun 2009 07:23:03 -0400 Received: from localhost.localdomain (localhost [127.0.0.1]) (Authenticated sender: corentincj@iksaif.net) by iksaif.net (Postfix) with ESMTPA id 2560DC9002F; Thu, 25 Jun 2009 13:25:45 +0200 (CEST) From: Corentin Chary To: lenb@kernel.org Cc: linux-acpi@vger.kernel.org, Corentin Chary Subject: [PATCH 6/7] eeepc-laptop: get the right value for CMSG Date: Thu, 25 Jun 2009 13:25:41 +0200 Message-Id: <1245929142-3354-6-git-send-email-corentincj@iksaif.net> X-Mailer: git-send-email 1.6.3.1 In-Reply-To: <1245929142-3354-5-git-send-email-corentincj@iksaif.net> References: <1245929142-3354-1-git-send-email-corentincj@iksaif.net> <1245929142-3354-2-git-send-email-corentincj@iksaif.net> <1245929142-3354-3-git-send-email-corentincj@iksaif.net> <1245929142-3354-4-git-send-email-corentincj@iksaif.net> <1245929142-3354-5-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 19cc9ae..f5d8473 100644 --- a/drivers/platform/x86/eeepc-laptop.c +++ b/drivers/platform/x86/eeepc-laptop.c @@ -553,6 +553,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; @@ -576,6 +598,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); }