diff options
author | Lennart Poettering <mzxreary@0pointer.de> | 2007-05-04 08:16:19 -0400 |
---|---|---|
committer | Len Brown <len.brown@intel.com> | 2007-05-10 03:52:22 -0400 |
commit | 00eb43a1897a8845d0edb198cec69ac5f1f299dd (patch) | |
tree | 32cab402e51882c7854eab20556f0da75525cdc7 /drivers/misc/msi-laptop.c | |
parent | a64e62a07097f67108f0b68bc15216c3a4a5299b (diff) |
acpi,msi-laptop: Fall back to EC polling mode for MSI laptop specific EC commands
The ACPI EC that is used in MSI laptops knows some non-standard
commands for changing the screen brighntess and a few other things,
which are used by the msi-laptop.c driver. Unfortunately for these
commands no GPE events for IBF and OBF are triggered. Since nowadays
the EC code uses the ec_intr=1 mode by default, this causes these
operations to timeout, although they don't fail. In result, all
operations that you can do with the msi-laptop.c driver take more or
less 1s to complete, which is awfully slow.
In one of the more recent kernels (2.6.20?) the EC subsystem has been
revamped. With that change the EC timeout has been increased. before
that increase the MSI EC accesses were slow -- but not *that* slow,
hence I took notice of this limitation of the MSI EC hardware only very
recently.
The standard EC operations on the MSI EC as defined in the ACPI spec
support GPE events properly.
The following patch adds a new argument "force_poll" to the
ec_transaction() function (and friends). If set to 1, the function
will poll for IBF/OBF even if ec_intr=1 is enabled. If set to 0 the
current behaviour is used. The msi-laptop driver is modified to make
use of this new flag, so that OBF/IBF is polled for the special MSI EC
transactions -- but only for them.
Signed-off-by: Lennart Poettering <mzxreary@0pointer.de>
Acked-by: Alexey Starikovskiy <aystarik@gmail.com>
Signed-off-by: Len Brown <len.brown@intel.com>
Diffstat (limited to 'drivers/misc/msi-laptop.c')
-rw-r--r-- | drivers/misc/msi-laptop.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/drivers/misc/msi-laptop.c b/drivers/misc/msi-laptop.c index 68c4b58525ba..41e901f53e7c 100644 --- a/drivers/misc/msi-laptop.c +++ b/drivers/misc/msi-laptop.c | |||
@@ -85,7 +85,7 @@ static int set_lcd_level(int level) | |||
85 | buf[0] = 0x80; | 85 | buf[0] = 0x80; |
86 | buf[1] = (u8) (level*31); | 86 | buf[1] = (u8) (level*31); |
87 | 87 | ||
88 | return ec_transaction(MSI_EC_COMMAND_LCD_LEVEL, buf, sizeof(buf), NULL, 0); | 88 | return ec_transaction(MSI_EC_COMMAND_LCD_LEVEL, buf, sizeof(buf), NULL, 0, 1); |
89 | } | 89 | } |
90 | 90 | ||
91 | static int get_lcd_level(void) | 91 | static int get_lcd_level(void) |
@@ -93,7 +93,7 @@ static int get_lcd_level(void) | |||
93 | u8 wdata = 0, rdata; | 93 | u8 wdata = 0, rdata; |
94 | int result; | 94 | int result; |
95 | 95 | ||
96 | result = ec_transaction(MSI_EC_COMMAND_LCD_LEVEL, &wdata, 1, &rdata, 1); | 96 | result = ec_transaction(MSI_EC_COMMAND_LCD_LEVEL, &wdata, 1, &rdata, 1, 1); |
97 | if (result < 0) | 97 | if (result < 0) |
98 | return result; | 98 | return result; |
99 | 99 | ||
@@ -105,7 +105,7 @@ static int get_auto_brightness(void) | |||
105 | u8 wdata = 4, rdata; | 105 | u8 wdata = 4, rdata; |
106 | int result; | 106 | int result; |
107 | 107 | ||
108 | result = ec_transaction(MSI_EC_COMMAND_LCD_LEVEL, &wdata, 1, &rdata, 1); | 108 | result = ec_transaction(MSI_EC_COMMAND_LCD_LEVEL, &wdata, 1, &rdata, 1, 1); |
109 | if (result < 0) | 109 | if (result < 0) |
110 | return result; | 110 | return result; |
111 | 111 | ||
@@ -119,14 +119,14 @@ static int set_auto_brightness(int enable) | |||
119 | 119 | ||
120 | wdata[0] = 4; | 120 | wdata[0] = 4; |
121 | 121 | ||
122 | result = ec_transaction(MSI_EC_COMMAND_LCD_LEVEL, wdata, 1, &rdata, 1); | 122 | result = ec_transaction(MSI_EC_COMMAND_LCD_LEVEL, wdata, 1, &rdata, 1, 1); |
123 | if (result < 0) | 123 | if (result < 0) |
124 | return result; | 124 | return result; |
125 | 125 | ||
126 | wdata[0] = 0x84; | 126 | wdata[0] = 0x84; |
127 | wdata[1] = (rdata & 0xF7) | (enable ? 8 : 0); | 127 | wdata[1] = (rdata & 0xF7) | (enable ? 8 : 0); |
128 | 128 | ||
129 | return ec_transaction(MSI_EC_COMMAND_LCD_LEVEL, wdata, 2, NULL, 0); | 129 | return ec_transaction(MSI_EC_COMMAND_LCD_LEVEL, wdata, 2, NULL, 0, 1); |
130 | } | 130 | } |
131 | 131 | ||
132 | static int get_wireless_state(int *wlan, int *bluetooth) | 132 | static int get_wireless_state(int *wlan, int *bluetooth) |
@@ -134,7 +134,7 @@ static int get_wireless_state(int *wlan, int *bluetooth) | |||
134 | u8 wdata = 0, rdata; | 134 | u8 wdata = 0, rdata; |
135 | int result; | 135 | int result; |
136 | 136 | ||
137 | result = ec_transaction(MSI_EC_COMMAND_WIRELESS, &wdata, 1, &rdata, 1); | 137 | result = ec_transaction(MSI_EC_COMMAND_WIRELESS, &wdata, 1, &rdata, 1, 1); |
138 | if (result < 0) | 138 | if (result < 0) |
139 | return -1; | 139 | return -1; |
140 | 140 | ||