Lines Matching defs:device
83 static int acpi_video_bus_add(struct acpi_device *device);
84 static int acpi_video_bus_remove(struct acpi_device *device);
85 static void acpi_video_bus_notify(struct acpi_device *device, u32 event);
139 u32 bios_can_detect:1; /* BIOS can detect the device */
140 u32 depend_on_vga:1; /* Non-VGA output device whose power is related to
141 the VGA device. */
146 * The device ID might not actually follow the scheme described by this
164 struct acpi_device *device;
176 char phys[32]; /* for input device */
197 u8 _DDC:1; /* Return the EDID for this device */
217 struct acpi_video_device *device);
219 static int acpi_video_device_lcd_set_level(struct acpi_video_device *device,
222 struct acpi_video_device *device,
224 static int acpi_video_get_next_level(struct acpi_video_device *device,
228 /* backlight device sysfs support */
259 /* thermal cooling device callbacks */
263 struct acpi_device *device = cooling_dev->devdata;
264 struct acpi_video_device *video = acpi_driver_data(device);
273 struct acpi_device *device = cooling_dev->devdata;
274 struct acpi_video_device *video = acpi_driver_data(device);
293 struct acpi_device *device = cooling_dev->devdata;
294 struct acpi_video_device *video = acpi_driver_data(device);
349 acpi_video_device_lcd_set_level(struct acpi_video_device *device, int level)
354 status = acpi_execute_simple_method(device->dev->handle,
361 device->brightness->curr = level;
362 for (state = ACPI_VIDEO_FIRST_LEVEL; state < device->brightness->count;
364 if (level == device->brightness->levels[state]) {
365 if (device->backlight)
366 device->backlight->props.brightness =
599 acpi_video_bqc_value_to_level(struct acpi_video_device *device,
604 if (device->brightness->flags._BQC_use_index) {
610 if (device->brightness->flags._BCL_reversed)
611 bqc_value = device->brightness->count -
614 level = device->brightness->levels[bqc_value +
626 acpi_video_device_lcd_get_level_current(struct acpi_video_device *device,
632 if (device->cap._BQC || device->cap._BCQ) {
633 char *buf = device->cap._BQC ? "_BQC" : "_BCQ";
635 status = acpi_evaluate_integer(device->dev->handle, buf,
647 *level = acpi_video_bqc_value_to_level(device, *level);
650 i < device->brightness->count; i++)
651 if (device->brightness->levels[i] == *level) {
652 device->brightness->curr = *level;
662 device->cap._BQC = device->cap._BCQ = 0;
673 device->cap._BQC = device->cap._BCQ = 0;
677 *level = device->brightness->curr;
682 acpi_video_device_EDID(struct acpi_video_device *device,
694 if (!device)
703 status = acpi_evaluate_object(device->dev->handle, "_DDC", &args, &buffer);
724 * video : video bus device pointer
758 status = acpi_execute_simple_method(video->device->handle, "_DOS",
783 static int acpi_video_bqc_quirk(struct acpi_video_device *device,
786 struct acpi_video_device_brightness *br = device->brightness;
829 result = acpi_video_device_lcd_set_level(device, test_level);
833 result = acpi_video_device_lcd_get_level_current(device, &level, true);
847 device->cap._BQC = device->cap._BCQ = 0;
853 int acpi_video_get_levels(struct acpi_device *device,
864 if (!ACPI_SUCCESS(acpi_video_device_lcd_query_levels(device->handle,
966 * device : video output device (LCD, CRT, ..)
971 * Allocate and initialize device->brightness.
975 acpi_video_init_brightness(struct acpi_video_device *device)
982 result = acpi_video_get_levels(device->dev, &br, &max_level);
985 device->brightness = br;
990 if (!device->cap._BQC)
993 result = acpi_video_device_lcd_get_level_current(device,
998 result = acpi_video_bqc_quirk(device, max_level, level_old);
1005 if (!device->cap._BQC)
1008 level = acpi_video_bqc_value_to_level(device, level_old);
1022 result = acpi_video_device_lcd_set_level(device, level);
1034 device->brightness = NULL;
1040 * device : video output device (LCD, CRT, ..)
1046 * device.
1049 static void acpi_video_device_find_cap(struct acpi_video_device *device)
1051 if (acpi_has_method(device->dev->handle, "_ADR"))
1052 device->cap._ADR = 1;
1053 if (acpi_has_method(device->dev->handle, "_BCL"))
1054 device->cap._BCL = 1;
1055 if (acpi_has_method(device->dev->handle, "_BCM"))
1056 device->cap._BCM = 1;
1057 if (acpi_has_method(device->dev->handle, "_BQC")) {
1058 device->cap._BQC = 1;
1059 } else if (acpi_has_method(device->dev->handle, "_BCQ")) {
1061 device->cap._BCQ = 1;
1064 if (acpi_has_method(device->dev->handle, "_DDC"))
1065 device->cap._DDC = 1;
1070 * device : video output device (VGA)
1075 * Find out all required AML methods defined under the video bus device.
1080 if (acpi_has_method(video->device->handle, "_DOS"))
1082 if (acpi_has_method(video->device->handle, "_DOD"))
1084 if (acpi_has_method(video->device->handle, "_ROM"))
1086 if (acpi_has_method(video->device->handle, "_GPD"))
1088 if (acpi_has_method(video->device->handle, "_SPD"))
1090 if (acpi_has_method(video->device->handle, "_VPO"))
1095 * Check whether the video bus device has required AML method to
1107 dev = acpi_get_pci_dev(video->device->handle);
1117 /* Does this device support video switching? */
1122 acpi_device_bid(video->device));
1128 /* Does this device support retrieving a video ROM? */
1134 /* Does this device support configuring which video device to POST? */
1149 /* device interface */
1182 acpi_video_bus_get_one_device(struct acpi_device *device,
1191 acpi_evaluate_integer(device->handle, "_ADR", NULL, &device_id);
1192 /* Some device omits _ADR, we skip them instead of fail */
1200 strcpy(acpi_device_name(device), ACPI_VIDEO_DEVICE_NAME);
1201 strcpy(acpi_device_class(device), ACPI_VIDEO_CLASS);
1202 device->driver_data = data;
1206 data->dev = device;
1263 * video : video bus device
1268 * Enumerate the video device list of the video bus,
1287 * video : video bus device
1288 * device : video output device under the video
1300 struct acpi_video_device *device)
1307 if (device->device_id == (ids->value.int_val & 0xffff)) {
1308 ids->bind_info = device;
1314 static bool acpi_video_device_in_dod(struct acpi_video_device *device)
1316 struct acpi_video_bus *video = device->video;
1329 (device->device_id & 0xfff))
1338 * video : video bus device
1360 status = acpi_evaluate_object(video->device->handle, "_DOD", NULL, &buffer);
1412 acpi_video_get_next_level(struct acpi_video_device *device,
1419 for (i = ACPI_VIDEO_FIRST_LEVEL; i < device->brightness->count; i++) {
1420 l = device->brightness->levels[i];
1429 for (i = ACPI_VIDEO_FIRST_LEVEL; i < device->brightness->count; i++) {
1430 l = device->brightness->levels[i];
1459 struct acpi_video_device *device = container_of(to_delayed_work(work),
1462 int event = device->switch_brightness_event;
1466 if (!device->backlight)
1469 if (!device->brightness)
1472 result = acpi_video_device_lcd_get_level_current(device,
1478 level_next = acpi_video_get_next_level(device, level_current, event);
1480 result = acpi_video_device_lcd_set_level(device, level_next);
1483 backlight_force_update(device->backlight,
1491 int acpi_video_get_edid(struct acpi_device *device, int type, int device_id,
1500 if (!device || !acpi_driver_data(device))
1503 video = acpi_driver_data(device);
1561 struct acpi_device *device)
1573 list_for_each_entry(dev, &device->children, node) {
1577 dev_err(&dev->dev, "Can't attach device\n");
1603 static void acpi_video_bus_notify(struct acpi_device *device, u32 event)
1605 struct acpi_video_bus *video = acpi_driver_data(device);
1643 if (acpi_notifier_call_chain(device, event, 0))
1670 struct acpi_device *device = NULL;
1678 device = video_device->dev;
1686 acpi_notifier_call_chain(device, event, 0);
1707 case ACPI_VIDEO_NOTIFY_DISPLAY_OFF: /* display device off */
1717 acpi_notifier_call_chain(device, event, 0);
1745 dev_info(&video->device->dev, "Restoring backlight state\n");
1761 struct acpi_device *device = context;
1765 if (handle == device->handle)
1778 static void acpi_video_dev_register_backlight(struct acpi_video_device *device)
1783 struct device *parent = NULL;
1788 result = acpi_video_init_brightness(device);
1800 if (ACPI_SUCCESS(acpi_get_parent(device->dev->handle, &acpi_parent))) {
1811 device->brightness->count - ACPI_VIDEO_FIRST_LEVEL - 1;
1812 device->backlight = backlight_device_register(name,
1814 device,
1818 if (IS_ERR(device->backlight)) {
1819 device->backlight = NULL;
1827 device->backlight->props.brightness =
1828 acpi_video_get_brightness(device->backlight);
1830 device->cooling_dev = thermal_cooling_device_register("LCD",
1831 device->dev, &video_cooling_ops);
1832 if (IS_ERR(device->cooling_dev)) {
1836 * register video output if cooling device registration failed?
1839 device->cooling_dev = NULL;
1843 dev_info(&device->dev->dev, "registered as cooling_device%d\n",
1844 device->cooling_dev->id);
1845 result = sysfs_create_link(&device->dev->dev.kobj,
1846 &device->cooling_dev->device.kobj,
1850 result = sysfs_create_link(&device->cooling_dev->device.kobj,
1851 &device->dev->dev.kobj, "device");
1872 * Do not create backlight device for video output
1873 * device that is not in the enumerated list.
1911 static void acpi_video_dev_unregister_backlight(struct acpi_video_device *device)
1913 if (device->backlight) {
1914 backlight_device_unregister(device->backlight);
1915 device->backlight = NULL;
1917 if (device->brightness) {
1918 kfree(device->brightness->levels);
1919 kfree(device->brightness);
1920 device->brightness = NULL;
1922 if (device->cooling_dev) {
1923 sysfs_remove_link(&device->dev->dev.kobj, "thermal_cooling");
1924 sysfs_remove_link(&device->cooling_dev->device.kobj, "device");
1925 thermal_cooling_device_unregister(device->cooling_dev);
1926 device->cooling_dev = NULL;
1950 static void acpi_video_dev_add_notify_handler(struct acpi_video_device *device)
1953 struct acpi_device *adev = device->dev;
1956 acpi_video_device_notify, device);
1960 device->flags.notify = 1;
1980 "%s/video/input0", acpi_device_hid(video->device));
1982 input->name = acpi_device_name(video->device);
1986 input->dev.parent = &video->device->dev;
2056 static int acpi_video_bus_add(struct acpi_device *device)
2063 device->parent->handle, 1,
2065 device, NULL);
2081 if (!strcmp(device->pnp.bus_id, "VID")) {
2083 device->pnp.bus_id[3] = '0' + instance;
2087 if (!strcmp(device->pnp.bus_id, "VGA")) {
2089 device->pnp.bus_id[3] = '0' + instance;
2093 video->device = device;
2094 strcpy(acpi_device_name(device), ACPI_VIDEO_BUS_NAME);
2095 strcpy(acpi_device_class(device), ACPI_VIDEO_CLASS);
2096 device->driver_data = video;
2106 error = acpi_video_bus_get_devices(video, device);
2111 ACPI_VIDEO_DEVICE_NAME, acpi_device_bid(device),
2129 device->driver_data = NULL;
2134 static int acpi_video_bus_remove(struct acpi_device *device)
2139 if (!device || !acpi_driver_data(device))
2142 video = acpi_driver_data(device);
2160 if (dev->device == 0x00D1)
2162 if (dev->device == 0x7000)