162306a36Sopenharmony_ci/*
262306a36Sopenharmony_ci * Copyright © 2007-2008 Intel Corporation
362306a36Sopenharmony_ci *   Jesse Barnes <jesse.barnes@intel.com>
462306a36Sopenharmony_ci *
562306a36Sopenharmony_ci * Permission is hereby granted, free of charge, to any person obtaining a
662306a36Sopenharmony_ci * copy of this software and associated documentation files (the "Software"),
762306a36Sopenharmony_ci * to deal in the Software without restriction, including without limitation
862306a36Sopenharmony_ci * the rights to use, copy, modify, merge, publish, distribute, sublicense,
962306a36Sopenharmony_ci * and/or sell copies of the Software, and to permit persons to whom the
1062306a36Sopenharmony_ci * Software is furnished to do so, subject to the following conditions:
1162306a36Sopenharmony_ci *
1262306a36Sopenharmony_ci * The above copyright notice and this permission notice shall be included in
1362306a36Sopenharmony_ci * all copies or substantial portions of the Software.
1462306a36Sopenharmony_ci *
1562306a36Sopenharmony_ci * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
1662306a36Sopenharmony_ci * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
1762306a36Sopenharmony_ci * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
1862306a36Sopenharmony_ci * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
1962306a36Sopenharmony_ci * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
2062306a36Sopenharmony_ci * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
2162306a36Sopenharmony_ci * OTHER DEALINGS IN THE SOFTWARE.
2262306a36Sopenharmony_ci */
2362306a36Sopenharmony_ci#ifndef __DRM_EDID_H__
2462306a36Sopenharmony_ci#define __DRM_EDID_H__
2562306a36Sopenharmony_ci
2662306a36Sopenharmony_ci#include <linux/types.h>
2762306a36Sopenharmony_ci#include <linux/hdmi.h>
2862306a36Sopenharmony_ci#include <drm/drm_mode.h>
2962306a36Sopenharmony_ci
3062306a36Sopenharmony_cistruct drm_device;
3162306a36Sopenharmony_cistruct drm_edid;
3262306a36Sopenharmony_cistruct i2c_adapter;
3362306a36Sopenharmony_ci
3462306a36Sopenharmony_ci#define EDID_LENGTH 128
3562306a36Sopenharmony_ci#define DDC_ADDR 0x50
3662306a36Sopenharmony_ci#define DDC_ADDR2 0x52 /* E-DDC 1.2 - where DisplayID can hide */
3762306a36Sopenharmony_ci
3862306a36Sopenharmony_ci#define CEA_EXT	    0x02
3962306a36Sopenharmony_ci#define VTB_EXT	    0x10
4062306a36Sopenharmony_ci#define DI_EXT	    0x40
4162306a36Sopenharmony_ci#define LS_EXT	    0x50
4262306a36Sopenharmony_ci#define MI_EXT	    0x60
4362306a36Sopenharmony_ci#define DISPLAYID_EXT 0x70
4462306a36Sopenharmony_ci
4562306a36Sopenharmony_cistruct est_timings {
4662306a36Sopenharmony_ci	u8 t1;
4762306a36Sopenharmony_ci	u8 t2;
4862306a36Sopenharmony_ci	u8 mfg_rsvd;
4962306a36Sopenharmony_ci} __attribute__((packed));
5062306a36Sopenharmony_ci
5162306a36Sopenharmony_ci/* 00=16:10, 01=4:3, 10=5:4, 11=16:9 */
5262306a36Sopenharmony_ci#define EDID_TIMING_ASPECT_SHIFT 6
5362306a36Sopenharmony_ci#define EDID_TIMING_ASPECT_MASK  (0x3 << EDID_TIMING_ASPECT_SHIFT)
5462306a36Sopenharmony_ci
5562306a36Sopenharmony_ci/* need to add 60 */
5662306a36Sopenharmony_ci#define EDID_TIMING_VFREQ_SHIFT  0
5762306a36Sopenharmony_ci#define EDID_TIMING_VFREQ_MASK   (0x3f << EDID_TIMING_VFREQ_SHIFT)
5862306a36Sopenharmony_ci
5962306a36Sopenharmony_cistruct std_timing {
6062306a36Sopenharmony_ci	u8 hsize; /* need to multiply by 8 then add 248 */
6162306a36Sopenharmony_ci	u8 vfreq_aspect;
6262306a36Sopenharmony_ci} __attribute__((packed));
6362306a36Sopenharmony_ci
6462306a36Sopenharmony_ci#define DRM_EDID_PT_HSYNC_POSITIVE (1 << 1)
6562306a36Sopenharmony_ci#define DRM_EDID_PT_VSYNC_POSITIVE (1 << 2)
6662306a36Sopenharmony_ci#define DRM_EDID_PT_SEPARATE_SYNC  (3 << 3)
6762306a36Sopenharmony_ci#define DRM_EDID_PT_STEREO         (1 << 5)
6862306a36Sopenharmony_ci#define DRM_EDID_PT_INTERLACED     (1 << 7)
6962306a36Sopenharmony_ci
7062306a36Sopenharmony_ci/* If detailed data is pixel timing */
7162306a36Sopenharmony_cistruct detailed_pixel_timing {
7262306a36Sopenharmony_ci	u8 hactive_lo;
7362306a36Sopenharmony_ci	u8 hblank_lo;
7462306a36Sopenharmony_ci	u8 hactive_hblank_hi;
7562306a36Sopenharmony_ci	u8 vactive_lo;
7662306a36Sopenharmony_ci	u8 vblank_lo;
7762306a36Sopenharmony_ci	u8 vactive_vblank_hi;
7862306a36Sopenharmony_ci	u8 hsync_offset_lo;
7962306a36Sopenharmony_ci	u8 hsync_pulse_width_lo;
8062306a36Sopenharmony_ci	u8 vsync_offset_pulse_width_lo;
8162306a36Sopenharmony_ci	u8 hsync_vsync_offset_pulse_width_hi;
8262306a36Sopenharmony_ci	u8 width_mm_lo;
8362306a36Sopenharmony_ci	u8 height_mm_lo;
8462306a36Sopenharmony_ci	u8 width_height_mm_hi;
8562306a36Sopenharmony_ci	u8 hborder;
8662306a36Sopenharmony_ci	u8 vborder;
8762306a36Sopenharmony_ci	u8 misc;
8862306a36Sopenharmony_ci} __attribute__((packed));
8962306a36Sopenharmony_ci
9062306a36Sopenharmony_ci/* If it's not pixel timing, it'll be one of the below */
9162306a36Sopenharmony_cistruct detailed_data_string {
9262306a36Sopenharmony_ci	u8 str[13];
9362306a36Sopenharmony_ci} __attribute__((packed));
9462306a36Sopenharmony_ci
9562306a36Sopenharmony_ci#define DRM_EDID_RANGE_OFFSET_MIN_VFREQ (1 << 0) /* 1.4 */
9662306a36Sopenharmony_ci#define DRM_EDID_RANGE_OFFSET_MAX_VFREQ (1 << 1) /* 1.4 */
9762306a36Sopenharmony_ci#define DRM_EDID_RANGE_OFFSET_MIN_HFREQ (1 << 2) /* 1.4 */
9862306a36Sopenharmony_ci#define DRM_EDID_RANGE_OFFSET_MAX_HFREQ (1 << 3) /* 1.4 */
9962306a36Sopenharmony_ci
10062306a36Sopenharmony_ci#define DRM_EDID_DEFAULT_GTF_SUPPORT_FLAG   0x00 /* 1.3 */
10162306a36Sopenharmony_ci#define DRM_EDID_RANGE_LIMITS_ONLY_FLAG     0x01 /* 1.4 */
10262306a36Sopenharmony_ci#define DRM_EDID_SECONDARY_GTF_SUPPORT_FLAG 0x02 /* 1.3 */
10362306a36Sopenharmony_ci#define DRM_EDID_CVT_SUPPORT_FLAG           0x04 /* 1.4 */
10462306a36Sopenharmony_ci
10562306a36Sopenharmony_ci#define DRM_EDID_CVT_FLAGS_STANDARD_BLANKING (1 << 3)
10662306a36Sopenharmony_ci#define DRM_EDID_CVT_FLAGS_REDUCED_BLANKING  (1 << 4)
10762306a36Sopenharmony_ci
10862306a36Sopenharmony_cistruct detailed_data_monitor_range {
10962306a36Sopenharmony_ci	u8 min_vfreq;
11062306a36Sopenharmony_ci	u8 max_vfreq;
11162306a36Sopenharmony_ci	u8 min_hfreq_khz;
11262306a36Sopenharmony_ci	u8 max_hfreq_khz;
11362306a36Sopenharmony_ci	u8 pixel_clock_mhz; /* need to multiply by 10 */
11462306a36Sopenharmony_ci	u8 flags;
11562306a36Sopenharmony_ci	union {
11662306a36Sopenharmony_ci		struct {
11762306a36Sopenharmony_ci			u8 reserved;
11862306a36Sopenharmony_ci			u8 hfreq_start_khz; /* need to multiply by 2 */
11962306a36Sopenharmony_ci			u8 c; /* need to divide by 2 */
12062306a36Sopenharmony_ci			__le16 m;
12162306a36Sopenharmony_ci			u8 k;
12262306a36Sopenharmony_ci			u8 j; /* need to divide by 2 */
12362306a36Sopenharmony_ci		} __attribute__((packed)) gtf2;
12462306a36Sopenharmony_ci		struct {
12562306a36Sopenharmony_ci			u8 version;
12662306a36Sopenharmony_ci			u8 data1; /* high 6 bits: extra clock resolution */
12762306a36Sopenharmony_ci			u8 data2; /* plus low 2 of above: max hactive */
12862306a36Sopenharmony_ci			u8 supported_aspects;
12962306a36Sopenharmony_ci			u8 flags; /* preferred aspect and blanking support */
13062306a36Sopenharmony_ci			u8 supported_scalings;
13162306a36Sopenharmony_ci			u8 preferred_refresh;
13262306a36Sopenharmony_ci		} __attribute__((packed)) cvt;
13362306a36Sopenharmony_ci	} __attribute__((packed)) formula;
13462306a36Sopenharmony_ci} __attribute__((packed));
13562306a36Sopenharmony_ci
13662306a36Sopenharmony_cistruct detailed_data_wpindex {
13762306a36Sopenharmony_ci	u8 white_yx_lo; /* Lower 2 bits each */
13862306a36Sopenharmony_ci	u8 white_x_hi;
13962306a36Sopenharmony_ci	u8 white_y_hi;
14062306a36Sopenharmony_ci	u8 gamma; /* need to divide by 100 then add 1 */
14162306a36Sopenharmony_ci} __attribute__((packed));
14262306a36Sopenharmony_ci
14362306a36Sopenharmony_cistruct detailed_data_color_point {
14462306a36Sopenharmony_ci	u8 windex1;
14562306a36Sopenharmony_ci	u8 wpindex1[3];
14662306a36Sopenharmony_ci	u8 windex2;
14762306a36Sopenharmony_ci	u8 wpindex2[3];
14862306a36Sopenharmony_ci} __attribute__((packed));
14962306a36Sopenharmony_ci
15062306a36Sopenharmony_cistruct cvt_timing {
15162306a36Sopenharmony_ci	u8 code[3];
15262306a36Sopenharmony_ci} __attribute__((packed));
15362306a36Sopenharmony_ci
15462306a36Sopenharmony_cistruct detailed_non_pixel {
15562306a36Sopenharmony_ci	u8 pad1;
15662306a36Sopenharmony_ci	u8 type; /* ff=serial, fe=string, fd=monitor range, fc=monitor name
15762306a36Sopenharmony_ci		    fb=color point data, fa=standard timing data,
15862306a36Sopenharmony_ci		    f9=undefined, f8=mfg. reserved */
15962306a36Sopenharmony_ci	u8 pad2;
16062306a36Sopenharmony_ci	union {
16162306a36Sopenharmony_ci		struct detailed_data_string str;
16262306a36Sopenharmony_ci		struct detailed_data_monitor_range range;
16362306a36Sopenharmony_ci		struct detailed_data_wpindex color;
16462306a36Sopenharmony_ci		struct std_timing timings[6];
16562306a36Sopenharmony_ci		struct cvt_timing cvt[4];
16662306a36Sopenharmony_ci	} __attribute__((packed)) data;
16762306a36Sopenharmony_ci} __attribute__((packed));
16862306a36Sopenharmony_ci
16962306a36Sopenharmony_ci#define EDID_DETAIL_EST_TIMINGS 0xf7
17062306a36Sopenharmony_ci#define EDID_DETAIL_CVT_3BYTE 0xf8
17162306a36Sopenharmony_ci#define EDID_DETAIL_COLOR_MGMT_DATA 0xf9
17262306a36Sopenharmony_ci#define EDID_DETAIL_STD_MODES 0xfa
17362306a36Sopenharmony_ci#define EDID_DETAIL_MONITOR_CPDATA 0xfb
17462306a36Sopenharmony_ci#define EDID_DETAIL_MONITOR_NAME 0xfc
17562306a36Sopenharmony_ci#define EDID_DETAIL_MONITOR_RANGE 0xfd
17662306a36Sopenharmony_ci#define EDID_DETAIL_MONITOR_STRING 0xfe
17762306a36Sopenharmony_ci#define EDID_DETAIL_MONITOR_SERIAL 0xff
17862306a36Sopenharmony_ci
17962306a36Sopenharmony_cistruct detailed_timing {
18062306a36Sopenharmony_ci	__le16 pixel_clock; /* need to multiply by 10 KHz */
18162306a36Sopenharmony_ci	union {
18262306a36Sopenharmony_ci		struct detailed_pixel_timing pixel_data;
18362306a36Sopenharmony_ci		struct detailed_non_pixel other_data;
18462306a36Sopenharmony_ci	} __attribute__((packed)) data;
18562306a36Sopenharmony_ci} __attribute__((packed));
18662306a36Sopenharmony_ci
18762306a36Sopenharmony_ci#define DRM_EDID_INPUT_SERRATION_VSYNC (1 << 0)
18862306a36Sopenharmony_ci#define DRM_EDID_INPUT_SYNC_ON_GREEN   (1 << 1)
18962306a36Sopenharmony_ci#define DRM_EDID_INPUT_COMPOSITE_SYNC  (1 << 2)
19062306a36Sopenharmony_ci#define DRM_EDID_INPUT_SEPARATE_SYNCS  (1 << 3)
19162306a36Sopenharmony_ci#define DRM_EDID_INPUT_BLANK_TO_BLACK  (1 << 4)
19262306a36Sopenharmony_ci#define DRM_EDID_INPUT_VIDEO_LEVEL     (3 << 5)
19362306a36Sopenharmony_ci#define DRM_EDID_INPUT_DIGITAL         (1 << 7)
19462306a36Sopenharmony_ci#define DRM_EDID_DIGITAL_DEPTH_MASK    (7 << 4) /* 1.4 */
19562306a36Sopenharmony_ci#define DRM_EDID_DIGITAL_DEPTH_UNDEF   (0 << 4) /* 1.4 */
19662306a36Sopenharmony_ci#define DRM_EDID_DIGITAL_DEPTH_6       (1 << 4) /* 1.4 */
19762306a36Sopenharmony_ci#define DRM_EDID_DIGITAL_DEPTH_8       (2 << 4) /* 1.4 */
19862306a36Sopenharmony_ci#define DRM_EDID_DIGITAL_DEPTH_10      (3 << 4) /* 1.4 */
19962306a36Sopenharmony_ci#define DRM_EDID_DIGITAL_DEPTH_12      (4 << 4) /* 1.4 */
20062306a36Sopenharmony_ci#define DRM_EDID_DIGITAL_DEPTH_14      (5 << 4) /* 1.4 */
20162306a36Sopenharmony_ci#define DRM_EDID_DIGITAL_DEPTH_16      (6 << 4) /* 1.4 */
20262306a36Sopenharmony_ci#define DRM_EDID_DIGITAL_DEPTH_RSVD    (7 << 4) /* 1.4 */
20362306a36Sopenharmony_ci#define DRM_EDID_DIGITAL_TYPE_MASK     (7 << 0) /* 1.4 */
20462306a36Sopenharmony_ci#define DRM_EDID_DIGITAL_TYPE_UNDEF    (0 << 0) /* 1.4 */
20562306a36Sopenharmony_ci#define DRM_EDID_DIGITAL_TYPE_DVI      (1 << 0) /* 1.4 */
20662306a36Sopenharmony_ci#define DRM_EDID_DIGITAL_TYPE_HDMI_A   (2 << 0) /* 1.4 */
20762306a36Sopenharmony_ci#define DRM_EDID_DIGITAL_TYPE_HDMI_B   (3 << 0) /* 1.4 */
20862306a36Sopenharmony_ci#define DRM_EDID_DIGITAL_TYPE_MDDI     (4 << 0) /* 1.4 */
20962306a36Sopenharmony_ci#define DRM_EDID_DIGITAL_TYPE_DP       (5 << 0) /* 1.4 */
21062306a36Sopenharmony_ci#define DRM_EDID_DIGITAL_DFP_1_X       (1 << 0) /* 1.3 */
21162306a36Sopenharmony_ci
21262306a36Sopenharmony_ci#define DRM_EDID_FEATURE_DEFAULT_GTF      (1 << 0) /* 1.2 */
21362306a36Sopenharmony_ci#define DRM_EDID_FEATURE_CONTINUOUS_FREQ  (1 << 0) /* 1.4 */
21462306a36Sopenharmony_ci#define DRM_EDID_FEATURE_PREFERRED_TIMING (1 << 1)
21562306a36Sopenharmony_ci#define DRM_EDID_FEATURE_STANDARD_COLOR   (1 << 2)
21662306a36Sopenharmony_ci/* If analog */
21762306a36Sopenharmony_ci#define DRM_EDID_FEATURE_DISPLAY_TYPE     (3 << 3) /* 00=mono, 01=rgb, 10=non-rgb, 11=unknown */
21862306a36Sopenharmony_ci/* If digital */
21962306a36Sopenharmony_ci#define DRM_EDID_FEATURE_COLOR_MASK	  (3 << 3)
22062306a36Sopenharmony_ci#define DRM_EDID_FEATURE_RGB		  (0 << 3)
22162306a36Sopenharmony_ci#define DRM_EDID_FEATURE_RGB_YCRCB444	  (1 << 3)
22262306a36Sopenharmony_ci#define DRM_EDID_FEATURE_RGB_YCRCB422	  (2 << 3)
22362306a36Sopenharmony_ci#define DRM_EDID_FEATURE_RGB_YCRCB	  (3 << 3) /* both 4:4:4 and 4:2:2 */
22462306a36Sopenharmony_ci
22562306a36Sopenharmony_ci#define DRM_EDID_FEATURE_PM_ACTIVE_OFF    (1 << 5)
22662306a36Sopenharmony_ci#define DRM_EDID_FEATURE_PM_SUSPEND       (1 << 6)
22762306a36Sopenharmony_ci#define DRM_EDID_FEATURE_PM_STANDBY       (1 << 7)
22862306a36Sopenharmony_ci
22962306a36Sopenharmony_ci#define DRM_EDID_HDMI_DC_48               (1 << 6)
23062306a36Sopenharmony_ci#define DRM_EDID_HDMI_DC_36               (1 << 5)
23162306a36Sopenharmony_ci#define DRM_EDID_HDMI_DC_30               (1 << 4)
23262306a36Sopenharmony_ci#define DRM_EDID_HDMI_DC_Y444             (1 << 3)
23362306a36Sopenharmony_ci
23462306a36Sopenharmony_ci/* YCBCR 420 deep color modes */
23562306a36Sopenharmony_ci#define DRM_EDID_YCBCR420_DC_48		  (1 << 2)
23662306a36Sopenharmony_ci#define DRM_EDID_YCBCR420_DC_36		  (1 << 1)
23762306a36Sopenharmony_ci#define DRM_EDID_YCBCR420_DC_30		  (1 << 0)
23862306a36Sopenharmony_ci#define DRM_EDID_YCBCR420_DC_MASK (DRM_EDID_YCBCR420_DC_48 | \
23962306a36Sopenharmony_ci				    DRM_EDID_YCBCR420_DC_36 | \
24062306a36Sopenharmony_ci				    DRM_EDID_YCBCR420_DC_30)
24162306a36Sopenharmony_ci
24262306a36Sopenharmony_ci/* HDMI 2.1 additional fields */
24362306a36Sopenharmony_ci#define DRM_EDID_MAX_FRL_RATE_MASK		0xf0
24462306a36Sopenharmony_ci#define DRM_EDID_FAPA_START_LOCATION		(1 << 0)
24562306a36Sopenharmony_ci#define DRM_EDID_ALLM				(1 << 1)
24662306a36Sopenharmony_ci#define DRM_EDID_FVA				(1 << 2)
24762306a36Sopenharmony_ci
24862306a36Sopenharmony_ci/* Deep Color specific */
24962306a36Sopenharmony_ci#define DRM_EDID_DC_30BIT_420			(1 << 0)
25062306a36Sopenharmony_ci#define DRM_EDID_DC_36BIT_420			(1 << 1)
25162306a36Sopenharmony_ci#define DRM_EDID_DC_48BIT_420			(1 << 2)
25262306a36Sopenharmony_ci
25362306a36Sopenharmony_ci/* VRR specific */
25462306a36Sopenharmony_ci#define DRM_EDID_CNMVRR				(1 << 3)
25562306a36Sopenharmony_ci#define DRM_EDID_CINEMA_VRR			(1 << 4)
25662306a36Sopenharmony_ci#define DRM_EDID_MDELTA				(1 << 5)
25762306a36Sopenharmony_ci#define DRM_EDID_VRR_MAX_UPPER_MASK		0xc0
25862306a36Sopenharmony_ci#define DRM_EDID_VRR_MAX_LOWER_MASK		0xff
25962306a36Sopenharmony_ci#define DRM_EDID_VRR_MIN_MASK			0x3f
26062306a36Sopenharmony_ci
26162306a36Sopenharmony_ci/* DSC specific */
26262306a36Sopenharmony_ci#define DRM_EDID_DSC_10BPC			(1 << 0)
26362306a36Sopenharmony_ci#define DRM_EDID_DSC_12BPC			(1 << 1)
26462306a36Sopenharmony_ci#define DRM_EDID_DSC_16BPC			(1 << 2)
26562306a36Sopenharmony_ci#define DRM_EDID_DSC_ALL_BPP			(1 << 3)
26662306a36Sopenharmony_ci#define DRM_EDID_DSC_NATIVE_420			(1 << 6)
26762306a36Sopenharmony_ci#define DRM_EDID_DSC_1P2			(1 << 7)
26862306a36Sopenharmony_ci#define DRM_EDID_DSC_MAX_FRL_RATE_MASK		0xf0
26962306a36Sopenharmony_ci#define DRM_EDID_DSC_MAX_SLICES			0xf
27062306a36Sopenharmony_ci#define DRM_EDID_DSC_TOTAL_CHUNK_KBYTES		0x3f
27162306a36Sopenharmony_ci
27262306a36Sopenharmony_ci/* ELD Header Block */
27362306a36Sopenharmony_ci#define DRM_ELD_HEADER_BLOCK_SIZE	4
27462306a36Sopenharmony_ci
27562306a36Sopenharmony_ci#define DRM_ELD_VER			0
27662306a36Sopenharmony_ci# define DRM_ELD_VER_SHIFT		3
27762306a36Sopenharmony_ci# define DRM_ELD_VER_MASK		(0x1f << 3)
27862306a36Sopenharmony_ci# define DRM_ELD_VER_CEA861D		(2 << 3) /* supports 861D or below */
27962306a36Sopenharmony_ci# define DRM_ELD_VER_CANNED		(0x1f << 3)
28062306a36Sopenharmony_ci
28162306a36Sopenharmony_ci#define DRM_ELD_BASELINE_ELD_LEN	2	/* in dwords! */
28262306a36Sopenharmony_ci
28362306a36Sopenharmony_ci/* ELD Baseline Block for ELD_Ver == 2 */
28462306a36Sopenharmony_ci#define DRM_ELD_CEA_EDID_VER_MNL	4
28562306a36Sopenharmony_ci# define DRM_ELD_CEA_EDID_VER_SHIFT	5
28662306a36Sopenharmony_ci# define DRM_ELD_CEA_EDID_VER_MASK	(7 << 5)
28762306a36Sopenharmony_ci# define DRM_ELD_CEA_EDID_VER_NONE	(0 << 5)
28862306a36Sopenharmony_ci# define DRM_ELD_CEA_EDID_VER_CEA861	(1 << 5)
28962306a36Sopenharmony_ci# define DRM_ELD_CEA_EDID_VER_CEA861A	(2 << 5)
29062306a36Sopenharmony_ci# define DRM_ELD_CEA_EDID_VER_CEA861BCD	(3 << 5)
29162306a36Sopenharmony_ci# define DRM_ELD_MNL_SHIFT		0
29262306a36Sopenharmony_ci# define DRM_ELD_MNL_MASK		(0x1f << 0)
29362306a36Sopenharmony_ci
29462306a36Sopenharmony_ci#define DRM_ELD_SAD_COUNT_CONN_TYPE	5
29562306a36Sopenharmony_ci# define DRM_ELD_SAD_COUNT_SHIFT	4
29662306a36Sopenharmony_ci# define DRM_ELD_SAD_COUNT_MASK		(0xf << 4)
29762306a36Sopenharmony_ci# define DRM_ELD_CONN_TYPE_SHIFT	2
29862306a36Sopenharmony_ci# define DRM_ELD_CONN_TYPE_MASK		(3 << 2)
29962306a36Sopenharmony_ci# define DRM_ELD_CONN_TYPE_HDMI		(0 << 2)
30062306a36Sopenharmony_ci# define DRM_ELD_CONN_TYPE_DP		(1 << 2)
30162306a36Sopenharmony_ci# define DRM_ELD_SUPPORTS_AI		(1 << 1)
30262306a36Sopenharmony_ci# define DRM_ELD_SUPPORTS_HDCP		(1 << 0)
30362306a36Sopenharmony_ci
30462306a36Sopenharmony_ci#define DRM_ELD_AUD_SYNCH_DELAY		6	/* in units of 2 ms */
30562306a36Sopenharmony_ci# define DRM_ELD_AUD_SYNCH_DELAY_MAX	0xfa	/* 500 ms */
30662306a36Sopenharmony_ci
30762306a36Sopenharmony_ci#define DRM_ELD_SPEAKER			7
30862306a36Sopenharmony_ci# define DRM_ELD_SPEAKER_MASK		0x7f
30962306a36Sopenharmony_ci# define DRM_ELD_SPEAKER_RLRC		(1 << 6)
31062306a36Sopenharmony_ci# define DRM_ELD_SPEAKER_FLRC		(1 << 5)
31162306a36Sopenharmony_ci# define DRM_ELD_SPEAKER_RC		(1 << 4)
31262306a36Sopenharmony_ci# define DRM_ELD_SPEAKER_RLR		(1 << 3)
31362306a36Sopenharmony_ci# define DRM_ELD_SPEAKER_FC		(1 << 2)
31462306a36Sopenharmony_ci# define DRM_ELD_SPEAKER_LFE		(1 << 1)
31562306a36Sopenharmony_ci# define DRM_ELD_SPEAKER_FLR		(1 << 0)
31662306a36Sopenharmony_ci
31762306a36Sopenharmony_ci#define DRM_ELD_PORT_ID			8	/* offsets 8..15 inclusive */
31862306a36Sopenharmony_ci# define DRM_ELD_PORT_ID_LEN		8
31962306a36Sopenharmony_ci
32062306a36Sopenharmony_ci#define DRM_ELD_MANUFACTURER_NAME0	16
32162306a36Sopenharmony_ci#define DRM_ELD_MANUFACTURER_NAME1	17
32262306a36Sopenharmony_ci
32362306a36Sopenharmony_ci#define DRM_ELD_PRODUCT_CODE0		18
32462306a36Sopenharmony_ci#define DRM_ELD_PRODUCT_CODE1		19
32562306a36Sopenharmony_ci
32662306a36Sopenharmony_ci#define DRM_ELD_MONITOR_NAME_STRING	20	/* offsets 20..(20+mnl-1) inclusive */
32762306a36Sopenharmony_ci
32862306a36Sopenharmony_ci#define DRM_ELD_CEA_SAD(mnl, sad)	(20 + (mnl) + 3 * (sad))
32962306a36Sopenharmony_ci
33062306a36Sopenharmony_cistruct edid {
33162306a36Sopenharmony_ci	u8 header[8];
33262306a36Sopenharmony_ci	/* Vendor & product info */
33362306a36Sopenharmony_ci	u8 mfg_id[2];
33462306a36Sopenharmony_ci	u8 prod_code[2];
33562306a36Sopenharmony_ci	u32 serial; /* FIXME: byte order */
33662306a36Sopenharmony_ci	u8 mfg_week;
33762306a36Sopenharmony_ci	u8 mfg_year;
33862306a36Sopenharmony_ci	/* EDID version */
33962306a36Sopenharmony_ci	u8 version;
34062306a36Sopenharmony_ci	u8 revision;
34162306a36Sopenharmony_ci	/* Display info: */
34262306a36Sopenharmony_ci	u8 input;
34362306a36Sopenharmony_ci	u8 width_cm;
34462306a36Sopenharmony_ci	u8 height_cm;
34562306a36Sopenharmony_ci	u8 gamma;
34662306a36Sopenharmony_ci	u8 features;
34762306a36Sopenharmony_ci	/* Color characteristics */
34862306a36Sopenharmony_ci	u8 red_green_lo;
34962306a36Sopenharmony_ci	u8 blue_white_lo;
35062306a36Sopenharmony_ci	u8 red_x;
35162306a36Sopenharmony_ci	u8 red_y;
35262306a36Sopenharmony_ci	u8 green_x;
35362306a36Sopenharmony_ci	u8 green_y;
35462306a36Sopenharmony_ci	u8 blue_x;
35562306a36Sopenharmony_ci	u8 blue_y;
35662306a36Sopenharmony_ci	u8 white_x;
35762306a36Sopenharmony_ci	u8 white_y;
35862306a36Sopenharmony_ci	/* Est. timings and mfg rsvd timings*/
35962306a36Sopenharmony_ci	struct est_timings established_timings;
36062306a36Sopenharmony_ci	/* Standard timings 1-8*/
36162306a36Sopenharmony_ci	struct std_timing standard_timings[8];
36262306a36Sopenharmony_ci	/* Detailing timings 1-4 */
36362306a36Sopenharmony_ci	struct detailed_timing detailed_timings[4];
36462306a36Sopenharmony_ci	/* Number of 128 byte ext. blocks */
36562306a36Sopenharmony_ci	u8 extensions;
36662306a36Sopenharmony_ci	/* Checksum */
36762306a36Sopenharmony_ci	u8 checksum;
36862306a36Sopenharmony_ci} __attribute__((packed));
36962306a36Sopenharmony_ci
37062306a36Sopenharmony_ci#define EDID_PRODUCT_ID(e) ((e)->prod_code[0] | ((e)->prod_code[1] << 8))
37162306a36Sopenharmony_ci
37262306a36Sopenharmony_ci/* Short Audio Descriptor */
37362306a36Sopenharmony_cistruct cea_sad {
37462306a36Sopenharmony_ci	u8 format;
37562306a36Sopenharmony_ci	u8 channels; /* max number of channels - 1 */
37662306a36Sopenharmony_ci	u8 freq;
37762306a36Sopenharmony_ci	u8 byte2; /* meaning depends on format */
37862306a36Sopenharmony_ci};
37962306a36Sopenharmony_ci
38062306a36Sopenharmony_cistruct drm_encoder;
38162306a36Sopenharmony_cistruct drm_connector;
38262306a36Sopenharmony_cistruct drm_connector_state;
38362306a36Sopenharmony_cistruct drm_display_mode;
38462306a36Sopenharmony_ci
38562306a36Sopenharmony_ciint drm_edid_to_sad(const struct edid *edid, struct cea_sad **sads);
38662306a36Sopenharmony_ciint drm_edid_to_speaker_allocation(const struct edid *edid, u8 **sadb);
38762306a36Sopenharmony_ciint drm_av_sync_delay(struct drm_connector *connector,
38862306a36Sopenharmony_ci		      const struct drm_display_mode *mode);
38962306a36Sopenharmony_ci
39062306a36Sopenharmony_ci#ifdef CONFIG_DRM_LOAD_EDID_FIRMWARE
39162306a36Sopenharmony_ciint __drm_set_edid_firmware_path(const char *path);
39262306a36Sopenharmony_ciint __drm_get_edid_firmware_path(char *buf, size_t bufsize);
39362306a36Sopenharmony_ci#endif
39462306a36Sopenharmony_ci
39562306a36Sopenharmony_cibool drm_edid_are_equal(const struct edid *edid1, const struct edid *edid2);
39662306a36Sopenharmony_ci
39762306a36Sopenharmony_ciint
39862306a36Sopenharmony_cidrm_hdmi_avi_infoframe_from_display_mode(struct hdmi_avi_infoframe *frame,
39962306a36Sopenharmony_ci					 const struct drm_connector *connector,
40062306a36Sopenharmony_ci					 const struct drm_display_mode *mode);
40162306a36Sopenharmony_ciint
40262306a36Sopenharmony_cidrm_hdmi_vendor_infoframe_from_display_mode(struct hdmi_vendor_infoframe *frame,
40362306a36Sopenharmony_ci					    const struct drm_connector *connector,
40462306a36Sopenharmony_ci					    const struct drm_display_mode *mode);
40562306a36Sopenharmony_ci
40662306a36Sopenharmony_civoid
40762306a36Sopenharmony_cidrm_hdmi_avi_infoframe_quant_range(struct hdmi_avi_infoframe *frame,
40862306a36Sopenharmony_ci				   const struct drm_connector *connector,
40962306a36Sopenharmony_ci				   const struct drm_display_mode *mode,
41062306a36Sopenharmony_ci				   enum hdmi_quantization_range rgb_quant_range);
41162306a36Sopenharmony_ci
41262306a36Sopenharmony_ci/**
41362306a36Sopenharmony_ci * drm_eld_mnl - Get ELD monitor name length in bytes.
41462306a36Sopenharmony_ci * @eld: pointer to an eld memory structure with mnl set
41562306a36Sopenharmony_ci */
41662306a36Sopenharmony_cistatic inline int drm_eld_mnl(const uint8_t *eld)
41762306a36Sopenharmony_ci{
41862306a36Sopenharmony_ci	return (eld[DRM_ELD_CEA_EDID_VER_MNL] & DRM_ELD_MNL_MASK) >> DRM_ELD_MNL_SHIFT;
41962306a36Sopenharmony_ci}
42062306a36Sopenharmony_ci
42162306a36Sopenharmony_ci/**
42262306a36Sopenharmony_ci * drm_eld_sad - Get ELD SAD structures.
42362306a36Sopenharmony_ci * @eld: pointer to an eld memory structure with sad_count set
42462306a36Sopenharmony_ci */
42562306a36Sopenharmony_cistatic inline const uint8_t *drm_eld_sad(const uint8_t *eld)
42662306a36Sopenharmony_ci{
42762306a36Sopenharmony_ci	unsigned int ver, mnl;
42862306a36Sopenharmony_ci
42962306a36Sopenharmony_ci	ver = (eld[DRM_ELD_VER] & DRM_ELD_VER_MASK) >> DRM_ELD_VER_SHIFT;
43062306a36Sopenharmony_ci	if (ver != 2 && ver != 31)
43162306a36Sopenharmony_ci		return NULL;
43262306a36Sopenharmony_ci
43362306a36Sopenharmony_ci	mnl = drm_eld_mnl(eld);
43462306a36Sopenharmony_ci	if (mnl > 16)
43562306a36Sopenharmony_ci		return NULL;
43662306a36Sopenharmony_ci
43762306a36Sopenharmony_ci	return eld + DRM_ELD_CEA_SAD(mnl, 0);
43862306a36Sopenharmony_ci}
43962306a36Sopenharmony_ci
44062306a36Sopenharmony_ci/**
44162306a36Sopenharmony_ci * drm_eld_sad_count - Get ELD SAD count.
44262306a36Sopenharmony_ci * @eld: pointer to an eld memory structure with sad_count set
44362306a36Sopenharmony_ci */
44462306a36Sopenharmony_cistatic inline int drm_eld_sad_count(const uint8_t *eld)
44562306a36Sopenharmony_ci{
44662306a36Sopenharmony_ci	return (eld[DRM_ELD_SAD_COUNT_CONN_TYPE] & DRM_ELD_SAD_COUNT_MASK) >>
44762306a36Sopenharmony_ci		DRM_ELD_SAD_COUNT_SHIFT;
44862306a36Sopenharmony_ci}
44962306a36Sopenharmony_ci
45062306a36Sopenharmony_ci/**
45162306a36Sopenharmony_ci * drm_eld_calc_baseline_block_size - Calculate baseline block size in bytes
45262306a36Sopenharmony_ci * @eld: pointer to an eld memory structure with mnl and sad_count set
45362306a36Sopenharmony_ci *
45462306a36Sopenharmony_ci * This is a helper for determining the payload size of the baseline block, in
45562306a36Sopenharmony_ci * bytes, for e.g. setting the Baseline_ELD_Len field in the ELD header block.
45662306a36Sopenharmony_ci */
45762306a36Sopenharmony_cistatic inline int drm_eld_calc_baseline_block_size(const uint8_t *eld)
45862306a36Sopenharmony_ci{
45962306a36Sopenharmony_ci	return DRM_ELD_MONITOR_NAME_STRING - DRM_ELD_HEADER_BLOCK_SIZE +
46062306a36Sopenharmony_ci		drm_eld_mnl(eld) + drm_eld_sad_count(eld) * 3;
46162306a36Sopenharmony_ci}
46262306a36Sopenharmony_ci
46362306a36Sopenharmony_ci/**
46462306a36Sopenharmony_ci * drm_eld_size - Get ELD size in bytes
46562306a36Sopenharmony_ci * @eld: pointer to a complete eld memory structure
46662306a36Sopenharmony_ci *
46762306a36Sopenharmony_ci * The returned value does not include the vendor block. It's vendor specific,
46862306a36Sopenharmony_ci * and comprises of the remaining bytes in the ELD memory buffer after
46962306a36Sopenharmony_ci * drm_eld_size() bytes of header and baseline block.
47062306a36Sopenharmony_ci *
47162306a36Sopenharmony_ci * The returned value is guaranteed to be a multiple of 4.
47262306a36Sopenharmony_ci */
47362306a36Sopenharmony_cistatic inline int drm_eld_size(const uint8_t *eld)
47462306a36Sopenharmony_ci{
47562306a36Sopenharmony_ci	return DRM_ELD_HEADER_BLOCK_SIZE + eld[DRM_ELD_BASELINE_ELD_LEN] * 4;
47662306a36Sopenharmony_ci}
47762306a36Sopenharmony_ci
47862306a36Sopenharmony_ci/**
47962306a36Sopenharmony_ci * drm_eld_get_spk_alloc - Get speaker allocation
48062306a36Sopenharmony_ci * @eld: pointer to an ELD memory structure
48162306a36Sopenharmony_ci *
48262306a36Sopenharmony_ci * The returned value is the speakers mask. User has to use %DRM_ELD_SPEAKER
48362306a36Sopenharmony_ci * field definitions to identify speakers.
48462306a36Sopenharmony_ci */
48562306a36Sopenharmony_cistatic inline u8 drm_eld_get_spk_alloc(const uint8_t *eld)
48662306a36Sopenharmony_ci{
48762306a36Sopenharmony_ci	return eld[DRM_ELD_SPEAKER] & DRM_ELD_SPEAKER_MASK;
48862306a36Sopenharmony_ci}
48962306a36Sopenharmony_ci
49062306a36Sopenharmony_ci/**
49162306a36Sopenharmony_ci * drm_eld_get_conn_type - Get device type hdmi/dp connected
49262306a36Sopenharmony_ci * @eld: pointer to an ELD memory structure
49362306a36Sopenharmony_ci *
49462306a36Sopenharmony_ci * The caller need to use %DRM_ELD_CONN_TYPE_HDMI or %DRM_ELD_CONN_TYPE_DP to
49562306a36Sopenharmony_ci * identify the display type connected.
49662306a36Sopenharmony_ci */
49762306a36Sopenharmony_cistatic inline u8 drm_eld_get_conn_type(const uint8_t *eld)
49862306a36Sopenharmony_ci{
49962306a36Sopenharmony_ci	return eld[DRM_ELD_SAD_COUNT_CONN_TYPE] & DRM_ELD_CONN_TYPE_MASK;
50062306a36Sopenharmony_ci}
50162306a36Sopenharmony_ci
50262306a36Sopenharmony_ci/**
50362306a36Sopenharmony_ci * drm_edid_decode_mfg_id - Decode the manufacturer ID
50462306a36Sopenharmony_ci * @mfg_id: The manufacturer ID
50562306a36Sopenharmony_ci * @vend: A 4-byte buffer to store the 3-letter vendor string plus a '\0'
50662306a36Sopenharmony_ci *	  termination
50762306a36Sopenharmony_ci */
50862306a36Sopenharmony_cistatic inline const char *drm_edid_decode_mfg_id(u16 mfg_id, char vend[4])
50962306a36Sopenharmony_ci{
51062306a36Sopenharmony_ci	vend[0] = '@' + ((mfg_id >> 10) & 0x1f);
51162306a36Sopenharmony_ci	vend[1] = '@' + ((mfg_id >> 5) & 0x1f);
51262306a36Sopenharmony_ci	vend[2] = '@' + ((mfg_id >> 0) & 0x1f);
51362306a36Sopenharmony_ci	vend[3] = '\0';
51462306a36Sopenharmony_ci
51562306a36Sopenharmony_ci	return vend;
51662306a36Sopenharmony_ci}
51762306a36Sopenharmony_ci
51862306a36Sopenharmony_ci/**
51962306a36Sopenharmony_ci * drm_edid_encode_panel_id - Encode an ID for matching against drm_edid_get_panel_id()
52062306a36Sopenharmony_ci * @vend_chr_0: First character of the vendor string.
52162306a36Sopenharmony_ci * @vend_chr_1: Second character of the vendor string.
52262306a36Sopenharmony_ci * @vend_chr_2: Third character of the vendor string.
52362306a36Sopenharmony_ci * @product_id: The 16-bit product ID.
52462306a36Sopenharmony_ci *
52562306a36Sopenharmony_ci * This is a macro so that it can be calculated at compile time and used
52662306a36Sopenharmony_ci * as an initializer.
52762306a36Sopenharmony_ci *
52862306a36Sopenharmony_ci * For instance:
52962306a36Sopenharmony_ci *   drm_edid_encode_panel_id('B', 'O', 'E', 0x2d08) => 0x09e52d08
53062306a36Sopenharmony_ci *
53162306a36Sopenharmony_ci * Return: a 32-bit ID per panel.
53262306a36Sopenharmony_ci */
53362306a36Sopenharmony_ci#define drm_edid_encode_panel_id(vend_chr_0, vend_chr_1, vend_chr_2, product_id) \
53462306a36Sopenharmony_ci	((((u32)(vend_chr_0) - '@') & 0x1f) << 26 | \
53562306a36Sopenharmony_ci	 (((u32)(vend_chr_1) - '@') & 0x1f) << 21 | \
53662306a36Sopenharmony_ci	 (((u32)(vend_chr_2) - '@') & 0x1f) << 16 | \
53762306a36Sopenharmony_ci	 ((product_id) & 0xffff))
53862306a36Sopenharmony_ci
53962306a36Sopenharmony_ci/**
54062306a36Sopenharmony_ci * drm_edid_decode_panel_id - Decode a panel ID from drm_edid_encode_panel_id()
54162306a36Sopenharmony_ci * @panel_id: The panel ID to decode.
54262306a36Sopenharmony_ci * @vend: A 4-byte buffer to store the 3-letter vendor string plus a '\0'
54362306a36Sopenharmony_ci *	  termination
54462306a36Sopenharmony_ci * @product_id: The product ID will be returned here.
54562306a36Sopenharmony_ci *
54662306a36Sopenharmony_ci * For instance, after:
54762306a36Sopenharmony_ci *   drm_edid_decode_panel_id(0x09e52d08, vend, &product_id)
54862306a36Sopenharmony_ci * These will be true:
54962306a36Sopenharmony_ci *   vend[0] = 'B'
55062306a36Sopenharmony_ci *   vend[1] = 'O'
55162306a36Sopenharmony_ci *   vend[2] = 'E'
55262306a36Sopenharmony_ci *   vend[3] = '\0'
55362306a36Sopenharmony_ci *   product_id = 0x2d08
55462306a36Sopenharmony_ci */
55562306a36Sopenharmony_cistatic inline void drm_edid_decode_panel_id(u32 panel_id, char vend[4], u16 *product_id)
55662306a36Sopenharmony_ci{
55762306a36Sopenharmony_ci	*product_id = (u16)(panel_id & 0xffff);
55862306a36Sopenharmony_ci	drm_edid_decode_mfg_id(panel_id >> 16, vend);
55962306a36Sopenharmony_ci}
56062306a36Sopenharmony_ci
56162306a36Sopenharmony_cibool drm_probe_ddc(struct i2c_adapter *adapter);
56262306a36Sopenharmony_cistruct edid *drm_do_get_edid(struct drm_connector *connector,
56362306a36Sopenharmony_ci	int (*get_edid_block)(void *data, u8 *buf, unsigned int block,
56462306a36Sopenharmony_ci			      size_t len),
56562306a36Sopenharmony_ci	void *data);
56662306a36Sopenharmony_cistruct edid *drm_get_edid(struct drm_connector *connector,
56762306a36Sopenharmony_ci			  struct i2c_adapter *adapter);
56862306a36Sopenharmony_ciu32 drm_edid_get_panel_id(struct i2c_adapter *adapter);
56962306a36Sopenharmony_cistruct edid *drm_get_edid_switcheroo(struct drm_connector *connector,
57062306a36Sopenharmony_ci				     struct i2c_adapter *adapter);
57162306a36Sopenharmony_cistruct edid *drm_edid_duplicate(const struct edid *edid);
57262306a36Sopenharmony_ciint drm_add_edid_modes(struct drm_connector *connector, struct edid *edid);
57362306a36Sopenharmony_ciint drm_edid_override_connector_update(struct drm_connector *connector);
57462306a36Sopenharmony_ci
57562306a36Sopenharmony_ciu8 drm_match_cea_mode(const struct drm_display_mode *to_match);
57662306a36Sopenharmony_cibool drm_detect_hdmi_monitor(const struct edid *edid);
57762306a36Sopenharmony_cibool drm_detect_monitor_audio(const struct edid *edid);
57862306a36Sopenharmony_cienum hdmi_quantization_range
57962306a36Sopenharmony_cidrm_default_rgb_quant_range(const struct drm_display_mode *mode);
58062306a36Sopenharmony_ciint drm_add_modes_noedid(struct drm_connector *connector,
58162306a36Sopenharmony_ci			 int hdisplay, int vdisplay);
58262306a36Sopenharmony_civoid drm_set_preferred_mode(struct drm_connector *connector,
58362306a36Sopenharmony_ci			    int hpref, int vpref);
58462306a36Sopenharmony_ci
58562306a36Sopenharmony_ciint drm_edid_header_is_valid(const void *edid);
58662306a36Sopenharmony_cibool drm_edid_block_valid(u8 *raw_edid, int block, bool print_bad_edid,
58762306a36Sopenharmony_ci			  bool *edid_corrupt);
58862306a36Sopenharmony_cibool drm_edid_is_valid(struct edid *edid);
58962306a36Sopenharmony_civoid drm_edid_get_monitor_name(const struct edid *edid, char *name,
59062306a36Sopenharmony_ci			       int buflen);
59162306a36Sopenharmony_cistruct drm_display_mode *drm_mode_find_dmt(struct drm_device *dev,
59262306a36Sopenharmony_ci					   int hsize, int vsize, int fresh,
59362306a36Sopenharmony_ci					   bool rb);
59462306a36Sopenharmony_cistruct drm_display_mode *
59562306a36Sopenharmony_cidrm_display_mode_from_cea_vic(struct drm_device *dev,
59662306a36Sopenharmony_ci			      u8 video_code);
59762306a36Sopenharmony_ci
59862306a36Sopenharmony_ci/* Interface based on struct drm_edid */
59962306a36Sopenharmony_ciconst struct drm_edid *drm_edid_alloc(const void *edid, size_t size);
60062306a36Sopenharmony_ciconst struct drm_edid *drm_edid_dup(const struct drm_edid *drm_edid);
60162306a36Sopenharmony_civoid drm_edid_free(const struct drm_edid *drm_edid);
60262306a36Sopenharmony_cibool drm_edid_valid(const struct drm_edid *drm_edid);
60362306a36Sopenharmony_ciconst struct edid *drm_edid_raw(const struct drm_edid *drm_edid);
60462306a36Sopenharmony_ciconst struct drm_edid *drm_edid_read(struct drm_connector *connector);
60562306a36Sopenharmony_ciconst struct drm_edid *drm_edid_read_ddc(struct drm_connector *connector,
60662306a36Sopenharmony_ci					 struct i2c_adapter *adapter);
60762306a36Sopenharmony_ciconst struct drm_edid *drm_edid_read_custom(struct drm_connector *connector,
60862306a36Sopenharmony_ci					    int (*read_block)(void *context, u8 *buf, unsigned int block, size_t len),
60962306a36Sopenharmony_ci					    void *context);
61062306a36Sopenharmony_ciconst struct drm_edid *drm_edid_read_switcheroo(struct drm_connector *connector,
61162306a36Sopenharmony_ci						struct i2c_adapter *adapter);
61262306a36Sopenharmony_ciint drm_edid_connector_update(struct drm_connector *connector,
61362306a36Sopenharmony_ci			      const struct drm_edid *edid);
61462306a36Sopenharmony_ciint drm_edid_connector_add_modes(struct drm_connector *connector);
61562306a36Sopenharmony_ci
61662306a36Sopenharmony_ciconst u8 *drm_find_edid_extension(const struct drm_edid *drm_edid,
61762306a36Sopenharmony_ci				  int ext_id, int *ext_index);
61862306a36Sopenharmony_ci
61962306a36Sopenharmony_ci#endif /* __DRM_EDID_H__ */
620