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