tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: 4c7d00ccf40db99bfb7bd1857bcbf007275704d8
commit: aa2b4a59871a0528bccb91ad94768c9dc2b7bb3d ASoC: Intel: boards: fix incorrect HDMI Kconfig dependency
date: 7 weeks ago
config: i386-randconfig-e003-20200206 (attached as .config)
compiler: gcc-7 (Debian 7.5.0-3) 7.5.0
reproduce:
git checkout aa2b4a59871a0528bccb91ad94768c9dc2b7bb3d
# save the attached .config to linux build tree
make ARCH=i386
If you fix the issue, kindly add following tag
Reported-by: kbuild test robot <[email protected]>
All errors (new ones prefixed by >>):
ld: sound/pci/hda/patch_hdmi.o: in function `intel_not_share_assigned_cvt':
>> sound/pci/hda/patch_hdmi.c:1086: undefined reference to `snd_hda_get_num_devices'
>> ld: sound/pci/hda/patch_hdmi.c:1098: undefined reference to `snd_hda_get_dev_select'
>> ld: sound/pci/hda/patch_hdmi.c:1099: undefined reference to `snd_hda_set_dev_select'
ld: sound/pci/hda/patch_hdmi.c:1123: undefined reference to `snd_hda_set_dev_select'
ld: sound/pci/hda/patch_hdmi.o: in function `check_non_pcm_per_cvt':
>> sound/pci/hda/patch_hdmi.c:1894: undefined reference to `snd_hda_spdif_out_of_nid'
ld: sound/pci/hda/patch_hdmi.o: in function `reprogram_jack_detect':
>> sound/pci/hda/patch_hdmi.c:2490: undefined reference to `snd_hda_jack_tbl_get_mst'
>> ld: sound/pci/hda/patch_hdmi.c:2503: undefined reference to `snd_hda_jack_detect_enable'
ld: sound/pci/hda/patch_hdmi.o: in function `generic_hdmi_build_pcms':
>> sound/pci/hda/patch_hdmi.c:2144: undefined reference to `snd_hda_codec_pcm_new'
ld: sound/pci/hda/patch_hdmi.o: in function `generic_hdmi_playback_pcm_cleanup':
>> sound/pci/hda/patch_hdmi.c:1996: undefined reference to `__snd_hda_codec_cleanup_stream'
ld: sound/pci/hda/patch_hdmi.o: in function `generic_hdmi_build_jack':
>> sound/pci/hda/patch_hdmi.c:2213: undefined reference to `is_jack_detectable'
>> ld: sound/pci/hda/patch_hdmi.c:2217: undefined reference to `snd_hda_jack_add_kctl_mst'
>> ld: sound/pci/hda/patch_hdmi.c:2222: undefined reference to `snd_hda_jack_tbl_get_mst'
ld: sound/pci/hda/patch_hdmi.o: in function `hdmi_pin_get_eld':
>> sound/pci/hda/patch_hdmi.c:646: undefined reference to `snd_hda_set_dev_select'
ld: sound/pci/hda/patch_hdmi.o: in function `intel_haswell_enable_all_pins':
>> sound/pci/hda/patch_hdmi.c:2640: undefined reference to `snd_hda_codec_update_widgets'
ld: sound/pci/hda/patch_hdmi.o: in function `simple_hdmi_unsol_event':
>> sound/pci/hda/patch_hdmi.c:2978: undefined reference to `snd_hda_jack_set_dirty_all'
>> ld: sound/pci/hda/patch_hdmi.c:2979: undefined reference to `snd_hda_jack_report_sync'
ld: sound/pci/hda/patch_hdmi.o: in function `simple_playback_pcm_prepare':
>> sound/pci/hda/patch_hdmi.c:3159: undefined reference to `snd_hda_multi_out_dig_prepare'
ld: sound/pci/hda/patch_hdmi.o: in function `simple_playback_pcm_close':
>> sound/pci/hda/patch_hdmi.c:3149: undefined reference to `snd_hda_multi_out_dig_close'
ld: sound/pci/hda/patch_hdmi.o: in function `simple_playback_pcm_open':
>> sound/pci/hda/patch_hdmi.c:3141: undefined reference to `snd_hda_multi_out_dig_open'
ld: sound/pci/hda/patch_hdmi.o: in function `nvhdmi_7x_init_8ch':
>> sound/pci/hda/patch_hdmi.c:3087: undefined reference to `snd_hda_sequence_write'
ld: sound/pci/hda/patch_hdmi.o: in function `nvhdmi_7x_init_2ch':
sound/pci/hda/patch_hdmi.c:3081: undefined reference to `snd_hda_sequence_write'
ld: sound/pci/hda/patch_hdmi.o: in function `hdmi_pcm_open':
sound/pci/hda/patch_hdmi.c:1257: undefined reference to `snd_hda_set_dev_select'
>> ld: sound/pci/hda/patch_hdmi.c:1265: undefined reference to `snd_hda_spdif_ctls_assign'
vim +1086 sound/pci/hda/patch_hdmi.c
307229d2ac5f604 Anssi Hannula 2013-10-24 921
307229d2ac5f604 Anssi Hannula 2013-10-24 922 static int hdmi_setup_stream(struct hda_codec *codec, hda_nid_t cvt_nid,
9c32fea836928d7 Nikhil Mahale 2019-11-19 923 hda_nid_t pin_nid, int dev_id,
9c32fea836928d7 Nikhil Mahale 2019-11-19 924 u32 stream_tag, int format)
307229d2ac5f604 Anssi Hannula 2013-10-24 925 {
307229d2ac5f604 Anssi Hannula 2013-10-24 926 struct hdmi_spec *spec = codec->spec;
5a5d718f952b55e Sriram Periyasamy 2017-09-19 927 unsigned int param;
307229d2ac5f604 Anssi Hannula 2013-10-24 928 int err;
307229d2ac5f604 Anssi Hannula 2013-10-24 929
9c32fea836928d7 Nikhil Mahale 2019-11-19 930 err = spec->ops.pin_hbr_setup(codec, pin_nid, dev_id,
9c32fea836928d7 Nikhil Mahale 2019-11-19 931 is_hbr_format(format));
307229d2ac5f604 Anssi Hannula 2013-10-24 932
307229d2ac5f604 Anssi Hannula 2013-10-24 933 if (err) {
4e76a8833fac8dc Takashi Iwai 2014-02-25 934 codec_dbg(codec, "hdmi_setup_stream: HBR is not supported\n");
307229d2ac5f604 Anssi Hannula 2013-10-24 935 return err;
ea87d1c493aba9c Anssi Hannula 2010-08-03 936 }
079d88ccc374d2c Wu Fengguang 2010-03-08 937
cb45722b289b544 Takashi Iwai 2019-11-11 938 if (spec->intel_hsw_fixup) {
5a5d718f952b55e Sriram Periyasamy 2017-09-19 939
5a5d718f952b55e Sriram Periyasamy 2017-09-19 940 /*
5a5d718f952b55e Sriram Periyasamy 2017-09-19 941 * on recent platforms IEC Coding Type is required for HBR
5a5d718f952b55e Sriram Periyasamy 2017-09-19 942 * support, read current Digital Converter settings and set
5a5d718f952b55e Sriram Periyasamy 2017-09-19 943 * ICT bitfield if needed.
5a5d718f952b55e Sriram Periyasamy 2017-09-19 944 */
5a5d718f952b55e Sriram Periyasamy 2017-09-19 945 param = snd_hda_codec_read(codec, cvt_nid, 0,
5a5d718f952b55e Sriram Periyasamy 2017-09-19 946 AC_VERB_GET_DIGI_CONVERT_1, 0);
5a5d718f952b55e Sriram Periyasamy 2017-09-19 947
5a5d718f952b55e Sriram Periyasamy 2017-09-19 948 param = (param >> 16) & ~(AC_DIG3_ICT);
5a5d718f952b55e Sriram Periyasamy 2017-09-19 949
5a5d718f952b55e Sriram Periyasamy 2017-09-19 950 /* on recent platforms ICT mode is required for HBR support */
5a5d718f952b55e Sriram Periyasamy 2017-09-19 951 if (is_hbr_format(format))
5a5d718f952b55e Sriram Periyasamy 2017-09-19 952 param |= 0x1;
5a5d718f952b55e Sriram Periyasamy 2017-09-19 953
5a5d718f952b55e Sriram Periyasamy 2017-09-19 954 snd_hda_codec_write(codec, cvt_nid, 0,
5a5d718f952b55e Sriram Periyasamy 2017-09-19 955 AC_VERB_SET_DIGI_CONVERT_3, param);
5a5d718f952b55e Sriram Periyasamy 2017-09-19 956 }
5a5d718f952b55e Sriram Periyasamy 2017-09-19 957
384a48d71520ca5 Stephen Warren 2011-06-01 @958 snd_hda_codec_setup_stream(codec, cvt_nid, stream_tag, 0, format);
ea87d1c493aba9c Anssi Hannula 2010-08-03 959 return 0;
079d88ccc374d2c Wu Fengguang 2010-03-08 960 }
079d88ccc374d2c Wu Fengguang 2010-03-08 961
42b2987079eca02 Libin Yang 2015-12-16 962 /* Try to find an available converter
42b2987079eca02 Libin Yang 2015-12-16 963 * If pin_idx is less then zero, just try to find an available converter.
42b2987079eca02 Libin Yang 2015-12-16 964 * Otherwise, try to find an available converter and get the cvt mux index
42b2987079eca02 Libin Yang 2015-12-16 965 * of the pin.
42b2987079eca02 Libin Yang 2015-12-16 966 */
7ef166b831237e6 Wang Xingchao 2013-06-18 967 static int hdmi_choose_cvt(struct hda_codec *codec,
4846a67eb5a1d7c Takashi Iwai 2016-03-21 968 int pin_idx, int *cvt_id)
bbbe33900d1f3c4 Takashi Iwai 2010-08-13 969 {
bbbe33900d1f3c4 Takashi Iwai 2010-08-13 970 struct hdmi_spec *spec = codec->spec;
384a48d71520ca5 Stephen Warren 2011-06-01 971 struct hdmi_spec_per_pin *per_pin;
384a48d71520ca5 Stephen Warren 2011-06-01 972 struct hdmi_spec_per_cvt *per_cvt = NULL;
7ef166b831237e6 Wang Xingchao 2013-06-18 973 int cvt_idx, mux_idx = 0;
bbbe33900d1f3c4 Takashi Iwai 2010-08-13 974
42b2987079eca02 Libin Yang 2015-12-16 975 /* pin_idx < 0 means no pin will be bound to the converter */
42b2987079eca02 Libin Yang 2015-12-16 976 if (pin_idx < 0)
42b2987079eca02 Libin Yang 2015-12-16 977 per_pin = NULL;
42b2987079eca02 Libin Yang 2015-12-16 978 else
bce0d2a80e428aa Takashi Iwai 2013-03-13 979 per_pin = get_pin(spec, pin_idx);
384a48d71520ca5 Stephen Warren 2011-06-01 980
384a48d71520ca5 Stephen Warren 2011-06-01 981 /* Dynamically assign converter to stream */
384a48d71520ca5 Stephen Warren 2011-06-01 982 for (cvt_idx = 0; cvt_idx < spec->num_cvts; cvt_idx++) {
bce0d2a80e428aa Takashi Iwai 2013-03-13 983 per_cvt = get_cvt(spec, cvt_idx);
384a48d71520ca5 Stephen Warren 2011-06-01 984
384a48d71520ca5 Stephen Warren 2011-06-01 985 /* Must not already be assigned */
384a48d71520ca5 Stephen Warren 2011-06-01 986 if (per_cvt->assigned)
384a48d71520ca5 Stephen Warren 2011-06-01 987 continue;
42b2987079eca02 Libin Yang 2015-12-16 988 if (per_pin == NULL)
42b2987079eca02 Libin Yang 2015-12-16 989 break;
384a48d71520ca5 Stephen Warren 2011-06-01 990 /* Must be in pin's mux's list of converters */
384a48d71520ca5 Stephen Warren 2011-06-01 991 for (mux_idx = 0; mux_idx < per_pin->num_mux_nids; mux_idx++)
384a48d71520ca5 Stephen Warren 2011-06-01 992 if (per_pin->mux_nids[mux_idx] == per_cvt->cvt_nid)
384a48d71520ca5 Stephen Warren 2011-06-01 993 break;
384a48d71520ca5 Stephen Warren 2011-06-01 994 /* Not in mux list */
384a48d71520ca5 Stephen Warren 2011-06-01 995 if (mux_idx == per_pin->num_mux_nids)
384a48d71520ca5 Stephen Warren 2011-06-01 996 continue;
384a48d71520ca5 Stephen Warren 2011-06-01 997 break;
384a48d71520ca5 Stephen Warren 2011-06-01 998 }
7ef166b831237e6 Wang Xingchao 2013-06-18 999
384a48d71520ca5 Stephen Warren 2011-06-01 1000 /* No free converters */
384a48d71520ca5 Stephen Warren 2011-06-01 1001 if (cvt_idx == spec->num_cvts)
42b2987079eca02 Libin Yang 2015-12-16 1002 return -EBUSY;
bbbe33900d1f3c4 Takashi Iwai 2010-08-13 1003
42b2987079eca02 Libin Yang 2015-12-16 1004 if (per_pin != NULL)
2df6742f613840a Mengdong Lin 2014-03-20 1005 per_pin->mux_idx = mux_idx;
2df6742f613840a Mengdong Lin 2014-03-20 1006
7ef166b831237e6 Wang Xingchao 2013-06-18 1007 if (cvt_id)
7ef166b831237e6 Wang Xingchao 2013-06-18 1008 *cvt_id = cvt_idx;
7ef166b831237e6 Wang Xingchao 2013-06-18 1009
7ef166b831237e6 Wang Xingchao 2013-06-18 1010 return 0;
7ef166b831237e6 Wang Xingchao 2013-06-18 1011 }
7ef166b831237e6 Wang Xingchao 2013-06-18 1012
2df6742f613840a Mengdong Lin 2014-03-20 1013 /* Assure the pin select the right convetor */
2df6742f613840a Mengdong Lin 2014-03-20 1014 static void intel_verify_pin_cvt_connect(struct hda_codec *codec,
2df6742f613840a Mengdong Lin 2014-03-20 1015 struct hdmi_spec_per_pin *per_pin)
2df6742f613840a Mengdong Lin 2014-03-20 1016 {
2df6742f613840a Mengdong Lin 2014-03-20 1017 hda_nid_t pin_nid = per_pin->pin_nid;
2df6742f613840a Mengdong Lin 2014-03-20 1018 int mux_idx, curr;
2df6742f613840a Mengdong Lin 2014-03-20 1019
2df6742f613840a Mengdong Lin 2014-03-20 1020 mux_idx = per_pin->mux_idx;
2df6742f613840a Mengdong Lin 2014-03-20 1021 curr = snd_hda_codec_read(codec, pin_nid, 0,
2df6742f613840a Mengdong Lin 2014-03-20 1022 AC_VERB_GET_CONNECT_SEL, 0);
2df6742f613840a Mengdong Lin 2014-03-20 1023 if (curr != mux_idx)
2df6742f613840a Mengdong Lin 2014-03-20 1024 snd_hda_codec_write_cache(codec, pin_nid, 0,
2df6742f613840a Mengdong Lin 2014-03-20 1025 AC_VERB_SET_CONNECT_SEL,
2df6742f613840a Mengdong Lin 2014-03-20 1026 mux_idx);
2df6742f613840a Mengdong Lin 2014-03-20 1027 }
2df6742f613840a Mengdong Lin 2014-03-20 1028
42b2987079eca02 Libin Yang 2015-12-16 1029 /* get the mux index for the converter of the pins
42b2987079eca02 Libin Yang 2015-12-16 1030 * converter's mux index is the same for all pins on Intel platform
42b2987079eca02 Libin Yang 2015-12-16 1031 */
42b2987079eca02 Libin Yang 2015-12-16 1032 static int intel_cvt_id_to_mux_idx(struct hdmi_spec *spec,
42b2987079eca02 Libin Yang 2015-12-16 1033 hda_nid_t cvt_nid)
42b2987079eca02 Libin Yang 2015-12-16 1034 {
42b2987079eca02 Libin Yang 2015-12-16 1035 int i;
42b2987079eca02 Libin Yang 2015-12-16 1036
42b2987079eca02 Libin Yang 2015-12-16 1037 for (i = 0; i < spec->num_cvts; i++)
42b2987079eca02 Libin Yang 2015-12-16 1038 if (spec->cvt_nids[i] == cvt_nid)
42b2987079eca02 Libin Yang 2015-12-16 1039 return i;
42b2987079eca02 Libin Yang 2015-12-16 1040 return -EINVAL;
42b2987079eca02 Libin Yang 2015-12-16 1041 }
42b2987079eca02 Libin Yang 2015-12-16 1042
300016b960661b4 Mengdong Lin 2013-11-04 1043 /* Intel HDMI workaround to fix audio routing issue:
300016b960661b4 Mengdong Lin 2013-11-04 1044 * For some Intel display codecs, pins share the same connection list.
300016b960661b4 Mengdong Lin 2013-11-04 1045 * So a conveter can be selected by multiple pins and playback on any of these
300016b960661b4 Mengdong Lin 2013-11-04 1046 * pins will generate sound on the external display, because audio flows from
300016b960661b4 Mengdong Lin 2013-11-04 1047 * the same converter to the display pipeline. Also muting one pin may make
300016b960661b4 Mengdong Lin 2013-11-04 1048 * other pins have no sound output.
300016b960661b4 Mengdong Lin 2013-11-04 1049 * So this function assures that an assigned converter for a pin is not selected
300016b960661b4 Mengdong Lin 2013-11-04 1050 * by any other pins.
300016b960661b4 Mengdong Lin 2013-11-04 1051 */
300016b960661b4 Mengdong Lin 2013-11-04 1052 static void intel_not_share_assigned_cvt(struct hda_codec *codec,
9152085defb6426 Libin Yang 2017-01-12 1053 hda_nid_t pin_nid,
9152085defb6426 Libin Yang 2017-01-12 1054 int dev_id, int mux_idx)
7ef166b831237e6 Wang Xingchao 2013-06-18 1055 {
7ef166b831237e6 Wang Xingchao 2013-06-18 1056 struct hdmi_spec *spec = codec->spec;
7639a06c23c7d4c Takashi Iwai 2015-03-03 1057 hda_nid_t nid;
f82d7d16aee5eb4 Mengdong Lin 2013-09-21 1058 int cvt_idx, curr;
f82d7d16aee5eb4 Mengdong Lin 2013-09-21 1059 struct hdmi_spec_per_cvt *per_cvt;
9152085defb6426 Libin Yang 2017-01-12 1060 struct hdmi_spec_per_pin *per_pin;
9152085defb6426 Libin Yang 2017-01-12 1061 int pin_idx;
9152085defb6426 Libin Yang 2017-01-12 1062
9152085defb6426 Libin Yang 2017-01-12 1063 /* configure the pins connections */
9152085defb6426 Libin Yang 2017-01-12 1064 for (pin_idx = 0; pin_idx < spec->num_pins; pin_idx++) {
9152085defb6426 Libin Yang 2017-01-12 1065 int dev_id_saved;
9152085defb6426 Libin Yang 2017-01-12 1066 int dev_num;
7ef166b831237e6 Wang Xingchao 2013-06-18 1067
9152085defb6426 Libin Yang 2017-01-12 1068 per_pin = get_pin(spec, pin_idx);
9152085defb6426 Libin Yang 2017-01-12 1069 /*
9152085defb6426 Libin Yang 2017-01-12 1070 * pin not connected to monitor
9152085defb6426 Libin Yang 2017-01-12 1071 * no need to operate on it
9152085defb6426 Libin Yang 2017-01-12 1072 */
9152085defb6426 Libin Yang 2017-01-12 1073 if (!per_pin->pcm)
9152085defb6426 Libin Yang 2017-01-12 1074 continue;
f82d7d16aee5eb4 Mengdong Lin 2013-09-21 1075
9152085defb6426 Libin Yang 2017-01-12 1076 if ((per_pin->pin_nid == pin_nid) &&
9152085defb6426 Libin Yang 2017-01-12 1077 (per_pin->dev_id == dev_id))
f82d7d16aee5eb4 Mengdong Lin 2013-09-21 1078 continue;
7ef166b831237e6 Wang Xingchao 2013-06-18 1079
9152085defb6426 Libin Yang 2017-01-12 1080 /*
9152085defb6426 Libin Yang 2017-01-12 1081 * if per_pin->dev_id >= dev_num,
9152085defb6426 Libin Yang 2017-01-12 1082 * snd_hda_get_dev_select() will fail,
9152085defb6426 Libin Yang 2017-01-12 1083 * and the following operation is unpredictable.
9152085defb6426 Libin Yang 2017-01-12 1084 * So skip this situation.
9152085defb6426 Libin Yang 2017-01-12 1085 */
9152085defb6426 Libin Yang 2017-01-12 @1086 dev_num = snd_hda_get_num_devices(codec, per_pin->pin_nid) + 1;
9152085defb6426 Libin Yang 2017-01-12 1087 if (per_pin->dev_id >= dev_num)
7ef166b831237e6 Wang Xingchao 2013-06-18 1088 continue;
7ef166b831237e6 Wang Xingchao 2013-06-18 1089
9152085defb6426 Libin Yang 2017-01-12 1090 nid = per_pin->pin_nid;
9152085defb6426 Libin Yang 2017-01-12 1091
9152085defb6426 Libin Yang 2017-01-12 1092 /*
9152085defb6426 Libin Yang 2017-01-12 1093 * Calling this function should not impact
9152085defb6426 Libin Yang 2017-01-12 1094 * on the device entry selection
9152085defb6426 Libin Yang 2017-01-12 1095 * So let's save the dev id for each pin,
9152085defb6426 Libin Yang 2017-01-12 1096 * and restore it when return
9152085defb6426 Libin Yang 2017-01-12 1097 */
9152085defb6426 Libin Yang 2017-01-12 @1098 dev_id_saved = snd_hda_get_dev_select(codec, nid);
9152085defb6426 Libin Yang 2017-01-12 @1099 snd_hda_set_dev_select(codec, nid, per_pin->dev_id);
f82d7d16aee5eb4 Mengdong Lin 2013-09-21 1100 curr = snd_hda_codec_read(codec, nid, 0,
7ef166b831237e6 Wang Xingchao 2013-06-18 1101 AC_VERB_GET_CONNECT_SEL, 0);
9152085defb6426 Libin Yang 2017-01-12 1102 if (curr != mux_idx) {
9152085defb6426 Libin Yang 2017-01-12 1103 snd_hda_set_dev_select(codec, nid, dev_id_saved);
f82d7d16aee5eb4 Mengdong Lin 2013-09-21 1104 continue;
9152085defb6426 Libin Yang 2017-01-12 1105 }
9152085defb6426 Libin Yang 2017-01-12 1106
7ef166b831237e6 Wang Xingchao 2013-06-18 1107
f82d7d16aee5eb4 Mengdong Lin 2013-09-21 1108 /* choose an unassigned converter. The conveters in the
f82d7d16aee5eb4 Mengdong Lin 2013-09-21 1109 * connection list are in the same order as in the codec.
f82d7d16aee5eb4 Mengdong Lin 2013-09-21 1110 */
f82d7d16aee5eb4 Mengdong Lin 2013-09-21 1111 for (cvt_idx = 0; cvt_idx < spec->num_cvts; cvt_idx++) {
f82d7d16aee5eb4 Mengdong Lin 2013-09-21 1112 per_cvt = get_cvt(spec, cvt_idx);
f82d7d16aee5eb4 Mengdong Lin 2013-09-21 1113 if (!per_cvt->assigned) {
4e76a8833fac8dc Takashi Iwai 2014-02-25 1114 codec_dbg(codec,
4e76a8833fac8dc Takashi Iwai 2014-02-25 1115 "choose cvt %d for pin nid %d\n",
f82d7d16aee5eb4 Mengdong Lin 2013-09-21 1116 cvt_idx, nid);
f82d7d16aee5eb4 Mengdong Lin 2013-09-21 1117 snd_hda_codec_write_cache(codec, nid, 0,
7ef166b831237e6 Wang Xingchao 2013-06-18 1118 AC_VERB_SET_CONNECT_SEL,
f82d7d16aee5eb4 Mengdong Lin 2013-09-21 1119 cvt_idx);
f82d7d16aee5eb4 Mengdong Lin 2013-09-21 1120 break;
f82d7d16aee5eb4 Mengdong Lin 2013-09-21 1121 }
7ef166b831237e6 Wang Xingchao 2013-06-18 1122 }
9152085defb6426 Libin Yang 2017-01-12 1123 snd_hda_set_dev_select(codec, nid, dev_id_saved);
7ef166b831237e6 Wang Xingchao 2013-06-18 1124 }
7ef166b831237e6 Wang Xingchao 2013-06-18 1125 }
7ef166b831237e6 Wang Xingchao 2013-06-18 1126
42b2987079eca02 Libin Yang 2015-12-16 1127 /* A wrapper of intel_not_share_asigned_cvt() */
42b2987079eca02 Libin Yang 2015-12-16 1128 static void intel_not_share_assigned_cvt_nid(struct hda_codec *codec,
9152085defb6426 Libin Yang 2017-01-12 1129 hda_nid_t pin_nid, int dev_id, hda_nid_t cvt_nid)
42b2987079eca02 Libin Yang 2015-12-16 1130 {
42b2987079eca02 Libin Yang 2015-12-16 1131 int mux_idx;
42b2987079eca02 Libin Yang 2015-12-16 1132 struct hdmi_spec *spec = codec->spec;
42b2987079eca02 Libin Yang 2015-12-16 1133
42b2987079eca02 Libin Yang 2015-12-16 1134 /* On Intel platform, the mapping of converter nid to
42b2987079eca02 Libin Yang 2015-12-16 1135 * mux index of the pins are always the same.
42b2987079eca02 Libin Yang 2015-12-16 1136 * The pin nid may be 0, this means all pins will not
42b2987079eca02 Libin Yang 2015-12-16 1137 * share the converter.
42b2987079eca02 Libin Yang 2015-12-16 1138 */
42b2987079eca02 Libin Yang 2015-12-16 1139 mux_idx = intel_cvt_id_to_mux_idx(spec, cvt_nid);
42b2987079eca02 Libin Yang 2015-12-16 1140 if (mux_idx >= 0)
9152085defb6426 Libin Yang 2017-01-12 1141 intel_not_share_assigned_cvt(codec, pin_nid, dev_id, mux_idx);
42b2987079eca02 Libin Yang 2015-12-16 1142 }
42b2987079eca02 Libin Yang 2015-12-16 1143
4846a67eb5a1d7c Takashi Iwai 2016-03-21 1144 /* skeleton caller of pin_cvt_fixup ops */
4846a67eb5a1d7c Takashi Iwai 2016-03-21 1145 static void pin_cvt_fixup(struct hda_codec *codec,
4846a67eb5a1d7c Takashi Iwai 2016-03-21 1146 struct hdmi_spec_per_pin *per_pin,
4846a67eb5a1d7c Takashi Iwai 2016-03-21 1147 hda_nid_t cvt_nid)
4846a67eb5a1d7c Takashi Iwai 2016-03-21 1148 {
4846a67eb5a1d7c Takashi Iwai 2016-03-21 1149 struct hdmi_spec *spec = codec->spec;
4846a67eb5a1d7c Takashi Iwai 2016-03-21 1150
4846a67eb5a1d7c Takashi Iwai 2016-03-21 1151 if (spec->ops.pin_cvt_fixup)
4846a67eb5a1d7c Takashi Iwai 2016-03-21 1152 spec->ops.pin_cvt_fixup(codec, per_pin, cvt_nid);
4846a67eb5a1d7c Takashi Iwai 2016-03-21 1153 }
4846a67eb5a1d7c Takashi Iwai 2016-03-21 1154
42b2987079eca02 Libin Yang 2015-12-16 1155 /* called in hdmi_pcm_open when no pin is assigned to the PCM
42b2987079eca02 Libin Yang 2015-12-16 1156 * in dyn_pcm_assign mode.
42b2987079eca02 Libin Yang 2015-12-16 1157 */
42b2987079eca02 Libin Yang 2015-12-16 1158 static int hdmi_pcm_open_no_pin(struct hda_pcm_stream *hinfo,
42b2987079eca02 Libin Yang 2015-12-16 1159 struct hda_codec *codec,
42b2987079eca02 Libin Yang 2015-12-16 1160 struct snd_pcm_substream *substream)
42b2987079eca02 Libin Yang 2015-12-16 1161 {
42b2987079eca02 Libin Yang 2015-12-16 1162 struct hdmi_spec *spec = codec->spec;
42b2987079eca02 Libin Yang 2015-12-16 1163 struct snd_pcm_runtime *runtime = substream->runtime;
ac98379a751e37b Libin Yang 2015-12-16 1164 int cvt_idx, pcm_idx;
42b2987079eca02 Libin Yang 2015-12-16 1165 struct hdmi_spec_per_cvt *per_cvt = NULL;
42b2987079eca02 Libin Yang 2015-12-16 1166 int err;
42b2987079eca02 Libin Yang 2015-12-16 1167
ac98379a751e37b Libin Yang 2015-12-16 1168 pcm_idx = hinfo_to_pcm_index(codec, hinfo);
ac98379a751e37b Libin Yang 2015-12-16 1169 if (pcm_idx < 0)
ac98379a751e37b Libin Yang 2015-12-16 1170 return -EINVAL;
ac98379a751e37b Libin Yang 2015-12-16 1171
4846a67eb5a1d7c Takashi Iwai 2016-03-21 1172 err = hdmi_choose_cvt(codec, -1, &cvt_idx);
42b2987079eca02 Libin Yang 2015-12-16 1173 if (err)
42b2987079eca02 Libin Yang 2015-12-16 1174 return err;
42b2987079eca02 Libin Yang 2015-12-16 1175
42b2987079eca02 Libin Yang 2015-12-16 1176 per_cvt = get_cvt(spec, cvt_idx);
42b2987079eca02 Libin Yang 2015-12-16 1177 per_cvt->assigned = 1;
42b2987079eca02 Libin Yang 2015-12-16 1178 hinfo->nid = per_cvt->cvt_nid;
42b2987079eca02 Libin Yang 2015-12-16 1179
4846a67eb5a1d7c Takashi Iwai 2016-03-21 1180 pin_cvt_fixup(codec, NULL, per_cvt->cvt_nid);
42b2987079eca02 Libin Yang 2015-12-16 1181
ac98379a751e37b Libin Yang 2015-12-16 1182 set_bit(pcm_idx, &spec->pcm_in_use);
42b2987079eca02 Libin Yang 2015-12-16 1183 /* todo: setup spdif ctls assign */
42b2987079eca02 Libin Yang 2015-12-16 1184
42b2987079eca02 Libin Yang 2015-12-16 1185 /* Initially set the converter's capabilities */
42b2987079eca02 Libin Yang 2015-12-16 1186 hinfo->channels_min = per_cvt->channels_min;
42b2987079eca02 Libin Yang 2015-12-16 1187 hinfo->channels_max = per_cvt->channels_max;
42b2987079eca02 Libin Yang 2015-12-16 1188 hinfo->rates = per_cvt->rates;
42b2987079eca02 Libin Yang 2015-12-16 1189 hinfo->formats = per_cvt->formats;
42b2987079eca02 Libin Yang 2015-12-16 1190 hinfo->maxbps = per_cvt->maxbps;
42b2987079eca02 Libin Yang 2015-12-16 1191
42b2987079eca02 Libin Yang 2015-12-16 1192 /* Store the updated parameters */
42b2987079eca02 Libin Yang 2015-12-16 1193 runtime->hw.channels_min = hinfo->channels_min;
42b2987079eca02 Libin Yang 2015-12-16 1194 runtime->hw.channels_max = hinfo->channels_max;
42b2987079eca02 Libin Yang 2015-12-16 1195 runtime->hw.formats = hinfo->formats;
42b2987079eca02 Libin Yang 2015-12-16 1196 runtime->hw.rates = hinfo->rates;
42b2987079eca02 Libin Yang 2015-12-16 1197
42b2987079eca02 Libin Yang 2015-12-16 1198 snd_pcm_hw_constraint_step(substream->runtime, 0,
42b2987079eca02 Libin Yang 2015-12-16 1199 SNDRV_PCM_HW_PARAM_CHANNELS, 2);
42b2987079eca02 Libin Yang 2015-12-16 1200 return 0;
42b2987079eca02 Libin Yang 2015-12-16 1201 }
42b2987079eca02 Libin Yang 2015-12-16 1202
7ef166b831237e6 Wang Xingchao 2013-06-18 1203 /*
7ef166b831237e6 Wang Xingchao 2013-06-18 1204 * HDA PCM callbacks
7ef166b831237e6 Wang Xingchao 2013-06-18 1205 */
7ef166b831237e6 Wang Xingchao 2013-06-18 1206 static int hdmi_pcm_open(struct hda_pcm_stream *hinfo,
7ef166b831237e6 Wang Xingchao 2013-06-18 1207 struct hda_codec *codec,
7ef166b831237e6 Wang Xingchao 2013-06-18 1208 struct snd_pcm_substream *substream)
7ef166b831237e6 Wang Xingchao 2013-06-18 1209 {
7ef166b831237e6 Wang Xingchao 2013-06-18 1210 struct hdmi_spec *spec = codec->spec;
7ef166b831237e6 Wang Xingchao 2013-06-18 1211 struct snd_pcm_runtime *runtime = substream->runtime;
4846a67eb5a1d7c Takashi Iwai 2016-03-21 1212 int pin_idx, cvt_idx, pcm_idx;
7ef166b831237e6 Wang Xingchao 2013-06-18 1213 struct hdmi_spec_per_pin *per_pin;
7ef166b831237e6 Wang Xingchao 2013-06-18 1214 struct hdmi_eld *eld;
7ef166b831237e6 Wang Xingchao 2013-06-18 1215 struct hdmi_spec_per_cvt *per_cvt = NULL;
7ef166b831237e6 Wang Xingchao 2013-06-18 1216 int err;
7ef166b831237e6 Wang Xingchao 2013-06-18 1217
7ef166b831237e6 Wang Xingchao 2013-06-18 1218 /* Validate hinfo */
2bf3c85a5b167a6 Libin Yang 2015-12-16 1219 pcm_idx = hinfo_to_pcm_index(codec, hinfo);
2bf3c85a5b167a6 Libin Yang 2015-12-16 1220 if (pcm_idx < 0)
2bf3c85a5b167a6 Libin Yang 2015-12-16 1221 return -EINVAL;
2bf3c85a5b167a6 Libin Yang 2015-12-16 1222
42b2987079eca02 Libin Yang 2015-12-16 1223 mutex_lock(&spec->pcm_lock);
4e76a8833fac8dc Takashi Iwai 2014-02-25 1224 pin_idx = hinfo_to_pin_index(codec, hinfo);
42b2987079eca02 Libin Yang 2015-12-16 1225 if (!spec->dyn_pcm_assign) {
42b2987079eca02 Libin Yang 2015-12-16 1226 if (snd_BUG_ON(pin_idx < 0)) {
f69548ffafcc494 Takashi Iwai 2018-07-12 1227 err = -EINVAL;
f69548ffafcc494 Takashi Iwai 2018-07-12 1228 goto unlock;
42b2987079eca02 Libin Yang 2015-12-16 1229 }
42b2987079eca02 Libin Yang 2015-12-16 1230 } else {
42b2987079eca02 Libin Yang 2015-12-16 1231 /* no pin is assigned to the PCM
42b2987079eca02 Libin Yang 2015-12-16 1232 * PA need pcm open successfully when probe
42b2987079eca02 Libin Yang 2015-12-16 1233 */
42b2987079eca02 Libin Yang 2015-12-16 1234 if (pin_idx < 0) {
42b2987079eca02 Libin Yang 2015-12-16 1235 err = hdmi_pcm_open_no_pin(hinfo, codec, substream);
f69548ffafcc494 Takashi Iwai 2018-07-12 1236 goto unlock;
42b2987079eca02 Libin Yang 2015-12-16 1237 }
42b2987079eca02 Libin Yang 2015-12-16 1238 }
7ef166b831237e6 Wang Xingchao 2013-06-18 1239
4846a67eb5a1d7c Takashi Iwai 2016-03-21 1240 err = hdmi_choose_cvt(codec, pin_idx, &cvt_idx);
f69548ffafcc494 Takashi Iwai 2018-07-12 1241 if (err < 0)
f69548ffafcc494 Takashi Iwai 2018-07-12 1242 goto unlock;
7ef166b831237e6 Wang Xingchao 2013-06-18 1243
7ef166b831237e6 Wang Xingchao 2013-06-18 1244 per_cvt = get_cvt(spec, cvt_idx);
384a48d71520ca5 Stephen Warren 2011-06-01 1245 /* Claim converter */
384a48d71520ca5 Stephen Warren 2011-06-01 1246 per_cvt->assigned = 1;
42b2987079eca02 Libin Yang 2015-12-16 1247
ac98379a751e37b Libin Yang 2015-12-16 1248 set_bit(pcm_idx, &spec->pcm_in_use);
42b2987079eca02 Libin Yang 2015-12-16 1249 per_pin = get_pin(spec, pin_idx);
1df5a06abbaa876 Anssi Hannula 2013-10-05 1250 per_pin->cvt_nid = per_cvt->cvt_nid;
384a48d71520ca5 Stephen Warren 2011-06-01 1251 hinfo->nid = per_cvt->cvt_nid;
384a48d71520ca5 Stephen Warren 2011-06-01 1252
e38e486d66e2a3b Takashi Iwai 2019-12-02 1253 /* flip stripe flag for the assigned stream if supported */
e38e486d66e2a3b Takashi Iwai 2019-12-02 1254 if (get_wcaps(codec, per_cvt->cvt_nid) & AC_WCAP_STRIPE)
e38e486d66e2a3b Takashi Iwai 2019-12-02 1255 azx_stream(get_azx_dev(substream))->stripe = 1;
e38e486d66e2a3b Takashi Iwai 2019-12-02 1256
9152085defb6426 Libin Yang 2017-01-12 1257 snd_hda_set_dev_select(codec, per_pin->pin_nid, per_pin->dev_id);
bddee96b5d0db86 Takashi Iwai 2013-06-18 1258 snd_hda_codec_write_cache(codec, per_pin->pin_nid, 0,
384a48d71520ca5 Stephen Warren 2011-06-01 1259 AC_VERB_SET_CONNECT_SEL,
4846a67eb5a1d7c Takashi Iwai 2016-03-21 1260 per_pin->mux_idx);
7ef166b831237e6 Wang Xingchao 2013-06-18 1261
7ef166b831237e6 Wang Xingchao 2013-06-18 1262 /* configure unused pins to choose other converters */
4846a67eb5a1d7c Takashi Iwai 2016-03-21 1263 pin_cvt_fixup(codec, per_pin, 0);
7ef166b831237e6 Wang Xingchao 2013-06-18 1264
2bf3c85a5b167a6 Libin Yang 2015-12-16 @1265 snd_hda_spdif_ctls_assign(codec, pcm_idx, per_cvt->cvt_nid);
bbbe33900d1f3c4 Takashi Iwai 2010-08-13 1266
2def8172c6611f2 Stephen Warren 2011-06-01 1267 /* Initially set the converter's capabilities */
384a48d71520ca5 Stephen Warren 2011-06-01 1268 hinfo->channels_min = per_cvt->channels_min;
384a48d71520ca5 Stephen Warren 2011-06-01 1269 hinfo->channels_max = per_cvt->channels_max;
384a48d71520ca5 Stephen Warren 2011-06-01 1270 hinfo->rates = per_cvt->rates;
384a48d71520ca5 Stephen Warren 2011-06-01 1271 hinfo->formats = per_cvt->formats;
384a48d71520ca5 Stephen Warren 2011-06-01 1272 hinfo->maxbps = per_cvt->maxbps;
2def8172c6611f2 Stephen Warren 2011-06-01 1273
42b2987079eca02 Libin Yang 2015-12-16 1274 eld = &per_pin->sink_eld;
384a48d71520ca5 Stephen Warren 2011-06-01 1275 /* Restrict capabilities by ELD if this isn't disabled */
c3d52105753dafd Stephen Warren 2011-06-01 1276 if (!static_hdmi_pcm && eld->eld_valid) {
1613d6b46b433f0 David Henningsson 2013-02-19 1277 snd_hdmi_eld_update_pcm_info(&eld->info, hinfo);
bbbe33900d1f3c4 Takashi Iwai 2010-08-13 1278 if (hinfo->channels_min > hinfo->channels_max ||
2ad779b7329d689 Takashi Iwai 2013-02-01 1279 !hinfo->rates || !hinfo->formats) {
2ad779b7329d689 Takashi Iwai 2013-02-01 1280 per_cvt->assigned = 0;
2ad779b7329d689 Takashi Iwai 2013-02-01 1281 hinfo->nid = 0;
2bf3c85a5b167a6 Libin Yang 2015-12-16 @1282 snd_hda_spdif_ctls_unassign(codec, pcm_idx);
f69548ffafcc494 Takashi Iwai 2018-07-12 1283 err = -ENODEV;
f69548ffafcc494 Takashi Iwai 2018-07-12 1284 goto unlock;
bbbe33900d1f3c4 Takashi Iwai 2010-08-13 1285 }
2ad779b7329d689 Takashi Iwai 2013-02-01 1286 }
2def8172c6611f2 Stephen Warren 2011-06-01 1287
2def8172c6611f2 Stephen Warren 2011-06-01 1288 /* Store the updated parameters */
639cef0eb6df05d Takashi Iwai 2011-01-14 1289 runtime->hw.channels_min = hinfo->channels_min;
639cef0eb6df05d Takashi Iwai 2011-01-14 1290 runtime->hw.channels_max = hinfo->channels_max;
639cef0eb6df05d Takashi Iwai 2011-01-14 1291 runtime->hw.formats = hinfo->formats;
639cef0eb6df05d Takashi Iwai 2011-01-14 1292 runtime->hw.rates = hinfo->rates;
4fe2ca14678174d Takashi Iwai 2011-01-14 1293
4fe2ca14678174d Takashi Iwai 2011-01-14 1294 snd_pcm_hw_constraint_step(substream->runtime, 0,
4fe2ca14678174d Takashi Iwai 2011-01-14 1295 SNDRV_PCM_HW_PARAM_CHANNELS, 2);
f69548ffafcc494 Takashi Iwai 2018-07-12 1296 unlock:
f69548ffafcc494 Takashi Iwai 2018-07-12 1297 mutex_unlock(&spec->pcm_lock);
f69548ffafcc494 Takashi Iwai 2018-07-12 1298 return err;
bbbe33900d1f3c4 Takashi Iwai 2010-08-13 1299 }
bbbe33900d1f3c4 Takashi Iwai 2010-08-13 1300
:::::: The code at line 1086 was first introduced by commit
:::::: 9152085defb6426ce8f9989ca27e4450daefbd89 ALSA: hda - add DP MST audio support
:::::: TO: Libin Yang <[email protected]>
:::::: CC: Daniel Vetter <[email protected]>
---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/hyperkitty/list/[email protected] Intel Corporation
Hey,
On Thu, 6 Feb 2020, kbuild test robot wrote:
> ld: sound/pci/hda/patch_hdmi.o: in function `intel_not_share_assigned_cvt':
> >> sound/pci/hda/patch_hdmi.c:1086: undefined reference to `snd_hda_get_num_devices'
> >> ld: sound/pci/hda/patch_hdmi.c:1098: undefined reference to `snd_hda_get_dev_select'
> >> ld: sound/pci/hda/patch_hdmi.c:1099: undefined reference to `snd_hda_set_dev_select'
hmm, this seems similar case as the previous one today w.r.t
hda_dsp_common.c:76. Patch_hdmi.c is built-in while snd-hda is a module.
Maybe we need to just drop the dependency from the ASoC board files to
SND_HDA_CODEC_HDMI. We don't have one for SND_HDA_CODEC either.
Br, Kai
On Thu, 06 Feb 2020 14:40:17 +0100,
Kai Vehmanen wrote:
>
> Hey,
>
> On Thu, 6 Feb 2020, kbuild test robot wrote:
>
> > ld: sound/pci/hda/patch_hdmi.o: in function `intel_not_share_assigned_cvt':
> > >> sound/pci/hda/patch_hdmi.c:1086: undefined reference to `snd_hda_get_num_devices'
> > >> ld: sound/pci/hda/patch_hdmi.c:1098: undefined reference to `snd_hda_get_dev_select'
> > >> ld: sound/pci/hda/patch_hdmi.c:1099: undefined reference to `snd_hda_set_dev_select'
>
> hmm, this seems similar case as the previous one today w.r.t
> hda_dsp_common.c:76. Patch_hdmi.c is built-in while snd-hda is a module.
> Maybe we need to just drop the dependency from the ASoC board files to
> SND_HDA_CODEC_HDMI. We don't have one for SND_HDA_CODEC either.
The problem is that SOF tries to do reverse-select the legacy HD-audio
codec, but it doesn't work in general. Or it must be done very
carefully.
If something gets selected, all dependencies have to be
reverse-selected, too. But the legacy HDA is built up in a way of
standard top-down selection (i.e. SND_HDA_CODEC_* depends on SND_HDA,
not other way round).
Takashi
On 2/6/20 7:48 AM, Takashi Iwai wrote:
> On Thu, 06 Feb 2020 14:40:17 +0100,
> Kai Vehmanen wrote:
>>
>> Hey,
>>
>> On Thu, 6 Feb 2020, kbuild test robot wrote:
>>
>>> ld: sound/pci/hda/patch_hdmi.o: in function `intel_not_share_assigned_cvt':
>>>>> sound/pci/hda/patch_hdmi.c:1086: undefined reference to `snd_hda_get_num_devices'
>>>>> ld: sound/pci/hda/patch_hdmi.c:1098: undefined reference to `snd_hda_get_dev_select'
>>>>> ld: sound/pci/hda/patch_hdmi.c:1099: undefined reference to `snd_hda_set_dev_select'
>>
>> hmm, this seems similar case as the previous one today w.r.t
>> hda_dsp_common.c:76. Patch_hdmi.c is built-in while snd-hda is a module.
>> Maybe we need to just drop the dependency from the ASoC board files to
>> SND_HDA_CODEC_HDMI. We don't have one for SND_HDA_CODEC either.
>
> The problem is that SOF tries to do reverse-select the legacy HD-audio
> codec, but it doesn't work in general. Or it must be done very
> carefully.
>
> If something gets selected, all dependencies have to be
> reverse-selected, too. But the legacy HDA is built up in a way of
> standard top-down selection (i.e. SND_HDA_CODEC_* depends on SND_HDA,
> not other way round).
It's the same issue as the other one reported earlier, and adding the
dependency on SOF_HDA makes the unmet dependency go away.