Merge tag 'nfsd-4.7' of git://linux-nfs.org/~bfields/linux
[deliverable/linux.git] / include / media / davinci / vpbe_display.h
1 /*
2 * Copyright (C) 2010 Texas Instruments Incorporated - http://www.ti.com/
3 *
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License as
6 * published by the Free Software Foundation version 2.
7 *
8 * This program is distributed WITHOUT ANY WARRANTY of any
9 * kind, whether express or implied; without even the implied warranty
10 * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 */
13 #ifndef VPBE_DISPLAY_H
14 #define VPBE_DISPLAY_H
15
16 /* Header files */
17 #include <linux/videodev2.h>
18 #include <media/v4l2-common.h>
19 #include <media/v4l2-fh.h>
20 #include <media/videobuf2-v4l2.h>
21 #include <media/videobuf2-dma-contig.h>
22 #include <media/davinci/vpbe_types.h>
23 #include <media/davinci/vpbe_osd.h>
24 #include <media/davinci/vpbe.h>
25
26 #define VPBE_DISPLAY_MAX_DEVICES 2
27
28 enum vpbe_display_device_id {
29 VPBE_DISPLAY_DEVICE_0,
30 VPBE_DISPLAY_DEVICE_1
31 };
32
33 #define VPBE_DISPLAY_DRV_NAME "vpbe-display"
34
35 #define VPBE_DISPLAY_MAJOR_RELEASE 1
36 #define VPBE_DISPLAY_MINOR_RELEASE 0
37 #define VPBE_DISPLAY_BUILD 1
38 #define VPBE_DISPLAY_VERSION_CODE ((VPBE_DISPLAY_MAJOR_RELEASE << 16) | \
39 (VPBE_DISPLAY_MINOR_RELEASE << 8) | \
40 VPBE_DISPLAY_BUILD)
41
42 #define VPBE_DISPLAY_VALID_FIELD(field) ((V4L2_FIELD_NONE == field) || \
43 (V4L2_FIELD_ANY == field) || (V4L2_FIELD_INTERLACED == field))
44
45 /* Exp ratio numerator and denominator constants */
46 #define VPBE_DISPLAY_H_EXP_RATIO_N 9
47 #define VPBE_DISPLAY_H_EXP_RATIO_D 8
48 #define VPBE_DISPLAY_V_EXP_RATIO_N 6
49 #define VPBE_DISPLAY_V_EXP_RATIO_D 5
50
51 /* Zoom multiplication factor */
52 #define VPBE_DISPLAY_ZOOM_4X 4
53 #define VPBE_DISPLAY_ZOOM_2X 2
54
55 /* Structures */
56 struct display_layer_info {
57 int enable;
58 /* Layer ID used by Display Manager */
59 enum osd_layer id;
60 struct osd_layer_config config;
61 enum osd_zoom_factor h_zoom;
62 enum osd_zoom_factor v_zoom;
63 enum osd_h_exp_ratio h_exp;
64 enum osd_v_exp_ratio v_exp;
65 };
66
67 struct vpbe_disp_buffer {
68 struct vb2_v4l2_buffer vb;
69 struct list_head list;
70 };
71
72 /* vpbe display object structure */
73 struct vpbe_layer {
74 /* Pointer to the vpbe_display */
75 struct vpbe_display *disp_dev;
76 /* Pointer pointing to current v4l2_buffer */
77 struct vpbe_disp_buffer *cur_frm;
78 /* Pointer pointing to next v4l2_buffer */
79 struct vpbe_disp_buffer *next_frm;
80 /* videobuf specific parameters
81 * Buffer queue used in video-buf
82 */
83 struct vb2_queue buffer_queue;
84 /* allocator-specific contexts for each plane */
85 struct vb2_alloc_ctx *alloc_ctx;
86 /* Queue of filled frames */
87 struct list_head dma_queue;
88 /* Used in video-buf */
89 spinlock_t irqlock;
90 /* V4l2 specific parameters */
91 /* Identifies video device for this layer */
92 struct video_device video_dev;
93 /* Used to store pixel format */
94 struct v4l2_pix_format pix_fmt;
95 enum v4l2_field buf_field;
96 /* Video layer configuration params */
97 struct display_layer_info layer_info;
98 /* vpbe specific parameters
99 * enable window for display
100 */
101 unsigned char window_enable;
102 /* number of open instances of the layer */
103 unsigned int usrs;
104 /* Indicates id of the field which is being displayed */
105 unsigned int field_id;
106 /* Identifies device object */
107 enum vpbe_display_device_id device_id;
108 /* facilitation of ioctl ops lock by v4l2*/
109 struct mutex opslock;
110 u8 layer_first_int;
111 };
112
113 /* vpbe device structure */
114 struct vpbe_display {
115 /* layer specific parameters */
116 /* lock for isr updates to buf layers*/
117 spinlock_t dma_queue_lock;
118 /* C-Plane offset from start of y-plane */
119 unsigned int cbcr_ofst;
120 struct vpbe_layer *dev[VPBE_DISPLAY_MAX_DEVICES];
121 struct vpbe_device *vpbe_dev;
122 struct osd_state *osd_device;
123 };
124
125 struct buf_config_params {
126 unsigned char min_numbuffers;
127 unsigned char numbuffers[VPBE_DISPLAY_MAX_DEVICES];
128 unsigned int min_bufsize[VPBE_DISPLAY_MAX_DEVICES];
129 unsigned int layer_bufsize[VPBE_DISPLAY_MAX_DEVICES];
130 };
131
132 #endif /* VPBE_DISPLAY_H */
This page took 0.05194 seconds and 5 git commands to generate.