Received: by 2002:a05:7412:3784:b0:e2:908c:2ebd with SMTP id jk4csp2219796rdb; Tue, 3 Oct 2023 14:12:13 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFZQvEKtC/STDP5eTD6oiOoxLt6tt+4/q3XUvE+Dod6czjiW5nEZxzWWROzSEjLaks+8Qtp X-Received: by 2002:a17:902:e80a:b0:1c6:7ba:3a9a with SMTP id u10-20020a170902e80a00b001c607ba3a9amr894349plg.14.1696367533637; Tue, 03 Oct 2023 14:12:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696367533; cv=none; d=google.com; s=arc-20160816; b=I36Xa5bJMd0yx6zzoh12dvOwciWppWnBoPPWgL0+imy6pE1Z2dTkS6wfaoLZWZ8ji4 fb8K3hGeAitilCxHM6q05C0U8ErVbXVt5u7pMO0eAsn4YB6Pji1XEA3BzqgFB4ItYsZy Yprz5AbzJVUZHKxeyhaXkco9X4QnrIjzf00CI3BNVCTyXyQG/7fsnrWbQgzbggm24Tl5 490nUxONek/L3uvOPRRGpwcTRiGA/jgg5n8+2yaMr7Ezyg+p9ypL67H5AzMreR7IqfmI FsNY+LLdDHTYICbbwtV2z84/d2UAEHna/vdBNNFCc+m/fPAk8VsPDttCTprcJUdCnDzz DpIQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=TfxDtijsU/A62NyvsK23Kej6jVvl6v8DWcOLSJPA8yU=; fh=Iu05yrOKhRyKBOIps2Mjvip7s5lelUzP4uL09HFczko=; b=znLRNOiYSMaHc9w0Pd+c+Cn7M4hiLKiqaiIjfvYpKsGDGx/1m/pyhx3kqZMKkKFOR6 ZiCXPVH4ts2w6k1HqFG2bnR8r8ug+K9Br+UnNfFJ1VL+XiYz6rdl81xATKk4ueHylHQm FBs4V3bSsoPwFUiFAWlD9mGo3riefNRr36Gq5W+VCS90wJ3GdmiCp5TmUiw8eLy7UGWX 2rLj/xCiXZAdnbWqLht5d1uiOZsQZW2Tt4pJQX5u5IIAxx3MQL9OSwhdEJdKcnqRK1iO E2l7tQi50BQyK5YEAfAG8eX9DQhTZ8hQpsnzQmhsx508IvYqiMn+HKdugnhrZV4kDgxD i0uw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=m8+TezgT; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from agentk.vger.email (agentk.vger.email. [23.128.96.32]) by mx.google.com with ESMTPS id r2-20020a170902c60200b001c589ba4a08si2062457plr.1.2023.10.03.14.12.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 03 Oct 2023 14:12:13 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) client-ip=23.128.96.32; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=m8+TezgT; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by agentk.vger.email (Postfix) with ESMTP id 0750D818F493; Tue, 3 Oct 2023 14:12:10 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at agentk.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241147AbjJCVL5 (ORCPT + 99 others); Tue, 3 Oct 2023 17:11:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57394 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232343AbjJCVLy (ORCPT ); Tue, 3 Oct 2023 17:11:54 -0400 Received: from mail-yw1-x1131.google.com (mail-yw1-x1131.google.com [IPv6:2607:f8b0:4864:20::1131]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A0D6083 for ; Tue, 3 Oct 2023 14:11:50 -0700 (PDT) Received: by mail-yw1-x1131.google.com with SMTP id 00721157ae682-59f57ad6126so16534997b3.3 for ; Tue, 03 Oct 2023 14:11:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1696367510; x=1696972310; darn=vger.kernel.org; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=TfxDtijsU/A62NyvsK23Kej6jVvl6v8DWcOLSJPA8yU=; b=m8+TezgTbFlYLEVZhDOb3nmU3vV+C+dCZZH6DLM09FLf9xHS6x2B1XYN21YJ2UZMdQ vo370D0bOn01+qjYhlIh6lYZ4M3/eA/P18xfOiVc/htygbBmbgvubOW2dztpjsHSD1xL KwkH+HfsHybxg0cOlTwCVBuaWOtvBaFPi+nYWXVDP0mnAQbB1HSg8ZGevRh2AUQ+UnOp 6tHMi4DKooK/EXYM3Ss4AFKm/kteAYp45Kl2vUC5SsWZ8hfXK9t9O7RT0rlYpdN/xyVN axPtRIAFEhS9rer/Ea8sZra1aWpJ0EkfBWTLjEA1xAFXWRELvP9HNXegSf8rFdy79hzJ IwSg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1696367510; x=1696972310; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=TfxDtijsU/A62NyvsK23Kej6jVvl6v8DWcOLSJPA8yU=; b=uwvSETji/hVyCzXUjSa4CzfH7pKykZ+idS4CHd5YXv6/IzwrNqmR+jOoDoNjpkHVq0 NU6h7Tr7ndWCpK32XrpVlIj728WtLeUIvySPiJTmY88SwGXWMWcM0pX9QoQ0WoyH0cIu smVRESXgpRlWsmBiN5oBNj1yI4ioBoxcsqe6Y1RUBQWJSca9pJEOz/4U/AFQZ/p3eX+B QFp6W3tL8uqQH8tuAmlKmxUlrSeYZjWPjxEpLoprC7VXjLUPFX9jOf5ZqWux0Ty32+Lw mQRZimCIn7m7eT75xQ1CdqE4IfDGSSxNrGpl7jEVTgRzaA+vgZnDSBNVG3WBBQ0YbZDL fSng== X-Gm-Message-State: AOJu0Yxoostjcmxaf+cBevUVlHLM07KPi3WWVvIE7M9gX466bJ/jKu/V JSQVnEhXdpmvpNJQa1HD56Q15TZL3JCxCvTnbPO9pw== X-Received: by 2002:a0d:ca02:0:b0:589:a4c6:a4ed with SMTP id m2-20020a0dca02000000b00589a4c6a4edmr791250ywd.3.1696367509732; Tue, 03 Oct 2023 14:11:49 -0700 (PDT) MIME-Version: 1.0 References: <1695848028-18023-1-git-send-email-quic_khsieh@quicinc.com> <1695848028-18023-9-git-send-email-quic_khsieh@quicinc.com> <2d8d4354-6dbb-e810-6efb-ca6b31f71b45@quicinc.com> In-Reply-To: From: Dmitry Baryshkov Date: Wed, 4 Oct 2023 00:11:38 +0300 Message-ID: Subject: Re: [PATCH v4 8/8] drm/msm/dp: move of_dp_aux_populate_bus() to eDP probe() To: Kuogee Hsieh Cc: 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, andersson@kernel.org, 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 Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, 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 agentk.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 (agentk.vger.email [0.0.0.0]); Tue, 03 Oct 2023 14:12:10 -0700 (PDT) On Tue, 3 Oct 2023 at 23:18, Kuogee Hsieh wrote: > > > On 10/3/2023 10:56 AM, Dmitry Baryshkov wrote: > > On 03/10/2023 20:25, Kuogee Hsieh wrote: > >> > >> 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) > >> > >> > >> my point is, > >> > >> since display is user interface, > >> > >> if there has any inputs before timer expire then there is no reason > >> to execute pm_runtime_suspend(). > >> > >> otherwise pm_runtime_suspend() should be executed. > >> > >> Therefore I used autosuspend at aux_transfer() an > >> ddp_bridge_atomic_post_disable(). > >> > >> here is not related to user interface so that i use put_sysn() directly. > >> > >> is my point make sense? > >> > >> or should I drop all autosuspend and replace them with put_sync()? > > > > This was my question from the beginning: what was the reason for using > > autosuspend? Did it bring any sensible improvement in the disable & > > reenable path? > > ok, i got your point. > > 1) I will use put_sync() at dp_bridge_atomic_dsiable() and > dp_bridge_hpd_disable() instead of put_autosuspend(). > > 2) keep pm_runtime_put_autosuspend() at dp_aux_transfer(). Why? The panel driver should take care about keeping DP on between transfers. > > Is this good? > > > > >> > >> > >>> > >>>> + > >>>> + 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. > >>> > >>>> + > >>>> + 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. > >>> > >>> > >>>> +{ > >>>> + 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 > >>>> > >>> > > -- With best wishes Dmitry