Lines Matching refs:video

3  *  video.c - ACPI Video Driver
26 #include <acpi/video.h>
37 ACPI_MODULE_NAME("video");
47 * By default, we don't allow duplicate ACPI video bus devices
107 .name = "video",
118 u8 multihead:1; /* can switch video heads */
119 u8 rom:1; /* can retrieve a video rom */
207 struct acpi_video_bus *video;
215 static void acpi_video_device_rebind(struct acpi_video_bus *video);
216 static void acpi_video_device_bind(struct acpi_video_bus *video,
218 static int acpi_video_device_enumerate(struct acpi_video_bus *video);
264 struct acpi_video_device *video = acpi_driver_data(device);
266 *state = video->brightness->count - ACPI_VIDEO_FIRST_LEVEL - 1;
274 struct acpi_video_device *video = acpi_driver_data(device);
278 if (acpi_video_device_lcd_get_level_current(video, &level, false))
280 for (offset = ACPI_VIDEO_FIRST_LEVEL; offset < video->brightness->count;
282 if (level == video->brightness->levels[offset]) {
283 *state = video->brightness->count - offset - 1;
294 struct acpi_video_device *video = acpi_driver_data(device);
297 if (state >= video->brightness->count - ACPI_VIDEO_FIRST_LEVEL)
300 state = video->brightness->count - state;
301 level = video->brightness->levels[state - 1];
302 return acpi_video_device_lcd_set_level(video, level);
468 * Some machines have a broken acpi-video interface for brightness
531 * Some machines have multiple video output devices, but only the one
533 * register backlight interface for other video output devices.
548 * events, in this case acpi-video is considered the canonical source
669 * ACPI video backlight still works w/ buggy _BQC.
724 * video : video bus device pointer
748 acpi_video_bus_DOS(struct acpi_video_bus *video, int bios_flag, int lcd_flag)
752 if (!video->cap._DOS)
757 video->dos_setting = (lcd_flag << 2) | bios_flag;
758 status = acpi_execute_simple_method(video->device->handle, "_DOS",
966 * device : video output device (LCD, CRT, ..)
1040 * device : video output device (LCD, CRT, ..)
1070 * device : video output device (VGA)
1075 * Find out all required AML methods defined under the video bus device.
1078 static void acpi_video_bus_find_cap(struct acpi_video_bus *video)
1080 if (acpi_has_method(video->device->handle, "_DOS"))
1081 video->cap._DOS = 1;
1082 if (acpi_has_method(video->device->handle, "_DOD"))
1083 video->cap._DOD = 1;
1084 if (acpi_has_method(video->device->handle, "_ROM"))
1085 video->cap._ROM = 1;
1086 if (acpi_has_method(video->device->handle, "_GPD"))
1087 video->cap._GPD = 1;
1088 if (acpi_has_method(video->device->handle, "_SPD"))
1089 video->cap._SPD = 1;
1090 if (acpi_has_method(video->device->handle, "_VPO"))
1091 video->cap._VPO = 1;
1095 * Check whether the video bus device has required AML method to
1099 static int acpi_video_bus_check(struct acpi_video_bus *video)
1104 if (!video)
1107 dev = acpi_get_pci_dev(video->device->handle);
1117 /* Does this device support video switching? */
1118 if (video->cap._DOS || video->cap._DOD) {
1119 if (!video->cap._DOS) {
1122 acpi_device_bid(video->device));
1124 video->flags.multihead = 1;
1128 /* Does this device support retrieving a video ROM? */
1129 if (video->cap._ROM) {
1130 video->flags.rom = 1;
1134 /* Does this device support configuring which video device to POST? */
1135 if (video->cap._GPD && video->cap._SPD && video->cap._VPO) {
1136 video->flags.post = 1;
1151 acpi_video_get_device_attr(struct acpi_video_bus *video, unsigned long device_id)
1156 for (i = 0; i < video->attached_count; i++) {
1157 ids = &video->attached_array[i];
1166 acpi_video_get_device_type(struct acpi_video_bus *video,
1172 for (i = 0; i < video->attached_count; i++) {
1173 ids = &video->attached_array[i];
1183 struct acpi_video_bus *video)
1205 data->video = video;
1210 attribute = acpi_video_get_device_attr(video, device_id);
1234 device_type = acpi_video_get_device_type(video, device_id);
1251 acpi_video_device_bind(video, data);
1254 mutex_lock(&video->device_list_lock);
1255 list_add_tail(&data->entry, &video->video_device_list);
1256 mutex_unlock(&video->device_list_lock);
1263 * video : video bus device
1268 * Enumerate the video device list of the video bus,
1269 * bind the ids with the corresponding video devices
1270 * under the video bus.
1273 static void acpi_video_device_rebind(struct acpi_video_bus *video)
1277 mutex_lock(&video->device_list_lock);
1279 list_for_each_entry(dev, &video->video_device_list, entry)
1280 acpi_video_device_bind(video, dev);
1282 mutex_unlock(&video->device_list_lock);
1287 * video : video bus device
1288 * device : video output device under the video
1294 * Bind the ids with the corresponding video devices
1295 * under the video bus.
1299 acpi_video_device_bind(struct acpi_video_bus *video,
1305 for (i = 0; i < video->attached_count; i++) {
1306 ids = &video->attached_array[i];
1316 struct acpi_video_bus *video = device->video;
1324 if (!video->attached_count || video->child_count > 8)
1327 for (i = 0; i < video->attached_count; i++) {
1328 if ((video->attached_array[i].value.int_val & 0xfff) ==
1338 * video : video bus device
1347 static int acpi_video_device_enumerate(struct acpi_video_bus *video)
1357 if (!video->cap._DOD)
1360 status = acpi_evaluate_object(video->device->handle, "_DOD", NULL, &buffer);
1373 ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Found %d video heads in _DOD\n",
1401 kfree(video->attached_array);
1403 video->attached_array = active_list;
1404 video->attached_count = count;
1494 struct acpi_video_bus *video;
1503 video = acpi_driver_data(device);
1505 for (i = 0; i < video->attached_count; i++) {
1506 video_device = video->attached_array[i].bind_info;
1560 acpi_video_bus_get_devices(struct acpi_video_bus *video,
1567 * There are systems where video module known to work fine regardless
1571 acpi_video_device_enumerate(video);
1575 status = acpi_video_bus_get_one_device(dev, video);
1580 video->child_count++;
1591 static int acpi_video_bus_start_devices(struct acpi_video_bus *video)
1593 return acpi_video_bus_DOS(video, 0,
1597 static int acpi_video_bus_stop_devices(struct acpi_video_bus *video)
1599 return acpi_video_bus_DOS(video, 0,
1605 struct acpi_video_bus *video = acpi_driver_data(device);
1609 if (!video || !video->input)
1612 input = video->input;
1620 case ACPI_VIDEO_NOTIFY_PROBE: /* User plugged in or removed a video
1622 acpi_video_device_enumerate(video);
1623 acpi_video_device_rebind(video);
1679 bus = video_device->video;
1732 struct acpi_video_bus *video;
1743 video = container_of(nb, struct acpi_video_bus, pm_nb);
1745 dev_info(&video->device->dev, "Restoring backlight state\n");
1747 for (i = 0; i < video->attached_count; i++) {
1748 video_device = video->attached_array[i].bind_info;
1836 * register video output if cooling device registration failed?
1856 static void acpi_video_run_bcl_for_osi(struct acpi_video_bus *video)
1861 mutex_lock(&video->device_list_lock);
1862 list_for_each_entry(dev, &video->video_device_list, entry) {
1866 mutex_unlock(&video->device_list_lock);
1872 * Do not create backlight device for video output
1885 static int acpi_video_bus_register_backlight(struct acpi_video_bus *video)
1889 if (video->backlight_registered)
1892 acpi_video_run_bcl_for_osi(video);
1897 mutex_lock(&video->device_list_lock);
1898 list_for_each_entry(dev, &video->video_device_list, entry) {
1902 mutex_unlock(&video->device_list_lock);
1904 video->backlight_registered = true;
1906 video->pm_nb.notifier_call = acpi_video_resume;
1907 video->pm_nb.priority = 0;
1908 return register_pm_notifier(&video->pm_nb);
1930 static int acpi_video_bus_unregister_backlight(struct acpi_video_bus *video)
1935 if (!video->backlight_registered)
1938 error = unregister_pm_notifier(&video->pm_nb);
1940 mutex_lock(&video->device_list_lock);
1941 list_for_each_entry(dev, &video->video_device_list, entry)
1943 mutex_unlock(&video->device_list_lock);
1945 video->backlight_registered = false;
1963 static int acpi_video_bus_add_notify_handler(struct acpi_video_bus *video)
1969 video->input = input = input_allocate_device();
1975 error = acpi_video_bus_start_devices(video);
1979 snprintf(video->phys, sizeof(video->phys),
1980 "%s/video/input0", acpi_device_hid(video->device));
1982 input->name = acpi_device_name(video->device);
1983 input->phys = video->phys;
1986 input->dev.parent = &video->device->dev;
2001 mutex_lock(&video->device_list_lock);
2002 list_for_each_entry(dev, &video->video_device_list, entry)
2004 mutex_unlock(&video->device_list_lock);
2009 acpi_video_bus_stop_devices(video);
2012 video->input = NULL;
2026 static void acpi_video_bus_remove_notify_handler(struct acpi_video_bus *video)
2030 mutex_lock(&video->device_list_lock);
2031 list_for_each_entry(dev, &video->video_device_list, entry)
2033 mutex_unlock(&video->device_list_lock);
2035 acpi_video_bus_stop_devices(video);
2036 input_unregister_device(video->input);
2037 video->input = NULL;
2040 static int acpi_video_bus_put_devices(struct acpi_video_bus *video)
2044 mutex_lock(&video->device_list_lock);
2045 list_for_each_entry_safe(dev, next, &video->video_device_list, entry) {
2049 mutex_unlock(&video->device_list_lock);
2058 struct acpi_video_bus *video;
2068 "Duplicate ACPI video bus devices for the"
2070 "parameter \"video.allow_duplicates=1\""
2076 video = kzalloc(sizeof(struct acpi_video_bus), GFP_KERNEL);
2077 if (!video)
2093 video->device = device;
2096 device->driver_data = video;
2098 acpi_video_bus_find_cap(video);
2099 error = acpi_video_bus_check(video);
2103 mutex_init(&video->device_list_lock);
2104 INIT_LIST_HEAD(&video->video_device_list);
2106 error = acpi_video_bus_get_devices(video, device);
2112 video->flags.multihead ? "yes" : "no",
2113 video->flags.rom ? "yes" : "no",
2114 video->flags.post ? "yes" : "no");
2116 list_add_tail(&video->entry, &video_bus_head);
2119 acpi_video_bus_register_backlight(video);
2120 acpi_video_bus_add_notify_handler(video);
2125 acpi_video_bus_put_devices(video);
2126 kfree(video->attached_array);
2128 kfree(video);
2136 struct acpi_video_bus *video = NULL;
2142 video = acpi_driver_data(device);
2144 acpi_video_bus_remove_notify_handler(video);
2145 acpi_video_bus_unregister_backlight(video);
2146 acpi_video_bus_put_devices(video);
2149 list_del(&video->entry);
2152 kfree(video->attached_array);
2153 kfree(video);
2274 struct acpi_video_bus *video;
2279 list_for_each_entry(video, &video_bus_head, entry)
2280 acpi_video_bus_unregister_backlight(video);
2301 * the video opregion code to be run first in order to initialise
2302 * state before any ACPI video calls are made. To handle this we defer
2303 * registration of the video class until the opregion code has run.