aboutsummaryrefslogtreecommitdiffstats
path: root/sound/pci/hda
diff options
context:
space:
mode:
authorDavid Henningsson <david.henningsson@canonical.com>2010-11-23 04:23:40 -0500
committerTakashi Iwai <tiwai@suse.de>2010-12-08 03:13:43 -0500
commit116dcde638065a6b94344ca570e1e79c8e857826 (patch)
treecdd1ab0a24ed0eac0f8cb530223ff1f49a073187 /sound/pci/hda
parentd0fa15e0987bb5444244db111d485fb8819ceba5 (diff)
ALSA: HDA: Remove unconnected PCM devices for Intel HDMI
Some newer chips have more than one HDMI output, but usually not all of them are exposed as physical jacks. Removing the unused PCM devices (as indicated by BIOS in the pin config default) will reduce user confusion as they currently have to choose between several HDMI devices, some of them not working anyway. Signed-off-by: David Henningsson <david.henningsson@canonical.com> Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/pci/hda')
-rw-r--r--sound/pci/hda/patch_hdmi.c41
1 files changed, 32 insertions, 9 deletions
diff --git a/sound/pci/hda/patch_hdmi.c b/sound/pci/hda/patch_hdmi.c
index 8f07719ef985..d1b1b5796c98 100644
--- a/sound/pci/hda/patch_hdmi.c
+++ b/sound/pci/hda/patch_hdmi.c
@@ -904,23 +904,28 @@ static int hdmi_add_pin(struct hda_codec *codec, hda_nid_t pin_nid)
904 spec->pin[spec->num_pins] = pin_nid; 904 spec->pin[spec->num_pins] = pin_nid;
905 spec->num_pins++; 905 spec->num_pins++;
906 906
907 /*
908 * It is assumed that converter nodes come first in the node list and
909 * hence have been registered and usable now.
910 */
911 return hdmi_read_pin_conn(codec, pin_nid); 907 return hdmi_read_pin_conn(codec, pin_nid);
912} 908}
913 909
914static int hdmi_add_cvt(struct hda_codec *codec, hda_nid_t nid) 910static int hdmi_add_cvt(struct hda_codec *codec, hda_nid_t nid)
915{ 911{
912 int i, found_pin = 0;
916 struct hdmi_spec *spec = codec->spec; 913 struct hdmi_spec *spec = codec->spec;
917 914
918 if (spec->num_cvts >= MAX_HDMI_CVTS) { 915 for (i = 0; i < spec->num_pins; i++)
919 snd_printk(KERN_WARNING 916 if (nid == spec->pin_cvt[i]) {
920 "HDMI: no space for converter %d\n", nid); 917 found_pin = 1;
921 return -E2BIG; 918 break;
919 }
920
921 if (!found_pin) {
922 snd_printdd("HDMI: Skipping node %d (no connection)\n", nid);
923 return -EINVAL;
922 } 924 }
923 925
926 if (snd_BUG_ON(spec->num_cvts >= MAX_HDMI_CVTS))
927 return -E2BIG;
928
924 spec->cvt[spec->num_cvts] = nid; 929 spec->cvt[spec->num_cvts] = nid;
925 spec->num_cvts++; 930 spec->num_cvts++;
926 931
@@ -931,6 +936,8 @@ static int hdmi_parse_codec(struct hda_codec *codec)
931{ 936{
932 hda_nid_t nid; 937 hda_nid_t nid;
933 int i, nodes; 938 int i, nodes;
939 int num_tmp_cvts = 0;
940 hda_nid_t tmp_cvt[MAX_HDMI_CVTS];
934 941
935 nodes = snd_hda_get_sub_nodes(codec, codec->afg, &nid); 942 nodes = snd_hda_get_sub_nodes(codec, codec->afg, &nid);
936 if (!nid || nodes < 0) { 943 if (!nid || nodes < 0) {
@@ -941,6 +948,7 @@ static int hdmi_parse_codec(struct hda_codec *codec)
941 for (i = 0; i < nodes; i++, nid++) { 948 for (i = 0; i < nodes; i++, nid++) {
942 unsigned int caps; 949 unsigned int caps;
943 unsigned int type; 950 unsigned int type;
951 unsigned int config;
944 952
945 caps = snd_hda_param_read(codec, nid, AC_PAR_AUDIO_WIDGET_CAP); 953 caps = snd_hda_param_read(codec, nid, AC_PAR_AUDIO_WIDGET_CAP);
946 type = get_wcaps_type(caps); 954 type = get_wcaps_type(caps);
@@ -950,17 +958,32 @@ static int hdmi_parse_codec(struct hda_codec *codec)
950 958
951 switch (type) { 959 switch (type) {
952 case AC_WID_AUD_OUT: 960 case AC_WID_AUD_OUT:
953 hdmi_add_cvt(codec, nid); 961 if (num_tmp_cvts >= MAX_HDMI_CVTS) {
962 snd_printk(KERN_WARNING
963 "HDMI: no space for converter %d\n", nid);
964 continue;
965 }
966 tmp_cvt[num_tmp_cvts] = nid;
967 num_tmp_cvts++;
954 break; 968 break;
955 case AC_WID_PIN: 969 case AC_WID_PIN:
956 caps = snd_hda_param_read(codec, nid, AC_PAR_PIN_CAP); 970 caps = snd_hda_param_read(codec, nid, AC_PAR_PIN_CAP);
957 if (!(caps & (AC_PINCAP_HDMI | AC_PINCAP_DP))) 971 if (!(caps & (AC_PINCAP_HDMI | AC_PINCAP_DP)))
958 continue; 972 continue;
973
974 config = snd_hda_codec_read(codec, nid, 0,
975 AC_VERB_GET_CONFIG_DEFAULT, 0);
976 if (get_defcfg_connect(config) == AC_JACK_PORT_NONE)
977 continue;
978
959 hdmi_add_pin(codec, nid); 979 hdmi_add_pin(codec, nid);
960 break; 980 break;
961 } 981 }
962 } 982 }
963 983
984 for (i = 0; i < num_tmp_cvts; i++)
985 hdmi_add_cvt(codec, tmp_cvt[i]);
986
964 /* 987 /*
965 * G45/IbexPeak don't support EPSS: the unsolicited pin hot plug event 988 * G45/IbexPeak don't support EPSS: the unsolicited pin hot plug event
966 * can be lost and presence sense verb will become inaccurate if the 989 * can be lost and presence sense verb will become inaccurate if the