diff options
Diffstat (limited to 'drivers/extcon/extcon.h')
-rw-r--r-- | drivers/extcon/extcon.h | 62 |
1 files changed, 62 insertions, 0 deletions
diff --git a/drivers/extcon/extcon.h b/drivers/extcon/extcon.h new file mode 100644 index 000000000000..993ddccafe11 --- /dev/null +++ b/drivers/extcon/extcon.h | |||
@@ -0,0 +1,62 @@ | |||
1 | #ifndef __LINUX_EXTCON_INTERNAL_H__ | ||
2 | #define __LINUX_EXTCON_INTERNAL_H__ | ||
3 | |||
4 | #include <linux/extcon.h> | ||
5 | |||
6 | /** | ||
7 | * struct extcon_dev - An extcon device represents one external connector. | ||
8 | * @name: The name of this extcon device. Parent device name is | ||
9 | * used if NULL. | ||
10 | * @supported_cable: Array of supported cable names ending with EXTCON_NONE. | ||
11 | * If supported_cable is NULL, cable name related APIs | ||
12 | * are disabled. | ||
13 | * @mutually_exclusive: Array of mutually exclusive set of cables that cannot | ||
14 | * be attached simultaneously. The array should be | ||
15 | * ending with NULL or be NULL (no mutually exclusive | ||
16 | * cables). For example, if it is { 0x7, 0x30, 0}, then, | ||
17 | * {0, 1}, {0, 1, 2}, {0, 2}, {1, 2}, or {4, 5} cannot | ||
18 | * be attached simulataneously. {0x7, 0} is equivalent to | ||
19 | * {0x3, 0x6, 0x5, 0}. If it is {0xFFFFFFFF, 0}, there | ||
20 | * can be no simultaneous connections. | ||
21 | * @dev: Device of this extcon. | ||
22 | * @state: Attach/detach state of this extcon. Do not provide at | ||
23 | * register-time. | ||
24 | * @nh: Notifier for the state change events from this extcon | ||
25 | * @entry: To support list of extcon devices so that users can | ||
26 | * search for extcon devices based on the extcon name. | ||
27 | * @lock: | ||
28 | * @max_supported: Internal value to store the number of cables. | ||
29 | * @extcon_dev_type: Device_type struct to provide attribute_groups | ||
30 | * customized for each extcon device. | ||
31 | * @cables: Sysfs subdirectories. Each represents one cable. | ||
32 | * | ||
33 | * In most cases, users only need to provide "User initializing data" of | ||
34 | * this struct when registering an extcon. In some exceptional cases, | ||
35 | * optional callbacks may be needed. However, the values in "internal data" | ||
36 | * are overwritten by register function. | ||
37 | */ | ||
38 | struct extcon_dev { | ||
39 | /* Optional user initializing data */ | ||
40 | const char *name; | ||
41 | const unsigned int *supported_cable; | ||
42 | const u32 *mutually_exclusive; | ||
43 | |||
44 | /* Internal data. Please do not set. */ | ||
45 | struct device dev; | ||
46 | struct raw_notifier_head *nh; | ||
47 | struct list_head entry; | ||
48 | int max_supported; | ||
49 | spinlock_t lock; /* could be called by irq handler */ | ||
50 | u32 state; | ||
51 | |||
52 | /* /sys/class/extcon/.../cable.n/... */ | ||
53 | struct device_type extcon_dev_type; | ||
54 | struct extcon_cable *cables; | ||
55 | |||
56 | /* /sys/class/extcon/.../mutually_exclusive/... */ | ||
57 | struct attribute_group attr_g_muex; | ||
58 | struct attribute **attrs_muex; | ||
59 | struct device_attribute *d_attrs_muex; | ||
60 | }; | ||
61 | |||
62 | #endif /* __LINUX_EXTCON_INTERNAL_H__ */ | ||