Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0-or-later */
0002 /*
0003  * Copyright (C) 2016 Texas Instruments, Inc.
0004  */
0005 
0006 #ifndef __OMAPFB_DSS_H
0007 #define __OMAPFB_DSS_H
0008 
0009 #include <linux/list.h>
0010 #include <linux/kobject.h>
0011 #include <linux/device.h>
0012 #include <linux/interrupt.h>
0013 #include <linux/platform_data/omapdss.h>
0014 
0015 #include <video/videomode.h>
0016 
0017 #define DISPC_IRQ_FRAMEDONE     (1 << 0)
0018 #define DISPC_IRQ_VSYNC         (1 << 1)
0019 #define DISPC_IRQ_EVSYNC_EVEN       (1 << 2)
0020 #define DISPC_IRQ_EVSYNC_ODD        (1 << 3)
0021 #define DISPC_IRQ_ACBIAS_COUNT_STAT (1 << 4)
0022 #define DISPC_IRQ_PROG_LINE_NUM     (1 << 5)
0023 #define DISPC_IRQ_GFX_FIFO_UNDERFLOW    (1 << 6)
0024 #define DISPC_IRQ_GFX_END_WIN       (1 << 7)
0025 #define DISPC_IRQ_PAL_GAMMA_MASK    (1 << 8)
0026 #define DISPC_IRQ_OCP_ERR       (1 << 9)
0027 #define DISPC_IRQ_VID1_FIFO_UNDERFLOW   (1 << 10)
0028 #define DISPC_IRQ_VID1_END_WIN      (1 << 11)
0029 #define DISPC_IRQ_VID2_FIFO_UNDERFLOW   (1 << 12)
0030 #define DISPC_IRQ_VID2_END_WIN      (1 << 13)
0031 #define DISPC_IRQ_SYNC_LOST     (1 << 14)
0032 #define DISPC_IRQ_SYNC_LOST_DIGIT   (1 << 15)
0033 #define DISPC_IRQ_WAKEUP        (1 << 16)
0034 #define DISPC_IRQ_SYNC_LOST2        (1 << 17)
0035 #define DISPC_IRQ_VSYNC2        (1 << 18)
0036 #define DISPC_IRQ_VID3_END_WIN      (1 << 19)
0037 #define DISPC_IRQ_VID3_FIFO_UNDERFLOW   (1 << 20)
0038 #define DISPC_IRQ_ACBIAS_COUNT_STAT2    (1 << 21)
0039 #define DISPC_IRQ_FRAMEDONE2        (1 << 22)
0040 #define DISPC_IRQ_FRAMEDONEWB       (1 << 23)
0041 #define DISPC_IRQ_FRAMEDONETV       (1 << 24)
0042 #define DISPC_IRQ_WBBUFFEROVERFLOW  (1 << 25)
0043 #define DISPC_IRQ_WBUNCOMPLETEERROR (1 << 26)
0044 #define DISPC_IRQ_SYNC_LOST3        (1 << 27)
0045 #define DISPC_IRQ_VSYNC3        (1 << 28)
0046 #define DISPC_IRQ_ACBIAS_COUNT_STAT3    (1 << 29)
0047 #define DISPC_IRQ_FRAMEDONE3        (1 << 30)
0048 
0049 struct omap_dss_device;
0050 struct omap_overlay_manager;
0051 struct dss_lcd_mgr_config;
0052 struct snd_aes_iec958;
0053 struct snd_cea_861_aud_if;
0054 struct hdmi_avi_infoframe;
0055 
0056 enum omap_display_type {
0057     OMAP_DISPLAY_TYPE_NONE      = 0,
0058     OMAP_DISPLAY_TYPE_DPI       = 1 << 0,
0059     OMAP_DISPLAY_TYPE_DBI       = 1 << 1,
0060     OMAP_DISPLAY_TYPE_SDI       = 1 << 2,
0061     OMAP_DISPLAY_TYPE_DSI       = 1 << 3,
0062     OMAP_DISPLAY_TYPE_VENC      = 1 << 4,
0063     OMAP_DISPLAY_TYPE_HDMI      = 1 << 5,
0064     OMAP_DISPLAY_TYPE_DVI       = 1 << 6,
0065 };
0066 
0067 enum omap_plane {
0068     OMAP_DSS_GFX    = 0,
0069     OMAP_DSS_VIDEO1 = 1,
0070     OMAP_DSS_VIDEO2 = 2,
0071     OMAP_DSS_VIDEO3 = 3,
0072     OMAP_DSS_WB = 4,
0073 };
0074 
0075 enum omap_channel {
0076     OMAP_DSS_CHANNEL_LCD    = 0,
0077     OMAP_DSS_CHANNEL_DIGIT  = 1,
0078     OMAP_DSS_CHANNEL_LCD2   = 2,
0079     OMAP_DSS_CHANNEL_LCD3   = 3,
0080     OMAP_DSS_CHANNEL_WB = 4,
0081 };
0082 
0083 enum omap_color_mode {
0084     OMAP_DSS_COLOR_CLUT1    = 1 << 0,  /* BITMAP 1 */
0085     OMAP_DSS_COLOR_CLUT2    = 1 << 1,  /* BITMAP 2 */
0086     OMAP_DSS_COLOR_CLUT4    = 1 << 2,  /* BITMAP 4 */
0087     OMAP_DSS_COLOR_CLUT8    = 1 << 3,  /* BITMAP 8 */
0088     OMAP_DSS_COLOR_RGB12U   = 1 << 4,  /* RGB12, 16-bit container */
0089     OMAP_DSS_COLOR_ARGB16   = 1 << 5,  /* ARGB16 */
0090     OMAP_DSS_COLOR_RGB16    = 1 << 6,  /* RGB16 */
0091     OMAP_DSS_COLOR_RGB24U   = 1 << 7,  /* RGB24, 32-bit container */
0092     OMAP_DSS_COLOR_RGB24P   = 1 << 8,  /* RGB24, 24-bit container */
0093     OMAP_DSS_COLOR_YUV2 = 1 << 9,  /* YUV2 4:2:2 co-sited */
0094     OMAP_DSS_COLOR_UYVY = 1 << 10, /* UYVY 4:2:2 co-sited */
0095     OMAP_DSS_COLOR_ARGB32   = 1 << 11, /* ARGB32 */
0096     OMAP_DSS_COLOR_RGBA32   = 1 << 12, /* RGBA32 */
0097     OMAP_DSS_COLOR_RGBX32   = 1 << 13, /* RGBx32 */
0098     OMAP_DSS_COLOR_NV12     = 1 << 14, /* NV12 format: YUV 4:2:0 */
0099     OMAP_DSS_COLOR_RGBA16       = 1 << 15, /* RGBA16 - 4444 */
0100     OMAP_DSS_COLOR_RGBX16       = 1 << 16, /* RGBx16 - 4444 */
0101     OMAP_DSS_COLOR_ARGB16_1555  = 1 << 17, /* ARGB16 - 1555 */
0102     OMAP_DSS_COLOR_XRGB16_1555  = 1 << 18, /* xRGB16 - 1555 */
0103 };
0104 
0105 enum omap_dss_load_mode {
0106     OMAP_DSS_LOAD_CLUT_AND_FRAME    = 0,
0107     OMAP_DSS_LOAD_CLUT_ONLY     = 1,
0108     OMAP_DSS_LOAD_FRAME_ONLY    = 2,
0109     OMAP_DSS_LOAD_CLUT_ONCE_FRAME   = 3,
0110 };
0111 
0112 enum omap_dss_trans_key_type {
0113     OMAP_DSS_COLOR_KEY_GFX_DST = 0,
0114     OMAP_DSS_COLOR_KEY_VID_SRC = 1,
0115 };
0116 
0117 enum omap_dss_signal_level {
0118     OMAPDSS_SIG_ACTIVE_LOW,
0119     OMAPDSS_SIG_ACTIVE_HIGH,
0120 };
0121 
0122 enum omap_dss_signal_edge {
0123     OMAPDSS_DRIVE_SIG_FALLING_EDGE,
0124     OMAPDSS_DRIVE_SIG_RISING_EDGE,
0125 };
0126 
0127 enum omap_dss_venc_type {
0128     OMAP_DSS_VENC_TYPE_COMPOSITE,
0129     OMAP_DSS_VENC_TYPE_SVIDEO,
0130 };
0131 
0132 enum omap_dss_dsi_pixel_format {
0133     OMAP_DSS_DSI_FMT_RGB888,
0134     OMAP_DSS_DSI_FMT_RGB666,
0135     OMAP_DSS_DSI_FMT_RGB666_PACKED,
0136     OMAP_DSS_DSI_FMT_RGB565,
0137 };
0138 
0139 enum omap_dss_dsi_mode {
0140     OMAP_DSS_DSI_CMD_MODE = 0,
0141     OMAP_DSS_DSI_VIDEO_MODE,
0142 };
0143 
0144 enum omap_display_caps {
0145     OMAP_DSS_DISPLAY_CAP_MANUAL_UPDATE  = 1 << 0,
0146     OMAP_DSS_DISPLAY_CAP_TEAR_ELIM      = 1 << 1,
0147 };
0148 
0149 enum omap_dss_display_state {
0150     OMAP_DSS_DISPLAY_DISABLED = 0,
0151     OMAP_DSS_DISPLAY_ACTIVE,
0152 };
0153 
0154 enum omap_dss_rotation_type {
0155     OMAP_DSS_ROT_DMA    = 1 << 0,
0156     OMAP_DSS_ROT_VRFB   = 1 << 1,
0157     OMAP_DSS_ROT_TILER  = 1 << 2,
0158 };
0159 
0160 /* clockwise rotation angle */
0161 enum omap_dss_rotation_angle {
0162     OMAP_DSS_ROT_0   = 0,
0163     OMAP_DSS_ROT_90  = 1,
0164     OMAP_DSS_ROT_180 = 2,
0165     OMAP_DSS_ROT_270 = 3,
0166 };
0167 
0168 enum omap_overlay_caps {
0169     OMAP_DSS_OVL_CAP_SCALE = 1 << 0,
0170     OMAP_DSS_OVL_CAP_GLOBAL_ALPHA = 1 << 1,
0171     OMAP_DSS_OVL_CAP_PRE_MULT_ALPHA = 1 << 2,
0172     OMAP_DSS_OVL_CAP_ZORDER = 1 << 3,
0173     OMAP_DSS_OVL_CAP_POS = 1 << 4,
0174     OMAP_DSS_OVL_CAP_REPLICATION = 1 << 5,
0175 };
0176 
0177 enum omap_dss_output_id {
0178     OMAP_DSS_OUTPUT_DPI = 1 << 0,
0179     OMAP_DSS_OUTPUT_DBI = 1 << 1,
0180     OMAP_DSS_OUTPUT_SDI = 1 << 2,
0181     OMAP_DSS_OUTPUT_DSI1    = 1 << 3,
0182     OMAP_DSS_OUTPUT_DSI2    = 1 << 4,
0183     OMAP_DSS_OUTPUT_VENC    = 1 << 5,
0184     OMAP_DSS_OUTPUT_HDMI    = 1 << 6,
0185 };
0186 
0187 /* DSI */
0188 
0189 enum omap_dss_dsi_trans_mode {
0190     /* Sync Pulses: both sync start and end packets sent */
0191     OMAP_DSS_DSI_PULSE_MODE,
0192     /* Sync Events: only sync start packets sent */
0193     OMAP_DSS_DSI_EVENT_MODE,
0194     /* Burst: only sync start packets sent, pixels are time compressed */
0195     OMAP_DSS_DSI_BURST_MODE,
0196 };
0197 
0198 struct omap_dss_dsi_videomode_timings {
0199     unsigned long hsclk;
0200 
0201     unsigned ndl;
0202     unsigned bitspp;
0203 
0204     /* pixels */
0205     u16 hact;
0206     /* lines */
0207     u16 vact;
0208 
0209     /* DSI video mode blanking data */
0210     /* Unit: byte clock cycles */
0211     u16 hss;
0212     u16 hsa;
0213     u16 hse;
0214     u16 hfp;
0215     u16 hbp;
0216     /* Unit: line clocks */
0217     u16 vsa;
0218     u16 vfp;
0219     u16 vbp;
0220 
0221     /* DSI blanking modes */
0222     int blanking_mode;
0223     int hsa_blanking_mode;
0224     int hbp_blanking_mode;
0225     int hfp_blanking_mode;
0226 
0227     enum omap_dss_dsi_trans_mode trans_mode;
0228 
0229     bool ddr_clk_always_on;
0230     int window_sync;
0231 };
0232 
0233 struct omap_dss_dsi_config {
0234     enum omap_dss_dsi_mode mode;
0235     enum omap_dss_dsi_pixel_format pixel_format;
0236     const struct omap_video_timings *timings;
0237 
0238     unsigned long hs_clk_min, hs_clk_max;
0239     unsigned long lp_clk_min, lp_clk_max;
0240 
0241     bool ddr_clk_always_on;
0242     enum omap_dss_dsi_trans_mode trans_mode;
0243 };
0244 
0245 struct omap_video_timings {
0246     /* Unit: pixels */
0247     u16 x_res;
0248     /* Unit: pixels */
0249     u16 y_res;
0250     /* Unit: Hz */
0251     u32 pixelclock;
0252     /* Unit: pixel clocks */
0253     u16 hsw;    /* Horizontal synchronization pulse width */
0254     /* Unit: pixel clocks */
0255     u16 hfp;    /* Horizontal front porch */
0256     /* Unit: pixel clocks */
0257     u16 hbp;    /* Horizontal back porch */
0258     /* Unit: line clocks */
0259     u16 vsw;    /* Vertical synchronization pulse width */
0260     /* Unit: line clocks */
0261     u16 vfp;    /* Vertical front porch */
0262     /* Unit: line clocks */
0263     u16 vbp;    /* Vertical back porch */
0264 
0265     /* Vsync logic level */
0266     enum omap_dss_signal_level vsync_level;
0267     /* Hsync logic level */
0268     enum omap_dss_signal_level hsync_level;
0269     /* Interlaced or Progressive timings */
0270     bool interlace;
0271     /* Pixel clock edge to drive LCD data */
0272     enum omap_dss_signal_edge data_pclk_edge;
0273     /* Data enable logic level */
0274     enum omap_dss_signal_level de_level;
0275     /* Pixel clock edges to drive HSYNC and VSYNC signals */
0276     enum omap_dss_signal_edge sync_pclk_edge;
0277 
0278     bool double_pixel;
0279 };
0280 
0281 /* Hardcoded timings for tv modes. Venc only uses these to
0282  * identify the mode, and does not actually use the configs
0283  * itself. However, the configs should be something that
0284  * a normal monitor can also show */
0285 extern const struct omap_video_timings omap_dss_pal_timings;
0286 extern const struct omap_video_timings omap_dss_ntsc_timings;
0287 
0288 struct omap_dss_cpr_coefs {
0289     s16 rr, rg, rb;
0290     s16 gr, gg, gb;
0291     s16 br, bg, bb;
0292 };
0293 
0294 struct omap_overlay_info {
0295     dma_addr_t paddr;
0296     dma_addr_t p_uv_addr;  /* for NV12 format */
0297     u16 screen_width;
0298     u16 width;
0299     u16 height;
0300     enum omap_color_mode color_mode;
0301     u8 rotation;
0302     enum omap_dss_rotation_type rotation_type;
0303     bool mirror;
0304 
0305     u16 pos_x;
0306     u16 pos_y;
0307     u16 out_width;  /* if 0, out_width == width */
0308     u16 out_height; /* if 0, out_height == height */
0309     u8 global_alpha;
0310     u8 pre_mult_alpha;
0311     u8 zorder;
0312 };
0313 
0314 struct omap_overlay {
0315     struct kobject kobj;
0316     struct list_head list;
0317 
0318     /* static fields */
0319     const char *name;
0320     enum omap_plane id;
0321     enum omap_color_mode supported_modes;
0322     enum omap_overlay_caps caps;
0323 
0324     /* dynamic fields */
0325     struct omap_overlay_manager *manager;
0326 
0327     /*
0328      * The following functions do not block:
0329      *
0330      * is_enabled
0331      * set_overlay_info
0332      * get_overlay_info
0333      *
0334      * The rest of the functions may block and cannot be called from
0335      * interrupt context
0336      */
0337 
0338     int (*enable)(struct omap_overlay *ovl);
0339     int (*disable)(struct omap_overlay *ovl);
0340     bool (*is_enabled)(struct omap_overlay *ovl);
0341 
0342     int (*set_manager)(struct omap_overlay *ovl,
0343         struct omap_overlay_manager *mgr);
0344     int (*unset_manager)(struct omap_overlay *ovl);
0345 
0346     int (*set_overlay_info)(struct omap_overlay *ovl,
0347             struct omap_overlay_info *info);
0348     void (*get_overlay_info)(struct omap_overlay *ovl,
0349             struct omap_overlay_info *info);
0350 
0351     int (*wait_for_go)(struct omap_overlay *ovl);
0352 
0353     struct omap_dss_device *(*get_device)(struct omap_overlay *ovl);
0354 };
0355 
0356 struct omap_overlay_manager_info {
0357     u32 default_color;
0358 
0359     enum omap_dss_trans_key_type trans_key_type;
0360     u32 trans_key;
0361     bool trans_enabled;
0362 
0363     bool partial_alpha_enabled;
0364 
0365     bool cpr_enable;
0366     struct omap_dss_cpr_coefs cpr_coefs;
0367 };
0368 
0369 struct omap_overlay_manager {
0370     struct kobject kobj;
0371 
0372     /* static fields */
0373     const char *name;
0374     enum omap_channel id;
0375     struct list_head overlays;
0376     enum omap_display_type supported_displays;
0377     enum omap_dss_output_id supported_outputs;
0378 
0379     /* dynamic fields */
0380     struct omap_dss_device *output;
0381 
0382     /*
0383      * The following functions do not block:
0384      *
0385      * set_manager_info
0386      * get_manager_info
0387      * apply
0388      *
0389      * The rest of the functions may block and cannot be called from
0390      * interrupt context
0391      */
0392 
0393     int (*set_output)(struct omap_overlay_manager *mgr,
0394         struct omap_dss_device *output);
0395     int (*unset_output)(struct omap_overlay_manager *mgr);
0396 
0397     int (*set_manager_info)(struct omap_overlay_manager *mgr,
0398             struct omap_overlay_manager_info *info);
0399     void (*get_manager_info)(struct omap_overlay_manager *mgr,
0400             struct omap_overlay_manager_info *info);
0401 
0402     int (*apply)(struct omap_overlay_manager *mgr);
0403     int (*wait_for_go)(struct omap_overlay_manager *mgr);
0404     int (*wait_for_vsync)(struct omap_overlay_manager *mgr);
0405 
0406     struct omap_dss_device *(*get_device)(struct omap_overlay_manager *mgr);
0407 };
0408 
0409 /* 22 pins means 1 clk lane and 10 data lanes */
0410 #define OMAP_DSS_MAX_DSI_PINS 22
0411 
0412 struct omap_dsi_pin_config {
0413     int num_pins;
0414     /*
0415      * pin numbers in the following order:
0416      * clk+, clk-
0417      * data1+, data1-
0418      * data2+, data2-
0419      * ...
0420      */
0421     int pins[OMAP_DSS_MAX_DSI_PINS];
0422 };
0423 
0424 struct omap_dss_writeback_info {
0425     u32 paddr;
0426     u32 p_uv_addr;
0427     u16 buf_width;
0428     u16 width;
0429     u16 height;
0430     enum omap_color_mode color_mode;
0431     u8 rotation;
0432     enum omap_dss_rotation_type rotation_type;
0433     bool mirror;
0434     u8 pre_mult_alpha;
0435 };
0436 
0437 struct omapdss_dpi_ops {
0438     int (*connect)(struct omap_dss_device *dssdev,
0439             struct omap_dss_device *dst);
0440     void (*disconnect)(struct omap_dss_device *dssdev,
0441             struct omap_dss_device *dst);
0442 
0443     int (*enable)(struct omap_dss_device *dssdev);
0444     void (*disable)(struct omap_dss_device *dssdev);
0445 
0446     int (*check_timings)(struct omap_dss_device *dssdev,
0447             struct omap_video_timings *timings);
0448     void (*set_timings)(struct omap_dss_device *dssdev,
0449             struct omap_video_timings *timings);
0450     void (*get_timings)(struct omap_dss_device *dssdev,
0451             struct omap_video_timings *timings);
0452 
0453     void (*set_data_lines)(struct omap_dss_device *dssdev, int data_lines);
0454 };
0455 
0456 struct omapdss_sdi_ops {
0457     int (*connect)(struct omap_dss_device *dssdev,
0458             struct omap_dss_device *dst);
0459     void (*disconnect)(struct omap_dss_device *dssdev,
0460             struct omap_dss_device *dst);
0461 
0462     int (*enable)(struct omap_dss_device *dssdev);
0463     void (*disable)(struct omap_dss_device *dssdev);
0464 
0465     int (*check_timings)(struct omap_dss_device *dssdev,
0466             struct omap_video_timings *timings);
0467     void (*set_timings)(struct omap_dss_device *dssdev,
0468             struct omap_video_timings *timings);
0469     void (*get_timings)(struct omap_dss_device *dssdev,
0470             struct omap_video_timings *timings);
0471 
0472     void (*set_datapairs)(struct omap_dss_device *dssdev, int datapairs);
0473 };
0474 
0475 struct omapdss_dvi_ops {
0476     int (*connect)(struct omap_dss_device *dssdev,
0477             struct omap_dss_device *dst);
0478     void (*disconnect)(struct omap_dss_device *dssdev,
0479             struct omap_dss_device *dst);
0480 
0481     int (*enable)(struct omap_dss_device *dssdev);
0482     void (*disable)(struct omap_dss_device *dssdev);
0483 
0484     int (*check_timings)(struct omap_dss_device *dssdev,
0485             struct omap_video_timings *timings);
0486     void (*set_timings)(struct omap_dss_device *dssdev,
0487             struct omap_video_timings *timings);
0488     void (*get_timings)(struct omap_dss_device *dssdev,
0489             struct omap_video_timings *timings);
0490 };
0491 
0492 struct omapdss_atv_ops {
0493     int (*connect)(struct omap_dss_device *dssdev,
0494             struct omap_dss_device *dst);
0495     void (*disconnect)(struct omap_dss_device *dssdev,
0496             struct omap_dss_device *dst);
0497 
0498     int (*enable)(struct omap_dss_device *dssdev);
0499     void (*disable)(struct omap_dss_device *dssdev);
0500 
0501     int (*check_timings)(struct omap_dss_device *dssdev,
0502             struct omap_video_timings *timings);
0503     void (*set_timings)(struct omap_dss_device *dssdev,
0504             struct omap_video_timings *timings);
0505     void (*get_timings)(struct omap_dss_device *dssdev,
0506             struct omap_video_timings *timings);
0507 
0508     void (*set_type)(struct omap_dss_device *dssdev,
0509         enum omap_dss_venc_type type);
0510     void (*invert_vid_out_polarity)(struct omap_dss_device *dssdev,
0511         bool invert_polarity);
0512 
0513     int (*set_wss)(struct omap_dss_device *dssdev, u32 wss);
0514     u32 (*get_wss)(struct omap_dss_device *dssdev);
0515 };
0516 
0517 struct omapdss_hdmi_ops {
0518     int (*connect)(struct omap_dss_device *dssdev,
0519             struct omap_dss_device *dst);
0520     void (*disconnect)(struct omap_dss_device *dssdev,
0521             struct omap_dss_device *dst);
0522 
0523     int (*enable)(struct omap_dss_device *dssdev);
0524     void (*disable)(struct omap_dss_device *dssdev);
0525 
0526     int (*check_timings)(struct omap_dss_device *dssdev,
0527             struct omap_video_timings *timings);
0528     void (*set_timings)(struct omap_dss_device *dssdev,
0529             struct omap_video_timings *timings);
0530     void (*get_timings)(struct omap_dss_device *dssdev,
0531             struct omap_video_timings *timings);
0532 
0533     int (*read_edid)(struct omap_dss_device *dssdev, u8 *buf, int len);
0534     bool (*detect)(struct omap_dss_device *dssdev);
0535 
0536     int (*set_hdmi_mode)(struct omap_dss_device *dssdev, bool hdmi_mode);
0537     int (*set_infoframe)(struct omap_dss_device *dssdev,
0538         const struct hdmi_avi_infoframe *avi);
0539 };
0540 
0541 struct omapdss_dsi_ops {
0542     int (*connect)(struct omap_dss_device *dssdev,
0543             struct omap_dss_device *dst);
0544     void (*disconnect)(struct omap_dss_device *dssdev,
0545             struct omap_dss_device *dst);
0546 
0547     int (*enable)(struct omap_dss_device *dssdev);
0548     void (*disable)(struct omap_dss_device *dssdev, bool disconnect_lanes,
0549             bool enter_ulps);
0550 
0551     /* bus configuration */
0552     int (*set_config)(struct omap_dss_device *dssdev,
0553             const struct omap_dss_dsi_config *cfg);
0554     int (*configure_pins)(struct omap_dss_device *dssdev,
0555             const struct omap_dsi_pin_config *pin_cfg);
0556 
0557     void (*enable_hs)(struct omap_dss_device *dssdev, int channel,
0558             bool enable);
0559     int (*enable_te)(struct omap_dss_device *dssdev, bool enable);
0560 
0561     int (*update)(struct omap_dss_device *dssdev, int channel,
0562             void (*callback)(int, void *), void *data);
0563 
0564     void (*bus_lock)(struct omap_dss_device *dssdev);
0565     void (*bus_unlock)(struct omap_dss_device *dssdev);
0566 
0567     int (*enable_video_output)(struct omap_dss_device *dssdev, int channel);
0568     void (*disable_video_output)(struct omap_dss_device *dssdev,
0569             int channel);
0570 
0571     int (*request_vc)(struct omap_dss_device *dssdev, int *channel);
0572     int (*set_vc_id)(struct omap_dss_device *dssdev, int channel,
0573             int vc_id);
0574     void (*release_vc)(struct omap_dss_device *dssdev, int channel);
0575 
0576     /* data transfer */
0577     int (*dcs_write)(struct omap_dss_device *dssdev, int channel,
0578             u8 *data, int len);
0579     int (*dcs_write_nosync)(struct omap_dss_device *dssdev, int channel,
0580             u8 *data, int len);
0581     int (*dcs_read)(struct omap_dss_device *dssdev, int channel, u8 dcs_cmd,
0582             u8 *data, int len);
0583 
0584     int (*gen_write)(struct omap_dss_device *dssdev, int channel,
0585             u8 *data, int len);
0586     int (*gen_write_nosync)(struct omap_dss_device *dssdev, int channel,
0587             u8 *data, int len);
0588     int (*gen_read)(struct omap_dss_device *dssdev, int channel,
0589             u8 *reqdata, int reqlen,
0590             u8 *data, int len);
0591 
0592     int (*bta_sync)(struct omap_dss_device *dssdev, int channel);
0593 
0594     int (*set_max_rx_packet_size)(struct omap_dss_device *dssdev,
0595             int channel, u16 plen);
0596 };
0597 
0598 struct omap_dss_device {
0599     struct kobject kobj;
0600     struct device *dev;
0601 
0602     struct module *owner;
0603 
0604     struct list_head panel_list;
0605 
0606     /* alias in the form of "display%d" */
0607     char alias[16];
0608 
0609     enum omap_display_type type;
0610     enum omap_display_type output_type;
0611 
0612     union {
0613         struct {
0614             u8 data_lines;
0615         } dpi;
0616 
0617         struct {
0618             u8 datapairs;
0619         } sdi;
0620 
0621         struct {
0622             int module;
0623         } dsi;
0624 
0625         struct {
0626             enum omap_dss_venc_type type;
0627             bool invert_polarity;
0628         } venc;
0629     } phy;
0630 
0631     struct {
0632         struct omap_video_timings timings;
0633 
0634         enum omap_dss_dsi_pixel_format dsi_pix_fmt;
0635         enum omap_dss_dsi_mode dsi_mode;
0636     } panel;
0637 
0638     struct {
0639         u8 pixel_size;
0640     } ctrl;
0641 
0642     const char *name;
0643 
0644     /* used to match device to driver */
0645     const char *driver_name;
0646 
0647     void *data;
0648 
0649     struct omap_dss_driver *driver;
0650 
0651     union {
0652         const struct omapdss_dpi_ops *dpi;
0653         const struct omapdss_sdi_ops *sdi;
0654         const struct omapdss_dvi_ops *dvi;
0655         const struct omapdss_hdmi_ops *hdmi;
0656         const struct omapdss_atv_ops *atv;
0657         const struct omapdss_dsi_ops *dsi;
0658     } ops;
0659 
0660     /* helper variable for driver suspend/resume */
0661     bool activate_after_resume;
0662 
0663     enum omap_display_caps caps;
0664 
0665     struct omap_dss_device *src;
0666 
0667     enum omap_dss_display_state state;
0668 
0669     /* OMAP DSS output specific fields */
0670 
0671     struct list_head list;
0672 
0673     /* DISPC channel for this output */
0674     enum omap_channel dispc_channel;
0675     bool dispc_channel_connected;
0676 
0677     /* output instance */
0678     enum omap_dss_output_id id;
0679 
0680     /* the port number in the DT node */
0681     int port_num;
0682 
0683     /* dynamic fields */
0684     struct omap_overlay_manager *manager;
0685 
0686     struct omap_dss_device *dst;
0687 };
0688 
0689 struct omap_dss_driver {
0690     int (*probe)(struct omap_dss_device *);
0691     void (*remove)(struct omap_dss_device *);
0692 
0693     int (*connect)(struct omap_dss_device *dssdev);
0694     void (*disconnect)(struct omap_dss_device *dssdev);
0695 
0696     int (*enable)(struct omap_dss_device *display);
0697     void (*disable)(struct omap_dss_device *display);
0698     int (*run_test)(struct omap_dss_device *display, int test);
0699 
0700     int (*update)(struct omap_dss_device *dssdev,
0701                    u16 x, u16 y, u16 w, u16 h);
0702     int (*sync)(struct omap_dss_device *dssdev);
0703 
0704     int (*enable_te)(struct omap_dss_device *dssdev, bool enable);
0705     int (*get_te)(struct omap_dss_device *dssdev);
0706 
0707     u8 (*get_rotate)(struct omap_dss_device *dssdev);
0708     int (*set_rotate)(struct omap_dss_device *dssdev, u8 rotate);
0709 
0710     bool (*get_mirror)(struct omap_dss_device *dssdev);
0711     int (*set_mirror)(struct omap_dss_device *dssdev, bool enable);
0712 
0713     int (*memory_read)(struct omap_dss_device *dssdev,
0714             void *buf, size_t size,
0715             u16 x, u16 y, u16 w, u16 h);
0716 
0717     void (*get_resolution)(struct omap_dss_device *dssdev,
0718             u16 *xres, u16 *yres);
0719     void (*get_dimensions)(struct omap_dss_device *dssdev,
0720             u32 *width, u32 *height);
0721     int (*get_recommended_bpp)(struct omap_dss_device *dssdev);
0722 
0723     int (*check_timings)(struct omap_dss_device *dssdev,
0724             struct omap_video_timings *timings);
0725     void (*set_timings)(struct omap_dss_device *dssdev,
0726             struct omap_video_timings *timings);
0727     void (*get_timings)(struct omap_dss_device *dssdev,
0728             struct omap_video_timings *timings);
0729 
0730     int (*set_wss)(struct omap_dss_device *dssdev, u32 wss);
0731     u32 (*get_wss)(struct omap_dss_device *dssdev);
0732 
0733     int (*read_edid)(struct omap_dss_device *dssdev, u8 *buf, int len);
0734     bool (*detect)(struct omap_dss_device *dssdev);
0735 
0736     int (*set_hdmi_mode)(struct omap_dss_device *dssdev, bool hdmi_mode);
0737     int (*set_hdmi_infoframe)(struct omap_dss_device *dssdev,
0738         const struct hdmi_avi_infoframe *avi);
0739 };
0740 
0741 #define for_each_dss_dev(d) while ((d = omap_dss_get_next_device(d)) != NULL)
0742 
0743 typedef void (*omap_dispc_isr_t) (void *arg, u32 mask);
0744 
0745 #if IS_ENABLED(CONFIG_FB_OMAP2)
0746 
0747 enum omapdss_version omapdss_get_version(void);
0748 bool omapdss_is_initialized(void);
0749 
0750 int omap_dss_register_driver(struct omap_dss_driver *);
0751 void omap_dss_unregister_driver(struct omap_dss_driver *);
0752 
0753 int omapdss_register_display(struct omap_dss_device *dssdev);
0754 void omapdss_unregister_display(struct omap_dss_device *dssdev);
0755 
0756 struct omap_dss_device *omap_dss_get_device(struct omap_dss_device *dssdev);
0757 void omap_dss_put_device(struct omap_dss_device *dssdev);
0758 struct omap_dss_device *omap_dss_get_next_device(struct omap_dss_device *from);
0759 struct omap_dss_device *omap_dss_find_device(void *data,
0760         int (*match)(struct omap_dss_device *dssdev, void *data));
0761 const char *omapdss_get_default_display_name(void);
0762 
0763 void videomode_to_omap_video_timings(const struct videomode *vm,
0764         struct omap_video_timings *ovt);
0765 void omap_video_timings_to_videomode(const struct omap_video_timings *ovt,
0766         struct videomode *vm);
0767 
0768 int dss_feat_get_num_mgrs(void);
0769 int dss_feat_get_num_ovls(void);
0770 enum omap_color_mode dss_feat_get_supported_color_modes(enum omap_plane plane);
0771 
0772 
0773 
0774 int omap_dss_get_num_overlay_managers(void);
0775 struct omap_overlay_manager *omap_dss_get_overlay_manager(int num);
0776 
0777 int omap_dss_get_num_overlays(void);
0778 struct omap_overlay *omap_dss_get_overlay(int num);
0779 
0780 int omapdss_register_output(struct omap_dss_device *output);
0781 void omapdss_unregister_output(struct omap_dss_device *output);
0782 struct omap_dss_device *omap_dss_get_output(enum omap_dss_output_id id);
0783 struct omap_dss_device *omap_dss_find_output(const char *name);
0784 struct omap_dss_device *omap_dss_find_output_by_port_node(struct device_node *port);
0785 int omapdss_output_set_device(struct omap_dss_device *out,
0786         struct omap_dss_device *dssdev);
0787 int omapdss_output_unset_device(struct omap_dss_device *out);
0788 
0789 struct omap_dss_device *omapdss_find_output_from_display(struct omap_dss_device *dssdev);
0790 struct omap_overlay_manager *omapdss_find_mgr_from_display(struct omap_dss_device *dssdev);
0791 
0792 void omapdss_default_get_resolution(struct omap_dss_device *dssdev,
0793         u16 *xres, u16 *yres);
0794 int omapdss_default_get_recommended_bpp(struct omap_dss_device *dssdev);
0795 void omapdss_default_get_timings(struct omap_dss_device *dssdev,
0796         struct omap_video_timings *timings);
0797 
0798 int omap_dispc_register_isr(omap_dispc_isr_t isr, void *arg, u32 mask);
0799 int omap_dispc_unregister_isr(omap_dispc_isr_t isr, void *arg, u32 mask);
0800 
0801 int omapdss_compat_init(void);
0802 void omapdss_compat_uninit(void);
0803 
0804 static inline bool omapdss_device_is_connected(struct omap_dss_device *dssdev)
0805 {
0806     return dssdev->src;
0807 }
0808 
0809 static inline bool omapdss_device_is_enabled(struct omap_dss_device *dssdev)
0810 {
0811     return dssdev->state == OMAP_DSS_DISPLAY_ACTIVE;
0812 }
0813 
0814 struct device_node *
0815 omapdss_of_get_next_port(const struct device_node *parent,
0816              struct device_node *prev);
0817 
0818 struct device_node *
0819 omapdss_of_get_next_endpoint(const struct device_node *parent,
0820                  struct device_node *prev);
0821 
0822 struct device_node *
0823 omapdss_of_get_first_endpoint(const struct device_node *parent);
0824 
0825 struct omap_dss_device *
0826 omapdss_of_find_source_for_first_ep(struct device_node *node);
0827 #else
0828 
0829 static inline enum omapdss_version omapdss_get_version(void)
0830 { return OMAPDSS_VER_UNKNOWN; };
0831 
0832 static inline bool omapdss_is_initialized(void)
0833 { return false; };
0834 
0835 static inline int omap_dispc_register_isr(omap_dispc_isr_t isr,
0836                       void *arg, u32 mask)
0837 { return 0; };
0838 
0839 static inline int omap_dispc_unregister_isr(omap_dispc_isr_t isr,
0840                         void *arg, u32 mask)
0841 { return 0; };
0842 
0843 static inline struct omap_dss_device
0844 *omap_dss_get_device(struct omap_dss_device *dssdev)
0845 { return NULL; };
0846 
0847 static inline struct omap_dss_device
0848 *omap_dss_get_next_device(struct omap_dss_device *from)
0849 {return NULL; };
0850 
0851 static inline void omap_dss_put_device(struct omap_dss_device *dssdev) {};
0852 
0853 static inline int omapdss_compat_init(void)
0854 { return 0; };
0855 
0856 static inline void omapdss_compat_uninit(void) {};
0857 
0858 static inline int omap_dss_get_num_overlay_managers(void)
0859 { return 0; };
0860 
0861 static inline struct omap_overlay_manager *omap_dss_get_overlay_manager(int num)
0862 { return NULL; };
0863 
0864 static inline int omap_dss_get_num_overlays(void)
0865 { return 0; };
0866 
0867 static inline struct omap_overlay *omap_dss_get_overlay(int num)
0868 { return NULL; };
0869 
0870 
0871 #endif /* FB_OMAP2 */
0872 
0873 
0874 #endif /* __OMAPFB_DSS_H */