aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/video/cx18/cx18-driver.h
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/media/video/cx18/cx18-driver.h')
-rw-r--r--drivers/media/video/cx18/cx18-driver.h62
1 files changed, 43 insertions, 19 deletions
diff --git a/drivers/media/video/cx18/cx18-driver.h b/drivers/media/video/cx18/cx18-driver.h
index c6a1e907f63a..e3f7911a7385 100644
--- a/drivers/media/video/cx18/cx18-driver.h
+++ b/drivers/media/video/cx18/cx18-driver.h
@@ -50,6 +50,7 @@
50#include <media/v4l2-ioctl.h> 50#include <media/v4l2-ioctl.h>
51#include <media/v4l2-device.h> 51#include <media/v4l2-device.h>
52#include <media/tuner.h> 52#include <media/tuner.h>
53#include <media/ir-kbd-i2c.h>
53#include "cx18-mailbox.h" 54#include "cx18-mailbox.h"
54#include "cx18-av-core.h" 55#include "cx18-av-core.h"
55#include "cx23418.h" 56#include "cx23418.h"
@@ -120,12 +121,16 @@
120/* Maximum firmware DMA buffers per stream */ 121/* Maximum firmware DMA buffers per stream */
121#define CX18_MAX_FW_MDLS_PER_STREAM 63 122#define CX18_MAX_FW_MDLS_PER_STREAM 63
122 123
124/* YUV buffer sizes in bytes to ensure integer # of frames per buffer */
125#define CX18_UNIT_ENC_YUV_BUFSIZE (720 * 32 * 3 / 2) /* bytes */
126#define CX18_625_LINE_ENC_YUV_BUFSIZE (CX18_UNIT_ENC_YUV_BUFSIZE * 576/32)
127#define CX18_525_LINE_ENC_YUV_BUFSIZE (CX18_UNIT_ENC_YUV_BUFSIZE * 480/32)
128
123/* DMA buffer, default size in kB allocated */ 129/* DMA buffer, default size in kB allocated */
124#define CX18_DEFAULT_ENC_TS_BUFSIZE 32 130#define CX18_DEFAULT_ENC_TS_BUFSIZE 32
125#define CX18_DEFAULT_ENC_MPG_BUFSIZE 32 131#define CX18_DEFAULT_ENC_MPG_BUFSIZE 32
126#define CX18_DEFAULT_ENC_IDX_BUFSIZE 32 132#define CX18_DEFAULT_ENC_IDX_BUFSIZE 32
127#define CX18_DEFAULT_ENC_YUV_BUFSIZE 128 133#define CX18_DEFAULT_ENC_YUV_BUFSIZE (CX18_UNIT_ENC_YUV_BUFSIZE * 3 / 1024 + 1)
128/* Default VBI bufsize based on standards supported by card tuner for now */
129#define CX18_DEFAULT_ENC_PCM_BUFSIZE 4 134#define CX18_DEFAULT_ENC_PCM_BUFSIZE 4
130 135
131/* i2c stuff */ 136/* i2c stuff */
@@ -246,8 +251,8 @@ struct cx18_options {
246 int radio; /* enable/disable radio */ 251 int radio; /* enable/disable radio */
247}; 252};
248 253
249/* per-buffer bit flags */ 254/* per-mdl bit flags */
250#define CX18_F_B_NEED_BUF_SWAP 0 /* this buffer should be byte swapped */ 255#define CX18_F_M_NEED_SWAP 0 /* mdl buffer data must be endianess swapped */
251 256
252/* per-stream, s_flags */ 257/* per-stream, s_flags */
253#define CX18_F_S_CLAIMED 3 /* this stream is claimed */ 258#define CX18_F_S_CLAIMED 3 /* this stream is claimed */
@@ -274,18 +279,29 @@ struct cx18_options {
274struct cx18_buffer { 279struct cx18_buffer {
275 struct list_head list; 280 struct list_head list;
276 dma_addr_t dma_handle; 281 dma_addr_t dma_handle;
277 u32 id;
278 unsigned long b_flags;
279 unsigned skipped;
280 char *buf; 282 char *buf;
281 283
282 u32 bytesused; 284 u32 bytesused;
283 u32 readpos; 285 u32 readpos;
284}; 286};
285 287
288struct cx18_mdl {
289 struct list_head list;
290 u32 id; /* index into cx->scb->cpu_mdl[] of 1st cx18_mdl_ent */
291
292 unsigned int skipped;
293 unsigned long m_flags;
294
295 struct list_head buf_list;
296 struct cx18_buffer *curr_buf; /* current buffer in list for reading */
297
298 u32 bytesused;
299 u32 readpos;
300};
301
286struct cx18_queue { 302struct cx18_queue {
287 struct list_head list; 303 struct list_head list;
288 atomic_t buffers; 304 atomic_t depth;
289 u32 bytesused; 305 u32 bytesused;
290 spinlock_t lock; 306 spinlock_t lock;
291}; 307};
@@ -337,7 +353,7 @@ struct cx18_stream {
337 const char *name; /* name of the stream */ 353 const char *name; /* name of the stream */
338 int type; /* stream type */ 354 int type; /* stream type */
339 u32 handle; /* task handle */ 355 u32 handle; /* task handle */
340 unsigned mdl_offset; 356 unsigned int mdl_base_idx;
341 357
342 u32 id; 358 u32 id;
343 unsigned long s_flags; /* status flags, see above */ 359 unsigned long s_flags; /* status flags, see above */
@@ -346,14 +362,20 @@ struct cx18_stream {
346 PCI_DMA_NONE */ 362 PCI_DMA_NONE */
347 wait_queue_head_t waitq; 363 wait_queue_head_t waitq;
348 364
349 /* Buffer Stats */ 365 /* Buffers */
350 u32 buffers; 366 struct list_head buf_pool; /* buffers not attached to an MDL */
351 u32 buf_size; 367 u32 buffers; /* total buffers owned by this stream */
368 u32 buf_size; /* size in bytes of a single buffer */
369
370 /* MDL sizes - all stream MDLs are the same size */
371 u32 bufs_per_mdl;
372 u32 mdl_size; /* total bytes in all buffers in a mdl */
352 373
353 /* Buffer Queues */ 374 /* MDL Queues */
354 struct cx18_queue q_free; /* free buffers */ 375 struct cx18_queue q_free; /* free - in rotation, not committed */
355 struct cx18_queue q_busy; /* busy buffers - in use by firmware */ 376 struct cx18_queue q_busy; /* busy - in use by firmware */
356 struct cx18_queue q_full; /* full buffers - data for user apps */ 377 struct cx18_queue q_full; /* full - data for user apps */
378 struct cx18_queue q_idle; /* idle - not in rotation */
357 379
358 struct work_struct out_work_order; 380 struct work_struct out_work_order;
359 381
@@ -481,10 +503,11 @@ struct vbi_info {
481 u32 inserted_frame; 503 u32 inserted_frame;
482 504
483 /* 505 /*
484 * A dummy driver stream transfer buffer with a copy of the next 506 * A dummy driver stream transfer mdl & buffer with a copy of the next
485 * sliced_mpeg_data[] buffer for output to userland apps. 507 * sliced_mpeg_data[] buffer for output to userland apps.
486 * Only used in cx18-fileops.c, but its state needs to persist at times. 508 * Only used in cx18-fileops.c, but its state needs to persist at times.
487 */ 509 */
510 struct cx18_mdl sliced_mpeg_mdl;
488 struct cx18_buffer sliced_mpeg_buf; 511 struct cx18_buffer sliced_mpeg_buf;
489}; 512};
490 513
@@ -511,10 +534,9 @@ struct cx18 {
511 u8 is_60hz; 534 u8 is_60hz;
512 u8 nof_inputs; /* number of video inputs */ 535 u8 nof_inputs; /* number of video inputs */
513 u8 nof_audio_inputs; /* number of audio inputs */ 536 u8 nof_audio_inputs; /* number of audio inputs */
514 u16 buffer_id; /* buffer ID counter */
515 u32 v4l2_cap; /* V4L2 capabilities of card */ 537 u32 v4l2_cap; /* V4L2 capabilities of card */
516 u32 hw_flags; /* Hardware description of the board */ 538 u32 hw_flags; /* Hardware description of the board */
517 unsigned mdl_offset; 539 unsigned int free_mdl_idx;
518 struct cx18_scb __iomem *scb; /* pointer to SCB */ 540 struct cx18_scb __iomem *scb; /* pointer to SCB */
519 struct mutex epu2apu_mb_lock; /* protect driver to chip mailbox in SCB*/ 541 struct mutex epu2apu_mb_lock; /* protect driver to chip mailbox in SCB*/
520 struct mutex epu2cpu_mb_lock; /* protect driver to chip mailbox in SCB*/ 542 struct mutex epu2cpu_mb_lock; /* protect driver to chip mailbox in SCB*/
@@ -585,6 +607,8 @@ struct cx18 {
585 struct i2c_algo_bit_data i2c_algo[2]; 607 struct i2c_algo_bit_data i2c_algo[2];
586 struct cx18_i2c_algo_callback_data i2c_algo_cb_data[2]; 608 struct cx18_i2c_algo_callback_data i2c_algo_cb_data[2];
587 609
610 struct IR_i2c_init_data ir_i2c_init_data;
611
588 /* gpio */ 612 /* gpio */
589 u32 gpio_dir; 613 u32 gpio_dir;
590 u32 gpio_val; 614 u32 gpio_val;