xref: /linux/drivers/usb/typec/bus.h (revision 1ac731c529cd4d6adbce134754b51ff7d822b145)
1 /* SPDX-License-Identifier: GPL-2.0 */
2 
3 #ifndef __USB_TYPEC_ALTMODE_H__
4 #define __USB_TYPEC_ALTMODE_H__
5 
6 #include <linux/usb/typec_altmode.h>
7 
8 struct bus_type;
9 struct typec_mux;
10 struct typec_retimer;
11 
12 struct altmode {
13 	unsigned int			id;
14 	struct typec_altmode		adev;
15 	struct typec_mux		*mux;
16 	struct typec_retimer		*retimer;
17 
18 	enum typec_port_data		roles;
19 
20 	struct attribute		*attrs[5];
21 	char				group_name[8];
22 	struct attribute_group		group;
23 	const struct attribute_group	*groups[2];
24 
25 	struct altmode			*partner;
26 	struct altmode			*plug[2];
27 };
28 
29 #define to_altmode(d) container_of(d, struct altmode, adev)
30 
31 extern const struct bus_type typec_bus;
32 extern const struct device_type typec_altmode_dev_type;
33 
34 #define is_typec_altmode(_dev_) (_dev_->type == &typec_altmode_dev_type)
35 
36 #endif /* __USB_TYPEC_ALTMODE_H__ */
37