aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/acpi
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/acpi')
-rw-r--r--drivers/acpi/acpi_lpss.c17
-rw-r--r--drivers/acpi/acpica/nsprepkg.c39
-rw-r--r--drivers/acpi/ec.c25
-rw-r--r--drivers/acpi/pci_irq.c4
-rw-r--r--drivers/acpi/processor_idle.c4
-rw-r--r--drivers/acpi/scan.c32
-rw-r--r--drivers/acpi/video.c45
7 files changed, 146 insertions, 20 deletions
diff --git a/drivers/acpi/acpi_lpss.c b/drivers/acpi/acpi_lpss.c
index ce06149088c5..9dfec48dd4e5 100644
--- a/drivers/acpi/acpi_lpss.c
+++ b/drivers/acpi/acpi_lpss.c
@@ -196,6 +196,17 @@ static struct lpss_device_desc byt_i2c_dev_desc = {
196 .setup = lpss_i2c_setup, 196 .setup = lpss_i2c_setup,
197}; 197};
198 198
199static struct lpss_shared_clock bsw_pwm_clock = {
200 .name = "pwm_clk",
201 .rate = 19200000,
202};
203
204static struct lpss_device_desc bsw_pwm_dev_desc = {
205 .clk_required = true,
206 .save_ctx = true,
207 .shared_clock = &bsw_pwm_clock,
208};
209
199#else 210#else
200 211
201#define LPSS_ADDR(desc) (0UL) 212#define LPSS_ADDR(desc) (0UL)
@@ -225,6 +236,12 @@ static const struct acpi_device_id acpi_lpss_device_ids[] = {
225 { "INT33B2", }, 236 { "INT33B2", },
226 { "INT33FC", }, 237 { "INT33FC", },
227 238
239 /* Braswell LPSS devices */
240 { "80862288", LPSS_ADDR(bsw_pwm_dev_desc) },
241 { "8086228A", LPSS_ADDR(byt_uart_dev_desc) },
242 { "8086228E", LPSS_ADDR(byt_spi_dev_desc) },
243 { "808622C1", LPSS_ADDR(byt_i2c_dev_desc) },
244
228 { "INT3430", LPSS_ADDR(lpt_dev_desc) }, 245 { "INT3430", LPSS_ADDR(lpt_dev_desc) },
229 { "INT3431", LPSS_ADDR(lpt_dev_desc) }, 246 { "INT3431", LPSS_ADDR(lpt_dev_desc) },
230 { "INT3432", LPSS_ADDR(lpt_i2c_dev_desc) }, 247 { "INT3432", LPSS_ADDR(lpt_i2c_dev_desc) },
diff --git a/drivers/acpi/acpica/nsprepkg.c b/drivers/acpi/acpica/nsprepkg.c
index 68f725839eb6..1b13b921dda9 100644
--- a/drivers/acpi/acpica/nsprepkg.c
+++ b/drivers/acpi/acpica/nsprepkg.c
@@ -316,6 +316,45 @@ acpi_ns_check_package(struct acpi_evaluate_info *info,
316 acpi_ns_check_package_list(info, package, elements, count); 316 acpi_ns_check_package_list(info, package, elements, count);
317 break; 317 break;
318 318
319 case ACPI_PTYPE2_UUID_PAIR:
320
321 /* The package must contain pairs of (UUID + type) */
322
323 if (count & 1) {
324 expected_count = count + 1;
325 goto package_too_small;
326 }
327
328 while (count > 0) {
329 status = acpi_ns_check_object_type(info, elements,
330 package->ret_info.
331 object_type1, 0);
332 if (ACPI_FAILURE(status)) {
333 return (status);
334 }
335
336 /* Validate length of the UUID buffer */
337
338 if ((*elements)->buffer.length != 16) {
339 ACPI_WARN_PREDEFINED((AE_INFO,
340 info->full_pathname,
341 info->node_flags,
342 "Invalid length for UUID Buffer"));
343 return (AE_AML_OPERAND_VALUE);
344 }
345
346 status = acpi_ns_check_object_type(info, elements + 1,
347 package->ret_info.
348 object_type2, 0);
349 if (ACPI_FAILURE(status)) {
350 return (status);
351 }
352
353 elements += 2;
354 count -= 2;
355 }
356 break;
357
319 default: 358 default:
320 359
321 /* Should not get here if predefined info table is correct */ 360 /* Should not get here if predefined info table is correct */
diff --git a/drivers/acpi/ec.c b/drivers/acpi/ec.c
index a66ab658abbc..cb6066c809ea 100644
--- a/drivers/acpi/ec.c
+++ b/drivers/acpi/ec.c
@@ -197,6 +197,8 @@ static bool advance_transaction(struct acpi_ec *ec)
197 t->rdata[t->ri++] = acpi_ec_read_data(ec); 197 t->rdata[t->ri++] = acpi_ec_read_data(ec);
198 if (t->rlen == t->ri) { 198 if (t->rlen == t->ri) {
199 t->flags |= ACPI_EC_COMMAND_COMPLETE; 199 t->flags |= ACPI_EC_COMMAND_COMPLETE;
200 if (t->command == ACPI_EC_COMMAND_QUERY)
201 pr_debug("hardware QR_EC completion\n");
200 wakeup = true; 202 wakeup = true;
201 } 203 }
202 } else 204 } else
@@ -208,7 +210,20 @@ static bool advance_transaction(struct acpi_ec *ec)
208 } 210 }
209 return wakeup; 211 return wakeup;
210 } else { 212 } else {
211 if ((status & ACPI_EC_FLAG_IBF) == 0) { 213 /*
214 * There is firmware refusing to respond QR_EC when SCI_EVT
215 * is not set, for which case, we complete the QR_EC
216 * without issuing it to the firmware.
217 * https://bugzilla.kernel.org/show_bug.cgi?id=86211
218 */
219 if (!(status & ACPI_EC_FLAG_SCI) &&
220 (t->command == ACPI_EC_COMMAND_QUERY)) {
221 t->flags |= ACPI_EC_COMMAND_POLL;
222 t->rdata[t->ri++] = 0x00;
223 t->flags |= ACPI_EC_COMMAND_COMPLETE;
224 pr_debug("software QR_EC completion\n");
225 wakeup = true;
226 } else if ((status & ACPI_EC_FLAG_IBF) == 0) {
212 acpi_ec_write_cmd(ec, t->command); 227 acpi_ec_write_cmd(ec, t->command);
213 t->flags |= ACPI_EC_COMMAND_POLL; 228 t->flags |= ACPI_EC_COMMAND_POLL;
214 } else 229 } else
@@ -288,11 +303,11 @@ static int acpi_ec_transaction_unlocked(struct acpi_ec *ec,
288 /* following two actions should be kept atomic */ 303 /* following two actions should be kept atomic */
289 ec->curr = t; 304 ec->curr = t;
290 start_transaction(ec); 305 start_transaction(ec);
291 if (ec->curr->command == ACPI_EC_COMMAND_QUERY)
292 clear_bit(EC_FLAGS_QUERY_PENDING, &ec->flags);
293 spin_unlock_irqrestore(&ec->lock, tmp); 306 spin_unlock_irqrestore(&ec->lock, tmp);
294 ret = ec_poll(ec); 307 ret = ec_poll(ec);
295 spin_lock_irqsave(&ec->lock, tmp); 308 spin_lock_irqsave(&ec->lock, tmp);
309 if (ec->curr->command == ACPI_EC_COMMAND_QUERY)
310 clear_bit(EC_FLAGS_QUERY_PENDING, &ec->flags);
296 ec->curr = NULL; 311 ec->curr = NULL;
297 spin_unlock_irqrestore(&ec->lock, tmp); 312 spin_unlock_irqrestore(&ec->lock, tmp);
298 return ret; 313 return ret;
@@ -1015,6 +1030,10 @@ static struct dmi_system_id ec_dmi_table[] __initdata = {
1015 DMI_MATCH(DMI_SYS_VENDOR, "Quanta"), 1030 DMI_MATCH(DMI_SYS_VENDOR, "Quanta"),
1016 DMI_MATCH(DMI_PRODUCT_NAME, "TW9/SW9"),}, NULL}, 1031 DMI_MATCH(DMI_PRODUCT_NAME, "TW9/SW9"),}, NULL},
1017 { 1032 {
1033 ec_flag_msi, "Clevo W350etq", {
1034 DMI_MATCH(DMI_SYS_VENDOR, "CLEVO CO."),
1035 DMI_MATCH(DMI_PRODUCT_NAME, "W35_37ET"),}, NULL},
1036 {
1018 ec_validate_ecdt, "ASUS hardware", { 1037 ec_validate_ecdt, "ASUS hardware", {
1019 DMI_MATCH(DMI_BIOS_VENDOR, "ASUS") }, NULL}, 1038 DMI_MATCH(DMI_BIOS_VENDOR, "ASUS") }, NULL},
1020 { 1039 {
diff --git a/drivers/acpi/pci_irq.c b/drivers/acpi/pci_irq.c
index c96887d5289e..6e6b80eb0bba 100644
--- a/drivers/acpi/pci_irq.c
+++ b/drivers/acpi/pci_irq.c
@@ -484,6 +484,10 @@ void acpi_pci_irq_disable(struct pci_dev *dev)
484 /* Keep IOAPIC pin configuration when suspending */ 484 /* Keep IOAPIC pin configuration when suspending */
485 if (dev->dev.power.is_prepared) 485 if (dev->dev.power.is_prepared)
486 return; 486 return;
487#ifdef CONFIG_PM_RUNTIME
488 if (dev->dev.power.runtime_status == RPM_SUSPENDING)
489 return;
490#endif
487 491
488 entry = acpi_pci_irq_lookup(dev, pin); 492 entry = acpi_pci_irq_lookup(dev, pin);
489 if (!entry) 493 if (!entry)
diff --git a/drivers/acpi/processor_idle.c b/drivers/acpi/processor_idle.c
index 3dca36d4ad26..17f9ec501972 100644
--- a/drivers/acpi/processor_idle.c
+++ b/drivers/acpi/processor_idle.c
@@ -1071,9 +1071,9 @@ int acpi_processor_cst_has_changed(struct acpi_processor *pr)
1071 1071
1072 if (pr->id == 0 && cpuidle_get_driver() == &acpi_idle_driver) { 1072 if (pr->id == 0 && cpuidle_get_driver() == &acpi_idle_driver) {
1073 1073
1074 cpuidle_pause_and_lock();
1075 /* Protect against cpu-hotplug */ 1074 /* Protect against cpu-hotplug */
1076 get_online_cpus(); 1075 get_online_cpus();
1076 cpuidle_pause_and_lock();
1077 1077
1078 /* Disable all cpuidle devices */ 1078 /* Disable all cpuidle devices */
1079 for_each_online_cpu(cpu) { 1079 for_each_online_cpu(cpu) {
@@ -1100,8 +1100,8 @@ int acpi_processor_cst_has_changed(struct acpi_processor *pr)
1100 cpuidle_enable_device(dev); 1100 cpuidle_enable_device(dev);
1101 } 1101 }
1102 } 1102 }
1103 put_online_cpus();
1104 cpuidle_resume_and_unlock(); 1103 cpuidle_resume_and_unlock();
1104 put_online_cpus();
1105 } 1105 }
1106 1106
1107 return 0; 1107 return 0;
diff --git a/drivers/acpi/scan.c b/drivers/acpi/scan.c
index 0a817ad24f16..3bf7764659a4 100644
--- a/drivers/acpi/scan.c
+++ b/drivers/acpi/scan.c
@@ -667,8 +667,14 @@ static ssize_t
667acpi_device_sun_show(struct device *dev, struct device_attribute *attr, 667acpi_device_sun_show(struct device *dev, struct device_attribute *attr,
668 char *buf) { 668 char *buf) {
669 struct acpi_device *acpi_dev = to_acpi_device(dev); 669 struct acpi_device *acpi_dev = to_acpi_device(dev);
670 acpi_status status;
671 unsigned long long sun;
672
673 status = acpi_evaluate_integer(acpi_dev->handle, "_SUN", NULL, &sun);
674 if (ACPI_FAILURE(status))
675 return -ENODEV;
670 676
671 return sprintf(buf, "%lu\n", acpi_dev->pnp.sun); 677 return sprintf(buf, "%llu\n", sun);
672} 678}
673static DEVICE_ATTR(sun, 0444, acpi_device_sun_show, NULL); 679static DEVICE_ATTR(sun, 0444, acpi_device_sun_show, NULL);
674 680
@@ -690,7 +696,6 @@ static int acpi_device_setup_files(struct acpi_device *dev)
690{ 696{
691 struct acpi_buffer buffer = {ACPI_ALLOCATE_BUFFER, NULL}; 697 struct acpi_buffer buffer = {ACPI_ALLOCATE_BUFFER, NULL};
692 acpi_status status; 698 acpi_status status;
693 unsigned long long sun;
694 int result = 0; 699 int result = 0;
695 700
696 /* 701 /*
@@ -731,14 +736,10 @@ static int acpi_device_setup_files(struct acpi_device *dev)
731 if (dev->pnp.unique_id) 736 if (dev->pnp.unique_id)
732 result = device_create_file(&dev->dev, &dev_attr_uid); 737 result = device_create_file(&dev->dev, &dev_attr_uid);
733 738
734 status = acpi_evaluate_integer(dev->handle, "_SUN", NULL, &sun); 739 if (acpi_has_method(dev->handle, "_SUN")) {
735 if (ACPI_SUCCESS(status)) {
736 dev->pnp.sun = (unsigned long)sun;
737 result = device_create_file(&dev->dev, &dev_attr_sun); 740 result = device_create_file(&dev->dev, &dev_attr_sun);
738 if (result) 741 if (result)
739 goto end; 742 goto end;
740 } else {
741 dev->pnp.sun = (unsigned long)-1;
742 } 743 }
743 744
744 if (acpi_has_method(dev->handle, "_STA")) { 745 if (acpi_has_method(dev->handle, "_STA")) {
@@ -922,12 +923,17 @@ static void acpi_device_notify(acpi_handle handle, u32 event, void *data)
922 device->driver->ops.notify(device, event); 923 device->driver->ops.notify(device, event);
923} 924}
924 925
925static acpi_status acpi_device_notify_fixed(void *data) 926static void acpi_device_notify_fixed(void *data)
926{ 927{
927 struct acpi_device *device = data; 928 struct acpi_device *device = data;
928 929
929 /* Fixed hardware devices have no handles */ 930 /* Fixed hardware devices have no handles */
930 acpi_device_notify(NULL, ACPI_FIXED_HARDWARE_EVENT, device); 931 acpi_device_notify(NULL, ACPI_FIXED_HARDWARE_EVENT, device);
932}
933
934static acpi_status acpi_device_fixed_event(void *data)
935{
936 acpi_os_execute(OSL_NOTIFY_HANDLER, acpi_device_notify_fixed, data);
931 return AE_OK; 937 return AE_OK;
932} 938}
933 939
@@ -938,12 +944,12 @@ static int acpi_device_install_notify_handler(struct acpi_device *device)
938 if (device->device_type == ACPI_BUS_TYPE_POWER_BUTTON) 944 if (device->device_type == ACPI_BUS_TYPE_POWER_BUTTON)
939 status = 945 status =
940 acpi_install_fixed_event_handler(ACPI_EVENT_POWER_BUTTON, 946 acpi_install_fixed_event_handler(ACPI_EVENT_POWER_BUTTON,
941 acpi_device_notify_fixed, 947 acpi_device_fixed_event,
942 device); 948 device);
943 else if (device->device_type == ACPI_BUS_TYPE_SLEEP_BUTTON) 949 else if (device->device_type == ACPI_BUS_TYPE_SLEEP_BUTTON)
944 status = 950 status =
945 acpi_install_fixed_event_handler(ACPI_EVENT_SLEEP_BUTTON, 951 acpi_install_fixed_event_handler(ACPI_EVENT_SLEEP_BUTTON,
946 acpi_device_notify_fixed, 952 acpi_device_fixed_event,
947 device); 953 device);
948 else 954 else
949 status = acpi_install_notify_handler(device->handle, 955 status = acpi_install_notify_handler(device->handle,
@@ -960,10 +966,10 @@ static void acpi_device_remove_notify_handler(struct acpi_device *device)
960{ 966{
961 if (device->device_type == ACPI_BUS_TYPE_POWER_BUTTON) 967 if (device->device_type == ACPI_BUS_TYPE_POWER_BUTTON)
962 acpi_remove_fixed_event_handler(ACPI_EVENT_POWER_BUTTON, 968 acpi_remove_fixed_event_handler(ACPI_EVENT_POWER_BUTTON,
963 acpi_device_notify_fixed); 969 acpi_device_fixed_event);
964 else if (device->device_type == ACPI_BUS_TYPE_SLEEP_BUTTON) 970 else if (device->device_type == ACPI_BUS_TYPE_SLEEP_BUTTON)
965 acpi_remove_fixed_event_handler(ACPI_EVENT_SLEEP_BUTTON, 971 acpi_remove_fixed_event_handler(ACPI_EVENT_SLEEP_BUTTON,
966 acpi_device_notify_fixed); 972 acpi_device_fixed_event);
967 else 973 else
968 acpi_remove_notify_handler(device->handle, ACPI_DEVICE_NOTIFY, 974 acpi_remove_notify_handler(device->handle, ACPI_DEVICE_NOTIFY,
969 acpi_device_notify); 975 acpi_device_notify);
@@ -975,7 +981,7 @@ static int acpi_device_probe(struct device *dev)
975 struct acpi_driver *acpi_drv = to_acpi_driver(dev->driver); 981 struct acpi_driver *acpi_drv = to_acpi_driver(dev->driver);
976 int ret; 982 int ret;
977 983
978 if (acpi_dev->handler) 984 if (acpi_dev->handler && !acpi_is_pnp_device(acpi_dev))
979 return -EINVAL; 985 return -EINVAL;
980 986
981 if (!acpi_drv->ops.add) 987 if (!acpi_drv->ops.add)
diff --git a/drivers/acpi/video.c b/drivers/acpi/video.c
index 826884392e6b..fcbda105616e 100644
--- a/drivers/acpi/video.c
+++ b/drivers/acpi/video.c
@@ -82,9 +82,9 @@ module_param(allow_duplicates, bool, 0644);
82 * For Windows 8 systems: used to decide if video module 82 * For Windows 8 systems: used to decide if video module
83 * should skip registering backlight interface of its own. 83 * should skip registering backlight interface of its own.
84 */ 84 */
85static int use_native_backlight_param = 1; 85static int use_native_backlight_param = -1;
86module_param_named(use_native_backlight, use_native_backlight_param, int, 0444); 86module_param_named(use_native_backlight, use_native_backlight_param, int, 0444);
87static bool use_native_backlight_dmi = false; 87static bool use_native_backlight_dmi = true;
88 88
89static int register_count; 89static int register_count;
90static struct mutex video_list_lock; 90static struct mutex video_list_lock;
@@ -417,6 +417,12 @@ static int __init video_set_use_native_backlight(const struct dmi_system_id *d)
417 return 0; 417 return 0;
418} 418}
419 419
420static int __init video_disable_native_backlight(const struct dmi_system_id *d)
421{
422 use_native_backlight_dmi = false;
423 return 0;
424}
425
420static struct dmi_system_id video_dmi_table[] __initdata = { 426static struct dmi_system_id video_dmi_table[] __initdata = {
421 /* 427 /*
422 * Broken _BQC workaround http://bugzilla.kernel.org/show_bug.cgi?id=13121 428 * Broken _BQC workaround http://bugzilla.kernel.org/show_bug.cgi?id=13121
@@ -720,6 +726,41 @@ static struct dmi_system_id video_dmi_table[] __initdata = {
720 DMI_MATCH(DMI_PRODUCT_NAME, "HP EliteBook 8780w"), 726 DMI_MATCH(DMI_PRODUCT_NAME, "HP EliteBook 8780w"),
721 }, 727 },
722 }, 728 },
729
730 /*
731 * These models have a working acpi_video backlight control, and using
732 * native backlight causes a regression where backlight does not work
733 * when userspace is not handling brightness key events. Disable
734 * native_backlight on these to fix this:
735 * https://bugzilla.kernel.org/show_bug.cgi?id=81691
736 */
737 {
738 .callback = video_disable_native_backlight,
739 .ident = "ThinkPad T420",
740 .matches = {
741 DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"),
742 DMI_MATCH(DMI_PRODUCT_VERSION, "ThinkPad T420"),
743 },
744 },
745 {
746 .callback = video_disable_native_backlight,
747 .ident = "ThinkPad T520",
748 .matches = {
749 DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"),
750 DMI_MATCH(DMI_PRODUCT_VERSION, "ThinkPad T520"),
751 },
752 },
753
754 /* The native backlight controls do not work on some older machines */
755 {
756 /* https://bugs.freedesktop.org/show_bug.cgi?id=81515 */
757 .callback = video_disable_native_backlight,
758 .ident = "HP ENVY 15 Notebook",
759 .matches = {
760 DMI_MATCH(DMI_SYS_VENDOR, "Hewlett-Packard"),
761 DMI_MATCH(DMI_PRODUCT_NAME, "HP ENVY 15 Notebook PC"),
762 },
763 },
723 {} 764 {}
724}; 765};
725 766