Received: by 2002:a05:7412:3784:b0:e2:908c:2ebd with SMTP id jk4csp2105244rdb; Tue, 3 Oct 2023 10:16:47 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGcpYhkqMml6vjviC4CvnzMG0LdxJ0bxwV1jc1qnKLdngILVL5/3lkOMhhsUe+HZDqSa8q4 X-Received: by 2002:a05:6870:5b84:b0:1b0:189c:87a0 with SMTP id em4-20020a0568705b8400b001b0189c87a0mr137001oab.41.1696353407687; Tue, 03 Oct 2023 10:16:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696353407; cv=none; d=google.com; s=arc-20160816; b=taLOD4F5azz0SZwKPT4udPxUz4kMahDgIq7Sz4qy4B8u7Hq8eCQ8KqlN6Ykd47Eh54 XAnoDA2Ra/HXkw/9A22VPr6C/4qbsyI984DB9oI6w/PFDUZct5bSqeMvXnnNknu01Gvv nrxMZfytNwCHIqH1eOsnoO1I4P6OGqU+DOTkdk4lsS8N59IjIjkFTreWKsgQMmrwGp98 in/caRpi26JAKF2ST+BDX6ZMZybhBx2D8zV3nsjR5VjAATaHSdQYjunVVrFr5HbRLWnB iQFazVO6dhhXYhjXTPEZAOLdl8AChU8PDdSpdrGWhJsZuxkK7YhVtV3HTQTBSAYRxN11 UaHw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id:dkim-signature; bh=SF1yqv/TmX5oNWEY6wY/ffeQMFkBBGbKZ10TUflmA+w=; fh=sqsfmfyJwUJv6m2jYDJZFZGhueTiUiMY+SatAtIaJFA=; b=osUchHH62ysUk+jtU+vWmCNLIbq7DaTuJu7VSPTGa2TECG6qPF342viDyDm5ELPPHw deJy0ZV3SaWg/H+sfF3pZMZJPAncdqZUb9MempE8SEQIG1z9Mm4zI1XccaO7QHL4/Een XS4A2pT2Ub+qtQY89hCqJGBGZ9b6QimomZwHD+iEMZtZWKN3yLSWwlpCSygTmcAfMjMn v68BYp6l3wJSZ9YsZmM3NNv2giHP14uVXYSlyygBK5IxEGuISe5tT2mKf2vMSiyhFC32 /VCTgGwNWxTa6HO45rabxcJuzIm5+sGvgXXFZDOUWM3HSj73LSXmC5DK2CkVLAPT+LhU 5nsA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=Z4NXhw0a; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 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 groat.vger.email (groat.vger.email. [2620:137:e000::3:5]) by mx.google.com with ESMTPS id a73-20020a63904c000000b00564f4a7f70asi1845522pge.412.2023.10.03.10.16.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 03 Oct 2023 10:16:47 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) client-ip=2620:137:e000::3:5; Authentication-Results: mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=Z4NXhw0a; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 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 groat.vger.email (Postfix) with ESMTP id E177C80740EC; Tue, 3 Oct 2023 10:16:44 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at groat.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240580AbjJCRQ2 (ORCPT + 99 others); Tue, 3 Oct 2023 13:16:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42338 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232065AbjJCRQ1 (ORCPT ); Tue, 3 Oct 2023 13:16:27 -0400 Received: from mx0a-0031df01.pphosted.com (mx0a-0031df01.pphosted.com [205.220.168.131]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CA7A49B; Tue, 3 Oct 2023 10:16:23 -0700 (PDT) Received: from pps.filterd (m0279866.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 393H6gKj007661; Tue, 3 Oct 2023 17:16:01 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; h=message-id : date : mime-version : subject : to : cc : references : from : in-reply-to : content-type : content-transfer-encoding; s=qcppdkim1; bh=SF1yqv/TmX5oNWEY6wY/ffeQMFkBBGbKZ10TUflmA+w=; b=Z4NXhw0a93/prKXKVyH5Tv/U0tHcnWFpDJnb9Y0ItCY9mcbP9QNqH1hwxSZCSlWvvEZr esqqie81qocpvcRG7/ekZS4uxV9UwlDlYMvCn2yrWRtdwcAbOPIZ2rbymd+XUEY53LtP h+dDzWGcmt061yixyeIPeidAjI+sRUz2LmW+yz4gdy2DUiScOTZjwwSx5avN7Cr535n4 vRu6DG2mURc/YZa0VL2NFgHijA2ZaRiXhRg4/3nNjFoJvsa7hpbDXcNT7r2tRgJDTbZa 4OzNt/KUR0JY7vHos27G3rDsQMUB+exzV9reQxdRK02hCvA45uYqmh5RwIXs5y7G/UEJ yg== Received: from nalasppmta02.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3tgbjgsrtt-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 03 Oct 2023 17:16:00 +0000 Received: from nalasex01a.na.qualcomm.com (nalasex01a.na.qualcomm.com [10.47.209.196]) by NALASPPMTA02.qualcomm.com (8.17.1.5/8.17.1.5) with ESMTPS id 393HFx5I001557 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 3 Oct 2023 17:15:59 GMT Received: from [10.110.36.217] (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; Tue, 3 Oct 2023 10:15:58 -0700 Message-ID: <456136f5-1e4d-3866-603f-16f308f06028@quicinc.com> Date: Tue, 3 Oct 2023 10:15:57 -0700 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 Thunderbird/102.13.0 Subject: Re: [PATCH v4 8/8] drm/msm/dp: move of_dp_aux_populate_bus() to eDP probe() Content-Language: en-US To: Dmitry Baryshkov CC: , , , , , , , , , , , , , , , , References: <1695848028-18023-1-git-send-email-quic_khsieh@quicinc.com> <1695848028-18023-9-git-send-email-quic_khsieh@quicinc.com> From: Kuogee Hsieh In-Reply-To: Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: 7bit 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: Pftrp3B1XSHMdTRSJ72Uw-ZIZhF4umL5 X-Proofpoint-GUID: Pftrp3B1XSHMdTRSJ72Uw-ZIZhF4umL5 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-10-03_15,2023-10-02_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 clxscore=1015 lowpriorityscore=0 spamscore=0 priorityscore=1501 adultscore=0 suspectscore=0 bulkscore=0 impostorscore=0 mlxlogscore=999 phishscore=0 malwarescore=0 mlxscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2309180000 definitions=main-2310030131 X-Spam-Status: No, score=-1.9 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on groat.vger.email 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 (groat.vger.email [0.0.0.0]); Tue, 03 Oct 2023 10:16:45 -0700 (PDT) On 9/27/2023 2:57 PM, Dmitry Baryshkov wrote: > On Wed, 27 Sept 2023 at 23:54, Kuogee Hsieh wrote: >> Currently eDP population is done at msm_dp_modeset_init() which happen >> at binding time. Move eDP population to be done at display probe time >> so that probe deferral cases can be handled effectively. >> wait_for_hpd_asserted callback is added during drm_dp_aux_init() >> to ensure eDP's HPD is up before proceeding eDP population. >> >> Changes in v4: >> -- delete duplicate initialize code to dp_aux before drm_dp_aux_register() >> -- delete of_get_child_by_name(dev->of_node, "aux-bus") and inline the function >> -- not initialize rc = 0 >> >> Changes in v3: >> -- add done_probing callback into devm_of_dp_aux_populate_bus() >> >> Signed-off-by: Kuogee Hsieh >> --- >> drivers/gpu/drm/msm/dp/dp_aux.c | 34 ++++++++++++++---- >> drivers/gpu/drm/msm/dp/dp_display.c | 69 ++++++++++++++++++------------------- >> 2 files changed, 60 insertions(+), 43 deletions(-) >> >> diff --git a/drivers/gpu/drm/msm/dp/dp_aux.c b/drivers/gpu/drm/msm/dp/dp_aux.c >> index 22eb774..425b5c5 100644 >> --- a/drivers/gpu/drm/msm/dp/dp_aux.c >> +++ b/drivers/gpu/drm/msm/dp/dp_aux.c >> @@ -480,7 +480,6 @@ void dp_aux_deinit(struct drm_dp_aux *dp_aux) >> >> int dp_aux_register(struct drm_dp_aux *dp_aux) >> { >> - struct dp_aux_private *aux; >> int ret; >> >> if (!dp_aux) { >> @@ -488,12 +487,7 @@ int dp_aux_register(struct drm_dp_aux *dp_aux) >> return -EINVAL; >> } >> >> - aux = container_of(dp_aux, struct dp_aux_private, dp_aux); >> - >> - aux->dp_aux.name = "dpu_dp_aux"; >> - aux->dp_aux.dev = aux->dev; >> - aux->dp_aux.transfer = dp_aux_transfer; >> - ret = drm_dp_aux_register(&aux->dp_aux); >> + ret = drm_dp_aux_register(dp_aux); >> if (ret) { >> DRM_ERROR("%s: failed to register drm aux: %d\n", __func__, >> ret); >> @@ -508,6 +502,21 @@ void dp_aux_unregister(struct drm_dp_aux *dp_aux) >> drm_dp_aux_unregister(dp_aux); >> } >> >> +static int dp_wait_hpd_asserted(struct drm_dp_aux *dp_aux, >> + unsigned long wait_us) >> +{ >> + int ret; >> + struct dp_aux_private *aux; >> + >> + aux = container_of(dp_aux, struct dp_aux_private, dp_aux); >> + >> + pm_runtime_get_sync(aux->dev); >> + ret = dp_catalog_aux_wait_for_hpd_connect_state(aux->catalog); >> + pm_runtime_put_sync(aux->dev); > Ok, so here you have used put_sync instead of autosuspend. Can we have > some uniformity? (I'd prefer to see put_sync or just put everywhere) > >> + >> + return ret; >> +} >> + >> struct drm_dp_aux *dp_aux_get(struct device *dev, struct dp_catalog *catalog, >> bool is_edp) >> { >> @@ -531,6 +540,17 @@ struct drm_dp_aux *dp_aux_get(struct device *dev, struct dp_catalog *catalog, >> aux->catalog = catalog; >> aux->retry_cnt = 0; >> >> + /* >> + * Use the drm_dp_aux_init() to use the aux adapter >> + * before registering aux with the DRM device so that >> + * msm edp panel can be detected by generic_dep_panel_probe(). > eDP, AUX, generic_edp_panel_probe(). > >> + */ >> + aux->dp_aux.name = "dpu_dp_aux"; >> + aux->dp_aux.dev = dev; >> + aux->dp_aux.transfer = dp_aux_transfer; >> + aux->dp_aux.wait_hpd_asserted = dp_wait_hpd_asserted; >> + drm_dp_aux_init(&aux->dp_aux); >> + >> return &aux->dp_aux; >> } >> >> diff --git a/drivers/gpu/drm/msm/dp/dp_display.c b/drivers/gpu/drm/msm/dp/dp_display.c >> index 711d262..9a2b403 100644 >> --- a/drivers/gpu/drm/msm/dp/dp_display.c >> +++ b/drivers/gpu/drm/msm/dp/dp_display.c >> @@ -1203,6 +1203,28 @@ static const struct msm_dp_desc *dp_display_get_desc(struct platform_device *pde >> return NULL; >> } >> >> +static int dp_auxbus_done_probe(struct drm_dp_aux *aux) >> +{ >> + int rc; >> + >> + rc = component_add(aux->dev, &dp_display_comp_ops); >> + if (rc) >> + DRM_ERROR("eDP component add failed, rc=%d\n", rc); > drop. are you mean dropping this line? >> + >> + return rc; >> +} >> + >> +static inline int dp_display_auxbus_population(struct dp_display_private *dp) > It's not `population`. It is just `populate`. > > Also please inline this function. Are you means moving this function to header file? > > >> +{ >> + int ret; >> + >> + ret = devm_of_dp_aux_populate_bus(dp->aux, dp_auxbus_done_probe); >> + if (ret == -ENODEV) >> + DRM_ERROR("aux-bus not found\n"); >> + >> + return ret; >> +} >> + >> static int dp_display_probe(struct platform_device *pdev) >> { >> int rc = 0; >> @@ -1271,10 +1293,16 @@ static int dp_display_probe(struct platform_device *pdev) >> if (rc) >> return rc; >> >> - rc = component_add(&pdev->dev, &dp_display_comp_ops); >> - if (rc) { >> - DRM_ERROR("component add failed, rc=%d\n", rc); >> - dp_display_deinit_sub_modules(dp); >> + if (dp->dp_display.is_edp) { >> + rc = dp_display_auxbus_population(dp); >> + if (rc) >> + DRM_ERROR("eDP auxbus population failed, rc=%d\n", rc); >> + } else { >> + rc = component_add(&pdev->dev, &dp_display_comp_ops); >> + if (rc) { >> + DRM_ERROR("component add failed, rc=%d\n", rc); >> + dp_display_deinit_sub_modules(dp); >> + } >> } >> >> return rc; >> @@ -1285,8 +1313,6 @@ static int dp_display_remove(struct platform_device *pdev) >> struct dp_display_private *dp = dev_get_dp_display_private(&pdev->dev); >> >> component_del(&pdev->dev, &dp_display_comp_ops); >> - dp_display_deinit_sub_modules(dp); >> - >> platform_set_drvdata(pdev, NULL); >> >> dp_display_deinit_sub_modules(dp); >> @@ -1385,29 +1411,8 @@ static int dp_display_get_next_bridge(struct msm_dp *dp) >> { >> int rc; >> struct dp_display_private *dp_priv; >> - struct device_node *aux_bus; >> - struct device *dev; >> >> dp_priv = container_of(dp, struct dp_display_private, dp_display); >> - dev = &dp_priv->pdev->dev; >> - aux_bus = of_get_child_by_name(dev->of_node, "aux-bus"); >> - >> - if (aux_bus && dp->is_edp) { >> - /* >> - * The code below assumes that the panel will finish probing >> - * by the time devm_of_dp_aux_populate_ep_devices() returns. >> - * This isn't a great assumption since it will fail if the >> - * panel driver is probed asynchronously but is the best we >> - * can do without a bigger driver reorganization. >> - */ >> - rc = of_dp_aux_populate_bus(dp_priv->aux, NULL); >> - of_node_put(aux_bus); >> - if (rc) >> - goto error; >> - } else if (dp->is_edp) { >> - DRM_ERROR("eDP aux_bus not found\n"); >> - return -ENODEV; >> - } >> >> /* >> * External bridges are mandatory for eDP interfaces: one has to >> @@ -1420,17 +1425,9 @@ static int dp_display_get_next_bridge(struct msm_dp *dp) >> if (!dp->is_edp && rc == -ENODEV) >> return 0; >> >> - if (!rc) { >> + if (!rc) >> dp->next_bridge = dp_priv->parser->next_bridge; >> - return 0; >> - } >> >> -error: >> - if (dp->is_edp) { >> - of_dp_aux_depopulate_bus(dp_priv->aux); >> - dp_display_host_phy_exit(dp_priv); >> - dp_display_host_deinit(dp_priv); >> - } >> return rc; >> } >> >> -- >> 2.7.4 >> >