diff options
Diffstat (limited to 'sound/pci/hda/hda_eld.c')
-rw-r--r-- | sound/pci/hda/hda_eld.c | 46 |
1 files changed, 22 insertions, 24 deletions
diff --git a/sound/pci/hda/hda_eld.c b/sound/pci/hda/hda_eld.c index 46690a7f48f6..e1cd34d9011d 100644 --- a/sound/pci/hda/hda_eld.c +++ b/sound/pci/hda/hda_eld.c | |||
@@ -167,7 +167,8 @@ static unsigned int hdmi_get_eld_data(struct hda_codec *codec, hda_nid_t nid, | |||
167 | (buf[byte] >> (lowbit)) & ((1 << (bits)) - 1); \ | 167 | (buf[byte] >> (lowbit)) & ((1 << (bits)) - 1); \ |
168 | }) | 168 | }) |
169 | 169 | ||
170 | static void hdmi_update_short_audio_desc(struct cea_sad *a, | 170 | static void hdmi_update_short_audio_desc(struct hda_codec *codec, |
171 | struct cea_sad *a, | ||
171 | const unsigned char *buf) | 172 | const unsigned char *buf) |
172 | { | 173 | { |
173 | int i; | 174 | int i; |
@@ -188,8 +189,7 @@ static void hdmi_update_short_audio_desc(struct cea_sad *a, | |||
188 | a->format = GRAB_BITS(buf, 0, 3, 4); | 189 | a->format = GRAB_BITS(buf, 0, 3, 4); |
189 | switch (a->format) { | 190 | switch (a->format) { |
190 | case AUDIO_CODING_TYPE_REF_STREAM_HEADER: | 191 | case AUDIO_CODING_TYPE_REF_STREAM_HEADER: |
191 | snd_printd(KERN_INFO | 192 | codec_info(codec, "HDMI: audio coding type 0 not expected\n"); |
192 | "HDMI: audio coding type 0 not expected\n"); | ||
193 | break; | 193 | break; |
194 | 194 | ||
195 | case AUDIO_CODING_TYPE_LPCM: | 195 | case AUDIO_CODING_TYPE_LPCM: |
@@ -233,9 +233,9 @@ static void hdmi_update_short_audio_desc(struct cea_sad *a, | |||
233 | a->format = GRAB_BITS(buf, 2, 3, 5); | 233 | a->format = GRAB_BITS(buf, 2, 3, 5); |
234 | if (a->format == AUDIO_CODING_XTYPE_HE_REF_CT || | 234 | if (a->format == AUDIO_CODING_XTYPE_HE_REF_CT || |
235 | a->format >= AUDIO_CODING_XTYPE_FIRST_RESERVED) { | 235 | a->format >= AUDIO_CODING_XTYPE_FIRST_RESERVED) { |
236 | snd_printd(KERN_INFO | 236 | codec_info(codec, |
237 | "HDMI: audio coding xtype %d not expected\n", | 237 | "HDMI: audio coding xtype %d not expected\n", |
238 | a->format); | 238 | a->format); |
239 | a->format = 0; | 239 | a->format = 0; |
240 | } else | 240 | } else |
241 | a->format += AUDIO_CODING_TYPE_HE_AAC - | 241 | a->format += AUDIO_CODING_TYPE_HE_AAC - |
@@ -247,7 +247,7 @@ static void hdmi_update_short_audio_desc(struct cea_sad *a, | |||
247 | /* | 247 | /* |
248 | * Be careful, ELD buf could be totally rubbish! | 248 | * Be careful, ELD buf could be totally rubbish! |
249 | */ | 249 | */ |
250 | int snd_hdmi_parse_eld(struct parsed_hdmi_eld *e, | 250 | int snd_hdmi_parse_eld(struct hda_codec *codec, struct parsed_hdmi_eld *e, |
251 | const unsigned char *buf, int size) | 251 | const unsigned char *buf, int size) |
252 | { | 252 | { |
253 | int mnl; | 253 | int mnl; |
@@ -256,8 +256,7 @@ int snd_hdmi_parse_eld(struct parsed_hdmi_eld *e, | |||
256 | e->eld_ver = GRAB_BITS(buf, 0, 3, 5); | 256 | e->eld_ver = GRAB_BITS(buf, 0, 3, 5); |
257 | if (e->eld_ver != ELD_VER_CEA_861D && | 257 | if (e->eld_ver != ELD_VER_CEA_861D && |
258 | e->eld_ver != ELD_VER_PARTIAL) { | 258 | e->eld_ver != ELD_VER_PARTIAL) { |
259 | snd_printd(KERN_INFO "HDMI: Unknown ELD version %d\n", | 259 | codec_info(codec, "HDMI: Unknown ELD version %d\n", e->eld_ver); |
260 | e->eld_ver); | ||
261 | goto out_fail; | 260 | goto out_fail; |
262 | } | 261 | } |
263 | 262 | ||
@@ -280,20 +279,20 @@ int snd_hdmi_parse_eld(struct parsed_hdmi_eld *e, | |||
280 | e->product_id = get_unaligned_le16(buf + 18); | 279 | e->product_id = get_unaligned_le16(buf + 18); |
281 | 280 | ||
282 | if (mnl > ELD_MAX_MNL) { | 281 | if (mnl > ELD_MAX_MNL) { |
283 | snd_printd(KERN_INFO "HDMI: MNL is reserved value %d\n", mnl); | 282 | codec_info(codec, "HDMI: MNL is reserved value %d\n", mnl); |
284 | goto out_fail; | 283 | goto out_fail; |
285 | } else if (ELD_FIXED_BYTES + mnl > size) { | 284 | } else if (ELD_FIXED_BYTES + mnl > size) { |
286 | snd_printd(KERN_INFO "HDMI: out of range MNL %d\n", mnl); | 285 | codec_info(codec, "HDMI: out of range MNL %d\n", mnl); |
287 | goto out_fail; | 286 | goto out_fail; |
288 | } else | 287 | } else |
289 | strlcpy(e->monitor_name, buf + ELD_FIXED_BYTES, mnl + 1); | 288 | strlcpy(e->monitor_name, buf + ELD_FIXED_BYTES, mnl + 1); |
290 | 289 | ||
291 | for (i = 0; i < e->sad_count; i++) { | 290 | for (i = 0; i < e->sad_count; i++) { |
292 | if (ELD_FIXED_BYTES + mnl + 3 * (i + 1) > size) { | 291 | if (ELD_FIXED_BYTES + mnl + 3 * (i + 1) > size) { |
293 | snd_printd(KERN_INFO "HDMI: out of range SAD %d\n", i); | 292 | codec_info(codec, "HDMI: out of range SAD %d\n", i); |
294 | goto out_fail; | 293 | goto out_fail; |
295 | } | 294 | } |
296 | hdmi_update_short_audio_desc(e->sad + i, | 295 | hdmi_update_short_audio_desc(codec, e->sad + i, |
297 | buf + ELD_FIXED_BYTES + mnl + 3 * i); | 296 | buf + ELD_FIXED_BYTES + mnl + 3 * i); |
298 | } | 297 | } |
299 | 298 | ||
@@ -394,7 +393,8 @@ static void hdmi_print_pcm_rates(int pcm, char *buf, int buflen) | |||
394 | 393 | ||
395 | #define SND_PRINT_RATES_ADVISED_BUFSIZE 80 | 394 | #define SND_PRINT_RATES_ADVISED_BUFSIZE 80 |
396 | 395 | ||
397 | static void hdmi_show_short_audio_desc(struct cea_sad *a) | 396 | static void hdmi_show_short_audio_desc(struct hda_codec *codec, |
397 | struct cea_sad *a) | ||
398 | { | 398 | { |
399 | char buf[SND_PRINT_RATES_ADVISED_BUFSIZE]; | 399 | char buf[SND_PRINT_RATES_ADVISED_BUFSIZE]; |
400 | char buf2[8 + SND_PRINT_BITS_ADVISED_BUFSIZE] = ", bits ="; | 400 | char buf2[8 + SND_PRINT_BITS_ADVISED_BUFSIZE] = ", bits ="; |
@@ -412,12 +412,10 @@ static void hdmi_show_short_audio_desc(struct cea_sad *a) | |||
412 | else | 412 | else |
413 | buf2[0] = '\0'; | 413 | buf2[0] = '\0'; |
414 | 414 | ||
415 | _snd_printd(SND_PR_VERBOSE, "HDMI: supports coding type %s:" | 415 | codec_dbg(codec, |
416 | " channels = %d, rates =%s%s\n", | 416 | "HDMI: supports coding type %s: channels = %d, rates =%s%s\n", |
417 | cea_audio_coding_type_names[a->format], | 417 | cea_audio_coding_type_names[a->format], |
418 | a->channels, | 418 | a->channels, buf, buf2); |
419 | buf, | ||
420 | buf2); | ||
421 | } | 419 | } |
422 | 420 | ||
423 | void snd_print_channel_allocation(int spk_alloc, char *buf, int buflen) | 421 | void snd_print_channel_allocation(int spk_alloc, char *buf, int buflen) |
@@ -432,22 +430,22 @@ void snd_print_channel_allocation(int spk_alloc, char *buf, int buflen) | |||
432 | buf[j] = '\0'; /* necessary when j == 0 */ | 430 | buf[j] = '\0'; /* necessary when j == 0 */ |
433 | } | 431 | } |
434 | 432 | ||
435 | void snd_hdmi_show_eld(struct parsed_hdmi_eld *e) | 433 | void snd_hdmi_show_eld(struct hda_codec *codec, struct parsed_hdmi_eld *e) |
436 | { | 434 | { |
437 | int i; | 435 | int i; |
438 | 436 | ||
439 | _snd_printd(SND_PR_VERBOSE, "HDMI: detected monitor %s at connection type %s\n", | 437 | codec_dbg(codec, "HDMI: detected monitor %s at connection type %s\n", |
440 | e->monitor_name, | 438 | e->monitor_name, |
441 | eld_connection_type_names[e->conn_type]); | 439 | eld_connection_type_names[e->conn_type]); |
442 | 440 | ||
443 | if (e->spk_alloc) { | 441 | if (e->spk_alloc) { |
444 | char buf[SND_PRINT_CHANNEL_ALLOCATION_ADVISED_BUFSIZE]; | 442 | char buf[SND_PRINT_CHANNEL_ALLOCATION_ADVISED_BUFSIZE]; |
445 | snd_print_channel_allocation(e->spk_alloc, buf, sizeof(buf)); | 443 | snd_print_channel_allocation(e->spk_alloc, buf, sizeof(buf)); |
446 | _snd_printd(SND_PR_VERBOSE, "HDMI: available speakers:%s\n", buf); | 444 | codec_dbg(codec, "HDMI: available speakers:%s\n", buf); |
447 | } | 445 | } |
448 | 446 | ||
449 | for (i = 0; i < e->sad_count; i++) | 447 | for (i = 0; i < e->sad_count; i++) |
450 | hdmi_show_short_audio_desc(e->sad + i); | 448 | hdmi_show_short_audio_desc(codec, e->sad + i); |
451 | } | 449 | } |
452 | 450 | ||
453 | #ifdef CONFIG_PROC_FS | 451 | #ifdef CONFIG_PROC_FS |