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