1 /* 2 * (C) Copyright 2008-2017 Fuzhou Rockchip Electronics Co., Ltd 3 * 4 * SPDX-License-Identifier: GPL-2.0+ 5 */ 6 7 #ifndef _ROCKCHIP_DISPLAY_H 8 #define _ROCKCHIP_DISPLAY_H 9 10 #include <bmp_layout.h> 11 #include <drm_modes.h> 12 #include <edid.h> 13 14 #define ROCKCHIP_OUTPUT_DSI_DUAL_CHANNEL BIT(0) 15 #define ROCKCHIP_OUTPUT_DSI_DUAL_LINK BIT(1) 16 17 enum data_format { 18 ROCKCHIP_FMT_ARGB8888 = 0, 19 ROCKCHIP_FMT_RGB888, 20 ROCKCHIP_FMT_RGB565, 21 ROCKCHIP_FMT_YUV420SP = 4, 22 ROCKCHIP_FMT_YUV422SP, 23 ROCKCHIP_FMT_YUV444SP, 24 }; 25 26 enum display_mode { 27 ROCKCHIP_DISPLAY_FULLSCREEN, 28 ROCKCHIP_DISPLAY_CENTER, 29 }; 30 31 /* 32 * display output interface supported by rockchip lcdc 33 */ 34 #define ROCKCHIP_OUT_MODE_P888 0 35 #define ROCKCHIP_OUT_MODE_P666 1 36 #define ROCKCHIP_OUT_MODE_P565 2 37 /* for use special outface */ 38 #define ROCKCHIP_OUT_MODE_AAAA 15 39 40 struct crtc_state { 41 struct udevice *dev; 42 const struct rockchip_crtc *crtc; 43 void *private; 44 int node; 45 int crtc_id; 46 47 int format; 48 u32 dma_addr; 49 int ymirror; 50 int rb_swap; 51 int xvir; 52 int src_x; 53 int src_y; 54 int src_w; 55 int src_h; 56 int crtc_x; 57 int crtc_y; 58 int crtc_w; 59 int crtc_h; 60 }; 61 62 struct panel_state { 63 struct udevice *dev; 64 int node; 65 int dsp_lut_node; 66 67 const struct rockchip_panel *panel; 68 void *private; 69 }; 70 71 struct connector_state { 72 struct udevice *dev; 73 const struct rockchip_connector *connector; 74 struct udevice *phy_dev; 75 const struct rockchip_phy *phy; 76 int node; 77 int phy_node; 78 79 void *private; 80 void *phy_private; 81 82 struct drm_display_mode mode; 83 u8 edid[EDID_SIZE * 4]; 84 int bus_format; 85 int output_mode; 86 int type; 87 int output_type; 88 89 struct { 90 u32 *lut; 91 int size; 92 } gamma; 93 }; 94 95 struct logo_info { 96 int mode; 97 char *mem; 98 bool ymirror; 99 u32 offset; 100 u32 width; 101 u32 height; 102 u32 bpp; 103 }; 104 105 struct rockchip_logo_cache { 106 struct list_head head; 107 char name[20]; 108 struct logo_info logo; 109 }; 110 111 struct display_state { 112 struct list_head head; 113 114 const void *blob; 115 int node; 116 117 struct crtc_state crtc_state; 118 struct connector_state conn_state; 119 struct panel_state panel_state; 120 121 const char *ulogo_name; 122 const char *klogo_name; 123 124 struct logo_info logo; 125 int logo_mode; 126 int charge_logo_mode; 127 void *mem_base; 128 int mem_size; 129 130 int enable; 131 int is_init; 132 int is_enable; 133 }; 134 135 int drm_mode_vrefresh(const struct drm_display_mode *mode); 136 137 #endif 138