blob: 7ad51fc9ce4b477c0543be84a0c1d262ac8ceee5 [file] [log] [blame]
Tim Zimmermann6a834b72020-09-03 09:11:59 +02001/*
2 * Host notify class driver
3 *
4 * Copyright (C) 2011-2017 Samsung, Inc.
5 * Author: Dongrak Shin <dongrak.shin@samsung.com>
6 *
7 */
8
9 /* usb notify layer v3.3 */
10
11#ifndef __LINUX_HOST_NOTIFY_H__
12#define __LINUX_HOST_NOTIFY_H__
13
14enum host_uevent_state {
15 NOTIFY_HOST_NONE,
16 NOTIFY_HOST_ADD,
17 NOTIFY_HOST_REMOVE,
18 NOTIFY_HOST_OVERCURRENT,
19 NOTIFY_HOST_LOWBATT,
20 NOTIFY_HOST_BLOCK,
21 NOTIFY_HOST_UNKNOWN,
22 NOTIFY_HOST_SOURCE,
23 NOTIFY_HOST_SINK,
24};
25
26enum host_uevent_type {
27 NOTIFY_UNKNOWN_STATE,
28 NOTIFY_HOST_STATE,
29 NOTIFY_POWER_STATE,
30};
31
32enum otg_hostnotify_mode {
33 NOTIFY_NONE_MODE,
34 NOTIFY_HOST_MODE,
35 NOTIFY_PERIPHERAL_MODE,
36 NOTIFY_TEST_MODE,
37};
38
39enum booster_power {
40 NOTIFY_POWER_OFF,
41 NOTIFY_POWER_ON,
42};
43
44enum set_command {
45 NOTIFY_SET_OFF,
46 NOTIFY_SET_ON,
47};
48
49struct host_notify_dev {
50 const char *name;
51 struct device *dev;
52 int index;
53 int host_state;
54 int host_change;
55 int power_state;
56 int power_change;
57 int mode;
58 int booster;
59 int (*set_mode)(bool);
60 int (*set_booster)(bool);
61};
62
63#ifdef CONFIG_USB_HOST_NOTIFY
64extern int host_state_notify(struct host_notify_dev *ndev, int state);
65extern int host_notify_dev_register(struct host_notify_dev *ndev);
66extern void host_notify_dev_unregister(struct host_notify_dev *ndev);
67#else
68static inline int host_state_notify(struct host_notify_dev *ndev, int state)
69 {return 0; }
70static inline int host_notify_dev_register(struct host_notify_dev *ndev)
71 {return 0; }
72static inline void host_notify_dev_unregister(struct host_notify_dev *ndev) {}
73#endif
74
75#endif /* __LINUX_HOST_NOTIFY_H__ */