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 typec_altmode; 12 struct fwnode_handle; 13 14 typedef int (*typec_switch_set_fn_t)(struct typec_switch *sw, 15 enum typec_orientation orientation); 16 17 struct typec_switch_desc { 18 struct fwnode_handle *fwnode; 19 typec_switch_set_fn_t set; 20 void *drvdata; 21 }; 22 23 struct typec_switch *typec_switch_get(struct device *dev); 24 void typec_switch_put(struct typec_switch *sw); 25 struct typec_switch * 26 typec_switch_register(struct device *parent, 27 const struct typec_switch_desc *desc); 28 void typec_switch_unregister(struct typec_switch *sw); 29 30 void typec_switch_set_drvdata(struct typec_switch *sw, void *data); 31 void *typec_switch_get_drvdata(struct typec_switch *sw); 32 33 struct typec_mux_state { 34 struct typec_altmode *alt; 35 unsigned long mode; 36 void *data; 37 }; 38 39 typedef int (*typec_mux_set_fn_t)(struct typec_mux *mux, 40 struct typec_mux_state *state); 41 42 struct typec_mux_desc { 43 struct fwnode_handle *fwnode; 44 typec_mux_set_fn_t set; 45 void *drvdata; 46 }; 47 48 struct typec_mux * 49 typec_mux_get(struct device *dev, const struct typec_altmode_desc *desc); 50 void typec_mux_put(struct typec_mux *mux); 51 struct typec_mux * 52 typec_mux_register(struct device *parent, const struct typec_mux_desc *desc); 53 void typec_mux_unregister(struct typec_mux *mux); 54 55 void typec_mux_set_drvdata(struct typec_mux *mux, void *data); 56 void *typec_mux_get_drvdata(struct typec_mux *mux); 57 58 #endif /* __USB_TYPEC_MUX */ 59