2 * Copyright (C) 2009 Texas Instruments Inc
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
15 #ifndef VPIF_CAPTURE_H
16 #define VPIF_CAPTURE_H
19 #include <media/videobuf2-dma-contig.h>
20 #include <media/v4l2-device.h>
25 #define VPIF_CAPTURE_VERSION "0.0.2"
27 #define VPIF_VALID_FIELD(field) (((V4L2_FIELD_ANY == field) || \
28 (V4L2_FIELD_NONE == field)) || \
29 (((V4L2_FIELD_INTERLACED == field) || \
30 (V4L2_FIELD_SEQ_TB == field)) || \
31 (V4L2_FIELD_SEQ_BT == field)))
33 #define VPIF_CAPTURE_MAX_DEVICES 2
34 #define VPIF_VIDEO_INDEX 0
35 #define VPIF_NUMBER_OF_OBJECTS 1
37 /* Enumerated data type to give id to each device per channel */
38 enum vpif_channel_id
{
39 VPIF_CHANNEL0_VIDEO
= 0,
44 enum v4l2_field buf_field
;
45 /* Currently selected or default standard */
47 struct v4l2_dv_timings dv_timings
;
50 struct vpif_cap_buffer
{
51 struct vb2_v4l2_buffer vb
;
52 struct list_head list
;
56 /* Pointer pointing to current v4l2_buffer */
57 struct vpif_cap_buffer
*cur_frm
;
58 /* Pointer pointing to current v4l2_buffer */
59 struct vpif_cap_buffer
*next_frm
;
60 /* Used to store pixel format */
61 struct v4l2_format fmt
;
62 /* Buffer queue used in video-buf */
63 struct vb2_queue buffer_queue
;
64 /* Queue of filled frames */
65 struct list_head dma_queue
;
66 /* Protects the dma_queue field */
68 /* lock used to access this structure */
70 /* Function pointer to set the addresses */
71 void (*set_addr
) (unsigned long, unsigned long, unsigned long,
73 /* offset where Y top starts from the starting of the buffer */
75 /* offset where Y bottom starts from the starting of the buffer */
77 /* offset where C top starts from the starting of the buffer */
79 /* offset where C bottom starts from the starting of the buffer */
81 /* Indicates width of the image data */
83 /* Indicates height of the image data */
88 /* Identifies video device for this channel */
89 struct video_device video_dev
;
90 /* Indicates id of the field which is being displayed */
92 /* flag to indicate whether decoder is initialized */
94 /* Identifies channel */
95 enum vpif_channel_id channel_id
;
98 /* subdev corresponding to the current input, may be NULL */
99 struct v4l2_subdev
*sd
;
100 /* vpif configuration params */
101 struct vpif_params vpifparams
;
102 /* common object array */
103 struct common_obj common
[VPIF_NUMBER_OF_OBJECTS
];
105 struct video_obj video
;
109 struct v4l2_device v4l2_dev
;
110 struct channel_obj
*dev
[VPIF_CAPTURE_NUM_CHANNELS
];
111 struct v4l2_subdev
**sd
;
112 struct v4l2_async_notifier notifier
;
113 struct vpif_capture_config
*config
;
116 #endif /* VPIF_CAPTURE_H */