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_all: Notifier for the state change events for all supported 25 * external connectors from this extcon. 26 * @nh: Notifier for the state change events from this extcon 27 * @entry: To support list of extcon devices so that users can 28 * search for extcon devices based on the extcon name. 29 * @lock: 30 * @max_supported: Internal value to store the number of cables. 31 * @extcon_dev_type: Device_type struct to provide attribute_groups 32 * customized for each extcon device. 33 * @cables: Sysfs subdirectories. Each represents one cable. 34 * 35 * In most cases, users only need to provide "User initializing data" of 36 * this struct when registering an extcon. In some exceptional cases, 37 * optional callbacks may be needed. However, the values in "internal data" 38 * are overwritten by register function. 39 */ 40 struct extcon_dev { 41 /* Optional user initializing data */ 42 const char *name; 43 const unsigned int *supported_cable; 44 const u32 *mutually_exclusive; 45 46 /* Internal data. Please do not set. */ 47 struct device dev; 48 struct raw_notifier_head nh_all; 49 struct raw_notifier_head *nh; 50 struct list_head entry; 51 int max_supported; 52 spinlock_t lock; /* could be called by irq handler */ 53 u32 state; 54 55 /* /sys/class/extcon/.../cable.n/... */ 56 struct device_type extcon_dev_type; 57 struct extcon_cable *cables; 58 59 /* /sys/class/extcon/.../mutually_exclusive/... */ 60 struct attribute_group attr_g_muex; 61 struct attribute **attrs_muex; 62 struct device_attribute *d_attrs_muex; 63 }; 64 65 #endif /* __LINUX_EXTCON_INTERNAL_H__ */ 66