* Re: [Fwd: Re: A problem about acer-wmi]
@ 2011-08-11 6:58 Joey Lee
2011-08-11 7:45 ` AceLan Kao
0 siblings, 1 reply; 16+ messages in thread
From: Joey Lee @ 2011-08-11 6:58 UTC (permalink / raw)
To: acelan; +Cc: platform-driver-x86
於 四,2011-08-11 於 03:30 +0000,joeyli(Joey Lee) 提到:
> 於 四,2011-08-11 於 10:48 +0800,AceLan Kao 提到:
> > Dear Joey,
> >
> > This is the dmesg log.
> > [ 9010.944053] acer_wmi: Acer Laptop ACPI-WMI Extras
> > [ 9010.944071] acer_wmi: Function bitmap for Communication Button: 0x1
Per this log, the 0x1 means your machine have wifi hardware module and
BIOS detected it then write information to SMBIOS area.
> > [ 9010.944075] acer_wmi: Brightness must be controlled by generic video driver
> > [ 9010.944996] input: Acer WMI hotkeys as /devices/virtual/input/input21
> > [ 9010.947095] acer_wmi: Set Device Status failed: 0xe2 - 0x0
> >
But,
here have problem when acer-wmi driver try to set the state by
WMID_GUID3 method, the wmi function response 0xe2.
> > And after adding my quirk, the set device status still failed, but
> > except that, everything works well.
> >
>
> So, you machine have wifi hardware module or not?
>
> > The "failed" comes from acer_rfkill_init(), it'll call
> > acer_rfkill_register() with ACER_CAP_WIRELESS parameter without
> > checking the capability.
> > I don't know why only wifi doesn't check the capability and call
> > acer_rfkill_register() directly, but it doesn't hurt the system.
> >
> > ===
> > static int acer_rfkill_init(struct device *dev)
> > {
> > wireless_rfkill = acer_rfkill_register(dev, RFKILL_TYPE_WLAN,
> > "acer-wireless", ACER_CAP_WIRELESS);
> > if (IS_ERR(wireless_rfkill))
> > return PTR_ERR(wireless_rfkill);
> > ===
> >
> > Best regards,
> > AceLan Kao.
> >
>
> I checked the history, looks like it's just a original design in old
> patch.
>
> Yes, you are right, add ACER_CAP_WIRELESS check is better. I am doing
> generate a patch to add ACER_CAP_WIRELESS check.
> Will attached patch on mail.
>
>
> Thank's
> Joey Lee
>
Please let me know does there have any wifi module in your machine when
you test?
If yes, then you need contact with BIOS team for why the WMID_GUID3
method response 0xe2 when set device state, because this function works
find on my TravelMate 8572 machine.
On the other hand,
The following is patch to check the ACER_CAP_WIRELESS before generate
wireless rfkill.
Thank's
Joey Lee
From 18c20f2b40bc64ec72b52ae2e4d994237173f982 Mon Sep 17 00:00:00 2001
From: Lee, Chun-Yi <jlee@suse.com>
Date: Thu, 11 Aug 2011 12:49:53 +0800
Subject: [PATCH] acer-wmi: check wireless capability flag before register rfkill
There will be better to check the wireless capability flag
(ACER_CAP_WIRELESS) before register wireless rfkill because maybe
the machine doesn't have wifi module or the module removed by user.
Signed-off-by: Lee, Chun-Yi <jlee@suse.com>
---
drivers/platform/x86/acer-wmi.c | 64 +++++++++++++++++++++++++-------------
1 files changed, 42 insertions(+), 22 deletions(-)
diff --git a/drivers/platform/x86/acer-wmi.c b/drivers/platform/x86/acer-wmi.c
index 712a505..b4078c4 100644
--- a/drivers/platform/x86/acer-wmi.c
+++ b/drivers/platform/x86/acer-wmi.c
@@ -1289,12 +1289,13 @@ static void acer_rfkill_update(struct work_struct *ignored)
u32 state;
acpi_status status;
- status = get_u32(&state, ACER_CAP_WIRELESS);
- if (ACPI_SUCCESS(status)) {
- if (quirks->wireless == 3) {
- rfkill_set_hw_state(wireless_rfkill, !state);
- } else {
- rfkill_set_sw_state(wireless_rfkill, !state);
+ if (has_cap(ACER_CAP_WIRELESS)) {
+ status = get_u32(&state, ACER_CAP_WIRELESS);
+ if (ACPI_SUCCESS(status)) {
+ if (quirks->wireless == 3)
+ rfkill_set_hw_state(wireless_rfkill, !state);
+ else
+ rfkill_set_sw_state(wireless_rfkill, !state);
}
}
@@ -1362,19 +1363,24 @@ static struct rfkill *acer_rfkill_register(struct device *dev,
static int acer_rfkill_init(struct device *dev)
{
- wireless_rfkill = acer_rfkill_register(dev, RFKILL_TYPE_WLAN,
- "acer-wireless", ACER_CAP_WIRELESS);
- if (IS_ERR(wireless_rfkill))
- return PTR_ERR(wireless_rfkill);
+ int err;
+
+ if (has_cap(ACER_CAP_WIRELESS)) {
+ wireless_rfkill = acer_rfkill_register(dev, RFKILL_TYPE_WLAN,
+ "acer-wireless", ACER_CAP_WIRELESS);
+ if (IS_ERR(wireless_rfkill)) {
+ err = PTR_ERR(wireless_rfkill);
+ goto error_wireless;
+ }
+ }
if (has_cap(ACER_CAP_BLUETOOTH)) {
bluetooth_rfkill = acer_rfkill_register(dev,
RFKILL_TYPE_BLUETOOTH, "acer-bluetooth",
ACER_CAP_BLUETOOTH);
if (IS_ERR(bluetooth_rfkill)) {
- rfkill_unregister(wireless_rfkill);
- rfkill_destroy(wireless_rfkill);
- return PTR_ERR(bluetooth_rfkill);
+ err = PTR_ERR(bluetooth_rfkill);
+ goto error_bluetooth;
}
}
@@ -1383,30 +1389,44 @@ static int acer_rfkill_init(struct device *dev)
RFKILL_TYPE_WWAN, "acer-threeg",
ACER_CAP_THREEG);
if (IS_ERR(threeg_rfkill)) {
- rfkill_unregister(wireless_rfkill);
- rfkill_destroy(wireless_rfkill);
- rfkill_unregister(bluetooth_rfkill);
- rfkill_destroy(bluetooth_rfkill);
- return PTR_ERR(threeg_rfkill);
+ err = PTR_ERR(threeg_rfkill);
+ goto error_threeg;
}
}
rfkill_inited = true;
- if (ec_raw_mode || !wmi_has_guid(ACERWMID_EVENT_GUID))
+ if ((ec_raw_mode || !wmi_has_guid(ACERWMID_EVENT_GUID)) &&
+ has_cap(ACER_CAP_WIRELESS | ACER_CAP_BLUETOOTH | ACER_CAP_THREEG))
schedule_delayed_work(&acer_rfkill_work,
round_jiffies_relative(HZ));
return 0;
+
+error_threeg:
+ if (has_cap(ACER_CAP_BLUETOOTH)) {
+ rfkill_unregister(bluetooth_rfkill);
+ rfkill_destroy(bluetooth_rfkill);
+ }
+error_bluetooth:
+ if (has_cap(ACER_CAP_WIRELESS)) {
+ rfkill_unregister(wireless_rfkill);
+ rfkill_destroy(wireless_rfkill);
+ }
+error_wireless:
+ return err;
}
static void acer_rfkill_exit(void)
{
- if (ec_raw_mode || !wmi_has_guid(ACERWMID_EVENT_GUID))
+ if ((ec_raw_mode || !wmi_has_guid(ACERWMID_EVENT_GUID)) &&
+ has_cap(ACER_CAP_WIRELESS | ACER_CAP_BLUETOOTH | ACER_CAP_THREEG))
cancel_delayed_work_sync(&acer_rfkill_work);
- rfkill_unregister(wireless_rfkill);
- rfkill_destroy(wireless_rfkill);
+ if (has_cap(ACER_CAP_WIRELESS)) {
+ rfkill_unregister(wireless_rfkill);
+ rfkill_destroy(wireless_rfkill);
+ }
if (has_cap(ACER_CAP_BLUETOOTH)) {
rfkill_unregister(bluetooth_rfkill);
--
1.6.0.2
^ permalink raw reply related [flat|nested] 16+ messages in thread* Re: [Fwd: Re: A problem about acer-wmi]
2011-08-11 6:58 [Fwd: Re: A problem about acer-wmi] Joey Lee
@ 2011-08-11 7:45 ` AceLan Kao
2011-08-11 8:02 ` Joey Lee
2011-09-07 2:33 ` joeyli
0 siblings, 2 replies; 16+ messages in thread
From: AceLan Kao @ 2011-08-11 7:45 UTC (permalink / raw)
To: Joey Lee; +Cc: platform-driver-x86
Dear Joey,
Good, that looks more reasonable to me.
Yes, my machine has wifi module on it, but the wifi hotkey event is
handled by BIOS, so the wifi toggle works as expected.
I still got the failed message, but we can take it as a BIOS bug and
leave it there.
BTW, your patches work well on my machine, thanks for your hard work.
You can have my signature on your patches.
Tested-by: AceLan Kao <acelan.kao@canonical.com>
Best regards,
AceLan Kao.
2011/8/11 Joey Lee <jlee@novell.com>:
> 於 四,2011-08-11 於 03:30 +0000,joeyli(Joey Lee) 提到:
>> 於 四,2011-08-11 於 10:48 +0800,AceLan Kao 提到:
>> > Dear Joey,
>> >
>> > This is the dmesg log.
>> > [ 9010.944053] acer_wmi: Acer Laptop ACPI-WMI Extras
>> > [ 9010.944071] acer_wmi: Function bitmap for Communication Button: 0x1
>
> Per this log, the 0x1 means your machine have wifi hardware module and
> BIOS detected it then write information to SMBIOS area.
>
>> > [ 9010.944075] acer_wmi: Brightness must be controlled by generic video driver
>> > [ 9010.944996] input: Acer WMI hotkeys as /devices/virtual/input/input21
>> > [ 9010.947095] acer_wmi: Set Device Status failed: 0xe2 - 0x0
>> >
>
> But,
> here have problem when acer-wmi driver try to set the state by
> WMID_GUID3 method, the wmi function response 0xe2.
>
>> > And after adding my quirk, the set device status still failed, but
>> > except that, everything works well.
>> >
>>
>> So, you machine have wifi hardware module or not?
>>
>> > The "failed" comes from acer_rfkill_init(), it'll call
>> > acer_rfkill_register() with ACER_CAP_WIRELESS parameter without
>> > checking the capability.
>> > I don't know why only wifi doesn't check the capability and call
>> > acer_rfkill_register() directly, but it doesn't hurt the system.
>> >
>> > ===
>> > static int acer_rfkill_init(struct device *dev)
>> > {
>> > wireless_rfkill = acer_rfkill_register(dev, RFKILL_TYPE_WLAN,
>> > "acer-wireless", ACER_CAP_WIRELESS);
>> > if (IS_ERR(wireless_rfkill))
>> > return PTR_ERR(wireless_rfkill);
>> > ===
>> >
>> > Best regards,
>> > AceLan Kao.
>> >
>>
>> I checked the history, looks like it's just a original design in old
>> patch.
>>
>> Yes, you are right, add ACER_CAP_WIRELESS check is better. I am doing
>> generate a patch to add ACER_CAP_WIRELESS check.
>> Will attached patch on mail.
>>
>>
>> Thank's
>> Joey Lee
>>
>
> Please let me know does there have any wifi module in your machine when
> you test?
> If yes, then you need contact with BIOS team for why the WMID_GUID3
> method response 0xe2 when set device state, because this function works
> find on my TravelMate 8572 machine.
>
> On the other hand,
> The following is patch to check the ACER_CAP_WIRELESS before generate
> wireless rfkill.
>
>
> Thank's
> Joey Lee
>
> >From 18c20f2b40bc64ec72b52ae2e4d994237173f982 Mon Sep 17 00:00:00 2001
> From: Lee, Chun-Yi <jlee@suse.com>
> Date: Thu, 11 Aug 2011 12:49:53 +0800
> Subject: [PATCH] acer-wmi: check wireless capability flag before register rfkill
>
> There will be better to check the wireless capability flag
> (ACER_CAP_WIRELESS) before register wireless rfkill because maybe
> the machine doesn't have wifi module or the module removed by user.
>
> Signed-off-by: Lee, Chun-Yi <jlee@suse.com>
> ---
> drivers/platform/x86/acer-wmi.c | 64 +++++++++++++++++++++++++-------------
> 1 files changed, 42 insertions(+), 22 deletions(-)
>
> diff --git a/drivers/platform/x86/acer-wmi.c b/drivers/platform/x86/acer-wmi.c
> index 712a505..b4078c4 100644
> --- a/drivers/platform/x86/acer-wmi.c
> +++ b/drivers/platform/x86/acer-wmi.c
> @@ -1289,12 +1289,13 @@ static void acer_rfkill_update(struct work_struct *ignored)
> u32 state;
> acpi_status status;
>
> - status = get_u32(&state, ACER_CAP_WIRELESS);
> - if (ACPI_SUCCESS(status)) {
> - if (quirks->wireless == 3) {
> - rfkill_set_hw_state(wireless_rfkill, !state);
> - } else {
> - rfkill_set_sw_state(wireless_rfkill, !state);
> + if (has_cap(ACER_CAP_WIRELESS)) {
> + status = get_u32(&state, ACER_CAP_WIRELESS);
> + if (ACPI_SUCCESS(status)) {
> + if (quirks->wireless == 3)
> + rfkill_set_hw_state(wireless_rfkill, !state);
> + else
> + rfkill_set_sw_state(wireless_rfkill, !state);
> }
> }
>
> @@ -1362,19 +1363,24 @@ static struct rfkill *acer_rfkill_register(struct device *dev,
>
> static int acer_rfkill_init(struct device *dev)
> {
> - wireless_rfkill = acer_rfkill_register(dev, RFKILL_TYPE_WLAN,
> - "acer-wireless", ACER_CAP_WIRELESS);
> - if (IS_ERR(wireless_rfkill))
> - return PTR_ERR(wireless_rfkill);
> + int err;
> +
> + if (has_cap(ACER_CAP_WIRELESS)) {
> + wireless_rfkill = acer_rfkill_register(dev, RFKILL_TYPE_WLAN,
> + "acer-wireless", ACER_CAP_WIRELESS);
> + if (IS_ERR(wireless_rfkill)) {
> + err = PTR_ERR(wireless_rfkill);
> + goto error_wireless;
> + }
> + }
>
> if (has_cap(ACER_CAP_BLUETOOTH)) {
> bluetooth_rfkill = acer_rfkill_register(dev,
> RFKILL_TYPE_BLUETOOTH, "acer-bluetooth",
> ACER_CAP_BLUETOOTH);
> if (IS_ERR(bluetooth_rfkill)) {
> - rfkill_unregister(wireless_rfkill);
> - rfkill_destroy(wireless_rfkill);
> - return PTR_ERR(bluetooth_rfkill);
> + err = PTR_ERR(bluetooth_rfkill);
> + goto error_bluetooth;
> }
> }
>
> @@ -1383,30 +1389,44 @@ static int acer_rfkill_init(struct device *dev)
> RFKILL_TYPE_WWAN, "acer-threeg",
> ACER_CAP_THREEG);
> if (IS_ERR(threeg_rfkill)) {
> - rfkill_unregister(wireless_rfkill);
> - rfkill_destroy(wireless_rfkill);
> - rfkill_unregister(bluetooth_rfkill);
> - rfkill_destroy(bluetooth_rfkill);
> - return PTR_ERR(threeg_rfkill);
> + err = PTR_ERR(threeg_rfkill);
> + goto error_threeg;
> }
> }
>
> rfkill_inited = true;
>
> - if (ec_raw_mode || !wmi_has_guid(ACERWMID_EVENT_GUID))
> + if ((ec_raw_mode || !wmi_has_guid(ACERWMID_EVENT_GUID)) &&
> + has_cap(ACER_CAP_WIRELESS | ACER_CAP_BLUETOOTH | ACER_CAP_THREEG))
> schedule_delayed_work(&acer_rfkill_work,
> round_jiffies_relative(HZ));
>
> return 0;
> +
> +error_threeg:
> + if (has_cap(ACER_CAP_BLUETOOTH)) {
> + rfkill_unregister(bluetooth_rfkill);
> + rfkill_destroy(bluetooth_rfkill);
> + }
> +error_bluetooth:
> + if (has_cap(ACER_CAP_WIRELESS)) {
> + rfkill_unregister(wireless_rfkill);
> + rfkill_destroy(wireless_rfkill);
> + }
> +error_wireless:
> + return err;
> }
>
> static void acer_rfkill_exit(void)
> {
> - if (ec_raw_mode || !wmi_has_guid(ACERWMID_EVENT_GUID))
> + if ((ec_raw_mode || !wmi_has_guid(ACERWMID_EVENT_GUID)) &&
> + has_cap(ACER_CAP_WIRELESS | ACER_CAP_BLUETOOTH | ACER_CAP_THREEG))
> cancel_delayed_work_sync(&acer_rfkill_work);
>
> - rfkill_unregister(wireless_rfkill);
> - rfkill_destroy(wireless_rfkill);
> + if (has_cap(ACER_CAP_WIRELESS)) {
> + rfkill_unregister(wireless_rfkill);
> + rfkill_destroy(wireless_rfkill);
> + }
>
> if (has_cap(ACER_CAP_BLUETOOTH)) {
> rfkill_unregister(bluetooth_rfkill);
> --
> 1.6.0.2
>
>
>
>
--
Chia-Lin Kao(AceLan)
http://blog.acelan.idv.tw/
E-Mail: acelan.kaoATcanonical.com (s/AT/@/)
^ permalink raw reply [flat|nested] 16+ messages in thread* Re: [Fwd: Re: A problem about acer-wmi]
2011-08-11 7:45 ` AceLan Kao
@ 2011-08-11 8:02 ` Joey Lee
2011-08-11 8:49 ` AceLan Kao
2011-09-07 2:33 ` joeyli
1 sibling, 1 reply; 16+ messages in thread
From: Joey Lee @ 2011-08-11 8:02 UTC (permalink / raw)
To: acelan; +Cc: Joey Lee, platform-driver-x86
Hi AceLan,
於 四,2011-08-11 於 15:45 +0800,AceLan Kao 提到:
> Dear Joey,
>
> Good, that looks more reasonable to me.
>
> Yes, my machine has wifi module on it, but the wifi hotkey event is
> handled by BIOS, so the wifi toggle works as expected.
> I still got the failed message, but we can take it as a BIOS bug and
> leave it there.
>
> BTW, your patches work well on my machine, thanks for your hard work.
> You can have my signature on your patches.
> Tested-by: AceLan Kao <acelan.kao@canonical.com>
>
> Best regards,
> AceLan Kao.
It's good news!
Will you contribute any patches to acer-wmi for support any function
keys on your Acer Aspire 4739Z?
Thank's
Joey Lee
> 2011/8/11 Joey Lee <jlee@novell.com>:
> > 於 四,2011-08-11 於 03:30 +0000,joeyli(Joey Lee) 提到:
> >> 於 四,2011-08-11 於 10:48 +0800,AceLan Kao 提到:
> >> > Dear Joey,
> >> >
> >> > This is the dmesg log.
> >> > [ 9010.944053] acer_wmi: Acer Laptop ACPI-WMI Extras
> >> > [ 9010.944071] acer_wmi: Function bitmap for Communication Button: 0x1
> >
> > Per this log, the 0x1 means your machine have wifi hardware module and
> > BIOS detected it then write information to SMBIOS area.
> >
> >> > [ 9010.944075] acer_wmi: Brightness must be controlled by generic video driver
> >> > [ 9010.944996] input: Acer WMI hotkeys as /devices/virtual/input/input21
> >> > [ 9010.947095] acer_wmi: Set Device Status failed: 0xe2 - 0x0
> >> >
> >
> > But,
> > here have problem when acer-wmi driver try to set the state by
> > WMID_GUID3 method, the wmi function response 0xe2.
> >
> >> > And after adding my quirk, the set device status still failed, but
> >> > except that, everything works well.
> >> >
> >>
> >> So, you machine have wifi hardware module or not?
> >>
> >> > The "failed" comes from acer_rfkill_init(), it'll call
> >> > acer_rfkill_register() with ACER_CAP_WIRELESS parameter without
> >> > checking the capability.
> >> > I don't know why only wifi doesn't check the capability and call
> >> > acer_rfkill_register() directly, but it doesn't hurt the system.
> >> >
> >> > ===
> >> > static int acer_rfkill_init(struct device *dev)
> >> > {
> >> > wireless_rfkill = acer_rfkill_register(dev, RFKILL_TYPE_WLAN,
> >> > "acer-wireless", ACER_CAP_WIRELESS);
> >> > if (IS_ERR(wireless_rfkill))
> >> > return PTR_ERR(wireless_rfkill);
> >> > ===
> >> >
> >> > Best regards,
> >> > AceLan Kao.
> >> >
> >>
> >> I checked the history, looks like it's just a original design in old
> >> patch.
> >>
> >> Yes, you are right, add ACER_CAP_WIRELESS check is better. I am doing
> >> generate a patch to add ACER_CAP_WIRELESS check.
> >> Will attached patch on mail.
> >>
> >>
> >> Thank's
> >> Joey Lee
> >>
> >
> > Please let me know does there have any wifi module in your machine when
> > you test?
> > If yes, then you need contact with BIOS team for why the WMID_GUID3
> > method response 0xe2 when set device state, because this function works
> > find on my TravelMate 8572 machine.
> >
> > On the other hand,
> > The following is patch to check the ACER_CAP_WIRELESS before generate
> > wireless rfkill.
> >
> >
> > Thank's
> > Joey Lee
> >
> > >From 18c20f2b40bc64ec72b52ae2e4d994237173f982 Mon Sep 17 00:00:00 2001
> > From: Lee, Chun-Yi <jlee@suse.com>
> > Date: Thu, 11 Aug 2011 12:49:53 +0800
> > Subject: [PATCH] acer-wmi: check wireless capability flag before register rfkill
> >
> > There will be better to check the wireless capability flag
> > (ACER_CAP_WIRELESS) before register wireless rfkill because maybe
> > the machine doesn't have wifi module or the module removed by user.
> >
> > Signed-off-by: Lee, Chun-Yi <jlee@suse.com>
> > ---
> > drivers/platform/x86/acer-wmi.c | 64 +++++++++++++++++++++++++-------------
> > 1 files changed, 42 insertions(+), 22 deletions(-)
> >
> > diff --git a/drivers/platform/x86/acer-wmi.c b/drivers/platform/x86/acer-wmi.c
> > index 712a505..b4078c4 100644> > @@ -1289,12 +1289,13 @@ static void acer_rfkill_update(struct work_struct *ignored)
> > u32 state;
> > acpi_status status;
> >
> > - status = get_u32(&state, ACER_CAP_WIRELESS);
> > - if (ACPI_SUCCESS(status)) {
> > - if (quirks->wireless == 3) {
> > - rfkill_set_hw_state(wireless_rfkill, !state);
> > - } else {
> > - rfkill_set_sw_state(wireless_rfkill, !state);
> > + if (has_cap(ACER_CAP_WIRELESS)) {
> > + status = get_u32(&state, ACER_CAP_WIRELESS);
> > + if (ACPI_SUCCESS(status)) {
> > + if (quirks->wireless == 3)
> > + rfkill_set_hw_state(wireless_rfkill, !state);
> > + else
> > + rfkill_set_sw_state(wireless_rfkill, !state);
> > }
> > }
> >
> > @@ -1362,19 +1363,24 @@ static struct rfkill *acer_rfkill_register(struct device *dev,
> >
> > static int acer_rfkill_init(struct device *dev)
> > {
> > - wireless_rfkill = acer_rfkill_register(dev, RFKILL_TYPE_WLAN,
> > - "acer-wireless", ACER_CAP_WIRELESS);
> > - if (IS_ERR(wireless_rfkill))
> > - return PTR_ERR(wireless_rfkill);
> > + int err;
> > +
> > + if (has_cap(ACER_CAP_WIRELESS)) {
> > + wireless_rfkill = acer_rfkill_register(dev, RFKILL_TYPE_WLAN,
> > + "acer-wireless", ACER_CAP_WIRELESS);
> > + if (IS_ERR(wireless_rfkill)) {
> > + err = PTR_ERR(wireless_rfkill);
> > + goto error_wireless;
> > + }
> > + }
> >
> > if (has_cap(ACER_CAP_BLUETOOTH)) {
> > bluetooth_rfkill = acer_rfkill_register(dev,
> > RFKILL_TYPE_BLUETOOTH, "acer-bluetooth",
> > ACER_CAP_BLUETOOTH);
> > if (IS_ERR(bluetooth_rfkill)) {
> > - rfkill_unregister(wireless_rfkill);
> > - rfkill_destroy(wireless_rfkill);
> > - return PTR_ERR(bluetooth_rfkill);
> > + err = PTR_ERR(bluetooth_rfkill);
> > + goto error_bluetooth;
> > }
> > }
> >
> > @@ -1383,30 +1389,44 @@ static int acer_rfkill_init(struct device *dev)
> > RFKILL_TYPE_WWAN, "acer-threeg",
> > ACER_CAP_THREEG);
> > if (IS_ERR(threeg_rfkill)) {
> > - rfkill_unregister(wireless_rfkill);
> > - rfkill_destroy(wireless_rfkill);
> > - rfkill_unregister(bluetooth_rfkill);
> > - rfkill_destroy(bluetooth_rfkill);
> > - return PTR_ERR(threeg_rfkill);
> > + err = PTR_ERR(threeg_rfkill);
> > + goto error_threeg;
> > }
> > }
> >
> > rfkill_inited = true;
> >
> > - if (ec_raw_mode || !wmi_has_guid(ACERWMID_EVENT_GUID))
> > + if ((ec_raw_mode || !wmi_has_guid(ACERWMID_EVENT_GUID)) &&
> > + has_cap(ACER_CAP_WIRELESS | ACER_CAP_BLUETOOTH | ACER_CAP_THREEG))
> > schedule_delayed_work(&acer_rfkill_work,
> > round_jiffies_relative(HZ));
> >
> > return 0;
> > +
> > +error_threeg:
> > + if (has_cap(ACER_CAP_BLUETOOTH)) {
> > + rfkill_unregister(bluetooth_rfkill);
> > + rfkill_destroy(bluetooth_rfkill);
> > + }
> > +error_bluetooth:
> > + if (has_cap(ACER_CAP_WIRELESS)) {
> > + rfkill_unregister(wireless_rfkill);
> > + rfkill_destroy(wireless_rfkill);
> > + }
> > +error_wireless:
> > + return err;
> > }
> >
> > static void acer_rfkill_exit(void)
> > {
> > - if (ec_raw_mode || !wmi_has_guid(ACERWMID_EVENT_GUID))
> > + if ((ec_raw_mode |> > + has_cap(ACER_CAP_WIRELESS | ACER_CAP_BLUETOOTH | ACER_CAP_THREEG))
> > cancel_delayed_work_sync(&acer_rfkill_work);
> >
> > - rfkill_unregister(wireless_rfkill);
> > - rfkill_destroy(wireless_rfkill);
> > + if (has_cap(ACER_CAP_WIRELESS)) {
> > + rfkill_unregister(wireless_rfkill);
> > + rfkill_destroy(wireless_rfkill);
> > + }
> >
> > if (has_cap(ACER_CAP_BLUETOOTH)) {
> > rfkill_unregister(bluetooth_rfkill);
> > --
> > 1.6.0.2
> >
> >
> >
> >
>
>
>
^ permalink raw reply [flat|nested] 16+ messages in thread* Re: [Fwd: Re: A problem about acer-wmi]
2011-08-11 8:02 ` Joey Lee
@ 2011-08-11 8:49 ` AceLan Kao
0 siblings, 0 replies; 16+ messages in thread
From: AceLan Kao @ 2011-08-11 8:49 UTC (permalink / raw)
To: Joey Lee; +Cc: platform-driver-x86
Dear Joey,
Sure, I will.
But my patch depends on your patches,
so I'm not sure if I should send it out now before the acceptation of
your patches.
Best regards,
AceLan Kao.
2011/8/11 Joey Lee <jlee@novell.com>:
> Hi AceLan,
>
> 於 四,2011-08-11 於 15:45 +0800,AceLan Kao 提到:
>> Dear Joey,
>>
>> Good, that looks more reasonable to me.
>>
>> Yes, my machine has wifi module on it, but the wifi hotkey event is
>> handled by BIOS, so the wifi toggle works as expected.
>> I still got the failed message, but we can take it as a BIOS bug and
>> leave it there.
>>
>> BTW, your patches work well on my machine, thanks for your hard work.
>> You can have my signature on your patches.
>> Tested-by: AceLan Kao <acelan.kao@canonical.com>
>>
>> Best regards,
>> AceLan Kao.
>
> It's good news!
>
> Will you contribute any patches to acer-wmi for support any function
> keys on your Acer Aspire 4739Z?
>
>
> Thank's
> Joey Lee
>
>> 2011/8/11 Joey Lee <jlee@novell.com>:
>> > 於 四,2011-08-11 於 03:30 +0000,joeyli(Joey Lee) 提到:
>> >> 於 四,2011-08-11 於 10:48 +0800,AceLan Kao 提到:
>> >> > Dear Joey,
>> >> >
>> >> > This is the dmesg log.
>> >> > [ 9010.944053] acer_wmi: Acer Laptop ACPI-WMI Extras
>> >> > [ 9010.944071] acer_wmi: Function bitmap for Communication Button: 0x1
>> >
>> > Per this log, the 0x1 means your machine have wifi hardware module and
>> > BIOS detected it then write information to SMBIOS area.
>> >
>> >> > [ 9010.944075] acer_wmi: Brightness must be controlled by generic video driver
>> >> > [ 9010.944996] input: Acer WMI hotkeys as /devices/virtual/input/input21
>> >> > [ 9010.947095] acer_wmi: Set Device Status failed: 0xe2 - 0x0
>> >> >
>> >
>> > But,
>> > here have problem when acer-wmi driver try to set the state by
>> > WMID_GUID3 method, the wmi function response 0xe2.
>> >
>> >> > And after adding my quirk, the set device status still failed, but
>> >> > except that, everything works well.
>> >> >
>> >>
>> >> So, you machine have wifi hardware module or not?
>> >>
>> >> > The "failed" comes from acer_rfkill_init(), it'll call
>> >> > acer_rfkill_register() with ACER_CAP_WIRELESS parameter without
>> >> > checking the capability.
>> >> > I don't know why only wifi doesn't check the capability and call
>> >> > acer_rfkill_register() directly, but it doesn't hurt the system.
>> >> >
>> >> > ===
>> >> > static int acer_rfkill_init(struct device *dev)
>> >> > {
>> >> > wireless_rfkill = acer_rfkill_register(dev, RFKILL_TYPE_WLAN,
>> >> > "acer-wireless", ACER_CAP_WIRELESS);
>> >> > if (IS_ERR(wireless_rfkill))
>> >> > return PTR_ERR(wireless_rfkill);
>> >> > ===
>> >> >
>> >> > Best regards,
>> >> > AceLan Kao.
>> >> >
>> >>
>> >> I checked the history, looks like it's just a original design in old
>> >> patch.
>> >>
>> >> Yes, you are right, add ACER_CAP_WIRELESS check is better. I am doing
>> >> generate a patch to add ACER_CAP_WIRELESS check.
>> >> Will attached patch on mail.
>> >>
>> >>
>> >> Thank's
>> >> Joey Lee
>> >>
>> >
>> > Please let me know does there have any wifi module in your machine when
>> > you test?
>> > If yes, then you need contact with BIOS team for why the WMID_GUID3
>> > method response 0xe2 when set device state, because this function works
>> > find on my TravelMate 8572 machine.
>> >
>> > On the other hand,
>> > The following is patch to check the ACER_CAP_WIRELESS before generate
>> > wireless rfkill.
>> >
>> >
>> > Thank's
>> > Joey Lee
>> >
>> > >From 18c20f2b40bc64ec72b52ae2e4d994237173f982 Mon Sep 17 00:00:00 2001
>> > From: Lee, Chun-Yi <jlee@suse.com>
>> > Date: Thu, 11 Aug 2011 12:49:53 +0800
>> > Subject: [PATCH] acer-wmi: check wireless capability flag before register rfkill
>> >
>> > There will be better to check the wireless capability flag
>> > (ACER_CAP_WIRELESS) before register wireless rfkill because maybe
>> > the machine doesn't have wifi module or the module removed by user.
>> >
>> > Signed-off-by: Lee, Chun-Yi <jlee@suse.com>
>> > ---
>> > drivers/platform/x86/acer-wmi.c | 64 +++++++++++++++++++++++++-------------
>> > 1 files changed, 42 insertions(+), 22 deletions(-)
>> >
>> > diff --git a/drivers/platform/x86/acer-wmi.c b/drivers/platform/x86/acer-wmi.c
>> > index 712a505..b4078c4 100644> > @@ -1289,12 +1289,13 @@ static void acer_rfkill_update(struct work_struct *ignored)
>> > u32 state;
>> > acpi_status status;
>> >
>> > - status = get_u32(&state, ACER_CAP_WIRELESS);
>> > - if (ACPI_SUCCESS(status)) {
>> > - if (quirks->wireless == 3) {
>> > - rfkill_set_hw_state(wireless_rfkill, !state);
>> > - } else {
>> > - rfkill_set_sw_state(wireless_rfkill, !state);
>> > + if (has_cap(ACER_CAP_WIRELESS)) {
>> > + status = get_u32(&state, ACER_CAP_WIRELESS);
>> > + if (ACPI_SUCCESS(status)) {
>> > + if (quirks->wireless == 3)
>> > + rfkill_set_hw_state(wireless_rfkill, !state);
>> > + else
>> > + rfkill_set_sw_state(wireless_rfkill, !state);
>> > }
>> > }
>> >
>> > @@ -1362,19 +1363,24 @@ static struct rfkill *acer_rfkill_register(struct device *dev,
>> >
>> > static int acer_rfkill_init(struct device *dev)
>> > {
>> > - wireless_rfkill = acer_rfkill_register(dev, RFKILL_TYPE_WLAN,
>> > - "acer-wireless", ACER_CAP_WIRELESS);
>> > - if (IS_ERR(wireless_rfkill))
>> > - return PTR_ERR(wireless_rfkill);
>> > + int err;
>> > +
>> > + if (has_cap(ACER_CAP_WIRELESS)) {
>> > + wireless_rfkill = acer_rfkill_register(dev, RFKILL_TYPE_WLAN,
>> > + "acer-wireless", ACER_CAP_WIRELESS);
>> > + if (IS_ERR(wireless_rfkill)) {
>> > + err = PTR_ERR(wireless_rfkill);
>> > + goto error_wireless;
>> > + }
>> > + }
>> >
>> > if (has_cap(ACER_CAP_BLUETOOTH)) {
>> > bluetooth_rfkill = acer_rfkill_register(dev,
>> > RFKILL_TYPE_BLUETOOTH, "acer-bluetooth",
>> > ACER_CAP_BLUETOOTH);
>> > if (IS_ERR(bluetooth_rfkill)) {
>> > - rfkill_unregister(wireless_rfkill);
>> > - rfkill_destroy(wireless_rfkill);
>> > - return PTR_ERR(bluetooth_rfkill);
>> > + err = PTR_ERR(bluetooth_rfkill);
>> > + goto error_bluetooth;
>> > }
>> > }
>> >
>> > @@ -1383,30 +1389,44 @@ static int acer_rfkill_init(struct device *dev)
>> > RFKILL_TYPE_WWAN, "acer-threeg",
>> > ACER_CAP_THREEG);
>> > if (IS_ERR(threeg_rfkill)) {
>> > - rfkill_unregister(wireless_rfkill);
>> > - rfkill_destroy(wireless_rfkill);
>> > - rfkill_unregister(bluetooth_rfkill);
>> > - rfkill_destroy(bluetooth_rfkill);
>> > - return PTR_ERR(threeg_rfkill);
>> > + err = PTR_ERR(threeg_rfkill);
>> > + goto error_threeg;
>> > }
>> > }
>> >
>> > rfkill_inited = true;
>> >
>> > - if (ec_raw_mode || !wmi_has_guid(ACERWMID_EVENT_GUID))
>> > + if ((ec_raw_mode || !wmi_has_guid(ACERWMID_EVENT_GUID)) &&
>> > + has_cap(ACER_CAP_WIRELESS | ACER_CAP_BLUETOOTH | ACER_CAP_THREEG))
>> > schedule_delayed_work(&acer_rfkill_work,
>> > round_jiffies_relative(HZ));
>> >
>> > return 0;
>> > +
>> > +error_threeg:
>> > + if (has_cap(ACER_CAP_BLUETOOTH)) {
>> > + rfkill_unregister(bluetooth_rfkill);
>> > + rfkill_destroy(bluetooth_rfkill);
>> > + }
>> > +error_bluetooth:
>> > + if (has_cap(ACER_CAP_WIRELESS)) {
>> > + rfkill_unregister(wireless_rfkill);
>> > + rfkill_destroy(wireless_rfkill);
>> > + }
>> > +error_wireless:
>> > + return err;
>> > }
>> >
>> > static void acer_rfkill_exit(void)
>> > {
>> > - if (ec_raw_mode || !wmi_has_guid(ACERWMID_EVENT_GUID))
>> > + if ((ec_raw_mode |> > + has_cap(ACER_CAP_WIRELESS | ACER_CAP_BLUETOOTH | ACER_CAP_THREEG))
>> > cancel_delayed_work_sync(&acer_rfkill_work);
>> >
>> > - rfkill_unregister(wireless_rfkill);
>> > - rfkill_destroy(wireless_rfkill);
>> > + if (has_cap(ACER_CAP_WIRELESS)) {
>> > + rfkill_unregister(wireless_rfkill);
>> > + rfkill_destroy(wireless_rfkill);
>> > + }
>> >
>> > if (has_cap(ACER_CAP_BLUETOOTH)) {
>> > rfkill_unregister(bluetooth_rfkill);
>> > --
>> > 1.6.0.2
>> >
>> >
>> >
>> >
>>
>>
>>
>
>
>
--
Chia-Lin Kao(AceLan)
http://blog.acelan.idv.tw/
E-Mail: acelan.kaoATcanonical.com (s/AT/@/)
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [Fwd: Re: A problem about acer-wmi]
2011-08-11 7:45 ` AceLan Kao
2011-08-11 8:02 ` Joey Lee
@ 2011-09-07 2:33 ` joeyli
2011-09-07 5:29 ` AceLan Kao
1 sibling, 1 reply; 16+ messages in thread
From: joeyli @ 2011-09-07 2:33 UTC (permalink / raw)
To: AceLan Kao; +Cc: Joey Lee, platform-driver-x86
Hi AceLan,
I am tracing a issue related to hotkey define.
Could you please share dmidecode to me on your machine?
Thank's a lot!
Joey Lee
於 四,2011-08-11 於 15:45 +0800,AceLan Kao 提到:
> Dear Joey,
>
> Good, that looks more reasonable to me.
>
> Yes, my machine has wifi module on it, but the wifi hotkey event is
> handled by BIOS, so the wifi toggle works as expected.
> I still got the failed message, but we can take it as a BIOS bug and
> leave it there.
>
> BTW, your patches work well on my machine, thanks for your hard work.
> You can have my signature on your patches.
> Tested-by: AceLan Kao <acelan.kao@canonical.com>
>
> Best regards,
> AceLan Kao.
>
> 2011/8/11 Joey Lee <jlee@novell.com>:
> > 於 四,2011-08-11 於 03:30 +0000,joeyli(Joey Lee) 提到:
> >> 於 四,2011-08-11 於 10:48 +0800,AceLan Kao 提到:
> >> > Dear Joey,
> >> >
> >> > This is the dmesg log.
> >> > [ 9010.944053] acer_wmi: Acer Laptop ACPI-WMI Extras
> >> > [ 9010.944071] acer_wmi: Function bitmap for Communication Button: 0x1
> >
> > Per this log, the 0x1 means your machine have wifi hardware module and
> > BIOS detected it then write information to SMBIOS area.
> >
> >> > [ 9010.944075] acer_wmi: Brightness must be controlled by generic video driver
> >> > [ 9010.944996] input: Acer WMI hotkeys as /devices/virtual/input/input21
> >> > [ 9010.947095] acer_wmi: Set Device Status failed: 0xe2 - 0x0
> >> >
> >
> > But,
> > here have problem when acer-wmi driver try to set the state by
> > WMID_GUID3 method, the wmi function response 0xe2.
> >
> >> > And after adding my quirk, the set device status still failed, but
> >> > except that, everything works well.
> >> >
> >>
> >> So, you machine have wifi hardware module or not?
> >>
> >> > The "failed" comes from acer_rfkill_init(), it'll call
> >> > acer_rfkill_register() with ACER_CAP_WIRELESS parameter without
> >> > checking the capability.
> >> > I don't know why only wifi doesn't check the capability and call
> >> > acer_rfkill_register() directly, but it doesn't hurt the system.
> >> >
> >> > ===
> >> > static int acer_rfkill_init(struct device *dev)
> >> > {
> >> > wireless_rfkill = acer_rfkill_register(dev, RFKILL_TYPE_WLAN,
> >> > "acer-wireless", ACER_CAP_WIRELESS);
> >> > if (IS_ERR(wireless_rfkill))
> >> > return PTR_ERR(wireless_rfkill);
> >> > ===
> >> >
> >> > Best regards,
> >> > AceLan Kao.
> >> >
> >>
> >> I checked the history, looks like it's just a original design in old
> >> patch.
> >>
> >> Yes, you are right, add ACER_CAP_WIRELESS check is better. I am doing
> >> generate a patch to add ACER_CAP_WIRELESS check.
> >> Will attached patch on mail.
> >>
> >>
> >> Thank's
> >> Joey Lee
> >>
> >
> > Please let me know does there have any wifi module in your machine when
> > you test?
> > If yes, then you need contact with BIOS team for why the WMID_GUID3
> > method response 0xe2 when set device state, because this function works
> > find on my TravelMate 8572 machine.
> >
> > On the other hand,
> > The following is patch to check the ACER_CAP_WIRELESS before generate
> > wireless rfkill.
> >
> >
> > Thank's
> > Joey Lee
> >
> > >From 18c20f2b40bc64ec72b52ae2e4d994237173f982 Mon Sep 17 00:00:00 2001
> > From: Lee, Chun-Yi <jlee@suse.com>
> > Date: Thu, 11 Aug 2011 12:49:53 +0800
> > Subject: [PATCH] acer-wmi: check wireless capability flag before register rfkill
> >
> > There will be better to check the wireless capability flag
> > (ACER_CAP_WIRELESS) before register wireless rfkill because maybe
> > the machine doesn't have wifi module or the module removed by user.
> >
> > Signed-off-by: Lee, Chun-Yi <jlee@suse.com>
> > ---
> > drivers/platform/x86/acer-wmi.c | 64 +++++++++++++++++++++++++-------------
> > 1 files changed, 42 insertions(+), 22 deletions(-)
> >
> > diff --git a/drivers/platform/x86/acer-wmi.c b/drivers/platform/x86/acer-wmi.c
> > index 712a505..b4078c4 100644
> > --- a/drivers/platform/x86/acer-wmi.c
> > +++ b/drivers/platform/x86/acer-wmi.c
> > @@ -1289,12 +1289,13 @@ static void acer_rfkill_update(struct work_struct *ignored)
> > u32 state;
> > acpi_status status;
> >
> > - status = get_u32(&state, ACER_CAP_WIRELESS);
> > - if (ACPI_SUCCESS(status)) {
> > - if (quirks->wireless == 3) {
> > - rfkill_set_hw_state(wireless_rfkill, !state);
> > - } else {
> > - rfkill_set_sw_state(wireless_rfkill, !state);
> > + if (has_cap(ACER_CAP_WIRELESS)) {
> > + status = get_u32(&state, ACER_CAP_WIRELESS);
> > + if (ACPI_SUCCESS(status)) {
> > + if (quirks->wireless == 3)
> > + rfkill_set_hw_state(wireless_rfkill, !state);
> > + else
> > + rfkill_set_sw_state(wireless_rfkill, !state);
> > }
> > }
> >
> > @@ -1362,19 +1363,24 @@ static struct rfkill *acer_rfkill_register(struct device *dev,
> >
> > static int acer_rfkill_init(struct device *dev)
> > {
> > - wireless_rfkill = acer_rfkill_register(dev, RFKILL_TYPE_WLAN,
> > - "acer-wireless", ACER_CAP_WIRELESS);
> > - if (IS_ERR(wireless_rfkill))
> > - return PTR_ERR(wireless_rfkill);
> > + int err;
> > +
> > + if (has_cap(ACER_CAP_WIRELESS)) {
> > + wireless_rfkill = acer_rfkill_register(dev, RFKILL_TYPE_WLAN,
> > + "acer-wireless", ACER_CAP_WIRELESS);
> > + if (IS_ERR(wireless_rfkill)) {
> > + err = PTR_ERR(wireless_rfkill);
> > + goto error_wireless;
> > + }
> > + }
> >
> > if (has_cap(ACER_CAP_BLUETOOTH)) {
> > bluetooth_rfkill = acer_rfkill_register(dev,
> > RFKILL_TYPE_BLUETOOTH, "acer-bluetooth",
> > ACER_CAP_BLUETOOTH);
> > if (IS_ERR(bluetooth_rfkill)) {
> > - rfkill_unregister(wireless_rfkill);
> > - rfkill_destroy(wireless_rfkill);
> > - return PTR_ERR(bluetooth_rfkill);
> > + err = PTR_ERR(bluetooth_rfkill);
> > + goto error_bluetooth;
> > }
> > }
> >
> > @@ -1383,30 +1389,44 @@ static int acer_rfkill_init(struct device *dev)
> > RFKILL_TYPE_WWAN, "acer-threeg",
> > ACER_CAP_THREEG);
> > if (IS_ERR(threeg_rfkill)) {
> > - rfkill_unregister(wireless_rfkill);
> > - rfkill_destroy(wireless_rfkill);
> > - rfkill_unregister(bluetooth_rfkill);
> > - rfkill_destroy(bluetooth_rfkill);
> > - return PTR_ERR(threeg_rfkill);
> > + err = PTR_ERR(threeg_rfkill);
> > + goto error_threeg;
> > }
> > }
> >
> > rfkill_inited = true;
> >
> > - if (ec_raw_mode || !wmi_has_guid(ACERWMID_EVENT_GUID))
> > + if ((ec_raw_mode || !wmi_has_guid(ACERWMID_EVENT_GUID)) &&
> > + has_cap(ACER_CAP_WIRELESS | ACER_CAP_BLUETOOTH | ACER_CAP_THREEG))
> > schedule_delayed_work(&acer_rfkill_work,
> > round_jiffies_relative(HZ));
> >
> > return 0;
> > +
> > +error_threeg:
> > + if (has_cap(ACER_CAP_BLUETOOTH)) {
> > + rfkill_unregister(bluetooth_rfkill);
> > + rfkill_destroy(bluetooth_rfkill);
> > + }
> > +error_bluetooth:
> > + if (has_cap(ACER_CAP_WIRELESS)) {
> > + rfkill_unregister(wireless_rfkill);
> > + rfkill_destroy(wireless_rfkill);
> > + }
> > +error_wireless:
> > + return err;
> > }
> >
> > static void acer_rfkill_exit(void)
> > {
> > - if (ec_raw_mode || !wmi_has_guid(ACERWMID_EVENT_GUID))
> > + if ((ec_raw_mode || !wmi_has_guid(ACERWMID_EVENT_GUID)) &&
> > + has_cap(ACER_CAP_WIRELESS | ACER_CAP_BLUETOOTH | ACER_CAP_THREEG))
> > cancel_delayed_work_sync(&acer_rfkill_work);
> >
> > - rfkill_unregister(wireless_rfkill);
> > - rfkill_destroy(wireless_rfkill);
> > + if (has_cap(ACER_CAP_WIRELESS)) {
> > + rfkill_unregister(wireless_rfkill);
> > + rfkill_destroy(wireless_rfkill);
> > + }
> >
> > if (has_cap(ACER_CAP_BLUETOOTH)) {
> > rfkill_unregister(bluetooth_rfkill);
> > --
> > 1.6.0.2
> >
> >
> >
> >
>
>
>
> --
> Chia-Lin Kao(AceLan)
> http://blog.acelan.idv.tw/
> E-Mail: acelan.kaoATcanonical.com (s/AT/@/)
> --
> To unsubscribe from this list: send the line "unsubscribe platform-driver-x86" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 16+ messages in thread* Re: [Fwd: Re: A problem about acer-wmi]
2011-09-07 2:33 ` joeyli
@ 2011-09-07 5:29 ` AceLan Kao
0 siblings, 0 replies; 16+ messages in thread
From: AceLan Kao @ 2011-09-07 5:29 UTC (permalink / raw)
To: joeyli; +Cc: Joey Lee, platform-driver-x86
[-- Attachment #1: Type: text/plain, Size: 9597 bytes --]
Sure, here it is.
2011/9/7 joeyli <jlee@suse.com>:
> Hi AceLan,
>
> I am tracing a issue related to hotkey define.
> Could you please share dmidecode to me on your machine?
>
>
> Thank's a lot!
> Joey Lee
>
> 於 四,2011-08-11 於 15:45 +0800,AceLan Kao 提到:
>> Dear Joey,
>>
>> Good, that looks more reasonable to me.
>>
>> Yes, my machine has wifi module on it, but the wifi hotkey event is
>> handled by BIOS, so the wifi toggle works as expected.
>> I still got the failed message, but we can take it as a BIOS bug and
>> leave it there.
>>
>> BTW, your patches work well on my machine, thanks for your hard work.
>> You can have my signature on your patches.
>> Tested-by: AceLan Kao <acelan.kao@canonical.com>
>>
>> Best regards,
>> AceLan Kao.
>>
>> 2011/8/11 Joey Lee <jlee@novell.com>:
>> > 於 四,2011-08-11 於 03:30 +0000,joeyli(Joey Lee) 提到:
>> >> 於 四,2011-08-11 於 10:48 +0800,AceLan Kao 提到:
>> >> > Dear Joey,
>> >> >
>> >> > This is the dmesg log.
>> >> > [ 9010.944053] acer_wmi: Acer Laptop ACPI-WMI Extras
>> >> > [ 9010.944071] acer_wmi: Function bitmap for Communication Button: 0x1
>> >
>> > Per this log, the 0x1 means your machine have wifi hardware module and
>> > BIOS detected it then write information to SMBIOS area.
>> >
>> >> > [ 9010.944075] acer_wmi: Brightness must be controlled by generic video driver
>> >> > [ 9010.944996] input: Acer WMI hotkeys as /devices/virtual/input/input21
>> >> > [ 9010.947095] acer_wmi: Set Device Status failed: 0xe2 - 0x0
>> >> >
>> >
>> > But,
>> > here have problem when acer-wmi driver try to set the state by
>> > WMID_GUID3 method, the wmi function response 0xe2.
>> >
>> >> > And after adding my quirk, the set device status still failed, but
>> >> > except that, everything works well.
>> >> >
>> >>
>> >> So, you machine have wifi hardware module or not?
>> >>
>> >> > The "failed" comes from acer_rfkill_init(), it'll call
>> >> > acer_rfkill_register() with ACER_CAP_WIRELESS parameter without
>> >> > checking the capability.
>> >> > I don't know why only wifi doesn't check the capability and call
>> >> > acer_rfkill_register() directly, but it doesn't hurt the system.
>> >> >
>> >> > ===
>> >> > static int acer_rfkill_init(struct device *dev)
>> >> > {
>> >> > wireless_rfkill = acer_rfkill_register(dev, RFKILL_TYPE_WLAN,
>> >> > "acer-wireless", ACER_CAP_WIRELESS);
>> >> > if (IS_ERR(wireless_rfkill))
>> >> > return PTR_ERR(wireless_rfkill);
>> >> > ===
>> >> >
>> >> > Best regards,
>> >> > AceLan Kao.
>> >> >
>> >>
>> >> I checked the history, looks like it's just a original design in old
>> >> patch.
>> >>
>> >> Yes, you are right, add ACER_CAP_WIRELESS check is better. I am doing
>> >> generate a patch to add ACER_CAP_WIRELESS check.
>> >> Will attached patch on mail.
>> >>
>> >>
>> >> Thank's
>> >> Joey Lee
>> >>
>> >
>> > Please let me know does there have any wifi module in your machine when
>> > you test?
>> > If yes, then you need contact with BIOS team for why the WMID_GUID3
>> > method response 0xe2 when set device state, because this function works
>> > find on my TravelMate 8572 machine.
>> >
>> > On the other hand,
>> > The following is patch to check the ACER_CAP_WIRELESS before generate
>> > wireless rfkill.
>> >
>> >
>> > Thank's
>> > Joey Lee
>> >
>> > >From 18c20f2b40bc64ec72b52ae2e4d994237173f982 Mon Sep 17 00:00:00 2001
>> > From: Lee, Chun-Yi <jlee@suse.com>
>> > Date: Thu, 11 Aug 2011 12:49:53 +0800
>> > Subject: [PATCH] acer-wmi: check wireless capability flag before register rfkill
>> >
>> > There will be better to check the wireless capability flag
>> > (ACER_CAP_WIRELESS) before register wireless rfkill because maybe
>> > the machine doesn't have wifi module or the module removed by user.
>> >
>> > Signed-off-by: Lee, Chun-Yi <jlee@suse.com>
>> > ---
>> > drivers/platform/x86/acer-wmi.c | 64 +++++++++++++++++++++++++-------------
>> > 1 files changed, 42 insertions(+), 22 deletions(-)
>> >
>> > diff --git a/drivers/platform/x86/acer-wmi.c b/drivers/platform/x86/acer-wmi.c
>> > index 712a505..b4078c4 100644
>> > --- a/drivers/platform/x86/acer-wmi.c
>> > +++ b/drivers/platform/x86/acer-wmi.c
>> > @@ -1289,12 +1289,13 @@ static void acer_rfkill_update(struct work_struct *ignored)
>> > u32 state;
>> > acpi_status status;
>> >
>> > - status = get_u32(&state, ACER_CAP_WIRELESS);
>> > - if (ACPI_SUCCESS(status)) {
>> > - if (quirks->wireless == 3) {
>> > - rfkill_set_hw_state(wireless_rfkill, !state);
>> > - } else {
>> > - rfkill_set_sw_state(wireless_rfkill, !state);
>> > + if (has_cap(ACER_CAP_WIRELESS)) {
>> > + status = get_u32(&state, ACER_CAP_WIRELESS);
>> > + if (ACPI_SUCCESS(status)) {
>> > + if (quirks->wireless == 3)
>> > + rfkill_set_hw_state(wireless_rfkill, !state);
>> > + else
>> > + rfkill_set_sw_state(wireless_rfkill, !state);
>> > }
>> > }
>> >
>> > @@ -1362,19 +1363,24 @@ static struct rfkill *acer_rfkill_register(struct device *dev,
>> >
>> > static int acer_rfkill_init(struct device *dev)
>> > {
>> > - wireless_rfkill = acer_rfkill_register(dev, RFKILL_TYPE_WLAN,
>> > - "acer-wireless", ACER_CAP_WIRELESS);
>> > - if (IS_ERR(wireless_rfkill))
>> > - return PTR_ERR(wireless_rfkill);
>> > + int err;
>> > +
>> > + if (has_cap(ACER_CAP_WIRELESS)) {
>> > + wireless_rfkill = acer_rfkill_register(dev, RFKILL_TYPE_WLAN,
>> > + "acer-wireless", ACER_CAP_WIRELESS);
>> > + if (IS_ERR(wireless_rfkill)) {
>> > + err = PTR_ERR(wireless_rfkill);
>> > + goto error_wireless;
>> > + }
>> > + }
>> >
>> > if (has_cap(ACER_CAP_BLUETOOTH)) {
>> > bluetooth_rfkill = acer_rfkill_register(dev,
>> > RFKILL_TYPE_BLUETOOTH, "acer-bluetooth",
>> > ACER_CAP_BLUETOOTH);
>> > if (IS_ERR(bluetooth_rfkill)) {
>> > - rfkill_unregister(wireless_rfkill);
>> > - rfkill_destroy(wireless_rfkill);
>> > - return PTR_ERR(bluetooth_rfkill);
>> > + err = PTR_ERR(bluetooth_rfkill);
>> > + goto error_bluetooth;
>> > }
>> > }
>> >
>> > @@ -1383,30 +1389,44 @@ static int acer_rfkill_init(struct device *dev)
>> > RFKILL_TYPE_WWAN, "acer-threeg",
>> > ACER_CAP_THREEG);
>> > if (IS_ERR(threeg_rfkill)) {
>> > - rfkill_unregister(wireless_rfkill);
>> > - rfkill_destroy(wireless_rfkill);
>> > - rfkill_unregister(bluetooth_rfkill);
>> > - rfkill_destroy(bluetooth_rfkill);
>> > - return PTR_ERR(threeg_rfkill);
>> > + err = PTR_ERR(threeg_rfkill);
>> > + goto error_threeg;
>> > }
>> > }
>> >
>> > rfkill_inited = true;
>> >
>> > - if (ec_raw_mode || !wmi_has_guid(ACERWMID_EVENT_GUID))
>> > + if ((ec_raw_mode || !wmi_has_guid(ACERWMID_EVENT_GUID)) &&
>> > + has_cap(ACER_CAP_WIRELESS | ACER_CAP_BLUETOOTH | ACER_CAP_THREEG))
>> > schedule_delayed_work(&acer_rfkill_work,
>> > round_jiffies_relative(HZ));
>> >
>> > return 0;
>> > +
>> > +error_threeg:
>> > + if (has_cap(ACER_CAP_BLUETOOTH)) {
>> > + rfkill_unregister(bluetooth_rfkill);
>> > + rfkill_destroy(bluetooth_rfkill);
>> > + }
>> > +error_bluetooth:
>> > + if (has_cap(ACER_CAP_WIRELESS)) {
>> > + rfkill_unregister(wireless_rfkill);
>> > + rfkill_destroy(wireless_rfkill);
>> > + }
>> > +error_wireless:
>> > + return err;
>> > }
>> >
>> > static void acer_rfkill_exit(void)
>> > {
>> > - if (ec_raw_mode || !wmi_has_guid(ACERWMID_EVENT_GUID))
>> > + if ((ec_raw_mode || !wmi_has_guid(ACERWMID_EVENT_GUID)) &&
>> > + has_cap(ACER_CAP_WIRELESS | ACER_CAP_BLUETOOTH | ACER_CAP_THREEG))
>> > cancel_delayed_work_sync(&acer_rfkill_work);
>> >
>> > - rfkill_unregister(wireless_rfkill);
>> > - rfkill_destroy(wireless_rfkill);
>> > + if (has_cap(ACER_CAP_WIRELESS)) {
>> > + rfkill_unregister(wireless_rfkill);
>> > + rfkill_destroy(wireless_rfkill);
>> > + }
>> >
>> > if (has_cap(ACER_CAP_BLUETOOTH)) {
>> > rfkill_unregister(bluetooth_rfkill);
>> > --
>> > 1.6.0.2
>> >
>> >
>> >
>> >
>>
>>
>>
>> --
>> Chia-Lin Kao(AceLan)
>> http://blog.acelan.idv.tw/
>> E-Mail: acelan.kaoATcanonical.com (s/AT/@/)
>> --
>> To unsubscribe from this list: send the line "unsubscribe platform-driver-x86" in
>> the body of a message to majordomo@vger.kernel.org
>> More majordomo info at http://vger.kernel.org/majordomo-info.html
>
>
>
--
Chia-Lin Kao(AceLan)
http://blog.acelan.idv.tw/
E-Mail: acelan.kaoATcanonical.com (s/AT/@/)
[-- Attachment #2: dmidecode.log --]
[-- Type: text/x-log, Size: 14527 bytes --]
# dmidecode 2.9
SMBIOS 2.6 present.
51 structures occupying 2384 bytes.
Table at 0x000E9AE0.
Handle 0x0000, DMI type 0, 24 bytes
BIOS Information
Vendor: INSYDE
Version: V1.05TD
Release Date: 07/25/2011
ROM Size: 2048 kB
Characteristics:
PCI is supported
BIOS is upgradeable
BIOS shadowing is allowed
Boot from CD is supported
Selectable boot is supported
EDD is supported
Japanese floppy for NEC 9800 1.2 MB is supported (int 13h)
Japanese floppy for Toshiba 1.2 MB is supported (int 13h)
5.25"/360 KB floppy services are supported (int 13h)
5.25"/1.2 MB floppy services are supported (int 13h)
3.5"/720 KB floppy services are supported (int 13h)
3.5"/2.88 MB floppy services are supported (int 13h)
8042 keyboard services are supported (int 9h)
CGA/mono video services are supported (int 10h)
ACPI is supported
USB legacy is supported
BIOS boot specification is supported
Targeted content distribution is supported
BIOS Revision: 5.152
Handle 0x0001, DMI type 1, 27 bytes
System Information
Manufacturer: eMachines
Product Name: AS4739Z
Version: V1.05TD
Serial Number: S2RK302002110078222500
UUID: BBAFC2DE-DA16-4E63-A218-60EB69E6F69B
Wake-up Type: Power Switch
SKU Number: Calpella_CRB
Family: Intel_Mobile
Handle 0x0002, DMI type 2, 16 bytes
Base Board Information
Manufacturer: eMachines
Product Name: HMA_CP
Version: Base Board Version
Serial Number: 110FCECMBQT00007
Asset Tag: Base Board Asset Tag
Features:
Board is a hosting board
Board is replaceable
Location In Chassis: Base Board Chassis Location
Chassis Handle: 0x0003
Type: Motherboard
Contained Object Handles: 0
Handle 0x0003, DMI type 3, 23 bytes
Chassis Information
Manufacturer: Chassis Manufacturer
Type: Notebook
Lock: Not Present
Version: Chassis Version
Serial Number: Chassis Serial Number
Asset Tag:
Boot-up State: Safe
Power Supply State: Safe
Thermal State: Safe
Security Status: None
OEM Information: 0x00000000
Height: Unspecified
Number Of Power Cords: 1
Contained Elements: 0
Handle 0x0004, DMI type 9, 17 bytes
System Slot Information
Designation: J5C1
Type: x16 <OUT OF SPEC>
Current Usage: Available
Length: Other
Characteristics:
PME signal is supported
Hot-plug devices are supported
Handle 0x0005, DMI type 9, 17 bytes
System Slot Information
Designation: J6C1
Type: x1 <OUT OF SPEC>
Current Usage: Available
Length: Other
Characteristics:
PME signal is supported
Hot-plug devices are supported
Handle 0x0006, DMI type 9, 17 bytes
System Slot Information
Designation: J6C2
Type: x1 <OUT OF SPEC>
Current Usage: Available
Length: Other
Characteristics:
PME signal is supported
Hot-plug devices are supported
Handle 0x0007, DMI type 9, 17 bytes
System Slot Information
Designation: J6D2
Type: x1 <OUT OF SPEC>
Current Usage: Available
Length: Other
Characteristics:
PME signal is supported
Hot-plug devices are supported
Handle 0x0008, DMI type 9, 17 bytes
System Slot Information
Designation: J7C1
Type: x1 <OUT OF SPEC>
Current Usage: Available
Length: Other
Characteristics:
PME signal is supported
Hot-plug devices are supported
Handle 0x0009, DMI type 9, 17 bytes
System Slot Information
Designation: J7D2
Type: x1 <OUT OF SPEC>
Current Usage: Available
Length: Other
Characteristics:
PME signal is supported
Hot-plug devices are supported
Handle 0x000A, DMI type 9, 17 bytes
System Slot Information
Designation: J8C2
Type: x16 <OUT OF SPEC>
Current Usage: Available
Length: Other
Characteristics:
PME signal is supported
Hot-plug devices are supported
Handle 0x000B, DMI type 9, 17 bytes
System Slot Information
Designation: J8C1
Type: x1 <OUT OF SPEC>
Current Usage: Available
Length: Other
Characteristics:
PME signal is supported
Hot-plug devices are supported
Handle 0x000C, DMI type 11, 5 bytes
OEM Strings
String 1: String1 for Original Equipment Manufacturer
String 2: String2 for Original Equipment Manufacturer
String 3: String3 for Original Equipment Manufacturer
String 4: String4 for Original Equipment Manufacturer
String 5: String5 for Original Equipment Manufacturer
Handle 0x000D, DMI type 12, 5 bytes
System Configuration Options
Option 1:
Option 2: String2 for Type12 Equipment Manufacturer
Option 3: String3 for Type12 Equipment Manufacturer
Option 4: String4 for Type12 Equipment Manufacturer
Handle 0x000E, DMI type 21, 7 bytes
Built-in Pointing Device
Type: Touch Pad
Interface: PS/2
Buttons: 4
Handle 0x000F, DMI type 27, 15 bytes
Cooling Device
Type: Fan
Status: OK
OEM-specific Information: 0x00000000
Nominal Speed: 2000 rpm
Handle 0x0010, DMI type 32, 20 bytes
System Boot Information
Status: No errors detected
Handle 0x0011, DMI type 39, 22 bytes
System Power Supply
Location: OEM_Define0
Name: OEM_Define1
Manufacturer: OEM_Define2
Serial Number: OEM_Define3
Asset Tag: OEM_Define4
Model Part Number: OEM_Define5
Revision: OEM_Define6
Max Power Capacity: 0.075 W
Status: Present, OK
Type: Regulator
Input Voltage Range Switching: Auto-switch
Plugged: No
Hot Replaceable: No
Cooling Device Handle: 0x000F
Handle 0x0012, DMI type 40, 18 bytes
Unknown Type
Header and Data:
28 12 12 00 02 06 04 00 05 01 AA 07 00 00 05 02
DC 05
Strings:
PCIExpressx16
Compiler Version: VC 9.0
Handle 0x0013, DMI type 41, 11 bytes
Unknown Type
Header and Data:
29 0B 13 00 01 85 01 00 00 00 01
Strings:
Hanksville Gbe Lan Connection
Handle 0x0014, DMI type 22, 26 bytes
Portable Battery
Location: Fake
Manufacturer: -Virtual Battery 0-
Manufacture Date: 10/12/2007
Serial Number: Battery 0
Name: CRB Battery 0
Chemistry: Lithium Ion
Design Capacity: Unknown
Design Voltage: Unknown
SBDS Version: Not Specified
Maximum Error: Unknown
OEM-specific Information: 0x00000000
Handle 0x0015, DMI type 136, 6 bytes
OEM-specific Type
Header and Data:
88 06 15 00 5A 5A
Handle 0x0016, DMI type 129, 8 bytes
OEM-specific Type
Header and Data:
81 08 16 00 01 01 02 01
Strings:
Intel_ASF
Intel_ASF_001
Handle 0x0017, DMI type 130, 20 bytes
OEM-specific Type
Header and Data:
82 14 17 00 24 41 4D 54 01 01 01 01 01 A5 1F 02
00 00 00 00
Handle 0x0018, DMI type 16, 23 bytes
Physical Memory Array
Location: System Board Or Motherboard
Use: System Memory
Error Correction Type: None
Maximum Capacity: 16 GB
Error Information Handle: No Error
Number Of Devices: 2
Handle 0x0019, DMI type 17, 34 bytes
Memory Device
Array Handle: 0x0018
Error Information Handle: 0x001B
Total Width: 64 bits
Data Width: 64 bits
Size: 1024 MB
Form Factor: SODIMM
Set: None
Locator: DIMM0
Bank Locator: BANK 0
Type: <OUT OF SPEC>
Type Detail: Synchronous
Speed: 1067 MHz (0.9 ns)
Manufacturer: Not Specified
Serial Number: ED015413
Asset Tag: Unknown
Part Number: NT1GC64BH4B0PS-CG
Handle 0x001A, DMI type 6, 12 bytes
Memory Module Information
Socket Designation: DIMM0
Bank Connections: None
Current Speed: Unknown
Type: DIMM
Installed Size: 1024 MB (Single-bank Connection)
Enabled Size: 1024 MB (Single-bank Connection)
Error Status: OK
Handle 0x001B, DMI type 18, 23 bytes
32-bit Memory Error Information
Type: OK
Granularity: Unknown
Operation: Unknown
Vendor Syndrome: Unknown
Memory Array Address: Unknown
Device Address: Unknown
Resolution: Unknown
Handle 0x001C, DMI type 20, 35 bytes
Memory Device Mapped Address
Starting Address: 0x00000000000
Ending Address: 0x0003FFFFFFF
Range Size: 1 GB
Physical Device Handle: 0x0019
Memory Array Mapped Address Handle: 0x0028
Partition Row Position: Unknown
Interleave Position: 1
Interleaved Data Depth: 1
Handle 0x001D, DMI type 17, 34 bytes
Memory Device
Array Handle: 0x0018
Error Information Handle: Not Provided
Total Width: 8 bits
Data Width: 8 bits
Size: No Module Installed
Form Factor: DIMM
Set: None
Locator: DIMM1
Bank Locator: BANK 1
Type: <OUT OF SPEC>
Type Detail: Synchronous
Speed: 1067 MHz (0.9 ns)
Manufacturer: Not Specified
Serial Number: 00000000
Asset Tag: Unknown
Part Number: Not Specified
Handle 0x001E, DMI type 6, 12 bytes
Memory Module Information
Socket Designation: DIMM1
Bank Connections: None
Current Speed: Unknown
Type: DIMM
Installed Size: Not Installed
Enabled Size: Not Installed
Error Status: OK
Handle 0x001F, DMI type 18, 23 bytes
32-bit Memory Error Information
Type: OK
Granularity: Unknown
Operation: Unknown
Vendor Syndrome: Unknown
Memory Array Address: Unknown
Device Address: Unknown
Resolution: Unknown
Handle 0x0020, DMI type 17, 34 bytes
Memory Device
Array Handle: 0x0018
Error Information Handle: 0x0022
Total Width: 64 bits
Data Width: 64 bits
Size: 1024 MB
Form Factor: SODIMM
Set: None
Locator: DIMM1
Bank Locator: BANK 2
Type: <OUT OF SPEC>
Type Detail: Synchronous
Speed: 1067 MHz (0.9 ns)
Manufacturer: Not Specified
Serial Number: AB40D41A
Asset Tag: Unknown
Part Number: NT1GC64BH4B0PS-CG
Handle 0x0021, DMI type 6, 12 bytes
Memory Module Information
Socket Designation: DIMM1
Bank Connections: None
Current Speed: Unknown
Type: DIMM
Installed Size: 1024 MB (Single-bank Connection)
Enabled Size: 1024 MB (Single-bank Connection)
Error Status: OK
Handle 0x0022, DMI type 18, 23 bytes
32-bit Memory Error Information
Type: OK
Granularity: Unknown
Operation: Unknown
Vendor Syndrome: Unknown
Memory Array Address: Unknown
Device Address: Unknown
Resolution: Unknown
Handle 0x0023, DMI type 20, 35 bytes
Memory Device Mapped Address
Starting Address: 0x00000000000
Ending Address: 0x0003FFFFFFF
Range Size: 1 GB
Physical Device Handle: 0x0020
Memory Array Mapped Address Handle: 0x0028
Partition Row Position: Unknown
Interleave Position: 2
Interleaved Data Depth: 1
Handle 0x0024, DMI type 17, 34 bytes
Memory Device
Array Handle: 0x0018
Error Information Handle: Not Provided
Total Width: 8 bits
Data Width: 8 bits
Size: No Module Installed
Form Factor: DIMM
Set: None
Locator: DIMM3
Bank Locator: BANK 3
Type: <OUT OF SPEC>
Type Detail: Synchronous
Speed: 1067 MHz (0.9 ns)
Manufacturer: Not Specified
Serial Number: 00000000
Asset Tag: Unknown
Part Number: Not Specified
Handle 0x0025, DMI type 6, 12 bytes
Memory Module Information
Socket Designation: DIMM3
Bank Connections: None
Current Speed: Unknown
Type: DIMM
Installed Size: Not Installed
Enabled Size: Not Installed
Error Status: OK
Handle 0x0026, DMI type 18, 23 bytes
32-bit Memory Error Information
Type: OK
Granularity: Unknown
Operation: Unknown
Vendor Syndrome: Unknown
Memory Array Address: Unknown
Device Address: Unknown
Resolution: Unknown
Handle 0x0027, DMI type 18, 23 bytes
32-bit Memory Error Information
Type: OK
Granularity: Unknown
Operation: Unknown
Vendor Syndrome: Unknown
Memory Array Address: Unknown
Device Address: Unknown
Resolution: Unknown
Handle 0x0028, DMI type 19, 31 bytes
Memory Array Mapped Address
Starting Address: 0x00000000000
Ending Address: 0x0007FFFFFFF
Range Size: 2 GB
Physical Array Handle: 0x0018
Partition Width: 0
Handle 0x0029, DMI type 5, 20 bytes
Memory Controller Information
Error Detecting Method: None
Error Correcting Capabilities:
Unknown
None
Supported Interleave: One-way Interleave
Current Interleave: One-way Interleave
Maximum Memory Module Size: 8192 MB
Maximum Total Memory Size: 16384 MB
Supported Speeds:
Other
Supported Memory Types:
Other
Memory Module Voltage: Unknown
Associated Memory Slots: 2
0x001A
0x0021
Enabled Error Correcting Capabilities:
None
Handle 0x002A, DMI type 4, 42 bytes
Processor Information
Socket Designation: CPU
Type: Central Processor
Family: <OUT OF SPEC>
Manufacturer: Intel(R) Corporation
ID: 55 06 02 00 FF FB EB BF
Version: Intel(R) Pentium(R) CPU P6200 @ 2.13GHz
Voltage: 0.0 V
External Clock: 1066 MHz
Max Speed: 2133 MHz
Current Speed: 2131 MHz
Status: Populated, Enabled
Upgrade: ZIF Socket
L1 Cache Handle: 0x002E
L2 Cache Handle: 0x002D
L3 Cache Handle: 0x002B
Serial Number: Not Specified
Asset Tag: FFFF
Part Number: Not Specified
Core Count: 2
Core Enabled: 2
Thread Count: 2
Characteristics:
64-bit capable
Handle 0x002B, DMI type 7, 19 bytes
Cache Information
Socket Designation: L3 Cache
Configuration: Enabled, Not Socketed, Level 3
Operational Mode: Write Through
Location: Internal
Installed Size: 3072 KB
Maximum Size: 3072 KB
Supported SRAM Types:
Synchronous
Installed SRAM Type: Synchronous
Speed: Unknown
Error Correction Type: Single-bit ECC
System Type: Unified
Associativity: Other
Handle 0x002C, DMI type 7, 19 bytes
Cache Information
Socket Designation: L1 Cache
Configuration: Enabled, Not Socketed, Level 1
Operational Mode: Write Through
Location: Internal
Installed Size: 32 KB
Maximum Size: 32 KB
Supported SRAM Types:
Synchronous
Installed SRAM Type: Synchronous
Speed: Unknown
Error Correction Type: Single-bit ECC
System Type: Data
Associativity: 8-way Set-associative
Handle 0x002D, DMI type 7, 19 bytes
Cache Information
Socket Designation: L2 Cache
Configuration: Enabled, Not Socketed, Level 2
Operational Mode: Write Through
Location: Internal
Installed Size: 256 KB
Maximum Size: 256 KB
Supported SRAM Types:
Synchronous
Installed SRAM Type: Synchronous
Speed: Unknown
Error Correction Type: Single-bit ECC
System Type: Unified
Associativity: 8-way Set-associative
Handle 0x002E, DMI type 7, 19 bytes
Cache Information
Socket Designation: L1 Cache
Configuration: Enabled, Not Socketed, Level 1
Operational Mode: Write Through
Location: Internal
Installed Size: 32 KB
Maximum Size: 32 KB
Supported SRAM Types:
Synchronous
Installed SRAM Type: Synchronous
Speed: Unknown
Error Correction Type: Single-bit ECC
System Type: Instruction
Associativity: 4-way Set-associative
Handle 0x002F, DMI type 170, 106 bytes
OEM-specific Type
Header and Data:
AA 6A 2F 00 01 00 00 00 7F 00 0F 00 06 00 01 02
01 00 41 02 04 00 42 02 08 00 43 02 10 00 44 02
20 00 45 02 40 00 46 02 01 00 47 02 02 00 61 02
08 00 62 02 04 00 63 02 01 00 64 02 02 00 81 02
04 00 82 02 02 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00
Handle 0x0030, DMI type 171, 24 bytes
OEM-specific Type
Header and Data:
AB 18 30 00 02 69 19 62 20 04 02 04 75 76 05 86
80 56 3B 07 8C 16 32 00
Handle 0x0031, DMI type 172, 6 bytes
OEM-specific Type
Header and Data:
AC 06 31 00 02 04
Handle 0x0032, DMI type 127, 4 bytes
End Of Table
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [Fwd: Re: A problem about acer-wmi]
@ 2011-08-11 3:30 Joey Lee
0 siblings, 0 replies; 16+ messages in thread
From: Joey Lee @ 2011-08-11 3:30 UTC (permalink / raw)
To: acelan; +Cc: Joey Lee, platform-driver-x86
於 四,2011-08-11 於 10:48 +0800,AceLan Kao 提到:
> Dear Joey,
>
> This is the dmesg log.
> [ 9010.944053] acer_wmi: Acer Laptop ACPI-WMI Extras
> [ 9010.944071] acer_wmi: Function bitmap for Communication Button: 0x1
> [ 9010.944075] acer_wmi: Brightness must be controlled by generic video driver
> [ 9010.944996] input: Acer WMI hotkeys as /devices/virtual/input/input21
> [ 9010.947095] acer_wmi: Set Device Status failed: 0xe2 - 0x0
>
> And after adding my quirk, the set device status still failed, but
> except that, everything works well.
>
So, you machine have wifi hardware module or not?
> The "failed" comes from acer_rfkill_init(), it'll call
> acer_rfkill_register() with ACER_CAP_WIRELESS parameter without
> checking the capability.
> I don't know why only wifi doesn't check the capability and call
> acer_rfkill_register() directly, but it doesn't hurt the system.
>
> ===
> static int acer_rfkill_init(struct device *dev)
> {
> wireless_rfkill = acer_rfkill_register(dev, RFKILL_TYPE_WLAN,
> "acer-wireless", ACER_CAP_WIRELESS);
> if (IS_ERR(wireless_rfkill))
> return PTR_ERR(wireless_rfkill);
> ===
>
> Best regards,
> AceLan Kao.
>
I checked the history, looks like it's just a original design in old
patch.
Yes, you are right, add ACER_CAP_WIRELESS check is better. I am doing
generate a patch to add ACER_CAP_WIRELESS check.
Will attached patch on mail.
Thank's
Joey Lee
> 2011/8/10 Joey Lee <jlee@novell.com>:
> > Hi AceLan,
> >
> > 於 三,2011-08-10 於 10:13 +0800,joeyli 提到:
> >> 於 二,2011-08-09 於 14:33 +0800,AceLan Kao 提到:
> >> > Dear Joey,
> >> >
> >> > The current project we have right now have to follow the Acer WMI to
> >> > handle the key events, that means no EC key event.
> >> > And we have 3 keys that are not working now, they are touchpad
> > toggle,
> >> > brightness up, and brightness down.
> >> > The touchpad toggle function is a Hotkey Break Event(function number
> >> > 0x2), and brightness key events are Brightness Change Event(function
> >> > number 0x4). But now acer-wmi driver only handles General Hotkey
> >> > Event(function number 0x1).
> >> >
> >>
> >> Yes, current acer-wmi only capture the event function number 0x1, you
> >> can add those new function to acer_wmi_notify().
> >>
> >> > I just implemented those 3 key events, so I think maybe we don't
> > have
> >> > to create a new acer-wmi driver.
> >>
> >> Great! Welcome for you patches, I will also test it.
> >>
> >> > I'm longing for your work to clear up the acer-wmi driver, so that I
> >> > can add the new machine id and send you the patch.
> >> > Thanks.
> >> >
> >> > BTW, I'm available to help if you are too busy to do that.
> >> >
> >> > Best regards,
> >> > AceLan Kao.
> >> >
> >>
> >> I am doing the clear up, now, will send out patch (I hope today).
> >>
> >>
> >> Thank's
> >> Joey Lee
> >>
> >
> > I add a new ACER_WMID_v2 interface flag and do some clear up in acer-wmi
> > initial function and get_u32 functions.
> >
> > Please kindly test this patch:
> >
> >
> > Thank's
> > Joey Lee
> >
> > >From 28b2e2ebaa230d339d5749b581c667ed074bb7ea Mon Sep 17 00:00:00 2001
> > From: Lee, Chun-Yi <jlee@suse.com>
> > Date: Wed, 10 Aug 2011 16:36:02 +0800
> > Subject: [PATCH] acer-wmi: add ACER_WMID_v2 interface flag to represent new notebooks
> >
> > There have new acer notebooks' BIOS provide new WMID_GUID3 and
> > ACERWMID_EVENT_GUID methods.
> >
> > Some of machines still keep the old WMID_GUID1 method but more and
> > more machines were already removed old wmi methods from DSDT.
> >
> > So, this patch add a new ACER_WMID_v2 interface flag to represent
> > new acer notebooks, the following is definition:
> >
> > + ACER_WMID:
> > It means this machine only provides WMID_GUID1/2 methods.
> >
> > + ACER_WMID_v2:
> > It means this machine provide new WMID_GUID3 and WMID_EVENT_GUID
> > methods.
> > Some ACER_> > but we still query/set communication device's state by new
> > WMID_GUID3 method.
> >
> > Tested on Acer Travelmate 8572
> >
> > Signed-off-by: Lee, Chun-Yi <jlee@suse.com>
> > ---
> > drivers/platform/x86/acer-wmi.c | 409 ++++++++++++++++++++-------------------
> > 1 files changed, 211 insertions(+), 198 deletions(-)
> >
> > diff --git a/drivers/platform/x86/acer-wmi.c b/drivers/platform/x86/acer-wmi.c
> > index af2bb20..712a505 100644
> > --- a/drivers/platform/x86/acer-wmi.c
> > +++ b/drivers/platform/x86/acer-wmi.c
> > @@ -190,6 +190,7 @@ enum interface_flags {
> > ACER_AMW0,
> > ACER_AMW0_V2,
> > ACER_WMID,
> > + ACER_WMID_v2,
> > };
> >
> > #define ACER_DEFAULT_WIRELESS 0
> > @@ -868,6 +869,176 @@ static acpi_status WMID_set_u32(u32 value, u32 cap, struct wmi_interface *iface)
> > return WMI_execute_u32(method_id, (u32)value, NULL);
> > }
> >
> > +static acpi_status wmid3_get_device_status(u32 *value, u16 device)
> > +{
> > + struct wmid3_gds_return_value return_value;
> > + acpi_status status;
> > + union acpi_object *obj;
> > + struct wmid3_gds_input_param params = {
> > + .function_num = 0x1,
> > + .hotkey_number = 0x01,
> > + .devices = device,
> > + };
> > + struct acpi_buffer input = {
> > + sizeof(struct wmid3_gds_input_param),
> > + ¶ms
> > + };
> > + struct acpi_buffer output = { ACPI_ALLOCATE_BUFFER, NULL };
> > +
> > + status = wmi_evaluate_method(WMID_GUID3, 0, 0x2, &input, &output);
> > + if (ACPI_FAILURE(status))
> > + return status;
> > +
> > + obj = output.pointer;
> > +
> > + if (!obj)
> > + return AE_ERROR;
> > + else if (obj->type != ACPI_TYPE_BUFFER) {
> > + kfree(obj);
> > + return AE_ERROR;
> > + }
> > + if (obj->buffer.length != 8) {
> > + pr_warn("Unknown buffer length %d\n", obj->buffer.length);
> > + kfree(obj);
> > + return AE_ERROR;
> > + }
> > +
> > + return_value = *((struct wmid3_gds_return_value *)obj->buffer.pointer);
> > + kfree(obj);
> > +
> > + if (return_value.error_code || return_value.ec_return_value)
> > + pr_warn("Get Device Status failed: 0x%x - 0x%x\n",
> > + return_value.error_code,
> > + return_value.ec_return_value);
> > + else
> > + *value = !!(return_value.devices & device);
> > +
> > + return status;
> > +}
> > +
> > +static acpi_status wmid_v2_get_u32(u32 *value, u32 cap)
> > +{
> > + u16 device;
> > +
> > + switch (cap) {
> > + case ACER_CAP_WIRELESS:
> > + device = ACER_WMID3_GDS_WIRELESS;
> > + break;
> > + case ACER_CAP_BLUETOOTH:
> > + device = ACER_WMID3_GDS_BLUETOOTH;
> > + break;
> > + case ACER_CAP_THREEG:
> > + device = ACER_WMID3_GDS_THREEG;
> > + break;
> > + default:
> > + return AE_ERROR;
> > + }
> > + return wmid3_get_device_status(value, device);
> > +}
> > +
> > +static acpi_status wmid3_set_device_status(u32 value, u16 device)
> > +{
> > + struct wmid3_gds_return_value return_value;
> > + acpi_status status;
> > + union acpi_object *obj;
> > + u16 devices;
> > + struct wmid3_gds_input_param params = {
> > + .function_num = 0x1,
> > + .hotkey_number = 0x01,
> > + .devices = ACER_WMID3_GDS_WIRELESS |
> > + ACER_WMID3_GDS_THREEG |
> > + ACER_WMID3_GDS_WIMAX |
> > + ACER_WMID3_GDS_BLUETOOTH,
> > + };
> > + struct acpi_buffer input = {
> > + sizeof(struct wmid3_gds_input_param),
> > + > > + struct acpi_buffer output2 = { ACPI_ALLOCATE_BUFFER, NULL };
> > +
> > + status = wmi_evaluate_method(WMID_GUID3, 0, 0x2, &input, &output);
> > + if (ACPI_FAILURE(status))
> > + return status;
> > +
> > + obj = output.pointer;
> > +
> > + if (!obj)
> > + return AE_ERROR;
> > + else if (obj->type != ACPI_TYPE_BUFFER) {
> > + kfree(obj);
> > + return AE_ERROR;
> > + }
> > + if (obj->buffer.length != 8) {
> > + pr_warning("Unknown buffer length %d\n", obj->buffer.length);
> > + kfree(obj);
> > + return AE_ERROR;
> > + }
> > +
> > + return_value = *((struct wmid3_gds_return_value *)obj->buffer.pointer);
> > + kfree(obj);
> > +
> > + if (return_value.error_code || return_value.ec_return_value) {
> > + pr_warning("Get Current Device Status failed: "
> > + "0x%x - 0x%x\n", return_value.error_code,
> > + return_value.ec_return_value);
> > + return status;
> > + }
> > +
> > + devices = return_value.devices;
> > + params.function_num = 0x2;
> > + params.hotkey_number = 0x01;
> > + params.devices = (value) ? (devices | device) : (devices & ~device);
> > +
> > + status = wmi_evaluate_method(WMID_GUID3, 0, 0x1, &input, &output2);
> > + if (ACPI_FAILURE(status))
> > + return status;
> > +
> > + obj = output2.pointer;
> > +
> > + if (!obj)
> > + return AE_ERROR;
> > + else if (obj->type != ACPI_TYPE_BUFFER) {
> > + kfree(obj);
> > + return AE_ERROR;
> > + }
> > + if (obj->buffer.length != 4) {
> > + pr_warning("Unknown buffer length %d\n", obj->buffer.length);
> > + kfree(obj);
> > + return AE_ERROR;
> > + }
> > +
> > + return_value = *((struct wmid3_gds_return_value *)obj->buffer.pointer);
> > + kfree(obj);
> > +
> > + if (return_value.error_code || return_value.ec_return_value)
> > + pr_warning("Set Device Status failed: "
> > + "0x%x - 0x%x\n", return_value.error_code,
> > + return_value.ec_return_value);
> > +
> > + return status;
> > +}
> > +
> > +static acpi_status wmid_v2_set_u32(u32 value, u32 cap)
> > +{
> > + u16 device;
> > +
> > + switch (cap) {
> > + case ACER_CAP_WIRELESS:
> > + device = ACER_WMID3_GDS_WIRELESS;
> > + break;
> > + case ACER_CAP_BLUETOOTH:
> > + device = ACER_WMID3_GDS_BLUETOOTH;
> > + break;
> > + case ACER_CAP_THREEG:
> > + device = ACER_WMID3_GDS_THREEG;
> > + break;
> > + default:
> > + return AE_ERROR;
> > + }
> > + return wmid3_set_device_status(value, device);
> > +}
> > +
> > static void type_aa_dmi_decode(const struct dmi_header *header, void *dummy)
> > {
> > struct hotkey_function_type_aa *type_aa;
> > @@ -913,17 +1084,11 @@ static acpi_status WMID_set_capabilities(void)
> > return AE_ERROR;
> > }
> >
> > - dmi_walk(type_aa_dmi_decode, NULL);
> > - if (!has_type_aa) {
> > - interface->capability |= ACER_CAP_WIRELESS;
> > - if (devices & 0x40)
> > - interface->capability |= ACER_CAP_THREEG;
> > - if (devices & 0x10)
> > - interface->capability |= ACER_CAP_BLUETOOTH;
> > - }
> > -
> > - /* WMID always provides brightness methods */
> > - interface->capability |= ACER_CAP_BRIGHTNESS;
> > + interface->capability |= ACER_CAP_WIRELESS;
> > + if (devices & 0x40)
> > + interface->capability |= ACER_CAP_THREEG;
> > + if (devices & 0x10)
> > + interface->capability |= A> > @@ -936,6 +1101,10 @@ static struct wmi_interface wmid_interface = {
> > .type = ACER_WMID,
> > };
> >
> > +static struct wmi_interface wmid_v2_interface = {
> > + .type = ACER_WMID_v2,
> > +};
> > +
> > /*
> > * Generic Device (interface-independent)
> > */
> > @@ -956,6 +1125,14 @@ static acpi_status get_u32(u32 *value, u32 cap)
> > case ACER_WMID:
> > status = WMID_get_u32(value, cap, interface);
> > break;
> > + case ACER_WMID_v2:
> > + if (cap & (ACER_CAP_WIRELESS |
> > + ACER_CAP_BLUETOOTH |
> > + ACER_CAP_THREEG))
> > + status = wmid_v2_get_u32(value, cap);
> > + else if (wmi_has_guid(WMID_GUID2))
> > + status = WMID_get_u32(value, cap, interface);
> > + break;
> > }
> >
> > return status;
> > @@ -989,6 +1166,13 @@ static acpi_status set_u32(u32 value, u32 cap)
> > }
> > case ACER_WMID:
> > return WMID_set_u32(value, cap, interface);
> > + case ACER_WMID_v2:
> > + if (cap & (ACER_CAP_WIRELESS |
> > + ACER_CAP_BLUETOOTH |
> > + ACER_CAP_THREEG))
> > + return wmid_v2_set_u32(value, cap);
> > + else if (wmi_has_guid(WMID_GUID2))
> > + return WMID_set_u32(value, cap, interface);
> > default:
> > return AE_BAD_PARAMETER;
> > }
> > @@ -1095,186 +1279,6 @@ static void acer_backlight_exit(void)
> > backlight_device_unregister(acer_backlight_device);
> > }
> >
> > -static acpi_status wmid3_get_device_status(u32 *value, u16 device)
> > -{
> > - struct wmid3_gds_return_value return_value;
> > - acpi_status status;
> > - union acpi_object *obj;
> > - struct wmid3_gds_input_param params = {
> > - .function_num = 0x1,
> > - .hotkey_number = 0x01,
> > - .devices = device,
> > - };
> > - struct acpi_buffer input = {
> > - sizeof(struct wmid3_gds_input_param),
> > - ¶ms
> > - };
> > - struct acpi_buffer output = { ACPI_ALLOCATE_BUFFER, NULL };
> > -
> > - status = wmi_evaluate_method(WMID_GUID3, 0, 0x2, &input, &output);
> > - if (ACPI_FAILURE(status))
> > - return status;
> > -
> > - obj = output.pointer;
> > -
> > - if (!obj)
> > - return AE_ERROR;
> > - else if (obj->type != ACPI_TYPE_BUFFER) {
> > - kfree(obj);
> > - return AE_ERROR;
> > - }
> > - if (obj->buffer.length != 8) {
> > - pr_warn("Unknown buffer length %d\n", obj->buffer.length);
> > - kfree(obj);
> > - return AE_ERROR;
> > - }
> > -
> > - return_value = *((struct wmid3_gds_return_value *)obj->buffer.pointer);
> > - kfree(obj);
> > -
> > - if (return_value.error_code || return_value.ec_return_value)
> > - pr_warn("Get Device Status failed: 0x%x - 0x%x\n",
> > - return_value.error_code,
> > - return_value.ec_return_value);
> > - else
> > - *value = !!(return_value.devices & device);
> > -
> > - return status;
> > -}
> > -
> > -static acpi_status get_device_status(u32 *value, u32 cap)
> > -{
> > - if (wmi_has_guid(WMID_GUID3)) {
> > - u16 device;
> > -
> > - switch (cap) {
> > - case ACER_CAP_WIRELESS:
> > - device = ACER_WMID3_GDS_WIRELESS;
> > - break;
> > - case ACER_CAP_BLUETOOTH:
> > - device = ACER_WMID3_GDS_BLUETOOTH;
> > - break;
> > -> > - break;
> > - default:
> > - return AE_ERROR;
> > - }
> > - return wmid3_get_device_status(value, device);
> > -
> > - } else {
> > - return get_u32(value, cap);
> > - }
> > -}
> > -
> > -static acpi_status wmid3_set_device_status(u32 value, u16 device)
> > -{
> > - struct wmid3_gds_return_value return_value;
> > - acpi_status status;
> > - union acpi_object *obj;
> > - u16 devices;
> > - struct wmid3_gds_input_param params = {
> > - .function_num = 0x1,
> > - .hotkey_number = 0x01,
> > - .devices = ACER_WMID3_GDS_WIRELESS |
> > - ACER_WMID3_GDS_THREEG |
> > - ACER_WMID3_GDS_WIMAX |
> > - ACER_WMID3_GDS_BLUETOOTH,
> > - };
> > - struct acpi_buffer input = {
> > - sizeof(struct wmid3_gds_input_param),
> > - ¶ms
> > - };
> > - struct acpi_buffer output = { ACPI_ALLOCATE_BUFFER, NULL };
> > - struct acpi_buffer output2 = { ACPI_ALLOCATE_BUFFER, NULL };
> > -
> > - status = wmi_evaluate_method(WMID_GUID3, 0, 0x2, &input, &output);
> > - if (ACPI_FAILURE(status))
> > - return status;
> > -
> > - obj = output.pointer;
> > -
> > - if (!obj)
> > - return AE_ERROR;
> > - else if (obj->type != ACPI_TYPE_BUFFER) {
> > - kfree(obj);
> > - return AE_ERROR;
> > - }
> > - if (obj->buffer.length != 8) {
> > - pr_warning("Unknown buffer length %d\n", obj->buffer.length);
> > - kfree(obj);
> > - return AE_ERROR;
> > - }
> > -
> > - return_value = *((struct wmid3_gds_return_value *)obj->buffer.pointer);
> > - kfree(obj);
> > -
> > - if (return_value.error_code || return_value.ec_return_value) {
> > - pr_warning("Get Current Device Status failed: "
> > - "0x%x - 0x%x\n", return_value.error_code,
> > - return_value.ec_return_value);
> > - return status;
> > - }
> > -
> > - devices = return_value.devices;
> > - params.function_num = 0x2;
> > - params.hotkey_number = 0x01;
> > - params.devices = (value) ? (devices | device) : (devices & ~device);
> > -
> > - status = wmi_evaluate_method(WMID_GUID3, 0, 0x1, &input, &output2);
> > - if (ACPI_FAILURE(status))
> > - return status;
> > -
> > - obj = output2.pointer;
> > -
> > - if (!obj)
> > - return AE_ERROR;
> > - else if (obj->type != ACPI_TYPE_BUFFER) {
> > - kfree(obj);
> > - return AE_ERROR;
> > - }
> > - if (obj->buffer.length != 4) {
> > - pr_warning("Unknown buffer length %d\n", obj->buffer.length);
> > - kfree(obj);
> > - return AE_ERROR;
> > - }
> > -
> > - return_value = *((struct wmid3_gds_return_value *)obj->buffer.pointer);
> > - kfree(obj);
> > -
> > - if (return_value.error_code || return_value.ec_return_value)
> > - pr_warning("Set Device Status failed: "
> > - "0x%x - 0x%x\n", return_value.error_code,
> > - return_value.ec_return_value);
> > -
> > - return status;
> > -}
> > -
> > -static acpi_status set_device_status(u32 value, u32 cap)
> > -{
> > - if (wmi_has_guid(WMID_GUID3)) {
> > - u16 device;
> > -
> > - switch (cap) {
> > - case ACER_CAP_WIRELESS:
> > - device = ACER_WMID3_GDS_WIRELESS;
> > - break;
> > - case ACER_CAP_BLUETOOTH:
> > - device = ACER_WMID3_GDS_BLUETOOTH;
> > - break;
> > - case ACER_CAP_THREEG:
> > - device = ACE> > - return AE_ERROR;
> > - }
> > - return wmid3_set_device_status(value, device);
> > -
> > - } else {
> > - return set_u32(value, cap);
> > - }
> > -}
> > -
> > /*
> > * Rfkill devices
> > */
> > @@ -1301,8 +1305,7 @@ static void acer_rfkill_update(struct work_struct *ignored)
> > }
> >
> > if (has_cap(ACER_CAP_THREEG) && wmi_has_guid(WMID_GUID3)) {
> > - status = wmid3_get_device_status(&state,
> > - ACER_WMID3_GDS_THREEG);
> > + status = get_u32(&state, ACER_WMID3_GDS_THREEG);
> > if (ACPI_SUCCESS(status))
> > rfkill_set_sw_state(threeg_rfkill, !state);
> > }
> > @@ -1316,7 +1319,7 @@ static int acer_rfkill_set(void *data, bool blocked)
> > u32 cap = (unsigned long)data;
> >
> > if (rfkill_inited) {
> > - status = set_device_status(!blocked, cap);
> > + status = set_u32(!blocked, cap);
> > if (ACPI_FAILURE(status))
> > return -ENODEV;
> > }
> > @@ -1343,7 +1346,7 @@ static struct rfkill *acer_rfkill_register(struct device *dev,
> > if (!rfkill_dev)
> > return ERR_PTR(-ENOMEM);
> >
> > - status = get_device_status(&state, cap);
> > + status = get_u32(&state, cap);
> >
> > err = rfkill_register(rfkill_dev);
> > if (err) {
> > @@ -1464,6 +1467,8 @@ static ssize_t show_interface(struct device *dev, struct device_attribute *attr,
> > return sprintf(buf, "AMW0 v2\n");
> > case ACER_WMID:
> > return sprintf(buf, "WMID\n");
> > + case ACER_WMID_v2:
> > + return sprintf(buf, "WMID v2\n");
> > default:
> > return sprintf(buf, "Error!\n");
> > }
> > @@ -1883,12 +1888,20 @@ static int __init acer_wmi_init(void)
> > if (!wmi_has_guid(AMW0_GUID1) && wmi_has_guid(WMID_GUID1))
> > interface = &wmid_interface;
> >
> > + if (wmi_has_guid(WMID_GUID3))
> > + interface = &wmid_v2_interface;
> > +
> > + if (interface)
> > + dmi_walk(type_aa_dmi_decode, NULL);
> > +
> > if (wmi_has_guid(WMID_GUID2) && interface) {
> > - if (ACPI_FAILURE(WMID_set_capabilities())) {
> > + if (!has_type_aa && ACPI_FAILURE(WMID_set_capabilities())) {
> > pr_err("Unable to detect available WMID devices\n");
> > return -ENODEV;
> > }
> > - } else if (!wmi_has_guid(WMID_GUID2) && interface) {
> > + /* WMID always provides brightness methods */
> > + interface->capability |= ACER_CAP_BRIGHTNESS;
> > + } else if (!wmi_has_guid(WMID_GUID2) && interface && !has_type_aa) {
> > pr_err("No WMID device detection method found\n");
> > return -ENODEV;
> > }
> > @@ -1912,7 +1925,7 @@ static int __init acer_wmi_init(void)
> >
> > set_quirks();
> >
> > - if (acpi_video_backlight_support() && has_cap(ACER_CAP_BRIGHTNESS)) {
> > + if (acpi_video_backlight_support()) {
> > interface->capability &= ~ACER_CAP_BRIGHTNESS;
> > pr_info("Brightness must be controlled by "
> > "generic video driver\n");
> > --
> > 1.6.0.2
> >
> >
> >
> >
>
>
>
^ permalink raw reply [flat|nested] 16+ messages in thread* Re: [Fwd: Re: A problem about acer-wmi]
@ 2011-08-10 10:02 Joey Lee
2011-08-11 2:48 ` AceLan Kao
0 siblings, 1 reply; 16+ messages in thread
From: Joey Lee @ 2011-08-10 10:02 UTC (permalink / raw)
To: acelan; +Cc: acelan.kao, joeyli.kernel, platform-driver-x86
Hi AceLan,
於 三,2011-08-10 於 10:13 +0800,joeyli 提到:
> 於 二,2011-08-09 於 14:33 +0800,AceLan Kao 提到:
> > Dear Joey,
> >
> > The current project we have right now have to follow the Acer WMI to
> > handle the key events, that means no EC key event.
> > And we have 3 keys that are not working now, they are touchpad
toggle,
> > brightness up, and brightness down.
> > The touchpad toggle function is a Hotkey Break Event(function number
> > 0x2), and brightness key events are Brightness Change Event(function
> > number 0x4). But now acer-wmi driver only handles General Hotkey
> > Event(function number 0x1).
> >
>
> Yes, current acer-wmi only capture the event function number 0x1, you
> can add those new function to acer_wmi_notify().
>
> > I just implemented those 3 key events, so I think maybe we don't
have
> > to create a new acer-wmi driver.
>
> Great! Welcome for you patches, I will also test it.
>
> > I'm longing for your work to clear up the acer-wmi driver, so that I
> > can add the new machine id and send you the patch.
> > Thanks.
> >
> > BTW, I'm available to help if you are too busy to do that.
> >
> > Best regards,
> > AceLan Kao.
> >
>
> I am doing the clear up, now, will send out patch (I hope today).
>
>
> Thank's
> Joey Lee
>
I add a new ACER_WMID_v2 interface flag and do some clear up in acer-wmi
initial function and get_u32 functions.
Please kindly test this patch:
Thank's
Joey Lee
From 28b2e2ebaa230d339d5749b581c667ed074bb7ea Mon Sep 17 00:00:00 2001
From: Lee, Chun-Yi <jlee@suse.com>
Date: Wed, 10 Aug 2011 16:36:02 +0800
Subject: [PATCH] acer-wmi: add ACER_WMID_v2 interface flag to represent new notebooks
There have new acer notebooks' BIOS provide new WMID_GUID3 and
ACERWMID_EVENT_GUID methods.
Some of machines still keep the old WMID_GUID1 method but more and
more machines were already removed old wmi methods from DSDT.
So, this patch add a new ACER_WMID_v2 interface flag to represent
new acer notebooks, the following is definition:
+ ACER_WMID:
It means this machine only provides WMID_GUID1/2 methods.
+ ACER_WMID_v2:
It means this machine provide new WMID_GUID3 and WMID_EVENT_GUID
methods.
Some ACER_WMID_v2 machines also provide old WMID_GUID1/2 methods,
but we still query/set communication device's state by new
WMID_GUID3 method.
Tested on Acer Travelmate 8572
Signed-off-by: Lee, Chun-Yi <jlee@suse.com>
---
drivers/platform/x86/acer-wmi.c | 409 ++++++++++++++++++++-------------------
1 files changed, 211 insertions(+), 198 deletions(-)
diff --git a/drivers/platform/x86/acer-wmi.c b/drivers/platform/x86/acer-wmi.c
index af2bb20..712a505 100644
--- a/drivers/platform/x86/acer-wmi.c
+++ b/drivers/platform/x86/acer-wmi.c
@@ -190,6 +190,7 @@ enum interface_flags {
ACER_AMW0,
ACER_AMW0_V2,
ACER_WMID,
+ ACER_WMID_v2,
};
#define ACER_DEFAULT_WIRELESS 0
@@ -868,6 +869,176 @@ static acpi_status WMID_set_u32(u32 value, u32 cap, struct wmi_interface *iface)
return WMI_execute_u32(method_id, (u32)value, NULL);
}
+static acpi_status wmid3_get_device_status(u32 *value, u16 device)
+{
+ struct wmid3_gds_return_value return_value;
+ acpi_status status;
+ union acpi_object *obj;
+ struct wmid3_gds_input_param params = {
+ .function_num = 0x1,
+ .hotkey_number = 0x01,
+ .devices = device,
+ };
+ struct acpi_buffer input = {
+ sizeof(struct wmid3_gds_input_param),
+ ¶ms
+ };
+ struct acpi_buffer output = { ACPI_ALLOCATE_BUFFER, NULL };
+
+ status = wmi_evaluate_method(WMID_GUID3, 0, 0x2, &input, &output);
+ if (ACPI_FAILURE(status))
+ return status;
+
+ obj = output.pointer;
+
+ if (!obj)
+ return AE_ERROR;
+ else if (obj->type != ACPI_TYPE_BUFFER) {
+ kfree(obj);
+ return AE_ERROR;
+ }
+ if (obj->buffer.length != 8) {
+ pr_warn("Unknown buffer length %d\n", obj->buffer.length);
+ kfree(obj);
+ return AE_ERROR;
+ }
+
+ return_value = *((struct wmid3_gds_return_value *)obj->buffer.pointer);
+ kfree(obj);
+
+ if (return_value.error_code || return_value.ec_return_value)
+ pr_warn("Get Device Status failed: 0x%x - 0x%x\n",
+ return_value.error_code,
+ return_value.ec_return_value);
+ else
+ *value = !!(return_value.devices & device);
+
+ return status;
+}
+
+static acpi_status wmid_v2_get_u32(u32 *value, u32 cap)
+{
+ u16 device;
+
+ switch (cap) {
+ case ACER_CAP_WIRELESS:
+ device = ACER_WMID3_GDS_WIRELESS;
+ break;
+ case ACER_CAP_BLUETOOTH:
+ device = ACER_WMID3_GDS_BLUETOOTH;
+ break;
+ case ACER_CAP_THREEG:
+ device = ACER_WMID3_GDS_THREEG;
+ break;
+ default:
+ return AE_ERROR;
+ }
+ return wmid3_get_device_status(value, device);
+}
+
+static acpi_status wmid3_set_device_status(u32 value, u16 device)
+{
+ struct wmid3_gds_return_value return_value;
+ acpi_status status;
+ union acpi_object *obj;
+ u16 devices;
+ struct wmid3_gds_input_param params = {
+ .function_num = 0x1,
+ .hotkey_number = 0x01,
+ .devices = ACER_WMID3_GDS_WIRELESS |
+ ACER_WMID3_GDS_THREEG |
+ ACER_WMID3_GDS_WIMAX |
+ ACER_WMID3_GDS_BLUETOOTH,
+ };
+ struct acpi_buffer input = {
+ sizeof(struct wmid3_gds_input_param),
+ ¶ms
+ };
+ struct acpi_buffer output = { ACPI_ALLOCATE_BUFFER, NULL };
+ struct acpi_buffer output2 = { ACPI_ALLOCATE_BUFFER, NULL };
+
+ status = wmi_evaluate_method(WMID_GUID3, 0, 0x2, &input, &output);
+ if (ACPI_FAILURE(status))
+ return status;
+
+ obj = output.pointer;
+
+ if (!obj)
+ return AE_ERROR;
+ else if (obj->type != ACPI_TYPE_BUFFER) {
+ kfree(obj);
+ return AE_ERROR;
+ }
+ if (obj->buffer.length != 8) {
+ pr_warning("Unknown buffer length %d\n", obj->buffer.length);
+ kfree(obj);
+ return AE_ERROR;
+ }
+
+ return_value = *((struct wmid3_gds_return_value *)obj->buffer.pointer);
+ kfree(obj);
+
+ if (return_value.error_code || return_value.ec_return_value) {
+ pr_warning("Get Current Device Status failed: "
+ "0x%x - 0x%x\n", return_value.error_code,
+ return_value.ec_return_value);
+ return status;
+ }
+
+ devices = return_value.devices;
+ params.function_num = 0x2;
+ params.hotkey_number = 0x01;
+ params.devices = (value) ? (devices | device) : (devices & ~device);
+
+ status = wmi_evaluate_method(WMID_GUID3, 0, 0x1, &input, &output2);
+ if (ACPI_FAILURE(status))
+ return status;
+
+ obj = output2.pointer;
+
+ if (!obj)
+ return AE_ERROR;
+ else if (obj->type != ACPI_TYPE_BUFFER) {
+ kfree(obj);
+ return AE_ERROR;
+ }
+ if (obj->buffer.length != 4) {
+ pr_warning("Unknown buffer length %d\n", obj->buffer.length);
+ kfree(obj);
+ return AE_ERROR;
+ }
+
+ return_value = *((struct wmid3_gds_return_value *)obj->buffer.pointer);
+ kfree(obj);
+
+ if (return_value.error_code || return_value.ec_return_value)
+ pr_warning("Set Device Status failed: "
+ "0x%x - 0x%x\n", return_value.error_code,
+ return_value.ec_return_value);
+
+ return status;
+}
+
+static acpi_status wmid_v2_set_u32(u32 value, u32 cap)
+{
+ u16 device;
+
+ switch (cap) {
+ case ACER_CAP_WIRELESS:
+ device = ACER_WMID3_GDS_WIRELESS;
+ break;
+ case ACER_CAP_BLUETOOTH:
+ device = ACER_WMID3_GDS_BLUETOOTH;
+ break;
+ case ACER_CAP_THREEG:
+ device = ACER_WMID3_GDS_THREEG;
+ break;
+ default:
+ return AE_ERROR;
+ }
+ return wmid3_set_device_status(value, device);
+}
+
static void type_aa_dmi_decode(const struct dmi_header *header, void *dummy)
{
struct hotkey_function_type_aa *type_aa;
@@ -913,17 +1084,11 @@ static acpi_status WMID_set_capabilities(void)
return AE_ERROR;
}
- dmi_walk(type_aa_dmi_decode, NULL);
- if (!has_type_aa) {
- interface->capability |= ACER_CAP_WIRELESS;
- if (devices & 0x40)
- interface->capability |= ACER_CAP_THREEG;
- if (devices & 0x10)
- interface->capability |= ACER_CAP_BLUETOOTH;
- }
-
- /* WMID always provides brightness methods */
- interface->capability |= ACER_CAP_BRIGHTNESS;
+ interface->capability |= ACER_CAP_WIRELESS;
+ if (devices & 0x40)
+ interface->capability |= ACER_CAP_THREEG;
+ if (devices & 0x10)
+ interface->capability |= ACER_CAP_BLUETOOTH;
if (!(devices & 0x20))
max_brightness = 0x9;
@@ -936,6 +1101,10 @@ static struct wmi_interface wmid_interface = {
.type = ACER_WMID,
};
+static struct wmi_interface wmid_v2_interface = {
+ .type = ACER_WMID_v2,
+};
+
/*
* Generic Device (interface-independent)
*/
@@ -956,6 +1125,14 @@ static acpi_status get_u32(u32 *value, u32 cap)
case ACER_WMID:
status = WMID_get_u32(value, cap, interface);
break;
+ case ACER_WMID_v2:
+ if (cap & (ACER_CAP_WIRELESS |
+ ACER_CAP_BLUETOOTH |
+ ACER_CAP_THREEG))
+ status = wmid_v2_get_u32(value, cap);
+ else if (wmi_has_guid(WMID_GUID2))
+ status = WMID_get_u32(value, cap, interface);
+ break;
}
return status;
@@ -989,6 +1166,13 @@ static acpi_status set_u32(u32 value, u32 cap)
}
case ACER_WMID:
return WMID_set_u32(value, cap, interface);
+ case ACER_WMID_v2:
+ if (cap & (ACER_CAP_WIRELESS |
+ ACER_CAP_BLUETOOTH |
+ ACER_CAP_THREEG))
+ return wmid_v2_set_u32(value, cap);
+ else if (wmi_has_guid(WMID_GUID2))
+ return WMID_set_u32(value, cap, interface);
default:
return AE_BAD_PARAMETER;
}
@@ -1095,186 +1279,6 @@ static void acer_backlight_exit(void)
backlight_device_unregister(acer_backlight_device);
}
-static acpi_status wmid3_get_device_status(u32 *value, u16 device)
-{
- struct wmid3_gds_return_value return_value;
- acpi_status status;
- union acpi_object *obj;
- struct wmid3_gds_input_param params = {
- .function_num = 0x1,
- .hotkey_number = 0x01,
- .devices = device,
- };
- struct acpi_buffer input = {
- sizeof(struct wmid3_gds_input_param),
- ¶ms
- };
- struct acpi_buffer output = { ACPI_ALLOCATE_BUFFER, NULL };
-
- status = wmi_evaluate_method(WMID_GUID3, 0, 0x2, &input, &output);
- if (ACPI_FAILURE(status))
- return status;
-
- obj = output.pointer;
-
- if (!obj)
- return AE_ERROR;
- else if (obj->type != ACPI_TYPE_BUFFER) {
- kfree(obj);
- return AE_ERROR;
- }
- if (obj->buffer.length != 8) {
- pr_warn("Unknown buffer length %d\n", obj->buffer.length);
- kfree(obj);
- return AE_ERROR;
- }
-
- return_value = *((struct wmid3_gds_return_value *)obj->buffer.pointer);
- kfree(obj);
-
- if (return_value.error_code || return_value.ec_return_value)
- pr_warn("Get Device Status failed: 0x%x - 0x%x\n",
- return_value.error_code,
- return_value.ec_return_value);
- else
- *value = !!(return_value.devices & device);
-
- return status;
-}
-
-static acpi_status get_device_status(u32 *value, u32 cap)
-{
- if (wmi_has_guid(WMID_GUID3)) {
- u16 device;
-
- switch (cap) {
- case ACER_CAP_WIRELESS:
- device = ACER_WMID3_GDS_WIRELESS;
- break;
- case ACER_CAP_BLUETOOTH:
- device = ACER_WMID3_GDS_BLUETOOTH;
- break;
- case ACER_CAP_THREEG:
- device = ACER_WMID3_GDS_THREEG;
- break;
- default:
- return AE_ERROR;
- }
- return wmid3_get_device_status(value, device);
-
- } else {
- return get_u32(value, cap);
- }
-}
-
-static acpi_status wmid3_set_device_status(u32 value, u16 device)
-{
- struct wmid3_gds_return_value return_value;
- acpi_status status;
- union acpi_object *obj;
- u16 devices;
- struct wmid3_gds_input_param params = {
- .function_num = 0x1,
- .hotkey_number = 0x01,
- .devices = ACER_WMID3_GDS_WIRELESS |
- ACER_WMID3_GDS_THREEG |
- ACER_WMID3_GDS_WIMAX |
- ACER_WMID3_GDS_BLUETOOTH,
- };
- struct acpi_buffer input = {
- sizeof(struct wmid3_gds_input_param),
- ¶ms
- };
- struct acpi_buffer output = { ACPI_ALLOCATE_BUFFER, NULL };
- struct acpi_buffer output2 = { ACPI_ALLOCATE_BUFFER, NULL };
-
- status = wmi_evaluate_method(WMID_GUID3, 0, 0x2, &input, &output);
- if (ACPI_FAILURE(status))
- return status;
-
- obj = output.pointer;
-
- if (!obj)
- return AE_ERROR;
- else if (obj->type != ACPI_TYPE_BUFFER) {
- kfree(obj);
- return AE_ERROR;
- }
- if (obj->buffer.length != 8) {
- pr_warning("Unknown buffer length %d\n", obj->buffer.length);
- kfree(obj);
- return AE_ERROR;
- }
-
- return_value = *((struct wmid3_gds_return_value *)obj->buffer.pointer);
- kfree(obj);
-
- if (return_value.error_code || return_value.ec_return_value) {
- pr_warning("Get Current Device Status failed: "
- "0x%x - 0x%x\n", return_value.error_code,
- return_value.ec_return_value);
- return status;
- }
-
- devices = return_value.devices;
- params.function_num = 0x2;
- params.hotkey_number = 0x01;
- params.devices = (value) ? (devices | device) : (devices & ~device);
-
- status = wmi_evaluate_method(WMID_GUID3, 0, 0x1, &input, &output2);
- if (ACPI_FAILURE(status))
- return status;
-
- obj = output2.pointer;
-
- if (!obj)
- return AE_ERROR;
- else if (obj->type != ACPI_TYPE_BUFFER) {
- kfree(obj);
- return AE_ERROR;
- }
- if (obj->buffer.length != 4) {
- pr_warning("Unknown buffer length %d\n", obj->buffer.length);
- kfree(obj);
- return AE_ERROR;
- }
-
- return_value = *((struct wmid3_gds_return_value *)obj->buffer.pointer);
- kfree(obj);
-
- if (return_value.error_code || return_value.ec_return_value)
- pr_warning("Set Device Status failed: "
- "0x%x - 0x%x\n", return_value.error_code,
- return_value.ec_return_value);
-
- return status;
-}
-
-static acpi_status set_device_status(u32 value, u32 cap)
-{
- if (wmi_has_guid(WMID_GUID3)) {
- u16 device;
-
- switch (cap) {
- case ACER_CAP_WIRELESS:
- device = ACER_WMID3_GDS_WIRELESS;
- break;
- case ACER_CAP_BLUETOOTH:
- device = ACER_WMID3_GDS_BLUETOOTH;
- break;
- case ACER_CAP_THREEG:
- device = ACER_WMID3_GDS_THREEG;
- break;
- default:
- return AE_ERROR;
- }
- return wmid3_set_device_status(value, device);
-
- } else {
- return set_u32(value, cap);
- }
-}
-
/*
* Rfkill devices
*/
@@ -1301,8 +1305,7 @@ static void acer_rfkill_update(struct work_struct *ignored)
}
if (has_cap(ACER_CAP_THREEG) && wmi_has_guid(WMID_GUID3)) {
- status = wmid3_get_device_status(&state,
- ACER_WMID3_GDS_THREEG);
+ status = get_u32(&state, ACER_WMID3_GDS_THREEG);
if (ACPI_SUCCESS(status))
rfkill_set_sw_state(threeg_rfkill, !state);
}
@@ -1316,7 +1319,7 @@ static int acer_rfkill_set(void *data, bool blocked)
u32 cap = (unsigned long)data;
if (rfkill_inited) {
- status = set_device_status(!blocked, cap);
+ status = set_u32(!blocked, cap);
if (ACPI_FAILURE(status))
return -ENODEV;
}
@@ -1343,7 +1346,7 @@ static struct rfkill *acer_rfkill_register(struct device *dev,
if (!rfkill_dev)
return ERR_PTR(-ENOMEM);
- status = get_device_status(&state, cap);
+ status = get_u32(&state, cap);
err = rfkill_register(rfkill_dev);
if (err) {
@@ -1464,6 +1467,8 @@ static ssize_t show_interface(struct device *dev, struct device_attribute *attr,
return sprintf(buf, "AMW0 v2\n");
case ACER_WMID:
return sprintf(buf, "WMID\n");
+ case ACER_WMID_v2:
+ return sprintf(buf, "WMID v2\n");
default:
return sprintf(buf, "Error!\n");
}
@@ -1883,12 +1888,20 @@ static int __init acer_wmi_init(void)
if (!wmi_has_guid(AMW0_GUID1) && wmi_has_guid(WMID_GUID1))
interface = &wmid_interface;
+ if (wmi_has_guid(WMID_GUID3))
+ interface = &wmid_v2_interface;
+
+ if (interface)
+ dmi_walk(type_aa_dmi_decode, NULL);
+
if (wmi_has_guid(WMID_GUID2) && interface) {
- if (ACPI_FAILURE(WMID_set_capabilities())) {
+ if (!has_type_aa && ACPI_FAILURE(WMID_set_capabilities())) {
pr_err("Unable to detect available WMID devices\n");
return -ENODEV;
}
- } else if (!wmi_has_guid(WMID_GUID2) && interface) {
+ /* WMID always provides brightness methods */
+ interface->capability |= ACER_CAP_BRIGHTNESS;
+ } else if (!wmi_has_guid(WMID_GUID2) && interface && !has_type_aa) {
pr_err("No WMID device detection method found\n");
return -ENODEV;
}
@@ -1912,7 +1925,7 @@ static int __init acer_wmi_init(void)
set_quirks();
- if (acpi_video_backlight_support() && has_cap(ACER_CAP_BRIGHTNESS)) {
+ if (acpi_video_backlight_support()) {
interface->capability &= ~ACER_CAP_BRIGHTNESS;
pr_info("Brightness must be controlled by "
"generic video driver\n");
--
1.6.0.2
^ permalink raw reply related [flat|nested] 16+ messages in thread* Re: [Fwd: Re: A problem about acer-wmi]
2011-08-10 10:02 Joey Lee
@ 2011-08-11 2:48 ` AceLan Kao
0 siblings, 0 replies; 16+ messages in thread
From: AceLan Kao @ 2011-08-11 2:48 UTC (permalink / raw)
To: Joey Lee; +Cc: joeyli.kernel, platform-driver-x86
Dear Joey,
This is the dmesg log.
[ 9010.944053] acer_wmi: Acer Laptop ACPI-WMI Extras
[ 9010.944071] acer_wmi: Function bitmap for Communication Button: 0x1
[ 9010.944075] acer_wmi: Brightness must be controlled by generic video driver
[ 9010.944996] input: Acer WMI hotkeys as /devices/virtual/input/input21
[ 9010.947095] acer_wmi: Set Device Status failed: 0xe2 - 0x0
And after adding my quirk, the set device status still failed, but
except that, everything works well.
The "failed" comes from acer_rfkill_init(), it'll call
acer_rfkill_register() with ACER_CAP_WIRELESS parameter without
checking the capability.
I don't know why only wifi doesn't check the capability and call
acer_rfkill_register() directly, but it doesn't hurt the system.
===
static int acer_rfkill_init(struct device *dev)
{
wireless_rfkill = acer_rfkill_register(dev, RFKILL_TYPE_WLAN,
"acer-wireless", ACER_CAP_WIRELESS);
if (IS_ERR(wireless_rfkill))
return PTR_ERR(wireless_rfkill);
===
Best regards,
AceLan Kao.
2011/8/10 Joey Lee <jlee@novell.com>:
> Hi AceLan,
>
> 於 三,2011-08-10 於 10:13 +0800,joeyli 提到:
>> 於 二,2011-08-09 於 14:33 +0800,AceLan Kao 提到:
>> > Dear Joey,
>> >
>> > The current project we have right now have to follow the Acer WMI to
>> > handle the key events, that means no EC key event.
>> > And we have 3 keys that are not working now, they are touchpad
> toggle,
>> > brightness up, and brightness down.
>> > The touchpad toggle function is a Hotkey Break Event(function number
>> > 0x2), and brightness key events are Brightness Change Event(function
>> > number 0x4). But now acer-wmi driver only handles General Hotkey
>> > Event(function number 0x1).
>> >
>>
>> Yes, current acer-wmi only capture the event function number 0x1, you
>> can add those new function to acer_wmi_notify().
>>
>> > I just implemented those 3 key events, so I think maybe we don't
> have
>> > to create a new acer-wmi driver.
>>
>> Great! Welcome for you patches, I will also test it.
>>
>> > I'm longing for your work to clear up the acer-wmi driver, so that I
>> > can add the new machine id and send you the patch.
>> > Thanks.
>> >
>> > BTW, I'm available to help if you are too busy to do that.
>> >
>> > Best regards,
>> > AceLan Kao.
>> >
>>
>> I am doing the clear up, now, will send out patch (I hope today).
>>
>>
>> Thank's
>> Joey Lee
>>
>
> I add a new ACER_WMID_v2 interface flag and do some clear up in acer-wmi
> initial function and get_u32 functions.
>
> Please kindly test this patch:
>
>
> Thank's
> Joey Lee
>
> >From 28b2e2ebaa230d339d5749b581c667ed074bb7ea Mon Sep 17 00:00:00 2001
> From: Lee, Chun-Yi <jlee@suse.com>
> Date: Wed, 10 Aug 2011 16:36:02 +0800
> Subject: [PATCH] acer-wmi: add ACER_WMID_v2 interface flag to represent new notebooks
>
> There have new acer notebooks' BIOS provide new WMID_GUID3 and
> ACERWMID_EVENT_GUID methods.
>
> Some of machines still keep the old WMID_GUID1 method but more and
> more machines were already removed old wmi methods from DSDT.
>
> So, this patch add a new ACER_WMID_v2 interface flag to represent
> new acer notebooks, the following is definition:
>
> + ACER_WMID:
> It means this machine only provides WMID_GUID1/2 methods.
>
> + ACER_WMID_v2:
> It means this machine provide new WMID_GUID3 and WMID_EVENT_GUID
> methods.
> Some ACER_WMID_v2 machines also provide old WMID_GUID1/2 methods,
> but we still query/set communication device's state by new
> WMID_GUID3 method.
>
> Tested on Acer Travelmate 8572
>
> Signed-off-by: Lee, Chun-Yi <jlee@suse.com>
> ---
> drivers/platform/x86/acer-wmi.c | 409 ++++++++++++++++++++-------------------
> 1 files changed, 211 insertions(+), 198 deletions(-)
>
> diff --git a/drivers/platform/x86/acer-wmi.c b/drivers/platform/x86/acer-wmi.c
> index af2bb20..712a505 100644
> --- a/drivers/platform/x86/acer-wmi.c
> +++ b/drivers/platform/x86/acer-wmi.c
> @@ -190,6 +190,7 @@ enum interface_flags {
> ACER_AMW0,
> ACER_AMW0_V2,
> ACER_WMID,
> + ACER_WMID_v2,
> };
>
> #define ACER_DEFAULT_WIRELESS 0
> @@ -868,6 +869,176 @@ static acpi_status WMID_set_u32(u32 value, u32 cap, struct wmi_interface *iface)
> return WMI_execute_u32(method_id, (u32)value, NULL);
> }
>
> +static acpi_status wmid3_get_device_status(u32 *value, u16 device)
> +{
> + struct wmid3_gds_return_value return_value;
> + acpi_status status;
> + union acpi_object *obj;
> + struct wmid3_gds_input_param params = {
> + .function_num = 0x1,
> + .hotkey_number = 0x01,
> + .devices = device,
> + };
> + struct acpi_buffer input = {
> + sizeof(struct wmid3_gds_input_param),
> + ¶ms
> + };
> + struct acpi_buffer output = { ACPI_ALLOCATE_BUFFER, NULL };
> +
> + status = wmi_evaluate_method(WMID_GUID3, 0, 0x2, &input, &output);
> + if (ACPI_FAILURE(status))
> + return status;
> +
> + obj = output.pointer;
> +
> + if (!obj)
> + return AE_ERROR;
> + else if (obj->type != ACPI_TYPE_BUFFER) {
> + kfree(obj);
> + return AE_ERROR;
> + }
> + if (obj->buffer.length != 8) {
> + pr_warn("Unknown buffer length %d\n", obj->buffer.length);
> + kfree(obj);
> + return AE_ERROR;
> + }
> +
> + return_value = *((struct wmid3_gds_return_value *)obj->buffer.pointer);
> + kfree(obj);
> +
> + if (return_value.error_code || return_value.ec_return_value)
> + pr_warn("Get Device Status failed: 0x%x - 0x%x\n",
> + return_value.error_code,
> + return_value.ec_return_value);
> + else
> + *value = !!(return_value.devices & device);
> +
> + return status;
> +}
> +
> +static acpi_status wmid_v2_get_u32(u32 *value, u32 cap)
> +{
> + u16 device;
> +
> + switch (cap) {
> + case ACER_CAP_WIRELESS:
> + device = ACER_WMID3_GDS_WIRELESS;
> + break;
> + case ACER_CAP_BLUETOOTH:
> + device = ACER_WMID3_GDS_BLUETOOTH;
> + break;
> + case ACER_CAP_THREEG:
> + device = ACER_WMID3_GDS_THREEG;
> + break;
> + default:
> + return AE_ERROR;
> + }
> + return wmid3_get_device_status(value, device);
> +}
> +
> +static acpi_status wmid3_set_device_status(u32 value, u16 device)
> +{
> + struct wmid3_gds_return_value return_value;
> + acpi_status status;
> + union acpi_object *obj;
> + u16 devices;
> + struct wmid3_gds_input_param params = {
> + .function_num = 0x1,
> + .hotkey_number = 0x01,
> + .devices = ACER_WMID3_GDS_WIRELESS |
> + ACER_WMID3_GDS_THREEG |
> + ACER_WMID3_GDS_WIMAX |
> + ACER_WMID3_GDS_BLUETOOTH,
> + };
> + struct acpi_buffer input = {
> + sizeof(struct wmid3_gds_input_param),
> + ¶ms
> + };
> + struct acpi_buffer output = { ACPI_ALLOCATE_BUFFER, NULL };
> + struct acpi_buffer output2 = { ACPI_ALLOCATE_BUFFER, NULL };
> +
> + status = wmi_evaluate_method(WMID_GUID3, 0, 0x2, &input, &output);
> + if (ACPI_FAILURE(status))
> + return status;
> +
> + obj = output.pointer;
> +
> + if (!obj)
> + return AE_ERROR;
> + else if (obj->type != ACPI_TYPE_BUFFER) {
> + kfree(obj);
> + return AE_ERROR;
> + }
> + if (obj->buffer.length != 8) {
> + pr_warning("Unknown buffer length %d\n", obj->buffer.length);
> + kfree(obj);
> + return AE_ERROR;
> + }
> +
> + return_value = *((struct wmid3_gds_return_value *)obj->buffer.pointer);
> + kfree(obj);
> +
> + if (return_value.error_code || return_value.ec_return_value) {
> + pr_warning("Get Current Device Status failed: "
> + "0x%x - 0x%x\n", return_value.error_code,
> + return_value.ec_return_value);
> + return status;
> + }
> +
> + devices = return_value.devices;
> + params.function_num = 0x2;
> + params.hotkey_number = 0x01;
> + params.devices = (value) ? (devices | device) : (devices & ~device);
> +
> + status = wmi_evaluate_method(WMID_GUID3, 0, 0x1, &input, &output2);
> + if (ACPI_FAILURE(status))
> + return status;
> +
> + obj = output2.pointer;
> +
> + if (!obj)
> + return AE_ERROR;
> + else if (obj->type != ACPI_TYPE_BUFFER) {
> + kfree(obj);
> + return AE_ERROR;
> + }
> + if (obj->buffer.length != 4) {
> + pr_warning("Unknown buffer length %d\n", obj->buffer.length);
> + kfree(obj);
> + return AE_ERROR;
> + }
> +
> + return_value = *((struct wmid3_gds_return_value *)obj->buffer.pointer);
> + kfree(obj);
> +
> + if (return_value.error_code || return_value.ec_return_value)
> + pr_warning("Set Device Status failed: "
> + "0x%x - 0x%x\n", return_value.error_code,
> + return_value.ec_return_value);
> +
> + return status;
> +}
> +
> +static acpi_status wmid_v2_set_u32(u32 value, u32 cap)
> +{
> + u16 device;
> +
> + switch (cap) {
> + case ACER_CAP_WIRELESS:
> + device = ACER_WMID3_GDS_WIRELESS;
> + break;
> + case ACER_CAP_BLUETOOTH:
> + device = ACER_WMID3_GDS_BLUETOOTH;
> + break;
> + case ACER_CAP_THREEG:
> + device = ACER_WMID3_GDS_THREEG;
> + break;
> + default:
> + return AE_ERROR;
> + }
> + return wmid3_set_device_status(value, device);
> +}
> +
> static void type_aa_dmi_decode(const struct dmi_header *header, void *dummy)
> {
> struct hotkey_function_type_aa *type_aa;
> @@ -913,17 +1084,11 @@ static acpi_status WMID_set_capabilities(void)
> return AE_ERROR;
> }
>
> - dmi_walk(type_aa_dmi_decode, NULL);
> - if (!has_type_aa) {
> - interface->capability |= ACER_CAP_WIRELESS;
> - if (devices & 0x40)
> - interface->capability |= ACER_CAP_THREEG;
> - if (devices & 0x10)
> - interface->capability |= ACER_CAP_BLUETOOTH;
> - }
> -
> - /* WMID always provides brightness methods */
> - interface->capability |= ACER_CAP_BRIGHTNESS;
> + interface->capability |= ACER_CAP_WIRELESS;
> + if (devices & 0x40)
> + interface->capability |= ACER_CAP_THREEG;
> + if (devices & 0x10)
> + interface->capability |= ACER_CAP_BLUETOOTH;
>
> if (!(devices & 0x20))
> max_brightness = 0x9;
> @@ -936,6 +1101,10 @@ static struct wmi_interface wmid_interface = {
> .type = ACER_WMID,
> };
>
> +static struct wmi_interface wmid_v2_interface = {
> + .type = ACER_WMID_v2,
> +};
> +
> /*
> * Generic Device (interface-independent)
> */
> @@ -956,6 +1125,14 @@ static acpi_status get_u32(u32 *value, u32 cap)
> case ACER_WMID:
> status = WMID_get_u32(value, cap, interface);
> break;
> + case ACER_WMID_v2:
> + if (cap & (ACER_CAP_WIRELESS |
> + ACER_CAP_BLUETOOTH |
> + ACER_CAP_THREEG))
> + status = wmid_v2_get_u32(value, cap);
> + else if (wmi_has_guid(WMID_GUID2))
> + status = WMID_get_u32(value, cap, interface);
> + break;
> }
>
> return status;
> @@ -989,6 +1166,13 @@ static acpi_status set_u32(u32 value, u32 cap)
> }
> case ACER_WMID:
> return WMID_set_u32(value, cap, interface);
> + case ACER_WMID_v2:
> + if (cap & (ACER_CAP_WIRELESS |
> + ACER_CAP_BLUETOOTH |
> + ACER_CAP_THREEG))
> + return wmid_v2_set_u32(value, cap);
> + else if (wmi_has_guid(WMID_GUID2))
> + return WMID_set_u32(value, cap, interface);
> default:
> return AE_BAD_PARAMETER;
> }
> @@ -1095,186 +1279,6 @@ static void acer_backlight_exit(void)
> backlight_device_unregister(acer_backlight_device);
> }
>
> -static acpi_status wmid3_get_device_status(u32 *value, u16 device)
> -{
> - struct wmid3_gds_return_value return_value;
> - acpi_status status;
> - union acpi_object *obj;
> - struct wmid3_gds_input_param params = {
> - .function_num = 0x1,
> - .hotkey_number = 0x01,
> - .devices = device,
> - };
> - struct acpi_buffer input = {
> - sizeof(struct wmid3_gds_input_param),
> - ¶ms
> - };
> - struct acpi_buffer output = { ACPI_ALLOCATE_BUFFER, NULL };
> -
> - status = wmi_evaluate_method(WMID_GUID3, 0, 0x2, &input, &output);
> - if (ACPI_FAILURE(status))
> - return status;
> -
> - obj = output.pointer;
> -
> - if (!obj)
> - return AE_ERROR;
> - else if (obj->type != ACPI_TYPE_BUFFER) {
> - kfree(obj);
> - return AE_ERROR;
> - }
> - if (obj->buffer.length != 8) {
> - pr_warn("Unknown buffer length %d\n", obj->buffer.length);
> - kfree(obj);
> - return AE_ERROR;
> - }
> -
> - return_value = *((struct wmid3_gds_return_value *)obj->buffer.pointer);
> - kfree(obj);
> -
> - if (return_value.error_code || return_value.ec_return_value)
> - pr_warn("Get Device Status failed: 0x%x - 0x%x\n",
> - return_value.error_code,
> - return_value.ec_return_value);
> - else
> - *value = !!(return_value.devices & device);
> -
> - return status;
> -}
> -
> -static acpi_status get_device_status(u32 *value, u32 cap)
> -{
> - if (wmi_has_guid(WMID_GUID3)) {
> - u16 device;
> -
> - switch (cap) {
> - case ACER_CAP_WIRELESS:
> - device = ACER_WMID3_GDS_WIRELESS;
> - break;
> - case ACER_CAP_BLUETOOTH:
> - device = ACER_WMID3_GDS_BLUETOOTH;
> - break;
> - case ACER_CAP_THREEG:
> - device = ACER_WMID3_GDS_THREEG;
> - break;
> - default:
> - return AE_ERROR;
> - }
> - return wmid3_get_device_status(value, device);
> -
> - } else {
> - return get_u32(value, cap);
> - }
> -}
> -
> -static acpi_status wmid3_set_device_status(u32 value, u16 device)
> -{
> - struct wmid3_gds_return_value return_value;
> - acpi_status status;
> - union acpi_object *obj;
> - u16 devices;
> - struct wmid3_gds_input_param params = {
> - .function_num = 0x1,
> - .hotkey_number = 0x01,
> - .devices = ACER_WMID3_GDS_WIRELESS |
> - ACER_WMID3_GDS_THREEG |
> - ACER_WMID3_GDS_WIMAX |
> - ACER_WMID3_GDS_BLUETOOTH,
> - };
> - struct acpi_buffer input = {
> - sizeof(struct wmid3_gds_input_param),
> - ¶ms
> - };
> - struct acpi_buffer output = { ACPI_ALLOCATE_BUFFER, NULL };
> - struct acpi_buffer output2 = { ACPI_ALLOCATE_BUFFER, NULL };
> -
> - status = wmi_evaluate_method(WMID_GUID3, 0, 0x2, &input, &output);
> - if (ACPI_FAILURE(status))
> - return status;
> -
> - obj = output.pointer;
> -
> - if (!obj)
> - return AE_ERROR;
> - else if (obj->type != ACPI_TYPE_BUFFER) {
> - kfree(obj);
> - return AE_ERROR;
> - }
> - if (obj->buffer.length != 8) {
> - pr_warning("Unknown buffer length %d\n", obj->buffer.length);
> - kfree(obj);
> - return AE_ERROR;
> - }
> -
> - return_value = *((struct wmid3_gds_return_value *)obj->buffer.pointer);
> - kfree(obj);
> -
> - if (return_value.error_code || return_value.ec_return_value) {
> - pr_warning("Get Current Device Status failed: "
> - "0x%x - 0x%x\n", return_value.error_code,
> - return_value.ec_return_value);
> - return status;
> - }
> -
> - devices = return_value.devices;
> - params.function_num = 0x2;
> - params.hotkey_number = 0x01;
> - params.devices = (value) ? (devices | device) : (devices & ~device);
> -
> - status = wmi_evaluate_method(WMID_GUID3, 0, 0x1, &input, &output2);
> - if (ACPI_FAILURE(status))
> - return status;
> -
> - obj = output2.pointer;
> -
> - if (!obj)
> - return AE_ERROR;
> - else if (obj->type != ACPI_TYPE_BUFFER) {
> - kfree(obj);
> - return AE_ERROR;
> - }
> - if (obj->buffer.length != 4) {
> - pr_warning("Unknown buffer length %d\n", obj->buffer.length);
> - kfree(obj);
> - return AE_ERROR;
> - }
> -
> - return_value = *((struct wmid3_gds_return_value *)obj->buffer.pointer);
> - kfree(obj);
> -
> - if (return_value.error_code || return_value.ec_return_value)
> - pr_warning("Set Device Status failed: "
> - "0x%x - 0x%x\n", return_value.error_code,
> - return_value.ec_return_value);
> -
> - return status;
> -}
> -
> -static acpi_status set_device_status(u32 value, u32 cap)
> -{
> - if (wmi_has_guid(WMID_GUID3)) {
> - u16 device;
> -
> - switch (cap) {
> - case ACER_CAP_WIRELESS:
> - device = ACER_WMID3_GDS_WIRELESS;
> - break;
> - case ACER_CAP_BLUETOOTH:
> - device = ACER_WMID3_GDS_BLUETOOTH;
> - break;
> - case ACER_CAP_THREEG:
> - device = ACER_WMID3_GDS_THREEG;
> - break;
> - default:
> - return AE_ERROR;
> - }
> - return wmid3_set_device_status(value, device);
> -
> - } else {
> - return set_u32(value, cap);
> - }
> -}
> -
> /*
> * Rfkill devices
> */
> @@ -1301,8 +1305,7 @@ static void acer_rfkill_update(struct work_struct *ignored)
> }
>
> if (has_cap(ACER_CAP_THREEG) && wmi_has_guid(WMID_GUID3)) {
> - status = wmid3_get_device_status(&state,
> - ACER_WMID3_GDS_THREEG);
> + status = get_u32(&state, ACER_WMID3_GDS_THREEG);
> if (ACPI_SUCCESS(status))
> rfkill_set_sw_state(threeg_rfkill, !state);
> }
> @@ -1316,7 +1319,7 @@ static int acer_rfkill_set(void *data, bool blocked)
> u32 cap = (unsigned long)data;
>
> if (rfkill_inited) {
> - status = set_device_status(!blocked, cap);
> + status = set_u32(!blocked, cap);
> if (ACPI_FAILURE(status))
> return -ENODEV;
> }
> @@ -1343,7 +1346,7 @@ static struct rfkill *acer_rfkill_register(struct device *dev,
> if (!rfkill_dev)
> return ERR_PTR(-ENOMEM);
>
> - status = get_device_status(&state, cap);
> + status = get_u32(&state, cap);
>
> err = rfkill_register(rfkill_dev);
> if (err) {
> @@ -1464,6 +1467,8 @@ static ssize_t show_interface(struct device *dev, struct device_attribute *attr,
> return sprintf(buf, "AMW0 v2\n");
> case ACER_WMID:
> return sprintf(buf, "WMID\n");
> + case ACER_WMID_v2:
> + return sprintf(buf, "WMID v2\n");
> default:
> return sprintf(buf, "Error!\n");
> }
> @@ -1883,12 +1888,20 @@ static int __init acer_wmi_init(void)
> if (!wmi_has_guid(AMW0_GUID1) && wmi_has_guid(WMID_GUID1))
> interface = &wmid_interface;
>
> + if (wmi_has_guid(WMID_GUID3))
> + interface = &wmid_v2_interface;
> +
> + if (interface)
> + dmi_walk(type_aa_dmi_decode, NULL);
> +
> if (wmi_has_guid(WMID_GUID2) && interface) {
> - if (ACPI_FAILURE(WMID_set_capabilities())) {
> + if (!has_type_aa && ACPI_FAILURE(WMID_set_capabilities())) {
> pr_err("Unable to detect available WMID devices\n");
> return -ENODEV;
> }
> - } else if (!wmi_has_guid(WMID_GUID2) && interface) {
> + /* WMID always provides brightness methods */
> + interface->capability |= ACER_CAP_BRIGHTNESS;
> + } else if (!wmi_has_guid(WMID_GUID2) && interface && !has_type_aa) {
> pr_err("No WMID device detection method found\n");
> return -ENODEV;
> }
> @@ -1912,7 +1925,7 @@ static int __init acer_wmi_init(void)
>
> set_quirks();
>
> - if (acpi_video_backlight_support() && has_cap(ACER_CAP_BRIGHTNESS)) {
> + if (acpi_video_backlight_support()) {
> interface->capability &= ~ACER_CAP_BRIGHTNESS;
> pr_info("Brightness must be controlled by "
> "generic video driver\n");
> --
> 1.6.0.2
>
>
>
>
--
Chia-Lin Kao(AceLan)
http://blog.acelan.idv.tw/
E-Mail: acelan.kaoATcanonical.com (s/AT/@/)
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [Fwd: Re: A problem about acer-wmi]
@ 2011-08-10 9:17 Joey Lee
0 siblings, 0 replies; 16+ messages in thread
From: Joey Lee @ 2011-08-10 9:17 UTC (permalink / raw)
To: acelan; +Cc: platform-driver-x86
Hi AceLan,
於 三,2011-08-10 於 10:13 +0800,joeyli 提到:
> 於 二,2011-08-09 於 14:33 +0800,AceLan Kao 提到:
> > Dear Joey,
> >
> > The current project we have right now have to follow the Acer WMI to
> > handle the key events, that means no EC key event.
> > And we have 3 keys that are not working now, they are touchpad
toggle,
> > brightness up, and brightness down.
> > The touchpad toggle function is a Hotkey Break Event(function number
> > 0x2), and brightness key events are Brightness Change Event(function
> > number 0x4). But now acer-wmi driver only handles General Hotkey
> > Event(function number 0x1).
> >
>
> Yes, current acer-wmi only capture the event function number 0x1, you
> can add those new function to acer_wmi_notify().
>
> > I just implemented those 3 key events, so I think maybe we don't
have
> > to create a new acer-wmi driver.
>
> Great! Welcome for you patches, I will also test it.
>
> > I'm longing for your work to clear up the acer-wmi driver, so that I
> > can add the new machine id and send you the patch.
> > Thanks.
> >
> > BTW, I'm available to help if you are too busy to do that.
> >
> > Best regards,
> > AceLan Kao.
> >
>
> I am doing the clear up, now, will send out patch (I hope today).
>
>
> Thank's
> Joey Lee
>
I add a new ACER_WMID_v2 interface flag and do some clear up in acer-wmi
initial function and get_u32 functions.
Please kindly test this patch:
Thank's
Joey Lee
From 28b2e2ebaa230d339d5749b581c667ed074bb7ea Mon Sep 17 00:00:00 2001
From: Lee, Chun-Yi <jlee@suse.com>
Date: Wed, 10 Aug 2011 16:36:02 +0800
Subject: [PATCH] acer-wmi: add ACER_WMID_v2 interface flag to represent new notebooks
There have new acer notebooks' BIOS provide new WMID_GUID3 and
ACERWMID_EVENT_GUID methods.
Some of machines still keep the old WMID_GUID1 method but more and
more machines were already removed old wmi methods from DSDT.
So, this patch add a new ACER_WMID_v2 interface flag to represent
new acer notebooks, the following is definition:
+ ACER_WMID:
It means this machine only provides WMID_GUID1/2 methods.
+ ACER_WMID_v2:
It means this machine provide new WMID_GUID3 and WMID_EVENT_GUID
methods.
Some ACER_WMID_v2 machines also provide old WMID_GUID1/2 methods,
but we still query/set communication device's state by new
WMID_GUID3 method.
Tested on Acer Travelmate 8572
Signed-off-by: Lee, Chun-Yi <jlee@suse.com>
---
drivers/platform/x86/acer-wmi.c | 409 ++++++++++++++++++++-------------------
1 files changed, 211 insertions(+), 198 deletions(-)
diff --git a/drivers/platform/x86/acer-wmi.c b/drivers/platform/x86/acer-wmi.c
index af2bb20..712a505 100644
--- a/drivers/platform/x86/acer-wmi.c
+++ b/drivers/platform/x86/acer-wmi.c
@@ -190,6 +190,7 @@ enum interface_flags {
ACER_AMW0,
ACER_AMW0_V2,
ACER_WMID,
+ ACER_WMID_v2,
};
#define ACER_DEFAULT_WIRELESS 0
@@ -868,6 +869,176 @@ static acpi_status WMID_set_u32(u32 value, u32 cap, struct wmi_interface *iface)
return WMI_execute_u32(method_id, (u32)value, NULL);
}
+static acpi_status wmid3_get_device_status(u32 *value, u16 device)
+{
+ struct wmid3_gds_return_value return_value;
+ acpi_status status;
+ union acpi_object *obj;
+ struct wmid3_gds_input_param params = {
+ .function_num = 0x1,
+ .hotkey_number = 0x01,
+ .devices = device,
+ };
+ struct acpi_buffer input = {
+ sizeof(struct wmid3_gds_input_param),
+ ¶ms
+ };
+ struct acpi_buffer output = { ACPI_ALLOCATE_BUFFER, NULL };
+
+ status = wmi_evaluate_method(WMID_GUID3, 0, 0x2, &input, &output);
+ if (ACPI_FAILURE(status))
+ return status;
+
+ obj = output.pointer;
+
+ if (!obj)
+ return AE_ERROR;
+ else if (obj->type != ACPI_TYPE_BUFFER) {
+ kfree(obj);
+ return AE_ERROR;
+ }
+ if (obj->buffer.length != 8) {
+ pr_warn("Unknown buffer length %d\n", obj->buffer.length);
+ kfree(obj);
+ return AE_ERROR;
+ }
+
+ return_value = *((struct wmid3_gds_return_value *)obj->buffer.pointer);
+ kfree(obj);
+
+ if (return_value.error_code || return_value.ec_return_value)
+ pr_warn("Get Device Status failed: 0x%x - 0x%x\n",
+ return_value.error_code,
+ return_value.ec_return_value);
+ else
+ *value = !!(return_value.devices & device);
+
+ return status;
+}
+
+static acpi_status wmid_v2_get_u32(u32 *value, u32 cap)
+{
+ u16 device;
+
+ switch (cap) {
+ case ACER_CAP_WIRELESS:
+ device = ACER_WMID3_GDS_WIRELESS;
+ break;
+ case ACER_CAP_BLUETOOTH:
+ device = ACER_WMID3_GDS_BLUETOOTH;
+ break;
+ case ACER_CAP_THREEG:
+ device = ACER_WMID3_GDS_THREEG;
+ break;
+ default:
+ return AE_ERROR;
+ }
+ return wmid3_get_device_status(value, device);
+}
+
+static acpi_status wmid3_set_device_status(u32 value, u16 device)
+{
+ struct wmid3_gds_return_value return_value;
+ acpi_status status;
+ union acpi_object *obj;
+ u16 devices;
+ struct wmid3_gds_input_param params = {
+ .function_num = 0x1,
+ .hotkey_number = 0x01,
+ .devices = ACER_WMID3_GDS_WIRELESS |
+ ACER_WMID3_GDS_THREEG |
+ ACER_WMID3_GDS_WIMAX |
+ ACER_WMID3_GDS_BLUETOOTH,
+ };
+ struct acpi_buffer input = {
+ sizeof(struct wmid3_gds_input_param),
+ ¶ms
+ };
+ struct acpi_buffer output = { ACPI_ALLOCATE_BUFFER, NULL };
+ struct acpi_buffer output2 = { ACPI_ALLOCATE_BUFFER, NULL };
+
+ status = wmi_evaluate_method(WMID_GUID3, 0, 0x2, &input, &output);
+ if (ACPI_FAILURE(status))
+ return status;
+
+ obj = output.pointer;
+
+ if (!obj)
+ return AE_ERROR;
+ else if (obj->type != ACPI_TYPE_BUFFER) {
+ kfree(obj);
+ return AE_ERROR;
+ }
+ if (obj->buffer.length != 8) {
+ pr_warning("Unknown buffer length %d\n", obj->buffer.length);
+ kfree(obj);
+ return AE_ERROR;
+ }
+
+ return_value = *((struct wmid3_gds_return_value *)obj->buffer.pointer);
+ kfree(obj);
+
+ if (return_value.error_code || return_value.ec_return_value) {
+ pr_warning("Get Current Device Status failed: "
+ "0x%x - 0x%x\n", return_value.error_code,
+ return_value.ec_return_value);
+ return status;
+ }
+
+ devices = return_value.devices;
+ params.function_num = 0x2;
+ params.hotkey_number = 0x01;
+ params.devices = (value) ? (devices | device) : (devices & ~device);
+
+ status = wmi_evaluate_method(WMID_GUID3, 0, 0x1, &input, &output2);
+ if (ACPI_FAILURE(status))
+ return status;
+
+ obj = output2.pointer;
+
+ if (!obj)
+ return AE_ERROR;
+ else if (obj->type != ACPI_TYPE_BUFFER) {
+ kfree(obj);
+ return AE_ERROR;
+ }
+ if (obj->buffer.length != 4) {
+ pr_warning("Unknown buffer length %d\n", obj->buffer.length);
+ kfree(obj);
+ return AE_ERROR;
+ }
+
+ return_value = *((struct wmid3_gds_return_value *)obj->buffer.pointer);
+ kfree(obj);
+
+ if (return_value.error_code || return_value.ec_return_value)
+ pr_warning("Set Device Status failed: "
+ "0x%x - 0x%x\n", return_value.error_code,
+ return_value.ec_return_value);
+
+ return status;
+}
+
+static acpi_status wmid_v2_set_u32(u32 value, u32 cap)
+{
+ u16 device;
+
+ switch (cap) {
+ case ACER_CAP_WIRELESS:
+ device = ACER_WMID3_GDS_WIRELESS;
+ break;
+ case ACER_CAP_BLUETOOTH:
+ device = ACER_WMID3_GDS_BLUETOOTH;
+ break;
+ case ACER_CAP_THREEG:
+ device = ACER_WMID3_GDS_THREEG;
+ break;
+ default:
+ return AE_ERROR;
+ }
+ return wmid3_set_device_status(value, device);
+}
+
static void type_aa_dmi_decode(const struct dmi_header *header, void *dummy)
{
struct hotkey_function_type_aa *type_aa;
@@ -913,17 +1084,11 @@ static acpi_status WMID_set_capabilities(void)
return AE_ERROR;
}
- dmi_walk(type_aa_dmi_decode, NULL);
- if (!has_type_aa) {
- interface->capability |= ACER_CAP_WIRELESS;
- if (devices & 0x40)
- interface->capability |= ACER_CAP_THREEG;
- if (devices & 0x10)
- interface->capability |= ACER_CAP_BLUETOOTH;
- }
-
- /* WMID always provides brightness methods */
- interface->capability |= ACER_CAP_BRIGHTNESS;
+ interface->capability |= ACER_CAP_WIRELESS;
+ if (devices & 0x40)
+ interface->capability |= ACER_CAP_THREEG;
+ if (devices & 0x10)
+ interface->capability |= ACER_CAP_BLUETOOTH;
if (!(devices & 0x20))
max_brightness = 0x9;
@@ -936,6 +1101,10 @@ static struct wmi_interface wmid_interface = {
.type = ACER_WMID,
};
+static struct wmi_interface wmid_v2_interface = {
+ .type = ACER_WMID_v2,
+};
+
/*
* Generic Device (interface-independent)
*/
@@ -956,6 +1125,14 @@ static acpi_status get_u32(u32 *value, u32 cap)
case ACER_WMID:
status = WMID_get_u32(value, cap, interface);
break;
+ case ACER_WMID_v2:
+ if (cap & (ACER_CAP_WIRELESS |
+ ACER_CAP_BLUETOOTH |
+ ACER_CAP_THREEG))
+ status = wmid_v2_get_u32(value, cap);
+ else if (wmi_has_guid(WMID_GUID2))
+ status = WMID_get_u32(value, cap, interface);
+ break;
}
return status;
@@ -989,6 +1166,13 @@ static acpi_status set_u32(u32 value, u32 cap)
}
case ACER_WMID:
return WMID_set_u32(value, cap, interface);
+ case ACER_WMID_v2:
+ if (cap & (ACER_CAP_WIRELESS |
+ ACER_CAP_BLUETOOTH |
+ ACER_CAP_THREEG))
+ return wmid_v2_set_u32(value, cap);
+ else if (wmi_has_guid(WMID_GUID2))
+ return WMID_set_u32(value, cap, interface);
default:
return AE_BAD_PARAMETER;
}
@@ -1095,186 +1279,6 @@ static void acer_backlight_exit(void)
backlight_device_unregister(acer_backlight_device);
}
-static acpi_status wmid3_get_device_status(u32 *value, u16 device)
-{
- struct wmid3_gds_return_value return_value;
- acpi_status status;
- union acpi_object *obj;
- struct wmid3_gds_input_param params = {
- .function_num = 0x1,
- .hotkey_number = 0x01,
- .devices = device,
- };
- struct acpi_buffer input = {
- sizeof(struct wmid3_gds_input_param),
- ¶ms
- };
- struct acpi_buffer output = { ACPI_ALLOCATE_BUFFER, NULL };
-
- status = wmi_evaluate_method(WMID_GUID3, 0, 0x2, &input, &output);
- if (ACPI_FAILURE(status))
- return status;
-
- obj = output.pointer;
-
- if (!obj)
- return AE_ERROR;
- else if (obj->type != ACPI_TYPE_BUFFER) {
- kfree(obj);
- return AE_ERROR;
- }
- if (obj->buffer.length != 8) {
- pr_warn("Unknown buffer length %d\n", obj->buffer.length);
- kfree(obj);
- return AE_ERROR;
- }
-
- return_value = *((struct wmid3_gds_return_value *)obj->buffer.pointer);
- kfree(obj);
-
- if (return_value.error_code || return_value.ec_return_value)
- pr_warn("Get Device Status failed: 0x%x - 0x%x\n",
- return_value.error_code,
- return_value.ec_return_value);
- else
- *value = !!(return_value.devices & device);
-
- return status;
-}
-
-static acpi_status get_device_status(u32 *value, u32 cap)
-{
- if (wmi_has_guid(WMID_GUID3)) {
- u16 device;
-
- switch (cap) {
- case ACER_CAP_WIRELESS:
- device = ACER_WMID3_GDS_WIRELESS;
- break;
- case ACER_CAP_BLUETOOTH:
- device = ACER_WMID3_GDS_BLUETOOTH;
- break;
- case ACER_CAP_THREEG:
- device = ACER_WMID3_GDS_THREEG;
- break;
- default:
- return AE_ERROR;
- }
- return wmid3_get_device_status(value, device);
-
- } else {
- return get_u32(value, cap);
- }
-}
-
-static acpi_status wmid3_set_device_status(u32 value, u16 device)
-{
- struct wmid3_gds_return_value return_value;
- acpi_status status;
- union acpi_object *obj;
- u16 devices;
- struct wmid3_gds_input_param params = {
- .function_num = 0x1,
- .hotkey_number = 0x01,
- .devices = ACER_WMID3_GDS_WIRELESS |
- ACER_WMID3_GDS_THREEG |
- ACER_WMID3_GDS_WIMAX |
- ACER_WMID3_GDS_BLUETOOTH,
- };
- struct acpi_buffer input = {
- sizeof(struct wmid3_gds_input_param),
- ¶ms
- };
- struct acpi_buffer output = { ACPI_ALLOCATE_BUFFER, NULL };
- struct acpi_buffer output2 = { ACPI_ALLOCATE_BUFFER, NULL };
-
- status = wmi_evaluate_method(WMID_GUID3, 0, 0x2, &input, &output);
- if (ACPI_FAILURE(status))
- return status;
-
- obj = output.pointer;
-
- if (!obj)
- return AE_ERROR;
- else if (obj->type != ACPI_TYPE_BUFFER) {
- kfree(obj);
- return AE_ERROR;
- }
- if (obj->buffer.length != 8) {
- pr_warning("Unknown buffer length %d\n", obj->buffer.length);
- kfree(obj);
- return AE_ERROR;
- }
-
- return_value = *((struct wmid3_gds_return_value *)obj->buffer.pointer);
- kfree(obj);
-
- if (return_value.error_code || return_value.ec_return_value) {
- pr_warning("Get Current Device Status failed: "
- "0x%x - 0x%x\n", return_value.error_code,
- return_value.ec_return_value);
- return status;
- }
-
- devices = return_value.devices;
- params.function_num = 0x2;
- params.hotkey_number = 0x01;
- params.devices = (value) ? (devices | device) : (devices & ~device);
-
- status = wmi_evaluate_method(WMID_GUID3, 0, 0x1, &input, &output2);
- if (ACPI_FAILURE(status))
- return status;
-
- obj = output2.pointer;
-
- if (!obj)
- return AE_ERROR;
- else if (obj->type != ACPI_TYPE_BUFFER) {
- kfree(obj);
- return AE_ERROR;
- }
- if (obj->buffer.length != 4) {
- pr_warning("Unknown buffer length %d\n", obj->buffer.length);
- kfree(obj);
- return AE_ERROR;
- }
-
- return_value = *((struct wmid3_gds_return_value *)obj->buffer.pointer);
- kfree(obj);
-
- if (return_value.error_code || return_value.ec_return_value)
- pr_warning("Set Device Status failed: "
- "0x%x - 0x%x\n", return_value.error_code,
- return_value.ec_return_value);
-
- return status;
-}
-
-static acpi_status set_device_status(u32 value, u32 cap)
-{
- if (wmi_has_guid(WMID_GUID3)) {
- u16 device;
-
- switch (cap) {
- case ACER_CAP_WIRELESS:
- device = ACER_WMID3_GDS_WIRELESS;
- break;
- case ACER_CAP_BLUETOOTH:
- device = ACER_WMID3_GDS_BLUETOOTH;
- break;
- case ACER_CAP_THREEG:
- device = ACER_WMID3_GDS_THREEG;
- break;
- default:
- return AE_ERROR;
- }
- return wmid3_set_device_status(value, device);
-
- } else {
- return set_u32(value, cap);
- }
-}
-
/*
* Rfkill devices
*/
@@ -1301,8 +1305,7 @@ static void acer_rfkill_update(struct work_struct *ignored)
}
if (has_cap(ACER_CAP_THREEG) && wmi_has_guid(WMID_GUID3)) {
- status = wmid3_get_device_status(&state,
- ACER_WMID3_GDS_THREEG);
+ status = get_u32(&state, ACER_WMID3_GDS_THREEG);
if (ACPI_SUCCESS(status))
rfkill_set_sw_state(threeg_rfkill, !state);
}
@@ -1316,7 +1319,7 @@ static int acer_rfkill_set(void *data, bool blocked)
u32 cap = (unsigned long)data;
if (rfkill_inited) {
- status = set_device_status(!blocked, cap);
+ status = set_u32(!blocked, cap);
if (ACPI_FAILURE(status))
return -ENODEV;
}
@@ -1343,7 +1346,7 @@ static struct rfkill *acer_rfkill_register(struct device *dev,
if (!rfkill_dev)
return ERR_PTR(-ENOMEM);
- status = get_device_status(&state, cap);
+ status = get_u32(&state, cap);
err = rfkill_register(rfkill_dev);
if (err) {
@@ -1464,6 +1467,8 @@ static ssize_t show_interface(struct device *dev, struct device_attribute *attr,
return sprintf(buf, "AMW0 v2\n");
case ACER_WMID:
return sprintf(buf, "WMID\n");
+ case ACER_WMID_v2:
+ return sprintf(buf, "WMID v2\n");
default:
return sprintf(buf, "Error!\n");
}
@@ -1883,12 +1888,20 @@ static int __init acer_wmi_init(void)
if (!wmi_has_guid(AMW0_GUID1) && wmi_has_guid(WMID_GUID1))
interface = &wmid_interface;
+ if (wmi_has_guid(WMID_GUID3))
+ interface = &wmid_v2_interface;
+
+ if (interface)
+ dmi_walk(type_aa_dmi_decode, NULL);
+
if (wmi_has_guid(WMID_GUID2) && interface) {
- if (ACPI_FAILURE(WMID_set_capabilities())) {
+ if (!has_type_aa && ACPI_FAILURE(WMID_set_capabilities())) {
pr_err("Unable to detect available WMID devices\n");
return -ENODEV;
}
- } else if (!wmi_has_guid(WMID_GUID2) && interface) {
+ /* WMID always provides brightness methods */
+ interface->capability |= ACER_CAP_BRIGHTNESS;
+ } else if (!wmi_has_guid(WMID_GUID2) && interface && !has_type_aa) {
pr_err("No WMID device detection method found\n");
return -ENODEV;
}
@@ -1912,7 +1925,7 @@ static int __init acer_wmi_init(void)
set_quirks();
- if (acpi_video_backlight_support() && has_cap(ACER_CAP_BRIGHTNESS)) {
+ if (acpi_video_backlight_support()) {
interface->capability &= ~ACER_CAP_BRIGHTNESS;
pr_info("Brightness must be controlled by "
"generic video driver\n");
--
1.6.0.2
^ permalink raw reply related [flat|nested] 16+ messages in thread[parent not found: <4E25AFC7020000230002F7D1@novprvlin0050.provo.novell.com>]
* Re: [Fwd: Re: A problem about acer-wmi]
[not found] <4E25AFC7020000230002F7D1@novprvlin0050.provo.novell.com>
@ 2011-08-09 2:05 ` AceLan Kao
2011-08-09 2:07 ` AceLan Kao
2011-08-09 2:14 ` joeyli
0 siblings, 2 replies; 16+ messages in thread
From: AceLan Kao @ 2011-08-09 2:05 UTC (permalink / raw)
To: Joey Lee; +Cc: platform-driver-x86
Dear Joey,
Is there any progress of the acer-wmi patch?
I read the Acer WMI/SMBIOS Spec. and think we might need to create a
new acer-wmi driver for the new machines and leave the original
acer-wmi driver for the old ones.
The GUID is changed and there are more functions be added in the spec.
that the acer-wmi driver is hard to handle now.
And I'm not sure if I can implement a open source wmi driver from the spec.
Please input more idea about this, thanks.
Best regards,
AceLan Kao.
2011/7/19 Joey Lee <jlee@novell.com>:
> Cc. to platform driver mail
>
> Hi AceLan,
>
> In old acer machine supports both old WMI_GUID1 and new WMI_WMID3, but
> more and more machines removed old WMI_GUID1 method and just support new
> one.
>
> I will spend a bit time to clear up acer-wmi driver, add support to
> those new machines.
> I will send out patches for review.
>
>
>
> Thank's a lot!
> Joey Lee
>
>
> -------- 轉遞的郵件 --------
>> 自: AceLan Kao <acelan.kao@canonical.com>
>> 至: Joey Lee <jlee@novell.com>
>> 主旨: Re: A problem about acer-wmi
>> 日期: Tue, 19 Jul 2011 11:37:28 +0800
>>
>> Dear Joey,
>>
>> Thanks for your quick response.
>> Here are the logs and it's good to discuss this issue on platform driver list.
>> Thanks.
>>
>> Best regards,
>> AceLan Kao.
>>
>> 2011/7/19 Joey Lee <jlee@novell.com>:
>> > 於 二,2011-07-19 於 02:57 +0000,joeyli(Joey Lee) 提到:
>> >> Hi Kao,
>> >>
>> >> 於 二,2011-07-19 於 09:43 +0800,AceLan Kao 提到:
>> >> > Dear Joey,
>> >> >
>> >> > We have a new machine the model is Acer Aspire 4739Z
>> >> > I tried to add it's model in acer_quirks struct, but in
>> >> > acer_wmi_init(), it can't find it's interface.
>> >> > {
>> >> > .callback = dmi_matched,
>> >> > .ident = "Acer Aspire 4739Z",
>> >> > .matches = {
>> >> > DMI_MATCH(DMI_SYS_VENDOR, "Acer"),
>> >> > DMI_MATCH(DMI_PRODUCT_NAME, "AS4739Z"),
>> >> > },
>> >> > .driver_data = &quirk_acer_travelmate_2490,
>> >> > },
>> >> >
>> >> > wmi_has_guid(AMW0_GUID1), wmi_has_guid(WMID_GUID1), and
>> >> > wmi_has_guid(WMID_GUID2) all return 0.
>> >> > And, wmi_has_guid(WMID_GUID3) and wmi_has_guid(ACERWMID_EVENT_GUID) return 1.
>> >> >
>> >> > I don't understand the logic of those wmi_has_guid(), so I don't know
>> >> > how to modify them, I just assigned the interface as
>> >> > interface = &wmid_interface;
>> >> > and that would make us capture the KEY_F22(Touch Pad On/Off) event and
>> >> > get the OSD appeared.
>> >> >
>> >> > Please direct me how to add this h/w correctly into acer_wmi.c and
>> >> > please let me know if I should provide any info you need.
>> >> > Thanks.
>> >> >
>> >> > Best regards,
>> >> > AceLan Kao.
>> >> >
>> >>
>> >> Thank's for you pay attention to acer-wmi driver. Please attached the
>> >> dmidecode log and acpidump on this mail to me.
>> >> Then, I can trace the DSDT to find out good way.
>> >>
>> >
>> > Forgot tell how to capture the log and DSDT:
>> > + dmidecode > dmidecode.log
>> > + acpidump > acpidump.dat
>> >
>> >
>> > Thank's a lot!
>> > Joey Lee
>> >
>> >> And,
>> >> Do you mind if I forward this mail to platform driver group on kernel
>> >> upstream?
>> >> Then we can discuss on upstream, maybe have more experts can provide
>> >> commants to us.
>> >>
>> >>
>> >> Thank's a lot!
>> >> Joey Lee
>> >
>> >
>> >
>>
>>
>>
>
>
>
--
Chia-Lin Kao(AceLan)
http://blog.acelan.idv.tw/
E-Mail: acelan.kaoATcanonical.com (s/AT/@/)
^ permalink raw reply [flat|nested] 16+ messages in thread* Re: [Fwd: Re: A problem about acer-wmi]
2011-08-09 2:05 ` AceLan Kao
@ 2011-08-09 2:07 ` AceLan Kao
2011-08-09 2:14 ` joeyli
1 sibling, 0 replies; 16+ messages in thread
From: AceLan Kao @ 2011-08-09 2:07 UTC (permalink / raw)
To: Joey Lee; +Cc: platform-driver-x86
Resend from my gmail account
在 2011年8月9日上午10:05,AceLan Kao <acelan.kao@canonical.com> 寫道:
> Dear Joey,
>
> Is there any progress of the acer-wmi patch?
>
> I read the Acer WMI/SMBIOS Spec. and think we might need to create a
> new acer-wmi driver for the new machines and leave the original
> acer-wmi driver for the old ones.
> The GUID is changed and there are more functions be added in the spec.
> that the acer-wmi driver is hard to handle now.
> And I'm not sure if I can implement a open source wmi driver from the spec.
> Please input more idea about this, thanks.
>
> Best regards,
> AceLan Kao.
>
> 2011/7/19 Joey Lee <jlee@novell.com>:
>> Cc. to platform driver mail
>>
>> Hi AceLan,
>>
>> In old acer machine supports both old WMI_GUID1 and new WMI_WMID3, but
>> more and more machines removed old WMI_GUID1 method and just support new
>> one.
>>
>> I will spend a bit time to clear up acer-wmi driver, add support to
>> those new machines.
>> I will send out patches for review.
>>
>>
>>
>> Thank's a lot!
>> Joey Lee
>>
>>
>> -------- 轉遞的郵件 --------
>>> 自: AceLan Kao <acelan.kao@canonical.com>
>>> 至: Joey Lee <jlee@novell.com>
>>> 主旨: Re: A problem about acer-wmi
>>> 日期: Tue, 19 Jul 2011 11:37:28 +0800
>>>
>>> Dear Joey,
>>>
>>> Thanks for your quick response.
>>> Here are the logs and it's good to discuss this issue on platform driver list.
>>> Thanks.
>>>
>>> Best regards,
>>> AceLan Kao.
>>>
>>> 2011/7/19 Joey Lee <jlee@novell.com>:
>>> > 於 二,2011-07-19 於 02:57 +0000,joeyli(Joey Lee) 提到:
>>> >> Hi Kao,
>>> >>
>>> >> 於 二,2011-07-19 於 09:43 +0800,AceLan Kao 提到:
>>> >> > Dear Joey,
>>> >> >
>>> >> > We have a new machine the model is Acer Aspire 4739Z
>>> >> > I tried to add it's model in acer_quirks struct, but in
>>> >> > acer_wmi_init(), it can't find it's interface.
>>> >> > {
>>> >> > .callback = dmi_matched,
>>> >> > .ident = "Acer Aspire 4739Z",
>>> >> > .matches = {
>>> >> > DMI_MATCH(DMI_SYS_VENDOR, "Acer"),
>>> >> > DMI_MATCH(DMI_PRODUCT_NAME, "AS4739Z"),
>>> >> > },
>>> >> > .driver_data = &quirk_acer_travelmate_2490,
>>> >> > },
>>> >> >
>>> >> > wmi_has_guid(AMW0_GUID1), wmi_has_guid(WMID_GUID1), and
>>> >> > wmi_has_guid(WMID_GUID2) all return 0.
>>> >> > And, wmi_has_guid(WMID_GUID3) and wmi_has_guid(ACERWMID_EVENT_GUID) return 1.
>>> >> >
>>> >> > I don't understand the logic of those wmi_has_guid(), so I don't know
>>> >> > how to modify them, I just assigned the interface as
>>> >> > interface = &wmid_interface;
>>> >> > and that would make us capture the KEY_F22(Touch Pad On/Off) event and
>>> >> > get the OSD appeared.
>>> >> >
>>> >> > Please direct me how to add this h/w correctly into acer_wmi.c and
>>> >> > please let me know if I should provide any info you need.
>>> >> > Thanks.
>>> >> >
>>> >> > Best regards,
>>> >> > AceLan Kao.
>>> >> >
>>> >>
>>> >> Thank's for you pay attention to acer-wmi driver. Please attached the
>>> >> dmidecode log and acpidump on this mail to me.
>>> >> Then, I can trace the DSDT to find out good way.
>>> >>
>>> >
>>> > Forgot tell how to capture the log and DSDT:
>>> > + dmidecode > dmidecode.log
>>> > + acpidump > acpidump.dat
>>> >
>>> >
>>> > Thank's a lot!
>>> > Joey Lee
>>> >
>>> >> And,
>>> >> Do you mind if I forward this mail to platform driver group on kernel
>>> >> upstream?
>>> >> Then we can discuss on upstream, maybe have more experts can provide
>>> >> commants to us.
>>> >>
>>> >>
>>> >> Thank's a lot!
>>> >> Joey Lee
>>> >
>>> >
>>> >
>>>
>>>
>>>
>>
>>
>>
>
>
>
> --
> Chia-Lin Kao(AceLan)
> http://blog.acelan.idv.tw/
> E-Mail: acelan.kaoATcanonical.com (s/AT/@/)
>
--
Chia-Lin Kao(AceLan)
http://blog.acelan.idv.tw/
E-Mail: acelan.kaoATcanonical.com (s/AT/@/)
^ permalink raw reply [flat|nested] 16+ messages in thread* Re: [Fwd: Re: A problem about acer-wmi]
2011-08-09 2:05 ` AceLan Kao
2011-08-09 2:07 ` AceLan Kao
@ 2011-08-09 2:14 ` joeyli
2011-08-09 6:33 ` AceLan Kao
1 sibling, 1 reply; 16+ messages in thread
From: joeyli @ 2011-08-09 2:14 UTC (permalink / raw)
To: AceLan Kao; +Cc: Joey Lee, platform-driver-x86
於 二,2011-08-09 於 10:05 +0800,AceLan Kao 提到:
> Dear Joey,
>
> Is there any progress of the acer-wmi patch?
>
Sorry for I am busy from last 2 weeks until now.
> I read the Acer WMI/SMBIOS Spec. and think we might need to create a
> new acer-wmi driver for the new machines and leave the original
> acer-wmi driver for the old ones.
> The GUID is changed and there are more functions be added in the spec.
> that the acer-wmi driver is hard to handle now.
> And I'm not sure if I can implement a open source wmi driver from the spec.
> Please input more idea about this, thanks.
>
> Best regards,
> AceLan Kao.
>
I don't think we need a new acer-wmi driver to handle new machine,
because acer-wmi driver already support the following WMI methods:
#define WMID_GUID3 "61EF69EA-865C-4BC3-A502-A0DEBA0CB531"
#define ACERWMID_EVENT_GUID "676AA15E-6A47-4D9F-A2CC-1E6D18D14026"
I will find a bit time at this week to clear up acer-wmi driver.
Did you see any function key or new function didn't handle by current
acer-wmi driver?
Thank's
Joey Lee
> 2011/7/19 Joey Lee <jlee@novell.com>:
> > Cc. to platform driver mail
> >
> > Hi AceLan,
> >
> > In old acer machine supports both old WMI_GUID1 and new WMI_WMID3, but
> > more and more machines removed old WMI_GUID1 method and just support new
> > one.
> >
> > I will spend a bit time to clear up acer-wmi driver, add support to
> > those new machines.
> > I will send out patches for review.
> >
> >
> >
> > Thank's a lot!
> > Joey Lee
> >
> >
> > -------- 轉遞的郵件 --------
> >> 自: AceLan Kao <acelan.kao@canonical.com>
> >> 至: Joey Lee <jlee@novell.com>
> >> 主旨: Re: A problem about acer-wmi
> >> 日期: Tue, 19 Jul 2011 11:37:28 +0800
> >>
> >> Dear Joey,
> >>
> >> Thanks for your quick response.
> >> Here are the logs and it's good to discuss this issue on platform driver list.
> >> Thanks.
> >>
> >> Best regards,
> >> AceLan Kao.
> >>
> >> 2011/7/19 Joey Lee <jlee@novell.com>:
> >> > 於 二,2011-07-19 於 02:57 +0000,joeyli(Joey Lee) 提到:
> >> >> Hi Kao,
> >> >>
> >> >> 於 二,2011-07-19 於 09:43 +0800,AceLan Kao 提到:
> >> >> > Dear Joey,
> >> >> >
> >> >> > We have a new machine the model is Acer Aspire 4739Z
> >> >> > I tried to add it's model in acer_quirks struct, but in
> >> >> > acer_wmi_init(), it can't find it's interface.
> >> >> > {
> >> >> > .callback = dmi_matched,
> >> >> > .ident = "Acer Aspire 4739Z",
> >> >> > .matches = {
> >> >> > DMI_MATCH(DMI_SYS_VENDOR, "Acer"),
> >> >> > DMI_MATCH(DMI_PRODUCT_NAME, "AS4739Z"),
> >> >> > },
> >> >> > .driver_data = &quirk_acer_travelmate_2490,
> >> >> > },
> >> >> >
> >> >> > wmi_has_guid(AMW0_GUID1), wmi_has_guid(WMID_GUID1), and
> >> >> > wmi_has_guid(WMID_GUID2) all return 0.
> >> >> > And, wmi_has_guid(WMID_GUID3) and wmi_has_guid(ACERWMID_EVENT_GUID) return 1.
> >> >> >
> >> >> > I don't understand the logic of those wmi_has_guid(), so I don't know
> >> >> > how to modify them, I just assigned the interface as
> >> >> > interface = &wmid_interface;
> >> >> > and that would make us capture the KEY_F22(Touch Pad On/Off) event and
> >> >> > get the OSD appeared.
> >> >> >
> >> >> > Please direct me how to add this h/w correctly into acer_wmi.c and
> >> >> > please let me know if I should provide any info you need.
> >> >> > Thanks.
> >> >> >
> >> >> > Best regards,
> >> >> > AceLan Kao.
> >> >> >
> >> >>
> >> >> Thank's for you pay attention to acer-wmi driver. Please attached the
> >> >> dmidecode log and acpidump on this mail to me.
> >> >> Then, I can trace the DSDT to find out good way.
> >> >>
> >> >
> >> > Forgot tell how to capture the log and DSDT:
> >> > + dmidecode > dmidecode.log
> >> > + acpidump > acpidump.dat
> >> >
> >> >
> >> > Thank's a lot!
> >> > Joey Lee
> >> >
> >> >> And,
> >> >> Do you mind if I forward this mail to platform driver group on kernel
> >> >> upstream?
> >> >> Then we can discuss on upstream, maybe have more experts can provide
> >> >> commants to us.
> >> >>
> >> >>
> >> >> Thank's a lot!
> >> >> Joey Lee
> >> >
> >> >
> >> >
> >>
> >>
> >>
> >
> >
> >
>
>
>
^ permalink raw reply [flat|nested] 16+ messages in thread* Re: [Fwd: Re: A problem about acer-wmi]
2011-08-09 2:14 ` joeyli
@ 2011-08-09 6:33 ` AceLan Kao
2011-08-10 2:13 ` joeyli
0 siblings, 1 reply; 16+ messages in thread
From: AceLan Kao @ 2011-08-09 6:33 UTC (permalink / raw)
To: joeyli; +Cc: Joey Lee, platform-driver-x86
Dear Joey,
The current project we have right now have to follow the Acer WMI to
handle the key events, that means no EC key event.
And we have 3 keys that are not working now, they are touchpad toggle,
brightness up, and brightness down.
The touchpad toggle function is a Hotkey Break Event(function number
0x2), and brightness key events are Brightness Change Event(function
number 0x4). But now acer-wmi driver only handles General Hotkey
Event(function number 0x1).
I just implemented those 3 key events, so I think maybe we don't have
to create a new acer-wmi driver.
I'm longing for your work to clear up the acer-wmi driver, so that I
can add the new machine id and send you the patch.
Thanks.
BTW, I'm available to help if you are too busy to do that.
Best regards,
AceLan Kao.
2011/8/9 joeyli <jlee@suse.com>:
> 於 二,2011-08-09 於 10:05 +0800,AceLan Kao 提到:
>> Dear Joey,
>>
>> Is there any progress of the acer-wmi patch?
>>
>
> Sorry for I am busy from last 2 weeks until now.
>
>> I read the Acer WMI/SMBIOS Spec. and think we might need to create a
>> new acer-wmi driver for the new machines and leave the original
>> acer-wmi driver for the old ones.
>> The GUID is changed and there are more functions be added in the spec.
>> that the acer-wmi driver is hard to handle now.
>> And I'm not sure if I can implement a open source wmi driver from the spec.
>> Please input more idea about this, thanks.
>>
>> Best regards,
>> AceLan Kao.
>>
>
> I don't think we need a new acer-wmi driver to handle new machine,
> because acer-wmi driver already support the following WMI methods:
>
> #define WMID_GUID3 "61EF69EA-865C-4BC3-A502-A0DEBA0CB531"
> #define ACERWMID_EVENT_GUID "676AA15E-6A47-4D9F-A2CC-1E6D18D14026"
>
> I will find a bit time at this week to clear up acer-wmi driver.
>
> Did you see any function key or new function didn't handle by current
> acer-wmi driver?
>
>
> Thank's
> Joey Lee
>
>> 2011/7/19 Joey Lee <jlee@novell.com>:
>> > Cc. to platform driver mail
>> >
>> > Hi AceLan,
>> >
>> > In old acer machine supports both old WMI_GUID1 and new WMI_WMID3, but
>> > more and more machines removed old WMI_GUID1 method and just support new
>> > one.
>> >
>> > I will spend a bit time to clear up acer-wmi driver, add support to
>> > those new machines.
>> > I will send out patches for review.
>> >
>> >
>> >
>> > Thank's a lot!
>> > Joey Lee
>> >
>> >
>> > -------- 轉遞的郵件 --------
>> >> 自: AceLan Kao <acelan.kao@canonical.com>
>> >> 至: Joey Lee <jlee@novell.com>
>> >> 主旨: Re: A problem about acer-wmi
>> >> 日期: Tue, 19 Jul 2011 11:37:28 +0800
>> >>
>> >> Dear Joey,
>> >>
>> >> Thanks for your quick response.
>> >> Here are the logs and it's good to discuss this issue on platform driver list.
>> >> Thanks.
>> >>
>> >> Best regards,
>> >> AceLan Kao.
>> >>
>> >> 2011/7/19 Joey Lee <jlee@novell.com>:
>> >> > 於 二,2011-07-19 於 02:57 +0000,joeyli(Joey Lee) 提到:
>> >> >> Hi Kao,
>> >> >>
>> >> >> 於 二,2011-07-19 於 09:43 +0800,AceLan Kao 提到:
>> >> >> > Dear Joey,
>> >> >> >
>> >> >> > We have a new machine the model is Acer Aspire 4739Z
>> >> >> > I tried to add it's model in acer_quirks struct, but in
>> >> >> > acer_wmi_init(), it can't find it's interface.
>> >> >> > {
>> >> >> > .callback = dmi_matched,
>> >> >> > .ident = "Acer Aspire 4739Z",
>> >> >> > .matches = {
>> >> >> > DMI_MATCH(DMI_SYS_VENDOR, "Acer"),
>> >> >> > DMI_MATCH(DMI_PRODUCT_NAME, "AS4739Z"),
>> >> >> > },
>> >> >> > .driver_data = &quirk_acer_travelmate_2490,
>> >> >> > },
>> >> >> >
>> >> >> > wmi_has_guid(AMW0_GUID1), wmi_has_guid(WMID_GUID1), and
>> >> >> > wmi_has_guid(WMID_GUID2) all return 0.
>> >> >> > And, wmi_has_guid(WMID_GUID3) and wmi_has_guid(ACERWMID_EVENT_GUID) return 1.
>> >> >> >
>> >> >> > I don't understand the logic of those wmi_has_guid(), so I don't know
>> >> >> > how to modify them, I just assigned the interface as
>> >> >> > interface = &wmid_interface;
>> >> >> > and that would make us capture the KEY_F22(Touch Pad On/Off) event and
>> >> >> > get the OSD appeared.
>> >> >> >
>> >> >> > Please direct me how to add this h/w correctly into acer_wmi.c and
>> >> >> > please let me know if I should provide any info you need.
>> >> >> > Thanks.
>> >> >> >
>> >> >> > Best regards,
>> >> >> > AceLan Kao.
>> >> >> >
>> >> >>
>> >> >> Thank's for you pay attention to acer-wmi driver. Please attached the
>> >> >> dmidecode log and acpidump on this mail to me.
>> >> >> Then, I can trace the DSDT to find out good way.
>> >> >>
>> >> >
>> >> > Forgot tell how to capture the log and DSDT:
>> >> > + dmidecode > dmidecode.log
>> >> > + acpidump > acpidump.dat
>> >> >
>> >> >
>> >> > Thank's a lot!
>> >> > Joey Lee
>> >> >
>> >> >> And,
>> >> >> Do you mind if I forward this mail to platform driver group on kernel
>> >> >> upstream?
>> >> >> Then we can discuss on upstream, maybe have more experts can provide
>> >> >> commants to us.
>> >> >>
>> >> >>
>> >> >> Thank's a lot!
>> >> >> Joey Lee
>> >> >
>> >> >
>> >> >
>> >>
>> >>
>> >>
>> >
>> >
>> >
>>
>>
>>
>
>
>
--
Chia-Lin Kao(AceLan)
http://blog.acelan.idv.tw/
E-Mail: acelan.kaoATcanonical.com (s/AT/@/)
^ permalink raw reply [flat|nested] 16+ messages in thread* Re: [Fwd: Re: A problem about acer-wmi]
2011-08-09 6:33 ` AceLan Kao
@ 2011-08-10 2:13 ` joeyli
2011-08-10 8:49 ` joeyli
0 siblings, 1 reply; 16+ messages in thread
From: joeyli @ 2011-08-10 2:13 UTC (permalink / raw)
To: AceLan Kao; +Cc: Joey Lee, platform-driver-x86
於 二,2011-08-09 於 14:33 +0800,AceLan Kao 提到:
> Dear Joey,
>
> The current project we have right now have to follow the Acer WMI to
> handle the key events, that means no EC key event.
> And we have 3 keys that are not working now, they are touchpad toggle,
> brightness up, and brightness down.
> The touchpad toggle function is a Hotkey Break Event(function number
> 0x2), and brightness key events are Brightness Change Event(function
> number 0x4). But now acer-wmi driver only handles General Hotkey
> Event(function number 0x1).
>
Yes, current acer-wmi only capture the event function number 0x1, you
can add those new function to acer_wmi_notify().
> I just implemented those 3 key events, so I think maybe we don't have
> to create a new acer-wmi driver.
Great! Welcome for you patches, I will also test it.
> I'm longing for your work to clear up the acer-wmi driver, so that I
> can add the new machine id and send you the patch.
> Thanks.
>
> BTW, I'm available to help if you are too busy to do that.
>
> Best regards,
> AceLan Kao.
>
I am doing the clear up, now, will send out patch (I hope today).
Thank's
Joey Lee
> 2011/8/9 joeyli <jlee@suse.com>:
> > 於 二,2011-08-09 於 10:05 +0800,AceLan Kao 提到:
> >> Dear Joey,
> >>
> >> Is there any progress of the acer-wmi patch?
> >>
> >
> > Sorry for I am busy from last 2 weeks until now.
> >
> >> I read the Acer WMI/SMBIOS Spec. and think we might need to create a
> >> new acer-wmi driver for the new machines and leave the original
> >> acer-wmi driver for the old ones.
> >> The GUID is changed and there are more functions be added in the spec.
> >> that the acer-wmi driver is hard to handle now.
> >> And I'm not sure if I can implement a open source wmi driver from the spec.
> >> Please input more idea about this, thanks.
> >>
> >> Best regards,
> >> AceLan Kao.
> >>
> >
> > I don't think we need a new acer-wmi driver to handle new machine,
> > because acer-wmi driver already support the following WMI methods:
> >
> > #define WMID_GUID3 "61EF69EA-865C-4BC3-A502-A0DEBA0CB531"
> > #define ACERWMID_EVENT_GUID "676AA15E-6A47-4D9F-A2CC-1E6D18D14026"
> >
> > I will find a bit time at this week to clear up acer-wmi driver.
> >
> > Did you see any function key or new function didn't handle by current
> > acer-wmi driver?
> >
> >
> > Thank's
> > Joey Lee
> >
> >> 2011/7/19 Joey Lee <jlee@novell.com>:
> >> > Cc. to platform driver mail
> >> >
> >> > Hi AceLan,
> >> >
> >> > In old acer machine supports both old WMI_GUID1 and new WMI_WMID3, but
> >> > more and more machines removed old WMI_GUID1 method and just support new
> >> > one.
> >> >
> >> > I will spend a bit time to clear up acer-wmi driver, add support to
> >> > those new machines.
> >> > I will send out patches for review.
> >> >
> >> >
> >> >
> >> > Thank's a lot!
> >> > Joey Lee
> >> >
> >> >
> >> > -------- 轉遞的郵件 --------
> >> >> 自: AceLan Kao <acelan.kao@canonical.com>
> >> >> 至: Joey Lee <jlee@novell.com>
> >> >> 主旨: Re: A problem about acer-wmi
> >> >> 日期: Tue, 19 Jul 2011 11:37:28 +0800
> >> >>
> >> >> Dear Joey,
> >> >>
> >> >> Thanks for your quick response.
> >> >> Here are the logs and it's good to discuss this issue on platform driver list.
> >> >> Thanks.
> >> >>
> >> >> Best regards,
> >> >> AceLan Kao.
> >> >>
> >> >> 2011/7/19 Joey Lee <jlee@novell.com>:
> >> >> > 於 二,2011-07-19 於 02:57 +0000,joeyli(Joey Lee) 提到:
> >> >> >> Hi Kao,
> >> >> >>
> >> >> >> 於 二,2011-07-19 於 09:43 +0800,AceLan Kao 提到:
> >> >> >> > Dear Joey,
> >> >> >> >
> >> >> >> > We have a new machine the model is Acer Aspire 4739Z
> >> >> >> > I tried to add it's model in acer_quirks struct, but in
> >> >> >> > acer_wmi_init(), it can't find it's interface.
> >> >> >> > {
> >> >> >> > .callback = dmi_matched,
> >> >> >> > .ident = "Acer Aspire 4739Z",
> >> >> >> > .matches = {
> >> >> >> > DMI_MATCH(DMI_SYS_VENDOR, "Acer"),
> >> >> >> > DMI_MATCH(DMI_PRODUCT_NAME, "AS4739Z"),
> >> >> >> > },
> >> >> >> > .driver_data = &quirk_acer_travelmate_2490,
> >> >> >> > },
> >> >> >> >
> >> >> >> > wmi_has_guid(AMW0_GUID1), wmi_has_guid(WMID_GUID1), and
> >> >> >> > wmi_has_guid(WMID_GUID2) all return 0.
> >> >> >> > And, wmi_has_guid(WMID_GUID3) and wmi_has_guid(ACERWMID_EVENT_GUID) return 1.
> >> >> >> >
> >> >> >> > I don't understand the logic of those wmi_has_guid(), so I don't know
> >> >> >> > how to modify them, I just assigned the interface as
> >> >> >> > interface = &wmid_interface;
> >> >> >> > and that would make us capture the KEY_F22(Touch Pad On/Off) event and
> >> >> >> > get the OSD appeared.
> >> >> >> >
> >> >> >> > Please direct me how to add this h/w correctly into acer_wmi.c and
> >> >> >> > please let me know if I should provide any info you need.
> >> >> >> > Thanks.
> >> >> >> >
> >> >> >> > Best regards,
> >> >> >> > AceLan Kao.
> >> >> >> >
> >> >> >>
> >> >> >> Thank's for you pay attention to acer-wmi driver. Please attached the
> >> >> >> dmidecode log and acpidump on this mail to me.
> >> >> >> Then, I can trace the DSDT to find out good way.
> >> >> >>
> >> >> >
> >> >> > Forgot tell how to capture the log and DSDT:
> >> >> > + dmidecode > dmidecode.log
> >> >> > + acpidump > acpidump.dat
> >> >> >
> >> >> >
> >> >> > Thank's a lot!
> >> >> > Joey Lee
> >> >> >
> >> >> >> And,
> >> >> >> Do you mind if I forward this mail to platform driver group on kernel
> >> >> >> upstream?
> >> >> >> Then we can discuss on upstream, maybe have more experts can provide
> >> >> >> commants to us.
> >> >> >>
> >> >> >>
> >> >> >> Thank's a lot!
> >> >> >> Joey Lee
> >> >> >
> >> >> >
> >> >> >
> >> >>
> >> >>
> >> >>
> >> >
> >> >
> >> >
> >>
> >>
> >>
> >
> >
> >
>
>
>
^ permalink raw reply [flat|nested] 16+ messages in thread* Re: [Fwd: Re: A problem about acer-wmi]
2011-08-10 2:13 ` joeyli
@ 2011-08-10 8:49 ` joeyli
0 siblings, 0 replies; 16+ messages in thread
From: joeyli @ 2011-08-10 8:49 UTC (permalink / raw)
To: AceLan Kao; +Cc: Joey Lee, platform-driver-x86
Hi AceLan,
於 三,2011-08-10 於 10:13 +0800,joeyli 提到:
> 於 二,2011-08-09 於 14:33 +0800,AceLan Kao 提到:
> > Dear Joey,
> >
> > The current project we have right now have to follow the Acer WMI to
> > handle the key events, that means no EC key event.
> > And we have 3 keys that are not working now, they are touchpad toggle,
> > brightness up, and brightness down.
> > The touchpad toggle function is a Hotkey Break Event(function number
> > 0x2), and brightness key events are Brightness Change Event(function
> > number 0x4). But now acer-wmi driver only handles General Hotkey
> > Event(function number 0x1).
> >
>
> Yes, current acer-wmi only capture the event function number 0x1, you
> can add those new function to acer_wmi_notify().
>
> > I just implemented those 3 key events, so I think maybe we don't have
> > to create a new acer-wmi driver.
>
> Great! Welcome for you patches, I will also test it.
>
> > I'm longing for your work to clear up the acer-wmi driver, so that I
> > can add the new machine id and send you the patch.
> > Thanks.
> >
> > BTW, I'm available to help if you are too busy to do that.
> >
> > Best regards,
> > AceLan Kao.
> >
>
> I am doing the clear up, now, will send out patch (I hope today).
>
>
> Thank's
> Joey Lee
>
I add a new ACER_WMID_v2 interface flag and do some clear up in acer-wmi
initial function and get_u32 functions.
Please kindly test this patch:
Thank's
Joey Lee
From 28b2e2ebaa230d339d5749b581c667ed074bb7ea Mon Sep 17 00:00:00 2001
From: Lee, Chun-Yi <jlee@suse.com>
Date: Wed, 10 Aug 2011 16:36:02 +0800
Subject: [PATCH] acer-wmi: add ACER_WMID_v2 interface flag to represent new notebooks
There have new acer notebooks' BIOS provide new WMID_GUID3 and
ACERWMID_EVENT_GUID methods.
Some of machines still keep the old WMID_GUID1 method but more and
more machines were already removed old wmi methods from DSDT.
So, this patch add a new ACER_WMID_v2 interface flag to represent
new acer notebooks, the following is definition:
+ ACER_WMID:
It means this machine only provides WMID_GUID1/2 methods.
+ ACER_WMID_v2:
It means this machine provide new WMID_GUID3 and WMID_EVENT_GUID
methods.
Some ACER_WMID_v2 machines also provide old WMID_GUID1/2 methods,
but we still query/set communication device's state by new
WMID_GUID3 method.
Tested on Acer Travelmate 8572
Signed-off-by: Lee, Chun-Yi <jlee@suse.com>
---
drivers/platform/x86/acer-wmi.c | 409 ++++++++++++++++++++-------------------
1 files changed, 211 insertions(+), 198 deletions(-)
diff --git a/drivers/platform/x86/acer-wmi.c b/drivers/platform/x86/acer-wmi.c
index af2bb20..712a505 100644
--- a/drivers/platform/x86/acer-wmi.c
+++ b/drivers/platform/x86/acer-wmi.c
@@ -190,6 +190,7 @@ enum interface_flags {
ACER_AMW0,
ACER_AMW0_V2,
ACER_WMID,
+ ACER_WMID_v2,
};
#define ACER_DEFAULT_WIRELESS 0
@@ -868,6 +869,176 @@ static acpi_status WMID_set_u32(u32 value, u32 cap, struct wmi_interface *iface)
return WMI_execute_u32(method_id, (u32)value, NULL);
}
+static acpi_status wmid3_get_device_status(u32 *value, u16 device)
+{
+ struct wmid3_gds_return_value return_value;
+ acpi_status status;
+ union acpi_object *obj;
+ struct wmid3_gds_input_param params = {
+ .function_num = 0x1,
+ .hotkey_number = 0x01,
+ .devices = device,
+ };
+ struct acpi_buffer input = {
+ sizeof(struct wmid3_gds_input_param),
+ ¶ms
+ };
+ struct acpi_buffer output = { ACPI_ALLOCATE_BUFFER, NULL };
+
+ status = wmi_evaluate_method(WMID_GUID3, 0, 0x2, &input, &output);
+ if (ACPI_FAILURE(status))
+ return status;
+
+ obj = output.pointer;
+
+ if (!obj)
+ return AE_ERROR;
+ else if (obj->type != ACPI_TYPE_BUFFER) {
+ kfree(obj);
+ return AE_ERROR;
+ }
+ if (obj->buffer.length != 8) {
+ pr_warn("Unknown buffer length %d\n", obj->buffer.length);
+ kfree(obj);
+ return AE_ERROR;
+ }
+
+ return_value = *((struct wmid3_gds_return_value *)obj->buffer.pointer);
+ kfree(obj);
+
+ if (return_value.error_code || return_value.ec_return_value)
+ pr_warn("Get Device Status failed: 0x%x - 0x%x\n",
+ return_value.error_code,
+ return_value.ec_return_value);
+ else
+ *value = !!(return_value.devices & device);
+
+ return status;
+}
+
+static acpi_status wmid_v2_get_u32(u32 *value, u32 cap)
+{
+ u16 device;
+
+ switch (cap) {
+ case ACER_CAP_WIRELESS:
+ device = ACER_WMID3_GDS_WIRELESS;
+ break;
+ case ACER_CAP_BLUETOOTH:
+ device = ACER_WMID3_GDS_BLUETOOTH;
+ break;
+ case ACER_CAP_THREEG:
+ device = ACER_WMID3_GDS_THREEG;
+ break;
+ default:
+ return AE_ERROR;
+ }
+ return wmid3_get_device_status(value, device);
+}
+
+static acpi_status wmid3_set_device_status(u32 value, u16 device)
+{
+ struct wmid3_gds_return_value return_value;
+ acpi_status status;
+ union acpi_object *obj;
+ u16 devices;
+ struct wmid3_gds_input_param params = {
+ .function_num = 0x1,
+ .hotkey_number = 0x01,
+ .devices = ACER_WMID3_GDS_WIRELESS |
+ ACER_WMID3_GDS_THREEG |
+ ACER_WMID3_GDS_WIMAX |
+ ACER_WMID3_GDS_BLUETOOTH,
+ };
+ struct acpi_buffer input = {
+ sizeof(struct wmid3_gds_input_param),
+ ¶ms
+ };
+ struct acpi_buffer output = { ACPI_ALLOCATE_BUFFER, NULL };
+ struct acpi_buffer output2 = { ACPI_ALLOCATE_BUFFER, NULL };
+
+ status = wmi_evaluate_method(WMID_GUID3, 0, 0x2, &input, &output);
+ if (ACPI_FAILURE(status))
+ return status;
+
+ obj = output.pointer;
+
+ if (!obj)
+ return AE_ERROR;
+ else if (obj->type != ACPI_TYPE_BUFFER) {
+ kfree(obj);
+ return AE_ERROR;
+ }
+ if (obj->buffer.length != 8) {
+ pr_warning("Unknown buffer length %d\n", obj->buffer.length);
+ kfree(obj);
+ return AE_ERROR;
+ }
+
+ return_value = *((struct wmid3_gds_return_value *)obj->buffer.pointer);
+ kfree(obj);
+
+ if (return_value.error_code || return_value.ec_return_value) {
+ pr_warning("Get Current Device Status failed: "
+ "0x%x - 0x%x\n", return_value.error_code,
+ return_value.ec_return_value);
+ return status;
+ }
+
+ devices = return_value.devices;
+ params.function_num = 0x2;
+ params.hotkey_number = 0x01;
+ params.devices = (value) ? (devices | device) : (devices & ~device);
+
+ status = wmi_evaluate_method(WMID_GUID3, 0, 0x1, &input, &output2);
+ if (ACPI_FAILURE(status))
+ return status;
+
+ obj = output2.pointer;
+
+ if (!obj)
+ return AE_ERROR;
+ else if (obj->type != ACPI_TYPE_BUFFER) {
+ kfree(obj);
+ return AE_ERROR;
+ }
+ if (obj->buffer.length != 4) {
+ pr_warning("Unknown buffer length %d\n", obj->buffer.length);
+ kfree(obj);
+ return AE_ERROR;
+ }
+
+ return_value = *((struct wmid3_gds_return_value *)obj->buffer.pointer);
+ kfree(obj);
+
+ if (return_value.error_code || return_value.ec_return_value)
+ pr_warning("Set Device Status failed: "
+ "0x%x - 0x%x\n", return_value.error_code,
+ return_value.ec_return_value);
+
+ return status;
+}
+
+static acpi_status wmid_v2_set_u32(u32 value, u32 cap)
+{
+ u16 device;
+
+ switch (cap) {
+ case ACER_CAP_WIRELESS:
+ device = ACER_WMID3_GDS_WIRELESS;
+ break;
+ case ACER_CAP_BLUETOOTH:
+ device = ACER_WMID3_GDS_BLUETOOTH;
+ break;
+ case ACER_CAP_THREEG:
+ device = ACER_WMID3_GDS_THREEG;
+ break;
+ default:
+ return AE_ERROR;
+ }
+ return wmid3_set_device_status(value, device);
+}
+
static void type_aa_dmi_decode(const struct dmi_header *header, void *dummy)
{
struct hotkey_function_type_aa *type_aa;
@@ -913,17 +1084,11 @@ static acpi_status WMID_set_capabilities(void)
return AE_ERROR;
}
- dmi_walk(type_aa_dmi_decode, NULL);
- if (!has_type_aa) {
- interface->capability |= ACER_CAP_WIRELESS;
- if (devices & 0x40)
- interface->capability |= ACER_CAP_THREEG;
- if (devices & 0x10)
- interface->capability |= ACER_CAP_BLUETOOTH;
- }
-
- /* WMID always provides brightness methods */
- interface->capability |= ACER_CAP_BRIGHTNESS;
+ interface->capability |= ACER_CAP_WIRELESS;
+ if (devices & 0x40)
+ interface->capability |= ACER_CAP_THREEG;
+ if (devices & 0x10)
+ interface->capability |= ACER_CAP_BLUETOOTH;
if (!(devices & 0x20))
max_brightness = 0x9;
@@ -936,6 +1101,10 @@ static struct wmi_interface wmid_interface = {
.type = ACER_WMID,
};
+static struct wmi_interface wmid_v2_interface = {
+ .type = ACER_WMID_v2,
+};
+
/*
* Generic Device (interface-independent)
*/
@@ -956,6 +1125,14 @@ static acpi_status get_u32(u32 *value, u32 cap)
case ACER_WMID:
status = WMID_get_u32(value, cap, interface);
break;
+ case ACER_WMID_v2:
+ if (cap & (ACER_CAP_WIRELESS |
+ ACER_CAP_BLUETOOTH |
+ ACER_CAP_THREEG))
+ status = wmid_v2_get_u32(value, cap);
+ else if (wmi_has_guid(WMID_GUID2))
+ status = WMID_get_u32(value, cap, interface);
+ break;
}
return status;
@@ -989,6 +1166,13 @@ static acpi_status set_u32(u32 value, u32 cap)
}
case ACER_WMID:
return WMID_set_u32(value, cap, interface);
+ case ACER_WMID_v2:
+ if (cap & (ACER_CAP_WIRELESS |
+ ACER_CAP_BLUETOOTH |
+ ACER_CAP_THREEG))
+ return wmid_v2_set_u32(value, cap);
+ else if (wmi_has_guid(WMID_GUID2))
+ return WMID_set_u32(value, cap, interface);
default:
return AE_BAD_PARAMETER;
}
@@ -1095,186 +1279,6 @@ static void acer_backlight_exit(void)
backlight_device_unregister(acer_backlight_device);
}
-static acpi_status wmid3_get_device_status(u32 *value, u16 device)
-{
- struct wmid3_gds_return_value return_value;
- acpi_status status;
- union acpi_object *obj;
- struct wmid3_gds_input_param params = {
- .function_num = 0x1,
- .hotkey_number = 0x01,
- .devices = device,
- };
- struct acpi_buffer input = {
- sizeof(struct wmid3_gds_input_param),
- ¶ms
- };
- struct acpi_buffer output = { ACPI_ALLOCATE_BUFFER, NULL };
-
- status = wmi_evaluate_method(WMID_GUID3, 0, 0x2, &input, &output);
- if (ACPI_FAILURE(status))
- return status;
-
- obj = output.pointer;
-
- if (!obj)
- return AE_ERROR;
- else if (obj->type != ACPI_TYPE_BUFFER) {
- kfree(obj);
- return AE_ERROR;
- }
- if (obj->buffer.length != 8) {
- pr_warn("Unknown buffer length %d\n", obj->buffer.length);
- kfree(obj);
- return AE_ERROR;
- }
-
- return_value = *((struct wmid3_gds_return_value *)obj->buffer.pointer);
- kfree(obj);
-
- if (return_value.error_code || return_value.ec_return_value)
- pr_warn("Get Device Status failed: 0x%x - 0x%x\n",
- return_value.error_code,
- return_value.ec_return_value);
- else
- *value = !!(return_value.devices & device);
-
- return status;
-}
-
-static acpi_status get_device_status(u32 *value, u32 cap)
-{
- if (wmi_has_guid(WMID_GUID3)) {
- u16 device;
-
- switch (cap) {
- case ACER_CAP_WIRELESS:
- device = ACER_WMID3_GDS_WIRELESS;
- break;
- case ACER_CAP_BLUETOOTH:
- device = ACER_WMID3_GDS_BLUETOOTH;
- break;
- case ACER_CAP_THREEG:
- device = ACER_WMID3_GDS_THREEG;
- break;
- default:
- return AE_ERROR;
- }
- return wmid3_get_device_status(value, device);
-
- } else {
- return get_u32(value, cap);
- }
-}
-
-static acpi_status wmid3_set_device_status(u32 value, u16 device)
-{
- struct wmid3_gds_return_value return_value;
- acpi_status status;
- union acpi_object *obj;
- u16 devices;
- struct wmid3_gds_input_param params = {
- .function_num = 0x1,
- .hotkey_number = 0x01,
- .devices = ACER_WMID3_GDS_WIRELESS |
- ACER_WMID3_GDS_THREEG |
- ACER_WMID3_GDS_WIMAX |
- ACER_WMID3_GDS_BLUETOOTH,
- };
- struct acpi_buffer input = {
- sizeof(struct wmid3_gds_input_param),
- ¶ms
- };
- struct acpi_buffer output = { ACPI_ALLOCATE_BUFFER, NULL };
- struct acpi_buffer output2 = { ACPI_ALLOCATE_BUFFER, NULL };
-
- status = wmi_evaluate_method(WMID_GUID3, 0, 0x2, &input, &output);
- if (ACPI_FAILURE(status))
- return status;
-
- obj = output.pointer;
-
- if (!obj)
- return AE_ERROR;
- else if (obj->type != ACPI_TYPE_BUFFER) {
- kfree(obj);
- return AE_ERROR;
- }
- if (obj->buffer.length != 8) {
- pr_warning("Unknown buffer length %d\n", obj->buffer.length);
- kfree(obj);
- return AE_ERROR;
- }
-
- return_value = *((struct wmid3_gds_return_value *)obj->buffer.pointer);
- kfree(obj);
-
- if (return_value.error_code || return_value.ec_return_value) {
- pr_warning("Get Current Device Status failed: "
- "0x%x - 0x%x\n", return_value.error_code,
- return_value.ec_return_value);
- return status;
- }
-
- devices = return_value.devices;
- params.function_num = 0x2;
- params.hotkey_number = 0x01;
- params.devices = (value) ? (devices | device) : (devices & ~device);
-
- status = wmi_evaluate_method(WMID_GUID3, 0, 0x1, &input, &output2);
- if (ACPI_FAILURE(status))
- return status;
-
- obj = output2.pointer;
-
- if (!obj)
- return AE_ERROR;
- else if (obj->type != ACPI_TYPE_BUFFER) {
- kfree(obj);
- return AE_ERROR;
- }
- if (obj->buffer.length != 4) {
- pr_warning("Unknown buffer length %d\n", obj->buffer.length);
- kfree(obj);
- return AE_ERROR;
- }
-
- return_value = *((struct wmid3_gds_return_value *)obj->buffer.pointer);
- kfree(obj);
-
- if (return_value.error_code || return_value.ec_return_value)
- pr_warning("Set Device Status failed: "
- "0x%x - 0x%x\n", return_value.error_code,
- return_value.ec_return_value);
-
- return status;
-}
-
-static acpi_status set_device_status(u32 value, u32 cap)
-{
- if (wmi_has_guid(WMID_GUID3)) {
- u16 device;
-
- switch (cap) {
- case ACER_CAP_WIRELESS:
- device = ACER_WMID3_GDS_WIRELESS;
- break;
- case ACER_CAP_BLUETOOTH:
- device = ACER_WMID3_GDS_BLUETOOTH;
- break;
- case ACER_CAP_THREEG:
- device = ACER_WMID3_GDS_THREEG;
- break;
- default:
- return AE_ERROR;
- }
- return wmid3_set_device_status(value, device);
-
- } else {
- return set_u32(value, cap);
- }
-}
-
/*
* Rfkill devices
*/
@@ -1301,8 +1305,7 @@ static void acer_rfkill_update(struct work_struct *ignored)
}
if (has_cap(ACER_CAP_THREEG) && wmi_has_guid(WMID_GUID3)) {
- status = wmid3_get_device_status(&state,
- ACER_WMID3_GDS_THREEG);
+ status = get_u32(&state, ACER_WMID3_GDS_THREEG);
if (ACPI_SUCCESS(status))
rfkill_set_sw_state(threeg_rfkill, !state);
}
@@ -1316,7 +1319,7 @@ static int acer_rfkill_set(void *data, bool blocked)
u32 cap = (unsigned long)data;
if (rfkill_inited) {
- status = set_device_status(!blocked, cap);
+ status = set_u32(!blocked, cap);
if (ACPI_FAILURE(status))
return -ENODEV;
}
@@ -1343,7 +1346,7 @@ static struct rfkill *acer_rfkill_register(struct device *dev,
if (!rfkill_dev)
return ERR_PTR(-ENOMEM);
- status = get_device_status(&state, cap);
+ status = get_u32(&state, cap);
err = rfkill_register(rfkill_dev);
if (err) {
@@ -1464,6 +1467,8 @@ static ssize_t show_interface(struct device *dev, struct device_attribute *attr,
return sprintf(buf, "AMW0 v2\n");
case ACER_WMID:
return sprintf(buf, "WMID\n");
+ case ACER_WMID_v2:
+ return sprintf(buf, "WMID v2\n");
default:
return sprintf(buf, "Error!\n");
}
@@ -1883,12 +1888,20 @@ static int __init acer_wmi_init(void)
if (!wmi_has_guid(AMW0_GUID1) && wmi_has_guid(WMID_GUID1))
interface = &wmid_interface;
+ if (wmi_has_guid(WMID_GUID3))
+ interface = &wmid_v2_interface;
+
+ if (interface)
+ dmi_walk(type_aa_dmi_decode, NULL);
+
if (wmi_has_guid(WMID_GUID2) && interface) {
- if (ACPI_FAILURE(WMID_set_capabilities())) {
+ if (!has_type_aa && ACPI_FAILURE(WMID_set_capabilities())) {
pr_err("Unable to detect available WMID devices\n");
return -ENODEV;
}
- } else if (!wmi_has_guid(WMID_GUID2) && interface) {
+ /* WMID always provides brightness methods */
+ interface->capability |= ACER_CAP_BRIGHTNESS;
+ } else if (!wmi_has_guid(WMID_GUID2) && interface && !has_type_aa) {
pr_err("No WMID device detection method found\n");
return -ENODEV;
}
@@ -1912,7 +1925,7 @@ static int __init acer_wmi_init(void)
set_quirks();
- if (acpi_video_backlight_support() && has_cap(ACER_CAP_BRIGHTNESS)) {
+ if (acpi_video_backlight_support()) {
interface->capability &= ~ACER_CAP_BRIGHTNESS;
pr_info("Brightness must be controlled by "
"generic video driver\n");
--
1.6.0.2
^ permalink raw reply related [flat|nested] 16+ messages in thread
end of thread, other threads:[~2011-09-07 5:29 UTC | newest]
Thread overview: 16+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-08-11 6:58 [Fwd: Re: A problem about acer-wmi] Joey Lee
2011-08-11 7:45 ` AceLan Kao
2011-08-11 8:02 ` Joey Lee
2011-08-11 8:49 ` AceLan Kao
2011-09-07 2:33 ` joeyli
2011-09-07 5:29 ` AceLan Kao
-- strict thread matches above, loose matches on Subject: below --
2011-08-11 3:30 Joey Lee
2011-08-10 10:02 Joey Lee
2011-08-11 2:48 ` AceLan Kao
2011-08-10 9:17 Joey Lee
[not found] <4E25AFC7020000230002F7D1@novprvlin0050.provo.novell.com>
2011-08-09 2:05 ` AceLan Kao
2011-08-09 2:07 ` AceLan Kao
2011-08-09 2:14 ` joeyli
2011-08-09 6:33 ` AceLan Kao
2011-08-10 2:13 ` joeyli
2011-08-10 8:49 ` joeyli
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.