aboutsummaryrefslogtreecommitdiffstats
path: root/sound/pci/hda/patch_sigmatel.c
diff options
context:
space:
mode:
Diffstat (limited to 'sound/pci/hda/patch_sigmatel.c')
-rw-r--r--sound/pci/hda/patch_sigmatel.c238
1 files changed, 21 insertions, 217 deletions
diff --git a/sound/pci/hda/patch_sigmatel.c b/sound/pci/hda/patch_sigmatel.c
index 775f8581906e..dbe8b1201eff 100644
--- a/sound/pci/hda/patch_sigmatel.c
+++ b/sound/pci/hda/patch_sigmatel.c
@@ -5351,172 +5351,12 @@ static int patch_stac9205(struct hda_codec *codec)
5351 * STAC9872 hack 5351 * STAC9872 hack
5352 */ 5352 */
5353 5353
5354/* static config for Sony VAIO FE550G and Sony VAIO AR */ 5354static struct hda_verb stac9872_core_init[] = {
5355static hda_nid_t vaio_dacs[] = { 0x2 };
5356#define VAIO_HP_DAC 0x5
5357static hda_nid_t vaio_adcs[] = { 0x8 /*,0x6*/ };
5358static hda_nid_t vaio_mux_nids[] = { 0x15 };
5359
5360static struct hda_input_mux vaio_mux = {
5361 .num_items = 3,
5362 .items = {
5363 /* { "HP", 0x0 }, */
5364 { "Mic Jack", 0x1 },
5365 { "Internal Mic", 0x2 },
5366 { "PCM", 0x3 },
5367 }
5368};
5369
5370static struct hda_verb vaio_init[] = {
5371 {0x0a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, /* HP <- 0x2 */
5372 {0x0a, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | STAC_HP_EVENT},
5373 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Speaker <- 0x5 */
5374 {0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* Mic? (<- 0x2) */
5375 {0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, /* CD */
5376 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* Mic? */
5377 {0x15, AC_VERB_SET_CONNECT_SEL, 0x1}, /* mic-sel: 0a,0d,14,02 */
5378 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* HP */
5379 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Speaker */
5380 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* capture sw/vol -> 0x8 */
5381 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, /* CD-in -> 0x6 */
5382 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Mic-in -> 0x9 */
5383 {}
5384};
5385
5386static struct hda_verb vaio_ar_init[] = {
5387 {0x0a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, /* HP <- 0x2 */
5388 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Speaker <- 0x5 */
5389 {0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* Mic? (<- 0x2) */
5390 {0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, /* CD */
5391/* {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },*/ /* Optical Out */
5392 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* Mic? */
5393 {0x15, AC_VERB_SET_CONNECT_SEL, 0x1}, /* mic-sel: 0a,0d,14,02 */ 5355 {0x15, AC_VERB_SET_CONNECT_SEL, 0x1}, /* mic-sel: 0a,0d,14,02 */
5394 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* HP */
5395 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Speaker */
5396/* {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},*/ /* Optical Out */
5397 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* capture sw/vol -> 0x8 */
5398 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, /* CD-in -> 0x6 */
5399 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Mic-in -> 0x9 */ 5356 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Mic-in -> 0x9 */
5400 {} 5357 {}
5401}; 5358};
5402 5359
5403static struct snd_kcontrol_new vaio_mixer[] = {
5404 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x02, 0, HDA_OUTPUT),
5405 HDA_CODEC_MUTE("Headphone Playback Switch", 0x02, 0, HDA_OUTPUT),
5406 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x05, 0, HDA_OUTPUT),
5407 HDA_CODEC_MUTE("Speaker Playback Switch", 0x05, 0, HDA_OUTPUT),
5408 /* HDA_CODEC_VOLUME("CD Capture Volume", 0x07, 0, HDA_INPUT), */
5409 HDA_CODEC_VOLUME("Capture Volume", 0x09, 0, HDA_INPUT),
5410 HDA_CODEC_MUTE("Capture Switch", 0x09, 0, HDA_INPUT),
5411 {
5412 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
5413 .name = "Capture Source",
5414 .count = 1,
5415 .info = stac92xx_mux_enum_info,
5416 .get = stac92xx_mux_enum_get,
5417 .put = stac92xx_mux_enum_put,
5418 },
5419 {}
5420};
5421
5422static struct snd_kcontrol_new vaio_ar_mixer[] = {
5423 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x02, 0, HDA_OUTPUT),
5424 HDA_CODEC_MUTE("Headphone Playback Switch", 0x02, 0, HDA_OUTPUT),
5425 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x05, 0, HDA_OUTPUT),
5426 HDA_CODEC_MUTE("Speaker Playback Switch", 0x05, 0, HDA_OUTPUT),
5427 /* HDA_CODEC_VOLUME("CD Capture Volume", 0x07, 0, HDA_INPUT), */
5428 HDA_CODEC_VOLUME("Capture Volume", 0x09, 0, HDA_INPUT),
5429 HDA_CODEC_MUTE("Capture Switch", 0x09, 0, HDA_INPUT),
5430 /*HDA_CODEC_MUTE("Optical Out Switch", 0x10, 0, HDA_OUTPUT),
5431 HDA_CODEC_VOLUME("Optical Out Volume", 0x10, 0, HDA_OUTPUT),*/
5432 {
5433 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
5434 .name = "Capture Source",
5435 .count = 1,
5436 .info = stac92xx_mux_enum_info,
5437 .get = stac92xx_mux_enum_get,
5438 .put = stac92xx_mux_enum_put,
5439 },
5440 {}
5441};
5442
5443static struct hda_codec_ops stac9872_patch_ops = {
5444 .build_controls = stac92xx_build_controls,
5445 .build_pcms = stac92xx_build_pcms,
5446 .init = stac92xx_init,
5447 .free = stac92xx_free,
5448#ifdef SND_HDA_NEEDS_RESUME
5449 .resume = stac92xx_resume,
5450#endif
5451};
5452
5453static int stac9872_vaio_init(struct hda_codec *codec)
5454{
5455 int err;
5456
5457 err = stac92xx_init(codec);
5458 if (err < 0)
5459 return err;
5460 if (codec->patch_ops.unsol_event)
5461 codec->patch_ops.unsol_event(codec, STAC_HP_EVENT << 26);
5462 return 0;
5463}
5464
5465static void stac9872_vaio_hp_detect(struct hda_codec *codec, unsigned int res)
5466{
5467 if (get_pin_presence(codec, 0x0a)) {
5468 stac92xx_reset_pinctl(codec, 0x0f, AC_PINCTL_OUT_EN);
5469 stac92xx_set_pinctl(codec, 0x0a, AC_PINCTL_OUT_EN);
5470 } else {
5471 stac92xx_reset_pinctl(codec, 0x0a, AC_PINCTL_OUT_EN);
5472 stac92xx_set_pinctl(codec, 0x0f, AC_PINCTL_OUT_EN);
5473 }
5474}
5475
5476static void stac9872_vaio_unsol_event(struct hda_codec *codec, unsigned int res)
5477{
5478 switch (res >> 26) {
5479 case STAC_HP_EVENT:
5480 stac9872_vaio_hp_detect(codec, res);
5481 break;
5482 }
5483}
5484
5485static struct hda_codec_ops stac9872_vaio_patch_ops = {
5486 .build_controls = stac92xx_build_controls,
5487 .build_pcms = stac92xx_build_pcms,
5488 .init = stac9872_vaio_init,
5489 .free = stac92xx_free,
5490 .unsol_event = stac9872_vaio_unsol_event,
5491#ifdef CONFIG_PM
5492 .resume = stac92xx_resume,
5493#endif
5494};
5495
5496enum { /* FE and SZ series. id=0x83847661 and subsys=0x104D0700 or 104D1000. */
5497 CXD9872RD_VAIO,
5498 /* Unknown. id=0x83847662 and subsys=0x104D1200 or 104D1000. */
5499 STAC9872AK_VAIO,
5500 /* Unknown. id=0x83847661 and subsys=0x104D1200. */
5501 STAC9872K_VAIO,
5502 /* AR Series. id=0x83847664 and subsys=104D1300 */
5503 CXD9872AKD_VAIO,
5504 STAC_9872_MODELS,
5505};
5506
5507static const char *stac9872_models[STAC_9872_MODELS] = {
5508 [CXD9872RD_VAIO] = "vaio",
5509 [CXD9872AKD_VAIO] = "vaio-ar",
5510};
5511
5512static struct snd_pci_quirk stac9872_cfg_tbl[] = {
5513 SND_PCI_QUIRK(0x104d, 0x81e6, "Sony VAIO F/S", CXD9872RD_VAIO),
5514 SND_PCI_QUIRK(0x104d, 0x81ef, "Sony VAIO F/S", CXD9872RD_VAIO),
5515 SND_PCI_QUIRK(0x104d, 0x81fd, "Sony VAIO AR", CXD9872AKD_VAIO),
5516 SND_PCI_QUIRK(0x104d, 0x8205, "Sony VAIO AR", CXD9872AKD_VAIO),
5517 {}
5518};
5519
5520static struct snd_kcontrol_new stac9872_mixer[] = { 5360static struct snd_kcontrol_new stac9872_mixer[] = {
5521 HDA_CODEC_VOLUME("Capture Volume", 0x09, 0, HDA_INPUT), 5361 HDA_CODEC_VOLUME("Capture Volume", 0x09, 0, HDA_INPUT),
5522 HDA_CODEC_MUTE("Capture Switch", 0x09, 0, HDA_INPUT), 5362 HDA_CODEC_MUTE("Capture Switch", 0x09, 0, HDA_INPUT),
@@ -5540,72 +5380,36 @@ static hda_nid_t stac9872_mux_nids[] = {
5540static int patch_stac9872(struct hda_codec *codec) 5380static int patch_stac9872(struct hda_codec *codec)
5541{ 5381{
5542 struct sigmatel_spec *spec; 5382 struct sigmatel_spec *spec;
5383 int err;
5543 5384
5544 spec = kzalloc(sizeof(*spec), GFP_KERNEL); 5385 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
5545 if (spec == NULL) 5386 if (spec == NULL)
5546 return -ENOMEM; 5387 return -ENOMEM;
5547 codec->spec = spec; 5388 codec->spec = spec;
5548 5389
5390#if 0 /* no model right now */
5549 spec->board_config = snd_hda_check_board_config(codec, STAC_9872_MODELS, 5391 spec->board_config = snd_hda_check_board_config(codec, STAC_9872_MODELS,
5550 stac9872_models, 5392 stac9872_models,
5551 stac9872_cfg_tbl); 5393 stac9872_cfg_tbl);
5552 if (spec->board_config < 0) { 5394#endif
5553 int err;
5554
5555 spec->num_pins = ARRAY_SIZE(stac9872_pin_nids);
5556 spec->pin_nids = stac9872_pin_nids;
5557 spec->multiout.dac_nids = spec->dac_nids;
5558 spec->num_adcs = ARRAY_SIZE(stac9872_adc_nids);
5559 spec->adc_nids = stac9872_adc_nids;
5560 spec->num_muxes = ARRAY_SIZE(stac9872_mux_nids);
5561 spec->mux_nids = stac9872_mux_nids;
5562 spec->mixer = stac9872_mixer;
5563 spec->init = vaio_init;
5564
5565 err = stac92xx_parse_auto_config(codec, 0x10, 0x12);
5566 if (err < 0) {
5567 stac92xx_free(codec);
5568 return -EINVAL;
5569 }
5570 spec->input_mux = &spec->private_imux;
5571 codec->patch_ops = stac92xx_patch_ops;
5572 return 0;
5573 }
5574
5575 switch (spec->board_config) {
5576 case CXD9872RD_VAIO:
5577 case STAC9872AK_VAIO:
5578 case STAC9872K_VAIO:
5579 spec->mixer = vaio_mixer;
5580 spec->init = vaio_init;
5581 spec->multiout.max_channels = 2;
5582 spec->multiout.num_dacs = ARRAY_SIZE(vaio_dacs);
5583 spec->multiout.dac_nids = vaio_dacs;
5584 spec->multiout.hp_nid = VAIO_HP_DAC;
5585 spec->num_adcs = ARRAY_SIZE(vaio_adcs);
5586 spec->adc_nids = vaio_adcs;
5587 spec->num_pwrs = 0;
5588 spec->input_mux = &vaio_mux;
5589 spec->mux_nids = vaio_mux_nids;
5590 codec->patch_ops = stac9872_vaio_patch_ops;
5591 break;
5592
5593 case CXD9872AKD_VAIO:
5594 spec->mixer = vaio_ar_mixer;
5595 spec->init = vaio_ar_init;
5596 spec->multiout.max_channels = 2;
5597 spec->multiout.num_dacs = ARRAY_SIZE(vaio_dacs);
5598 spec->multiout.dac_nids = vaio_dacs;
5599 spec->multiout.hp_nid = VAIO_HP_DAC;
5600 spec->num_adcs = ARRAY_SIZE(vaio_adcs);
5601 spec->num_pwrs = 0;
5602 spec->adc_nids = vaio_adcs;
5603 spec->input_mux = &vaio_mux;
5604 spec->mux_nids = vaio_mux_nids;
5605 codec->patch_ops = stac9872_patch_ops;
5606 break;
5607 }
5608 5395
5396 spec->num_pins = ARRAY_SIZE(stac9872_pin_nids);
5397 spec->pin_nids = stac9872_pin_nids;
5398 spec->multiout.dac_nids = spec->dac_nids;
5399 spec->num_adcs = ARRAY_SIZE(stac9872_adc_nids);
5400 spec->adc_nids = stac9872_adc_nids;
5401 spec->num_muxes = ARRAY_SIZE(stac9872_mux_nids);
5402 spec->mux_nids = stac9872_mux_nids;
5403 spec->mixer = stac9872_mixer;
5404 spec->init = stac9872_core_init;
5405
5406 err = stac92xx_parse_auto_config(codec, 0x10, 0x12);
5407 if (err < 0) {
5408 stac92xx_free(codec);
5409 return -EINVAL;
5410 }
5411 spec->input_mux = &spec->private_imux;
5412 codec->patch_ops = stac92xx_patch_ops;
5609 return 0; 5413 return 0;
5610} 5414}
5611 5415