1 /* linux/arm/arch/plat-s5p/include/plat/mipi_dsim.h
3 * Platform data header for Samsung SoC MIPI-DSIM.
5 * Copyright (c) 2011 Samsung Electronics Co., Ltd
7 * InKi Dae <inki.dae@samsung.com>
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License version 2 as
11 * published by the Free Software Foundation.
19 #define PANEL_NAME_SIZE (32)
21 enum mipi_dsim_interface_type {
26 enum mipi_dsim_virtual_ch_no {
33 enum mipi_dsim_burst_mode_type {
34 DSIM_NON_BURST_SYNC_EVENT,
35 DSIM_BURST_SYNC_EVENT,
36 DSIM_NON_BURST_SYNC_PULSE,
41 enum mipi_dsim_no_of_data_lane {
48 enum mipi_dsim_byte_clk_src {
54 enum mipi_dsim_pixel_format {
60 DSIM_VID_18BPP_666PACKED,
61 DSIM_18BPP_666LOOSELYPACKED,
66 * struct mipi_dsim_config - interface for configuring mipi-dsi controller.
68 * @auto_flush: enable or disable Auto flush of MD FIFO using VSYNC pulse.
69 * @eot_disable: enable or disable EoT packet in HS mode.
70 * @auto_vertical_cnt: specifies auto vertical count mode.
71 * in Video mode, the vertical line transition uses line counter
72 * configured by VSA, VBP, and Vertical resolution.
73 * If this bit is set to '1', the line counter does not use VSA and VBP
74 * registers.(in command mode, this variable is ignored)
75 * @hse: set horizontal sync event mode.
76 * In VSYNC pulse and Vporch area, MIPI DSI master transfers only HSYNC
77 * start packet to MIPI DSI slave at MIPI DSI spec1.1r02.
78 * this bit transfers HSYNC end packet in VSYNC pulse and Vporch area
79 * (in mommand mode, this variable is ignored)
80 * @hfp: specifies HFP disable mode.
81 * if this variable is set, DSI master ignores HFP area in VIDEO mode.
82 * (in command mode, this variable is ignored)
83 * @hbp: specifies HBP disable mode.
84 * if this variable is set, DSI master ignores HBP area in VIDEO mode.
85 * (in command mode, this variable is ignored)
86 * @hsa: specifies HSA disable mode.
87 * if this variable is set, DSI master ignores HSA area in VIDEO mode.
88 * (in command mode, this variable is ignored)
89 * @e_interface: specifies interface to be used.(CPU or RGB interface)
90 * @e_virtual_ch: specifies virtual channel number that main or
92 * @e_pixel_format: specifies pixel stream format for main or sub display.
93 * @e_burst_mode: selects Burst mode in Video mode.
94 * in Non-burst mode, RGB data area is filled with RGB data and NULL
95 * packets, according to input bandwidth of RGB interface.
96 * In Burst mode, RGB data area is filled with RGB data only.
97 * @e_no_data_lane: specifies data lane count to be used by Master.
98 * @e_byte_clk: select byte clock source. (it must be DSIM_PLL_OUT_DIV8)
99 * DSIM_EXT_CLK_DIV8 and DSIM_EXT_CLK_BYPASSS are not supported.
100 * @pll_stable_time: specifies the PLL Timer for stability of the ganerated
101 * clock(System clock cycle base)
102 * if the timer value goes to 0x00000000, the clock stable bit of status
103 * and interrupt register is set.
104 * @esc_clk: specifies escape clock frequency for getting the escape clock
106 * @stop_holding_cnt: specifies the interval value between transmitting
107 * read packet(or write "set_tear_on" command) and BTA request.
108 * after transmitting read packet or write "set_tear_on" command,
109 * BTA requests to D-PHY automatically. this counter value specifies
110 * the interval between them.
111 * @bta_timeout: specifies the timer for BTA.
112 * this register specifies time out from BTA request to change
113 * the direction with respect to Tx escape clock.
114 * @rx_timeout: specifies the timer for LP Rx mode timeout.
115 * this register specifies time out on how long RxValid deasserts,
116 * after RxLpdt asserts with respect to Tx escape clock.
117 * - RxValid specifies Rx data valid indicator.
118 * - RxLpdt specifies an indicator that D-PHY is under RxLpdt mode.
119 * - RxValid and RxLpdt specifies signal from D-PHY.
121 struct mipi_dsim_config {
122 unsigned char auto_flush;
123 unsigned char eot_disable;
125 unsigned char auto_vertical_cnt;
131 enum mipi_dsim_interface_type e_interface;
132 enum mipi_dsim_virtual_ch_no e_virtual_ch;
133 enum mipi_dsim_pixel_format e_pixel_format;
134 enum mipi_dsim_burst_mode_type e_burst_mode;
135 enum mipi_dsim_no_of_data_lane e_no_data_lane;
136 enum mipi_dsim_byte_clk_src e_byte_clk;
139 * ===========================================
140 * | P | M | S | MHz |
141 * -------------------------------------------
142 * | 3 | 100 | 3 | 100 |
143 * | 3 | 100 | 2 | 200 |
144 * | 3 | 63 | 1 | 252 |
145 * | 4 | 100 | 1 | 300 |
146 * | 4 | 110 | 1 | 330 |
147 * | 12 | 350 | 1 | 350 |
148 * | 3 | 100 | 1 | 400 |
149 * | 4 | 150 | 1 | 450 |
150 * | 6 | 118 | 1 | 472 |
151 * | 3 | 120 | 1 | 480 |
152 * | 12 | 250 | 0 | 500 |
153 * | 4 | 100 | 0 | 600 |
154 * | 3 | 81 | 0 | 648 |
155 * | 3 | 88 | 0 | 704 |
156 * | 3 | 90 | 0 | 720 |
157 * | 3 | 100 | 0 | 800 |
158 * | 12 | 425 | 0 | 850 |
159 * | 4 | 150 | 0 | 900 |
160 * | 12 | 475 | 0 | 950 |
161 * | 6 | 250 | 0 | 1000 |
162 * -------------------------------------------
166 * pms could be calculated as the following.
167 * M * 24 / P * 2 ^ S = MHz
173 unsigned int pll_stable_time;
174 unsigned long esc_clk;
176 unsigned short stop_holding_cnt;
177 unsigned char bta_timeout;
178 unsigned short rx_timeout;
182 * struct mipi_dsim_device - global interface for mipi-dsi driver.
184 * @dev: driver model representation of the device.
185 * @id: unique device id.
186 * @clock: pointer to MIPI-DSI clock of clock framework.
187 * @irq: interrupt number to MIPI-DSI controller.
188 * @reg_base: base address to memory mapped SRF of MIPI-DSI controller.
190 * @lock: the mutex protecting this data structure.
191 * @dsim_info: infomation for configuring mipi-dsi controller.
192 * @master_ops: callbacks to mipi-dsi operations.
193 * @dsim_lcd_dev: pointer to activated ddi device.
194 * (it would be registered by mipi-dsi driver.)
195 * @dsim_lcd_drv: pointer to activated_ddi driver.
196 * (it would be registered by mipi-dsi driver.)
197 * @lcd_info: pointer to mipi_lcd_info structure.
198 * @state: specifies status of MIPI-DSI controller.
199 * the status could be RESET, INIT, STOP, HSCLKEN and ULPS.
200 * @resume_complete: indicates whether resume operation is completed or not.
201 * @data_lane: specifiec enabled data lane number.
202 * this variable would be set by driver according to e_no_data_lane
204 * @e_clk_src: select byte clock source.
205 * @pd: pointer to MIPI-DSI driver platform data.
207 struct mipi_dsim_device {
208 struct mipi_dsim_config *dsim_config;
209 struct mipi_dsim_master_ops *master_ops;
210 struct mipi_dsim_lcd_device *dsim_lcd_dev;
211 struct mipi_dsim_lcd_driver *dsim_lcd_drv;
214 unsigned int data_lane;
215 enum mipi_dsim_byte_clk_src e_clk_src;
217 struct s5p_platform_mipi_dsim *pd;
221 * struct s5p_platform_mipi_dsim - interface to platform data
222 * for mipi-dsi driver.
224 * @lcd_panel_name: specifies lcd panel name registered to mipi-dsi driver.
225 * lcd panel driver searched would be actived.
226 * @dsim_config: pointer of structure for configuring mipi-dsi controller.
227 * @lcd_panel_info: pointer for lcd panel specific structure.
228 * this structure specifies width, height, timing and polarity and so on.
229 * @mipi_power: callback pointer for enabling or disabling mipi power.
230 * @phy_enable: pointer to a callback controlling D-PHY enable/reset
232 struct s5p_platform_mipi_dsim {
233 char lcd_panel_name[PANEL_NAME_SIZE];
235 struct mipi_dsim_config *dsim_config;
236 void *lcd_panel_info;
238 int (*lcd_power)(void);
239 int (*mipi_power)(void);
240 int (*phy_enable)(int on, u32 reset);
243 * struct mipi_dsim_master_ops - callbacks to mipi-dsi operations.
245 * @cmd_write: transfer command to lcd panel at LP mode.
246 * @cmd_read: read command from rx register.
247 * @get_dsim_frame_done: get the status that all screen data have been
248 * transferred to mipi-dsi.
249 * @clear_dsim_frame_done: clear frame done status.
250 * @get_fb_frame_done: get frame done status of display controller.
251 * @trigger: trigger display controller.
252 * - this one would be used only in case of CPU mode.
255 struct mipi_dsim_master_ops {
256 int (*cmd_write)(struct mipi_dsim_device *dsim, unsigned int data_id,
257 unsigned int data0, unsigned int data1);
258 int (*cmd_read)(struct mipi_dsim_device *dsim, unsigned int data_id,
259 unsigned int data0, unsigned int data1);
260 int (*get_dsim_frame_done)(struct mipi_dsim_device *dsim);
261 int (*clear_dsim_frame_done)(struct mipi_dsim_device *dsim);
263 int (*get_fb_frame_done)(void);
264 void (*trigger)(struct fb_info *info);
268 * device structure for mipi-dsi based lcd panel.
270 * @name: name of the device to use with this device, or an
271 * alias for that name.
272 * @dev: driver model representation of the device.
273 * @id: id of device to be registered.
274 * @bus_id: bus id for identifing connected bus
275 * and this bus id should be same as id of mipi_dsim_device.
276 * @irq: irq number for signaling when framebuffer transfer of
277 * lcd panel module is completed.
278 * this irq would be used only for MIPI-DSI based CPU mode lcd panel.
279 * @master: pointer to mipi-dsi master device object.
280 * @platform_data: lcd panel specific platform data.
282 struct mipi_dsim_lcd_device {
289 struct mipi_dsim_device *master;
294 * driver structure for mipi-dsi based lcd panel.
296 * this structure should be registered by lcd panel driver.
297 * mipi-dsi driver seeks lcd panel registered through name field
298 * and calls these callback functions in appropriate time.
300 * @name: name of the driver to use with this device, or an
301 * alias for that name.
302 * @id: id of driver to be registered.
303 * this id would be used for finding device object registered.
305 struct mipi_dsim_lcd_driver {
309 int (*mipi_panel_init)(struct mipi_dsim_device *dsim_dev);
310 void (*mipi_display_on)(struct mipi_dsim_device *dsim_dev);
313 int s5p_mipi_dsi_init(void);
316 * register mipi_dsim_lcd_driver object defined by lcd panel driver
317 * to mipi-dsi driver.
319 int s5p_mipi_dsi_register_lcd_driver(struct mipi_dsim_lcd_driver
323 * register mipi_dsim_lcd_device to mipi-dsi master.
325 int s5p_mipi_dsi_register_lcd_device(struct mipi_dsim_lcd_device
329 * s5p_dsim_phy_enable - global MIPI-DSI receiver D-PHY control
330 * @pdev: MIPI-DSIM platform device
331 * @on: true to enable D-PHY and deassert its reset
332 * false to disable D-PHY
334 int s5p_dsim_phy_enable(int on);