1 /* 2 * Copyright (c) 2007-2019 Allwinnertech Co., Ltd. 3 * Author: zhengwanyu <zhengwanyu@allwinnertech.com> 4 * 5 * This software is licensed under the terms of the GNU General Public 6 * License version 2, as published by the Free Software Foundation, and 7 * may be copied, distributed, and modified under those terms. 8 * 9 * This program is distributed in the hope that it will be useful, 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 * GNU General Public License for more details. 13 * 14 */ 15 #ifndef _SUNXI_HDMI_H_ 16 #define _SUNXI_HDMI_H_ 17 #include<video/sunxi_display2.h> 18 19 #include "hdmi_core/api/core_api.h" 20 21 struct sunxi_hdmi_work_mode { 22 unsigned int hdmi_mode; /*0:DVI 1:HDMI*/ 23 unsigned int color_fmt; 24 unsigned int color_depth; 25 unsigned int color_space; 26 unsigned int eotf; 27 unsigned int color_range; 28 unsigned int aspect_ratio; 29 }; 30 31 struct sunxi_mode_related_info { 32 /*name of struct drm_display_mode*/ 33 char mode_type[20]; 34 unsigned char mode_index; 35 bool native; 36 37 unsigned int rgb[4]; 38 unsigned int rgb_count; 39 40 unsigned int yuv444[4]; 41 unsigned int yuv444_count; 42 43 unsigned int yuv422[4]; 44 unsigned int yuv422_count; 45 46 unsigned int yuv420[4]; 47 unsigned int yuv420_count; 48 49 unsigned int reserved0; 50 unsigned int reserved1; 51 unsigned int reserved2; 52 unsigned int reserved3; 53 unsigned int reserved4; 54 }; 55 56 struct hdr_static_metadata_db { 57 unsigned char et_n; 58 unsigned char sm_n; 59 60 /*Desired Content Max Luminance data*/ 61 unsigned char dc_max_lum_data; 62 63 /*Desired Content Max Frame-average Luminance data*/ 64 unsigned char dc_max_fa_lum_data; 65 66 /*Desired Content Min Luminance data*/ 67 unsigned char dc_min_lum_data; 68 }; 69 70 struct sunxi_mode_independent_info { 71 bool bad_edid; 72 73 unsigned int hdmi_mode; 74 75 /*VSDB*/ 76 /*for cec*/ 77 unsigned short phyaddr; 78 79 /*HDMI2.0 HF_VSDB*/ 80 //bool scramble_340mcs; 81 82 /*hdr*/ 83 struct hdr_static_metadata_db hdr_static_metadata; 84 85 }; 86 87 struct sunxi_hdmi_funcs { 88 /*get gotplug status*/ 89 int (*get_connect_status)(void); 90 struct sunxi_hdmi_work_mode *(*get_init_params)(void); 91 92 sink_edid_t *(*get_sink_caps)(void); 93 94 /*set hdmi working mode*/ 95 int (*set_working_mode)(struct sunxi_hdmi_work_mode *work_mode); 96 /*get hdmi working mode*/ 97 void (*get_working_mode)(struct sunxi_hdmi_work_mode *work_mode); 98 99 /*read edid*/ 100 int (*get_edid_block)(void *data, unsigned char *buf, 101 unsigned int block, size_t len); 102 103 /*correct the params parsed from edid*/ 104 /*void (*mode_related_params_correct)( 105 struct sunxi_mode_related_info *info);*/ 106 void (*mode_independent_params_correct)( 107 struct sunxi_mode_independent_info *info); 108 109 int (*enable)(struct disp_video_timings *timing); 110 int (*sw_enable)(struct disp_video_timings *timing); 111 void (*disable)(void); 112 }; 113 114 struct sunxi_hdmi_funcs *sunxi_hdmi_get_funcs(void); 115 116 #endif 117