1 /* include/video/exynos_mipi_dsim.h
3 * Platform data header for Samsung SoC MIPI-DSIM.
5 * Copyright (c) 2012 Samsung Electronics Co., Ltd
7 * InKi Dae <inki.dae@samsung.com>
8 * Donghwa Lee <dh09.lee@samsung.com>
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License version 2 as
12 * published by the Free Software Foundation.
15 #ifndef _EXYNOS_MIPI_DSIM_H
16 #define _EXYNOS_MIPI_DSIM_H
18 #include <linux/device.h>
21 #define PANEL_NAME_SIZE (32)
24 * Enumerate display interface type.
26 * DSIM_COMMAND means cpu interface and rgb interface for DSIM_VIDEO.
28 * P.S. MIPI DSI Master has two display controller intefaces, RGB Interface
29 * for main display and CPU Interface(same as I80 Interface) for main
32 enum mipi_dsim_interface_type
{
37 enum mipi_dsim_virtual_ch_no
{
44 enum mipi_dsim_burst_mode_type
{
45 DSIM_NON_BURST_SYNC_EVENT
,
46 DSIM_BURST_SYNC_EVENT
,
47 DSIM_NON_BURST_SYNC_PULSE
,
52 enum mipi_dsim_no_of_data_lane
{
59 enum mipi_dsim_byte_clk_src
{
65 enum mipi_dsim_pixel_format
{
71 DSIM_VID_18BPP_666PACKED
,
72 DSIM_18BPP_666LOOSELYPACKED
,
77 * struct mipi_dsim_config - interface for configuring mipi-dsi controller.
79 * @auto_flush: enable or disable Auto flush of MD FIFO using VSYNC pulse.
80 * @eot_disable: enable or disable EoT packet in HS mode.
81 * @auto_vertical_cnt: specifies auto vertical count mode.
82 * in Video mode, the vertical line transition uses line counter
83 * configured by VSA, VBP, and Vertical resolution.
84 * If this bit is set to '1', the line counter does not use VSA and VBP
85 * registers.(in command mode, this variable is ignored)
86 * @hse: set horizontal sync event mode.
87 * In VSYNC pulse and Vporch area, MIPI DSI master transfers only HSYNC
88 * start packet to MIPI DSI slave at MIPI DSI spec1.1r02.
89 * this bit transfers HSYNC end packet in VSYNC pulse and Vporch area
90 * (in mommand mode, this variable is ignored)
91 * @hfp: specifies HFP disable mode.
92 * if this variable is set, DSI master ignores HFP area in VIDEO mode.
93 * (in command mode, this variable is ignored)
94 * @hbp: specifies HBP disable mode.
95 * if this variable is set, DSI master ignores HBP area in VIDEO mode.
96 * (in command mode, this variable is ignored)
97 * @hsa: specifies HSA disable mode.
98 * if this variable is set, DSI master ignores HSA area in VIDEO mode.
99 * (in command mode, this variable is ignored)
100 * @cma_allow: specifies the number of horizontal lines, where command packet
101 * transmission is allowed after Stable VFP period.
102 * @e_interface: specifies interface to be used.(CPU or RGB interface)
103 * @e_virtual_ch: specifies virtual channel number that main or
105 * @e_pixel_format: specifies pixel stream format for main or sub display.
106 * @e_burst_mode: selects Burst mode in Video mode.
107 * in Non-burst mode, RGB data area is filled with RGB data and NULL
108 * packets, according to input bandwidth of RGB interface.
109 * In Burst mode, RGB data area is filled with RGB data only.
110 * @e_no_data_lane: specifies data lane count to be used by Master.
111 * @e_byte_clk: select byte clock source. (it must be DSIM_PLL_OUT_DIV8)
112 * DSIM_EXT_CLK_DIV8 and DSIM_EXT_CLK_BYPASSS are not supported.
113 * @pll_stable_time: specifies the PLL Timer for stability of the ganerated
114 * clock(System clock cycle base)
115 * if the timer value goes to 0x00000000, the clock stable bit of status
116 * and interrupt register is set.
117 * @esc_clk: specifies escape clock frequency for getting the escape clock
119 * @stop_holding_cnt: specifies the interval value between transmitting
120 * read packet(or write "set_tear_on" command) and BTA request.
121 * after transmitting read packet or write "set_tear_on" command,
122 * BTA requests to D-PHY automatically. this counter value specifies
123 * the interval between them.
124 * @bta_timeout: specifies the timer for BTA.
125 * this register specifies time out from BTA request to change
126 * the direction with respect to Tx escape clock.
127 * @rx_timeout: specifies the timer for LP Rx mode timeout.
128 * this register specifies time out on how long RxValid deasserts,
129 * after RxLpdt asserts with respect to Tx escape clock.
130 * - RxValid specifies Rx data valid indicator.
131 * - RxLpdt specifies an indicator that D-PHY is under RxLpdt mode.
132 * - RxValid and RxLpdt specifies signal from D-PHY.
134 struct mipi_dsim_config
{
135 unsigned char auto_flush
;
136 unsigned char eot_disable
;
138 unsigned char auto_vertical_cnt
;
143 unsigned char cmd_allow
;
145 enum mipi_dsim_interface_type e_interface
;
146 enum mipi_dsim_virtual_ch_no e_virtual_ch
;
147 enum mipi_dsim_pixel_format e_pixel_format
;
148 enum mipi_dsim_burst_mode_type e_burst_mode
;
149 enum mipi_dsim_no_of_data_lane e_no_data_lane
;
150 enum mipi_dsim_byte_clk_src e_byte_clk
;
153 * ===========================================
154 * | P | M | S | MHz |
155 * -------------------------------------------
156 * | 3 | 100 | 3 | 100 |
157 * | 3 | 100 | 2 | 200 |
158 * | 3 | 63 | 1 | 252 |
159 * | 4 | 100 | 1 | 300 |
160 * | 4 | 110 | 1 | 330 |
161 * | 12 | 350 | 1 | 350 |
162 * | 3 | 100 | 1 | 400 |
163 * | 4 | 150 | 1 | 450 |
164 * | 6 | 118 | 1 | 472 |
165 * | 3 | 120 | 1 | 480 |
166 * | 12 | 250 | 0 | 500 |
167 * | 4 | 100 | 0 | 600 |
168 * | 3 | 81 | 0 | 648 |
169 * | 3 | 88 | 0 | 704 |
170 * | 3 | 90 | 0 | 720 |
171 * | 3 | 100 | 0 | 800 |
172 * | 12 | 425 | 0 | 850 |
173 * | 4 | 150 | 0 | 900 |
174 * | 12 | 475 | 0 | 950 |
175 * | 6 | 250 | 0 | 1000 |
176 * -------------------------------------------
180 * pms could be calculated as the following.
181 * M * 24 / P * 2 ^ S = MHz
187 unsigned int pll_stable_time
;
188 unsigned long esc_clk
;
190 unsigned short stop_holding_cnt
;
191 unsigned char bta_timeout
;
192 unsigned short rx_timeout
;
196 * struct mipi_dsim_device - global interface for mipi-dsi driver.
198 * @dev: driver model representation of the device.
199 * @id: unique device id.
200 * @clock: pointer to MIPI-DSI clock of clock framework.
201 * @irq: interrupt number to MIPI-DSI controller.
202 * @reg_base: base address to memory mapped SRF of MIPI-DSI controller.
204 * @lock: the mutex protecting this data structure.
205 * @dsim_info: infomation for configuring mipi-dsi controller.
206 * @master_ops: callbacks to mipi-dsi operations.
207 * @dsim_lcd_dev: pointer to activated ddi device.
208 * (it would be registered by mipi-dsi driver.)
209 * @dsim_lcd_drv: pointer to activated_ddi driver.
210 * (it would be registered by mipi-dsi driver.)
211 * @lcd_info: pointer to mipi_lcd_info structure.
212 * @state: specifies status of MIPI-DSI controller.
213 * the status could be RESET, INIT, STOP, HSCLKEN and ULPS.
214 * @data_lane: specifiec enabled data lane number.
215 * this variable would be set by driver according to e_no_data_lane
217 * @e_clk_src: select byte clock source.
218 * @pd: pointer to MIPI-DSI driver platform data.
219 * @phy: pointer to the MIPI-DSI PHY
221 struct mipi_dsim_device
{
226 void __iomem
*reg_base
;
229 struct mipi_dsim_config
*dsim_config
;
230 struct mipi_dsim_master_ops
*master_ops
;
231 struct mipi_dsim_lcd_device
*dsim_lcd_dev
;
232 struct mipi_dsim_lcd_driver
*dsim_lcd_drv
;
235 unsigned int data_lane
;
236 unsigned int e_clk_src
;
239 struct mipi_dsim_platform_data
*pd
;
244 * struct mipi_dsim_platform_data - interface to platform data
245 * for mipi-dsi driver.
247 * @lcd_panel_name: specifies lcd panel name registered to mipi-dsi driver.
248 * lcd panel driver searched would be actived.
249 * @dsim_config: pointer of structure for configuring mipi-dsi controller.
250 * @enabled: indicate whether mipi controller got enabled or not.
251 * @lcd_panel_info: pointer for lcd panel specific structure.
252 * this structure specifies width, height, timing and polarity and so on.
254 struct mipi_dsim_platform_data
{
255 char lcd_panel_name
[PANEL_NAME_SIZE
];
257 struct mipi_dsim_config
*dsim_config
;
258 unsigned int enabled
;
259 void *lcd_panel_info
;
263 * struct mipi_dsim_master_ops - callbacks to mipi-dsi operations.
265 * @cmd_write: transfer command to lcd panel at LP mode.
266 * @cmd_read: read command from rx register.
267 * @get_dsim_frame_done: get the status that all screen data have been
268 * transferred to mipi-dsi.
269 * @clear_dsim_frame_done: clear frame done status.
270 * @get_fb_frame_done: get frame done status of display controller.
271 * @trigger: trigger display controller.
272 * - this one would be used only in case of CPU mode.
273 * @set_early_blank_mode: set framebuffer blank mode.
274 * - this callback should be called prior to fb_blank() by a client driver
276 * @set_blank_mode: set framebuffer blank mode.
277 * - this callback should be called after fb_blank() by a client driver
281 struct mipi_dsim_master_ops
{
282 int (*cmd_write
)(struct mipi_dsim_device
*dsim
, unsigned int data_id
,
283 const unsigned char *data0
, unsigned int data1
);
284 int (*cmd_read
)(struct mipi_dsim_device
*dsim
, unsigned int data_id
,
285 unsigned int data0
, unsigned int req_size
, u8
*rx_buf
);
286 int (*get_dsim_frame_done
)(struct mipi_dsim_device
*dsim
);
287 int (*clear_dsim_frame_done
)(struct mipi_dsim_device
*dsim
);
289 int (*get_fb_frame_done
)(struct fb_info
*info
);
290 void (*trigger
)(struct fb_info
*info
);
291 int (*set_early_blank_mode
)(struct mipi_dsim_device
*dsim
, int power
);
292 int (*set_blank_mode
)(struct mipi_dsim_device
*dsim
, int power
);
296 * device structure for mipi-dsi based lcd panel.
298 * @name: name of the device to use with this device, or an
299 * alias for that name.
300 * @dev: driver model representation of the device.
301 * @id: id of device to be registered.
302 * @bus_id: bus id for identifing connected bus
303 * and this bus id should be same as id of mipi_dsim_device.
304 * @irq: irq number for signaling when framebuffer transfer of
305 * lcd panel module is completed.
306 * this irq would be used only for MIPI-DSI based CPU mode lcd panel.
307 * @master: pointer to mipi-dsi master device object.
308 * @platform_data: lcd panel specific platform data.
310 struct mipi_dsim_lcd_device
{
318 struct mipi_dsim_device
*master
;
323 * driver structure for mipi-dsi based lcd panel.
325 * this structure should be registered by lcd panel driver.
326 * mipi-dsi driver seeks lcd panel registered through name field
327 * and calls these callback functions in appropriate time.
329 * @name: name of the driver to use with this device, or an
330 * alias for that name.
331 * @id: id of driver to be registered.
332 * this id would be used for finding device object registered.
334 struct mipi_dsim_lcd_driver
{
338 void (*power_on
)(struct mipi_dsim_lcd_device
*dsim_dev
, int enable
);
339 void (*set_sequence
)(struct mipi_dsim_lcd_device
*dsim_dev
);
340 int (*probe
)(struct mipi_dsim_lcd_device
*dsim_dev
);
341 int (*remove
)(struct mipi_dsim_lcd_device
*dsim_dev
);
342 void (*shutdown
)(struct mipi_dsim_lcd_device
*dsim_dev
);
343 int (*suspend
)(struct mipi_dsim_lcd_device
*dsim_dev
);
344 int (*resume
)(struct mipi_dsim_lcd_device
*dsim_dev
);
348 * register mipi_dsim_lcd_device to mipi-dsi master.
350 int exynos_mipi_dsi_register_lcd_device(struct mipi_dsim_lcd_device
353 * register mipi_dsim_lcd_driver object defined by lcd panel driver
354 * to mipi-dsi driver.
356 int exynos_mipi_dsi_register_lcd_driver(struct mipi_dsim_lcd_driver
358 #endif /* _EXYNOS_MIPI_DSIM_H */