2 * Copyright (C) 2016 Texas Instruments
3 * Author: Tomi Valkeinen <tomi.valkeinen@ti.com>
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.
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
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/>.
18 #ifndef __OMAP_DRM_DSS_H
19 #define __OMAP_DRM_DSS_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 #include <uapi/drm/drm_mode.h>
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)
61 struct omap_dss_device
;
62 struct omap_overlay_manager
;
63 struct dss_lcd_mgr_config
;
64 struct snd_aes_iec958
;
65 struct snd_cea_861_aud_if
;
66 struct hdmi_avi_infoframe
;
68 enum 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,
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,
95 enum 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 */
117 enum 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,
124 enum omap_dss_trans_key_type
{
125 OMAP_DSS_COLOR_KEY_GFX_DST
= 0,
126 OMAP_DSS_COLOR_KEY_VID_SRC
= 1,
129 enum omap_rfbi_te_mode
{
130 OMAP_DSS_RFBI_TE_MODE_1
= 1,
131 OMAP_DSS_RFBI_TE_MODE_2
= 2,
134 enum omap_dss_signal_level
{
135 OMAPDSS_SIG_ACTIVE_LOW
,
136 OMAPDSS_SIG_ACTIVE_HIGH
,
139 enum omap_dss_signal_edge
{
140 OMAPDSS_DRIVE_SIG_FALLING_EDGE
,
141 OMAPDSS_DRIVE_SIG_RISING_EDGE
,
144 enum omap_dss_venc_type
{
145 OMAP_DSS_VENC_TYPE_COMPOSITE
,
146 OMAP_DSS_VENC_TYPE_SVIDEO
,
149 enum 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
,
156 enum omap_dss_dsi_mode
{
157 OMAP_DSS_DSI_CMD_MODE
= 0,
158 OMAP_DSS_DSI_VIDEO_MODE
,
161 enum omap_display_caps
{
162 OMAP_DSS_DISPLAY_CAP_MANUAL_UPDATE
= 1 << 0,
163 OMAP_DSS_DISPLAY_CAP_TEAR_ELIM
= 1 << 1,
166 enum omap_dss_display_state
{
167 OMAP_DSS_DISPLAY_DISABLED
= 0,
168 OMAP_DSS_DISPLAY_ACTIVE
,
171 enum 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,
177 /* clockwise rotation angle */
178 enum omap_dss_rotation_angle
{
181 OMAP_DSS_ROT_180
= 2,
182 OMAP_DSS_ROT_270
= 3,
185 enum 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,
194 enum omap_overlay_manager_caps
{
195 OMAP_DSS_DUMMY_VALUE
, /* add a dummy value to prevent compiler error */
198 enum omap_dss_clk_source
{
199 OMAP_DSS_CLK_SRC_FCK
= 0, /* OMAP2/3: DSS1_ALWON_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 */
209 enum omap_hdmi_flags
{
210 OMAP_HDMI_SDA_SCL_EXTERNAL_PULLUP
= 1 << 0,
213 enum 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,
225 struct rfbi_timings
{
239 u32 tim
[5]; /* set by rfbi_convert_timings() */
246 enum 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
,
255 struct omap_dss_dsi_videomode_timings
{
266 /* DSI video mode blanking data */
267 /* Unit: byte clock cycles */
273 /* Unit: line clocks */
278 /* DSI blanking modes */
280 int hsa_blanking_mode
;
281 int hbp_blanking_mode
;
282 int hfp_blanking_mode
;
284 enum omap_dss_dsi_trans_mode trans_mode
;
286 bool ddr_clk_always_on
;
290 struct 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
;
295 unsigned long hs_clk_min
, hs_clk_max
;
296 unsigned long lp_clk_min
, lp_clk_max
;
298 bool ddr_clk_always_on
;
299 enum omap_dss_dsi_trans_mode trans_mode
;
302 struct omap_video_timings
{
309 /* Unit: pixel clocks */
310 u16 hsync_len
; /* Horizontal synchronization pulse width */
311 /* Unit: pixel clocks */
312 u16 hfront_porch
; /* Horizontal front porch */
313 /* Unit: pixel clocks */
314 u16 hback_porch
; /* Horizontal back porch */
315 /* Unit: line clocks */
316 u16 vsync_len
; /* Vertical synchronization pulse width */
317 /* Unit: line clocks */
318 u16 vfront_porch
; /* Vertical front porch */
319 /* Unit: line clocks */
320 u16 vback_porch
; /* Vertical back porch */
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 /* Pixel clock edge to drive LCD data */
327 enum omap_dss_signal_edge data_pclk_edge
;
328 /* Data enable logic level */
329 enum omap_dss_signal_level de_level
;
330 /* Pixel clock edges to drive HSYNC and VSYNC signals */
331 enum omap_dss_signal_edge sync_pclk_edge
;
335 enum display_flags flags
;
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 */
342 extern const struct omap_video_timings omap_dss_pal_timings
;
343 extern const struct omap_video_timings omap_dss_ntsc_timings
;
345 struct omap_dss_cpr_coefs
{
351 struct omap_overlay_info
{
353 dma_addr_t p_uv_addr
; /* for NV12 format */
357 enum omap_color_mode color_mode
;
359 enum omap_dss_rotation_type rotation_type
;
364 u16 out_width
; /* if 0, out_width == width */
365 u16 out_height
; /* if 0, out_height == height */
371 struct omap_overlay
{
373 struct list_head list
;
378 enum omap_color_mode supported_modes
;
379 enum omap_overlay_caps caps
;
382 struct omap_overlay_manager
*manager
;
385 * The following functions do not block:
391 * The rest of the functions may block and cannot be called from
395 int (*enable
)(struct omap_overlay
*ovl
);
396 int (*disable
)(struct omap_overlay
*ovl
);
397 bool (*is_enabled
)(struct omap_overlay
*ovl
);
399 int (*set_manager
)(struct omap_overlay
*ovl
,
400 struct omap_overlay_manager
*mgr
);
401 int (*unset_manager
)(struct omap_overlay
*ovl
);
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
);
408 int (*wait_for_go
)(struct omap_overlay
*ovl
);
410 struct omap_dss_device
*(*get_device
)(struct omap_overlay
*ovl
);
413 struct omap_overlay_manager_info
{
416 enum omap_dss_trans_key_type trans_key_type
;
420 bool partial_alpha_enabled
;
423 struct omap_dss_cpr_coefs cpr_coefs
;
426 struct omap_overlay_manager
{
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
;
438 struct omap_dss_device
*output
;
441 * The following functions do not block:
447 * The rest of the functions may block and cannot be called from
451 int (*set_output
)(struct omap_overlay_manager
*mgr
,
452 struct omap_dss_device
*output
);
453 int (*unset_output
)(struct omap_overlay_manager
*mgr
);
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
);
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
);
464 struct omap_dss_device
*(*get_device
)(struct omap_overlay_manager
*mgr
);
467 /* 22 pins means 1 clk lane and 10 data lanes */
468 #define OMAP_DSS_MAX_DSI_PINS 22
470 struct omap_dsi_pin_config
{
473 * pin numbers in the following order:
479 int pins
[OMAP_DSS_MAX_DSI_PINS
];
482 struct omap_dss_writeback_info
{
488 enum omap_color_mode color_mode
;
490 enum omap_dss_rotation_type rotation_type
;
495 struct 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
);
501 int (*enable
)(struct omap_dss_device
*dssdev
);
502 void (*disable
)(struct omap_dss_device
*dssdev
);
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
);
511 void (*set_data_lines
)(struct omap_dss_device
*dssdev
, int data_lines
);
514 struct 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
);
520 int (*enable
)(struct omap_dss_device
*dssdev
);
521 void (*disable
)(struct omap_dss_device
*dssdev
);
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
);
530 void (*set_datapairs
)(struct omap_dss_device
*dssdev
, int datapairs
);
533 struct 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
);
539 int (*enable
)(struct omap_dss_device
*dssdev
);
540 void (*disable
)(struct omap_dss_device
*dssdev
);
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
);
550 struct 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
);
556 int (*enable
)(struct omap_dss_device
*dssdev
);
557 void (*disable
)(struct omap_dss_device
*dssdev
);
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
);
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
);
571 int (*set_wss
)(struct omap_dss_device
*dssdev
, u32 wss
);
572 u32 (*get_wss
)(struct omap_dss_device
*dssdev
);
575 struct 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
);
581 int (*enable
)(struct omap_dss_device
*dssdev
);
582 void (*disable
)(struct omap_dss_device
*dssdev
);
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
);
591 int (*read_edid
)(struct omap_dss_device
*dssdev
, u8
*buf
, int len
);
592 bool (*detect
)(struct omap_dss_device
*dssdev
);
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
);
599 struct 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
);
605 int (*enable
)(struct omap_dss_device
*dssdev
);
606 void (*disable
)(struct omap_dss_device
*dssdev
, bool disconnect_lanes
,
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
);
615 void (*enable_hs
)(struct omap_dss_device
*dssdev
, int channel
,
617 int (*enable_te
)(struct omap_dss_device
*dssdev
, bool enable
);
619 int (*update
)(struct omap_dss_device
*dssdev
, int channel
,
620 void (*callback
)(int, void *), void *data
);
622 void (*bus_lock
)(struct omap_dss_device
*dssdev
);
623 void (*bus_unlock
)(struct omap_dss_device
*dssdev
);
625 int (*enable_video_output
)(struct omap_dss_device
*dssdev
, int channel
);
626 void (*disable_video_output
)(struct omap_dss_device
*dssdev
,
629 int (*request_vc
)(struct omap_dss_device
*dssdev
, int *channel
);
630 int (*set_vc_id
)(struct omap_dss_device
*dssdev
, int channel
,
632 void (*release_vc
)(struct omap_dss_device
*dssdev
, int channel
);
635 int (*dcs_write
)(struct omap_dss_device
*dssdev
, int channel
,
637 int (*dcs_write_nosync
)(struct omap_dss_device
*dssdev
, int channel
,
639 int (*dcs_read
)(struct omap_dss_device
*dssdev
, int channel
, u8 dcs_cmd
,
642 int (*gen_write
)(struct omap_dss_device
*dssdev
, int channel
,
644 int (*gen_write_nosync
)(struct omap_dss_device
*dssdev
, int channel
,
646 int (*gen_read
)(struct omap_dss_device
*dssdev
, int channel
,
647 u8
*reqdata
, int reqlen
,
650 int (*bta_sync
)(struct omap_dss_device
*dssdev
, int channel
);
652 int (*set_max_rx_packet_size
)(struct omap_dss_device
*dssdev
,
653 int channel
, u16 plen
);
656 struct omap_dss_device
{
660 struct module
*owner
;
662 struct list_head panel_list
;
664 /* alias in the form of "display%d" */
667 enum omap_display_type type
;
668 enum omap_display_type output_type
;
689 enum omap_dss_venc_type type
;
690 bool invert_polarity
;
695 struct omap_video_timings timings
;
697 enum omap_dss_dsi_pixel_format dsi_pix_fmt
;
698 enum omap_dss_dsi_mode dsi_mode
;
703 struct rfbi_timings rfbi_timings
;
708 /* used to match device to driver */
709 const char *driver_name
;
713 struct omap_dss_driver
*driver
;
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
;
724 /* helper variable for driver suspend/resume */
725 bool activate_after_resume
;
727 enum omap_display_caps caps
;
729 struct omap_dss_device
*src
;
731 enum omap_dss_display_state state
;
733 /* OMAP DSS output specific fields */
735 struct list_head list
;
737 /* DISPC channel for this output */
738 enum omap_channel dispc_channel
;
739 bool dispc_channel_connected
;
741 /* output instance */
742 enum omap_dss_output_id id
;
744 /* the port number in the DT node */
748 struct omap_overlay_manager
*manager
;
750 struct omap_dss_device
*dst
;
753 struct omap_dss_driver
{
754 int (*probe
)(struct omap_dss_device
*);
755 void (*remove
)(struct omap_dss_device
*);
757 int (*connect
)(struct omap_dss_device
*dssdev
);
758 void (*disconnect
)(struct omap_dss_device
*dssdev
);
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
);
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
);
768 int (*enable_te
)(struct omap_dss_device
*dssdev
, bool enable
);
769 int (*get_te
)(struct omap_dss_device
*dssdev
);
771 u8 (*get_rotate
)(struct omap_dss_device
*dssdev
);
772 int (*set_rotate
)(struct omap_dss_device
*dssdev
, u8 rotate
);
774 bool (*get_mirror
)(struct omap_dss_device
*dssdev
);
775 int (*set_mirror
)(struct omap_dss_device
*dssdev
, bool enable
);
777 int (*memory_read
)(struct omap_dss_device
*dssdev
,
778 void *buf
, size_t size
,
779 u16 x
, u16 y
, u16 w
, u16 h
);
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
);
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
);
794 int (*set_wss
)(struct omap_dss_device
*dssdev
, u32 wss
);
795 u32 (*get_wss
)(struct omap_dss_device
*dssdev
);
797 int (*read_edid
)(struct omap_dss_device
*dssdev
, u8
*buf
, int len
);
798 bool (*detect
)(struct omap_dss_device
*dssdev
);
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
);
805 enum omapdss_version
omapdss_get_version(void);
806 bool omapdss_is_initialized(void);
808 int omap_dss_register_driver(struct omap_dss_driver
*);
809 void omap_dss_unregister_driver(struct omap_dss_driver
*);
811 int omapdss_register_display(struct omap_dss_device
*dssdev
);
812 void omapdss_unregister_display(struct omap_dss_device
*dssdev
);
814 struct omap_dss_device
*omap_dss_get_device(struct omap_dss_device
*dssdev
);
815 void 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)
817 struct omap_dss_device
*omap_dss_get_next_device(struct omap_dss_device
*from
);
818 struct omap_dss_device
*omap_dss_find_device(void *data
,
819 int (*match
)(struct omap_dss_device
*dssdev
, void *data
));
820 const char *omapdss_get_default_display_name(void);
822 void videomode_to_omap_video_timings(const struct videomode
*vm
,
823 struct omap_video_timings
*ovt
);
824 void omap_video_timings_to_videomode(const struct omap_video_timings
*ovt
,
825 struct videomode
*vm
);
827 int dss_feat_get_num_mgrs(void);
828 int dss_feat_get_num_ovls(void);
829 enum omap_color_mode
dss_feat_get_supported_color_modes(enum omap_plane plane
);
833 int omap_dss_get_num_overlay_managers(void);
834 struct omap_overlay_manager
*omap_dss_get_overlay_manager(int num
);
836 int omap_dss_get_num_overlays(void);
837 struct omap_overlay
*omap_dss_get_overlay(int num
);
839 int omapdss_register_output(struct omap_dss_device
*output
);
840 void omapdss_unregister_output(struct omap_dss_device
*output
);
841 struct omap_dss_device
*omap_dss_get_output(enum omap_dss_output_id id
);
842 struct omap_dss_device
*omap_dss_find_output(const char *name
);
843 struct omap_dss_device
*omap_dss_find_output_by_port_node(struct device_node
*port
);
844 int omapdss_output_set_device(struct omap_dss_device
*out
,
845 struct omap_dss_device
*dssdev
);
846 int omapdss_output_unset_device(struct omap_dss_device
*out
);
848 struct omap_dss_device
*omapdss_find_output_from_display(struct omap_dss_device
*dssdev
);
849 struct omap_overlay_manager
*omapdss_find_mgr_from_display(struct omap_dss_device
*dssdev
);
851 void omapdss_default_get_resolution(struct omap_dss_device
*dssdev
,
852 u16
*xres
, u16
*yres
);
853 int omapdss_default_get_recommended_bpp(struct omap_dss_device
*dssdev
);
854 void omapdss_default_get_timings(struct omap_dss_device
*dssdev
,
855 struct omap_video_timings
*timings
);
857 typedef void (*omap_dispc_isr_t
) (void *arg
, u32 mask
);
858 int omap_dispc_register_isr(omap_dispc_isr_t isr
, void *arg
, u32 mask
);
859 int omap_dispc_unregister_isr(omap_dispc_isr_t isr
, void *arg
, u32 mask
);
861 int omapdss_compat_init(void);
862 void omapdss_compat_uninit(void);
864 static inline bool omapdss_device_is_connected(struct omap_dss_device
*dssdev
)
869 static inline bool omapdss_device_is_enabled(struct omap_dss_device
*dssdev
)
871 return dssdev
->state
== OMAP_DSS_DISPLAY_ACTIVE
;
875 omapdss_of_get_next_port(const struct device_node
*parent
,
876 struct device_node
*prev
);
879 omapdss_of_get_next_endpoint(const struct device_node
*parent
,
880 struct device_node
*prev
);
883 omapdss_of_get_first_endpoint(const struct device_node
*parent
);
885 struct omap_dss_device
*
886 omapdss_of_find_source_for_first_ep(struct device_node
*node
);
888 u32
dispc_read_irqstatus(void);
889 void dispc_clear_irqstatus(u32 mask
);
890 u32
dispc_read_irqenable(void);
891 void dispc_write_irqenable(u32 mask
);
893 int dispc_request_irq(irq_handler_t handler
, void *dev_id
);
894 void dispc_free_irq(void *dev_id
);
896 int dispc_runtime_get(void);
897 void dispc_runtime_put(void);
899 void dispc_mgr_enable(enum omap_channel channel
, bool enable
);
900 bool dispc_mgr_is_enabled(enum omap_channel channel
);
901 u32
dispc_mgr_get_vsync_irq(enum omap_channel channel
);
902 u32
dispc_mgr_get_framedone_irq(enum omap_channel channel
);
903 u32
dispc_mgr_get_sync_lost_irq(enum omap_channel channel
);
904 bool dispc_mgr_go_busy(enum omap_channel channel
);
905 void dispc_mgr_go(enum omap_channel channel
);
906 void dispc_mgr_set_lcd_config(enum omap_channel channel
,
907 const struct dss_lcd_mgr_config
*config
);
908 void dispc_mgr_set_timings(enum omap_channel channel
,
909 const struct omap_video_timings
*timings
);
910 void dispc_mgr_setup(enum omap_channel channel
,
911 const struct omap_overlay_manager_info
*info
);
912 u32
dispc_mgr_gamma_size(enum omap_channel channel
);
913 void dispc_mgr_set_gamma(enum omap_channel channel
,
914 const struct drm_color_lut
*lut
,
915 unsigned int length
);
917 int dispc_ovl_enable(enum omap_plane plane
, bool enable
);
918 bool dispc_ovl_enabled(enum omap_plane plane
);
919 void dispc_ovl_set_channel_out(enum omap_plane plane
,
920 enum omap_channel channel
);
921 int dispc_ovl_setup(enum omap_plane plane
, const struct omap_overlay_info
*oi
,
922 bool replication
, const struct omap_video_timings
*mgr_timings
,
925 enum omap_dss_output_id
dispc_mgr_get_supported_outputs(enum omap_channel channel
);
928 int (*connect
)(enum omap_channel channel
,
929 struct omap_dss_device
*dst
);
930 void (*disconnect
)(enum omap_channel channel
,
931 struct omap_dss_device
*dst
);
933 void (*start_update
)(enum omap_channel channel
);
934 int (*enable
)(enum omap_channel channel
);
935 void (*disable
)(enum omap_channel channel
);
936 void (*set_timings
)(enum omap_channel channel
,
937 const struct omap_video_timings
*timings
);
938 void (*set_lcd_config
)(enum omap_channel channel
,
939 const struct dss_lcd_mgr_config
*config
);
940 int (*register_framedone_handler
)(enum omap_channel channel
,
941 void (*handler
)(void *), void *data
);
942 void (*unregister_framedone_handler
)(enum omap_channel channel
,
943 void (*handler
)(void *), void *data
);
946 int dss_install_mgr_ops(const struct dss_mgr_ops
*mgr_ops
);
947 void dss_uninstall_mgr_ops(void);
949 int dss_mgr_connect(enum omap_channel channel
,
950 struct omap_dss_device
*dst
);
951 void dss_mgr_disconnect(enum omap_channel channel
,
952 struct omap_dss_device
*dst
);
953 void dss_mgr_set_timings(enum omap_channel channel
,
954 const struct omap_video_timings
*timings
);
955 void dss_mgr_set_lcd_config(enum omap_channel channel
,
956 const struct dss_lcd_mgr_config
*config
);
957 int dss_mgr_enable(enum omap_channel channel
);
958 void dss_mgr_disable(enum omap_channel channel
);
959 void dss_mgr_start_update(enum omap_channel channel
);
960 int dss_mgr_register_framedone_handler(enum omap_channel channel
,
961 void (*handler
)(void *), void *data
);
962 void dss_mgr_unregister_framedone_handler(enum omap_channel channel
,
963 void (*handler
)(void *), void *data
);
965 #endif /* __OMAP_DRM_DSS_H */