Skip to content

Commit 83f4997

Browse files
committed
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
2 parents af0c9af + 693abe1 commit 83f4997

File tree

3 files changed

+54
-34
lines changed

3 files changed

+54
-34
lines changed

sound/core/pcm_lib.c

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2112,6 +2112,13 @@ int pcm_lib_apply_appl_ptr(struct snd_pcm_substream *substream,
21122112
return 0;
21132113
}
21142114

2115+
/* allow waiting for a capture stream that hasn't been started */
2116+
#if IS_ENABLED(CONFIG_SND_PCM_OSS)
2117+
#define wait_capture_start(substream) ((substream)->oss.oss)
2118+
#else
2119+
#define wait_capture_start(substream) false
2120+
#endif
2121+
21152122
/* the common loop for read/write data */
21162123
snd_pcm_sframes_t __snd_pcm_lib_xfer(struct snd_pcm_substream *substream,
21172124
void *data, bool interleaved,
@@ -2182,7 +2189,7 @@ snd_pcm_sframes_t __snd_pcm_lib_xfer(struct snd_pcm_substream *substream,
21822189
err = snd_pcm_start(substream);
21832190
if (err < 0)
21842191
goto _end_unlock;
2185-
} else {
2192+
} else if (!wait_capture_start(substream)) {
21862193
/* nothing to do */
21872194
err = 0;
21882195
goto _end_unlock;

sound/pci/hda/patch_realtek.c

Lines changed: 45 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,7 @@ struct alc_spec {
117117
int codec_variant; /* flag for other variants */
118118
unsigned int has_alc5505_dsp:1;
119119
unsigned int no_depop_delay:1;
120+
unsigned int done_hp_init:1;
120121

121122
/* for PLL fix */
122123
hda_nid_t pll_nid;
@@ -3372,6 +3373,48 @@ static void alc_default_shutup(struct hda_codec *codec)
33723373
snd_hda_shutup_pins(codec);
33733374
}
33743375

3376+
static void alc294_hp_init(struct hda_codec *codec)
3377+
{
3378+
struct alc_spec *spec = codec->spec;
3379+
hda_nid_t hp_pin = spec->gen.autocfg.hp_pins[0];
3380+
int i, val;
3381+
3382+
if (!hp_pin)
3383+
return;
3384+
3385+
snd_hda_codec_write(codec, hp_pin, 0,
3386+
AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3387+
3388+
msleep(100);
3389+
3390+
snd_hda_codec_write(codec, hp_pin, 0,
3391+
AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
3392+
3393+
alc_update_coef_idx(codec, 0x6f, 0x000f, 0);/* Set HP depop to manual mode */
3394+
alc_update_coefex_idx(codec, 0x58, 0x00, 0x8000, 0x8000); /* HP depop procedure start */
3395+
3396+
/* Wait for depop procedure finish */
3397+
val = alc_read_coefex_idx(codec, 0x58, 0x01);
3398+
for (i = 0; i < 20 && val & 0x0080; i++) {
3399+
msleep(50);
3400+
val = alc_read_coefex_idx(codec, 0x58, 0x01);
3401+
}
3402+
/* Set HP depop to auto mode */
3403+
alc_update_coef_idx(codec, 0x6f, 0x000f, 0x000b);
3404+
msleep(50);
3405+
}
3406+
3407+
static void alc294_init(struct hda_codec *codec)
3408+
{
3409+
struct alc_spec *spec = codec->spec;
3410+
3411+
if (!spec->done_hp_init) {
3412+
alc294_hp_init(codec);
3413+
spec->done_hp_init = true;
3414+
}
3415+
alc_default_init(codec);
3416+
}
3417+
33753418
static void alc5505_coef_set(struct hda_codec *codec, unsigned int index_reg,
33763419
unsigned int val)
33773420
{
@@ -7373,37 +7416,6 @@ static void alc269_fill_coef(struct hda_codec *codec)
73737416
alc_update_coef_idx(codec, 0x4, 0, 1<<11);
73747417
}
73757418

7376-
static void alc294_hp_init(struct hda_codec *codec)
7377-
{
7378-
struct alc_spec *spec = codec->spec;
7379-
hda_nid_t hp_pin = spec->gen.autocfg.hp_pins[0];
7380-
int i, val;
7381-
7382-
if (!hp_pin)
7383-
return;
7384-
7385-
snd_hda_codec_write(codec, hp_pin, 0,
7386-
AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
7387-
7388-
msleep(100);
7389-
7390-
snd_hda_codec_write(codec, hp_pin, 0,
7391-
AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
7392-
7393-
alc_update_coef_idx(codec, 0x6f, 0x000f, 0);/* Set HP depop to manual mode */
7394-
alc_update_coefex_idx(codec, 0x58, 0x00, 0x8000, 0x8000); /* HP depop procedure start */
7395-
7396-
/* Wait for depop procedure finish */
7397-
val = alc_read_coefex_idx(codec, 0x58, 0x01);
7398-
for (i = 0; i < 20 && val & 0x0080; i++) {
7399-
msleep(50);
7400-
val = alc_read_coefex_idx(codec, 0x58, 0x01);
7401-
}
7402-
/* Set HP depop to auto mode */
7403-
alc_update_coef_idx(codec, 0x6f, 0x000f, 0x000b);
7404-
msleep(50);
7405-
}
7406-
74077419
/*
74087420
*/
74097421
static int patch_alc269(struct hda_codec *codec)
@@ -7529,7 +7541,7 @@ static int patch_alc269(struct hda_codec *codec)
75297541
spec->codec_variant = ALC269_TYPE_ALC294;
75307542
spec->gen.mixer_nid = 0; /* ALC2x4 does not have any loopback mixer path */
75317543
alc_update_coef_idx(codec, 0x6b, 0x0018, (1<<4) | (1<<3)); /* UAJ MIC Vref control by verb */
7532-
alc294_hp_init(codec);
7544+
spec->init_hook = alc294_init;
75337545
break;
75347546
case 0x10ec0300:
75357547
spec->codec_variant = ALC269_TYPE_ALC300;
@@ -7541,7 +7553,7 @@ static int patch_alc269(struct hda_codec *codec)
75417553
spec->codec_variant = ALC269_TYPE_ALC700;
75427554
spec->gen.mixer_nid = 0; /* ALC700 does not have any loopback mixer path */
75437555
alc_update_coef_idx(codec, 0x4a, 1 << 15, 0); /* Combo jack auto trigger control */
7544-
alc294_hp_init(codec);
7556+
spec->init_hook = alc294_init;
75457557
break;
75467558

75477559
}

sound/usb/quirks.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1492,6 +1492,7 @@ u64 snd_usb_interface_dsd_format_quirks(struct snd_usb_audio *chip,
14921492
return SNDRV_PCM_FMTBIT_DSD_U32_BE;
14931493
break;
14941494

1495+
case USB_ID(0x10cb, 0x0103): /* The Bit Opus #3; with fp->dsd_raw */
14951496
case USB_ID(0x152a, 0x85de): /* SMSL D1 DAC */
14961497
case USB_ID(0x16d0, 0x09dd): /* Encore mDSD */
14971498
case USB_ID(0x0d8c, 0x0316): /* Hegel HD12 DSD */

0 commit comments

Comments
 (0)