From patchwork Fri Dec 6 04:32:04 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Abhinav Kumar X-Patchwork-Id: 13896416 Received: from mx0a-0031df01.pphosted.com (mx0a-0031df01.pphosted.com [205.220.168.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 0BB761F130D; Fri, 6 Dec 2024 04:33:18 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.168.131 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733459600; cv=none; b=GP6CrEf1F28sKanz109PY4hp4w9mZqfbs9/vYza+Am7Kdd3hqvfosK9pHnxuYWqEZrzno9A3aU5CpB+gbmNBU/+nPWbki50wGihCeXNl8l20/EfU24JrndS45voDIhd9MIvj/iEGqiZLXTPxKx/Hf9MiCYSrPUx5OMjMEedZp7s= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733459600; c=relaxed/simple; bh=VcW+kFVNca7+tVYnlERdBKTtdsIWWyATbFzurq1OScw=; h=From:Date:Subject:MIME-Version:Content-Type:Message-ID:References: In-Reply-To:To:CC; b=gH80rZc2ms1fN2BIFwr2AkT67ynh0UHSAToLo0jouQVPQgnvEDrqSJ9kavkWEZkd7t7QEKRMWentkWhr+kb9UA0SXzgimlv0Z/c9Wd56Sho7JBHpsIxLtKydY1AsTLKT37humoE+y1/MFiddGQzxCOH+aByT8vFs2ZyhKGM3xsk= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=quicinc.com; spf=pass smtp.mailfrom=quicinc.com; dkim=pass (2048-bit key) header.d=quicinc.com header.i=@quicinc.com header.b=S0a9+VCl; arc=none smtp.client-ip=205.220.168.131 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=quicinc.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=quicinc.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=quicinc.com header.i=@quicinc.com header.b="S0a9+VCl" Received: from pps.filterd (m0279862.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 4B5HaLrr006904; Fri, 6 Dec 2024 04:32:44 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=qcppdkim1; bh= 2M+7253oWBAgGqjLZHRTLfQPC25SNs98onVgPUFYShc=; b=S0a9+VCl8/YFSCs+ nnvLUMjGfqYd7UGupbzDI8SJgzUd1r1hpCgir4/ncu//q57yVRkOg7DJ5evXHvfg yFReKOVRvPZlZZFcAIcvivI9s31iHzucTXnduiBhMygyxJg7Ci5cTJLK+HAAyX8/ 5twaZ+IbWMo+tXl7OHS9yKUD/UsvxlJDfpItWYpsbbqK2k/qpV/HH127aRQAJEoc 5xqBATCQem4+5xWX0oVHU+0xzODnPYvsJeTkNalX3B4PYumGO7ph/8T3vGcQmxRZ oAPA2g3HNi9GBhWrwjjZyoj+BZrY03D3Gh8zBer4vOpEhEvevvh5yLcbCGfjodPf 8K+aRA== Received: from nalasppmta02.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 43ben89rp4-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 06 Dec 2024 04:32:44 +0000 (GMT) Received: from nalasex01a.na.qualcomm.com (nalasex01a.na.qualcomm.com [10.47.209.196]) by NALASPPMTA02.qualcomm.com (8.18.1.2/8.18.1.2) with ESMTPS id 4B64WhRV022169 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 6 Dec 2024 04:32:43 GMT Received: from abhinavk-linux1.qualcomm.com (10.80.80.8) by nalasex01a.na.qualcomm.com (10.47.209.196) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.9; Thu, 5 Dec 2024 20:32:42 -0800 From: Abhinav Kumar Date: Thu, 5 Dec 2024 20:32:04 -0800 Subject: [PATCH 33/45] drm/msm/dp: add irq hpd callback for dp mst Precedence: bulk X-Mailing-List: linux-arm-msm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-ID: <20241205-dp_mst-v1-33-f8618d42a99a@quicinc.com> References: <20241205-dp_mst-v1-0-f8618d42a99a@quicinc.com> In-Reply-To: <20241205-dp_mst-v1-0-f8618d42a99a@quicinc.com> To: Rob Clark , Dmitry Baryshkov , Sean Paul , Marijn Suijten , David Airlie , "Simona Vetter" , Stephen Boyd , "Chandan Uddaraju" , Guenter Roeck , Kuogee Hsieh , Bjorn Andersson , Konrad Dybcio , Rob Herring , Krzysztof Kozlowski , Conor Dooley CC: Vara Reddy , Rob Clark , Tanmay Shah , , , , , , Jessica Zhang , Laurent Pinchart , Abhinav Kumar X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=ed25519-sha256; t=1733459543; l=4918; i=quic_abhinavk@quicinc.com; s=20240509; h=from:subject:message-id; bh=VcW+kFVNca7+tVYnlERdBKTtdsIWWyATbFzurq1OScw=; b=Ke7UJr/9lVsEGZeZ8l1DA1xgJIeEFmAzJVIviADQnmx8rpZ/XLXEAYpPEcuuzlb7aqjYDzMHk m0P+f/61M7FD3cNFHG2U/tHyYNqt0d9Ahz5QkKZLP6SW4BZkKSHMZ0c X-Developer-Key: i=quic_abhinavk@quicinc.com; a=ed25519; pk=SD3D8dOKDDh6BoX3jEYjsHrTFwuIK8+o0cLPgQok9ys= X-ClientProxiedBy: nasanex01b.na.qualcomm.com (10.46.141.250) To nalasex01a.na.qualcomm.com (10.47.209.196) X-QCInternal: smtphost X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=5800 signatures=585085 X-Proofpoint-ORIG-GUID: TY1YD3e5tkczos9xnDGFsu3gehYCTMDh X-Proofpoint-GUID: TY1YD3e5tkczos9xnDGFsu3gehYCTMDh X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1039,Hydra:6.0.680,FMLib:17.12.60.29 definitions=2024-09-06_09,2024-09-06_01,2024-09-02_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 bulkscore=0 phishscore=0 priorityscore=1501 impostorscore=0 mlxlogscore=999 clxscore=1015 malwarescore=0 suspectscore=0 spamscore=0 mlxscore=0 lowpriorityscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2411120000 definitions=main-2412060030 Add irq hpd callback for the dp mst module which shall be invoked from the dp_display's irq hpd handler to perform mst specific operations in case of irq hpd. In MST case, route the IRQ HPD messages to MST module. Signed-off-by: Abhinav Kumar --- drivers/gpu/drm/msm/dp/dp_display.c | 17 +++++++++++++---- drivers/gpu/drm/msm/dp/dp_mst_drm.c | 36 +++++++++++++++++++++++++++++++++++- drivers/gpu/drm/msm/dp/dp_mst_drm.h | 2 ++ 3 files changed, 50 insertions(+), 5 deletions(-) diff --git a/drivers/gpu/drm/msm/dp/dp_display.c b/drivers/gpu/drm/msm/dp/dp_display.c index 60316633cc6bcfdfad8ab356d803642d353add61..97f8228042773f51f23a9d39fc009de0798059d7 100644 --- a/drivers/gpu/drm/msm/dp/dp_display.c +++ b/drivers/gpu/drm/msm/dp/dp_display.c @@ -583,7 +583,9 @@ static int msm_dp_display_usbpd_attention_cb(struct device *dev) { int rc = 0; u32 sink_request; + struct msm_dp_display_private *dp = dev_get_dp_display_private(dev); + struct msm_dp *msm_dp_display = &dp->msm_dp_display; /* check for any test request issued by sink */ rc = msm_dp_link_process_request(dp->link); @@ -591,12 +593,18 @@ static int msm_dp_display_usbpd_attention_cb(struct device *dev) sink_request = dp->link->sink_request; drm_dbg_dp(dp->drm_dev, "hpd_state=%d sink_request=%d\n", dp->hpd_state, sink_request); - if (sink_request & DS_PORT_STATUS_CHANGED) - rc = msm_dp_display_handle_port_status_changed(dp); - else + if (sink_request & DS_PORT_STATUS_CHANGED) { + if (!msm_dp_display->mst_active) + rc = msm_dp_display_handle_port_status_changed(dp); + } else { rc = msm_dp_display_handle_irq_hpd(dp); + } } + /* let MST specific IRQ events be handled by its callback */ + if (msm_dp_display->mst_active) + msm_dp_mst_display_hpd_irq(&dp->msm_dp_display); + return rc; } @@ -736,7 +744,8 @@ static int msm_dp_irq_hpd_handle(struct msm_dp_display_private *dp, u32 data) drm_dbg_dp(dp->drm_dev, "Before, type=%d hpd_state=%d\n", dp->msm_dp_display.connector_type, state); - if (state == ST_MAINLINK_READY || state == ST_DISCONNECT_PENDING) { + if ((state == ST_MAINLINK_READY || state == ST_DISCONNECT_PENDING) && + !dp->msm_dp_display.mst_active) { /* wait until ST_CONNECTED */ msm_dp_add_event(dp, EV_IRQ_HPD_INT, 0, 1); /* delay = 1 */ mutex_unlock(&dp->event_mutex); diff --git a/drivers/gpu/drm/msm/dp/dp_mst_drm.c b/drivers/gpu/drm/msm/dp/dp_mst_drm.c index 2934fe6a93ff8b927b035c01b6007f3f4ec91a3f..2d92084586b466d4953429e8a6fbf766d081cb9f 100644 --- a/drivers/gpu/drm/msm/dp/dp_mst_drm.c +++ b/drivers/gpu/drm/msm/dp/dp_mst_drm.c @@ -559,6 +559,40 @@ static struct msm_dp_mst_bridge_state *msm_dp_mst_br_priv_state(struct drm_atomi &bridge->obj)); } +/* DP MST HPD IRQ callback */ +void msm_dp_mst_display_hpd_irq(struct msm_dp *dp_display) +{ + int rc; + struct msm_dp_mst *mst = dp_display->msm_dp_mst; + u8 ack[8] = {}; + u8 esi[14]; + unsigned int esi_res = DP_SINK_COUNT_ESI + 1; + bool handled; + + rc = drm_dp_dpcd_read(mst->dp_aux, DP_SINK_COUNT_ESI, + esi, 14); + if (rc != 14) { + DRM_ERROR("dpcd sink status read failed, rlen=%d\n", rc); + return; + } + + drm_dbg_dp(dp_display->drm_dev, "mst irq: esi1[0x%x] esi2[0x%x] esi3[%x]\n", + esi[1], esi[2], esi[3]); + + rc = drm_dp_mst_hpd_irq_handle_event(&mst->mst_mgr, esi, ack, &handled); + + /* ack the request */ + if (handled) { + rc = drm_dp_dpcd_writeb(mst->dp_aux, esi_res, ack[1]); + + if (rc != 1) + DRM_ERROR("dpcd esi_res failed. rc=%d\n", rc); + + drm_dp_mst_hpd_irq_send_new_request(&mst->mst_mgr); + } + drm_dbg_dp(dp_display->drm_dev, "mst display hpd_irq handled:%d rc:%d\n", handled, rc); +} + /* DP MST Connector OPs */ static int msm_dp_mst_connector_detect(struct drm_connector *connector, @@ -570,7 +604,7 @@ msm_dp_mst_connector_detect(struct drm_connector *connector, struct msm_dp_mst *mst = dp_display->msm_dp_mst; enum drm_connector_status status = connector_status_disconnected; - if (dp_display->link_ready) + if (dp_display->link_ready && dp_display->mst_active) status = drm_dp_mst_detect_port(connector, ctx, &mst->mst_mgr, mst_conn->mst_port); diff --git a/drivers/gpu/drm/msm/dp/dp_mst_drm.h b/drivers/gpu/drm/msm/dp/dp_mst_drm.h index 9a8535b97193d911592b44fdfcf43ca2f252cea0..5fe5dc7596086467e9a3b3d7d04a665853fbb3d7 100644 --- a/drivers/gpu/drm/msm/dp/dp_mst_drm.h +++ b/drivers/gpu/drm/msm/dp/dp_mst_drm.h @@ -103,4 +103,6 @@ int msm_dp_mst_drm_bridge_init(struct msm_dp *dp, struct drm_encoder *encoder); int msm_dp_mst_init(struct msm_dp *dp_display, u32 max_streams, u32 max_dpcd_transaction_bytes, struct drm_dp_aux *drm_aux); +void msm_dp_mst_display_hpd_irq(struct msm_dp *dp_display); + #endif /* _DP_MST_DRM_H_ */