1 /*
2  * Copyright (C) 2012 Texas Instruments Inc
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 in the hope that it will be useful,
9  * but WITHOUT ANY WARRANTY; without even the implied warranty of
10  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
11  * GNU General Public License for more details.
12  *
13  * You should have received a copy of the GNU General Public License
14  * along with this program; if not, write to the Free Software
15  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
16  *
17  * Contributors:
18  *      Manjunath Hadli <manjunath.hadli@ti.com>
19  *      Prabhakar Lad <prabhakar.lad@ti.com>
20  */
21 
22 #ifndef _DAVINCI_VPFE_DM365_IPIPEIF_USER_H
23 #define _DAVINCI_VPFE_DM365_IPIPEIF_USER_H
24 
25 /* clockdiv for IPIPE 5.1 */
26 struct ipipeif_5_1_clkdiv {
27 	unsigned char m;
28 	unsigned char n;
29 };
30 
31 enum ipipeif_decimation {
32 	IPIPEIF_DECIMATION_OFF,
33 	IPIPEIF_DECIMATION_ON
34 };
35 
36 /* DPC at the if for IPIPE 5.1 */
37 struct ipipeif_dpc {
38 	/* 0 - disable, 1 - enable */
39 	unsigned char en;
40 	/* threshold */
41 	unsigned short thr;
42 };
43 
44 enum ipipeif_clock {
45 	IPIPEIF_PIXCEL_CLK,
46 	IPIPEIF_SDRAM_CLK
47 };
48 
49 enum  ipipeif_avg_filter {
50 	IPIPEIF_AVG_OFF,
51 	IPIPEIF_AVG_ON
52 };
53 
54 struct ipipeif_5_1 {
55 	struct ipipeif_5_1_clkdiv clk_div;
56 	/* Defect pixel correction */
57 	struct ipipeif_dpc dpc;
58 	/* clipped to this value */
59 	unsigned short clip;
60 	/* Align HSync and VSync to rsz_start */
61 	unsigned char align_sync;
62 	/* resizer start position */
63 	unsigned int rsz_start;
64 	/* DF gain enable */
65 	unsigned char df_gain_en;
66 	/* DF gain value */
67 	unsigned short df_gain;
68 	/* DF gain threshold value */
69 	unsigned short df_gain_thr;
70 };
71 
72 struct ipipeif_params {
73 	enum ipipeif_clock clock_select;
74 	unsigned int ppln;
75 	unsigned int lpfr;
76 	unsigned char rsz;
77 	enum ipipeif_decimation decimation;
78 	enum ipipeif_avg_filter avg_filter;
79 	/* IPIPE 5.1 */
80 	struct ipipeif_5_1 if_5_1;
81 };
82 
83 /*
84  * Private IOCTL
85  * VIDIOC_VPFE_IPIPEIF_S_CONFIG: Set IPIEIF configuration
86  * VIDIOC_VPFE_IPIPEIF_G_CONFIG: Get IPIEIF configuration
87  */
88 #define VIDIOC_VPFE_IPIPEIF_S_CONFIG \
89 	_IOWR('I', BASE_VIDIOC_PRIVATE + 1, struct ipipeif_params)
90 #define VIDIOC_VPFE_IPIPEIF_G_CONFIG \
91 	_IOWR('I', BASE_VIDIOC_PRIVATE + 2, struct ipipeif_params)
92 
93 #endif		/* _DAVINCI_VPFE_DM365_IPIPEIF_USER_H */
94