Received: by 2002:a05:7412:da14:b0:e2:908c:2ebd with SMTP id fe20csp655725rdb; Fri, 6 Oct 2023 14:50:03 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHw56BQUWX2kbZf3mbcuFiAIz9OJD1lCXE8W5awgd25eReY1j9HWhJoQ33J2JeD/m0yHesw X-Received: by 2002:a05:6870:9720:b0:1d5:9ae7:ec79 with SMTP id n32-20020a056870972000b001d59ae7ec79mr10811663oaq.12.1696629003459; Fri, 06 Oct 2023 14:50:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696629003; cv=none; d=google.com; s=arc-20160816; b=hXAE0T6kqkn4Kgvfpl1I4vWHU4HZ1BgBX13Rp10wQ1tYji+JA13zZ+RqkFUybUi/o9 m7MWdmD30qw1+NbM2Yd88K3EF8IjsiJ7QdY28Clomgg6J/p5NMA1RloihraFz42jj/x/ beTj7FZ7p17OrjI3cwoxCVvKlzSxYkDVG4J6Ctp7fmBnz+m/UsjBcsQrXsvd+G6AFnuR 2SiSRlvTdNdaYCXI5LxBEifA5AoCF+h8xHzQFEMkF9OPWw7mOaq1fj3YDHAfZm64xR5t bM/Dow/uQLlnfSIhLqc06go7/lI7LaRUJeMNS9LFjANg/aW4hFj+5l/SDiqS9y2jyfsA EmAw== 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=vAdY1fRl3DInOj3arSz3of7krdMLZP31tdXdXtBXNTI=; fh=4FjyiQPX309EVCzkoGiIe7P6/BaSh4oIfDFrzrZvjM0=; b=BlZCLxs4OBmgYHcRDAxjHvEY+iEjduMUtjxSPq76sejncOI3Y8rXjD9DOGTrP1+8Tm 6aukUYzgdeLWw8Hr/9prRbUddZLvI9ayF1XYttLmBCdDlAUoEq/IlF8oMaJ4lVmeNUib 7Kk0pYFtx1i5fpN9t7rB+OFTmEdp5nPrfZOle6cz3OC1ptW25dDzVuWP88iyw5sb4C/J oaZ2eSfo/HU2o6RLkpi156Q+WkIvpiQ70pVRvFCrYQixfZvtcX3gmDxtA2G50DL/6weU NCffBBSnOrUxfWxavDV8IWV0sfBcmu4W7ma74bM/zZQ2/8aDAqmh5SEr7SxDMJ1vjkZE 0lvA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=FDdpjDM+; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 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 lipwig.vger.email (lipwig.vger.email. [23.128.96.33]) by mx.google.com with ESMTPS id s27-20020a63925b000000b00573fc592e9dsi1229609pgn.848.2023.10.06.14.50.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 06 Oct 2023 14:50:03 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) client-ip=23.128.96.33; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=FDdpjDM+; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 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 lipwig.vger.email (Postfix) with ESMTP id DFA9682155EC; Fri, 6 Oct 2023 14:49:59 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at lipwig.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233634AbjJFVtq (ORCPT + 99 others); Fri, 6 Oct 2023 17:49:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60754 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233813AbjJFVtp (ORCPT ); Fri, 6 Oct 2023 17:49:45 -0400 Received: from mail-lf1-x133.google.com (mail-lf1-x133.google.com [IPv6:2a00:1450:4864:20::133]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5F099BE for ; Fri, 6 Oct 2023 14:49:42 -0700 (PDT) Received: by mail-lf1-x133.google.com with SMTP id 2adb3069b0e04-50305abe5f0so3410437e87.2 for ; Fri, 06 Oct 2023 14:49:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1696628980; x=1697233780; darn=vger.kernel.org; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=vAdY1fRl3DInOj3arSz3of7krdMLZP31tdXdXtBXNTI=; b=FDdpjDM+MB8Z+zu4+RIUlGmFf9qagMZrful4t32/f3SfkM0gjPsZZ23GLwcoBvtBlz BINqW1xCVmJ8l0BaFYf4+iKpEOZWJD9maYaa/uH0xA5+VbtDypNMwGAUApbuhcvaQx4D lYrcp5bUXPgzfZKktO01Wo4ZbaW3x2dgz7w7e6kpIcG2TF1uQuoTX362zdevDGFf9A7Y 2pX6CvJZhdbAvproT18Yp/XUBToQjIc8kgaq6XeURMHC+YvpG8ZDl+zz/uKuxW1uq1ks q0LqhJxIoZbGGrrVslhp+wmHJhYRdSqK2bjD9AvqkhczEEFGXitfCgyBYJkjnRkcMfZu QOpA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1696628980; x=1697233780; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=vAdY1fRl3DInOj3arSz3of7krdMLZP31tdXdXtBXNTI=; b=aYq+ZXnFIQ3klATRCuabQj2UCbl1FVcswY3vYg8Vwg2OlB1RCNN9D7zGbeNWQYo36z fOHsGcv6lbZQ9dM37R6SgB5cKRZhI8pkvTRAHOdSunu2iE4D+aTO3jZUCw06/Ww84hHt JTKR79AaYczTnhffG8vqU+Yna6uyPFBBNiMjcRFrEegr9d8lc9QJqq9L+z+iwK1HB6l2 CGf0FAhNgxvudYeCmge7IahcbCNTCddXxuFUkOhP/T+cmY1G/NXrOBHBHQ0C4BtHGk1w NKqRYET+Uqz1V4Kb/KcfsRcoS/0rKFkasYWLano4I5MOvpDYBvwKXpO/RF9sAWnjO4FA E9PQ== X-Gm-Message-State: AOJu0YxVYI4Wa8aqZYZ9rlrdBpKP1rwBiXTKTbU8qSThufGmL2sjPfAZ MgCpFuFzO/hAHY47GUa1hNTX9A== X-Received: by 2002:a2e:3c12:0:b0:2b6:bb21:8d74 with SMTP id j18-20020a2e3c12000000b002b6bb218d74mr8429749lja.1.1696628980515; Fri, 06 Oct 2023 14:49:40 -0700 (PDT) Received: from [192.168.1.34] ([194.204.33.9]) by smtp.gmail.com with ESMTPSA id x28-20020a05651c105c00b002c120b99f8csm934333ljm.134.2023.10.06.14.49.38 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 06 Oct 2023 14:49:40 -0700 (PDT) Message-ID: <69a74260-556c-4e34-8381-82677c335b97@linaro.org> Date: Sat, 7 Oct 2023 00:49:27 +0300 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v6 5/7] drm/msm/dp: incorporate pm_runtime framework into DP driver Content-Language: en-GB To: Kuogee Hsieh , 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 Cc: 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 References: <1696628318-15095-1-git-send-email-quic_khsieh@quicinc.com> <1696628318-15095-6-git-send-email-quic_khsieh@quicinc.com> From: Dmitry Baryshkov In-Reply-To: <1696628318-15095-6-git-send-email-quic_khsieh@quicinc.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=2.7 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, RCVD_IN_SBL_CSS,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lipwig.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 (lipwig.vger.email [0.0.0.0]); Fri, 06 Oct 2023 14:50:00 -0700 (PDT) X-Spam-Level: ** On 07/10/2023 00:38, Kuogee Hsieh wrote: > Currently DP driver is executed independent of PM runtime framework. > This leads msm eDP panel can not being detected by edp_panel driver during > generic_edp_panel_probe() due to AUX DPCD read failed at edp panel driver. > Incorporate PM runtime framework into DP driver so that host controller's > power and clocks are enable/disable through PM runtime mechanism. > Once PM runtime framework is incorporated into DP driver, waking up device > from power up path is not necessary. Hence remove it. > > After incorporating pm_runtime framework into eDP/DP driver, dp_pm_suspend() > to handle power off both DP phy and controller during suspend and > dp_pm_resume() to handle power on both DP phy and controller during resume > are not necessary. Therefore both dp_pm_suspend() and dp_pm_resume() are > dropped and replace with dp_pm_runtime_suspend() and dp_pm_runtime_resume() > respectively. > > Please noted that there are different implementations between external DP > and eDP. For external DP, DP controller and HPD block are initialized with > HPD irq enabled after dp_pm_runtime_resume() and then start waiting for HPD > plugin interrupt. Once HDP plugin interrupt received, dp_hpd_plugin_handle() > will initialize PHY immediately followed by link training. > For eDP, eDP controller, HPD block and PHY are initialized with HPD irq > disabled after dp_pm_runtime_resume() since HPD interrupt is not required. Ugh. Your original comment in the email was easier to parse. Can we just have it instead? And I thought that it would be a better fit for the source code comment rather than for the commit message. > > Changes in v6: > -- delete dp_power_client_deinit(dp->power); > -- remove if (!dp->dp_display.is_edp) condition checkout at dp_hpd_plug_handle() > -- remove if (!dp->dp_display.is_edp) condition checkout at dp_hpd_unplug_handle() > -- add IRQF_NO_AUTOEN to devm_request_irq() > -- add enable_irq() and disable_irq() to pm_runtime_resume() and pm_runtime_suspend() > -- del dp->hpd_state = ST_DISCONNECTED from dp_bridge_hpd_disable() > > Changes in v5: > -- remove pm_runtime_put_autosuspend feature, use pm_runtime_put_sync() directly > -- squash add pm_runtime_force_suspend()/resume() patch into this patch > > Changes in v4: > -- reworded commit text to explain why pm_framework is required for edp panel > -- reworded commit text to explain autosuspend is choiced > -- delete EV_POWER_PM_GET and PM_EV_POWER_PUT from changes #3 > -- delete dp_display_pm_get() and dp_display_pm_Put() from changes #3 > -- return value from pm_runtime_resume_and_get() directly > -- check return value of devm_pm_runtime_enable() > -- delete pm_runtime_xxx from dp_display_remove() > -- drop dp_display_host_init() from EV_HPD_INIT_SETUP > -- drop both dp_pm_prepare() and dp_pm_compete() from this change > -- delete ST_SUSPENDED state > -- rewording commit text to add more details regrading the purpose > of this change > > Changes in v3: > -- incorporate removing pm_runtime_xx() from dp_pwer.c to this patch > -- use pm_runtime_resume_and_get() instead of pm_runtime_get() > -- error checking pm_runtime_resume_and_get() return value > -- add EV_POWER_PM_GET and PM_EV_POWER_PUT to handle HPD_GPIO case > -- replace dp_pm_suspend() with pm_runtime_force_suspend() > -- replace dp_pm_resume() with pm_runtime_force_resume() > > Signed-off-by: Kuogee Hsieh > Reported-by: kernel test robot > --- > drivers/gpu/drm/msm/dp/dp_aux.c | 5 ++ > drivers/gpu/drm/msm/dp/dp_display.c | 167 ++++++++++++------------------------ > drivers/gpu/drm/msm/dp/dp_power.c | 16 ---- > drivers/gpu/drm/msm/dp/dp_power.h | 11 --- > 4 files changed, 60 insertions(+), 139 deletions(-) > > diff --git a/drivers/gpu/drm/msm/dp/dp_aux.c b/drivers/gpu/drm/msm/dp/dp_aux.c > index 8e3b677..10b6eeb 100644 > --- a/drivers/gpu/drm/msm/dp/dp_aux.c > +++ b/drivers/gpu/drm/msm/dp/dp_aux.c > @@ -291,6 +291,10 @@ static ssize_t dp_aux_transfer(struct drm_dp_aux *dp_aux, > return -EINVAL; > } > > + ret = pm_runtime_resume_and_get(dp_aux->dev); > + if (ret) > + return ret; > + > mutex_lock(&aux->mutex); > if (!aux->initted) { > ret = -EIO; > @@ -364,6 +368,7 @@ static ssize_t dp_aux_transfer(struct drm_dp_aux *dp_aux, > > exit: > mutex_unlock(&aux->mutex); > + pm_runtime_put_sync(dp_aux->dev); > > return ret; > } > diff --git a/drivers/gpu/drm/msm/dp/dp_display.c b/drivers/gpu/drm/msm/dp/dp_display.c > index 89fad67..384a86c 100644 > --- a/drivers/gpu/drm/msm/dp/dp_display.c > +++ b/drivers/gpu/drm/msm/dp/dp_display.c > @@ -49,7 +49,6 @@ enum { > ST_CONNECTED, > ST_DISCONNECT_PENDING, > ST_DISPLAY_OFF, > - ST_SUSPENDED, > }; > > enum { > @@ -310,10 +309,6 @@ static void dp_display_unbind(struct device *dev, struct device *master, > struct dp_display_private *dp = dev_get_dp_display_private(dev); > struct msm_drm_private *priv = dev_get_drvdata(master); > > - /* disable all HPD interrupts */ > - if (dp->core_initialized) > - dp_catalog_hpd_config_intr(dp->catalog, DP_DP_HPD_INT_MASK, false); > - > kthread_stop(dp->ev_tsk); > > of_dp_aux_depopulate_bus(dp->aux); > @@ -558,7 +553,7 @@ static int dp_hpd_plug_handle(struct dp_display_private *dp, u32 data) > drm_dbg_dp(dp->drm_dev, "Before, type=%d hpd_state=%d\n", > dp->dp_display.connector_type, state); > > - if (state == ST_DISPLAY_OFF || state == ST_SUSPENDED) { > + if (state == ST_DISPLAY_OFF) { > mutex_unlock(&dp->event_mutex); > return 0; > } > @@ -575,6 +570,12 @@ static int dp_hpd_plug_handle(struct dp_display_private *dp, u32 data) > return 0; > } > > + ret = pm_runtime_resume_and_get(&dp->pdev->dev); > + if (ret) { > + DRM_ERROR("failed to pm_runtime_resume\n"); > + return ret; > + } > + > ret = dp_display_usbpd_configure_cb(&dp->pdev->dev); > if (ret) { /* link train failed */ > dp->hpd_state = ST_DISCONNECTED; > @@ -657,6 +658,7 @@ static int dp_hpd_unplug_handle(struct dp_display_private *dp, u32 data) > dp->dp_display.connector_type, state); > > /* uevent will complete disconnection part */ > + pm_runtime_put_sync(&dp->pdev->dev); > mutex_unlock(&dp->event_mutex); > return 0; > } > @@ -672,7 +674,7 @@ static int dp_irq_hpd_handle(struct dp_display_private *dp, u32 data) > drm_dbg_dp(dp->drm_dev, "Before, type=%d hpd_state=%d\n", > dp->dp_display.connector_type, state); > > - if (state == ST_DISPLAY_OFF || state == ST_SUSPENDED) { > + if (state == ST_DISPLAY_OFF) { > mutex_unlock(&dp->event_mutex); > return 0; > } > @@ -1085,7 +1087,6 @@ static int hpd_event_thread(void *data) > > switch (todo->event_id) { > case EV_HPD_INIT_SETUP: > - dp_display_host_init(dp_priv); > break; > case EV_HPD_PLUG_INT: > dp_hpd_plug_handle(dp_priv, todo->data); > @@ -1177,7 +1178,9 @@ static int dp_display_request_irq(struct dp_display_private *dp) > } > > rc = devm_request_irq(dev, dp->irq, dp_display_irq_handler, > - IRQF_TRIGGER_HIGH, "dp_display_isr", dp); > + IRQF_TRIGGER_HIGH|IRQF_NO_AUTOEN, > + "dp_display_isr", dp); > + > if (rc < 0) { > DRM_ERROR("failed to request IRQ%u: %d\n", > dp->irq, rc); > @@ -1263,6 +1266,10 @@ static int dp_display_probe(struct platform_device *pdev) > > platform_set_drvdata(pdev, &dp->dp_display); > > + rc = devm_pm_runtime_enable(&pdev->dev); > + if (rc) > + goto err; > + > rc = dp_display_request_irq(dp); > if (rc) > goto err; > @@ -1285,7 +1292,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_power_client_deinit(dp->power); > dp_display_deinit_sub_modules(dp); > > platform_set_drvdata(pdev, NULL); > @@ -1293,109 +1299,39 @@ static int dp_display_remove(struct platform_device *pdev) > return 0; > } > > -static int dp_pm_resume(struct device *dev) > +static int dp_pm_runtime_suspend(struct device *dev) > { > - struct platform_device *pdev = to_platform_device(dev); > - struct msm_dp *dp_display = platform_get_drvdata(pdev); > - struct dp_display_private *dp; > - int sink_count = 0; > - > - dp = container_of(dp_display, struct dp_display_private, dp_display); > - > - mutex_lock(&dp->event_mutex); > - > - drm_dbg_dp(dp->drm_dev, > - "Before, type=%d core_inited=%d phy_inited=%d power_on=%d\n", > - dp->dp_display.connector_type, dp->core_initialized, > - dp->phy_initialized, dp_display->power_on); > - > - /* start from disconnected state */ > - dp->hpd_state = ST_DISCONNECTED; > - > - /* turn on dp ctrl/phy */ > - dp_display_host_init(dp); > - > - if (dp_display->is_edp) > - dp_catalog_ctrl_hpd_enable(dp->catalog); > + struct dp_display_private *dp = dev_get_dp_display_private(dev); > > - if (dp_catalog_link_is_connected(dp->catalog)) { > - /* > - * set sink to normal operation mode -- D0 > - * before dpcd read > - */ > - dp_display_host_phy_init(dp); > - dp_link_psm_config(dp->link, &dp->panel->link_info, false); > - sink_count = drm_dp_read_sink_count(dp->aux); > - if (sink_count < 0) > - sink_count = 0; > + disable_irq(dp->irq); > > + if (dp->dp_display.is_edp) { > dp_display_host_phy_exit(dp); > + dp_catalog_ctrl_hpd_disable(dp->catalog); > } > - > - dp->link->sink_count = sink_count; > - /* > - * can not declared display is connected unless > - * HDMI cable is plugged in and sink_count of > - * dongle become 1 > - * also only signal audio when disconnected > - */ > - if (dp->link->sink_count) { > - dp->dp_display.link_ready = true; > - } else { > - dp->dp_display.link_ready = false; > - dp_display_handle_plugged_change(dp_display, false); > - } > - > - drm_dbg_dp(dp->drm_dev, > - "After, type=%d sink=%d conn=%d core_init=%d phy_init=%d power=%d\n", > - dp->dp_display.connector_type, dp->link->sink_count, > - dp->dp_display.link_ready, dp->core_initialized, > - dp->phy_initialized, dp_display->power_on); > - > - mutex_unlock(&dp->event_mutex); > + dp_display_host_deinit(dp); > > return 0; > } > > -static int dp_pm_suspend(struct device *dev) > +static int dp_pm_runtime_resume(struct device *dev) > { > - struct platform_device *pdev = to_platform_device(dev); > - struct msm_dp *dp_display = platform_get_drvdata(pdev); > - struct dp_display_private *dp; > - > - dp = container_of(dp_display, struct dp_display_private, dp_display); > - > - mutex_lock(&dp->event_mutex); > - > - drm_dbg_dp(dp->drm_dev, > - "Before, type=%d core_inited=%d phy_inited=%d power_on=%d\n", > - dp->dp_display.connector_type, dp->core_initialized, > - dp->phy_initialized, dp_display->power_on); > - > - /* mainlink enabled */ > - if (dp_power_clk_status(dp->power, DP_CTRL_PM)) > - dp_ctrl_off_link_stream(dp->ctrl); > - > - dp_display_host_phy_exit(dp); > - > - /* host_init will be called at pm_resume */ > - dp_display_host_deinit(dp); > - > - dp->hpd_state = ST_SUSPENDED; > - > - drm_dbg_dp(dp->drm_dev, > - "After, type=%d core_inited=%d phy_inited=%d power_on=%d\n", > - dp->dp_display.connector_type, dp->core_initialized, > - dp->phy_initialized, dp_display->power_on); > + struct dp_display_private *dp = dev_get_dp_display_private(dev); > > - mutex_unlock(&dp->event_mutex); > + dp_display_host_init(dp); > + if (dp->dp_display.is_edp) { > + dp_catalog_ctrl_hpd_enable(dp->catalog); > + dp_display_host_phy_init(dp); > + } > > + enable_irq(dp->irq); > return 0; > } > > static const struct dev_pm_ops dp_pm_ops = { > - .suspend = dp_pm_suspend, > - .resume = dp_pm_resume, > + SET_RUNTIME_PM_OPS(dp_pm_runtime_suspend, dp_pm_runtime_resume, NULL) > + SET_SYSTEM_SLEEP_PM_OPS(pm_runtime_force_suspend, > + pm_runtime_force_resume) > }; > > static struct platform_driver dp_display_driver = { > @@ -1478,10 +1414,6 @@ static int dp_display_get_next_bridge(struct msm_dp *dp) > aux_bus = of_get_child_by_name(dev->of_node, "aux-bus"); > > if (aux_bus && dp->is_edp) { > - dp_display_host_init(dp_priv); > - dp_catalog_ctrl_hpd_enable(dp_priv->catalog); > - dp_display_host_phy_init(dp_priv); > - > /* > * The code below assumes that the panel will finish probing > * by the time devm_of_dp_aux_populate_ep_devices() returns. > @@ -1583,6 +1515,11 @@ void dp_bridge_atomic_enable(struct drm_bridge *drm_bridge, > dp_hpd_plug_handle(dp_display, 0); > > mutex_lock(&dp_display->event_mutex); > + if (pm_runtime_resume_and_get(&dp_display->pdev->dev)) { > + DRM_ERROR("failed to pm_runtime_resume\n"); > + mutex_unlock(&dp_display->event_mutex); > + return; > + } > > state = dp_display->hpd_state; > if (state != ST_DISPLAY_OFF && state != ST_MAINLINK_READY) { > @@ -1647,10 +1584,9 @@ void dp_bridge_atomic_post_disable(struct drm_bridge *drm_bridge, > mutex_lock(&dp_display->event_mutex); > > state = dp_display->hpd_state; > - if (state != ST_DISCONNECT_PENDING && state != ST_CONNECTED) { > - mutex_unlock(&dp_display->event_mutex); > - return; > - } > + if (state != ST_DISCONNECT_PENDING && state != ST_CONNECTED) > + drm_dbg_dp(dp->drm_dev, "type=%d wrong hpd_state=%d\n", > + dp->connector_type, state); > > dp_display_disable(dp_display); > > @@ -1663,6 +1599,8 @@ void dp_bridge_atomic_post_disable(struct drm_bridge *drm_bridge, > } > > drm_dbg_dp(dp->drm_dev, "type=%d Done\n", dp->connector_type); > + > + pm_runtime_put_sync(&dp_display->pdev->dev); > mutex_unlock(&dp_display->event_mutex); > } > > @@ -1702,6 +1640,12 @@ void dp_bridge_hpd_enable(struct drm_bridge *bridge) > struct dp_display_private *dp = container_of(dp_display, struct dp_display_private, dp_display); > > mutex_lock(&dp->event_mutex); > + if (pm_runtime_resume_and_get(&dp->pdev->dev)) { > + DRM_ERROR("failed to start power\n"); > + mutex_unlock(&dp->event_mutex); > + return; > + } > + > dp_catalog_ctrl_hpd_enable(dp->catalog); > > /* enable HDP interrupts */ > @@ -1723,6 +1667,8 @@ void dp_bridge_hpd_disable(struct drm_bridge *bridge) > dp_catalog_ctrl_hpd_disable(dp->catalog); > > dp_display->internal_hpd = false; > + > + pm_runtime_put_sync(&dp->pdev->dev); > mutex_unlock(&dp->event_mutex); > } > > @@ -1737,13 +1683,10 @@ void dp_bridge_hpd_notify(struct drm_bridge *bridge, > if (dp_display->internal_hpd) > return; > > - if (!dp->core_initialized) { > - drm_dbg_dp(dp->drm_dev, "not initialized\n"); > - return; > - } > - > - if (!dp_display->link_ready && status == connector_status_connected) > + if (!dp_display->link_ready && status == connector_status_connected) { > + dp->hpd_state = ST_DISCONNECTED; Why? What has changed in this patch so that we have to set the hpd_state? Also shouldn't this be handled in the event handler instead? > dp_add_event(dp, EV_HPD_PLUG_INT, 0, 0); > - else if (dp_display->link_ready && status == connector_status_disconnected) > + } else if (dp_display->link_ready && status == connector_status_disconnected) { > dp_add_event(dp, EV_HPD_UNPLUG_INT, 0, 0); > + } > } > diff --git a/drivers/gpu/drm/msm/dp/dp_power.c b/drivers/gpu/drm/msm/dp/dp_power.c > index 5cb84ca..863c766 100644 > --- a/drivers/gpu/drm/msm/dp/dp_power.c > +++ b/drivers/gpu/drm/msm/dp/dp_power.c > @@ -152,20 +152,9 @@ int dp_power_client_init(struct dp_power *dp_power) > > power = container_of(dp_power, struct dp_power_private, dp_power); > > - pm_runtime_enable(power->dev); > - > return dp_power_clk_init(power); > } > > -void dp_power_client_deinit(struct dp_power *dp_power) > -{ > - struct dp_power_private *power; > - > - power = container_of(dp_power, struct dp_power_private, dp_power); > - > - pm_runtime_disable(power->dev); > -} > - > int dp_power_init(struct dp_power *dp_power) > { > int rc = 0; > @@ -173,11 +162,7 @@ int dp_power_init(struct dp_power *dp_power) > > power = container_of(dp_power, struct dp_power_private, dp_power); > > - pm_runtime_get_sync(power->dev); > - > rc = dp_power_clk_enable(dp_power, DP_CORE_PM, true); > - if (rc) > - pm_runtime_put_sync(power->dev); > > return rc; > } > @@ -189,7 +174,6 @@ int dp_power_deinit(struct dp_power *dp_power) > power = container_of(dp_power, struct dp_power_private, dp_power); > > dp_power_clk_enable(dp_power, DP_CORE_PM, false); > - pm_runtime_put_sync(power->dev); > return 0; > } > > diff --git a/drivers/gpu/drm/msm/dp/dp_power.h b/drivers/gpu/drm/msm/dp/dp_power.h > index a3dec20..55ada51 100644 > --- a/drivers/gpu/drm/msm/dp/dp_power.h > +++ b/drivers/gpu/drm/msm/dp/dp_power.h > @@ -81,17 +81,6 @@ int dp_power_clk_enable(struct dp_power *power, enum dp_pm_type pm_type, > int dp_power_client_init(struct dp_power *power); > > /** > - * dp_power_clinet_deinit() - de-initialize clock and regulator modules > - * > - * @power: instance of power module > - * return: 0 for success, error for failure. > - * > - * This API will de-initialize the DisplayPort's clocks and regulator > - * modules. > - */ > -void dp_power_client_deinit(struct dp_power *power); > - > -/** > * dp_power_get() - configure and get the DisplayPort power module data > * > * @parser: instance of parser module -- With best wishes Dmitry