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 #include <dm/ofnode.h> 14 15 #define ROCKCHIP_OUTPUT_DSI_DUAL_CHANNEL BIT(0) 16 #define ROCKCHIP_OUTPUT_DSI_DUAL_LINK BIT(1) 17 18 enum data_format { 19 ROCKCHIP_FMT_ARGB8888 = 0, 20 ROCKCHIP_FMT_RGB888, 21 ROCKCHIP_FMT_RGB565, 22 ROCKCHIP_FMT_YUV420SP = 4, 23 ROCKCHIP_FMT_YUV422SP, 24 ROCKCHIP_FMT_YUV444SP, 25 }; 26 27 enum display_mode { 28 ROCKCHIP_DISPLAY_FULLSCREEN, 29 ROCKCHIP_DISPLAY_CENTER, 30 }; 31 32 enum rockchip_cmd_type { 33 CMD_TYPE_DEFAULT, 34 CMD_TYPE_SPI, 35 CMD_TYPE_MCU 36 }; 37 38 /* 39 * display output interface supported by rockchip lcdc 40 */ 41 #define ROCKCHIP_OUT_MODE_P888 0 42 #define ROCKCHIP_OUT_MODE_P666 1 43 #define ROCKCHIP_OUT_MODE_P565 2 44 #define ROCKCHIP_OUT_MODE_S888 8 45 #define ROCKCHIP_OUT_MODE_S888_DUMMY 12 46 #define ROCKCHIP_OUT_MODE_YUV420 14 47 /* for use special outface */ 48 #define ROCKCHIP_OUT_MODE_AAAA 15 49 50 struct crtc_state { 51 struct udevice *dev; 52 const struct rockchip_crtc *crtc; 53 void *private; 54 ofnode node; 55 int crtc_id; 56 57 int format; 58 u32 dma_addr; 59 int ymirror; 60 int rb_swap; 61 int xvir; 62 int src_x; 63 int src_y; 64 int src_w; 65 int src_h; 66 int crtc_x; 67 int crtc_y; 68 int crtc_w; 69 int crtc_h; 70 }; 71 72 struct panel_state { 73 struct udevice *dev; 74 ofnode node; 75 ofnode dsp_lut_node; 76 77 const struct rockchip_panel *panel; 78 void *private; 79 }; 80 81 struct overscan { 82 int left_margin; 83 int right_margin; 84 int top_margin; 85 int bottom_margin; 86 }; 87 88 struct connector_state { 89 struct udevice *dev; 90 const struct rockchip_connector *connector; 91 struct udevice *phy_dev; 92 const struct rockchip_phy *phy; 93 ofnode node; 94 ofnode phy_node; 95 96 void *private; 97 void *phy_private; 98 99 struct drm_display_mode mode; 100 struct overscan overscan; 101 u8 edid[EDID_SIZE * 4]; 102 int bus_format; 103 int output_mode; 104 int type; 105 int output_type; 106 int color_space; 107 108 struct { 109 u32 *lut; 110 int size; 111 } gamma; 112 }; 113 114 struct logo_info { 115 int mode; 116 char *mem; 117 bool ymirror; 118 u32 offset; 119 u32 width; 120 u32 height; 121 u32 bpp; 122 }; 123 124 struct rockchip_logo_cache { 125 struct list_head head; 126 char name[20]; 127 struct logo_info logo; 128 }; 129 130 struct display_state { 131 struct list_head head; 132 133 const void *blob; 134 ofnode node; 135 136 struct crtc_state crtc_state; 137 struct connector_state conn_state; 138 struct panel_state panel_state; 139 140 const char *ulogo_name; 141 const char *klogo_name; 142 143 struct logo_info logo; 144 int logo_mode; 145 int charge_logo_mode; 146 void *mem_base; 147 int mem_size; 148 149 int enable; 150 int is_init; 151 int is_enable; 152 }; 153 154 int drm_mode_vrefresh(const struct drm_display_mode *mode); 155 156 #endif 157