ALSA: HDA: use PCI_BASE_CLASS_DISPLAY to cover more display adapters
Subsystems (4)
PATCH 1/2 ALSA: HDA: use PCI_BASE_CLASS_DISPLAY to cover more display adapters
--- sound/pci/hda/hda_intel.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
sound/pci/hda/hda_intel.c +4 -4
@@ -31,7 +31,7 @@* CHANGES: * * 2004.12.01 Major rewrite by tiwai, merged the work of pshou -* +* */ #include <linux/delay.h>
@@ -390,8 +390,8 @@ static char *driver_short_names[] = { [AZX_DRIVER_SIS] = "HDA SIS966", [AZX_DRIVER_ULI] = "HDA ULI M5461", [AZX_DRIVER_NVIDIA] = "HDA NVidia", - [AZX_DRIVER_TERA] = "HDA Teradici", - [AZX_DRIVER_CTX] = "HDA Creative", + [AZX_DRIVER_TERA] = "HDA Teradici", + [AZX_DRIVER_CTX] = "HDA Creative", [AZX_DRIVER_CTHDA] = "HDA Creative", [AZX_DRIVER_CMEDIA] = "HDA C-Media", [AZX_DRIVER_GENERIC] = "HD-Audio Generic",
@@ -1429,7 +1429,7 @@ 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 >>16 ) ==PCI_BASE_CLASS_DISPLAY )return p;pci_dev_put (p); }
Signature · 6 lines
2.7.4 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 2/2 vgaswitchreoo: set audio client id in vgaswitchreoo enable function
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, the audio which is binded to UMA will be suspended if user use debugfs to contorl power
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, the correct audio id will be set in vgaswitchreoo enable function.
--- drivers/gpu/vga/vga_switcheroo.c | 37 +++++++++++++++++++++++++++---------- include/linux/vga_switcheroo.h | 8 ++++---- sound/pci/hda/hda_intel.c | 11 ++++++----- 3 files changed, 37 insertions(+), 19 deletions(-)
drivers/gpu/vga/vga_switcheroo.c +28 -10
@@ -103,6 +103,7 @@* runtime pm. If true, writing ON and OFF to the vga_switcheroo debugfs * interface is a no-op so as not to interfere with runtime pm * @list: client list +* @vga_dev: pci device, indicate which GPU is bound to current audio client * * Registered client. A client can be either a GPU or an audio device on a GPU. * For audio clients, the @fb_info and @active members are bogus.
@@ -116,6 +117,7 @@ struct vga_switcheroo_client {bool active;bool driver_power_control;struct list_head list; +struct pci_dev *vga_dev; };/*
@@ -161,9 +163,8 @@ struct vgasr_priv { };#define ID_BIT_AUDIO 0x100 -#define client_is_audio (c) ((c)->id & ID_BIT_AUDIO) -#define client_is_vga (c) ((c)->id == VGA_SWITCHEROO_UNKNOWN_ID || \ - !client_is_audio(c)) +#define client_is_audio (c) ((c)->id & ID_BIT_AUDIO) +#define client_is_vga (c) (!client_is_audio(c))#define client_id (c) ((c)->id & ~ID_BIT_AUDIO)static int vga_switcheroo_debugfs_init (struct vgasr_priv *priv);
@@ -192,14 +193,28 @@ static void vga_switcheroo_enable(void) vgasr_priv.handler->init ();list_for_each_entry (client, &vgasr_priv.clients, list) { -if (client->id !=VGA_SWITCHEROO_UNKNOWN_ID ) +if (!client_is_vga (client) ||client_id (client) != +VGA_SWITCHEROO_UNKNOWN_ID )continue ; + ret = vgasr_priv.handler->get_client_id (client->pdev);if (ret <0 )return ; - client->id = ret; } + +list_for_each_entry (client, &vgasr_priv.clients, list) { +if (!client_is_audio (client) ||client_id (client) != +VGA_SWITCHEROO_UNKNOWN_ID ) +continue ; + + ret = vgasr_priv.handler->get_client_id (client->vga_dev); +if (ret <0 ) +return ; + + client->id = ret |ID_BIT_AUDIO ; + } +vga_switcheroo_debugfs_init (&vgasr_priv); vgasr_priv.active = true; }
@@ -272,7 +287,8 @@ EXPORT_SYMBOL(vga_switcheroo_handler_flags);static int register_client (struct pci_dev *pdev,const struct vga_switcheroo_client_ops *ops, -enum vga_switcheroo_client_id id,bool active, +enum vga_switcheroo_client_id id,struct pci_dev *vga_dev, +bool active,bool driver_power_control) {struct vga_switcheroo_client *client;
@@ -287,6 +303,7 @@ static int register_client(struct pci_dev *pdev, client->id = id; client->active = active; client->driver_power_control = driver_power_control; + client->vga_dev = vga_dev;mutex_lock (&vgasr_mutex);list_add_tail (&client->list, &vgasr_priv.clients);
@@ -319,7 +336,7 @@ int vga_switcheroo_register_client(struct pci_dev *pdev,const struct vga_switcheroo_client_ops *ops, bool driver_power_control) { - return register_client(pdev, ops, VGA_SWITCHEROO_UNKNOWN_ID, + return register_client(pdev, ops, VGA_SWITCHEROO_UNKNOWN_ID, NULL, pdev == vga_default_device(),driver_power_control ); }
@@ -329,7 +346,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 +* @vga_dev: pci device which is bound to current audio client * * Register audio client (audio device on a GPU). The client is assumed * to use runtime PM. Beforehand, vga_switcheroo_client_probe_defer()
@@ -339,9 +356,10 @@ 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 *vga_dev) { -return register_client (pdev, ops, id |ID_BIT_AUDIO , false, true); +return register_client (pdev, ops,VGA_SWITCHEROO_UNKNOWN_ID |ID_BIT_AUDIO , + vga_dev, false, true); }EXPORT_SYMBOL (vga_switcheroo_register_audio_client);
include/linux/vga_switcheroo.h +4 -4
@@ -84,8 +84,8 @@ enum vga_switcheroo_state {* Client identifier. Audio clients use the same identifier & 0x100. */ enum vga_switcheroo_client_id { -VGA_SWITCHEROO_UNKNOWN_ID =-1 , -VGA_SWITCHEROO_IGD , +VGA_SWITCHEROO_UNKNOWN_ID =0x1000 , +VGA_SWITCHEROO_IGD =0 ,VGA_SWITCHEROO_DIS ,VGA_SWITCHEROO_MAX_CLIENTS , };
@@ -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 *vga_dev);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 *vga_dev) {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 ; }
sound/pci/hda/hda_intel.c +6 -5
@@ -1319,15 +1319,16 @@ 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 ;
Signature · 6 lines
2.7.4 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
A message that is not in the archive (sent off-list or not yet received): 1531469162-6472-2-git-send-email-Jim.Qu-5C7GfCeVMHo@public.gmane.org
Re: [alsa-devel] [PATCH 2/2] vgaswitchreoo: set audio client id in vgaswitchreoo enable function
Quoted 10 lines · Jim Qu
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, the audio which is binded to UMA will be suspended if user use debugfs to contorl power
Quoted 6 lines
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, the correct audio id will be set in vgaswitchreoo enable function.
Signed-off-by Jim Qu <[email protected]>
The idea looks good to me. Just a nitpick:
Quoted 9 lines
sound/pci/hda/hda_intel.c +1
-0@@ -1319,15 +1319,16 @@ 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 ;
sound/pci/hda/hda_intel.c static const struct vga_switcheroo_client_ops azx_vs_ops = { · line 1331
Quoted 10 lines
sound/pci/hda/hda_intel.c +5
-5-/* 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);
Passing a NULL vga_dev won't work, so the NULL check after calling vga_switcheroo_register_audio_client() is moot. If any, it should be checked before that.
thanks,
Takashi
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
A message that is not in the archive (sent off-list or not yet received): [email protected]
Re: [alsa-devel] [PATCH 2/2] vgaswitchreoo: set audio client id in vgaswitchreoo enable function
Quoted 26 lines · Takashi Iwai
Quoted 9 lines · Jim Qu
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, the audio which is binded to UMA will be suspended if user use debugfs to contorl powerQuoted 6 lines
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, the correct audio id will be set in vgaswitchreoo enable function.
Signed-off-by Jim Qu <[email protected]>The idea looks good to me. Just a nitpick:
Quoted 7 lines
sound/pci/hda/hda_intel.c +1
-0@@ -1319,15 +1319,16 @@ 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;
Quoted 16 lines
sound/pci/hda/hda_intel.c static const struct vga_switcheroo_client_ops azx_vs_ops = { · line 1331
Quoted 12 lines
sound/pci/hda/hda_intel.c +5
-5if (!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);Passing a NULL
vga_devwon't work, so the NULL check after callingvga_switcheroo_register_audio_client()is moot. If any, it should be checked before that.
The hda->use_vga_switcheroo is set to 1 in init_vga_switcheroo() if bound vga pci dev is not NULL. Since the hda->use_vga_switcheroo is checked at beginning of the function. so the p which pass into vga_switcheroo_register_audio_client() is constant valid value.
Thanks
JimQu
Quoted 3 lines
thanks,
Takashi
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
Re: [PATCH 2/2] vgaswitchreoo: set audio client id in vgaswitchreoo enable function
Quoted 46 lines · jimqu
Quoted 32 lines · Takashi Iwai
Quoted 9 lines · Jim Qu
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, the audio which is binded to UMA will be suspended if user use debugfs to contorl powerQuoted 6 lines
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, the correct audio id will be set in vgaswitchreoo enable function.
Signed-off-by Jim Qu <[email protected]>The idea looks good to me. Just a nitpick:
Quoted 13 lines
sound/pci/hda/hda_intel.c +1
-5@@ -1319,15 +1319,16 @@ 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 );Quoted 9 lines
sound/pci/hda/hda_intel.c static const struct vga_switcheroo_client_ops azx_vs_ops = { · line 1331
Quoted 5 lines
sound/pci/hda/hda_intel.c +5
-0+ + p =get_bound_vga (chip->pci); + err =vga_switcheroo_register_audio_client (chip->pci, &azx_vs_ops, p); +if (p) +pci_dev_put (p);Passing a NULL
vga_devwon't work, so the NULL check after callingvga_switcheroo_register_audio_client()is moot. If any, it should be checked before that.
Quoted 4 lines
The
hda->use_vga_switcheroois set to 1 ininit_vga_switcheroo()if bound vga pci dev is not NULL. Since thehda->use_vga_switcheroois checked at beginning of the function. so the p which pass intovga_switcheroo_register_audio_client()is constant valid value.
So the NULL-check in the patch is also useless, no? :)
Takashi
_______________________________________________
Alsa-devel mailing list
[email protected]
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel
A message that is not in the archive (sent off-list or not yet received): [email protected]
Re: [alsa-devel] [PATCH 2/2] vgaswitchreoo: set audio client id in vgaswitchreoo enable function
Quoted 46 lines · Takashi Iwai
Quoted 44 lines · jimqu
Quoted 41 lines · Takashi Iwai
Quoted 9 lines · Jim Qu
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, the audio which is binded to UMA will be suspended if user use debugfs to contorl powerQuoted 6 lines
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, the correct audio id will be set in vgaswitchreoo enable function.
Signed-off-by Jim Qu <[email protected]>The idea looks good to me. Just a nitpick:
Quoted 8 lines
(quoted diff) +1
-0@@ -1319,15 +1319,16 @@ 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;Review static const struct vga_switcheroo_client_ops azx_vs_ops = { · line 1330
Quoted 10 lines
(quoted diff) +5
-5- /* 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);Passing a NULL
vga_devwon't work, so the NULL check after callingvga_switcheroo_register_audio_client()is moot. If any, it should be checked before that.
Quoted 5 lines
Quoted 4 lines
The
hda->use_vga_switcheroois set to 1 ininit_vga_switcheroo()if
bound vga pci dev is not NULL. Since thehda->use_vga_switcheroois checked at beginning of the function. so the p which pass intovga_switcheroo_register_audio_client()is constant valid value.So the NULL-check in the patch is also useless, no? :)
Ha-ha, indeed, the NULL-check of p is unnecessary. will update in v2.
Thanks
JimQu
Quoted 1 line
Takashi
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
Re: [PATCH 2/2] vgaswitchreoo: set audio client id in vgaswitchreoo enable function
In reply to a message not in the archiveQuoted 9 lines · Jim Qu
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, the audio which is binded to UMA will be suspended if user use debugfs to contorl power
Quoted 6 lines
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, the correct audio id will be set in vgaswitchreoo enable function.
Signed-off-by Jim Qu <[email protected]>
The approach you've taken in this patch won't work if the HDA controller is bound to a driver after both GPUs have already been bound to a driver and the handler has already been registered.
That's because vga_switcheroo_enable() is run when two GPUs have registered as clients and the handler has also registered. If the HDA controller is probed afterwards, its ID will be stuck at VGA_SWITCHEROO_UNKNOWN_ID.
Before resubmitting this patch, please run it through scripts/checkpatch.pl, there are multiple trivial issues here.
Also, please use scripts/get_maintainers.pl on all files you're touching and cc the patch to the listed maintainers and reviewers.
drivers/gpu/vga/vga_switcheroo.c struct vgasr_priv { · line 168
Quoted 10 lines
drivers/gpu/vga/vga_switcheroo.c +2
-3@@ -161,9 +163,8 @@ struct vgasr_priv { };#define ID_BIT_AUDIO 0x100 -#define client_is_audio (c) ((c)->id & ID_BIT_AUDIO) -#define client_is_vga (c) ((c)->id == VGA_SWITCHEROO_UNKNOWN_ID || \ - !client_is_audio(c)) +#define client_is_audio (c) ((c)->id & ID_BIT_AUDIO) +#define client_is_vga (c) (!client_is_audio(c))#define client_id (c) ((c)->id & ~ID_BIT_AUDIO)
There's a spurious whitespace change in the client_is_audio() line, please get rid of it.
include/linux/vga_switcheroo.h enum vga_switcheroo_state { · line 88
Quoted 10 lines
include/linux/vga_switcheroo.h +2
-2@@ -84,8 +84,8 @@ enum vga_switcheroo_state {* Client identifier. Audio clients use the same identifier & 0x100. */ enum vga_switcheroo_client_id { -VGA_SWITCHEROO_UNKNOWN_ID =-1 , -VGA_SWITCHEROO_IGD , +VGA_SWITCHEROO_UNKNOWN_ID =0x1000 , +VGA_SWITCHEROO_IGD =0 ,
Hm, why is this change necessary?
Thanks,
Lukas
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
A message that is not in the archive (sent off-list or not yet received): 20180713092742.GA4013-JFq808J9C/[email protected]
Re: [PATCH 2/2] vgaswitchreoo: set audio client id in vgaswitchreoo enable function
Quoted 34 lines · Lukas Wunner
Quoted 9 lines · Jim Qu
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, the audio which is binded to UMA will be suspended if user use debugfs to contorl powerQuoted 6 lines
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, the correct audio id will be set in vgaswitchreoo enable function.
Signed-off-by Jim Qu <[email protected]>The approach you've taken in this patch won't work if the HDA controller is bound to a driver after both GPUs have already been bound to a driver and the handler has already been registered.
That's because
vga_switcheroo_enable()is run when two GPUs have registered as clients and the handler has also registered. If the HDA controller is probed afterwards, its ID will be stuck atVGA_SWITCHEROO_UNKNOWN_ID.Before resubmitting this patch, please run it through
scripts/checkpatch.pl, there are multiple trivial issues here.Also, please use
scripts/get_maintainers.plon all files you're touching and cc the patch to the listed maintainers and reviewers.Quoted 3 lines
(quoted diff) +0
-0@@ -161,9 +163,8 @@ struct vgasr_priv { };
Quoted 10 lines
drivers/gpu/vga/vga_switcheroo.c struct vgasr_priv { · line 168
Quoted 7 lines
drivers/gpu/vga/vga_switcheroo.c +2
-3#define ID_BIT_AUDIO 0x100 -#define client_is_audio (c) ((c)->id & ID_BIT_AUDIO) -#define client_is_vga (c) ((c)->id == VGA_SWITCHEROO_UNKNOWN_ID || \ - !client_is_audio(c)) +#define client_is_audio (c) ((c)->id & ID_BIT_AUDIO) +#define client_is_vga (c) (!client_is_audio(c))#define client_id (c) ((c)->id & ~ID_BIT_AUDIO)There's a spurious whitespace change in the
client_is_audio()line, please get rid of it.
Yeah, I will correct it in later update.
Quoted 11 lines
include/linux/vga_switcheroo.h enum vga_switcheroo_state { · line 88
Quoted 10 lines
include/linux/vga_switcheroo.h +2
-2@@ -84,8 +84,8 @@ enum vga_switcheroo_state {* Client identifier. Audio clients use the same identifier & 0x100. */ enum vga_switcheroo_client_id { -VGA_SWITCHEROO_UNKNOWN_ID =-1 , -VGA_SWITCHEROO_IGD , +VGA_SWITCHEROO_UNKNOWN_ID =0x1000 , +VGA_SWITCHEROO_IGD =0 ,Hm, why is this change necessary?
Before, we suppose VGA_SWITCHEROO_UNKNOWN_ID can be only used for gpu client, but now we also use it on audio client. Because of -1 in memory is presented as 0xffffffffffffffff, so the 0xffffffffffffffff & ID_BIT_AUDIO = ID_BIT_AUDIO, this will confuse people if it used on gpu client. that audio identify bit is set.
Thanks
JimQu
Quoted 4 lines
Thanks,
Lukas
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
Re: [PATCH 2/2] vgaswitchreoo: set audio client id in vgaswitchreoo enable function
In reply to a message not in the archiveQuoted 15 lines · Lukas Wunner
Quoted 14 lines · Jim Qu
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, the audio which is binded to UMA will be suspended if user use debugfs to contorl powerIn HDA driver side, it is difficult to know which GPU the audio has binded to. So set the bound gpu pci dev to vgaswitchroo, the correct audio id will be set in vgaswitchreoo enable function.
Quoted 8 lines
Quoted 1 line
Signed-off-by Jim Qu <[email protected]>The approach you've taken in this patch won't work if the HDA controller is bound to a driver after both GPUs have already been bound to a driver and the handler has already been registered.
That's because
vga_switcheroo_enable()is run when two GPUs have registered as clients and the handler has also registered. If the HDA controller is probed afterwards, its ID will be stuck atVGA_SWITCHEROO_UNKNOWN_ID.
In genernic speaking, there are two cases , a. audio client is the third client. b. audio client is not the third client.
if audio is third client. vga_switcheroo_ready() is true, vga_switcheroo_enable() can be called in audio client register fuction.
if audio is not the third client, vga_switcheroo_enable() will be called in the second GFX client register.
In vga_switcheroo_enable() , the first list loop will set two GPU clients' id, and the second list loop will select audio client, set id by its bound gpu pci dev.
Quoted 6 lines
Before resubmitting this patch, please run it through
scripts/checkpatch.pl, there are multiple trivial issues here.Also, please use
scripts/get_maintainers.plon all files you're touching and cc the patch to the listed maintainers and reviewers.
OK, will do it in next v2.
Quoted 13 lines
drivers/gpu/vga/vga_switcheroo.c struct vgasr_priv { · line 168
Quoted 10 lines
drivers/gpu/vga/vga_switcheroo.c +2
-3@@ -161,9 +163,8 @@ struct vgasr_priv { };#define ID_BIT_AUDIO 0x100 -#define client_is_audio (c) ((c)->id & ID_BIT_AUDIO) -#define client_is_vga (c) ((c)->id == VGA_SWITCHEROO_UNKNOWN_ID || \ - !client_is_audio(c)) +#define client_is_audio (c) ((c)->id & ID_BIT_AUDIO) +#define client_is_vga (c) (!client_is_audio(c))#define client_id (c) ((c)->id & ~ID_BIT_AUDIO)There's a spurious whitespace change in the
client_is_audio()line, please get rid of it.
Will update it in v2.
Quoted 11 lines
include/linux/vga_switcheroo.h enum vga_switcheroo_state { · line 88
Quoted 10 lines
include/linux/vga_switcheroo.h +2
-2@@ -84,8 +84,8 @@ enum vga_switcheroo_state {* Client identifier. Audio clients use the same identifier & 0x100. */ enum vga_switcheroo_client_id { -VGA_SWITCHEROO_UNKNOWN_ID =-1 , -VGA_SWITCHEROO_IGD , +VGA_SWITCHEROO_UNKNOWN_ID =0x1000 , +VGA_SWITCHEROO_IGD =0 ,Hm, why is this change necessary?
Before , we suppose VGA_SWITCHEROO_UNKNOWN_ID can be only used for gpu client, and now we also use it on the audio client. if we set VGA_SWITCHEROO_UNKNOWN_ID to gpu clients, client_is_audio(client) will be true, since -1 in memory is presented as 0xffffffffffffffff(if it is 64bit asic).
thanks
JimQu
Quoted 4 lines
Thanks,
Lukas
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
Lukas Wunner
reviewerRe: [PATCH 2/2] vgaswitchreoo: set audio client id in vgaswitchreoo enable function
Quoted 28 lines · jimqu
??? 2018/7/13 17:27, Lukas Wunner ??????:
Quoted 15 lines · Jim Qu
Quoted 14 lines
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, the audio which is binded to UMA will be suspended if user use debugfs to contorl powerIn HDA driver side, it is difficult to know which GPU the audio has binded to. So set the bound gpu pci dev to vgaswitchroo, the correct audio id will be set in vgaswitchreoo enable function.
Quoted 8 lines
Quoted 1 line
Signed-off-by Jim Qu <[email protected]>The approach you've taken in this patch won't work if the HDA controller is bound to a driver after both GPUs have already been bound to a driver and the handler has already been registered.
That's because
vga_switcheroo_enable()is run when two GPUs have registered as clients and the handler has also registered. If the HDA controller is probed afterwards, its ID will be stuck atVGA_SWITCHEROO_UNKNOWN_ID.In genernic speaking, there are two cases , a. audio client is the third client. b. audio client is not the third client.
Quoted 7 lines
if audio is third client.
vga_switcheroo_ready()is true,vga_switcheroo_enable()can be called in audio client register fuction. if audio is not the third client,vga_switcheroo_enable()will be called in the second GFX client register.
Invga_switcheroo_enable(), the first list loop will set two GPU clients' id, and the second list loop will select audio client, set id by its bound gpu pci dev.
No, if audio is the third client, vga_switcheroo_ready() is *not* true because vgasr_priv.active is true. This is set to true once the two GPUs and the handler have registered. If the audio device registers afterwards, vga_switcheroo_enable() will already have been called. It's never called twice because it sets vgasr_priv.active = true.
As a result, the audio device is stuck at VGA_SWITCHEROO_UNKNOWN_ID.
Thanks,
Lukas
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
A message that is not in the archive (sent off-list or not yet received): 20180716140246.GA12334-JFq808J9C/[email protected]
Re: [PATCH 2/2] vgaswitchreoo: set audio client id in vgaswitchreoo enable function
Quoted 35 lines · Lukas Wunner
Quoted 27 lines · jimqu
??? 2018/7/13 17:27, Lukas Wunner ??????:
Quoted 15 lines · Jim Qu
Quoted 14 lines
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, the audio which is binded to UMA will be suspended if user use debugfs to contorl powerIn HDA driver side, it is difficult to know which GPU the audio has binded to. So set the bound gpu pci dev to vgaswitchroo, the correct audio id will be set in vgaswitchreoo enable function.
Quoted 8 lines
Quoted 1 line
Signed-off-by Jim Qu <[email protected]>The approach you've taken in this patch won't work if the HDA controller is bound to a driver after both GPUs have already been bound to a driver and the handler has already been registered.
That's because
vga_switcheroo_enable()is run when two GPUs have registered as clients and the handler has also registered. If the HDA controller is probed afterwards, its ID will be stuck atVGA_SWITCHEROO_UNKNOWN_ID.In genernic speaking, there are two cases , a. audio client is the third client. b. audio client is not the third client.
Quoted 7 lines
if audio is third client.
vga_switcheroo_ready()is true,vga_switcheroo_enable()can be called in audio client register fuction. if audio is not the third client,vga_switcheroo_enable()will be called in the second GFX client register.
Invga_switcheroo_enable(), the first list loop will set two GPU clients' id, and the second list loop will select audio client, set id by its bound gpu pci dev.
Quoted 7 lines
No, if audio is the third client,
vga_switcheroo_ready()is *not* true because vgasr_priv.active is true. This is set to true once the two GPUs and the handler have registered. If the audio device registers afterwards,vga_switcheroo_enable()will already have been called. It's never called twice because it sets vgasr_priv.active = true.As a result, the audio device is stuck at
VGA_SWITCHEROO_UNKNOWN_ID.
Indeed, I almost ignore the vgasr_priv.active, since I added amdgpu to blacklist, audio is always the first client. :). not so bad, Let me rework the patch tomorrow.
Thanks
JimQu
Quoted 3 lines
Thanks,
Lukas
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
A message that is not in the archive (sent off-list or not yet received): 1531469162-6472-1-git-send-email-Jim.Qu-5C7GfCeVMHo@public.gmane.org
Quoted 1 line · Jim Qu
Signed-off-by Jim Qu <[email protected]>
Empty commit message. Please add an explanation why the change is necessary so folks browsing the git history understand it's motivation. I think here the motivation is that the PCI class is sometimes PCI_CLASS_DISPLAY_3D or PCI_CLASS_DISPLAY_OTHER.
sound/pci/hda/hda_intel.c line 34
Quoted 8 lines
sound/pci/hda/hda_intel.c +1
-1@@ -31,7 +31,7 @@* CHANGES: * * 2004.12.01 Major rewrite by tiwai, merged the work of pshou -* +*
Spurious unrelated change, please get rid of it, this clutters up the git history unnecessarily.
sound/pci/hda/hda_intel.c static char *driver_short_names[] = { · line 394
Quoted 8 lines
sound/pci/hda/hda_intel.c +2
-2@@ -390,8 +390,8 @@ static char *driver_short_names[] = { [AZX_DRIVER_SIS] = "HDA SIS966", [AZX_DRIVER_ULI] = "HDA ULI M5461", [AZX_DRIVER_NVIDIA] = "HDA NVidia", - [AZX_DRIVER_TERA] = "HDA Teradici", - [AZX_DRIVER_CTX] = "HDA Creative", + [AZX_DRIVER_TERA] = "HDA Teradici", + [AZX_DRIVER_CTX] = "HDA Creative",
Ditto.
Thanks,
Lukas
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
Quoted 2 lines · Jim Qu
Signed-off-by Jim Qu <[email protected]>
More explanations please. e.g. why is this needed?
The code change itself looks good, but ...
Quoted 10 lines
sound/pci/hda/hda_intel.c +1
-1@@ -31,7 +31,7 @@* CHANGES: * * 2004.12.01 Major rewrite by tiwai, merged the work of pshou -* +* */ #include <linux/delay.h>
sound/pci/hda/hda_intel.c static char *driver_short_names[] = { · line 397
Quoted 10 lines
sound/pci/hda/hda_intel.c +2
-2@@ -390,8 +390,8 @@ static char *driver_short_names[] = { [AZX_DRIVER_SIS] = "HDA SIS966", [AZX_DRIVER_ULI] = "HDA ULI M5461", [AZX_DRIVER_NVIDIA] = "HDA NVidia", - [AZX_DRIVER_TERA] = "HDA Teradici", - [AZX_DRIVER_CTX] = "HDA Creative", + [AZX_DRIVER_TERA] = "HDA Teradici", + [AZX_DRIVER_CTX] = "HDA Creative", [AZX_DRIVER_CTHDA] = "HDA Creative", [AZX_DRIVER_CMEDIA] = "HDA C-Media", [AZX_DRIVER_GENERIC] = "HD-Audio Generic",
These two hunks are utterly irrelevant with the fix. Please drop them.
thanks,
Takashi
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
A message that is not in the archive (sent off-list or not yet received): [email protected]
See comments in line
thanks
JimQu
获取 Outlook for Android<https://aka.ms/ghei36>
发件人: Takashi Iwai
发送时间: 7月13日星期五 16:33
主题: Re: [alsa-devel] [PATCH 1/2] ALSA: HDA: use PCI_BASE_CLASS_DISPLAY tocover more display adapters 收件人: Qu, Jim
抄送: [email protected], [email protected], [email protected]
On Fri, 13 Jul 2018 10:06:01 +0200, Jim Qu wrote: > > Signed-off-by: Jim Qu More explanations please. e.g. why is this needed? The code change itself looks good, but ... > @@ -31,7 +31,7 @@ > * CHANGES: > * > * 2004.12.01 Major rewrite by tiwai, merged the work of pshou > - * > + * > */ > > #include > @@ -390,8 +390,8 @@ static char *driver_short_names[] = { > [AZX_DRIVER_SIS] = "HDA SIS966", > [AZX_DRIVER_ULI] = "HDA ULI M5461", > [AZX_DRIVER_NVIDIA] = "HDA NVidia", > - [AZX_DRIVER_TERA] = "HDA Teradici", > - [AZX_DRIVER_CTX] = "HDA Creative", > + [AZX_DRIVER_TERA] = "HDA Teradici", > + [AZX_DRIVER_CTX] = "HDA Creative", > [AZX_DRIVER_CTHDA] = "HDA Creative", > [AZX_DRIVER_CMEDIA] = "HDA C-Media", > [AZX_DRIVER_GENERIC] = "HD-Audio Generic", These two hunks are utterly irrelevant with the fix. Please drop them.
Jim: Yeah, I forget to generate a new one. I will delete them when push the patch.
thanks, Takashi
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx