From: khsieh@codeaurora.org
To: Stephen Boyd <swboyd@chromium.org>
Cc: robdclark@gmail.com, sean@poorly.run, tanmay@codeaurora.org,
abhinavk@codeaurora.org, aravindh@codeaurora.org,
airlied@linux.ie, daniel@ffwll.ch, linux-arm-msm@vger.kernel.org,
dri-devel@lists.freedesktop.org, freedreno@lists.freedesktop.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2 2/3] drm/msm/dp: do not re initialize of audio_comp at display_disable()
Date: Wed, 14 Apr 2021 10:55:09 -0700 [thread overview]
Message-ID: <cf72c919404a5bb4d0bdf101a341b074@codeaurora.org> (raw)
In-Reply-To: <161837022104.3764895.807226402876043006@swboyd.mtv.corp.google.com>
On 2021-04-13 20:17, Stephen Boyd wrote:
> Quoting Kuogee Hsieh (2021-04-13 16:11:30)
>> At dongle unplug, dp initializes audio_comp followed by sending
>> disconnect
>> event notification to audio and to make sure audio had shutdown
>> completely
>> by wait for audio completion notification at display_disable(). This
>> patch
>
> Is this dp_display_disable()? Doubtful that display_disable() is the
> function we're talking about.
yes
>
>> will not re initialize audio_comp at display_disable() if audio
>> shutdown
>> is triggered by dongle unplugged.
>
> This commit text seems to say the why before the what, where why is "dp
> initializes audio_comp followed by sending disconnect.." and the what
> is
> "this patch will no re-initialized audio_comp...". Can you reorder this
> so the what comes before the why?
>
ok
>>
>> Signed-off-by: Kuogee Hsieh <khsieh@codeaurora.org>
>> ---
>> drivers/gpu/drm/msm/dp/dp_display.c | 6 ++++--
>> 1 file changed, 4 insertions(+), 2 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/msm/dp/dp_display.c
>> b/drivers/gpu/drm/msm/dp/dp_display.c
>> index 0ba71c7..1d71c95 100644
>> --- a/drivers/gpu/drm/msm/dp/dp_display.c
>> +++ b/drivers/gpu/drm/msm/dp/dp_display.c
>> @@ -894,8 +894,10 @@ static int dp_display_disable(struct
>> dp_display_private *dp, u32 data)
>> /* wait only if audio was enabled */
>> if (dp_display->audio_enabled) {
>> /* signal the disconnect event */
>> - reinit_completion(&dp->audio_comp);
>> - dp_display_handle_plugged_change(dp_display, false);
>> + if (dp->hpd_state != ST_DISCONNECT_PENDING) {
>> + reinit_completion(&dp->audio_comp);
>
> Why is this reinitialized here at all? Wouldn't it make more sense to
> initialize the completion once at cable plug in and then not initialize
> the completion anywhere else? Or initialize the completion whenever
> dp_display->audio_enabled is set to true and then only wait for the
> completion here if that boolean is true? Or initialize the completion
> when dp_display_handle_plugged_change() is passed true for the
> 'plugged'
> argument?
> yes, i think it is better approach, this will take care of both unplug
> and suspend.
> I started reading the code and quickly got lost figuring out how
> dp_display_handle_plugged_change() worked and the interaction between
> the dp display code and the audio codec embedded in here. There seem to
> be a couple of conditions that cut off things early, like
> dp_display->audio_enabled and audio->engine_on. Why? Why does
> dp_display_signal_audio_complete() call complete_all() vs. just
> complete()? Please help! :(
>
>> + dp_display_handle_plugged_change(dp_display,
>> false);
>
> I think it's this way because dp_hpd_unplug_handle() is the function
> that sets the hpd_state to ST_DISCONNECT_PENDING and then reinitializes
> the completion (why?) and calls dp_display_handle_plugged_change(). So
> the commit text could say that reinitializing the completion again here
> at dp_display_disable() is racing with the audio code in the case that
> dp_hpd_unplug_handle() already called
> dp_display_handle_plugged_change() and it would make more sense. But
> the
> question still stands why that race even exists in the first place vs.
> initializing the completion variable in only one place unconditionally
> when the cable is connected, in dp_hpd_plug_handle() or
> dp_display_post_enable().
>
>> + }
>> if (!wait_for_completion_timeout(&dp->audio_comp,
>> HZ * 5))
>> DRM_ERROR("audio comp timeout\n");
WARNING: multiple messages have this Message-ID (diff)
From: khsieh@codeaurora.org
To: Stephen Boyd <swboyd@chromium.org>
Cc: freedreno@lists.freedesktop.org, airlied@linux.ie,
linux-arm-msm@vger.kernel.org, dri-devel@lists.freedesktop.org,
linux-kernel@vger.kernel.org, abhinavk@codeaurora.org,
tanmay@codeaurora.org, aravindh@codeaurora.org, sean@poorly.run
Subject: Re: [PATCH v2 2/3] drm/msm/dp: do not re initialize of audio_comp at display_disable()
Date: Wed, 14 Apr 2021 10:55:09 -0700 [thread overview]
Message-ID: <cf72c919404a5bb4d0bdf101a341b074@codeaurora.org> (raw)
In-Reply-To: <161837022104.3764895.807226402876043006@swboyd.mtv.corp.google.com>
On 2021-04-13 20:17, Stephen Boyd wrote:
> Quoting Kuogee Hsieh (2021-04-13 16:11:30)
>> At dongle unplug, dp initializes audio_comp followed by sending
>> disconnect
>> event notification to audio and to make sure audio had shutdown
>> completely
>> by wait for audio completion notification at display_disable(). This
>> patch
>
> Is this dp_display_disable()? Doubtful that display_disable() is the
> function we're talking about.
yes
>
>> will not re initialize audio_comp at display_disable() if audio
>> shutdown
>> is triggered by dongle unplugged.
>
> This commit text seems to say the why before the what, where why is "dp
> initializes audio_comp followed by sending disconnect.." and the what
> is
> "this patch will no re-initialized audio_comp...". Can you reorder this
> so the what comes before the why?
>
ok
>>
>> Signed-off-by: Kuogee Hsieh <khsieh@codeaurora.org>
>> ---
>> drivers/gpu/drm/msm/dp/dp_display.c | 6 ++++--
>> 1 file changed, 4 insertions(+), 2 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/msm/dp/dp_display.c
>> b/drivers/gpu/drm/msm/dp/dp_display.c
>> index 0ba71c7..1d71c95 100644
>> --- a/drivers/gpu/drm/msm/dp/dp_display.c
>> +++ b/drivers/gpu/drm/msm/dp/dp_display.c
>> @@ -894,8 +894,10 @@ static int dp_display_disable(struct
>> dp_display_private *dp, u32 data)
>> /* wait only if audio was enabled */
>> if (dp_display->audio_enabled) {
>> /* signal the disconnect event */
>> - reinit_completion(&dp->audio_comp);
>> - dp_display_handle_plugged_change(dp_display, false);
>> + if (dp->hpd_state != ST_DISCONNECT_PENDING) {
>> + reinit_completion(&dp->audio_comp);
>
> Why is this reinitialized here at all? Wouldn't it make more sense to
> initialize the completion once at cable plug in and then not initialize
> the completion anywhere else? Or initialize the completion whenever
> dp_display->audio_enabled is set to true and then only wait for the
> completion here if that boolean is true? Or initialize the completion
> when dp_display_handle_plugged_change() is passed true for the
> 'plugged'
> argument?
> yes, i think it is better approach, this will take care of both unplug
> and suspend.
> I started reading the code and quickly got lost figuring out how
> dp_display_handle_plugged_change() worked and the interaction between
> the dp display code and the audio codec embedded in here. There seem to
> be a couple of conditions that cut off things early, like
> dp_display->audio_enabled and audio->engine_on. Why? Why does
> dp_display_signal_audio_complete() call complete_all() vs. just
> complete()? Please help! :(
>
>> + dp_display_handle_plugged_change(dp_display,
>> false);
>
> I think it's this way because dp_hpd_unplug_handle() is the function
> that sets the hpd_state to ST_DISCONNECT_PENDING and then reinitializes
> the completion (why?) and calls dp_display_handle_plugged_change(). So
> the commit text could say that reinitializing the completion again here
> at dp_display_disable() is racing with the audio code in the case that
> dp_hpd_unplug_handle() already called
> dp_display_handle_plugged_change() and it would make more sense. But
> the
> question still stands why that race even exists in the first place vs.
> initializing the completion variable in only one place unconditionally
> when the cable is connected, in dp_hpd_plug_handle() or
> dp_display_post_enable().
>
>> + }
>> if (!wait_for_completion_timeout(&dp->audio_comp,
>> HZ * 5))
>> DRM_ERROR("audio comp timeout\n");
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel
next prev parent reply other threads:[~2021-04-14 17:55 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-04-13 23:11 [PATCH v2 2/3] drm/msm/dp: do not re initialize of audio_comp at display_disable() Kuogee Hsieh
2021-04-13 23:11 ` Kuogee Hsieh
2021-04-14 3:17 ` Stephen Boyd
2021-04-14 3:17 ` Stephen Boyd
2021-04-14 17:55 ` khsieh [this message]
2021-04-14 17:55 ` khsieh
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=cf72c919404a5bb4d0bdf101a341b074@codeaurora.org \
--to=khsieh@codeaurora.org \
--cc=abhinavk@codeaurora.org \
--cc=airlied@linux.ie \
--cc=aravindh@codeaurora.org \
--cc=daniel@ffwll.ch \
--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=robdclark@gmail.com \
--cc=sean@poorly.run \
--cc=swboyd@chromium.org \
--cc=tanmay@codeaurora.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.