Lines Matching refs:video

3  *  video.c - ACPI Video Driver
10 #define pr_fmt(fmt) "ACPI: video: " fmt
28 #include <acpi/video.h>
44 * By default, we don't allow duplicate ACPI video bus devices
101 .name = "video",
111 u8 multihead:1; /* can switch video heads */
112 u8 rom:1; /* can retrieve a video rom */
200 struct acpi_video_bus *video;
208 static void acpi_video_device_rebind(struct acpi_video_bus *video);
209 static void acpi_video_device_bind(struct acpi_video_bus *video,
211 static int acpi_video_device_enumerate(struct acpi_video_bus *video);
256 struct acpi_video_device *video = cooling_dev->devdata;
258 *state = video->brightness->count - ACPI_VIDEO_FIRST_LEVEL - 1;
265 struct acpi_video_device *video = cooling_dev->devdata;
269 if (acpi_video_device_lcd_get_level_current(video, &level, false))
271 for (offset = ACPI_VIDEO_FIRST_LEVEL; offset < video->brightness->count;
273 if (level == video->brightness->levels[offset]) {
274 *state = video->brightness->count - offset - 1;
284 struct acpi_video_device *video = cooling_dev->devdata;
287 if (state >= video->brightness->count - ACPI_VIDEO_FIRST_LEVEL)
290 state = video->brightness->count - state;
291 level = video->brightness->levels[state - 1];
292 return acpi_video_device_lcd_set_level(video, level);
463 * Some machines have multiple video output devices, but only the one
465 * register backlight interface for other video output devices.
480 * events, in this case acpi-video is considered the canonical source
600 * ACPI video backlight still works w/ buggy _BQC.
656 * video : video bus device pointer
680 acpi_video_bus_DOS(struct acpi_video_bus *video, int bios_flag, int lcd_flag)
684 if (!video->cap._DOS)
689 video->dos_setting = (lcd_flag << 2) | bios_flag;
690 status = acpi_execute_simple_method(video->device->handle, "_DOS",
897 * device : video output device (LCD, CRT, ..)
971 * device : video output device (LCD, CRT, ..)
1002 * device : video output device (VGA)
1007 * Find out all required AML methods defined under the video bus device.
1010 static void acpi_video_bus_find_cap(struct acpi_video_bus *video)
1012 if (acpi_has_method(video->device->handle, "_DOS"))
1013 video->cap._DOS = 1;
1014 if (acpi_has_method(video->device->handle, "_DOD"))
1015 video->cap._DOD = 1;
1016 if (acpi_has_method(video->device->handle, "_ROM"))
1017 video->cap._ROM = 1;
1018 if (acpi_has_method(video->device->handle, "_GPD"))
1019 video->cap._GPD = 1;
1020 if (acpi_has_method(video->device->handle, "_SPD"))
1021 video->cap._SPD = 1;
1022 if (acpi_has_method(video->device->handle, "_VPO"))
1023 video->cap._VPO = 1;
1027 * Check whether the video bus device has required AML method to
1031 static int acpi_video_bus_check(struct acpi_video_bus *video)
1036 if (!video)
1039 dev = acpi_get_pci_dev(video->device->handle);
1049 /* Does this device support video switching? */
1050 if (video->cap._DOS || video->cap._DOD) {
1051 if (!video->cap._DOS) {
1053 acpi_device_bid(video->device));
1055 video->flags.multihead = 1;
1059 /* Does this device support retrieving a video ROM? */
1060 if (video->cap._ROM) {
1061 video->flags.rom = 1;
1065 /* Does this device support configuring which video device to POST? */
1066 if (video->cap._GPD && video->cap._SPD && video->cap._VPO) {
1067 video->flags.post = 1;
1082 acpi_video_get_device_attr(struct acpi_video_bus *video, unsigned long device_id)
1087 for (i = 0; i < video->attached_count; i++) {
1088 ids = &video->attached_array[i];
1097 acpi_video_get_device_type(struct acpi_video_bus *video,
1103 for (i = 0; i < video->attached_count; i++) {
1104 ids = &video->attached_array[i];
1114 struct acpi_video_bus *video = arg;
1136 data->video = video;
1141 attribute = acpi_video_get_device_attr(video, device_id);
1165 device_type = acpi_video_get_device_type(video, device_id);
1182 acpi_video_device_bind(video, data);
1188 mutex_lock(&video->device_list_lock);
1189 list_add_tail(&data->entry, &video->video_device_list);
1190 mutex_unlock(&video->device_list_lock);
1193 video->child_count++;
1199 * video : video bus device
1204 * Enumerate the video device list of the video bus,
1205 * bind the ids with the corresponding video devices
1206 * under the video bus.
1209 static void acpi_video_device_rebind(struct acpi_video_bus *video)
1213 mutex_lock(&video->device_list_lock);
1215 list_for_each_entry(dev, &video->video_device_list, entry)
1216 acpi_video_device_bind(video, dev);
1218 mutex_unlock(&video->device_list_lock);
1223 * video : video bus device
1224 * device : video output device under the video
1230 * Bind the ids with the corresponding video devices
1231 * under the video bus.
1235 acpi_video_device_bind(struct acpi_video_bus *video,
1241 for (i = 0; i < video->attached_count; i++) {
1242 ids = &video->attached_array[i];
1245 acpi_handle_debug(video->device->handle, "%s: %d\n",
1253 struct acpi_video_bus *video = device->video;
1261 if (!video->attached_count || video->child_count > 8)
1264 for (i = 0; i < video->attached_count; i++) {
1265 if ((video->attached_array[i].value.int_val & 0xfff) ==
1275 * video : video bus device
1284 static int acpi_video_device_enumerate(struct acpi_video_bus *video)
1294 if (!video->cap._DOD)
1297 status = acpi_evaluate_object(video->device->handle, "_DOD", NULL, &buffer);
1299 acpi_handle_info(video->device->handle,
1307 acpi_handle_info(video->device->handle, "Invalid _DOD data\n");
1312 acpi_handle_debug(video->device->handle, "Found %d video heads in _DOD\n",
1328 acpi_handle_info(video->device->handle,
1336 acpi_handle_debug(video->device->handle,
1343 kfree(video->attached_array);
1345 video->attached_array = active_list;
1346 video->attached_count = count;
1437 struct acpi_video_bus *video;
1446 video = acpi_driver_data(device);
1448 for (i = 0; i < video->attached_count; i++) {
1449 video_device = video->attached_array[i].bind_info;
1503 acpi_video_bus_get_devices(struct acpi_video_bus *video,
1507 * There are systems where video module known to work fine regardless
1511 acpi_video_device_enumerate(video);
1513 return acpi_dev_for_each_child(device, acpi_video_bus_get_one_device, video);
1522 static int acpi_video_bus_start_devices(struct acpi_video_bus *video)
1524 return acpi_video_bus_DOS(video, 0,
1528 static int acpi_video_bus_stop_devices(struct acpi_video_bus *video)
1530 return acpi_video_bus_DOS(video, 0,
1537 struct acpi_video_bus *video = acpi_driver_data(device);
1541 if (!video || !video->input)
1544 input = video->input;
1552 case ACPI_VIDEO_NOTIFY_PROBE: /* User plugged in or removed a video
1554 acpi_video_device_enumerate(video);
1555 acpi_video_device_rebind(video);
1609 bus = video_device->video;
1662 struct acpi_video_bus *video;
1670 video = container_of(nb, struct acpi_video_bus, pm_nb);
1672 dev_info(&video->device->dev, "Restoring backlight state\n");
1674 for (i = 0; i < video->attached_count; i++) {
1675 video_device = video->attached_array[i].bind_info;
1761 * register video output if cooling device registration failed?
1782 static void acpi_video_run_bcl_for_osi(struct acpi_video_bus *video)
1787 mutex_lock(&video->device_list_lock);
1788 list_for_each_entry(dev, &video->video_device_list, entry) {
1792 mutex_unlock(&video->device_list_lock);
1798 * Do not create backlight device for video output
1811 static int acpi_video_bus_register_backlight(struct acpi_video_bus *video)
1815 if (video->backlight_registered)
1821 mutex_lock(&video->device_list_lock);
1822 list_for_each_entry(dev, &video->video_device_list, entry) {
1826 mutex_unlock(&video->device_list_lock);
1828 video->backlight_registered = true;
1830 video->pm_nb.notifier_call = acpi_video_resume;
1831 video->pm_nb.priority = 0;
1832 return register_pm_notifier(&video->pm_nb);
1854 static int acpi_video_bus_unregister_backlight(struct acpi_video_bus *video)
1859 if (!video->backlight_registered)
1862 error = unregister_pm_notifier(&video->pm_nb);
1864 mutex_lock(&video->device_list_lock);
1865 list_for_each_entry(dev, &video->video_device_list, entry)
1867 mutex_unlock(&video->device_list_lock);
1869 video->backlight_registered = false;
1887 static int acpi_video_bus_add_notify_handler(struct acpi_video_bus *video)
1893 video->input = input = input_allocate_device();
1899 error = acpi_video_bus_start_devices(video);
1903 snprintf(video->phys, sizeof(video->phys),
1904 "%s/video/input0", acpi_device_hid(video->device));
1906 input->name = acpi_device_name(video->device);
1907 input->phys = video->phys;
1910 input->dev.parent = &video->device->dev;
1925 mutex_lock(&video->device_list_lock);
1926 list_for_each_entry(dev, &video->video_device_list, entry)
1928 mutex_unlock(&video->device_list_lock);
1933 acpi_video_bus_stop_devices(video);
1936 video->input = NULL;
1950 static void acpi_video_bus_remove_notify_handler(struct acpi_video_bus *video)
1954 mutex_lock(&video->device_list_lock);
1955 list_for_each_entry(dev, &video->video_device_list, entry)
1957 mutex_unlock(&video->device_list_lock);
1959 acpi_video_bus_stop_devices(video);
1960 input_unregister_device(video->input);
1961 video->input = NULL;
1964 static int acpi_video_bus_put_devices(struct acpi_video_bus *video)
1968 mutex_lock(&video->device_list_lock);
1969 list_for_each_entry_safe(dev, next, &video->video_device_list, entry) {
1973 mutex_unlock(&video->device_list_lock);
1982 struct acpi_video_bus *video;
1993 "Duplicate ACPI video bus devices for the"
1995 "parameter \"video.allow_duplicates=1\""
2001 video = kzalloc(sizeof(struct acpi_video_bus), GFP_KERNEL);
2002 if (!video)
2018 video->device = device;
2021 device->driver_data = video;
2023 acpi_video_bus_find_cap(video);
2024 error = acpi_video_bus_check(video);
2028 mutex_init(&video->device_list_lock);
2029 INIT_LIST_HEAD(&video->video_device_list);
2031 error = acpi_video_bus_get_devices(video, device);
2036 * HP ZBook Fury 16 G10 requires ACPI video's child devices have _PS0
2043 video->flags.multihead ? "yes" : "no",
2044 video->flags.rom ? "yes" : "no",
2045 video->flags.post ? "yes" : "no");
2047 list_add_tail(&video->entry, &video_bus_head);
2052 * show up later and this may change the result from video to native.
2060 acpi_video_run_bcl_for_osi(video);
2063 acpi_video_bus_register_backlight(video);
2065 error = acpi_video_bus_add_notify_handler(video);
2077 acpi_video_bus_remove_notify_handler(video);
2080 list_del(&video->entry);
2082 acpi_video_bus_unregister_backlight(video);
2084 acpi_video_bus_put_devices(video);
2085 kfree(video->attached_array);
2087 kfree(video);
2095 struct acpi_video_bus *video = NULL;
2101 video = acpi_driver_data(device);
2107 list_del(&video->entry);
2110 acpi_video_bus_remove_notify_handler(video);
2111 acpi_video_bus_unregister_backlight(video);
2112 acpi_video_bus_put_devices(video);
2114 kfree(video->attached_array);
2115 kfree(video);
2248 struct acpi_video_bus *video;
2251 list_for_each_entry(video, &video_bus_head, entry)
2252 acpi_video_bus_register_backlight(video);
2266 * the video opregion code to be run first in order to initialise
2267 * state before any ACPI video calls are made. To handle this we defer
2268 * registration of the video class until the opregion code has run.