From patchwork Wed Oct 26 03:26:19 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bjorn Andersson X-Patchwork-Id: 11052 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp32885wru; Tue, 25 Oct 2022 20:29:29 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4ED+RB8B9PeAyq/mhAA8B6v6k5kIFKZbOyO85OK6v0FlX9LZWgVyVR1h4iIJQd74OO89Gt X-Received: by 2002:a17:90b:4d92:b0:213:48e0:8611 with SMTP id oj18-20020a17090b4d9200b0021348e08611mr1856418pjb.212.1666754969249; Tue, 25 Oct 2022 20:29:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666754969; cv=none; d=google.com; s=arc-20160816; b=kdYiXpkvv7Qp9A7JJ2sCYPPz3J4pLm5TveGfSXAfXEFQSYzUt+nok4mdSed7fkVywh nhtYa5RxOjx19Xvi4FGCHNrNP0dKnGIm/cADqfDA792hPCh+yn5im04sQ3YiGqJhisHH 0N+W+go0IQyebyB0PcyDezVqEtzEitaAcMXjPMTJDjywSJ1V4fVg1937jQPntJa5PC5J d4FHliPiDQsyWlUTKk1oKhH7T4ZMsY1fkafPQxrMFcpNPe4LS/V5NJzUKUVrPpBWEs7g Jn9KK8tr2DThhizT5XtJVhZetkVK1E+AysgTprN1iMumDARNCYGvBm6oZL08r8IQce/u t+wA== 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=LyVIrY3tJ2qqOaCkzXC1eFEMMZgK5KC0maZFvChrtp0=; b=oMzuSNqnNJ3nTsR7yvmak7am/Hz8whaTwpTwoTFVOpmWxBdVIhY0JF8mBtD4woPK4Z C/3BH8H0XVRQvGrvkM9TqpwTdLLMDNb2rAsf8yDEhJNPOgQfq9GN3bZOtSW2UZ5czls+ klgstPZHsJg13su6WIORKf8GSfMjcmRLCuQBUCLOnRwIU+ULg8pJfwo8aBzVORNvj1V4 xO8nr4pDBSec5j3w2tu0/uYzrT9zi2h1KLVsLWQ7QxdUdRQ5EevASvgKU87JLgvD3eyi i9nL+TZYViFqbMUb6ayw4047wPs2WqIctloHWyN8y41CyB59uNi31nG0dmzaCI2hVeX7 fpHQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=ZgAWRrVc; 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: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id d2-20020a056a0024c200b0056c45eb2147si2075376pfv.51.2022.10.25.20.29.16; Tue, 25 Oct 2022 20:29:29 -0700 (PDT) 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=ZgAWRrVc; 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 S232903AbiJZD1K (ORCPT + 99 others); Tue, 25 Oct 2022 23:27:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37978 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232678AbiJZD0o (ORCPT ); Tue, 25 Oct 2022 23:26:44 -0400 Received: from mx0b-0031df01.pphosted.com (mx0b-0031df01.pphosted.com [205.220.180.131]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B6A356BD60; Tue, 25 Oct 2022 20:26:42 -0700 (PDT) Received: from pps.filterd (m0279873.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.17.1.5/8.17.1.5) with ESMTP id 29Q3Hgiw004785; Wed, 26 Oct 2022 03:26:36 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=LyVIrY3tJ2qqOaCkzXC1eFEMMZgK5KC0maZFvChrtp0=; b=ZgAWRrVc1zskg5TiEFeneeAHTQokDu/leHNnwYRHM9GmvSXAFFwlVL+NgqNALTtCOq8i Nqzy9lzpazcHdSfqoQacIY5st/BL7LkIVd6/j9Y9MIj4dkdmqwcrWIy0mlzU4S3030R8 lZ05qTjlQ42N3tVKcAvP8c5ZY2QukQoeItu3gUgX1nG6Oz5AoWa01XbZD4oqv5dZPP6I z5IPc5neDEOZlO9bH5S+sUrxUX09yrofHvp3EfXzGr2ezApK7tCNycq9tvmvn+plxuXf NqWo/ybmF0BImBuKLHqG3rW//3RPXqaPIiDU7BbbliGeECRq7eAWy5MnMRANBFz8Vnuy hA== Received: from nalasppmta04.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3kebkdj40f-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 26 Oct 2022 03:26:36 +0000 Received: from nalasex01c.na.qualcomm.com (nalasex01c.na.qualcomm.com [10.47.97.35]) by NALASPPMTA04.qualcomm.com (8.17.1.5/8.17.1.5) with ESMTPS id 29Q3QZ52030215 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 26 Oct 2022 03:26:35 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.29; Tue, 25 Oct 2022 20:26:34 -0700 From: Bjorn Andersson To: Rob Clark , Abhinav Kumar , Dmitry Baryshkov CC: Sean Paul , David Airlie , "Daniel Vetter" , Rob Herring , "Krzysztof Kozlowski" , Bjorn Andersson , Konrad Dybcio , "Kuogee Hsieh" , Sankeerth Billakanti , Johan Hovold , , , , , Subject: [PATCH v3 07/12] drm/msm/dp: Implement hpd_notify() Date: Tue, 25 Oct 2022 20:26:19 -0700 Message-ID: <20221026032624.30871-8-quic_bjorande@quicinc.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20221026032624.30871-1-quic_bjorande@quicinc.com> References: <20221026032624.30871-1-quic_bjorande@quicinc.com> MIME-Version: 1.0 X-Originating-IP: [10.80.80.8] X-ClientProxiedBy: nasanex01a.na.qualcomm.com (10.52.223.231) 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: ChgHosFiuTC_zzMSt6BgZwXmdm2x-9jh X-Proofpoint-ORIG-GUID: ChgHosFiuTC_zzMSt6BgZwXmdm2x-9jh X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.895,Hydra:6.0.545,FMLib:17.11.122.1 definitions=2022-10-25_15,2022-10-25_01,2022-06-22_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 adultscore=0 mlxlogscore=999 priorityscore=1501 spamscore=0 suspectscore=0 phishscore=0 bulkscore=0 malwarescore=0 lowpriorityscore=0 impostorscore=0 clxscore=1015 mlxscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2209130000 definitions=main-2210260016 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,URIBL_BLOCKED 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747719258841596042?= X-GMAIL-MSGID: =?utf-8?q?1747719258841596042?= 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 --- Changes since v2: - Fixed spelling of "on a GPIO" in commit message 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 699f28f2251e..a4563a0753b0 100644 --- a/drivers/gpu/drm/msm/dp/dp_display.c +++ b/drivers/gpu/drm/msm/dp/dp_display.c @@ -1765,3 +1765,25 @@ void dp_bridge_mode_set(struct drm_bridge *drm_bridge, dp_display->dp_mode.h_active_low = !!(dp_display->dp_mode.drm_mode.flags & DRM_MODE_FLAG_NHSYNC); } + +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->next_bridge) + 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 6df25f7662e7..1a02ec029fdd 100644 --- a/drivers/gpu/drm/msm/dp/dp_drm.c +++ b/drivers/gpu/drm/msm/dp/dp_drm.c @@ -68,6 +68,7 @@ static const struct drm_bridge_funcs dp_bridge_ops = { .mode_valid = dp_bridge_mode_valid, .get_modes = dp_bridge_get_modes, .detect = dp_bridge_detect, + .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 82035dbb0578..79e6b2cf2d25 100644 --- a/drivers/gpu/drm/msm/dp/dp_drm.h +++ b/drivers/gpu/drm/msm/dp/dp_drm.h @@ -32,5 +32,7 @@ enum drm_mode_status dp_bridge_mode_valid(struct drm_bridge *bridge, void dp_bridge_mode_set(struct drm_bridge *drm_bridge, const struct drm_display_mode *mode, const struct drm_display_mode *adjusted_mode); +void dp_bridge_hpd_notify(struct drm_bridge *bridge, + enum drm_connector_status status); #endif /* _DP_DRM_H_ */