diff options
author | Hans de Goede <hdegoede@redhat.com> | 2015-06-16 10:27:45 -0400 |
---|---|---|
committer | Rafael J. Wysocki <rafael.j.wysocki@intel.com> | 2015-06-18 19:10:26 -0400 |
commit | adc8bb8e0fe005ed29366e6c4621652481878214 (patch) | |
tree | 7bd8a4bd76676768a2c195a864d3afc30db6e543 | |
parent | fb105d964226ce4834b45d7e3d9f339aa716ed70 (diff) |
acpi-video-detect: Move acpi_is_video_device() to acpi/scan.c
This allows video_detect.c to be build as a module, this is a preparation
patch for the backlight interface selection logic cleanup.
Note this commit also causes acpi_is_video_device() to always be build
indepedent of CONFIG_ACPI_VIDEO, as there is no reason to make its
building depend on CONFIG_ACPI_VIDEO.
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Acked-by: Darren Hart <dvhart@linux.intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
-rw-r--r-- | drivers/acpi/scan.c | 56 | ||||
-rw-r--r-- | drivers/acpi/video_detect.c | 60 | ||||
-rw-r--r-- | include/linux/acpi.h | 8 |
3 files changed, 58 insertions, 66 deletions
diff --git a/drivers/acpi/scan.c b/drivers/acpi/scan.c index 0a099917a006..aa997c66d697 100644 --- a/drivers/acpi/scan.c +++ b/drivers/acpi/scan.c | |||
@@ -1949,6 +1949,62 @@ bool acpi_dock_match(acpi_handle handle) | |||
1949 | return acpi_has_method(handle, "_DCK"); | 1949 | return acpi_has_method(handle, "_DCK"); |
1950 | } | 1950 | } |
1951 | 1951 | ||
1952 | static acpi_status | ||
1953 | acpi_backlight_cap_match(acpi_handle handle, u32 level, void *context, | ||
1954 | void **return_value) | ||
1955 | { | ||
1956 | long *cap = context; | ||
1957 | |||
1958 | if (acpi_has_method(handle, "_BCM") && | ||
1959 | acpi_has_method(handle, "_BCL")) { | ||
1960 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Found generic backlight " | ||
1961 | "support\n")); | ||
1962 | *cap |= ACPI_VIDEO_BACKLIGHT; | ||
1963 | if (!acpi_has_method(handle, "_BQC")) | ||
1964 | printk(KERN_WARNING FW_BUG PREFIX "No _BQC method, " | ||
1965 | "cannot determine initial brightness\n"); | ||
1966 | /* We have backlight support, no need to scan further */ | ||
1967 | return AE_CTRL_TERMINATE; | ||
1968 | } | ||
1969 | return 0; | ||
1970 | } | ||
1971 | |||
1972 | /* Returns true if the ACPI object is a video device which can be | ||
1973 | * handled by video.ko. | ||
1974 | * The device will get a Linux specific CID added in scan.c to | ||
1975 | * identify the device as an ACPI graphics device | ||
1976 | * Be aware that the graphics device may not be physically present | ||
1977 | * Use acpi_video_get_capabilities() to detect general ACPI video | ||
1978 | * capabilities of present cards | ||
1979 | */ | ||
1980 | long acpi_is_video_device(acpi_handle handle) | ||
1981 | { | ||
1982 | long video_caps = 0; | ||
1983 | |||
1984 | /* Is this device able to support video switching ? */ | ||
1985 | if (acpi_has_method(handle, "_DOD") || acpi_has_method(handle, "_DOS")) | ||
1986 | video_caps |= ACPI_VIDEO_OUTPUT_SWITCHING; | ||
1987 | |||
1988 | /* Is this device able to retrieve a video ROM ? */ | ||
1989 | if (acpi_has_method(handle, "_ROM")) | ||
1990 | video_caps |= ACPI_VIDEO_ROM_AVAILABLE; | ||
1991 | |||
1992 | /* Is this device able to configure which video head to be POSTed ? */ | ||
1993 | if (acpi_has_method(handle, "_VPO") && | ||
1994 | acpi_has_method(handle, "_GPD") && | ||
1995 | acpi_has_method(handle, "_SPD")) | ||
1996 | video_caps |= ACPI_VIDEO_DEVICE_POSTING; | ||
1997 | |||
1998 | /* Only check for backlight functionality if one of the above hit. */ | ||
1999 | if (video_caps) | ||
2000 | acpi_walk_namespace(ACPI_TYPE_DEVICE, handle, | ||
2001 | ACPI_UINT32_MAX, acpi_backlight_cap_match, NULL, | ||
2002 | &video_caps, NULL); | ||
2003 | |||
2004 | return video_caps; | ||
2005 | } | ||
2006 | EXPORT_SYMBOL(acpi_is_video_device); | ||
2007 | |||
1952 | const char *acpi_device_hid(struct acpi_device *device) | 2008 | const char *acpi_device_hid(struct acpi_device *device) |
1953 | { | 2009 | { |
1954 | struct acpi_hardware_id *hid; | 2010 | struct acpi_hardware_id *hid; |
diff --git a/drivers/acpi/video_detect.c b/drivers/acpi/video_detect.c index 3af18beaea0a..5076138156fd 100644 --- a/drivers/acpi/video_detect.c +++ b/drivers/acpi/video_detect.c | |||
@@ -5,10 +5,6 @@ | |||
5 | * May be copied or modified under the terms of the GNU General Public License | 5 | * May be copied or modified under the terms of the GNU General Public License |
6 | * | 6 | * |
7 | * video_detect.c: | 7 | * video_detect.c: |
8 | * Provides acpi_is_video_device() for early scanning of ACPI devices in scan.c | ||
9 | * There a Linux specific (Spec does not provide a HID for video devices) is | ||
10 | * assigned | ||
11 | * | ||
12 | * After PCI devices are glued with ACPI devices | 8 | * After PCI devices are glued with ACPI devices |
13 | * acpi_get_pci_dev() can be called to identify ACPI graphics | 9 | * acpi_get_pci_dev() can be called to identify ACPI graphics |
14 | * devices for which a real graphics card is plugged in | 10 | * devices for which a real graphics card is plugged in |
@@ -47,62 +43,6 @@ static long acpi_video_support; | |||
47 | static bool acpi_video_caps_checked; | 43 | static bool acpi_video_caps_checked; |
48 | 44 | ||
49 | static acpi_status | 45 | static acpi_status |
50 | acpi_backlight_cap_match(acpi_handle handle, u32 level, void *context, | ||
51 | void **return_value) | ||
52 | { | ||
53 | long *cap = context; | ||
54 | |||
55 | if (acpi_has_method(handle, "_BCM") && | ||
56 | acpi_has_method(handle, "_BCL")) { | ||
57 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Found generic backlight " | ||
58 | "support\n")); | ||
59 | *cap |= ACPI_VIDEO_BACKLIGHT; | ||
60 | if (!acpi_has_method(handle, "_BQC")) | ||
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 | */ | ||
77 | long acpi_is_video_device(acpi_handle handle) | ||
78 | { | ||
79 | long video_caps = 0; | ||
80 | |||
81 | /* Is this device able to support video switching ? */ | ||
82 | if (acpi_has_method(handle, "_DOD") || acpi_has_method(handle, "_DOS")) | ||
83 | video_caps |= ACPI_VIDEO_OUTPUT_SWITCHING; | ||
84 | |||
85 | /* Is this device able to retrieve a video ROM ? */ | ||
86 | if (acpi_has_method(handle, "_ROM")) | ||
87 | video_caps |= ACPI_VIDEO_ROM_AVAILABLE; | ||
88 | |||
89 | /* Is this device able to configure which video head to be POSTed ? */ | ||
90 | if (acpi_has_method(handle, "_VPO") && | ||
91 | acpi_has_method(handle, "_GPD") && | ||
92 | acpi_has_method(handle, "_SPD")) | ||
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 | |||
101 | return video_caps; | ||
102 | } | ||
103 | EXPORT_SYMBOL(acpi_is_video_device); | ||
104 | |||
105 | static acpi_status | ||
106 | find_video(acpi_handle handle, u32 lvl, void *context, void **rv) | 46 | find_video(acpi_handle handle, u32 lvl, void *context, void **rv) |
107 | { | 47 | { |
108 | long *cap = context; | 48 | long *cap = context; |
diff --git a/include/linux/acpi.h b/include/linux/acpi.h index 88c92a03a77e..7cb3b0bc4a7e 100644 --- a/include/linux/acpi.h +++ b/include/linux/acpi.h | |||
@@ -243,19 +243,15 @@ extern bool wmi_has_guid(const char *guid); | |||
243 | #define ACPI_VIDEO_OUTPUT_SWITCHING_DMI_VENDOR 0x0400 | 243 | #define ACPI_VIDEO_OUTPUT_SWITCHING_DMI_VENDOR 0x0400 |
244 | #define ACPI_VIDEO_OUTPUT_SWITCHING_DMI_VIDEO 0x0800 | 244 | #define ACPI_VIDEO_OUTPUT_SWITCHING_DMI_VIDEO 0x0800 |
245 | 245 | ||
246 | extern long acpi_is_video_device(acpi_handle handle); | ||
247 | |||
246 | #if defined(CONFIG_ACPI_VIDEO) || defined(CONFIG_ACPI_VIDEO_MODULE) | 248 | #if defined(CONFIG_ACPI_VIDEO) || defined(CONFIG_ACPI_VIDEO_MODULE) |
247 | 249 | ||
248 | extern long acpi_is_video_device(acpi_handle handle); | ||
249 | extern void acpi_video_dmi_promote_vendor(void); | 250 | extern void acpi_video_dmi_promote_vendor(void); |
250 | extern int acpi_video_backlight_support(void); | 251 | extern int acpi_video_backlight_support(void); |
251 | 252 | ||
252 | #else | 253 | #else |
253 | 254 | ||
254 | static inline long acpi_is_video_device(acpi_handle handle) | ||
255 | { | ||
256 | return 0; | ||
257 | } | ||
258 | |||
259 | static inline void acpi_video_dmi_promote_vendor(void) | 255 | static inline void acpi_video_dmi_promote_vendor(void) |
260 | { | 256 | { |
261 | } | 257 | } |