1 /* SPDX-License-Identifier: GPL-2.0-only */
2 
3 #ifndef __CROS_TYPEC_ALTMODE_H__
4 #define __CROS_TYPEC_ALTMODE_H__
5 
6 #include <linux/kconfig.h>
7 #include <linux/usb/typec.h>
8 
9 struct cros_typec_port;
10 struct typec_altmode;
11 struct typec_altmode_desc;
12 struct typec_displayport_data;
13 
14 #if IS_ENABLED(CONFIG_TYPEC_DP_ALTMODE)
15 struct typec_altmode *
16 cros_typec_register_displayport(struct cros_typec_port *port,
17 				struct typec_altmode_desc *desc,
18 				bool ap_mode_entry);
19 
20 int cros_typec_displayport_status_update(struct typec_altmode *altmode,
21 					 struct typec_displayport_data *data);
22 #else
23 static inline struct typec_altmode *
cros_typec_register_displayport(struct cros_typec_port * port,struct typec_altmode_desc * desc,bool ap_mode_entry)24 cros_typec_register_displayport(struct cros_typec_port *port,
25 				struct typec_altmode_desc *desc,
26 				bool ap_mode_entry)
27 {
28 	return typec_port_register_altmode(port->port, desc);
29 }
30 
cros_typec_displayport_status_update(struct typec_altmode * altmode,struct typec_displayport_data * data)31 static inline int cros_typec_displayport_status_update(struct typec_altmode *altmode,
32 					 struct typec_displayport_data *data)
33 {
34 	return 0;
35 }
36 #endif
37 
38 #if IS_ENABLED(CONFIG_TYPEC_TBT_ALTMODE)
39 struct typec_altmode *
40 cros_typec_register_thunderbolt(struct cros_typec_port *port,
41 				struct typec_altmode_desc *desc);
42 #else
43 static inline struct typec_altmode *
cros_typec_register_thunderbolt(struct cros_typec_port * port,struct typec_altmode_desc * desc)44 cros_typec_register_thunderbolt(struct cros_typec_port *port,
45 				struct typec_altmode_desc *desc)
46 {
47 	return typec_port_register_altmode(port->port, desc);
48 }
49 #endif
50 
51 #endif /* __CROS_TYPEC_ALTMODE_H__ */
52