1 /*	$NetBSD: dcb.h,v 1.3 2021/12/18 23:45:33 riastradh Exp $	*/
2 
3 /* SPDX-License-Identifier: MIT */
4 #ifndef __NVBIOS_DCB_H__
5 #define __NVBIOS_DCB_H__
6 enum dcb_output_type {
7 	DCB_OUTPUT_ANALOG	= 0x0,
8 	DCB_OUTPUT_TV		= 0x1,
9 	DCB_OUTPUT_TMDS		= 0x2,
10 	DCB_OUTPUT_LVDS		= 0x3,
11 	DCB_OUTPUT_DP		= 0x6,
12 	DCB_OUTPUT_WFD		= 0x8,
13 	DCB_OUTPUT_EOL		= 0xe,
14 	DCB_OUTPUT_UNUSED	= 0xf,
15 	DCB_OUTPUT_MERGED	= 100,
16 	DCB_OUTPUT_ANY = -1,
17 };
18 
19 struct dcb_output {
20 	int index;	/* may not be raw dcb index if merging has happened */
21 	u16 hasht;
22 	u16 hashm;
23 	enum dcb_output_type type;
24 	uint8_t i2c_index;
25 	uint8_t heads;
26 	uint8_t connector;
27 	uint8_t bus;
28 	uint8_t location;
29 	uint8_t or;
30 	uint8_t link;
31 	bool duallink_possible;
32 	uint8_t extdev;
33 	union {
34 		struct sor_conf {
35 			int link;
36 		} sorconf;
37 		struct {
38 			int maxfreq;
39 		} crtconf;
40 		struct {
41 			struct sor_conf sor;
42 			bool use_straps_for_mode;
43 			bool use_acpi_for_edid;
44 			bool use_power_scripts;
45 		} lvdsconf;
46 		struct {
47 			bool has_component_output;
48 		} tvconf;
49 		struct {
50 			struct sor_conf sor;
51 			int link_nr;
52 			int link_bw;
53 		} dpconf;
54 		struct {
55 			struct sor_conf sor;
56 			int slave_addr;
57 		} tmdsconf;
58 	};
59 	bool i2c_upper_default;
60 };
61 
62 u16 dcb_table(struct nvkm_bios *, u8 *ver, u8 *hdr, u8 *ent, u8 *len);
63 u16 dcb_outp(struct nvkm_bios *, u8 idx, u8 *ver, u8 *len);
64 u16 dcb_outp_parse(struct nvkm_bios *, u8 idx, u8 *, u8 *,
65 		   struct dcb_output *);
66 u16 dcb_outp_match(struct nvkm_bios *, u16 type, u16 mask, u8 *, u8 *,
67 		   struct dcb_output *);
68 int dcb_outp_foreach(struct nvkm_bios *, void *data, int (*exec)
69 		     (struct nvkm_bios *, void *, int index, u16 entry));
70 #endif
71