1
0
Fork 0

sound fixes for 5.0-rc5

Only three fixes: a fix for Realtek HD-audio looks lengthy, but it's
 just a code shuffling, and the actual changes are fairly small.  The
 rest are a PCM core fix for a long-standing bug that was recently
 scratched by syzkaller, and a trivial USB-audio quirk for DSD
 support.
 -----BEGIN PGP SIGNATURE-----
 
 iQJCBAABCAAsFiEEIXTw5fNLNI7mMiVaLtJE4w1nLE8FAlxS3GQOHHRpd2FpQHN1
 c2UuZGUACgkQLtJE4w1nLE9t6w//e5Gjbp+3kU3XtJYpW9VwPCSnst7Wsy7BXrRj
 N7B+lG1Iaq6BESKjHYm64GF+WNfDYEeN0Xf6qlxIQaiDZclNTxAF6TPcVoRFLQA1
 sC3GED6uzvw066Wf9EpXzqqnzTc2tX/G2fO2+7ppXL4W+xQ5PxtMvB/XrlVjwONM
 rUpdEC3NQAePO6eNJruTqc/BS6Gqs+WpWllAISU2mnIbbG3pMCbCZgyUMqsEWYwp
 QpghV0A0fwBxY6GaSA0cSevIJt811VzCEsPk/AlA9W9F2+Z8kPWg+ovhOi53ClUv
 JxYwzCpg65tE0+G56rrCB0njxK3eLl9HRbg7fqyzeSjDHestvzNHjGWgUynjHCD+
 UBdDIKJayLGsZ5D/EtWPpFSbpMlqrZqXO8Nwkn1TP0k5+4btDoSA8Xor7yD6MRpd
 b4KR+zzxUxXqsNlrB8+yHqt/sQ0Ld3igrbGfXY8Q7+StxYq68o4/F9kPX8hjqhNc
 49lkyOc/969E9MqNo/zj6aCbGz8VBHkw+7jYsxwMBZMgpZvSQ8IQ8LEE7t2etTEQ
 j87qb9A0yNgEiRV/U+YT0Y9gwgIPWFHrq9u8ISslEPcyRj0AA9dzI+SAlhzZWqb8
 BcJypAT24GPzFGigsHbG7m69cJ7Je49YfdYjnu9Heg9whOSNFIWPW7WqLBJbgkXG
 DmxmlRE=
 =KZ/d
 -----END PGP SIGNATURE-----

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

Pull sound fixes from Takashi Iwai:
 "Only three fixes.

  The fix for Realtek HD-audio looks lengthy, but it's just a code
  shuffling, and the actual changes are fairly small.

  The rest are a PCM core fix for a long-standing bug that was recently
  scratched by syzkaller, and a trivial USB-audio quirk for DSD support"

* tag 'sound-5.0-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound:
  ALSA: hda/realtek - Fixed hp_pin no value
  ALSA: pcm: Fix tight loop of OSS capture stream
  ALSA: usb-audio: Add Opus #3 to quirks for native DSD support
hifive-unleashed-5.1
Linus Torvalds 2019-01-31 10:00:00 -08:00
commit 83f4997a01
3 changed files with 54 additions and 34 deletions

View File

@ -2112,6 +2112,13 @@ int pcm_lib_apply_appl_ptr(struct snd_pcm_substream *substream,
return 0;
}
/* allow waiting for a capture stream that hasn't been started */
#if IS_ENABLED(CONFIG_SND_PCM_OSS)
#define wait_capture_start(substream) ((substream)->oss.oss)
#else
#define wait_capture_start(substream) false
#endif
/* the common loop for read/write data */
snd_pcm_sframes_t __snd_pcm_lib_xfer(struct snd_pcm_substream *substream,
void *data, bool interleaved,
@ -2182,7 +2189,7 @@ snd_pcm_sframes_t __snd_pcm_lib_xfer(struct snd_pcm_substream *substream,
err = snd_pcm_start(substream);
if (err < 0)
goto _end_unlock;
} else {
} else if (!wait_capture_start(substream)) {
/* nothing to do */
err = 0;
goto _end_unlock;

View File

@ -117,6 +117,7 @@ struct alc_spec {
int codec_variant; /* flag for other variants */
unsigned int has_alc5505_dsp:1;
unsigned int no_depop_delay:1;
unsigned int done_hp_init:1;
/* for PLL fix */
hda_nid_t pll_nid;
@ -3372,6 +3373,48 @@ static void alc_default_shutup(struct hda_codec *codec)
snd_hda_shutup_pins(codec);
}
static void alc294_hp_init(struct hda_codec *codec)
{
struct alc_spec *spec = codec->spec;
hda_nid_t hp_pin = spec->gen.autocfg.hp_pins[0];
int i, val;
if (!hp_pin)
return;
snd_hda_codec_write(codec, hp_pin, 0,
AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
msleep(100);
snd_hda_codec_write(codec, hp_pin, 0,
AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
alc_update_coef_idx(codec, 0x6f, 0x000f, 0);/* Set HP depop to manual mode */
alc_update_coefex_idx(codec, 0x58, 0x00, 0x8000, 0x8000); /* HP depop procedure start */
/* Wait for depop procedure finish */
val = alc_read_coefex_idx(codec, 0x58, 0x01);
for (i = 0; i < 20 && val & 0x0080; i++) {
msleep(50);
val = alc_read_coefex_idx(codec, 0x58, 0x01);
}
/* Set HP depop to auto mode */
alc_update_coef_idx(codec, 0x6f, 0x000f, 0x000b);
msleep(50);
}
static void alc294_init(struct hda_codec *codec)
{
struct alc_spec *spec = codec->spec;
if (!spec->done_hp_init) {
alc294_hp_init(codec);
spec->done_hp_init = true;
}
alc_default_init(codec);
}
static void alc5505_coef_set(struct hda_codec *codec, unsigned int index_reg,
unsigned int val)
{
@ -7373,37 +7416,6 @@ static void alc269_fill_coef(struct hda_codec *codec)
alc_update_coef_idx(codec, 0x4, 0, 1<<11);
}
static void alc294_hp_init(struct hda_codec *codec)
{
struct alc_spec *spec = codec->spec;
hda_nid_t hp_pin = spec->gen.autocfg.hp_pins[0];
int i, val;
if (!hp_pin)
return;
snd_hda_codec_write(codec, hp_pin, 0,
AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
msleep(100);
snd_hda_codec_write(codec, hp_pin, 0,
AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
alc_update_coef_idx(codec, 0x6f, 0x000f, 0);/* Set HP depop to manual mode */
alc_update_coefex_idx(codec, 0x58, 0x00, 0x8000, 0x8000); /* HP depop procedure start */
/* Wait for depop procedure finish */
val = alc_read_coefex_idx(codec, 0x58, 0x01);
for (i = 0; i < 20 && val & 0x0080; i++) {
msleep(50);
val = alc_read_coefex_idx(codec, 0x58, 0x01);
}
/* Set HP depop to auto mode */
alc_update_coef_idx(codec, 0x6f, 0x000f, 0x000b);
msleep(50);
}
/*
*/
static int patch_alc269(struct hda_codec *codec)
@ -7529,7 +7541,7 @@ static int patch_alc269(struct hda_codec *codec)
spec->codec_variant = ALC269_TYPE_ALC294;
spec->gen.mixer_nid = 0; /* ALC2x4 does not have any loopback mixer path */
alc_update_coef_idx(codec, 0x6b, 0x0018, (1<<4) | (1<<3)); /* UAJ MIC Vref control by verb */
alc294_hp_init(codec);
spec->init_hook = alc294_init;
break;
case 0x10ec0300:
spec->codec_variant = ALC269_TYPE_ALC300;
@ -7541,7 +7553,7 @@ static int patch_alc269(struct hda_codec *codec)
spec->codec_variant = ALC269_TYPE_ALC700;
spec->gen.mixer_nid = 0; /* ALC700 does not have any loopback mixer path */
alc_update_coef_idx(codec, 0x4a, 1 << 15, 0); /* Combo jack auto trigger control */
alc294_hp_init(codec);
spec->init_hook = alc294_init;
break;
}

View File

@ -1492,6 +1492,7 @@ u64 snd_usb_interface_dsd_format_quirks(struct snd_usb_audio *chip,
return SNDRV_PCM_FMTBIT_DSD_U32_BE;
break;
case USB_ID(0x10cb, 0x0103): /* The Bit Opus #3; with fp->dsd_raw */
case USB_ID(0x152a, 0x85de): /* SMSL D1 DAC */
case USB_ID(0x16d0, 0x09dd): /* Encore mDSD */
case USB_ID(0x0d8c, 0x0316): /* Hegel HD12 DSD */