Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
exynos_mipi_dsim.h
Go to the documentation of this file.
1 /* include/video/exynos_mipi_dsim.h
2  *
3  * Platform data header for Samsung SoC MIPI-DSIM.
4  *
5  * Copyright (c) 2012 Samsung Electronics Co., Ltd
6  *
7  * InKi Dae <[email protected]>
8  * Donghwa Lee <[email protected]>
9  *
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.
13 */
14 
15 #ifndef _EXYNOS_MIPI_DSIM_H
16 #define _EXYNOS_MIPI_DSIM_H
17 
18 #include <linux/device.h>
19 #include <linux/fb.h>
20 
21 #define PANEL_NAME_SIZE (32)
22 
23 /*
24  * Enumerate display interface type.
25  *
26  * DSIM_COMMAND means cpu interface and rgb interface for DSIM_VIDEO.
27  *
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
30  * and sub display.
31  */
35 };
36 
42 };
43 
50 };
51 
57 };
58 
63 };
64 
74 };
75 
76 /*
77  * struct mipi_dsim_config - interface for configuring mipi-dsi controller.
78  *
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
104  * sub diaplsy uses.
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
118  * prescaler value.
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.
133  */
135  unsigned char auto_flush;
136  unsigned char eot_disable;
137 
138  unsigned char auto_vertical_cnt;
139  unsigned char hse;
140  unsigned char hfp;
141  unsigned char hbp;
142  unsigned char hsa;
143  unsigned char cmd_allow;
144 
151 
152  /*
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  * -------------------------------------------
177  */
178 
179  /*
180  * pms could be calculated as the following.
181  * M * 24 / P * 2 ^ S = MHz
182  */
183  unsigned char p;
184  unsigned short m;
185  unsigned char s;
186 
187  unsigned int pll_stable_time;
188  unsigned long esc_clk;
189 
190  unsigned short stop_holding_cnt;
191  unsigned char bta_timeout;
192  unsigned short rx_timeout;
193 };
194 
195 /*
196  * struct mipi_dsim_device - global interface for mipi-dsi driver.
197  *
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.
203  * (virtual address)
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
216  * automatically.
217  * @e_clk_src: select byte clock source.
218  * @pd: pointer to MIPI-DSI driver platform data.
219  */
221  struct device *dev;
222  int id;
223  struct resource *res;
224  struct clk *clock;
225  unsigned int irq;
227  struct mutex lock;
228 
233 
234  unsigned int state;
235  unsigned int data_lane;
236  unsigned int e_clk_src;
237  bool suspended;
238 
240 };
241 
242 /*
243  * struct mipi_dsim_platform_data - interface to platform data
244  * for mipi-dsi driver.
245  *
246  * @lcd_panel_name: specifies lcd panel name registered to mipi-dsi driver.
247  * lcd panel driver searched would be actived.
248  * @dsim_config: pointer of structure for configuring mipi-dsi controller.
249  * @enabled: indicate whether mipi controller got enabled or not.
250  * @lcd_panel_info: pointer for lcd panel specific structure.
251  * this structure specifies width, height, timing and polarity and so on.
252  * @phy_enable: pointer to a callback controlling D-PHY enable/reset
253  */
256 
258  unsigned int enabled;
260 
261  int (*phy_enable)(struct platform_device *pdev, bool on);
262 };
263 
264 /*
265  * struct mipi_dsim_master_ops - callbacks to mipi-dsi operations.
266  *
267  * @cmd_write: transfer command to lcd panel at LP mode.
268  * @cmd_read: read command from rx register.
269  * @get_dsim_frame_done: get the status that all screen data have been
270  * transferred to mipi-dsi.
271  * @clear_dsim_frame_done: clear frame done status.
272  * @get_fb_frame_done: get frame done status of display controller.
273  * @trigger: trigger display controller.
274  * - this one would be used only in case of CPU mode.
275  * @set_early_blank_mode: set framebuffer blank mode.
276  * - this callback should be called prior to fb_blank() by a client driver
277  * only if needing.
278  * @set_blank_mode: set framebuffer blank mode.
279  * - this callback should be called after fb_blank() by a client driver
280  * only if needing.
281  */
282 
284  int (*cmd_write)(struct mipi_dsim_device *dsim, unsigned int data_id,
285  const unsigned char *data0, unsigned int data1);
286  int (*cmd_read)(struct mipi_dsim_device *dsim, unsigned int data_id,
287  unsigned int data0, unsigned int req_size, u8 *rx_buf);
290 
292  void (*trigger)(struct fb_info *info);
293  int (*set_early_blank_mode)(struct mipi_dsim_device *dsim, int power);
294  int (*set_blank_mode)(struct mipi_dsim_device *dsim, int power);
295 };
296 
297 /*
298  * device structure for mipi-dsi based lcd panel.
299  *
300  * @name: name of the device to use with this device, or an
301  * alias for that name.
302  * @dev: driver model representation of the device.
303  * @id: id of device to be registered.
304  * @bus_id: bus id for identifing connected bus
305  * and this bus id should be same as id of mipi_dsim_device.
306  * @irq: irq number for signaling when framebuffer transfer of
307  * lcd panel module is completed.
308  * this irq would be used only for MIPI-DSI based CPU mode lcd panel.
309  * @master: pointer to mipi-dsi master device object.
310  * @platform_data: lcd panel specific platform data.
311  */
313  char *name;
314  struct device dev;
315  int id;
316  int bus_id;
317  int irq;
319 
322 };
323 
324 /*
325  * driver structure for mipi-dsi based lcd panel.
326  *
327  * this structure should be registered by lcd panel driver.
328  * mipi-dsi driver seeks lcd panel registered through name field
329  * and calls these callback functions in appropriate time.
330  *
331  * @name: name of the driver to use with this device, or an
332  * alias for that name.
333  * @id: id of driver to be registered.
334  * this id would be used for finding device object registered.
335  */
337  char *name;
338  int id;
339 
340  void (*power_on)(struct mipi_dsim_lcd_device *dsim_dev, int enable);
341  void (*set_sequence)(struct mipi_dsim_lcd_device *dsim_dev);
342  int (*probe)(struct mipi_dsim_lcd_device *dsim_dev);
343  int (*remove)(struct mipi_dsim_lcd_device *dsim_dev);
344  void (*shutdown)(struct mipi_dsim_lcd_device *dsim_dev);
345  int (*suspend)(struct mipi_dsim_lcd_device *dsim_dev);
346  int (*resume)(struct mipi_dsim_lcd_device *dsim_dev);
347 };
348 
349 /*
350  * register mipi_dsim_lcd_device to mipi-dsi master.
351  */
353  *lcd_dev);
359  *lcd_drv);
360 #endif /* _EXYNOS_MIPI_DSIM_H */