From patchwork Wed Sep 27 20:53:41 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kuogee Hsieh X-Patchwork-Id: 145618 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:cae8:0:b0:403:3b70:6f57 with SMTP id r8csp2934898vqu; Wed, 27 Sep 2023 15:24:57 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGlST+jSHyBOluwwuBN6Eqc5I9vTvM55IYr2OFQjlzyOCYFZvj3pWEIOAUPwiwt1N47u/Pw X-Received: by 2002:a05:6358:789:b0:139:db34:240b with SMTP id n9-20020a056358078900b00139db34240bmr4595747rwj.8.1695853496754; Wed, 27 Sep 2023 15:24:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695853496; cv=none; d=google.com; s=arc-20160816; b=wnmQzNYyfqiVIFHRlUWrMEtFSOJER+CB4jLs+cdEwW8yNtlBM8Y76RWNfU2XN0/ec7 oKQKWoPv+HgBDr4nD9Sr0/TF8N0ha997Lnp57IQnh0bTUDYnfrnCrSunDb0P8owAMDep l/+lf53z/Tiqj/+kDRe2dwaGB+VWef2ddo0F6NXVdOzazMVQ1QCecuSqzClg6Czglr2Y YqtHHVwaLb1xyuGYD10iHa2t9Q2jGAIzHMeV2Uq/9dNH/4zEz8lJJAihYbt9NyXP0dZU tSTFg+Q6KTuc6lXs5xH1qY7SiyMwMnB/1xf+DP7F3Mc45OzVw9nm5Igxn1eWZUZYczML yaRQ== 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=9SJBDHJJX6f5gzJgmfcXibXUCzw6ONzbRLoEBZiNiyA=; fh=WdvorNt9W2LCUPiGPsn75/bW5381IkpXRxF82JgZV7c=; b=S/GAj9gs4Pt71uTQTxHuD0fvDeWIiLL1Oye8J1B0cP+QmM1ERXtchUJABhJ/DtZCxS lAKibb7CrceZAsa+R3V65KWbmsx6XOWb/cHzLjcUC2gnpWlkHwz5DbL89rzzDaZn4w+m 8pvX1780o56PdheY1Qp0sbcKzMlShErknQ98s6WHXRP+9VIO1lfln9ISREj/QHv0qEB+ m68emZLZ/0IQq5woDs6edpF7So8UoWlj8s6fnJ8W/W9gD0OipNaesf9pQeFufHPJsTvH DNcpnlF2sCDsNgt1RwG3BuJw0cK91mBbQm5qLp5GQhFptHHDO9p7SHUA/5VDXuY5r97q ogOg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=WzkkS5Xp; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 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 snail.vger.email (snail.vger.email. [2620:137:e000::3:7]) by mx.google.com with ESMTPS id bt8-20020a632908000000b0057762236debsi16603248pgb.546.2023.09.27.15.24.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 27 Sep 2023 15:24:56 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) client-ip=2620:137:e000::3:7; Authentication-Results: mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=WzkkS5Xp; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 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 snail.vger.email (Postfix) with ESMTP id D592F822CE26; Wed, 27 Sep 2023 13:54:36 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229883AbjI0Uy0 (ORCPT + 20 others); Wed, 27 Sep 2023 16:54:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41600 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229493AbjI0UyW (ORCPT ); Wed, 27 Sep 2023 16:54:22 -0400 Received: from mx0a-0031df01.pphosted.com (mx0a-0031df01.pphosted.com [205.220.168.131]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EFF2A121; Wed, 27 Sep 2023 13:54:20 -0700 (PDT) Received: from pps.filterd (m0279867.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 38RKT2ui024545; Wed, 27 Sep 2023 20:54:01 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=9SJBDHJJX6f5gzJgmfcXibXUCzw6ONzbRLoEBZiNiyA=; b=WzkkS5Xpw4XwEPWS7PNhKMekPW1dR0bqV1fxQeP7tdase0FIywiBiglHtaJETk+3DeZm 919ND0rWw5DKwuI2dO2oOH0vsRk0tWNEIMRCKamAxQxsDPb9m4gzmnnpK30gBIMhhaKq MWOvlArYjUhyuHYw2z4h4/+SB9bl1p7OhjtOL7Bar02n+vW+xWRZOgsJf5EiySCYlc+h BSoi2muYFJlehdzPHhxliW41AwpoLWIRoskAqbKyFRyy9j+Q6Xsbzlo7IrThoxZaVuXb 6rs7o2DlaA5PSUrdswfBqBKw+FA192CQgoQA9uwxOxz63fo36826BIKN7EbVeHUiIjKJ HA== Received: from nalasppmta01.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3tcda7t1eb-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 27 Sep 2023 20:54:01 +0000 Received: from nalasex01a.na.qualcomm.com (nalasex01a.na.qualcomm.com [10.47.209.196]) by NALASPPMTA01.qualcomm.com (8.17.1.5/8.17.1.5) with ESMTPS id 38RKs0W2032209 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 27 Sep 2023 20:54:00 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; Wed, 27 Sep 2023 13:54:00 -0700 From: Kuogee Hsieh To: , , , , , , , , , , CC: Kuogee Hsieh , , , , , , , Subject: [PATCH v4 1/8] drm/msm/dp: tie dp_display_irq_handler() with dp driver Date: Wed, 27 Sep 2023 13:53:41 -0700 Message-ID: <1695848028-18023-2-git-send-email-quic_khsieh@quicinc.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1695848028-18023-1-git-send-email-quic_khsieh@quicinc.com> References: <1695848028-18023-1-git-send-email-quic_khsieh@quicinc.com> MIME-Version: 1.0 X-Originating-IP: [10.80.80.8] 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: 4sL9SJ46kiE-N1-JdaZ62qaJvTKU6vpU X-Proofpoint-GUID: 4sL9SJ46kiE-N1-JdaZ62qaJvTKU6vpU X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.267,Aquarius:18.0.980,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2023-09-27_13,2023-09-27_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 adultscore=0 malwarescore=0 clxscore=1011 lowpriorityscore=0 impostorscore=0 bulkscore=0 mlxlogscore=999 priorityscore=1501 mlxscore=0 suspectscore=0 spamscore=0 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2309180000 definitions=main-2309270178 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 X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Wed, 27 Sep 2023 13:54:36 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1778231276050337000 X-GMAIL-MSGID: 1778231276050337000 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 v4: -- delete dp->irq check at dp_display_request_irq() Changes in v3: -- move calling dp_display_irq_handler() to probe Signed-off-by: Kuogee Hsieh --- drivers/gpu/drm/msm/dp/dp_display.c | 29 +++++++++-------------------- drivers/gpu/drm/msm/dp/dp_display.h | 1 - 2 files changed, 9 insertions(+), 21 deletions(-) diff --git a/drivers/gpu/drm/msm/dp/dp_display.c b/drivers/gpu/drm/msm/dp/dp_display.c index 76f1395..5645178 100644 --- a/drivers/gpu/drm/msm/dp/dp_display.c +++ b/drivers/gpu/drm/msm/dp/dp_display.c @@ -1193,30 +1193,21 @@ 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); + 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 +1278,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 +1544,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);