Lines Matching +full:audio +full:- +full:codec
1 // SPDX-License-Identifier: GPL-2.0-or-later
3 * Legacy Nvidia HDMI codec support
31 /* set audio protect on */
39 /* set audio protect on */
50 static int nvhdmi_mcp_init(struct hda_codec *codec)
52 struct hdmi_spec *spec = codec->spec;
54 if (spec->multiout.max_channels == 2)
55 snd_hda_sequence_write(codec, nvhdmi_basic_init_7x_2ch);
57 snd_hda_sequence_write(codec, nvhdmi_basic_init_7x_8ch);
61 static void nvhdmi_8ch_7x_set_info_frame_parameters(struct hda_codec *codec,
65 int chan = channels ? (channels - 1) : 1;
84 /* Set the audio infoframe channel allocation and checksum fields. The
87 snd_hda_codec_write(codec, 0x1, 0,
90 snd_hda_codec_write(codec, 0x1, 0,
92 (0x71 - chan - chanmask));
96 struct hda_codec *codec,
99 struct hdmi_spec *spec = codec->spec;
102 snd_hda_codec_write(codec, nvhdmi_master_con_nid_7x,
106 snd_hda_codec_write(codec, nvhdmi_con_nids_7x[i], 0,
109 snd_hda_codec_write(codec, nvhdmi_con_nids_7x[i], 0,
113 /* The audio hardware sends a channel count of 0x7 (8ch) when all the
116 nvhdmi_8ch_7x_set_info_frame_parameters(codec, 8);
118 return snd_hda_multi_out_dig_close(codec, &spec->multiout);
122 struct hda_codec *codec,
130 struct hdmi_spec *spec = codec->spec;
134 guard(mutex)(&codec->spdif_mutex);
136 spdif = snd_hda_spdif_out_of_nid(codec, per_cvt->cvt_nid);
138 chs = substream->runtime->channels;
143 if (codec->spdif_status_reset && (spdif->ctls & AC_DIG1_ENABLE))
144 snd_hda_codec_write(codec,
148 spdif->ctls & ~AC_DIG1_ENABLE & 0xff);
151 snd_hda_codec_write(codec, nvhdmi_master_con_nid_7x, 0,
155 snd_hda_codec_write(codec, nvhdmi_master_con_nid_7x, 0,
159 /* enable and set the channel status audio/data flag */
160 if (codec->spdif_status_reset && (spdif->ctls & AC_DIG1_ENABLE)) {
161 snd_hda_codec_write(codec,
165 spdif->ctls & 0xff);
166 snd_hda_codec_write(codec,
181 if (codec->spdif_status_reset &&
182 (spdif->ctls & AC_DIG1_ENABLE))
183 snd_hda_codec_write(codec,
187 spdif->ctls & ~AC_DIG1_ENABLE & 0xff);
189 snd_hda_codec_write(codec,
195 snd_hda_codec_write(codec,
201 /* enable and set the channel status audio/data flag */
202 if (codec->spdif_status_reset &&
203 (spdif->ctls & AC_DIG1_ENABLE)) {
204 snd_hda_codec_write(codec,
208 spdif->ctls & 0xff);
209 snd_hda_codec_write(codec,
216 nvhdmi_8ch_7x_set_info_frame_parameters(codec, chs);
236 static int nvhdmi_mcp_build_pcms(struct hda_codec *codec)
238 struct hdmi_spec *spec = codec->spec;
241 err = snd_hda_hdmi_simple_build_pcms(codec);
242 if (!err && spec->multiout.max_channels == 8) {
245 info->own_chmap = true;
250 static int nvhdmi_mcp_build_controls(struct hda_codec *codec)
252 struct hdmi_spec *spec = codec->spec;
257 err = snd_hda_hdmi_simple_build_controls(codec);
261 if (spec->multiout.max_channels != 8)
266 err = snd_pcm_add_chmap_ctls(info->pcm,
271 switch (codec->preset->vendor_id) {
276 chmap->channel_mask = (1U << 2) | (1U << 8);
279 chmap->channel_mask = (1U << 2) | (1U << 6) | (1U << 8);
304 static int nvhdmi_mcp_probe(struct hda_codec *codec,
310 err = snd_hda_hdmi_simple_probe(codec, nvhdmi_master_con_nid_7x,
315 /* override the PCM rates, etc, as the codec doesn't give full list */
316 spec = codec->spec;
317 spec->pcm_playback.rates = SUPPORTED_RATES;
318 spec->pcm_playback.maxbps = SUPPORTED_MAXBPS;
319 spec->pcm_playback.formats = SUPPORTED_FORMATS;
320 spec->nv_dp_workaround = true;
322 if (id->driver_data == MODEL_2CH)
325 spec->multiout.max_channels = 8;
326 spec->pcm_playback = nvhdmi_pcm_playback_8ch_7x;
328 switch (codec->preset->vendor_id) {
333 spec->hw_constraints_channels = &hw_constraints_2_8_channels;
336 spec->hw_constraints_channels = &hw_constraints_2_6_8_channels;
342 /* Initialize the audio infoframe channel mask and checksum to something
345 nvhdmi_8ch_7x_set_info_frame_parameters(codec, 8);
375 MODULE_DESCRIPTION("Legacy Nvidia HDMI HD-audio codec");