]> git.karo-electronics.de Git - linux-beck.git/commitdiff
ideapad: check VPC bit before sync rfkill hw status
authorIke Panhc <ike.pan@canonical.com>
Fri, 1 Oct 2010 07:39:05 +0000 (15:39 +0800)
committerMatthew Garrett <mjg@redhat.com>
Thu, 21 Oct 2010 13:36:49 +0000 (09:36 -0400)
Check VPC bit to make sure the HW rfkill is touched.

Signed-off-by: Ike Panhc <ike.pan@canonical.com>
Signed-off-by: Matthew Garrett <mjg@redhat.com>
drivers/platform/x86/ideapad_acpi.c

index c87693c7dde032a55cfd386880395785a1ca0cab..e07d6072e75c95316b8dc551557c7769d898fa76 100644 (file)
@@ -379,7 +379,21 @@ static int ideapad_acpi_remove(struct acpi_device *adevice, int type)
 
 static void ideapad_acpi_notify(struct acpi_device *adevice, u32 event)
 {
-       ideapad_sync_rfk_state(adevice);
+       acpi_handle handle = adevice->handle;
+       unsigned long vpc1, vpc2, vpc_bit;
+
+       if (read_ec_data(handle, 0x10, &vpc1))
+               return;
+       if (read_ec_data(handle, 0x1A, &vpc2))
+               return;
+
+       vpc1 = (vpc2 << 8) | vpc1;
+       for (vpc_bit = 0; vpc_bit < 16; vpc_bit++) {
+               if (test_bit(vpc_bit, &vpc1)) {
+                       if (vpc_bit == 9)
+                               ideapad_sync_rfk_state(adevice);
+               }
+       }
 }
 
 static struct acpi_driver ideapad_acpi_driver = {