blob: d8885984184f24e48ca4bc63494f0d95eb1c5fbe [file] [log] [blame]
Siddhartha Agrawal3e694ea2013-01-23 17:01:31 -08001/* Copyright (c) 2012-2013, The Linux Foundation. All rights reserved.
Shashank Mittal4bfb2e32012-04-16 10:56:27 -07002 *
3 * Redistribution and use in source and binary forms, with or without
4 * modification, are permitted provided that the following conditions are
5 * 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
9 * copyright notice, this list of conditions and the following
10 * disclaimer in the documentation and/or other materials provided
11 * with the distribution.
Siddhartha Agrawal3e694ea2013-01-23 17:01:31 -080012 * * Neither the name of The Linux Foundation nor the names of its
Shashank Mittal4bfb2e32012-04-16 10:56:27 -070013 * 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 "AS IS" AND ANY EXPRESS OR IMPLIED
17 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
18 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
19 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
20 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
21 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
22 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
23 * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
24 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
25 * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
26 * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 *
28 */
29
30#ifndef _PLATFORM_MSM_SHARED_MSM_PANEL_H_
31#define _PLATFORM_MSM_SHARED_MSM_PANEL_H_
32
33#include <stdint.h>
34#include <dev/fbcon.h>
35
36#define TRUE 1
37#define FALSE 0
38
39/* panel type list */
40#define NO_PANEL 0xffff /* No Panel */
41#define MDDI_PANEL 1 /* MDDI */
42#define EBI2_PANEL 2 /* EBI2 */
43#define LCDC_PANEL 3 /* internal LCDC type */
44#define EXT_MDDI_PANEL 4 /* Ext.MDDI */
45#define TV_PANEL 5 /* TV */
46#define HDMI_PANEL 6 /* HDMI TV */
47#define DTV_PANEL 7 /* DTV */
48#define MIPI_VIDEO_PANEL 8 /* MIPI */
49#define MIPI_CMD_PANEL 9 /* MIPI */
50#define WRITEBACK_PANEL 10 /* Wifi display */
51#define LVDS_PANEL 11 /* LVDS */
Asaf Pensob8f524c2013-05-20 12:32:31 +030052#define EDP_PANEL 12 /* EDP */
Shashank Mittal4bfb2e32012-04-16 10:56:27 -070053
54enum msm_mdp_hw_revision {
55 MDP_REV_20 = 1,
56 MDP_REV_22,
57 MDP_REV_30,
58 MDP_REV_303,
Terence Hampsonf49ff4e2013-06-18 15:11:31 -040059 MDP_REV_304,
Shashank Mittal4bfb2e32012-04-16 10:56:27 -070060 MDP_REV_31,
61 MDP_REV_40,
62 MDP_REV_41,
63 MDP_REV_42,
64 MDP_REV_43,
65 MDP_REV_44,
Siddhartha Agrawal7e2e2152013-01-23 17:06:58 -080066 MDP_REV_50,
Shashank Mittal4bfb2e32012-04-16 10:56:27 -070067};
68
69/* panel info type */
70struct lcd_panel_info {
71 uint32_t vsync_enable;
72 uint32_t refx100;
73 uint32_t v_back_porch;
74 uint32_t v_front_porch;
75 uint32_t v_pulse_width;
76 uint32_t hw_vsync_mode;
77 uint32_t vsync_notifier_period;
78 uint32_t rev;
79};
80
Ajay Singh Parmar7c1cd522013-02-13 20:33:49 +053081struct hdmi_panel_info {
82 uint32_t h_back_porch;
83 uint32_t h_front_porch;
84 uint32_t h_pulse_width;
85 uint32_t v_back_porch;
86 uint32_t v_front_porch;
87 uint32_t v_pulse_width;
88};
89
Shashank Mittal4bfb2e32012-04-16 10:56:27 -070090struct lcdc_panel_info {
91 uint32_t h_back_porch;
92 uint32_t h_front_porch;
93 uint32_t h_pulse_width;
94 uint32_t v_back_porch;
95 uint32_t v_front_porch;
96 uint32_t v_pulse_width;
97 uint32_t border_clr;
98 uint32_t underflow_clr;
99 uint32_t hsync_skew;
100 /* Pad width */
101 uint32_t xres_pad;
102 /* Pad height */
103 uint32_t yres_pad;
Siddhartha Agrawal547ce4a2013-05-23 14:10:43 -0700104 uint8_t dual_pipe;
Kuogee Hsiehad69c3c2013-08-01 14:34:29 -0700105 uint8_t split_display;
Siddhartha Agrawal6ef1e222013-06-12 18:24:58 -0700106 uint8_t pipe_swap;
Shashank Mittal4bfb2e32012-04-16 10:56:27 -0700107};
108
109struct mipi_panel_info {
110 char mode; /* video/cmd */
111 char interleave_mode;
Arpita Banerjeef1a8ac92013-05-21 10:09:35 -0700112 int eof_bllp_power;
Arpita Banerjee2522bc62013-05-24 16:03:53 -0700113 uint32_t bitclock;
Shashank Mittal4bfb2e32012-04-16 10:56:27 -0700114 char crc_check;
115 char ecc_check;
116 char dst_format; /* shared by video and command */
117 char num_of_lanes;
118 char data_lane0;
119 char data_lane1;
120 char data_lane2;
121 char data_lane3;
122 char dlane_swap; /* data lane swap */
123 char rgb_swap;
124 char b_sel;
125 char g_sel;
126 char r_sel;
127 char rx_eot_ignore;
128 char tx_eot_append;
129 char t_clk_post; /* 0xc0, DSI_CLKOUT_TIMING_CTRL */
130 char t_clk_pre; /* 0xc0, DSI_CLKOUT_TIMING_CTRL */
131 char vc; /* virtual channel */
132 struct mipi_dsi_phy_ctrl *dsi_phy_db;
Siddhartha Agrawal3e694ea2013-01-23 17:01:31 -0800133 struct mdss_dsi_phy_ctrl *mdss_dsi_phy_db;
Arpita Banerjee2522bc62013-05-24 16:03:53 -0700134 struct mdss_dsi_pll_config *dsi_pll_config;
Shashank Mittal4bfb2e32012-04-16 10:56:27 -0700135 struct mipi_dsi_cmd *panel_cmds;
136 int num_of_panel_cmds;
137 /* video mode */
138 char pulse_mode_hsa_he;
139 char hfp_power_stop;
140 char hbp_power_stop;
141 char hsa_power_stop;
142 char eof_bllp_power_stop;
143 char bllp_power_stop;
144 char traffic_mode;
145 char frame_rate;
146 /* command mode */
147 char interleave_max;
148 char insert_dcs_cmd;
149 char wr_mem_continue;
150 char wr_mem_start;
151 char te_sel;
152 char stream; /* 0 or 1 */
153 char mdp_trigger;
154 char dma_trigger;
155 uint32_t dsi_pclk_rate;
156 /* The packet-size should not bet changed */
157 char no_max_pkt_size;
158 /* Clock required during LP commands */
159 char force_clk_lane_hs;
Channagoud Kadabi539ef722012-03-29 16:02:50 +0530160 char lane_swap;
Siddhartha Agrawal547ce4a2013-05-23 14:10:43 -0700161 uint8_t dual_dsi;
162 uint8_t broadcast;
Shashank Mittal4bfb2e32012-04-16 10:56:27 -0700163};
164
Kuogee Hsiehad69c3c2013-08-01 14:34:29 -0700165struct edp_panel_info {
166 int max_lane_count;
167 unsigned long max_link_clk;
168};
169
Shashank Mittal4bfb2e32012-04-16 10:56:27 -0700170enum lvds_mode {
171 LVDS_SINGLE_CHANNEL_MODE,
172 LVDS_DUAL_CHANNEL_MODE,
173};
174
175struct lvds_panel_info {
176 enum lvds_mode channel_mode;
177 /* Channel swap in dual mode */
178 char channel_swap;
179};
180
181struct msm_panel_info {
182 uint32_t xres;
183 uint32_t yres;
184 uint32_t bpp;
185 uint32_t type;
186 uint32_t wait_cycle;
187 uint32_t clk_rate;
Arpita Banerjeef1a8ac92013-05-21 10:09:35 -0700188 uint32_t rotation;
189 uint32_t broadcastmode;
190 char lowpowerstop;
Shashank Mittal4bfb2e32012-04-16 10:56:27 -0700191
192 struct lcd_panel_info lcd;
193 struct lcdc_panel_info lcdc;
194 struct mipi_panel_info mipi;
195 struct lvds_panel_info lvds;
Ajay Singh Parmar7c1cd522013-02-13 20:33:49 +0530196 struct hdmi_panel_info hdmi;
Kuogee Hsiehad69c3c2013-08-01 14:34:29 -0700197 struct edp_panel_info edp;
Shashank Mittal4bfb2e32012-04-16 10:56:27 -0700198
199 int (*on) (void);
200 int (*off) (void);
Kuogee Hsiehad69c3c2013-08-01 14:34:29 -0700201 int (*prepare) (void);
Amir Samuelov2d4ba162012-07-22 11:53:14 +0300202 int (*early_config) (void *pdata);
Shashank Mittal4bfb2e32012-04-16 10:56:27 -0700203 int (*config) (void *pdata);
Channagoud Kadabi01c91822012-06-06 15:53:30 +0530204 int (*rotate) (void);
Shashank Mittal4bfb2e32012-04-16 10:56:27 -0700205};
206
207struct msm_fb_panel_data {
208 struct msm_panel_info panel_info;
209 struct fbcon_config fb;
210 int mdp_rev;
Channagoud Kadabi01c91822012-06-06 15:53:30 +0530211 int rotate;
Shashank Mittal4bfb2e32012-04-16 10:56:27 -0700212
213 /* function entry chain */
214 int (*power_func) (int enable);
215 int (*clk_func) (int enable);
Arpita Banerjee2522bc62013-05-24 16:03:53 -0700216 int (*pll_clk_func) (int enable, struct msm_panel_info *);
Shashank Mittal4bfb2e32012-04-16 10:56:27 -0700217};
218
Kuogee Hsiehad69c3c2013-08-01 14:34:29 -0700219struct display_timing_desc_x {
Asaf Pensob8f524c2013-05-20 12:32:31 +0300220 uint32_t pclk;
221 uint32_t h_addressable; /* addressable + boder = active */
222 uint32_t h_border;
223 uint32_t h_blank; /* fporch + bporch + sync_pulse = blank */
224 uint32_t h_fporch;
225 uint32_t h_sync_pulse;
226 uint32_t v_addressable; /* addressable + boder = active */
227 uint32_t v_border;
228 uint32_t v_blank; /* fporch + bporch + sync_pulse = blank */
229 uint32_t v_fporch;
230 uint32_t v_sync_pulse;
231 uint32_t width_mm;
232 uint32_t height_mm;
233 uint32_t interlaced;
234 uint32_t stereo;
235 uint32_t sync_type;
236 uint32_t sync_separate;
237 uint32_t vsync_pol;
238 uint32_t hsync_pol;
239};
240
Kuogee Hsiehad69c3c2013-08-01 14:34:29 -0700241struct edp_edid_x {
Asaf Pensob8f524c2013-05-20 12:32:31 +0300242 char id_name[4];
243 short id_product;
244 char version;
245 char revision;
246 char video_digital;
247 char color_depth; /* 6, 8, 10, 12 and 14 bits */
248 char color_format; /* RGB 4:4:4, YCrCb 4:4:4, Ycrcb 4:2:2 */
249 char dpm; /* display power management */
250 char sync_digital; /* 1 = digital */
251 char sync_separate; /* 1 = separate */
252 char vsync_pol; /* 0 = negative, 1 = positive */
253 char hsync_pol; /* 0 = negative, 1 = positive */
254 char ext_block_cnt;
Kuogee Hsiehad69c3c2013-08-01 14:34:29 -0700255 struct display_timing_desc_x timing[4];
Asaf Pensob8f524c2013-05-20 12:32:31 +0300256};
257
Kuogee Hsiehad69c3c2013-08-01 14:34:29 -0700258struct dpcd_cap_x {
Asaf Pensob8f524c2013-05-20 12:32:31 +0300259 char max_lane_count;
260 uint32_t max_link_clk; /* 162, 270 and 540 Mb, divided by 10 */
261};
262
Kuogee Hsiehad69c3c2013-08-01 14:34:29 -0700263
264
Asaf Pensob8f524c2013-05-20 12:32:31 +0300265struct edp_panel_data {
266 struct msm_fb_panel_data *panel_data;
Kuogee Hsiehad69c3c2013-08-01 14:34:29 -0700267 struct edp_edid_x edid;
268 struct dpcd_cap_x dpcd;
Asaf Pensob8f524c2013-05-20 12:32:31 +0300269};
270
Shashank Mittal4bfb2e32012-04-16 10:56:27 -0700271int msm_display_init(struct msm_fb_panel_data *pdata);
272#endif