usb: typec: tcpm: Respond Not_Supported if no snk_vdo

If snk_vdo is not populated from fwnode, it implies the port does not
support responding to SVDM commands. Not_Supported Message shall be sent
if the contract is in PD3. And for PD2, the port shall ignore the
commands.

Fixes: 193a68011f ("staging: typec: tcpm: Respond to Discover Identity commands")
Cc: stable <stable@vger.kernel.org>
Reviewed-by: Guenter Roeck <linux@roeck-us.net>
Acked-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
Signed-off-by: Kyle Tso <kyletso@google.com>
Link: https://lore.kernel.org/r/20210523015855.1785484-3-kyletso@google.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
Kyle Tso 2021-05-23 09:58:55 +08:00 коммит произвёл Greg Kroah-Hartman
Родитель 0bc3ee9288
Коммит a20dcf53ea
1 изменённых файлов: 4 добавлений и 1 удалений

Просмотреть файл

@ -2430,7 +2430,10 @@ static void tcpm_pd_data_request(struct tcpm_port *port,
NONE_AMS); NONE_AMS);
break; break;
case PD_DATA_VENDOR_DEF: case PD_DATA_VENDOR_DEF:
if (tcpm_vdm_ams(port) || port->nr_snk_vdo)
tcpm_handle_vdm_request(port, msg->payload, cnt); tcpm_handle_vdm_request(port, msg->payload, cnt);
else if (port->negotiated_rev > PD_REV20)
tcpm_pd_handle_msg(port, PD_MSG_CTRL_NOT_SUPP, NONE_AMS);
break; break;
case PD_DATA_BIST: case PD_DATA_BIST:
port->bist_request = le32_to_cpu(msg->payload[0]); port->bist_request = le32_to_cpu(msg->payload[0]);