From patchwork Mon Jan 24 22:48:07 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Ross X-Patchwork-Id: 503151 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 p0OMmo7Y029862 for ; Mon, 24 Jan 2011 22:48:53 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752615Ab1AXWsv (ORCPT ); Mon, 24 Jan 2011 17:48:51 -0500 Received: from li44-10.members.linode.com ([72.14.181.10]:52656 "EHLO plausible.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752714Ab1AXWsu (ORCPT ); Mon, 24 Jan 2011 17:48:50 -0500 Received: from localhost.localdomain (unknown [192.102.209.1]) (Authenticated sender: andy-wrs) by plausible.org (Postfix) with ESMTPSA id CF4D111944F; Mon, 24 Jan 2011 14:48:48 -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 3/4] asus-laptop: Support pega_accel accelerometer driver Date: Mon, 24 Jan 2011 14:48:07 -0800 Message-Id: <1295909288-32650-4-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 b397a4c..75c84f8 100644 --- a/drivers/platform/x86/asus-laptop.c +++ b/drivers/platform/x86/asus-laptop.c @@ -261,6 +261,7 @@ struct asus_laptop { bool have_rsts; bool have_pega_lucid; int lcd_state; + struct platform_device *pega_accel; struct rfkill *gps_rfkill; @@ -1631,6 +1632,19 @@ static int __devinit asus_acpi_init(struct asus_laptop *asus) return result; } +static void __devinit asus_pega_accel_init(struct asus_laptop *asus) +{ + /* Pegatron Lucid tablets expose their accelerometer through ACPI. + * Check for XLR{X,Y,Z} methods */ + if (acpi_check_handle(asus->handle, "XLRX", NULL) || + acpi_check_handle(asus->handle, "XLRY", NULL) || + acpi_check_handle(asus->handle, "XLRZ", NULL)) + return; + + asus->pega_accel = platform_device_register_simple("pega_accel", -1, + NULL, 0); +} + static bool asus_device_present; static int __devinit asus_acpi_add(struct acpi_device *device) @@ -1681,6 +1695,8 @@ static int __devinit asus_acpi_add(struct acpi_device *device) goto fail_rfkill; asus->have_pega_lucid = asus_check_pega_lucid(asus); + if (asus->have_pega_lucid) + asus_pega_accel_init(asus); asus_device_present = true; return 0; @@ -1704,6 +1720,9 @@ static int asus_acpi_remove(struct acpi_device *device, int type) { struct asus_laptop *asus = acpi_driver_data(device); + if (asus->pega_accel) + platform_device_unregister(asus->pega_accel); + asus_backlight_exit(asus); asus_rfkill_exit(asus); asus_led_exit(asus);