X86 platform drivers
 help / color / mirror / Atom feed
From: Marek Vasut <marex@denx.de>
To: joeyli <jlee@suse.com>
Cc: platform-driver-x86@vger.kernel.org, corentincj@iksaif.net,
	trenn@suse.de, dtor@mail.ru, jbenc@suse.cz,
	carlos@strangeworlds.co.uk, mjg@redhat.com
Subject: Re: [PATCH] ACER: Add support for accelerometer sensor
Date: Mon, 28 May 2012 08:19:17 +0200	[thread overview]
Message-ID: <201205280819.17686.marex@denx.de> (raw)
In-Reply-To: <1338185402.9751.4113.camel@linux-s257.site>

Dear joeyli,

> Hi Marek,
> 
> 於 一,2012-05-28 於 01:44 +0200,Marek Vasut 提到:
> 
> > This device is present on Iconia Tab W500.
> > 
> > Signed-off-by: Marek Vasut <marex@denx.de>
> > Cc: joeyli <jlee@suse.com>
> > ---
> > 
> >  drivers/platform/x86/acer-wmi.c |  110
> >  +++++++++++++++++++++++++++++++++++++++ 1 file changed, 110
> >  insertions(+)
> > 
> > diff --git a/drivers/platform/x86/acer-wmi.c
> > b/drivers/platform/x86/acer-wmi.c index c1a3fd8..2df0673 100644
> > --- a/drivers/platform/x86/acer-wmi.c
> > +++ b/drivers/platform/x86/acer-wmi.c
> > @@ -95,6 +95,7 @@
> > MODULE_ALIAS("wmi:676AA15E-6A47-4D9F-A2CC-1E6D18D14026");
> > 
> >  enum acer_wmi_event_ids {
> >  
> >  	WMID_HOTKEY_EVENT = 0x1,
> > 
> > +	WMID_ACCEL_EVENT = 0x5,
> > 
> >  };
> >  
> >  static const struct key_entry acer_wmi_keymap[] = {
> > 
> > @@ -130,6 +131,7 @@ static const struct key_entry acer_wmi_keymap[] = {
> > 
> >  };
> >  
> >  static struct input_dev *acer_wmi_input_dev;
> > 
> > +static struct input_dev *acer_wmi_accel_dev;
> > 
> >  struct event_return_value {
> >  
> >  	u8 function;
> > 
> > @@ -145,6 +147,7 @@ struct event_return_value {
> > 
> >  #define ACER_WMID3_GDS_THREEG		(1<<6)	/* 3G */
> >  #define ACER_WMID3_GDS_WIMAX		(1<<7)	/* WiMAX */
> >  #define ACER_WMID3_GDS_BLUETOOTH	(1<<11)	/* BT */
> > 
> > +#define ACER_WMID3_GDS_ACCEL		(1<<2)	/* Accelerometer */
> 
> Please kindly share your dmidecode information:
>  # dmidecode > dmidecode.log

Will do.

> How did you know '1<<2' reflects to G-sensor? As I know this is a
> reserved bit did not use before.

Honestly? Wild guess.

> >  struct lm_input_params {
> >  
> >  	u8 function_num;        /* Function Number */
> > 
> > @@ -200,6 +203,7 @@ struct hotkey_function_type_aa {
> > 
> >  #define ACER_CAP_BLUETOOTH		(1<<2)
> >  #define ACER_CAP_BRIGHTNESS		(1<<3)
> >  #define ACER_CAP_THREEG			(1<<4)
> > 
> > +#define ACER_CAP_ACCEL			(1<<5)
> > 
> >  #define ACER_CAP_ANY			(0xFFFFFFFF)
> >  
> >  /*
> > 
> > @@ -1150,6 +1154,8 @@ static void type_aa_dmi_decode(const struct
> > dmi_header *header, void *dummy)
> > 
> >  		interface->capability |= ACER_CAP_THREEG;
> >  	
> >  	if (type_aa->commun_func_bitmap & ACER_WMID3_GDS_BLUETOOTH)
> >  	
> >  		interface->capability |= ACER_CAP_BLUETOOTH;
> > 
> > +	if (type_aa->others_func_bitmap & ACER_WMID3_GDS_ACCEL)
> > +		interface->capability |= ACER_CAP_ACCEL;
> > 
> >  	commun_fn_key_number = type_aa->commun_fn_key_number;
> >  
> >  }
> > 
> > @@ -1375,6 +1381,61 @@ static void acer_backlight_exit(void)
> > 
> >  }
> >  
> >  /*
> > 
> > + * Accelerometer device
> > + */
> > +#define ACER_GSENSOR_HANDLE	"\\_SB.PCI0.LPC0.SENR"
> > +#define ACER_GSENSOR_INIT	"\\_SB.PCI0.LPC0.SENR._INI"
> > +#define ACER_GSENSOR_RDVL	"\\_SB.PCI0.LPC0.SENR.RDVL"
> 
> I think that will be better don't hard code the path of device in
> driver, because different models have different path naming.

Certainly, how should I do it the correct way please?

> IMHO, please reference thinkpad_acpi driver like the following:
> 
> vi drivers/platform/x86/thinkpad_acpi.c
> 
> #define TPACPI_ACPI_EC_HID              "PNP0C09"
> ...
> static acpi_handle ec_handle;
> ...
> 
> static int __init probe_for_thinkpad(void)
> {
> ...
>         /* The EC handler is required */
>         tpacpi_acpi_handle_locate("ec", TPACPI_ACPI_EC_HID, &ec_handle);
> 
> static void __init tpacpi_acpi_handle_locate(const char *name,
> {
> ...
>         memset(&device_found, 0, sizeof(device_found));
>         status = acpi_get_devices(hid, tpacpi_acpi_handle_locate_callback,
>                                   (void *)name, &device_found);

I see! Will do (incl. the other driver) Thanks for your guidance here, really, 
thanks a lot!

> > @@ -2118,6 +2225,9 @@ static void __exit acer_wmi_exit(void)
> > 
> >  	if (wmi_has_guid(ACERWMID_EVENT_GUID))
> >  	
> >  		acer_wmi_input_destroy();
> > 
> > +	if (has_cap(ACER_CAP_ACCEL))
> > +		acer_wmi_accel_destroy();
> > +
> > 
> >  	remove_sysfs(acer_platform_device);
> >  	remove_debugfs();
> >  	platform_device_unregister(acer_platform_device);
> 
> other stuff looks good to me.

Thanks. Btw I'll update the CC list in V2.

> 
> Thanks a lot!
> Joey Lee

  reply	other threads:[~2012-05-28  6:19 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-05-27 23:44 [PATCH] ACER: Add support for accelerometer sensor Marek Vasut
2012-05-28  6:10 ` joeyli
2012-05-28  6:19   ` Marek Vasut [this message]
     [not found] ` <201205281234.15981.marex@denx.de>
     [not found]   ` <1338257194.9751.4158.camel@linux-s257.site>
     [not found]     ` <201205290722.50810.marex@denx.de>
2012-05-29  8:00       ` joeyli

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=201205280819.17686.marex@denx.de \
    --to=marex@denx.de \
    --cc=carlos@strangeworlds.co.uk \
    --cc=corentincj@iksaif.net \
    --cc=dtor@mail.ru \
    --cc=jbenc@suse.cz \
    --cc=jlee@suse.com \
    --cc=mjg@redhat.com \
    --cc=platform-driver-x86@vger.kernel.org \
    --cc=trenn@suse.de \
    /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