~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/include/video/exynos_mipi_dsim.h

Version: ~ [ linux-6.1-rc7 ] ~ [ linux-6.0.10 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.80 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.156 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.225 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.267 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.300 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.334 ] ~ [ linux-4.8.17 ] ~ [ linux-4.7.10 ] ~ [ linux-4.6.7 ] ~ [ linux-4.5.7 ] ~ [ linux-4.4.302 ] ~ [ linux-4.3.6 ] ~ [ linux-4.2.8 ] ~ [ linux-4.1.52 ] ~ [ linux-4.0.9 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.9 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

  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 <inki.dae@samsung.com>
  8  * Donghwa Lee <dh09.lee@samsung.com>
  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  */
 32 enum mipi_dsim_interface_type {
 33         DSIM_COMMAND,
 34         DSIM_VIDEO
 35 };
 36 
 37 enum mipi_dsim_virtual_ch_no {
 38         DSIM_VIRTUAL_CH_0,
 39         DSIM_VIRTUAL_CH_1,
 40         DSIM_VIRTUAL_CH_2,
 41         DSIM_VIRTUAL_CH_3
 42 };
 43 
 44 enum mipi_dsim_burst_mode_type {
 45         DSIM_NON_BURST_SYNC_EVENT,
 46         DSIM_BURST_SYNC_EVENT,
 47         DSIM_NON_BURST_SYNC_PULSE,
 48         DSIM_BURST,
 49         DSIM_NON_VIDEO_MODE
 50 };
 51 
 52 enum mipi_dsim_no_of_data_lane {
 53         DSIM_DATA_LANE_1,
 54         DSIM_DATA_LANE_2,
 55         DSIM_DATA_LANE_3,
 56         DSIM_DATA_LANE_4
 57 };
 58 
 59 enum mipi_dsim_byte_clk_src {
 60         DSIM_PLL_OUT_DIV8,
 61         DSIM_EXT_CLK_DIV8,
 62         DSIM_EXT_CLK_BYPASS
 63 };
 64 
 65 enum mipi_dsim_pixel_format {
 66         DSIM_CMD_3BPP,
 67         DSIM_CMD_8BPP,
 68         DSIM_CMD_12BPP,
 69         DSIM_CMD_16BPP,
 70         DSIM_VID_16BPP_565,
 71         DSIM_VID_18BPP_666PACKED,
 72         DSIM_18BPP_666LOOSELYPACKED,
 73         DSIM_24BPP_888
 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  */
134 struct mipi_dsim_config {
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 
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;
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  * @phy: pointer to the MIPI-DSI PHY
220  */
221 struct mipi_dsim_device {
222         struct device                   *dev;
223         int                             id;
224         struct clk                      *clock;
225         unsigned int                    irq;
226         void __iomem                    *reg_base;
227         struct mutex                    lock;
228 
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;
233 
234         unsigned int                    state;
235         unsigned int                    data_lane;
236         unsigned int                    e_clk_src;
237         bool                            suspended;
238 
239         struct mipi_dsim_platform_data  *pd;
240         struct phy                      *phy;
241 };
242 
243 /*
244  * struct mipi_dsim_platform_data - interface to platform data
245  *      for mipi-dsi driver.
246  *
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.
253  */
254 struct mipi_dsim_platform_data {
255         char                            lcd_panel_name[PANEL_NAME_SIZE];
256 
257         struct mipi_dsim_config         *dsim_config;
258         unsigned int                    enabled;
259         void                            *lcd_panel_info;
260 };
261 
262 /*
263  * struct mipi_dsim_master_ops - callbacks to mipi-dsi operations.
264  *
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
275  *      only if needing.
276  *  @set_blank_mode: set framebuffer blank mode.
277  *      - this callback should be called after fb_blank() by a client driver
278  *      only if needing.
279  */
280 
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);
288 
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);
293 };
294 
295 /*
296  * device structure for mipi-dsi based lcd panel.
297  *
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.
309  */
310 struct mipi_dsim_lcd_device {
311         char                    *name;
312         struct device           dev;
313         int                     id;
314         int                     bus_id;
315         int                     irq;
316         int                     panel_reverse;
317 
318         struct mipi_dsim_device *master;
319         void                    *platform_data;
320 };
321 
322 /*
323  * driver structure for mipi-dsi based lcd panel.
324  *
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.
328  *
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.
333  */
334 struct mipi_dsim_lcd_driver {
335         char                    *name;
336         int                     id;
337 
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);
345 };
346 
347 /*
348  * register mipi_dsim_lcd_device to mipi-dsi master.
349  */
350 int exynos_mipi_dsi_register_lcd_device(struct mipi_dsim_lcd_device
351                                                 *lcd_dev);
352 /**
353  * register mipi_dsim_lcd_driver object defined by lcd panel driver
354  * to mipi-dsi driver.
355  */
356 int exynos_mipi_dsi_register_lcd_driver(struct mipi_dsim_lcd_driver
357                                                 *lcd_drv);
358 #endif /* _EXYNOS_MIPI_DSIM_H */
359 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | Wiki (Japanese) | Wiki (English) | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

osdn.jp