Skip to contentSkip to conversation

BUG: Fn keys not working on EliteBook 8460p after fabf85e3ca15d5b94058f391dac8df870cdd427a

PATCH New Pali Rohár 3 participants 20 messages Apr 13, 2013 – Aug 14, 2013 x86 platform drivers

lore
Share & tools
lore
#0 lore raw

Hello,

all Fn keys, wifi switch, web and mute buttons not working anymore on my notebook HP EliteBook 8460p. I bisected git commit which broke all above keys: fabf85e3ca15d5b94058f391dac8df870cdd427a

When I reverted that commit after reboot buttons started working again. Can you fix it or revert that broken commit? This is critical problem, which caused my notebook to be unusable...

Signature · 2 lines
Pali Rohár
[email protected]
#1 lore raw
Quoted 7 lines · Pali Rohár

all Fn keys, wifi switch, web and mute buttons not working anymore on my notebook HP EliteBook 8460p. I bisected git commit which broke all above keys: fabf85e3ca15d5b94058f391dac8df870cdd427a

When I reverted that commit after reboot buttons started working again. Can you fix it or revert that broken commit? This is critical problem, which caused my notebook to be unusable...

Sure, I'll revert that. Kyle, can you look into figuring out a way to only run this on machines that need it?

Signature · 1 line
Matthew Garrett | [email protected]
#2 lore raw

Sure, sorry about that. I was hoping the GUID would be enough. I'll see what I can come up with.

Quoted 12 lines · Matthew Garrett
Quoted 7 lines · Pali Rohár

all Fn keys, wifi switch, web and mute buttons not working anymore on my notebook HP EliteBook 8460p. I bisected git commit which broke all above keys: fabf85e3ca15d5b94058f391dac8df870cdd427a

When I reverted that commit after reboot buttons started working again. Can you fix it or revert that broken commit? This is critical problem, which caused my notebook to be unusable...

Sure, I'll revert that. Kyle, can you look into figuring out a way to only run this on machines that need it?

#3 lore raw
Quoted 2 lines · Kyle Evans

Sure, sorry about that. I was hoping the GUID would be enough. I'll see what I can come up with.

Sure there's no WMI method that makes the EC write? It's a little weird for WMI drivers to have to hit the EC directly.

Signature · 1 line
Matthew Garrett | [email protected]
#4 lore raw
Quoted 6 lines · Matthew Garrett
Quoted 2 lines · Kyle Evans

Sure, sorry about that. I was hoping the GUID would be enough. I'll see what I can come up with.

Sure there's no WMI method that makes the EC write? It's a little weird for WMI drivers to have to hit the EC directly.

I have no idea, I didn't know what a DSDT was before trying to get these buttons working.

...A quick grep reveals acpi_wmi_ec_space_handler, is that what I should use? It calls ec_write itself, but has more function parameters and of course error checking to make sure you don't screw up those extra parameters. Seems inefficient to me. Or, maybe like it was designed for an automated code routine.

Looking further, I don't see any other drivers that use it, ec_write seems to be the standard.

Your call though, you are the master in this domain and you wrote the driver.

static acpi_status
acpi_wmi_ec_space_handler(u32 function, acpi_physical_address address,
u32 bits, u64 *value,
void *handler_context, void *region_context)

{
        int result = 0, i = 0;
        u8 temp = 0;

        if ((address > 0xFF) || !value)
                return AE_BAD_PARAMETER;

        if (function != ACPI_READ && function != ACPI_WRITE)
                return AE_BAD_PARAMETER;

        if (bits != 8)
                return AE_BAD_PARAMETER;

        if (function == ACPI_READ) {
                result = ec_read(address, &temp);
                (*value) |= ((u64)temp) << i;
        } else {
                temp = 0xff & ((*value) >> i);
                result = ec_write(address, temp);
        }

        switch (result) {
        case -EINVAL:
                return AE_BAD_PARAMETER;
                break;
        case -ENODEV:
                return AE_NOT_FOUND;
                break;
        case -ETIME:
                return AE_TIME;
                break;
        default:
                return AE_OK;
        }
}
#5 lore raw
Quoted 9 lines · Kyle Evans
Quoted 6 lines · Matthew Garrett
Quoted 2 lines · Kyle Evans

Sure, sorry about that. I was hoping the GUID would be enough. I'll see what I can come up with.

Sure there's no WMI method that makes the EC write? It's a little weird for WMI drivers to have to hit the EC directly.

I have no idea, I didn't know what a DSDT was before trying to get these buttons working.

Got a copy of your ACPI tables?

Signature · 1 line
Matthew Garrett | [email protected]
#6 lore raw
In reply to Kyle Evans

Can you try this patch?

(quoted diff) +0 -0

b/drivers/platform/x86/hp-wmi.c
index 45cacf7..91cc5df 100644

drivers/platform/x86/hp-wmi.c +0 -0
@@ -53,6 +53,7 @@

MODULE_ALIAS("wmi:5FB7F034-2C63-45e9-BE91-3D44E2C707E4");
#define HPWMI_ALS_QUERY 0x3
#define HPWMI_HARDWARE_QUERY 0x4
#define HPWMI_WIRELESS_QUERY 0x5
+#define HPWMI_BIOS_QUERY 0x8
#define HPWMI_HOTKEY_QUERY 0xc
#define HPWMI_WIRELESS2_QUERY 0x1b

@@ -284,6 +285,18 @@ static int hp_wmi_tablet_state(void)
return (state & 0x4) ? 1 : 0;
}

+static int hp_wmi_enable_hotkeys()
+{
+ int ret;
+ int query = 1;
+
+ ret = hp_wmi_perform_query(HPWMI_BIOS_QUERY, 1, &query, sizeof(query),
+ 0);
+ if (ret)
+ return -EINVAL;
+ return 0;
+}
+
static int hp_wmi_set_block(void *data, bool blocked) {
enum hp_wmi_radio r = (enum hp_wmi_radio) data;
@@ -925,9 +938,7 @@ static int __init hp_wmi_init(void)
err = hp_wmi_input_setup();
if (err)
return err;
-
- //Enable magic for hotkeys that run on the SMBus
- ec_write(0xe6,0x6e);
+ hp_wmi_enable_hotkeys();
}

if (bios_capable) {

Signature · 1 line
Matthew Garrett | [email protected]
#7 lore raw
Quoted 36 lines · On Tuesday 16 April 2013 18:26:26 Matthew Garrett wrote:

Can you try this patch?

drivers/platform/x86/hp-wmi.c +12 -0
index 45cacf7..91cc5df 100644
@@ -53,6 +53,7 @@
 MODULE_ALIAS("wmi:5FB7F034-2C63-45e9-BE91-3D44E2C707E4");
 #define HPWMI_ALS_QUERY 0x3
 #define HPWMI_HARDWARE_QUERY 0x4
 #define HPWMI_WIRELESS_QUERY 0x5
+#define HPWMI_BIOS_QUERY 0x8
 #define HPWMI_HOTKEY_QUERY 0xc
 #define HPWMI_WIRELESS2_QUERY 0x1b
@@ -284,6 +285,18 @@ static int hp_wmi_tablet_state(void)
 	return (state & 0x4) ? 1 : 0;
 }
 
+static int hp_wmi_enable_hotkeys()
+{
+	int ret;
+	int query = 1;
+
+	ret = hp_wmi_perform_query(HPWMI_BIOS_QUERY, 1, &query,
 sizeof(query), +				   0);
+	if (ret)
+		return -EINVAL;
+	return 0;
+}
+
 static int hp_wmi_set_block(void *data, bool blocked)
 {
 	enum hp_wmi_radio r = (enum hp_wmi_radio) data;

drivers/platform/x86/hp-wmi.c static int __init hp_wmi_init(void) · line 944

Quoted 10 lines
drivers/platform/x86/hp-wmi.c +1 -3
@@ -925,9 +938,7 @@ static int __init hp_wmi_init(void)
 		err = hp_wmi_input_setup();
 		if (err)
 			return err;
-
-		//Enable magic for hotkeys that run on the SMBus
-		ec_write(0xe6,0x6e);
+		hp_wmi_enable_hotkeys();
 	}
 
 	if (bios_capable) {

Hello,
I tested above patch and it fixing my problem. Now Fn keys working again on my HP EliteBook 8460p.

Signature · 2 lines
Pali Rohár
[email protected]
#8 lore raw
In reply to Matthew Garrett
Quoted 2 lines · Matthew Garrett

Can you try this patch?

No dice. I have a dmi check patch that I will send in a day or two if you don't find what you are looking for.

Currently, I am based on the torvalds master, but I can base off something else if you'd like.

#9 lore raw
Quoted 6 lines · Kyle Evans
Quoted 2 lines · Matthew Garrett

Can you try this patch?

No dice. I have a dmi check patch that I will send in a day or two if you don't find what you are looking for.

DMI's almost certainly the wrong solution. According to your DSDT, EC register 0xe6 is called SFHK. That's written to by the SSHK method, which in turn is executed by SHKS which should be called by the hp_wmi_query call added there. Any chance you can try to figure out why that's not happening?

Signature · 1 line
Matthew Garrett | [email protected]
#10 lore raw
Quoted 4 lines · Matthew Garrett
Quoted 3 lines · Kyle Evans
Quoted 2 lines · Matthew Garrett

Can you try this patch?

Quoted 8 lines
Quoted 2 lines

No dice. I have a dmi check patch that I will send in a day or two if you don't find what you are looking for.

DMI's almost certainly the wrong solution. According to your DSDT, EC register 0xe6 is called SFHK. That's written to by the SSHK method, which in turn is executed by SHKS which should be called by the hp_wmi_query call added there. Any chance you can try to figure out why that's not happening?

I see, I don't know how I missed that before. I think because I was searching for e6 instead of E6. I'm sure we can crack this the right way now. I'll do some digging.

#11 lore raw
In reply to Matthew Garrett
Quoted 4 lines · Matthew Garrett
Quoted 3 lines · Kyle Evans
Quoted 2 lines · Matthew Garrett

Can you try this patch?

Quoted 8 lines
Quoted 2 lines

No dice. I have a dmi check patch that I will send in a day or two if you don't find what you are looking for.

DMI's almost certainly the wrong solution. According to your DSDT, EC register 0xe6 is called SFHK. That's written to by the SSHK method, which in turn is executed by SHKS which should be called by the hp_wmi_query call added there. Any chance you can try to figure out why that's not happening?

I am not fully understanding how the bios query ID gets translated into the method. As far as I can tell this happens under HWMC. But, if I trace through that, 0x8(write) and 0x9(read) do not exist. However, 0x9(read) does have a method that works when I query it, GHKS. I do not find the method for 0x8(write).

0x9(write), or SHKS, is essentially ec_write(SFHK,Arg0). Arg0 turns out to be whatever data is sent in the 0x9 buffer.

                                ...
                                CreateDWordField (Arg1, 0x10, DDWD)

                                If (LEqual (CMDT, 0x09))
                                {
                                    Store (SHKS (DDWD), Local2)
                                ...

I tried writing 0x60, and I tried writing 0x0e just to see if it if a subset of that register is needed to enable the keys and it seems I need the full 0x6e. I only find two places in the DSDT with that value, both in the WQAE buffer and I can't see how that is used.

#12 lore raw
Quoted 1 line · Kyle Evans

0x9(write), or SHKS, is essentially ec_write(SFHK,Arg0). Arg0 turns out

Oh - try changing

int query = 1

to

int query=0x6e

Signature · 1 line
Matthew Garrett | [email protected]
#13 lore raw
Quoted 11 lines · Matthew Garrett
Quoted 1 line · Kyle Evans

0x9(write), or SHKS, is essentially ec_write(SFHK,Arg0). Arg0 turns out

Oh - try changing

int query = 1

to

int query=0x6e

That only works if I also change:

-#define HPWMI_BIOS_QUERY 0x8
+#define HPWMI_BIOS_QUERY 0x9

But then we are still faced with a hardware detection problem I would assume.

#14 lore raw
Quoted 6 lines · Kyle Evans

That only works if I also change:

(quoted diff) +1 -1
-#define HPWMI_BIOS_QUERY 0x8
+#define HPWMI_BIOS_QUERY 0x9

But then we are still faced with a hardware detection problem I would assume.

Heh. That's actually what it should have been in the first place - I just screwed it up. So, looks like that's a good starting point. I'll push the revert to Linux and queue this up for 3.10.

Signature · 1 line
Matthew Garrett | [email protected]
#15 lore raw

Re: hp-wmi: SMBus hotkeys

Quoted 4 lines · Matthew Garrett
Quoted 2 lines · Kyle Evans

That only works if I also change:

Quoted 8 lines
Quoted 4 lines
(quoted diff) +1 -1
-#define HPWMI_BIOS_QUERY 0x8
+#define HPWMI_BIOS_QUERY 0x9

But then we are still faced with a hardware detection problem I would assume.

Heh. That's actually what it should have been in the first place - I just screwed it up. So, looks like that's a good starting point. I'll push the revert to Linux and queue this up for 3.10.

So, what is the plan for this? We have the WMI method so that ec_write is not needed, but how are you thinking it should be triggered? I've got some free time coming up and would like to get this banged out during that time if it is something I can do.

#16 lore raw

Re: hp-wmi: SMBus hotkeys

Quoted 4 lines · Kyle Evans

So, what is the plan for this? We have the WMI method so that ec_write is not needed, but how are you thinking it should be triggered? I've got some free time coming up and would like to get this banged out during that time if it is something I can do.

Well, with luck this patch would be safe on its own. How did you figure out that you needed to set this register to this value?

Signature · 1 line
Matthew Garrett | [email protected]
#17 lore raw

Re: hp-wmi: SMBus hotkeys

Quoted 9 lines · Matthew Garrett
Quoted 4 lines · Kyle Evans

So, what is the plan for this? We have the WMI method so that ec_write is not needed, but how are you thinking it should be triggered? I've got some free time coming up and would like to get this banged out during that time if it is something I can do.

Well, with luck this patch would be safe on its own. How did you figure out that you needed to set this register to this value?

Well, in the end I dumped the EC contents from windows several times and compared the static values with those in the dump from linux. From your reply I understand that you are thinking that register 0xe6 is not SFHK on machines that the previous patch broke.... That sounds reasonable.

My concern was that SFHK required a different value on those machines, but I am not at all familiar with common practice.

Just a note, I found several other registers with static, non-zero values, which are zero in linux.

#18 lore raw

BUG: Again: Fn keys not working on EliteBook 8460p after b253c9d1d858a3f115f791ee4fe2b9399ae7dbbd

In reply to Pali Rohár
Quoted 11 lines · On Saturday 13 April 2013 03:31:17 Pali Rohár wrote:

Hello,

all Fn keys, wifi switch, web and mute buttons not working anymore on my notebook HP EliteBook 8460p. I bisected git commit which broke all above keys:
fabf85e3ca15d5b94058f391dac8df870cdd427a

When I reverted that commit after reboot buttons started working again. Can you fix it or revert that broken commit? This is critical problem, which caused my notebook to be unusable...

Hello, same problem happen again on my notebook. Problematic commit is now: b253c9d1d858a3f115f791ee4fe2b9399ae7dbbd
hp-wmi: Enable hotkeys on some systems

When I disabled calling function hp_wmi_enable_hotkeys() from hp_wmi_init() keys started working again after reboot.

This problem is present in 3.11 rc5. Please can you do something so keys on my notebook will work again and it will not be broken again in next kernel release? If you need some debug data or something else, I can help.

In mail from 16.04.2013 you provided similar patch but with #define HPWMI_BIOS_QUERY 0x8
I tested that patch and that does not broke keys.

But commit b253c9d1d858a3f115f791ee4fe2b9399ae7dbbd have #define HPWMI_BIOS_QUERY 0x9
which broke keys again...

Signature · 2 lines
Pali Rohár
[email protected]
#19 lore raw

PATCH 1/1 hp-wmi; Limit hotkey enable funtion

This patch is a supplement to commit
b253c9d1d858a3f115f791ee4fe2b9399ae7dbbd

---
 drivers/platform/x86/hp-wmi.c |   16 +++++++++++++++-
 1 files changed, 15 insertions(+), 1 deletions(-)
drivers/platform/x86/hp-wmi.c +15 -1
index 97bb05e..b65014f 100644
@@ -35,6 +35,7 @@
 #include <linux/input/sparse-keymap.h>
 #include <linux/platform_device.h>
 #include <linux/acpi.h>
+#include <linux/dmi.h>
 #include <linux/rfkill.h>
 #include <linux/string.h>
 
@@ -996,6 +997,17 @@ static struct platform_driver hp_wmi_driver = {
 	.remove = __exit_p(hp_wmi_bios_remove),
 };
 
+static struct dmi_system_id __initdata tx2_dmi_table[] = {
+	{
+		.ident = "tx2",
+		.matches = {
+			DMI_MATCH(DMI_SYS_VENDOR, "Hewlett-Packard"),
+			DMI_MATCH(DMI_PRODUCT_NAME, "tx2"),
+		},
+	},
+	{ }
+};
+
 static int __init hp_wmi_init(void)
 {
 	int err;
@@ -1010,7 +1022,9 @@ static int __init hp_wmi_init(void)
 		if (err)
 			return err;
 
-		hp_wmi_enable_hotkeys();
+		if (dmi_check_system(tx2_dmi_table)) {
+			hp_wmi_enable_hotkeys();
+		{
 	}
 
 	if (bios_capable) {
Signature · 1 line
1.7.3.4