blob: 11f471cd2ec8080ae0e6ebc414c9bf909a1f64c5 [file] [log] [blame]
Aravind Venkateswaran31119842015-01-13 14:46:04 -08001/* Copyright (c) 2013-2015, The Linux Foundation. All rights reserved.
Arpita Banerjee841fa062013-05-24 14:59:51 -07002 *
3 * Redistribution and use in source and binary forms, with or without
4 * modification, are permitted provided that the following conditions
5 * are met:
6 * * Redistributions of source code must retain the above copyright
7 * notice, this list of conditions and the following disclaimer.
8 * * Redistributions in binary form must reproduce the above copyright
9 * notice, this list of conditions and the following disclaimer in
10 * the documentation and/or other materials provided with the
11 * distribution.
12 * * Neither the name of The Linux Foundation nor the names of its
13 * contributors may be used to endorse or promote products derived
14 * from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
17 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
18 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
19 * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
20 * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
21 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
22 * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
23 * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
24 * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
25 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
26 * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
27 * SUCH DAMAGE.
28 */
29
30#ifndef _PANEL_H_
31#define _PANEL_H_
32
33/*---------------------------------------------------------------------------*/
34/* HEADER files */
35/*---------------------------------------------------------------------------*/
36#include <debug.h>
37#include <smem.h>
38
Casey Piper5197f932013-08-14 17:27:29 -070039#define TOTAL_RESET_GPIO_CTRL 5
40
Vineet Bajajfeef0a92015-04-29 17:09:44 +053041#define ADV7533_MAIN (0x39)
42#define ADV7533_CEC_DSI (0x3c)
43
Arpita Banerjee841fa062013-05-24 14:59:51 -070044/*---------------------------------------------------------------------------*/
Veera Sundaram Sankaran824e6fa2014-12-09 11:32:58 -080045/* panel type */
Kuogee Hsieh80b8a6c2014-06-09 17:25:38 -070046/*---------------------------------------------------------------------------*/
47enum {
48 PANEL_TYPE_UNKNOWN,
49 PANEL_TYPE_DSI,
50 PANEL_TYPE_EDP,
51 PANEL_TYPE_HDMI
52};
53
54/*---------------------------------------------------------------------------*/
Arpita Banerjee841fa062013-05-24 14:59:51 -070055/* Structure definition */
56/*---------------------------------------------------------------------------*/
57
58/*Panel Configuration */
Veera Sundaram Sankaran824e6fa2014-12-09 11:32:58 -080059struct panel_config{
Arpita Banerjee841fa062013-05-24 14:59:51 -070060
Dhaval Patel9f61f132013-07-18 14:45:11 -070061 char *panel_node_id;
Arpita Banerjee841fa062013-05-24 14:59:51 -070062 char *panel_controller;
63 char *panel_compatible;
64 uint16_t panel_interface;
65 uint16_t panel_type;
66 char *panel_destination;
67 uint32_t panel_orientation;
Aravind Venkateswaran31119842015-01-13 14:46:04 -080068 /* panel_clockrate is deprecated in favor of panel_bitclock_freq */
Arpita Banerjee841fa062013-05-24 14:59:51 -070069 uint32_t panel_clockrate;
70 uint16_t panel_framerate;
71 uint16_t panel_channelid;
72 uint16_t dsi_virtualchannel_id;
73 uint16_t panel_broadcast_mode;
Dhaval Patel729aa972014-01-06 15:20:01 -080074 uint16_t panel_lp11_init;
75 uint16_t panel_init_delay;
Arpita Banerjee841fa062013-05-24 14:59:51 -070076 uint16_t dsi_stream;
77 uint8_t interleave_mode;
78 uint32_t panel_bitclock_freq;
79 uint32_t panel_operating_mode;
80 uint32_t panel_with_enable_gpio;
Dhaval Patel29f24492013-08-08 20:45:42 -070081 uint8_t mode_gpio_state;
Dhaval Patel3f4876a2014-01-03 13:33:20 -080082 char *slave_panel_node_id;
Arpita Banerjee841fa062013-05-24 14:59:51 -070083};
84
Veera Sundaram Sankaran824e6fa2014-12-09 11:32:58 -080085struct panel_resolution{
Arpita Banerjee841fa062013-05-24 14:59:51 -070086
87 uint16_t panel_width;
88 uint16_t panel_height;
89 uint16_t hfront_porch;
90 uint16_t hback_porch;
91 uint16_t hpulse_width;
92 uint16_t hsync_skew;
93 uint16_t vfront_porch;
94 uint16_t vback_porch;
95 uint16_t vpulse_width;
96 uint16_t hleft_border;
97 uint16_t hright_border;
98 uint16_t vtop_border;
99 uint16_t vbottom_border;
100 uint16_t hactive_res;
101 uint16_t vactive_res;
102 uint16_t invert_data_polarity;
103 uint16_t invert_vsync_polarity;
104 uint16_t invert_hsync_polarity;
105};
106
Veera Sundaram Sankaran824e6fa2014-12-09 11:32:58 -0800107struct color_info{
Arpita Banerjee841fa062013-05-24 14:59:51 -0700108 uint8_t color_format;
109 uint8_t color_order;
110 uint8_t underflow_color;
111 uint8_t border_color;
112 uint8_t pixel_packing;
113 uint8_t pixel_alignment;
114};
115
Veera Sundaram Sankaran824e6fa2014-12-09 11:32:58 -0800116struct command_state {
Arpita Banerjee841fa062013-05-24 14:59:51 -0700117 uint8_t oncommand_state;
118 uint8_t offcommand_state;
119};
120
Veera Sundaram Sankaran824e6fa2014-12-09 11:32:58 -0800121struct videopanel_info {
Arpita Banerjee841fa062013-05-24 14:59:51 -0700122 uint8_t hsync_pulse;
123 uint8_t hfp_power_mode;
124 uint8_t hbp_power_mode;
125 uint8_t hsa_power_mode;
126 uint8_t bllp_eof_power_mode;
127 uint8_t bllp_power_mode;
128 uint8_t traffic_mode;
129 uint8_t dma_delayafter_vsync;
130 uint32_t bllp_eof_power;
131};
132
Veera Sundaram Sankaran824e6fa2014-12-09 11:32:58 -0800133struct commandpanel_info {
Arpita Banerjee841fa062013-05-24 14:59:51 -0700134 uint8_t techeck_enable;
135 uint8_t tepin_select;
136 uint8_t teusing_tepin;
137 uint8_t autorefresh_enable;
138 uint32_t autorefresh_framenumdiv;
139 uint32_t tevsync_rdptr_irqline;
140 uint32_t tevsync_continue_lines;
141 uint32_t tevsync_startline_divisor;
142 uint32_t tepercent_variance;
143 uint8_t tedcs_command;
144 uint8_t disable_eotafter_hsxfer;
145 uint32_t cmdmode_idletime;
146};
147
Veera Sundaram Sankaran824e6fa2014-12-09 11:32:58 -0800148struct lane_configuration {
Arpita Banerjee841fa062013-05-24 14:59:51 -0700149 uint8_t dsi_lanes;
150 uint8_t dsi_lanemap;
151 uint8_t lane0_state;
152 uint8_t lane1_state;
153 uint8_t lane2_state;
154 uint8_t lane3_state;
Ray Zhang0d303af2015-01-21 10:17:02 +0800155 uint8_t force_clk_lane_hs;
Arpita Banerjee841fa062013-05-24 14:59:51 -0700156};
157
Veera Sundaram Sankaran824e6fa2014-12-09 11:32:58 -0800158struct panel_timing {
Arpita Banerjee841fa062013-05-24 14:59:51 -0700159 uint8_t dsi_mdp_trigger;
160 uint8_t dsi_dma_trigger;
161 uint8_t tclk_post;
162 uint8_t tclk_pre;
163};
164
rayz3c988f02013-08-13 18:06:39 +0800165enum {
166 BL_PWM = 0,
167 BL_WLED,
168 BL_DCS,
rayz3c988f02013-08-13 18:06:39 +0800169};
170
Veera Sundaram Sankaran824e6fa2014-12-09 11:32:58 -0800171struct panel_reset_sequence {
Casey Piper5197f932013-08-14 17:27:29 -0700172 uint8_t pin_state[TOTAL_RESET_GPIO_CTRL];
173 uint32_t sleep[TOTAL_RESET_GPIO_CTRL];
174 uint8_t pin_direction;
175};
176
Veera Sundaram Sankaran824e6fa2014-12-09 11:32:58 -0800177struct backlight {
Arpita Banerjee841fa062013-05-24 14:59:51 -0700178 uint16_t bl_interface_type;
179 uint16_t bl_min_level;
180 uint16_t bl_max_level;
181 uint16_t bl_step;
182 uint16_t bl_pmic_controltype;
183 char *bl_pmic_model;
Arpita Banerjee841fa062013-05-24 14:59:51 -0700184};
185
Veera Sundaram Sankaran824e6fa2014-12-09 11:32:58 -0800186struct fb_compression {
Siddhartha Agrawalfe64dcb2014-10-07 12:41:01 -0700187 uint32_t enabled;
188 uint32_t comp_ratio;
189 uint32_t comp_mode;
190 uint32_t qerr_enable;
191 uint32_t cd_bias;
192 uint32_t pat_enable;
193 uint32_t vlc_enable;
194 uint32_t bflc_enable;
195
196 uint32_t line_x_budget;
197 uint32_t block_x_budget;
198 uint32_t block_budget;
199
200 uint32_t lossless_mode_thd;
201 uint32_t lossy_mode_thd;
202 uint32_t lossy_rgb_thd;
203 uint32_t lossy_mode_idx;
Jeevan Shriram1b07e372014-11-30 22:03:50 -0800204
205 uint32_t slice_height;
206 uint32_t pred_mode;
207 uint32_t max_pred_err;
Siddhartha Agrawalfe64dcb2014-10-07 12:41:01 -0700208};
209
Kuogee Hsiehe0fbc022015-07-07 10:26:58 -0700210struct dsc_parameters {
211 uint32_t major;
212 uint32_t minor;
213 uint32_t pps_id;
214 uint32_t slice_height;
215 uint32_t slice_width;
216 uint32_t bpp; /* target bpp */
217 uint32_t bpc; /* target bpc, byte per component */
218 uint32_t slice_per_pkt;
219 uint32_t block_prediction;
Ujwal Patel41a665a2015-07-17 13:51:30 -0700220};
221
222struct topology_config {
223 char *config_name; /* matches with kernel cmdline */
224 /*
225 * lm_split: -ve value means that lm_split is not used.
226 * If lm_split is used then DUAL_PIPE flag will be added.
227 */
228 int lm_split[2];
229 int num_dsc_enc; /* how many encoder to use */
230 struct dsc_parameters *dsc;
Ujwal Patel5c3227b2015-08-12 14:48:02 -0700231 int use_pingpong_split;
Kuogee Hsiehe0fbc022015-07-07 10:26:58 -0700232};
233
Arpita Banerjee841fa062013-05-24 14:59:51 -0700234#endif /*_PANEL_H_ */