Commit 0852d7a6 authored by Takashi Iwai's avatar Takashi Iwai

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: default avatarTakashi Iwai <tiwai@suse.de>
parent 32d2c7fa
...@@ -3423,11 +3423,13 @@ int snd_hda_parse_pin_def_config(struct hda_codec *codec, ...@@ -3423,11 +3423,13 @@ int snd_hda_parse_pin_def_config(struct hda_codec *codec,
break; break;
case AC_JACK_SPDIF_OUT: case AC_JACK_SPDIF_OUT:
case AC_JACK_DIG_OTHER_OUT: case AC_JACK_DIG_OTHER_OUT:
cfg->dig_out_pin = nid; if (cfg->dig_outs >= ARRAY_SIZE(cfg->dig_out_pins))
if (loc == AC_JACK_LOC_HDMI) continue;
cfg->dig_out_type = HDA_PCM_TYPE_HDMI; cfg->dig_out_pins[cfg->dig_outs] = nid;
else cfg->dig_out_type[cfg->dig_outs] =
cfg->dig_out_type = HDA_PCM_TYPE_SPDIF; (loc == AC_JACK_LOC_HDMI) ?
HDA_PCM_TYPE_HDMI : HDA_PCM_TYPE_SPDIF;
cfg->dig_outs++;
break; break;
case AC_JACK_SPDIF_IN: case AC_JACK_SPDIF_IN:
case AC_JACK_DIG_OTHER_IN: case AC_JACK_DIG_OTHER_IN:
...@@ -3541,8 +3543,9 @@ int snd_hda_parse_pin_def_config(struct hda_codec *codec, ...@@ -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[1], cfg->hp_pins[2],
cfg->hp_pins[3], cfg->hp_pins[4]); cfg->hp_pins[3], cfg->hp_pins[4]);
snd_printd(" mono: mono_out=0x%x\n", cfg->mono_out_pin); snd_printd(" mono: mono_out=0x%x\n", cfg->mono_out_pin);
if (cfg->dig_out_pin) if (cfg->dig_outs)
snd_printd(" dig-out=0x%x\n", cfg->dig_out_pin); 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," snd_printd(" inputs: mic=0x%x, fmic=0x%x, line=0x%x, fline=0x%x,"
" cd=0x%x, aux=0x%x\n", " cd=0x%x, aux=0x%x\n",
cfg->input_pins[AUTO_PIN_MIC], cfg->input_pins[AUTO_PIN_MIC],
......
...@@ -355,10 +355,11 @@ struct auto_pin_cfg { ...@@ -355,10 +355,11 @@ struct auto_pin_cfg {
int line_out_type; /* AUTO_PIN_XXX_OUT */ int line_out_type; /* AUTO_PIN_XXX_OUT */
hda_nid_t hp_pins[AUTO_CFG_MAX_OUTS]; hda_nid_t hp_pins[AUTO_CFG_MAX_OUTS];
hda_nid_t input_pins[AUTO_PIN_LAST]; 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 dig_in_pin;
hda_nid_t mono_out_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 */ int dig_in_type; /* HDA_PCM_TYPE_XXX */
}; };
......
...@@ -2898,7 +2898,7 @@ static int ad1988_parse_auto_config(struct hda_codec *codec) ...@@ -2898,7 +2898,7 @@ static int ad1988_parse_auto_config(struct hda_codec *codec)
spec->multiout.max_channels = spec->multiout.num_dacs * 2; 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; spec->multiout.dig_out_nid = AD1988_SPDIF_OUT;
if (spec->autocfg.dig_in_pin) if (spec->autocfg.dig_in_pin)
spec->dig_in_nid = AD1988_SPDIF_IN; spec->dig_in_nid = AD1988_SPDIF_IN;
......
...@@ -4291,7 +4291,7 @@ static int alc880_parse_auto_config(struct hda_codec *codec) ...@@ -4291,7 +4291,7 @@ static int alc880_parse_auto_config(struct hda_codec *codec)
spec->multiout.max_channels = spec->multiout.num_dacs * 2; 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; spec->multiout.dig_out_nid = ALC880_DIGOUT_NID;
if (spec->autocfg.dig_in_pin) if (spec->autocfg.dig_in_pin)
spec->dig_in_nid = ALC880_DIGIN_NID; spec->dig_in_nid = ALC880_DIGIN_NID;
...@@ -5658,7 +5658,7 @@ static int alc260_parse_auto_config(struct hda_codec *codec) ...@@ -5658,7 +5658,7 @@ static int alc260_parse_auto_config(struct hda_codec *codec)
spec->multiout.max_channels = 2; spec->multiout.max_channels = 2;
if (spec->autocfg.dig_out_pin) if (spec->autocfg.dig_outs)
spec->multiout.dig_out_nid = ALC260_DIGOUT_NID; spec->multiout.dig_out_nid = ALC260_DIGOUT_NID;
if (spec->kctls.list) if (spec->kctls.list)
add_mixer(spec, spec->kctls.list); add_mixer(spec, spec->kctls.list);
...@@ -10626,7 +10626,7 @@ static int alc262_parse_auto_config(struct hda_codec *codec) ...@@ -10626,7 +10626,7 @@ static int alc262_parse_auto_config(struct hda_codec *codec)
if (err < 0) if (err < 0)
return err; return err;
if (!spec->autocfg.line_outs) { 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->multiout.max_channels = 2;
spec->no_analog = 1; spec->no_analog = 1;
goto dig_only; goto dig_only;
...@@ -10643,9 +10643,9 @@ static int alc262_parse_auto_config(struct hda_codec *codec) ...@@ -10643,9 +10643,9 @@ static int alc262_parse_auto_config(struct hda_codec *codec)
spec->multiout.max_channels = spec->multiout.num_dacs * 2; spec->multiout.max_channels = spec->multiout.num_dacs * 2;
dig_only: dig_only:
if (spec->autocfg.dig_out_pin) { if (spec->autocfg.dig_outs) {
spec->multiout.dig_out_nid = ALC262_DIGOUT_NID; 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) if (spec->autocfg.dig_in_pin)
spec->dig_in_nid = ALC262_DIGIN_NID; spec->dig_in_nid = ALC262_DIGIN_NID;
...@@ -11807,7 +11807,7 @@ static int alc268_parse_auto_config(struct hda_codec *codec) ...@@ -11807,7 +11807,7 @@ static int alc268_parse_auto_config(struct hda_codec *codec)
spec->multiout.max_channels = 2; spec->multiout.max_channels = 2;
/* digital only support output */ /* digital only support output */
if (spec->autocfg.dig_out_pin) if (spec->autocfg.dig_outs)
spec->multiout.dig_out_nid = ALC268_DIGOUT_NID; spec->multiout.dig_out_nid = ALC268_DIGOUT_NID;
if (spec->kctls.list) if (spec->kctls.list)
...@@ -12722,7 +12722,7 @@ static int alc269_parse_auto_config(struct hda_codec *codec) ...@@ -12722,7 +12722,7 @@ static int alc269_parse_auto_config(struct hda_codec *codec)
spec->multiout.max_channels = spec->multiout.num_dacs * 2; 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; spec->multiout.dig_out_nid = ALC269_DIGOUT_NID;
if (spec->kctls.list) if (spec->kctls.list)
...@@ -13779,7 +13779,7 @@ static int alc861_parse_auto_config(struct hda_codec *codec) ...@@ -13779,7 +13779,7 @@ static int alc861_parse_auto_config(struct hda_codec *codec)
spec->multiout.max_channels = spec->multiout.num_dacs * 2; 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; spec->multiout.dig_out_nid = ALC861_DIGOUT_NID;
if (spec->kctls.list) if (spec->kctls.list)
...@@ -14881,7 +14881,7 @@ static int alc861vd_parse_auto_config(struct hda_codec *codec) ...@@ -14881,7 +14881,7 @@ static int alc861vd_parse_auto_config(struct hda_codec *codec)
spec->multiout.max_channels = spec->multiout.num_dacs * 2; 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; spec->multiout.dig_out_nid = ALC861VD_DIGOUT_NID;
if (spec->kctls.list) if (spec->kctls.list)
...@@ -16689,7 +16689,7 @@ static int alc662_parse_auto_config(struct hda_codec *codec) ...@@ -16689,7 +16689,7 @@ static int alc662_parse_auto_config(struct hda_codec *codec)
spec->multiout.max_channels = spec->multiout.num_dacs * 2; 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; spec->multiout.dig_out_nid = ALC880_DIGOUT_NID;
if (spec->kctls.list) if (spec->kctls.list)
......
...@@ -2546,7 +2546,7 @@ static int stac92xx_build_pcms(struct hda_codec *codec) ...@@ -2546,7 +2546,7 @@ static int stac92xx_build_pcms(struct hda_codec *codec)
codec->num_pcms++; codec->num_pcms++;
info++; info++;
info->name = "STAC92xx Digital"; 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) { if (spec->multiout.dig_out_nid) {
info->stream[SNDRV_PCM_STREAM_PLAYBACK] = stac92xx_pcm_digital_playback; info->stream[SNDRV_PCM_STREAM_PLAYBACK] = stac92xx_pcm_digital_playback;
info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = spec->multiout.dig_out_nid; 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 ...@@ -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) if (spec->multiout.max_channels > 2)
spec->surr_switch = 1; spec->surr_switch = 1;
if (spec->autocfg.dig_out_pin) if (spec->autocfg.dig_outs)
spec->multiout.dig_out_nid = dig_out; spec->multiout.dig_out_nid = dig_out;
if (dig_in && spec->autocfg.dig_in_pin) if (dig_in && spec->autocfg.dig_in_pin)
spec->dig_in_nid = dig_in; spec->dig_in_nid = dig_in;
...@@ -3819,7 +3819,7 @@ static int stac9200_parse_auto_config(struct hda_codec *codec) ...@@ -3819,7 +3819,7 @@ static int stac9200_parse_auto_config(struct hda_codec *codec)
if (err < 0) if (err < 0)
return err; return err;
if (spec->autocfg.dig_out_pin) if (spec->autocfg.dig_outs)
spec->multiout.dig_out_nid = 0x05; spec->multiout.dig_out_nid = 0x05;
if (spec->autocfg.dig_in_pin) if (spec->autocfg.dig_in_pin)
spec->dig_in_nid = 0x04; spec->dig_in_nid = 0x04;
...@@ -4069,8 +4069,8 @@ static int stac92xx_init(struct hda_codec *codec) ...@@ -4069,8 +4069,8 @@ static int stac92xx_init(struct hda_codec *codec)
for (i = 0; i < spec->num_dmics; i++) for (i = 0; i < spec->num_dmics; i++)
stac92xx_auto_set_pinctl(codec, spec->dmic_nids[i], stac92xx_auto_set_pinctl(codec, spec->dmic_nids[i],
AC_PINCTL_IN_EN); AC_PINCTL_IN_EN);
if (cfg->dig_out_pin) if (cfg->dig_out_pins[0])
stac92xx_auto_set_pinctl(codec, cfg->dig_out_pin, stac92xx_auto_set_pinctl(codec, cfg->dig_out_pins[0],
AC_PINCTL_OUT_EN); AC_PINCTL_OUT_EN);
if (cfg->dig_in_pin) if (cfg->dig_in_pin)
stac92xx_auto_set_pinctl(codec, cfg->dig_in_pin, stac92xx_auto_set_pinctl(codec, cfg->dig_in_pin,
......
...@@ -1354,7 +1354,7 @@ static int vt1708_parse_auto_config(struct hda_codec *codec) ...@@ -1354,7 +1354,7 @@ static int vt1708_parse_auto_config(struct hda_codec *codec)
spec->multiout.max_channels = spec->multiout.num_dacs * 2; 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; spec->multiout.dig_out_nid = VT1708_DIGOUT_NID;
if (spec->autocfg.dig_in_pin) if (spec->autocfg.dig_in_pin)
spec->dig_in_nid = VT1708_DIGIN_NID; spec->dig_in_nid = VT1708_DIGIN_NID;
...@@ -1827,7 +1827,7 @@ static int vt1709_parse_auto_config(struct hda_codec *codec) ...@@ -1827,7 +1827,7 @@ static int vt1709_parse_auto_config(struct hda_codec *codec)
spec->multiout.max_channels = spec->multiout.num_dacs * 2; 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; spec->multiout.dig_out_nid = VT1709_DIGOUT_NID;
if (spec->autocfg.dig_in_pin) if (spec->autocfg.dig_in_pin)
spec->dig_in_nid = VT1709_DIGIN_NID; spec->dig_in_nid = VT1709_DIGIN_NID;
...@@ -2371,7 +2371,7 @@ static int vt1708B_parse_auto_config(struct hda_codec *codec) ...@@ -2371,7 +2371,7 @@ static int vt1708B_parse_auto_config(struct hda_codec *codec)
spec->multiout.max_channels = spec->multiout.num_dacs * 2; 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; spec->multiout.dig_out_nid = VT1708B_DIGOUT_NID;
if (spec->autocfg.dig_in_pin) if (spec->autocfg.dig_in_pin)
spec->dig_in_nid = VT1708B_DIGIN_NID; spec->dig_in_nid = VT1708B_DIGIN_NID;
...@@ -2836,7 +2836,7 @@ static int vt1708S_parse_auto_config(struct hda_codec *codec) ...@@ -2836,7 +2836,7 @@ static int vt1708S_parse_auto_config(struct hda_codec *codec)
spec->multiout.max_channels = spec->multiout.num_dacs * 2; 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->multiout.dig_out_nid = VT1708S_DIGOUT_NID;
spec->extra_dig_out_nid = 0x15; spec->extra_dig_out_nid = 0x15;
...@@ -3155,7 +3155,7 @@ static int vt1702_parse_auto_config(struct hda_codec *codec) ...@@ -3155,7 +3155,7 @@ static int vt1702_parse_auto_config(struct hda_codec *codec)
spec->multiout.max_channels = spec->multiout.num_dacs * 2; 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->multiout.dig_out_nid = VT1702_DIGOUT_NID;
spec->extra_dig_out_nid = 0x1B; spec->extra_dig_out_nid = 0x1B;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment