AMD-GFX Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: "Zhang, Jerry (Junwei)" <Jerry.Zhang-5C7GfCeVMHo@public.gmane.org>
To: "Qu, Jim" <Jim.Qu-5C7GfCeVMHo@public.gmane.org>,
	Alex Deucher
	<alexdeucher-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
Cc: "Deucher,
	Alexander" <Alexander.Deucher-5C7GfCeVMHo@public.gmane.org>,
	amd-gfx list
	<amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org>
Subject: Re: 答复: [PATCH] vgaswitchroo: set audio client id according to bound gpu client id
Date: Fri, 29 Jun 2018 15:40:14 +0800	[thread overview]
Message-ID: <5B35E25E.9020708@amd.com> (raw)
In-Reply-To: <DM3PR12MB0873339C6A535584C2C787B3994E0-4hRkV8tDpBiYEITDcfEJ8AdYzm3356FpvxpqHgZTriW3zl9H0oFU5g@public.gmane.org>

On 06/29/2018 01:59 PM, Qu, Jim wrote:
> If the GFX is headless, the audio codec should be disabled on PCIE bus. the the HDA driver will never probe the audio. right?

After checking the HDA a little, looks HDA could also handle many other audio devices.
In this case, HDA may probe other audio device, e.g. from Braswell.

Just a guess.

Jerry

>
> Thanks
> JimQu
>
> ________________________________________
> 发件人: Alex Deucher <alexdeucher@gmail.com>
> 发送时间: 2018年6月29日 12:01
> 收件人: Zhang, Jerry
> 抄送: Qu, Jim; amd-gfx list; Deucher, Alexander
> 主题: Re: [PATCH] vgaswitchroo: set audio client id according to bound gpu client id
>
> On Thu, Jun 28, 2018 at 10:54 PM, Zhang, Jerry (Junwei)
> <Jerry.Zhang@amd.com> wrote:
>> On 06/28/2018 02:22 PM, Jim Qu wrote:
>>>
>>> On modern laptop, there are more and more platforms
>>> have two GPUs, and each of them maybe have audio codec
>>> for HDMP/DP output. For some dGPU which is no output,
>>> audio codec usually is disabled.
>>>
>>> In currect HDA audio driver, it will set all codec as
>>> VGA_SWITCHEROO_DIS, so if system runtime pm is enabled,
>>> the audio which is binded to UMA will be suspended.
>>>
>>> In HDA driver side, it is difficult to know which GPU
>>> the audio has binded to. So set the bound gpu pci dev
>>> to vgaswitchroo, let vgaswitchroo make decision.
>>>
>>> Newer dGPUs use PCI_CLASS_DISPLAY_OTHER rather than
>>> PCI_CLASS_DISPLAY_VGA.  Make sure we check for both when
>>> checking for the dGPU in get_bound_vga()
>>
>>
>> IIRC, VGA is for iGPU, OTHER is for dGPU.
>> if not, please correct me.
>
> I think the dGPU can be either VGA or OTHER depending on whether there
> are displays wired to it.  E.g., iceland and hainan don't even have
> VGA hw on them since they are headless.
>
> Alex
>
>>
>>
>>>
>>> The patch also combine the HDA change to avoid break
>>> building.
>>>
>>> Change-Id: I9906c1bd4dd5b36108d7133bb1cf724d13f1cd6d
>>> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
>>> Signed-off-by: Jim Qu <Jim.Qu@amd.com>
>>> ---
>>>    drivers/gpu/vga/vga_switcheroo.c | 11 +++++++++--
>>>    include/linux/vga_switcheroo.h   |  4 ++--
>>>    sound/pci/hda/hda_intel.c        | 15 +++++++++------
>>>    3 files changed, 20 insertions(+), 10 deletions(-)
>>>
>>> diff --git a/drivers/gpu/vga/vga_switcheroo.c
>>> b/drivers/gpu/vga/vga_switcheroo.c
>>> index fc4adf3..7b7b0fd 100644
>>> --- a/drivers/gpu/vga/vga_switcheroo.c
>>> +++ b/drivers/gpu/vga/vga_switcheroo.c
>>> @@ -329,7 +329,7 @@ EXPORT_SYMBOL(vga_switcheroo_register_client);
>>>     * vga_switcheroo_register_audio_client - register audio client
>>>     * @pdev: client pci device
>>>     * @ops: client callbacks
>>> - * @id: client identifier
>>> + * @bound_vga: client bound vga pci device
>>>     *
>>>     * Register audio client (audio device on a GPU). The client is assumed
>>>     * to use runtime PM. Beforehand, vga_switcheroo_client_probe_defer()
>>> @@ -339,8 +339,15 @@ EXPORT_SYMBOL(vga_switcheroo_register_client);
>>>     */
>>>    int vga_switcheroo_register_audio_client(struct pci_dev *pdev,
>>>                          const struct vga_switcheroo_client_ops *ops,
>>> -                       enum vga_switcheroo_client_id id)
>>> +                       struct pci_dev *bound_vga)
>>>    {
>>> +       enum vga_switcheroo_client_id id = VGA_SWITCHEROO_DIS;
>>> +
>>> +       if (bound_vga) {
>>> +               if (vgasr_priv.handler->get_client_id)
>>
>>
>> We may combine 2 "if" together.
>>
>> Anyway, the patch looks fine for me.
>>
>> Reviewed-by: Junwei Zhang <Jerry.Zhang@amd.com>
>>
>> Additionally, better to includes Intel guys mail list and sound mail list if
>> any.
>>
>> Jerry
>>
>>
>>> +                       id = vgasr_priv.handler->get_client_id(bound_vga);
>>> +       }
>>> +
>>>          return register_client(pdev, ops, id | ID_BIT_AUDIO, false, true);
>>>    }
>>>    EXPORT_SYMBOL(vga_switcheroo_register_audio_client);
>>> diff --git a/include/linux/vga_switcheroo.h
>>> b/include/linux/vga_switcheroo.h
>>> index 77f0f0a..a0c7b86 100644
>>> --- a/include/linux/vga_switcheroo.h
>>> +++ b/include/linux/vga_switcheroo.h
>>> @@ -151,7 +151,7 @@ int vga_switcheroo_register_client(struct pci_dev
>>> *dev,
>>>                                     bool driver_power_control);
>>>    int vga_switcheroo_register_audio_client(struct pci_dev *pdev,
>>>                                           const struct
>>> vga_switcheroo_client_ops *ops,
>>> -                                        enum vga_switcheroo_client_id
>>> id);
>>> +                                        struct pci_dev *bound_vga);
>>>
>>>    void vga_switcheroo_client_fb_set(struct pci_dev *dev,
>>>                                    struct fb_info *info);
>>> @@ -180,7 +180,7 @@ static inline int
>>> vga_switcheroo_register_handler(const struct vga_switcheroo_ha
>>>                  enum vga_switcheroo_handler_flags_t handler_flags) {
>>> return 0; }
>>>    static inline int vga_switcheroo_register_audio_client(struct pci_dev
>>> *pdev,
>>>          const struct vga_switcheroo_client_ops *ops,
>>> -       enum vga_switcheroo_client_id id) { return 0; }
>>> +       struct pci_dev *bound_vga) { return 0; }
>>>    static inline void vga_switcheroo_unregister_handler(void) {}
>>>    static inline enum vga_switcheroo_handler_flags_t
>>> vga_switcheroo_handler_flags(void) { return 0; }
>>>    static inline int vga_switcheroo_lock_ddc(struct pci_dev *pdev) { return
>>> -ENODEV; }
>>> diff --git a/sound/pci/hda/hda_intel.c b/sound/pci/hda/hda_intel.c
>>> index 1ae1850..8f992e6 100644
>>> --- a/sound/pci/hda/hda_intel.c
>>> +++ b/sound/pci/hda/hda_intel.c
>>> @@ -1319,15 +1319,17 @@ static const struct vga_switcheroo_client_ops
>>> azx_vs_ops = {
>>>    static int register_vga_switcheroo(struct azx *chip)
>>>    {
>>>          struct hda_intel *hda = container_of(chip, struct hda_intel,
>>> chip);
>>> +       struct pci_dev *p;
>>>          int err;
>>>
>>>          if (!hda->use_vga_switcheroo)
>>>                  return 0;
>>> -       /* FIXME: currently only handling DIS controller
>>> -        * is there any machine with two switchable HDMI audio
>>> controllers?
>>> -        */
>>> -       err = vga_switcheroo_register_audio_client(chip->pci, &azx_vs_ops,
>>> -                                                  VGA_SWITCHEROO_DIS);
>>> +
>>> +       p = get_bound_vga(chip->pci);
>>> +       err = vga_switcheroo_register_audio_client(chip->pci, &azx_vs_ops,
>>> p);
>>> +
>>> +       if (p)
>>> +               pci_dev_put(p);
>>>          if (err < 0)
>>>                  return err;
>>>          hda->vga_switcheroo_registered = 1;
>>> @@ -1429,7 +1431,8 @@ static struct pci_dev *get_bound_vga(struct pci_dev
>>> *pci)
>>>                          p =
>>> pci_get_domain_bus_and_slot(pci_domain_nr(pci->bus),
>>>                                                          pci->bus->number,
>>> 0);
>>>                          if (p) {
>>> -                               if ((p->class >> 8) ==
>>> PCI_CLASS_DISPLAY_VGA)
>>> +                               if ((p->class >> 8) ==
>>> PCI_CLASS_DISPLAY_VGA ||
>>> +                               (p->class >> 8) ==
>>> PCI_CLASS_DISPLAY_OTHER)
>>>                                          return p;
>>>                                  pci_dev_put(p);
>>>                          }
>>>
>> _______________________________________________
>> amd-gfx mailing list
>> amd-gfx@lists.freedesktop.org
>> https://lists.freedesktop.org/mailman/listinfo/amd-gfx
_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

  parent reply	other threads:[~2018-06-29  7:40 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
     [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) [this message]
     [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=5B35E25E.9020708@amd.com \
    --to=jerry.zhang-5c7gfcevmho@public.gmane.org \
    --cc=Alexander.Deucher-5C7GfCeVMHo@public.gmane.org \
    --cc=Jim.Qu-5C7GfCeVMHo@public.gmane.org \
    --cc=alexdeucher-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
    --cc=amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.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