aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorSandor Yu <R01008@freescale.com>2014-07-01 03:51:20 -0400
committerSandor Yu <R01008@freescale.com>2014-07-03 04:16:55 -0400
commit6193c09144f928d72b0474be28865489bb550cfe (patch)
tree99b410c6b59ab5e4f7ce63ed0f7c7c86a1376d30 /include
parentafdee488043af1ca3568f3a7a69e0d4b019e92b4 (diff)
ENGR00317086-3 dcic: Add dcic driver source code
Add dcic driver source code. Support two instance dcic1 and dcic2. Signed-off-by: Sandor Yu <R01008@freescale.com> (cherry picked from commit 5dd90299f33e93252bd1cc7a9704adb9f469fa66)
Diffstat (limited to 'include')
-rw-r--r--include/linux/mxc_dcic.h134
-rw-r--r--include/uapi/linux/mxc_dcic.h47
2 files changed, 181 insertions, 0 deletions
diff --git a/include/linux/mxc_dcic.h b/include/linux/mxc_dcic.h
new file mode 100644
index 000000000000..9f0ebc57bd60
--- /dev/null
+++ b/include/linux/mxc_dcic.h
@@ -0,0 +1,134 @@
1/*
2 * Copyright (C) 2014 Freescale Semiconductor, Inc. All Rights Reserved
3 */
4
5/*
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License along
17 * with this program; if not, write to the Free Software Foundation, Inc.,
18 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
19 */
20
21/*!
22 * @file linux/mxc_dcic.h
23 *
24 * @brief Global header file for the MXC DCIC driver
25 *
26 * @ingroup MXC DCIC
27 */
28
29#ifndef __LINUX_DCIC_H__
30#define __LINUX_DCIC_H__
31
32#include <uapi/linux/mxc_dcic.h>
33
34#define DCICC_IC_ENABLE 0x1
35#define DCICC_IC_DISABLE 0x0
36#define DCICC_IC_MASK 0x1
37#define DCICC_DE_ACTIVE_HIGH 0
38#define DCICC_DE_ACTIVE_LOW (0x1 << 4)
39#define DCICC_DE_ACTIVE_MASK (0x1 << 4)
40#define DCICC_HSYNC_POL_ACTIVE_HIGH 0
41#define DCICC_HSYNC_POL_ACTIVE_LOW (0x1 << 5)
42#define DCICC_HSYNC_POL_ACTIVE_MASK (0x1 << 5)
43#define DCICC_VSYNC_POL_ACTIVE_HIGH 0
44#define DCICC_VSYNC_POL_ACTIVE_LOW (0x1 << 6)
45#define DCICC_VSYNC_POL_ACTIVE_MASK (0x1 << 6)
46#define DCICC_CLK_POL_NO_INVERTED 0
47#define DCICC_CLK_POL_INVERTED (0x1 << 7)
48#define DCICC_CLK_POL_INVERTED_MASK (0x1 << 7)
49
50#define DCICIC_ERROR_INT_DISABLE 1
51#define DCICIC_ERROR_INT_ENABLE 0
52#define DCICIC_ERROR_INT_MASK_MASK 1
53#define DCICIC_FUN_INT_DISABLE (0x1 << 1)
54#define DCICIC_FUN_INT_ENABLE 0
55#define DCICIC_FUN_INT_MASK (0x1 << 1)
56#define DCICIC_FREEZE_MASK_CHANGED 0
57#define DCICIC_FREEZE_MASK_FORZEN (0x1 << 3)
58#define DCICIC_FREEZE_MASK_MASK (0x1 << 3)
59#define DCICIC_EXT_SIG_EX_DISABLE 0
60#define DCICIC_EXT_SIG_EN_ENABLE (0x1 << 16)
61#define DCICIC_EXT_SIG_EN_MASK (0x1 << 16)
62
63#define DCICS_ROI_MATCH_STAT_MASK 0xFFFF
64#define DCICS_EI_STAT_PENDING (0x1 << 16)
65#define DCICS_EI_STAT_NO_PENDING 0
66#define DCICS_FI_STAT_PENDING (0x1 << 17)
67#define DCICS_FI_STAT_NO_PENDING 0
68
69#define DCICRC_ROI_START_OFFSET_X_MASK 0x1FFF
70#define DCICRC_ROI_START_OFFSET_X_SHIFT 0
71#define DCICRC_ROI_START_OFFSET_Y_MASK (0xFFF << 16)
72#define DCICRC_ROI_START_OFFSET_Y_SHIFT 16
73#define DCICRC_ROI_CHANGED 0
74#define DCICRC_ROI_FROZEN (0x1 << 30)
75#define DCICRC_ROI_ENABLE (0x1 << 31)
76#define DCICRC_ROI_DISABLE 0
77
78#define DCICRS_ROI_END_OFFSET_X_MASK 0x1FFF
79#define DCICRS_ROI_END_OFFSET_X_SHIFT 0
80#define DCICRS_ROI_END_OFFSET_Y_MASK (0xFFF << 16)
81#define DCICRS_ROI_END_OFFSET_Y_SHIFT 16
82
83struct roi_regs {
84 u32 dcicrc;
85 u32 dcicrs;
86 u32 dcicrrs;
87 u32 dcicrcs;
88};
89
90struct dcic_regs {
91 u32 dcicc;
92 u32 dcicic;
93 u32 dcics;
94 u32 dcic_reserved;
95 struct roi_regs ROI[16];
96};
97
98struct dcic_mux {
99 char dcic[16];
100 u32 val;
101};
102
103struct bus_mux {
104 char name[16];
105 int reg;
106 int shift;
107 int mask;
108 int dcic_mux_num;
109 const struct dcic_mux *dcics;
110};
111
112struct dcic_info {
113 int bus_mux_num;
114 const struct bus_mux *buses;
115};
116
117struct dcic_data {
118 struct regmap *regmap;
119 struct device *dev;
120 struct dcic_regs *regs;
121 const struct bus_mux *buses;
122 u32 bus_n;
123 u32 mux_n;
124 struct clk *disp_axi_clk;
125 struct clk *dcic_clk;
126 struct mutex lock;
127 struct completion roi_crc_comp;
128 struct class *class;
129 int major;
130 struct cdev cdev; /* Char device structure */
131 dev_t devt;
132 unsigned int result;
133};
134#endif
diff --git a/include/uapi/linux/mxc_dcic.h b/include/uapi/linux/mxc_dcic.h
new file mode 100644
index 000000000000..cbcacaa64b3c
--- /dev/null
+++ b/include/uapi/linux/mxc_dcic.h
@@ -0,0 +1,47 @@
1/*
2 * Copyright (C) 2014 Freescale Semiconductor, Inc. All Rights Reserved
3 */
4
5/*
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License along
17 * with this program; if not, write to the Free Software Foundation, Inc.,
18 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
19 */
20
21/*!
22 * @file uapi/linux/mxc_dcic.h
23 *
24 * @brief MXC DCIC private header file
25 *
26 * @ingroup MXC DCIC
27 */
28#ifndef __ASM_ARCH_MXC_DCIC_H__
29#define __ASM_ARCH_MXC_DCIC_H__
30
31#define DCIC_IOC_ALLOC_ROI_NUM _IO('D', 10)
32#define DCIC_IOC_FREE_ROI_NUM _IO('D', 11)
33#define DCIC_IOC_CONFIG_DCIC _IO('D', 12)
34#define DCIC_IOC_CONFIG_ROI _IO('D', 13)
35#define DCIC_IOC_GET_RESULT _IO('D', 14)
36
37struct roi_params {
38 unsigned int roi_n;
39 unsigned int ref_sig;
40 unsigned int start_y;
41 unsigned int start_x;
42 unsigned int end_y;
43 unsigned int end_x;
44 char freeze;
45};
46
47#endif