summaryrefslogtreecommitdiffstats
path: root/include/linux/extcon.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/linux/extcon.h')
-rw-r--r--include/linux/extcon.h109
1 files changed, 5 insertions, 104 deletions
diff --git a/include/linux/extcon.h b/include/linux/extcon.h
index 744d60ca80c3..6d94e82c8ad9 100644
--- a/include/linux/extcon.h
+++ b/include/linux/extcon.h
@@ -1,5 +1,6 @@
1/* 1/*
2 * External Connector (extcon) framework 2 * External Connector (extcon) framework
3 * - linux/include/linux/extcon.h for extcon consumer device driver.
3 * 4 *
4 * Copyright (C) 2015 Samsung Electronics 5 * Copyright (C) 2015 Samsung Electronics
5 * Author: Chanwoo Choi <cw00.choi@samsung.com> 6 * Author: Chanwoo Choi <cw00.choi@samsung.com>
@@ -170,61 +171,29 @@ union extcon_property_value {
170 int intval; /* type : integer (intval) */ 171 int intval; /* type : integer (intval) */
171}; 172};
172 173
173struct extcon_cable;
174struct extcon_dev; 174struct extcon_dev;
175 175
176#if IS_ENABLED(CONFIG_EXTCON) 176#if IS_ENABLED(CONFIG_EXTCON)
177
178/* Following APIs register/unregister the extcon device. */
179extern int extcon_dev_register(struct extcon_dev *edev);
180extern void extcon_dev_unregister(struct extcon_dev *edev);
181extern int devm_extcon_dev_register(struct device *dev,
182 struct extcon_dev *edev);
183extern void devm_extcon_dev_unregister(struct device *dev,
184 struct extcon_dev *edev);
185
186/* Following APIs allocate/free the memory of the extcon device. */
187extern struct extcon_dev *extcon_dev_allocate(const unsigned int *cable);
188extern void extcon_dev_free(struct extcon_dev *edev);
189extern struct extcon_dev *devm_extcon_dev_allocate(struct device *dev,
190 const unsigned int *cable);
191extern void devm_extcon_dev_free(struct device *dev, struct extcon_dev *edev);
192
193/* Synchronize the state and property value for each external connector. */
194extern int extcon_sync(struct extcon_dev *edev, unsigned int id);
195
196/* 177/*
197 * Following APIs get/set the connected state of each external connector. 178 * Following APIs get the connected state of each external connector.
198 * The 'id' argument indicates the defined external connector. 179 * The 'id' argument indicates the defined external connector.
199 */ 180 */
200extern int extcon_get_state(struct extcon_dev *edev, unsigned int id); 181extern int extcon_get_state(struct extcon_dev *edev, unsigned int id);
201extern int extcon_set_state(struct extcon_dev *edev, unsigned int id,
202 bool state);
203extern int extcon_set_state_sync(struct extcon_dev *edev, unsigned int id,
204 bool state);
205 182
206/* 183/*
207 * Following APIs get/set the property of each external connector. 184 * Following APIs get the property of each external connector.
208 * The 'id' argument indicates the defined external connector 185 * The 'id' argument indicates the defined external connector
209 * and the 'prop' indicates the extcon property. 186 * and the 'prop' indicates the extcon property.
210 * 187 *
211 * And extcon_get/set_property_capability() set the capability of the property 188 * And extcon_get_property_capability() get the capability of the property
212 * for each external connector. They are used to set the capability of the 189 * for each external connector. They are used to get the capability of the
213 * property of each external connector based on the id and property. 190 * property of each external connector based on the id and property.
214 */ 191 */
215extern int extcon_get_property(struct extcon_dev *edev, unsigned int id, 192extern int extcon_get_property(struct extcon_dev *edev, unsigned int id,
216 unsigned int prop, 193 unsigned int prop,
217 union extcon_property_value *prop_val); 194 union extcon_property_value *prop_val);
218extern int extcon_set_property(struct extcon_dev *edev, unsigned int id,
219 unsigned int prop,
220 union extcon_property_value prop_val);
221extern int extcon_set_property_sync(struct extcon_dev *edev, unsigned int id,
222 unsigned int prop,
223 union extcon_property_value prop_val);
224extern int extcon_get_property_capability(struct extcon_dev *edev, 195extern int extcon_get_property_capability(struct extcon_dev *edev,
225 unsigned int id, unsigned int prop); 196 unsigned int id, unsigned int prop);
226extern int extcon_set_property_capability(struct extcon_dev *edev,
227 unsigned int id, unsigned int prop);
228 197
229/* 198/*
230 * Following APIs register the notifier block in order to detect 199 * Following APIs register the notifier block in order to detect
@@ -268,79 +237,17 @@ extern struct extcon_dev *extcon_get_edev_by_phandle(struct device *dev,
268extern const char *extcon_get_edev_name(struct extcon_dev *edev); 237extern const char *extcon_get_edev_name(struct extcon_dev *edev);
269 238
270#else /* CONFIG_EXTCON */ 239#else /* CONFIG_EXTCON */
271static inline int extcon_dev_register(struct extcon_dev *edev)
272{
273 return 0;
274}
275
276static inline void extcon_dev_unregister(struct extcon_dev *edev) { }
277
278static inline int devm_extcon_dev_register(struct device *dev,
279 struct extcon_dev *edev)
280{
281 return -EINVAL;
282}
283
284static inline void devm_extcon_dev_unregister(struct device *dev,
285 struct extcon_dev *edev) { }
286
287static inline struct extcon_dev *extcon_dev_allocate(const unsigned int *cable)
288{
289 return ERR_PTR(-ENOSYS);
290}
291
292static inline void extcon_dev_free(struct extcon_dev *edev) { }
293
294static inline struct extcon_dev *devm_extcon_dev_allocate(struct device *dev,
295 const unsigned int *cable)
296{
297 return ERR_PTR(-ENOSYS);
298}
299
300static inline void devm_extcon_dev_free(struct extcon_dev *edev) { }
301
302
303static inline int extcon_get_state(struct extcon_dev *edev, unsigned int id) 240static inline int extcon_get_state(struct extcon_dev *edev, unsigned int id)
304{ 241{
305 return 0; 242 return 0;
306} 243}
307 244
308static inline int extcon_set_state(struct extcon_dev *edev, unsigned int id,
309 bool state)
310{
311 return 0;
312}
313
314static inline int extcon_set_state_sync(struct extcon_dev *edev, unsigned int id,
315 bool state)
316{
317 return 0;
318}
319
320static inline int extcon_sync(struct extcon_dev *edev, unsigned int id)
321{
322 return 0;
323}
324
325static inline int extcon_get_property(struct extcon_dev *edev, unsigned int id, 245static inline int extcon_get_property(struct extcon_dev *edev, unsigned int id,
326 unsigned int prop, 246 unsigned int prop,
327 union extcon_property_value *prop_val) 247 union extcon_property_value *prop_val)
328{ 248{
329 return 0; 249 return 0;
330} 250}
331static inline int extcon_set_property(struct extcon_dev *edev, unsigned int id,
332 unsigned int prop,
333 union extcon_property_value prop_val)
334{
335 return 0;
336}
337
338static inline int extcon_set_property_sync(struct extcon_dev *edev,
339 unsigned int id, unsigned int prop,
340 union extcon_property_value prop_val)
341{
342 return 0;
343}
344 251
345static inline int extcon_get_property_capability(struct extcon_dev *edev, 252static inline int extcon_get_property_capability(struct extcon_dev *edev,
346 unsigned int id, unsigned int prop) 253 unsigned int id, unsigned int prop)
@@ -348,12 +255,6 @@ static inline int extcon_get_property_capability(struct extcon_dev *edev,
348 return 0; 255 return 0;
349} 256}
350 257
351static inline int extcon_set_property_capability(struct extcon_dev *edev,
352 unsigned int id, unsigned int prop)
353{
354 return 0;
355}
356
357static inline int extcon_register_notifier(struct extcon_dev *edev, 258static inline int extcon_register_notifier(struct extcon_dev *edev,
358 unsigned int id, struct notifier_block *nb) 259 unsigned int id, struct notifier_block *nb)
359{ 260{