From: Takashi Iwai <tiwai@suse.de>
To: Andre Eikmeyer <dev@deq.rocks>
Cc: platform-driver-x86@vger.kernel.org,
amd-gfx@lists.freedesktop.org, linux-sound@vger.kernel.org,
"Atharva Tiwari" <atharvatiwarilinuxdev@gmail.com>,
"Hans de Goede" <hansg@kernel.org>,
"Ilpo Järvinen" <ilpo.jarvinen@linux.intel.com>,
"Alex Deucher" <alexander.deucher@amd.com>,
"Christian König" <christian.koenig@amd.com>,
"David Airlie" <airlied@gmail.com>,
"Simona Vetter" <simona@ffwll.ch>,
"Kenneth Feng" <kenneth.feng@amd.com>,
"Jaroslav Kysela" <perex@perex.cz>,
"Takashi Iwai" <tiwai@suse.com>,
dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 3/3] ALSA: hda: allow direct complete with a powered-off GPU
Date: Wed, 12 Aug 2026 15:53:57 +0200 [thread overview]
Message-ID: <87ik5fzbpm.wl-tiwai@suse.de> (raw)
In-Reply-To: <87mrurzc3s.wl-tiwai@suse.de>
On Wed, 12 Aug 2026 15:45:27 +0200,
Takashi Iwai wrote:
>
> On Wed, 12 Aug 2026 14:22:06 +0200,
> Andre Eikmeyer wrote:
> >
> > +static bool azx_vga_is_powered_off(struct azx *chip)
> > +{
> > +#ifdef SUPPORT_VGA_SWITCHEROO
> > + struct pci_dev *pci;
> > + bool powered_off = false;
> > +
> > + if (!use_vga_switcheroo(container_of(chip, struct hda_intel, chip)))
> > + return false;
> > +
> > + pci = get_bound_vga(chip->pci);
> > + if (pci) {
> > + powered_off = pm_runtime_suspended(&pci->dev) &&
> > + vga_switcheroo_get_client_state(pci) == VGA_SWITCHEROO_OFF;
> > + pci_dev_put(pci);
> > + }
> > +
> > + return powered_off;
> > +#else
> > + return false;
> > +#endif
> > +}
>
> This ifdef can be moved to the caller side below...
>
> > +
> > static int azx_prepare(struct device *dev)
> > {
> > struct snd_card *card = dev_get_drvdata(dev);
> > @@ -1025,6 +1048,10 @@ static int azx_prepare(struct device *dev)
> > return 0;
> >
> > chip = card->private_data;
> > + /* A powered-off dGPU cannot signal HDA wake events. */
> > + if (azx_vga_is_powered_off(chip))
> > + return 1;
> > +
>
> ... to wrap the call site, instead. Since this is the only caller,
> having the conditional here would make the intention clearer.
Looking at the code again, this won't work well.
But, keeping vga_switcheroo-specific code in a single place would be
still meaningful. So,
#ifdef SUPPORT_VGA_SWITCHEROO
#define use_vga_switcheroo(chip) ((chip)->use_vga_switcheroo)
#define needs_eld_notify_link(chip) ((chip)->bus.keep_power)
+static bool azx_vga_is_powered_off(struct azx *chip);
#else
#define use_vga_switcheroo(chip) 0
#define needs_eld_notify_link(chip) false
+#define azx_vga_is_powered_off(chip) false
#endif
and then define azx_vga_is_powered_off() in the section for
vga_switcheroo code.
In anyway, it's a matter of taste, and if the resultant patch doesn't
look better, you can keep the original way, too.
thanks,
Takashi
next prev parent reply other threads:[~2026-08-12 13:54 UTC|newest]
Thread overview: 30+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-12 12:22 [PATCH 0/3] Apple GMUX hybrid graphics support for MacBookPro15,1 Andre Eikmeyer
2026-08-12 12:22 ` [PATCH 1/3] platform/x86: apple-gmux: add MacBookPro15, 1 dGPU power sequence Andre Eikmeyer
2026-08-12 12:22 ` [PATCH 1/3] platform/x86: apple-gmux: add MacBookPro15,1 " Andre Eikmeyer
2026-08-12 12:38 ` [PATCH 1/3] platform/x86: apple-gmux: add MacBookPro15, 1 " sashiko-bot
2026-08-12 12:22 ` [PATCH 2/3] drm/amdgpu: add Apple GMUX runtime PM support Andre Eikmeyer
2026-08-12 12:48 ` sashiko-bot
2026-08-12 12:22 ` [PATCH 3/3] ALSA: hda: allow direct complete with a powered-off GPU Andre Eikmeyer
2026-08-12 13:01 ` sashiko-bot
2026-08-12 13:45 ` Takashi Iwai
2026-08-12 13:53 ` Takashi Iwai [this message]
2026-08-12 14:03 ` [PATCH v2 " Andre Eikmeyer
2026-08-12 14:23 ` [PATCH v3 " Andre Eikmeyer
2026-08-12 14:30 ` Takashi Iwai
2026-08-12 14:04 ` [PATCH " Christian König
2026-08-12 14:42 ` [PATCH v2 0/3] Apple GMUX hybrid graphics support for MacBookPro15,1 Andre Eikmeyer
2026-08-12 14:42 ` [PATCH v2 1/3] platform/x86: apple-gmux: add MacBookPro15,1 dGPU power sequence Andre Eikmeyer
2026-08-12 14:42 ` [PATCH v2 1/3] platform/x86: apple-gmux: add MacBookPro15, 1 " Andre Eikmeyer
2026-08-12 15:11 ` [PATCH v2 1/3] platform/x86: apple-gmux: add MacBookPro15,1 " sashiko-bot
2026-08-12 14:42 ` [PATCH v2 2/3] drm/amdgpu: add Apple GMUX runtime PM support Andre Eikmeyer
2026-08-12 15:24 ` sashiko-bot
2026-08-12 14:42 ` [PATCH v2 3/3] ALSA: hda: allow direct complete with a powered-off GPU Andre Eikmeyer
2026-08-12 15:36 ` sashiko-bot
2026-08-12 14:47 ` [PATCH v3 0/3] Apple GMUX hybrid graphics support for MacBookPro15,1 Andre Eikmeyer
2026-08-12 14:47 ` [PATCH v3 1/3] platform/x86: apple-gmux: add MacBookPro15, 1 dGPU power sequence Andre Eikmeyer
2026-08-12 14:47 ` [PATCH v3 1/3] platform/x86: apple-gmux: add MacBookPro15,1 " Andre Eikmeyer
2026-08-12 15:07 ` sashiko-bot
2026-08-12 14:47 ` [PATCH v3 2/3] drm/amdgpu: add Apple GMUX runtime PM support Andre Eikmeyer
2026-08-12 15:30 ` sashiko-bot
2026-08-12 14:47 ` [PATCH v3 3/3] ALSA: hda: allow direct complete with a powered-off GPU Andre Eikmeyer
2026-08-12 15:46 ` sashiko-bot
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=87ik5fzbpm.wl-tiwai@suse.de \
--to=tiwai@suse.de \
--cc=airlied@gmail.com \
--cc=alexander.deucher@amd.com \
--cc=amd-gfx@lists.freedesktop.org \
--cc=atharvatiwarilinuxdev@gmail.com \
--cc=christian.koenig@amd.com \
--cc=dev@deq.rocks \
--cc=dri-devel@lists.freedesktop.org \
--cc=hansg@kernel.org \
--cc=ilpo.jarvinen@linux.intel.com \
--cc=kenneth.feng@amd.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-sound@vger.kernel.org \
--cc=perex@perex.cz \
--cc=platform-driver-x86@vger.kernel.org \
--cc=simona@ffwll.ch \
--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 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.