Skip to content

Commit 63177af

Browse files
Conmanx360tiwai
authored andcommitted
ALSA: hda/ca0132: Add pincfg for SBZ + R3Di, add fp hp auto-detect
This patch adds an unsolicited response tag for the front headphone panel which uses the same hp_callback as the rear headphone detection. This patch also adds pincfgs for the R3Di and SBZ which were taken from the Windows driver. The pins are also defined in the function ca0132_config. Both the R3Di and SBZ are also given a max out channel value of 6 to handle 5.1 surround sound in later patches. Signed-off-by: Connor McAdams <conmanx360@gmail.com> Reviewed-by: Takashi Sakamoto <o-takashi@sakamocchi.jp> Signed-off-by: Takashi Iwai <tiwai@suse.de>
1 parent 8a19bce commit 63177af

File tree

1 file changed

+108
-3
lines changed

1 file changed

+108
-3
lines changed

sound/pci/hda/patch_ca0132.c

Lines changed: 108 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -727,6 +727,7 @@ struct ca0132_spec {
727727
hda_nid_t shared_mic_nid;
728728
hda_nid_t shared_out_nid;
729729
hda_nid_t unsol_tag_hp;
730+
hda_nid_t unsol_tag_front_hp; /* for desktop ca0132 codecs */
730731
hda_nid_t unsol_tag_amic1;
731732

732733
/* chip access */
@@ -789,6 +790,36 @@ static const struct hda_pintbl alienware_pincfgs[] = {
789790
{}
790791
};
791792

793+
/* Sound Blaster Z pin configs taken from Windows Driver */
794+
static const struct hda_pintbl sbz_pincfgs[] = {
795+
{ 0x0b, 0x01017010 }, /* Port G -- Lineout FRONT L/R */
796+
{ 0x0c, 0x014510f0 }, /* SPDIF Out 1 */
797+
{ 0x0d, 0x014510f0 }, /* Digital Out */
798+
{ 0x0e, 0x01c510f0 }, /* SPDIF In */
799+
{ 0x0f, 0x0221701f }, /* Port A -- BackPanel HP */
800+
{ 0x10, 0x01017012 }, /* Port D -- Center/LFE or FP Hp */
801+
{ 0x11, 0x01017014 }, /* Port B -- LineMicIn2 / Rear L/R */
802+
{ 0x12, 0x01a170f0 }, /* Port C -- LineIn1 */
803+
{ 0x13, 0x908700f0 }, /* What U Hear In*/
804+
{ 0x18, 0x50d000f0 }, /* N/A */
805+
{}
806+
};
807+
808+
/* Recon3D integrated pin configs taken from Windows Driver */
809+
static const struct hda_pintbl r3di_pincfgs[] = {
810+
{ 0x0b, 0x01014110 }, /* Port G -- Lineout FRONT L/R */
811+
{ 0x0c, 0x014510f0 }, /* SPDIF Out 1 */
812+
{ 0x0d, 0x014510f0 }, /* Digital Out */
813+
{ 0x0e, 0x41c520f0 }, /* SPDIF In */
814+
{ 0x0f, 0x0221401f }, /* Port A -- BackPanel HP */
815+
{ 0x10, 0x01016011 }, /* Port D -- Center/LFE or FP Hp */
816+
{ 0x11, 0x01011014 }, /* Port B -- LineMicIn2 / Rear L/R */
817+
{ 0x12, 0x02a090f0 }, /* Port C -- LineIn1 */
818+
{ 0x13, 0x908700f0 }, /* What U Hear In*/
819+
{ 0x18, 0x500000f0 }, /* N/A */
820+
{}
821+
};
822+
792823
static const struct snd_pci_quirk ca0132_quirks[] = {
793824
SND_PCI_QUIRK(0x1028, 0x0685, "Alienware 15 2015", QUIRK_ALIENWARE),
794825
SND_PCI_QUIRK(0x1028, 0x0688, "Alienware 17 2015", QUIRK_ALIENWARE),
@@ -4507,6 +4538,10 @@ static void ca0132_init_unsol(struct hda_codec *codec)
45074538
amic_callback);
45084539
snd_hda_jack_detect_enable_callback(codec, UNSOL_TAG_DSP,
45094540
ca0132_process_dsp_response);
4541+
/* Front headphone jack detection */
4542+
if (spec->quirk == QUIRK_SBZ || spec->quirk == QUIRK_R3DI)
4543+
snd_hda_jack_detect_enable_callback(codec,
4544+
spec->unsol_tag_front_hp, hp_callback);
45104545
}
45114546

45124547
/*
@@ -4688,9 +4723,14 @@ static void ca0132_config(struct hda_codec *codec)
46884723

46894724
spec->multiout.dac_nids = spec->dacs;
46904725
spec->multiout.num_dacs = 3;
4691-
spec->multiout.max_channels = 2;
46924726

4693-
if (spec->quirk == QUIRK_ALIENWARE) {
4727+
if (spec->quirk == QUIRK_NONE || spec->quirk == QUIRK_ALIENWARE)
4728+
spec->multiout.max_channels = 2;
4729+
else
4730+
spec->multiout.max_channels = 6;
4731+
4732+
switch (spec->quirk) {
4733+
case QUIRK_ALIENWARE:
46944734
codec_dbg(codec, "ca0132_config: QUIRK_ALIENWARE applied.\n");
46954735
snd_hda_apply_pincfgs(codec, alienware_pincfgs);
46964736

@@ -4710,7 +4750,71 @@ static void ca0132_config(struct hda_codec *codec)
47104750
spec->input_pins[2] = 0x13;
47114751
spec->shared_mic_nid = 0x7;
47124752
spec->unsol_tag_amic1 = 0x11;
4713-
} else {
4753+
break;
4754+
case QUIRK_SBZ:
4755+
codec_dbg(codec, "%s: QUIRK_SBZ applied.\n", __func__);
4756+
snd_hda_apply_pincfgs(codec, sbz_pincfgs);
4757+
4758+
spec->num_outputs = 2;
4759+
spec->out_pins[0] = 0x0B; /* Line out */
4760+
spec->out_pins[1] = 0x0F; /* Rear headphone out */
4761+
spec->out_pins[2] = 0x10; /* Front Headphone / Center/LFE*/
4762+
spec->out_pins[3] = 0x11; /* Rear surround */
4763+
spec->shared_out_nid = 0x2;
4764+
spec->unsol_tag_hp = spec->out_pins[1];
4765+
spec->unsol_tag_front_hp = spec->out_pins[2];
4766+
4767+
spec->adcs[0] = 0x7; /* Rear Mic / Line-in */
4768+
spec->adcs[1] = 0x8; /* Front Mic, but only if no DSP */
4769+
spec->adcs[2] = 0xa; /* what u hear */
4770+
4771+
spec->num_inputs = 2;
4772+
spec->input_pins[0] = 0x12; /* Rear Mic / Line-in */
4773+
spec->input_pins[1] = 0x13; /* What U Hear */
4774+
spec->shared_mic_nid = 0x7;
4775+
spec->unsol_tag_amic1 = spec->input_pins[0];
4776+
4777+
/* SPDIF I/O */
4778+
spec->dig_out = 0x05;
4779+
spec->multiout.dig_out_nid = spec->dig_out;
4780+
cfg->dig_out_pins[0] = 0x0c;
4781+
cfg->dig_outs = 1;
4782+
cfg->dig_out_type[0] = HDA_PCM_TYPE_SPDIF;
4783+
spec->dig_in = 0x09;
4784+
cfg->dig_in_pin = 0x0e;
4785+
cfg->dig_in_type = HDA_PCM_TYPE_SPDIF;
4786+
break;
4787+
case QUIRK_R3DI:
4788+
codec_dbg(codec, "%s: QUIRK_R3DI applied.\n", __func__);
4789+
snd_hda_apply_pincfgs(codec, r3di_pincfgs);
4790+
4791+
spec->num_outputs = 2;
4792+
spec->out_pins[0] = 0x0B; /* Line out */
4793+
spec->out_pins[1] = 0x0F; /* Rear headphone out */
4794+
spec->out_pins[2] = 0x10; /* Front Headphone / Center/LFE*/
4795+
spec->out_pins[3] = 0x11; /* Rear surround */
4796+
spec->shared_out_nid = 0x2;
4797+
spec->unsol_tag_hp = spec->out_pins[1];
4798+
spec->unsol_tag_front_hp = spec->out_pins[2];
4799+
4800+
spec->adcs[0] = 0x07; /* Rear Mic / Line-in */
4801+
spec->adcs[1] = 0x08; /* Front Mic, but only if no DSP */
4802+
spec->adcs[2] = 0x0a; /* what u hear */
4803+
4804+
spec->num_inputs = 2;
4805+
spec->input_pins[0] = 0x12; /* Rear Mic / Line-in */
4806+
spec->input_pins[1] = 0x13; /* What U Hear */
4807+
spec->shared_mic_nid = 0x7;
4808+
spec->unsol_tag_amic1 = spec->input_pins[0];
4809+
4810+
/* SPDIF I/O */
4811+
spec->dig_out = 0x05;
4812+
spec->multiout.dig_out_nid = spec->dig_out;
4813+
cfg->dig_out_pins[0] = 0x0c;
4814+
cfg->dig_outs = 1;
4815+
cfg->dig_out_type[0] = HDA_PCM_TYPE_SPDIF;
4816+
break;
4817+
default:
47144818
spec->num_outputs = 2;
47154819
spec->out_pins[0] = 0x0b; /* speaker out */
47164820
spec->out_pins[1] = 0x10; /* headphone out */
@@ -4737,6 +4841,7 @@ static void ca0132_config(struct hda_codec *codec)
47374841
spec->dig_in = 0x09;
47384842
cfg->dig_in_pin = 0x0e;
47394843
cfg->dig_in_type = HDA_PCM_TYPE_SPDIF;
4844+
break;
47404845
}
47414846
}
47424847

0 commit comments

Comments
 (0)