• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // SPDX-License-Identifier: GPL-2.0
2 
3 #ifndef __USB_TYPEC_MUX
4 #define __USB_TYPEC_MUX
5 
6 #include <linux/usb/typec.h>
7 
8 struct device;
9 struct typec_mux;
10 struct typec_switch;
11 struct fwnode_handle;
12 
13 typedef int (*typec_switch_set_fn_t)(struct typec_switch *sw,
14 				     enum typec_orientation orientation);
15 
16 struct typec_switch_desc {
17 	struct fwnode_handle *fwnode;
18 	typec_switch_set_fn_t set;
19 	void *drvdata;
20 };
21 
22 struct typec_switch *typec_switch_get(struct device *dev);
23 void typec_switch_put(struct typec_switch *sw);
24 struct typec_switch *
25 typec_switch_register(struct device *parent,
26 		      const struct typec_switch_desc *desc);
27 void typec_switch_unregister(struct typec_switch *sw);
28 
29 void typec_switch_set_drvdata(struct typec_switch *sw, void *data);
30 void *typec_switch_get_drvdata(struct typec_switch *sw);
31 
32 typedef int (*typec_mux_set_fn_t)(struct typec_mux *mux, int state);
33 
34 struct typec_mux_desc {
35 	struct fwnode_handle *fwnode;
36 	typec_mux_set_fn_t set;
37 	void *drvdata;
38 };
39 
40 struct typec_mux *
41 typec_mux_get(struct device *dev, const struct typec_altmode_desc *desc);
42 void typec_mux_put(struct typec_mux *mux);
43 struct typec_mux *
44 typec_mux_register(struct device *parent, const struct typec_mux_desc *desc);
45 void typec_mux_unregister(struct typec_mux *mux);
46 
47 void typec_mux_set_drvdata(struct typec_mux *mux, void *data);
48 void *typec_mux_get_drvdata(struct typec_mux *mux);
49 
50 #endif /* __USB_TYPEC_MUX */
51