You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
153 lines
3.0 KiB
153 lines
3.0 KiB
#if defined(CONFIG_USB_NOTIFY_LAYER_V34)
|
|
/* SPDX-License-Identifier: GPL-2.0 */
|
|
/*
|
|
* Host notify class driver
|
|
*
|
|
* Copyright (C) 2019 Samsung, Inc.
|
|
* Author: Dongrak Shin <dongrak.shin@samsung.com>
|
|
*
|
|
*/
|
|
|
|
/* usb notify layer v3.4 */
|
|
|
|
#ifndef __LINUX_HOST_NOTIFY_H__
|
|
#define __LINUX_HOST_NOTIFY_H__
|
|
|
|
enum host_uevent_state {
|
|
NOTIFY_HOST_NONE,
|
|
NOTIFY_HOST_ADD,
|
|
NOTIFY_HOST_REMOVE,
|
|
NOTIFY_HOST_OVERCURRENT,
|
|
NOTIFY_HOST_LOWBATT,
|
|
NOTIFY_HOST_BLOCK,
|
|
NOTIFY_HOST_UNKNOWN,
|
|
NOTIFY_HOST_SOURCE,
|
|
NOTIFY_HOST_SINK,
|
|
};
|
|
|
|
enum host_uevent_type {
|
|
NOTIFY_UNKNOWN_STATE,
|
|
NOTIFY_HOST_STATE,
|
|
NOTIFY_POWER_STATE,
|
|
};
|
|
|
|
enum otg_hostnotify_mode {
|
|
NOTIFY_NONE_MODE,
|
|
NOTIFY_HOST_MODE,
|
|
NOTIFY_PERIPHERAL_MODE,
|
|
NOTIFY_TEST_MODE,
|
|
};
|
|
|
|
enum booster_power {
|
|
NOTIFY_POWER_OFF,
|
|
NOTIFY_POWER_ON,
|
|
};
|
|
|
|
enum set_command {
|
|
NOTIFY_SET_OFF,
|
|
NOTIFY_SET_ON,
|
|
};
|
|
|
|
struct host_notify_dev {
|
|
const char *name;
|
|
struct device *dev;
|
|
int index;
|
|
int host_state;
|
|
int host_change;
|
|
int power_state;
|
|
int power_change;
|
|
int mode;
|
|
int booster;
|
|
int (*set_mode)(bool on);
|
|
int (*set_booster)(bool on);
|
|
};
|
|
|
|
#ifdef CONFIG_USB_HOST_NOTIFY
|
|
extern int host_state_notify(struct host_notify_dev *ndev, int state);
|
|
extern int host_notify_dev_register(struct host_notify_dev *ndev);
|
|
extern void host_notify_dev_unregister(struct host_notify_dev *ndev);
|
|
#else
|
|
static inline int host_state_notify(struct host_notify_dev *ndev, int state)
|
|
{
|
|
return 0;
|
|
}
|
|
static inline int host_notify_dev_register(struct host_notify_dev *ndev)
|
|
{
|
|
return 0;
|
|
}
|
|
static inline void host_notify_dev_unregister(struct host_notify_dev *ndev) {}
|
|
#endif
|
|
|
|
#endif /* __LINUX_HOST_NOTIFY_H__ */
|
|
#else
|
|
/*
|
|
* Host notify class driver
|
|
*
|
|
* Copyright (C) 2011-2017 Samsung, Inc.
|
|
* Author: Dongrak Shin <dongrak.shin@samsung.com>
|
|
*
|
|
*/
|
|
|
|
/* usb notify layer v3.2 */
|
|
|
|
#ifndef __LINUX_HOST_NOTIFY_H__
|
|
#define __LINUX_HOST_NOTIFY_H__
|
|
|
|
enum host_uevent_state {
|
|
NOTIFY_HOST_NONE,
|
|
NOTIFY_HOST_ADD,
|
|
NOTIFY_HOST_REMOVE,
|
|
NOTIFY_HOST_OVERCURRENT,
|
|
NOTIFY_HOST_LOWBATT,
|
|
NOTIFY_HOST_BLOCK,
|
|
NOTIFY_HOST_UNKNOWN,
|
|
};
|
|
|
|
enum otg_hostnotify_mode {
|
|
NOTIFY_NONE_MODE,
|
|
NOTIFY_HOST_MODE,
|
|
NOTIFY_PERIPHERAL_MODE,
|
|
NOTIFY_TEST_MODE,
|
|
};
|
|
|
|
enum booster_power {
|
|
NOTIFY_POWER_OFF,
|
|
NOTIFY_POWER_ON,
|
|
};
|
|
|
|
enum set_command {
|
|
NOTIFY_SET_OFF,
|
|
NOTIFY_SET_ON,
|
|
};
|
|
|
|
struct host_notify_dev {
|
|
const char *name;
|
|
struct device *dev;
|
|
int index;
|
|
int state;
|
|
int mode;
|
|
int booster;
|
|
int (*set_mode)(bool);
|
|
int (*set_booster)(bool);
|
|
};
|
|
|
|
#ifdef CONFIG_USB_HOST_NOTIFY
|
|
extern int host_state_notify(struct host_notify_dev *ndev, int state);
|
|
extern int host_notify_dev_register(struct host_notify_dev *ndev);
|
|
extern void host_notify_dev_unregister(struct host_notify_dev *ndev);
|
|
#else
|
|
static inline int host_state_notify(struct host_notify_dev *ndev, int state)
|
|
{
|
|
return 0;
|
|
}
|
|
static inline int host_notify_dev_register(struct host_notify_dev *ndev)
|
|
{
|
|
return 0;
|
|
}
|
|
static inline void host_notify_dev_unregister(struct host_notify_dev *ndev)
|
|
{
|
|
}
|
|
#endif
|
|
|
|
#endif /* __LINUX_HOST_NOTIFY_H__ */
|
|
#endif /* CONFIG_USB_NOTIFY_LAYER_V34 */
|
|
|