c05564c4d8
Android 13
358 lines
8.8 KiB
C
Executable file
358 lines
8.8 KiB
C
Executable file
/* SPDX-License-Identifier: GPL-2.0 */
|
|
/*
|
|
* Copyright (C) 2016-2022 Samsung Electronics Co. Ltd.
|
|
*
|
|
* This program is free software; you can redistribute it and/or modify
|
|
* it under the terms of the GNU General Public License as published by
|
|
* the Free Software Foundation; either version 2 of the License, or
|
|
* (at your option) any later version.
|
|
*/
|
|
|
|
/* usb notify layer v3.7 */
|
|
|
|
#ifndef __LINUX_USBLOG_PROC_NOTIFY_H__
|
|
#define __LINUX_USBLOG_PROC_NOTIFY_H__
|
|
|
|
#define NOTIFY_FOREACH_STATE(S) \
|
|
S(NOTIFY_UNDEFINED_STATE), \
|
|
S(NOTIFY_INVALID_STATE), \
|
|
S(NOTIFY_TOGGLING), \
|
|
S(NOTIFY_SRC_UNATTACHED), \
|
|
S(NOTIFY_SRC_ATTACH_WAIT), \
|
|
S(NOTIFY_SRC_ATTACHED), \
|
|
S(NOTIFY_SRC_STARTUP), \
|
|
S(NOTIFY_SRC_SEND_CAPABILITIES), \
|
|
S(NOTIFY_SRC_SEND_CAPABILITIES_TIMEOUT), \
|
|
S(NOTIFY_SRC_NEGOTIATE_CAPABILITIES), \
|
|
S(NOTIFY_SRC_TRANSITION_SUPPLY), \
|
|
S(NOTIFY_SRC_READY), \
|
|
S(NOTIFY_SRC_WAIT_NEW_CAPABILITIES), \
|
|
\
|
|
S(NOTIFY_SNK_UNATTACHED), \
|
|
S(NOTIFY_SNK_ATTACH_WAIT), \
|
|
S(NOTIFY_SNK_DEBOUNCED), \
|
|
S(NOTIFY_SNK_ATTACHED), \
|
|
S(NOTIFY_SNK_STARTUP), \
|
|
S(NOTIFY_SNK_DISCOVERY), \
|
|
S(NOTIFY_SNK_DISCOVERY_DEBOUNCE), \
|
|
S(NOTIFY_SNK_DISCOVERY_DEBOUNCE_DONE), \
|
|
S(NOTIFY_SNK_WAIT_CAPABILITIES), \
|
|
S(NOTIFY_SNK_NEGOTIATE_CAPABILITIES), \
|
|
S(NOTIFY_SNK_NEGOTIATE_PPS_CAPABILITIES), \
|
|
S(NOTIFY_SNK_TRANSITION_SINK), \
|
|
S(NOTIFY_SNK_TRANSITION_SINK_VBUS), \
|
|
S(NOTIFY_SNK_READY), \
|
|
\
|
|
S(NOTIFY_ACC_UNATTACHED), \
|
|
S(NOTIFY_DEBUG_ACC_ATTACHED), \
|
|
S(NOTIFY_AUDIO_ACC_ATTACHED), \
|
|
S(NOTIFY_AUDIO_ACC_DEBOUNCE), \
|
|
\
|
|
S(NOTIFY_HARD_RESET_SEND), \
|
|
S(NOTIFY_HARD_RESET_START), \
|
|
S(NOTIFY_SRC_HARD_RESET_VBUS_OFF), \
|
|
S(NOTIFY_SRC_HARD_RESET_VBUS_ON), \
|
|
S(NOTIFY_SNK_HARD_RESET_SINK_OFF), \
|
|
S(NOTIFY_SNK_HARD_RESET_WAIT_VBUS), \
|
|
S(NOTIFY_SNK_HARD_RESET_SINK_ON), \
|
|
\
|
|
S(NOTIFY_SOFT_RESET), \
|
|
S(NOTIFY_SOFT_RESET_SEND), \
|
|
\
|
|
S(NOTIFY_DR_SWAP_ACCEPT), \
|
|
S(NOTIFY_DR_SWAP_SEND), \
|
|
S(NOTIFY_DR_SWAP_SEND_TIMEOUT), \
|
|
S(NOTIFY_DR_SWAP_CANCEL), \
|
|
S(NOTIFY_DR_SWAP_CHANGE_DR), \
|
|
\
|
|
S(NOTIFY_PR_SWAP_ACCEPT), \
|
|
S(NOTIFY_PR_SWAP_SEND), \
|
|
S(NOTIFY_PR_SWAP_SEND_TIMEOUT), \
|
|
S(NOTIFY_PR_SWAP_CANCEL), \
|
|
S(NOTIFY_PR_SWAP_START), \
|
|
S(NOTIFY_PR_SWAP_SRC_SNK_TRANSITION_OFF), \
|
|
S(NOTIFY_PR_SWAP_SRC_SNK_SOURCE_OFF), \
|
|
S(NOTIFY_PR_SWAP_SRC_SNK_SOURCE_OFF_CC_DEBOUNCED), \
|
|
S(NOTIFY_PR_SWAP_SRC_SNK_SINK_ON), \
|
|
S(NOTIFY_PR_SWAP_SNK_SRC_SINK_OFF), \
|
|
S(NOTIFY_PR_SWAP_SNK_SRC_SOURCE_ON), \
|
|
S(NOTIFY_PR_SWAP_SNK_SRC_SOURCE_ON_VBUS_RAMPED_UP), \
|
|
\
|
|
S(NOTIFY_VCONN_SWAP_ACCEPT), \
|
|
S(NOTIFY_VCONN_SWAP_SEND), \
|
|
S(NOTIFY_VCONN_SWAP_SEND_TIMEOUT), \
|
|
S(NOTIFY_VCONN_SWAP_CANCEL), \
|
|
S(NOTIFY_VCONN_SWAP_START), \
|
|
S(NOTIFY_VCONN_SWAP_WAIT_FOR_VCONN), \
|
|
S(NOTIFY_VCONN_SWAP_TURN_ON_VCONN), \
|
|
S(NOTIFY_VCONN_SWAP_TURN_OFF_VCONN), \
|
|
\
|
|
S(NOTIFY_SNK_TRY), \
|
|
S(NOTIFY_SNK_TRY_WAIT), \
|
|
S(NOTIFY_SNK_TRY_WAIT_DEBOUNCE), \
|
|
S(NOTIFY_SNK_TRY_WAIT_DEBOUNCE_CHECK_VBUS), \
|
|
S(NOTIFY_SRC_TRYWAIT), \
|
|
S(NOTIFY_SRC_TRYWAIT_DEBOUNCE), \
|
|
S(NOTIFY_SRC_TRYWAIT_UNATTACHED), \
|
|
\
|
|
S(NOTIFY_SRC_TRY), \
|
|
S(NOTIFY_SRC_TRY_WAIT), \
|
|
S(NOTIFY_SRC_TRY_DEBOUNCE), \
|
|
S(NOTIFY_SNK_TRYWAIT), \
|
|
S(NOTIFY_SNK_TRYWAIT_DEBOUNCE), \
|
|
S(NOTIFY_SNK_TRYWAIT_VBUS), \
|
|
S(NOTIFY_BIST_RX), \
|
|
\
|
|
S(NOTIFY_GET_STATUS_SEND), \
|
|
S(NOTIFY_GET_STATUS_SEND_TIMEOUT), \
|
|
S(NOTIFY_GET_PPS_STATUS_SEND), \
|
|
S(NOTIFY_GET_PPS_STATUS_SEND_TIMEOUT), \
|
|
\
|
|
S(NOTIFY_ERROR_RECOVERY), \
|
|
S(NOTIFY_PORT_RESET), \
|
|
S(NOTIFY_PORT_RESET_WAIT_OFF), \
|
|
\
|
|
S(NOTIFY_SNK_TRY_WAIT_PE), \
|
|
S(NOTIFY_SRC_TRY_WAIT_PE), \
|
|
S(NOTIFY_DEBUG_ACC_SNK_ATTACHED), \
|
|
S(NOTIFY_CUSTOM_SRC_ATTACHED), \
|
|
S(NOTIFY_NORP_SRC_ATTACHED), \
|
|
S(NOTIFY_ROLE_SWAP), \
|
|
S(NOTIFY_WATER_PROTECTION_WAIT), \
|
|
S(NOTIFY_WATER_PROTECTION), \
|
|
S(NOTIFY_UNATTACH_WAIT_PE)
|
|
|
|
|
|
#define NOTIFY_GENERATE_ENUM(e) e
|
|
#define NOTIFY_GENERATE_STRING(s) #s
|
|
|
|
enum usblog_tcpm_state {
|
|
NOTIFY_FOREACH_STATE(NOTIFY_GENERATE_ENUM)
|
|
};
|
|
|
|
enum usblog_type {
|
|
NOTIFY_FUNCSTATE,
|
|
NOTIFY_TCPMSTATE,
|
|
NOTIFY_CCSTATE,
|
|
NOTIFY_ALTERNATEMODE,
|
|
NOTIFY_CCIC_EVENT,
|
|
NOTIFY_MANAGER,
|
|
NOTIFY_USBMODE,
|
|
NOTIFY_USBMODE_EXTRA,
|
|
NOTIFY_USBSTATE,
|
|
NOTIFY_EVENT,
|
|
NOTIFY_PORT_CONNECT,
|
|
NOTIFY_PORT_DISCONNECT,
|
|
NOTIFY_PORT_CLASS,
|
|
NOTIFY_PORT_CLASS_BLOCK,
|
|
NOTIFY_PCM_PLAYBACK,
|
|
NOTIFY_PCM_CAPTURE,
|
|
NOTIFY_EXTRA,
|
|
};
|
|
|
|
enum usblog_state {
|
|
NOTIFY_CONFIGURED = 1,
|
|
NOTIFY_CONNECTED,
|
|
NOTIFY_DISCONNECTED,
|
|
NOTIFY_RESET,
|
|
NOTIFY_RESET_FULL,
|
|
NOTIFY_RESET_HIGH,
|
|
NOTIFY_RESET_SUPER,
|
|
NOTIFY_ACCSTART,
|
|
NOTIFY_PULLUP,
|
|
NOTIFY_PULLUP_ENABLE,
|
|
NOTIFY_PULLUP_EN_SUCCESS,
|
|
NOTIFY_PULLUP_EN_FAIL,
|
|
NOTIFY_PULLUP_DISABLE,
|
|
NOTIFY_PULLUP_DIS_SUCCESS,
|
|
NOTIFY_PULLUP_DIS_FAIL,
|
|
NOTIFY_VBUS_SESSION,
|
|
NOTIFY_VBUS_SESSION_ENABLE,
|
|
NOTIFY_VBUS_EN_SUCCESS,
|
|
NOTIFY_VBUS_EN_FAIL,
|
|
NOTIFY_VBUS_SESSION_DISABLE,
|
|
NOTIFY_VBUS_DIS_SUCCESS,
|
|
NOTIFY_VBUS_DIS_FAIL,
|
|
NOTIFY_HIGH,
|
|
NOTIFY_SUPER,
|
|
NOTIFY_GET_DES,
|
|
NOTIFY_SET_CON,
|
|
NOTIFY_CONNDONE_SSP,
|
|
NOTIFY_CONNDONE_SS,
|
|
NOTIFY_CONNDONE_HS,
|
|
NOTIFY_CONNDONE_FS,
|
|
NOTIFY_CONNDONE_LS,
|
|
};
|
|
|
|
enum usblog_status {
|
|
NOTIFY_DETACH = 0,
|
|
NOTIFY_ATTACH_DFP,
|
|
NOTIFY_ATTACH_UFP,
|
|
NOTIFY_ATTACH_DRP,
|
|
};
|
|
|
|
/*
|
|
* You should refer "linux/usb/typec/common/pdic_notifier.h"
|
|
* ccic_device, ccic_id may be different at each branch
|
|
*/
|
|
enum ccic_device {
|
|
NOTIFY_DEV_INITIAL = 0,
|
|
NOTIFY_DEV_USB,
|
|
NOTIFY_DEV_BATTERY,
|
|
NOTIFY_DEV_PDIC,
|
|
NOTIFY_DEV_MUIC,
|
|
NOTIFY_DEV_CCIC,
|
|
NOTIFY_DEV_MANAGER,
|
|
NOTIFY_DEV_DP,
|
|
NOTIFY_DEV_USB_DP,
|
|
NOTIFY_DEV_SUB_BATTERY,
|
|
NOTIFY_DEV_SECOND_MUIC,
|
|
NOTIFY_DEV_DEDICATED_MUIC,
|
|
NOTIFY_DEV_ALL,
|
|
};
|
|
|
|
enum ccic_id {
|
|
NOTIFY_ID_INITIAL = 0,
|
|
NOTIFY_ID_ATTACH,
|
|
NOTIFY_ID_RID,
|
|
NOTIFY_ID_USB,
|
|
NOTIFY_ID_POWER_STATUS,
|
|
NOTIFY_ID_WATER,
|
|
NOTIFY_ID_VCONN,
|
|
NOTIFY_ID_OTG,
|
|
NOTIFY_ID_TA,
|
|
NOTIFY_ID_DP_CONNECT,
|
|
NOTIFY_ID_DP_HPD,
|
|
NOTIFY_ID_DP_LINK_CONF,
|
|
NOTIFY_ID_USB_DP,
|
|
NOTIFY_ID_ROLE_SWAP,
|
|
NOTIFY_ID_FAC,
|
|
NOTIFY_ID_CC_PIN_STATUS,
|
|
NOTIFY_ID_WATER_CABLE,
|
|
NOTIFY_ID_POFF_WATER,
|
|
NOTIFY_ID_DEVICE_INFO,
|
|
NOTIFY_ID_SVID_INFO,
|
|
NOTIFY_ID_CLEAR_INFO,
|
|
};
|
|
|
|
enum ccic_rid {
|
|
NOTIFY_RID_UNDEFINED = 0,
|
|
#if defined(CONFIG_USB_CCIC_NOTIFIER_USING_QC)
|
|
NOTIFY_RID_GND,
|
|
NOTIFY_RID_056K,
|
|
#else
|
|
NOTIFY_RID_000K,
|
|
NOTIFY_RID_001K,
|
|
#endif
|
|
NOTIFY_RID_255K,
|
|
NOTIFY_RID_301K,
|
|
NOTIFY_RID_523K,
|
|
NOTIFY_RID_619K,
|
|
NOTIFY_RID_OPEN,
|
|
};
|
|
|
|
enum ccic_con {
|
|
NOTIFY_CON_DETACH = 0,
|
|
NOTIFY_CON_ATTACH,
|
|
};
|
|
|
|
enum ccic_rprd {
|
|
NOTIFY_RD = 0,
|
|
NOTIFY_RP,
|
|
};
|
|
|
|
enum ccic_rpstatus {
|
|
NOTIFY_RP_NONE = 0,
|
|
NOTIFY_RP_56K, /* 80uA */
|
|
NOTIFY_RP_22K, /* 180uA */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
|
NOTIFY_EXTRA_CCOPEN_REQ_SET,
|
|
NOTIFY_EXTRA_CCOPEN_REQ_CLEAR,
|
|
NOTIFY_EXTRA_USB_ANALOGAUDIO,
|
|
NOTIFY_EXTRA_USBHOST_OVERCURRENT,
|
|
NOTIFY_EXTRA_ROOTHUB_SUSPEND_FAIL,
|
|
NOTIFY_EXTRA_PORT_SUSPEND_FAIL,
|
|
NOTIFY_EXTRA_PORT_SUSPEND_WAKEUP_FAIL,
|
|
NOTIFY_EXTRA_PORT_SUSPEND_LTM_FAIL,
|
|
NOTIFY_EXTRA_VIB_FW_LOAD_SUCCESS,
|
|
};
|
|
|
|
#define ALTERNATE_MODE_NOT_READY (1 << 0)
|
|
#define ALTERNATE_MODE_READY (1 << 1)
|
|
#define ALTERNATE_MODE_STOP (1 << 2)
|
|
#define ALTERNATE_MODE_START (1 << 3)
|
|
#define ALTERNATE_MODE_RESET (1 << 4)
|
|
|
|
#ifdef CONFIG_USB_NOTIFY_PROC_LOG
|
|
extern void store_usblog_notify(int type, void *param1, void *param2);
|
|
extern void store_ccic_version(unsigned char *hw, unsigned char *sw_main,
|
|
unsigned char *sw_boot);
|
|
extern unsigned long long show_ccic_version(void);
|
|
extern void store_ccic_bin_version(const unsigned char *sw_main,
|
|
const unsigned char *sw_boot);
|
|
extern int register_usblog_proc(void);
|
|
extern void unregister_usblog_proc(void);
|
|
#else
|
|
static inline void store_usblog_notify(int type, void *param1, void *param2) {}
|
|
static inline void store_ccic_version(unsigned char *hw, unsigned char *sw_main,
|
|
unsigned char *sw_boot) {}
|
|
static inline unsigned long long show_ccic_version(void) {return 0; }
|
|
static inline void store_ccic_bin_version(const unsigned char *sw_main,
|
|
const unsigned char *sw_boot) {}
|
|
static inline int register_usblog_proc(void)
|
|
{return 0; }
|
|
static inline void unregister_usblog_proc(void) {}
|
|
#endif
|
|
#endif
|
|
|