Commit b2e65c8e9133218eb28c30e79ddd3d66d4666ba0
Committed by
Takashi Iwai
1 parent
26aebef420
Exists in
master
and in
39 other branches
ALSA: asihpi - Update verbose debug print macros
Replace local VPRINTK1 with snd_printdd. Create local snd_printddd instead of VPRINTK2 for most verbose debug. In most cases let snd_printk supply default level for messages. Signed-off-by: Eliot Blennerhassett <eblennerhassett@audioscience.com> Signed-off-by: Takashi Iwai <tiwai@suse.de>
Showing 1 changed file with 47 additions and 53 deletions Side-by-side Diff
sound/pci/asihpi/asihpi.c
... | ... | @@ -22,21 +22,6 @@ |
22 | 22 | * for any purpose including commercial applications. |
23 | 23 | */ |
24 | 24 | |
25 | -/* >0: print Hw params, timer vars. >1: print stream write/copy sizes */ | |
26 | -#define REALLY_VERBOSE_LOGGING 0 | |
27 | - | |
28 | -#if REALLY_VERBOSE_LOGGING | |
29 | -#define VPRINTK1 snd_printd | |
30 | -#else | |
31 | -#define VPRINTK1(...) | |
32 | -#endif | |
33 | - | |
34 | -#if REALLY_VERBOSE_LOGGING > 1 | |
35 | -#define VPRINTK2 snd_printd | |
36 | -#else | |
37 | -#define VPRINTK2(...) | |
38 | -#endif | |
39 | - | |
40 | 25 | #include "hpi_internal.h" |
41 | 26 | #include "hpimsginit.h" |
42 | 27 | #include "hpioctl.h" |
43 | 28 | |
... | ... | @@ -57,11 +42,25 @@ |
57 | 42 | #include <sound/tlv.h> |
58 | 43 | #include <sound/hwdep.h> |
59 | 44 | |
60 | - | |
61 | 45 | MODULE_LICENSE("GPL"); |
62 | 46 | MODULE_AUTHOR("AudioScience inc. <support@audioscience.com>"); |
63 | 47 | MODULE_DESCRIPTION("AudioScience ALSA ASI5000 ASI6000 ASI87xx ASI89xx"); |
64 | 48 | |
49 | +#if defined CONFIG_SND_DEBUG_VERBOSE | |
50 | +/** | |
51 | + * snd_printddd - very verbose debug printk | |
52 | + * @format: format string | |
53 | + * | |
54 | + * Works like snd_printk() for debugging purposes. | |
55 | + * Ignored when CONFIG_SND_DEBUG_VERBOSE is not set. | |
56 | + * Must set snd module debug parameter to 3 to enable at runtime. | |
57 | + */ | |
58 | +#define snd_printddd(format, args...) \ | |
59 | + __snd_printk(3, __FILE__, __LINE__, format, ##args) | |
60 | +#else | |
61 | +#define snd_printddd(format, args...) do { } while (0) | |
62 | +#endif | |
63 | + | |
65 | 64 | static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* index 0-MAX */ |
66 | 65 | static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */ |
67 | 66 | static int enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP; |
... | ... | @@ -289,7 +288,6 @@ |
289 | 288 | #define hpi_handle_error(x) handle_error(x, __LINE__, __FILE__) |
290 | 289 | |
291 | 290 | /***************************** GENERAL PCM ****************/ |
292 | -#if REALLY_VERBOSE_LOGGING | |
293 | 291 | static void print_hwparams(struct snd_pcm_hw_params *p) |
294 | 292 | { |
295 | 293 | snd_printd("HWPARAMS \n"); |
... | ... | @@ -304,9 +302,6 @@ |
304 | 302 | snd_printd("periods %d \n", params_periods(p)); |
305 | 303 | snd_printd("buffer_size %d \n", params_buffer_size(p)); |
306 | 304 | } |
307 | -#else | |
308 | -#define print_hwparams(x) | |
309 | -#endif | |
310 | 305 | |
311 | 306 | static snd_pcm_format_t hpi_to_alsa_formats[] = { |
312 | 307 | -1, /* INVALID */ |
... | ... | @@ -464,7 +459,7 @@ |
464 | 459 | if (err) |
465 | 460 | return err; |
466 | 461 | |
467 | - VPRINTK1(KERN_INFO "format %d, %d chans, %d_hz\n", | |
462 | + snd_printdd("format %d, %d chans, %d_hz\n", | |
468 | 463 | format, params_channels(params), |
469 | 464 | params_rate(params)); |
470 | 465 | |
471 | 466 | |
... | ... | @@ -487,13 +482,12 @@ |
487 | 482 | err = hpi_stream_host_buffer_attach(dpcm->h_stream, |
488 | 483 | params_buffer_bytes(params), runtime->dma_addr); |
489 | 484 | if (err == 0) { |
490 | - VPRINTK1(KERN_INFO | |
485 | + snd_printdd( | |
491 | 486 | "stream_host_buffer_attach succeeded %u %lu\n", |
492 | 487 | params_buffer_bytes(params), |
493 | 488 | (unsigned long)runtime->dma_addr); |
494 | 489 | } else { |
495 | - snd_printd(KERN_INFO | |
496 | - "stream_host_buffer_attach error %d\n", | |
490 | + snd_printd("stream_host_buffer_attach error %d\n", | |
497 | 491 | err); |
498 | 492 | return -ENOMEM; |
499 | 493 | } |
... | ... | @@ -502,7 +496,7 @@ |
502 | 496 | &dpcm->hpi_buffer_attached, |
503 | 497 | NULL, NULL, NULL); |
504 | 498 | |
505 | - VPRINTK1(KERN_INFO "stream_host_buffer_attach status 0x%x\n", | |
499 | + snd_printdd("stream_host_buffer_attach status 0x%x\n", | |
506 | 500 | dpcm->hpi_buffer_attached); |
507 | 501 | } |
508 | 502 | bytes_per_sec = params_rate(params) * params_channels(params); |
... | ... | @@ -515,7 +509,7 @@ |
515 | 509 | dpcm->bytes_per_sec = bytes_per_sec; |
516 | 510 | dpcm->buffer_bytes = params_buffer_bytes(params); |
517 | 511 | dpcm->period_bytes = params_period_bytes(params); |
518 | - VPRINTK1(KERN_INFO "buffer_bytes=%d, period_bytes=%d, bps=%d\n", | |
512 | + snd_printdd("buffer_bytes=%d, period_bytes=%d, bps=%d\n", | |
519 | 513 | dpcm->buffer_bytes, dpcm->period_bytes, bytes_per_sec); |
520 | 514 | |
521 | 515 | return 0; |
... | ... | @@ -571,7 +565,7 @@ |
571 | 565 | struct snd_pcm_substream *s; |
572 | 566 | u16 e; |
573 | 567 | |
574 | - VPRINTK1(KERN_INFO "%c%d trigger\n", | |
568 | + snd_printdd("%c%d trigger\n", | |
575 | 569 | SCHR(substream->stream), substream->number); |
576 | 570 | switch (cmd) { |
577 | 571 | case SNDRV_PCM_TRIGGER_START: |
... | ... | @@ -595,7 +589,7 @@ |
595 | 589 | * data?? |
596 | 590 | */ |
597 | 591 | unsigned int preload = ds->period_bytes * 1; |
598 | - VPRINTK2(KERN_INFO "%d preload x%x\n", s->number, preload); | |
592 | + snd_printddd("%d preload x%x\n", s->number, preload); | |
599 | 593 | hpi_handle_error(hpi_outstream_write_buf( |
600 | 594 | ds->h_stream, |
601 | 595 | &runtime->dma_area[0], |
... | ... | @@ -605,7 +599,7 @@ |
605 | 599 | } |
606 | 600 | |
607 | 601 | if (card->support_grouping) { |
608 | - VPRINTK1(KERN_INFO "\t%c%d group\n", | |
602 | + snd_printdd("\t%c%d group\n", | |
609 | 603 | SCHR(s->stream), |
610 | 604 | s->number); |
611 | 605 | e = hpi_stream_group_add( |
... | ... | @@ -620,7 +614,7 @@ |
620 | 614 | } else |
621 | 615 | break; |
622 | 616 | } |
623 | - VPRINTK1(KERN_INFO "start\n"); | |
617 | + snd_printdd("start\n"); | |
624 | 618 | /* start the master stream */ |
625 | 619 | snd_card_asihpi_pcm_timer_start(substream); |
626 | 620 | if ((substream->stream == SNDRV_PCM_STREAM_CAPTURE) || |
627 | 621 | |
... | ... | @@ -642,14 +636,14 @@ |
642 | 636 | s->runtime->status->state = SNDRV_PCM_STATE_SETUP; |
643 | 637 | |
644 | 638 | if (card->support_grouping) { |
645 | - VPRINTK1(KERN_INFO "\t%c%d group\n", | |
639 | + snd_printdd("\t%c%d group\n", | |
646 | 640 | SCHR(s->stream), |
647 | 641 | s->number); |
648 | 642 | snd_pcm_trigger_done(s, substream); |
649 | 643 | } else |
650 | 644 | break; |
651 | 645 | } |
652 | - VPRINTK1(KERN_INFO "stop\n"); | |
646 | + snd_printdd("stop\n"); | |
653 | 647 | |
654 | 648 | /* _prepare and _hwparams reset the stream */ |
655 | 649 | hpi_handle_error(hpi_stream_stop(dpcm->h_stream)); |
656 | 650 | |
... | ... | @@ -662,12 +656,12 @@ |
662 | 656 | break; |
663 | 657 | |
664 | 658 | case SNDRV_PCM_TRIGGER_PAUSE_RELEASE: |
665 | - VPRINTK1(KERN_INFO "pause release\n"); | |
659 | + snd_printdd("pause release\n"); | |
666 | 660 | hpi_handle_error(hpi_stream_start(dpcm->h_stream)); |
667 | 661 | snd_card_asihpi_pcm_timer_start(substream); |
668 | 662 | break; |
669 | 663 | case SNDRV_PCM_TRIGGER_PAUSE_PUSH: |
670 | - VPRINTK1(KERN_INFO "pause\n"); | |
664 | + snd_printdd("pause\n"); | |
671 | 665 | snd_card_asihpi_pcm_timer_stop(substream); |
672 | 666 | hpi_handle_error(hpi_stream_stop(dpcm->h_stream)); |
673 | 667 | break; |
... | ... | @@ -739,7 +733,7 @@ |
739 | 733 | u16 state; |
740 | 734 | u32 buffer_size, bytes_avail, samples_played, on_card_bytes; |
741 | 735 | |
742 | - VPRINTK1(KERN_INFO "%c%d snd_card_asihpi_timer_function\n", | |
736 | + snd_printdd("%c%d snd_card_asihpi_timer_function\n", | |
743 | 737 | SCHR(substream->stream), substream->number); |
744 | 738 | |
745 | 739 | /* find minimum newdata and buffer pos in group */ |
746 | 740 | |
... | ... | @@ -768,10 +762,10 @@ |
768 | 762 | if ((bytes_avail == 0) && |
769 | 763 | (on_card_bytes < ds->pcm_buf_host_rw_ofs)) { |
770 | 764 | hpi_handle_error(hpi_stream_start(ds->h_stream)); |
771 | - VPRINTK1(KERN_INFO "P%d start\n", s->number); | |
765 | + snd_printdd("P%d start\n", s->number); | |
772 | 766 | } |
773 | 767 | } else if (state == HPI_STATE_DRAINED) { |
774 | - VPRINTK1(KERN_WARNING "P%d drained\n", | |
768 | + snd_printd(KERN_WARNING "P%d drained\n", | |
775 | 769 | s->number); |
776 | 770 | /*snd_pcm_stop(s, SNDRV_PCM_STATE_XRUN); |
777 | 771 | continue; */ |
778 | 772 | |
... | ... | @@ -792,13 +786,13 @@ |
792 | 786 | newdata); |
793 | 787 | } |
794 | 788 | |
795 | - VPRINTK1(KERN_INFO "PB timer hw_ptr x%04lX, appl_ptr x%04lX\n", | |
789 | + snd_printdd("hw_ptr x%04lX, appl_ptr x%04lX\n", | |
796 | 790 | (unsigned long)frames_to_bytes(runtime, |
797 | 791 | runtime->status->hw_ptr), |
798 | 792 | (unsigned long)frames_to_bytes(runtime, |
799 | 793 | runtime->control->appl_ptr)); |
800 | 794 | |
801 | - VPRINTK1(KERN_INFO "%d %c%d S=%d, rw=%04X, dma=x%04X, left=x%04X," | |
795 | + snd_printdd("%d %c%d S=%d, rw=%04X, dma=x%04X, left=x%04X," | |
802 | 796 | " aux=x%04X space=x%04X\n", |
803 | 797 | loops, SCHR(s->stream), s->number, |
804 | 798 | state, ds->pcm_buf_host_rw_ofs, pcm_buf_dma_ofs, (int)bytes_avail, |
... | ... | @@ -820,7 +814,7 @@ |
820 | 814 | |
821 | 815 | next_jiffies = max(next_jiffies, 1U); |
822 | 816 | dpcm->timer.expires = jiffies + next_jiffies; |
823 | - VPRINTK1(KERN_INFO "jif %d buf pos x%04X newdata x%04X xfer x%04X\n", | |
817 | + snd_printdd("jif %d buf pos x%04X newdata x%04X xfer x%04X\n", | |
824 | 818 | next_jiffies, pcm_buf_dma_ofs, newdata, xfercount); |
825 | 819 | |
826 | 820 | snd_pcm_group_for_each_entry(s, substream) { |
... | ... | @@ -835,7 +829,7 @@ |
835 | 829 | if (xfercount && (on_card_bytes <= ds->period_bytes)) { |
836 | 830 | if (card->support_mmap) { |
837 | 831 | if (s->stream == SNDRV_PCM_STREAM_PLAYBACK) { |
838 | - VPRINTK2(KERN_INFO "P%d write x%04x\n", | |
832 | + snd_printddd("P%d write x%04x\n", | |
839 | 833 | s->number, |
840 | 834 | ds->period_bytes); |
841 | 835 | hpi_handle_error( |
... | ... | @@ -846,7 +840,7 @@ |
846 | 840 | xfercount, |
847 | 841 | &ds->format)); |
848 | 842 | } else { |
849 | - VPRINTK2(KERN_INFO "C%d read x%04x\n", | |
843 | + snd_printddd("C%d read x%04x\n", | |
850 | 844 | s->number, |
851 | 845 | xfercount); |
852 | 846 | hpi_handle_error( |
... | ... | @@ -869,7 +863,7 @@ |
869 | 863 | static int snd_card_asihpi_playback_ioctl(struct snd_pcm_substream *substream, |
870 | 864 | unsigned int cmd, void *arg) |
871 | 865 | { |
872 | - /* snd_printd(KERN_INFO "Playback ioctl %d\n", cmd); */ | |
866 | + snd_printdd(KERN_INFO "Playback ioctl %d\n", cmd); | |
873 | 867 | return snd_pcm_lib_ioctl(substream, cmd, arg); |
874 | 868 | } |
875 | 869 | |
... | ... | @@ -879,7 +873,7 @@ |
879 | 873 | struct snd_pcm_runtime *runtime = substream->runtime; |
880 | 874 | struct snd_card_asihpi_pcm *dpcm = runtime->private_data; |
881 | 875 | |
882 | - VPRINTK1(KERN_INFO "playback prepare %d\n", substream->number); | |
876 | + snd_printdd("playback prepare %d\n", substream->number); | |
883 | 877 | |
884 | 878 | hpi_handle_error(hpi_outstream_reset(dpcm->h_stream)); |
885 | 879 | dpcm->pcm_buf_host_rw_ofs = 0; |
... | ... | @@ -896,7 +890,7 @@ |
896 | 890 | snd_pcm_uframes_t ptr; |
897 | 891 | |
898 | 892 | ptr = bytes_to_frames(runtime, dpcm->pcm_buf_dma_ofs % dpcm->buffer_bytes); |
899 | - /* VPRINTK2(KERN_INFO "playback_pointer=x%04lx\n", (unsigned long)ptr); */ | |
893 | + snd_printddd("playback_pointer=x%04lx\n", (unsigned long)ptr); | |
900 | 894 | return ptr; |
901 | 895 | } |
902 | 896 | |
... | ... | @@ -1018,7 +1012,7 @@ |
1018 | 1012 | |
1019 | 1013 | snd_pcm_set_sync(substream); |
1020 | 1014 | |
1021 | - VPRINTK1(KERN_INFO "playback open\n"); | |
1015 | + snd_printdd("playback open\n"); | |
1022 | 1016 | |
1023 | 1017 | return 0; |
1024 | 1018 | } |
... | ... | @@ -1029,7 +1023,7 @@ |
1029 | 1023 | struct snd_card_asihpi_pcm *dpcm = runtime->private_data; |
1030 | 1024 | |
1031 | 1025 | hpi_handle_error(hpi_outstream_close(dpcm->h_stream)); |
1032 | - VPRINTK1(KERN_INFO "playback close\n"); | |
1026 | + snd_printdd("playback close\n"); | |
1033 | 1027 | |
1034 | 1028 | return 0; |
1035 | 1029 | } |
... | ... | @@ -1049,7 +1043,7 @@ |
1049 | 1043 | if (copy_from_user(runtime->dma_area, src, len)) |
1050 | 1044 | return -EFAULT; |
1051 | 1045 | |
1052 | - VPRINTK2(KERN_DEBUG "playback copy%d %u bytes\n", | |
1046 | + snd_printddd("playback copy%d %u bytes\n", | |
1053 | 1047 | substream->number, len); |
1054 | 1048 | |
1055 | 1049 | hpi_handle_error(hpi_outstream_write_buf(dpcm->h_stream, |
... | ... | @@ -1104,7 +1098,7 @@ |
1104 | 1098 | struct snd_pcm_runtime *runtime = substream->runtime; |
1105 | 1099 | struct snd_card_asihpi_pcm *dpcm = runtime->private_data; |
1106 | 1100 | |
1107 | - VPRINTK2(KERN_INFO "capture pointer %d=%d\n", | |
1101 | + snd_printddd("capture pointer %d=%d\n", | |
1108 | 1102 | substream->number, dpcm->pcm_buf_dma_ofs); |
1109 | 1103 | /* NOTE Unlike playback can't use actual samples_played |
1110 | 1104 | for the capture position, because those samples aren't yet in |
... | ... | @@ -1129,7 +1123,7 @@ |
1129 | 1123 | dpcm->pcm_buf_dma_ofs = 0; |
1130 | 1124 | dpcm->pcm_buf_elapsed_dma_ofs = 0; |
1131 | 1125 | |
1132 | - VPRINTK1("Capture Prepare %d\n", substream->number); | |
1126 | + snd_printdd("Capture Prepare %d\n", substream->number); | |
1133 | 1127 | return 0; |
1134 | 1128 | } |
1135 | 1129 | |
... | ... | @@ -1192,7 +1186,7 @@ |
1192 | 1186 | if (dpcm == NULL) |
1193 | 1187 | return -ENOMEM; |
1194 | 1188 | |
1195 | - VPRINTK1("hpi_instream_open adapter %d stream %d\n", | |
1189 | + snd_printdd("capture open adapter %d stream %d\n", | |
1196 | 1190 | card->adapter_index, substream->number); |
1197 | 1191 | |
1198 | 1192 | err = hpi_handle_error( |
... | ... | @@ -1262,7 +1256,7 @@ |
1262 | 1256 | |
1263 | 1257 | len = frames_to_bytes(runtime, count); |
1264 | 1258 | |
1265 | - VPRINTK2(KERN_INFO "capture copy%d %d bytes\n", substream->number, len); | |
1259 | + snd_printddd("capture copy%d %d bytes\n", substream->number, len); | |
1266 | 1260 | hpi_handle_error(hpi_instream_read_buf(dpcm->h_stream, |
1267 | 1261 | runtime->dma_area, len)); |
1268 | 1262 | |
... | ... | @@ -2906,7 +2900,6 @@ |
2906 | 2900 | asihpi->support_mrx |
2907 | 2901 | ); |
2908 | 2902 | |
2909 | - | |
2910 | 2903 | err = snd_card_asihpi_pcm_new(asihpi, 0, pcm_substreams); |
2911 | 2904 | if (err < 0) { |
2912 | 2905 | snd_printk(KERN_ERR "pcm_new failed\n"); |
... | ... | @@ -2941,6 +2934,7 @@ |
2941 | 2934 | sprintf(card->longname, "%s %i", |
2942 | 2935 | card->shortname, asihpi->adapter_index); |
2943 | 2936 | err = snd_card_register(card); |
2937 | + | |
2944 | 2938 | if (!err) { |
2945 | 2939 | hpi_card->snd_card_asihpi = card; |
2946 | 2940 | dev++; |