diff options
| author | Jonathan Herman <hermanjl@cs.unc.edu> | 2013-01-22 10:38:37 -0500 |
|---|---|---|
| committer | Jonathan Herman <hermanjl@cs.unc.edu> | 2013-01-22 10:38:37 -0500 |
| commit | fcc9d2e5a6c89d22b8b773a64fb4ad21ac318446 (patch) | |
| tree | a57612d1888735a2ec7972891b68c1ac5ec8faea /include/linux/usb/otg_id.h | |
| parent | 8dea78da5cee153b8af9c07a2745f6c55057fe12 (diff) | |
Diffstat (limited to 'include/linux/usb/otg_id.h')
| -rw-r--r-- | include/linux/usb/otg_id.h | 58 |
1 files changed, 58 insertions, 0 deletions
diff --git a/include/linux/usb/otg_id.h b/include/linux/usb/otg_id.h new file mode 100644 index 00000000000..f9f5189a73b --- /dev/null +++ b/include/linux/usb/otg_id.h | |||
| @@ -0,0 +1,58 @@ | |||
| 1 | /* | ||
| 2 | * Copyright (C) 2011 Google, Inc. | ||
| 3 | * | ||
| 4 | * Author: | ||
| 5 | * Colin Cross <ccross@android.com> | ||
| 6 | * | ||
| 7 | * This software is licensed under the terms of the GNU General Public | ||
| 8 | * License version 2, as published by the Free Software Foundation, and | ||
| 9 | * may be copied, distributed, and modified under those terms. | ||
| 10 | * | ||
| 11 | * This program is distributed in the hope that it will be useful, | ||
| 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 14 | * GNU General Public License for more details. | ||
| 15 | * | ||
| 16 | */ | ||
| 17 | |||
| 18 | #ifndef __LINUX_USB_OTG_ID_H | ||
| 19 | #define __LINUX_USB_OTG_ID_H | ||
| 20 | |||
| 21 | #include <linux/notifier.h> | ||
| 22 | #include <linux/plist.h> | ||
| 23 | |||
| 24 | /** | ||
| 25 | * otg_id_notifier_block | ||
| 26 | * | ||
| 27 | * @priority: Order the notifications will be called in. Higher numbers | ||
| 28 | * get called first. | ||
| 29 | * @detect: Called during otg_id_notify. Return OTG_ID_HANDLED if the USB cable | ||
| 30 | * has been identified | ||
| 31 | * @proxy_wait: Called during otg_id_notify if a previous handler returns | ||
| 32 | * OTG_ID_PROXY_WAIT. This should wait on ID change then call otg_id_notify. | ||
| 33 | * This is used when a handler knows what's connected but can't detect | ||
| 34 | * the change itself. | ||
| 35 | * @cancel: Called after detect has returned OTG_ID_HANDLED to ask it to | ||
| 36 | * release detection resources to allow a new identification to occur. | ||
| 37 | */ | ||
| 38 | |||
| 39 | struct otg_id_notifier_block { | ||
| 40 | int priority; | ||
| 41 | int (*detect)(struct otg_id_notifier_block *otg_id_nb); | ||
| 42 | int (*proxy_wait)(struct otg_id_notifier_block *otg_id_nb); | ||
| 43 | void (*cancel)(struct otg_id_notifier_block *otg_id_nb); | ||
| 44 | struct plist_node p; | ||
| 45 | }; | ||
| 46 | |||
| 47 | #define OTG_ID_PROXY_WAIT 2 | ||
| 48 | #define OTG_ID_HANDLED 1 | ||
| 49 | #define OTG_ID_UNHANDLED 0 | ||
| 50 | |||
| 51 | int otg_id_register_notifier(struct otg_id_notifier_block *otg_id_nb); | ||
| 52 | void otg_id_unregister_notifier(struct otg_id_notifier_block *otg_id_nb); | ||
| 53 | |||
| 54 | void otg_id_notify(void); | ||
| 55 | int otg_id_suspend(void); | ||
| 56 | void otg_id_resume(void); | ||
| 57 | |||
| 58 | #endif /* __LINUX_USB_OTG_ID_H */ | ||
