diff options
Diffstat (limited to 'drivers/video/tegra/dc/ext/tegra_dc_ext_priv.h')
-rw-r--r-- | drivers/video/tegra/dc/ext/tegra_dc_ext_priv.h | 147 |
1 files changed, 147 insertions, 0 deletions
diff --git a/drivers/video/tegra/dc/ext/tegra_dc_ext_priv.h b/drivers/video/tegra/dc/ext/tegra_dc_ext_priv.h new file mode 100644 index 00000000000..95a637d5a52 --- /dev/null +++ b/drivers/video/tegra/dc/ext/tegra_dc_ext_priv.h | |||
@@ -0,0 +1,147 @@ | |||
1 | /* | ||
2 | * drivers/video/tegra/dc/ext/tegra_dc_ext_priv.h | ||
3 | * | ||
4 | * Copyright (C) 2011, NVIDIA Corporation | ||
5 | * | ||
6 | * Author: Robert Morell <rmorell@nvidia.com> | ||
7 | * | ||
8 | * This program is free software; you can redistribute it and/or modify | ||
9 | * it under the terms of the GNU General Public License as published by | ||
10 | * the Free Software Foundation; either version 2 of the License, or | ||
11 | * (at your option) any later version. | ||
12 | * | ||
13 | * This program is distributed in the hope that it will be useful, but WITHOUT | ||
14 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||
15 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for | ||
16 | * more details. | ||
17 | */ | ||
18 | |||
19 | #ifndef __TEGRA_DC_EXT_PRIV_H | ||
20 | #define __TEGRA_DC_EXT_PRIV_H | ||
21 | |||
22 | #include <linux/cdev.h> | ||
23 | #include <linux/list.h> | ||
24 | #include <linux/mutex.h> | ||
25 | #include <linux/poll.h> | ||
26 | |||
27 | #include <mach/dc.h> | ||
28 | #include <mach/nvmap.h> | ||
29 | |||
30 | #include <video/tegra_dc_ext.h> | ||
31 | |||
32 | struct tegra_dc_ext; | ||
33 | |||
34 | struct tegra_dc_ext_user { | ||
35 | struct tegra_dc_ext *ext; | ||
36 | struct nvmap_client *nvmap; | ||
37 | }; | ||
38 | |||
39 | enum { | ||
40 | TEGRA_DC_Y, | ||
41 | TEGRA_DC_U, | ||
42 | TEGRA_DC_V, | ||
43 | TEGRA_DC_NUM_PLANES, | ||
44 | }; | ||
45 | |||
46 | struct tegra_dc_ext_win { | ||
47 | struct tegra_dc_ext *ext; | ||
48 | |||
49 | int idx; | ||
50 | |||
51 | struct tegra_dc_ext_user *user; | ||
52 | |||
53 | struct mutex lock; | ||
54 | |||
55 | /* Current nvmap handle (if any) for Y, U, V planes */ | ||
56 | struct nvmap_handle_ref *cur_handle[TEGRA_DC_NUM_PLANES]; | ||
57 | |||
58 | struct workqueue_struct *flip_wq; | ||
59 | |||
60 | atomic_t nr_pending_flips; | ||
61 | }; | ||
62 | |||
63 | struct tegra_dc_ext { | ||
64 | struct tegra_dc *dc; | ||
65 | |||
66 | struct cdev cdev; | ||
67 | struct device *dev; | ||
68 | |||
69 | struct nvmap_client *nvmap; | ||
70 | |||
71 | struct tegra_dc_ext_win win[DC_N_WINDOWS]; | ||
72 | |||
73 | struct { | ||
74 | struct tegra_dc_ext_user *user; | ||
75 | struct nvmap_handle_ref *cur_handle; | ||
76 | struct mutex lock; | ||
77 | } cursor; | ||
78 | |||
79 | bool enabled; | ||
80 | }; | ||
81 | |||
82 | #define TEGRA_DC_EXT_EVENT_MASK_ALL \ | ||
83 | TEGRA_DC_EXT_EVENT_HOTPLUG | ||
84 | |||
85 | #define TEGRA_DC_EXT_EVENT_MAX_SZ 8 | ||
86 | |||
87 | struct tegra_dc_ext_event_list { | ||
88 | struct tegra_dc_ext_event event; | ||
89 | /* The data field _must_ follow the event field. */ | ||
90 | char data[TEGRA_DC_EXT_EVENT_MAX_SZ]; | ||
91 | |||
92 | struct list_head list; | ||
93 | }; | ||
94 | |||
95 | #define TEGRA_DC_EXT_CAPABILITIES \ | ||
96 | TEGRA_DC_EXT_CAPABILITIES_CURSOR_MODE | ||
97 | |||
98 | struct tegra_dc_ext_control_user { | ||
99 | struct tegra_dc_ext_control *control; | ||
100 | |||
101 | struct list_head event_list; | ||
102 | atomic_t num_events; | ||
103 | |||
104 | u32 event_mask; | ||
105 | |||
106 | struct tegra_dc_ext_event_list event_to_copy; | ||
107 | loff_t partial_copy; | ||
108 | |||
109 | struct mutex lock; | ||
110 | |||
111 | struct list_head list; | ||
112 | }; | ||
113 | |||
114 | struct tegra_dc_ext_control { | ||
115 | struct cdev cdev; | ||
116 | struct device *dev; | ||
117 | |||
118 | struct list_head users; | ||
119 | |||
120 | struct mutex lock; | ||
121 | }; | ||
122 | |||
123 | extern int tegra_dc_ext_devno; | ||
124 | extern struct class *tegra_dc_ext_class; | ||
125 | |||
126 | extern int tegra_dc_ext_pin_window(struct tegra_dc_ext_user *user, u32 id, | ||
127 | struct nvmap_handle_ref **handle, | ||
128 | dma_addr_t *phys_addr); | ||
129 | |||
130 | extern int tegra_dc_ext_get_cursor(struct tegra_dc_ext_user *user); | ||
131 | extern int tegra_dc_ext_put_cursor(struct tegra_dc_ext_user *user); | ||
132 | extern int tegra_dc_ext_set_cursor_image(struct tegra_dc_ext_user *user, | ||
133 | struct tegra_dc_ext_cursor_image *); | ||
134 | extern int tegra_dc_ext_set_cursor(struct tegra_dc_ext_user *user, | ||
135 | struct tegra_dc_ext_cursor *); | ||
136 | |||
137 | extern int tegra_dc_ext_control_init(void); | ||
138 | |||
139 | extern int tegra_dc_ext_queue_hotplug(struct tegra_dc_ext_control *, | ||
140 | int output); | ||
141 | extern ssize_t tegra_dc_ext_event_read(struct file *filp, char __user *buf, | ||
142 | size_t size, loff_t *ppos); | ||
143 | extern unsigned int tegra_dc_ext_event_poll(struct file *, poll_table *); | ||
144 | |||
145 | extern int tegra_dc_ext_get_num_outputs(void); | ||
146 | |||
147 | #endif /* __TEGRA_DC_EXT_PRIV_H */ | ||