mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-10 06:09:23 -04:00
arm/dts: improve rt1715 typec and pd compatible
+ * 2.0.15_G + * (1) undef CONFIG_COMPATIBLE_APPLE_TA + * (2) Fix TEST.PD.PROT.ALL.5 Unrecognized Message (PD2) + * (3) Fix TEST.PD.PROT.ALL3.3 Invalid Manufacturer Info Target + * (4) Fix TEST.PD.PROT.ALL3.4 Invalid Manufacturer Info Ref + * (5) Fix TEST.PD.PROT.SRC.11 Unexpected Message Received in Ready State (PD2) + * (6) Fix TEST.PD.PROT.SRC.13 PR_Swap - GoodCRC not sent in Response to PS_RDY + * (7) Fix TEST.PD.VDM.SRC.2 Invalid Fields - Discover Identity (PD2) + * (8) Revise the usages of PD_TIMER_NO_RESPONSE + * (9) Retry to send Source_Capabilities after PR_Swap + * (10) Fix tcpm_get_remote_power_cap() and __tcpm_inquire_select_source_cap() + * (11) Increase the threshold to enter PE_ERROR_RECOVERY_ONCE from 2 to 4 + * (12) Change wait_event() back to wait_event_interruptible() for not being + * detected as hung tasks this changes come from richtek patch04 Change-Id: Ida06c5af3df73a42ba140a5b5d10b97b739fe3fc Reviewed-on: https://gerrit.mot.com/2057497 SME-Granted: SME Approvals Granted SLTApproved: Slta Waiver Reviewed-by: Huosheng Liao <liaohs@motorola.com> Tested-by: Jira Key Submit-Approved: Jira Key
This commit is contained in:
parent
18114899c1
commit
bb11b88513
22 changed files with 132 additions and 108 deletions
|
|
@ -99,6 +99,8 @@ void pd_dpm_dfp_inform_uvdm(struct pd_port *pd_port, bool ack);
|
|||
|
||||
#endif /* CONFIG_USB_PD_CUSTOM_VDM */
|
||||
|
||||
void pd_dpm_ufp_send_svdm_nak(struct pd_port *pd_port);
|
||||
|
||||
/* ---- DRP : Inform PowerCap ---- */
|
||||
|
||||
void pd_dpm_dr_inform_sink_cap(struct pd_port *pd_port);
|
||||
|
|
|
|||
|
|
@ -363,6 +363,8 @@ enum pd_pe_state {
|
|||
PE_DFP_UVDM_NAKED,
|
||||
#endif/* CONFIG_USB_PD_CUSTOM_VDM */
|
||||
|
||||
PE_UFP_VDM_SEND_NAK,
|
||||
|
||||
/******************* PD30 Common *******************/
|
||||
#ifdef CONFIG_USB_PD_REV30
|
||||
#ifdef CONFIG_USB_PD_REV30_BAT_CAP_REMOTE
|
||||
|
|
@ -842,6 +844,8 @@ void pe_dfp_uvdm_acked_entry(
|
|||
void pe_dfp_uvdm_naked_entry(
|
||||
struct pd_port *pd_port);
|
||||
#endif/* CONFIG_USB_PD_CUSTOM_VDM */
|
||||
void pe_ufp_vdm_send_nak_entry(
|
||||
struct pd_port *pd_port);
|
||||
|
||||
/******************* PD30 Common *******************/
|
||||
#ifdef CONFIG_USB_PD_REV30
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@
|
|||
#define CONFIG_TYPEC_CAP_DBGACC_SNK
|
||||
#define CONFIG_TYPEC_CAP_CUSTOM_SRC
|
||||
#define CONFIG_TYPEC_CAP_NORP_SRC
|
||||
#define CONFIG_COMPATIBLE_APPLE_TA
|
||||
/* #define CONFIG_COMPATIBLE_APPLE_TA */
|
||||
|
||||
#if 0 /* CONFIG_MTK_GAUGE_VERSION == 30 */
|
||||
#define CONFIG_RECV_BAT_ABSENT_NOTIFY
|
||||
|
|
|
|||
|
|
@ -980,6 +980,9 @@ extern int tcpm_dpm_pd_fast_swap(struct tcpc_device *tcpc,
|
|||
uint8_t role, const struct tcp_dpm_event_cb_data *data);
|
||||
extern int tcpm_dpm_pd_get_status(struct tcpc_device *tcpc,
|
||||
const struct tcp_dpm_event_cb_data *data, struct pd_status *status);
|
||||
extern int tcpm_dpm_pd_get_pps_status_raw(struct tcpc_device *tcpc,
|
||||
const struct tcp_dpm_event_cb_data *cb_data,
|
||||
struct pd_pps_status_raw *pps_status);
|
||||
extern int tcpm_dpm_pd_get_pps_status(struct tcpc_device *tcpc,
|
||||
const struct tcp_dpm_event_cb_data *data,
|
||||
struct pd_pps_status *pps_status);
|
||||
|
|
|
|||
|
|
@ -89,9 +89,9 @@ static inline bool pd_dbg_print_out(void)
|
|||
static int print_out_thread_fn(void *data)
|
||||
{
|
||||
while (true) {
|
||||
wait_event(print_out_wait_que,
|
||||
atomic_read(&pending_print_out) ||
|
||||
kthread_should_stop());
|
||||
wait_event_interruptible(print_out_wait_que,
|
||||
atomic_read(&pending_print_out) ||
|
||||
kthread_should_stop());
|
||||
if (kthread_should_stop())
|
||||
break;
|
||||
do {
|
||||
|
|
|
|||
|
|
@ -822,7 +822,7 @@ static inline int dp_ufp_u_request_dp_status(struct pd_port *pd_port)
|
|||
return pd_reply_svdm_request(pd_port,
|
||||
CMDT_RSP_ACK, 1, &dp_data->local_status);
|
||||
} else {
|
||||
return pd_reply_svdm_request_simply(pd_port, CMDT_RSP_NAK);
|
||||
return dpm_vdm_reply_svdm_nak(pd_port);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -895,8 +895,7 @@ static inline int dp_ufp_u_request_dp_config(struct pd_port *pd_port)
|
|||
break;
|
||||
}
|
||||
|
||||
return pd_reply_svdm_request_simply(
|
||||
pd_port, ack ? CMDT_RSP_ACK : CMDT_RSP_NAK);
|
||||
return dpm_vdm_reply_svdm_request(pd_port, ack);
|
||||
}
|
||||
|
||||
static inline void dp_ufp_u_send_dp_attention(struct pd_port *pd_port)
|
||||
|
|
|
|||
|
|
@ -254,9 +254,9 @@ static int pps_request_thread_fn(void *data)
|
|||
};
|
||||
|
||||
while (true) {
|
||||
wait_event(pd_port->pps_request_wait_que,
|
||||
atomic_read(&pd_port->pps_request) ||
|
||||
kthread_should_stop());
|
||||
wait_event_interruptible(pd_port->pps_request_wait_que,
|
||||
atomic_read(&pd_port->pps_request) ||
|
||||
kthread_should_stop());
|
||||
if (kthread_should_stop())
|
||||
break;
|
||||
do {
|
||||
|
|
@ -1465,6 +1465,10 @@ void pd_dpm_dfp_inform_uvdm(struct pd_port *pd_port, bool ack)
|
|||
|
||||
#endif /* CONFIG_USB_PD_CUSTOM_VDM */
|
||||
|
||||
void pd_dpm_ufp_send_svdm_nak(struct pd_port *pd_port)
|
||||
{
|
||||
dpm_vdm_reply_svdm_nak(pd_port);
|
||||
}
|
||||
|
||||
/*
|
||||
* DRP : Inform Source/Sink Cap
|
||||
|
|
@ -1854,7 +1858,7 @@ void pd_dpm_inform_battery_status(struct pd_port *pd_port)
|
|||
#endif /* CONFIG_USB_PD_REV30_BAT_STATUS_REMOTE */
|
||||
|
||||
static const struct pd_manufacturer_info c_invalid_mfrs = {
|
||||
.vid = 0, .pid = 0, .mfrs_string = "Not Supported",
|
||||
.vid = 0xFFFF, .pid = 0, .mfrs_string = "Not Supported",
|
||||
};
|
||||
|
||||
#ifdef CONFIG_USB_PD_REV30_MFRS_INFO_LOCAL
|
||||
|
|
@ -2310,7 +2314,9 @@ int pd_dpm_core_init(struct pd_port *pd_port)
|
|||
int i, j;
|
||||
bool ret;
|
||||
uint8_t svid_ops_nr = ARRAY_SIZE(svdm_svid_ops);
|
||||
#ifdef CONFIG_USB_PD_REV30
|
||||
struct tcpc_device *tcpc = pd_port->tcpc;
|
||||
#endif /* CONFIG_USB_PD_REV30 */
|
||||
|
||||
pd_port->svid_data = devm_kzalloc(&pd_port->tcpc->dev,
|
||||
sizeof(struct svdm_svid_data) * svid_ops_nr, GFP_KERNEL);
|
||||
|
|
|
|||
|
|
@ -226,6 +226,7 @@ static const char *const pe_state_name[] = {
|
|||
"PE_DFP_UVDM_ACKED",
|
||||
"PE_DFP_UVDM_NAKED",
|
||||
#endif/* CONFIG_USB_PD_CUSTOM_VDM */
|
||||
"PE_UFP_VDM_SEND_NAK",
|
||||
/******************* PD30 Common *******************/
|
||||
#ifdef CONFIG_USB_PD_REV30
|
||||
#ifdef CONFIG_USB_PD_REV30_BAT_CAP_REMOTE
|
||||
|
|
@ -485,6 +486,7 @@ static const char *const pe_state_name[] = {
|
|||
"D_UVDM_ACKED",
|
||||
"D_UVDM_NAKED",
|
||||
#endif/* CONFIG_USB_PD_CUSTOM_VDM */
|
||||
"U_SEND_NAK",
|
||||
/******************* PD30 Common *******************/
|
||||
#ifdef CONFIG_USB_PD_REV30
|
||||
#ifdef CONFIG_USB_PD_REV30_BAT_CAP_REMOTE
|
||||
|
|
@ -754,6 +756,7 @@ static const struct pe_state_actions pe_state_actions[] = {
|
|||
PE_STATE_ACTIONS(pe_dfp_uvdm_acked),
|
||||
PE_STATE_ACTIONS(pe_dfp_uvdm_naked),
|
||||
#endif/* CONFIG_USB_PD_CUSTOM_VDM */
|
||||
PE_STATE_ACTIONS(pe_ufp_vdm_send_nak),
|
||||
/******************* PD30 Common *******************/
|
||||
#ifdef CONFIG_USB_PD_REV30
|
||||
#ifdef CONFIG_USB_PD_REV30_BAT_CAP_REMOTE
|
||||
|
|
|
|||
|
|
@ -159,9 +159,6 @@ static inline uint8_t pe20_power_ready_entry(struct pd_port *pd_port)
|
|||
if (pd_port->data_role == PD_ROLE_DFP)
|
||||
rx_cap = PD_RX_CAP_PE_READY_DFP;
|
||||
|
||||
pd_port->pe_data.pe_state_flags |=
|
||||
PE_STATE_FLAG_IGNORE_UNKNOWN_EVENT;
|
||||
|
||||
return rx_cap;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -50,7 +50,6 @@ void pe_prs_src_snk_assert_rd_entry(struct pd_port *pd_port)
|
|||
|
||||
void pe_prs_src_snk_wait_source_on_entry(struct pd_port *pd_port)
|
||||
{
|
||||
PE_STATE_HRESET_IF_TX_FAILED(pd_port);
|
||||
pd_send_sop_ctrl_msg(pd_port, PD_CTRL_PS_RDY);
|
||||
}
|
||||
|
||||
|
|
@ -105,7 +104,6 @@ void pe_prs_snk_src_source_on_entry(struct pd_port *pd_port)
|
|||
dpm_reaction_set(pd_port, DPM_REACTION_CAP_RESET_CABLE);
|
||||
#endif /* CONFIG_USB_PD_RESET_CABLE */
|
||||
|
||||
PE_STATE_HRESET_IF_TX_FAILED(pd_port);
|
||||
pd_dpm_dynamic_enable_vconn(pd_port);
|
||||
pd_dpm_prs_enable_power_source(pd_port, true);
|
||||
|
||||
|
|
|
|||
|
|
@ -115,11 +115,13 @@ void pe_src_hard_reset_entry(struct pd_port *pd_port)
|
|||
{
|
||||
pd_send_hard_reset(pd_port);
|
||||
pd_enable_timer(pd_port, PD_TIMER_PS_HARD_RESET);
|
||||
pd_enable_timer(pd_port, PD_TIMER_NO_RESPONSE);
|
||||
}
|
||||
|
||||
void pe_src_hard_reset_received_entry(struct pd_port *pd_port)
|
||||
{
|
||||
pd_enable_timer(pd_port, PD_TIMER_PS_HARD_RESET);
|
||||
pd_enable_timer(pd_port, PD_TIMER_NO_RESPONSE);
|
||||
}
|
||||
|
||||
void pe_src_transition_to_default_entry(struct pd_port *pd_port)
|
||||
|
|
@ -131,7 +133,6 @@ void pe_src_transition_to_default_entry(struct pd_port *pd_port)
|
|||
void pe_src_transition_to_default_exit(struct pd_port *pd_port)
|
||||
{
|
||||
pd_set_vconn(pd_port, PD_ROLE_VCONN_ON);
|
||||
pd_enable_timer(pd_port, PD_TIMER_NO_RESPONSE);
|
||||
}
|
||||
|
||||
void pe_src_get_sink_cap_entry(struct pd_port *pd_port)
|
||||
|
|
|
|||
|
|
@ -116,3 +116,9 @@ void pe_ufp_uvdm_recv_entry(struct pd_port *pd_port)
|
|||
}
|
||||
|
||||
#endif /* CONFIG_USB_PD_CUSTOM_VDM */
|
||||
|
||||
void pe_ufp_vdm_send_nak_entry(struct pd_port *pd_port)
|
||||
{
|
||||
pd_dpm_ufp_send_svdm_nak(pd_port);
|
||||
VDM_STATE_DPM_INFORMED(pd_port);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -303,19 +303,23 @@ bool pd_make_pe_state_transit(struct pd_port *pd_port,
|
|||
|
||||
/*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifdef CONFIG_USB_PD_REV30
|
||||
static inline bool pd30_process_ready_protocol_error(struct pd_port *pd_port)
|
||||
static inline bool pd_process_ready_protocol_error(struct pd_port *pd_port)
|
||||
{
|
||||
#ifdef CONFIG_USB_PD_REV30
|
||||
bool multi_chunk;
|
||||
|
||||
if (!pd_check_rev30(pd_port))
|
||||
return false;
|
||||
#endif /* CONFIG_USB_PD_REV30 */
|
||||
|
||||
if (!pd_port->curr_unsupported_msg) {
|
||||
pe_transit_soft_reset_state(pd_port);
|
||||
return true;
|
||||
}
|
||||
|
||||
if (!pd_check_rev30(pd_port)) {
|
||||
PE_TRANSIT_STATE(pd_port, PE_REJECT);
|
||||
return true;
|
||||
}
|
||||
|
||||
#ifdef CONFIG_USB_PD_REV30
|
||||
multi_chunk = pd_is_multi_chunk_msg(pd_port);
|
||||
|
||||
if (pd_port->power_role == PD_ROLE_SINK) {
|
||||
|
|
@ -327,21 +331,34 @@ static inline bool pd30_process_ready_protocol_error(struct pd_port *pd_port)
|
|||
PE_TRANSIT_STATE(pd_port, multi_chunk ?
|
||||
PE_SRC_CHUNK_RECEIVED : PE_SRC_SEND_NOT_SUPPORTED);
|
||||
return true;
|
||||
}
|
||||
#else
|
||||
return false;
|
||||
#endif /* CONFIG_USB_PD_REV30 */
|
||||
|
||||
}
|
||||
|
||||
bool pd_process_protocol_error(
|
||||
struct pd_port *pd_port, struct pd_event *pd_event)
|
||||
{
|
||||
bool ret = false;
|
||||
bool power_change = false;
|
||||
#if PE_INFO_ENABLE
|
||||
uint8_t event_type = pd_event->event_type;
|
||||
uint8_t msg_id = pd_get_msg_hdr_id(pd_port);
|
||||
uint8_t msg_type = pd_event->msg;
|
||||
uint8_t msg_id = pd_get_msg_hdr_id(pd_port);
|
||||
#endif
|
||||
struct tcpc_device __maybe_unused *tcpc = pd_port->tcpc;
|
||||
|
||||
if (pd_port->pe_data.pe_state_flags &
|
||||
PE_STATE_FLAG_IGNORE_UNKNOWN_EVENT) {
|
||||
PE_INFO("Ignore Unknown Event\n");
|
||||
goto out;
|
||||
}
|
||||
|
||||
if (pd_check_pe_during_hard_reset(pd_port)) {
|
||||
PE_INFO("Ignore Event during HReset\n");
|
||||
goto out;
|
||||
}
|
||||
|
||||
switch (pd_port->pe_state_curr) {
|
||||
case PE_SNK_TRANSITION_SINK:
|
||||
/* fall through */
|
||||
|
|
@ -351,8 +368,8 @@ bool pd_process_protocol_error(
|
|||
power_change = true;
|
||||
if (pd_event_msg_match(pd_event,
|
||||
PD_EVT_CTRL_MSG, PD_CTRL_PING)) {
|
||||
PE_DBG("Ignore Ping\n");
|
||||
return false;
|
||||
PE_INFO("Ignore Ping\n");
|
||||
goto out;
|
||||
}
|
||||
break;
|
||||
|
||||
|
|
@ -361,36 +378,21 @@ bool pd_process_protocol_error(
|
|||
#endif /* CONFIG_USB_PD_PR_SWAP */
|
||||
if (pd_event_msg_match(pd_event,
|
||||
PD_EVT_CTRL_MSG, PD_CTRL_PING)) {
|
||||
PE_DBG("Ignore Ping\n");
|
||||
return false;
|
||||
PE_INFO("Ignore Ping\n");
|
||||
goto out;
|
||||
}
|
||||
break;
|
||||
|
||||
#ifdef CONFIG_USB_PD_REV30
|
||||
case PE_SNK_READY:
|
||||
case PE_SRC_READY:
|
||||
if (pd30_process_ready_protocol_error(pd_port))
|
||||
return true;
|
||||
if (pd_process_ready_protocol_error(pd_port)) {
|
||||
ret = true;
|
||||
goto out;
|
||||
}
|
||||
break;
|
||||
#endif /* CONFIG_USB_PD_REV30 */
|
||||
};
|
||||
|
||||
if (pd_port->pe_data.pe_state_flags &
|
||||
PE_STATE_FLAG_IGNORE_UNKNOWN_EVENT) {
|
||||
PE_DBG("Ignore Unknown Event\n");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (pd_check_pe_during_hard_reset(pd_port)) {
|
||||
PE_DBG("Ignore Event during HReset\n");
|
||||
return false;
|
||||
}
|
||||
|
||||
/*
|
||||
* msg_type: PD_EVT_CTRL_MSG (1), PD_EVT_DATA_MSG (2)
|
||||
*/
|
||||
|
||||
PE_INFO("PRL_ERR: %d-%d-%d\n", event_type, msg_type, msg_id);
|
||||
ret = true;
|
||||
|
||||
if (pd_port->pe_data.during_swap) {
|
||||
#ifdef CONFIG_USB_PD_PR_SWAP_ERROR_RECOVERY
|
||||
|
|
@ -403,7 +405,13 @@ bool pd_process_protocol_error(
|
|||
else
|
||||
pe_transit_soft_reset_state(pd_port);
|
||||
|
||||
return true;
|
||||
/*
|
||||
* event_type: PD_EVT_CTRL_MSG (1), PD_EVT_DATA_MSG (2)
|
||||
*/
|
||||
out:
|
||||
PE_INFO("PRL_ERR: %d-%d-%d\n", event_type, msg_type, msg_id);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
bool pd_process_tx_failed(struct pd_port *pd_port)
|
||||
|
|
@ -662,9 +670,9 @@ static inline uint8_t pe_get_startup_state(
|
|||
break;
|
||||
}
|
||||
|
||||
/* At least > 2 for Ellisys VNDI PR_SWAP */
|
||||
/* At least > 4 for Ellisys VNDI PR_SWAP */
|
||||
#ifdef CONFIG_USB_PD_ERROR_RECOVERY_ONCE
|
||||
if (pd_port->error_recovery_once > 2)
|
||||
if (pd_port->error_recovery_once > 4)
|
||||
startup_state = PE_ERROR_RECOVERY_ONCE;
|
||||
#endif /* CONFIG_USB_PD_ERROR_RECOVERY_ONCE */
|
||||
|
||||
|
|
|
|||
|
|
@ -75,13 +75,11 @@ DECL_PE_STATE_TRANSITION(PD_HW_VBUS_PRESENT) = {
|
|||
};
|
||||
DECL_PE_STATE_REACTION(PD_HW_VBUS_PRESENT);
|
||||
|
||||
#ifdef CONFIG_USB_PD_PR_SWAP_ERROR_RECOVERY
|
||||
DECL_PE_STATE_TRANSITION(PD_HW_TX_FAILED) = {
|
||||
{ PE_PRS_SRC_SNK_WAIT_SOURCE_ON, PE_ERROR_RECOVERY },
|
||||
{ PE_PRS_SNK_SRC_SOURCE_ON, PE_ERROR_RECOVERY },
|
||||
{ PE_PRS_SRC_SNK_WAIT_SOURCE_ON, PE_PRS_SNK_HARD_RESET },
|
||||
{ PE_PRS_SNK_SRC_SOURCE_ON, PE_PRS_SRC_HARD_RESET },
|
||||
};
|
||||
DECL_PE_STATE_REACTION(PD_HW_TX_FAILED);
|
||||
#endif /* CONFIG_USB_PD_PR_SWAP_ERROR_RECOVERY */
|
||||
|
||||
DECL_PE_STATE_TRANSITION(PD_HW_VBUS_SAFE0V) = {
|
||||
{ PE_PRS_SRC_SNK_TRANSITION_TO_OFF, PE_PRS_SRC_SNK_ASSERT_RD },
|
||||
|
|
@ -178,10 +176,8 @@ static inline bool pd_process_hw_msg(
|
|||
|
||||
return PE_MAKE_STATE_TRANSIT(PD_HW_VBUS_PRESENT);
|
||||
|
||||
#ifdef CONFIG_USB_PD_PR_SWAP_ERROR_RECOVERY
|
||||
case PD_HW_TX_FAILED:
|
||||
return PE_MAKE_STATE_TRANSIT(PD_HW_TX_FAILED);
|
||||
#endif /* CONFIG_USB_PD_PR_SWAP_ERROR_RECOVERY */
|
||||
|
||||
case PD_HW_VBUS_SAFE0V:
|
||||
return PE_MAKE_STATE_TRANSIT(PD_HW_VBUS_SAFE0V);
|
||||
|
|
|
|||
|
|
@ -60,10 +60,7 @@ static bool pd_process_ctrl_msg_get_source_cap(
|
|||
}
|
||||
#endif /* CONFIG_USB_PD_PR_SWAP */
|
||||
|
||||
if (!pd_check_rev30(pd_port)) {
|
||||
PE_TRANSIT_STATE(pd_port, PE_REJECT);
|
||||
return true;
|
||||
}
|
||||
pd_port->curr_unsupported_msg = true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -97,10 +97,7 @@ static inline bool pd_process_ctrl_msg_get_sink_cap(
|
|||
}
|
||||
#endif /* CONFIG_USB_PD_PR_SWAP */
|
||||
|
||||
if (!pd_check_rev30(pd_port)) {
|
||||
PE_TRANSIT_STATE(pd_port, PE_REJECT);
|
||||
return true;
|
||||
}
|
||||
pd_port->curr_unsupported_msg = true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
|
@ -323,12 +320,7 @@ static inline bool pd_process_hw_msg_tx_failed(
|
|||
struct tcpc_device __maybe_unused *tcpc = pd_port->tcpc;
|
||||
|
||||
if (pd_port->pe_state_curr == PE_SRC_SEND_CAPABILITIES) {
|
||||
if (pe_data->pd_connected) {
|
||||
if (!pe_data->explicit_contract) {
|
||||
PE_DBG("PR_SWAP NoResp\n");
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
if (!pe_data->pd_connected || !pe_data->explicit_contract) {
|
||||
PE_TRANSIT_STATE(pd_port, PE_SRC_DISCOVERY);
|
||||
return true;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -17,6 +17,7 @@
|
|||
#include "inc/tcpci_event.h"
|
||||
#include "inc/pd_process_evt.h"
|
||||
#include "inc/pd_dpm_core.h"
|
||||
#include "pd_dpm_prv.h"
|
||||
|
||||
/* VDM reactions */
|
||||
|
||||
|
|
@ -628,10 +629,15 @@ static inline bool pd_process_data_msg(
|
|||
|
||||
print_vdm_msg(pd_port, pd_event);
|
||||
|
||||
if (pd_msg->frame_type == TCPC_TX_SOP_PRIME)
|
||||
if (pd_port->curr_vdm_svid != USB_SID_PD &&
|
||||
!dpm_get_svdm_svid_data(pd_port, pd_port->curr_vdm_svid)) {
|
||||
PE_TRANSIT_STATE(pd_port, PE_UFP_VDM_SEND_NAK);
|
||||
ret = true;
|
||||
} else if (pd_msg->frame_type == TCPC_TX_SOP_PRIME) {
|
||||
ret = pd_process_sop_prime_vdm(pd_port, pd_event);
|
||||
else
|
||||
} else {
|
||||
ret = pd_process_sop_vdm(pd_port, pd_event);
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -95,7 +95,7 @@ int tcpci_check_vbus_valid_from_ic(struct tcpc_device *tcpc)
|
|||
|
||||
if (tcpci_get_power_status(tcpc, &power_status) == 0) {
|
||||
if (vbus_level != tcpc->vbus_level) {
|
||||
TCPC_INFO("[Warning] ps_changed %d ->%d\n",
|
||||
TCPC_INFO("[Warning] ps_changed %d -> %d\n",
|
||||
vbus_level, tcpc->vbus_level);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -35,7 +35,7 @@
|
|||
#include "inc/pd_dbg_info.h"
|
||||
#include "inc/rt-regmap.h"
|
||||
|
||||
#define TCPC_CORE_VERSION "2.0.14_G"
|
||||
#define TCPC_CORE_VERSION "2.0.15_G"
|
||||
|
||||
static ssize_t tcpc_show_property(struct device *dev,
|
||||
struct device_attribute *attr, char *buf);
|
||||
|
|
@ -199,28 +199,21 @@ static ssize_t tcpc_show_property(struct device *dev,
|
|||
return strlen(buf);
|
||||
}
|
||||
|
||||
static int get_parameters(char *buf, long int *param1, int num_of_par)
|
||||
static int get_parameters(char *buf, unsigned long *param, int num_of_par)
|
||||
{
|
||||
char *token;
|
||||
int base, cnt;
|
||||
|
||||
token = strsep(&buf, " ");
|
||||
int cnt = 0;
|
||||
char *token = strsep(&buf, " ");
|
||||
|
||||
for (cnt = 0; cnt < num_of_par; cnt++) {
|
||||
if (token != NULL) {
|
||||
if ((token[1] == 'x') || (token[1] == 'X'))
|
||||
base = 16;
|
||||
else
|
||||
base = 10;
|
||||
|
||||
if (kstrtoul(token, base, ¶m1[cnt]) != 0)
|
||||
if (token) {
|
||||
if (kstrtoul(token, 0, ¶m[cnt]) != 0)
|
||||
return -EINVAL;
|
||||
|
||||
token = strsep(&buf, " ");
|
||||
}
|
||||
else
|
||||
} else
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
@ -880,6 +873,21 @@ MODULE_VERSION(TCPC_CORE_VERSION);
|
|||
MODULE_LICENSE("GPL");
|
||||
|
||||
/* Release Version
|
||||
* 2.0.15_G
|
||||
* (1) undef CONFIG_COMPATIBLE_APPLE_TA
|
||||
* (2) Fix TEST.PD.PROT.ALL.5 Unrecognized Message (PD2)
|
||||
* (3) Fix TEST.PD.PROT.ALL3.3 Invalid Manufacturer Info Target
|
||||
* (4) Fix TEST.PD.PROT.ALL3.4 Invalid Manufacturer Info Ref
|
||||
* (5) Fix TEST.PD.PROT.SRC.11 Unexpected Message Received in Ready State (PD2)
|
||||
* (6) Fix TEST.PD.PROT.SRC.13 PR_Swap - GoodCRC not sent in Response to PS_RDY
|
||||
* (7) Fix TEST.PD.VDM.SRC.2 Invalid Fields - Discover Identity (PD2)
|
||||
* (8) Revise the usages of PD_TIMER_NO_RESPONSE
|
||||
* (9) Retry to send Source_Capabilities after PR_Swap
|
||||
* (10) Fix tcpm_get_remote_power_cap() and __tcpm_inquire_select_source_cap()
|
||||
* (11) Increase the threshold to enter PE_ERROR_RECOVERY_ONCE from 2 to 4
|
||||
* (12) Change wait_event() back to wait_event_interruptible() for not being
|
||||
* detected as hung tasks
|
||||
*
|
||||
* 2.0.14_G
|
||||
* (1) Move out typec_port registration and operation to rt_pd_manager.c
|
||||
* (2) Rename CONFIG_TYPEC_WAIT_BC12 to CONFIG_USB_PD_WAIT_BC12
|
||||
|
|
|
|||
|
|
@ -1313,9 +1313,9 @@ static int tcpc_event_thread_fn(void *data)
|
|||
sched_setscheduler(current, SCHED_FIFO, &sch_param);
|
||||
|
||||
while (true) {
|
||||
wait_event(tcpc->event_wait_que,
|
||||
atomic_read(&tcpc->pending_event) ||
|
||||
kthread_should_stop());
|
||||
wait_event_interruptible(tcpc->event_wait_que,
|
||||
atomic_read(&tcpc->pending_event) ||
|
||||
kthread_should_stop());
|
||||
if (kthread_should_stop())
|
||||
break;
|
||||
do {
|
||||
|
|
|
|||
|
|
@ -987,6 +987,7 @@ static enum hrtimer_restart tcpc_timer_pddebounce(struct hrtimer *timer)
|
|||
return HRTIMER_NORESTART;
|
||||
}
|
||||
|
||||
#ifdef CONFIG_COMPATIBLE_APPLE_TA
|
||||
static enum hrtimer_restart tcpc_timer_apple_cc_open(struct hrtimer *timer)
|
||||
{
|
||||
int index = TYPEC_TIMER_APPLE_CC_OPEN;
|
||||
|
|
@ -996,6 +997,7 @@ static enum hrtimer_restart tcpc_timer_apple_cc_open(struct hrtimer *timer)
|
|||
TCPC_TIMER_TRIGGER();
|
||||
return HRTIMER_NORESTART;
|
||||
}
|
||||
#endif /* CONFIG_COMPATIBLE_APPLE_TA */
|
||||
|
||||
static enum hrtimer_restart tcpc_timer_tryccdebounce(struct hrtimer *timer)
|
||||
{
|
||||
|
|
@ -1339,8 +1341,9 @@ static int tcpc_timer_thread_fn(void *data)
|
|||
sched_setscheduler(current, SCHED_FIFO, &sch_param);
|
||||
|
||||
while (true) {
|
||||
wait_event(tcpc->timer_wait_que, tcpc_get_timer_tick(tcpc) ||
|
||||
kthread_should_stop());
|
||||
wait_event_interruptible(tcpc->timer_wait_que,
|
||||
tcpc_get_timer_tick(tcpc) ||
|
||||
kthread_should_stop());
|
||||
if (kthread_should_stop())
|
||||
break;
|
||||
tcpc_handle_timer_triggered(tcpc);
|
||||
|
|
|
|||
|
|
@ -51,13 +51,6 @@ static int tcpm_check_pd_attached(struct tcpc_device *tcpc)
|
|||
}
|
||||
|
||||
ret = tcpm_check_typec_attached(tcpc);
|
||||
if (ret != TCPM_SUCCESS)
|
||||
goto unlock_typec_out;
|
||||
|
||||
#ifdef CONFIG_TYPEC_CAP_CUSTOM_SRC
|
||||
if (tcpc->typec_attach_old == TYPEC_ATTACHED_CUSTOM_SRC)
|
||||
ret = TCPM_ERROR_CUSTOM_SRC;
|
||||
#endif /* CONFIG_TYPEC_CAP_CUSTOM_SRC */
|
||||
|
||||
unlock_typec_out:
|
||||
tcpci_unlock_typec(tcpc);
|
||||
|
|
@ -674,15 +667,17 @@ int tcpm_get_remote_power_cap(struct tcpc_device *tcpc,
|
|||
int i;
|
||||
|
||||
mutex_lock(&pd_port->pd_lock);
|
||||
remote_cap->selected_cap_idx =
|
||||
tcpc->pd_port.pe_data.remote_selected_cap;
|
||||
remote_cap->nr = tcpc->pd_port.pe_data.remote_src_cap.nr;
|
||||
remote_cap->selected_cap_idx = pd_port->pe_data.remote_selected_cap;
|
||||
remote_cap->nr = pd_port->pe_data.remote_src_cap.nr;
|
||||
for (i = 0; i < remote_cap->nr; i++) {
|
||||
tcpm_extract_power_cap_val(
|
||||
tcpc->pd_port.pe_data.remote_src_cap.pdos[i], &cap);
|
||||
pd_port->pe_data.remote_src_cap.pdos[i], &cap);
|
||||
remote_cap->max_mv[i] = cap.max_mv;
|
||||
remote_cap->min_mv[i] = cap.min_mv;
|
||||
remote_cap->ma[i] = cap.ma;
|
||||
if (cap.type == DPM_PDO_TYPE_BAT)
|
||||
remote_cap->ma[i] = cap.uw / cap.min_mv;
|
||||
else
|
||||
remote_cap->ma[i] = cap.ma;
|
||||
remote_cap->type[i] = cap.type;
|
||||
}
|
||||
mutex_unlock(&pd_port->pd_lock);
|
||||
|
|
@ -706,7 +701,7 @@ static inline int __tcpm_inquire_select_source_cap(
|
|||
return TCPM_ERROR_POWER_ROLE;
|
||||
|
||||
sel = RDO_POS(pd_port->last_rdo) - 1;
|
||||
if (sel > pe_data->remote_src_cap.nr)
|
||||
if (sel >= pe_data->remote_src_cap.nr)
|
||||
return TCPM_ERROR_NO_SOURCE_CAP;
|
||||
|
||||
if (!tcpm_extract_power_cap_val(
|
||||
|
|
|
|||
Loading…
Reference in a new issue