aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/acpi
diff options
context:
space:
mode:
authorDmitry Torokhov <dmitry.torokhov@gmail.com>2014-10-11 14:34:07 -0400
committerDmitry Torokhov <dmitry.torokhov@gmail.com>2014-10-11 14:34:07 -0400
commit9d93551188069a0a21e664b4bfc89ed4a6df1903 (patch)
treebcf7334c0e57323a6844b8147ce1c92180fe8cef /drivers/acpi
parentdd4cae8bf16611053ee7b00e20aa4fa945b92b99 (diff)
parentbfe01a5ba2490f299e1d2d5508cbbbadd897bbe9 (diff)
Merge tag 'v3.17' into next
Synchronize with mainline to bring in changes to Synaptics and i8042 drivers.
Diffstat (limited to 'drivers/acpi')
-rw-r--r--drivers/acpi/acpi_cmos_rtc.c2
-rw-r--r--drivers/acpi/acpi_lpss.c11
-rw-r--r--drivers/acpi/acpica/aclocal.h1
-rw-r--r--drivers/acpi/acpica/acobject.h1
-rw-r--r--drivers/acpi/acpica/dsfield.c2
-rw-r--r--drivers/acpi/acpica/evregion.c47
-rw-r--r--drivers/acpi/acpica/exfield.c67
-rw-r--r--drivers/acpi/acpica/exprep.c2
-rw-r--r--drivers/acpi/acpica/nsprepkg.c39
-rw-r--r--drivers/acpi/battery.c14
-rw-r--r--drivers/acpi/bus.c10
-rw-r--r--drivers/acpi/container.c8
-rw-r--r--drivers/acpi/ec.c4
-rw-r--r--drivers/acpi/processor_idle.c4
-rw-r--r--drivers/acpi/scan.c20
-rw-r--r--drivers/acpi/video.c53
16 files changed, 226 insertions, 59 deletions
diff --git a/drivers/acpi/acpi_cmos_rtc.c b/drivers/acpi/acpi_cmos_rtc.c
index 2da8660262e5..81dc75033f15 100644
--- a/drivers/acpi/acpi_cmos_rtc.c
+++ b/drivers/acpi/acpi_cmos_rtc.c
@@ -33,7 +33,7 @@ acpi_cmos_rtc_space_handler(u32 function, acpi_physical_address address,
33 void *handler_context, void *region_context) 33 void *handler_context, void *region_context)
34{ 34{
35 int i; 35 int i;
36 u8 *value = (u8 *)&value64; 36 u8 *value = (u8 *)value64;
37 37
38 if (address > 0xff || !value64) 38 if (address > 0xff || !value64)
39 return AE_BAD_PARAMETER; 39 return AE_BAD_PARAMETER;
diff --git a/drivers/acpi/acpi_lpss.c b/drivers/acpi/acpi_lpss.c
index 9dfec48dd4e5..b0ea767c8696 100644
--- a/drivers/acpi/acpi_lpss.c
+++ b/drivers/acpi/acpi_lpss.c
@@ -419,7 +419,6 @@ static int acpi_lpss_create_device(struct acpi_device *adev,
419 adev->driver_data = pdata; 419 adev->driver_data = pdata;
420 pdev = acpi_create_platform_device(adev); 420 pdev = acpi_create_platform_device(adev);
421 if (!IS_ERR_OR_NULL(pdev)) { 421 if (!IS_ERR_OR_NULL(pdev)) {
422 device_enable_async_suspend(&pdev->dev);
423 return 1; 422 return 1;
424 } 423 }
425 424
@@ -610,7 +609,7 @@ static int acpi_lpss_suspend_late(struct device *dev)
610 return acpi_dev_suspend_late(dev); 609 return acpi_dev_suspend_late(dev);
611} 610}
612 611
613static int acpi_lpss_restore_early(struct device *dev) 612static int acpi_lpss_resume_early(struct device *dev)
614{ 613{
615 int ret = acpi_dev_resume_early(dev); 614 int ret = acpi_dev_resume_early(dev);
616 615
@@ -650,15 +649,15 @@ static int acpi_lpss_runtime_resume(struct device *dev)
650static struct dev_pm_domain acpi_lpss_pm_domain = { 649static struct dev_pm_domain acpi_lpss_pm_domain = {
651 .ops = { 650 .ops = {
652#ifdef CONFIG_PM_SLEEP 651#ifdef CONFIG_PM_SLEEP
653 .suspend_late = acpi_lpss_suspend_late,
654 .restore_early = acpi_lpss_restore_early,
655 .prepare = acpi_subsys_prepare, 652 .prepare = acpi_subsys_prepare,
656 .complete = acpi_subsys_complete, 653 .complete = acpi_subsys_complete,
657 .suspend = acpi_subsys_suspend, 654 .suspend = acpi_subsys_suspend,
658 .resume_early = acpi_subsys_resume_early, 655 .suspend_late = acpi_lpss_suspend_late,
656 .resume_early = acpi_lpss_resume_early,
659 .freeze = acpi_subsys_freeze, 657 .freeze = acpi_subsys_freeze,
660 .poweroff = acpi_subsys_suspend, 658 .poweroff = acpi_subsys_suspend,
661 .poweroff_late = acpi_subsys_suspend_late, 659 .poweroff_late = acpi_lpss_suspend_late,
660 .restore_early = acpi_lpss_resume_early,
662#endif 661#endif
663#ifdef CONFIG_PM_RUNTIME 662#ifdef CONFIG_PM_RUNTIME
664 .runtime_suspend = acpi_lpss_runtime_suspend, 663 .runtime_suspend = acpi_lpss_runtime_suspend,
diff --git a/drivers/acpi/acpica/aclocal.h b/drivers/acpi/acpica/aclocal.h
index 1f9aba5fb81f..2747279fbe3c 100644
--- a/drivers/acpi/acpica/aclocal.h
+++ b/drivers/acpi/acpica/aclocal.h
@@ -254,6 +254,7 @@ struct acpi_create_field_info {
254 u32 field_bit_position; 254 u32 field_bit_position;
255 u32 field_bit_length; 255 u32 field_bit_length;
256 u16 resource_length; 256 u16 resource_length;
257 u16 pin_number_index;
257 u8 field_flags; 258 u8 field_flags;
258 u8 attribute; 259 u8 attribute;
259 u8 field_type; 260 u8 field_type;
diff --git a/drivers/acpi/acpica/acobject.h b/drivers/acpi/acpica/acobject.h
index 22fb6449d3d6..8abb393dafab 100644
--- a/drivers/acpi/acpica/acobject.h
+++ b/drivers/acpi/acpica/acobject.h
@@ -264,6 +264,7 @@ struct acpi_object_region_field {
264 ACPI_OBJECT_COMMON_HEADER ACPI_COMMON_FIELD_INFO u16 resource_length; 264 ACPI_OBJECT_COMMON_HEADER ACPI_COMMON_FIELD_INFO u16 resource_length;
265 union acpi_operand_object *region_obj; /* Containing op_region object */ 265 union acpi_operand_object *region_obj; /* Containing op_region object */
266 u8 *resource_buffer; /* resource_template for serial regions/fields */ 266 u8 *resource_buffer; /* resource_template for serial regions/fields */
267 u16 pin_number_index; /* Index relative to previous Connection/Template */
267}; 268};
268 269
269struct acpi_object_bank_field { 270struct acpi_object_bank_field {
diff --git a/drivers/acpi/acpica/dsfield.c b/drivers/acpi/acpica/dsfield.c
index 3661c8e90540..c57666196672 100644
--- a/drivers/acpi/acpica/dsfield.c
+++ b/drivers/acpi/acpica/dsfield.c
@@ -360,6 +360,7 @@ acpi_ds_get_field_names(struct acpi_create_field_info *info,
360 */ 360 */
361 info->resource_buffer = NULL; 361 info->resource_buffer = NULL;
362 info->connection_node = NULL; 362 info->connection_node = NULL;
363 info->pin_number_index = 0;
363 364
364 /* 365 /*
365 * A Connection() is either an actual resource descriptor (buffer) 366 * A Connection() is either an actual resource descriptor (buffer)
@@ -437,6 +438,7 @@ acpi_ds_get_field_names(struct acpi_create_field_info *info,
437 } 438 }
438 439
439 info->field_bit_position += info->field_bit_length; 440 info->field_bit_position += info->field_bit_length;
441 info->pin_number_index++; /* Index relative to previous Connection() */
440 break; 442 break;
441 443
442 default: 444 default:
diff --git a/drivers/acpi/acpica/evregion.c b/drivers/acpi/acpica/evregion.c
index 9957297d1580..8eb8575e8c16 100644
--- a/drivers/acpi/acpica/evregion.c
+++ b/drivers/acpi/acpica/evregion.c
@@ -142,6 +142,7 @@ acpi_ev_address_space_dispatch(union acpi_operand_object *region_obj,
142 union acpi_operand_object *region_obj2; 142 union acpi_operand_object *region_obj2;
143 void *region_context = NULL; 143 void *region_context = NULL;
144 struct acpi_connection_info *context; 144 struct acpi_connection_info *context;
145 acpi_physical_address address;
145 146
146 ACPI_FUNCTION_TRACE(ev_address_space_dispatch); 147 ACPI_FUNCTION_TRACE(ev_address_space_dispatch);
147 148
@@ -231,25 +232,23 @@ acpi_ev_address_space_dispatch(union acpi_operand_object *region_obj,
231 /* We have everything we need, we can invoke the address space handler */ 232 /* We have everything we need, we can invoke the address space handler */
232 233
233 handler = handler_desc->address_space.handler; 234 handler = handler_desc->address_space.handler;
234 235 address = (region_obj->region.address + region_offset);
235 ACPI_DEBUG_PRINT((ACPI_DB_OPREGION,
236 "Handler %p (@%p) Address %8.8X%8.8X [%s]\n",
237 &region_obj->region.handler->address_space, handler,
238 ACPI_FORMAT_NATIVE_UINT(region_obj->region.address +
239 region_offset),
240 acpi_ut_get_region_name(region_obj->region.
241 space_id)));
242 236
243 /* 237 /*
244 * Special handling for generic_serial_bus and general_purpose_io: 238 * Special handling for generic_serial_bus and general_purpose_io:
245 * There are three extra parameters that must be passed to the 239 * There are three extra parameters that must be passed to the
246 * handler via the context: 240 * handler via the context:
247 * 1) Connection buffer, a resource template from Connection() op. 241 * 1) Connection buffer, a resource template from Connection() op
248 * 2) Length of the above buffer. 242 * 2) Length of the above buffer
249 * 3) Actual access length from the access_as() op. 243 * 3) Actual access length from the access_as() op
244 *
245 * In addition, for general_purpose_io, the Address and bit_width fields
246 * are defined as follows:
247 * 1) Address is the pin number index of the field (bit offset from
248 * the previous Connection)
249 * 2) bit_width is the actual bit length of the field (number of pins)
250 */ 250 */
251 if (((region_obj->region.space_id == ACPI_ADR_SPACE_GSBUS) || 251 if ((region_obj->region.space_id == ACPI_ADR_SPACE_GSBUS) &&
252 (region_obj->region.space_id == ACPI_ADR_SPACE_GPIO)) &&
253 context && field_obj) { 252 context && field_obj) {
254 253
255 /* Get the Connection (resource_template) buffer */ 254 /* Get the Connection (resource_template) buffer */
@@ -258,6 +257,24 @@ acpi_ev_address_space_dispatch(union acpi_operand_object *region_obj,
258 context->length = field_obj->field.resource_length; 257 context->length = field_obj->field.resource_length;
259 context->access_length = field_obj->field.access_length; 258 context->access_length = field_obj->field.access_length;
260 } 259 }
260 if ((region_obj->region.space_id == ACPI_ADR_SPACE_GPIO) &&
261 context && field_obj) {
262
263 /* Get the Connection (resource_template) buffer */
264
265 context->connection = field_obj->field.resource_buffer;
266 context->length = field_obj->field.resource_length;
267 context->access_length = field_obj->field.access_length;
268 address = field_obj->field.pin_number_index;
269 bit_width = field_obj->field.bit_length;
270 }
271
272 ACPI_DEBUG_PRINT((ACPI_DB_OPREGION,
273 "Handler %p (@%p) Address %8.8X%8.8X [%s]\n",
274 &region_obj->region.handler->address_space, handler,
275 ACPI_FORMAT_NATIVE_UINT(address),
276 acpi_ut_get_region_name(region_obj->region.
277 space_id)));
261 278
262 if (!(handler_desc->address_space.handler_flags & 279 if (!(handler_desc->address_space.handler_flags &
263 ACPI_ADDR_HANDLER_DEFAULT_INSTALLED)) { 280 ACPI_ADDR_HANDLER_DEFAULT_INSTALLED)) {
@@ -271,9 +288,7 @@ acpi_ev_address_space_dispatch(union acpi_operand_object *region_obj,
271 288
272 /* Call the handler */ 289 /* Call the handler */
273 290
274 status = handler(function, 291 status = handler(function, address, bit_width, value, context,
275 (region_obj->region.address + region_offset),
276 bit_width, value, context,
277 region_obj2->extra.region_context); 292 region_obj2->extra.region_context);
278 293
279 if (ACPI_FAILURE(status)) { 294 if (ACPI_FAILURE(status)) {
diff --git a/drivers/acpi/acpica/exfield.c b/drivers/acpi/acpica/exfield.c
index 6907ce0c704c..b994845ed359 100644
--- a/drivers/acpi/acpica/exfield.c
+++ b/drivers/acpi/acpica/exfield.c
@@ -253,6 +253,37 @@ acpi_ex_read_data_from_field(struct acpi_walk_state * walk_state,
253 buffer = &buffer_desc->integer.value; 253 buffer = &buffer_desc->integer.value;
254 } 254 }
255 255
256 if ((obj_desc->common.type == ACPI_TYPE_LOCAL_REGION_FIELD) &&
257 (obj_desc->field.region_obj->region.space_id ==
258 ACPI_ADR_SPACE_GPIO)) {
259 /*
260 * For GPIO (general_purpose_io), the Address will be the bit offset
261 * from the previous Connection() operator, making it effectively a
262 * pin number index. The bit_length is the length of the field, which
263 * is thus the number of pins.
264 */
265 ACPI_DEBUG_PRINT((ACPI_DB_BFIELD,
266 "GPIO FieldRead [FROM]: Pin %u Bits %u\n",
267 obj_desc->field.pin_number_index,
268 obj_desc->field.bit_length));
269
270 /* Lock entire transaction if requested */
271
272 acpi_ex_acquire_global_lock(obj_desc->common_field.field_flags);
273
274 /* Perform the write */
275
276 status = acpi_ex_access_region(obj_desc, 0,
277 (u64 *)buffer, ACPI_READ);
278 acpi_ex_release_global_lock(obj_desc->common_field.field_flags);
279 if (ACPI_FAILURE(status)) {
280 acpi_ut_remove_reference(buffer_desc);
281 } else {
282 *ret_buffer_desc = buffer_desc;
283 }
284 return_ACPI_STATUS(status);
285 }
286
256 ACPI_DEBUG_PRINT((ACPI_DB_BFIELD, 287 ACPI_DEBUG_PRINT((ACPI_DB_BFIELD,
257 "FieldRead [TO]: Obj %p, Type %X, Buf %p, ByteLen %X\n", 288 "FieldRead [TO]: Obj %p, Type %X, Buf %p, ByteLen %X\n",
258 obj_desc, obj_desc->common.type, buffer, 289 obj_desc, obj_desc->common.type, buffer,
@@ -413,6 +444,42 @@ acpi_ex_write_data_to_field(union acpi_operand_object *source_desc,
413 444
414 *result_desc = buffer_desc; 445 *result_desc = buffer_desc;
415 return_ACPI_STATUS(status); 446 return_ACPI_STATUS(status);
447 } else if ((obj_desc->common.type == ACPI_TYPE_LOCAL_REGION_FIELD) &&
448 (obj_desc->field.region_obj->region.space_id ==
449 ACPI_ADR_SPACE_GPIO)) {
450 /*
451 * For GPIO (general_purpose_io), we will bypass the entire field
452 * mechanism and handoff the bit address and bit width directly to
453 * the handler. The Address will be the bit offset
454 * from the previous Connection() operator, making it effectively a
455 * pin number index. The bit_length is the length of the field, which
456 * is thus the number of pins.
457 */
458 if (source_desc->common.type != ACPI_TYPE_INTEGER) {
459 return_ACPI_STATUS(AE_AML_OPERAND_TYPE);
460 }
461
462 ACPI_DEBUG_PRINT((ACPI_DB_BFIELD,
463 "GPIO FieldWrite [FROM]: (%s:%X), Val %.8X [TO]: Pin %u Bits %u\n",
464 acpi_ut_get_type_name(source_desc->common.
465 type),
466 source_desc->common.type,
467 (u32)source_desc->integer.value,
468 obj_desc->field.pin_number_index,
469 obj_desc->field.bit_length));
470
471 buffer = &source_desc->integer.value;
472
473 /* Lock entire transaction if requested */
474
475 acpi_ex_acquire_global_lock(obj_desc->common_field.field_flags);
476
477 /* Perform the write */
478
479 status = acpi_ex_access_region(obj_desc, 0,
480 (u64 *)buffer, ACPI_WRITE);
481 acpi_ex_release_global_lock(obj_desc->common_field.field_flags);
482 return_ACPI_STATUS(status);
416 } 483 }
417 484
418 /* Get a pointer to the data to be written */ 485 /* Get a pointer to the data to be written */
diff --git a/drivers/acpi/acpica/exprep.c b/drivers/acpi/acpica/exprep.c
index ee3f872870bc..118e942005e5 100644
--- a/drivers/acpi/acpica/exprep.c
+++ b/drivers/acpi/acpica/exprep.c
@@ -484,6 +484,8 @@ acpi_status acpi_ex_prep_field_value(struct acpi_create_field_info *info)
484 obj_desc->field.resource_length = info->resource_length; 484 obj_desc->field.resource_length = info->resource_length;
485 } 485 }
486 486
487 obj_desc->field.pin_number_index = info->pin_number_index;
488
487 /* Allow full data read from EC address space */ 489 /* Allow full data read from EC address space */
488 490
489 if ((obj_desc->field.region_obj->region.space_id == 491 if ((obj_desc->field.region_obj->region.space_id ==
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/battery.c b/drivers/acpi/battery.c
index 1c162e7be045..5fdfe65fe165 100644
--- a/drivers/acpi/battery.c
+++ b/drivers/acpi/battery.c
@@ -534,20 +534,6 @@ static int acpi_battery_get_state(struct acpi_battery *battery)
534 " invalid.\n"); 534 " invalid.\n");
535 } 535 }
536 536
537 /*
538 * When fully charged, some batteries wrongly report
539 * capacity_now = design_capacity instead of = full_charge_capacity
540 */
541 if (battery->capacity_now > battery->full_charge_capacity
542 && battery->full_charge_capacity != ACPI_BATTERY_VALUE_UNKNOWN) {
543 if (battery->capacity_now != battery->design_capacity)
544 printk_once(KERN_WARNING FW_BUG
545 "battery: reported current charge level (%d) "
546 "is higher than reported maximum charge level (%d).\n",
547 battery->capacity_now, battery->full_charge_capacity);
548 battery->capacity_now = battery->full_charge_capacity;
549 }
550
551 if (test_bit(ACPI_BATTERY_QUIRK_PERCENTAGE_CAPACITY, &battery->flags) 537 if (test_bit(ACPI_BATTERY_QUIRK_PERCENTAGE_CAPACITY, &battery->flags)
552 && battery->capacity_now >= 0 && battery->capacity_now <= 100) 538 && battery->capacity_now >= 0 && battery->capacity_now <= 100)
553 battery->capacity_now = (battery->capacity_now * 539 battery->capacity_now = (battery->capacity_now *
diff --git a/drivers/acpi/bus.c b/drivers/acpi/bus.c
index 8581f5b84f48..8b67bd0f6bb5 100644
--- a/drivers/acpi/bus.c
+++ b/drivers/acpi/bus.c
@@ -177,16 +177,6 @@ void acpi_bus_detach_private_data(acpi_handle handle)
177} 177}
178EXPORT_SYMBOL_GPL(acpi_bus_detach_private_data); 178EXPORT_SYMBOL_GPL(acpi_bus_detach_private_data);
179 179
180void acpi_bus_no_hotplug(acpi_handle handle)
181{
182 struct acpi_device *adev = NULL;
183
184 acpi_bus_get_device(handle, &adev);
185 if (adev)
186 adev->flags.no_hotplug = true;
187}
188EXPORT_SYMBOL_GPL(acpi_bus_no_hotplug);
189
190static void acpi_print_osc_error(acpi_handle handle, 180static void acpi_print_osc_error(acpi_handle handle,
191 struct acpi_osc_context *context, char *error) 181 struct acpi_osc_context *context, char *error)
192{ 182{
diff --git a/drivers/acpi/container.c b/drivers/acpi/container.c
index 76f7cff64594..c8ead9f97375 100644
--- a/drivers/acpi/container.c
+++ b/drivers/acpi/container.c
@@ -99,6 +99,13 @@ static void container_device_detach(struct acpi_device *adev)
99 device_unregister(dev); 99 device_unregister(dev);
100} 100}
101 101
102static void container_device_online(struct acpi_device *adev)
103{
104 struct device *dev = acpi_driver_data(adev);
105
106 kobject_uevent(&dev->kobj, KOBJ_ONLINE);
107}
108
102static struct acpi_scan_handler container_handler = { 109static struct acpi_scan_handler container_handler = {
103 .ids = container_device_ids, 110 .ids = container_device_ids,
104 .attach = container_device_attach, 111 .attach = container_device_attach,
@@ -106,6 +113,7 @@ static struct acpi_scan_handler container_handler = {
106 .hotplug = { 113 .hotplug = {
107 .enabled = true, 114 .enabled = true,
108 .demand_offline = true, 115 .demand_offline = true,
116 .notify_online = container_device_online,
109 }, 117 },
110}; 118};
111 119
diff --git a/drivers/acpi/ec.c b/drivers/acpi/ec.c
index 9922cc46b15c..cb6066c809ea 100644
--- a/drivers/acpi/ec.c
+++ b/drivers/acpi/ec.c
@@ -1030,6 +1030,10 @@ static struct dmi_system_id ec_dmi_table[] __initdata = {
1030 DMI_MATCH(DMI_SYS_VENDOR, "Quanta"), 1030 DMI_MATCH(DMI_SYS_VENDOR, "Quanta"),
1031 DMI_MATCH(DMI_PRODUCT_NAME, "TW9/SW9"),}, NULL}, 1031 DMI_MATCH(DMI_PRODUCT_NAME, "TW9/SW9"),}, NULL},
1032 { 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 {
1033 ec_validate_ecdt, "ASUS hardware", { 1037 ec_validate_ecdt, "ASUS hardware", {
1034 DMI_MATCH(DMI_BIOS_VENDOR, "ASUS") }, NULL}, 1038 DMI_MATCH(DMI_BIOS_VENDOR, "ASUS") }, NULL},
1035 { 1039 {
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 9a9298994e26..ae44d8654c82 100644
--- a/drivers/acpi/scan.c
+++ b/drivers/acpi/scan.c
@@ -130,7 +130,7 @@ static int create_modalias(struct acpi_device *acpi_dev, char *modalias,
130 list_for_each_entry(id, &acpi_dev->pnp.ids, list) { 130 list_for_each_entry(id, &acpi_dev->pnp.ids, list) {
131 count = snprintf(&modalias[len], size, "%s:", id->id); 131 count = snprintf(&modalias[len], size, "%s:", id->id);
132 if (count < 0) 132 if (count < 0)
133 return EINVAL; 133 return -EINVAL;
134 if (count >= size) 134 if (count >= size)
135 return -ENOMEM; 135 return -ENOMEM;
136 len += count; 136 len += count;
@@ -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")) {
@@ -2188,6 +2189,9 @@ static void acpi_bus_attach(struct acpi_device *device)
2188 ok: 2189 ok:
2189 list_for_each_entry(child, &device->children, node) 2190 list_for_each_entry(child, &device->children, node)
2190 acpi_bus_attach(child); 2191 acpi_bus_attach(child);
2192
2193 if (device->handler && device->handler->hotplug.notify_online)
2194 device->handler->hotplug.notify_online(device);
2191} 2195}
2192 2196
2193/** 2197/**
diff --git a/drivers/acpi/video.c b/drivers/acpi/video.c
index 826884392e6b..8e7e18567ae6 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,49 @@ 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 .callback = video_disable_native_backlight,
755 .ident = "ThinkPad X201s",
756 .matches = {
757 DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"),
758 DMI_MATCH(DMI_PRODUCT_VERSION, "ThinkPad X201s"),
759 },
760 },
761
762 /* The native backlight controls do not work on some older machines */
763 {
764 /* https://bugs.freedesktop.org/show_bug.cgi?id=81515 */
765 .callback = video_disable_native_backlight,
766 .ident = "HP ENVY 15 Notebook",
767 .matches = {
768 DMI_MATCH(DMI_SYS_VENDOR, "Hewlett-Packard"),
769 DMI_MATCH(DMI_PRODUCT_NAME, "HP ENVY 15 Notebook PC"),
770 },
771 },
723 {} 772 {}
724}; 773};
725 774