From: Takashi Iwai <tiwai@suse.de>
To: Alex Deucher <alexdeucher@gmail.com>
Cc: "Zhou, David\(ChunMing\)" <David1.Zhou@amd.com>,
"alsa-devel@alsa-project.org" <alsa-devel@alsa-project.org>,
Nicholas Johnson <nicholas.johnson-opensource@outlook.com.au>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"amd-gfx@lists.freedesktop.org" <amd-gfx@lists.freedesktop.org>,
Takashi Iwai <tiwai@suse.com>, Lukas Wunner <lukas@wunner.de>,
"Deucher, Alexander" <Alexander.Deucher@amd.com>,
"Koenig, Christian" <Christian.Koenig@amd.com>
Subject: Re: [PATCH 0/1] Fiji GPU audio register timeout when in BACO state
Date: Thu, 30 Apr 2020 17:14:56 +0200 [thread overview]
Message-ID: <s5hwo5xj98v.wl-tiwai@suse.de> (raw)
In-Reply-To: <CADnq5_Mjb_FnNOzjUfJZ7GSDzi-+Cfc1ZTuqm7UWCWVvY6DU_w@mail.gmail.com>
On Wed, 29 Apr 2020 18:19:57 +0200,
Alex Deucher wrote:
>
> On Wed, Apr 29, 2020 at 12:05 PM Takashi Iwai <tiwai@suse.de> wrote:
> > Well, but the code path there is the runtime PM resume of the audio
> > device and it means that GPU must have been runtime-resumed again
> > beforehand via the device link. So, it should have worked from the
> > beginning but in reality not -- that is, apparently some inconsistency
> > is found in the initial attempt of the runtime resume...
>
> Yeah, it should be covered, but I wonder if there is something in the
> ELD update sequence that needs to call pm_runtime_get_sync()? The ELD
> sequence on AMD GPUs doesn't work the same as on other vendors. The
> GPU driver has a backdoor into the HDA device's verbs to set update
> the audio state rather than doing it via an ELD buffer update. We
> still update the ELD buffer for consistency. Maybe when the GPU
> driver sets the audio state at monitor detection time that triggers an
> interrupt or something on the HDA side which races with the CPU and
> the power down of the GPU. That still seems unlikely though since the
> runtime pm on the GPU side defaults to a 5 second suspend timer.
I'm not sure whether it's the race between runtime suspend of GPU vs
runtime resume of audio. My wild guess is rather that it's the timing
GPU notifies to the audio; then the audio driver notifies to
user-space and user-space opens the stream, which in turn invokes the
runtime resume of GPU. But in GPU side, it's still under processing,
so it proceeds before the GPU finishes its initialization job.
Nicholas, could you try the patch below and see whether the problem
still appears? The patch artificially delays the notification and ELD
update for 300msec. If this works, it means the timing problem.
thanks,
Takashi
--- a/sound/pci/hda/patch_hdmi.c
+++ b/sound/pci/hda/patch_hdmi.c
@@ -767,6 +767,7 @@ static void check_presence_and_report(struct hda_codec *codec, hda_nid_t nid,
if (pin_idx < 0)
return;
mutex_lock(&spec->pcm_lock);
+ get_pin(spec, pin_idx)->repoll_count = 1;
hdmi_present_sense(get_pin(spec, pin_idx), 1);
mutex_unlock(&spec->pcm_lock);
}
@@ -1647,7 +1648,10 @@ static void sync_eld_via_acomp(struct hda_codec *codec,
per_pin->dev_id, &eld->monitor_present,
eld->eld_buffer, ELD_MAX_SIZE);
eld->eld_valid = (eld->eld_size > 0);
- update_eld(codec, per_pin, eld, 0);
+ if (per_pin->repoll_count)
+ schedule_delayed_work(&per_pin->work, msecs_to_jiffies(300));
+ else
+ update_eld(codec, per_pin, eld, 0);
mutex_unlock(&per_pin->lock);
}
@@ -1669,6 +1673,11 @@ static void hdmi_repoll_eld(struct work_struct *work)
struct hdmi_spec *spec = codec->spec;
struct hda_jack_tbl *jack;
+ if (codec_has_acomp(codec)) {
+ per_pin->repoll_count = 0;
+ goto check;
+ }
+
jack = snd_hda_jack_tbl_get_mst(codec, per_pin->pin_nid,
per_pin->dev_id);
if (jack)
@@ -1677,6 +1686,7 @@ static void hdmi_repoll_eld(struct work_struct *work)
if (per_pin->repoll_count++ > 6)
per_pin->repoll_count = 0;
+ check:
mutex_lock(&spec->pcm_lock);
hdmi_present_sense(per_pin, per_pin->repoll_count);
mutex_unlock(&spec->pcm_lock);
next prev parent reply other threads:[~2020-04-30 15:16 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <PSXP216MB0438D2AF96CE0D4F83F48C4D80AE0@PSXP216MB0438.KORP216.PROD.OUTLOOK.COM>
2020-04-27 14:22 ` [PATCH 0/1] Fiji GPU audio register timeout when in BACO state Deucher, Alexander
2020-04-27 15:15 ` Takashi Iwai
2020-04-27 17:20 ` Nicholas Johnson
2020-04-27 18:28 ` Alex Deucher
2020-04-27 18:39 ` Takashi Iwai
2020-04-27 18:43 ` Alex Deucher
2020-04-28 7:57 ` Takashi Iwai
2020-04-28 14:48 ` Nicholas Johnson
2020-04-29 7:37 ` Takashi Iwai
2020-04-29 15:27 ` Nicholas Johnson
2020-04-29 15:43 ` Takashi Iwai
2020-04-29 15:47 ` Alex Deucher
2020-04-29 16:05 ` Takashi Iwai
2020-04-29 16:19 ` Alex Deucher
2020-04-30 15:14 ` Takashi Iwai [this message]
2020-04-30 16:52 ` Nicholas Johnson
2020-04-30 17:01 ` Takashi Iwai
2020-04-30 17:38 ` Nicholas Johnson
2020-04-30 17:49 ` Takashi Iwai
2020-05-02 7:11 ` Takashi Iwai
2020-05-02 7:17 ` Lukas Wunner
2020-05-02 7:27 ` Takashi Iwai
2020-05-02 10:09 ` Takashi Iwai
2020-05-06 15:15 ` Nicholas Johnson
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=s5hwo5xj98v.wl-tiwai@suse.de \
--to=tiwai@suse.de \
--cc=Alexander.Deucher@amd.com \
--cc=Christian.Koenig@amd.com \
--cc=David1.Zhou@amd.com \
--cc=alexdeucher@gmail.com \
--cc=alsa-devel@alsa-project.org \
--cc=amd-gfx@lists.freedesktop.org \
--cc=linux-kernel@vger.kernel.org \
--cc=lukas@wunner.de \
--cc=nicholas.johnson-opensource@outlook.com.au \
--cc=tiwai@suse.com \
/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