linux-input.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Andy Ross <andy.ross-CWA4WttNNZF54TAoqtyWWQ@public.gmane.org>
To: Dmitry Torokhov
	<dmitry.torokhov-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>,
	Corentin Chary
	<corentincj-EjuBZuxMvz2sTnJN9+BGXg@public.gmane.org>,
	linux-input-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	acpi4asus-user-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org,
	platform-driver-x86-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Subject: [PATCH 1/4] asus-laptop: Device detection for Pegatron Lucid tablets
Date: Mon, 24 Jan 2011 14:48:05 -0800	[thread overview]
Message-ID: <1295909288-32650-2-git-send-email-andy.ross@windriver.com> (raw)
In-Reply-To: <1295909288-32650-1-git-send-email-andy.ross-CWA4WttNNZF54TAoqtyWWQ@public.gmane.org>

Recognize the Pegatron Lucid tablet devices (which share the same
"\_SB.ATKD" namespace) by the result of their INIT method and the
presence of some specific methods.

Signed-off-by: Andy Ross <andy.ross-CWA4WttNNZF54TAoqtyWWQ@public.gmane.org>
---
 drivers/platform/x86/asus-laptop.c |   25 ++++++++++++++++++++++++-
 1 files changed, 24 insertions(+), 1 deletions(-)

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;
 
-- 
1.7.1


------------------------------------------------------------------------------
Special Offer-- Download ArcSight Logger for FREE (a $49 USD value)!
Finally, a world-class log management solution at an even better price-free!
Download using promo code Free_Logger_4_Dev2Dev. Offer expires 
February 28th, so secure your free ArcSight Logger TODAY! 
http://p.sf.net/sfu/arcsight-sfd2d

  parent reply	other threads:[~2011-01-24 22:48 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-01-24 22:48 [PATCH 0/4] Pegatron Lucid tablet acceleromter/ALS Andy Ross
     [not found] ` <1295909288-32650-1-git-send-email-andy.ross-CWA4WttNNZF54TAoqtyWWQ@public.gmane.org>
2011-01-24 22:48   ` Andy Ross [this message]
2011-01-24 23:05   ` Dmitry Torokhov
2011-01-25  7:30     ` Corentin Chary
2011-01-25 16:43       ` Andy Ross
2011-01-25 17:05         ` Corentin Chary
     [not found]           ` <AANLkTi=tQpQ0wjfx-Cp13FuCSQNFitN7XAg-V2AcSHz2-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2011-01-25 17:09             ` Andy Ross
     [not found]               ` <4D3F03B0.7030607-CWA4WttNNZF54TAoqtyWWQ@public.gmane.org>
2011-01-25 17:10                 ` Corentin Chary
2011-01-25 17:12           ` Dmitry Torokhov
2011-01-24 22:48 ` [PATCH 2/4] asus-laptop: Pegatron Lucid ALS support Andy Ross
2011-01-24 22:48 ` [PATCH 3/4] asus-laptop: Support pega_accel accelerometer driver Andy Ross
2011-01-24 22:48 ` [PATCH 4/4] input: Pegatron Lucid accelerometer Andy Ross

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1295909288-32650-2-git-send-email-andy.ross@windriver.com \
    --to=andy.ross-cwa4wttnnzf54taoqtywwq@public.gmane.org \
    --cc=acpi4asus-user-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org \
    --cc=corentincj-EjuBZuxMvz2sTnJN9+BGXg@public.gmane.org \
    --cc=dmitry.torokhov-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
    --cc=linux-input-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=platform-driver-x86-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).