diff options
Diffstat (limited to 'drivers/acpi/video.c')
-rw-r--r-- | drivers/acpi/video.c | 74 |
1 files changed, 34 insertions, 40 deletions
diff --git a/drivers/acpi/video.c b/drivers/acpi/video.c index 1f3ffb353299..56666a982476 100644 --- a/drivers/acpi/video.c +++ b/drivers/acpi/video.c | |||
@@ -117,7 +117,7 @@ struct acpi_video_enumerated_device { | |||
117 | }; | 117 | }; |
118 | 118 | ||
119 | struct acpi_video_bus { | 119 | struct acpi_video_bus { |
120 | acpi_handle handle; | 120 | struct acpi_device *device; |
121 | u8 dos_setting; | 121 | u8 dos_setting; |
122 | struct acpi_video_enumerated_device *attached_array; | 122 | struct acpi_video_enumerated_device *attached_array; |
123 | u8 attached_count; | 123 | u8 attached_count; |
@@ -155,7 +155,6 @@ struct acpi_video_device_brightness { | |||
155 | }; | 155 | }; |
156 | 156 | ||
157 | struct acpi_video_device { | 157 | struct acpi_video_device { |
158 | acpi_handle handle; | ||
159 | unsigned long device_id; | 158 | unsigned long device_id; |
160 | struct acpi_video_device_flags flags; | 159 | struct acpi_video_device_flags flags; |
161 | struct acpi_video_device_cap cap; | 160 | struct acpi_video_device_cap cap; |
@@ -272,7 +271,8 @@ static int | |||
272 | acpi_video_device_query(struct acpi_video_device *device, unsigned long *state) | 271 | acpi_video_device_query(struct acpi_video_device *device, unsigned long *state) |
273 | { | 272 | { |
274 | int status; | 273 | int status; |
275 | status = acpi_evaluate_integer(device->handle, "_DGS", NULL, state); | 274 | |
275 | status = acpi_evaluate_integer(device->dev->handle, "_DGS", NULL, state); | ||
276 | 276 | ||
277 | return status; | 277 | return status; |
278 | } | 278 | } |
@@ -283,8 +283,7 @@ acpi_video_device_get_state(struct acpi_video_device *device, | |||
283 | { | 283 | { |
284 | int status; | 284 | int status; |
285 | 285 | ||
286 | 286 | status = acpi_evaluate_integer(device->dev->handle, "_DCS", NULL, state); | |
287 | status = acpi_evaluate_integer(device->handle, "_DCS", NULL, state); | ||
288 | 287 | ||
289 | return status; | 288 | return status; |
290 | } | 289 | } |
@@ -299,7 +298,7 @@ acpi_video_device_set_state(struct acpi_video_device *device, int state) | |||
299 | 298 | ||
300 | 299 | ||
301 | arg0.integer.value = state; | 300 | arg0.integer.value = state; |
302 | status = acpi_evaluate_integer(device->handle, "_DSS", &args, &ret); | 301 | status = acpi_evaluate_integer(device->dev->handle, "_DSS", &args, &ret); |
303 | 302 | ||
304 | return status; | 303 | return status; |
305 | } | 304 | } |
@@ -315,7 +314,7 @@ acpi_video_device_lcd_query_levels(struct acpi_video_device *device, | |||
315 | 314 | ||
316 | *levels = NULL; | 315 | *levels = NULL; |
317 | 316 | ||
318 | status = acpi_evaluate_object(device->handle, "_BCL", NULL, &buffer); | 317 | status = acpi_evaluate_object(device->dev->handle, "_BCL", NULL, &buffer); |
319 | if (!ACPI_SUCCESS(status)) | 318 | if (!ACPI_SUCCESS(status)) |
320 | return status; | 319 | return status; |
321 | obj = (union acpi_object *)buffer.pointer; | 320 | obj = (union acpi_object *)buffer.pointer; |
@@ -344,7 +343,7 @@ acpi_video_device_lcd_set_level(struct acpi_video_device *device, int level) | |||
344 | 343 | ||
345 | 344 | ||
346 | arg0.integer.value = level; | 345 | arg0.integer.value = level; |
347 | status = acpi_evaluate_object(device->handle, "_BCM", &args, NULL); | 346 | status = acpi_evaluate_object(device->dev->handle, "_BCM", &args, NULL); |
348 | 347 | ||
349 | printk(KERN_DEBUG "set_level status: %x\n", status); | 348 | printk(KERN_DEBUG "set_level status: %x\n", status); |
350 | return status; | 349 | return status; |
@@ -356,7 +355,7 @@ acpi_video_device_lcd_get_level_current(struct acpi_video_device *device, | |||
356 | { | 355 | { |
357 | int status; | 356 | int status; |
358 | 357 | ||
359 | status = acpi_evaluate_integer(device->handle, "_BQC", NULL, level); | 358 | status = acpi_evaluate_integer(device->dev->handle, "_BQC", NULL, level); |
360 | 359 | ||
361 | return status; | 360 | return status; |
362 | } | 361 | } |
@@ -383,7 +382,7 @@ acpi_video_device_EDID(struct acpi_video_device *device, | |||
383 | else | 382 | else |
384 | return -EINVAL; | 383 | return -EINVAL; |
385 | 384 | ||
386 | status = acpi_evaluate_object(device->handle, "_DDC", &args, &buffer); | 385 | status = acpi_evaluate_object(device->dev->handle, "_DDC", &args, &buffer); |
387 | if (ACPI_FAILURE(status)) | 386 | if (ACPI_FAILURE(status)) |
388 | return -ENODEV; | 387 | return -ENODEV; |
389 | 388 | ||
@@ -413,7 +412,7 @@ acpi_video_bus_set_POST(struct acpi_video_bus *video, unsigned long option) | |||
413 | 412 | ||
414 | arg0.integer.value = option; | 413 | arg0.integer.value = option; |
415 | 414 | ||
416 | status = acpi_evaluate_integer(video->handle, "_SPD", &args, &tmp); | 415 | status = acpi_evaluate_integer(video->device->handle, "_SPD", &args, &tmp); |
417 | if (ACPI_SUCCESS(status)) | 416 | if (ACPI_SUCCESS(status)) |
418 | status = tmp ? (-EINVAL) : (AE_OK); | 417 | status = tmp ? (-EINVAL) : (AE_OK); |
419 | 418 | ||
@@ -425,8 +424,7 @@ acpi_video_bus_get_POST(struct acpi_video_bus *video, unsigned long *id) | |||
425 | { | 424 | { |
426 | int status; | 425 | int status; |
427 | 426 | ||
428 | 427 | status = acpi_evaluate_integer(video->device->handle, "_GPD", NULL, id); | |
429 | status = acpi_evaluate_integer(video->handle, "_GPD", NULL, id); | ||
430 | 428 | ||
431 | return status; | 429 | return status; |
432 | } | 430 | } |
@@ -437,7 +435,7 @@ acpi_video_bus_POST_options(struct acpi_video_bus *video, | |||
437 | { | 435 | { |
438 | int status; | 436 | int status; |
439 | 437 | ||
440 | status = acpi_evaluate_integer(video->handle, "_VPO", NULL, options); | 438 | status = acpi_evaluate_integer(video->device->handle, "_VPO", NULL, options); |
441 | *options &= 3; | 439 | *options &= 3; |
442 | 440 | ||
443 | return status; | 441 | return status; |
@@ -478,7 +476,7 @@ acpi_video_bus_DOS(struct acpi_video_bus *video, int bios_flag, int lcd_flag) | |||
478 | } | 476 | } |
479 | arg0.integer.value = (lcd_flag << 2) | bios_flag; | 477 | arg0.integer.value = (lcd_flag << 2) | bios_flag; |
480 | video->dos_setting = arg0.integer.value; | 478 | video->dos_setting = arg0.integer.value; |
481 | acpi_evaluate_object(video->handle, "_DOS", &args, NULL); | 479 | acpi_evaluate_object(video->device->handle, "_DOS", &args, NULL); |
482 | 480 | ||
483 | Failed: | 481 | Failed: |
484 | return status; | 482 | return status; |
@@ -506,25 +504,25 @@ static void acpi_video_device_find_cap(struct acpi_video_device *device) | |||
506 | 504 | ||
507 | memset(&device->cap, 0, 4); | 505 | memset(&device->cap, 0, 4); |
508 | 506 | ||
509 | if (ACPI_SUCCESS(acpi_get_handle(device->handle, "_ADR", &h_dummy1))) { | 507 | if (ACPI_SUCCESS(acpi_get_handle(device->dev->handle, "_ADR", &h_dummy1))) { |
510 | device->cap._ADR = 1; | 508 | device->cap._ADR = 1; |
511 | } | 509 | } |
512 | if (ACPI_SUCCESS(acpi_get_handle(device->handle, "_BCL", &h_dummy1))) { | 510 | if (ACPI_SUCCESS(acpi_get_handle(device->dev->handle, "_BCL", &h_dummy1))) { |
513 | device->cap._BCL = 1; | 511 | device->cap._BCL = 1; |
514 | } | 512 | } |
515 | if (ACPI_SUCCESS(acpi_get_handle(device->handle, "_BCM", &h_dummy1))) { | 513 | if (ACPI_SUCCESS(acpi_get_handle(device->dev->handle, "_BCM", &h_dummy1))) { |
516 | device->cap._BCM = 1; | 514 | device->cap._BCM = 1; |
517 | } | 515 | } |
518 | if (ACPI_SUCCESS(acpi_get_handle(device->handle, "_DDC", &h_dummy1))) { | 516 | if (ACPI_SUCCESS(acpi_get_handle(device->dev->handle, "_DDC", &h_dummy1))) { |
519 | device->cap._DDC = 1; | 517 | device->cap._DDC = 1; |
520 | } | 518 | } |
521 | if (ACPI_SUCCESS(acpi_get_handle(device->handle, "_DCS", &h_dummy1))) { | 519 | if (ACPI_SUCCESS(acpi_get_handle(device->dev->handle, "_DCS", &h_dummy1))) { |
522 | device->cap._DCS = 1; | 520 | device->cap._DCS = 1; |
523 | } | 521 | } |
524 | if (ACPI_SUCCESS(acpi_get_handle(device->handle, "_DGS", &h_dummy1))) { | 522 | if (ACPI_SUCCESS(acpi_get_handle(device->dev->handle, "_DGS", &h_dummy1))) { |
525 | device->cap._DGS = 1; | 523 | device->cap._DGS = 1; |
526 | } | 524 | } |
527 | if (ACPI_SUCCESS(acpi_get_handle(device->handle, "_DSS", &h_dummy1))) { | 525 | if (ACPI_SUCCESS(acpi_get_handle(device->dev->handle, "_DSS", &h_dummy1))) { |
528 | device->cap._DSS = 1; | 526 | device->cap._DSS = 1; |
529 | } | 527 | } |
530 | 528 | ||
@@ -588,22 +586,22 @@ static void acpi_video_bus_find_cap(struct acpi_video_bus *video) | |||
588 | acpi_handle h_dummy1; | 586 | acpi_handle h_dummy1; |
589 | 587 | ||
590 | memset(&video->cap, 0, 4); | 588 | memset(&video->cap, 0, 4); |
591 | if (ACPI_SUCCESS(acpi_get_handle(video->handle, "_DOS", &h_dummy1))) { | 589 | if (ACPI_SUCCESS(acpi_get_handle(video->device->handle, "_DOS", &h_dummy1))) { |
592 | video->cap._DOS = 1; | 590 | video->cap._DOS = 1; |
593 | } | 591 | } |
594 | if (ACPI_SUCCESS(acpi_get_handle(video->handle, "_DOD", &h_dummy1))) { | 592 | if (ACPI_SUCCESS(acpi_get_handle(video->device->handle, "_DOD", &h_dummy1))) { |
595 | video->cap._DOD = 1; | 593 | video->cap._DOD = 1; |
596 | } | 594 | } |
597 | if (ACPI_SUCCESS(acpi_get_handle(video->handle, "_ROM", &h_dummy1))) { | 595 | if (ACPI_SUCCESS(acpi_get_handle(video->device->handle, "_ROM", &h_dummy1))) { |
598 | video->cap._ROM = 1; | 596 | video->cap._ROM = 1; |
599 | } | 597 | } |
600 | if (ACPI_SUCCESS(acpi_get_handle(video->handle, "_GPD", &h_dummy1))) { | 598 | if (ACPI_SUCCESS(acpi_get_handle(video->device->handle, "_GPD", &h_dummy1))) { |
601 | video->cap._GPD = 1; | 599 | video->cap._GPD = 1; |
602 | } | 600 | } |
603 | if (ACPI_SUCCESS(acpi_get_handle(video->handle, "_SPD", &h_dummy1))) { | 601 | if (ACPI_SUCCESS(acpi_get_handle(video->device->handle, "_SPD", &h_dummy1))) { |
604 | video->cap._SPD = 1; | 602 | video->cap._SPD = 1; |
605 | } | 603 | } |
606 | if (ACPI_SUCCESS(acpi_get_handle(video->handle, "_VPO", &h_dummy1))) { | 604 | if (ACPI_SUCCESS(acpi_get_handle(video->device->handle, "_VPO", &h_dummy1))) { |
607 | video->cap._VPO = 1; | 605 | video->cap._VPO = 1; |
608 | } | 606 | } |
609 | } | 607 | } |
@@ -1271,7 +1269,6 @@ acpi_video_bus_get_one_device(struct acpi_device *device, | |||
1271 | 1269 | ||
1272 | memset(data, 0, sizeof(struct acpi_video_device)); | 1270 | memset(data, 0, sizeof(struct acpi_video_device)); |
1273 | 1271 | ||
1274 | data->handle = device->handle; | ||
1275 | strcpy(acpi_device_name(device), ACPI_VIDEO_DEVICE_NAME); | 1272 | strcpy(acpi_device_name(device), ACPI_VIDEO_DEVICE_NAME); |
1276 | strcpy(acpi_device_class(device), ACPI_VIDEO_CLASS); | 1273 | strcpy(acpi_device_class(device), ACPI_VIDEO_CLASS); |
1277 | acpi_driver_data(device) = data; | 1274 | acpi_driver_data(device) = data; |
@@ -1298,7 +1295,7 @@ acpi_video_bus_get_one_device(struct acpi_device *device, | |||
1298 | acpi_video_device_bind(video, data); | 1295 | acpi_video_device_bind(video, data); |
1299 | acpi_video_device_find_cap(data); | 1296 | acpi_video_device_find_cap(data); |
1300 | 1297 | ||
1301 | status = acpi_install_notify_handler(data->handle, | 1298 | status = acpi_install_notify_handler(device->handle, |
1302 | ACPI_DEVICE_NOTIFY, | 1299 | ACPI_DEVICE_NOTIFY, |
1303 | acpi_video_device_notify, | 1300 | acpi_video_device_notify, |
1304 | data); | 1301 | data); |
@@ -1400,8 +1397,7 @@ static int acpi_video_device_enumerate(struct acpi_video_bus *video) | |||
1400 | union acpi_object *dod = NULL; | 1397 | union acpi_object *dod = NULL; |
1401 | union acpi_object *obj; | 1398 | union acpi_object *obj; |
1402 | 1399 | ||
1403 | 1400 | status = acpi_evaluate_object(video->device->handle, "_DOD", NULL, &buffer); | |
1404 | status = acpi_evaluate_object(video->handle, "_DOD", NULL, &buffer); | ||
1405 | if (!ACPI_SUCCESS(status)) { | 1401 | if (!ACPI_SUCCESS(status)) { |
1406 | ACPI_EXCEPTION((AE_INFO, status, "Evaluating _DOD")); | 1402 | ACPI_EXCEPTION((AE_INFO, status, "Evaluating _DOD")); |
1407 | return status; | 1403 | return status; |
@@ -1569,7 +1565,7 @@ static int acpi_video_bus_put_one_device(struct acpi_video_device *device) | |||
1569 | up(&video->sem); | 1565 | up(&video->sem); |
1570 | acpi_video_device_remove_fs(device->dev); | 1566 | acpi_video_device_remove_fs(device->dev); |
1571 | 1567 | ||
1572 | status = acpi_remove_notify_handler(device->handle, | 1568 | status = acpi_remove_notify_handler(device->dev->handle, |
1573 | ACPI_DEVICE_NOTIFY, | 1569 | ACPI_DEVICE_NOTIFY, |
1574 | acpi_video_device_notify); | 1570 | acpi_video_device_notify); |
1575 | 1571 | ||
@@ -1624,8 +1620,7 @@ static void acpi_video_bus_notify(acpi_handle handle, u32 event, void *data) | |||
1624 | if (!video) | 1620 | if (!video) |
1625 | return; | 1621 | return; |
1626 | 1622 | ||
1627 | if (acpi_bus_get_device(handle, &device)) | 1623 | device = video->device; |
1628 | return; | ||
1629 | 1624 | ||
1630 | switch (event) { | 1625 | switch (event) { |
1631 | case ACPI_VIDEO_NOTIFY_SWITCH: /* User request that a switch occur, | 1626 | case ACPI_VIDEO_NOTIFY_SWITCH: /* User request that a switch occur, |
@@ -1668,8 +1663,7 @@ static void acpi_video_device_notify(acpi_handle handle, u32 event, void *data) | |||
1668 | if (!video_device) | 1663 | if (!video_device) |
1669 | return; | 1664 | return; |
1670 | 1665 | ||
1671 | if (acpi_bus_get_device(handle, &device)) | 1666 | device = video_device->dev; |
1672 | return; | ||
1673 | 1667 | ||
1674 | switch (event) { | 1668 | switch (event) { |
1675 | case ACPI_VIDEO_NOTIFY_SWITCH: /* change in status (cycle output device) */ | 1669 | case ACPI_VIDEO_NOTIFY_SWITCH: /* change in status (cycle output device) */ |
@@ -1707,7 +1701,7 @@ static int acpi_video_bus_add(struct acpi_device *device) | |||
1707 | return -ENOMEM; | 1701 | return -ENOMEM; |
1708 | memset(video, 0, sizeof(struct acpi_video_bus)); | 1702 | memset(video, 0, sizeof(struct acpi_video_bus)); |
1709 | 1703 | ||
1710 | video->handle = device->handle; | 1704 | video->device = device; |
1711 | strcpy(acpi_device_name(device), ACPI_VIDEO_BUS_NAME); | 1705 | strcpy(acpi_device_name(device), ACPI_VIDEO_BUS_NAME); |
1712 | strcpy(acpi_device_class(device), ACPI_VIDEO_CLASS); | 1706 | strcpy(acpi_device_class(device), ACPI_VIDEO_CLASS); |
1713 | acpi_driver_data(device) = video; | 1707 | acpi_driver_data(device) = video; |
@@ -1727,7 +1721,7 @@ static int acpi_video_bus_add(struct acpi_device *device) | |||
1727 | acpi_video_bus_get_devices(video, device); | 1721 | acpi_video_bus_get_devices(video, device); |
1728 | acpi_video_bus_start_devices(video); | 1722 | acpi_video_bus_start_devices(video); |
1729 | 1723 | ||
1730 | status = acpi_install_notify_handler(video->handle, | 1724 | status = acpi_install_notify_handler(device->handle, |
1731 | ACPI_DEVICE_NOTIFY, | 1725 | ACPI_DEVICE_NOTIFY, |
1732 | acpi_video_bus_notify, video); | 1726 | acpi_video_bus_notify, video); |
1733 | if (ACPI_FAILURE(status)) { | 1727 | if (ACPI_FAILURE(status)) { |
@@ -1767,7 +1761,7 @@ static int acpi_video_bus_remove(struct acpi_device *device, int type) | |||
1767 | 1761 | ||
1768 | acpi_video_bus_stop_devices(video); | 1762 | acpi_video_bus_stop_devices(video); |
1769 | 1763 | ||
1770 | status = acpi_remove_notify_handler(video->handle, | 1764 | status = acpi_remove_notify_handler(video->device->handle, |
1771 | ACPI_DEVICE_NOTIFY, | 1765 | ACPI_DEVICE_NOTIFY, |
1772 | acpi_video_bus_notify); | 1766 | acpi_video_bus_notify); |
1773 | 1767 | ||