aboutsummaryrefslogtreecommitdiffstats
path: root/sound/pci
diff options
context:
space:
mode:
authorCharles Chin <Charles.Chin@idt.com>2011-11-03 05:27:27 -0400
committerTakashi Iwai <tiwai@suse.de>2011-11-03 05:28:17 -0400
commit9009b0e41c1e81e1a30acdb5d4ffbb6dc5e1345f (patch)
tree70283f1dd43f5c29db0ac61556edaf6abc8de86d /sound/pci
parent112daa7a4c09059ae93e1a3de42e874c13a30728 (diff)
ALSA: hda/sigmatel - Automatically retrieve digital I/O widgets
Revise stac92xx_parse_auto_config to automatically scan for digital input and output converters. Signed-off-by: Charles Chin <Charles.Chin@idt.com> Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/pci')
-rw-r--r--sound/pci/hda/patch_sigmatel.c39
1 files changed, 26 insertions, 13 deletions
diff --git a/sound/pci/hda/patch_sigmatel.c b/sound/pci/hda/patch_sigmatel.c
index 5961e727b2cf..de4c36027cbe 100644
--- a/sound/pci/hda/patch_sigmatel.c
+++ b/sound/pci/hda/patch_sigmatel.c
@@ -3791,9 +3791,10 @@ static int is_dual_headphones(struct hda_codec *codec)
3791} 3791}
3792 3792
3793 3793
3794static int stac92xx_parse_auto_config(struct hda_codec *codec, hda_nid_t dig_out, hda_nid_t dig_in) 3794static int stac92xx_parse_auto_config(struct hda_codec *codec)
3795{ 3795{
3796 struct sigmatel_spec *spec = codec->spec; 3796 struct sigmatel_spec *spec = codec->spec;
3797 hda_nid_t dig_out = 0, dig_in = 0;
3797 int hp_swap = 0; 3798 int hp_swap = 0;
3798 int i, err; 3799 int i, err;
3799 3800
@@ -3976,6 +3977,22 @@ static int stac92xx_parse_auto_config(struct hda_codec *codec, hda_nid_t dig_out
3976 if (spec->multiout.max_channels > 2) 3977 if (spec->multiout.max_channels > 2)
3977 spec->surr_switch = 1; 3978 spec->surr_switch = 1;
3978 3979
3980 /* find digital out and in converters */
3981 for (i = codec->start_nid; i < codec->start_nid + codec->num_nodes; i++) {
3982 unsigned int wid_caps = get_wcaps(codec, i);
3983 if (wid_caps & AC_WCAP_DIGITAL) {
3984 switch (get_wcaps_type(wid_caps)) {
3985 case AC_WID_AUD_OUT:
3986 if (!dig_out)
3987 dig_out = i;
3988 break;
3989 case AC_WID_AUD_IN:
3990 if (!dig_in)
3991 dig_in = i;
3992 break;
3993 }
3994 }
3995 }
3979 if (spec->autocfg.dig_outs) 3996 if (spec->autocfg.dig_outs)
3980 spec->multiout.dig_out_nid = dig_out; 3997 spec->multiout.dig_out_nid = dig_out;
3981 if (dig_in && spec->autocfg.dig_in_pin) 3998 if (dig_in && spec->autocfg.dig_in_pin)
@@ -5279,7 +5296,7 @@ static int patch_stac925x(struct hda_codec *codec)
5279 spec->capvols = stac925x_capvols; 5296 spec->capvols = stac925x_capvols;
5280 spec->capsws = stac925x_capsws; 5297 spec->capsws = stac925x_capsws;
5281 5298
5282 err = stac92xx_parse_auto_config(codec, 0x8, 0x7); 5299 err = stac92xx_parse_auto_config(codec);
5283 if (!err) { 5300 if (!err) {
5284 if (spec->board_config < 0) { 5301 if (spec->board_config < 0) {
5285 printk(KERN_WARNING "hda_codec: No auto-config is " 5302 printk(KERN_WARNING "hda_codec: No auto-config is "
@@ -5420,7 +5437,7 @@ again:
5420 spec->num_pwrs = ARRAY_SIZE(stac92hd73xx_pwr_nids); 5437 spec->num_pwrs = ARRAY_SIZE(stac92hd73xx_pwr_nids);
5421 spec->pwr_nids = stac92hd73xx_pwr_nids; 5438 spec->pwr_nids = stac92hd73xx_pwr_nids;
5422 5439
5423 err = stac92xx_parse_auto_config(codec, 0x25, 0x27); 5440 err = stac92xx_parse_auto_config(codec);
5424 5441
5425 if (!err) { 5442 if (!err) {
5426 if (spec->board_config < 0) { 5443 if (spec->board_config < 0) {
@@ -5657,11 +5674,7 @@ again:
5657 } 5674 }
5658#endif 5675#endif
5659 5676
5660 /* 92HD65/66 series has S/PDIF-IN */ 5677 err = stac92xx_parse_auto_config(codec);
5661 if (codec->vendor_id >= 0x111d76e8 && codec->vendor_id <= 0x111d76f3)
5662 err = stac92xx_parse_auto_config(codec, 0x1d, 0x22);
5663 else
5664 err = stac92xx_parse_auto_config(codec, 0x1d, 0);
5665 if (!err) { 5678 if (!err) {
5666 if (spec->board_config < 0) { 5679 if (spec->board_config < 0) {
5667 printk(KERN_WARNING "hda_codec: No auto-config is " 5680 printk(KERN_WARNING "hda_codec: No auto-config is "
@@ -5982,7 +5995,7 @@ again:
5982 5995
5983 spec->multiout.dac_nids = spec->dac_nids; 5996 spec->multiout.dac_nids = spec->dac_nids;
5984 5997
5985 err = stac92xx_parse_auto_config(codec, 0x21, 0); 5998 err = stac92xx_parse_auto_config(codec);
5986 if (!err) { 5999 if (!err) {
5987 if (spec->board_config < 0) { 6000 if (spec->board_config < 0) {
5988 printk(KERN_WARNING "hda_codec: No auto-config is " 6001 printk(KERN_WARNING "hda_codec: No auto-config is "
@@ -6091,7 +6104,7 @@ static int patch_stac922x(struct hda_codec *codec)
6091 6104
6092 spec->multiout.dac_nids = spec->dac_nids; 6105 spec->multiout.dac_nids = spec->dac_nids;
6093 6106
6094 err = stac92xx_parse_auto_config(codec, 0x08, 0x09); 6107 err = stac92xx_parse_auto_config(codec);
6095 if (!err) { 6108 if (!err) {
6096 if (spec->board_config < 0) { 6109 if (spec->board_config < 0) {
6097 printk(KERN_WARNING "hda_codec: No auto-config is " 6110 printk(KERN_WARNING "hda_codec: No auto-config is "
@@ -6216,7 +6229,7 @@ static int patch_stac927x(struct hda_codec *codec)
6216 spec->aloopback_shift = 0; 6229 spec->aloopback_shift = 0;
6217 spec->eapd_switch = 1; 6230 spec->eapd_switch = 1;
6218 6231
6219 err = stac92xx_parse_auto_config(codec, 0x1e, 0x20); 6232 err = stac92xx_parse_auto_config(codec);
6220 if (!err) { 6233 if (!err) {
6221 if (spec->board_config < 0) { 6234 if (spec->board_config < 0) {
6222 printk(KERN_WARNING "hda_codec: No auto-config is " 6235 printk(KERN_WARNING "hda_codec: No auto-config is "
@@ -6341,7 +6354,7 @@ static int patch_stac9205(struct hda_codec *codec)
6341 break; 6354 break;
6342 } 6355 }
6343 6356
6344 err = stac92xx_parse_auto_config(codec, 0x1f, 0x20); 6357 err = stac92xx_parse_auto_config(codec);
6345 if (!err) { 6358 if (!err) {
6346 if (spec->board_config < 0) { 6359 if (spec->board_config < 0) {
6347 printk(KERN_WARNING "hda_codec: No auto-config is " 6360 printk(KERN_WARNING "hda_codec: No auto-config is "
@@ -6446,7 +6459,7 @@ static int patch_stac9872(struct hda_codec *codec)
6446 spec->capvols = stac9872_capvols; 6459 spec->capvols = stac9872_capvols;
6447 spec->capsws = stac9872_capsws; 6460 spec->capsws = stac9872_capsws;
6448 6461
6449 err = stac92xx_parse_auto_config(codec, 0x10, 0x12); 6462 err = stac92xx_parse_auto_config(codec);
6450 if (err < 0) { 6463 if (err < 0) {
6451 stac92xx_free(codec); 6464 stac92xx_free(codec);
6452 return -EINVAL; 6465 return -EINVAL;