Commit b29083c5 authored by Linus Torvalds's avatar 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
parents 4941b8f0 c7cd0ef6
...@@ -3172,7 +3172,7 @@ static int add_std_chmaps(struct hda_codec *codec) ...@@ -3172,7 +3172,7 @@ static int add_std_chmaps(struct hda_codec *codec)
struct snd_pcm_chmap *chmap; struct snd_pcm_chmap *chmap;
const struct snd_pcm_chmap_elem *elem; const struct snd_pcm_chmap_elem *elem;
if (!pcm || pcm->own_chmap || if (!pcm || !pcm->pcm || pcm->own_chmap ||
!hinfo->substreams) !hinfo->substreams)
continue; continue;
elem = hinfo->chmap ? hinfo->chmap : snd_pcm_std_chmaps; elem = hinfo->chmap ? hinfo->chmap : snd_pcm_std_chmaps;
......
...@@ -671,7 +671,8 @@ static bool is_active_nid(struct hda_codec *codec, hda_nid_t nid, ...@@ -671,7 +671,8 @@ static bool is_active_nid(struct hda_codec *codec, hda_nid_t nid,
} }
for (i = 0; i < path->depth; i++) { for (i = 0; i < path->depth; i++) {
if (path->path[i] == nid) { if (path->path[i] == nid) {
if (dir == HDA_OUTPUT || path->idx[i] == idx) if (dir == HDA_OUTPUT || idx == -1 ||
path->idx[i] == idx)
return true; return true;
break; break;
} }
...@@ -682,7 +683,7 @@ static bool is_active_nid(struct hda_codec *codec, hda_nid_t nid, ...@@ -682,7 +683,7 @@ static bool is_active_nid(struct hda_codec *codec, hda_nid_t nid,
/* check whether the NID is referred by any active paths */ /* check whether the NID is referred by any active paths */
#define is_active_nid_for_any(codec, nid) \ #define is_active_nid_for_any(codec, nid) \
is_active_nid(codec, nid, HDA_OUTPUT, 0) is_active_nid(codec, nid, HDA_OUTPUT, -1)
/* get the default amp value for the target state */ /* get the default amp value for the target state */
static int get_amp_val_to_activate(struct hda_codec *codec, hda_nid_t nid, static int get_amp_val_to_activate(struct hda_codec *codec, hda_nid_t nid,
...@@ -883,8 +884,7 @@ void snd_hda_activate_path(struct hda_codec *codec, struct nid_path *path, ...@@ -883,8 +884,7 @@ void snd_hda_activate_path(struct hda_codec *codec, struct nid_path *path,
struct hda_gen_spec *spec = codec->spec; struct hda_gen_spec *spec = codec->spec;
int i; int i;
if (!enable) path->active = enable;
path->active = false;
/* make sure the widget is powered up */ /* make sure the widget is powered up */
if (enable && (spec->power_down_unused || codec->power_save_node)) if (enable && (spec->power_down_unused || codec->power_save_node))
...@@ -902,9 +902,6 @@ void snd_hda_activate_path(struct hda_codec *codec, struct nid_path *path, ...@@ -902,9 +902,6 @@ void snd_hda_activate_path(struct hda_codec *codec, struct nid_path *path,
if (has_amp_out(codec, path, i)) if (has_amp_out(codec, path, i))
activate_amp_out(codec, path, i, enable); activate_amp_out(codec, path, i, enable);
} }
if (enable)
path->active = true;
} }
EXPORT_SYMBOL_GPL(snd_hda_activate_path); EXPORT_SYMBOL_GPL(snd_hda_activate_path);
......
...@@ -200,12 +200,33 @@ static int cx_auto_init(struct hda_codec *codec) ...@@ -200,12 +200,33 @@ static int cx_auto_init(struct hda_codec *codec)
return 0; return 0;
} }
#define cx_auto_free snd_hda_gen_free static void cx_auto_reboot_notify(struct hda_codec *codec)
{
struct conexant_spec *spec = codec->spec;
if (codec->core.vendor_id != 0x14f150f2)
return;
/* Turn the CX20722 codec into D3 to avoid spurious noises
from the internal speaker during (and after) reboot */
cx_auto_turn_eapd(codec, spec->num_eapds, spec->eapds, false);
snd_hda_codec_set_power_to_all(codec, codec->core.afg, AC_PWRST_D3);
snd_hda_codec_write(codec, codec->core.afg, 0,
AC_VERB_SET_POWER_STATE, AC_PWRST_D3);
}
static void cx_auto_free(struct hda_codec *codec)
{
cx_auto_reboot_notify(codec);
snd_hda_gen_free(codec);
}
static const struct hda_codec_ops cx_auto_patch_ops = { static const struct hda_codec_ops cx_auto_patch_ops = {
.build_controls = cx_auto_build_controls, .build_controls = cx_auto_build_controls,
.build_pcms = snd_hda_gen_build_pcms, .build_pcms = snd_hda_gen_build_pcms,
.init = cx_auto_init, .init = cx_auto_init,
.reboot_notify = cx_auto_reboot_notify,
.free = cx_auto_free, .free = cx_auto_free,
.unsol_event = snd_hda_jack_unsol_event, .unsol_event = snd_hda_jack_unsol_event,
#ifdef CONFIG_PM #ifdef CONFIG_PM
......
...@@ -1268,6 +1268,7 @@ u64 snd_usb_interface_dsd_format_quirks(struct snd_usb_audio *chip, ...@@ -1268,6 +1268,7 @@ u64 snd_usb_interface_dsd_format_quirks(struct snd_usb_audio *chip,
return SNDRV_PCM_FMTBIT_DSD_U32_BE; return SNDRV_PCM_FMTBIT_DSD_U32_BE;
break; break;
case USB_ID(0x20b1, 0x000a): /* Gustard DAC-X20U */
case USB_ID(0x20b1, 0x2009): /* DIYINHK DSD DXD 384kHz USB to I2S/DSD */ case USB_ID(0x20b1, 0x2009): /* DIYINHK DSD DXD 384kHz USB to I2S/DSD */
case USB_ID(0x20b1, 0x2023): /* JLsounds I2SoverUSB */ case USB_ID(0x20b1, 0x2023): /* JLsounds I2SoverUSB */
if (fp->altsetting == 3) if (fp->altsetting == 3)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment