1
2
3
4
5
6
7
8
9
10
11#ifndef UDL_DRV_H
12#define UDL_DRV_H
13
14#include <linux/mm_types.h>
15#include <linux/usb.h>
16
17#include <drm/drm_device.h>
18#include <drm/drm_framebuffer.h>
19#include <drm/drm_gem.h>
20#include <drm/drm_simple_kms_helper.h>
21
22struct drm_mode_create_dumb;
23
24#define DRIVER_NAME "udl"
25#define DRIVER_DESC "DisplayLink"
26#define DRIVER_DATE "20120220"
27
28#define DRIVER_MAJOR 0
29#define DRIVER_MINOR 0
30#define DRIVER_PATCHLEVEL 1
31
32struct udl_device;
33
34struct urb_node {
35 struct list_head entry;
36 struct udl_device *dev;
37 struct delayed_work release_urb_work;
38 struct urb *urb;
39};
40
41struct urb_list {
42 struct list_head list;
43 spinlock_t lock;
44 struct semaphore limit_sem;
45 int available;
46 int count;
47 size_t size;
48};
49
50struct udl_device {
51 struct drm_device drm;
52 struct device *dev;
53 struct usb_device *udev;
54
55 struct drm_simple_display_pipe display_pipe;
56
57 struct mutex gem_lock;
58
59 int sku_pixel_limit;
60
61 struct urb_list urbs;
62
63 char mode_buf[1024];
64 uint32_t mode_buf_len;
65};
66
67#define to_udl(x) container_of(x, struct udl_device, drm)
68
69
70int udl_modeset_init(struct drm_device *dev);
71struct drm_connector *udl_connector_init(struct drm_device *dev);
72
73struct urb *udl_get_urb(struct drm_device *dev);
74
75int udl_submit_urb(struct drm_device *dev, struct urb *urb, size_t len);
76void udl_urb_completion(struct urb *urb);
77
78int udl_init(struct udl_device *udl);
79
80int udl_render_hline(struct drm_device *dev, int log_bpp, struct urb **urb_ptr,
81 const char *front, char **urb_buf_ptr,
82 u32 byte_offset, u32 device_byte_offset, u32 byte_width);
83
84int udl_drop_usb(struct drm_device *dev);
85
86#define CMD_WRITE_RAW8 "\xAF\x60"
87#define CMD_WRITE_RL8 "\xAF\x61"
88#define CMD_WRITE_COPY8 "\xAF\x62"
89#define CMD_WRITE_RLX8 "\xAF\x63"
90
91#define CMD_WRITE_RAW16 "\xAF\x68"
92#define CMD_WRITE_RL16 "\xAF\x69"
93#define CMD_WRITE_COPY16 "\xAF\x6A"
94#define CMD_WRITE_RLX16 "\xAF\x6B"
95
96
97#define UDL_REG_BLANK_MODE 0x1f
98
99#define UDL_BLANK_MODE_ON 0x00
100#define UDL_BLANK_MODE_BLANKED 0x01
101#define UDL_BLANK_MODE_VSYNC_OFF 0x03
102#define UDL_BLANK_MODE_HSYNC_OFF 0x05
103#define UDL_BLANK_MODE_POWERDOWN 0x07
104
105#endif
106