xref: /openbmc/linux/include/linux/usb/typec_mux.h (revision ba61bb17)
1 // SPDX-License-Identifier: GPL-2.0
2 
3 #ifndef __USB_TYPEC_MUX
4 #define __USB_TYPEC_MUX
5 
6 #include <linux/list.h>
7 #include <linux/usb/typec.h>
8 
9 struct device;
10 
11 /**
12  * struct typec_switch - USB Type-C cable orientation switch
13  * @dev: Switch device
14  * @entry: List entry
15  * @set: Callback to the driver for setting the orientation
16  *
17  * USB Type-C pin flipper switch routing the correct data pairs from the
18  * connector to the USB controller depending on the orientation of the cable
19  * plug.
20  */
21 struct typec_switch {
22 	struct device *dev;
23 	struct list_head entry;
24 
25 	int (*set)(struct typec_switch *sw, enum typec_orientation orientation);
26 };
27 
28 /**
29  * struct typec_switch - USB Type-C connector pin mux
30  * @dev: Mux device
31  * @entry: List entry
32  * @set: Callback to the driver for setting the state of the mux
33  *
34  * Pin Multiplexer/DeMultiplexer switch routing the USB Type-C connector pins to
35  * different components depending on the requested mode of operation. Used with
36  * Accessory/Alternate modes.
37  */
38 struct typec_mux {
39 	struct device *dev;
40 	struct list_head entry;
41 
42 	int (*set)(struct typec_mux *mux, int state);
43 };
44 
45 struct typec_switch *typec_switch_get(struct device *dev);
46 void typec_switch_put(struct typec_switch *sw);
47 int typec_switch_register(struct typec_switch *sw);
48 void typec_switch_unregister(struct typec_switch *sw);
49 
50 struct typec_mux *typec_mux_get(struct device *dev);
51 void typec_mux_put(struct typec_mux *mux);
52 int typec_mux_register(struct typec_mux *mux);
53 void typec_mux_unregister(struct typec_mux *mux);
54 
55 #endif /* __USB_TYPEC_MUX */
56