Message ID | 1694813901-26952-2-git-send-email-quic_khsieh@quicinc.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:172:b0:3f2:4152:657d with SMTP id h50csp1494393vqi; Fri, 15 Sep 2023 22:46:30 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEzYVs2nunMQYTVkuWKEgJW9gB0vNuSwsLtCt+q1q3UvZxgij924kzuoCXinmTkcKfxVZaw X-Received: by 2002:a05:6a20:a127:b0:15a:290:d83d with SMTP id q39-20020a056a20a12700b0015a0290d83dmr4363101pzk.41.1694843190239; Fri, 15 Sep 2023 22:46:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1694843190; cv=none; d=google.com; s=arc-20160816; b=okTJmvflF8DSPttDw1CME+1nJLZXkBAixu5gjg+VIt8zL8tz7/Q4yMqiCrLlSzS6bD 5BUk60E+y/kCQGd3MpEHe5pRLxBS0pshhD96HhMgj0g8909gr2b2LU13eSJe7CUge/CI NA55iwabJ/8tGwV84EljS05/OQGw7XWOh7vY826X/+VbOcQPi/Lktqk7spzzlc4nhGSq Fsf1/EiyHEkh1Mvb1YIVsKdhLEcApacnhofSfsFXuGLteJQUn01EvH8HOavvB4kVgBCE t0VNA96+QPsYz69bw4k/RexJ4pCprCPs8kHNVerljmhpluLYoriae9CC1DMFZjnbsOcO tzIA== 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=P1oGUFuxb73yOXKQ5NYHmRx7z6WC8IEDuXMifT614u0=; fh=WdvorNt9W2LCUPiGPsn75/bW5381IkpXRxF82JgZV7c=; b=GDV+UrrHivgblUOxC4HlPyyDvpgaGyOQTseb4uMDN2LXEIVmcUr1vngcoQTlkQBCxv LhGXY5uLh6rjgBQxpQdB+oAbcwkd6EhABHkObtb9qmPexE9LLTNINrAKW5wk5pSXLly4 kgSLwYWwlpIZghf/cqR57mw7mLYW4tN7tD6vzsVebbKrg7J6BdYb4kgZuTtV+2NgZ/gb 8JZouq5skq0B7r/6sN/WylN1fvnlfXgBtnPi0iJl3aqruDp3w68s5vJELrP03FzsXD3J 2a7rYJmzUJz3NKjh2RviBgX4LSLGaX3t6fffVj6VSK5HmtR1U/30wvfKJzxpnyrfHoJ7 iqeQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=LkUooMz0; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 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 howler.vger.email (howler.vger.email. [23.128.96.34]) by mx.google.com with ESMTPS id b15-20020a170903228f00b001a6ef92d441si4782312plh.599.2023.09.15.22.46.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 15 Sep 2023 22:46:30 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) client-ip=23.128.96.34; Authentication-Results: mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=LkUooMz0; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 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 (depot.vger.email [IPv6:2620:137:e000::3:0]) by howler.vger.email (Postfix) with ESMTP id 7C92A858B02F; Fri, 15 Sep 2023 14:39:52 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at howler.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237846AbjIOVjW (ORCPT <rfc822;realc9580@gmail.com> + 29 others); Fri, 15 Sep 2023 17:39:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60884 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237452AbjIOViy (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Fri, 15 Sep 2023 17:38:54 -0400 Received: from mx0b-0031df01.pphosted.com (mx0b-0031df01.pphosted.com [205.220.180.131]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 10E9EB8; Fri, 15 Sep 2023 14:38:49 -0700 (PDT) Received: from pps.filterd (m0279868.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 38FLVqUn019278; Fri, 15 Sep 2023 21:38:39 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=P1oGUFuxb73yOXKQ5NYHmRx7z6WC8IEDuXMifT614u0=; b=LkUooMz0Z+CBILyJ0eH/aPRRyaLd+jTPweGDEt+VQLSBkfQ1I43xiaC+FRyXkVAw22Ew XfWB3rFG/hvbGAaVJfuFj/HpI2uKFqIW67i3mfVZxU4Kn6zvNIC8GcItbyDFlrjkM0+0 I7YRkYfPb+Zc5tbX+tStD8u2dK/n/UHZzPvDFHhKP5CMAy11Jn6GDvb664zR33nVLT8s usgmYjE4PwyKk66A1m96B0ByMFBNmO+XUTrf0Yz9eUfeuLOQmfFGimi4M/HbTPNuJ6uH BK/2eVueir1EJcTJOb8UPaJcUozhaTTobtxVvqFjsSlCfcQ/tqf88klartaihPWVTyU4 AQ== Received: from nalasppmta03.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3t4g5tj5xv-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 15 Sep 2023 21:38:39 +0000 Received: from nalasex01a.na.qualcomm.com (nalasex01a.na.qualcomm.com [10.47.209.196]) by NALASPPMTA03.qualcomm.com (8.17.1.5/8.17.1.5) with ESMTPS id 38FLccS7024814 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 15 Sep 2023 21:38:38 GMT Received: from khsieh-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.1118.36; Fri, 15 Sep 2023 14:38:37 -0700 From: Kuogee Hsieh <quic_khsieh@quicinc.com> To: <dri-devel@lists.freedesktop.org>, <robdclark@gmail.com>, <sean@poorly.run>, <swboyd@chromium.org>, <dianders@chromium.org>, <vkoul@kernel.org>, <daniel@ffwll.ch>, <airlied@gmail.com>, <agross@kernel.org>, <dmitry.baryshkov@linaro.org>, <andersson@kernel.org> CC: Kuogee Hsieh <quic_khsieh@quicinc.com>, <quic_abhinavk@quicinc.com>, <quic_jesszhan@quicinc.com>, <quic_sbillaka@quicinc.com>, <marijn.suijten@somainline.org>, <freedreno@lists.freedesktop.org>, <linux-arm-msm@vger.kernel.org>, <linux-kernel@vger.kernel.org> Subject: [PATCH v3 1/7] drm/msm/dp: tie dp_display_irq_handler() with dp driver Date: Fri, 15 Sep 2023 14:38:15 -0700 Message-ID: <1694813901-26952-2-git-send-email-quic_khsieh@quicinc.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1694813901-26952-1-git-send-email-quic_khsieh@quicinc.com> References: <1694813901-26952-1-git-send-email-quic_khsieh@quicinc.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.80.80.8] X-ClientProxiedBy: nasanex01a.na.qualcomm.com (10.52.223.231) 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: _ben7jJ7ASmqDW4uraRYS-b5CAs7cBUu X-Proofpoint-GUID: _ben7jJ7ASmqDW4uraRYS-b5CAs7cBUu X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.267,Aquarius:18.0.980,Hydra:6.0.601,FMLib:17.11.176.26 definitions=2023-09-15_17,2023-09-15_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 bulkscore=0 malwarescore=0 suspectscore=0 lowpriorityscore=0 impostorscore=0 phishscore=0 mlxlogscore=999 priorityscore=1501 adultscore=0 mlxscore=0 spamscore=0 clxscore=1015 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2308100000 definitions=main-2309150194 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_BLOCKED, 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: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (howler.vger.email [0.0.0.0]); Fri, 15 Sep 2023 14:39:52 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1777163980088234881 X-GMAIL-MSGID: 1777171893073808606 |
Series |
incorporate pm runtime framework and eDP clean up
|
|
Commit Message
Kuogee Hsieh
Sept. 15, 2023, 9:38 p.m. UTC
Currently the dp_display_irq_handler() is executed at msm_dp_modeset_init()
which ties irq registration to the DPU device's life cycle, while depending on
resources that are released as the DP device is torn down. Move register DP
driver irq handler at dp_display_probe() to have dp_display_irq_handler()
is tied with DP device.
Changes in v3:
-- move calling dp_display_irq_handler() to probe
Signed-off-by: Kuogee Hsieh <quic_khsieh@quicinc.com>
---
drivers/gpu/drm/msm/dp/dp_display.c | 35 +++++++++++++----------------------
drivers/gpu/drm/msm/dp/dp_display.h | 1 -
2 files changed, 13 insertions(+), 23 deletions(-)
Comments
On 9/15/2023 5:29 PM, Dmitry Baryshkov wrote: > On Sat, 16 Sept 2023 at 00:38, Kuogee Hsieh <quic_khsieh@quicinc.com> wrote: >> Currently the dp_display_irq_handler() is executed at msm_dp_modeset_init() >> which ties irq registration to the DPU device's life cycle, while depending on >> resources that are released as the DP device is torn down. Move register DP >> driver irq handler at dp_display_probe() to have dp_display_irq_handler() >> is tied with DP device. >> >> Changes in v3: >> -- move calling dp_display_irq_handler() to probe > Was there a changelog for the previous reivions? What is the > difference between v1 and v2? Sorry, v2 is same as v3. I submitted v2 first but found i forget to add change logs from review comments of v1. Therefore i submit v3 to add changes logs which missing at v2. > >> Signed-off-by: Kuogee Hsieh <quic_khsieh@quicinc.com> >> --- >> drivers/gpu/drm/msm/dp/dp_display.c | 35 +++++++++++++---------------------- >> drivers/gpu/drm/msm/dp/dp_display.h | 1 - >> 2 files changed, 13 insertions(+), 23 deletions(-) >> >> diff --git a/drivers/gpu/drm/msm/dp/dp_display.c b/drivers/gpu/drm/msm/dp/dp_display.c >> index 76f1395..c217430 100644 >> --- a/drivers/gpu/drm/msm/dp/dp_display.c >> +++ b/drivers/gpu/drm/msm/dp/dp_display.c >> @@ -1193,30 +1193,23 @@ static irqreturn_t dp_display_irq_handler(int irq, void *dev_id) >> return ret; >> } >> >> -int dp_display_request_irq(struct msm_dp *dp_display) >> +static int dp_display_request_irq(struct dp_display_private *dp) >> { >> int rc = 0; >> - struct dp_display_private *dp; >> - >> - if (!dp_display) { >> - DRM_ERROR("invalid input\n"); >> - return -EINVAL; >> - } >> - >> - dp = container_of(dp_display, struct dp_display_private, dp_display); >> + struct device *dev = &dp->pdev->dev; >> >> - dp->irq = irq_of_parse_and_map(dp->pdev->dev.of_node, 0); >> if (!dp->irq) { > What is the point in this check? > >> - DRM_ERROR("failed to get irq\n"); >> - return -EINVAL; >> + dp->irq = platform_get_irq(dp->pdev, 0); >> + if (!dp->irq) { >> + DRM_ERROR("failed to get irq\n"); >> + return -EINVAL; >> + } >> } >> >> - rc = devm_request_irq(dp_display->drm_dev->dev, dp->irq, >> - dp_display_irq_handler, >> + rc = devm_request_irq(dev, dp->irq, dp_display_irq_handler, >> IRQF_TRIGGER_HIGH, "dp_display_isr", dp); >> if (rc < 0) { >> - DRM_ERROR("failed to request IRQ%u: %d\n", >> - dp->irq, rc); >> + DRM_ERROR("failed to request IRQ%u: %d\n", dp->irq, rc); >> return rc; >> } >> >> @@ -1287,6 +1280,10 @@ static int dp_display_probe(struct platform_device *pdev) >> >> platform_set_drvdata(pdev, &dp->dp_display); >> >> + rc = dp_display_request_irq(dp); >> + if (rc) >> + return rc; > This way the IRQ ends up being enabled in _probe. Are we ready to > handle it here? Is the DP device fully setup at this moment? > >> + >> rc = component_add(&pdev->dev, &dp_display_comp_ops); >> if (rc) { >> DRM_ERROR("component add failed, rc=%d\n", rc); >> @@ -1549,12 +1546,6 @@ int msm_dp_modeset_init(struct msm_dp *dp_display, struct drm_device *dev, >> >> dp_priv = container_of(dp_display, struct dp_display_private, dp_display); >> >> - ret = dp_display_request_irq(dp_display); >> - if (ret) { >> - DRM_ERROR("request_irq failed, ret=%d\n", ret); >> - return ret; >> - } >> - >> ret = dp_display_get_next_bridge(dp_display); >> if (ret) >> return ret; >> diff --git a/drivers/gpu/drm/msm/dp/dp_display.h b/drivers/gpu/drm/msm/dp/dp_display.h >> index 1e9415a..b3c08de 100644 >> --- a/drivers/gpu/drm/msm/dp/dp_display.h >> +++ b/drivers/gpu/drm/msm/dp/dp_display.h >> @@ -35,7 +35,6 @@ struct msm_dp { >> int dp_display_set_plugged_cb(struct msm_dp *dp_display, >> hdmi_codec_plugged_cb fn, struct device *codec_dev); >> int dp_display_get_modes(struct msm_dp *dp_display); >> -int dp_display_request_irq(struct msm_dp *dp_display); >> bool dp_display_check_video_test(struct msm_dp *dp_display); >> int dp_display_get_test_bpp(struct msm_dp *dp_display); >> void dp_display_signal_audio_start(struct msm_dp *dp_display); >> -- >> 2.7.4 >> >
On Mon, 18 Sept 2023 at 20:03, Kuogee Hsieh <quic_khsieh@quicinc.com> wrote: > > > On 9/15/2023 5:29 PM, Dmitry Baryshkov wrote: > > On Sat, 16 Sept 2023 at 00:38, Kuogee Hsieh <quic_khsieh@quicinc.com> wrote: > >> Currently the dp_display_irq_handler() is executed at msm_dp_modeset_init() > >> which ties irq registration to the DPU device's life cycle, while depending on > >> resources that are released as the DP device is torn down. Move register DP > >> driver irq handler at dp_display_probe() to have dp_display_irq_handler() > >> is tied with DP device. > >> > >> Changes in v3: > >> -- move calling dp_display_irq_handler() to probe > > Was there a changelog for the previous reivions? What is the > > difference between v1 and v2? > > Sorry, v2 is same as v3. > > I submitted v2 first but found i forget to add change logs from review > comments of v1. > > Therefore i submit v3 to add changes logs which missing at v2. This doesn't consist of a change. It should have been a RESEND or just responding with the changelog. V3 means new revision. > > > > > > >> Signed-off-by: Kuogee Hsieh <quic_khsieh@quicinc.com> > >> --- > >> drivers/gpu/drm/msm/dp/dp_display.c | 35 +++++++++++++---------------------- > >> drivers/gpu/drm/msm/dp/dp_display.h | 1 - > >> 2 files changed, 13 insertions(+), 23 deletions(-) > >> > >> diff --git a/drivers/gpu/drm/msm/dp/dp_display.c b/drivers/gpu/drm/msm/dp/dp_display.c > >> index 76f1395..c217430 100644 > >> --- a/drivers/gpu/drm/msm/dp/dp_display.c > >> +++ b/drivers/gpu/drm/msm/dp/dp_display.c > >> @@ -1193,30 +1193,23 @@ static irqreturn_t dp_display_irq_handler(int irq, void *dev_id) > >> return ret; > >> } > >> > >> -int dp_display_request_irq(struct msm_dp *dp_display) > >> +static int dp_display_request_irq(struct dp_display_private *dp) > >> { > >> int rc = 0; > >> - struct dp_display_private *dp; > >> - > >> - if (!dp_display) { > >> - DRM_ERROR("invalid input\n"); > >> - return -EINVAL; > >> - } > >> - > >> - dp = container_of(dp_display, struct dp_display_private, dp_display); > >> + struct device *dev = &dp->pdev->dev; > >> > >> - dp->irq = irq_of_parse_and_map(dp->pdev->dev.of_node, 0); > >> if (!dp->irq) { > > What is the point in this check? > > > >> - DRM_ERROR("failed to get irq\n"); > >> - return -EINVAL; > >> + dp->irq = platform_get_irq(dp->pdev, 0); > >> + if (!dp->irq) { > >> + DRM_ERROR("failed to get irq\n"); > >> + return -EINVAL; > >> + } > >> } > >> > >> - rc = devm_request_irq(dp_display->drm_dev->dev, dp->irq, > >> - dp_display_irq_handler, > >> + rc = devm_request_irq(dev, dp->irq, dp_display_irq_handler, > >> IRQF_TRIGGER_HIGH, "dp_display_isr", dp); > >> if (rc < 0) { > >> - DRM_ERROR("failed to request IRQ%u: %d\n", > >> - dp->irq, rc); > >> + DRM_ERROR("failed to request IRQ%u: %d\n", dp->irq, rc); > >> return rc; > >> } > >> > >> @@ -1287,6 +1280,10 @@ static int dp_display_probe(struct platform_device *pdev) > >> > >> platform_set_drvdata(pdev, &dp->dp_display); > >> > >> + rc = dp_display_request_irq(dp); > >> + if (rc) > >> + return rc; > > This way the IRQ ends up being enabled in _probe. Are we ready to > > handle it here? Is the DP device fully setup at this moment? > > > >> + > >> rc = component_add(&pdev->dev, &dp_display_comp_ops); > >> if (rc) { > >> DRM_ERROR("component add failed, rc=%d\n", rc); > >> @@ -1549,12 +1546,6 @@ int msm_dp_modeset_init(struct msm_dp *dp_display, struct drm_device *dev, > >> > >> dp_priv = container_of(dp_display, struct dp_display_private, dp_display); > >> > >> - ret = dp_display_request_irq(dp_display); > >> - if (ret) { > >> - DRM_ERROR("request_irq failed, ret=%d\n", ret); > >> - return ret; > >> - } > >> - > >> ret = dp_display_get_next_bridge(dp_display); > >> if (ret) > >> return ret; > >> diff --git a/drivers/gpu/drm/msm/dp/dp_display.h b/drivers/gpu/drm/msm/dp/dp_display.h > >> index 1e9415a..b3c08de 100644 > >> --- a/drivers/gpu/drm/msm/dp/dp_display.h > >> +++ b/drivers/gpu/drm/msm/dp/dp_display.h > >> @@ -35,7 +35,6 @@ struct msm_dp { > >> int dp_display_set_plugged_cb(struct msm_dp *dp_display, > >> hdmi_codec_plugged_cb fn, struct device *codec_dev); > >> int dp_display_get_modes(struct msm_dp *dp_display); > >> -int dp_display_request_irq(struct msm_dp *dp_display); > >> bool dp_display_check_video_test(struct msm_dp *dp_display); > >> int dp_display_get_test_bpp(struct msm_dp *dp_display); > >> void dp_display_signal_audio_start(struct msm_dp *dp_display); > >> -- > >> 2.7.4 > >> > >
On 9/15/2023 5:29 PM, Dmitry Baryshkov wrote: > On Sat, 16 Sept 2023 at 00:38, Kuogee Hsieh <quic_khsieh@quicinc.com> wrote: >> Currently the dp_display_irq_handler() is executed at msm_dp_modeset_init() >> which ties irq registration to the DPU device's life cycle, while depending on >> resources that are released as the DP device is torn down. Move register DP >> driver irq handler at dp_display_probe() to have dp_display_irq_handler() >> is tied with DP device. >> >> Changes in v3: >> -- move calling dp_display_irq_handler() to probe > Was there a changelog for the previous reivions? What is the > difference between v1 and v2? > >> Signed-off-by: Kuogee Hsieh <quic_khsieh@quicinc.com> >> --- >> drivers/gpu/drm/msm/dp/dp_display.c | 35 +++++++++++++---------------------- >> drivers/gpu/drm/msm/dp/dp_display.h | 1 - >> 2 files changed, 13 insertions(+), 23 deletions(-) >> >> diff --git a/drivers/gpu/drm/msm/dp/dp_display.c b/drivers/gpu/drm/msm/dp/dp_display.c >> index 76f1395..c217430 100644 >> --- a/drivers/gpu/drm/msm/dp/dp_display.c >> +++ b/drivers/gpu/drm/msm/dp/dp_display.c >> @@ -1193,30 +1193,23 @@ static irqreturn_t dp_display_irq_handler(int irq, void *dev_id) >> return ret; >> } >> >> -int dp_display_request_irq(struct msm_dp *dp_display) >> +static int dp_display_request_irq(struct dp_display_private *dp) >> { >> int rc = 0; >> - struct dp_display_private *dp; >> - >> - if (!dp_display) { >> - DRM_ERROR("invalid input\n"); >> - return -EINVAL; >> - } >> - >> - dp = container_of(dp_display, struct dp_display_private, dp_display); >> + struct device *dev = &dp->pdev->dev; >> >> - dp->irq = irq_of_parse_and_map(dp->pdev->dev.of_node, 0); >> if (!dp->irq) { > What is the point in this check? > >> - DRM_ERROR("failed to get irq\n"); >> - return -EINVAL; >> + dp->irq = platform_get_irq(dp->pdev, 0); >> + if (!dp->irq) { >> + DRM_ERROR("failed to get irq\n"); >> + return -EINVAL; >> + } >> } >> >> - rc = devm_request_irq(dp_display->drm_dev->dev, dp->irq, >> - dp_display_irq_handler, >> + rc = devm_request_irq(dev, dp->irq, dp_display_irq_handler, >> IRQF_TRIGGER_HIGH, "dp_display_isr", dp); >> if (rc < 0) { >> - DRM_ERROR("failed to request IRQ%u: %d\n", >> - dp->irq, rc); >> + DRM_ERROR("failed to request IRQ%u: %d\n", dp->irq, rc); >> return rc; >> } >> >> @@ -1287,6 +1280,10 @@ static int dp_display_probe(struct platform_device *pdev) >> >> platform_set_drvdata(pdev, &dp->dp_display); >> >> + rc = dp_display_request_irq(dp); >> + if (rc) >> + return rc; > This way the IRQ ends up being enabled in _probe. Are we ready to > handle it here? Is the DP device fully setup at this moment? The irq is enabled here. but DP driver hpd hardware block has not yet be enabled. this means no irq will be delivered. .hpd_enable() will call pm_runtime_resume_and_get() and dp_catalog_ctrl_hpd_enable(). after .hpd_enable() irq will be delivered and handled properly. >> + >> rc = component_add(&pdev->dev, &dp_display_comp_ops); >> if (rc) { >> DRM_ERROR("component add failed, rc=%d\n", rc); >> @@ -1549,12 +1546,6 @@ int msm_dp_modeset_init(struct msm_dp *dp_display, struct drm_device *dev, >> >> dp_priv = container_of(dp_display, struct dp_display_private, dp_display); >> >> - ret = dp_display_request_irq(dp_display); >> - if (ret) { >> - DRM_ERROR("request_irq failed, ret=%d\n", ret); >> - return ret; >> - } >> - >> ret = dp_display_get_next_bridge(dp_display); >> if (ret) >> return ret; >> diff --git a/drivers/gpu/drm/msm/dp/dp_display.h b/drivers/gpu/drm/msm/dp/dp_display.h >> index 1e9415a..b3c08de 100644 >> --- a/drivers/gpu/drm/msm/dp/dp_display.h >> +++ b/drivers/gpu/drm/msm/dp/dp_display.h >> @@ -35,7 +35,6 @@ struct msm_dp { >> int dp_display_set_plugged_cb(struct msm_dp *dp_display, >> hdmi_codec_plugged_cb fn, struct device *codec_dev); >> int dp_display_get_modes(struct msm_dp *dp_display); >> -int dp_display_request_irq(struct msm_dp *dp_display); >> bool dp_display_check_video_test(struct msm_dp *dp_display); >> int dp_display_get_test_bpp(struct msm_dp *dp_display); >> void dp_display_signal_audio_start(struct msm_dp *dp_display); >> -- >> 2.7.4 >> >
On Sat, 23 Sept 2023 at 02:03, Kuogee Hsieh <quic_khsieh@quicinc.com> wrote: > > > On 9/15/2023 5:29 PM, Dmitry Baryshkov wrote: > > On Sat, 16 Sept 2023 at 00:38, Kuogee Hsieh <quic_khsieh@quicinc.com> wrote: > >> Currently the dp_display_irq_handler() is executed at msm_dp_modeset_init() > >> which ties irq registration to the DPU device's life cycle, while depending on > >> resources that are released as the DP device is torn down. Move register DP > >> driver irq handler at dp_display_probe() to have dp_display_irq_handler() > >> is tied with DP device. > >> > >> Changes in v3: > >> -- move calling dp_display_irq_handler() to probe > > Was there a changelog for the previous reivions? What is the > > difference between v1 and v2? > > > >> Signed-off-by: Kuogee Hsieh <quic_khsieh@quicinc.com> > >> --- > >> drivers/gpu/drm/msm/dp/dp_display.c | 35 +++++++++++++---------------------- > >> drivers/gpu/drm/msm/dp/dp_display.h | 1 - > >> 2 files changed, 13 insertions(+), 23 deletions(-) > >> > >> diff --git a/drivers/gpu/drm/msm/dp/dp_display.c b/drivers/gpu/drm/msm/dp/dp_display.c > >> index 76f1395..c217430 100644 > >> --- a/drivers/gpu/drm/msm/dp/dp_display.c > >> +++ b/drivers/gpu/drm/msm/dp/dp_display.c > >> @@ -1193,30 +1193,23 @@ static irqreturn_t dp_display_irq_handler(int irq, void *dev_id) > >> return ret; > >> } > >> > >> -int dp_display_request_irq(struct msm_dp *dp_display) > >> +static int dp_display_request_irq(struct dp_display_private *dp) > >> { > >> int rc = 0; > >> - struct dp_display_private *dp; > >> - > >> - if (!dp_display) { > >> - DRM_ERROR("invalid input\n"); > >> - return -EINVAL; > >> - } > >> - > >> - dp = container_of(dp_display, struct dp_display_private, dp_display); > >> + struct device *dev = &dp->pdev->dev; > >> > >> - dp->irq = irq_of_parse_and_map(dp->pdev->dev.of_node, 0); > >> if (!dp->irq) { > > What is the point in this check? > > > >> - DRM_ERROR("failed to get irq\n"); > >> - return -EINVAL; > >> + dp->irq = platform_get_irq(dp->pdev, 0); > >> + if (!dp->irq) { > >> + DRM_ERROR("failed to get irq\n"); > >> + return -EINVAL; > >> + } > >> } > >> > >> - rc = devm_request_irq(dp_display->drm_dev->dev, dp->irq, > >> - dp_display_irq_handler, > >> + rc = devm_request_irq(dev, dp->irq, dp_display_irq_handler, > >> IRQF_TRIGGER_HIGH, "dp_display_isr", dp); > >> if (rc < 0) { > >> - DRM_ERROR("failed to request IRQ%u: %d\n", > >> - dp->irq, rc); > >> + DRM_ERROR("failed to request IRQ%u: %d\n", dp->irq, rc); > >> return rc; > >> } > >> > >> @@ -1287,6 +1280,10 @@ static int dp_display_probe(struct platform_device *pdev) > >> > >> platform_set_drvdata(pdev, &dp->dp_display); > >> > >> + rc = dp_display_request_irq(dp); > >> + if (rc) > >> + return rc; > > This way the IRQ ends up being enabled in _probe. Are we ready to > > handle it here? Is the DP device fully setup at this moment? > > The irq is enabled here. > > but DP driver hpd hardware block has not yet be enabled. this means no > irq will be delivered. There are other IRQ kinds, not only just HPD ones. > > .hpd_enable() will call pm_runtime_resume_and_get() and > dp_catalog_ctrl_hpd_enable(). > > after .hpd_enable() irq will be delivered and handled properly. > > > > >> + > >> rc = component_add(&pdev->dev, &dp_display_comp_ops); > >> if (rc) { > >> DRM_ERROR("component add failed, rc=%d\n", rc); > >> @@ -1549,12 +1546,6 @@ int msm_dp_modeset_init(struct msm_dp *dp_display, struct drm_device *dev, > >> > >> dp_priv = container_of(dp_display, struct dp_display_private, dp_display); > >> > >> - ret = dp_display_request_irq(dp_display); > >> - if (ret) { > >> - DRM_ERROR("request_irq failed, ret=%d\n", ret); > >> - return ret; > >> - } > >> - > >> ret = dp_display_get_next_bridge(dp_display); > >> if (ret) > >> return ret; > >> diff --git a/drivers/gpu/drm/msm/dp/dp_display.h b/drivers/gpu/drm/msm/dp/dp_display.h > >> index 1e9415a..b3c08de 100644 > >> --- a/drivers/gpu/drm/msm/dp/dp_display.h > >> +++ b/drivers/gpu/drm/msm/dp/dp_display.h > >> @@ -35,7 +35,6 @@ struct msm_dp { > >> int dp_display_set_plugged_cb(struct msm_dp *dp_display, > >> hdmi_codec_plugged_cb fn, struct device *codec_dev); > >> int dp_display_get_modes(struct msm_dp *dp_display); > >> -int dp_display_request_irq(struct msm_dp *dp_display); > >> bool dp_display_check_video_test(struct msm_dp *dp_display); > >> int dp_display_get_test_bpp(struct msm_dp *dp_display); > >> void dp_display_signal_audio_start(struct msm_dp *dp_display); > >> -- > >> 2.7.4 > >> > >
On 9/23/2023 11:45 AM, Dmitry Baryshkov wrote: > On Sat, 23 Sept 2023 at 02:03, Kuogee Hsieh <quic_khsieh@quicinc.com> wrote: >> >> On 9/15/2023 5:29 PM, Dmitry Baryshkov wrote: >>> On Sat, 16 Sept 2023 at 00:38, Kuogee Hsieh <quic_khsieh@quicinc.com> wrote: >>>> Currently the dp_display_irq_handler() is executed at msm_dp_modeset_init() >>>> which ties irq registration to the DPU device's life cycle, while depending on >>>> resources that are released as the DP device is torn down. Move register DP >>>> driver irq handler at dp_display_probe() to have dp_display_irq_handler() >>>> is tied with DP device. >>>> >>>> Changes in v3: >>>> -- move calling dp_display_irq_handler() to probe >>> Was there a changelog for the previous reivions? What is the >>> difference between v1 and v2? >>> >>>> Signed-off-by: Kuogee Hsieh <quic_khsieh@quicinc.com> >>>> --- >>>> drivers/gpu/drm/msm/dp/dp_display.c | 35 +++++++++++++---------------------- >>>> drivers/gpu/drm/msm/dp/dp_display.h | 1 - >>>> 2 files changed, 13 insertions(+), 23 deletions(-) >>>> >>>> diff --git a/drivers/gpu/drm/msm/dp/dp_display.c b/drivers/gpu/drm/msm/dp/dp_display.c >>>> index 76f1395..c217430 100644 >>>> --- a/drivers/gpu/drm/msm/dp/dp_display.c >>>> +++ b/drivers/gpu/drm/msm/dp/dp_display.c >>>> @@ -1193,30 +1193,23 @@ static irqreturn_t dp_display_irq_handler(int irq, void *dev_id) >>>> return ret; >>>> } >>>> >>>> -int dp_display_request_irq(struct msm_dp *dp_display) >>>> +static int dp_display_request_irq(struct dp_display_private *dp) >>>> { >>>> int rc = 0; >>>> - struct dp_display_private *dp; >>>> - >>>> - if (!dp_display) { >>>> - DRM_ERROR("invalid input\n"); >>>> - return -EINVAL; >>>> - } >>>> - >>>> - dp = container_of(dp_display, struct dp_display_private, dp_display); >>>> + struct device *dev = &dp->pdev->dev; >>>> >>>> - dp->irq = irq_of_parse_and_map(dp->pdev->dev.of_node, 0); >>>> if (!dp->irq) { >>> What is the point in this check? >>> >>>> - DRM_ERROR("failed to get irq\n"); >>>> - return -EINVAL; >>>> + dp->irq = platform_get_irq(dp->pdev, 0); >>>> + if (!dp->irq) { >>>> + DRM_ERROR("failed to get irq\n"); >>>> + return -EINVAL; >>>> + } >>>> } >>>> >>>> - rc = devm_request_irq(dp_display->drm_dev->dev, dp->irq, >>>> - dp_display_irq_handler, >>>> + rc = devm_request_irq(dev, dp->irq, dp_display_irq_handler, >>>> IRQF_TRIGGER_HIGH, "dp_display_isr", dp); >>>> if (rc < 0) { >>>> - DRM_ERROR("failed to request IRQ%u: %d\n", >>>> - dp->irq, rc); >>>> + DRM_ERROR("failed to request IRQ%u: %d\n", dp->irq, rc); >>>> return rc; >>>> } >>>> >>>> @@ -1287,6 +1280,10 @@ static int dp_display_probe(struct platform_device *pdev) >>>> >>>> platform_set_drvdata(pdev, &dp->dp_display); >>>> >>>> + rc = dp_display_request_irq(dp); >>>> + if (rc) >>>> + return rc; >>> This way the IRQ ends up being enabled in _probe. Are we ready to >>> handle it here? Is the DP device fully setup at this moment? >> The irq is enabled here. >> >> but DP driver hpd hardware block has not yet be enabled. this means no >> irq will be delivered. > There are other IRQ kinds, not only just HPD ones. pm_runtime_resume_and_get() will enable host controller (including hpd and aux block). so that as long as pm_runtime_resume_and_get() called, then all DP related interrupts will be handled accordingly. > >> .hpd_enable() will call pm_runtime_resume_and_get() and >> dp_catalog_ctrl_hpd_enable(). >> >> after .hpd_enable() irq will be delivered and handled properly. >> >> >> >>>> + >>>> rc = component_add(&pdev->dev, &dp_display_comp_ops); >>>> if (rc) { >>>> DRM_ERROR("component add failed, rc=%d\n", rc); >>>> @@ -1549,12 +1546,6 @@ int msm_dp_modeset_init(struct msm_dp *dp_display, struct drm_device *dev, >>>> >>>> dp_priv = container_of(dp_display, struct dp_display_private, dp_display); >>>> >>>> - ret = dp_display_request_irq(dp_display); >>>> - if (ret) { >>>> - DRM_ERROR("request_irq failed, ret=%d\n", ret); >>>> - return ret; >>>> - } >>>> - >>>> ret = dp_display_get_next_bridge(dp_display); >>>> if (ret) >>>> return ret; >>>> diff --git a/drivers/gpu/drm/msm/dp/dp_display.h b/drivers/gpu/drm/msm/dp/dp_display.h >>>> index 1e9415a..b3c08de 100644 >>>> --- a/drivers/gpu/drm/msm/dp/dp_display.h >>>> +++ b/drivers/gpu/drm/msm/dp/dp_display.h >>>> @@ -35,7 +35,6 @@ struct msm_dp { >>>> int dp_display_set_plugged_cb(struct msm_dp *dp_display, >>>> hdmi_codec_plugged_cb fn, struct device *codec_dev); >>>> int dp_display_get_modes(struct msm_dp *dp_display); >>>> -int dp_display_request_irq(struct msm_dp *dp_display); >>>> bool dp_display_check_video_test(struct msm_dp *dp_display); >>>> int dp_display_get_test_bpp(struct msm_dp *dp_display); >>>> void dp_display_signal_audio_start(struct msm_dp *dp_display); >>>> -- >>>> 2.7.4 >>>> > >
diff --git a/drivers/gpu/drm/msm/dp/dp_display.c b/drivers/gpu/drm/msm/dp/dp_display.c index 76f1395..c217430 100644 --- a/drivers/gpu/drm/msm/dp/dp_display.c +++ b/drivers/gpu/drm/msm/dp/dp_display.c @@ -1193,30 +1193,23 @@ static irqreturn_t dp_display_irq_handler(int irq, void *dev_id) return ret; } -int dp_display_request_irq(struct msm_dp *dp_display) +static int dp_display_request_irq(struct dp_display_private *dp) { int rc = 0; - struct dp_display_private *dp; - - if (!dp_display) { - DRM_ERROR("invalid input\n"); - return -EINVAL; - } - - dp = container_of(dp_display, struct dp_display_private, dp_display); + struct device *dev = &dp->pdev->dev; - dp->irq = irq_of_parse_and_map(dp->pdev->dev.of_node, 0); if (!dp->irq) { - DRM_ERROR("failed to get irq\n"); - return -EINVAL; + dp->irq = platform_get_irq(dp->pdev, 0); + if (!dp->irq) { + DRM_ERROR("failed to get irq\n"); + return -EINVAL; + } } - rc = devm_request_irq(dp_display->drm_dev->dev, dp->irq, - dp_display_irq_handler, + rc = devm_request_irq(dev, dp->irq, dp_display_irq_handler, IRQF_TRIGGER_HIGH, "dp_display_isr", dp); if (rc < 0) { - DRM_ERROR("failed to request IRQ%u: %d\n", - dp->irq, rc); + DRM_ERROR("failed to request IRQ%u: %d\n", dp->irq, rc); return rc; } @@ -1287,6 +1280,10 @@ static int dp_display_probe(struct platform_device *pdev) platform_set_drvdata(pdev, &dp->dp_display); + rc = dp_display_request_irq(dp); + if (rc) + return rc; + rc = component_add(&pdev->dev, &dp_display_comp_ops); if (rc) { DRM_ERROR("component add failed, rc=%d\n", rc); @@ -1549,12 +1546,6 @@ int msm_dp_modeset_init(struct msm_dp *dp_display, struct drm_device *dev, dp_priv = container_of(dp_display, struct dp_display_private, dp_display); - ret = dp_display_request_irq(dp_display); - if (ret) { - DRM_ERROR("request_irq failed, ret=%d\n", ret); - return ret; - } - ret = dp_display_get_next_bridge(dp_display); if (ret) return ret; diff --git a/drivers/gpu/drm/msm/dp/dp_display.h b/drivers/gpu/drm/msm/dp/dp_display.h index 1e9415a..b3c08de 100644 --- a/drivers/gpu/drm/msm/dp/dp_display.h +++ b/drivers/gpu/drm/msm/dp/dp_display.h @@ -35,7 +35,6 @@ struct msm_dp { int dp_display_set_plugged_cb(struct msm_dp *dp_display, hdmi_codec_plugged_cb fn, struct device *codec_dev); int dp_display_get_modes(struct msm_dp *dp_display); -int dp_display_request_irq(struct msm_dp *dp_display); bool dp_display_check_video_test(struct msm_dp *dp_display); int dp_display_get_test_bpp(struct msm_dp *dp_display); void dp_display_signal_audio_start(struct msm_dp *dp_display);