Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/netbsd-9]: src/sys/dev/audio Pull up following revision(s) (requested by...



details:   https://anonhg.NetBSD.org/src/rev/aeac4755e43a
branches:  netbsd-9
changeset: 933015:aeac4755e43a
user:      martin <martin%NetBSD.org@localhost>
date:      Mon May 18 18:05:34 2020 +0000

description:
Pull up following revision(s) (requested by isaki in ticket #910):

        sys/dev/audio/audio.c: revision 1.49
        sys/dev/audio/audio.c: revision 1.61
        sys/dev/audio/audio.c: revision 1.66
        sys/dev/audio/audio.c: revision 1.67

Move #if DIAGNOSTIC..#endif to correct place.
It should ignore stray interrupts regardless of DIAGNOSTIC.

Improve an error message about round_blocksize.

Improve diagnostic messages.

Improve the blocksize notation.
The blocksize is expressed in bytes, and the millisecond notation
is supplementary information to make it easier to understand.

diffstat:

 sys/dev/audio/audio.c |  42 ++++++++++++++++++++++++++++++------------
 1 files changed, 30 insertions(+), 12 deletions(-)

diffs (109 lines):

diff -r fa76f009d3c3 -r aeac4755e43a sys/dev/audio/audio.c
--- a/sys/dev/audio/audio.c     Mon May 18 18:02:23 2020 +0000
+++ b/sys/dev/audio/audio.c     Mon May 18 18:05:34 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: audio.c,v 1.28.2.13 2020/05/18 18:02:23 martin Exp $   */
+/*     $NetBSD: audio.c,v 1.28.2.14 2020/05/18 18:05:34 martin Exp $   */
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -138,7 +138,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: audio.c,v 1.28.2.13 2020/05/18 18:02:23 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: audio.c,v 1.28.2.14 2020/05/18 18:05:34 martin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "audio.h"
@@ -4783,6 +4783,7 @@
        const audio_format2_t *hwfmt, const audio_filter_reg_t *reg)
 {
        char codecbuf[64];
+       char blkdmsbuf[8];
        audio_trackmixer_t *mixer;
        void (*softint_handler)(void *);
        int len;
@@ -4791,6 +4792,7 @@
        size_t bufsize;
        int hwblks;
        int blkms;
+       int blkdms;
        int error;
 
        KASSERT(hwfmt != NULL);
@@ -4827,8 +4829,13 @@
                        if ((rounded * NBBY) % (mixer->hwbuf.fmt.stride *
                            mixer->hwbuf.fmt.channels) != 0) {
                                device_printf(sc->sc_dev,
-                                   "blksize not configured %d -> %d\n",
-                                   blksize, rounded);
+                                   "round_blocksize must return blocksize "
+                                   "divisible by framesize: "
+                                   "blksize=%d rounded=%d "
+                                   "stride=%ubit channels=%u\n",
+                                   blksize, rounded,
+                                   mixer->hwbuf.fmt.stride,
+                                   mixer->hwbuf.fmt.channels);
                                return EINVAL;
                        }
                        /* Recalculation */
@@ -4965,13 +4972,20 @@
                    mixer->hwbuf.fmt.precision);
        }
        blkms = mixer->blktime_n * 1000 / mixer->blktime_d;
-       aprint_normal_dev(sc->sc_dev, "%s:%d%s %dch %dHz, blk %dms for %s\n",
+       blkdms = (mixer->blktime_n * 10000 / mixer->blktime_d) % 10;
+       blkdmsbuf[0] = '\0';
+       if (blkdms != 0) {
+               snprintf(blkdmsbuf, sizeof(blkdmsbuf), ".%1d", blkdms);
+       }
+       aprint_normal_dev(sc->sc_dev,
+           "%s:%d%s %dch %dHz, blk %d bytes (%d%sms) for %s\n",
            audio_encoding_name(mixer->track_fmt.encoding),
            mixer->track_fmt.precision,
            codecbuf,
            mixer->track_fmt.channels,
            mixer->track_fmt.sample_rate,
-           blkms,
+           blksize,
+           blkms, blkdmsbuf,
            (mode == AUMODE_PLAY) ? "playback" : "recording");
 
        return 0;
@@ -5455,12 +5469,14 @@
 
        if (sc->sc_dying)
                return;
+       if (sc->sc_pbusy == false) {
 #if defined(DIAGNOSTIC)
-       if (sc->sc_pbusy == false) {
-               device_printf(sc->sc_dev, "stray interrupt\n");
+               device_printf(sc->sc_dev,
+                   "DIAGNOSTIC: %s raised stray interrupt\n",
+                   device_xname(sc->hw_dev));
+#endif
                return;
        }
-#endif
 
        mixer = sc->sc_pmixer;
        mixer->hw_complete_counter += mixer->frames_per_block;
@@ -5728,12 +5744,14 @@
 
        if (sc->sc_dying)
                return;
+       if (sc->sc_rbusy == false) {
 #if defined(DIAGNOSTIC)
-       if (sc->sc_rbusy == false) {
-               device_printf(sc->sc_dev, "stray interrupt\n");
+               device_printf(sc->sc_dev,
+                   "DIAGNOSTIC: %s raised stray interrupt\n",
+                   device_xname(sc->hw_dev));
+#endif
                return;
        }
-#endif
 
        mixer = sc->sc_rmixer;
        mixer->hw_complete_counter += mixer->frames_per_block;



Home | Main Index | Thread Index | Old Index