blob: b686ab06795728581ad38399dd443de2b0f471d2 [file] [log] [blame]
Colin Crossab246b82011-06-24 15:58:51 -07001/*
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 * @cancel: Called after detect has returned OTG_ID_HANDLED to ask it to
32 * release detection resources to allow a new identification to occur.
33 */
34
35struct otg_id_notifier_block {
36 int priority;
37 int (*detect)(struct otg_id_notifier_block *otg_id_nb);
38 void (*cancel)(struct otg_id_notifier_block *otg_id_nb);
39 struct plist_node p;
40};
41
42#define OTG_ID_HANDLED 1
43#define OTG_ID_UNHANDLED 0
44
45int otg_id_register_notifier(struct otg_id_notifier_block *otg_id_nb);
46void otg_id_unregister_notifier(struct otg_id_notifier_block *otg_id_nb);
47
48void otg_id_notify(void);
49
50#endif /* __LINUX_USB_OTG_ID_H */