summaryrefslogtreecommitdiff
path: root/sys/arch/zaurus
diff options
context:
space:
mode:
authorAlexandre Ratchov <ratchov@cvs.openbsd.org>2015-05-11 06:46:23 +0000
committerAlexandre Ratchov <ratchov@cvs.openbsd.org>2015-05-11 06:46:23 +0000
commitcb499c42facd77434ebac9a75c6bd41df9f1ed9d (patch)
treecc19762f9b558b3e3639e919167faf31200d4068 /sys/arch/zaurus
parente7adfc42b4982d81907aac13902bddc965027d8d (diff)
Remove all audio format conversion code from the kernel (btw holding
the kernel_lock), as we already do better conversions in user-mode. Yet, no need for every single driver to fiddle with the conversion code as they are done transparently by common MI code. With help from armani and miod, support from mpi ok armani@
Diffstat (limited to 'sys/arch/zaurus')
-rw-r--r--sys/arch/zaurus/conf/files.zaurus4
-rw-r--r--sys/arch/zaurus/dev/zaurus_audio.c255
2 files changed, 9 insertions, 250 deletions
diff --git a/sys/arch/zaurus/conf/files.zaurus b/sys/arch/zaurus/conf/files.zaurus
index 0f909372749..1a566399193 100644
--- a/sys/arch/zaurus/conf/files.zaurus
+++ b/sys/arch/zaurus/conf/files.zaurus
@@ -1,4 +1,4 @@
-# $OpenBSD: files.zaurus,v 1.30 2014/10/18 12:21:57 miod Exp $
+# $OpenBSD: files.zaurus,v 1.31 2015/05/11 06:46:21 ratchov Exp $
#
# First try for arm-specific configuration info
#
@@ -61,7 +61,7 @@ attach zts at pxaip
file arch/zaurus/dev/zts.c zts
# Zaurus sound
-device zaudio: audio, auconv, mulaw, i2s, i2c
+device zaudio: audio, i2s, i2c
attach zaudio at pxaip
file arch/zaurus/dev/zaurus_audio.c zaudio
diff --git a/sys/arch/zaurus/dev/zaurus_audio.c b/sys/arch/zaurus/dev/zaurus_audio.c
index f0bd34352ad..8d83c91a27d 100644
--- a/sys/arch/zaurus/dev/zaurus_audio.c
+++ b/sys/arch/zaurus/dev/zaurus_audio.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: zaurus_audio.c,v 1.18 2014/09/19 16:45:55 jsg Exp $ */
+/* $OpenBSD: zaurus_audio.c,v 1.19 2015/05/11 06:46:21 ratchov Exp $ */
/*
* Copyright (c) 2005 Christopher Pascoe <pascoe@openbsd.org>
@@ -42,10 +42,7 @@
#include <zaurus/dev/zaurus_scoopvar.h>
#include <dev/i2c/wm8750reg.h>
-
#include <dev/audio_if.h>
-#include <dev/mulaw.h>
-#include <dev/auconv.h>
#define WM8750_ADDRESS 0x1B
#define SPKR_VOLUME 112
@@ -483,53 +480,11 @@ zaudio_query_encoding(void *hdl, struct audio_encoding *aep)
{
switch (aep->index) {
case 0:
- strlcpy(aep->name, AudioEulinear, sizeof(aep->name));
- aep->encoding = AUDIO_ENCODING_ULINEAR;
- aep->precision = 8;
- aep->flags = 0;
- break;
- case 1:
- strlcpy(aep->name, AudioEmulaw, sizeof(aep->name));
- aep->encoding = AUDIO_ENCODING_ULAW;
- aep->precision = 8;
- aep->flags = AUDIO_ENCODINGFLAG_EMULATED;
- break;
- case 2:
- strlcpy(aep->name, AudioEalaw, sizeof(aep->name));
- aep->encoding = AUDIO_ENCODING_ALAW;
- aep->precision = 8;
- aep->flags = AUDIO_ENCODINGFLAG_EMULATED;
- break;
- case 3:
- strlcpy(aep->name, AudioEslinear, sizeof(aep->name));
- aep->encoding = AUDIO_ENCODING_SLINEAR;
- aep->precision = 8;
- aep->flags = AUDIO_ENCODINGFLAG_EMULATED;
- break;
- case 4:
strlcpy(aep->name, AudioEslinear_le, sizeof(aep->name));
aep->encoding = AUDIO_ENCODING_SLINEAR_LE;
aep->precision = 16;
aep->flags = 0;
break;
- case 5:
- strlcpy(aep->name, AudioEulinear_le, sizeof(aep->name));
- aep->encoding = AUDIO_ENCODING_ULINEAR_LE;
- aep->precision = 16;
- aep->flags = AUDIO_ENCODINGFLAG_EMULATED;
- break;
- case 6:
- strlcpy(aep->name, AudioEslinear_be, sizeof(aep->name));
- aep->encoding = AUDIO_ENCODING_SLINEAR_BE;
- aep->precision = 16;
- aep->flags = AUDIO_ENCODINGFLAG_EMULATED;
- break;
- case 7:
- strlcpy(aep->name, AudioEulinear_be, sizeof(aep->name));
- aep->encoding = AUDIO_ENCODING_ULINEAR_BE;
- aep->precision = 16;
- aep->flags = AUDIO_ENCODINGFLAG_EMULATED;
- break;
default:
return (EINVAL);
}
@@ -545,177 +500,9 @@ zaudio_set_params(void *hdl, int setmode, int usemode,
struct zaudio_softc *sc = hdl;
if (setmode & AUMODE_PLAY) {
- play->factor = 1;
- play->sw_code = NULL;
- switch(play->encoding) {
- case AUDIO_ENCODING_ULAW:
- switch (play->channels) {
- case 1:
- play->factor = 4;
- play->sw_code = mulaw_to_slinear16_le_mts;
- break;
- case 2:
- play->factor = 2;
- play->sw_code = mulaw_to_slinear16_le;
- break;
- default:
- return (EINVAL);
- }
- break;
- case AUDIO_ENCODING_SLINEAR_LE:
- switch (play->precision) {
- case 8:
- switch (play->channels) {
- case 1:
- play->factor = 4;
- play->sw_code = linear8_to_linear16_le_mts;
- break;
- case 2:
- play->factor = 2;
- play->sw_code = linear8_to_linear16_le;
- break;
- default:
- return (EINVAL);
- }
- break;
- case 16:
- switch (play->channels) {
- case 1:
- play->factor = 2;
- play->sw_code = noswap_bytes_mts;
- break;
- case 2:
- break;
- default:
- return (EINVAL);
- }
- break;
- default:
- return (EINVAL);
- }
- break;
- case AUDIO_ENCODING_ULINEAR_LE:
- switch (play->precision) {
- case 8:
- switch (play->channels) {
- case 1:
- play->factor = 4;
- play->sw_code =
- ulinear8_to_linear16_le_mts;
- break;
- case 2:
- play->factor = 2;
- play->sw_code = ulinear8_to_linear16_le;
- break;
- default:
- return (EINVAL);
- }
- break;
- case 16:
- switch (play->channels) {
- case 1:
- play->factor = 2;
- play->sw_code = change_sign16_le_mts;
- break;
- case 2:
- play->sw_code = change_sign16_le;
- break;
- default:
- return (EINVAL);
- }
- break;
- default:
- return (EINVAL);
- }
- break;
- case AUDIO_ENCODING_ALAW:
- switch (play->channels) {
- case 1:
- play->factor = 4;
- play->sw_code = alaw_to_slinear16_le_mts;
- break;
- case 2:
- play->factor = 2;
- play->sw_code = alaw_to_slinear16_le;
- break;
- default:
- return (EINVAL);
- }
- break;
- case AUDIO_ENCODING_SLINEAR_BE:
- switch (play->precision) {
- case 8:
- switch (play->channels) {
- case 1:
- play->factor = 4;
- play->sw_code =
- linear8_to_linear16_le_mts;
- break;
- case 2:
- play->factor = 2;
- play->sw_code = linear8_to_linear16_le;
- break;
- default:
- return (EINVAL);
- }
- break;
- case 16:
- switch (play->channels) {
- case 1:
- play->factor = 2;
- play->sw_code = swap_bytes_mts;
- break;
- case 2:
- play->sw_code = swap_bytes;
- break;
- default:
- return (EINVAL);
- }
- break;
- default:
- return (EINVAL);
- }
- break;
- case AUDIO_ENCODING_ULINEAR_BE:
- switch (play->precision) {
- case 8:
- switch (play->channels) {
- case 1:
- play->factor = 4;
- play->sw_code =
- ulinear8_to_linear16_le_mts;
- break;
- case 2:
- play->factor = 2;
- play->sw_code = ulinear8_to_linear16_le;
- break;
- default:
- return (EINVAL);
- }
- break;
- case 16:
- switch (play->channels) {
- case 1:
- play->factor = 2;
- play->sw_code =
- swap_bytes_change_sign16_le_mts;
- break;
- case 2:
- play->sw_code =
- swap_bytes_change_sign16_le;
- break;
- default:
- return (EINVAL);
- }
- break;
- default:
- return (EINVAL);
- }
- break;
- default:
- return (EINVAL);
- }
-
+ play->precision = 16;
+ play->channels = 2;
+ play->encoding = AUDIO_ENCODING_SLINEAR_LE;
play->bps = AUDIO_BPS(play->precision);
play->msb = 1;
@@ -724,37 +511,9 @@ zaudio_set_params(void *hdl, int setmode, int usemode,
#if RECORD_XXX_NOT_YET
if (setmode & AUMODE_RECORD) {
- rec->factor = 1;
- rec->sw_code = NULL;
- switch(rec->encoding) {
- case AUDIO_ENCODING_ULAW:
- rec->sw_code = ulinear8_to_mulaw;
- break;
- case AUDIO_ENCODING_SLINEAR_LE:
- if (rec->precision == 8)
- rec->sw_code = change_sign8;
- break;
- case AUDIO_ENCODING_ULINEAR_LE:
- if (rec->precision == 16)
- rec->sw_code = change_sign16_le;
- break;
- case AUDIO_ENCODING_ALAW:
- rec->sw_code = ulinear8_to_alaw;
- break;
- case AUDIO_ENCODING_SLINEAR_BE:
- if (rec->precision == 16)
- rec->sw_code = swap_bytes;
- else
- rec->sw_code = change_sign8;
- break;
- case AUDIO_ENCODING_ULINEAR_BE:
- if (rec->precision == 16)
- rec->sw_code = change_sign16_swap_bytes_le;
- break;
- default:
- return (EINVAL);
- }
-
+ rec->precision = 16;
+ rec->channels = 2;
+ rec->encoding = AUDIO_ENCODING_SLINEAR_LE;
rec->bps = AUDIO_BPS(rec->precision);
rec->msb = 1;