4 * Copyright (C) 2011-2013 Samsung, Inc.
5 * Author: Dongrak Shin <dongrak.shin@samsung.com>
9 #ifndef __LINUX_USB_NOTIFY_H__
10 #define __LINUX_USB_NOTIFY_H__
12 #include <linux/notifier.h>
13 #include <linux/host_notify.h>
15 enum otg_notify_events {
20 NOTIFY_EVENT_SMARTDOCK_TA,
21 NOTIFY_EVENT_SMARTDOCK_USB,
22 NOTIFY_EVENT_AUDIODOCK,
24 NOTIFY_EVENT_LANHUB_TA,
26 NOTIFY_EVENT_DRIVE_VBUS,
27 NOTIFY_EVENT_OVERCURRENT,
28 NOTIFY_EVENT_SMSC_OVC,
29 NOTIFY_EVENT_SMTD_EXT_CURRENT,
30 NOTIFY_EVENT_MMD_EXT_CURRENT,
31 NOTIFY_EVENT_VBUSPOWER,
34 enum otg_notify_evt_type {
35 NOTIFY_EVENT_EXTRA = (1 << 0),
36 NOTIFY_EVENT_STATE = (1 << 1),
37 NOTIFY_EVENT_DELAY = (1 << 2),
40 enum otg_notify_gpio {
45 enum ovc_check_value {
52 struct atomic_notifier_head otg_notifier;
53 struct blocking_notifier_head extra_notifier;
58 int smsc_ovc_poll_sec;
60 int booting_delay_sec;
61 const char *muic_name;
62 int (*pre_gpio) (int gpio, int use);
63 int (*post_gpio) (int gpio, int use);
64 int (*vbus_drive) (bool);
65 int (*set_host) (bool);
66 int (*set_peripheral)(bool);
67 int (*set_charger)(bool);
68 int (*post_vbus_detect)(bool);
69 int (*set_lanhubta)(int);
70 int (*set_battcall)(int, int);
76 int (*booster) (bool);
79 #ifdef CONFIG_USB_NOTIFY_LAYER
80 extern void send_otg_notify(struct otg_notify *n,
81 unsigned long event, int enable);
82 extern struct otg_booster *find_get_booster(void);
83 extern int register_booster(struct otg_booster *b);
84 extern int register_ovc_func(int (*check_state)(void *), void *data);
85 extern int get_usb_mode(void);
86 extern unsigned long get_cable_type(void);
87 extern void *get_notify_data(struct otg_notify *n);
88 extern void set_notify_data(struct otg_notify *n, void *data);
89 extern struct otg_notify *get_otg_notify(void);
90 extern int set_otg_notify(struct otg_notify *n);
91 extern void put_otg_notify(struct otg_notify *n);
93 static inline void send_otg_notify(struct otg_notify *n,
94 unsigned long event, int enable) { }
95 static inline struct otg_booster *find_get_booster(void) {return NULL; }
96 static inline int register_booster(struct otg_booster *b) {return 0; }
97 static inline int register_ovc_func
98 (int (*check_state)(void *), void *data) {return 0; }
99 static inline int get_usb_mode(void) {return 0; }
100 static inline unsigned long get_cable_type(void) {return 0; }
101 static inline void *get_notify_data(struct otg_notify *n) {return NULL; }
102 static inline void set_notify_data(struct otg_notify *n, void *data) {}
103 static inline struct otg_notify *get_otg_notify(void) {return NULL; }
104 static inline int set_otg_notify(struct otg_notify *n) {return 0; }
105 static inline void put_otg_notify(struct otg_notify *n) {}
108 #endif /* __LINUX_USB_NOTIFY_H__ */