Skip to content

Commit 6f64e3a

Browse files
committed
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
2 parents b031456 + c97617a commit 6f64e3a

File tree

7 files changed

+49
-30
lines changed

7 files changed

+49
-30
lines changed

include/sound/compress_driver.h

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,11 @@ static inline void snd_compr_drain_notify(struct snd_compr_stream *stream)
173173
if (snd_BUG_ON(!stream))
174174
return;
175175

176-
stream->runtime->state = SNDRV_PCM_STATE_SETUP;
176+
if (stream->direction == SND_COMPRESS_PLAYBACK)
177+
stream->runtime->state = SNDRV_PCM_STATE_SETUP;
178+
else
179+
stream->runtime->state = SNDRV_PCM_STATE_PREPARED;
180+
177181
wake_up(&stream->runtime->sleep);
178182
}
179183

include/sound/hda_codec.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ struct hda_bus {
6868
unsigned int response_reset:1; /* controller was reset */
6969
unsigned int in_reset:1; /* during reset operation */
7070
unsigned int no_response_fallback:1; /* don't fallback at RIRB error */
71+
unsigned int bus_probing :1; /* during probing process */
7172

7273
int primary_dig_out_type; /* primary digital out PCM type */
7374
unsigned int mixer_assigned; /* codec addr for mixer name */

sound/pci/hda/hda_bind.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,8 @@ static int hda_codec_driver_probe(struct device *dev)
115115
err = snd_hda_codec_build_controls(codec);
116116
if (err < 0)
117117
goto error_module;
118-
if (codec->card->registered) {
118+
/* only register after the bus probe finished; otherwise it's racy */
119+
if (!codec->bus->bus_probing && codec->card->registered) {
119120
err = snd_card_register(codec->card);
120121
if (err < 0)
121122
goto error_module;

sound/pci/hda/hda_intel.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2185,6 +2185,7 @@ static int azx_probe_continue(struct azx *chip)
21852185
int dev = chip->dev_index;
21862186
int err;
21872187

2188+
to_hda_bus(bus)->bus_probing = 1;
21882189
hda->probe_continued = 1;
21892190

21902191
/* bind with i915 if needed */
@@ -2269,6 +2270,7 @@ static int azx_probe_continue(struct azx *chip)
22692270
if (err < 0)
22702271
hda->init_failed = 1;
22712272
complete_all(&hda->probe_wait);
2273+
to_hda_bus(bus)->bus_probing = 0;
22722274
return err;
22732275
}
22742276

sound/pci/hda/patch_ca0132.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8451,8 +8451,10 @@ static void ca0132_free(struct hda_codec *codec)
84518451
ca0132_exit_chip(codec);
84528452

84538453
snd_hda_power_down(codec);
8454-
if (IS_ENABLED(CONFIG_PCI) && spec->mem_base)
8454+
#ifdef CONFIG_PCI
8455+
if (spec->mem_base)
84558456
pci_iounmap(codec->bus->pci, spec->mem_base);
8457+
#endif
84568458
kfree(spec->spec_init_verbs);
84578459
kfree(codec->spec);
84588460
}

sound/pci/hda/patch_realtek.c

Lines changed: 35 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -515,6 +515,15 @@ static void alc_auto_init_amp(struct hda_codec *codec, int type)
515515
}
516516
}
517517

518+
/* get a primary headphone pin if available */
519+
static hda_nid_t alc_get_hp_pin(struct alc_spec *spec)
520+
{
521+
if (spec->gen.autocfg.hp_pins[0])
522+
return spec->gen.autocfg.hp_pins[0];
523+
if (spec->gen.autocfg.line_out_type == AC_JACK_HP_OUT)
524+
return spec->gen.autocfg.line_out_pins[0];
525+
return 0;
526+
}
518527

519528
/*
520529
* Realtek SSID verification
@@ -725,9 +734,7 @@ static int alc_subsystem_id(struct hda_codec *codec, const hda_nid_t *ports)
725734
* 15 : 1 --> enable the function "Mute internal speaker
726735
* when the external headphone out jack is plugged"
727736
*/
728-
if (!spec->gen.autocfg.hp_pins[0] &&
729-
!(spec->gen.autocfg.line_out_pins[0] &&
730-
spec->gen.autocfg.line_out_type == AUTO_PIN_HP_OUT)) {
737+
if (!alc_get_hp_pin(spec)) {
731738
hda_nid_t nid;
732739
tmp = (ass >> 11) & 0x3; /* HP to chassis */
733740
nid = ports[tmp];
@@ -2959,7 +2966,7 @@ static void alc282_restore_default_value(struct hda_codec *codec)
29592966
static void alc282_init(struct hda_codec *codec)
29602967
{
29612968
struct alc_spec *spec = codec->spec;
2962-
hda_nid_t hp_pin = spec->gen.autocfg.hp_pins[0];
2969+
hda_nid_t hp_pin = alc_get_hp_pin(spec);
29632970
bool hp_pin_sense;
29642971
int coef78;
29652972

@@ -2996,7 +3003,7 @@ static void alc282_init(struct hda_codec *codec)
29963003
static void alc282_shutup(struct hda_codec *codec)
29973004
{
29983005
struct alc_spec *spec = codec->spec;
2999-
hda_nid_t hp_pin = spec->gen.autocfg.hp_pins[0];
3006+
hda_nid_t hp_pin = alc_get_hp_pin(spec);
30003007
bool hp_pin_sense;
30013008
int coef78;
30023009

@@ -3074,14 +3081,9 @@ static void alc283_restore_default_value(struct hda_codec *codec)
30743081
static void alc283_init(struct hda_codec *codec)
30753082
{
30763083
struct alc_spec *spec = codec->spec;
3077-
hda_nid_t hp_pin = spec->gen.autocfg.hp_pins[0];
3084+
hda_nid_t hp_pin = alc_get_hp_pin(spec);
30783085
bool hp_pin_sense;
30793086

3080-
if (!spec->gen.autocfg.hp_outs) {
3081-
if (spec->gen.autocfg.line_out_type == AC_JACK_HP_OUT)
3082-
hp_pin = spec->gen.autocfg.line_out_pins[0];
3083-
}
3084-
30853087
alc283_restore_default_value(codec);
30863088

30873089
if (!hp_pin)
@@ -3115,14 +3117,9 @@ static void alc283_init(struct hda_codec *codec)
31153117
static void alc283_shutup(struct hda_codec *codec)
31163118
{
31173119
struct alc_spec *spec = codec->spec;
3118-
hda_nid_t hp_pin = spec->gen.autocfg.hp_pins[0];
3120+
hda_nid_t hp_pin = alc_get_hp_pin(spec);
31193121
bool hp_pin_sense;
31203122

3121-
if (!spec->gen.autocfg.hp_outs) {
3122-
if (spec->gen.autocfg.line_out_type == AC_JACK_HP_OUT)
3123-
hp_pin = spec->gen.autocfg.line_out_pins[0];
3124-
}
3125-
31263123
if (!hp_pin) {
31273124
alc269_shutup(codec);
31283125
return;
@@ -3156,7 +3153,7 @@ static void alc283_shutup(struct hda_codec *codec)
31563153
static void alc256_init(struct hda_codec *codec)
31573154
{
31583155
struct alc_spec *spec = codec->spec;
3159-
hda_nid_t hp_pin = spec->gen.autocfg.hp_pins[0];
3156+
hda_nid_t hp_pin = alc_get_hp_pin(spec);
31603157
bool hp_pin_sense;
31613158

31623159
if (!hp_pin)
@@ -3192,7 +3189,7 @@ static void alc256_init(struct hda_codec *codec)
31923189
static void alc256_shutup(struct hda_codec *codec)
31933190
{
31943191
struct alc_spec *spec = codec->spec;
3195-
hda_nid_t hp_pin = spec->gen.autocfg.hp_pins[0];
3192+
hda_nid_t hp_pin = alc_get_hp_pin(spec);
31963193
bool hp_pin_sense;
31973194

31983195
if (!hp_pin) {
@@ -3228,7 +3225,7 @@ static void alc256_shutup(struct hda_codec *codec)
32283225
static void alc225_init(struct hda_codec *codec)
32293226
{
32303227
struct alc_spec *spec = codec->spec;
3231-
hda_nid_t hp_pin = spec->gen.autocfg.hp_pins[0];
3228+
hda_nid_t hp_pin = alc_get_hp_pin(spec);
32323229
bool hp1_pin_sense, hp2_pin_sense;
32333230

32343231
if (!hp_pin)
@@ -3271,7 +3268,7 @@ static void alc225_init(struct hda_codec *codec)
32713268
static void alc225_shutup(struct hda_codec *codec)
32723269
{
32733270
struct alc_spec *spec = codec->spec;
3274-
hda_nid_t hp_pin = spec->gen.autocfg.hp_pins[0];
3271+
hda_nid_t hp_pin = alc_get_hp_pin(spec);
32753272
bool hp1_pin_sense, hp2_pin_sense;
32763273

32773274
if (!hp_pin) {
@@ -3315,7 +3312,7 @@ static void alc225_shutup(struct hda_codec *codec)
33153312
static void alc_default_init(struct hda_codec *codec)
33163313
{
33173314
struct alc_spec *spec = codec->spec;
3318-
hda_nid_t hp_pin = spec->gen.autocfg.hp_pins[0];
3315+
hda_nid_t hp_pin = alc_get_hp_pin(spec);
33193316
bool hp_pin_sense;
33203317

33213318
if (!hp_pin)
@@ -3344,7 +3341,7 @@ static void alc_default_init(struct hda_codec *codec)
33443341
static void alc_default_shutup(struct hda_codec *codec)
33453342
{
33463343
struct alc_spec *spec = codec->spec;
3347-
hda_nid_t hp_pin = spec->gen.autocfg.hp_pins[0];
3344+
hda_nid_t hp_pin = alc_get_hp_pin(spec);
33483345
bool hp_pin_sense;
33493346

33503347
if (!hp_pin) {
@@ -3376,7 +3373,7 @@ static void alc_default_shutup(struct hda_codec *codec)
33763373
static void alc294_hp_init(struct hda_codec *codec)
33773374
{
33783375
struct alc_spec *spec = codec->spec;
3379-
hda_nid_t hp_pin = spec->gen.autocfg.hp_pins[0];
3376+
hda_nid_t hp_pin = alc_get_hp_pin(spec);
33803377
int i, val;
33813378

33823379
if (!hp_pin)
@@ -4780,7 +4777,7 @@ static void alc_update_headset_mode(struct hda_codec *codec)
47804777
struct alc_spec *spec = codec->spec;
47814778

47824779
hda_nid_t mux_pin = spec->gen.imux_pins[spec->gen.cur_mux[0]];
4783-
hda_nid_t hp_pin = spec->gen.autocfg.hp_pins[0];
4780+
hda_nid_t hp_pin = alc_get_hp_pin(spec);
47844781

47854782
int new_headset_mode;
47864783

@@ -5059,7 +5056,7 @@ static void alc_fixup_tpt470_dock(struct hda_codec *codec,
50595056
static void alc_shutup_dell_xps13(struct hda_codec *codec)
50605057
{
50615058
struct alc_spec *spec = codec->spec;
5062-
int hp_pin = spec->gen.autocfg.hp_pins[0];
5059+
int hp_pin = alc_get_hp_pin(spec);
50635060

50645061
/* Prevent pop noises when headphones are plugged in */
50655062
snd_hda_codec_write(codec, hp_pin, 0,
@@ -5152,7 +5149,7 @@ static void alc271_hp_gate_mic_jack(struct hda_codec *codec,
51525149

51535150
if (action == HDA_FIXUP_ACT_PROBE) {
51545151
int mic_pin = find_ext_mic_pin(codec);
5155-
int hp_pin = spec->gen.autocfg.hp_pins[0];
5152+
int hp_pin = alc_get_hp_pin(spec);
51565153

51575154
if (snd_BUG_ON(!mic_pin || !hp_pin))
51585155
return;
@@ -5634,6 +5631,7 @@ enum {
56345631
ALC294_FIXUP_ASUS_HEADSET_MIC,
56355632
ALC294_FIXUP_ASUS_SPK,
56365633
ALC225_FIXUP_HEADSET_JACK,
5634+
ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE,
56375635
};
56385636

56395637
static const struct hda_fixup alc269_fixups[] = {
@@ -6580,6 +6578,15 @@ static const struct hda_fixup alc269_fixups[] = {
65806578
.type = HDA_FIXUP_FUNC,
65816579
.v.func = alc_fixup_headset_jack,
65826580
},
6581+
[ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE] = {
6582+
.type = HDA_FIXUP_PINS,
6583+
.v.pins = (const struct hda_pintbl[]) {
6584+
{ 0x1a, 0x01a1913c }, /* use as headset mic, without its own jack detect */
6585+
{ }
6586+
},
6587+
.chained = true,
6588+
.chain_id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC
6589+
},
65836590
};
65846591

65856592
static const struct snd_pci_quirk alc269_fixup_tbl[] = {
@@ -6758,6 +6765,7 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = {
67586765
SND_PCI_QUIRK(0x1458, 0xfa53, "Gigabyte BXBT-2807", ALC283_FIXUP_HEADSET_MIC),
67596766
SND_PCI_QUIRK(0x1462, 0xb120, "MSI Cubi MS-B120", ALC283_FIXUP_HEADSET_MIC),
67606767
SND_PCI_QUIRK(0x1462, 0xb171, "Cubi N 8GL (MS-B171)", ALC283_FIXUP_HEADSET_MIC),
6768+
SND_PCI_QUIRK(0x1558, 0x1325, "System76 Darter Pro (darp5)", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
67616769
SND_PCI_QUIRK(0x17aa, 0x1036, "Lenovo P520", ALC233_FIXUP_LENOVO_MULTI_CODECS),
67626770
SND_PCI_QUIRK(0x17aa, 0x20f2, "Thinkpad SL410/510", ALC269_FIXUP_SKU_IGNORE),
67636771
SND_PCI_QUIRK(0x17aa, 0x215e, "Thinkpad L512", ALC269_FIXUP_SKU_IGNORE),

sound/usb/quirks.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1567,6 +1567,7 @@ u64 snd_usb_interface_dsd_format_quirks(struct snd_usb_audio *chip,
15671567
case 0x20b1: /* XMOS based devices */
15681568
case 0x152a: /* Thesycon devices */
15691569
case 0x25ce: /* Mytek devices */
1570+
case 0x2ab6: /* T+A devices */
15701571
if (fp->dsd_raw)
15711572
return SNDRV_PCM_FMTBIT_DSD_U32_BE;
15721573
break;

0 commit comments

Comments
 (0)