Lines Matching +full:video +full:- +full:codec

1 // SPDX-License-Identifier: GPL-2.0-or-later
30 * - HDMI audio InfoFrame (source to sink)
31 * - CEA E-EDID Extension (sink to source)
34 static unsigned int hdmi_get_eld_data(struct hda_codec *codec, hda_nid_t nid, in hdmi_get_eld_data() argument
39 val = snd_hda_codec_read(codec, nid, 0, in hdmi_get_eld_data()
42 codec_info(codec, "HDMI: ELD data byte %d: 0x%x\n", byte_index, val); in hdmi_get_eld_data()
47 int snd_hdmi_get_eld_size(struct hda_codec *codec, hda_nid_t nid) in snd_hdmi_get_eld_size() argument
49 return snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_HDMI_DIP_SIZE, in snd_hdmi_get_eld_size()
53 int snd_hdmi_get_eld(struct hda_codec *codec, hda_nid_t nid, in snd_hdmi_get_eld() argument
65 size = snd_hdmi_get_eld_size(codec, nid); in snd_hdmi_get_eld()
67 /* wfg: workaround for ASUS P5E-VM HDMI board */ in snd_hdmi_get_eld()
68 codec_info(codec, "HDMI: ELD buf size is 0, force 128\n"); in snd_hdmi_get_eld()
72 codec_info(codec, "HDMI: invalid ELD buf size %d\n", size); in snd_hdmi_get_eld()
73 return -ERANGE; in snd_hdmi_get_eld()
78 unsigned int val = hdmi_get_eld_data(codec, nid, i); in snd_hdmi_get_eld()
84 codec_info(codec, "HDMI: invalid ELD data byte %d\n", i); in snd_hdmi_get_eld()
85 ret = -EINVAL; in snd_hdmi_get_eld()
92 * to return non-zero ELD data, even when the graphics driver in snd_hdmi_get_eld()
96 codec_dbg(codec, "HDMI: 0 ELD data\n"); in snd_hdmi_get_eld()
97 ret = -EINVAL; in snd_hdmi_get_eld()
113 snd_iprintf(buffer, "monitor_present\t\t%d\n", eld->monitor_present); in snd_hdmi_print_eld_info()
114 snd_iprintf(buffer, "eld_valid\t\t%d\n", eld->eld_valid); in snd_hdmi_print_eld_info()
119 if (!eld->eld_valid) in snd_hdmi_print_eld_info()
122 snd_print_eld_info(&eld->info, buffer); in snd_hdmi_print_eld_info()
128 struct snd_parsed_hdmi_eld *e = &eld->info; in snd_hdmi_write_eld_info()
144 eld->monitor_present = val; in snd_hdmi_write_eld_info()
146 eld->eld_valid = val; in snd_hdmi_write_eld_info()
148 e->conn_type = val; in snd_hdmi_write_eld_info()
150 e->port_id = val; in snd_hdmi_write_eld_info()
152 e->support_hdcp = val; in snd_hdmi_write_eld_info()
154 e->support_ai = val; in snd_hdmi_write_eld_info()
156 e->aud_synch_delay = val; in snd_hdmi_write_eld_info()
158 e->spk_alloc = val; in snd_hdmi_write_eld_info()
160 e->sad_count = val; in snd_hdmi_write_eld_info()
163 n = name[3] - '0'; in snd_hdmi_write_eld_info()
166 n = 10 * n + name[4] - '0'; in snd_hdmi_write_eld_info()
171 e->sad[n].format = val; in snd_hdmi_write_eld_info()
173 e->sad[n].channels = val; in snd_hdmi_write_eld_info()
175 e->sad[n].rates = val; in snd_hdmi_write_eld_info()
177 e->sad[n].sample_bits = val; in snd_hdmi_write_eld_info()
179 e->sad[n].max_bitrate = val; in snd_hdmi_write_eld_info()
181 e->sad[n].profile = val; in snd_hdmi_write_eld_info()
182 if (n >= e->sad_count) in snd_hdmi_write_eld_info()
183 e->sad_count = n + 1; in snd_hdmi_write_eld_info()
207 for (i = 0; i < e->sad_count; i++) { in snd_hdmi_eld_update_pcm_info()
208 struct snd_cea_sad *a = &e->sad[i]; in snd_hdmi_eld_update_pcm_info()
209 rates |= a->rates; in snd_hdmi_eld_update_pcm_info()
210 if (a->channels > channels_max) in snd_hdmi_eld_update_pcm_info()
211 channels_max = a->channels; in snd_hdmi_eld_update_pcm_info()
212 if (a->format == AUDIO_CODING_TYPE_LPCM) { in snd_hdmi_eld_update_pcm_info()
213 if (a->sample_bits & ELD_PCM_BITS_20) { in snd_hdmi_eld_update_pcm_info()
218 if (a->sample_bits & ELD_PCM_BITS_24) { in snd_hdmi_eld_update_pcm_info()
226 /* restrict the parameters by the values the codec provides */ in snd_hdmi_eld_update_pcm_info()
227 hinfo->rates &= rates; in snd_hdmi_eld_update_pcm_info()
228 hinfo->formats &= formats; in snd_hdmi_eld_update_pcm_info()
229 hinfo->maxbps = min(hinfo->maxbps, maxbps); in snd_hdmi_eld_update_pcm_info()
230 hinfo->channels_max = min(hinfo->channels_max, channels_max); in snd_hdmi_eld_update_pcm_info()
267 int snd_hdmi_get_eld_ati(struct hda_codec *codec, hda_nid_t nid, in snd_hdmi_get_eld_ati() argument
276 spkalloc = snd_hda_codec_read(codec, nid, 0, ATI_VERB_GET_SPEAKER_ALLOCATION, 0); in snd_hdmi_get_eld_ati()
279 codec_info(codec, "HDMI ATI/AMD: no speaker allocation for ELD\n"); in snd_hdmi_get_eld_ati()
280 return -EINVAL; in snd_hdmi_get_eld_ati()
300 snd_hda_codec_write(codec, nid, 0, ATI_VERB_SET_SINK_INFO_INDEX, ATI_INFO_IDX_PORT_ID_LOW); in snd_hdmi_get_eld_ati()
301 sink_info = snd_hda_codec_read(codec, nid, 0, ATI_VERB_GET_SINK_INFO_DATA, 0); in snd_hdmi_get_eld_ati()
304 snd_hda_codec_write(codec, nid, 0, ATI_VERB_SET_SINK_INFO_INDEX, ATI_INFO_IDX_PORT_ID_HIGH); in snd_hdmi_get_eld_ati()
305 sink_info = snd_hda_codec_read(codec, nid, 0, ATI_VERB_GET_SINK_INFO_DATA, 0); in snd_hdmi_get_eld_ati()
308 snd_hda_codec_write(codec, nid, 0, ATI_VERB_SET_SINK_INFO_INDEX, ATI_INFO_IDX_MANUFACTURER_ID); in snd_hdmi_get_eld_ati()
309 sink_info = snd_hda_codec_read(codec, nid, 0, ATI_VERB_GET_SINK_INFO_DATA, 0); in snd_hdmi_get_eld_ati()
312 snd_hda_codec_write(codec, nid, 0, ATI_VERB_SET_SINK_INFO_INDEX, ATI_INFO_IDX_PRODUCT_ID); in snd_hdmi_get_eld_ati()
313 sink_info = snd_hda_codec_read(codec, nid, 0, ATI_VERB_GET_SINK_INFO_DATA, 0); in snd_hdmi_get_eld_ati()
316 snd_hda_codec_write(codec, nid, 0, ATI_VERB_SET_SINK_INFO_INDEX, ATI_INFO_IDX_SINK_DESC_LEN); in snd_hdmi_get_eld_ati()
317 sink_desc_len = snd_hda_codec_read(codec, nid, 0, ATI_VERB_GET_SINK_INFO_DATA, 0); in snd_hdmi_get_eld_ati()
320 codec_info(codec, "HDMI ATI/AMD: Truncating HDMI sink description with length %d\n", in snd_hdmi_get_eld_ati()
328 …snd_hda_codec_write(codec, nid, 0, ATI_VERB_SET_SINK_INFO_INDEX, ATI_INFO_IDX_SINK_DESC_FIRST + i); in snd_hdmi_get_eld_ati()
329 buf[pos++] = snd_hda_codec_read(codec, nid, 0, ATI_VERB_GET_SINK_INFO_DATA, 0); in snd_hdmi_get_eld_ati()
337 snd_hda_codec_write(codec, nid, 0, ATI_VERB_SET_AUDIO_DESCRIPTOR, i << 3); in snd_hdmi_get_eld_ati()
338 ati_sad = snd_hda_codec_read(codec, nid, 0, ATI_VERB_GET_AUDIO_DESCRIPTOR, 0); in snd_hdmi_get_eld_ati()
344 /* format is supported, copy SAD as-is */ in snd_hdmi_get_eld_ati()
362 codec_info(codec, "HDMI ATI/AMD: no audio descriptors for ELD\n"); in snd_hdmi_get_eld_ati()
363 return -EINVAL; in snd_hdmi_get_eld_ati()
368 * separately for both audio and video: in snd_hdmi_get_eld_ati()
370 * [1..251] msecs = (x-1)*2 (max 500ms with x = 251 = 0xfb) in snd_hdmi_get_eld_ati()
371 * 255 audio/video not supported in snd_hdmi_get_eld_ati()
374 * single value indicating video latency relative to audio: in snd_hdmi_get_eld_ati()
379 aud_synch = snd_hda_codec_read(codec, nid, 0, ATI_VERB_GET_AUDIO_VIDEO_DELAY, 0); in snd_hdmi_get_eld_ati()
386 buf[6] = video_latency_hdmi - audio_latency_hdmi; in snd_hdmi_get_eld_ati()
387 /* else unknown/invalid or 0ms or video ahead of audio, so use zero */ in snd_hdmi_get_eld_ati()
391 buf[5] |= ((pos - ELD_FIXED_BYTES - sink_desc_len) / 3) << 4; in snd_hdmi_get_eld_ati()
393 /* Baseline ELD block length is 4-byte aligned */ in snd_hdmi_get_eld_ati()
396 /* Baseline ELD length (4-byte header is not counted in) */ in snd_hdmi_get_eld_ati()
397 buf[2] = (pos - 4) / 4; in snd_hdmi_get_eld_ati()