From: Kuogee Hsieh <quic_khsieh@quicinc.com>
To: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
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>
Subject: Re: [PATCH v3 6/7] drm/msm/dp: add pm_runtime_force_suspend()/resume()
Date: Wed, 20 Sep 2023 12:49:19 -0700 [thread overview]
Message-ID: <cc9d09f1-2f59-19ae-8c69-15caaadf264a@quicinc.com> (raw)
In-Reply-To: <CAA8EJpr2wRq6Txi7YAQpJKa_9UGqH_nmHzvVOaAPkwOrtDg4Tw@mail.gmail.com>
On 9/19/2023 2:50 AM, Dmitry Baryshkov wrote:
> On Mon, 18 Sept 2023 at 20:48, Kuogee Hsieh <quic_khsieh@quicinc.com> wrote:
>>
>> On 9/15/2023 6:21 PM, Dmitry Baryshkov wrote:
>>> On Sat, 16 Sept 2023 at 00:38, Kuogee Hsieh <quic_khsieh@quicinc.com> wrote:
>>>> Add pm_runtime_force_suspend()/resume() to complete incorporating pm
>>>> runtime framework into DP driver. Both dp_pm_prepare() and dp_pm_complete()
>>>> are added to set hpd_state to correct state. After resume, DP driver will
>>>> re training its main link after .hpd_enable() callback enabled HPD
>>>> interrupts and bring up display accordingly.
>>> How will it re-train the main link? What is the code path for that?
>> 1) for edp, dp_bridge_atomic_enable(), called from framework, to start
>> link training and bring up display.
> And this path doesn't use .hpd_enable() which you have mentioned in
> the commit message. Please don't try to shorten the commit message.
> You see, I have had questions to several of them, which means that
> they were not verbose enough.
ok, my bad,
I will add more explain to commit text.
>> 2) for external DP, HPD_PLUG_INT will be generated to start link
>> training and bring up display.
> This should be hpd_notify, who starts link training, not some event.
>
>>> I think this is a misuse for prepare/complete callbacks, at least
>>> judging from their documentation.
>> 1) dp_pm_prepare() is called to make sure eDP/DP related power/clocks
>> are off and set hpd_state to ST_SUSPENDED and nothing else.
>>
>> 2) dp_pm_completed() is called to set hpd_state to ST_ST_DISCONNECTED
>> (default state) and nothing else.
>>
>> I think both are doing proper action.
> Have you read the prepare() / complete() documentation? Does your
> usage follow the documented use case?
I think I can just remove both dp_pm_prepare and dp_pm_complete fro
this patch.
>
>>
>>>> Changes in v3:
>>>> -- replace dp_pm_suspend() with pm_runtime_force_suspend()
>>>> -- replace dp_pm_resume() with pm_runtime_force_resume()
>>>>
>>>> Signed-off-by: Kuogee Hsieh <quic_khsieh@quicinc.com>
>>>> ---
>>>> drivers/gpu/drm/msm/dp/dp_display.c | 87 +++++--------------------------------
>>>> 1 file changed, 10 insertions(+), 77 deletions(-)
>>>>
>>>> diff --git a/drivers/gpu/drm/msm/dp/dp_display.c b/drivers/gpu/drm/msm/dp/dp_display.c
>>>> index b6992202..b58cb02 100644
>>>> --- a/drivers/gpu/drm/msm/dp/dp_display.c
>>>> +++ b/drivers/gpu/drm/msm/dp/dp_display.c
>>>> @@ -1333,101 +1333,35 @@ static int dp_pm_runtime_resume(struct device *dev)
>>>> return 0;
>>>> }
>>>>
>>>> -static int dp_pm_resume(struct device *dev)
>>>> +static void dp_pm_complete(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);
>>>> + struct dp_display_private *dp = dev_get_dp_display_private(dev);
>>>>
>>>> mutex_lock(&dp->event_mutex);
>>>>
>>>> drm_dbg_dp(dp->drm_dev,
>>>> - "Before, type=%d core_inited=%d phy_inited=%d power_on=%d\n",
>>>> + "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);
>>>> + dp->phy_initialized, dp->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);
>>>> -
>>>> - 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;
>>>> -
>>>> - dp_display_host_phy_exit(dp);
>>>> - }
>>>> -
>>>> - 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);
>>>> -
>>>> - return 0;
>>>> }
>>>>
>>>> -static int dp_pm_suspend(struct device *dev)
>>>> +static int dp_pm_prepare(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);
>>>> + struct dp_display_private *dp = dev_get_dp_display_private(dev);
>>>>
>>>> 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);
>>>> -
>>>> mutex_unlock(&dp->event_mutex);
>>>>
>>>> return 0;
>>>> @@ -1435,8 +1369,10 @@ static int dp_pm_suspend(struct device *dev)
>>>>
>>>> static const struct dev_pm_ops dp_pm_ops = {
>>>> SET_RUNTIME_PM_OPS(dp_pm_runtime_suspend, dp_pm_runtime_resume, NULL)
>>>> - .suspend = dp_pm_suspend,
>>>> - .resume = dp_pm_resume,
>>>> + SET_SYSTEM_SLEEP_PM_OPS(pm_runtime_force_suspend,
>>>> + pm_runtime_force_resume)
>>>> + .prepare = dp_pm_prepare,
>>>> + .complete = dp_pm_complete,
>>>> };
>>>>
>>>> static struct platform_driver dp_display_driver = {
>>>> @@ -1670,9 +1606,6 @@ void dp_bridge_atomic_post_disable(struct drm_bridge *drm_bridge,
>>>>
>>>> dp_display = container_of(dp, struct dp_display_private, dp_display);
>>>>
>>>> - if (dp->is_edp)
>>>> - dp_hpd_unplug_handle(dp_display, 0);
>>>> -
>>>> mutex_lock(&dp_display->event_mutex);
>>>>
>>>> state = dp_display->hpd_state;
>>>> --
>>>> 2.7.4
>>>>
>
>
next prev parent reply other threads:[~2023-09-20 19:49 UTC|newest]
Thread overview: 41+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-09-15 21:38 [PATCH v3 0/7] incorporate pm runtime framework and eDP clean up Kuogee Hsieh
2023-09-15 21:38 ` [PATCH v3 1/7] drm/msm/dp: tie dp_display_irq_handler() with dp driver Kuogee Hsieh
2023-09-16 0:29 ` Dmitry Baryshkov
2023-09-18 17:02 ` Kuogee Hsieh
2023-09-19 9:44 ` Dmitry Baryshkov
2023-09-22 23:02 ` Kuogee Hsieh
2023-09-23 18:45 ` Dmitry Baryshkov
2023-09-27 15:25 ` Kuogee Hsieh
2023-09-15 21:38 ` [PATCH v3 2/7] drm/msm/dp: replace is_connected with link_ready Kuogee Hsieh
2023-09-16 1:51 ` Dmitry Baryshkov
2023-09-18 17:09 ` Kuogee Hsieh
2023-09-19 9:44 ` Dmitry Baryshkov
2023-09-15 21:38 ` [PATCH v3 3/7] drm/msm/dp: use drm_bridge_hpd_notify() to report HPD status changes Kuogee Hsieh
2023-09-16 0:41 ` Dmitry Baryshkov
2023-09-18 20:16 ` Kuogee Hsieh
2023-09-19 9:45 ` Dmitry Baryshkov
2023-09-15 21:38 ` [PATCH v3 4/7] drm/msm/dp: incorporate pm_runtime framework into DP driver Kuogee Hsieh
2023-09-16 1:07 ` Dmitry Baryshkov
2023-09-20 22:46 ` Kuogee Hsieh
2023-09-25 9:06 ` Dmitry Baryshkov
2023-09-16 5:25 ` kernel test robot
2023-09-15 21:38 ` [PATCH v3 5/7] drm/msm/dp: delete EV_HPD_INIT_SETUP Kuogee Hsieh
2023-09-16 1:09 ` Dmitry Baryshkov
2023-09-15 21:38 ` [PATCH v3 6/7] drm/msm/dp: add pm_runtime_force_suspend()/resume() Kuogee Hsieh
2023-09-16 1:21 ` Dmitry Baryshkov
2023-09-18 17:47 ` Kuogee Hsieh
2023-09-19 9:50 ` Dmitry Baryshkov
2023-09-20 19:49 ` Kuogee Hsieh [this message]
2023-09-22 21:54 ` Stephen Boyd
2023-09-23 1:35 ` Abhinav Kumar
2023-09-25 16:07 ` Kuogee Hsieh
2023-09-27 22:01 ` Stephen Boyd
2023-09-27 22:04 ` Dmitry Baryshkov
2023-09-29 0:46 ` Abhinav Kumar
2023-10-02 22:58 ` Stephen Boyd
2023-10-03 1:32 ` Abhinav Kumar
2023-10-03 8:00 ` Dmitry Baryshkov
2023-09-27 21:41 ` Stephen Boyd
2023-09-28 22:35 ` Abhinav Kumar
2023-09-15 21:38 ` [PATCH v3 7/7] drm/msm/dp: move of_dp_aux_populate_bus() to eDP probe() Kuogee Hsieh
2023-09-16 1:48 ` Dmitry Baryshkov
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=cc9d09f1-2f59-19ae-8c69-15caaadf264a@quicinc.com \
--to=quic_khsieh@quicinc.com \
--cc=agross@kernel.org \
--cc=airlied@gmail.com \
--cc=andersson@kernel.org \
--cc=daniel@ffwll.ch \
--cc=dianders@chromium.org \
--cc=dmitry.baryshkov@linaro.org \
--cc=dri-devel@lists.freedesktop.org \
--cc=freedreno@lists.freedesktop.org \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=marijn.suijten@somainline.org \
--cc=quic_abhinavk@quicinc.com \
--cc=quic_jesszhan@quicinc.com \
--cc=quic_sbillaka@quicinc.com \
--cc=robdclark@gmail.com \
--cc=sean@poorly.run \
--cc=swboyd@chromium.org \
--cc=vkoul@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®