coreboot
coreboot is an Open Source project aimed at replacing the proprietary BIOS found in most computers.
usbc_mux.h
Go to the documentation of this file.
1 /* SPDX-License-Identifier: GPL-2.0-only */
2 
3 #ifndef __USBC_MUX_H__
4 #define __USBC_MUX_H__
5 
6 /* struct to hold all USB-C mux related variables */
7 struct usbc_mux_info {
8  bool dp; /* DP connected */
9  bool usb; /* USB connected */
10  bool cable; /* 0 = Passive cable, 1 = Active cable */
11  bool polarity; /* Polarity of connected device. 0 = Normal, 1 = Flipped */
12  bool hpd_lvl; /* HPD Level assert */
13  bool hpd_irq; /* HPD IRQ assert */
14  bool ufp; /* 0 = DFP, 1 = UFP */
15  bool dbg_acc; /* Debug Accessory. 0 = Disable, 1 = Enable */
16  uint8_t dp_pin_mode; /* DP pin assignments
17  0h: Reserved.
18  1h: Pin Assignment A.
19  2h: Pin Assignment B.
20  3h: Pin Assignment C.
21  4h: Pin Assignment D.
22  5h: Pin Assignment E.
23  6h: Pin Assignment F.
24  7-Fh: Reserved. */
25 };
26 struct usbc_mux_ops {
27  /*
28  * Get mux information on a given port.
29  *
30  * Return value:
31  * -1 = error
32  * 0 = success
33  */
34  int (*get_mux_info)(int port, struct usbc_mux_info *info);
35 };
36 
37 struct usbc_dp_ops {
38  /*
39  * Wait up to `timeout_ms` for DP connection to be ready on any available port.
40  *
41  * Return value:
42  * -1 = error
43  * 0 = no DP connection
44  * <bit mask> = mask for ports that are ready in DP mode.
45  */
46  int (*wait_for_connection)(long timeout_ms);
47 
48  /*
49  * Enter DP mode on a given `port`.
50  *
51  * Return value:
52  * -1 = error
53  * 0 = success
54  */
55  int (*enter_dp_mode)(int port);
56 
57  /*
58  * Wait up to `timeout_ms` for HPD on a given port.
59  *
60  * Return value:
61  * -1 = timeout
62  * 0 = success
63  */
64  int (*wait_for_hpd)(int port, long timeout_ms);
65 };
66 
67 struct usbc_ops {
68  struct usbc_mux_ops mux_ops;
69  struct usbc_dp_ops dp_ops;
70 };
71 
72 const struct usbc_ops *usbc_get_ops(void);
73 
74 #endif /* __USBC_MUX_H__ */
static struct smmstore_params_info info
Definition: ramstage.c:12
port
Definition: i915.h:29
unsigned char uint8_t
Definition: stdint.h:8
int(* enter_dp_mode)(int port)
Definition: usbc_mux.h:55
int(* wait_for_connection)(long timeout_ms)
Definition: usbc_mux.h:46
int(* wait_for_hpd)(int port, long timeout_ms)
Definition: usbc_mux.h:64
bool dbg_acc
Definition: usbc_mux.h:15
bool polarity
Definition: usbc_mux.h:11
bool hpd_irq
Definition: usbc_mux.h:13
bool cable
Definition: usbc_mux.h:10
uint8_t dp_pin_mode
Definition: usbc_mux.h:16
bool usb
Definition: usbc_mux.h:9
bool hpd_lvl
Definition: usbc_mux.h:12
int(* get_mux_info)(int port, struct usbc_mux_info *info)
Definition: usbc_mux.h:34
struct usbc_mux_ops mux_ops
Definition: usbc_mux.h:68
struct usbc_dp_ops dp_ops
Definition: usbc_mux.h:69
const struct usbc_ops * usbc_get_ops(void)
Definition: usbc_mux.c:16