Commit 6f64e3a4 authored by Linus Torvalds's avatar Linus Torvalds

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

Pull sound fixes from Takashi Iwai:
 "A collection of a few small fixes.

  The most significant one is the fix for the possible race at loading
  HD-audio drivers. This has been present for long time and surfaced
  only in a rare occasion, but finally spotted out"

* tag 'sound-5.0-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound:
  ALSA: hda/ca0132 - Fix build error without CONFIG_PCI
  ALSA: compress: Fix stop handling on compressed capture streams
  ALSA: usb-audio: Add support for new T+A USB DAC
  ALSA: hda - Serialize codec registrations
  ALSA: hda/realtek - Use a common helper for hp pin reference
  ALSA: hda/realtek - Fix lose hp_pins for disable auto mute
  ALSA: hda/realtek - Headset microphone support for System76 darp5
parents b0314565 c97617a8
...@@ -173,7 +173,11 @@ static inline void snd_compr_drain_notify(struct snd_compr_stream *stream) ...@@ -173,7 +173,11 @@ static inline void snd_compr_drain_notify(struct snd_compr_stream *stream)
if (snd_BUG_ON(!stream)) if (snd_BUG_ON(!stream))
return; return;
if (stream->direction == SND_COMPRESS_PLAYBACK)
stream->runtime->state = SNDRV_PCM_STATE_SETUP; stream->runtime->state = SNDRV_PCM_STATE_SETUP;
else
stream->runtime->state = SNDRV_PCM_STATE_PREPARED;
wake_up(&stream->runtime->sleep); wake_up(&stream->runtime->sleep);
} }
......
...@@ -68,6 +68,7 @@ struct hda_bus { ...@@ -68,6 +68,7 @@ struct hda_bus {
unsigned int response_reset:1; /* controller was reset */ unsigned int response_reset:1; /* controller was reset */
unsigned int in_reset:1; /* during reset operation */ unsigned int in_reset:1; /* during reset operation */
unsigned int no_response_fallback:1; /* don't fallback at RIRB error */ unsigned int no_response_fallback:1; /* don't fallback at RIRB error */
unsigned int bus_probing :1; /* during probing process */
int primary_dig_out_type; /* primary digital out PCM type */ int primary_dig_out_type; /* primary digital out PCM type */
unsigned int mixer_assigned; /* codec addr for mixer name */ unsigned int mixer_assigned; /* codec addr for mixer name */
......
...@@ -115,7 +115,8 @@ static int hda_codec_driver_probe(struct device *dev) ...@@ -115,7 +115,8 @@ static int hda_codec_driver_probe(struct device *dev)
err = snd_hda_codec_build_controls(codec); err = snd_hda_codec_build_controls(codec);
if (err < 0) if (err < 0)
goto error_module; goto error_module;
if (codec->card->registered) { /* only register after the bus probe finished; otherwise it's racy */
if (!codec->bus->bus_probing && codec->card->registered) {
err = snd_card_register(codec->card); err = snd_card_register(codec->card);
if (err < 0) if (err < 0)
goto error_module; goto error_module;
......
...@@ -2185,6 +2185,7 @@ static int azx_probe_continue(struct azx *chip) ...@@ -2185,6 +2185,7 @@ static int azx_probe_continue(struct azx *chip)
int dev = chip->dev_index; int dev = chip->dev_index;
int err; int err;
to_hda_bus(bus)->bus_probing = 1;
hda->probe_continued = 1; hda->probe_continued = 1;
/* bind with i915 if needed */ /* bind with i915 if needed */
...@@ -2269,6 +2270,7 @@ static int azx_probe_continue(struct azx *chip) ...@@ -2269,6 +2270,7 @@ static int azx_probe_continue(struct azx *chip)
if (err < 0) if (err < 0)
hda->init_failed = 1; hda->init_failed = 1;
complete_all(&hda->probe_wait); complete_all(&hda->probe_wait);
to_hda_bus(bus)->bus_probing = 0;
return err; return err;
} }
......
...@@ -8451,8 +8451,10 @@ static void ca0132_free(struct hda_codec *codec) ...@@ -8451,8 +8451,10 @@ static void ca0132_free(struct hda_codec *codec)
ca0132_exit_chip(codec); ca0132_exit_chip(codec);
snd_hda_power_down(codec); snd_hda_power_down(codec);
if (IS_ENABLED(CONFIG_PCI) && spec->mem_base) #ifdef CONFIG_PCI
if (spec->mem_base)
pci_iounmap(codec->bus->pci, spec->mem_base); pci_iounmap(codec->bus->pci, spec->mem_base);
#endif
kfree(spec->spec_init_verbs); kfree(spec->spec_init_verbs);
kfree(codec->spec); kfree(codec->spec);
} }
......
...@@ -515,6 +515,15 @@ static void alc_auto_init_amp(struct hda_codec *codec, int type) ...@@ -515,6 +515,15 @@ static void alc_auto_init_amp(struct hda_codec *codec, int type)
} }
} }
/* get a primary headphone pin if available */
static hda_nid_t alc_get_hp_pin(struct alc_spec *spec)
{
if (spec->gen.autocfg.hp_pins[0])
return spec->gen.autocfg.hp_pins[0];
if (spec->gen.autocfg.line_out_type == AC_JACK_HP_OUT)
return spec->gen.autocfg.line_out_pins[0];
return 0;
}
/* /*
* Realtek SSID verification * Realtek SSID verification
...@@ -725,9 +734,7 @@ static int alc_subsystem_id(struct hda_codec *codec, const hda_nid_t *ports) ...@@ -725,9 +734,7 @@ static int alc_subsystem_id(struct hda_codec *codec, const hda_nid_t *ports)
* 15 : 1 --> enable the function "Mute internal speaker * 15 : 1 --> enable the function "Mute internal speaker
* when the external headphone out jack is plugged" * when the external headphone out jack is plugged"
*/ */
if (!spec->gen.autocfg.hp_pins[0] && if (!alc_get_hp_pin(spec)) {
!(spec->gen.autocfg.line_out_pins[0] &&
spec->gen.autocfg.line_out_type == AUTO_PIN_HP_OUT)) {
hda_nid_t nid; hda_nid_t nid;
tmp = (ass >> 11) & 0x3; /* HP to chassis */ tmp = (ass >> 11) & 0x3; /* HP to chassis */
nid = ports[tmp]; nid = ports[tmp];
...@@ -2959,7 +2966,7 @@ static void alc282_restore_default_value(struct hda_codec *codec) ...@@ -2959,7 +2966,7 @@ static void alc282_restore_default_value(struct hda_codec *codec)
static void alc282_init(struct hda_codec *codec) static void alc282_init(struct hda_codec *codec)
{ {
struct alc_spec *spec = codec->spec; struct alc_spec *spec = codec->spec;
hda_nid_t hp_pin = spec->gen.autocfg.hp_pins[0]; hda_nid_t hp_pin = alc_get_hp_pin(spec);
bool hp_pin_sense; bool hp_pin_sense;
int coef78; int coef78;
...@@ -2996,7 +3003,7 @@ static void alc282_init(struct hda_codec *codec) ...@@ -2996,7 +3003,7 @@ static void alc282_init(struct hda_codec *codec)
static void alc282_shutup(struct hda_codec *codec) static void alc282_shutup(struct hda_codec *codec)
{ {
struct alc_spec *spec = codec->spec; struct alc_spec *spec = codec->spec;
hda_nid_t hp_pin = spec->gen.autocfg.hp_pins[0]; hda_nid_t hp_pin = alc_get_hp_pin(spec);
bool hp_pin_sense; bool hp_pin_sense;
int coef78; int coef78;
...@@ -3074,14 +3081,9 @@ static void alc283_restore_default_value(struct hda_codec *codec) ...@@ -3074,14 +3081,9 @@ static void alc283_restore_default_value(struct hda_codec *codec)
static void alc283_init(struct hda_codec *codec) static void alc283_init(struct hda_codec *codec)
{ {
struct alc_spec *spec = codec->spec; struct alc_spec *spec = codec->spec;
hda_nid_t hp_pin = spec->gen.autocfg.hp_pins[0]; hda_nid_t hp_pin = alc_get_hp_pin(spec);
bool hp_pin_sense; bool hp_pin_sense;
if (!spec->gen.autocfg.hp_outs) {
if (spec->gen.autocfg.line_out_type == AC_JACK_HP_OUT)
hp_pin = spec->gen.autocfg.line_out_pins[0];
}
alc283_restore_default_value(codec); alc283_restore_default_value(codec);
if (!hp_pin) if (!hp_pin)
...@@ -3115,14 +3117,9 @@ static void alc283_init(struct hda_codec *codec) ...@@ -3115,14 +3117,9 @@ static void alc283_init(struct hda_codec *codec)
static void alc283_shutup(struct hda_codec *codec) static void alc283_shutup(struct hda_codec *codec)
{ {
struct alc_spec *spec = codec->spec; struct alc_spec *spec = codec->spec;
hda_nid_t hp_pin = spec->gen.autocfg.hp_pins[0]; hda_nid_t hp_pin = alc_get_hp_pin(spec);
bool hp_pin_sense; bool hp_pin_sense;
if (!spec->gen.autocfg.hp_outs) {
if (spec->gen.autocfg.line_out_type == AC_JACK_HP_OUT)
hp_pin = spec->gen.autocfg.line_out_pins[0];
}
if (!hp_pin) { if (!hp_pin) {
alc269_shutup(codec); alc269_shutup(codec);
return; return;
...@@ -3156,7 +3153,7 @@ static void alc283_shutup(struct hda_codec *codec) ...@@ -3156,7 +3153,7 @@ static void alc283_shutup(struct hda_codec *codec)
static void alc256_init(struct hda_codec *codec) static void alc256_init(struct hda_codec *codec)
{ {
struct alc_spec *spec = codec->spec; struct alc_spec *spec = codec->spec;
hda_nid_t hp_pin = spec->gen.autocfg.hp_pins[0]; hda_nid_t hp_pin = alc_get_hp_pin(spec);
bool hp_pin_sense; bool hp_pin_sense;
if (!hp_pin) if (!hp_pin)
...@@ -3192,7 +3189,7 @@ static void alc256_init(struct hda_codec *codec) ...@@ -3192,7 +3189,7 @@ static void alc256_init(struct hda_codec *codec)
static void alc256_shutup(struct hda_codec *codec) static void alc256_shutup(struct hda_codec *codec)
{ {
struct alc_spec *spec = codec->spec; struct alc_spec *spec = codec->spec;
hda_nid_t hp_pin = spec->gen.autocfg.hp_pins[0]; hda_nid_t hp_pin = alc_get_hp_pin(spec);
bool hp_pin_sense; bool hp_pin_sense;
if (!hp_pin) { if (!hp_pin) {
...@@ -3228,7 +3225,7 @@ static void alc256_shutup(struct hda_codec *codec) ...@@ -3228,7 +3225,7 @@ static void alc256_shutup(struct hda_codec *codec)
static void alc225_init(struct hda_codec *codec) static void alc225_init(struct hda_codec *codec)
{ {
struct alc_spec *spec = codec->spec; struct alc_spec *spec = codec->spec;
hda_nid_t hp_pin = spec->gen.autocfg.hp_pins[0]; hda_nid_t hp_pin = alc_get_hp_pin(spec);
bool hp1_pin_sense, hp2_pin_sense; bool hp1_pin_sense, hp2_pin_sense;
if (!hp_pin) if (!hp_pin)
...@@ -3271,7 +3268,7 @@ static void alc225_init(struct hda_codec *codec) ...@@ -3271,7 +3268,7 @@ static void alc225_init(struct hda_codec *codec)
static void alc225_shutup(struct hda_codec *codec) static void alc225_shutup(struct hda_codec *codec)
{ {
struct alc_spec *spec = codec->spec; struct alc_spec *spec = codec->spec;
hda_nid_t hp_pin = spec->gen.autocfg.hp_pins[0]; hda_nid_t hp_pin = alc_get_hp_pin(spec);
bool hp1_pin_sense, hp2_pin_sense; bool hp1_pin_sense, hp2_pin_sense;
if (!hp_pin) { if (!hp_pin) {
...@@ -3315,7 +3312,7 @@ static void alc225_shutup(struct hda_codec *codec) ...@@ -3315,7 +3312,7 @@ static void alc225_shutup(struct hda_codec *codec)
static void alc_default_init(struct hda_codec *codec) static void alc_default_init(struct hda_codec *codec)
{ {
struct alc_spec *spec = codec->spec; struct alc_spec *spec = codec->spec;
hda_nid_t hp_pin = spec->gen.autocfg.hp_pins[0]; hda_nid_t hp_pin = alc_get_hp_pin(spec);
bool hp_pin_sense; bool hp_pin_sense;
if (!hp_pin) if (!hp_pin)
...@@ -3344,7 +3341,7 @@ static void alc_default_init(struct hda_codec *codec) ...@@ -3344,7 +3341,7 @@ static void alc_default_init(struct hda_codec *codec)
static void alc_default_shutup(struct hda_codec *codec) static void alc_default_shutup(struct hda_codec *codec)
{ {
struct alc_spec *spec = codec->spec; struct alc_spec *spec = codec->spec;
hda_nid_t hp_pin = spec->gen.autocfg.hp_pins[0]; hda_nid_t hp_pin = alc_get_hp_pin(spec);
bool hp_pin_sense; bool hp_pin_sense;
if (!hp_pin) { if (!hp_pin) {
...@@ -3376,7 +3373,7 @@ static void alc_default_shutup(struct hda_codec *codec) ...@@ -3376,7 +3373,7 @@ static void alc_default_shutup(struct hda_codec *codec)
static void alc294_hp_init(struct hda_codec *codec) static void alc294_hp_init(struct hda_codec *codec)
{ {
struct alc_spec *spec = codec->spec; struct alc_spec *spec = codec->spec;
hda_nid_t hp_pin = spec->gen.autocfg.hp_pins[0]; hda_nid_t hp_pin = alc_get_hp_pin(spec);
int i, val; int i, val;
if (!hp_pin) if (!hp_pin)
...@@ -4780,7 +4777,7 @@ static void alc_update_headset_mode(struct hda_codec *codec) ...@@ -4780,7 +4777,7 @@ static void alc_update_headset_mode(struct hda_codec *codec)
struct alc_spec *spec = codec->spec; struct alc_spec *spec = codec->spec;
hda_nid_t mux_pin = spec->gen.imux_pins[spec->gen.cur_mux[0]]; hda_nid_t mux_pin = spec->gen.imux_pins[spec->gen.cur_mux[0]];
hda_nid_t hp_pin = spec->gen.autocfg.hp_pins[0]; hda_nid_t hp_pin = alc_get_hp_pin(spec);
int new_headset_mode; int new_headset_mode;
...@@ -5059,7 +5056,7 @@ static void alc_fixup_tpt470_dock(struct hda_codec *codec, ...@@ -5059,7 +5056,7 @@ static void alc_fixup_tpt470_dock(struct hda_codec *codec,
static void alc_shutup_dell_xps13(struct hda_codec *codec) static void alc_shutup_dell_xps13(struct hda_codec *codec)
{ {
struct alc_spec *spec = codec->spec; struct alc_spec *spec = codec->spec;
int hp_pin = spec->gen.autocfg.hp_pins[0]; int hp_pin = alc_get_hp_pin(spec);
/* Prevent pop noises when headphones are plugged in */ /* Prevent pop noises when headphones are plugged in */
snd_hda_codec_write(codec, hp_pin, 0, snd_hda_codec_write(codec, hp_pin, 0,
...@@ -5152,7 +5149,7 @@ static void alc271_hp_gate_mic_jack(struct hda_codec *codec, ...@@ -5152,7 +5149,7 @@ static void alc271_hp_gate_mic_jack(struct hda_codec *codec,
if (action == HDA_FIXUP_ACT_PROBE) { if (action == HDA_FIXUP_ACT_PROBE) {
int mic_pin = find_ext_mic_pin(codec); int mic_pin = find_ext_mic_pin(codec);
int hp_pin = spec->gen.autocfg.hp_pins[0]; int hp_pin = alc_get_hp_pin(spec);
if (snd_BUG_ON(!mic_pin || !hp_pin)) if (snd_BUG_ON(!mic_pin || !hp_pin))
return; return;
...@@ -5634,6 +5631,7 @@ enum { ...@@ -5634,6 +5631,7 @@ enum {
ALC294_FIXUP_ASUS_HEADSET_MIC, ALC294_FIXUP_ASUS_HEADSET_MIC,
ALC294_FIXUP_ASUS_SPK, ALC294_FIXUP_ASUS_SPK,
ALC225_FIXUP_HEADSET_JACK, ALC225_FIXUP_HEADSET_JACK,
ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE,
}; };
static const struct hda_fixup alc269_fixups[] = { static const struct hda_fixup alc269_fixups[] = {
...@@ -6580,6 +6578,15 @@ static const struct hda_fixup alc269_fixups[] = { ...@@ -6580,6 +6578,15 @@ static const struct hda_fixup alc269_fixups[] = {
.type = HDA_FIXUP_FUNC, .type = HDA_FIXUP_FUNC,
.v.func = alc_fixup_headset_jack, .v.func = alc_fixup_headset_jack,
}, },
[ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE] = {
.type = HDA_FIXUP_PINS,
.v.pins = (const struct hda_pintbl[]) {
{ 0x1a, 0x01a1913c }, /* use as headset mic, without its own jack detect */
{ }
},
.chained = true,
.chain_id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC
},
}; };
static const struct snd_pci_quirk alc269_fixup_tbl[] = { static const struct snd_pci_quirk alc269_fixup_tbl[] = {
...@@ -6758,6 +6765,7 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = { ...@@ -6758,6 +6765,7 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = {
SND_PCI_QUIRK(0x1458, 0xfa53, "Gigabyte BXBT-2807", ALC283_FIXUP_HEADSET_MIC), SND_PCI_QUIRK(0x1458, 0xfa53, "Gigabyte BXBT-2807", ALC283_FIXUP_HEADSET_MIC),
SND_PCI_QUIRK(0x1462, 0xb120, "MSI Cubi MS-B120", ALC283_FIXUP_HEADSET_MIC), SND_PCI_QUIRK(0x1462, 0xb120, "MSI Cubi MS-B120", ALC283_FIXUP_HEADSET_MIC),
SND_PCI_QUIRK(0x1462, 0xb171, "Cubi N 8GL (MS-B171)", ALC283_FIXUP_HEADSET_MIC), SND_PCI_QUIRK(0x1462, 0xb171, "Cubi N 8GL (MS-B171)", ALC283_FIXUP_HEADSET_MIC),
SND_PCI_QUIRK(0x1558, 0x1325, "System76 Darter Pro (darp5)", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
SND_PCI_QUIRK(0x17aa, 0x1036, "Lenovo P520", ALC233_FIXUP_LENOVO_MULTI_CODECS), SND_PCI_QUIRK(0x17aa, 0x1036, "Lenovo P520", ALC233_FIXUP_LENOVO_MULTI_CODECS),
SND_PCI_QUIRK(0x17aa, 0x20f2, "Thinkpad SL410/510", ALC269_FIXUP_SKU_IGNORE), SND_PCI_QUIRK(0x17aa, 0x20f2, "Thinkpad SL410/510", ALC269_FIXUP_SKU_IGNORE),
SND_PCI_QUIRK(0x17aa, 0x215e, "Thinkpad L512", ALC269_FIXUP_SKU_IGNORE), SND_PCI_QUIRK(0x17aa, 0x215e, "Thinkpad L512", ALC269_FIXUP_SKU_IGNORE),
......
...@@ -1567,6 +1567,7 @@ u64 snd_usb_interface_dsd_format_quirks(struct snd_usb_audio *chip, ...@@ -1567,6 +1567,7 @@ u64 snd_usb_interface_dsd_format_quirks(struct snd_usb_audio *chip,
case 0x20b1: /* XMOS based devices */ case 0x20b1: /* XMOS based devices */
case 0x152a: /* Thesycon devices */ case 0x152a: /* Thesycon devices */
case 0x25ce: /* Mytek devices */ case 0x25ce: /* Mytek devices */
case 0x2ab6: /* T+A devices */
if (fp->dsd_raw) if (fp->dsd_raw)
return SNDRV_PCM_FMTBIT_DSD_U32_BE; return SNDRV_PCM_FMTBIT_DSD_U32_BE;
break; break;
......
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