aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorColin Cross <ccross@android.com>2011-06-24 15:58:51 -0700
committerPraneeth Bajjuri <praneeth@ti.com>2011-09-20 16:51:42 -0700
commitc66e94c705a6ca4c6eff495d1ac7e64b1a2afaaa (patch)
treebd0e019c3eae2a55f59a5b678027d5c11c5f6585 /include
parent2732686f5a4c8bd83c27d1e2f9e3994bbb6ceeb1 (diff)
downloadlinux-linaro-c66e94c705a6ca4c6eff495d1ac7e64b1a2afaaa.tar.gz
USB: otg: add otg id notifier utiltiies
Add a otg_id notifier to allow multiple drivers to cooperate to determine the type of cable connected to a USB connector without requiring direct calls between the drivers. Change-Id: Ic5675f1a89daf85b17336765de24e4bdb6df6348 Signed-off-by: Colin Cross <ccross@android.com>
Diffstat (limited to 'include')
-rw-r--r--include/linux/usb/otg_id.h50
1 files changed, 50 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..b686ab06795
--- /dev/null
+++ b/include/linux/usb/otg_id.h
@@ -0,0 +1,50 @@
+/*
+ * Copyright (C) 2011 Google, Inc.
+ *
+ * Author:
+ * Colin Cross <ccross@android.com>
+ *
+ * This software is licensed under the terms of the GNU General Public
+ * License version 2, as published by the Free Software Foundation, and
+ * may be copied, distributed, and modified under those terms.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ */
+
+#ifndef __LINUX_USB_OTG_ID_H
+#define __LINUX_USB_OTG_ID_H
+
+#include <linux/notifier.h>
+#include <linux/plist.h>
+
+/**
+ * otg_id_notifier_block
+ *
+ * @priority: Order the notifications will be called in. Higher numbers
+ * get called first.
+ * @detect: Called during otg_id_notify. Return OTG_ID_HANDLED if the USB cable
+ * has been identified
+ * @cancel: Called after detect has returned OTG_ID_HANDLED to ask it to
+ * release detection resources to allow a new identification to occur.
+ */
+
+struct otg_id_notifier_block {
+ int priority;
+ int (*detect)(struct otg_id_notifier_block *otg_id_nb);
+ void (*cancel)(struct otg_id_notifier_block *otg_id_nb);
+ struct plist_node p;
+};
+
+#define OTG_ID_HANDLED 1
+#define OTG_ID_UNHANDLED 0
+
+int otg_id_register_notifier(struct otg_id_notifier_block *otg_id_nb);
+void otg_id_unregister_notifier(struct otg_id_notifier_block *otg_id_nb);
+
+void otg_id_notify(void);
+
+#endif /* __LINUX_USB_OTG_ID_H */