aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/acpi
diff options
context:
space:
mode:
authorZhang Rui <rui.zhang@intel.com>2010-12-06 02:04:21 -0500
committerLen Brown <len.brown@intel.com>2010-12-14 00:04:52 -0500
commit677bd810eedce61edf15452491781ff046b92edc (patch)
tree3ed50023d311d598a4928c79ae575f02248a185a /drivers/acpi
parentcf7d7e5a1980d1116ee152d25dac382b112b9c17 (diff)
ACPI video: remove output switching control
Remove the ACPI video output switching control as it never works. With the patch applied, ACPI video driver still catches the video output notification, but it does nothing but raises the notification to userspace. Signed-off-by: Zhang Rui <rui.zhang@intel.com> Signed-off-by: Len Brown <len.brown@intel.com>
Diffstat (limited to 'drivers/acpi')
-rw-r--r--drivers/acpi/video.c86
-rw-r--r--drivers/acpi/video_detect.c57
2 files changed, 4 insertions, 139 deletions
diff --git a/drivers/acpi/video.c b/drivers/acpi/video.c
index 5cd0228d2daa..81766ebec843 100644
--- a/drivers/acpi/video.c
+++ b/drivers/acpi/video.c
@@ -33,7 +33,6 @@
33#include <linux/input.h> 33#include <linux/input.h>
34#include <linux/backlight.h> 34#include <linux/backlight.h>
35#include <linux/thermal.h> 35#include <linux/thermal.h>
36#include <linux/video_output.h>
37#include <linux/sort.h> 36#include <linux/sort.h>
38#include <linux/pci.h> 37#include <linux/pci.h>
39#include <linux/pci_ids.h> 38#include <linux/pci_ids.h>
@@ -172,9 +171,6 @@ struct acpi_video_device_cap {
172 u8 _BQC:1; /* Get current brightness level */ 171 u8 _BQC:1; /* Get current brightness level */
173 u8 _BCQ:1; /* Some buggy BIOS uses _BCQ instead of _BQC */ 172 u8 _BCQ:1; /* Some buggy BIOS uses _BCQ instead of _BQC */
174 u8 _DDC:1; /*Return the EDID for this device */ 173 u8 _DDC:1; /*Return the EDID for this device */
175 u8 _DCS:1; /*Return status of output device */
176 u8 _DGS:1; /*Query graphics state */
177 u8 _DSS:1; /*Device state set */
178}; 174};
179 175
180struct acpi_video_brightness_flags { 176struct acpi_video_brightness_flags {
@@ -202,7 +198,6 @@ struct acpi_video_device {
202 struct acpi_video_device_brightness *brightness; 198 struct acpi_video_device_brightness *brightness;
203 struct backlight_device *backlight; 199 struct backlight_device *backlight;
204 struct thermal_cooling_device *cooling_dev; 200 struct thermal_cooling_device *cooling_dev;
205 struct output_device *output_dev;
206}; 201};
207 202
208static const char device_decode[][30] = { 203static const char device_decode[][30] = {
@@ -226,10 +221,6 @@ static int acpi_video_get_next_level(struct acpi_video_device *device,
226 u32 level_current, u32 event); 221 u32 level_current, u32 event);
227static int acpi_video_switch_brightness(struct acpi_video_device *device, 222static int acpi_video_switch_brightness(struct acpi_video_device *device,
228 int event); 223 int event);
229static int acpi_video_device_get_state(struct acpi_video_device *device,
230 unsigned long long *state);
231static int acpi_video_output_get(struct output_device *od);
232static int acpi_video_device_set_state(struct acpi_video_device *device, int state);
233 224
234/*backlight device sysfs support*/ 225/*backlight device sysfs support*/
235static int acpi_video_get_brightness(struct backlight_device *bd) 226static int acpi_video_get_brightness(struct backlight_device *bd)
@@ -265,30 +256,6 @@ static struct backlight_ops acpi_backlight_ops = {
265 .update_status = acpi_video_set_brightness, 256 .update_status = acpi_video_set_brightness,
266}; 257};
267 258
268/*video output device sysfs support*/
269static int acpi_video_output_get(struct output_device *od)
270{
271 unsigned long long state;
272 struct acpi_video_device *vd =
273 (struct acpi_video_device *)dev_get_drvdata(&od->dev);
274 acpi_video_device_get_state(vd, &state);
275 return (int)state;
276}
277
278static int acpi_video_output_set(struct output_device *od)
279{
280 unsigned long state = od->request_state;
281 struct acpi_video_device *vd=
282 (struct acpi_video_device *)dev_get_drvdata(&od->dev);
283 return acpi_video_device_set_state(vd, state);
284}
285
286static struct output_properties acpi_output_properties = {
287 .set_state = acpi_video_output_set,
288 .get_status = acpi_video_output_get,
289};
290
291
292/* thermal cooling device callbacks */ 259/* thermal cooling device callbacks */
293static int video_get_max_state(struct thermal_cooling_device *cooling_dev, unsigned 260static int video_get_max_state(struct thermal_cooling_device *cooling_dev, unsigned
294 long *state) 261 long *state)
@@ -344,34 +311,6 @@ static struct thermal_cooling_device_ops video_cooling_ops = {
344 Video Management 311 Video Management
345 -------------------------------------------------------------------------- */ 312 -------------------------------------------------------------------------- */
346 313
347/* device */
348
349static int
350acpi_video_device_get_state(struct acpi_video_device *device,
351 unsigned long long *state)
352{
353 int status;
354
355 status = acpi_evaluate_integer(device->dev->handle, "_DCS", NULL, state);
356
357 return status;
358}
359
360static int
361acpi_video_device_set_state(struct acpi_video_device *device, int state)
362{
363 int status;
364 union acpi_object arg0 = { ACPI_TYPE_INTEGER };
365 struct acpi_object_list args = { 1, &arg0 };
366 unsigned long long ret;
367
368
369 arg0.integer.value = state;
370 status = acpi_evaluate_integer(device->dev->handle, "_DSS", &args, &ret);
371
372 return status;
373}
374
375static int 314static int
376acpi_video_device_lcd_query_levels(struct acpi_video_device *device, 315acpi_video_device_lcd_query_levels(struct acpi_video_device *device,
377 union acpi_object **levels) 316 union acpi_object **levels)
@@ -831,15 +770,6 @@ static void acpi_video_device_find_cap(struct acpi_video_device *device)
831 if (ACPI_SUCCESS(acpi_get_handle(device->dev->handle, "_DDC", &h_dummy1))) { 770 if (ACPI_SUCCESS(acpi_get_handle(device->dev->handle, "_DDC", &h_dummy1))) {
832 device->cap._DDC = 1; 771 device->cap._DDC = 1;
833 } 772 }
834 if (ACPI_SUCCESS(acpi_get_handle(device->dev->handle, "_DCS", &h_dummy1))) {
835 device->cap._DCS = 1;
836 }
837 if (ACPI_SUCCESS(acpi_get_handle(device->dev->handle, "_DGS", &h_dummy1))) {
838 device->cap._DGS = 1;
839 }
840 if (ACPI_SUCCESS(acpi_get_handle(device->dev->handle, "_DSS", &h_dummy1))) {
841 device->cap._DSS = 1;
842 }
843 773
844 if (acpi_video_backlight_support()) { 774 if (acpi_video_backlight_support()) {
845 struct backlight_properties props; 775 struct backlight_properties props;
@@ -904,21 +834,6 @@ static void acpi_video_device_find_cap(struct acpi_video_device *device)
904 printk(KERN_ERR PREFIX "Create sysfs link\n"); 834 printk(KERN_ERR PREFIX "Create sysfs link\n");
905 835
906 } 836 }
907
908 if (acpi_video_display_switch_support()) {
909
910 if (device->cap._DCS && device->cap._DSS) {
911 static int count;
912 char *name;
913 name = kasprintf(GFP_KERNEL, "acpi_video%d", count);
914 if (!name)
915 return;
916 count++;
917 device->output_dev = video_output_register(name,
918 NULL, device, &acpi_output_properties);
919 kfree(name);
920 }
921 }
922} 837}
923 838
924/* 839/*
@@ -1452,7 +1367,6 @@ static int acpi_video_bus_put_one_device(struct acpi_video_device *device)
1452 thermal_cooling_device_unregister(device->cooling_dev); 1367 thermal_cooling_device_unregister(device->cooling_dev);
1453 device->cooling_dev = NULL; 1368 device->cooling_dev = NULL;
1454 } 1369 }
1455 video_output_unregister(device->output_dev);
1456 1370
1457 return 0; 1371 return 0;
1458} 1372}
diff --git a/drivers/acpi/video_detect.c b/drivers/acpi/video_detect.c
index b83676126598..42d3d72dae85 100644
--- a/drivers/acpi/video_detect.c
+++ b/drivers/acpi/video_detect.c
@@ -17,15 +17,14 @@
17 * capabilities the graphics cards plugged in support. The check for general 17 * capabilities the graphics cards plugged in support. The check for general
18 * video capabilities will be triggered by the first caller of 18 * video capabilities will be triggered by the first caller of
19 * acpi_video_get_capabilities(NULL); which will happen when the first 19 * acpi_video_get_capabilities(NULL); which will happen when the first
20 * backlight (or display output) switching supporting driver calls: 20 * backlight switching supporting driver calls:
21 * acpi_video_backlight_support(); 21 * acpi_video_backlight_support();
22 * 22 *
23 * Depending on whether ACPI graphics extensions (cmp. ACPI spec Appendix B) 23 * Depending on whether ACPI graphics extensions (cmp. ACPI spec Appendix B)
24 * are available, video.ko should be used to handle the device. 24 * are available, video.ko should be used to handle the device.
25 * 25 *
26 * Otherwise vendor specific drivers like thinkpad_acpi, asus_acpi, 26 * Otherwise vendor specific drivers like thinkpad_acpi, asus_acpi,
27 * sony_acpi,... can take care about backlight brightness and display output 27 * sony_acpi,... can take care about backlight brightness.
28 * switching.
29 * 28 *
30 * If CONFIG_ACPI_VIDEO is neither set as "compiled in" (y) nor as a module (m) 29 * If CONFIG_ACPI_VIDEO is neither set as "compiled in" (y) nor as a module (m)
31 * this file will not be compiled, acpi_video_get_capabilities() and 30 * this file will not be compiled, acpi_video_get_capabilities() and
@@ -83,11 +82,6 @@ long acpi_is_video_device(struct acpi_device *device)
83 if (!device) 82 if (!device)
84 return 0; 83 return 0;
85 84
86 /* Is this device able to support video switching ? */
87 if (ACPI_SUCCESS(acpi_get_handle(device->handle, "_DOD", &h_dummy)) ||
88 ACPI_SUCCESS(acpi_get_handle(device->handle, "_DOS", &h_dummy)))
89 video_caps |= ACPI_VIDEO_OUTPUT_SWITCHING;
90
91 /* Is this device able to retrieve a video ROM ? */ 85 /* Is this device able to retrieve a video ROM ? */
92 if (ACPI_SUCCESS(acpi_get_handle(device->handle, "_ROM", &h_dummy))) 86 if (ACPI_SUCCESS(acpi_get_handle(device->handle, "_ROM", &h_dummy)))
93 video_caps |= ACPI_VIDEO_ROM_AVAILABLE; 87 video_caps |= ACPI_VIDEO_ROM_AVAILABLE;
@@ -161,8 +155,6 @@ long acpi_video_get_capabilities(acpi_handle graphics_handle)
161 * 155 *
162 * if (dmi_name_in_vendors("XY")) { 156 * if (dmi_name_in_vendors("XY")) {
163 * acpi_video_support |= 157 * acpi_video_support |=
164 * ACPI_VIDEO_OUTPUT_SWITCHING_DMI_VENDOR;
165 * acpi_video_support |=
166 * ACPI_VIDEO_BACKLIGHT_DMI_VENDOR; 158 * ACPI_VIDEO_BACKLIGHT_DMI_VENDOR;
167 *} 159 *}
168 */ 160 */
@@ -212,33 +204,8 @@ int acpi_video_backlight_support(void)
212EXPORT_SYMBOL(acpi_video_backlight_support); 204EXPORT_SYMBOL(acpi_video_backlight_support);
213 205
214/* 206/*
215 * Returns true if video.ko can do display output switching. 207 * Use acpi_backlight=vendor/video to force that backlight switching
216 * This does not work well/at all with binary graphics drivers 208 * is processed by vendor specific acpi drivers or video.ko driver.
217 * which disable system io ranges and do it on their own.
218 */
219int acpi_video_display_switch_support(void)
220{
221 if (!acpi_video_caps_checked)
222 acpi_video_get_capabilities(NULL);
223
224 if (acpi_video_support & ACPI_VIDEO_OUTPUT_SWITCHING_FORCE_VENDOR)
225 return 0;
226 else if (acpi_video_support & ACPI_VIDEO_OUTPUT_SWITCHING_FORCE_VIDEO)
227 return 1;
228
229 if (acpi_video_support & ACPI_VIDEO_OUTPUT_SWITCHING_DMI_VENDOR)
230 return 0;
231 else if (acpi_video_support & ACPI_VIDEO_OUTPUT_SWITCHING_DMI_VIDEO)
232 return 1;
233
234 return acpi_video_support & ACPI_VIDEO_OUTPUT_SWITCHING;
235}
236EXPORT_SYMBOL(acpi_video_display_switch_support);
237
238/*
239 * Use acpi_display_output=vendor/video or acpi_backlight=vendor/video
240 * To force that backlight or display output switching is processed by vendor
241 * specific acpi drivers or video.ko driver.
242 */ 209 */
243static int __init acpi_backlight(char *str) 210static int __init acpi_backlight(char *str)
244{ 211{
@@ -255,19 +222,3 @@ static int __init acpi_backlight(char *str)
255 return 1; 222 return 1;
256} 223}
257__setup("acpi_backlight=", acpi_backlight); 224__setup("acpi_backlight=", acpi_backlight);
258
259static int __init acpi_display_output(char *str)
260{
261 if (str == NULL || *str == '\0')
262 return 1;
263 else {
264 if (!strcmp("vendor", str))
265 acpi_video_support |=
266 ACPI_VIDEO_OUTPUT_SWITCHING_FORCE_VENDOR;
267 if (!strcmp("video", str))
268 acpi_video_support |=
269 ACPI_VIDEO_OUTPUT_SWITCHING_FORCE_VIDEO;
270 }
271 return 1;
272}
273__setup("acpi_display_output=", acpi_display_output);