aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2014-06-06 12:04:34 -0400
committerTakashi Iwai <tiwai@suse.de>2014-06-25 08:51:23 -0400
commit79514d473b097da82f5bc0b4e41251c44e29d98c (patch)
tree202f27c7246d020fa6c72bdd74c6c0fa69f7d99d
parenta53613a67e17e5cd29963496ad249cc419688c5d (diff)
ALSA: hda - Kill snd_printd*() in HDMI debug / info prints
Pass codec instance to each function that still prints info and debug outputs via snd_printd*(). Signed-off-by: Takashi Iwai <tiwai@suse.de>
-rw-r--r--sound/pci/hda/hda_eld.c46
-rw-r--r--sound/pci/hda/hda_local.h4
-rw-r--r--sound/pci/hda/patch_hdmi.c11
3 files changed, 30 insertions, 31 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
170static void hdmi_update_short_audio_desc(struct cea_sad *a, 170static 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 */
250int snd_hdmi_parse_eld(struct parsed_hdmi_eld *e, 250int 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
397static void hdmi_show_short_audio_desc(struct cea_sad *a) 396static 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
423void snd_print_channel_allocation(int spk_alloc, char *buf, int buflen) 421void 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
435void snd_hdmi_show_eld(struct parsed_hdmi_eld *e) 433void 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
diff --git a/sound/pci/hda/hda_local.h b/sound/pci/hda/hda_local.h
index ebd1fa6f015c..08a67e4c5df3 100644
--- a/sound/pci/hda/hda_local.h
+++ b/sound/pci/hda/hda_local.h
@@ -752,9 +752,9 @@ struct hdmi_eld {
752int snd_hdmi_get_eld_size(struct hda_codec *codec, hda_nid_t nid); 752int snd_hdmi_get_eld_size(struct hda_codec *codec, hda_nid_t nid);
753int snd_hdmi_get_eld(struct hda_codec *codec, hda_nid_t nid, 753int snd_hdmi_get_eld(struct hda_codec *codec, hda_nid_t nid,
754 unsigned char *buf, int *eld_size); 754 unsigned char *buf, int *eld_size);
755int snd_hdmi_parse_eld(struct parsed_hdmi_eld *e, 755int snd_hdmi_parse_eld(struct hda_codec *codec, struct parsed_hdmi_eld *e,
756 const unsigned char *buf, int size); 756 const unsigned char *buf, int size);
757void snd_hdmi_show_eld(struct parsed_hdmi_eld *e); 757void snd_hdmi_show_eld(struct hda_codec *codec, struct parsed_hdmi_eld *e);
758void snd_hdmi_eld_update_pcm_info(struct parsed_hdmi_eld *e, 758void snd_hdmi_eld_update_pcm_info(struct parsed_hdmi_eld *e,
759 struct hda_pcm_stream *hinfo); 759 struct hda_pcm_stream *hinfo);
760 760
diff --git a/sound/pci/hda/patch_hdmi.c b/sound/pci/hda/patch_hdmi.c
index 3e4417b0ddbe..eab53d7a0f18 100644
--- a/sound/pci/hda/patch_hdmi.c
+++ b/sound/pci/hda/patch_hdmi.c
@@ -648,7 +648,8 @@ static int get_channel_allocation_order(int ca)
648 * 648 *
649 * TODO: it could select the wrong CA from multiple candidates. 649 * TODO: it could select the wrong CA from multiple candidates.
650*/ 650*/
651static int hdmi_channel_allocation(struct hdmi_eld *eld, int channels) 651static int hdmi_channel_allocation(struct hda_codec *codec,
652 struct hdmi_eld *eld, int channels)
652{ 653{
653 int i; 654 int i;
654 int ca = 0; 655 int ca = 0;
@@ -694,7 +695,7 @@ static int hdmi_channel_allocation(struct hdmi_eld *eld, int channels)
694 } 695 }
695 696
696 snd_print_channel_allocation(eld->info.spk_alloc, buf, sizeof(buf)); 697 snd_print_channel_allocation(eld->info.spk_alloc, buf, sizeof(buf));
697 snd_printdd("HDMI: select CA 0x%x for %d-channel allocation: %s\n", 698 codec_dbg(codec, "HDMI: select CA 0x%x for %d-channel allocation: %s\n",
698 ca, channels, buf); 699 ca, channels, buf);
699 700
700 return ca; 701 return ca;
@@ -1131,7 +1132,7 @@ static void hdmi_setup_audio_infoframe(struct hda_codec *codec,
1131 if (!non_pcm && per_pin->chmap_set) 1132 if (!non_pcm && per_pin->chmap_set)
1132 ca = hdmi_manual_channel_allocation(channels, per_pin->chmap); 1133 ca = hdmi_manual_channel_allocation(channels, per_pin->chmap);
1133 else 1134 else
1134 ca = hdmi_channel_allocation(eld, channels); 1135 ca = hdmi_channel_allocation(codec, eld, channels);
1135 if (ca < 0) 1136 if (ca < 0)
1136 ca = 0; 1137 ca = 0;
1137 1138
@@ -1557,13 +1558,13 @@ static bool hdmi_present_sense(struct hdmi_spec_per_pin *per_pin, int repoll)
1557 eld->eld_valid = false; 1558 eld->eld_valid = false;
1558 else { 1559 else {
1559 memset(&eld->info, 0, sizeof(struct parsed_hdmi_eld)); 1560 memset(&eld->info, 0, sizeof(struct parsed_hdmi_eld));
1560 if (snd_hdmi_parse_eld(&eld->info, eld->eld_buffer, 1561 if (snd_hdmi_parse_eld(codec, &eld->info, eld->eld_buffer,
1561 eld->eld_size) < 0) 1562 eld->eld_size) < 0)
1562 eld->eld_valid = false; 1563 eld->eld_valid = false;
1563 } 1564 }
1564 1565
1565 if (eld->eld_valid) { 1566 if (eld->eld_valid) {
1566 snd_hdmi_show_eld(&eld->info); 1567 snd_hdmi_show_eld(codec, &eld->info);
1567 update_eld = true; 1568 update_eld = true;
1568 } 1569 }
1569 else if (repoll) { 1570 else if (repoll) {