Re: sun4c audio in 4.5
Jacob Meuser <[email protected]>
| Newsgroups | gmane.os.openbsd.sparc |
|---|---|
| Message-ID | <[email protected]> |
On Sat, May 16, 2009 at 08:35:25PM +0200, Alexandre Ratchov wrote:
> here's the diff. I've no system to test/compile it
> so i'm pretty sure it requires some tweaking, but the
> approach should work. Anyone could tweak/test it ?
>
> -- Alexandre
> Index: amd7930.c
> ===================================================================
> RCS file: /cvs/src/sys/arch/sparc/dev/amd7930.c,v
> retrieving revision 1.32
> diff -u -p -r1.32 amd7930.c
> --- amd7930.c 10 Apr 2009 20:53:51 -0000 1.32
> +++ amd7930.c 16 May 2009 18:31:46 -0000
> @@ -43,6 +43,7 @@
>
> #include <sys/audioio.h>
> #include <dev/audio_if.h>
> +#include <dev/mulaw.h>
>
> #include <dev/ic/am7930reg.h>
> #include <sparc/dev/amd7930var.h>
> @@ -389,13 +390,21 @@ amd7930_set_params(addr, setmode, usemod
> int setmode, usemode;
> struct audio_params *p, *r;
> {
> - if (p->sample_rate < 7500 || p->sample_rate > 8500 ||
> - p->encoding != AUDIO_ENCODING_ULAW ||
> - p->precision != 8 ||
> - p->channels != 1)
> - return (EINVAL);
> - p->sample_rate = 8000; /* no other rates supported by amd chip */
> -
> + if (setmode & AUDIO_PLAY) {
> + p->sample_rate = 8000;
> + p->encoding = AUDIO_ENCODING_ULINEAR;
> + p->precision = 8;
> + p->channels = 1;
> + p->sw_code = ulinear8_to_mulaw;
> + p->factor = 1;
> + } else if (setmode & AUDIO_RECORD) {
> + r->sample_rate = 8000;
> + r->encoding = AUDIO_ENCODING_ULINEAR;
> + r->precision = 8;
> + r->channels = 1;
> + r->sw_code = mulaw_to_ulinear8;
> + r->factor = 1;
> + }
> return (0);
> }
>
> @@ -406,8 +415,8 @@ amd7930_query_encoding(addr, fp)
> {
> switch (fp->index) {
> case 0:
> - strlcpy(fp->name, AudioEmulaw, sizeof fp->name);
> - fp->encoding = AUDIO_ENCODING_ULAW;
> + strlcpy(fp->name, AudioEulinear, sizeof fp->name);
> + fp->encoding = AUDIO_ENCODING_ULINEAR;
> fp->precision = 8;
> fp->flags = 0;
> break;
hmm, should we do fp->flags = AUDIO_ENCODING_EMULATED? I guess it's
kind of pointless since this is the only supported encoding.
if this thing really can do full-duplex, as the driver claims, then it
should be
if (setmode & AUMODE_PLAY) {
...
}
if (setmode & AUMODE_RECORD) {
...
}
right?
the rest looks good to me.
interesting that the driver wasn't doing anything with recording
parameters before ... makes me wonder if recording ever really worked.
--
[email protected]
SDF Public Access UNIX System - http://sdf.lonestar.org