Full support for Ginger Console
[linux-ginger.git] / drivers / media / video / ti-media / omap_voutdef.h
blob3b2f7456c215e89cc2b19e50776b446e391afa7a
1 /*
2 * drivers/media/video/omap/omap_voutdef.h
4 * Copyright (C) 2009 Texas Instruments.
6 * This file is licensed under the terms of the GNU General Public License
7 * version 2. This program is licensed "as is" without any warranty of any
8 * kind, whether express or implied.
9 */
11 #ifndef OMAP_VOUTDEF_H
12 #define OMAP_VOUTDEF_H
14 #include <plat/display.h>
16 #define YUYV_BPP 2
17 #define RGB565_BPP 2
18 #define RGB24_BPP 3
19 #define RGB32_BPP 4
20 #define TILE_SIZE 32
21 #define YUYV_VRFB_BPP 2
22 #define RGB_VRFB_BPP 1
23 #define MAX_CID 3
24 #define MAC_VRFB_CTXS 4
25 #define MAX_VOUT_DEV 2
26 #define MAX_OVLS 3
27 #define MAX_DISPLAYS 3
28 #define MAX_MANAGERS 3
30 /* Enum for Rotation
31 * DSS understands rotation in 0, 1, 2, 3 context
32 * while V4L2 driver understands it as 0, 90, 180, 270
34 enum dss_rotation {
35 dss_rotation_0_degree = 0,
36 dss_rotation_90_degree = 1,
37 dss_rotation_180_degree = 2,
38 dss_rotation_270_degree = 3,
41 * This structure is used to store the DMA transfer parameters
42 * for VRFB hidden buffer
44 struct vid_vrfb_dma {
45 int dev_id;
46 int dma_ch;
47 int req_status;
48 int tx_status;
49 wait_queue_head_t wait;
52 struct omapvideo_info {
53 int id;
54 int num_overlays;
55 struct omap_overlay *overlays[MAX_OVLS];
58 struct omap2video_device {
59 struct mutex mtx;
61 int state;
63 struct v4l2_device v4l2_dev;
64 int num_videos;
65 struct omap_vout_device *vouts[MAX_VOUT_DEV];
67 int num_displays;
68 struct omap_dss_device *displays[MAX_DISPLAYS];
69 int num_overlays;
70 struct omap_overlay *overlays[MAX_OVLS];
71 int num_managers;
72 struct omap_overlay_manager *managers[MAX_MANAGERS];
75 /* per-device data structure */
76 struct omap_vout_device {
78 struct omapvideo_info vid_info;
79 struct video_device *vfd;
80 struct omap2video_device *vid_dev;
81 int vid;
82 int opened;
84 /* we don't allow to change image fmt/size once buffer has
85 * been allocated
87 int buffer_allocated;
88 /* allow to reuse previously allocated buffer which is big enough */
89 int buffer_size;
90 /* keep buffer info across opens */
91 unsigned long buf_virt_addr[VIDEO_MAX_FRAME];
92 unsigned long buf_phy_addr[VIDEO_MAX_FRAME];
93 enum omap_color_mode dss_mode;
95 /* we don't allow to request new buffer when old buffers are
96 * still mmaped
98 int mmap_count;
100 spinlock_t vbq_lock; /* spinlock for videobuf queues */
101 unsigned long field_count; /* field counter for videobuf_buffer */
103 /* non-NULL means streaming is in progress. */
104 bool streaming;
106 struct v4l2_pix_format pix;
107 struct v4l2_rect crop;
108 struct v4l2_window win;
109 struct v4l2_framebuffer fbuf;
111 /* Lock to protect the shared data structures in ioctl */
112 struct mutex lock;
114 /* V4L2 control structure for different control id */
115 struct v4l2_control control[MAX_CID];
116 enum dss_rotation rotation;
117 bool mirror;
118 int flicker_filter;
119 /* V4L2 control structure for different control id */
121 int bpp; /* bytes per pixel */
122 int vrfb_bpp; /* bytes per pixel with respect to VRFB */
124 struct vid_vrfb_dma vrfb_dma_tx;
125 unsigned int smsshado_phy_addr[MAC_VRFB_CTXS];
126 unsigned int smsshado_virt_addr[MAC_VRFB_CTXS];
127 struct vrfb vrfb_context[MAC_VRFB_CTXS];
128 bool vrfb_static_allocation;
129 unsigned int smsshado_size;
130 unsigned char pos;
132 int ps, vr_ps, line_length, first_int, field_id;
133 enum v4l2_memory memory;
134 struct videobuf_buffer *cur_frm, *next_frm;
135 struct list_head dma_queue;
136 u8 *queued_buf_addr[VIDEO_MAX_FRAME];
137 u32 cropped_offset;
138 s32 tv_field1_offset;
139 void *isr_handle;
141 /* Buffer queue variables */
142 struct omap_vout_device *vout;
143 enum v4l2_buf_type type;
144 struct videobuf_queue vbq;
145 int io_allowed;
148 #endif /* ifndef OMAP_VOUTDEF_H */