Version:  2.0.40 2.2.26 2.4.37 3.11 3.12 3.13 3.14 3.15 3.16 3.17 3.18 3.19 4.0 4.1 4.2 4.3 4.4 4.5 4.6 4.7 4.8

Linux/drivers/gpu/drm/udl/udl_drv.c

  1 /*
  2  * Copyright (C) 2012 Red Hat
  3  *
  4  * This file is subject to the terms and conditions of the GNU General Public
  5  * License v2. See the file COPYING in the main directory of this archive for
  6  * more details.
  7  */
  8 
  9 #include <linux/module.h>
 10 #include <drm/drmP.h>
 11 #include <drm/drm_crtc_helper.h>
 12 #include "udl_drv.h"
 13 
 14 static int udl_driver_set_busid(struct drm_device *d, struct drm_master *m)
 15 {
 16         return 0;
 17 }
 18 
 19 static const struct vm_operations_struct udl_gem_vm_ops = {
 20         .fault = udl_gem_fault,
 21         .open = drm_gem_vm_open,
 22         .close = drm_gem_vm_close,
 23 };
 24 
 25 static const struct file_operations udl_driver_fops = {
 26         .owner = THIS_MODULE,
 27         .open = drm_open,
 28         .mmap = udl_drm_gem_mmap,
 29         .poll = drm_poll,
 30         .read = drm_read,
 31         .unlocked_ioctl = drm_ioctl,
 32         .release = drm_release,
 33 #ifdef CONFIG_COMPAT
 34         .compat_ioctl = drm_compat_ioctl,
 35 #endif
 36         .llseek = noop_llseek,
 37 };
 38 
 39 static struct drm_driver driver = {
 40         .driver_features = DRIVER_MODESET | DRIVER_GEM | DRIVER_PRIME,
 41         .load = udl_driver_load,
 42         .unload = udl_driver_unload,
 43         .set_busid = udl_driver_set_busid,
 44 
 45         /* gem hooks */
 46         .gem_free_object = udl_gem_free_object,
 47         .gem_vm_ops = &udl_gem_vm_ops,
 48 
 49         .dumb_create = udl_dumb_create,
 50         .dumb_map_offset = udl_gem_mmap,
 51         .dumb_destroy = drm_gem_dumb_destroy,
 52         .fops = &udl_driver_fops,
 53 
 54         .prime_handle_to_fd = drm_gem_prime_handle_to_fd,
 55         .prime_fd_to_handle = drm_gem_prime_fd_to_handle,
 56         .gem_prime_export = udl_gem_prime_export,
 57         .gem_prime_import = udl_gem_prime_import,
 58 
 59         .name = DRIVER_NAME,
 60         .desc = DRIVER_DESC,
 61         .date = DRIVER_DATE,
 62         .major = DRIVER_MAJOR,
 63         .minor = DRIVER_MINOR,
 64         .patchlevel = DRIVER_PATCHLEVEL,
 65 };
 66 
 67 static int udl_usb_probe(struct usb_interface *interface,
 68                          const struct usb_device_id *id)
 69 {
 70         struct usb_device *udev = interface_to_usbdev(interface);
 71         struct drm_device *dev;
 72         int r;
 73 
 74         dev = drm_dev_alloc(&driver, &interface->dev);
 75         if (!dev)
 76                 return -ENOMEM;
 77 
 78         r = drm_dev_register(dev, (unsigned long)udev);
 79         if (r)
 80                 goto err_free;
 81 
 82         usb_set_intfdata(interface, dev);
 83         DRM_INFO("Initialized udl on minor %d\n", dev->primary->index);
 84 
 85         return 0;
 86 
 87 err_free:
 88         drm_dev_unref(dev);
 89         return r;
 90 }
 91 
 92 static void udl_usb_disconnect(struct usb_interface *interface)
 93 {
 94         struct drm_device *dev = usb_get_intfdata(interface);
 95 
 96         drm_kms_helper_poll_disable(dev);
 97         udl_fbdev_unplug(dev);
 98         udl_drop_usb(dev);
 99         drm_unplug_dev(dev);
100 }
101 
102 /*
103  * There are many DisplayLink-based graphics products, all with unique PIDs.
104  * So we match on DisplayLink's VID + Vendor-Defined Interface Class (0xff)
105  * We also require a match on SubClass (0x00) and Protocol (0x00),
106  * which is compatible with all known USB 2.0 era graphics chips and firmware,
107  * but allows DisplayLink to increment those for any future incompatible chips
108  */
109 static struct usb_device_id id_table[] = {
110         {.idVendor = 0x17e9, .bInterfaceClass = 0xff,
111          .bInterfaceSubClass = 0x00,
112          .bInterfaceProtocol = 0x00,
113          .match_flags = USB_DEVICE_ID_MATCH_VENDOR |
114                         USB_DEVICE_ID_MATCH_INT_CLASS |
115                         USB_DEVICE_ID_MATCH_INT_SUBCLASS |
116                         USB_DEVICE_ID_MATCH_INT_PROTOCOL,},
117         {},
118 };
119 MODULE_DEVICE_TABLE(usb, id_table);
120 
121 static struct usb_driver udl_driver = {
122         .name = "udl",
123         .probe = udl_usb_probe,
124         .disconnect = udl_usb_disconnect,
125         .id_table = id_table,
126 };
127 module_usb_driver(udl_driver);
128 MODULE_LICENSE("GPL");
129 

This page was automatically generated by LXR 0.3.1 (source).  •  Linux is a registered trademark of Linus Torvalds  •  Contact us