From patchwork Mon Jan 24 22:48:05 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Ross X-Patchwork-Id: 503131 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter1.kernel.org (8.14.4/8.14.3) with ESMTP id p0OMmo7W029862 for ; Mon, 24 Jan 2011 22:48:53 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752666Ab1AXWst (ORCPT ); Mon, 24 Jan 2011 17:48:49 -0500 Received: from li44-10.members.linode.com ([72.14.181.10]:52646 "EHLO plausible.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752566Ab1AXWss (ORCPT ); Mon, 24 Jan 2011 17:48:48 -0500 Received: from localhost.localdomain (unknown [192.102.209.1]) (Authenticated sender: andy-wrs) by plausible.org (Postfix) with ESMTPSA id 5DFE611942C; Mon, 24 Jan 2011 14:48:46 -0800 (PST) From: Andy Ross To: Dmitry Torokhov , Corentin Chary , linux-input@vger.kernel.org, acpi4asus-user@lists.sourceforge.net, platform-driver-x86@vger.kernel.org Subject: [PATCH 1/4] asus-laptop: Device detection for Pegatron Lucid tablets Date: Mon, 24 Jan 2011 14:48:05 -0800 Message-Id: <1295909288-32650-2-git-send-email-andy.ross@windriver.com> X-Mailer: git-send-email 1.7.1 In-Reply-To: <1295909288-32650-1-git-send-email-andy.ross@windriver.com> References: <1295909288-32650-1-git-send-email-andy.ross@windriver.com> Sender: linux-input-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.6 (demeter1.kernel.org [140.211.167.41]); Mon, 24 Jan 2011 22:48:53 +0000 (UTC) diff --git a/drivers/platform/x86/asus-laptop.c b/drivers/platform/x86/asus-laptop.c index d235f44..6f542af 100644 --- a/drivers/platform/x86/asus-laptop.c +++ b/drivers/platform/x86/asus-laptop.c @@ -4,6 +4,7 @@ * * Copyright (C) 2002-2005 Julien Lerouge, 2003-2006 Karol Kozimor * Copyright (C) 2006-2007 Corentin Chary + * Copyright (C) 2011 Wind River Systems * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -210,6 +211,18 @@ static char *display_get_paths[] = { #define METHOD_KBD_LIGHT_SET "SLKB" #define METHOD_KBD_LIGHT_GET "GLKB" +/* For Pegatron Lucid tablet */ +#define DEVICE_NAME_PEGA "Lucid" + +#define METHOD_PEGA_ENABLE "ENPR" +#define METHOD_PEGA_DISABLE "DAPR" +#define PEGA_ALS 0x04 +#define PEGA_ALS_POWER 0x05 + +#define METHOD_PEGA_READ "RDLN" +#define PEGA_READ_ALS_H 0x02 +#define PEGA_READ_ALS_L 0x03 + /* * Define a specific led structure to keep the main structure clean */ @@ -246,6 +259,7 @@ struct asus_laptop { int wireless_status; bool have_rsts; + bool have_pega_lucid; int lcd_state; struct rfkill *gps_rfkill; @@ -361,6 +375,14 @@ static int acpi_check_handle(acpi_handle handle, const char *method, return 0; } +static bool asus_check_pega_lucid(struct asus_laptop *asus) +{ + return !strcmp(asus->name, DEVICE_NAME_PEGA) && + !acpi_check_handle(asus->handle, METHOD_PEGA_ENABLE, NULL) && + !acpi_check_handle(asus->handle, METHOD_PEGA_DISABLE, NULL) && + !acpi_check_handle(asus->handle, METHOD_PEGA_READ, NULL); +} + /* Generic LED function */ static int asus_led_set(struct asus_laptop *asus, const char *method, int value) @@ -1334,7 +1356,6 @@ static mode_t asus_sysfs_is_visible(struct kobject *kobj, attr == &dev_attr_ls_level.attr) { supported = !acpi_check_handle(handle, METHOD_ALS_CONTROL, NULL) && !acpi_check_handle(handle, METHOD_ALS_LEVEL, NULL); - } else if (attr == &dev_attr_gps.attr) { supported = !acpi_check_handle(handle, METHOD_GPS_ON, NULL) && !acpi_check_handle(handle, METHOD_GPS_OFF, NULL) && @@ -1605,6 +1626,8 @@ static int __devinit asus_acpi_add(struct acpi_device *device) if (result) goto fail_rfkill; + asus->have_pega_lucid = asus_check_pega_lucid(asus); + asus_device_present = true; return 0;