]> git.karo-electronics.de Git - karo-tx-linux.git/blob - include/uapi/linux/pxp_dma.h
1e462f4193d262d1ff8016e5b724701acf8a7482
[karo-tx-linux.git] / include / uapi / linux / pxp_dma.h
1 /*
2  * Copyright (C) 2013-2014 Freescale Semiconductor, Inc. All Rights Reserved.
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.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program; if not, write to the Free Software
16  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
17  *
18  */
19 #ifndef _UAPI_PXP_DMA
20 #define _UAPI_PXP_DMA
21
22 #include <linux/posix_types.h>
23 #include <linux/types.h>
24
25 #ifndef __KERNEL__
26 typedef unsigned long dma_addr_t;
27 typedef unsigned char bool;
28 #endif
29
30 /*  PXP Pixel format definitions */
31 /*  Four-character-code (FOURCC) */
32 #define fourcc(a, b, c, d)\
33         (((__u32)(a)<<0)|((__u32)(b)<<8)|((__u32)(c)<<16)|((__u32)(d)<<24))
34
35 /*!
36  * @name PXP Pixel Formats
37  *
38  * Pixel formats are defined with ASCII FOURCC code. The pixel format codes are
39  * the same used by V4L2 API.
40  */
41
42 /*! @} */
43 /*! @name RGB Formats */
44 /*! @{ */
45 #define PXP_PIX_FMT_RGB332  fourcc('R', 'G', 'B', '1')  /*!<  8  RGB-3-3-2    */
46 #define PXP_PIX_FMT_RGB555  fourcc('R', 'G', 'B', 'O')  /*!< 16  RGB-5-5-5    */
47 #define PXP_PIX_FMT_RGB565  fourcc('R', 'G', 'B', 'P')  /*!< 1 6  RGB-5-6-5   */
48 #define PXP_PIX_FMT_RGB666  fourcc('R', 'G', 'B', '6')  /*!< 18  RGB-6-6-6    */
49 #define PXP_PIX_FMT_BGR666  fourcc('B', 'G', 'R', '6')  /*!< 18  BGR-6-6-6    */
50 #define PXP_PIX_FMT_BGR24   fourcc('B', 'G', 'R', '3')  /*!< 24  BGR-8-8-8    */
51 #define PXP_PIX_FMT_RGB24   fourcc('R', 'G', 'B', '3')  /*!< 24  RGB-8-8-8    */
52 #define PXP_PIX_FMT_BGR32   fourcc('B', 'G', 'R', '4')  /*!< 32  BGR-8-8-8-8  */
53 #define PXP_PIX_FMT_BGRA32  fourcc('B', 'G', 'R', 'A')  /*!< 32  BGR-8-8-8-8  */
54 #define PXP_PIX_FMT_RGB32   fourcc('R', 'G', 'B', '4')  /*!< 32  RGB-8-8-8-8  */
55 #define PXP_PIX_FMT_RGBA32  fourcc('R', 'G', 'B', 'A')  /*!< 32  RGB-8-8-8-8  */
56 #define PXP_PIX_FMT_ABGR32  fourcc('A', 'B', 'G', 'R')  /*!< 32  ABGR-8-8-8-8 */
57 /*! @} */
58 /*! @name YUV Interleaved Formats */
59 /*! @{ */
60 #define PXP_PIX_FMT_YUYV    fourcc('Y', 'U', 'Y', 'V')  /*!< 16 YUV 4:2:2 */
61 #define PXP_PIX_FMT_UYVY    fourcc('U', 'Y', 'V', 'Y')  /*!< 16 YUV 4:2:2 */
62 #define PXP_PIX_FMT_VYUY    fourcc('V', 'Y', 'U', 'Y')  /*!< 16 YVU 4:2:2 */
63 #define PXP_PIX_FMT_YVYU    fourcc('Y', 'V', 'Y', 'U')  /*!< 16 YVU 4:2:2 */
64 #define PXP_PIX_FMT_Y41P    fourcc('Y', '4', '1', 'P')  /*!< 12 YUV 4:1:1 */
65 #define PXP_PIX_FMT_YUV444  fourcc('Y', '4', '4', '4')  /*!< 24 YUV 4:4:4 */
66 /* two planes -- one Y, one Cb + Cr interleaved  */
67 #define PXP_PIX_FMT_NV12    fourcc('N', 'V', '1', '2')  /* 12  Y/CbCr 4:2:0  */
68 #define PXP_PIX_FMT_NV21    fourcc('N', 'V', '2', '1')  /* 12  Y/CbCr 4:2:0  */
69 #define PXP_PIX_FMT_NV16    fourcc('N', 'V', '1', '6')  /* 12  Y/CbCr 4:2:2  */
70 #define PXP_PIX_FMT_NV61    fourcc('N', 'V', '6', '1')  /* 12  Y/CbCr 4:2:2  */
71 /*! @} */
72 /*! @name YUV Planar Formats */
73 /*! @{ */
74 #define PXP_PIX_FMT_GREY    fourcc('G', 'R', 'E', 'Y')  /*!< 8  Greyscale */
75 #define PXP_PIX_FMT_GY04    fourcc('G', 'Y', '0', '4') /*!< 4  Greyscale */
76 #define PXP_PIX_FMT_YVU410P fourcc('Y', 'V', 'U', '9')  /*!< 9  YVU 4:1:0 */
77 #define PXP_PIX_FMT_YUV410P fourcc('Y', 'U', 'V', '9')  /*!< 9  YUV 4:1:0 */
78 #define PXP_PIX_FMT_YVU420P fourcc('Y', 'V', '1', '2')  /*!< 12 YVU 4:2:0 */
79 #define PXP_PIX_FMT_YUV420P fourcc('I', '4', '2', '0')  /*!< 12 YUV 4:2:0 */
80 #define PXP_PIX_FMT_YUV420P2 fourcc('Y', 'U', '1', '2') /*!< 12 YUV 4:2:0 */
81 #define PXP_PIX_FMT_YVU422P fourcc('Y', 'V', '1', '6')  /*!< 16 YVU 4:2:2 */
82 #define PXP_PIX_FMT_YUV422P fourcc('4', '2', '2', 'P')  /*!< 16 YUV 4:2:2 */
83 /*! @} */
84
85 #define PXP_LUT_NONE                    0x0
86 #define PXP_LUT_INVERT                  0x1
87 #define PXP_LUT_BLACK_WHITE             0x2
88 #define PXP_LUT_USE_CMAP                0x4
89
90 #define NR_PXP_VIRT_CHANNEL     16
91
92 /* Order significant! */
93 enum pxp_channel_status {
94         PXP_CHANNEL_FREE,
95         PXP_CHANNEL_INITIALIZED,
96         PXP_CHANNEL_READY,
97 };
98
99 struct rect {
100         int top;                /* Upper left coordinate of rectangle */
101         int left;
102         int width;
103         int height;
104 };
105
106 struct pxp_layer_param {
107         unsigned short width;
108         unsigned short height;
109         unsigned short stride; /* aka pitch */
110         unsigned int pixel_fmt;
111
112         /* layers combining parameters
113          * (these are ignored for S0 and output
114          * layers, and only apply for OL layer)
115          */
116         bool combine_enable;
117         unsigned int color_key_enable;
118         unsigned int color_key;
119         bool global_alpha_enable;
120         /* global alpha is either override or multiply */
121         bool global_override;
122         unsigned char global_alpha;
123         bool alpha_invert;
124         bool local_alpha_enable;
125
126         dma_addr_t paddr;
127 };
128
129 struct pxp_proc_data {
130         /* S0 Transformation Info */
131         int scaling;
132         int hflip;
133         int vflip;
134         int rotate;
135         int rot_pos;
136         int yuv;
137
138         /* Source rectangle (srect) defines the sub-rectangle
139          * within S0 to undergo processing.
140          */
141         struct rect srect;
142         /* Dest rect (drect) defines how to position the processed
143          * source rectangle (after resizing) within the output frame,
144          * whose dimensions are defined in pxp->pxp_conf_state.out_param
145          */
146         struct rect drect;
147
148         /* Current S0 configuration */
149         unsigned int bgcolor;
150
151         /* Output overlay support */
152         int overlay_state;
153
154         /* LUT transformation on Y data */
155         int lut_transform;
156         unsigned char *lut_map; /* 256 entries */
157         bool lut_map_updated; /* Map recently changed */
158         bool combine_enable;
159 };
160
161 struct pxp_config_data {
162         struct pxp_layer_param s0_param;
163         struct pxp_layer_param ol_param[8];
164         struct pxp_layer_param out_param;
165         struct pxp_proc_data proc_data;
166         int layer_nr;
167
168         /* Users don't touch */
169         int handle;
170 };
171
172
173 #endif