diff options
author | Mike Frantzen <frantzen@cvs.openbsd.org> | 2002-04-08 01:43:14 +0000 |
---|---|---|
committer | Mike Frantzen <frantzen@cvs.openbsd.org> | 2002-04-08 01:43:14 +0000 |
commit | e210d08481c52a891fa224fcda24646635a68cb6 (patch) | |
tree | b9980e08a01f61ff68f5ec2490090a7122f68d2f /sys/dev/ic | |
parent | 3f0d6f25d6da4f496739325a24c4266771ce238d (diff) |
add flag to swap channels. from netbsd.
ok deraadt@
Diffstat (limited to 'sys/dev/ic')
-rw-r--r-- | sys/dev/ic/ac97.c | 25 | ||||
-rw-r--r-- | sys/dev/ic/ac97.h | 5 |
2 files changed, 22 insertions, 8 deletions
diff --git a/sys/dev/ic/ac97.c b/sys/dev/ic/ac97.c index 16142ac14ef..f41ac66b268 100644 --- a/sys/dev/ic/ac97.c +++ b/sys/dev/ic/ac97.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ac97.c,v 1.29 2002/03/14 01:26:53 millert Exp $ */ +/* $OpenBSD: ac97.c,v 1.30 2002/04/08 01:43:13 frantzen Exp $ */ /* * Copyright (c) 1999, 2000 Constantine Sapuntzakis @@ -829,8 +829,13 @@ ac97_mixer_set_port(codec_if, cp) 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 { + r = cp->un.value.level[AUDIO_MIXER_LEVEL_LEFT]; + l = cp->un.value.level[AUDIO_MIXER_LEVEL_RIGHT]; + } } if (!si->polarity) { @@ -915,9 +920,17 @@ ac97_mixer_get_port(codec_if, cp) (cp->un.value.num_channels > value->num_channels)) return (EINVAL); - l = r = (val >> si->ofs) & mask; - if (value->num_channels > 1) - r = (val >> (si->ofs + 8)) & mask; + if (value->num_channels == 1) + l = r = (val >> si->ofs) & mask; + else { + if (!(as->host_flags & AC97_HOST_SWAPPED_CHANNELS)) { + l = (val >> si->ofs) & mask; + r = (val >> (si->ofs + 8)) & mask; + } else { + r = (val >> si->ofs) & mask; + l = (val >> (si->ofs + 8)) & mask; + } + } l <<= 8 - si->bits; r <<= 8 - si->bits; diff --git a/sys/dev/ic/ac97.h b/sys/dev/ic/ac97.h index 524b732ab67..b7de3048098 100644 --- a/sys/dev/ic/ac97.h +++ b/sys/dev/ic/ac97.h @@ -1,4 +1,4 @@ -/* $OpenBSD: ac97.h,v 1.11 2002/03/14 01:26:53 millert Exp $ */ +/* $OpenBSD: ac97.h,v 1.12 2002/04/08 01:43:13 frantzen Exp $ */ /* * Copyright (c) 1999 Constantine Sapuntzakis @@ -42,7 +42,8 @@ struct ac97_host_if { enum ac97_host_flags { AC97_HOST_DONT_READ = 0x1, - AC97_HOST_DONT_READANY = 0x2 + AC97_HOST_DONT_READANY = 0x2, + AC97_HOST_SWAPPED_CHANNELS = 0x4 }; enum ac97_host_flags (*flags)(void *arg); |