diff options
author | Steven Toth <stoth@hauppauge.com> | 2008-01-10 01:40:49 -0500 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@infradead.org> | 2008-01-25 16:04:49 -0500 |
commit | 7b8880140ff6aec6a5bec7929b03ce0b96a7c79a (patch) | |
tree | b2646197762030abaa1110be0d2a9474bce20c3e /drivers/media/video/cx23885/cx23885.h | |
parent | c771261330c90b7c77f686a1aa0fb4f756e07b5f (diff) |
V4L/DVB (7007): cx23885: Add basic video support for the HVR1800
This enabled basic preview NTSC and PAL support for the HVR1800.
Signed-off-by: Steven Toth <stoth@hauppauge.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
Diffstat (limited to 'drivers/media/video/cx23885/cx23885.h')
-rw-r--r-- | drivers/media/video/cx23885/cx23885.h | 151 |
1 files changed, 147 insertions, 4 deletions
diff --git a/drivers/media/video/cx23885/cx23885.h b/drivers/media/video/cx23885/cx23885.h index b957242dcd5e..390f9335bdc9 100644 --- a/drivers/media/video/cx23885/cx23885.h +++ b/drivers/media/video/cx23885/cx23885.h | |||
@@ -44,6 +44,10 @@ | |||
44 | 44 | ||
45 | /* Max number of inputs by card */ | 45 | /* Max number of inputs by card */ |
46 | #define MAX_CX23885_INPUT 8 | 46 | #define MAX_CX23885_INPUT 8 |
47 | #define INPUT(nr) (&cx23885_boards[dev->board].input[nr]) | ||
48 | #define RESOURCE_OVERLAY 1 | ||
49 | #define RESOURCE_VIDEO 2 | ||
50 | #define RESOURCE_VBI 4 | ||
47 | 51 | ||
48 | #define BUFFER_TIMEOUT (HZ) /* 0.5 seconds */ | 52 | #define BUFFER_TIMEOUT (HZ) /* 0.5 seconds */ |
49 | 53 | ||
@@ -56,6 +60,60 @@ | |||
56 | #define CX23885_BOARD_HAUPPAUGE_HVR1500Q 5 | 60 | #define CX23885_BOARD_HAUPPAUGE_HVR1500Q 5 |
57 | #define CX23885_BOARD_HAUPPAUGE_HVR1500 6 | 61 | #define CX23885_BOARD_HAUPPAUGE_HVR1500 6 |
58 | 62 | ||
63 | /* Currently unsupported by the driver: PAL/H, NTSC/Kr, SECAM B/G/H/LC */ | ||
64 | #define CX23885_NORMS (\ | ||
65 | V4L2_STD_NTSC_M | V4L2_STD_NTSC_M_JP | V4L2_STD_NTSC_443 | \ | ||
66 | V4L2_STD_PAL_BG | V4L2_STD_PAL_DK | V4L2_STD_PAL_I | \ | ||
67 | V4L2_STD_PAL_M | V4L2_STD_PAL_N | V4L2_STD_PAL_Nc | \ | ||
68 | V4L2_STD_PAL_60 | V4L2_STD_SECAM_L | V4L2_STD_SECAM_DK) | ||
69 | |||
70 | struct cx23885_fmt { | ||
71 | char *name; | ||
72 | u32 fourcc; /* v4l2 format id */ | ||
73 | int depth; | ||
74 | int flags; | ||
75 | u32 cxformat; | ||
76 | }; | ||
77 | |||
78 | struct cx23885_ctrl { | ||
79 | struct v4l2_queryctrl v; | ||
80 | u32 off; | ||
81 | u32 reg; | ||
82 | u32 mask; | ||
83 | u32 shift; | ||
84 | }; | ||
85 | |||
86 | struct cx23885_tvnorm { | ||
87 | char *name; | ||
88 | v4l2_std_id id; | ||
89 | u32 cxiformat; | ||
90 | u32 cxoformat; | ||
91 | }; | ||
92 | |||
93 | struct cx23885_fh { | ||
94 | struct cx23885_dev *dev; | ||
95 | enum v4l2_buf_type type; | ||
96 | int radio; | ||
97 | u32 resources; | ||
98 | |||
99 | /* video overlay */ | ||
100 | struct v4l2_window win; | ||
101 | struct v4l2_clip *clips; | ||
102 | unsigned int nclips; | ||
103 | |||
104 | /* video capture */ | ||
105 | struct cx23885_fmt *fmt; | ||
106 | unsigned int width, height; | ||
107 | |||
108 | /* vbi capture */ | ||
109 | struct videobuf_queue vidq; | ||
110 | struct videobuf_queue vbiq; | ||
111 | |||
112 | /* MPEG Encoder specifics ONLY */ | ||
113 | struct videobuf_queue mpegq; | ||
114 | atomic_t v4l_reading; | ||
115 | }; | ||
116 | |||
59 | enum cx23885_itype { | 117 | enum cx23885_itype { |
60 | CX23885_VMUX_COMPOSITE1 = 1, | 118 | CX23885_VMUX_COMPOSITE1 = 1, |
61 | CX23885_VMUX_COMPOSITE2, | 119 | CX23885_VMUX_COMPOSITE2, |
@@ -94,12 +152,17 @@ struct cx23885_input { | |||
94 | 152 | ||
95 | typedef enum { | 153 | typedef enum { |
96 | CX23885_MPEG_UNDEFINED = 0, | 154 | CX23885_MPEG_UNDEFINED = 0, |
97 | CX23885_MPEG_DVB | 155 | CX23885_MPEG_DVB, |
156 | CX23885_ANALOG_VIDEO, | ||
98 | } port_t; | 157 | } port_t; |
99 | 158 | ||
100 | struct cx23885_board { | 159 | struct cx23885_board { |
101 | char *name; | 160 | char *name; |
102 | port_t portb, portc; | 161 | port_t porta, portb, portc; |
162 | unsigned int tuner_type; | ||
163 | unsigned int radio_type; | ||
164 | unsigned char tuner_addr; | ||
165 | unsigned char radio_addr; | ||
103 | 166 | ||
104 | /* Vendors can and do run the PCIe bridge at different | 167 | /* Vendors can and do run the PCIe bridge at different |
105 | * clock rates, driven physically by crystals on the PCBs. | 168 | * clock rates, driven physically by crystals on the PCBs. |
@@ -228,8 +291,31 @@ struct cx23885_dev { | |||
228 | CX23885_BRIDGE_885 = 885, | 291 | CX23885_BRIDGE_885 = 885, |
229 | CX23885_BRIDGE_887 = 887, | 292 | CX23885_BRIDGE_887 = 887, |
230 | } bridge; | 293 | } bridge; |
294 | |||
295 | /* Analog video */ | ||
296 | u32 resources; | ||
297 | unsigned int input; | ||
298 | u32 tvaudio; | ||
299 | v4l2_std_id tvnorm; | ||
300 | unsigned int tuner_type; | ||
301 | unsigned char tuner_addr; | ||
302 | unsigned int radio_type; | ||
303 | unsigned char radio_addr; | ||
304 | unsigned int has_radio; | ||
305 | |||
306 | /* V4l */ | ||
307 | u32 freq; | ||
308 | struct video_device *video_dev; | ||
309 | struct video_device *vbi_dev; | ||
310 | struct video_device *radio_dev; | ||
311 | |||
312 | struct cx23885_dmaqueue vidq; | ||
313 | struct cx23885_dmaqueue vbiq; | ||
314 | spinlock_t slock; | ||
231 | }; | 315 | }; |
232 | 316 | ||
317 | extern struct list_head cx23885_devlist; | ||
318 | |||
233 | #define SRAM_CH01 0 /* Video A */ | 319 | #define SRAM_CH01 0 /* Video A */ |
234 | #define SRAM_CH02 1 /* VBI A */ | 320 | #define SRAM_CH02 1 /* VBI A */ |
235 | #define SRAM_CH03 2 /* Video B */ | 321 | #define SRAM_CH03 2 /* Video B */ |
@@ -273,8 +359,34 @@ struct sram_channel { | |||
273 | #define cx_clear(reg,bit) cx_andor((reg),(bit),0) | 359 | #define cx_clear(reg,bit) cx_andor((reg),(bit),0) |
274 | 360 | ||
275 | /* ----------------------------------------------------------- */ | 361 | /* ----------------------------------------------------------- */ |
276 | /* cx23885-cards.c */ | 362 | /* cx23885-core.c */ |
363 | |||
364 | extern int cx23885_sram_channel_setup(struct cx23885_dev *dev, | ||
365 | struct sram_channel *ch, | ||
366 | unsigned int bpl, u32 risc); | ||
367 | |||
368 | extern void cx23885_sram_channel_dump(struct cx23885_dev *dev, | ||
369 | struct sram_channel *ch); | ||
277 | 370 | ||
371 | extern int cx23885_risc_stopper(struct pci_dev *pci, struct btcx_riscmem *risc, | ||
372 | u32 reg, u32 mask, u32 value); | ||
373 | |||
374 | extern int cx23885_risc_buffer(struct pci_dev *pci, struct btcx_riscmem *risc, | ||
375 | struct scatterlist *sglist, | ||
376 | unsigned int top_offset, unsigned int bottom_offset, | ||
377 | unsigned int bpl, unsigned int padding, unsigned int lines); | ||
378 | |||
379 | void cx23885_cancel_buffers(struct cx23885_tsport *port); | ||
380 | |||
381 | extern int cx23885_restart_queue(struct cx23885_tsport *port, | ||
382 | struct cx23885_dmaqueue *q); | ||
383 | |||
384 | extern void cx23885_wakeup(struct cx23885_tsport *port, | ||
385 | struct cx23885_dmaqueue *q, u32 count); | ||
386 | |||
387 | |||
388 | /* ----------------------------------------------------------- */ | ||
389 | /* cx23885-cards.c */ | ||
278 | extern struct cx23885_board cx23885_boards[]; | 390 | extern struct cx23885_board cx23885_boards[]; |
279 | extern const unsigned int cx23885_bcount; | 391 | extern const unsigned int cx23885_bcount; |
280 | 392 | ||
@@ -294,19 +406,50 @@ extern int cx23885_buf_prepare(struct videobuf_queue *q, | |||
294 | struct cx23885_tsport *port, | 406 | struct cx23885_tsport *port, |
295 | struct cx23885_buffer *buf, | 407 | struct cx23885_buffer *buf, |
296 | enum v4l2_field field); | 408 | enum v4l2_field field); |
297 | |||
298 | extern void cx23885_buf_queue(struct cx23885_tsport *port, | 409 | extern void cx23885_buf_queue(struct cx23885_tsport *port, |
299 | struct cx23885_buffer *buf); | 410 | struct cx23885_buffer *buf); |
300 | extern void cx23885_free_buffer(struct videobuf_queue *q, | 411 | extern void cx23885_free_buffer(struct videobuf_queue *q, |
301 | struct cx23885_buffer *buf); | 412 | struct cx23885_buffer *buf); |
302 | 413 | ||
303 | /* ----------------------------------------------------------- */ | 414 | /* ----------------------------------------------------------- */ |
415 | /* cx23885-video.c */ | ||
416 | /* Video */ | ||
417 | extern int cx23885_video_register(struct cx23885_dev *dev); | ||
418 | extern void cx23885_video_unregister(struct cx23885_dev *dev); | ||
419 | extern int cx23885_video_irq(struct cx23885_dev *dev, u32 status); | ||
420 | |||
421 | /* ----------------------------------------------------------- */ | ||
422 | /* cx23885-vbi.c */ | ||
423 | extern int cx23885_vbi_fmt(struct file *file, void *priv, | ||
424 | struct v4l2_format *f); | ||
425 | extern void cx23885_vbi_timeout(unsigned long data); | ||
426 | extern struct videobuf_queue_ops cx23885_vbi_qops; | ||
427 | |||
304 | /* cx23885-i2c.c */ | 428 | /* cx23885-i2c.c */ |
305 | extern int cx23885_i2c_register(struct cx23885_i2c *bus); | 429 | extern int cx23885_i2c_register(struct cx23885_i2c *bus); |
306 | extern int cx23885_i2c_unregister(struct cx23885_i2c *bus); | 430 | extern int cx23885_i2c_unregister(struct cx23885_i2c *bus); |
307 | extern void cx23885_call_i2c_clients(struct cx23885_i2c *bus, unsigned int cmd, | 431 | extern void cx23885_call_i2c_clients(struct cx23885_i2c *bus, unsigned int cmd, |
308 | void *arg); | 432 | void *arg); |
309 | 433 | ||
434 | /* ----------------------------------------------------------- */ | ||
435 | /* tv norms */ | ||
436 | |||
437 | static inline unsigned int norm_maxw(v4l2_std_id norm) | ||
438 | { | ||
439 | return (norm & (V4L2_STD_MN & ~V4L2_STD_PAL_Nc)) ? 720 : 768; | ||
440 | } | ||
441 | |||
442 | static inline unsigned int norm_maxh(v4l2_std_id norm) | ||
443 | { | ||
444 | return (norm & V4L2_STD_625_50) ? 576 : 480; | ||
445 | } | ||
446 | |||
447 | static inline unsigned int norm_swidth(v4l2_std_id norm) | ||
448 | { | ||
449 | return (norm & (V4L2_STD_MN & ~V4L2_STD_PAL_Nc)) ? 754 : 922; | ||
450 | } | ||
451 | |||
452 | |||
310 | /* | 453 | /* |
311 | * Local variables: | 454 | * Local variables: |
312 | * c-basic-offset: 8 | 455 | * c-basic-offset: 8 |