diff options
-rw-r--r-- | drivers/platform/x86/thinkpad_acpi.c | 26 |
1 files changed, 24 insertions, 2 deletions
diff --git a/drivers/platform/x86/thinkpad_acpi.c b/drivers/platform/x86/thinkpad_acpi.c index 3981b060b7d5..da739d5c9210 100644 --- a/drivers/platform/x86/thinkpad_acpi.c +++ b/drivers/platform/x86/thinkpad_acpi.c | |||
@@ -264,6 +264,7 @@ static struct { | |||
264 | u32 wan:1; | 264 | u32 wan:1; |
265 | u32 uwb:1; | 265 | u32 uwb:1; |
266 | u32 fan_ctrl_status_undef:1; | 266 | u32 fan_ctrl_status_undef:1; |
267 | u32 beep_needs_two_args:1; | ||
267 | u32 input_device_registered:1; | 268 | u32 input_device_registered:1; |
268 | u32 platform_drv_registered:1; | 269 | u32 platform_drv_registered:1; |
269 | u32 platform_drv_attrs_registered:1; | 270 | u32 platform_drv_attrs_registered:1; |
@@ -5142,8 +5143,17 @@ static struct ibm_struct led_driver_data = { | |||
5142 | 5143 | ||
5143 | TPACPI_HANDLE(beep, ec, "BEEP"); /* all except R30, R31 */ | 5144 | TPACPI_HANDLE(beep, ec, "BEEP"); /* all except R30, R31 */ |
5144 | 5145 | ||
5146 | #define TPACPI_BEEP_Q1 0x0001 | ||
5147 | |||
5148 | static const struct tpacpi_quirk beep_quirk_table[] __initconst = { | ||
5149 | TPACPI_Q_IBM('I', 'M', TPACPI_BEEP_Q1), /* 570 */ | ||
5150 | TPACPI_Q_IBM('I', 'U', TPACPI_BEEP_Q1), /* 570E - unverified */ | ||
5151 | }; | ||
5152 | |||
5145 | static int __init beep_init(struct ibm_init_struct *iibm) | 5153 | static int __init beep_init(struct ibm_init_struct *iibm) |
5146 | { | 5154 | { |
5155 | unsigned long quirks; | ||
5156 | |||
5147 | vdbg_printk(TPACPI_DBG_INIT, "initializing beep subdriver\n"); | 5157 | vdbg_printk(TPACPI_DBG_INIT, "initializing beep subdriver\n"); |
5148 | 5158 | ||
5149 | TPACPI_ACPIHANDLE_INIT(beep); | 5159 | TPACPI_ACPIHANDLE_INIT(beep); |
@@ -5151,6 +5161,11 @@ static int __init beep_init(struct ibm_init_struct *iibm) | |||
5151 | vdbg_printk(TPACPI_DBG_INIT, "beep is %s\n", | 5161 | vdbg_printk(TPACPI_DBG_INIT, "beep is %s\n", |
5152 | str_supported(beep_handle != NULL)); | 5162 | str_supported(beep_handle != NULL)); |
5153 | 5163 | ||
5164 | quirks = tpacpi_check_quirks(beep_quirk_table, | ||
5165 | ARRAY_SIZE(beep_quirk_table)); | ||
5166 | |||
5167 | tp_features.beep_needs_two_args = !!(quirks & TPACPI_BEEP_Q1); | ||
5168 | |||
5154 | return (beep_handle)? 0 : 1; | 5169 | return (beep_handle)? 0 : 1; |
5155 | } | 5170 | } |
5156 | 5171 | ||
@@ -5182,8 +5197,15 @@ static int beep_write(char *buf) | |||
5182 | /* beep_cmd set */ | 5197 | /* beep_cmd set */ |
5183 | } else | 5198 | } else |
5184 | return -EINVAL; | 5199 | return -EINVAL; |
5185 | if (!acpi_evalf(beep_handle, NULL, NULL, "vdd", beep_cmd, 0)) | 5200 | if (tp_features.beep_needs_two_args) { |
5186 | return -EIO; | 5201 | if (!acpi_evalf(beep_handle, NULL, NULL, "vdd", |
5202 | beep_cmd, 0)) | ||
5203 | return -EIO; | ||
5204 | } else { | ||
5205 | if (!acpi_evalf(beep_handle, NULL, NULL, "vd", | ||
5206 | beep_cmd)) | ||
5207 | return -EIO; | ||
5208 | } | ||
5187 | } | 5209 | } |
5188 | 5210 | ||
5189 | return 0; | 5211 | return 0; |