All of lore.kernel.org
 help / color / mirror / Atom feed
From: Takashi Iwai <tiwai@suse.de>
To: jimqu <jimqu@amd.com>
Cc: "alsa-devel@alsa-project.org" <alsa-devel@alsa-project.org>,
	"dri-devel@lists.freedesktop.org"
	<dri-devel@lists.freedesktop.org>, "Qu, Jim" <Jim.Qu@amd.com>,
	"amd-gfx@lists.freedesktop.org" <amd-gfx@lists.freedesktop.org>,
	"Deucher, Alexander" <Alexander.Deucher@amd.com>
Subject: Re: 答复: 答复: [alsa-devel] 答复: [PATCH] vgaswitchroo: set audio client id according to bound gpu client id
Date: Wed, 11 Jul 2018 11:53:19 +0200	[thread overview]
Message-ID: <s5h601mayk0.wl-tiwai@suse.de> (raw)
In-Reply-To: <46d4d516-8373-2b22-da2e-f9f386c66973@amd.com>

On Wed, 11 Jul 2018 11:26:11 +0200,
jimqu wrote:
> 
> 
> 
> On 2018年07月11日 17:04, Takashi Iwai wrote:
> > On Wed, 11 Jul 2018 10:41:38 +0200,
> > jimqu wrote:
> >>
> >>
> >> On 2018年07月11日 15:19, Takashi Iwai wrote:
> >>> On Tue, 10 Jul 2018 13:21:00 +0200,
> >>> Takashi Iwai wrote:
> >>>>> revert the fix of amdgpu suspend issue, audio issue also can be observed.
> >>>> Did you check the behavior with the single AMD GPU hardware?
> >>>> If confirmed, we can forget about vga_switcheroo.
> >>> ... and taking a look back at the recent changes, I guess it can be
> >>> the forced runtime PM enablement, not directly with vga_switcheroo
> >>> action itself.
> >> Yeah, the function vga_switcheroo_set_dynamic_switch() has discarded,
> >> so there is no way GFX driver to control audio power. However, keep in
> >> mind, current audio is bound to iGPU, that mean the issue should be
> >> nothing about
> >> vgaswtichreoo. since current audio pci bus is different from dGPU,
> >> that means the pci_bus_set_current_state() in
> >> vga_switcheroo_runtime_suspend() and pci_wakeup_bus() in
> >> vga_switcheroo_runtime_resume() could not touch the audio pci power
> >> state from dGPU instance.
> >>
> >> This is a feedback got from our OEM developer, it is the overview of
> >> audio detect process.
> >>
> >>> First, the kernel  audio driver will be triggered to read ELD, if the
> >>>> ELD is valid, it will report a jack event (on or available) to sound
> >>>> core driver; the pulseaudio subscribe all jack events, if it is told
> >>>> that the hdmi jack is plugged in (on), the pulseaudio will set this
> >>>> port to available, then the pa-card or pa-sink has available port, it
> >>>> can be selected (manually, some daemons or policy in
> >>>> /usr/share/pulseaudio/alsa-mixer/) as default output card/default sink.
> >> If the description is correct. I think there are maybe two problems.
> >>
> >> 1. audio will auto power off after setup device link duo to usage_count=0.
> >> 2. duo to audio is power down, it could not get the HDMI jack insert event.
> >>
> >> How do you think?
> >>
> >>> Jim, could you tell me which PCI devices are handled as vga_switcheroo
> >>> audio client?  The kernel should show all messages "xxx: Handle
> >>> vga_switcheroo audio client".
> >> [    4.311095] snd_hda_intel 0000:06:00.1: enabling device (0000 -> 0002)
> >> [    4.314286] snd_hda_intel 0000:06:00.1: Handle vga_switcheroo audio
> >> client
> >> [    4.314822] snd_hda_intel 0000:06:00.6: enabling device (0000 -> 0002)
> >>
> >> 01:00.0 VGA compatible controller [0300]: Advanced Micro Devices,
> >> Inc. [AMD/ATI] Device [1002:699f] (rev c3)
> >> 06:00.0 VGA compatible controller [0300]: Advanced Micro Devices,
> >> Inc. [AMD/ATI] Device [1002:15dd] (rev d1)
> >> 06:00.1 Audio device [0403]: Advanced Micro Devices, Inc. [AMD/ATI]
> >> Device [1002:15de]
> > OK this sheds a brighter light, finally.
> >
> > If my understanding is correct, the issue is a false vga_switcheroo
> > audio detection, after all.  This is the primary GPU and it shouldn't
> > be registered as a vga_switcheroo discrete GPU.
> >
> > Below is a very ugly workaround for this particular case.  It assumes
> > that the AMD+AMD combo will never have audio outputs on both but only
> > for the primary, and it's possibly wrong.
> >
> > Is there a handy way to identify whether the given VGA PCI entry is
> > a discrete GPU or not?  The amdgpu and radeon seem checking ATPX
> > ACPI.
> 
> This is no issue about this topic, in amdgpu driver, both iGPU/dGPU
> will register as VGA_SWITCHEROO_UNKNOWN_ID, and the client id will be
> re-initialized in vgaswitchreoo_enable() via ATPX call. Then, iGPU
> will set as VGA_SWITCHEROO_IGD, and dGPU will set as
> VGA_SWITCHEROO_DIS.

Please check the patch.  It's not about AMDGPU driver but the vga
switcheroo detection in HD-audio driver.  Not the GPU side but the
audio side.

The issues are two folds:
- We register each AMD controller associated with a GPU always as a
  discrete GPU vga_switcheroo audio.
- And when it's registered as a vga_switcheroo client, we forcibly
  enable runtime PM of the controller, since discrete GPU needs the
  runtime suspend.

So a workaround in your case is just not to register as a vga
switcheroo audio client.  Then the runtime PM isn't enabled in the AMD
HDMI audio controller, and the HDMI detection remains active.


Takashi

> 
> Thanks
> JimQu
> >
> > Takashi
> >
> > ---
> > --- a/sound/pci/hda/hda_intel.c
> > +++ b/sound/pci/hda/hda_intel.c
> > @@ -1418,8 +1418,18 @@ static int azx_dev_free(struct snd_device *device)
> >    */
> >   static struct pci_dev *get_bound_vga(struct pci_dev *pci)
> >   {
> > +	static const struct pci_device_id ids[] = {
> > +		{ PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_ANY_ID),
> > +		  .class = PCI_BASE_CLASS_DISPLAY << 16,
> > +		  .class_mask = 0xff << 16 },
> > +		{}
> > +	};
> >   	struct pci_dev *p;
> >   +	/* check whether Intel graphics is present as primary GPU */
> > +	if (!pci_dev_present(ids))
> > +		return NULL;
> > +
> >   	/* check only discrete GPU */
> >   	switch (pci->vendor) {
> >   	case PCI_VENDOR_ID_ATI:
> 
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

  reply	other threads:[~2018-07-11  9:53 UTC|newest]

Thread overview: 60+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-06-28  6:22 [PATCH] vgaswitchroo: set audio client id according to bound gpu client id Jim Qu
2018-06-28 12:43 ` Alex Deucher
     [not found]   ` <CADnq5_NcNfMD9UDN17c-513rD--kQY7nzw6OTgimV0pVqLjbOg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2018-06-29  7:39     ` 答复: " Qu, Jim
2018-06-29  8:06       ` Lukas Wunner
     [not found]         ` <20180629080634.GA7357-JFq808J9C/izQB+pC5nmwQ@public.gmane.org>
2018-06-29  8:55           ` 答复: " Qu, Jim
     [not found]             ` <DM3PR12MB08737DC9FB94BB6F3AEF5634994E0-4hRkV8tDpBiYEITDcfEJ8AdYzm3356FpvxpqHgZTriW3zl9H0oFU5g@public.gmane.org>
2018-06-29  9:21               ` Lukas Wunner
     [not found]                 ` <20180629092138.GA11849-JFq808J9C/izQB+pC5nmwQ@public.gmane.org>
2018-06-29 10:40                   ` Qu, Jim
2018-06-29 11:11                     ` Lukas Wunner
2018-07-09  8:52                       ` 答复: " Qu, Jim
     [not found]                         ` <DM3PR12MB0873FEC702770190057B49F799440-4hRkV8tDpBiYEITDcfEJ8AdYzm3356FpvxpqHgZTriW3zl9H0oFU5g@public.gmane.org>
2018-07-09  9:27                           ` Lukas Wunner
     [not found]                             ` <20180709092759.GA3649-JFq808J9C/izQB+pC5nmwQ@public.gmane.org>
2018-07-09 10:16                               ` 答复: " Qu, Jim
     [not found]                                 ` <DM3PR12MB087309CBC2CD3A934327EBCE99440-4hRkV8tDpBiYEITDcfEJ8AdYzm3356FpvxpqHgZTriW3zl9H0oFU5g@public.gmane.org>
2018-07-09 13:58                                   ` Alex Deucher
     [not found]                                     ` <CADnq5_OpZz=AgNomX7+5BzeN77CRZT7mXDT7kn620TE-OjqS0w-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2018-07-09 15:04                                       ` [alsa-devel] " Takashi Iwai
2018-07-09 15:47                                         ` [alsa-devel] ??????: " Lukas Wunner
2018-07-09 15:52                                           ` Takashi Iwai
2018-07-09 15:59                                             ` Alex Deucher
2018-07-09 16:02                                               ` Takashi Iwai
     [not found]                                             ` <s5hsh4scsoe.wl-tiwai-l3A5Bk7waGM@public.gmane.org>
2018-07-09 16:06                                               ` [alsa-devel] " Lukas Wunner
2018-07-09 16:15                                                 ` Alex Deucher
     [not found]                                                   ` <CADnq5_OqsZyMJx5TCqdr4iydzVyb3UHtqadvuq0szG+kNPe9dg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2018-07-09 17:04                                                     ` Takashi Iwai
     [not found]                                           ` <20180709154734.GA30496-JFq808J9C/izQB+pC5nmwQ@public.gmane.org>
2018-07-09 15:53                                             ` 答复: " Qu, Jim
2018-07-09 15:57                                               ` Takashi Iwai
2018-07-09 16:03                                                 ` 答复: " Alex Deucher
2018-07-09 17:06                                                   ` 答复: [alsa-devel] " Takashi Iwai
     [not found]                                         ` <s5hr2kco3gp.wl-tiwai-l3A5Bk7waGM@public.gmane.org>
2018-07-09 15:56                                           ` [alsa-devel] 答复: " Daniel Vetter
     [not found]                                             ` <20180709155643.GE3008-dv86pmgwkMBes7Z6vYuT8azUEOm+Xw19@public.gmane.org>
2018-07-09 15:58                                               ` Takashi Iwai
2018-07-09 16:05                                                 ` 答复: " Qu, Jim
     [not found]                                                   ` <DM3PR12MB0873E9DD8B7448CB8A6829DA99440-4hRkV8tDpBiYEITDcfEJ8AdYzm3356FpvxpqHgZTriW3zl9H0oFU5g@public.gmane.org>
2018-07-09 17:09                                                     ` Takashi Iwai
2018-07-10  7:44                                                       ` 答复: " Qu, Jim
2018-07-10  7:50                                                         ` Qu, Jim
     [not found]                                                   ` <DM3PR12MB0873205E27A9241DB3B10EA5995B0-4hRkV8tDpBiYEITDcfEJ8AdYzm3356FpvxpqHgZTriW3zl9H0oFU5g@public.gmane.org>
2018-07-10  8:01                                                     ` Takashi Iwai
     [not found]                                                       ` <s5hr2kbr03k.wl-tiwai-l3A5Bk7waGM@public.gmane.org>
2018-07-10  9:13                                                         ` jimqu
     [not found]                                                           ` <a37f08e7-734e-977c-597f-46d5c3ec34bc-5C7GfCeVMHo@public.gmane.org>
2018-07-10  9:50                                                             ` Takashi Iwai
2018-07-10 11:11                                                               ` jimqu
     [not found]                                                                 ` <733011b9-1880-76a8-d00f-076591e93c53-5C7GfCeVMHo@public.gmane.org>
2018-07-10 11:21                                                                   ` Takashi Iwai
2018-07-11  7:19                                                                     ` 答复: 答复: " Takashi Iwai
     [not found]                                                                       ` <s5hfu0qp7cv.wl-tiwai-l3A5Bk7waGM@public.gmane.org>
2018-07-11  8:41                                                                         ` 答复: 答复: [alsa-devel] " jimqu
     [not found]                                                                           ` <1936c752-f858-2caf-35e7-98bea431fb7c-5C7GfCeVMHo@public.gmane.org>
2018-07-11  9:04                                                                             ` Takashi Iwai
     [not found]                                                                               ` <s5h1scap2h2.wl-tiwai-l3A5Bk7waGM@public.gmane.org>
2018-07-11  9:26                                                                                 ` jimqu
2018-07-11  9:53                                                                                   ` Takashi Iwai [this message]
     [not found]                                                                                     ` <s5h601mayk0.wl-tiwai-l3A5Bk7waGM@public.gmane.org>
2018-07-11 10:21                                                                                       ` jimqu
2018-07-11 11:12                                                                                         ` Takashi Iwai
     [not found]                                                                                           ` <s5hwou29gce.wl-tiwai-l3A5Bk7waGM@public.gmane.org>
2018-07-13 15:07                                                                                             ` Takashi Iwai
2018-07-14 12:03                                                                                               ` jimqu
2018-07-14 16:31                                                                                                 ` Takashi Iwai
     [not found]                                                                                                   ` <s5hy3edlqxw.wl-tiwai-l3A5Bk7waGM@public.gmane.org>
2018-07-15 14:36                                                                                                     ` Alex Deucher
2018-07-16 15:10                                                                                                       ` Harry Wentland
     [not found]                                                                                                         ` <84b8615e-9de1-a279-e103-55367e2f0f85-5C7GfCeVMHo@public.gmane.org>
2018-07-16 15:25                                                                                                           ` Takashi Iwai
2018-07-16 16:56                                                                                                             ` Alex Deucher
2018-07-09 14:02                                   ` Alex Deucher
     [not found]                                     ` <CADnq5_PS_ZO2Y35HHnp3DcvN9wopQGavpDtMNCuuz4A1mDnD7g-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2018-07-09 15:09                                       ` [alsa-devel] " Takashi Iwai
     [not found] ` <1530166933-21655-1-git-send-email-Jim.Qu-5C7GfCeVMHo@public.gmane.org>
2018-06-29  2:54   ` Zhang, Jerry (Junwei)
     [not found]     ` <5B359F5E.5080502-5C7GfCeVMHo@public.gmane.org>
2018-06-29  4:01       ` Alex Deucher
     [not found]         ` <CADnq5_PTsyc9HFsGrvTsjnPOJKF3B_nzgVsp_wZWguTb6e3F0Q-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2018-06-29  5:59           ` 答复: " Qu, Jim
     [not found]             ` <DM3PR12MB0873339C6A535584C2C787B3994E0-4hRkV8tDpBiYEITDcfEJ8AdYzm3356FpvxpqHgZTriW3zl9H0oFU5g@public.gmane.org>
2018-06-29  7:40               ` Zhang, Jerry (Junwei)
     [not found]                 ` <5B35E25E.9020708-5C7GfCeVMHo@public.gmane.org>
2018-06-29  8:06                   ` 答复: " Qu, Jim
     [not found]                     ` <DM3PR12MB08739DC1ADB8BBF9AE6E8B0D994E0-4hRkV8tDpBiYEITDcfEJ8AdYzm3356FpvxpqHgZTriW3zl9H0oFU5g@public.gmane.org>
2018-06-29  8:54                       ` Zhang, Jerry (Junwei)
     [not found]                         ` <5B35F3C5.8060709-5C7GfCeVMHo@public.gmane.org>
2018-06-29  8:58                           ` 答复: " Qu, Jim
     [not found]                             ` <DM3PR12MB0873E459AC9D7F6CECDDBAB3994E0-4hRkV8tDpBiYEITDcfEJ8AdYzm3356FpvxpqHgZTriW3zl9H0oFU5g@public.gmane.org>
2018-06-29  9:16                               ` Zhang, Jerry (Junwei)
2018-06-29  7:35           ` Zhang, Jerry (Junwei)

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=s5h601mayk0.wl-tiwai@suse.de \
    --to=tiwai@suse.de \
    --cc=Alexander.Deucher@amd.com \
    --cc=Jim.Qu@amd.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=amd-gfx@lists.freedesktop.org \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=jimqu@amd.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 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.