aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/platform
diff options
context:
space:
mode:
authorTony Vroon <tony@linx.net>2009-02-02 06:11:10 -0500
committerLen Brown <len.brown@intel.com>2009-02-21 21:59:55 -0500
commit4898c2b2f04051e19f4230683c0f0b15f71af887 (patch)
tree45c1e916e5dccd8f0583f6f836483e6c9811840a /drivers/platform
parentadfafefd104d840ee4461965f22624d77532675b (diff)
fujitsu-laptop: Use RFKILL support bitmask from firmware
Up until now, we polled the rfkill status for every incoming FUJ02E3 ACPI event. It turns out that the firmware has a bitmask which indicates what rfkill-related state it can report. The rfkill_supported bitmask is now used to avoid polling for rfkill at all in the notification handler if there is no support. Also, it is used in the platform device callbacks. As before we register all callbacks and report "unknown" if the firmware does not give us status updates for that particular bit. This was fed through checkpatch.pl and tested on the S6420, S7020 and P8010 platforms. Signed-off-by: Tony Vroon <tony@linx.net> Tested-by: Stephen Gildea <stepheng+linux@gildea.com> Acked-by: Jonathan Woithe <jwoithe@physics.adelaide.edu.au> Signed-off-by: Len Brown <len.brown@intel.com>
Diffstat (limited to 'drivers/platform')
-rw-r--r--drivers/platform/x86/fujitsu-laptop.c25
1 files changed, 18 insertions, 7 deletions
diff --git a/drivers/platform/x86/fujitsu-laptop.c b/drivers/platform/x86/fujitsu-laptop.c
index 65dc41540c62..45940f31fe9e 100644
--- a/drivers/platform/x86/fujitsu-laptop.c
+++ b/drivers/platform/x86/fujitsu-laptop.c
@@ -166,6 +166,7 @@ struct fujitsu_hotkey_t {
166 struct platform_device *pf_device; 166 struct platform_device *pf_device;
167 struct kfifo *fifo; 167 struct kfifo *fifo;
168 spinlock_t fifo_lock; 168 spinlock_t fifo_lock;
169 int rfkill_supported;
169 int rfkill_state; 170 int rfkill_state;
170 int logolamp_registered; 171 int logolamp_registered;
171 int kblamps_registered; 172 int kblamps_registered;
@@ -526,7 +527,7 @@ static ssize_t
526show_lid_state(struct device *dev, 527show_lid_state(struct device *dev,
527 struct device_attribute *attr, char *buf) 528 struct device_attribute *attr, char *buf)
528{ 529{
529 if (fujitsu_hotkey->rfkill_state == UNSUPPORTED_CMD) 530 if (!(fujitsu_hotkey->rfkill_supported & 0x100))
530 return sprintf(buf, "unknown\n"); 531 return sprintf(buf, "unknown\n");
531 if (fujitsu_hotkey->rfkill_state & 0x100) 532 if (fujitsu_hotkey->rfkill_state & 0x100)
532 return sprintf(buf, "open\n"); 533 return sprintf(buf, "open\n");
@@ -538,7 +539,7 @@ static ssize_t
538show_dock_state(struct device *dev, 539show_dock_state(struct device *dev,
539 struct device_attribute *attr, char *buf) 540 struct device_attribute *attr, char *buf)
540{ 541{
541 if (fujitsu_hotkey->rfkill_state == UNSUPPORTED_CMD) 542 if (!(fujitsu_hotkey->rfkill_supported & 0x200))
542 return sprintf(buf, "unknown\n"); 543 return sprintf(buf, "unknown\n");
543 if (fujitsu_hotkey->rfkill_state & 0x200) 544 if (fujitsu_hotkey->rfkill_state & 0x200)
544 return sprintf(buf, "docked\n"); 545 return sprintf(buf, "docked\n");
@@ -550,7 +551,7 @@ static ssize_t
550show_radios_state(struct device *dev, 551show_radios_state(struct device *dev,
551 struct device_attribute *attr, char *buf) 552 struct device_attribute *attr, char *buf)
552{ 553{
553 if (fujitsu_hotkey->rfkill_state == UNSUPPORTED_CMD) 554 if (!(fujitsu_hotkey->rfkill_supported & 0x20))
554 return sprintf(buf, "unknown\n"); 555 return sprintf(buf, "unknown\n");
555 if (fujitsu_hotkey->rfkill_state & 0x20) 556 if (fujitsu_hotkey->rfkill_state & 0x20)
556 return sprintf(buf, "on\n"); 557 return sprintf(buf, "on\n");
@@ -928,8 +929,17 @@ static int acpi_fujitsu_hotkey_add(struct acpi_device *device)
928 ; /* No action, result is discarded */ 929 ; /* No action, result is discarded */
929 vdbg_printk(FUJLAPTOP_DBG_INFO, "Discarded %i ringbuffer entries\n", i); 930 vdbg_printk(FUJLAPTOP_DBG_INFO, "Discarded %i ringbuffer entries\n", i);
930 931
931 fujitsu_hotkey->rfkill_state = 932 fujitsu_hotkey->rfkill_supported =
932 call_fext_func(FUNC_RFKILL, 0x4, 0x0, 0x0); 933 call_fext_func(FUNC_RFKILL, 0x0, 0x0, 0x0);
934
935 /* Make sure our bitmask of supported functions is cleared if the
936 RFKILL function block is not implemented, like on the S7020. */
937 if (fujitsu_hotkey->rfkill_supported == UNSUPPORTED_CMD)
938 fujitsu_hotkey->rfkill_supported = 0;
939
940 if (fujitsu_hotkey->rfkill_supported)
941 fujitsu_hotkey->rfkill_state =
942 call_fext_func(FUNC_RFKILL, 0x4, 0x0, 0x0);
933 943
934 /* Suspect this is a keymap of the application panel, print it */ 944 /* Suspect this is a keymap of the application panel, print it */
935 printk(KERN_INFO "fujitsu-laptop: BTNI: [0x%x]\n", 945 printk(KERN_INFO "fujitsu-laptop: BTNI: [0x%x]\n",
@@ -1005,8 +1015,9 @@ static void acpi_fujitsu_hotkey_notify(acpi_handle handle, u32 event,
1005 1015
1006 input = fujitsu_hotkey->input; 1016 input = fujitsu_hotkey->input;
1007 1017
1008 fujitsu_hotkey->rfkill_state = 1018 if (fujitsu_hotkey->rfkill_supported)
1009 call_fext_func(FUNC_RFKILL, 0x4, 0x0, 0x0); 1019 fujitsu_hotkey->rfkill_state =
1020 call_fext_func(FUNC_RFKILL, 0x4, 0x0, 0x0);
1010 1021
1011 switch (event) { 1022 switch (event) {
1012 case ACPI_FUJITSU_NOTIFY_CODE1: 1023 case ACPI_FUJITSU_NOTIFY_CODE1: