diff options
author | Takashi Iwai <tiwai@suse.de> | 2019-08-27 10:37:50 -0400 |
---|---|---|
committer | Takashi Iwai <tiwai@suse.de> | 2019-08-27 10:37:50 -0400 |
commit | dd23e1d566d0f74aa3b68ab3237927bb15f0e644 (patch) | |
tree | 7b44b39ad4df39e50f0580a7b478dbdf99e78e50 /sound/pci/hda | |
parent | 4c098dab121a4164e9daa4d1ddbc59e93054e79e (diff) |
ALSA: hda - Allow runtime PM for controller if component notifier is used
Currently we disallow the runtime PM of the HD-audio controller if
it's bound with HDMI/DP on Nvidia / AMD unless it's for dGPU. This is
for keeping the link up to get the proper notification for ELD
hotplug.
As explained in the commit 37a3a98ef601 ("ALSA: hda - Enable runtime
PM only for discrete GPU"), this keep-power-up behavior is rather a
stop-gap solution until the ELD notification via audio component.
And now we finally got the audio component for these graphics drivers
via commit ade49db337a9 ("ALSA: hda/hdmi - Allow audio component for
AMD/ATI and Nvidia HDMI"), so it's time to change.
This patch makes HD-audio controller again runtime-suspendable when
the device gets bound with audio component in HDMI codec driver. For
making it easier to access from the codec driver, move the flag into
the common hda_bus object instead of hda_intel flag. Also rename it
to keep_power, to indicate the actual meaning.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/pci/hda')
-rw-r--r-- | sound/pci/hda/hda_intel.c | 11 | ||||
-rw-r--r-- | sound/pci/hda/hda_intel.h | 1 | ||||
-rw-r--r-- | sound/pci/hda/patch_hdmi.c | 4 |
3 files changed, 8 insertions, 8 deletions
diff --git a/sound/pci/hda/hda_intel.c b/sound/pci/hda/hda_intel.c index 4496fce21300..91e71be42fa4 100644 --- a/sound/pci/hda/hda_intel.c +++ b/sound/pci/hda/hda_intel.c | |||
@@ -356,7 +356,7 @@ enum { | |||
356 | */ | 356 | */ |
357 | #ifdef SUPPORT_VGA_SWITCHEROO | 357 | #ifdef SUPPORT_VGA_SWITCHEROO |
358 | #define use_vga_switcheroo(chip) ((chip)->use_vga_switcheroo) | 358 | #define use_vga_switcheroo(chip) ((chip)->use_vga_switcheroo) |
359 | #define needs_eld_notify_link(chip) ((chip)->need_eld_notify_link) | 359 | #define needs_eld_notify_link(chip) ((chip)->bus.keep_power) |
360 | #else | 360 | #else |
361 | #define use_vga_switcheroo(chip) 0 | 361 | #define use_vga_switcheroo(chip) 0 |
362 | #define needs_eld_notify_link(chip) false | 362 | #define needs_eld_notify_link(chip) false |
@@ -1145,7 +1145,7 @@ static int azx_runtime_idle(struct device *dev) | |||
1145 | return -EBUSY; | 1145 | return -EBUSY; |
1146 | 1146 | ||
1147 | /* ELD notification gets broken when HD-audio bus is off */ | 1147 | /* ELD notification gets broken when HD-audio bus is off */ |
1148 | if (needs_eld_notify_link(hda)) | 1148 | if (needs_eld_notify_link(chip)) |
1149 | return -EBUSY; | 1149 | return -EBUSY; |
1150 | 1150 | ||
1151 | return 0; | 1151 | return 0; |
@@ -1256,7 +1256,7 @@ static void setup_vga_switcheroo_runtime_pm(struct azx *chip) | |||
1256 | struct hda_intel *hda = container_of(chip, struct hda_intel, chip); | 1256 | struct hda_intel *hda = container_of(chip, struct hda_intel, chip); |
1257 | struct hda_codec *codec; | 1257 | struct hda_codec *codec; |
1258 | 1258 | ||
1259 | if (hda->use_vga_switcheroo && !hda->need_eld_notify_link) { | 1259 | if (hda->use_vga_switcheroo && !needs_eld_notify_link(chip)) { |
1260 | list_for_each_codec(codec, &chip->bus) | 1260 | list_for_each_codec(codec, &chip->bus) |
1261 | codec->auto_runtime_pm = 1; | 1261 | codec->auto_runtime_pm = 1; |
1262 | /* reset the power save setup */ | 1262 | /* reset the power save setup */ |
@@ -1270,10 +1270,9 @@ static void azx_vs_gpu_bound(struct pci_dev *pci, | |||
1270 | { | 1270 | { |
1271 | struct snd_card *card = pci_get_drvdata(pci); | 1271 | struct snd_card *card = pci_get_drvdata(pci); |
1272 | struct azx *chip = card->private_data; | 1272 | struct azx *chip = card->private_data; |
1273 | struct hda_intel *hda = container_of(chip, struct hda_intel, chip); | ||
1274 | 1273 | ||
1275 | if (client_id == VGA_SWITCHEROO_DIS) | 1274 | if (client_id == VGA_SWITCHEROO_DIS) |
1276 | hda->need_eld_notify_link = 0; | 1275 | chip->bus.keep_power = 0; |
1277 | setup_vga_switcheroo_runtime_pm(chip); | 1276 | setup_vga_switcheroo_runtime_pm(chip); |
1278 | } | 1277 | } |
1279 | 1278 | ||
@@ -1285,7 +1284,7 @@ static void init_vga_switcheroo(struct azx *chip) | |||
1285 | dev_info(chip->card->dev, | 1284 | dev_info(chip->card->dev, |
1286 | "Handle vga_switcheroo audio client\n"); | 1285 | "Handle vga_switcheroo audio client\n"); |
1287 | hda->use_vga_switcheroo = 1; | 1286 | hda->use_vga_switcheroo = 1; |
1288 | hda->need_eld_notify_link = 1; /* cleared in gpu_bound op */ | 1287 | chip->bus.keep_power = 1; /* cleared in either gpu_bound op or codec probe */ |
1289 | chip->driver_caps |= AZX_DCAPS_PM_RUNTIME; | 1288 | chip->driver_caps |= AZX_DCAPS_PM_RUNTIME; |
1290 | pci_dev_put(p); | 1289 | pci_dev_put(p); |
1291 | } | 1290 | } |
diff --git a/sound/pci/hda/hda_intel.h b/sound/pci/hda/hda_intel.h index 1468865e0342..2acfff3da1a0 100644 --- a/sound/pci/hda/hda_intel.h +++ b/sound/pci/hda/hda_intel.h | |||
@@ -25,7 +25,6 @@ struct hda_intel { | |||
25 | 25 | ||
26 | /* vga_switcheroo setup */ | 26 | /* vga_switcheroo setup */ |
27 | unsigned int use_vga_switcheroo:1; | 27 | unsigned int use_vga_switcheroo:1; |
28 | unsigned int need_eld_notify_link:1; | ||
29 | unsigned int vga_switcheroo_registered:1; | 28 | unsigned int vga_switcheroo_registered:1; |
30 | unsigned int init_failed:1; /* delayed init failed */ | 29 | unsigned int init_failed:1; /* delayed init failed */ |
31 | 30 | ||
diff --git a/sound/pci/hda/patch_hdmi.c b/sound/pci/hda/patch_hdmi.c index 933c7bf47ef6..83b8b9d27711 100644 --- a/sound/pci/hda/patch_hdmi.c +++ b/sound/pci/hda/patch_hdmi.c | |||
@@ -2542,8 +2542,10 @@ static void generic_acomp_init(struct hda_codec *codec, | |||
2542 | spec->port2pin = port2pin; | 2542 | spec->port2pin = port2pin; |
2543 | setup_drm_audio_ops(codec, ops); | 2543 | setup_drm_audio_ops(codec, ops); |
2544 | if (!snd_hdac_acomp_init(&codec->bus->core, &spec->drm_audio_ops, | 2544 | if (!snd_hdac_acomp_init(&codec->bus->core, &spec->drm_audio_ops, |
2545 | match_bound_vga, 0)) | 2545 | match_bound_vga, 0)) { |
2546 | spec->acomp_registered = true; | 2546 | spec->acomp_registered = true; |
2547 | codec->bus->keep_power = 0; | ||
2548 | } | ||
2547 | } | 2549 | } |
2548 | 2550 | ||
2549 | /* | 2551 | /* |