Pull sound fixes from Takashi Iwai: "One significant regression fix is for HD-audio buffer preallocation. In 5.6 it was set to non-prompt for x86 and forced to 0, but this turned out to be problematic for some applications, hence it gets reverted. Distros would need to restore CONFIG_SND_HDA_PREALLOC_SIZE value to the earlier values they've used in the past. Other than that, we've received quite a few small fixes for HD-audio and USB-audio. Most of them are for dealing with the broken TRX40 mobos and the runtime PM without HD-audio codecs" * tag 'sound-5.7-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound: ALSA: hda: call runtime_allow() for all hda controllers ALSA: hda: Allow setting preallocation again for x86 ALSA: hda: Explicitly permit using autosuspend if runtime PM is supported ALSA: hda: Skip controller resume if not needed ALSA: hda: Keep the controller initialization even if no codecs found ALSA: hda: Release resources at error in delayed probe ALSA: hda: Honor PM disablement in PM freeze and thaw_noirq ops ALSA: hda: Don't release card at firmware loading error ALSA: usb-audio: Check mapping at creating connector controls, too ALSA: usb-audio: Don't create jack controls for PCM terminals ALSA: usb-audio: Don't override ignore_ctl_error value from the map ALSA: usb-audio: Filter error from connector kctl ops, too ALSA: hda/realtek - Enable the headset mic on Asus FX505DT ALSA: ctxfi: Remove unnecessary cast in kfree
Unified · Split
| @@ -494,6 +494,11 @@ void snd_hda_update_power_acct(struct hda_codec *codec); · 493 unmodified lines | |||
| 494 | static inline void snd_hda_set_power_save(struct hda_bus *bus, int delay) {} | 494 | static inline void snd_hda_set_power_save(struct hda_bus *bus, int delay) {} |
| 495 | #endif | 495 | #endif |
| 496 | 496 | ||
| 497 | static inline bool hda_codec_need_resume(struct hda_codec *codec) | ||
| 498 | { | ||
| 499 | return !codec->relaxed_resume && codec->jacktbl.used; | ||
| 500 | } | ||
| 501 | |||
| 497 | #ifdef CONFIG_SND_HDA_PATCH_LOADER | 502 | #ifdef CONFIG_SND_HDA_PATCH_LOADER |
| 498 | /* | 503 | /* |
| 499 | * patch firmware | 504 | * patch firmware |
| @@ -21,16 +21,17 @@ config SND_HDA_EXT_CORE · 20 unmodified lines | |||
| 21 | select SND_HDA_CORE | 21 | select SND_HDA_CORE |
| 22 | 22 | ||
| 23 | config SND_HDA_PREALLOC_SIZE | 23 | config SND_HDA_PREALLOC_SIZE |
| 24 | int "Pre-allocated buffer size for HD-audio driver" if !SND_DMA_SGBUF | 24 | int "Pre-allocated buffer size for HD-audio driver" |
| 25 | range 0 32768 | 25 | range 0 32768 |
| 26 | default 0 if SND_DMA_SGBUF | 26 | default 2048 if SND_DMA_SGBUF |
| 27 | default 64 if !SND_DMA_SGBUF | 27 | default 64 if !SND_DMA_SGBUF |
| 28 | help | 28 | help |
| 29 | Specifies the default pre-allocated buffer-size in kB for the | 29 | Specifies the default pre-allocated buffer-size in kB for the |
| 30 | HD-audio driver. A larger buffer (e.g. 2048) is preferred | 30 | HD-audio driver. A larger buffer (e.g. 2048) is preferred |
| 31 | for systems using PulseAudio. The default 64 is chosen just | 31 | for systems using PulseAudio. The default 64 is chosen just |
| 32 | for compatibility reasons. | 32 | for compatibility reasons. |
| 33 | On x86 systems, the default is zero as we need no preallocation. | 33 | On x86 systems, the default is 2048 as a reasonable value for |
| 34 | most of modern systems. | ||
| 34 | 35 | ||
| 35 | Note that the pre-allocation size can be changed dynamically | 36 | Note that the pre-allocation size can be changed dynamically |
| 36 | via a proc file (/proc/asound/card*/pcm*/sub*/prealloc), too. | 37 | via a proc file (/proc/asound/card*/pcm*/sub*/prealloc), too. |
| @@ -168,7 +168,7 @@ static int src_get_rsc_ctrl_blk(void **rblk) · 167 unmodified lines | |||
| 168 | 168 | ||
| 169 | static int src_put_rsc_ctrl_blk(void *blk) | 169 | static int src_put_rsc_ctrl_blk(void *blk) |
| 170 | { | 170 | { |
| 171 | kfree((struct src_rsc_ctrl_blk *)blk); | 171 | kfree(blk); |
| 172 | 172 | ||
| 173 | return 0; | 173 | return 0; |
| 174 | } | 174 | } |
| @@ -494,7 +494,7 @@ static int src_mgr_get_ctrl_blk(void **rblk) · 319 unmodified lines | |||
| 494 | 494 | ||
| 495 | static int src_mgr_put_ctrl_blk(void *blk) | 495 | static int src_mgr_put_ctrl_blk(void *blk) |
| 496 | { | 496 | { |
| 497 | kfree((struct src_mgr_ctrl_blk *)blk); | 497 | kfree(blk); |
| 498 | 498 | ||
| 499 | return 0; | 499 | return 0; |
| 500 | } | 500 | } |
| @@ -515,7 +515,7 @@ static int srcimp_mgr_get_ctrl_blk(void **rblk) · 14 unmodified lines | |||
| 515 | 515 | ||
| 516 | static int srcimp_mgr_put_ctrl_blk(void *blk) | 516 | static int srcimp_mgr_put_ctrl_blk(void *blk) |
| 517 | { | 517 | { |
| 518 | kfree((struct srcimp_mgr_ctrl_blk *)blk); | 518 | kfree(blk); |
| 519 | 519 | ||
| 520 | return 0; | 520 | return 0; |
| 521 | } | 521 | } |
| @@ -702,7 +702,7 @@ static int amixer_rsc_get_ctrl_blk(void **rblk) · 180 unmodified lines | |||
| 702 | 702 | ||
| 703 | static int amixer_rsc_put_ctrl_blk(void *blk) | 703 | static int amixer_rsc_put_ctrl_blk(void *blk) |
| 704 | { | 704 | { |
| 705 | kfree((struct amixer_rsc_ctrl_blk *)blk); | 705 | kfree(blk); |
| 706 | 706 | ||
| 707 | return 0; | 707 | return 0; |
| 708 | } | 708 | } |
| @@ -909,7 +909,7 @@ static int dai_get_ctrl_blk(void **rblk) · 200 unmodified lines | |||
| 909 | 909 | ||
| 910 | static int dai_put_ctrl_blk(void *blk) | 910 | static int dai_put_ctrl_blk(void *blk) |
| 911 | { | 911 | { |
| 912 | kfree((struct dai_ctrl_blk *)blk); | 912 | kfree(blk); |
| 913 | 913 | ||
| 914 | return 0; | 914 | return 0; |
| 915 | } | 915 | } |
| @@ -958,7 +958,7 @@ static int dao_get_ctrl_blk(void **rblk) · 42 unmodified lines | |||
| 958 | 958 | ||
| 959 | static int dao_put_ctrl_blk(void *blk) | 959 | static int dao_put_ctrl_blk(void *blk) |
| 960 | { | 960 | { |
| 961 | kfree((struct dao_ctrl_blk *)blk); | 961 | kfree(blk); |
| 962 | 962 | ||
| 963 | return 0; | 963 | return 0; |
| 964 | } | 964 | } |
| @@ -1156,7 +1156,7 @@ static int daio_mgr_get_ctrl_blk(struct hw *hw, void **rblk) · 191 unmodified lines | |||
| 1156 | 1156 | ||
| 1157 | static int daio_mgr_put_ctrl_blk(void *blk) | 1157 | static int daio_mgr_put_ctrl_blk(void *blk) |
| 1158 | { | 1158 | { |
| 1159 | kfree((struct daio_mgr_ctrl_blk *)blk); | 1159 | kfree(blk); |
| 1160 | 1160 | ||
| 1161 | return 0; | 1161 | return 0; |
| 1162 | } | 1162 | } |
| @@ -2951,7 +2951,7 @@ static int hda_codec_runtime_resume(struct device *dev) · 2950 unmodified lines | |||
| 2951 | static int hda_codec_force_resume(struct device *dev) | 2951 | static int hda_codec_force_resume(struct device *dev) |
| 2952 | { | 2952 | { |
| 2953 | struct hda_codec *codec = dev_to_hda_codec(dev); | 2953 | struct hda_codec *codec = dev_to_hda_codec(dev); |
| 2954 | bool forced_resume = !codec->relaxed_resume && codec->jacktbl.used; | 2954 | bool forced_resume = hda_codec_need_resume(codec); |
| 2955 | int ret; | 2955 | int ret; |
| 2956 | 2956 | ||
| 2957 | /* The get/put pair below enforces the runtime resume even if the | 2957 | /* The get/put pair below enforces the runtime resume even if the |
| @@ -1027,7 +1027,7 @@ static int azx_suspend(struct device *dev) · 1026 unmodified lines | |||
| 1027 | chip = card->private_data; | 1027 | chip = card->private_data; |
| 1028 | bus = azx_bus(chip); | 1028 | bus = azx_bus(chip); |
| 1029 | snd_power_change_state(card, SNDRV_CTL_POWER_D3hot); | 1029 | snd_power_change_state(card, SNDRV_CTL_POWER_D3hot); |
| 1030 | __azx_runtime_suspend(chip); | 1030 | pm_runtime_force_suspend(dev); |
| 1031 | if (bus->irq >= 0) { | 1031 | if (bus->irq >= 0) { |
| 1032 | free_irq(bus->irq, chip); | 1032 | free_irq(bus->irq, chip); |
| 1033 | bus->irq = -1; | 1033 | bus->irq = -1; |
| @@ -1044,7 +1044,9 @@ static int azx_suspend(struct device *dev) · 10 unmodified lines | |||
| 1044 | static int azx_resume(struct device *dev) | 1044 | static int azx_resume(struct device *dev) |
| 1045 | { | 1045 | { |
| 1046 | struct snd_card *card = dev_get_drvdata(dev); | 1046 | struct snd_card *card = dev_get_drvdata(dev); |
| 1047 | struct hda_codec *codec; | ||
| 1047 | struct azx *chip; | 1048 | struct azx *chip; |
| 1049 | bool forced_resume = false; | ||
| 1048 | 1050 | ||
| 1049 | if (!azx_is_pm_ready(card)) | 1051 | if (!azx_is_pm_ready(card)) |
| 1050 | return 0; | 1052 | return 0; |
| @@ -1055,7 +1057,20 @@ static int azx_resume(struct device *dev) · 4 unmodified lines | |||
| 1055 | chip->msi = 0; | 1057 | chip->msi = 0; |
| 1056 | if (azx_acquire_irq(chip, 1) < 0) | 1058 | if (azx_acquire_irq(chip, 1) < 0) |
| 1057 | return -EIO; | 1059 | return -EIO; |
| 1058 | __azx_runtime_resume(chip, false); | 1060 | |
| 1061 | /* check for the forced resume */ | ||
| 1062 | list_for_each_codec(codec, &chip->bus) { | ||
| 1063 | if (hda_codec_need_resume(codec)) { | ||
| 1064 | forced_resume = true; | ||
| 1065 | break; | ||
| 1066 | } | ||
| 1067 | } | ||
| 1068 | |||
| 1069 | if (forced_resume) | ||
| 1070 | pm_runtime_get_noresume(dev); | ||
| 1071 | pm_runtime_force_resume(dev); | ||
| 1072 | if (forced_resume) | ||
| 1073 | pm_runtime_put(dev); | ||
| 1059 | snd_power_change_state(card, SNDRV_CTL_POWER_D0); | 1074 | snd_power_change_state(card, SNDRV_CTL_POWER_D0); |
| 1060 | 1075 | ||
| 1061 | trace_azx_resume(chip); | 1076 | trace_azx_resume(chip); |
| @@ -1071,6 +1086,8 @@ static int azx_freeze_noirq(struct device *dev) · 9 unmodified lines | |||
| 1071 | struct azx *chip = card->private_data; | 1086 | struct azx *chip = card->private_data; |
| 1072 | struct pci_dev *pci = to_pci_dev(dev); | 1087 | struct pci_dev *pci = to_pci_dev(dev); |
| 1073 | 1088 | ||
| 1089 | if (!azx_is_pm_ready(card)) | ||
| 1090 | return 0; | ||
| 1074 | if (chip->driver_type == AZX_DRIVER_SKL) | 1091 | if (chip->driver_type == AZX_DRIVER_SKL) |
| 1075 | pci_set_power_state(pci, PCI_D3hot); | 1092 | pci_set_power_state(pci, PCI_D3hot); |
| 1076 | 1093 | ||
| @@ -1083,6 +1100,8 @@ static int azx_thaw_noirq(struct device *dev) · 6 unmodified lines | |||
| 1083 | struct azx *chip = card->private_data; | 1100 | struct azx *chip = card->private_data; |
| 1084 | struct pci_dev *pci = to_pci_dev(dev); | 1101 | struct pci_dev *pci = to_pci_dev(dev); |
| 1085 | 1102 | ||
| 1103 | if (!azx_is_pm_ready(card)) | ||
| 1104 | return 0; | ||
| 1086 | if (chip->driver_type == AZX_DRIVER_SKL) | 1105 | if (chip->driver_type == AZX_DRIVER_SKL) |
| 1087 | pci_set_power_state(pci, PCI_D0); | 1106 | pci_set_power_state(pci, PCI_D0); |
| 1088 | 1107 | ||
| @@ -1098,12 +1117,12 @@ static int azx_runtime_suspend(struct device *dev) · 9 unmodified lines | |||
| 1098 | if (!azx_is_pm_ready(card)) | 1117 | if (!azx_is_pm_ready(card)) |
| 1099 | return 0; | 1118 | return 0; |
| 1100 | chip = card->private_data; | 1119 | chip = card->private_data; |
| 1101 | if (!azx_has_pm_runtime(chip)) | ||
| 1102 | return 0; | ||
| 1103 | 1120 | ||
| 1104 | /* enable controller wake up event */ | 1121 | /* enable controller wake up event */ |
| 1105 | azx_writew(chip, WAKEEN, azx_readw(chip, WAKEEN) | | 1122 | if (snd_power_get_state(card) == SNDRV_CTL_POWER_D0) { |
| 1106 | STATESTS_INT_MASK); | 1123 | azx_writew(chip, WAKEEN, azx_readw(chip, WAKEEN) | |
| 1124 | STATESTS_INT_MASK); | ||
| 1125 | } | ||
| 1107 | 1126 | ||
| 1108 | __azx_runtime_suspend(chip); | 1127 | __azx_runtime_suspend(chip); |
| 1109 | trace_azx_runtime_suspend(chip); | 1128 | trace_azx_runtime_suspend(chip); |
| @@ -1114,17 +1133,18 @@ static int azx_runtime_resume(struct device *dev) · 4 unmodified lines | |||
| 1114 | { | 1133 | { |
| 1115 | struct snd_card *card = dev_get_drvdata(dev); | 1134 | struct snd_card *card = dev_get_drvdata(dev); |
| 1116 | struct azx *chip; | 1135 | struct azx *chip; |
| 1136 | bool from_rt = snd_power_get_state(card) == SNDRV_CTL_POWER_D0; | ||
| 1117 | 1137 | ||
| 1118 | if (!azx_is_pm_ready(card)) | 1138 | if (!azx_is_pm_ready(card)) |
| 1119 | return 0; | 1139 | return 0; |
| 1120 | chip = card->private_data; | 1140 | chip = card->private_data; |
| 1121 | if (!azx_has_pm_runtime(chip)) | 1141 | __azx_runtime_resume(chip, from_rt); |
| 1122 | return 0; | ||
| 1123 | __azx_runtime_resume(chip, true); | ||
| 1124 | 1142 | ||
| 1125 | /* disable controller Wake Up event*/ | 1143 | /* disable controller Wake Up event*/ |
| 1126 | azx_writew(chip, WAKEEN, azx_readw(chip, WAKEEN) & | 1144 | if (from_rt) { |
| 1127 | ~STATESTS_INT_MASK); | 1145 | azx_writew(chip, WAKEEN, azx_readw(chip, WAKEEN) & |
| 1146 | ~STATESTS_INT_MASK); | ||
| 1147 | } | ||
| 1128 | 1148 | ||
| 1129 | trace_azx_runtime_resume(chip); | 1149 | trace_azx_runtime_resume(chip); |
| 1130 | return 0; | 1150 | return 0; |
| @@ -1199,10 +1219,8 @@ static void azx_vs_set_state(struct pci_dev *pci, · 68 unmodified lines | |||
| 1199 | if (!disabled) { | 1219 | if (!disabled) { |
| 1200 | dev_info(chip->card->dev, | 1220 | dev_info(chip->card->dev, |
| 1201 | "Start delayed initialization\n"); | 1221 | "Start delayed initialization\n"); |
| 1202 | if (azx_probe_continue(chip) < 0) { | 1222 | if (azx_probe_continue(chip) < 0) |
| 1203 | dev_err(chip->card->dev, "initialization error\n"); | 1223 | dev_err(chip->card->dev, "initialization error\n"); |
| 1204 | hda->init_failed = true; | ||
| 1205 | } | ||
| 1206 | } | 1224 | } |
| 1207 | } else { | 1225 | } else { |
| 1208 | dev_info(chip->card->dev, "%s via vga_switcheroo\n", | 1226 | dev_info(chip->card->dev, "%s via vga_switcheroo\n", |
| @@ -1335,12 +1353,15 @@ static int register_vga_switcheroo(struct azx *chip) · 126 unmodified lines | |||
| 1335 | /* | 1353 | /* |
| 1336 | * destructor | 1354 | * destructor |
| 1337 | */ | 1355 | */ |
| 1338 | static int azx_free(struct azx *chip) | 1356 | static void azx_free(struct azx *chip) |
| 1339 | { | 1357 | { |
| 1340 | struct pci_dev *pci = chip->pci; | 1358 | struct pci_dev *pci = chip->pci; |
| 1341 | struct hda_intel *hda = container_of(chip, struct hda_intel, chip); | 1359 | struct hda_intel *hda = container_of(chip, struct hda_intel, chip); |
| 1342 | struct hdac_bus *bus = azx_bus(chip); | 1360 | struct hdac_bus *bus = azx_bus(chip); |
| 1343 | 1361 | ||
| 1362 | if (hda->freed) | ||
| 1363 | return; | ||
| 1364 | |||
| 1344 | if (azx_has_pm_runtime(chip) && chip->running) | 1365 | if (azx_has_pm_runtime(chip) && chip->running) |
| 1345 | pm_runtime_get_noresume(&pci->dev); | 1366 | pm_runtime_get_noresume(&pci->dev); |
| 1346 | chip->running = 0; | 1367 | chip->running = 0; |
| @@ -1384,9 +1405,8 @@ static int azx_free(struct azx *chip) · 37 unmodified lines | |||
| 1384 | 1405 | ||
| 1385 | if (chip->driver_caps & AZX_DCAPS_I915_COMPONENT) | 1406 | if (chip->driver_caps & AZX_DCAPS_I915_COMPONENT) |
| 1386 | snd_hdac_i915_exit(bus); | 1407 | snd_hdac_i915_exit(bus); |
| 1387 | kfree(hda); | ||
| 1388 | 1408 | ||
| 1389 | return 0; | 1409 | hda->freed = 1; |
| 1390 | } | 1410 | } |
| 1391 | 1411 | ||
| 1392 | static int azx_dev_disconnect(struct snd_device *device) | 1412 | static int azx_dev_disconnect(struct snd_device *device) |
| @@ -1402,7 +1422,8 @@ static int azx_dev_disconnect(struct snd_device *device) · 9 unmodified lines | |||
| 1402 | 1422 | ||
| 1403 | static int azx_dev_free(struct snd_device *device) | 1423 | static int azx_dev_free(struct snd_device *device) |
| 1404 | { | 1424 | { |
| 1405 | return azx_free(device->device_data); | 1425 | azx_free(device->device_data); |
| 1426 | return 0; | ||
| 1406 | } | 1427 | } |
| 1407 | 1428 | ||
| 1408 | #ifdef SUPPORT_VGA_SWITCHEROO | 1429 | #ifdef SUPPORT_VGA_SWITCHEROO |
| @@ -1769,7 +1790,7 @@ static int azx_create(struct snd_card *card, struct pci_dev *pci, · 360 unmodified lines | |||
| 1769 | if (err < 0) | 1790 | if (err < 0) |
| 1770 | return err; | 1791 | return err; |
| 1771 | 1792 | ||
| 1772 | hda = kzalloc(sizeof(*hda), GFP_KERNEL); | 1793 | hda = devm_kzalloc(&pci->dev, sizeof(*hda), GFP_KERNEL); |
| 1773 | if (!hda) { | 1794 | if (!hda) { |
| 1774 | pci_disable_device(pci); | 1795 | pci_disable_device(pci); |
| 1775 | return -ENOMEM; | 1796 | return -ENOMEM; |
| @@ -1810,7 +1831,6 @@ static int azx_create(struct snd_card *card, struct pci_dev *pci, · 34 unmodified lines | |||
| 1810 | 1831 | ||
| 1811 | err = azx_bus_init(chip, model[dev]); | 1832 | err = azx_bus_init(chip, model[dev]); |
| 1812 | if (err < 0) { | 1833 | if (err < 0) { |
| 1813 | kfree(hda); | ||
| 1814 | pci_disable_device(pci); | 1834 | pci_disable_device(pci); |
| 1815 | return err; | 1835 | return err; |
| 1816 | } | 1836 | } |
| @@ -2005,7 +2025,7 @@ static int azx_first_init(struct azx *chip) · 188 unmodified lines | |||
| 2005 | /* codec detection */ | 2025 | /* codec detection */ |
| 2006 | if (!azx_bus(chip)->codec_mask) { | 2026 | if (!azx_bus(chip)->codec_mask) { |
| 2007 | dev_err(card->dev, "no codecs found!\n"); | 2027 | dev_err(card->dev, "no codecs found!\n"); |
| 2008 | return -ENODEV; | 2028 | /* keep running the rest for the runtime PM */ |
| 2009 | } | 2029 | } |
| 2010 | 2030 | ||
| 2011 | if (azx_acquire_irq(chip, 0) < 0) | 2031 | if (azx_acquire_irq(chip, 0) < 0) |
| @@ -2027,24 +2047,15 @@ static void azx_firmware_cb(const struct firmware *fw, void *context) · 15 unmodified lines | |||
| 2027 | { | 2047 | { |
| 2028 | struct snd_card *card = context; | 2048 | struct snd_card *card = context; |
| 2029 | struct azx *chip = card->private_data; | 2049 | struct azx *chip = card->private_data; |
| 2030 | struct pci_dev *pci = chip->pci; | ||
| 2031 | |||
| 2032 | if (!fw) { | ||
| 2033 | dev_err(card->dev, "Cannot load firmware, aborting\n"); | ||
| 2034 | goto error; | ||
| 2035 | } | ||
| 2036 | 2050 | ||
| 2037 | chip->fw = fw; | 2051 | if (fw) |
| 2052 | chip->fw = fw; | ||
| 2053 | else | ||
| 2054 | dev_err(card->dev, "Cannot load firmware, continue without patching\n"); | ||
| 2038 | if (!chip->disabled) { | 2055 | if (!chip->disabled) { |
| 2039 | /* continue probing */ | 2056 | /* continue probing */ |
| 2040 | if (azx_probe_continue(chip)) | 2057 | azx_probe_continue(chip); |
| 2041 | goto error; | ||
| 2042 | } | 2058 | } |
| 2043 | return; /* OK */ | ||
| 2044 | |||
| 2045 | error: | ||
| 2046 | snd_card_free(card); | ||
| 2047 | pci_set_drvdata(pci, NULL); | ||
| 2048 | } | 2059 | } |
| 2049 | #endif | 2060 | #endif |
| 2050 | 2061 | ||
| @@ -2308,9 +2319,11 @@ static int azx_probe_continue(struct azx *chip) · 257 unmodified lines | |||
| 2308 | #endif | 2319 | #endif |
| 2309 | 2320 | ||
| 2310 | /* create codec instances */ | 2321 | /* create codec instances */ |
| 2311 | err = azx_probe_codecs(chip, azx_max_codecs[chip->driver_type]); | 2322 | if (bus->codec_mask) { |
| 2312 | if (err < 0) | 2323 | err = azx_probe_codecs(chip, azx_max_codecs[chip->driver_type]); |
| 2313 | goto out_free; | 2324 | if (err < 0) |
| 2325 | goto out_free; | ||
| 2326 | } | ||
| 2314 | 2327 | ||
| 2315 | #ifdef CONFIG_SND_HDA_PATCH_LOADER | 2328 | #ifdef CONFIG_SND_HDA_PATCH_LOADER |
| 2316 | if (chip->fw) { | 2329 | if (chip->fw) { |
| @@ -2324,7 +2337,7 @@ static int azx_probe_continue(struct azx *chip) · 7 unmodified lines | |||
| 2324 | #endif | 2337 | #endif |
| 2325 | } | 2338 | } |
| 2326 | #endif | 2339 | #endif |
| 2327 | if ((probe_only[dev] & 1) == 0) { | 2340 | if (bus->codec_mask && !(probe_only[dev] & 1)) { |
| 2328 | err = azx_codec_configure(chip); | 2341 | err = azx_codec_configure(chip); |
| 2329 | if (err < 0) | 2342 | if (err < 0) |
| 2330 | goto out_free; | 2343 | goto out_free; |
| @@ -2341,17 +2354,23 @@ static int azx_probe_continue(struct azx *chip) · 10 unmodified lines | |||
| 2341 | 2354 | ||
| 2342 | set_default_power_save(chip); | 2355 | set_default_power_save(chip); |
| 2343 | 2356 | ||
| 2344 | if (azx_has_pm_runtime(chip)) | 2357 | if (azx_has_pm_runtime(chip)) { |
| 2358 | pm_runtime_use_autosuspend(&pci->dev); | ||
| 2359 | pm_runtime_allow(&pci->dev); | ||
| 2345 | pm_runtime_put_autosuspend(&pci->dev); | 2360 | pm_runtime_put_autosuspend(&pci->dev); |
| 2361 | } | ||
| 2346 | 2362 | ||
| 2347 | out_free: | 2363 | out_free: |
| 2348 | if (err < 0 || !hda->need_i915_power) | 2364 | if (err < 0) { |
| 2365 | azx_free(chip); | ||
| 2366 | return err; | ||
| 2367 | } | ||
| 2368 | |||
| 2369 | if (!hda->need_i915_power) | ||
| 2349 | display_power(chip, false); | 2370 | display_power(chip, false); |
| 2350 | if (err < 0) | ||
| 2351 | hda->init_failed = 1; | ||
| 2352 | complete_all(&hda->probe_wait); | 2371 | complete_all(&hda->probe_wait); |
| 2353 | to_hda_bus(bus)->bus_probing = 0; | 2372 | to_hda_bus(bus)->bus_probing = 0; |
| 2354 | return err; | 2373 | return 0; |
| 2355 | } | 2374 | } |
| 2356 | 2375 | ||
| 2357 | static void azx_remove(struct pci_dev *pci) | 2376 | static void azx_remove(struct pci_dev *pci) |
| @@ -27,6 +27,7 @@ struct hda_intel { · 26 unmodified lines | |||
| 27 | unsigned int use_vga_switcheroo:1; | 27 | unsigned int use_vga_switcheroo:1; |
| 28 | unsigned int vga_switcheroo_registered:1; | 28 | unsigned int vga_switcheroo_registered:1; |
| 29 | unsigned int init_failed:1; /* delayed init failed */ | 29 | unsigned int init_failed:1; /* delayed init failed */ |
| 30 | unsigned int freed:1; /* resources already released */ | ||
| 30 | 31 | ||
| 31 | bool need_i915_power:1; /* the hda controller needs i915 power */ | 32 | bool need_i915_power:1; /* the hda controller needs i915 power */ |
| 32 | }; | 33 | }; |
| @@ -7378,6 +7378,7 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = { · 7377 unmodified lines | |||
| 7378 | SND_PCI_QUIRK(0x1043, 0x16e3, "ASUS UX50", ALC269_FIXUP_STEREO_DMIC), | 7378 | SND_PCI_QUIRK(0x1043, 0x16e3, "ASUS UX50", ALC269_FIXUP_STEREO_DMIC), |
| 7379 | SND_PCI_QUIRK(0x1043, 0x17d1, "ASUS UX431FL", ALC294_FIXUP_ASUS_DUAL_SPK), | 7379 | SND_PCI_QUIRK(0x1043, 0x17d1, "ASUS UX431FL", ALC294_FIXUP_ASUS_DUAL_SPK), |
| 7380 | SND_PCI_QUIRK(0x1043, 0x18b1, "Asus MJ401TA", ALC256_FIXUP_ASUS_HEADSET_MIC), | 7380 | SND_PCI_QUIRK(0x1043, 0x18b1, "Asus MJ401TA", ALC256_FIXUP_ASUS_HEADSET_MIC), |
| 7381 | SND_PCI_QUIRK(0x1043, 0x18f1, "Asus FX505DT", ALC256_FIXUP_ASUS_HEADSET_MIC), | ||
| 7381 | SND_PCI_QUIRK(0x1043, 0x19ce, "ASUS B9450FA", ALC294_FIXUP_ASUS_HPE), | 7382 | SND_PCI_QUIRK(0x1043, 0x19ce, "ASUS B9450FA", ALC294_FIXUP_ASUS_HPE), |
| 7382 | SND_PCI_QUIRK(0x1043, 0x1a13, "Asus G73Jw", ALC269_FIXUP_ASUS_G73JW), | 7383 | SND_PCI_QUIRK(0x1043, 0x1a13, "Asus G73Jw", ALC269_FIXUP_ASUS_G73JW), |
| 7383 | SND_PCI_QUIRK(0x1043, 0x1a30, "ASUS X705UD", ALC256_FIXUP_ASUS_MIC), | 7384 | SND_PCI_QUIRK(0x1043, 0x1a30, "ASUS X705UD", ALC256_FIXUP_ASUS_MIC), |
| @@ -1457,7 +1457,7 @@ error: · 1456 unmodified lines | |||
| 1457 | usb_audio_err(chip, | 1457 | usb_audio_err(chip, |
| 1458 | "cannot get connectors status: req = %#x, wValue = %#x, wIndex = %#x, type = %d\n", | 1458 | "cannot get connectors status: req = %#x, wValue = %#x, wIndex = %#x, type = %d\n", |
| 1459 | UAC_GET_CUR, validx, idx, cval->val_type); | 1459 | UAC_GET_CUR, validx, idx, cval->val_type); |
| 1460 | return ret; | 1460 | return filter_error(cval, ret); |
| 1461 | } | 1461 | } |
| 1462 | 1462 | ||
| 1463 | ucontrol->value.integer.value[0] = val; | 1463 | ucontrol->value.integer.value[0] = val; |
| @@ -1771,11 +1771,15 @@ static void get_connector_control_name(struct usb_mixer_interface *mixer, · 307 unmodified lines | |||
| 1771 | 1771 | ||
| 1772 | /* Build a mixer control for a UAC connector control (jack-detect) */ | 1772 | /* Build a mixer control for a UAC connector control (jack-detect) */ |
| 1773 | static void build_connector_control(struct usb_mixer_interface *mixer, | 1773 | static void build_connector_control(struct usb_mixer_interface *mixer, |
| 1774 | const struct usbmix_name_map *imap, | ||
| 1774 | struct usb_audio_term *term, bool is_input) | 1775 | struct usb_audio_term *term, bool is_input) |
| 1775 | { | 1776 | { |
| 1776 | struct snd_kcontrol *kctl; | 1777 | struct snd_kcontrol *kctl; |
| 1777 | struct usb_mixer_elem_info *cval; | 1778 | struct usb_mixer_elem_info *cval; |
| 1778 | 1779 | ||
| 1780 | if (check_ignored_ctl(find_map(imap, term->id, 0))) | ||
| 1781 | return; | ||
| 1782 | |||
| 1779 | cval = kzalloc(sizeof(*cval), GFP_KERNEL); | 1783 | cval = kzalloc(sizeof(*cval), GFP_KERNEL); |
| 1780 | if (!cval) | 1784 | if (!cval) |
| 1781 | return; | 1785 | return; |
| @@ -2109,8 +2113,9 @@ static int parse_audio_input_terminal(struct mixer_build *state, int unitid, · 327 unmodified lines | |||
| 2109 | check_input_term(state, term_id, &iterm); | 2113 | check_input_term(state, term_id, &iterm); |
| 2110 | 2114 | ||
| 2111 | /* Check for jack detection. */ | 2115 | /* Check for jack detection. */ |
| 2112 | if (uac_v2v3_control_is_readable(bmctls, control)) | 2116 | if ((iterm.type & 0xff00) != 0x0100 && |
| 2113 | build_connector_control(state->mixer, &iterm, true); | 2117 | uac_v2v3_control_is_readable(bmctls, control)) |
| 2118 | build_connector_control(state->mixer, state->map, &iterm, true); | ||
| 2114 | 2119 | ||
| 2115 | return 0; | 2120 | return 0; |
| 2116 | } | 2121 | } |
| @@ -3071,13 +3076,13 @@ static int snd_usb_mixer_controls_badd(struct usb_mixer_interface *mixer, · 954 unmodified lines | |||
| 3071 | memset(&iterm, 0, sizeof(iterm)); | 3076 | memset(&iterm, 0, sizeof(iterm)); |
| 3072 | iterm.id = UAC3_BADD_IT_ID4; | 3077 | iterm.id = UAC3_BADD_IT_ID4; |
| 3073 | iterm.type = UAC_BIDIR_TERMINAL_HEADSET; | 3078 | iterm.type = UAC_BIDIR_TERMINAL_HEADSET; |
| 3074 | build_connector_control(mixer, &iterm, true); | 3079 | build_connector_control(mixer, map->map, &iterm, true); |
| 3075 | 3080 | ||
| 3076 | /* Output Term - Insertion control */ | 3081 | /* Output Term - Insertion control */ |
| 3077 | memset(&oterm, 0, sizeof(oterm)); | 3082 | memset(&oterm, 0, sizeof(oterm)); |
| 3078 | oterm.id = UAC3_BADD_OT_ID3; | 3083 | oterm.id = UAC3_BADD_OT_ID3; |
| 3079 | oterm.type = UAC_BIDIR_TERMINAL_HEADSET; | 3084 | oterm.type = UAC_BIDIR_TERMINAL_HEADSET; |
| 3080 | build_connector_control(mixer, &oterm, false); | 3085 | build_connector_control(mixer, map->map, &oterm, false); |
| 3081 | } | 3086 | } |
| 3082 | 3087 | ||
| 3083 | return 0; | 3088 | return 0; |
| @@ -3106,7 +3111,7 @@ static int snd_usb_mixer_controls(struct usb_mixer_interface *mixer) · 22 unmodified lines | |||
| 3106 | if (map->id == state.chip->usb_id) { | 3111 | if (map->id == state.chip->usb_id) { |
| 3107 | state.map = map->map; | 3112 | state.map = map->map; |
| 3108 | state.selector_map = map->selector_map; | 3113 | state.selector_map = map->selector_map; |
| 3109 | mixer->ignore_ctl_error = map->ignore_ctl_error; | 3114 | mixer->ignore_ctl_error |= map->ignore_ctl_error; |
| 3110 | break; | 3115 | break; |
| 3111 | } | 3116 | } |
| 3112 | } | 3117 | } |
| @@ -3149,10 +3154,11 @@ static int snd_usb_mixer_controls(struct usb_mixer_interface *mixer) · 36 unmodified lines | |||
| 3149 | if (err < 0 && err != -EINVAL) | 3154 | if (err < 0 && err != -EINVAL) |
| 3150 | return err; | 3155 | return err; |
| 3151 | 3156 | ||
| 3152 | if (uac_v2v3_control_is_readable(le16_to_cpu(desc->bmControls), | 3157 | if ((state.oterm.type & 0xff00) != 0x0100 && |
| 3158 | uac_v2v3_control_is_readable(le16_to_cpu(desc->bmControls), | ||
| 3153 | UAC2_TE_CONNECTOR)) { | 3159 | UAC2_TE_CONNECTOR)) { |
| 3154 | build_connector_control(state.mixer, &state.oterm, | 3160 | build_connector_control(state.mixer, state.map, |
| 3155 | false); | 3161 | &state.oterm, false); |
| 3156 | } | 3162 | } |
| 3157 | } else { /* UAC_VERSION_3 */ | 3163 | } else { /* UAC_VERSION_3 */ |
| 3158 | struct uac3_output_terminal_descriptor *desc = p; | 3164 | struct uac3_output_terminal_descriptor *desc = p; |
| @@ -3174,10 +3180,11 @@ static int snd_usb_mixer_controls(struct usb_mixer_interface *mixer) · 15 unmodified lines | |||
| 3174 | if (err < 0 && err != -EINVAL) | 3180 | if (err < 0 && err != -EINVAL) |
| 3175 | return err; | 3181 | return err; |
| 3176 | 3182 | ||
| 3177 | if (uac_v2v3_control_is_readable(le32_to_cpu(desc->bmControls), | 3183 | if ((state.oterm.type & 0xff00) != 0x0100 && |
| 3184 | uac_v2v3_control_is_readable(le32_to_cpu(desc->bmControls), | ||
| 3178 | UAC3_TE_INSERTION)) { | 3185 | UAC3_TE_INSERTION)) { |
| 3179 | build_connector_control(state.mixer, &state.oterm, | 3186 | build_connector_control(state.mixer, state.map, |
| 3180 | false); | 3187 | &state.oterm, false); |
| 3181 | } | 3188 | } |
| 3182 | } | 3189 | } |
| 3183 | } | 3190 | } |
| @@ -360,9 +360,11 @@ static const struct usbmix_name_map corsair_virtuoso_map[] = { · 359 unmodified lines | |||
| 360 | }; | 360 | }; |
| 361 | 361 | ||
| 362 | /* Some mobos shipped with a dummy HD-audio show the invalid GET_MIN/GET_MAX | 362 | /* Some mobos shipped with a dummy HD-audio show the invalid GET_MIN/GET_MAX |
| 363 | * response for Input Gain Pad (id=19, control=12). Skip it. | 363 | * response for Input Gain Pad (id=19, control=12) and the connector status |
| 364 | * for SPDIF terminal (id=18). Skip them. | ||
| 364 | */ | 365 | */ |
| 365 | static const struct usbmix_name_map asus_rog_map[] = { | 366 | static const struct usbmix_name_map asus_rog_map[] = { |
| 367 | { 18, NULL }, /* OT, connector control */ | ||
| 366 | { 19, NULL, 12 }, /* FU, Input Gain Pad */ | 368 | { 19, NULL, 12 }, /* FU, Input Gain Pad */ |
| 367 | {} | 369 | {} |
| 368 | }; | 370 | }; |