Skip to content

Commit 2fc07ef

Browse files
committed
Merge tag 'sound-3.7' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound
Pull sound updates #2 from Takashi Iwai: "This update contains a few cleanup works, regression/stable fixes gathered since the last pull request. - Clean up with generic hd-audio jack handling code by David Henningsson - A few regression fixes for standardized HD-audio auto-parser - Misc clean-up and small fixes" * tag 'sound-3.7' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound: ALSA: hda - do not detect jack on internal speakers for Realtek ALSA: hda - Fix missing beep on ASUS X43U notebook ALSA: hda - Remove AZX_DCAPS_POSFIX_COMBO ALSA: hda - Warn an allocation for an uninitialized array ALSA: hda/cirrus - Add missing init/free of hda_gen_spec ALSA: hda - Fix memory leaks at error path in patch_cirrus.c ALSA: hda - Add missing hda_gen_spec to struct via_spec ALSA: hda - remove "Mic Jack Mode" for headset jacks (Latitude Exx30) ALSA: hda - make Cirrus codec use generic unsol event handler ALSA: hda - make VIA codec use generic unsol event handler ALSA: hda - Remove dead GPIO code for VIA codec ALSA: usb-audio: Add TASCAM US122 MKII playback
2 parents 79360dd + f7f4b23 commit 2fc07ef

7 files changed

+122
-117
lines changed

sound/pci/hda/hda_codec.c

+2
Original file line numberDiff line numberDiff line change
@@ -5168,6 +5168,8 @@ EXPORT_SYMBOL_HDA(snd_hda_resume);
51685168
*/
51695169
void *snd_array_new(struct snd_array *array)
51705170
{
5171+
if (snd_BUG_ON(!array->elem_size))
5172+
return NULL;
51715173
if (array->used >= array->alloced) {
51725174
int num = array->alloced + array->alloc_align;
51735175
int size = (num + 1) * array->elem_size;

sound/pci/hda/hda_intel.c

-5
Original file line numberDiff line numberDiff line change
@@ -554,7 +554,6 @@ enum {
554554
#define AZX_DCAPS_BUFSIZE (1 << 21) /* no buffer size alignment */
555555
#define AZX_DCAPS_ALIGN_BUFSIZE (1 << 22) /* buffer size alignment */
556556
#define AZX_DCAPS_4K_BDLE_BOUNDARY (1 << 23) /* BDLE in 4k boundary */
557-
#define AZX_DCAPS_POSFIX_COMBO (1 << 24) /* Use COMBO as default */
558557
#define AZX_DCAPS_COUNT_LPIB_DELAY (1 << 25) /* Take LPIB as delay */
559558

560559
/* quirks for ATI SB / AMD Hudson */
@@ -2858,10 +2857,6 @@ static int __devinit check_position_fix(struct azx *chip, int fix)
28582857
snd_printd(SFX "Using LPIB position fix\n");
28592858
return POS_FIX_LPIB;
28602859
}
2861-
if (chip->driver_caps & AZX_DCAPS_POSFIX_COMBO) {
2862-
snd_printd(SFX "Using COMBO position fix\n");
2863-
return POS_FIX_COMBO;
2864-
}
28652860
return POS_FIX_AUTO;
28662861
}
28672862

sound/pci/hda/patch_cirrus.c

+17-41
Original file line numberDiff line numberDiff line change
@@ -897,7 +897,7 @@ static int build_digital_input(struct hda_codec *codec)
897897
* HP/SPK/SPDIF
898898
*/
899899

900-
static void cs_automute(struct hda_codec *codec)
900+
static void cs_automute(struct hda_codec *codec, struct hda_jack_tbl *tbl)
901901
{
902902
struct cs_spec *spec = codec->spec;
903903
struct auto_pin_cfg *cfg = &spec->autocfg;
@@ -973,7 +973,7 @@ static void cs_automute(struct hda_codec *codec)
973973
* Switch max 3 inputs of a single ADC (nid 3)
974974
*/
975975

976-
static void cs_automic(struct hda_codec *codec)
976+
static void cs_automic(struct hda_codec *codec, struct hda_jack_tbl *tbl)
977977
{
978978
struct cs_spec *spec = codec->spec;
979979
struct auto_pin_cfg *cfg = &spec->autocfg;
@@ -1035,7 +1035,7 @@ static void init_output(struct hda_codec *codec)
10351035
if (!cfg->speaker_outs)
10361036
continue;
10371037
if (get_wcaps(codec, nid) & AC_WCAP_UNSOL_CAP) {
1038-
snd_hda_jack_detect_enable(codec, nid, HP_EVENT);
1038+
snd_hda_jack_detect_enable_callback(codec, nid, HP_EVENT, cs_automute);
10391039
spec->hp_detect = 1;
10401040
}
10411041
}
@@ -1046,7 +1046,7 @@ static void init_output(struct hda_codec *codec)
10461046

10471047
/* SPDIF is enabled on presence detect for CS421x */
10481048
if (spec->hp_detect || spec->spdif_detect)
1049-
cs_automute(codec);
1049+
cs_automute(codec, NULL);
10501050
}
10511051

10521052
static void init_input(struct hda_codec *codec)
@@ -1070,13 +1070,13 @@ static void init_input(struct hda_codec *codec)
10701070
AC_VERB_SET_AMP_GAIN_MUTE,
10711071
AMP_IN_MUTE(spec->adc_idx[i]));
10721072
if (spec->mic_detect && spec->automic_idx == i)
1073-
snd_hda_jack_detect_enable(codec, pin, MIC_EVENT);
1073+
snd_hda_jack_detect_enable_callback(codec, pin, MIC_EVENT, cs_automic);
10741074
}
10751075
/* CS420x has multiple ADC, CS421x has single ADC */
10761076
if (spec->vendor_nid == CS420X_VENDOR_NID) {
10771077
change_cur_input(codec, spec->cur_input, 1);
10781078
if (spec->mic_detect)
1079-
cs_automic(codec);
1079+
cs_automic(codec, NULL);
10801080

10811081
coef = 0x000a; /* ADC1/2 - Digital and Analog Soft Ramp */
10821082
if (is_active_pin(codec, CS_DMIC2_PIN_NID))
@@ -1089,7 +1089,7 @@ static void init_input(struct hda_codec *codec)
10891089
cs_vendor_coef_set(codec, IDX_ADC_CFG, coef);
10901090
} else {
10911091
if (spec->mic_detect)
1092-
cs_automic(codec);
1092+
cs_automic(codec, NULL);
10931093
else {
10941094
spec->cur_adc = spec->adc_nid[spec->cur_input];
10951095
cs_update_input_select(codec);
@@ -1243,28 +1243,16 @@ static void cs_free(struct hda_codec *codec)
12431243
struct cs_spec *spec = codec->spec;
12441244
kfree(spec->capture_bind[0]);
12451245
kfree(spec->capture_bind[1]);
1246+
snd_hda_gen_free(&spec->gen);
12461247
kfree(codec->spec);
12471248
}
12481249

1249-
static void cs_unsol_event(struct hda_codec *codec, unsigned int res)
1250-
{
1251-
switch (snd_hda_jack_get_action(codec, res >> 26)) {
1252-
case HP_EVENT:
1253-
cs_automute(codec);
1254-
break;
1255-
case MIC_EVENT:
1256-
cs_automic(codec);
1257-
break;
1258-
}
1259-
snd_hda_jack_report_sync(codec);
1260-
}
1261-
12621250
static const struct hda_codec_ops cs_patch_ops = {
12631251
.build_controls = cs_build_controls,
12641252
.build_pcms = cs_build_pcms,
12651253
.init = cs_init,
12661254
.free = cs_free,
1267-
.unsol_event = cs_unsol_event,
1255+
.unsol_event = snd_hda_jack_unsol_event,
12681256
};
12691257

12701258
static int cs_parse_auto_config(struct hda_codec *codec)
@@ -1439,6 +1427,7 @@ static int patch_cs420x(struct hda_codec *codec)
14391427
if (!spec)
14401428
return -ENOMEM;
14411429
codec->spec = spec;
1430+
snd_hda_gen_init(&spec->gen);
14421431

14431432
spec->vendor_nid = CS420X_VENDOR_NID;
14441433

@@ -1457,7 +1446,7 @@ static int patch_cs420x(struct hda_codec *codec)
14571446
return 0;
14581447

14591448
error:
1460-
kfree(codec->spec);
1449+
cs_free(codec);
14611450
codec->spec = NULL;
14621451
return err;
14631452
}
@@ -1674,7 +1663,7 @@ static void init_cs421x_digital(struct hda_codec *codec)
16741663
if (!cfg->speaker_outs)
16751664
continue;
16761665
if (get_wcaps(codec, nid) & AC_WCAP_UNSOL_CAP) {
1677-
snd_hda_jack_detect_enable(codec, nid, SPDIF_EVENT);
1666+
snd_hda_jack_detect_enable_callback(codec, nid, SPDIF_EVENT, cs_automute);
16781667
spec->spdif_detect = 1;
16791668
}
16801669
}
@@ -1889,21 +1878,6 @@ static int cs421x_build_controls(struct hda_codec *codec)
18891878
return 0;
18901879
}
18911880

1892-
static void cs421x_unsol_event(struct hda_codec *codec, unsigned int res)
1893-
{
1894-
switch (snd_hda_jack_get_action(codec, res >> 26)) {
1895-
case HP_EVENT:
1896-
case SPDIF_EVENT:
1897-
cs_automute(codec);
1898-
break;
1899-
1900-
case MIC_EVENT:
1901-
cs_automic(codec);
1902-
break;
1903-
}
1904-
snd_hda_jack_report_sync(codec);
1905-
}
1906-
19071881
static int parse_cs421x_input(struct hda_codec *codec)
19081882
{
19091883
struct cs_spec *spec = codec->spec;
@@ -1977,7 +1951,7 @@ static struct hda_codec_ops cs421x_patch_ops = {
19771951
.build_pcms = cs_build_pcms,
19781952
.init = cs421x_init,
19791953
.free = cs_free,
1980-
.unsol_event = cs421x_unsol_event,
1954+
.unsol_event = snd_hda_jack_unsol_event,
19811955
#ifdef CONFIG_PM
19821956
.suspend = cs421x_suspend,
19831957
#endif
@@ -1992,6 +1966,7 @@ static int patch_cs4210(struct hda_codec *codec)
19921966
if (!spec)
19931967
return -ENOMEM;
19941968
codec->spec = spec;
1969+
snd_hda_gen_init(&spec->gen);
19951970

19961971
spec->vendor_nid = CS4210_VENDOR_NID;
19971972

@@ -2017,7 +1992,7 @@ static int patch_cs4210(struct hda_codec *codec)
20171992
return 0;
20181993

20191994
error:
2020-
kfree(codec->spec);
1995+
cs_free(codec);
20211996
codec->spec = NULL;
20221997
return err;
20231998
}
@@ -2031,6 +2006,7 @@ static int patch_cs4213(struct hda_codec *codec)
20312006
if (!spec)
20322007
return -ENOMEM;
20332008
codec->spec = spec;
2009+
snd_hda_gen_init(&spec->gen);
20342010

20352011
spec->vendor_nid = CS4213_VENDOR_NID;
20362012

@@ -2042,7 +2018,7 @@ static int patch_cs4213(struct hda_codec *codec)
20422018
return 0;
20432019

20442020
error:
2045-
kfree(codec->spec);
2021+
cs_free(codec);
20462022
codec->spec = NULL;
20472023
return err;
20482024
}

sound/pci/hda/patch_realtek.c

+3
Original file line numberDiff line numberDiff line change
@@ -611,6 +611,8 @@ static void alc_line_automute(struct hda_codec *codec, struct hda_jack_tbl *jack
611611
{
612612
struct alc_spec *spec = codec->spec;
613613

614+
if (spec->autocfg.line_out_type == AUTO_PIN_SPEAKER_OUT)
615+
return;
614616
/* check LO jack only when it's different from HP */
615617
if (spec->autocfg.line_out_pins[0] == spec->autocfg.hp_pins[0])
616618
return;
@@ -4245,6 +4247,7 @@ static void alc_auto_init_std(struct hda_codec *codec)
42454247
((spec)->beep_amp = HDA_COMPOSE_AMP_VAL(nid, 3, idx, dir))
42464248

42474249
static const struct snd_pci_quirk beep_white_list[] = {
4250+
SND_PCI_QUIRK(0x1043, 0x103c, "ASUS", 1),
42484251
SND_PCI_QUIRK(0x1043, 0x829f, "ASUS", 1),
42494252
SND_PCI_QUIRK(0x1043, 0x83ce, "EeePC", 1),
42504253
SND_PCI_QUIRK(0x1043, 0x831a, "EeePC", 1),

sound/pci/hda/patch_sigmatel.c

+27
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,7 @@ enum {
104104
STAC_92HD83XXX_HP_LED,
105105
STAC_92HD83XXX_HP_INV_LED,
106106
STAC_92HD83XXX_HP_MIC_LED,
107+
STAC_92HD83XXX_HEADSET_JACK,
107108
STAC_92HD83XXX_MODELS
108109
};
109110

@@ -204,6 +205,7 @@ struct sigmatel_spec {
204205
unsigned int check_volume_offset:1;
205206
unsigned int auto_mic:1;
206207
unsigned int linear_tone_beep:1;
208+
unsigned int headset_jack:1; /* 4-pin headset jack (hp + mono mic) */
207209

208210
/* gpio lines */
209211
unsigned int eapd_mask;
@@ -1684,6 +1686,7 @@ static const char * const stac92hd83xxx_models[STAC_92HD83XXX_MODELS] = {
16841686
[STAC_92HD83XXX_HP_LED] = "hp-led",
16851687
[STAC_92HD83XXX_HP_INV_LED] = "hp-inv-led",
16861688
[STAC_92HD83XXX_HP_MIC_LED] = "hp-mic-led",
1689+
[STAC_92HD83XXX_HEADSET_JACK] = "headset-jack",
16871690
};
16881691

16891692
static const struct snd_pci_quirk stac92hd83xxx_cfg_tbl[] = {
@@ -1694,6 +1697,24 @@ static const struct snd_pci_quirk stac92hd83xxx_cfg_tbl[] = {
16941697
"DFI LanParty", STAC_92HD83XXX_REF),
16951698
SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x02ba,
16961699
"unknown Dell", STAC_DELL_S14),
1700+
SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0532,
1701+
"Dell Latitude E6230", STAC_92HD83XXX_HEADSET_JACK),
1702+
SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0533,
1703+
"Dell Latitude E6330", STAC_92HD83XXX_HEADSET_JACK),
1704+
SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0534,
1705+
"Dell Latitude E6430", STAC_92HD83XXX_HEADSET_JACK),
1706+
SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0535,
1707+
"Dell Latitude E6530", STAC_92HD83XXX_HEADSET_JACK),
1708+
SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x053c,
1709+
"Dell Latitude E5430", STAC_92HD83XXX_HEADSET_JACK),
1710+
SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x053d,
1711+
"Dell Latitude E5530", STAC_92HD83XXX_HEADSET_JACK),
1712+
SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0549,
1713+
"Dell Latitude E5430", STAC_92HD83XXX_HEADSET_JACK),
1714+
SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x057d,
1715+
"Dell Latitude E6430s", STAC_92HD83XXX_HEADSET_JACK),
1716+
SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0584,
1717+
"Dell Latitude E6430U", STAC_92HD83XXX_HEADSET_JACK),
16971718
SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x1028,
16981719
"Dell Vostro 3500", STAC_DELL_VOSTRO_3500),
16991720
SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x1656,
@@ -2855,6 +2876,9 @@ static inline int stac92xx_add_jack_mode_control(struct hda_codec *codec,
28552876
char name[22];
28562877

28572878
if (snd_hda_get_input_pin_attr(def_conf) != INPUT_PIN_ATTR_INT) {
2879+
if (spec->headset_jack && snd_hda_get_input_pin_attr(def_conf)
2880+
!= INPUT_PIN_ATTR_DOCK)
2881+
return 0;
28582882
if (snd_hda_get_default_vref(codec, nid) == AC_PINCTL_VREF_GRD
28592883
&& nid == spec->line_switch)
28602884
control = STAC_CTL_WIDGET_IO_SWITCH;
@@ -5626,6 +5650,9 @@ static int patch_stac92hd83xxx(struct hda_codec *codec)
56265650
case STAC_92HD83XXX_HP_MIC_LED:
56275651
spec->mic_mute_led_gpio = 0x08; /* GPIO3 */
56285652
break;
5653+
case STAC_92HD83XXX_HEADSET_JACK:
5654+
spec->headset_jack = 1;
5655+
break;
56295656
}
56305657

56315658
if (find_mute_led_cfg(codec, default_polarity))

0 commit comments

Comments
 (0)