Commit b29083c5e52481e8ce6ce0007590f7a1f405018b

Authored by Linus Torvalds

Merge tag 'sound-fix-4.2' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound

Pull sound fixes from Takashi Iwai:
 "Here are stable fixes that have been gathered since rc8: fixes for
  HD-audio widget power control regressions since 4.1, a NULL fix for
  HD-audio HDMI, a noise fix for Conexant codecs and a quirk addition
  for USB-Audio DSD"

* tag 'sound-fix-4.2' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound:
  ALSA: hda - Fix path power activation
  ALSA: hda - Check all inputs for is_active_nid_for_any()
  ALSA: hda: fix possible NULL dereference
  ALSA: hda - Shutdown CX20722 on reboot/free to avoid spurious noises
  ALSA: usb: Add native DSD support for Gustard DAC-X20U

Showing 4 changed files Side-by-side Diff

sound/pci/hda/hda_codec.c
... ... @@ -3172,7 +3172,7 @@
3172 3172 struct snd_pcm_chmap *chmap;
3173 3173 const struct snd_pcm_chmap_elem *elem;
3174 3174  
3175   - if (!pcm || pcm->own_chmap ||
  3175 + if (!pcm || !pcm->pcm || pcm->own_chmap ||
3176 3176 !hinfo->substreams)
3177 3177 continue;
3178 3178 elem = hinfo->chmap ? hinfo->chmap : snd_pcm_std_chmaps;
sound/pci/hda/hda_generic.c
... ... @@ -671,7 +671,8 @@
671 671 }
672 672 for (i = 0; i < path->depth; i++) {
673 673 if (path->path[i] == nid) {
674   - if (dir == HDA_OUTPUT || path->idx[i] == idx)
  674 + if (dir == HDA_OUTPUT || idx == -1 ||
  675 + path->idx[i] == idx)
675 676 return true;
676 677 break;
677 678 }
... ... @@ -682,7 +683,7 @@
682 683  
683 684 /* check whether the NID is referred by any active paths */
684 685 #define is_active_nid_for_any(codec, nid) \
685   - is_active_nid(codec, nid, HDA_OUTPUT, 0)
  686 + is_active_nid(codec, nid, HDA_OUTPUT, -1)
686 687  
687 688 /* get the default amp value for the target state */
688 689 static int get_amp_val_to_activate(struct hda_codec *codec, hda_nid_t nid,
... ... @@ -883,8 +884,7 @@
883 884 struct hda_gen_spec *spec = codec->spec;
884 885 int i;
885 886  
886   - if (!enable)
887   - path->active = false;
  887 + path->active = enable;
888 888  
889 889 /* make sure the widget is powered up */
890 890 if (enable && (spec->power_down_unused || codec->power_save_node))
... ... @@ -902,9 +902,6 @@
902 902 if (has_amp_out(codec, path, i))
903 903 activate_amp_out(codec, path, i, enable);
904 904 }
905   -
906   - if (enable)
907   - path->active = true;
908 905 }
909 906 EXPORT_SYMBOL_GPL(snd_hda_activate_path);
910 907  
sound/pci/hda/patch_conexant.c
... ... @@ -200,12 +200,33 @@
200 200 return 0;
201 201 }
202 202  
203   -#define cx_auto_free snd_hda_gen_free
  203 +static void cx_auto_reboot_notify(struct hda_codec *codec)
  204 +{
  205 + struct conexant_spec *spec = codec->spec;
204 206  
  207 + if (codec->core.vendor_id != 0x14f150f2)
  208 + return;
  209 +
  210 + /* Turn the CX20722 codec into D3 to avoid spurious noises
  211 + from the internal speaker during (and after) reboot */
  212 + cx_auto_turn_eapd(codec, spec->num_eapds, spec->eapds, false);
  213 +
  214 + snd_hda_codec_set_power_to_all(codec, codec->core.afg, AC_PWRST_D3);
  215 + snd_hda_codec_write(codec, codec->core.afg, 0,
  216 + AC_VERB_SET_POWER_STATE, AC_PWRST_D3);
  217 +}
  218 +
  219 +static void cx_auto_free(struct hda_codec *codec)
  220 +{
  221 + cx_auto_reboot_notify(codec);
  222 + snd_hda_gen_free(codec);
  223 +}
  224 +
205 225 static const struct hda_codec_ops cx_auto_patch_ops = {
206 226 .build_controls = cx_auto_build_controls,
207 227 .build_pcms = snd_hda_gen_build_pcms,
208 228 .init = cx_auto_init,
  229 + .reboot_notify = cx_auto_reboot_notify,
209 230 .free = cx_auto_free,
210 231 .unsol_event = snd_hda_jack_unsol_event,
211 232 #ifdef CONFIG_PM
... ... @@ -1268,6 +1268,7 @@
1268 1268 return SNDRV_PCM_FMTBIT_DSD_U32_BE;
1269 1269 break;
1270 1270  
  1271 + case USB_ID(0x20b1, 0x000a): /* Gustard DAC-X20U */
1271 1272 case USB_ID(0x20b1, 0x2009): /* DIYINHK DSD DXD 384kHz USB to I2S/DSD */
1272 1273 case USB_ID(0x20b1, 0x2023): /* JLsounds I2SoverUSB */
1273 1274 if (fp->altsetting == 3)