1 /*
2  * Allwinner SoCs display driver.
3  *
4  * Copyright (C) 2016 Allwinner.
5  *
6  * This file is licensed under the terms of the GNU General Public
7  * License version 2.  This program is licensed "as is" without any
8  * warranty of any kind, whether express or implied.
9  */
10 
11 /*******************************************************************************
12  *  All Winner Tech, All Right Reserved. 2014-2015 Copyright (c)
13  *
14  *  File name   :   de_lti_type.h
15  *
16  *  Description :   display engine 2.0 lti struct declaration
17  *
18  *  History     :   2014/04/01  vito cheng  v0.1  Initial version
19  *
20  ******************************************************************************/
21 
22 #ifndef __DE_LTI_TYPE_H__
23 #define __DE_LTI_TYPE_H__
24 
25 #include "de_rtmx.h"
26 
27 #define LTI_PARA_NUM 1
28 #define LTI_MODE_NUM 2
29 
30 union LTI_EN {
31     unsigned int dwval;
32     struct {
33         unsigned int en:1;
34         unsigned int res0:7;
35         unsigned int sel:1;
36         unsigned int res1:7;
37         unsigned int nonl_en:1;
38         unsigned int res2:7;
39         unsigned int win_en:1;
40         unsigned int res3:7;
41 
42     } bits;
43 };
44 
45 union LTI_SIZE {
46     unsigned int dwval;
47     struct {
48         unsigned int width:12;
49         unsigned int res0:4;
50         unsigned int height:12;
51         unsigned int res1:4;
52     } bits;
53 };
54 
55 union LTI_FIR_COFF0 {
56     unsigned int dwval;
57     struct {
58         unsigned int c0:8;
59         unsigned int res0:8;
60         unsigned int c1:8;
61         unsigned int res1:8;
62     } bits;
63 };
64 union LTI_FIR_COFF1 {
65     unsigned int dwval;
66     struct {
67         unsigned int c2:8;
68         unsigned int res0:8;
69         unsigned int c3:8;
70         unsigned int res1:8;
71     } bits;
72 };
73 union LTI_FIR_COFF2 {
74     unsigned int dwval;
75     struct {
76         unsigned int c4:8;
77         unsigned int res0:24;
78     } bits;
79 };
80 
81 union LTI_FIR_GAIN {
82     unsigned int dwval;
83     struct {
84         unsigned int lti_fil_gain:4;
85         unsigned int res0:28;
86 
87     } bits;
88 };
89 
90 union LTI_COR_TH {
91     unsigned int dwval;
92     struct {
93         unsigned int lti_cor_th:10;
94         unsigned int res0:22;
95     } bits;
96 };
97 
98 union LTI_DIFF_CTL {
99     unsigned int dwval;
100     struct {
101         unsigned int offset:8;
102         unsigned int res0:8;
103         unsigned int slope:5;
104         unsigned int res1:11;
105     } bits;
106 };
107 
108 union LTI_EDGE_GAIN {
109     unsigned int dwval;
110     struct {
111         unsigned int edge_gain:5;
112         unsigned int res0:27;
113     } bits;
114 };
115 
116 union LTI_OS_CON {
117     unsigned int dwval;
118     struct {
119         unsigned int core_x:8;
120         unsigned int res0:8;
121         unsigned int clip:8;
122         unsigned int res1:4;
123         unsigned int peak_limit:3;
124         unsigned int res2:1;
125     } bits;
126 };
127 
128 union LTI_WIN_EXPANSION {
129     unsigned int dwval;
130     struct {
131         unsigned int win_range:8;
132         unsigned int res0:24;
133     } bits;
134 };
135 
136 union LTI_EDGE_ELVEL_TH {
137     unsigned int dwval;
138     struct {
139         unsigned int elvel_th:8;
140         unsigned int res0:24;
141     } bits;
142 };
143 
144 union LTI_WIN0_REG {
145     unsigned int dwval;
146     struct {
147         unsigned int win_left:12;
148         unsigned int res0:4;
149         unsigned int win_top:12;
150         unsigned int res1:4;
151     } bits;
152 };
153 
154 union LTI_WIN1_REG {
155     unsigned int dwval;
156     struct {
157         unsigned int win_right:12;
158         unsigned int res0:4;
159         unsigned int win_bot:12;
160         unsigned int res1:4;
161     } bits;
162 };
163 
164 struct __lti_reg_t {
165     union LTI_EN ctrl;                     /* 0x0000 */
166     unsigned int res0[2];            /* 0x0004-0x0008 */
167     union LTI_SIZE size;                     /* 0x000c */
168     union LTI_FIR_COFF0 coef0;           /* 0x0010 */
169     union LTI_FIR_COFF1 coef1;           /* 0x0014 */
170     union LTI_FIR_COFF2 coef2;           /* 0x0018 */
171     union LTI_FIR_GAIN gain;               /* 0x001c */
172     union LTI_COR_TH corth;              /* 0x0020 */
173     union LTI_DIFF_CTL diff;               /* 0x0024 */
174     union LTI_EDGE_GAIN edge_gain;       /* 0x0028 */
175     union LTI_OS_CON os_con;               /* 0x002c */
176     union LTI_WIN_EXPANSION win_range;   /* 0x0030 */
177     union LTI_EDGE_ELVEL_TH elvel_th;      /* 0x0034 */
178     union LTI_WIN0_REG win0;               /* 0x0038 */
179     union LTI_WIN1_REG win1;               /* 0x003c */
180 };
181 
182 struct __lti_config_data {
183     /* lti */
184     unsigned int lti_en;
185     unsigned int gain;
186 
187     /* window */
188     unsigned int win_en;
189     struct de_rect win;
190 
191 };
192 
193 #endif
194