Siddhartha Agrawal | 3e694ea | 2013-01-23 17:01:31 -0800 | [diff] [blame] | 1 | /* Copyright (c) 2012-2013, The Linux Foundation. All rights reserved. |
Shashank Mittal | 4bfb2e3 | 2012-04-16 10:56:27 -0700 | [diff] [blame] | 2 | * |
| 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 Agrawal | 3e694ea | 2013-01-23 17:01:31 -0800 | [diff] [blame] | 12 | * * Neither the name of The Linux Foundation nor the names of its |
Shashank Mittal | 4bfb2e3 | 2012-04-16 10:56:27 -0700 | [diff] [blame] | 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 "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 Penso | b8f524c | 2013-05-20 12:32:31 +0300 | [diff] [blame] | 52 | #define EDP_PANEL 12 /* EDP */ |
Shashank Mittal | 4bfb2e3 | 2012-04-16 10:56:27 -0700 | [diff] [blame] | 53 | |
| 54 | enum msm_mdp_hw_revision { |
| 55 | MDP_REV_20 = 1, |
| 56 | MDP_REV_22, |
| 57 | MDP_REV_30, |
| 58 | MDP_REV_303, |
Terence Hampson | f49ff4e | 2013-06-18 15:11:31 -0400 | [diff] [blame] | 59 | MDP_REV_304, |
Shashank Mittal | 4bfb2e3 | 2012-04-16 10:56:27 -0700 | [diff] [blame] | 60 | MDP_REV_31, |
| 61 | MDP_REV_40, |
| 62 | MDP_REV_41, |
| 63 | MDP_REV_42, |
| 64 | MDP_REV_43, |
| 65 | MDP_REV_44, |
Siddhartha Agrawal | 7e2e215 | 2013-01-23 17:06:58 -0800 | [diff] [blame] | 66 | MDP_REV_50, |
Shashank Mittal | 4bfb2e3 | 2012-04-16 10:56:27 -0700 | [diff] [blame] | 67 | }; |
| 68 | |
| 69 | /* panel info type */ |
| 70 | struct 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 Parmar | 7c1cd52 | 2013-02-13 20:33:49 +0530 | [diff] [blame] | 81 | struct 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 Mittal | 4bfb2e3 | 2012-04-16 10:56:27 -0700 | [diff] [blame] | 90 | struct 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 Agrawal | 547ce4a | 2013-05-23 14:10:43 -0700 | [diff] [blame] | 104 | uint8_t dual_pipe; |
Kuogee Hsieh | ad69c3c | 2013-08-01 14:34:29 -0700 | [diff] [blame^] | 105 | uint8_t split_display; |
Siddhartha Agrawal | 6ef1e22 | 2013-06-12 18:24:58 -0700 | [diff] [blame] | 106 | uint8_t pipe_swap; |
Shashank Mittal | 4bfb2e3 | 2012-04-16 10:56:27 -0700 | [diff] [blame] | 107 | }; |
| 108 | |
| 109 | struct mipi_panel_info { |
| 110 | char mode; /* video/cmd */ |
| 111 | char interleave_mode; |
Arpita Banerjee | f1a8ac9 | 2013-05-21 10:09:35 -0700 | [diff] [blame] | 112 | int eof_bllp_power; |
Arpita Banerjee | 2522bc6 | 2013-05-24 16:03:53 -0700 | [diff] [blame] | 113 | uint32_t bitclock; |
Shashank Mittal | 4bfb2e3 | 2012-04-16 10:56:27 -0700 | [diff] [blame] | 114 | 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 Agrawal | 3e694ea | 2013-01-23 17:01:31 -0800 | [diff] [blame] | 133 | struct mdss_dsi_phy_ctrl *mdss_dsi_phy_db; |
Arpita Banerjee | 2522bc6 | 2013-05-24 16:03:53 -0700 | [diff] [blame] | 134 | struct mdss_dsi_pll_config *dsi_pll_config; |
Shashank Mittal | 4bfb2e3 | 2012-04-16 10:56:27 -0700 | [diff] [blame] | 135 | 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 Kadabi | 539ef72 | 2012-03-29 16:02:50 +0530 | [diff] [blame] | 160 | char lane_swap; |
Siddhartha Agrawal | 547ce4a | 2013-05-23 14:10:43 -0700 | [diff] [blame] | 161 | uint8_t dual_dsi; |
| 162 | uint8_t broadcast; |
Shashank Mittal | 4bfb2e3 | 2012-04-16 10:56:27 -0700 | [diff] [blame] | 163 | }; |
| 164 | |
Kuogee Hsieh | ad69c3c | 2013-08-01 14:34:29 -0700 | [diff] [blame^] | 165 | struct edp_panel_info { |
| 166 | int max_lane_count; |
| 167 | unsigned long max_link_clk; |
| 168 | }; |
| 169 | |
Shashank Mittal | 4bfb2e3 | 2012-04-16 10:56:27 -0700 | [diff] [blame] | 170 | enum lvds_mode { |
| 171 | LVDS_SINGLE_CHANNEL_MODE, |
| 172 | LVDS_DUAL_CHANNEL_MODE, |
| 173 | }; |
| 174 | |
| 175 | struct lvds_panel_info { |
| 176 | enum lvds_mode channel_mode; |
| 177 | /* Channel swap in dual mode */ |
| 178 | char channel_swap; |
| 179 | }; |
| 180 | |
| 181 | struct 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 Banerjee | f1a8ac9 | 2013-05-21 10:09:35 -0700 | [diff] [blame] | 188 | uint32_t rotation; |
| 189 | uint32_t broadcastmode; |
| 190 | char lowpowerstop; |
Shashank Mittal | 4bfb2e3 | 2012-04-16 10:56:27 -0700 | [diff] [blame] | 191 | |
| 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 Parmar | 7c1cd52 | 2013-02-13 20:33:49 +0530 | [diff] [blame] | 196 | struct hdmi_panel_info hdmi; |
Kuogee Hsieh | ad69c3c | 2013-08-01 14:34:29 -0700 | [diff] [blame^] | 197 | struct edp_panel_info edp; |
Shashank Mittal | 4bfb2e3 | 2012-04-16 10:56:27 -0700 | [diff] [blame] | 198 | |
| 199 | int (*on) (void); |
| 200 | int (*off) (void); |
Kuogee Hsieh | ad69c3c | 2013-08-01 14:34:29 -0700 | [diff] [blame^] | 201 | int (*prepare) (void); |
Amir Samuelov | 2d4ba16 | 2012-07-22 11:53:14 +0300 | [diff] [blame] | 202 | int (*early_config) (void *pdata); |
Shashank Mittal | 4bfb2e3 | 2012-04-16 10:56:27 -0700 | [diff] [blame] | 203 | int (*config) (void *pdata); |
Channagoud Kadabi | 01c9182 | 2012-06-06 15:53:30 +0530 | [diff] [blame] | 204 | int (*rotate) (void); |
Shashank Mittal | 4bfb2e3 | 2012-04-16 10:56:27 -0700 | [diff] [blame] | 205 | }; |
| 206 | |
| 207 | struct msm_fb_panel_data { |
| 208 | struct msm_panel_info panel_info; |
| 209 | struct fbcon_config fb; |
| 210 | int mdp_rev; |
Channagoud Kadabi | 01c9182 | 2012-06-06 15:53:30 +0530 | [diff] [blame] | 211 | int rotate; |
Shashank Mittal | 4bfb2e3 | 2012-04-16 10:56:27 -0700 | [diff] [blame] | 212 | |
| 213 | /* function entry chain */ |
| 214 | int (*power_func) (int enable); |
| 215 | int (*clk_func) (int enable); |
Arpita Banerjee | 2522bc6 | 2013-05-24 16:03:53 -0700 | [diff] [blame] | 216 | int (*pll_clk_func) (int enable, struct msm_panel_info *); |
Shashank Mittal | 4bfb2e3 | 2012-04-16 10:56:27 -0700 | [diff] [blame] | 217 | }; |
| 218 | |
Kuogee Hsieh | ad69c3c | 2013-08-01 14:34:29 -0700 | [diff] [blame^] | 219 | struct display_timing_desc_x { |
Asaf Penso | b8f524c | 2013-05-20 12:32:31 +0300 | [diff] [blame] | 220 | 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 Hsieh | ad69c3c | 2013-08-01 14:34:29 -0700 | [diff] [blame^] | 241 | struct edp_edid_x { |
Asaf Penso | b8f524c | 2013-05-20 12:32:31 +0300 | [diff] [blame] | 242 | 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 Hsieh | ad69c3c | 2013-08-01 14:34:29 -0700 | [diff] [blame^] | 255 | struct display_timing_desc_x timing[4]; |
Asaf Penso | b8f524c | 2013-05-20 12:32:31 +0300 | [diff] [blame] | 256 | }; |
| 257 | |
Kuogee Hsieh | ad69c3c | 2013-08-01 14:34:29 -0700 | [diff] [blame^] | 258 | struct dpcd_cap_x { |
Asaf Penso | b8f524c | 2013-05-20 12:32:31 +0300 | [diff] [blame] | 259 | char max_lane_count; |
| 260 | uint32_t max_link_clk; /* 162, 270 and 540 Mb, divided by 10 */ |
| 261 | }; |
| 262 | |
Kuogee Hsieh | ad69c3c | 2013-08-01 14:34:29 -0700 | [diff] [blame^] | 263 | |
| 264 | |
Asaf Penso | b8f524c | 2013-05-20 12:32:31 +0300 | [diff] [blame] | 265 | struct edp_panel_data { |
| 266 | struct msm_fb_panel_data *panel_data; |
Kuogee Hsieh | ad69c3c | 2013-08-01 14:34:29 -0700 | [diff] [blame^] | 267 | struct edp_edid_x edid; |
| 268 | struct dpcd_cap_x dpcd; |
Asaf Penso | b8f524c | 2013-05-20 12:32:31 +0300 | [diff] [blame] | 269 | }; |
| 270 | |
Shashank Mittal | 4bfb2e3 | 2012-04-16 10:56:27 -0700 | [diff] [blame] | 271 | int msm_display_init(struct msm_fb_panel_data *pdata); |
| 272 | #endif |