On Mon, Nov 05, 2018 at 12:02:53PM +0100, Takashi Iwai wrote:
> The commit 37a3a98ef601 ("ALSA: hda - Enable runtime PM only for
> discrete GPU") added a new ops gpu_bound to be called when GPU gets
> bound.  The patch overlooked, however, that vga_switcheroo_enable() is
> called only once at GPU is bound.  When an audio client is registered
> after that point, it would miss the gpu_bound call.  This leads to the
> unexpected lack of runtime PM in HD-audio side.
> 
> For addressing that regression, just call gpu_bound callback manually
> at vga_switcheroo_register_audio_client() when the GPU was already
> bound.
> 
> Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=201615
> Fixes: 37a3a98ef601 ("ALSA: hda - Enable runtime PM only for discrete GPU")
> Cc: <sta...@vger.kernel.org>
> Signed-off-by: Takashi Iwai <ti...@suse.de>
> ---
>  drivers/gpu/vga/vga_switcheroo.c | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/drivers/gpu/vga/vga_switcheroo.c 
> b/drivers/gpu/vga/vga_switcheroo.c
> index cf2a18571d48..a132c37d7334 100644
> --- a/drivers/gpu/vga/vga_switcheroo.c
> +++ b/drivers/gpu/vga/vga_switcheroo.c
> @@ -380,6 +380,9 @@ int vga_switcheroo_register_audio_client(struct pci_dev 
> *pdev,
>                       mutex_unlock(&vgasr_mutex);
>                       return -EINVAL;
>               }
> +             /* notify if GPU has been already bound */
> +             if (ops->gpu_bound)
> +                     ops->gpu_bound(pdev, id);
>       }
>       mutex_unlock(&vgasr_mutex);

If the audio client registers before vga_switcheroo becomes enabled,
->gpu_bound will be executed twice.  AFAICS this only causes a minor
cosmetic issue, namely that dev_info() is called twice for blacklisted
devices in set_default_power_save().  This could be eliminated by
amending the if-condition with "&& vgasr_priv.active".  Since this
is only minor, up to you if you want to respin.

Either way,
Reviewed-by: Lukas Wunner <lu...@wunner.de>
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

Reply via email to