diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2011-01-13 23:15:35 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2011-01-13 23:15:35 -0500 |
commit | 52cfd503ad7176d23a5dd7af3981744feb60622f (patch) | |
tree | 0a8aeaaf4acbc86ac682f18632b8070c1c6b7ba1 /drivers/acpi/video.c | |
parent | dc8e7e3ec60bd5ef7868aa88755e9d4c948dc5cc (diff) | |
parent | 4263d9a3ae4d15785897d0543bb59316c84ee605 (diff) |
Merge branch 'release' of git://git.kernel.org/pub/scm/linux/kernel/git/lenb/linux-acpi-2.6
* 'release' of git://git.kernel.org/pub/scm/linux/kernel/git/lenb/linux-acpi-2.6: (59 commits)
ACPI / PM: Fix build problems for !CONFIG_ACPI related to NVS rework
ACPI: fix resource check message
ACPI / Battery: Update information on info notification and resume
ACPI: Drop device flag wake_capable
ACPI: Always check if _PRW is present before trying to evaluate it
ACPI / PM: Check status of power resources under mutexes
ACPI / PM: Rename acpi_power_off_device()
ACPI / PM: Drop acpi_power_nocheck
ACPI / PM: Drop acpi_bus_get_power()
Platform / x86: Make fujitsu_laptop use acpi_bus_update_power()
ACPI / Fan: Rework the handling of power resources
ACPI / PM: Register power resource devices as soon as they are needed
ACPI / PM: Register acpi_power_driver early
ACPI / PM: Add function for updating device power state consistently
ACPI / PM: Add function for device power state initialization
ACPI / PM: Introduce __acpi_bus_get_power()
ACPI / PM: Introduce function for refcounting device power resources
ACPI / PM: Add functions for manipulating lists of power resources
ACPI / PM: Prevent acpi_power_get_inferred_state() from making changes
ACPICA: Update version to 20101209
...
Diffstat (limited to 'drivers/acpi/video.c')
-rw-r--r-- | drivers/acpi/video.c | 104 |
1 files changed, 15 insertions, 89 deletions
diff --git a/drivers/acpi/video.c b/drivers/acpi/video.c index 15a0fde4b32a..90f8f7676d1f 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> |
@@ -81,6 +80,13 @@ module_param(brightness_switch_enabled, bool, 0644); | |||
81 | static int allow_duplicates; | 80 | static int allow_duplicates; |
82 | module_param(allow_duplicates, bool, 0644); | 81 | module_param(allow_duplicates, bool, 0644); |
83 | 82 | ||
83 | /* | ||
84 | * Some BIOSes claim they use minimum backlight at boot, | ||
85 | * and this may bring dimming screen after boot | ||
86 | */ | ||
87 | static int use_bios_initial_backlight = 1; | ||
88 | module_param(use_bios_initial_backlight, bool, 0644); | ||
89 | |||
84 | static int register_count = 0; | 90 | static int register_count = 0; |
85 | static int acpi_video_bus_add(struct acpi_device *device); | 91 | static int acpi_video_bus_add(struct acpi_device *device); |
86 | static int acpi_video_bus_remove(struct acpi_device *device, int type); | 92 | static int acpi_video_bus_remove(struct acpi_device *device, int type); |
@@ -172,9 +178,6 @@ struct acpi_video_device_cap { | |||
172 | u8 _BQC:1; /* Get current brightness level */ | 178 | u8 _BQC:1; /* Get current brightness level */ |
173 | u8 _BCQ:1; /* Some buggy BIOS uses _BCQ instead of _BQC */ | 179 | u8 _BCQ:1; /* Some buggy BIOS uses _BCQ instead of _BQC */ |
174 | u8 _DDC:1; /*Return the EDID for this device */ | 180 | 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 | }; | 181 | }; |
179 | 182 | ||
180 | struct acpi_video_brightness_flags { | 183 | struct acpi_video_brightness_flags { |
@@ -202,7 +205,6 @@ struct acpi_video_device { | |||
202 | struct acpi_video_device_brightness *brightness; | 205 | struct acpi_video_device_brightness *brightness; |
203 | struct backlight_device *backlight; | 206 | struct backlight_device *backlight; |
204 | struct thermal_cooling_device *cooling_dev; | 207 | struct thermal_cooling_device *cooling_dev; |
205 | struct output_device *output_dev; | ||
206 | }; | 208 | }; |
207 | 209 | ||
208 | static const char device_decode[][30] = { | 210 | static const char device_decode[][30] = { |
@@ -226,10 +228,6 @@ static int acpi_video_get_next_level(struct acpi_video_device *device, | |||
226 | u32 level_current, u32 event); | 228 | u32 level_current, u32 event); |
227 | static int acpi_video_switch_brightness(struct acpi_video_device *device, | 229 | static int acpi_video_switch_brightness(struct acpi_video_device *device, |
228 | int event); | 230 | int event); |
229 | static int acpi_video_device_get_state(struct acpi_video_device *device, | ||
230 | unsigned long long *state); | ||
231 | static int acpi_video_output_get(struct output_device *od); | ||
232 | static int acpi_video_device_set_state(struct acpi_video_device *device, int state); | ||
233 | 231 | ||
234 | /*backlight device sysfs support*/ | 232 | /*backlight device sysfs support*/ |
235 | static int acpi_video_get_brightness(struct backlight_device *bd) | 233 | static int acpi_video_get_brightness(struct backlight_device *bd) |
@@ -265,30 +263,6 @@ static const struct backlight_ops acpi_backlight_ops = { | |||
265 | .update_status = acpi_video_set_brightness, | 263 | .update_status = acpi_video_set_brightness, |
266 | }; | 264 | }; |
267 | 265 | ||
268 | /*video output device sysfs support*/ | ||
269 | static 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 | |||
278 | static 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 | |||
286 | static 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 */ | 266 | /* thermal cooling device callbacks */ |
293 | static int video_get_max_state(struct thermal_cooling_device *cooling_dev, unsigned | 267 | static int video_get_max_state(struct thermal_cooling_device *cooling_dev, unsigned |
294 | long *state) | 268 | long *state) |
@@ -344,34 +318,6 @@ static struct thermal_cooling_device_ops video_cooling_ops = { | |||
344 | Video Management | 318 | Video Management |
345 | -------------------------------------------------------------------------- */ | 319 | -------------------------------------------------------------------------- */ |
346 | 320 | ||
347 | /* device */ | ||
348 | |||
349 | static int | ||
350 | acpi_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 | |||
360 | static int | ||
361 | acpi_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 | |||
375 | static int | 321 | static int |
376 | acpi_video_device_lcd_query_levels(struct acpi_video_device *device, | 322 | acpi_video_device_lcd_query_levels(struct acpi_video_device *device, |
377 | union acpi_object **levels) | 323 | union acpi_object **levels) |
@@ -766,9 +712,11 @@ acpi_video_init_brightness(struct acpi_video_device *device) | |||
766 | * when invoked for the first time, i.e. level_old is invalid. | 712 | * when invoked for the first time, i.e. level_old is invalid. |
767 | * set the backlight to max_level in this case | 713 | * set the backlight to max_level in this case |
768 | */ | 714 | */ |
769 | for (i = 2; i < br->count; i++) | 715 | if (use_bios_initial_backlight) { |
770 | if (level_old == br->levels[i]) | 716 | for (i = 2; i < br->count; i++) |
771 | level = level_old; | 717 | if (level_old == br->levels[i]) |
718 | level = level_old; | ||
719 | } | ||
772 | goto set_level; | 720 | goto set_level; |
773 | } | 721 | } |
774 | 722 | ||
@@ -831,15 +779,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))) { | 779 | if (ACPI_SUCCESS(acpi_get_handle(device->dev->handle, "_DDC", &h_dummy1))) { |
832 | device->cap._DDC = 1; | 780 | device->cap._DDC = 1; |
833 | } | 781 | } |
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 | 782 | ||
844 | if (acpi_video_backlight_support()) { | 783 | if (acpi_video_backlight_support()) { |
845 | struct backlight_properties props; | 784 | struct backlight_properties props; |
@@ -904,21 +843,6 @@ static void acpi_video_device_find_cap(struct acpi_video_device *device) | |||
904 | printk(KERN_ERR PREFIX "Create sysfs link\n"); | 843 | printk(KERN_ERR PREFIX "Create sysfs link\n"); |
905 | 844 | ||
906 | } | 845 | } |
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 | } | 846 | } |
923 | 847 | ||
924 | /* | 848 | /* |
@@ -1360,6 +1284,9 @@ int acpi_video_get_edid(struct acpi_device *device, int type, int device_id, | |||
1360 | if (!video_device) | 1284 | if (!video_device) |
1361 | continue; | 1285 | continue; |
1362 | 1286 | ||
1287 | if (!video_device->cap._DDC) | ||
1288 | continue; | ||
1289 | |||
1363 | if (type) { | 1290 | if (type) { |
1364 | switch (type) { | 1291 | switch (type) { |
1365 | case ACPI_VIDEO_DISPLAY_CRT: | 1292 | case ACPI_VIDEO_DISPLAY_CRT: |
@@ -1452,7 +1379,6 @@ static int acpi_video_bus_put_one_device(struct acpi_video_device *device) | |||
1452 | thermal_cooling_device_unregister(device->cooling_dev); | 1379 | thermal_cooling_device_unregister(device->cooling_dev); |
1453 | device->cooling_dev = NULL; | 1380 | device->cooling_dev = NULL; |
1454 | } | 1381 | } |
1455 | video_output_unregister(device->output_dev); | ||
1456 | 1382 | ||
1457 | return 0; | 1383 | return 0; |
1458 | } | 1384 | } |