]> git.proxmox.com Git - mirror_ubuntu-artful-kernel.git/blame - drivers/media/platform/davinci/vpif_capture.h
Merge branches 'for-4.11/upstream-fixes', 'for-4.12/accutouch', 'for-4.12/cp2112...
[mirror_ubuntu-artful-kernel.git] / drivers / media / platform / davinci / vpif_capture.h
CommitLineData
6ffefff5
MK
1/*
2 * Copyright (C) 2009 Texas Instruments Inc
3 *
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.
8 *
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.
6ffefff5
MK
13 */
14
15#ifndef VPIF_CAPTURE_H
16#define VPIF_CAPTURE_H
17
6ffefff5 18/* Header files */
60aa38d8 19#include <media/videobuf2-dma-contig.h>
012eef70 20#include <media/v4l2-device.h>
6ffefff5
MK
21
22#include "vpif.h"
23
24/* Macros */
64dc3c1a 25#define VPIF_CAPTURE_VERSION "0.0.2"
6ffefff5
MK
26
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)))
32
33#define VPIF_CAPTURE_MAX_DEVICES 2
34#define VPIF_VIDEO_INDEX 0
35#define VPIF_NUMBER_OF_OBJECTS 1
36
37/* Enumerated data type to give id to each device per channel */
38enum vpif_channel_id {
39 VPIF_CHANNEL0_VIDEO = 0,
40 VPIF_CHANNEL1_VIDEO,
41};
42
43struct video_obj {
44 enum v4l2_field buf_field;
45 /* Currently selected or default standard */
46 v4l2_std_id stdid;
0598c17b 47 struct v4l2_dv_timings dv_timings;
6ffefff5
MK
48};
49
60aa38d8 50struct vpif_cap_buffer {
2d700715 51 struct vb2_v4l2_buffer vb;
60aa38d8
LP
52 struct list_head list;
53};
54
6ffefff5
MK
55struct common_obj {
56 /* Pointer pointing to current v4l2_buffer */
60aa38d8 57 struct vpif_cap_buffer *cur_frm;
6ffefff5 58 /* Pointer pointing to current v4l2_buffer */
60aa38d8 59 struct vpif_cap_buffer *next_frm;
6ffefff5
MK
60 /* Used to store pixel format */
61 struct v4l2_format fmt;
62 /* Buffer queue used in video-buf */
60aa38d8 63 struct vb2_queue buffer_queue;
6ffefff5
MK
64 /* Queue of filled frames */
65 struct list_head dma_queue;
62dd4acd 66 /* Protects the dma_queue field */
6ffefff5
MK
67 spinlock_t irqlock;
68 /* lock used to access this structure */
69 struct mutex lock;
6ffefff5
MK
70 /* Function pointer to set the addresses */
71 void (*set_addr) (unsigned long, unsigned long, unsigned long,
72 unsigned long);
73 /* offset where Y top starts from the starting of the buffer */
74 u32 ytop_off;
75 /* offset where Y bottom starts from the starting of the buffer */
76 u32 ybtm_off;
77 /* offset where C top starts from the starting of the buffer */
78 u32 ctop_off;
79 /* offset where C bottom starts from the starting of the buffer */
80 u32 cbtm_off;
81 /* Indicates width of the image data */
82 u32 width;
83 /* Indicates height of the image data */
84 u32 height;
85};
86
87struct channel_obj {
88 /* Identifies video device for this channel */
8eef6669 89 struct video_device video_dev;
6ffefff5
MK
90 /* Indicates id of the field which is being displayed */
91 u32 field_id;
92 /* flag to indicate whether decoder is initialized */
93 u8 initialized;
94 /* Identifies channel */
95 enum vpif_channel_id channel_id;
6f47c6c6
HV
96 /* Current input */
97 u32 input_idx;
178cce12
HV
98 /* subdev corresponding to the current input, may be NULL */
99 struct v4l2_subdev *sd;
6ffefff5
MK
100 /* vpif configuration params */
101 struct vpif_params vpifparams;
102 /* common object array */
103 struct common_obj common[VPIF_NUMBER_OF_OBJECTS];
104 /* video object */
105 struct video_obj video;
106};
107
6ffefff5
MK
108struct vpif_device {
109 struct v4l2_device v4l2_dev;
110 struct channel_obj *dev[VPIF_CAPTURE_NUM_CHANNELS];
111 struct v4l2_subdev **sd;
873229e4
LP
112 struct v4l2_async_notifier notifier;
113 struct vpif_capture_config *config;
6ffefff5
MK
114};
115
6ffefff5 116#endif /* VPIF_CAPTURE_H */