Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp34906rwb; Wed, 7 Dec 2022 14:04:23 -0800 (PST) X-Google-Smtp-Source: AA0mqf72As3SUPuKMXDM+mdeWLZKqz122DECfljbIzxi7aDtU4qslpGwsoqjDLTo6TQvirRNATQf X-Received: by 2002:a17:906:ecf1:b0:7c0:a26f:b52e with SMTP id qt17-20020a170906ecf100b007c0a26fb52emr27598700ejb.30.1670450663049; Wed, 07 Dec 2022 14:04:23 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1670450663; cv=none; d=google.com; s=arc-20160816; b=inCZUm72MfPg37B4nCz+6sdx+dUZhDMcLPeTNVFqXO9YbDm7vdEOJwGc0OFui92imP B2/9QavyXzIVZJMept/v0bctbT3YH/U8QSL+zWtHPREdyjh8/diF14ePd4ei0+v70XNy vkloCNqrTxn7nEdeNFOtr811XY/IZDAKpvXWQ2BQ32N0t0hjIr3uuWIcPTfmxzAyAeA9 Hf4LOK7mjFAD2msJ6YmiEUXGi6G1KR8RUlryM+PO4EKaa3SvsFfTyawC7OaoTLTkUoAu Jgl6qEh2fqfIFZTpt+5sNDfWr1i0Dz8VoNCBPBddNy8DoM97Dd/bEeRbjN1UBkLARl+M wxOw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=VQC4nPKO9pFOGSOkNuHOYewDGLmoGdtZo5RvIdCc7uY=; b=CdIMh46hq5dhkrSiFdTFxYlbydbLl1jVd9tqelqhuBpZ4Tkg31vjN4hb+7nPF/8px0 s13jXFNI580XkBYXGjZLhEsT+s8wBWIWNYM5F6evEtxa8qPGYxhyPCGCbmWBWVkNYfOo AmSbXlcPV/dSNGQawtEbpu+PmeJot+qjqZsGqb0wgwZdXQqyH03SeOLArr/83eslR3So E2kB5eMD9c/TR/BW37G7GTwJ6F2mDta+HX4cO+98ZV/EiTB0DXFOKoHQaP1A1xTWY4nV YgJwFZw7S1u5DlGjnonTftZ9pM6b64sU8FoDUPsQxDs9hx796gXV2dhAJJqah1LjymQ1 uHpA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=NHlvoWuY; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id m13-20020a056402430d00b004619e210510si4810693edc.150.2022.12.07.14.03.58; Wed, 07 Dec 2022 14:04:23 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=NHlvoWuY; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230011AbiLGWBF (ORCPT + 74 others); Wed, 7 Dec 2022 17:01:05 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43250 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229983AbiLGWAe (ORCPT ); Wed, 7 Dec 2022 17:00:34 -0500 Received: from mx0a-0031df01.pphosted.com (mx0a-0031df01.pphosted.com [205.220.168.131]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A2AE385663; Wed, 7 Dec 2022 14:00:30 -0800 (PST) Received: from pps.filterd (m0279863.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 2B7LTALC017780; Wed, 7 Dec 2022 22:00:25 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-type; s=qcppdkim1; bh=VQC4nPKO9pFOGSOkNuHOYewDGLmoGdtZo5RvIdCc7uY=; b=NHlvoWuYqk0bk4YRbOJErjLRnz/IsbeDjdSSxi0C067QAbWyWxEUC1j5ZTMcQyUGmDCY 8ekf5tadABb2hA6dGENPWHm0a+oSlgxtLSY5rIDFAVILUd+FVrhPIMy05GUgCzQOA23b o/1B93kzinPfPmJUJcYXqYaSUBKzDAmeEPJ8iAgBEn+4XaXGJyNkghXeHXuGiTHivboV CFSEGFOQRGYkBTZEawIWtU/AKxv9a2NwDhyra4PX/BDUNEXulzK33LgFSTdk3K74OhNF 4t2xL567Hnfxs6mbFc+9En35nIB9/X8NaE8fvbgGeEq5Lx4H2CBA4GQGCnWEgB/WpYgt gQ== Received: from nalasppmta05.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3mavtf12x2-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 07 Dec 2022 22:00:25 +0000 Received: from nalasex01c.na.qualcomm.com (nalasex01c.na.qualcomm.com [10.47.97.35]) by NALASPPMTA05.qualcomm.com (8.17.1.5/8.17.1.5) with ESMTPS id 2B7M0OYR009343 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 7 Dec 2022 22:00:24 GMT Received: from th-lint-050.qualcomm.com (10.80.80.8) by nalasex01c.na.qualcomm.com (10.47.97.35) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.36; Wed, 7 Dec 2022 14:00:23 -0800 From: Bjorn Andersson To: Dmitry Baryshkov CC: Rob Clark , Abhinav Kumar , Sean Paul , David Airlie , Daniel Vetter , Rob Herring , Krzysztof Kozlowski , Bjorn Andersson , Konrad Dybcio , Kalyan Thota , Jessica Zhang , "Kuogee Hsieh" , Johan Hovold , Sankeerth Billakanti , , , , , Subject: [PATCH v5 09/12] drm/msm/dp: Implement hpd_notify() Date: Wed, 7 Dec 2022 14:00:09 -0800 Message-ID: <20221207220012.16529-10-quic_bjorande@quicinc.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20221207220012.16529-1-quic_bjorande@quicinc.com> References: <20221207220012.16529-1-quic_bjorande@quicinc.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.80.80.8] X-ClientProxiedBy: nasanex01b.na.qualcomm.com (10.46.141.250) To nalasex01c.na.qualcomm.com (10.47.97.35) X-QCInternal: smtphost X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=5800 signatures=585085 X-Proofpoint-GUID: -8AgH90roarJkqD18ztlyUH_PNdFJ_ab X-Proofpoint-ORIG-GUID: -8AgH90roarJkqD18ztlyUH_PNdFJ_ab X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.923,Hydra:6.0.545,FMLib:17.11.122.1 definitions=2022-12-07_11,2022-12-07_01,2022-06-22_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 impostorscore=0 lowpriorityscore=0 suspectscore=0 mlxscore=0 mlxlogscore=999 malwarescore=0 clxscore=1015 adultscore=0 spamscore=0 phishscore=0 bulkscore=0 priorityscore=1501 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2210170000 definitions=main-2212070186 X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_LOW,SPF_HELO_NONE, SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Bjorn Andersson The DisplayPort controller's hot-plug mechanism is based on pinmuxing a physical signal on a GPIO pin into the controller. This is not always possible, either because there aren't dedicated GPIOs available or because the hot-plug signal is a virtual notification, in cases such as USB Type-C. For these cases, by implementing the hpd_notify() callback for the DisplayPort controller's drm_bridge, a downstream drm_bridge (next_bridge) can be used to track and signal the connection status changes. This makes it possible to use downstream drm_bridges such as display-connector or any virtual mechanism, as long as they are implemented as a drm_bridge. Signed-off-by: Bjorn Andersson [bjorn: Drop connector->fwnode assignment and dev from struct msm_dp] Signed-off-by: Bjorn Andersson Reviewed-by: Dmitry Baryshkov --- Changes since v4: - Look at internal_hpd now that it's introduced before this patch. drivers/gpu/drm/msm/dp/dp_display.c | 22 ++++++++++++++++++++++ drivers/gpu/drm/msm/dp/dp_drm.c | 1 + drivers/gpu/drm/msm/dp/dp_drm.h | 2 ++ 3 files changed, 25 insertions(+) diff --git a/drivers/gpu/drm/msm/dp/dp_display.c b/drivers/gpu/drm/msm/dp/dp_display.c index 095adf528e43..0bee412603fe 100644 --- a/drivers/gpu/drm/msm/dp/dp_display.c +++ b/drivers/gpu/drm/msm/dp/dp_display.c @@ -1792,3 +1792,25 @@ void dp_bridge_hpd_disable(struct drm_bridge *bridge) dp_display->internal_hpd = false; } + +void dp_bridge_hpd_notify(struct drm_bridge *bridge, + enum drm_connector_status status) +{ + struct msm_dp_bridge *dp_bridge = to_dp_bridge(bridge); + struct msm_dp *dp_display = dp_bridge->dp_display; + struct dp_display_private *dp = container_of(dp_display, struct dp_display_private, dp_display); + + /* Without next_bridge interrupts are handled by the DP core directly */ + if (dp_display->internal_hpd) + return; + + if (!dp->core_initialized) { + drm_dbg_dp(dp->drm_dev, "not initialized\n"); + return; + } + + if (!dp_display->is_connected && status == connector_status_connected) + dp_add_event(dp, EV_HPD_PLUG_INT, 0, 0); + else if (dp_display->is_connected && status == connector_status_disconnected) + dp_add_event(dp, EV_HPD_UNPLUG_INT, 0, 0); +} diff --git a/drivers/gpu/drm/msm/dp/dp_drm.c b/drivers/gpu/drm/msm/dp/dp_drm.c index 9d03b6ee3c41..275370f21115 100644 --- a/drivers/gpu/drm/msm/dp/dp_drm.c +++ b/drivers/gpu/drm/msm/dp/dp_drm.c @@ -104,6 +104,7 @@ static const struct drm_bridge_funcs dp_bridge_ops = { .atomic_check = dp_bridge_atomic_check, .hpd_enable = dp_bridge_hpd_enable, .hpd_disable = dp_bridge_hpd_disable, + .hpd_notify = dp_bridge_hpd_notify, }; struct drm_bridge *dp_bridge_init(struct msm_dp *dp_display, struct drm_device *dev, diff --git a/drivers/gpu/drm/msm/dp/dp_drm.h b/drivers/gpu/drm/msm/dp/dp_drm.h index 1f871b555006..250f7c66201f 100644 --- a/drivers/gpu/drm/msm/dp/dp_drm.h +++ b/drivers/gpu/drm/msm/dp/dp_drm.h @@ -34,5 +34,7 @@ void dp_bridge_mode_set(struct drm_bridge *drm_bridge, const struct drm_display_mode *adjusted_mode); void dp_bridge_hpd_enable(struct drm_bridge *bridge); void dp_bridge_hpd_disable(struct drm_bridge *bridge); +void dp_bridge_hpd_notify(struct drm_bridge *bridge, + enum drm_connector_status status); #endif /* _DP_DRM_H_ */ -- 2.37.3