aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--sound/pci/hda/patch_sigmatel.c110
1 files changed, 99 insertions, 11 deletions
diff --git a/sound/pci/hda/patch_sigmatel.c b/sound/pci/hda/patch_sigmatel.c
index 36f199442fdc..fb4bed0759d1 100644
--- a/sound/pci/hda/patch_sigmatel.c
+++ b/sound/pci/hda/patch_sigmatel.c
@@ -42,6 +42,9 @@
42#define STAC_D945GTP3 1 42#define STAC_D945GTP3 1
43#define STAC_D945GTP5 2 43#define STAC_D945GTP5 2
44#define STAC_MACMINI 3 44#define STAC_MACMINI 3
45#define STAC_D965_2112 4
46#define STAC_D965_284B 5
47#define STAC_922X_MODELS 6 /* number of 922x models */
45 48
46struct sigmatel_spec { 49struct sigmatel_spec {
47 struct snd_kcontrol_new *mixers[4]; 50 struct snd_kcontrol_new *mixers[4];
@@ -107,10 +110,24 @@ static hda_nid_t stac922x_adc_nids[2] = {
107 0x06, 0x07, 110 0x06, 0x07,
108}; 111};
109 112
113static hda_nid_t stac9227_adc_nids[2] = {
114 0x07, 0x08,
115};
116
117#if 0
118static hda_nid_t d965_2112_dac_nids[3] = {
119 0x02, 0x03, 0x05,
120};
121#endif
122
110static hda_nid_t stac922x_mux_nids[2] = { 123static hda_nid_t stac922x_mux_nids[2] = {
111 0x12, 0x13, 124 0x12, 0x13,
112}; 125};
113 126
127static hda_nid_t stac9227_mux_nids[2] = {
128 0x15, 0x16,
129};
130
114static hda_nid_t stac927x_adc_nids[3] = { 131static hda_nid_t stac927x_adc_nids[3] = {
115 0x07, 0x08, 0x09 132 0x07, 0x08, 0x09
116}; 133};
@@ -173,6 +190,24 @@ static struct hda_verb stac922x_core_init[] = {
173 {} 190 {}
174}; 191};
175 192
193static struct hda_verb stac9227_core_init[] = {
194 /* set master volume and direct control */
195 { 0x16, AC_VERB_SET_VOLUME_KNOB_CONTROL, 0xff},
196 /* unmute node 0x1b */
197 { 0x1b, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
198 {}
199};
200
201static struct hda_verb d965_2112_core_init[] = {
202 /* set master volume and direct control */
203 { 0x16, AC_VERB_SET_VOLUME_KNOB_CONTROL, 0xff},
204 /* unmute node 0x1b */
205 { 0x1b, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
206 /* select node 0x03 as DAC */
207 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x01},
208 {}
209};
210
176static struct hda_verb stac927x_core_init[] = { 211static struct hda_verb stac927x_core_init[] = {
177 /* set master volume and direct control */ 212 /* set master volume and direct control */
178 { 0x24, AC_VERB_SET_VOLUME_KNOB_CONTROL, 0xff}, 213 { 0x24, AC_VERB_SET_VOLUME_KNOB_CONTROL, 0xff},
@@ -212,6 +247,21 @@ static struct snd_kcontrol_new stac922x_mixer[] = {
212 { } /* end */ 247 { } /* end */
213}; 248};
214 249
250/* This needs to be generated dynamically based on sequence */
251static struct snd_kcontrol_new stac9227_mixer[] = {
252 {
253 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
254 .name = "Input Source",
255 .count = 1,
256 .info = stac92xx_mux_enum_info,
257 .get = stac92xx_mux_enum_get,
258 .put = stac92xx_mux_enum_put,
259 },
260 HDA_CODEC_VOLUME("Capture Volume", 0x15, 0x0, HDA_OUTPUT),
261 HDA_CODEC_MUTE("Capture Switch", 0x1b, 0x0, HDA_OUTPUT),
262 { } /* end */
263};
264
215static snd_kcontrol_new_t stac927x_mixer[] = { 265static snd_kcontrol_new_t stac927x_mixer[] = {
216 { 266 {
217 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 267 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
@@ -291,11 +341,17 @@ static unsigned int d945gtp5_pin_configs[10] = {
291 0x02a19320, 0x40000100, 341 0x02a19320, 0x40000100,
292}; 342};
293 343
294static unsigned int *stac922x_brd_tbl[] = { 344static unsigned int d965_2112_pin_configs[10] = {
295 ref922x_pin_configs, 345 0x0221401f, 0x40000100, 0x40000100, 0x01014011,
296 d945gtp3_pin_configs, 346 0x01a19021, 0x01813024, 0x01452130, 0x40000100,
297 d945gtp5_pin_configs, 347 0x02a19320, 0x40000100,
298 NULL, /* STAC_MACMINI */ 348};
349
350static unsigned int *stac922x_brd_tbl[STAC_922X_MODELS] = {
351 [STAC_REF] = ref922x_pin_configs,
352 [STAC_D945GTP3] = d945gtp3_pin_configs,
353 [STAC_D945GTP5] = d945gtp5_pin_configs,
354 [STAC_D965_2112] = d965_2112_pin_configs,
299}; 355};
300 356
301static struct hda_board_config stac922x_cfg_tbl[] = { 357static struct hda_board_config stac922x_cfg_tbl[] = {
@@ -330,6 +386,12 @@ static struct hda_board_config stac922x_cfg_tbl[] = {
330 { .pci_subvendor = 0x8384, 386 { .pci_subvendor = 0x8384,
331 .pci_subdevice = 0x7680, 387 .pci_subdevice = 0x7680,
332 .config = STAC_MACMINI }, /* Apple Mac Mini (early 2006) */ 388 .config = STAC_MACMINI }, /* Apple Mac Mini (early 2006) */
389 { .pci_subvendor = PCI_VENDOR_ID_INTEL,
390 .pci_subdevice = 0x2112,
391 .config = STAC_D965_2112 },
392 { .pci_subvendor = PCI_VENDOR_ID_INTEL,
393 .pci_subdevice = 0x284b,
394 .config = STAC_D965_284B },
333 {} /* terminator */ 395 {} /* terminator */
334}; 396};
335 397
@@ -713,7 +775,8 @@ static int stac92xx_add_dyn_out_pins(struct hda_codec *codec, struct auto_pin_cf
713 * A and B is not supported. 775 * A and B is not supported.
714 */ 776 */
715/* fill in the dac_nids table from the parsed pin configuration */ 777/* fill in the dac_nids table from the parsed pin configuration */
716static int stac92xx_auto_fill_dac_nids(struct hda_codec *codec, const struct auto_pin_cfg *cfg) 778static int stac92xx_auto_fill_dac_nids(struct hda_codec *codec,
779 const struct auto_pin_cfg *cfg)
717{ 780{
718 struct sigmatel_spec *spec = codec->spec; 781 struct sigmatel_spec *spec = codec->spec;
719 hda_nid_t nid; 782 hda_nid_t nid;
@@ -732,10 +795,13 @@ static int stac92xx_auto_fill_dac_nids(struct hda_codec *codec, const struct aut
732} 795}
733 796
734/* add playback controls from the parsed DAC table */ 797/* add playback controls from the parsed DAC table */
735static int stac92xx_auto_create_multi_out_ctls(struct sigmatel_spec *spec, const struct auto_pin_cfg *cfg) 798static int stac92xx_auto_create_multi_out_ctls(struct sigmatel_spec *spec,
799 const struct auto_pin_cfg *cfg)
736{ 800{
737 char name[32]; 801 char name[32];
738 static const char *chname[4] = { "Front", "Surround", NULL /*CLFE*/, "Side" }; 802 static const char *chname[4] = {
803 "Front", "Surround", NULL /*CLFE*/, "Side"
804 };
739 hda_nid_t nid; 805 hda_nid_t nid;
740 int i, err; 806 int i, err;
741 807
@@ -893,10 +959,12 @@ static int stac92xx_parse_auto_config(struct hda_codec *codec, hda_nid_t dig_out
893 return err; 959 return err;
894 if (! spec->autocfg.line_outs) 960 if (! spec->autocfg.line_outs)
895 return 0; /* can't find valid pin config */ 961 return 0; /* can't find valid pin config */
962
896 if ((err = stac92xx_add_dyn_out_pins(codec, &spec->autocfg)) < 0) 963 if ((err = stac92xx_add_dyn_out_pins(codec, &spec->autocfg)) < 0)
897 return err; 964 return err;
898 if ((err = stac92xx_auto_fill_dac_nids(codec, &spec->autocfg)) < 0) 965 if (spec->multiout.num_dacs == 0)
899 return err; 966 if ((err = stac92xx_auto_fill_dac_nids(codec, &spec->autocfg)) < 0)
967 return err;
900 968
901 if ((err = stac92xx_auto_create_multi_out_ctls(spec, &spec->autocfg)) < 0 || 969 if ((err = stac92xx_auto_create_multi_out_ctls(spec, &spec->autocfg)) < 0 ||
902 (err = stac92xx_auto_create_hp_ctls(codec, &spec->autocfg)) < 0 || 970 (err = stac92xx_auto_create_hp_ctls(codec, &spec->autocfg)) < 0 ||
@@ -1194,7 +1262,8 @@ static int patch_stac922x(struct hda_codec *codec)
1194 codec->spec = spec; 1262 codec->spec = spec;
1195 spec->board_config = snd_hda_check_board_config(codec, stac922x_cfg_tbl); 1263 spec->board_config = snd_hda_check_board_config(codec, stac922x_cfg_tbl);
1196 if (spec->board_config < 0) 1264 if (spec->board_config < 0)
1197 snd_printdd(KERN_INFO "hda_codec: Unknown model for STAC922x, using BIOS defaults\n"); 1265 snd_printdd(KERN_INFO "hda_codec: Unknown model for STAC922x, "
1266 "using BIOS defaults\n");
1198 else if (stac922x_brd_tbl[spec->board_config] != NULL) { 1267 else if (stac922x_brd_tbl[spec->board_config] != NULL) {
1199 spec->num_pins = 10; 1268 spec->num_pins = 10;
1200 spec->pin_nids = stac922x_pin_nids; 1269 spec->pin_nids = stac922x_pin_nids;
@@ -1210,6 +1279,25 @@ static int patch_stac922x(struct hda_codec *codec)
1210 spec->mixer = stac922x_mixer; 1279 spec->mixer = stac922x_mixer;
1211 1280
1212 spec->multiout.dac_nids = spec->dac_nids; 1281 spec->multiout.dac_nids = spec->dac_nids;
1282
1283 switch (spec->board_config) {
1284 case STAC_D965_2112:
1285 spec->adc_nids = stac9227_adc_nids;
1286 spec->mux_nids = stac9227_mux_nids;
1287#if 0
1288 spec->multiout.dac_nids = d965_2112_dac_nids;
1289 spec->multiout.num_dacs = ARRAY_SIZE(d965_2112_dac_nids);
1290#endif
1291 spec->init = d965_2112_core_init;
1292 spec->mixer = stac9227_mixer;
1293 break;
1294 case STAC_D965_284B:
1295 spec->adc_nids = stac9227_adc_nids;
1296 spec->mux_nids = stac9227_mux_nids;
1297 spec->init = stac9227_core_init;
1298 spec->mixer = stac9227_mixer;
1299 break;
1300 }
1213 1301
1214 err = stac92xx_parse_auto_config(codec, 0x08, 0x09); 1302 err = stac92xx_parse_auto_config(codec, 0x08, 0x09);
1215 if (err < 0) { 1303 if (err < 0) {