From 0852d7a654f75d22a3c09fd7da4a3551bbb37740 Mon Sep 17 00:00:00 2001 From: Takashi Iwai Date: Wed, 11 Feb 2009 11:35:15 +0100 Subject: [PATCH] ALSA: hda - Detect multiple digital-out pins Detect multiple digital-out pins in snd_hda_parse_pin_defconfig(). The dig_out_pin and dig_out_type fields become arrays. The codec parser still doesn't use this multiple pins detection, though. Signed-off-by: Takashi Iwai --- sound/pci/hda/hda_codec.c | 17 ++++++++++------- sound/pci/hda/hda_local.h | 5 +++-- sound/pci/hda/patch_analog.c | 2 +- sound/pci/hda/patch_realtek.c | 20 ++++++++++---------- sound/pci/hda/patch_sigmatel.c | 10 +++++----- sound/pci/hda/patch_via.c | 10 +++++----- 6 files changed, 34 insertions(+), 30 deletions(-) diff --git a/sound/pci/hda/hda_codec.c b/sound/pci/hda/hda_codec.c index 95f10aec7a0..29eeb748561 100644 --- a/sound/pci/hda/hda_codec.c +++ b/sound/pci/hda/hda_codec.c @@ -3423,11 +3423,13 @@ int snd_hda_parse_pin_def_config(struct hda_codec *codec, break; case AC_JACK_SPDIF_OUT: case AC_JACK_DIG_OTHER_OUT: - cfg->dig_out_pin = nid; - if (loc == AC_JACK_LOC_HDMI) - cfg->dig_out_type = HDA_PCM_TYPE_HDMI; - else - cfg->dig_out_type = HDA_PCM_TYPE_SPDIF; + if (cfg->dig_outs >= ARRAY_SIZE(cfg->dig_out_pins)) + continue; + cfg->dig_out_pins[cfg->dig_outs] = nid; + cfg->dig_out_type[cfg->dig_outs] = + (loc == AC_JACK_LOC_HDMI) ? + HDA_PCM_TYPE_HDMI : HDA_PCM_TYPE_SPDIF; + cfg->dig_outs++; break; case AC_JACK_SPDIF_IN: case AC_JACK_DIG_OTHER_IN: @@ -3541,8 +3543,9 @@ int snd_hda_parse_pin_def_config(struct hda_codec *codec, cfg->hp_pins[1], cfg->hp_pins[2], cfg->hp_pins[3], cfg->hp_pins[4]); snd_printd(" mono: mono_out=0x%x\n", cfg->mono_out_pin); - if (cfg->dig_out_pin) - snd_printd(" dig-out=0x%x\n", cfg->dig_out_pin); + if (cfg->dig_outs) + snd_printd(" dig-out=0x%x/0x%x\n", + cfg->dig_out_pins[0], cfg->dig_out_pins[1]); snd_printd(" inputs: mic=0x%x, fmic=0x%x, line=0x%x, fline=0x%x," " cd=0x%x, aux=0x%x\n", cfg->input_pins[AUTO_PIN_MIC], diff --git a/sound/pci/hda/hda_local.h b/sound/pci/hda/hda_local.h index 4086491ed33..2ae6b53a462 100644 --- a/sound/pci/hda/hda_local.h +++ b/sound/pci/hda/hda_local.h @@ -355,10 +355,11 @@ struct auto_pin_cfg { int line_out_type; /* AUTO_PIN_XXX_OUT */ hda_nid_t hp_pins[AUTO_CFG_MAX_OUTS]; hda_nid_t input_pins[AUTO_PIN_LAST]; - hda_nid_t dig_out_pin; + int dig_outs; + hda_nid_t dig_out_pins[2]; hda_nid_t dig_in_pin; hda_nid_t mono_out_pin; - int dig_out_type; /* HDA_PCM_TYPE_XXX */ + int dig_out_type[2]; /* HDA_PCM_TYPE_XXX */ int dig_in_type; /* HDA_PCM_TYPE_XXX */ }; diff --git a/sound/pci/hda/patch_analog.c b/sound/pci/hda/patch_analog.c index 6106dfe8ec0..d58c32b5b43 100644 --- a/sound/pci/hda/patch_analog.c +++ b/sound/pci/hda/patch_analog.c @@ -2898,7 +2898,7 @@ static int ad1988_parse_auto_config(struct hda_codec *codec) spec->multiout.max_channels = spec->multiout.num_dacs * 2; - if (spec->autocfg.dig_out_pin) + if (spec->autocfg.dig_outs) spec->multiout.dig_out_nid = AD1988_SPDIF_OUT; if (spec->autocfg.dig_in_pin) spec->dig_in_nid = AD1988_SPDIF_IN; diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c index 1db99df7950..e46251bceb9 100644 --- a/sound/pci/hda/patch_realtek.c +++ b/sound/pci/hda/patch_realtek.c @@ -4291,7 +4291,7 @@ static int alc880_parse_auto_config(struct hda_codec *codec) spec->multiout.max_channels = spec->multiout.num_dacs * 2; - if (spec->autocfg.dig_out_pin) + if (spec->autocfg.dig_outs) spec->multiout.dig_out_nid = ALC880_DIGOUT_NID; if (spec->autocfg.dig_in_pin) spec->dig_in_nid = ALC880_DIGIN_NID; @@ -5658,7 +5658,7 @@ static int alc260_parse_auto_config(struct hda_codec *codec) spec->multiout.max_channels = 2; - if (spec->autocfg.dig_out_pin) + if (spec->autocfg.dig_outs) spec->multiout.dig_out_nid = ALC260_DIGOUT_NID; if (spec->kctls.list) add_mixer(spec, spec->kctls.list); @@ -10626,7 +10626,7 @@ static int alc262_parse_auto_config(struct hda_codec *codec) if (err < 0) return err; if (!spec->autocfg.line_outs) { - if (spec->autocfg.dig_out_pin || spec->autocfg.dig_in_pin) { + if (spec->autocfg.dig_outs || spec->autocfg.dig_in_pin) { spec->multiout.max_channels = 2; spec->no_analog = 1; goto dig_only; @@ -10643,9 +10643,9 @@ static int alc262_parse_auto_config(struct hda_codec *codec) spec->multiout.max_channels = spec->multiout.num_dacs * 2; dig_only: - if (spec->autocfg.dig_out_pin) { + if (spec->autocfg.dig_outs) { spec->multiout.dig_out_nid = ALC262_DIGOUT_NID; - spec->dig_out_type = spec->autocfg.dig_out_type; + spec->dig_out_type = spec->autocfg.dig_out_type[0]; } if (spec->autocfg.dig_in_pin) spec->dig_in_nid = ALC262_DIGIN_NID; @@ -11807,7 +11807,7 @@ static int alc268_parse_auto_config(struct hda_codec *codec) spec->multiout.max_channels = 2; /* digital only support output */ - if (spec->autocfg.dig_out_pin) + if (spec->autocfg.dig_outs) spec->multiout.dig_out_nid = ALC268_DIGOUT_NID; if (spec->kctls.list) @@ -12722,7 +12722,7 @@ static int alc269_parse_auto_config(struct hda_codec *codec) spec->multiout.max_channels = spec->multiout.num_dacs * 2; - if (spec->autocfg.dig_out_pin) + if (spec->autocfg.dig_outs) spec->multiout.dig_out_nid = ALC269_DIGOUT_NID; if (spec->kctls.list) @@ -13779,7 +13779,7 @@ static int alc861_parse_auto_config(struct hda_codec *codec) spec->multiout.max_channels = spec->multiout.num_dacs * 2; - if (spec->autocfg.dig_out_pin) + if (spec->autocfg.dig_outs) spec->multiout.dig_out_nid = ALC861_DIGOUT_NID; if (spec->kctls.list) @@ -14881,7 +14881,7 @@ static int alc861vd_parse_auto_config(struct hda_codec *codec) spec->multiout.max_channels = spec->multiout.num_dacs * 2; - if (spec->autocfg.dig_out_pin) + if (spec->autocfg.dig_outs) spec->multiout.dig_out_nid = ALC861VD_DIGOUT_NID; if (spec->kctls.list) @@ -16689,7 +16689,7 @@ static int alc662_parse_auto_config(struct hda_codec *codec) spec->multiout.max_channels = spec->multiout.num_dacs * 2; - if (spec->autocfg.dig_out_pin) + if (spec->autocfg.dig_outs) spec->multiout.dig_out_nid = ALC880_DIGOUT_NID; if (spec->kctls.list) diff --git a/sound/pci/hda/patch_sigmatel.c b/sound/pci/hda/patch_sigmatel.c index 12b30884843..1882c573587 100644 --- a/sound/pci/hda/patch_sigmatel.c +++ b/sound/pci/hda/patch_sigmatel.c @@ -2546,7 +2546,7 @@ static int stac92xx_build_pcms(struct hda_codec *codec) codec->num_pcms++; info++; info->name = "STAC92xx Digital"; - info->pcm_type = spec->autocfg.dig_out_type; + info->pcm_type = spec->autocfg.dig_out_type[0]; if (spec->multiout.dig_out_nid) { info->stream[SNDRV_PCM_STREAM_PLAYBACK] = stac92xx_pcm_digital_playback; info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = spec->multiout.dig_out_nid; @@ -3706,7 +3706,7 @@ static int stac92xx_parse_auto_config(struct hda_codec *codec, hda_nid_t dig_out if (spec->multiout.max_channels > 2) spec->surr_switch = 1; - if (spec->autocfg.dig_out_pin) + if (spec->autocfg.dig_outs) spec->multiout.dig_out_nid = dig_out; if (dig_in && spec->autocfg.dig_in_pin) spec->dig_in_nid = dig_in; @@ -3819,7 +3819,7 @@ static int stac9200_parse_auto_config(struct hda_codec *codec) if (err < 0) return err; - if (spec->autocfg.dig_out_pin) + if (spec->autocfg.dig_outs) spec->multiout.dig_out_nid = 0x05; if (spec->autocfg.dig_in_pin) spec->dig_in_nid = 0x04; @@ -4069,8 +4069,8 @@ static int stac92xx_init(struct hda_codec *codec) for (i = 0; i < spec->num_dmics; i++) stac92xx_auto_set_pinctl(codec, spec->dmic_nids[i], AC_PINCTL_IN_EN); - if (cfg->dig_out_pin) - stac92xx_auto_set_pinctl(codec, cfg->dig_out_pin, + if (cfg->dig_out_pins[0]) + stac92xx_auto_set_pinctl(codec, cfg->dig_out_pins[0], AC_PINCTL_OUT_EN); if (cfg->dig_in_pin) stac92xx_auto_set_pinctl(codec, cfg->dig_in_pin, diff --git a/sound/pci/hda/patch_via.c b/sound/pci/hda/patch_via.c index c761394cbe8..639b2ff510a 100644 --- a/sound/pci/hda/patch_via.c +++ b/sound/pci/hda/patch_via.c @@ -1354,7 +1354,7 @@ static int vt1708_parse_auto_config(struct hda_codec *codec) spec->multiout.max_channels = spec->multiout.num_dacs * 2; - if (spec->autocfg.dig_out_pin) + if (spec->autocfg.dig_outs) spec->multiout.dig_out_nid = VT1708_DIGOUT_NID; if (spec->autocfg.dig_in_pin) spec->dig_in_nid = VT1708_DIGIN_NID; @@ -1827,7 +1827,7 @@ static int vt1709_parse_auto_config(struct hda_codec *codec) spec->multiout.max_channels = spec->multiout.num_dacs * 2; - if (spec->autocfg.dig_out_pin) + if (spec->autocfg.dig_outs) spec->multiout.dig_out_nid = VT1709_DIGOUT_NID; if (spec->autocfg.dig_in_pin) spec->dig_in_nid = VT1709_DIGIN_NID; @@ -2371,7 +2371,7 @@ static int vt1708B_parse_auto_config(struct hda_codec *codec) spec->multiout.max_channels = spec->multiout.num_dacs * 2; - if (spec->autocfg.dig_out_pin) + if (spec->autocfg.dig_outs) spec->multiout.dig_out_nid = VT1708B_DIGOUT_NID; if (spec->autocfg.dig_in_pin) spec->dig_in_nid = VT1708B_DIGIN_NID; @@ -2836,7 +2836,7 @@ static int vt1708S_parse_auto_config(struct hda_codec *codec) spec->multiout.max_channels = spec->multiout.num_dacs * 2; - if (spec->autocfg.dig_out_pin) + if (spec->autocfg.dig_outs) spec->multiout.dig_out_nid = VT1708S_DIGOUT_NID; spec->extra_dig_out_nid = 0x15; @@ -3155,7 +3155,7 @@ static int vt1702_parse_auto_config(struct hda_codec *codec) spec->multiout.max_channels = spec->multiout.num_dacs * 2; - if (spec->autocfg.dig_out_pin) + if (spec->autocfg.dig_outs) spec->multiout.dig_out_nid = VT1702_DIGOUT_NID; spec->extra_dig_out_nid = 0x1B; -- 2.20.1