aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/gpu/drm/omapdrm/dss/omapdss.h866
-rw-r--r--include/video/omapdss.h888
2 files changed, 865 insertions, 889 deletions
diff --git a/drivers/gpu/drm/omapdrm/dss/omapdss.h b/drivers/gpu/drm/omapdrm/dss/omapdss.h
index d7e7c909bbc2..9263283952b9 100644
--- a/drivers/gpu/drm/omapdrm/dss/omapdss.h
+++ b/drivers/gpu/drm/omapdrm/dss/omapdss.h
@@ -18,7 +18,871 @@
18#ifndef __OMAP_DRM_DSS_H 18#ifndef __OMAP_DRM_DSS_H
19#define __OMAP_DRM_DSS_H 19#define __OMAP_DRM_DSS_H
20 20
21#include <video/omapdss.h> 21#include <linux/list.h>
22#include <linux/kobject.h>
23#include <linux/device.h>
24#include <linux/interrupt.h>
25#include <video/videomode.h>
26#include <linux/platform_data/omapdss.h>
27
28#define DISPC_IRQ_FRAMEDONE (1 << 0)
29#define DISPC_IRQ_VSYNC (1 << 1)
30#define DISPC_IRQ_EVSYNC_EVEN (1 << 2)
31#define DISPC_IRQ_EVSYNC_ODD (1 << 3)
32#define DISPC_IRQ_ACBIAS_COUNT_STAT (1 << 4)
33#define DISPC_IRQ_PROG_LINE_NUM (1 << 5)
34#define DISPC_IRQ_GFX_FIFO_UNDERFLOW (1 << 6)
35#define DISPC_IRQ_GFX_END_WIN (1 << 7)
36#define DISPC_IRQ_PAL_GAMMA_MASK (1 << 8)
37#define DISPC_IRQ_OCP_ERR (1 << 9)
38#define DISPC_IRQ_VID1_FIFO_UNDERFLOW (1 << 10)
39#define DISPC_IRQ_VID1_END_WIN (1 << 11)
40#define DISPC_IRQ_VID2_FIFO_UNDERFLOW (1 << 12)
41#define DISPC_IRQ_VID2_END_WIN (1 << 13)
42#define DISPC_IRQ_SYNC_LOST (1 << 14)
43#define DISPC_IRQ_SYNC_LOST_DIGIT (1 << 15)
44#define DISPC_IRQ_WAKEUP (1 << 16)
45#define DISPC_IRQ_SYNC_LOST2 (1 << 17)
46#define DISPC_IRQ_VSYNC2 (1 << 18)
47#define DISPC_IRQ_VID3_END_WIN (1 << 19)
48#define DISPC_IRQ_VID3_FIFO_UNDERFLOW (1 << 20)
49#define DISPC_IRQ_ACBIAS_COUNT_STAT2 (1 << 21)
50#define DISPC_IRQ_FRAMEDONE2 (1 << 22)
51#define DISPC_IRQ_FRAMEDONEWB (1 << 23)
52#define DISPC_IRQ_FRAMEDONETV (1 << 24)
53#define DISPC_IRQ_WBBUFFEROVERFLOW (1 << 25)
54#define DISPC_IRQ_WBUNCOMPLETEERROR (1 << 26)
55#define DISPC_IRQ_SYNC_LOST3 (1 << 27)
56#define DISPC_IRQ_VSYNC3 (1 << 28)
57#define DISPC_IRQ_ACBIAS_COUNT_STAT3 (1 << 29)
58#define DISPC_IRQ_FRAMEDONE3 (1 << 30)
59
60struct omap_dss_device;
61struct omap_overlay_manager;
62struct dss_lcd_mgr_config;
63struct snd_aes_iec958;
64struct snd_cea_861_aud_if;
65struct hdmi_avi_infoframe;
66
67enum omap_display_type {
68 OMAP_DISPLAY_TYPE_NONE = 0,
69 OMAP_DISPLAY_TYPE_DPI = 1 << 0,
70 OMAP_DISPLAY_TYPE_DBI = 1 << 1,
71 OMAP_DISPLAY_TYPE_SDI = 1 << 2,
72 OMAP_DISPLAY_TYPE_DSI = 1 << 3,
73 OMAP_DISPLAY_TYPE_VENC = 1 << 4,
74 OMAP_DISPLAY_TYPE_HDMI = 1 << 5,
75 OMAP_DISPLAY_TYPE_DVI = 1 << 6,
76};
77
78enum omap_plane {
79 OMAP_DSS_GFX = 0,
80 OMAP_DSS_VIDEO1 = 1,
81 OMAP_DSS_VIDEO2 = 2,
82 OMAP_DSS_VIDEO3 = 3,
83 OMAP_DSS_WB = 4,
84};
85
86enum omap_channel {
87 OMAP_DSS_CHANNEL_LCD = 0,
88 OMAP_DSS_CHANNEL_DIGIT = 1,
89 OMAP_DSS_CHANNEL_LCD2 = 2,
90 OMAP_DSS_CHANNEL_LCD3 = 3,
91 OMAP_DSS_CHANNEL_WB = 4,
92};
93
94enum omap_color_mode {
95 OMAP_DSS_COLOR_CLUT1 = 1 << 0, /* BITMAP 1 */
96 OMAP_DSS_COLOR_CLUT2 = 1 << 1, /* BITMAP 2 */
97 OMAP_DSS_COLOR_CLUT4 = 1 << 2, /* BITMAP 4 */
98 OMAP_DSS_COLOR_CLUT8 = 1 << 3, /* BITMAP 8 */
99 OMAP_DSS_COLOR_RGB12U = 1 << 4, /* RGB12, 16-bit container */
100 OMAP_DSS_COLOR_ARGB16 = 1 << 5, /* ARGB16 */
101 OMAP_DSS_COLOR_RGB16 = 1 << 6, /* RGB16 */
102 OMAP_DSS_COLOR_RGB24U = 1 << 7, /* RGB24, 32-bit container */
103 OMAP_DSS_COLOR_RGB24P = 1 << 8, /* RGB24, 24-bit container */
104 OMAP_DSS_COLOR_YUV2 = 1 << 9, /* YUV2 4:2:2 co-sited */
105 OMAP_DSS_COLOR_UYVY = 1 << 10, /* UYVY 4:2:2 co-sited */
106 OMAP_DSS_COLOR_ARGB32 = 1 << 11, /* ARGB32 */
107 OMAP_DSS_COLOR_RGBA32 = 1 << 12, /* RGBA32 */
108 OMAP_DSS_COLOR_RGBX32 = 1 << 13, /* RGBx32 */
109 OMAP_DSS_COLOR_NV12 = 1 << 14, /* NV12 format: YUV 4:2:0 */
110 OMAP_DSS_COLOR_RGBA16 = 1 << 15, /* RGBA16 - 4444 */
111 OMAP_DSS_COLOR_RGBX16 = 1 << 16, /* RGBx16 - 4444 */
112 OMAP_DSS_COLOR_ARGB16_1555 = 1 << 17, /* ARGB16 - 1555 */
113 OMAP_DSS_COLOR_XRGB16_1555 = 1 << 18, /* xRGB16 - 1555 */
114};
115
116enum omap_dss_load_mode {
117 OMAP_DSS_LOAD_CLUT_AND_FRAME = 0,
118 OMAP_DSS_LOAD_CLUT_ONLY = 1,
119 OMAP_DSS_LOAD_FRAME_ONLY = 2,
120 OMAP_DSS_LOAD_CLUT_ONCE_FRAME = 3,
121};
122
123enum omap_dss_trans_key_type {
124 OMAP_DSS_COLOR_KEY_GFX_DST = 0,
125 OMAP_DSS_COLOR_KEY_VID_SRC = 1,
126};
127
128enum omap_rfbi_te_mode {
129 OMAP_DSS_RFBI_TE_MODE_1 = 1,
130 OMAP_DSS_RFBI_TE_MODE_2 = 2,
131};
132
133enum omap_dss_signal_level {
134 OMAPDSS_SIG_ACTIVE_LOW,
135 OMAPDSS_SIG_ACTIVE_HIGH,
136};
137
138enum omap_dss_signal_edge {
139 OMAPDSS_DRIVE_SIG_FALLING_EDGE,
140 OMAPDSS_DRIVE_SIG_RISING_EDGE,
141};
142
143enum omap_dss_venc_type {
144 OMAP_DSS_VENC_TYPE_COMPOSITE,
145 OMAP_DSS_VENC_TYPE_SVIDEO,
146};
147
148enum omap_dss_dsi_pixel_format {
149 OMAP_DSS_DSI_FMT_RGB888,
150 OMAP_DSS_DSI_FMT_RGB666,
151 OMAP_DSS_DSI_FMT_RGB666_PACKED,
152 OMAP_DSS_DSI_FMT_RGB565,
153};
154
155enum omap_dss_dsi_mode {
156 OMAP_DSS_DSI_CMD_MODE = 0,
157 OMAP_DSS_DSI_VIDEO_MODE,
158};
159
160enum omap_display_caps {
161 OMAP_DSS_DISPLAY_CAP_MANUAL_UPDATE = 1 << 0,
162 OMAP_DSS_DISPLAY_CAP_TEAR_ELIM = 1 << 1,
163};
164
165enum omap_dss_display_state {
166 OMAP_DSS_DISPLAY_DISABLED = 0,
167 OMAP_DSS_DISPLAY_ACTIVE,
168};
169
170enum omap_dss_rotation_type {
171 OMAP_DSS_ROT_DMA = 1 << 0,
172 OMAP_DSS_ROT_VRFB = 1 << 1,
173 OMAP_DSS_ROT_TILER = 1 << 2,
174};
175
176/* clockwise rotation angle */
177enum omap_dss_rotation_angle {
178 OMAP_DSS_ROT_0 = 0,
179 OMAP_DSS_ROT_90 = 1,
180 OMAP_DSS_ROT_180 = 2,
181 OMAP_DSS_ROT_270 = 3,
182};
183
184enum omap_overlay_caps {
185 OMAP_DSS_OVL_CAP_SCALE = 1 << 0,
186 OMAP_DSS_OVL_CAP_GLOBAL_ALPHA = 1 << 1,
187 OMAP_DSS_OVL_CAP_PRE_MULT_ALPHA = 1 << 2,
188 OMAP_DSS_OVL_CAP_ZORDER = 1 << 3,
189 OMAP_DSS_OVL_CAP_POS = 1 << 4,
190 OMAP_DSS_OVL_CAP_REPLICATION = 1 << 5,
191};
192
193enum omap_overlay_manager_caps {
194 OMAP_DSS_DUMMY_VALUE, /* add a dummy value to prevent compiler error */
195};
196
197enum omap_dss_clk_source {
198 OMAP_DSS_CLK_SRC_FCK = 0, /* OMAP2/3: DSS1_ALWON_FCLK
199 * OMAP4: DSS_FCLK */
200 OMAP_DSS_CLK_SRC_DSI_PLL_HSDIV_DISPC, /* OMAP3: DSI1_PLL_FCLK
201 * OMAP4: PLL1_CLK1 */
202 OMAP_DSS_CLK_SRC_DSI_PLL_HSDIV_DSI, /* OMAP3: DSI2_PLL_FCLK
203 * OMAP4: PLL1_CLK2 */
204 OMAP_DSS_CLK_SRC_DSI2_PLL_HSDIV_DISPC, /* OMAP4: PLL2_CLK1 */
205 OMAP_DSS_CLK_SRC_DSI2_PLL_HSDIV_DSI, /* OMAP4: PLL2_CLK2 */
206};
207
208enum omap_hdmi_flags {
209 OMAP_HDMI_SDA_SCL_EXTERNAL_PULLUP = 1 << 0,
210};
211
212enum omap_dss_output_id {
213 OMAP_DSS_OUTPUT_DPI = 1 << 0,
214 OMAP_DSS_OUTPUT_DBI = 1 << 1,
215 OMAP_DSS_OUTPUT_SDI = 1 << 2,
216 OMAP_DSS_OUTPUT_DSI1 = 1 << 3,
217 OMAP_DSS_OUTPUT_DSI2 = 1 << 4,
218 OMAP_DSS_OUTPUT_VENC = 1 << 5,
219 OMAP_DSS_OUTPUT_HDMI = 1 << 6,
220};
221
222/* RFBI */
223
224struct rfbi_timings {
225 int cs_on_time;
226 int cs_off_time;
227 int we_on_time;
228 int we_off_time;
229 int re_on_time;
230 int re_off_time;
231 int we_cycle_time;
232 int re_cycle_time;
233 int cs_pulse_width;
234 int access_time;
235
236 int clk_div;
237
238 u32 tim[5]; /* set by rfbi_convert_timings() */
239
240 int converted;
241};
242
243/* DSI */
244
245enum omap_dss_dsi_trans_mode {
246 /* Sync Pulses: both sync start and end packets sent */
247 OMAP_DSS_DSI_PULSE_MODE,
248 /* Sync Events: only sync start packets sent */
249 OMAP_DSS_DSI_EVENT_MODE,
250 /* Burst: only sync start packets sent, pixels are time compressed */
251 OMAP_DSS_DSI_BURST_MODE,
252};
253
254struct omap_dss_dsi_videomode_timings {
255 unsigned long hsclk;
256
257 unsigned ndl;
258 unsigned bitspp;
259
260 /* pixels */
261 u16 hact;
262 /* lines */
263 u16 vact;
264
265 /* DSI video mode blanking data */
266 /* Unit: byte clock cycles */
267 u16 hss;
268 u16 hsa;
269 u16 hse;
270 u16 hfp;
271 u16 hbp;
272 /* Unit: line clocks */
273 u16 vsa;
274 u16 vfp;
275 u16 vbp;
276
277 /* DSI blanking modes */
278 int blanking_mode;
279 int hsa_blanking_mode;
280 int hbp_blanking_mode;
281 int hfp_blanking_mode;
282
283 enum omap_dss_dsi_trans_mode trans_mode;
284
285 bool ddr_clk_always_on;
286 int window_sync;
287};
288
289struct omap_dss_dsi_config {
290 enum omap_dss_dsi_mode mode;
291 enum omap_dss_dsi_pixel_format pixel_format;
292 const struct omap_video_timings *timings;
293
294 unsigned long hs_clk_min, hs_clk_max;
295 unsigned long lp_clk_min, lp_clk_max;
296
297 bool ddr_clk_always_on;
298 enum omap_dss_dsi_trans_mode trans_mode;
299};
300
301struct omap_video_timings {
302 /* Unit: pixels */
303 u16 x_res;
304 /* Unit: pixels */
305 u16 y_res;
306 /* Unit: Hz */
307 u32 pixelclock;
308 /* Unit: pixel clocks */
309 u16 hsw; /* Horizontal synchronization pulse width */
310 /* Unit: pixel clocks */
311 u16 hfp; /* Horizontal front porch */
312 /* Unit: pixel clocks */
313 u16 hbp; /* Horizontal back porch */
314 /* Unit: line clocks */
315 u16 vsw; /* Vertical synchronization pulse width */
316 /* Unit: line clocks */
317 u16 vfp; /* Vertical front porch */
318 /* Unit: line clocks */
319 u16 vbp; /* Vertical back porch */
320
321 /* Vsync logic level */
322 enum omap_dss_signal_level vsync_level;
323 /* Hsync logic level */
324 enum omap_dss_signal_level hsync_level;
325 /* Interlaced or Progressive timings */
326 bool interlace;
327 /* Pixel clock edge to drive LCD data */
328 enum omap_dss_signal_edge data_pclk_edge;
329 /* Data enable logic level */
330 enum omap_dss_signal_level de_level;
331 /* Pixel clock edges to drive HSYNC and VSYNC signals */
332 enum omap_dss_signal_edge sync_pclk_edge;
333
334 bool double_pixel;
335};
336
337/* Hardcoded timings for tv modes. Venc only uses these to
338 * identify the mode, and does not actually use the configs
339 * itself. However, the configs should be something that
340 * a normal monitor can also show */
341extern const struct omap_video_timings omap_dss_pal_timings;
342extern const struct omap_video_timings omap_dss_ntsc_timings;
343
344struct omap_dss_cpr_coefs {
345 s16 rr, rg, rb;
346 s16 gr, gg, gb;
347 s16 br, bg, bb;
348};
349
350struct omap_overlay_info {
351 dma_addr_t paddr;
352 dma_addr_t p_uv_addr; /* for NV12 format */
353 u16 screen_width;
354 u16 width;
355 u16 height;
356 enum omap_color_mode color_mode;
357 u8 rotation;
358 enum omap_dss_rotation_type rotation_type;
359 bool mirror;
360
361 u16 pos_x;
362 u16 pos_y;
363 u16 out_width; /* if 0, out_width == width */
364 u16 out_height; /* if 0, out_height == height */
365 u8 global_alpha;
366 u8 pre_mult_alpha;
367 u8 zorder;
368};
369
370struct omap_overlay {
371 struct kobject kobj;
372 struct list_head list;
373
374 /* static fields */
375 const char *name;
376 enum omap_plane id;
377 enum omap_color_mode supported_modes;
378 enum omap_overlay_caps caps;
379
380 /* dynamic fields */
381 struct omap_overlay_manager *manager;
382
383 /*
384 * The following functions do not block:
385 *
386 * is_enabled
387 * set_overlay_info
388 * get_overlay_info
389 *
390 * The rest of the functions may block and cannot be called from
391 * interrupt context
392 */
393
394 int (*enable)(struct omap_overlay *ovl);
395 int (*disable)(struct omap_overlay *ovl);
396 bool (*is_enabled)(struct omap_overlay *ovl);
397
398 int (*set_manager)(struct omap_overlay *ovl,
399 struct omap_overlay_manager *mgr);
400 int (*unset_manager)(struct omap_overlay *ovl);
401
402 int (*set_overlay_info)(struct omap_overlay *ovl,
403 struct omap_overlay_info *info);
404 void (*get_overlay_info)(struct omap_overlay *ovl,
405 struct omap_overlay_info *info);
406
407 int (*wait_for_go)(struct omap_overlay *ovl);
408
409 struct omap_dss_device *(*get_device)(struct omap_overlay *ovl);
410};
411
412struct omap_overlay_manager_info {
413 u32 default_color;
414
415 enum omap_dss_trans_key_type trans_key_type;
416 u32 trans_key;
417 bool trans_enabled;
418
419 bool partial_alpha_enabled;
420
421 bool cpr_enable;
422 struct omap_dss_cpr_coefs cpr_coefs;
423};
424
425struct omap_overlay_manager {
426 struct kobject kobj;
427
428 /* static fields */
429 const char *name;
430 enum omap_channel id;
431 enum omap_overlay_manager_caps caps;
432 struct list_head overlays;
433 enum omap_display_type supported_displays;
434 enum omap_dss_output_id supported_outputs;
435
436 /* dynamic fields */
437 struct omap_dss_device *output;
438
439 /*
440 * The following functions do not block:
441 *
442 * set_manager_info
443 * get_manager_info
444 * apply
445 *
446 * The rest of the functions may block and cannot be called from
447 * interrupt context
448 */
449
450 int (*set_output)(struct omap_overlay_manager *mgr,
451 struct omap_dss_device *output);
452 int (*unset_output)(struct omap_overlay_manager *mgr);
453
454 int (*set_manager_info)(struct omap_overlay_manager *mgr,
455 struct omap_overlay_manager_info *info);
456 void (*get_manager_info)(struct omap_overlay_manager *mgr,
457 struct omap_overlay_manager_info *info);
458
459 int (*apply)(struct omap_overlay_manager *mgr);
460 int (*wait_for_go)(struct omap_overlay_manager *mgr);
461 int (*wait_for_vsync)(struct omap_overlay_manager *mgr);
462
463 struct omap_dss_device *(*get_device)(struct omap_overlay_manager *mgr);
464};
465
466/* 22 pins means 1 clk lane and 10 data lanes */
467#define OMAP_DSS_MAX_DSI_PINS 22
468
469struct omap_dsi_pin_config {
470 int num_pins;
471 /*
472 * pin numbers in the following order:
473 * clk+, clk-
474 * data1+, data1-
475 * data2+, data2-
476 * ...
477 */
478 int pins[OMAP_DSS_MAX_DSI_PINS];
479};
480
481struct omap_dss_writeback_info {
482 u32 paddr;
483 u32 p_uv_addr;
484 u16 buf_width;
485 u16 width;
486 u16 height;
487 enum omap_color_mode color_mode;
488 u8 rotation;
489 enum omap_dss_rotation_type rotation_type;
490 bool mirror;
491 u8 pre_mult_alpha;
492};
493
494struct omapdss_dpi_ops {
495 int (*connect)(struct omap_dss_device *dssdev,
496 struct omap_dss_device *dst);
497 void (*disconnect)(struct omap_dss_device *dssdev,
498 struct omap_dss_device *dst);
499
500 int (*enable)(struct omap_dss_device *dssdev);
501 void (*disable)(struct omap_dss_device *dssdev);
502
503 int (*check_timings)(struct omap_dss_device *dssdev,
504 struct omap_video_timings *timings);
505 void (*set_timings)(struct omap_dss_device *dssdev,
506 struct omap_video_timings *timings);
507 void (*get_timings)(struct omap_dss_device *dssdev,
508 struct omap_video_timings *timings);
509
510 void (*set_data_lines)(struct omap_dss_device *dssdev, int data_lines);
511};
512
513struct omapdss_sdi_ops {
514 int (*connect)(struct omap_dss_device *dssdev,
515 struct omap_dss_device *dst);
516 void (*disconnect)(struct omap_dss_device *dssdev,
517 struct omap_dss_device *dst);
518
519 int (*enable)(struct omap_dss_device *dssdev);
520 void (*disable)(struct omap_dss_device *dssdev);
521
522 int (*check_timings)(struct omap_dss_device *dssdev,
523 struct omap_video_timings *timings);
524 void (*set_timings)(struct omap_dss_device *dssdev,
525 struct omap_video_timings *timings);
526 void (*get_timings)(struct omap_dss_device *dssdev,
527 struct omap_video_timings *timings);
528
529 void (*set_datapairs)(struct omap_dss_device *dssdev, int datapairs);
530};
531
532struct omapdss_dvi_ops {
533 int (*connect)(struct omap_dss_device *dssdev,
534 struct omap_dss_device *dst);
535 void (*disconnect)(struct omap_dss_device *dssdev,
536 struct omap_dss_device *dst);
537
538 int (*enable)(struct omap_dss_device *dssdev);
539 void (*disable)(struct omap_dss_device *dssdev);
540
541 int (*check_timings)(struct omap_dss_device *dssdev,
542 struct omap_video_timings *timings);
543 void (*set_timings)(struct omap_dss_device *dssdev,
544 struct omap_video_timings *timings);
545 void (*get_timings)(struct omap_dss_device *dssdev,
546 struct omap_video_timings *timings);
547};
548
549struct omapdss_atv_ops {
550 int (*connect)(struct omap_dss_device *dssdev,
551 struct omap_dss_device *dst);
552 void (*disconnect)(struct omap_dss_device *dssdev,
553 struct omap_dss_device *dst);
554
555 int (*enable)(struct omap_dss_device *dssdev);
556 void (*disable)(struct omap_dss_device *dssdev);
557
558 int (*check_timings)(struct omap_dss_device *dssdev,
559 struct omap_video_timings *timings);
560 void (*set_timings)(struct omap_dss_device *dssdev,
561 struct omap_video_timings *timings);
562 void (*get_timings)(struct omap_dss_device *dssdev,
563 struct omap_video_timings *timings);
564
565 void (*set_type)(struct omap_dss_device *dssdev,
566 enum omap_dss_venc_type type);
567 void (*invert_vid_out_polarity)(struct omap_dss_device *dssdev,
568 bool invert_polarity);
569
570 int (*set_wss)(struct omap_dss_device *dssdev, u32 wss);
571 u32 (*get_wss)(struct omap_dss_device *dssdev);
572};
573
574struct omapdss_hdmi_ops {
575 int (*connect)(struct omap_dss_device *dssdev,
576 struct omap_dss_device *dst);
577 void (*disconnect)(struct omap_dss_device *dssdev,
578 struct omap_dss_device *dst);
579
580 int (*enable)(struct omap_dss_device *dssdev);
581 void (*disable)(struct omap_dss_device *dssdev);
582
583 int (*check_timings)(struct omap_dss_device *dssdev,
584 struct omap_video_timings *timings);
585 void (*set_timings)(struct omap_dss_device *dssdev,
586 struct omap_video_timings *timings);
587 void (*get_timings)(struct omap_dss_device *dssdev,
588 struct omap_video_timings *timings);
589
590 int (*read_edid)(struct omap_dss_device *dssdev, u8 *buf, int len);
591 bool (*detect)(struct omap_dss_device *dssdev);
592
593 int (*set_hdmi_mode)(struct omap_dss_device *dssdev, bool hdmi_mode);
594 int (*set_infoframe)(struct omap_dss_device *dssdev,
595 const struct hdmi_avi_infoframe *avi);
596};
597
598struct omapdss_dsi_ops {
599 int (*connect)(struct omap_dss_device *dssdev,
600 struct omap_dss_device *dst);
601 void (*disconnect)(struct omap_dss_device *dssdev,
602 struct omap_dss_device *dst);
603
604 int (*enable)(struct omap_dss_device *dssdev);
605 void (*disable)(struct omap_dss_device *dssdev, bool disconnect_lanes,
606 bool enter_ulps);
607
608 /* bus configuration */
609 int (*set_config)(struct omap_dss_device *dssdev,
610 const struct omap_dss_dsi_config *cfg);
611 int (*configure_pins)(struct omap_dss_device *dssdev,
612 const struct omap_dsi_pin_config *pin_cfg);
613
614 void (*enable_hs)(struct omap_dss_device *dssdev, int channel,
615 bool enable);
616 int (*enable_te)(struct omap_dss_device *dssdev, bool enable);
617
618 int (*update)(struct omap_dss_device *dssdev, int channel,
619 void (*callback)(int, void *), void *data);
620
621 void (*bus_lock)(struct omap_dss_device *dssdev);
622 void (*bus_unlock)(struct omap_dss_device *dssdev);
623
624 int (*enable_video_output)(struct omap_dss_device *dssdev, int channel);
625 void (*disable_video_output)(struct omap_dss_device *dssdev,
626 int channel);
627
628 int (*request_vc)(struct omap_dss_device *dssdev, int *channel);
629 int (*set_vc_id)(struct omap_dss_device *dssdev, int channel,
630 int vc_id);
631 void (*release_vc)(struct omap_dss_device *dssdev, int channel);
632
633 /* data transfer */
634 int (*dcs_write)(struct omap_dss_device *dssdev, int channel,
635 u8 *data, int len);
636 int (*dcs_write_nosync)(struct omap_dss_device *dssdev, int channel,
637 u8 *data, int len);
638 int (*dcs_read)(struct omap_dss_device *dssdev, int channel, u8 dcs_cmd,
639 u8 *data, int len);
640
641 int (*gen_write)(struct omap_dss_device *dssdev, int channel,
642 u8 *data, int len);
643 int (*gen_write_nosync)(struct omap_dss_device *dssdev, int channel,
644 u8 *data, int len);
645 int (*gen_read)(struct omap_dss_device *dssdev, int channel,
646 u8 *reqdata, int reqlen,
647 u8 *data, int len);
648
649 int (*bta_sync)(struct omap_dss_device *dssdev, int channel);
650
651 int (*set_max_rx_packet_size)(struct omap_dss_device *dssdev,
652 int channel, u16 plen);
653};
654
655struct omap_dss_device {
656 struct kobject kobj;
657 struct device *dev;
658
659 struct module *owner;
660
661 struct list_head panel_list;
662
663 /* alias in the form of "display%d" */
664 char alias[16];
665
666 enum omap_display_type type;
667 enum omap_display_type output_type;
668
669 union {
670 struct {
671 u8 data_lines;
672 } dpi;
673
674 struct {
675 u8 channel;
676 u8 data_lines;
677 } rfbi;
678
679 struct {
680 u8 datapairs;
681 } sdi;
682
683 struct {
684 int module;
685 } dsi;
686
687 struct {
688 enum omap_dss_venc_type type;
689 bool invert_polarity;
690 } venc;
691 } phy;
692
693 struct {
694 struct omap_video_timings timings;
695
696 enum omap_dss_dsi_pixel_format dsi_pix_fmt;
697 enum omap_dss_dsi_mode dsi_mode;
698 } panel;
699
700 struct {
701 u8 pixel_size;
702 struct rfbi_timings rfbi_timings;
703 } ctrl;
704
705 const char *name;
706
707 /* used to match device to driver */
708 const char *driver_name;
709
710 void *data;
711
712 struct omap_dss_driver *driver;
713
714 union {
715 const struct omapdss_dpi_ops *dpi;
716 const struct omapdss_sdi_ops *sdi;
717 const struct omapdss_dvi_ops *dvi;
718 const struct omapdss_hdmi_ops *hdmi;
719 const struct omapdss_atv_ops *atv;
720 const struct omapdss_dsi_ops *dsi;
721 } ops;
722
723 /* helper variable for driver suspend/resume */
724 bool activate_after_resume;
725
726 enum omap_display_caps caps;
727
728 struct omap_dss_device *src;
729
730 enum omap_dss_display_state state;
731
732 /* OMAP DSS output specific fields */
733
734 struct list_head list;
735
736 /* DISPC channel for this output */
737 enum omap_channel dispc_channel;
738 bool dispc_channel_connected;
739
740 /* output instance */
741 enum omap_dss_output_id id;
742
743 /* the port number in the DT node */
744 int port_num;
745
746 /* dynamic fields */
747 struct omap_overlay_manager *manager;
748
749 struct omap_dss_device *dst;
750};
751
752struct omap_dss_driver {
753 int (*probe)(struct omap_dss_device *);
754 void (*remove)(struct omap_dss_device *);
755
756 int (*connect)(struct omap_dss_device *dssdev);
757 void (*disconnect)(struct omap_dss_device *dssdev);
758
759 int (*enable)(struct omap_dss_device *display);
760 void (*disable)(struct omap_dss_device *display);
761 int (*run_test)(struct omap_dss_device *display, int test);
762
763 int (*update)(struct omap_dss_device *dssdev,
764 u16 x, u16 y, u16 w, u16 h);
765 int (*sync)(struct omap_dss_device *dssdev);
766
767 int (*enable_te)(struct omap_dss_device *dssdev, bool enable);
768 int (*get_te)(struct omap_dss_device *dssdev);
769
770 u8 (*get_rotate)(struct omap_dss_device *dssdev);
771 int (*set_rotate)(struct omap_dss_device *dssdev, u8 rotate);
772
773 bool (*get_mirror)(struct omap_dss_device *dssdev);
774 int (*set_mirror)(struct omap_dss_device *dssdev, bool enable);
775
776 int (*memory_read)(struct omap_dss_device *dssdev,
777 void *buf, size_t size,
778 u16 x, u16 y, u16 w, u16 h);
779
780 void (*get_resolution)(struct omap_dss_device *dssdev,
781 u16 *xres, u16 *yres);
782 void (*get_dimensions)(struct omap_dss_device *dssdev,
783 u32 *width, u32 *height);
784 int (*get_recommended_bpp)(struct omap_dss_device *dssdev);
785
786 int (*check_timings)(struct omap_dss_device *dssdev,
787 struct omap_video_timings *timings);
788 void (*set_timings)(struct omap_dss_device *dssdev,
789 struct omap_video_timings *timings);
790 void (*get_timings)(struct omap_dss_device *dssdev,
791 struct omap_video_timings *timings);
792
793 int (*set_wss)(struct omap_dss_device *dssdev, u32 wss);
794 u32 (*get_wss)(struct omap_dss_device *dssdev);
795
796 int (*read_edid)(struct omap_dss_device *dssdev, u8 *buf, int len);
797 bool (*detect)(struct omap_dss_device *dssdev);
798
799 int (*set_hdmi_mode)(struct omap_dss_device *dssdev, bool hdmi_mode);
800 int (*set_hdmi_infoframe)(struct omap_dss_device *dssdev,
801 const struct hdmi_avi_infoframe *avi);
802};
803
804enum omapdss_version omapdss_get_version(void);
805bool omapdss_is_initialized(void);
806
807int omap_dss_register_driver(struct omap_dss_driver *);
808void omap_dss_unregister_driver(struct omap_dss_driver *);
809
810int omapdss_register_display(struct omap_dss_device *dssdev);
811void omapdss_unregister_display(struct omap_dss_device *dssdev);
812
813struct omap_dss_device *omap_dss_get_device(struct omap_dss_device *dssdev);
814void omap_dss_put_device(struct omap_dss_device *dssdev);
815#define for_each_dss_dev(d) while ((d = omap_dss_get_next_device(d)) != NULL)
816struct omap_dss_device *omap_dss_get_next_device(struct omap_dss_device *from);
817struct omap_dss_device *omap_dss_find_device(void *data,
818 int (*match)(struct omap_dss_device *dssdev, void *data));
819const char *omapdss_get_default_display_name(void);
820
821void videomode_to_omap_video_timings(const struct videomode *vm,
822 struct omap_video_timings *ovt);
823void omap_video_timings_to_videomode(const struct omap_video_timings *ovt,
824 struct videomode *vm);
825
826int dss_feat_get_num_mgrs(void);
827int dss_feat_get_num_ovls(void);
828enum omap_color_mode dss_feat_get_supported_color_modes(enum omap_plane plane);
829
830
831
832int omap_dss_get_num_overlay_managers(void);
833struct omap_overlay_manager *omap_dss_get_overlay_manager(int num);
834
835int omap_dss_get_num_overlays(void);
836struct omap_overlay *omap_dss_get_overlay(int num);
837
838int omapdss_register_output(struct omap_dss_device *output);
839void omapdss_unregister_output(struct omap_dss_device *output);
840struct omap_dss_device *omap_dss_get_output(enum omap_dss_output_id id);
841struct omap_dss_device *omap_dss_find_output(const char *name);
842struct omap_dss_device *omap_dss_find_output_by_port_node(struct device_node *port);
843int omapdss_output_set_device(struct omap_dss_device *out,
844 struct omap_dss_device *dssdev);
845int omapdss_output_unset_device(struct omap_dss_device *out);
846
847struct omap_dss_device *omapdss_find_output_from_display(struct omap_dss_device *dssdev);
848struct omap_overlay_manager *omapdss_find_mgr_from_display(struct omap_dss_device *dssdev);
849
850void omapdss_default_get_resolution(struct omap_dss_device *dssdev,
851 u16 *xres, u16 *yres);
852int omapdss_default_get_recommended_bpp(struct omap_dss_device *dssdev);
853void omapdss_default_get_timings(struct omap_dss_device *dssdev,
854 struct omap_video_timings *timings);
855
856typedef void (*omap_dispc_isr_t) (void *arg, u32 mask);
857int omap_dispc_register_isr(omap_dispc_isr_t isr, void *arg, u32 mask);
858int omap_dispc_unregister_isr(omap_dispc_isr_t isr, void *arg, u32 mask);
859
860int omapdss_compat_init(void);
861void omapdss_compat_uninit(void);
862
863static inline bool omapdss_device_is_connected(struct omap_dss_device *dssdev)
864{
865 return dssdev->src;
866}
867
868static inline bool omapdss_device_is_enabled(struct omap_dss_device *dssdev)
869{
870 return dssdev->state == OMAP_DSS_DISPLAY_ACTIVE;
871}
872
873struct device_node *
874omapdss_of_get_next_port(const struct device_node *parent,
875 struct device_node *prev);
876
877struct device_node *
878omapdss_of_get_next_endpoint(const struct device_node *parent,
879 struct device_node *prev);
880
881struct device_node *
882omapdss_of_get_first_endpoint(const struct device_node *parent);
883
884struct omap_dss_device *
885omapdss_of_find_source_for_first_ep(struct device_node *node);
22 886
23u32 dispc_read_irqstatus(void); 887u32 dispc_read_irqstatus(void);
24void dispc_clear_irqstatus(u32 mask); 888void dispc_clear_irqstatus(u32 mask);
diff --git a/include/video/omapdss.h b/include/video/omapdss.h
deleted file mode 100644
index b25e2eab4b48..000000000000
--- a/include/video/omapdss.h
+++ /dev/null
@@ -1,888 +0,0 @@
1/*
2 * Copyright (C) 2008 Nokia Corporation
3 * Author: Tomi Valkeinen <tomi.valkeinen@nokia.com>
4 *
5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 as published by
7 * the Free Software Foundation.
8 *
9 * This program is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12 * more details.
13 *
14 * You should have received a copy of the GNU General Public License along with
15 * this program. If not, see <http://www.gnu.org/licenses/>.
16 */
17
18#ifndef __OMAP_OMAPDSS_H
19#define __OMAP_OMAPDSS_H
20
21#include <linux/list.h>
22#include <linux/kobject.h>
23#include <linux/device.h>
24#include <linux/interrupt.h>
25#include <linux/platform_data/omapdss.h>
26
27#include <video/videomode.h>
28
29#define DISPC_IRQ_FRAMEDONE (1 << 0)
30#define DISPC_IRQ_VSYNC (1 << 1)
31#define DISPC_IRQ_EVSYNC_EVEN (1 << 2)
32#define DISPC_IRQ_EVSYNC_ODD (1 << 3)
33#define DISPC_IRQ_ACBIAS_COUNT_STAT (1 << 4)
34#define DISPC_IRQ_PROG_LINE_NUM (1 << 5)
35#define DISPC_IRQ_GFX_FIFO_UNDERFLOW (1 << 6)
36#define DISPC_IRQ_GFX_END_WIN (1 << 7)
37#define DISPC_IRQ_PAL_GAMMA_MASK (1 << 8)
38#define DISPC_IRQ_OCP_ERR (1 << 9)
39#define DISPC_IRQ_VID1_FIFO_UNDERFLOW (1 << 10)
40#define DISPC_IRQ_VID1_END_WIN (1 << 11)
41#define DISPC_IRQ_VID2_FIFO_UNDERFLOW (1 << 12)
42#define DISPC_IRQ_VID2_END_WIN (1 << 13)
43#define DISPC_IRQ_SYNC_LOST (1 << 14)
44#define DISPC_IRQ_SYNC_LOST_DIGIT (1 << 15)
45#define DISPC_IRQ_WAKEUP (1 << 16)
46#define DISPC_IRQ_SYNC_LOST2 (1 << 17)
47#define DISPC_IRQ_VSYNC2 (1 << 18)
48#define DISPC_IRQ_VID3_END_WIN (1 << 19)
49#define DISPC_IRQ_VID3_FIFO_UNDERFLOW (1 << 20)
50#define DISPC_IRQ_ACBIAS_COUNT_STAT2 (1 << 21)
51#define DISPC_IRQ_FRAMEDONE2 (1 << 22)
52#define DISPC_IRQ_FRAMEDONEWB (1 << 23)
53#define DISPC_IRQ_FRAMEDONETV (1 << 24)
54#define DISPC_IRQ_WBBUFFEROVERFLOW (1 << 25)
55#define DISPC_IRQ_WBUNCOMPLETEERROR (1 << 26)
56#define DISPC_IRQ_SYNC_LOST3 (1 << 27)
57#define DISPC_IRQ_VSYNC3 (1 << 28)
58#define DISPC_IRQ_ACBIAS_COUNT_STAT3 (1 << 29)
59#define DISPC_IRQ_FRAMEDONE3 (1 << 30)
60
61struct omap_dss_device;
62struct omap_overlay_manager;
63struct dss_lcd_mgr_config;
64struct snd_aes_iec958;
65struct snd_cea_861_aud_if;
66struct hdmi_avi_infoframe;
67
68enum omap_display_type {
69 OMAP_DISPLAY_TYPE_NONE = 0,
70 OMAP_DISPLAY_TYPE_DPI = 1 << 0,
71 OMAP_DISPLAY_TYPE_DBI = 1 << 1,
72 OMAP_DISPLAY_TYPE_SDI = 1 << 2,
73 OMAP_DISPLAY_TYPE_DSI = 1 << 3,
74 OMAP_DISPLAY_TYPE_VENC = 1 << 4,
75 OMAP_DISPLAY_TYPE_HDMI = 1 << 5,
76 OMAP_DISPLAY_TYPE_DVI = 1 << 6,
77};
78
79enum omap_plane {
80 OMAP_DSS_GFX = 0,
81 OMAP_DSS_VIDEO1 = 1,
82 OMAP_DSS_VIDEO2 = 2,
83 OMAP_DSS_VIDEO3 = 3,
84 OMAP_DSS_WB = 4,
85};
86
87enum omap_channel {
88 OMAP_DSS_CHANNEL_LCD = 0,
89 OMAP_DSS_CHANNEL_DIGIT = 1,
90 OMAP_DSS_CHANNEL_LCD2 = 2,
91 OMAP_DSS_CHANNEL_LCD3 = 3,
92 OMAP_DSS_CHANNEL_WB = 4,
93};
94
95enum omap_color_mode {
96 OMAP_DSS_COLOR_CLUT1 = 1 << 0, /* BITMAP 1 */
97 OMAP_DSS_COLOR_CLUT2 = 1 << 1, /* BITMAP 2 */
98 OMAP_DSS_COLOR_CLUT4 = 1 << 2, /* BITMAP 4 */
99 OMAP_DSS_COLOR_CLUT8 = 1 << 3, /* BITMAP 8 */
100 OMAP_DSS_COLOR_RGB12U = 1 << 4, /* RGB12, 16-bit container */
101 OMAP_DSS_COLOR_ARGB16 = 1 << 5, /* ARGB16 */
102 OMAP_DSS_COLOR_RGB16 = 1 << 6, /* RGB16 */
103 OMAP_DSS_COLOR_RGB24U = 1 << 7, /* RGB24, 32-bit container */
104 OMAP_DSS_COLOR_RGB24P = 1 << 8, /* RGB24, 24-bit container */
105 OMAP_DSS_COLOR_YUV2 = 1 << 9, /* YUV2 4:2:2 co-sited */
106 OMAP_DSS_COLOR_UYVY = 1 << 10, /* UYVY 4:2:2 co-sited */
107 OMAP_DSS_COLOR_ARGB32 = 1 << 11, /* ARGB32 */
108 OMAP_DSS_COLOR_RGBA32 = 1 << 12, /* RGBA32 */
109 OMAP_DSS_COLOR_RGBX32 = 1 << 13, /* RGBx32 */
110 OMAP_DSS_COLOR_NV12 = 1 << 14, /* NV12 format: YUV 4:2:0 */
111 OMAP_DSS_COLOR_RGBA16 = 1 << 15, /* RGBA16 - 4444 */
112 OMAP_DSS_COLOR_RGBX16 = 1 << 16, /* RGBx16 - 4444 */
113 OMAP_DSS_COLOR_ARGB16_1555 = 1 << 17, /* ARGB16 - 1555 */
114 OMAP_DSS_COLOR_XRGB16_1555 = 1 << 18, /* xRGB16 - 1555 */
115};
116
117enum omap_dss_load_mode {
118 OMAP_DSS_LOAD_CLUT_AND_FRAME = 0,
119 OMAP_DSS_LOAD_CLUT_ONLY = 1,
120 OMAP_DSS_LOAD_FRAME_ONLY = 2,
121 OMAP_DSS_LOAD_CLUT_ONCE_FRAME = 3,
122};
123
124enum omap_dss_trans_key_type {
125 OMAP_DSS_COLOR_KEY_GFX_DST = 0,
126 OMAP_DSS_COLOR_KEY_VID_SRC = 1,
127};
128
129enum omap_rfbi_te_mode {
130 OMAP_DSS_RFBI_TE_MODE_1 = 1,
131 OMAP_DSS_RFBI_TE_MODE_2 = 2,
132};
133
134enum omap_dss_signal_level {
135 OMAPDSS_SIG_ACTIVE_LOW,
136 OMAPDSS_SIG_ACTIVE_HIGH,
137};
138
139enum omap_dss_signal_edge {
140 OMAPDSS_DRIVE_SIG_FALLING_EDGE,
141 OMAPDSS_DRIVE_SIG_RISING_EDGE,
142};
143
144enum omap_dss_venc_type {
145 OMAP_DSS_VENC_TYPE_COMPOSITE,
146 OMAP_DSS_VENC_TYPE_SVIDEO,
147};
148
149enum omap_dss_dsi_pixel_format {
150 OMAP_DSS_DSI_FMT_RGB888,
151 OMAP_DSS_DSI_FMT_RGB666,
152 OMAP_DSS_DSI_FMT_RGB666_PACKED,
153 OMAP_DSS_DSI_FMT_RGB565,
154};
155
156enum omap_dss_dsi_mode {
157 OMAP_DSS_DSI_CMD_MODE = 0,
158 OMAP_DSS_DSI_VIDEO_MODE,
159};
160
161enum omap_display_caps {
162 OMAP_DSS_DISPLAY_CAP_MANUAL_UPDATE = 1 << 0,
163 OMAP_DSS_DISPLAY_CAP_TEAR_ELIM = 1 << 1,
164};
165
166enum omap_dss_display_state {
167 OMAP_DSS_DISPLAY_DISABLED = 0,
168 OMAP_DSS_DISPLAY_ACTIVE,
169};
170
171enum omap_dss_rotation_type {
172 OMAP_DSS_ROT_DMA = 1 << 0,
173 OMAP_DSS_ROT_VRFB = 1 << 1,
174 OMAP_DSS_ROT_TILER = 1 << 2,
175};
176
177/* clockwise rotation angle */
178enum omap_dss_rotation_angle {
179 OMAP_DSS_ROT_0 = 0,
180 OMAP_DSS_ROT_90 = 1,
181 OMAP_DSS_ROT_180 = 2,
182 OMAP_DSS_ROT_270 = 3,
183};
184
185enum omap_overlay_caps {
186 OMAP_DSS_OVL_CAP_SCALE = 1 << 0,
187 OMAP_DSS_OVL_CAP_GLOBAL_ALPHA = 1 << 1,
188 OMAP_DSS_OVL_CAP_PRE_MULT_ALPHA = 1 << 2,
189 OMAP_DSS_OVL_CAP_ZORDER = 1 << 3,
190 OMAP_DSS_OVL_CAP_POS = 1 << 4,
191 OMAP_DSS_OVL_CAP_REPLICATION = 1 << 5,
192};
193
194enum omap_overlay_manager_caps {
195 OMAP_DSS_DUMMY_VALUE, /* add a dummy value to prevent compiler error */
196};
197
198enum omap_dss_clk_source {
199 OMAP_DSS_CLK_SRC_FCK = 0, /* OMAP2/3: DSS1_ALWON_FCLK
200 * OMAP4: DSS_FCLK */
201 OMAP_DSS_CLK_SRC_DSI_PLL_HSDIV_DISPC, /* OMAP3: DSI1_PLL_FCLK
202 * OMAP4: PLL1_CLK1 */
203 OMAP_DSS_CLK_SRC_DSI_PLL_HSDIV_DSI, /* OMAP3: DSI2_PLL_FCLK
204 * OMAP4: PLL1_CLK2 */
205 OMAP_DSS_CLK_SRC_DSI2_PLL_HSDIV_DISPC, /* OMAP4: PLL2_CLK1 */
206 OMAP_DSS_CLK_SRC_DSI2_PLL_HSDIV_DSI, /* OMAP4: PLL2_CLK2 */
207};
208
209enum omap_hdmi_flags {
210 OMAP_HDMI_SDA_SCL_EXTERNAL_PULLUP = 1 << 0,
211};
212
213enum omap_dss_output_id {
214 OMAP_DSS_OUTPUT_DPI = 1 << 0,
215 OMAP_DSS_OUTPUT_DBI = 1 << 1,
216 OMAP_DSS_OUTPUT_SDI = 1 << 2,
217 OMAP_DSS_OUTPUT_DSI1 = 1 << 3,
218 OMAP_DSS_OUTPUT_DSI2 = 1 << 4,
219 OMAP_DSS_OUTPUT_VENC = 1 << 5,
220 OMAP_DSS_OUTPUT_HDMI = 1 << 6,
221};
222
223/* RFBI */
224
225struct rfbi_timings {
226 int cs_on_time;
227 int cs_off_time;
228 int we_on_time;
229 int we_off_time;
230 int re_on_time;
231 int re_off_time;
232 int we_cycle_time;
233 int re_cycle_time;
234 int cs_pulse_width;
235 int access_time;
236
237 int clk_div;
238
239 u32 tim[5]; /* set by rfbi_convert_timings() */
240
241 int converted;
242};
243
244/* DSI */
245
246enum omap_dss_dsi_trans_mode {
247 /* Sync Pulses: both sync start and end packets sent */
248 OMAP_DSS_DSI_PULSE_MODE,
249 /* Sync Events: only sync start packets sent */
250 OMAP_DSS_DSI_EVENT_MODE,
251 /* Burst: only sync start packets sent, pixels are time compressed */
252 OMAP_DSS_DSI_BURST_MODE,
253};
254
255struct omap_dss_dsi_videomode_timings {
256 unsigned long hsclk;
257
258 unsigned ndl;
259 unsigned bitspp;
260
261 /* pixels */
262 u16 hact;
263 /* lines */
264 u16 vact;
265
266 /* DSI video mode blanking data */
267 /* Unit: byte clock cycles */
268 u16 hss;
269 u16 hsa;
270 u16 hse;
271 u16 hfp;
272 u16 hbp;
273 /* Unit: line clocks */
274 u16 vsa;
275 u16 vfp;
276 u16 vbp;
277
278 /* DSI blanking modes */
279 int blanking_mode;
280 int hsa_blanking_mode;
281 int hbp_blanking_mode;
282 int hfp_blanking_mode;
283
284 enum omap_dss_dsi_trans_mode trans_mode;
285
286 bool ddr_clk_always_on;
287 int window_sync;
288};
289
290struct omap_dss_dsi_config {
291 enum omap_dss_dsi_mode mode;
292 enum omap_dss_dsi_pixel_format pixel_format;
293 const struct omap_video_timings *timings;
294
295 unsigned long hs_clk_min, hs_clk_max;
296 unsigned long lp_clk_min, lp_clk_max;
297
298 bool ddr_clk_always_on;
299 enum omap_dss_dsi_trans_mode trans_mode;
300};
301
302struct omap_video_timings {
303 /* Unit: pixels */
304 u16 x_res;
305 /* Unit: pixels */
306 u16 y_res;
307 /* Unit: Hz */
308 u32 pixelclock;
309 /* Unit: pixel clocks */
310 u16 hsw; /* Horizontal synchronization pulse width */
311 /* Unit: pixel clocks */
312 u16 hfp; /* Horizontal front porch */
313 /* Unit: pixel clocks */
314 u16 hbp; /* Horizontal back porch */
315 /* Unit: line clocks */
316 u16 vsw; /* Vertical synchronization pulse width */
317 /* Unit: line clocks */
318 u16 vfp; /* Vertical front porch */
319 /* Unit: line clocks */
320 u16 vbp; /* Vertical back porch */
321
322 /* Vsync logic level */
323 enum omap_dss_signal_level vsync_level;
324 /* Hsync logic level */
325 enum omap_dss_signal_level hsync_level;
326 /* Interlaced or Progressive timings */
327 bool interlace;
328 /* Pixel clock edge to drive LCD data */
329 enum omap_dss_signal_edge data_pclk_edge;
330 /* Data enable logic level */
331 enum omap_dss_signal_level de_level;
332 /* Pixel clock edges to drive HSYNC and VSYNC signals */
333 enum omap_dss_signal_edge sync_pclk_edge;
334
335 bool double_pixel;
336};
337
338/* Hardcoded timings for tv modes. Venc only uses these to
339 * identify the mode, and does not actually use the configs
340 * itself. However, the configs should be something that
341 * a normal monitor can also show */
342extern const struct omap_video_timings omap_dss_pal_timings;
343extern const struct omap_video_timings omap_dss_ntsc_timings;
344
345struct omap_dss_cpr_coefs {
346 s16 rr, rg, rb;
347 s16 gr, gg, gb;
348 s16 br, bg, bb;
349};
350
351struct omap_overlay_info {
352 dma_addr_t paddr;
353 dma_addr_t p_uv_addr; /* for NV12 format */
354 u16 screen_width;
355 u16 width;
356 u16 height;
357 enum omap_color_mode color_mode;
358 u8 rotation;
359 enum omap_dss_rotation_type rotation_type;
360 bool mirror;
361
362 u16 pos_x;
363 u16 pos_y;
364 u16 out_width; /* if 0, out_width == width */
365 u16 out_height; /* if 0, out_height == height */
366 u8 global_alpha;
367 u8 pre_mult_alpha;
368 u8 zorder;
369};
370
371struct omap_overlay {
372 struct kobject kobj;
373 struct list_head list;
374
375 /* static fields */
376 const char *name;
377 enum omap_plane id;
378 enum omap_color_mode supported_modes;
379 enum omap_overlay_caps caps;
380
381 /* dynamic fields */
382 struct omap_overlay_manager *manager;
383
384 /*
385 * The following functions do not block:
386 *
387 * is_enabled
388 * set_overlay_info
389 * get_overlay_info
390 *
391 * The rest of the functions may block and cannot be called from
392 * interrupt context
393 */
394
395 int (*enable)(struct omap_overlay *ovl);
396 int (*disable)(struct omap_overlay *ovl);
397 bool (*is_enabled)(struct omap_overlay *ovl);
398
399 int (*set_manager)(struct omap_overlay *ovl,
400 struct omap_overlay_manager *mgr);
401 int (*unset_manager)(struct omap_overlay *ovl);
402
403 int (*set_overlay_info)(struct omap_overlay *ovl,
404 struct omap_overlay_info *info);
405 void (*get_overlay_info)(struct omap_overlay *ovl,
406 struct omap_overlay_info *info);
407
408 int (*wait_for_go)(struct omap_overlay *ovl);
409
410 struct omap_dss_device *(*get_device)(struct omap_overlay *ovl);
411};
412
413struct omap_overlay_manager_info {
414 u32 default_color;
415
416 enum omap_dss_trans_key_type trans_key_type;
417 u32 trans_key;
418 bool trans_enabled;
419
420 bool partial_alpha_enabled;
421
422 bool cpr_enable;
423 struct omap_dss_cpr_coefs cpr_coefs;
424};
425
426struct omap_overlay_manager {
427 struct kobject kobj;
428
429 /* static fields */
430 const char *name;
431 enum omap_channel id;
432 enum omap_overlay_manager_caps caps;
433 struct list_head overlays;
434 enum omap_display_type supported_displays;
435 enum omap_dss_output_id supported_outputs;
436
437 /* dynamic fields */
438 struct omap_dss_device *output;
439
440 /*
441 * The following functions do not block:
442 *
443 * set_manager_info
444 * get_manager_info
445 * apply
446 *
447 * The rest of the functions may block and cannot be called from
448 * interrupt context
449 */
450
451 int (*set_output)(struct omap_overlay_manager *mgr,
452 struct omap_dss_device *output);
453 int (*unset_output)(struct omap_overlay_manager *mgr);
454
455 int (*set_manager_info)(struct omap_overlay_manager *mgr,
456 struct omap_overlay_manager_info *info);
457 void (*get_manager_info)(struct omap_overlay_manager *mgr,
458 struct omap_overlay_manager_info *info);
459
460 int (*apply)(struct omap_overlay_manager *mgr);
461 int (*wait_for_go)(struct omap_overlay_manager *mgr);
462 int (*wait_for_vsync)(struct omap_overlay_manager *mgr);
463
464 struct omap_dss_device *(*get_device)(struct omap_overlay_manager *mgr);
465};
466
467/* 22 pins means 1 clk lane and 10 data lanes */
468#define OMAP_DSS_MAX_DSI_PINS 22
469
470struct omap_dsi_pin_config {
471 int num_pins;
472 /*
473 * pin numbers in the following order:
474 * clk+, clk-
475 * data1+, data1-
476 * data2+, data2-
477 * ...
478 */
479 int pins[OMAP_DSS_MAX_DSI_PINS];
480};
481
482struct omap_dss_writeback_info {
483 u32 paddr;
484 u32 p_uv_addr;
485 u16 buf_width;
486 u16 width;
487 u16 height;
488 enum omap_color_mode color_mode;
489 u8 rotation;
490 enum omap_dss_rotation_type rotation_type;
491 bool mirror;
492 u8 pre_mult_alpha;
493};
494
495struct omapdss_dpi_ops {
496 int (*connect)(struct omap_dss_device *dssdev,
497 struct omap_dss_device *dst);
498 void (*disconnect)(struct omap_dss_device *dssdev,
499 struct omap_dss_device *dst);
500
501 int (*enable)(struct omap_dss_device *dssdev);
502 void (*disable)(struct omap_dss_device *dssdev);
503
504 int (*check_timings)(struct omap_dss_device *dssdev,
505 struct omap_video_timings *timings);
506 void (*set_timings)(struct omap_dss_device *dssdev,
507 struct omap_video_timings *timings);
508 void (*get_timings)(struct omap_dss_device *dssdev,
509 struct omap_video_timings *timings);
510
511 void (*set_data_lines)(struct omap_dss_device *dssdev, int data_lines);
512};
513
514struct omapdss_sdi_ops {
515 int (*connect)(struct omap_dss_device *dssdev,
516 struct omap_dss_device *dst);
517 void (*disconnect)(struct omap_dss_device *dssdev,
518 struct omap_dss_device *dst);
519
520 int (*enable)(struct omap_dss_device *dssdev);
521 void (*disable)(struct omap_dss_device *dssdev);
522
523 int (*check_timings)(struct omap_dss_device *dssdev,
524 struct omap_video_timings *timings);
525 void (*set_timings)(struct omap_dss_device *dssdev,
526 struct omap_video_timings *timings);
527 void (*get_timings)(struct omap_dss_device *dssdev,
528 struct omap_video_timings *timings);
529
530 void (*set_datapairs)(struct omap_dss_device *dssdev, int datapairs);
531};
532
533struct omapdss_dvi_ops {
534 int (*connect)(struct omap_dss_device *dssdev,
535 struct omap_dss_device *dst);
536 void (*disconnect)(struct omap_dss_device *dssdev,
537 struct omap_dss_device *dst);
538
539 int (*enable)(struct omap_dss_device *dssdev);
540 void (*disable)(struct omap_dss_device *dssdev);
541
542 int (*check_timings)(struct omap_dss_device *dssdev,
543 struct omap_video_timings *timings);
544 void (*set_timings)(struct omap_dss_device *dssdev,
545 struct omap_video_timings *timings);
546 void (*get_timings)(struct omap_dss_device *dssdev,
547 struct omap_video_timings *timings);
548};
549
550struct omapdss_atv_ops {
551 int (*connect)(struct omap_dss_device *dssdev,
552 struct omap_dss_device *dst);
553 void (*disconnect)(struct omap_dss_device *dssdev,
554 struct omap_dss_device *dst);
555
556 int (*enable)(struct omap_dss_device *dssdev);
557 void (*disable)(struct omap_dss_device *dssdev);
558
559 int (*check_timings)(struct omap_dss_device *dssdev,
560 struct omap_video_timings *timings);
561 void (*set_timings)(struct omap_dss_device *dssdev,
562 struct omap_video_timings *timings);
563 void (*get_timings)(struct omap_dss_device *dssdev,
564 struct omap_video_timings *timings);
565
566 void (*set_type)(struct omap_dss_device *dssdev,
567 enum omap_dss_venc_type type);
568 void (*invert_vid_out_polarity)(struct omap_dss_device *dssdev,
569 bool invert_polarity);
570
571 int (*set_wss)(struct omap_dss_device *dssdev, u32 wss);
572 u32 (*get_wss)(struct omap_dss_device *dssdev);
573};
574
575struct omapdss_hdmi_ops {
576 int (*connect)(struct omap_dss_device *dssdev,
577 struct omap_dss_device *dst);
578 void (*disconnect)(struct omap_dss_device *dssdev,
579 struct omap_dss_device *dst);
580
581 int (*enable)(struct omap_dss_device *dssdev);
582 void (*disable)(struct omap_dss_device *dssdev);
583
584 int (*check_timings)(struct omap_dss_device *dssdev,
585 struct omap_video_timings *timings);
586 void (*set_timings)(struct omap_dss_device *dssdev,
587 struct omap_video_timings *timings);
588 void (*get_timings)(struct omap_dss_device *dssdev,
589 struct omap_video_timings *timings);
590
591 int (*read_edid)(struct omap_dss_device *dssdev, u8 *buf, int len);
592 bool (*detect)(struct omap_dss_device *dssdev);
593
594 int (*set_hdmi_mode)(struct omap_dss_device *dssdev, bool hdmi_mode);
595 int (*set_infoframe)(struct omap_dss_device *dssdev,
596 const struct hdmi_avi_infoframe *avi);
597};
598
599struct omapdss_dsi_ops {
600 int (*connect)(struct omap_dss_device *dssdev,
601 struct omap_dss_device *dst);
602 void (*disconnect)(struct omap_dss_device *dssdev,
603 struct omap_dss_device *dst);
604
605 int (*enable)(struct omap_dss_device *dssdev);
606 void (*disable)(struct omap_dss_device *dssdev, bool disconnect_lanes,
607 bool enter_ulps);
608
609 /* bus configuration */
610 int (*set_config)(struct omap_dss_device *dssdev,
611 const struct omap_dss_dsi_config *cfg);
612 int (*configure_pins)(struct omap_dss_device *dssdev,
613 const struct omap_dsi_pin_config *pin_cfg);
614
615 void (*enable_hs)(struct omap_dss_device *dssdev, int channel,
616 bool enable);
617 int (*enable_te)(struct omap_dss_device *dssdev, bool enable);
618
619 int (*update)(struct omap_dss_device *dssdev, int channel,
620 void (*callback)(int, void *), void *data);
621
622 void (*bus_lock)(struct omap_dss_device *dssdev);
623 void (*bus_unlock)(struct omap_dss_device *dssdev);
624
625 int (*enable_video_output)(struct omap_dss_device *dssdev, int channel);
626 void (*disable_video_output)(struct omap_dss_device *dssdev,
627 int channel);
628
629 int (*request_vc)(struct omap_dss_device *dssdev, int *channel);
630 int (*set_vc_id)(struct omap_dss_device *dssdev, int channel,
631 int vc_id);
632 void (*release_vc)(struct omap_dss_device *dssdev, int channel);
633
634 /* data transfer */
635 int (*dcs_write)(struct omap_dss_device *dssdev, int channel,
636 u8 *data, int len);
637 int (*dcs_write_nosync)(struct omap_dss_device *dssdev, int channel,
638 u8 *data, int len);
639 int (*dcs_read)(struct omap_dss_device *dssdev, int channel, u8 dcs_cmd,
640 u8 *data, int len);
641
642 int (*gen_write)(struct omap_dss_device *dssdev, int channel,
643 u8 *data, int len);
644 int (*gen_write_nosync)(struct omap_dss_device *dssdev, int channel,
645 u8 *data, int len);
646 int (*gen_read)(struct omap_dss_device *dssdev, int channel,
647 u8 *reqdata, int reqlen,
648 u8 *data, int len);
649
650 int (*bta_sync)(struct omap_dss_device *dssdev, int channel);
651
652 int (*set_max_rx_packet_size)(struct omap_dss_device *dssdev,
653 int channel, u16 plen);
654};
655
656struct omap_dss_device {
657 struct kobject kobj;
658 struct device *dev;
659
660 struct module *owner;
661
662 struct list_head panel_list;
663
664 /* alias in the form of "display%d" */
665 char alias[16];
666
667 enum omap_display_type type;
668 enum omap_display_type output_type;
669
670 union {
671 struct {
672 u8 data_lines;
673 } dpi;
674
675 struct {
676 u8 channel;
677 u8 data_lines;
678 } rfbi;
679
680 struct {
681 u8 datapairs;
682 } sdi;
683
684 struct {
685 int module;
686 } dsi;
687
688 struct {
689 enum omap_dss_venc_type type;
690 bool invert_polarity;
691 } venc;
692 } phy;
693
694 struct {
695 struct omap_video_timings timings;
696
697 enum omap_dss_dsi_pixel_format dsi_pix_fmt;
698 enum omap_dss_dsi_mode dsi_mode;
699 } panel;
700
701 struct {
702 u8 pixel_size;
703 struct rfbi_timings rfbi_timings;
704 } ctrl;
705
706 const char *name;
707
708 /* used to match device to driver */
709 const char *driver_name;
710
711 void *data;
712
713 struct omap_dss_driver *driver;
714
715 union {
716 const struct omapdss_dpi_ops *dpi;
717 const struct omapdss_sdi_ops *sdi;
718 const struct omapdss_dvi_ops *dvi;
719 const struct omapdss_hdmi_ops *hdmi;
720 const struct omapdss_atv_ops *atv;
721 const struct omapdss_dsi_ops *dsi;
722 } ops;
723
724 /* helper variable for driver suspend/resume */
725 bool activate_after_resume;
726
727 enum omap_display_caps caps;
728
729 struct omap_dss_device *src;
730
731 enum omap_dss_display_state state;
732
733 /* OMAP DSS output specific fields */
734
735 struct list_head list;
736
737 /* DISPC channel for this output */
738 enum omap_channel dispc_channel;
739 bool dispc_channel_connected;
740
741 /* output instance */
742 enum omap_dss_output_id id;
743
744 /* the port number in the DT node */
745 int port_num;
746
747 /* dynamic fields */
748 struct omap_overlay_manager *manager;
749
750 struct omap_dss_device *dst;
751};
752
753struct omap_dss_driver {
754 int (*probe)(struct omap_dss_device *);
755 void (*remove)(struct omap_dss_device *);
756
757 int (*connect)(struct omap_dss_device *dssdev);
758 void (*disconnect)(struct omap_dss_device *dssdev);
759
760 int (*enable)(struct omap_dss_device *display);
761 void (*disable)(struct omap_dss_device *display);
762 int (*run_test)(struct omap_dss_device *display, int test);
763
764 int (*update)(struct omap_dss_device *dssdev,
765 u16 x, u16 y, u16 w, u16 h);
766 int (*sync)(struct omap_dss_device *dssdev);
767
768 int (*enable_te)(struct omap_dss_device *dssdev, bool enable);
769 int (*get_te)(struct omap_dss_device *dssdev);
770
771 u8 (*get_rotate)(struct omap_dss_device *dssdev);
772 int (*set_rotate)(struct omap_dss_device *dssdev, u8 rotate);
773
774 bool (*get_mirror)(struct omap_dss_device *dssdev);
775 int (*set_mirror)(struct omap_dss_device *dssdev, bool enable);
776
777 int (*memory_read)(struct omap_dss_device *dssdev,
778 void *buf, size_t size,
779 u16 x, u16 y, u16 w, u16 h);
780
781 void (*get_resolution)(struct omap_dss_device *dssdev,
782 u16 *xres, u16 *yres);
783 void (*get_dimensions)(struct omap_dss_device *dssdev,
784 u32 *width, u32 *height);
785 int (*get_recommended_bpp)(struct omap_dss_device *dssdev);
786
787 int (*check_timings)(struct omap_dss_device *dssdev,
788 struct omap_video_timings *timings);
789 void (*set_timings)(struct omap_dss_device *dssdev,
790 struct omap_video_timings *timings);
791 void (*get_timings)(struct omap_dss_device *dssdev,
792 struct omap_video_timings *timings);
793
794 int (*set_wss)(struct omap_dss_device *dssdev, u32 wss);
795 u32 (*get_wss)(struct omap_dss_device *dssdev);
796
797 int (*read_edid)(struct omap_dss_device *dssdev, u8 *buf, int len);
798 bool (*detect)(struct omap_dss_device *dssdev);
799
800 int (*set_hdmi_mode)(struct omap_dss_device *dssdev, bool hdmi_mode);
801 int (*set_hdmi_infoframe)(struct omap_dss_device *dssdev,
802 const struct hdmi_avi_infoframe *avi);
803};
804
805enum omapdss_version omapdss_get_version(void);
806bool omapdss_is_initialized(void);
807
808int omap_dss_register_driver(struct omap_dss_driver *);
809void omap_dss_unregister_driver(struct omap_dss_driver *);
810
811int omapdss_register_display(struct omap_dss_device *dssdev);
812void omapdss_unregister_display(struct omap_dss_device *dssdev);
813
814struct omap_dss_device *omap_dss_get_device(struct omap_dss_device *dssdev);
815void omap_dss_put_device(struct omap_dss_device *dssdev);
816#define for_each_dss_dev(d) while ((d = omap_dss_get_next_device(d)) != NULL)
817struct omap_dss_device *omap_dss_get_next_device(struct omap_dss_device *from);
818struct omap_dss_device *omap_dss_find_device(void *data,
819 int (*match)(struct omap_dss_device *dssdev, void *data));
820const char *omapdss_get_default_display_name(void);
821
822void videomode_to_omap_video_timings(const struct videomode *vm,
823 struct omap_video_timings *ovt);
824void omap_video_timings_to_videomode(const struct omap_video_timings *ovt,
825 struct videomode *vm);
826
827int dss_feat_get_num_mgrs(void);
828int dss_feat_get_num_ovls(void);
829enum omap_color_mode dss_feat_get_supported_color_modes(enum omap_plane plane);
830
831
832
833int omap_dss_get_num_overlay_managers(void);
834struct omap_overlay_manager *omap_dss_get_overlay_manager(int num);
835
836int omap_dss_get_num_overlays(void);
837struct omap_overlay *omap_dss_get_overlay(int num);
838
839int omapdss_register_output(struct omap_dss_device *output);
840void omapdss_unregister_output(struct omap_dss_device *output);
841struct omap_dss_device *omap_dss_get_output(enum omap_dss_output_id id);
842struct omap_dss_device *omap_dss_find_output(const char *name);
843struct omap_dss_device *omap_dss_find_output_by_port_node(struct device_node *port);
844int omapdss_output_set_device(struct omap_dss_device *out,
845 struct omap_dss_device *dssdev);
846int omapdss_output_unset_device(struct omap_dss_device *out);
847
848struct omap_dss_device *omapdss_find_output_from_display(struct omap_dss_device *dssdev);
849struct omap_overlay_manager *omapdss_find_mgr_from_display(struct omap_dss_device *dssdev);
850
851void omapdss_default_get_resolution(struct omap_dss_device *dssdev,
852 u16 *xres, u16 *yres);
853int omapdss_default_get_recommended_bpp(struct omap_dss_device *dssdev);
854void omapdss_default_get_timings(struct omap_dss_device *dssdev,
855 struct omap_video_timings *timings);
856
857typedef void (*omap_dispc_isr_t) (void *arg, u32 mask);
858int omap_dispc_register_isr(omap_dispc_isr_t isr, void *arg, u32 mask);
859int omap_dispc_unregister_isr(omap_dispc_isr_t isr, void *arg, u32 mask);
860
861int omapdss_compat_init(void);
862void omapdss_compat_uninit(void);
863
864static inline bool omapdss_device_is_connected(struct omap_dss_device *dssdev)
865{
866 return dssdev->src;
867}
868
869static inline bool omapdss_device_is_enabled(struct omap_dss_device *dssdev)
870{
871 return dssdev->state == OMAP_DSS_DISPLAY_ACTIVE;
872}
873
874struct device_node *
875omapdss_of_get_next_port(const struct device_node *parent,
876 struct device_node *prev);
877
878struct device_node *
879omapdss_of_get_next_endpoint(const struct device_node *parent,
880 struct device_node *prev);
881
882struct device_node *
883omapdss_of_get_first_endpoint(const struct device_node *parent);
884
885struct omap_dss_device *
886omapdss_of_find_source_for_first_ep(struct device_node *node);
887
888#endif