@@ -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
@@ -31,6 +32,7 @@
* Josh Green - Light Sens support
* Thomas Tuttle - His first patch for led support was very helpfull
* Sam Lin - GPS support
+ * Andy Ross - Pegatron Lucid accelerometer
*/
#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
@@ -247,6 +249,7 @@ struct asus_laptop {
int wireless_status;
bool have_rsts;
int lcd_state;
+ struct platform_device *pega_accel;
struct rfkill *gps_rfkill;
@@ -1556,6 +1559,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)
@@ -1605,6 +1621,8 @@ static int __devinit asus_acpi_add(struct acpi_device *device)
if (result)
goto fail_rfkill;
+ asus_pega_accel_init(asus);
+
asus_device_present = true;
return 0;
@@ -1627,6 +1645,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);