video_detect.c (033d777f548645c3a906b73eef5d665aeee55092) video_detect.c (952c63e9512b63220886105cfc791507046fa39a)
1/*
2 * Copyright (C) 2008 SuSE Linux Products GmbH
3 * Thomas Renninger <trenn@suse.de>
4 *
5 * May be copied or modified under the terms of the GNU General Public License
6 *
7 * video_detect.c:
8 * Provides acpi_is_video_device() for early scanning of ACPI devices in scan.c

--- 37 unchanged lines hidden (view full) ---

46static long acpi_video_support;
47static bool acpi_video_caps_checked;
48
49static acpi_status
50acpi_backlight_cap_match(acpi_handle handle, u32 level, void *context,
51 void **retyurn_value)
52{
53 long *cap = context;
1/*
2 * Copyright (C) 2008 SuSE Linux Products GmbH
3 * Thomas Renninger <trenn@suse.de>
4 *
5 * May be copied or modified under the terms of the GNU General Public License
6 *
7 * video_detect.c:
8 * Provides acpi_is_video_device() for early scanning of ACPI devices in scan.c

--- 37 unchanged lines hidden (view full) ---

46static long acpi_video_support;
47static bool acpi_video_caps_checked;
48
49static acpi_status
50acpi_backlight_cap_match(acpi_handle handle, u32 level, void *context,
51 void **retyurn_value)
52{
53 long *cap = context;
54 acpi_handle h_dummy;
55
54
56 if (ACPI_SUCCESS(acpi_get_handle(handle, "_BCM", &h_dummy)) &&
57 ACPI_SUCCESS(acpi_get_handle(handle, "_BCL", &h_dummy))) {
55 if (acpi_has_method(handle, "_BCM") &&
56 acpi_has_method(handle, "_BCL")) {
58 ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Found generic backlight "
59 "support\n"));
60 *cap |= ACPI_VIDEO_BACKLIGHT;
57 ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Found generic backlight "
58 "support\n"));
59 *cap |= ACPI_VIDEO_BACKLIGHT;
61 if (ACPI_FAILURE(acpi_get_handle(handle, "_BQC", &h_dummy)))
60 if (!acpi_has_method(handle, "_BQC"))
62 printk(KERN_WARNING FW_BUG PREFIX "No _BQC method, "
63 "cannot determine initial brightness\n");
64 /* We have backlight support, no need to scan further */
65 return AE_CTRL_TERMINATE;
66 }
67 return 0;
68}
69
70/* Returns true if the ACPI object is a video device which can be
71 * handled by video.ko.
72 * The device will get a Linux specific CID added in scan.c to
73 * identify the device as an ACPI graphics device
74 * Be aware that the graphics device may not be physically present
75 * Use acpi_video_get_capabilities() to detect general ACPI video
76 * capabilities of present cards
77 */
78long acpi_is_video_device(acpi_handle handle)
79{
61 printk(KERN_WARNING FW_BUG PREFIX "No _BQC method, "
62 "cannot determine initial brightness\n");
63 /* We have backlight support, no need to scan further */
64 return AE_CTRL_TERMINATE;
65 }
66 return 0;
67}
68
69/* Returns true if the ACPI object is a video device which can be
70 * handled by video.ko.
71 * The device will get a Linux specific CID added in scan.c to
72 * identify the device as an ACPI graphics device
73 * Be aware that the graphics device may not be physically present
74 * Use acpi_video_get_capabilities() to detect general ACPI video
75 * capabilities of present cards
76 */
77long acpi_is_video_device(acpi_handle handle)
78{
80 acpi_handle h_dummy;
81 long video_caps = 0;
82
83 /* Is this device able to support video switching ? */
79 long video_caps = 0;
80
81 /* Is this device able to support video switching ? */
84 if (ACPI_SUCCESS(acpi_get_handle(handle, "_DOD", &h_dummy)) ||
85 ACPI_SUCCESS(acpi_get_handle(handle, "_DOS", &h_dummy)))
82 if (acpi_has_method(handle, "_DOD") || acpi_has_method(handle, "_DOS"))
86 video_caps |= ACPI_VIDEO_OUTPUT_SWITCHING;
87
88 /* Is this device able to retrieve a video ROM ? */
83 video_caps |= ACPI_VIDEO_OUTPUT_SWITCHING;
84
85 /* Is this device able to retrieve a video ROM ? */
89 if (ACPI_SUCCESS(acpi_get_handle(handle, "_ROM", &h_dummy)))
86 if (acpi_has_method(handle, "_ROM"))
90 video_caps |= ACPI_VIDEO_ROM_AVAILABLE;
91
92 /* Is this device able to configure which video head to be POSTed ? */
87 video_caps |= ACPI_VIDEO_ROM_AVAILABLE;
88
89 /* Is this device able to configure which video head to be POSTed ? */
93 if (ACPI_SUCCESS(acpi_get_handle(handle, "_VPO", &h_dummy)) &&
94 ACPI_SUCCESS(acpi_get_handle(handle, "_GPD", &h_dummy)) &&
95 ACPI_SUCCESS(acpi_get_handle(handle, "_SPD", &h_dummy)))
90 if (acpi_has_method(handle, "_VPO") &&
91 acpi_has_method(handle, "_GPD") &&
92 acpi_has_method(handle, "_SPD"))
96 video_caps |= ACPI_VIDEO_DEVICE_POSTING;
97
98 /* Only check for backlight functionality if one of the above hit. */
99 if (video_caps)
100 acpi_walk_namespace(ACPI_TYPE_DEVICE, handle,
101 ACPI_UINT32_MAX, acpi_backlight_cap_match, NULL,
102 &video_caps, NULL);
103

--- 196 unchanged lines hidden ---
93 video_caps |= ACPI_VIDEO_DEVICE_POSTING;
94
95 /* Only check for backlight functionality if one of the above hit. */
96 if (video_caps)
97 acpi_walk_namespace(ACPI_TYPE_DEVICE, handle,
98 ACPI_UINT32_MAX, acpi_backlight_cap_match, NULL,
99 &video_caps, NULL);
100

--- 196 unchanged lines hidden ---