mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-12 07:37:31 -04:00
usb: pd: Correctly handle SVDM versions
When receiving an SVDM with an unsupported version, we should still send a response with the highest version we support, rather than dropping the packet outright. Also update the outgoing SVDM version field to 1 (2.0) if operating in PD3 mode. Change-Id: I0bafb619e0ac16bc45064ef699870b0c03b52b47 Signed-off-by: Jack Pham <jackp@codeaurora.org>
This commit is contained in:
parent
8130739446
commit
b1fac94e68
1 changed files with 8 additions and 8 deletions
|
|
@ -1412,10 +1412,12 @@ int usbpd_send_svdm(struct usbpd *pd, u16 svid, u8 cmd,
|
|||
enum usbpd_svdm_cmd_type cmd_type, int obj_pos,
|
||||
const u32 *vdos, int num_vdos)
|
||||
{
|
||||
u32 svdm_hdr = SVDM_HDR(svid, 0, obj_pos, cmd_type, cmd);
|
||||
u32 svdm_hdr = SVDM_HDR(svid, pd->spec_rev == USBPD_REV_30 ? 1 : 0,
|
||||
obj_pos, cmd_type, cmd);
|
||||
|
||||
usbpd_dbg(&pd->dev, "VDM tx: svid:%x cmd:%x cmd_type:%x svdm_hdr:%x\n",
|
||||
svid, cmd, cmd_type, svdm_hdr);
|
||||
usbpd_dbg(&pd->dev, "VDM tx: svid:%04x ver:%d obj_pos:%d cmd:%x cmd_type:%x svdm_hdr:%x\n",
|
||||
svid, pd->spec_rev == USBPD_REV_30 ? 1 : 0, obj_pos,
|
||||
cmd, cmd_type, svdm_hdr);
|
||||
|
||||
return usbpd_send_vdm(pd, svdm_hdr, vdos, num_vdos);
|
||||
}
|
||||
|
|
@ -1582,7 +1584,7 @@ static void handle_vdm_rx(struct usbpd *pd, struct rx_msg *rx_msg)
|
|||
ktime_t recvd_time = ktime_get();
|
||||
|
||||
usbpd_dbg(&pd->dev,
|
||||
"VDM rx: svid:%x cmd:%x cmd_type:%x vdm_hdr:%x has_dp: %s\n",
|
||||
"VDM rx: svid:%04x cmd:%x cmd_type:%x vdm_hdr:%x has_dp: %s\n",
|
||||
svid, cmd, cmd_type, vdm_hdr,
|
||||
pd->has_dp ? "true" : "false");
|
||||
|
||||
|
|
@ -1605,11 +1607,9 @@ static void handle_vdm_rx(struct usbpd *pd, struct rx_msg *rx_msg)
|
|||
return;
|
||||
}
|
||||
|
||||
if (SVDM_HDR_VER(vdm_hdr) > 1) {
|
||||
usbpd_dbg(&pd->dev, "Discarding SVDM with incorrect version:%d\n",
|
||||
if (SVDM_HDR_VER(vdm_hdr) > 1)
|
||||
usbpd_dbg(&pd->dev, "Received SVDM with unsupported version:%d\n",
|
||||
SVDM_HDR_VER(vdm_hdr));
|
||||
return;
|
||||
}
|
||||
|
||||
if (cmd_type != SVDM_CMD_TYPE_INITIATOR &&
|
||||
pd->current_state != PE_SRC_STARTUP_WAIT_FOR_VDM_RESP)
|
||||
|
|
|
|||
Loading…
Reference in a new issue