hc
2024-03-26 e0728245c89800c2038c23308f2d88969d5b41c8
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
// SPDX-License-Identifier: GPL-2.0
 
#ifndef __USB_TYPEC_MUX
#define __USB_TYPEC_MUX
 
#include <linux/property.h>
#include <linux/usb/typec.h>
 
struct device;
struct typec_mux;
struct typec_switch;
struct typec_altmode;
struct fwnode_handle;
 
typedef int (*typec_switch_set_fn_t)(struct typec_switch *sw,
                    enum typec_orientation orientation);
 
struct typec_switch_desc {
   struct fwnode_handle *fwnode;
   typec_switch_set_fn_t set;
   const char *name;
   void *drvdata;
};
 
struct typec_switch *fwnode_typec_switch_get(struct fwnode_handle *fwnode);
void typec_switch_put(struct typec_switch *sw);
int typec_switch_set(struct typec_switch *sw,
            enum typec_orientation orientation);
 
static inline struct typec_switch *typec_switch_get(struct device *dev)
{
   return fwnode_typec_switch_get(dev_fwnode(dev));
}
 
struct typec_switch *
typec_switch_register(struct device *parent,
             const struct typec_switch_desc *desc);
void typec_switch_unregister(struct typec_switch *sw);
 
void typec_switch_set_drvdata(struct typec_switch *sw, void *data);
void *typec_switch_get_drvdata(struct typec_switch *sw);
 
struct typec_mux_state {
   struct typec_altmode *alt;
   unsigned long mode;
   void *data;
};
 
typedef int (*typec_mux_set_fn_t)(struct typec_mux *mux,
                 struct typec_mux_state *state);
 
struct typec_mux_desc {
   struct fwnode_handle *fwnode;
   typec_mux_set_fn_t set;
   const char *name;
   void *drvdata;
};
 
struct typec_mux *fwnode_typec_mux_get(struct fwnode_handle *fwnode,
                      const struct typec_altmode_desc *desc);
void typec_mux_put(struct typec_mux *mux);
int typec_mux_set(struct typec_mux *mux, struct typec_mux_state *state);
 
static inline struct typec_mux *
typec_mux_get(struct device *dev, const struct typec_altmode_desc *desc)
{
   return fwnode_typec_mux_get(dev_fwnode(dev), desc);
}
 
struct typec_mux *
typec_mux_register(struct device *parent, const struct typec_mux_desc *desc);
void typec_mux_unregister(struct typec_mux *mux);
 
void typec_mux_set_drvdata(struct typec_mux *mux, void *data);
void *typec_mux_get_drvdata(struct typec_mux *mux);
 
#endif /* __USB_TYPEC_MUX */