Tim Zimmermann | 6a834b7 | 2020-09-03 09:11:59 +0200 | [diff] [blame] | 1 | /* |
| 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 | |
| 14 | enum 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 | |
| 26 | enum host_uevent_type { |
| 27 | NOTIFY_UNKNOWN_STATE, |
| 28 | NOTIFY_HOST_STATE, |
| 29 | NOTIFY_POWER_STATE, |
| 30 | }; |
| 31 | |
| 32 | enum otg_hostnotify_mode { |
| 33 | NOTIFY_NONE_MODE, |
| 34 | NOTIFY_HOST_MODE, |
| 35 | NOTIFY_PERIPHERAL_MODE, |
| 36 | NOTIFY_TEST_MODE, |
| 37 | }; |
| 38 | |
| 39 | enum booster_power { |
| 40 | NOTIFY_POWER_OFF, |
| 41 | NOTIFY_POWER_ON, |
| 42 | }; |
| 43 | |
| 44 | enum set_command { |
| 45 | NOTIFY_SET_OFF, |
| 46 | NOTIFY_SET_ON, |
| 47 | }; |
| 48 | |
| 49 | struct 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 |
| 64 | extern int host_state_notify(struct host_notify_dev *ndev, int state); |
| 65 | extern int host_notify_dev_register(struct host_notify_dev *ndev); |
| 66 | extern void host_notify_dev_unregister(struct host_notify_dev *ndev); |
| 67 | #else |
| 68 | static inline int host_state_notify(struct host_notify_dev *ndev, int state) |
| 69 | {return 0; } |
| 70 | static inline int host_notify_dev_register(struct host_notify_dev *ndev) |
| 71 | {return 0; } |
| 72 | static inline void host_notify_dev_unregister(struct host_notify_dev *ndev) {} |
| 73 | #endif |
| 74 | |
| 75 | #endif /* __LINUX_HOST_NOTIFY_H__ */ |