Source-Changes-HG archive

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

[src/trunk]: src/sys/dev/ic Add new AC97_HOST_SWAPPED_CHANNELS host flag that...



details:   https://anonhg.NetBSD.org/src/rev/1a51d80f8b96
branches:  trunk
changeset: 501966:1a51d80f8b96
user:      rh <rh%NetBSD.org@localhost>
date:      Tue Jan 09 23:14:25 2001 +0000

description:
Add new AC97_HOST_SWAPPED_CHANNELS host flag that causes left and right
mixer channels to be swapped (required for hardware that has wiring
reversed).

diffstat:

 sys/dev/ic/ac97.c    |  21 ++++++++++++++++-----
 sys/dev/ic/ac97var.h |   3 ++-
 2 files changed, 18 insertions(+), 6 deletions(-)

diffs (59 lines):

diff -r 42ad655e76d5 -r 1a51d80f8b96 sys/dev/ic/ac97.c
--- a/sys/dev/ic/ac97.c Tue Jan 09 22:25:55 2001 +0000
+++ b/sys/dev/ic/ac97.c Tue Jan 09 23:14:25 2001 +0000
@@ -1,4 +1,4 @@
-/*      $NetBSD: ac97.c,v 1.16 2001/01/05 03:32:11 augustss Exp $ */
+/*      $NetBSD: ac97.c,v 1.17 2001/01/09 23:14:25 rh Exp $ */
 /*     $OpenBSD: ac97.c,v 1.8 2000/07/19 09:01:35 csapuntz Exp $       */
 
 /*
@@ -730,8 +730,14 @@
                if (cp->un.value.num_channels == 1) {
                        l = r = cp->un.value.level[AUDIO_MIXER_LEVEL_MONO];
                } else {
-                       l = cp->un.value.level[AUDIO_MIXER_LEVEL_LEFT];
-                       r = cp->un.value.level[AUDIO_MIXER_LEVEL_RIGHT];
+                       if (!(as->host_flags & AC97_HOST_SWAPPED_CHANNELS)) {
+                               l = cp->un.value.level[AUDIO_MIXER_LEVEL_LEFT];
+                               r = cp->un.value.level[AUDIO_MIXER_LEVEL_RIGHT];
+                       } else {        /* left/right is reversed here */
+                               r = cp->un.value.level[AUDIO_MIXER_LEVEL_LEFT];
+                               l = cp->un.value.level[AUDIO_MIXER_LEVEL_RIGHT];
+                       }
+
                }
 
                if (!si->polarity) {
@@ -820,8 +826,13 @@
                if (value->num_channels == 1) {
                        l = r = (val >> si->ofs) & mask;
                } else {
-                       l = (val >> si->ofs) & mask;
-                       r = (val >> (si->ofs + 8)) & mask;
+                       if (!(as->host_flags & AC97_HOST_SWAPPED_CHANNELS)) {
+                               l = (val >> si->ofs) & mask;
+                               r = (val >> (si->ofs + 8)) & mask;
+                       } else {        /* host has reversed channels */
+                               r = (val >> si->ofs) & mask;
+                               l = (val >> (si->ofs + 8)) & mask;
+                       }
                }
 
                l = (l << (8 - si->bits));
diff -r 42ad655e76d5 -r 1a51d80f8b96 sys/dev/ic/ac97var.h
--- a/sys/dev/ic/ac97var.h      Tue Jan 09 22:25:55 2001 +0000
+++ b/sys/dev/ic/ac97var.h      Tue Jan 09 23:14:25 2001 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ac97var.h,v 1.2 2000/11/04 08:07:14 thorpej Exp $      */
+/*     $NetBSD: ac97var.h,v 1.3 2001/01/09 23:14:25 rh Exp $   */
 /*     $OpenBSD: ac97.h,v 1.4 2000/07/19 09:01:35 csapuntz Exp $       */
 
 /*
@@ -43,6 +43,7 @@
 
        enum ac97_host_flags {
                AC97_HOST_DONT_READ = 0x1,
+               AC97_HOST_SWAPPED_CHANNELS = 0x2,       /* l/r is reversed */
        };
 
        enum ac97_host_flags (*flags)(void *arg);



Home | Main Index | Thread Index | Old Index