aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/video/bt8xx/bttvp.h
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/media/video/bt8xx/bttvp.h')
-rw-r--r--drivers/media/video/bt8xx/bttvp.h88
1 files changed, 76 insertions, 12 deletions
diff --git a/drivers/media/video/bt8xx/bttvp.h b/drivers/media/video/bt8xx/bttvp.h
index 3802cafc9e41..ad79b8d53430 100644
--- a/drivers/media/video/bt8xx/bttvp.h
+++ b/drivers/media/video/bt8xx/bttvp.h
@@ -26,7 +26,7 @@
26#define _BTTVP_H_ 26#define _BTTVP_H_
27 27
28#include <linux/version.h> 28#include <linux/version.h>
29#define BTTV_VERSION_CODE KERNEL_VERSION(0,9,16) 29#define BTTV_VERSION_CODE KERNEL_VERSION(0,9,17)
30 30
31#include <linux/types.h> 31#include <linux/types.h>
32#include <linux/wait.h> 32#include <linux/wait.h>
@@ -66,14 +66,22 @@
66#define RISC_SLOT_LOOP 14 66#define RISC_SLOT_LOOP 14
67 67
68#define RESOURCE_OVERLAY 1 68#define RESOURCE_OVERLAY 1
69#define RESOURCE_VIDEO 2 69#define RESOURCE_VIDEO_STREAM 2
70#define RESOURCE_VBI 4 70#define RESOURCE_VBI 4
71#define RESOURCE_VIDEO_READ 8
71 72
72#define RAW_LINES 640 73#define RAW_LINES 640
73#define RAW_BPL 1024 74#define RAW_BPL 1024
74 75
75#define UNSET (-1U) 76#define UNSET (-1U)
76 77
78/* Min. value in VDELAY register. */
79#define MIN_VDELAY 2
80/* Even to get Cb first, odd for Cr. */
81#define MAX_HDELAY (0x3FF & -2)
82/* Limits scaled width, which must be a multiple of 4. */
83#define MAX_HACTIVE (0x3FF & -4)
84
77#define clamp(x, low, high) min (max (low, x), high) 85#define clamp(x, low, high) min (max (low, x), high)
78 86
79/* ---------------------------------------------------------- */ 87/* ---------------------------------------------------------- */
@@ -92,8 +100,13 @@ struct bttv_tvnorm {
92 u16 vtotal; 100 u16 vtotal;
93 int sram; 101 int sram;
94 /* ITU-R frame line number of the first VBI line we can 102 /* ITU-R frame line number of the first VBI line we can
95 capture, of the first and second field. */ 103 capture, of the first and second field. The last possible line
104 is determined by cropcap.bounds. */
96 u16 vbistart[2]; 105 u16 vbistart[2];
106 /* Horizontally this counts fCLKx1 samples following the leading
107 edge of the horizontal sync pulse, vertically ITU-R frame line
108 numbers of the first field times two (2, 4, 6, ... 524 or 624). */
109 struct v4l2_cropcap cropcap;
97}; 110};
98extern const struct bttv_tvnorm bttv_tvnorms[]; 111extern const struct bttv_tvnorm bttv_tvnorms[];
99 112
@@ -128,6 +141,9 @@ struct bttv_buffer {
128 struct bttv_geometry geo; 141 struct bttv_geometry geo;
129 struct btcx_riscmem top; 142 struct btcx_riscmem top;
130 struct btcx_riscmem bottom; 143 struct btcx_riscmem bottom;
144 struct v4l2_rect crop;
145 unsigned int vbi_skip[2];
146 unsigned int vbi_count[2];
131}; 147};
132 148
133struct bttv_buffer_set { 149struct bttv_buffer_set {
@@ -146,6 +162,34 @@ struct bttv_overlay {
146 int setup_ok; 162 int setup_ok;
147}; 163};
148 164
165struct bttv_vbi_fmt {
166 struct v4l2_vbi_format fmt;
167
168 /* fmt.start[] and count[] refer to this video standard. */
169 const struct bttv_tvnorm *tvnorm;
170
171 /* Earliest possible start of video capturing with this
172 v4l2_vbi_format, in struct bttv_crop.rect units. */
173 __s32 end;
174};
175
176/* bttv-vbi.c */
177void bttv_vbi_fmt_reset(struct bttv_vbi_fmt *f, int norm);
178
179struct bttv_crop {
180 /* A cropping rectangle in struct bttv_tvnorm.cropcap units. */
181 struct v4l2_rect rect;
182
183 /* Scaled image size limits with this crop rect. Divide
184 max_height, but not min_height, by two when capturing
185 single fields. See also bttv_crop_reset() and
186 bttv_crop_adjust() in bttv-driver.c. */
187 __s32 min_scaled_width;
188 __s32 min_scaled_height;
189 __s32 max_scaled_width;
190 __s32 max_scaled_height;
191};
192
149struct bttv_fh { 193struct bttv_fh {
150 struct bttv *btv; 194 struct bttv *btv;
151 int resources; 195 int resources;
@@ -160,13 +204,19 @@ struct bttv_fh {
160 int width; 204 int width;
161 int height; 205 int height;
162 206
163 /* current settings */ 207 /* video overlay */
164 const struct bttv_format *ovfmt; 208 const struct bttv_format *ovfmt;
165 struct bttv_overlay ov; 209 struct bttv_overlay ov;
166 210
167 /* video overlay */ 211 /* Application called VIDIOC_S_CROP. */
212 int do_crop;
213
214 /* vbi capture */
168 struct videobuf_queue vbi; 215 struct videobuf_queue vbi;
169 int lines; 216 /* Current VBI capture window as seen through this fh (cannot
217 be global for compatibility with earlier drivers). Protected
218 by struct bttv.lock and struct bttv_fh.vbi.lock. */
219 struct bttv_vbi_fmt vbi_fmt;
170}; 220};
171 221
172/* ---------------------------------------------------------- */ 222/* ---------------------------------------------------------- */
@@ -176,7 +226,8 @@ struct bttv_fh {
176int bttv_risc_packed(struct bttv *btv, struct btcx_riscmem *risc, 226int bttv_risc_packed(struct bttv *btv, struct btcx_riscmem *risc,
177 struct scatterlist *sglist, 227 struct scatterlist *sglist,
178 unsigned int offset, unsigned int bpl, 228 unsigned int offset, unsigned int bpl,
179 unsigned int pitch, unsigned int lines); 229 unsigned int pitch, unsigned int skip_lines,
230 unsigned int store_lines);
180 231
181/* control dma register + risc main loop */ 232/* control dma register + risc main loop */
182void bttv_set_dma(struct bttv *btv, int override); 233void bttv_set_dma(struct bttv *btv, int override);
@@ -202,9 +253,9 @@ int bttv_overlay_risc(struct bttv *btv, struct bttv_overlay *ov,
202/* ---------------------------------------------------------- */ 253/* ---------------------------------------------------------- */
203/* bttv-vbi.c */ 254/* bttv-vbi.c */
204 255
205void bttv_vbi_try_fmt(struct bttv_fh *fh, struct v4l2_format *f); 256int bttv_vbi_try_fmt(struct bttv_fh *fh, struct v4l2_vbi_format *f);
206void bttv_vbi_get_fmt(struct bttv_fh *fh, struct v4l2_format *f); 257void bttv_vbi_get_fmt(struct bttv_fh *fh, struct v4l2_vbi_format *f);
207void bttv_vbi_setlines(struct bttv_fh *fh, struct bttv *btv, int lines); 258int bttv_vbi_set_fmt(struct bttv_fh *fh, struct v4l2_vbi_format *f);
208 259
209extern struct videobuf_queue_ops bttv_vbi_qops; 260extern struct videobuf_queue_ops bttv_vbi_qops;
210 261
@@ -233,7 +284,6 @@ extern int fini_bttv_i2c(struct bttv *btv);
233#define d2printk if (bttv_debug >= 2) printk 284#define d2printk if (bttv_debug >= 2) printk
234 285
235#define BTTV_MAX_FBUF 0x208000 286#define BTTV_MAX_FBUF 0x208000
236#define VBIBUF_SIZE (2048*VBI_MAXLINES*2)
237#define BTTV_TIMEOUT (HZ/2) /* 0.5 seconds */ 287#define BTTV_TIMEOUT (HZ/2) /* 0.5 seconds */
238#define BTTV_FREE_IDLE (HZ) /* one second */ 288#define BTTV_FREE_IDLE (HZ) /* one second */
239 289
@@ -314,7 +364,6 @@ struct bttv {
314 spinlock_t s_lock; 364 spinlock_t s_lock;
315 struct mutex lock; 365 struct mutex lock;
316 int resources; 366 int resources;
317 struct mutex reslock;
318#ifdef VIDIOC_G_PRIORITY 367#ifdef VIDIOC_G_PRIORITY
319 struct v4l2_prio_state prio; 368 struct v4l2_prio_state prio;
320#endif 369#endif
@@ -384,6 +433,21 @@ struct bttv {
384 433
385 unsigned int users; 434 unsigned int users;
386 struct bttv_fh init; 435 struct bttv_fh init;
436
437 /* Default (0) and current (1) video capturing and overlay
438 cropping parameters in bttv_tvnorm.cropcap units. Protected
439 by bttv.lock. */
440 struct bttv_crop crop[2];
441
442 /* Earliest possible start of video capturing in
443 bttv_tvnorm.cropcap line units. Set by check_alloc_btres()
444 and free_btres(). Protected by bttv.lock. */
445 __s32 vbi_end;
446
447 /* Latest possible end of VBI capturing (= crop[x].rect.top when
448 VIDEO_RESOURCES are locked). Set by check_alloc_btres()
449 and free_btres(). Protected by bttv.lock. */
450 __s32 crop_start;
387}; 451};
388 452
389/* our devices */ 453/* our devices */