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 connector_state { 76 struct udevice *dev; 77 const struct rockchip_connector *connector; 78 struct udevice *phy_dev; 79 const struct rockchip_phy *phy; 80 ofnode node; 81 ofnode phy_node; 82 83 void *private; 84 void *phy_private; 85 86 struct drm_display_mode mode; 87 u8 edid[EDID_SIZE * 4]; 88 int bus_format; 89 int output_mode; 90 int type; 91 int output_type; 92 int color_space; 93 94 struct { 95 u32 *lut; 96 int size; 97 } gamma; 98 }; 99 100 struct logo_info { 101 int mode; 102 char *mem; 103 bool ymirror; 104 u32 offset; 105 u32 width; 106 u32 height; 107 u32 bpp; 108 }; 109 110 struct rockchip_logo_cache { 111 struct list_head head; 112 char name[20]; 113 struct logo_info logo; 114 }; 115 116 struct display_state { 117 struct list_head head; 118 119 const void *blob; 120 ofnode node; 121 122 struct crtc_state crtc_state; 123 struct connector_state conn_state; 124 struct panel_state panel_state; 125 126 const char *ulogo_name; 127 const char *klogo_name; 128 129 struct logo_info logo; 130 int logo_mode; 131 int charge_logo_mode; 132 void *mem_base; 133 int mem_size; 134 135 int enable; 136 int is_init; 137 int is_enable; 138 }; 139 140 int drm_mode_vrefresh(const struct drm_display_mode *mode); 141 142 #endif 143