diff options
-rw-r--r-- | drivers/acpi/video.c | 114 |
1 files changed, 61 insertions, 53 deletions
diff --git a/drivers/acpi/video.c b/drivers/acpi/video.c index 0ec434d2586d..f021bf4d9307 100644 --- a/drivers/acpi/video.c +++ b/drivers/acpi/video.c | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * video.c - ACPI Video Driver ($Revision:$) | 2 | * video.c - ACPI Video Driver |
3 | * | 3 | * |
4 | * Copyright (C) 2004 Luming Yu <luming.yu@intel.com> | 4 | * Copyright (C) 2004 Luming Yu <luming.yu@intel.com> |
5 | * Copyright (C) 2004 Bruno Ducrot <ducrot@poupinou.org> | 5 | * Copyright (C) 2004 Bruno Ducrot <ducrot@poupinou.org> |
@@ -118,26 +118,26 @@ struct acpi_video_bus_flags { | |||
118 | }; | 118 | }; |
119 | 119 | ||
120 | struct acpi_video_bus_cap { | 120 | struct acpi_video_bus_cap { |
121 | u8 _DOS:1; /*Enable/Disable output switching */ | 121 | u8 _DOS:1; /* Enable/Disable output switching */ |
122 | u8 _DOD:1; /*Enumerate all devices attached to display adapter */ | 122 | u8 _DOD:1; /* Enumerate all devices attached to display adapter */ |
123 | u8 _ROM:1; /*Get ROM Data */ | 123 | u8 _ROM:1; /* Get ROM Data */ |
124 | u8 _GPD:1; /*Get POST Device */ | 124 | u8 _GPD:1; /* Get POST Device */ |
125 | u8 _SPD:1; /*Set POST Device */ | 125 | u8 _SPD:1; /* Set POST Device */ |
126 | u8 _VPO:1; /*Video POST Options */ | 126 | u8 _VPO:1; /* Video POST Options */ |
127 | u8 reserved:2; | 127 | u8 reserved:2; |
128 | }; | 128 | }; |
129 | 129 | ||
130 | struct acpi_video_device_attrib { | 130 | struct acpi_video_device_attrib { |
131 | u32 display_index:4; /* A zero-based instance of the Display */ | 131 | u32 display_index:4; /* A zero-based instance of the Display */ |
132 | u32 display_port_attachment:4; /*This field differentiates the display type */ | 132 | u32 display_port_attachment:4; /* This field differentiates the display type */ |
133 | u32 display_type:4; /*Describe the specific type in use */ | 133 | u32 display_type:4; /* Describe the specific type in use */ |
134 | u32 vendor_specific:4; /*Chipset Vendor Specific */ | 134 | u32 vendor_specific:4; /* Chipset Vendor Specific */ |
135 | u32 bios_can_detect:1; /*BIOS can detect the device */ | 135 | u32 bios_can_detect:1; /* BIOS can detect the device */ |
136 | u32 depend_on_vga:1; /*Non-VGA output device whose power is related to | 136 | u32 depend_on_vga:1; /* Non-VGA output device whose power is related to |
137 | the VGA device. */ | 137 | the VGA device. */ |
138 | u32 pipe_id:3; /*For VGA multiple-head devices. */ | 138 | u32 pipe_id:3; /* For VGA multiple-head devices. */ |
139 | u32 reserved:10; /*Must be 0 */ | 139 | u32 reserved:10; /* Must be 0 */ |
140 | u32 device_id_scheme:1; /*Device ID Scheme */ | 140 | u32 device_id_scheme:1; /* Device ID Scheme */ |
141 | }; | 141 | }; |
142 | 142 | ||
143 | struct acpi_video_enumerated_device { | 143 | struct acpi_video_enumerated_device { |
@@ -174,17 +174,17 @@ struct acpi_video_device_flags { | |||
174 | }; | 174 | }; |
175 | 175 | ||
176 | struct acpi_video_device_cap { | 176 | struct acpi_video_device_cap { |
177 | u8 _ADR:1; /*Return the unique ID */ | 177 | u8 _ADR:1; /* Return the unique ID */ |
178 | u8 _BCL:1; /*Query list of brightness control levels supported */ | 178 | u8 _BCL:1; /* Query list of brightness control levels supported */ |
179 | u8 _BCM:1; /*Set the brightness level */ | 179 | u8 _BCM:1; /* Set the brightness level */ |
180 | u8 _BQC:1; /* Get current brightness level */ | 180 | u8 _BQC:1; /* Get current brightness level */ |
181 | u8 _BCQ:1; /* Some buggy BIOS uses _BCQ instead of _BQC */ | 181 | u8 _BCQ:1; /* Some buggy BIOS uses _BCQ instead of _BQC */ |
182 | u8 _DDC:1; /*Return the EDID for this device */ | 182 | u8 _DDC:1; /* Return the EDID for this device */ |
183 | }; | 183 | }; |
184 | 184 | ||
185 | struct acpi_video_brightness_flags { | 185 | struct acpi_video_brightness_flags { |
186 | u8 _BCL_no_ac_battery_levels:1; /* no AC/Battery levels in _BCL */ | 186 | u8 _BCL_no_ac_battery_levels:1; /* no AC/Battery levels in _BCL */ |
187 | u8 _BCL_reversed:1; /* _BCL package is in a reversed order*/ | 187 | u8 _BCL_reversed:1; /* _BCL package is in a reversed order */ |
188 | u8 _BCL_use_index:1; /* levels in _BCL are index values */ | 188 | u8 _BCL_use_index:1; /* levels in _BCL are index values */ |
189 | u8 _BCM_use_index:1; /* input of _BCM is an index value */ | 189 | u8 _BCM_use_index:1; /* input of _BCM is an index value */ |
190 | u8 _BQC_use_index:1; /* _BQC returns an index value */ | 190 | u8 _BQC_use_index:1; /* _BQC returns an index value */ |
@@ -231,7 +231,7 @@ static int acpi_video_get_next_level(struct acpi_video_device *device, | |||
231 | static int acpi_video_switch_brightness(struct acpi_video_device *device, | 231 | static int acpi_video_switch_brightness(struct acpi_video_device *device, |
232 | int event); | 232 | int event); |
233 | 233 | ||
234 | /*backlight device sysfs support*/ | 234 | /* backlight device sysfs support */ |
235 | static int acpi_video_get_brightness(struct backlight_device *bd) | 235 | static int acpi_video_get_brightness(struct backlight_device *bd) |
236 | { | 236 | { |
237 | unsigned long long cur_level; | 237 | unsigned long long cur_level; |
@@ -243,8 +243,10 @@ static int acpi_video_get_brightness(struct backlight_device *bd) | |||
243 | return -EINVAL; | 243 | return -EINVAL; |
244 | for (i = 2; i < vd->brightness->count; i++) { | 244 | for (i = 2; i < vd->brightness->count; i++) { |
245 | if (vd->brightness->levels[i] == cur_level) | 245 | if (vd->brightness->levels[i] == cur_level) |
246 | /* The first two entries are special - see page 575 | 246 | /* |
247 | of the ACPI spec 3.0 */ | 247 | * The first two entries are special - see page 575 |
248 | * of the ACPI spec 3.0 | ||
249 | */ | ||
248 | return i-2; | 250 | return i-2; |
249 | } | 251 | } |
250 | return 0; | 252 | return 0; |
@@ -316,9 +318,11 @@ static const struct thermal_cooling_device_ops video_cooling_ops = { | |||
316 | .set_cur_state = video_set_cur_state, | 318 | .set_cur_state = video_set_cur_state, |
317 | }; | 319 | }; |
318 | 320 | ||
319 | /* -------------------------------------------------------------------------- | 321 | /* |
320 | Video Management | 322 | * -------------------------------------------------------------------------- |
321 | -------------------------------------------------------------------------- */ | 323 | * Video Management |
324 | * -------------------------------------------------------------------------- | ||
325 | */ | ||
322 | 326 | ||
323 | static int | 327 | static int |
324 | acpi_video_device_lcd_query_levels(struct acpi_video_device *device, | 328 | acpi_video_device_lcd_query_levels(struct acpi_video_device *device, |
@@ -556,7 +560,8 @@ acpi_video_device_lcd_get_level_current(struct acpi_video_device *device, | |||
556 | buf)); | 560 | buf)); |
557 | device->cap._BQC = device->cap._BCQ = 0; | 561 | device->cap._BQC = device->cap._BCQ = 0; |
558 | } else { | 562 | } else { |
559 | /* Fixme: | 563 | /* |
564 | * Fixme: | ||
560 | * should we return an error or ignore this failure? | 565 | * should we return an error or ignore this failure? |
561 | * dev->brightness->curr is a cached value which stores | 566 | * dev->brightness->curr is a cached value which stores |
562 | * the correct current backlight level in most cases. | 567 | * the correct current backlight level in most cases. |
@@ -615,8 +620,8 @@ acpi_video_device_EDID(struct acpi_video_device *device, | |||
615 | 620 | ||
616 | /* | 621 | /* |
617 | * Arg: | 622 | * Arg: |
618 | * video : video bus device pointer | 623 | * video : video bus device pointer |
619 | * bios_flag : | 624 | * bios_flag : |
620 | * 0. The system BIOS should NOT automatically switch(toggle) | 625 | * 0. The system BIOS should NOT automatically switch(toggle) |
621 | * the active display output. | 626 | * the active display output. |
622 | * 1. The system BIOS should automatically switch (toggle) the | 627 | * 1. The system BIOS should automatically switch (toggle) the |
@@ -628,9 +633,9 @@ acpi_video_device_EDID(struct acpi_video_device *device, | |||
628 | * lcd_flag : | 633 | * lcd_flag : |
629 | * 0. The system BIOS should automatically control the brightness level | 634 | * 0. The system BIOS should automatically control the brightness level |
630 | * of the LCD when the power changes from AC to DC | 635 | * of the LCD when the power changes from AC to DC |
631 | * 1. The system BIOS should NOT automatically control the brightness | 636 | * 1. The system BIOS should NOT automatically control the brightness |
632 | * level of the LCD when the power changes from AC to DC. | 637 | * level of the LCD when the power changes from AC to DC. |
633 | * Return Value: | 638 | * Return Value: |
634 | * -EINVAL wrong arg. | 639 | * -EINVAL wrong arg. |
635 | */ | 640 | */ |
636 | 641 | ||
@@ -717,8 +722,8 @@ static int acpi_video_bqc_quirk(struct acpi_video_device *device, | |||
717 | 722 | ||
718 | 723 | ||
719 | /* | 724 | /* |
720 | * Arg: | 725 | * Arg: |
721 | * device : video output device (LCD, CRT, ..) | 726 | * device : video output device (LCD, CRT, ..) |
722 | * | 727 | * |
723 | * Return Value: | 728 | * Return Value: |
724 | * Maximum brightness level | 729 | * Maximum brightness level |
@@ -877,7 +882,7 @@ out: | |||
877 | * device : video output device (LCD, CRT, ..) | 882 | * device : video output device (LCD, CRT, ..) |
878 | * | 883 | * |
879 | * Return Value: | 884 | * Return Value: |
880 | * None | 885 | * None |
881 | * | 886 | * |
882 | * Find out all required AML methods defined under the output | 887 | * Find out all required AML methods defined under the output |
883 | * device. | 888 | * device. |
@@ -988,11 +993,11 @@ static void acpi_video_device_find_cap(struct acpi_video_device *device) | |||
988 | } | 993 | } |
989 | 994 | ||
990 | /* | 995 | /* |
991 | * Arg: | 996 | * Arg: |
992 | * device : video output device (VGA) | 997 | * device : video output device (VGA) |
993 | * | 998 | * |
994 | * Return Value: | 999 | * Return Value: |
995 | * None | 1000 | * None |
996 | * | 1001 | * |
997 | * Find out all required AML methods defined under the video bus device. | 1002 | * Find out all required AML methods defined under the video bus device. |
998 | */ | 1003 | */ |
@@ -1039,7 +1044,8 @@ static int acpi_video_bus_check(struct acpi_video_bus *video) | |||
1039 | return -ENODEV; | 1044 | return -ENODEV; |
1040 | pci_dev_put(dev); | 1045 | pci_dev_put(dev); |
1041 | 1046 | ||
1042 | /* Since there is no HID, CID and so on for VGA driver, we have | 1047 | /* |
1048 | * Since there is no HID, CID and so on for VGA driver, we have | ||
1043 | * to check well known required nodes. | 1049 | * to check well known required nodes. |
1044 | */ | 1050 | */ |
1045 | 1051 | ||
@@ -1069,9 +1075,11 @@ static int acpi_video_bus_check(struct acpi_video_bus *video) | |||
1069 | return status; | 1075 | return status; |
1070 | } | 1076 | } |
1071 | 1077 | ||
1072 | /* -------------------------------------------------------------------------- | 1078 | /* |
1073 | Driver Interface | 1079 | * -------------------------------------------------------------------------- |
1074 | -------------------------------------------------------------------------- */ | 1080 | * Driver Interface |
1081 | * -------------------------------------------------------------------------- | ||
1082 | */ | ||
1075 | 1083 | ||
1076 | /* device interface */ | 1084 | /* device interface */ |
1077 | static struct acpi_video_device_attrib* | 1085 | static struct acpi_video_device_attrib* |
@@ -1192,12 +1200,12 @@ acpi_video_bus_get_one_device(struct acpi_device *device, | |||
1192 | 1200 | ||
1193 | /* | 1201 | /* |
1194 | * Arg: | 1202 | * Arg: |
1195 | * video : video bus device | 1203 | * video : video bus device |
1196 | * | 1204 | * |
1197 | * Return: | 1205 | * Return: |
1198 | * none | 1206 | * none |
1199 | * | 1207 | * |
1200 | * Enumerate the video device list of the video bus, | 1208 | * Enumerate the video device list of the video bus, |
1201 | * bind the ids with the corresponding video devices | 1209 | * bind the ids with the corresponding video devices |
1202 | * under the video bus. | 1210 | * under the video bus. |
1203 | */ | 1211 | */ |
@@ -1216,13 +1224,13 @@ static void acpi_video_device_rebind(struct acpi_video_bus *video) | |||
1216 | 1224 | ||
1217 | /* | 1225 | /* |
1218 | * Arg: | 1226 | * Arg: |
1219 | * video : video bus device | 1227 | * video : video bus device |
1220 | * device : video output device under the video | 1228 | * device : video output device under the video |
1221 | * bus | 1229 | * bus |
1222 | * | 1230 | * |
1223 | * Return: | 1231 | * Return: |
1224 | * none | 1232 | * none |
1225 | * | 1233 | * |
1226 | * Bind the ids with the corresponding video devices | 1234 | * Bind the ids with the corresponding video devices |
1227 | * under the video bus. | 1235 | * under the video bus. |
1228 | */ | 1236 | */ |
@@ -1245,11 +1253,11 @@ acpi_video_device_bind(struct acpi_video_bus *video, | |||
1245 | 1253 | ||
1246 | /* | 1254 | /* |
1247 | * Arg: | 1255 | * Arg: |
1248 | * video : video bus device | 1256 | * video : video bus device |
1249 | * | 1257 | * |
1250 | * Return: | 1258 | * Return: |
1251 | * < 0 : error | 1259 | * < 0 : error |
1252 | * | 1260 | * |
1253 | * Call _DOD to enumerate all devices attached to display adapter | 1261 | * Call _DOD to enumerate all devices attached to display adapter |
1254 | * | 1262 | * |
1255 | */ | 1263 | */ |