From fb9ea90d58acf8b607afcb0e0277827424199c33 Mon Sep 17 00:00:00 2001 From: Sankeerth Billakanti Date: Tue, 24 Sep 2019 08:21:52 +0530 Subject: [PATCH] disp: msm: dp: reset combo phy if peer_usb_comm is disabled Some Type-C multi-port adapters which do not support usb connection are advertising the multi-functionality in DP alt mode. If multi-functionality is preferred, the DP driver assumes the adapter supports usb connection and USB phy driver will program the PHY mode to DP+USB. In source mode, usb PD driver checks for the peer_usb_connection of the adapter. If it does not support usb then it will stop usb stack and update the PHY MODE to USB only mode from phy_suspend path. The result is, usb may program the combo PHY to usb only mode when DP is already connected. This is causing AUX read/write timeouts when DP is trying to access the phy registers. To fix this issue, a flag in SVID connect handler in usbpd driver to notify peer_usb_comm support to the DP driver. DP driver will read this flag and program the phy mode. Change-Id: I0164b239bf2832d480795d90f5e9fc221bcc12ba Signed-off-by: Sankeerth Billakanti --- msm/dp/dp_catalog.c | 1 + msm/dp/dp_display.c | 3 ++- msm/dp/dp_hpd.h | 1 + msm/dp/dp_usbpd.c | 6 ++++-- 4 files changed, 8 insertions(+), 3 deletions(-) diff --git a/msm/dp/dp_catalog.c b/msm/dp/dp_catalog.c index 32f4233e62fd..c928c1a34534 100644 --- a/msm/dp/dp_catalog.c +++ b/msm/dp/dp_catalog.c @@ -1349,6 +1349,7 @@ static void dp_catalog_ctrl_usb_reset(struct dp_catalog_ctrl *ctrl, bool flip) io_data = catalog->io.usb3_dp_com; + DP_DEBUG("Program PHYMODE to DP only\n"); dp_write(USB3_DP_COM_RESET_OVRD_CTRL, 0x0a); dp_write(USB3_DP_COM_PHY_MODE_CTRL, 0x02); dp_write(USB3_DP_COM_SW_RESET, 0x01); diff --git a/msm/dp/dp_display.c b/msm/dp/dp_display.c index bee9567d194f..45b1a689ca2e 100644 --- a/msm/dp/dp_display.c +++ b/msm/dp/dp_display.c @@ -781,7 +781,8 @@ static void dp_display_host_init(struct dp_display_private *dp) if (dp->hpd->orientation == ORIENTATION_CC2) flip = true; - reset = dp->debug->sim_mode ? false : !dp->hpd->multi_func; + reset = dp->debug->sim_mode ? false : + (!dp->hpd->multi_func || !dp->hpd->peer_usb_comm); dp->power->init(dp->power, flip); dp->hpd->host_init(dp->hpd, &dp->catalog->hpd); diff --git a/msm/dp/dp_hpd.h b/msm/dp/dp_hpd.h index 7fb57254858a..86806fbdf773 100644 --- a/msm/dp/dp_hpd.h +++ b/msm/dp/dp_hpd.h @@ -63,6 +63,7 @@ struct dp_hpd { bool hpd_irq; bool alt_mode_cfg_done; bool multi_func; + bool peer_usb_comm; void (*isr)(struct dp_hpd *dp_hpd); int (*register_hpd)(struct dp_hpd *dp_hpd); diff --git a/msm/dp/dp_usbpd.c b/msm/dp/dp_usbpd.c index 2187e6048a6b..030fe618dcb3 100644 --- a/msm/dp/dp_usbpd.c +++ b/msm/dp/dp_usbpd.c @@ -235,7 +235,8 @@ static void dp_usbpd_send_event(struct dp_usbpd_private *pd, } } -static void dp_usbpd_connect_cb(struct usbpd_svid_handler *hdlr) +static void dp_usbpd_connect_cb(struct usbpd_svid_handler *hdlr, + bool peer_usb_comm) { struct dp_usbpd_private *pd; @@ -245,7 +246,8 @@ static void dp_usbpd_connect_cb(struct usbpd_svid_handler *hdlr) return; } - DP_DEBUG("\n"); + DP_DEBUG("peer_usb_comm: %d\n"); + pd->dp_usbpd.base.peer_usb_comm = peer_usb_comm; dp_usbpd_send_event(pd, DP_USBPD_EVT_DISCOVER); }