usb: misc: nb7vpq904m: disable chip when boot up without cable

When boot up without USB cable, first UCSI_GET_CONNECTOR_STATUS command
will return all zero message,

Example UCSI IPC log:
40.319381997:   sync_write: CONTROL: 12 00 01 00 00 00 00 00
40.319507987:   read: CCI: 00 09 00 80
40.319620018:   read: MSG_IN: 00 00 00 00 00 00 00 00 00

Disable chip when connect status not set.

Change-Id: I6c91e462b10a8fc6798d95148be799706861ab46
Signed-off-by: Linyu Yuan <linyyuan@codeaurora.org>
This commit is contained in:
Linyu Yuan 2020-11-04 10:32:22 +08:00
commit 9b1743cb3a

View file

@ -458,13 +458,17 @@ static int ssusb_redriver_ucsi_notifier(struct notifier_block *nb,
if (info->connect && !info->partner_change)
return NOTIFY_DONE;
/*
* when connect a DP only cable,
* ucsi set usb flag first, then set usb and alternate mode
* after dp start link training.
* it should only set alternate_mode flag ???
*/
if (info->partner_usb && info->partner_alternate_mode) {
if (!info->connect) {
if (info->partner_usb || info->partner_alternate_mode)
dev_err(redriver->dev, "set partner when no connection\n");
op_mode = OP_MODE_NONE;
} else if (info->partner_usb && info->partner_alternate_mode) {
/*
* when connect a DP only cable,
* ucsi set usb flag first, then set usb and alternate mode
* after dp start link training.
* it should only set alternate_mode flag ???
*/
if (redriver->op_mode == OP_MODE_DP)
return NOTIFY_OK;
op_mode = OP_MODE_USB_AND_DP;
@ -472,10 +476,9 @@ static int ssusb_redriver_ucsi_notifier(struct notifier_block *nb,
if (redriver->op_mode == OP_MODE_DP)
return NOTIFY_OK;
op_mode = OP_MODE_USB;
}
else if (info->partner_alternate_mode)
} else if (info->partner_alternate_mode) {
op_mode = OP_MODE_DP;
else
} else
op_mode = OP_MODE_NONE;
if (redriver->op_mode == op_mode)