Merge remote-tracking branch 'moduleh/module.h-split'
[linux-2.6/next.git] / drivers / media / video / davinci / vpif_display.h
blob5d1936dafed25af340cb1ef91c261fd8fb76caa4
1 /*
2 * DM646x display header file
4 * Copyright (C) 2009 Texas Instruments Incorporated - http://www.ti.com/
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License as
8 * published by the Free Software Foundation version 2.
10 * This program is distributed .as is. WITHOUT ANY WARRANTY of any
11 * kind, whether express or implied; without even the implied warranty
12 * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
16 #ifndef DAVINCIHD_DISPLAY_H
17 #define DAVINCIHD_DISPLAY_H
19 /* Header files */
20 #include <linux/videodev2.h>
21 #include <media/v4l2-common.h>
22 #include <media/v4l2-device.h>
23 #include <media/videobuf-core.h>
24 #include <media/videobuf-dma-contig.h>
26 #include "vpif.h"
28 /* Macros */
29 #define VPIF_DISPLAY_VERSION "0.0.2"
31 #define VPIF_VALID_FIELD(field) \
32 (((V4L2_FIELD_ANY == field) || (V4L2_FIELD_NONE == field)) || \
33 (((V4L2_FIELD_INTERLACED == field) || (V4L2_FIELD_SEQ_TB == field)) || \
34 (V4L2_FIELD_SEQ_BT == field)))
36 #define VPIF_DISPLAY_MAX_DEVICES (2)
37 #define VPIF_SLICED_BUF_SIZE (256)
38 #define VPIF_SLICED_MAX_SERVICES (3)
39 #define VPIF_VIDEO_INDEX (0)
40 #define VPIF_VBI_INDEX (1)
41 #define VPIF_HBI_INDEX (2)
43 /* Setting it to 1 as HBI/VBI support yet to be added , else 3*/
44 #define VPIF_NUMOBJECTS (1)
46 /* Macros */
47 #define ISALIGNED(a) (0 == ((a) & 7))
49 /* enumerated data types */
50 /* Enumerated data type to give id to each device per channel */
51 enum vpif_channel_id {
52 VPIF_CHANNEL2_VIDEO = 0, /* Channel2 Video */
53 VPIF_CHANNEL3_VIDEO, /* Channel3 Video */
56 /* structures */
58 struct video_obj {
59 enum v4l2_field buf_field;
60 u32 latest_only; /* indicate whether to return
61 * most recent displayed frame only */
62 v4l2_std_id stdid; /* Currently selected or default
63 * standard */
64 u32 dv_preset;
65 struct v4l2_bt_timings bt_timings;
66 u32 output_id; /* Current output id */
69 struct vbi_obj {
70 int num_services;
71 struct vpif_vbi_params vbiparams; /* vpif parameters for the raw
72 * vbi data */
75 struct common_obj {
76 /* Buffer specific parameters */
77 u8 *fbuffers[VIDEO_MAX_FRAME]; /* List of buffer pointers for
78 * storing frames */
79 u32 numbuffers; /* number of buffers */
80 struct videobuf_buffer *cur_frm; /* Pointer pointing to current
81 * videobuf_buffer */
82 struct videobuf_buffer *next_frm; /* Pointer pointing to next
83 * videobuf_buffer */
84 enum v4l2_memory memory; /* This field keeps track of
85 * type of buffer exchange
86 * method user has selected */
87 struct v4l2_format fmt; /* Used to store the format */
88 struct videobuf_queue buffer_queue; /* Buffer queue used in
89 * video-buf */
90 struct list_head dma_queue; /* Queue of filled frames */
91 spinlock_t irqlock; /* Used in video-buf */
93 /* channel specific parameters */
94 struct mutex lock; /* lock used to access this
95 * structure */
96 u32 io_usrs; /* number of users performing
97 * IO */
98 u8 started; /* Indicates whether streaming
99 * started */
100 u32 ytop_off; /* offset of Y top from the
101 * starting of the buffer */
102 u32 ybtm_off; /* offset of Y bottom from the
103 * starting of the buffer */
104 u32 ctop_off; /* offset of C top from the
105 * starting of the buffer */
106 u32 cbtm_off; /* offset of C bottom from the
107 * starting of the buffer */
108 /* Function pointer to set the addresses */
109 void (*set_addr) (unsigned long, unsigned long,
110 unsigned long, unsigned long);
111 u32 height;
112 u32 width;
115 struct channel_obj {
116 /* V4l2 specific parameters */
117 struct video_device *video_dev; /* Identifies video device for
118 * this channel */
119 struct v4l2_prio_state prio; /* Used to keep track of state of
120 * the priority */
121 atomic_t usrs; /* number of open instances of
122 * the channel */
123 u32 field_id; /* Indicates id of the field
124 * which is being displayed */
125 u8 initialized; /* flag to indicate whether
126 * encoder is initialized */
128 enum vpif_channel_id channel_id;/* Identifies channel */
129 struct vpif_params vpifparams;
130 struct common_obj common[VPIF_NUMOBJECTS];
131 struct video_obj video;
132 struct vbi_obj vbi;
135 /* File handle structure */
136 struct vpif_fh {
137 struct channel_obj *channel; /* pointer to channel object for
138 * opened device */
139 u8 io_allowed[VPIF_NUMOBJECTS]; /* Indicates whether this file handle
140 * is doing IO */
141 enum v4l2_priority prio; /* Used to keep track priority of
142 * this instance */
143 u8 initialized; /* Used to keep track of whether this
144 * file handle has initialized
145 * channel or not */
148 /* vpif device structure */
149 struct vpif_device {
150 struct v4l2_device v4l2_dev;
151 struct channel_obj *dev[VPIF_DISPLAY_NUM_CHANNELS];
152 struct v4l2_subdev **sd;
156 struct vpif_config_params {
157 u32 min_bufsize[VPIF_DISPLAY_NUM_CHANNELS];
158 u32 channel_bufsize[VPIF_DISPLAY_NUM_CHANNELS];
159 u8 numbuffers[VPIF_DISPLAY_NUM_CHANNELS];
160 u8 min_numbuffers;
163 /* Struct which keeps track of the line numbers for the sliced vbi service */
164 struct vpif_service_line {
165 u16 service_id;
166 u16 service_line[2];
167 u16 enc_service_id;
168 u8 bytestowrite;
171 #endif /* DAVINCIHD_DISPLAY_H */