Blame view

include/video/omapdss.h 19.6 KB
559d67018   Tomi Valkeinen   OMAP: DSS2: Displ...
1
  /*
559d67018   Tomi Valkeinen   OMAP: DSS2: Displ...
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
   * Copyright (C) 2008 Nokia Corporation
   * Author: Tomi Valkeinen <tomi.valkeinen@nokia.com>
   *
   * This program is free software; you can redistribute it and/or modify it
   * under the terms of the GNU General Public License version 2 as published by
   * the Free Software Foundation.
   *
   * This program is distributed in the hope that it will be useful, but WITHOUT
   * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
   * more details.
   *
   * You should have received a copy of the GNU General Public License along with
   * this program.  If not, see <http://www.gnu.org/licenses/>.
   */
a0b38cc4d   Tomi Valkeinen   OMAP: DSS2: Move ...
17
18
  #ifndef __OMAP_OMAPDSS_H
  #define __OMAP_OMAPDSS_H
559d67018   Tomi Valkeinen   OMAP: DSS2: Displ...
19
20
21
22
  
  #include <linux/list.h>
  #include <linux/kobject.h>
  #include <linux/device.h>
559d67018   Tomi Valkeinen   OMAP: DSS2: Displ...
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
  
  #define DISPC_IRQ_FRAMEDONE		(1 << 0)
  #define DISPC_IRQ_VSYNC			(1 << 1)
  #define DISPC_IRQ_EVSYNC_EVEN		(1 << 2)
  #define DISPC_IRQ_EVSYNC_ODD		(1 << 3)
  #define DISPC_IRQ_ACBIAS_COUNT_STAT	(1 << 4)
  #define DISPC_IRQ_PROG_LINE_NUM		(1 << 5)
  #define DISPC_IRQ_GFX_FIFO_UNDERFLOW	(1 << 6)
  #define DISPC_IRQ_GFX_END_WIN		(1 << 7)
  #define DISPC_IRQ_PAL_GAMMA_MASK	(1 << 8)
  #define DISPC_IRQ_OCP_ERR		(1 << 9)
  #define DISPC_IRQ_VID1_FIFO_UNDERFLOW	(1 << 10)
  #define DISPC_IRQ_VID1_END_WIN		(1 << 11)
  #define DISPC_IRQ_VID2_FIFO_UNDERFLOW	(1 << 12)
  #define DISPC_IRQ_VID2_END_WIN		(1 << 13)
  #define DISPC_IRQ_SYNC_LOST		(1 << 14)
  #define DISPC_IRQ_SYNC_LOST_DIGIT	(1 << 15)
  #define DISPC_IRQ_WAKEUP		(1 << 16)
2a205f34b   Sumit Semwal   OMAP: DSS2: LCD2 ...
41
42
  #define DISPC_IRQ_SYNC_LOST2		(1 << 17)
  #define DISPC_IRQ_VSYNC2		(1 << 18)
b8c095b4d   Archit Taneja   OMAPDSS: DISPC: V...
43
44
  #define DISPC_IRQ_VID3_END_WIN		(1 << 19)
  #define DISPC_IRQ_VID3_FIFO_UNDERFLOW	(1 << 20)
2a205f34b   Sumit Semwal   OMAP: DSS2: LCD2 ...
45
46
  #define DISPC_IRQ_ACBIAS_COUNT_STAT2	(1 << 21)
  #define DISPC_IRQ_FRAMEDONE2		(1 << 22)
7f6f3c4bf   Tomi Valkeinen   OMAP: DSS2: DISPC...
47
48
49
  #define DISPC_IRQ_FRAMEDONEWB		(1 << 23)
  #define DISPC_IRQ_FRAMEDONETV		(1 << 24)
  #define DISPC_IRQ_WBBUFFEROVERFLOW	(1 << 25)
559d67018   Tomi Valkeinen   OMAP: DSS2: Displ...
50
51
52
53
54
55
56
57
58
59
60
  
  struct omap_dss_device;
  struct omap_overlay_manager;
  
  enum omap_display_type {
  	OMAP_DISPLAY_TYPE_NONE		= 0,
  	OMAP_DISPLAY_TYPE_DPI		= 1 << 0,
  	OMAP_DISPLAY_TYPE_DBI		= 1 << 1,
  	OMAP_DISPLAY_TYPE_SDI		= 1 << 2,
  	OMAP_DISPLAY_TYPE_DSI		= 1 << 3,
  	OMAP_DISPLAY_TYPE_VENC		= 1 << 4,
b119601d4   Mythri P K   OMAP4: DSS2: Add ...
61
  	OMAP_DISPLAY_TYPE_HDMI		= 1 << 5,
559d67018   Tomi Valkeinen   OMAP: DSS2: Displ...
62
63
64
65
66
  };
  
  enum omap_plane {
  	OMAP_DSS_GFX	= 0,
  	OMAP_DSS_VIDEO1	= 1,
b8c095b4d   Archit Taneja   OMAPDSS: DISPC: V...
67
68
  	OMAP_DSS_VIDEO2	= 2,
  	OMAP_DSS_VIDEO3	= 3,
559d67018   Tomi Valkeinen   OMAP: DSS2: Displ...
69
70
71
72
73
  };
  
  enum omap_channel {
  	OMAP_DSS_CHANNEL_LCD	= 0,
  	OMAP_DSS_CHANNEL_DIGIT	= 1,
8613b0005   Sumit Semwal   OMAP: DSS2: Repre...
74
  	OMAP_DSS_CHANNEL_LCD2	= 2,
559d67018   Tomi Valkeinen   OMAP: DSS2: Displ...
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
  };
  
  enum omap_color_mode {
  	OMAP_DSS_COLOR_CLUT1	= 1 << 0,  /* BITMAP 1 */
  	OMAP_DSS_COLOR_CLUT2	= 1 << 1,  /* BITMAP 2 */
  	OMAP_DSS_COLOR_CLUT4	= 1 << 2,  /* BITMAP 4 */
  	OMAP_DSS_COLOR_CLUT8	= 1 << 3,  /* BITMAP 8 */
  	OMAP_DSS_COLOR_RGB12U	= 1 << 4,  /* RGB12, 16-bit container */
  	OMAP_DSS_COLOR_ARGB16	= 1 << 5,  /* ARGB16 */
  	OMAP_DSS_COLOR_RGB16	= 1 << 6,  /* RGB16 */
  	OMAP_DSS_COLOR_RGB24U	= 1 << 7,  /* RGB24, 32-bit container */
  	OMAP_DSS_COLOR_RGB24P	= 1 << 8,  /* RGB24, 24-bit container */
  	OMAP_DSS_COLOR_YUV2	= 1 << 9,  /* YUV2 4:2:2 co-sited */
  	OMAP_DSS_COLOR_UYVY	= 1 << 10, /* UYVY 4:2:2 co-sited */
  	OMAP_DSS_COLOR_ARGB32	= 1 << 11, /* ARGB32 */
  	OMAP_DSS_COLOR_RGBA32	= 1 << 12, /* RGBA32 */
  	OMAP_DSS_COLOR_RGBX32	= 1 << 13, /* RGBx32 */
f20e42205   Amber Jain   OMAP: DSS2: Add n...
92
93
94
95
96
  	OMAP_DSS_COLOR_NV12		= 1 << 14, /* NV12 format: YUV 4:2:0 */
  	OMAP_DSS_COLOR_RGBA16		= 1 << 15, /* RGBA16 - 4444 */
  	OMAP_DSS_COLOR_RGBX16		= 1 << 16, /* RGBx16 - 4444 */
  	OMAP_DSS_COLOR_ARGB16_1555	= 1 << 17, /* ARGB16 - 1555 */
  	OMAP_DSS_COLOR_XRGB16_1555	= 1 << 18, /* xRGB16 - 1555 */
559d67018   Tomi Valkeinen   OMAP: DSS2: Displ...
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
  };
  
  enum omap_lcd_display_type {
  	OMAP_DSS_LCD_DISPLAY_STN,
  	OMAP_DSS_LCD_DISPLAY_TFT,
  };
  
  enum omap_dss_load_mode {
  	OMAP_DSS_LOAD_CLUT_AND_FRAME	= 0,
  	OMAP_DSS_LOAD_CLUT_ONLY		= 1,
  	OMAP_DSS_LOAD_FRAME_ONLY	= 2,
  	OMAP_DSS_LOAD_CLUT_ONCE_FRAME	= 3,
  };
  
  enum omap_dss_trans_key_type {
  	OMAP_DSS_COLOR_KEY_GFX_DST = 0,
  	OMAP_DSS_COLOR_KEY_VID_SRC = 1,
  };
  
  enum omap_rfbi_te_mode {
  	OMAP_DSS_RFBI_TE_MODE_1 = 1,
  	OMAP_DSS_RFBI_TE_MODE_2 = 2,
  };
  
  enum omap_panel_config {
  	OMAP_DSS_LCD_IVS		= 1<<0,
  	OMAP_DSS_LCD_IHS		= 1<<1,
  	OMAP_DSS_LCD_IPC		= 1<<2,
  	OMAP_DSS_LCD_IEO		= 1<<3,
  	OMAP_DSS_LCD_RF			= 1<<4,
  	OMAP_DSS_LCD_ONOFF		= 1<<5,
  
  	OMAP_DSS_LCD_TFT		= 1<<20,
  };
  
  enum omap_dss_venc_type {
  	OMAP_DSS_VENC_TYPE_COMPOSITE,
  	OMAP_DSS_VENC_TYPE_SVIDEO,
  };
a3b3cc2b8   Archit Taneja   OMAP: DSS2: Creat...
136
137
138
139
140
141
  enum omap_dss_dsi_pixel_format {
  	OMAP_DSS_DSI_FMT_RGB888,
  	OMAP_DSS_DSI_FMT_RGB666,
  	OMAP_DSS_DSI_FMT_RGB666_PACKED,
  	OMAP_DSS_DSI_FMT_RGB565,
  };
7e951ee99   Archit Taneja   OMAP: DSS2: Creat...
142
143
144
145
  enum omap_dss_dsi_mode {
  	OMAP_DSS_DSI_CMD_MODE = 0,
  	OMAP_DSS_DSI_VIDEO_MODE,
  };
559d67018   Tomi Valkeinen   OMAP: DSS2: Displ...
146
147
148
149
  enum omap_display_caps {
  	OMAP_DSS_DISPLAY_CAP_MANUAL_UPDATE	= 1 << 0,
  	OMAP_DSS_DISPLAY_CAP_TEAR_ELIM		= 1 << 1,
  };
559d67018   Tomi Valkeinen   OMAP: DSS2: Displ...
150
151
152
153
154
155
156
157
158
159
  enum omap_dss_display_state {
  	OMAP_DSS_DISPLAY_DISABLED = 0,
  	OMAP_DSS_DISPLAY_ACTIVE,
  	OMAP_DSS_DISPLAY_SUSPENDED,
  };
  
  /* XXX perhaps this should be removed */
  enum omap_dss_overlay_managers {
  	OMAP_DSS_OVL_MGR_LCD,
  	OMAP_DSS_OVL_MGR_TV,
8613b0005   Sumit Semwal   OMAP: DSS2: Repre...
160
  	OMAP_DSS_OVL_MGR_LCD2,
559d67018   Tomi Valkeinen   OMAP: DSS2: Displ...
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
  };
  
  enum omap_dss_rotation_type {
  	OMAP_DSS_ROT_DMA = 0,
  	OMAP_DSS_ROT_VRFB = 1,
  };
  
  /* clockwise rotation angle */
  enum omap_dss_rotation_angle {
  	OMAP_DSS_ROT_0   = 0,
  	OMAP_DSS_ROT_90  = 1,
  	OMAP_DSS_ROT_180 = 2,
  	OMAP_DSS_ROT_270 = 3,
  };
  
  enum omap_overlay_caps {
  	OMAP_DSS_OVL_CAP_SCALE = 1 << 0,
f6dc81509   Tomi Valkeinen   OMAP: DSS2: Add G...
178
179
  	OMAP_DSS_OVL_CAP_GLOBAL_ALPHA = 1 << 1,
  	OMAP_DSS_OVL_CAP_PRE_MULT_ALPHA = 1 << 2,
11354dd58   Archit Taneja   OMAPDSS/OMAP_VOUT...
180
  	OMAP_DSS_OVL_CAP_ZORDER = 1 << 3,
559d67018   Tomi Valkeinen   OMAP: DSS2: Displ...
181
182
183
  };
  
  enum omap_overlay_manager_caps {
4a9e78abb   Tomi Valkeinen   OMAP: DSS2: Remov...
184
  	OMAP_DSS_DUMMY_VALUE, /* add a dummy value to prevent compiler error */
559d67018   Tomi Valkeinen   OMAP: DSS2: Displ...
185
  };
89a35e517   Archit Taneja   OMAP2PLUS: DSS2: ...
186
187
188
189
190
191
192
  enum omap_dss_clk_source {
  	OMAP_DSS_CLK_SRC_FCK = 0,		/* OMAP2/3: DSS1_ALWON_FCLK
  						 * OMAP4: DSS_FCLK */
  	OMAP_DSS_CLK_SRC_DSI_PLL_HSDIV_DISPC,	/* OMAP3: DSI1_PLL_FCLK
  						 * OMAP4: PLL1_CLK1 */
  	OMAP_DSS_CLK_SRC_DSI_PLL_HSDIV_DSI,	/* OMAP3: DSI2_PLL_FCLK
  						 * OMAP4: PLL1_CLK2 */
5a8b572d8   Archit Taneja   OMAP4: DSS2: DSI:...
193
194
  	OMAP_DSS_CLK_SRC_DSI2_PLL_HSDIV_DISPC,	/* OMAP4: PLL2_CLK1 */
  	OMAP_DSS_CLK_SRC_DSI2_PLL_HSDIV_DSI,	/* OMAP4: PLL2_CLK2 */
89a35e517   Archit Taneja   OMAP2PLUS: DSS2: ...
195
  };
9a9016832   Mythri P K   OMAPDSS: HDMI: Di...
196
197
198
  enum omap_hdmi_flags {
  	OMAP_HDMI_SDA_SCL_EXTERNAL_PULLUP = 1 << 0,
  };
559d67018   Tomi Valkeinen   OMAP: DSS2: Displ...
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
  /* RFBI */
  
  struct rfbi_timings {
  	int cs_on_time;
  	int cs_off_time;
  	int we_on_time;
  	int we_off_time;
  	int re_on_time;
  	int re_off_time;
  	int we_cycle_time;
  	int re_cycle_time;
  	int cs_pulse_width;
  	int access_time;
  
  	int clk_div;
  
  	u32 tim[5];             /* set by rfbi_convert_timings() */
  
  	int converted;
  };
  
  void omap_rfbi_write_command(const void *buf, u32 len);
  void omap_rfbi_read_data(void *buf, u32 len);
  void omap_rfbi_write_data(const void *buf, u32 len);
  void omap_rfbi_write_pixels(const void __iomem *buf, int scr_width,
  		u16 x, u16 y,
  		u16 w, u16 h);
  int omap_rfbi_enable_te(bool enable, unsigned line);
  int omap_rfbi_setup_te(enum omap_rfbi_te_mode mode,
  			     unsigned hs_pulse_time, unsigned vs_pulse_time,
  			     int hs_pol_inv, int vs_pol_inv, int extif_div);
773139f17   Tomi Valkeinen   OMAP: DSS2: RFBI:...
230
231
  void rfbi_bus_lock(void);
  void rfbi_bus_unlock(void);
559d67018   Tomi Valkeinen   OMAP: DSS2: Displ...
232
233
  
  /* DSI */
8af6ff010   Archit Taneja   OMAP: DSS2: DSI V...
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
  
  struct omap_dss_dsi_videomode_data {
  	/* DSI video mode blanking data */
  	/* Unit: byte clock cycles */
  	u16 hsa;
  	u16 hfp;
  	u16 hbp;
  	/* Unit: line clocks */
  	u16 vsa;
  	u16 vfp;
  	u16 vbp;
  
  	/* DSI blanking modes */
  	int blanking_mode;
  	int hsa_blanking_mode;
  	int hbp_blanking_mode;
  	int hfp_blanking_mode;
  
  	/* Video port sync events */
  	int vp_de_pol;
  	int vp_hsync_pol;
  	int vp_vsync_pol;
  	bool vp_vsync_end;
  	bool vp_hsync_end;
  
  	bool ddr_clk_always_on;
  	int window_sync;
  };
1ffefe755   Archit Taneja   OMAP: DSS2: DSI: ...
262
263
264
265
  void dsi_bus_lock(struct omap_dss_device *dssdev);
  void dsi_bus_unlock(struct omap_dss_device *dssdev);
  int dsi_vc_dcs_write(struct omap_dss_device *dssdev, int channel, u8 *data,
  		int len);
6ff8aa318   Archit Taneja   OMAP: DSS2: DSI: ...
266
267
268
269
  int dsi_vc_generic_write(struct omap_dss_device *dssdev, int channel, u8 *data,
  		int len);
  int dsi_vc_dcs_write_0(struct omap_dss_device *dssdev, int channel, u8 dcs_cmd);
  int dsi_vc_generic_write_0(struct omap_dss_device *dssdev, int channel);
1ffefe755   Archit Taneja   OMAP: DSS2: DSI: ...
270
271
  int dsi_vc_dcs_write_1(struct omap_dss_device *dssdev, int channel, u8 dcs_cmd,
  		u8 param);
6ff8aa318   Archit Taneja   OMAP: DSS2: DSI: ...
272
273
274
275
  int dsi_vc_generic_write_1(struct omap_dss_device *dssdev, int channel,
  		u8 param);
  int dsi_vc_generic_write_2(struct omap_dss_device *dssdev, int channel,
  		u8 param1, u8 param2);
1ffefe755   Archit Taneja   OMAP: DSS2: DSI: ...
276
277
  int dsi_vc_dcs_write_nosync(struct omap_dss_device *dssdev, int channel,
  		u8 *data, int len);
6ff8aa318   Archit Taneja   OMAP: DSS2: DSI: ...
278
279
  int dsi_vc_generic_write_nosync(struct omap_dss_device *dssdev, int channel,
  		u8 *data, int len);
1ffefe755   Archit Taneja   OMAP: DSS2: DSI: ...
280
281
  int dsi_vc_dcs_read(struct omap_dss_device *dssdev, int channel, u8 dcs_cmd,
  		u8 *buf, int buflen);
b3b89c05c   Archit Taneja   OMAP: DSS2: DSI: ...
282
283
284
285
286
287
  int dsi_vc_generic_read_0(struct omap_dss_device *dssdev, int channel, u8 *buf,
  		int buflen);
  int dsi_vc_generic_read_1(struct omap_dss_device *dssdev, int channel, u8 param,
  		u8 *buf, int buflen);
  int dsi_vc_generic_read_2(struct omap_dss_device *dssdev, int channel,
  		u8 param1, u8 param2, u8 *buf, int buflen);
1ffefe755   Archit Taneja   OMAP: DSS2: DSI: ...
288
289
290
291
  int dsi_vc_set_max_rx_packet_size(struct omap_dss_device *dssdev, int channel,
  		u16 len);
  int dsi_vc_send_null(struct omap_dss_device *dssdev, int channel);
  int dsi_vc_send_bta_sync(struct omap_dss_device *dssdev, int channel);
9a147a65d   Tomi Valkeinen   OMAPDSS: DSI: cal...
292
293
  int dsi_enable_video_output(struct omap_dss_device *dssdev, int channel);
  void dsi_disable_video_output(struct omap_dss_device *dssdev, int channel);
559d67018   Tomi Valkeinen   OMAP: DSS2: Displ...
294
295
296
  
  /* Board specific data */
  struct omap_dss_board_info {
aac927c93   Tomi Valkeinen   OMAP: DSS2: rewri...
297
  	int (*get_context_loss_count)(struct device *dev);
559d67018   Tomi Valkeinen   OMAP: DSS2: Displ...
298
299
300
  	int num_devices;
  	struct omap_dss_device **devices;
  	struct omap_dss_device *default_device;
5bc416cba   Tomi Valkeinen   OMAP: DSS2: DSI: ...
301
302
  	int (*dsi_enable_pads)(int dsi_id, unsigned lane_mask);
  	void (*dsi_disable_pads)(int dsi_id, unsigned lane_mask);
559d67018   Tomi Valkeinen   OMAP: DSS2: Displ...
303
  };
b7ee79abc   Sumit Semwal   OMAP2, 3: DSS2: C...
304
305
  /* Init with the board info */
  extern int omap_display_init(struct omap_dss_board_info *board_data);
ee9dfd82f   Mythri P K   OMAPDSS: HDMI: Mo...
306
  /* HDMI mux init*/
9a9016832   Mythri P K   OMAPDSS: HDMI: Di...
307
  extern int omap_hdmi_init(enum omap_hdmi_flags flags);
b7ee79abc   Sumit Semwal   OMAP2, 3: DSS2: C...
308

cf07f5316   Senthilvadivu Guruswamy   OMAP2,3: DSS2: Bu...
309
310
311
312
  struct omap_display_platform_data {
  	struct omap_dss_board_info *board_data;
  	/* TODO: Additional members to be added when PM is considered */
  };
559d67018   Tomi Valkeinen   OMAP: DSS2: Displ...
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
  struct omap_video_timings {
  	/* Unit: pixels */
  	u16 x_res;
  	/* Unit: pixels */
  	u16 y_res;
  	/* Unit: KHz */
  	u32 pixel_clock;
  	/* Unit: pixel clocks */
  	u16 hsw;	/* Horizontal synchronization pulse width */
  	/* Unit: pixel clocks */
  	u16 hfp;	/* Horizontal front porch */
  	/* Unit: pixel clocks */
  	u16 hbp;	/* Horizontal back porch */
  	/* Unit: line clocks */
  	u16 vsw;	/* Vertical synchronization pulse width */
  	/* Unit: line clocks */
  	u16 vfp;	/* Vertical front porch */
  	/* Unit: line clocks */
  	u16 vbp;	/* Vertical back porch */
  };
  
  #ifdef CONFIG_OMAP2_DSS_VENC
  /* Hardcoded timings for tv modes. Venc only uses these to
   * identify the mode, and does not actually use the configs
   * itself. However, the configs should be something that
   * a normal monitor can also show */
5a1819e3a   Tobias Klauser   OMAP: DSS2: stora...
339
340
  extern const struct omap_video_timings omap_dss_pal_timings;
  extern const struct omap_video_timings omap_dss_ntsc_timings;
559d67018   Tomi Valkeinen   OMAP: DSS2: Displ...
341
  #endif
3c07cae2c   Tomi Valkeinen   OMAP: DSS2: Add C...
342
343
344
345
346
  struct omap_dss_cpr_coefs {
  	s16 rr, rg, rb;
  	s16 gr, gg, gb;
  	s16 br, bg, bb;
  };
559d67018   Tomi Valkeinen   OMAP: DSS2: Displ...
347
  struct omap_overlay_info {
559d67018   Tomi Valkeinen   OMAP: DSS2: Displ...
348
  	u32 paddr;
0d66cbb53   Amber Jain   OMAP: DSS2: Add s...
349
  	u32 p_uv_addr;  /* for NV12 format */
559d67018   Tomi Valkeinen   OMAP: DSS2: Displ...
350
351
352
353
354
355
356
357
358
359
360
361
362
  	u16 screen_width;
  	u16 width;
  	u16 height;
  	enum omap_color_mode color_mode;
  	u8 rotation;
  	enum omap_dss_rotation_type rotation_type;
  	bool mirror;
  
  	u16 pos_x;
  	u16 pos_y;
  	u16 out_width;	/* if 0, out_width == width */
  	u16 out_height;	/* if 0, out_height == height */
  	u8 global_alpha;
fd28a3907   Rajkumar N   OMAP3630: DSS2: E...
363
  	u8 pre_mult_alpha;
54128701e   Archit Taneja   OMAPDSS: DISPC: z...
364
  	u8 zorder;
559d67018   Tomi Valkeinen   OMAP: DSS2: Displ...
365
366
367
368
369
370
371
372
  };
  
  struct omap_overlay {
  	struct kobject kobj;
  	struct list_head list;
  
  	/* static fields */
  	const char *name;
4a9e78abb   Tomi Valkeinen   OMAP: DSS2: Remov...
373
  	enum omap_plane id;
559d67018   Tomi Valkeinen   OMAP: DSS2: Displ...
374
375
376
377
378
  	enum omap_color_mode supported_modes;
  	enum omap_overlay_caps caps;
  
  	/* dynamic fields */
  	struct omap_overlay_manager *manager;
559d67018   Tomi Valkeinen   OMAP: DSS2: Displ...
379

9d11c321a   Tomi Valkeinen   OMAPDSS: Add comm...
380
381
382
383
384
385
386
387
388
389
  	/*
  	 * The following functions do not block:
  	 *
  	 * is_enabled
  	 * set_overlay_info
  	 * get_overlay_info
  	 *
  	 * The rest of the functions may block and cannot be called from
  	 * interrupt context
  	 */
aaa874a98   Tomi Valkeinen   OMAPDSS: APPLY: r...
390
391
392
  	int (*enable)(struct omap_overlay *ovl);
  	int (*disable)(struct omap_overlay *ovl);
  	bool (*is_enabled)(struct omap_overlay *ovl);
559d67018   Tomi Valkeinen   OMAP: DSS2: Displ...
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
  	int (*set_manager)(struct omap_overlay *ovl,
  		struct omap_overlay_manager *mgr);
  	int (*unset_manager)(struct omap_overlay *ovl);
  
  	int (*set_overlay_info)(struct omap_overlay *ovl,
  			struct omap_overlay_info *info);
  	void (*get_overlay_info)(struct omap_overlay *ovl,
  			struct omap_overlay_info *info);
  
  	int (*wait_for_go)(struct omap_overlay *ovl);
  };
  
  struct omap_overlay_manager_info {
  	u32 default_color;
  
  	enum omap_dss_trans_key_type trans_key_type;
  	u32 trans_key;
  	bool trans_enabled;
11354dd58   Archit Taneja   OMAPDSS/OMAP_VOUT...
411
  	bool partial_alpha_enabled;
3c07cae2c   Tomi Valkeinen   OMAP: DSS2: Add C...
412
413
414
  
  	bool cpr_enable;
  	struct omap_dss_cpr_coefs cpr_coefs;
559d67018   Tomi Valkeinen   OMAP: DSS2: Displ...
415
416
417
418
  };
  
  struct omap_overlay_manager {
  	struct kobject kobj;
559d67018   Tomi Valkeinen   OMAP: DSS2: Displ...
419
420
421
  
  	/* static fields */
  	const char *name;
4a9e78abb   Tomi Valkeinen   OMAP: DSS2: Remov...
422
  	enum omap_channel id;
559d67018   Tomi Valkeinen   OMAP: DSS2: Displ...
423
  	enum omap_overlay_manager_caps caps;
07e327c9c   Tomi Valkeinen   OMAPDSS: store ov...
424
  	struct list_head overlays;
559d67018   Tomi Valkeinen   OMAP: DSS2: Displ...
425
426
427
428
  	enum omap_display_type supported_displays;
  
  	/* dynamic fields */
  	struct omap_dss_device *device;
559d67018   Tomi Valkeinen   OMAP: DSS2: Displ...
429

9d11c321a   Tomi Valkeinen   OMAPDSS: Add comm...
430
431
432
433
434
435
436
437
438
439
  	/*
  	 * The following functions do not block:
  	 *
  	 * set_manager_info
  	 * get_manager_info
  	 * apply
  	 *
  	 * The rest of the functions may block and cannot be called from
  	 * interrupt context
  	 */
559d67018   Tomi Valkeinen   OMAP: DSS2: Displ...
440
441
442
443
444
445
446
447
448
449
450
  	int (*set_device)(struct omap_overlay_manager *mgr,
  		struct omap_dss_device *dssdev);
  	int (*unset_device)(struct omap_overlay_manager *mgr);
  
  	int (*set_manager_info)(struct omap_overlay_manager *mgr,
  			struct omap_overlay_manager_info *info);
  	void (*get_manager_info)(struct omap_overlay_manager *mgr,
  			struct omap_overlay_manager_info *info);
  
  	int (*apply)(struct omap_overlay_manager *mgr);
  	int (*wait_for_go)(struct omap_overlay_manager *mgr);
3f71cbe73   Tomi Valkeinen   OMAP: DSS2: move ...
451
  	int (*wait_for_vsync)(struct omap_overlay_manager *mgr);
559d67018   Tomi Valkeinen   OMAP: DSS2: Displ...
452
453
454
455
456
457
  };
  
  struct omap_dss_device {
  	struct device dev;
  
  	enum omap_display_type type;
18faa1b68   Sumit Semwal   OMAP: DSS2: Intro...
458
  	enum omap_channel channel;
559d67018   Tomi Valkeinen   OMAP: DSS2: Displ...
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
  	union {
  		struct {
  			u8 data_lines;
  		} dpi;
  
  		struct {
  			u8 channel;
  			u8 data_lines;
  		} rfbi;
  
  		struct {
  			u8 datapairs;
  		} sdi;
  
  		struct {
  			u8 clk_lane;
  			u8 clk_pol;
  			u8 data1_lane;
  			u8 data1_pol;
  			u8 data2_lane;
  			u8 data2_pol;
75d7247c0   Archit Taneja   OMAP: DSS2: DSI: ...
480
481
482
483
  			u8 data3_lane;
  			u8 data3_pol;
  			u8 data4_lane;
  			u8 data4_pol;
559d67018   Tomi Valkeinen   OMAP: DSS2: Displ...
484

a72b64b99   Archit Taneja   OMAP: DSS2: Pass ...
485
  			int module;
559d67018   Tomi Valkeinen   OMAP: DSS2: Displ...
486
487
488
489
490
491
492
493
494
495
496
  			bool ext_te;
  			u8 ext_te_gpio;
  		} dsi;
  
  		struct {
  			enum omap_dss_venc_type type;
  			bool invert_polarity;
  		} venc;
  	} phy;
  
  	struct {
c6940a3dc   Tomi Valkeinen   OMAP: DSS2: move ...
497
  		struct {
e88816624   Archit Taneja   OMAP2PLUS: DSS2: ...
498
499
500
501
502
503
504
  			struct {
  				u16 lck_div;
  				u16 pck_div;
  				enum omap_dss_clk_source lcd_clk_src;
  			} channel;
  
  			enum omap_dss_clk_source dispc_fclk_src;
c6940a3dc   Tomi Valkeinen   OMAP: DSS2: move ...
505
506
507
  		} dispc;
  
  		struct {
c90a78ecc   Tomi Valkeinen   OMAP: DSS2: DSI: ...
508
  			/* regn is one greater than TRM's REGN value */
c6940a3dc   Tomi Valkeinen   OMAP: DSS2: move ...
509
510
511
512
513
514
  			u16 regn;
  			u16 regm;
  			u16 regm_dispc;
  			u16 regm_dsi;
  
  			u16 lp_clk_div;
e88816624   Archit Taneja   OMAP2PLUS: DSS2: ...
515
  			enum omap_dss_clk_source dsi_fclk_src;
c6940a3dc   Tomi Valkeinen   OMAP: DSS2: move ...
516
  		} dsi;
6cb07b256   Archit Taneja   OMAP: DSS2: HDMI:...
517
518
  
  		struct {
b44e45825   Tomi Valkeinen   OMAP: DSS2: HDMI:...
519
  			/* regn is one greater than TRM's REGN value */
6cb07b256   Archit Taneja   OMAP: DSS2: HDMI:...
520
521
522
  			u16 regn;
  			u16 regm2;
  		} hdmi;
c6940a3dc   Tomi Valkeinen   OMAP: DSS2: move ...
523
524
525
  	} clocks;
  
  	struct {
559d67018   Tomi Valkeinen   OMAP: DSS2: Displ...
526
527
528
529
530
531
532
  		struct omap_video_timings timings;
  
  		int acbi;	/* ac-bias pin transitions per interrupt */
  		/* Unit: line clocks */
  		int acb;	/* ac-bias pin frequency */
  
  		enum omap_panel_config config;
7e951ee99   Archit Taneja   OMAP: DSS2: Creat...
533

a3b3cc2b8   Archit Taneja   OMAP: DSS2: Creat...
534
  		enum omap_dss_dsi_pixel_format dsi_pix_fmt;
7e951ee99   Archit Taneja   OMAP: DSS2: Creat...
535
  		enum omap_dss_dsi_mode dsi_mode;
8af6ff010   Archit Taneja   OMAP: DSS2: DSI V...
536
  		struct omap_dss_dsi_videomode_data dsi_vm_data;
559d67018   Tomi Valkeinen   OMAP: DSS2: Displ...
537
538
539
540
541
  	} panel;
  
  	struct {
  		u8 pixel_size;
  		struct rfbi_timings rfbi_timings;
559d67018   Tomi Valkeinen   OMAP: DSS2: Displ...
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
  	} ctrl;
  
  	int reset_gpio;
  
  	int max_backlight_level;
  
  	const char *name;
  
  	/* used to match device to driver */
  	const char *driver_name;
  
  	void *data;
  
  	struct omap_dss_driver *driver;
  
  	/* helper variable for driver suspend/resume */
  	bool activate_after_resume;
  
  	enum omap_display_caps caps;
  
  	struct omap_overlay_manager *manager;
  
  	enum omap_dss_display_state state;
559d67018   Tomi Valkeinen   OMAP: DSS2: Displ...
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
  	/* platform specific  */
  	int (*platform_enable)(struct omap_dss_device *dssdev);
  	void (*platform_disable)(struct omap_dss_device *dssdev);
  	int (*set_backlight)(struct omap_dss_device *dssdev, int level);
  	int (*get_backlight)(struct omap_dss_device *dssdev);
  };
  
  struct omap_dss_driver {
  	struct device_driver driver;
  
  	int (*probe)(struct omap_dss_device *);
  	void (*remove)(struct omap_dss_device *);
  
  	int (*enable)(struct omap_dss_device *display);
  	void (*disable)(struct omap_dss_device *display);
  	int (*suspend)(struct omap_dss_device *display);
  	int (*resume)(struct omap_dss_device *display);
  	int (*run_test)(struct omap_dss_device *display, int test);
18946f62c   Tomi Valkeinen   OMAP: DSS2: move ...
583
584
585
  	int (*update)(struct omap_dss_device *dssdev,
  			       u16 x, u16 y, u16 w, u16 h);
  	int (*sync)(struct omap_dss_device *dssdev);
559d67018   Tomi Valkeinen   OMAP: DSS2: Displ...
586
  	int (*enable_te)(struct omap_dss_device *dssdev, bool enable);
225b650d4   Tomi Valkeinen   OMAP: DSS2: move ...
587
  	int (*get_te)(struct omap_dss_device *dssdev);
559d67018   Tomi Valkeinen   OMAP: DSS2: Displ...
588
589
590
591
592
593
594
595
596
597
  
  	u8 (*get_rotate)(struct omap_dss_device *dssdev);
  	int (*set_rotate)(struct omap_dss_device *dssdev, u8 rotate);
  
  	bool (*get_mirror)(struct omap_dss_device *dssdev);
  	int (*set_mirror)(struct omap_dss_device *dssdev, bool enable);
  
  	int (*memory_read)(struct omap_dss_device *dssdev,
  			void *buf, size_t size,
  			u16 x, u16 y, u16 w, u16 h);
96adcecee   Tomi Valkeinen   OMAP: DSS2: move ...
598
599
600
  
  	void (*get_resolution)(struct omap_dss_device *dssdev,
  			u16 *xres, u16 *yres);
7a0987bf2   Jani Nikula   OMAP: DSS2: Add m...
601
602
  	void (*get_dimensions)(struct omap_dss_device *dssdev,
  			u32 *width, u32 *height);
a26995040   Tomi Valkeinen   OMAP: DSS2: move ...
603
  	int (*get_recommended_bpp)(struct omap_dss_device *dssdev);
365113126   Tomi Valkeinen   OMAP: DSS2: move ...
604

69b2048f4   Tomi Valkeinen   OMAP: DSS2: move ...
605
606
607
608
609
610
  	int (*check_timings)(struct omap_dss_device *dssdev,
  			struct omap_video_timings *timings);
  	void (*set_timings)(struct omap_dss_device *dssdev,
  			struct omap_video_timings *timings);
  	void (*get_timings)(struct omap_dss_device *dssdev,
  			struct omap_video_timings *timings);
365113126   Tomi Valkeinen   OMAP: DSS2: move ...
611
612
  	int (*set_wss)(struct omap_dss_device *dssdev, u32 wss);
  	u32 (*get_wss)(struct omap_dss_device *dssdev);
3d5e0ef74   Tomi Valkeinen   OMAP: DSS2: add r...
613
614
  
  	int (*read_edid)(struct omap_dss_device *dssdev, u8 *buf, int len);
df4769c9c   Tomi Valkeinen   OMAP: DSS2: add d...
615
  	bool (*detect)(struct omap_dss_device *dssdev);
559d67018   Tomi Valkeinen   OMAP: DSS2: Displ...
616
617
618
619
  };
  
  int omap_dss_register_driver(struct omap_dss_driver *);
  void omap_dss_unregister_driver(struct omap_dss_driver *);
559d67018   Tomi Valkeinen   OMAP: DSS2: Displ...
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
  void omap_dss_get_device(struct omap_dss_device *dssdev);
  void omap_dss_put_device(struct omap_dss_device *dssdev);
  #define for_each_dss_dev(d) while ((d = omap_dss_get_next_device(d)) != NULL)
  struct omap_dss_device *omap_dss_get_next_device(struct omap_dss_device *from);
  struct omap_dss_device *omap_dss_find_device(void *data,
  		int (*match)(struct omap_dss_device *dssdev, void *data));
  
  int omap_dss_start_device(struct omap_dss_device *dssdev);
  void omap_dss_stop_device(struct omap_dss_device *dssdev);
  
  int omap_dss_get_num_overlay_managers(void);
  struct omap_overlay_manager *omap_dss_get_overlay_manager(int num);
  
  int omap_dss_get_num_overlays(void);
  struct omap_overlay *omap_dss_get_overlay(int num);
96adcecee   Tomi Valkeinen   OMAP: DSS2: move ...
635
636
  void omapdss_default_get_resolution(struct omap_dss_device *dssdev,
  		u16 *xres, u16 *yres);
a26995040   Tomi Valkeinen   OMAP: DSS2: move ...
637
  int omapdss_default_get_recommended_bpp(struct omap_dss_device *dssdev);
559d67018   Tomi Valkeinen   OMAP: DSS2: Displ...
638
639
640
641
642
643
644
645
646
647
  typedef void (*omap_dispc_isr_t) (void *arg, u32 mask);
  int omap_dispc_register_isr(omap_dispc_isr_t isr, void *arg, u32 mask);
  int omap_dispc_unregister_isr(omap_dispc_isr_t isr, void *arg, u32 mask);
  
  int omap_dispc_wait_for_irq_timeout(u32 irqmask, unsigned long timeout);
  int omap_dispc_wait_for_irq_interruptible_timeout(u32 irqmask,
  		unsigned long timeout);
  
  #define to_dss_driver(x) container_of((x), struct omap_dss_driver, driver)
  #define to_dss_device(x) container_of((x), struct omap_dss_device, dev)
1ffefe755   Archit Taneja   OMAP: DSS2: DSI: ...
648
649
  void omapdss_dsi_vc_enable_hs(struct omap_dss_device *dssdev, int channel,
  		bool enable);
225b650d4   Tomi Valkeinen   OMAP: DSS2: move ...
650
  int omapdss_dsi_enable_te(struct omap_dss_device *dssdev, bool enable);
61140c9a8   Tomi Valkeinen   OMAP: DSS2: DSI: ...
651

5476e74a0   Tomi Valkeinen   OMAPDSS: remove p...
652
  int omap_dsi_update(struct omap_dss_device *dssdev, int channel,
18946f62c   Tomi Valkeinen   OMAP: DSS2: move ...
653
  		void (*callback)(int, void *), void *data);
5ee3c1445   Archit Taneja   OMAP: DSS2: Funct...
654
655
656
  int omap_dsi_request_vc(struct omap_dss_device *dssdev, int *channel);
  int omap_dsi_set_vc_id(struct omap_dss_device *dssdev, int channel, int vc_id);
  void omap_dsi_release_vc(struct omap_dss_device *dssdev, int channel);
18946f62c   Tomi Valkeinen   OMAP: DSS2: move ...
657

37ac60e41   Tomi Valkeinen   OMAP: DSS2: move ...
658
  int omapdss_dsi_display_enable(struct omap_dss_device *dssdev);
2a89dc153   Tomi Valkeinen   OMAP: DSS2: DSI: ...
659
  void omapdss_dsi_display_disable(struct omap_dss_device *dssdev,
22d6d6762   Tomi Valkeinen   OMAP: DSS2: DSI: ...
660
  		bool disconnect_lanes, bool enter_ulps);
37ac60e41   Tomi Valkeinen   OMAP: DSS2: move ...
661
662
663
  
  int omapdss_dpi_display_enable(struct omap_dss_device *dssdev);
  void omapdss_dpi_display_disable(struct omap_dss_device *dssdev);
69b2048f4   Tomi Valkeinen   OMAP: DSS2: move ...
664
665
666
667
  void dpi_set_timings(struct omap_dss_device *dssdev,
  			struct omap_video_timings *timings);
  int dpi_check_timings(struct omap_dss_device *dssdev,
  			struct omap_video_timings *timings);
37ac60e41   Tomi Valkeinen   OMAP: DSS2: move ...
668
669
670
671
672
673
  
  int omapdss_sdi_display_enable(struct omap_dss_device *dssdev);
  void omapdss_sdi_display_disable(struct omap_dss_device *dssdev);
  
  int omapdss_rfbi_display_enable(struct omap_dss_device *dssdev);
  void omapdss_rfbi_display_disable(struct omap_dss_device *dssdev);
18946f62c   Tomi Valkeinen   OMAP: DSS2: move ...
674
675
676
677
678
  int omap_rfbi_prepare_update(struct omap_dss_device *dssdev,
  		u16 *x, u16 *y, u16 *w, u16 *h);
  int omap_rfbi_update(struct omap_dss_device *dssdev,
  		u16 x, u16 y, u16 w, u16 h,
  		void (*callback)(void *), void *data);
1d5952a86   Tomi Valkeinen   OMAP: DSS2: RFBI:...
679
680
  int omap_rfbi_configure(struct omap_dss_device *dssdev, int pixel_size,
  		int data_lines);
18946f62c   Tomi Valkeinen   OMAP: DSS2: move ...
681

559d67018   Tomi Valkeinen   OMAP: DSS2: Displ...
682
  #endif