aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/extcon.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/linux/extcon.h')
-rw-r--r--include/linux/extcon.h71
1 files changed, 14 insertions, 57 deletions
diff --git a/include/linux/extcon.h b/include/linux/extcon.h
index b871c0cb1f02..7010fb01a81a 100644
--- a/include/linux/extcon.h
+++ b/include/linux/extcon.h
@@ -46,7 +46,18 @@
46#define EXTCON_USB 1 46#define EXTCON_USB 1
47#define EXTCON_USB_HOST 2 47#define EXTCON_USB_HOST 2
48 48
49/* Charging external connector */ 49/*
50 * Charging external connector
51 *
52 * When one SDP charger connector was reported, we should also report
53 * the USB connector, which means EXTCON_CHG_USB_SDP should always
54 * appear together with EXTCON_USB. The same as ACA charger connector,
55 * EXTCON_CHG_USB_ACA would normally appear with EXTCON_USB_HOST.
56 *
57 * The EXTCON_CHG_USB_SLOW connector can provide at least 500mA of
58 * current at 5V. The EXTCON_CHG_USB_FAST connector can provide at
59 * least 1A of current at 5V.
60 */
50#define EXTCON_CHG_USB_SDP 5 /* Standard Downstream Port */ 61#define EXTCON_CHG_USB_SDP 5 /* Standard Downstream Port */
51#define EXTCON_CHG_USB_DCP 6 /* Dedicated Charging Port */ 62#define EXTCON_CHG_USB_DCP 6 /* Dedicated Charging Port */
52#define EXTCON_CHG_USB_CDP 7 /* Charging Downstream Port */ 63#define EXTCON_CHG_USB_CDP 7 /* Charging Downstream Port */
@@ -54,6 +65,7 @@
54#define EXTCON_CHG_USB_FAST 9 65#define EXTCON_CHG_USB_FAST 9
55#define EXTCON_CHG_USB_SLOW 10 66#define EXTCON_CHG_USB_SLOW 10
56#define EXTCON_CHG_WPT 11 /* Wireless Power Transfer */ 67#define EXTCON_CHG_WPT 11 /* Wireless Power Transfer */
68#define EXTCON_CHG_USB_PD 12 /* USB Power Delivery */
57 69
58/* Jack external connector */ 70/* Jack external connector */
59#define EXTCON_JACK_MICROPHONE 20 71#define EXTCON_JACK_MICROPHONE 20
@@ -160,62 +172,7 @@ union extcon_property_value {
160}; 172};
161 173
162struct extcon_cable; 174struct extcon_cable;
163 175struct extcon_dev;
164/**
165 * struct extcon_dev - An extcon device represents one external connector.
166 * @name: The name of this extcon device. Parent device name is
167 * used if NULL.
168 * @supported_cable: Array of supported cable names ending with EXTCON_NONE.
169 * If supported_cable is NULL, cable name related APIs
170 * are disabled.
171 * @mutually_exclusive: Array of mutually exclusive set of cables that cannot
172 * be attached simultaneously. The array should be
173 * ending with NULL or be NULL (no mutually exclusive
174 * cables). For example, if it is { 0x7, 0x30, 0}, then,
175 * {0, 1}, {0, 1, 2}, {0, 2}, {1, 2}, or {4, 5} cannot
176 * be attached simulataneously. {0x7, 0} is equivalent to
177 * {0x3, 0x6, 0x5, 0}. If it is {0xFFFFFFFF, 0}, there
178 * can be no simultaneous connections.
179 * @dev: Device of this extcon.
180 * @state: Attach/detach state of this extcon. Do not provide at
181 * register-time.
182 * @nh: Notifier for the state change events from this extcon
183 * @entry: To support list of extcon devices so that users can
184 * search for extcon devices based on the extcon name.
185 * @lock:
186 * @max_supported: Internal value to store the number of cables.
187 * @extcon_dev_type: Device_type struct to provide attribute_groups
188 * customized for each extcon device.
189 * @cables: Sysfs subdirectories. Each represents one cable.
190 *
191 * In most cases, users only need to provide "User initializing data" of
192 * this struct when registering an extcon. In some exceptional cases,
193 * optional callbacks may be needed. However, the values in "internal data"
194 * are overwritten by register function.
195 */
196struct extcon_dev {
197 /* Optional user initializing data */
198 const char *name;
199 const unsigned int *supported_cable;
200 const u32 *mutually_exclusive;
201
202 /* Internal data. Please do not set. */
203 struct device dev;
204 struct raw_notifier_head *nh;
205 struct list_head entry;
206 int max_supported;
207 spinlock_t lock; /* could be called by irq handler */
208 u32 state;
209
210 /* /sys/class/extcon/.../cable.n/... */
211 struct device_type extcon_dev_type;
212 struct extcon_cable *cables;
213
214 /* /sys/class/extcon/.../mutually_exclusive/... */
215 struct attribute_group attr_g_muex;
216 struct attribute **attrs_muex;
217 struct device_attribute *d_attrs_muex;
218};
219 176
220#if IS_ENABLED(CONFIG_EXTCON) 177#if IS_ENABLED(CONFIG_EXTCON)
221 178