merge kent-audio1 branch, which introduces audio filter pipeline to the MI
audio framework
Summary of changes:
* struct audio_params
- remove sw_code, factor, factor_denom, hw_sample_rate,
hw_encoding ,hw_precision, and hw_channels. Conversion information
is conveyed by stream_filter_list_t.
- change the type of sample_rate: u_long -> u_int
- add `validbits,' which represents the valid data size in
precision bits. It is required in order to distinguish 24/32bit
from 24/24bit or 32/32bit.
* audio_hw_if
- add two parameters to set_params()
stream_filter_list_t *pfil, stream_filter_list *rfil
A HW driver should set filter recipes for requested formats
- constify audio_params parameters of trigger_output() and
trigger_input(). They represent audio formats for the hardware.
- make open() and close() optional
- add int (AUMODE_PLAY or AUMODE_RECORD) and audio_params_t parameters
to round_blocksize()
* sw_code is replaced with stream_filter_t.
stream_filer_t converts audio data in an input buffer and writes
into another output buffer unlike sw_code, which converts data in
single buffer.
converters in dev/auconv.c, dev/mulaw.c, dev/aurateconv.c,
dev/tc/bba.c, dev/ic/msm6258.c, and arch/arm/iomd/vidcaudio.c are
reimplemented as stream_filter_t
* MI audio
- audiosetinfo() builds filter pipelines from stream_filter_list_t
filled by audio_hw_if::set_params()
- audiosetinfo() returns with EINVAL if mmapped and set_params()
requests filters
- audio_write(), audio_pint(), and audio_rint() invoke a filter
pipeline.
- ioctl() for FIONREAD, AUDIO_WSEEK, AUDIO_GETIOFFS,
AUDIO_GETOOFFS, and audio_prinfo::{seek,samples} for
AUDIO_GETINFO handle values for a buffer nearest to userland.
* add `struct device *' parameter to ac97_attach()
* all of audio HW drivers follow audio_hw_if and ac97 changes
2005-01-11 01:01:36 +03:00
|
|
|
/* $NetBSD: vidcaudio.c,v 1.41 2005/01/10 22:01:36 kent Exp $ */
|
2001-10-06 02:27:40 +04:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Copyright (c) 1995 Melvin Tang-Richardson
|
|
|
|
*
|
|
|
|
* Redistribution and use in source and binary forms, with or without
|
|
|
|
* modification, are permitted provided that the following conditions
|
|
|
|
* are met:
|
|
|
|
* 1. Redistributions of source code must retain the above copyright
|
|
|
|
* notice, this list of conditions and the following disclaimer.
|
|
|
|
* 2. Redistributions in binary form must reproduce the above copyright
|
|
|
|
* notice, this list of conditions and the following disclaimer in the
|
|
|
|
* documentation and/or other materials provided with the distribution.
|
|
|
|
* 3. All advertising materials mentioning features or use of this software
|
|
|
|
* must display the following acknowledgement:
|
|
|
|
* This product includes software developed by the RiscBSD team.
|
|
|
|
* 4. The name of the author may not be used to endorse or promote products
|
|
|
|
* derived from this software without specific prior written permission.
|
|
|
|
*
|
|
|
|
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
|
|
|
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
|
|
|
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
|
|
|
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
|
|
|
|
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
|
|
|
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
|
|
|
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
|
|
|
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
|
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
|
|
|
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
|
|
*/
|
|
|
|
|
2003-12-31 18:06:24 +03:00
|
|
|
/*-
|
|
|
|
* Copyright (c) 2003 Ben Harris
|
|
|
|
* All rights reserved.
|
|
|
|
*
|
|
|
|
* Redistribution and use in source and binary forms, with or without
|
|
|
|
* modification, are permitted provided that the following conditions
|
|
|
|
* are met:
|
|
|
|
* 1. Redistributions of source code must retain the above copyright
|
|
|
|
* notice, this list of conditions and the following disclaimer.
|
|
|
|
* 2. Redistributions in binary form must reproduce the above copyright
|
|
|
|
* notice, this list of conditions and the following disclaimer in the
|
|
|
|
* documentation and/or other materials provided with the distribution.
|
|
|
|
* 3. The name of the author may not be used to endorse or promote products
|
|
|
|
* derived from this software without specific prior written permission.
|
|
|
|
*
|
|
|
|
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
|
|
|
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
|
|
|
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
|
|
|
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
|
|
|
|
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
|
|
|
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
|
|
|
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
|
|
|
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
|
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
|
|
|
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
|
|
*/
|
|
|
|
|
2001-10-06 02:27:40 +04:00
|
|
|
/*
|
2003-12-31 18:06:24 +03:00
|
|
|
* audio driver for the RiscPC 8/16 bit sound
|
2001-10-06 02:27:40 +04:00
|
|
|
*
|
|
|
|
* Interfaces with the NetBSD generic audio driver to provide SUN
|
|
|
|
* /dev/audio (partial) compatibility.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <sys/param.h> /* proc.h */
|
2002-02-18 15:55:47 +03:00
|
|
|
|
merge kent-audio1 branch, which introduces audio filter pipeline to the MI
audio framework
Summary of changes:
* struct audio_params
- remove sw_code, factor, factor_denom, hw_sample_rate,
hw_encoding ,hw_precision, and hw_channels. Conversion information
is conveyed by stream_filter_list_t.
- change the type of sample_rate: u_long -> u_int
- add `validbits,' which represents the valid data size in
precision bits. It is required in order to distinguish 24/32bit
from 24/24bit or 32/32bit.
* audio_hw_if
- add two parameters to set_params()
stream_filter_list_t *pfil, stream_filter_list *rfil
A HW driver should set filter recipes for requested formats
- constify audio_params parameters of trigger_output() and
trigger_input(). They represent audio formats for the hardware.
- make open() and close() optional
- add int (AUMODE_PLAY or AUMODE_RECORD) and audio_params_t parameters
to round_blocksize()
* sw_code is replaced with stream_filter_t.
stream_filer_t converts audio data in an input buffer and writes
into another output buffer unlike sw_code, which converts data in
single buffer.
converters in dev/auconv.c, dev/mulaw.c, dev/aurateconv.c,
dev/tc/bba.c, dev/ic/msm6258.c, and arch/arm/iomd/vidcaudio.c are
reimplemented as stream_filter_t
* MI audio
- audiosetinfo() builds filter pipelines from stream_filter_list_t
filled by audio_hw_if::set_params()
- audiosetinfo() returns with EINVAL if mmapped and set_params()
requests filters
- audio_write(), audio_pint(), and audio_rint() invoke a filter
pipeline.
- ioctl() for FIONREAD, AUDIO_WSEEK, AUDIO_GETIOFFS,
AUDIO_GETOOFFS, and audio_prinfo::{seek,samples} for
AUDIO_GETINFO handle values for a buffer nearest to userland.
* add `struct device *' parameter to ac97_attach()
* all of audio HW drivers follow audio_hw_if and ac97 changes
2005-01-11 01:01:36 +03:00
|
|
|
__KERNEL_RCSID(0, "$NetBSD: vidcaudio.c,v 1.41 2005/01/10 22:01:36 kent Exp $");
|
2002-02-18 15:55:47 +03:00
|
|
|
|
2003-12-29 19:20:46 +03:00
|
|
|
#include <sys/audioio.h>
|
2001-10-06 02:27:40 +04:00
|
|
|
#include <sys/conf.h> /* autoconfig functions */
|
|
|
|
#include <sys/device.h> /* device calls */
|
|
|
|
#include <sys/errno.h>
|
2004-01-01 20:52:19 +03:00
|
|
|
#include <sys/malloc.h>
|
2003-12-29 19:20:46 +03:00
|
|
|
#include <sys/proc.h> /* device calls */
|
2001-10-06 02:27:40 +04:00
|
|
|
#include <sys/systm.h>
|
|
|
|
|
|
|
|
#include <uvm/uvm_extern.h>
|
|
|
|
|
|
|
|
#include <dev/audio_if.h>
|
2004-01-18 00:49:24 +03:00
|
|
|
#include <dev/audiobellvar.h>
|
merge kent-audio1 branch, which introduces audio filter pipeline to the MI
audio framework
Summary of changes:
* struct audio_params
- remove sw_code, factor, factor_denom, hw_sample_rate,
hw_encoding ,hw_precision, and hw_channels. Conversion information
is conveyed by stream_filter_list_t.
- change the type of sample_rate: u_long -> u_int
- add `validbits,' which represents the valid data size in
precision bits. It is required in order to distinguish 24/32bit
from 24/24bit or 32/32bit.
* audio_hw_if
- add two parameters to set_params()
stream_filter_list_t *pfil, stream_filter_list *rfil
A HW driver should set filter recipes for requested formats
- constify audio_params parameters of trigger_output() and
trigger_input(). They represent audio formats for the hardware.
- make open() and close() optional
- add int (AUMODE_PLAY or AUMODE_RECORD) and audio_params_t parameters
to round_blocksize()
* sw_code is replaced with stream_filter_t.
stream_filer_t converts audio data in an input buffer and writes
into another output buffer unlike sw_code, which converts data in
single buffer.
converters in dev/auconv.c, dev/mulaw.c, dev/aurateconv.c,
dev/tc/bba.c, dev/ic/msm6258.c, and arch/arm/iomd/vidcaudio.c are
reimplemented as stream_filter_t
* MI audio
- audiosetinfo() builds filter pipelines from stream_filter_list_t
filled by audio_hw_if::set_params()
- audiosetinfo() returns with EINVAL if mmapped and set_params()
requests filters
- audio_write(), audio_pint(), and audio_rint() invoke a filter
pipeline.
- ioctl() for FIONREAD, AUDIO_WSEEK, AUDIO_GETIOFFS,
AUDIO_GETOOFFS, and audio_prinfo::{seek,samples} for
AUDIO_GETINFO handle values for a buffer nearest to userland.
* add `struct device *' parameter to ac97_attach()
* all of audio HW drivers follow audio_hw_if and ac97 changes
2005-01-11 01:01:36 +03:00
|
|
|
#include <dev/auconv.h>
|
2003-12-31 18:06:24 +03:00
|
|
|
#include <dev/mulaw.h>
|
2001-10-06 02:27:40 +04:00
|
|
|
|
2001-11-27 04:03:52 +03:00
|
|
|
#include <machine/intr.h>
|
2004-01-01 19:23:15 +03:00
|
|
|
#include <machine/machdep.h>
|
2001-11-22 21:34:30 +03:00
|
|
|
#include <arm/arm32/katelib.h>
|
2001-10-06 02:27:40 +04:00
|
|
|
|
2002-02-18 15:55:47 +03:00
|
|
|
#include <arm/iomd/vidcaudiovar.h>
|
2001-10-06 02:27:40 +04:00
|
|
|
#include <arm/iomd/iomdreg.h>
|
|
|
|
#include <arm/iomd/iomdvar.h>
|
|
|
|
#include <arm/iomd/vidc.h>
|
|
|
|
#include <arm/mainbus/mainbus.h>
|
|
|
|
|
2004-03-13 20:52:02 +03:00
|
|
|
#include "pckbd.h"
|
|
|
|
#if NPCKBD > 0
|
|
|
|
#include <dev/pckbport/pckbdvar.h>
|
|
|
|
#endif
|
|
|
|
|
2004-01-18 00:49:24 +03:00
|
|
|
#include "rpckbd.h"
|
2004-03-13 20:52:02 +03:00
|
|
|
#if NRPCKBD > 0
|
|
|
|
#include <arm/iomd/rpckbdvar.h>
|
|
|
|
#endif
|
2004-01-18 01:52:42 +03:00
|
|
|
|
2004-03-13 20:52:02 +03:00
|
|
|
#include "vt.h"
|
|
|
|
#if NVT > 0
|
2004-01-18 01:52:42 +03:00
|
|
|
extern void vt_hookup_bell(void (*)(void *, u_int, u_int, u_int, int), void *);
|
2004-03-13 20:52:02 +03:00
|
|
|
#endif
|
2004-01-18 00:49:24 +03:00
|
|
|
|
2001-10-06 02:27:40 +04:00
|
|
|
extern int *vidc_base;
|
|
|
|
|
2004-01-01 19:35:35 +03:00
|
|
|
#ifdef VIDCAUDIO_DEBUG
|
|
|
|
#define DPRINTF(x) printf x
|
|
|
|
#else
|
|
|
|
#define DPRINTF(x)
|
|
|
|
#endif
|
|
|
|
|
2003-12-31 18:06:24 +03:00
|
|
|
struct vidcaudio_softc {
|
|
|
|
struct device sc_dev;
|
2001-10-06 02:27:40 +04:00
|
|
|
|
2003-12-31 18:06:24 +03:00
|
|
|
irqhandler_t sc_ih;
|
|
|
|
int sc_dma_intr;
|
2001-10-06 02:27:40 +04:00
|
|
|
|
2004-01-01 19:23:15 +03:00
|
|
|
int sc_is16bit;
|
2001-10-06 02:27:40 +04:00
|
|
|
|
2003-12-31 18:06:24 +03:00
|
|
|
size_t sc_pblksize;
|
2004-01-01 20:52:19 +03:00
|
|
|
vm_offset_t sc_poffset;
|
|
|
|
vm_offset_t sc_pbufsize;
|
|
|
|
paddr_t *sc_ppages;
|
2003-12-31 18:06:24 +03:00
|
|
|
void (*sc_pintr)(void *);
|
|
|
|
void *sc_parg;
|
|
|
|
int sc_pcountdown;
|
2001-10-06 02:27:40 +04:00
|
|
|
};
|
|
|
|
|
2003-12-31 18:40:31 +03:00
|
|
|
static int vidcaudio_probe(struct device *, struct cfdata *, void *);
|
|
|
|
static void vidcaudio_attach(struct device *, struct device *, void *);
|
|
|
|
static void vidcaudio_close(void *);
|
2001-10-06 02:27:40 +04:00
|
|
|
|
2003-12-31 18:40:31 +03:00
|
|
|
static int vidcaudio_intr(void *);
|
|
|
|
static void vidcaudio_rate(int);
|
|
|
|
static void vidcaudio_ctrl(int);
|
|
|
|
static void vidcaudio_stereo(int, int);
|
merge kent-audio1 branch, which introduces audio filter pipeline to the MI
audio framework
Summary of changes:
* struct audio_params
- remove sw_code, factor, factor_denom, hw_sample_rate,
hw_encoding ,hw_precision, and hw_channels. Conversion information
is conveyed by stream_filter_list_t.
- change the type of sample_rate: u_long -> u_int
- add `validbits,' which represents the valid data size in
precision bits. It is required in order to distinguish 24/32bit
from 24/24bit or 32/32bit.
* audio_hw_if
- add two parameters to set_params()
stream_filter_list_t *pfil, stream_filter_list *rfil
A HW driver should set filter recipes for requested formats
- constify audio_params parameters of trigger_output() and
trigger_input(). They represent audio formats for the hardware.
- make open() and close() optional
- add int (AUMODE_PLAY or AUMODE_RECORD) and audio_params_t parameters
to round_blocksize()
* sw_code is replaced with stream_filter_t.
stream_filer_t converts audio data in an input buffer and writes
into another output buffer unlike sw_code, which converts data in
single buffer.
converters in dev/auconv.c, dev/mulaw.c, dev/aurateconv.c,
dev/tc/bba.c, dev/ic/msm6258.c, and arch/arm/iomd/vidcaudio.c are
reimplemented as stream_filter_t
* MI audio
- audiosetinfo() builds filter pipelines from stream_filter_list_t
filled by audio_hw_if::set_params()
- audiosetinfo() returns with EINVAL if mmapped and set_params()
requests filters
- audio_write(), audio_pint(), and audio_rint() invoke a filter
pipeline.
- ioctl() for FIONREAD, AUDIO_WSEEK, AUDIO_GETIOFFS,
AUDIO_GETOOFFS, and audio_prinfo::{seek,samples} for
AUDIO_GETINFO handle values for a buffer nearest to userland.
* add `struct device *' parameter to ac97_attach()
* all of audio HW drivers follow audio_hw_if and ac97 changes
2005-01-11 01:01:36 +03:00
|
|
|
static stream_filter_factory_t mulaw_to_vidc;
|
|
|
|
static stream_filter_factory_t mulaw_to_vidc_stereo;
|
|
|
|
static int mulaw_to_vidc_fetch_to(stream_fetcher_t *, audio_stream_t *, int);
|
|
|
|
static int mulaw_to_vidc_stereo_fetch_to(stream_fetcher_t *,
|
|
|
|
audio_stream_t *, int);
|
2001-10-06 02:27:40 +04:00
|
|
|
|
2002-10-01 07:10:12 +04:00
|
|
|
CFATTACH_DECL(vidcaudio, sizeof(struct vidcaudio_softc),
|
2002-10-02 19:45:10 +04:00
|
|
|
vidcaudio_probe, vidcaudio_attach, NULL, NULL);
|
2001-10-06 02:27:40 +04:00
|
|
|
|
2003-12-31 18:40:31 +03:00
|
|
|
static int vidcaudio_query_encoding(void *, struct audio_encoding *);
|
merge kent-audio1 branch, which introduces audio filter pipeline to the MI
audio framework
Summary of changes:
* struct audio_params
- remove sw_code, factor, factor_denom, hw_sample_rate,
hw_encoding ,hw_precision, and hw_channels. Conversion information
is conveyed by stream_filter_list_t.
- change the type of sample_rate: u_long -> u_int
- add `validbits,' which represents the valid data size in
precision bits. It is required in order to distinguish 24/32bit
from 24/24bit or 32/32bit.
* audio_hw_if
- add two parameters to set_params()
stream_filter_list_t *pfil, stream_filter_list *rfil
A HW driver should set filter recipes for requested formats
- constify audio_params parameters of trigger_output() and
trigger_input(). They represent audio formats for the hardware.
- make open() and close() optional
- add int (AUMODE_PLAY or AUMODE_RECORD) and audio_params_t parameters
to round_blocksize()
* sw_code is replaced with stream_filter_t.
stream_filer_t converts audio data in an input buffer and writes
into another output buffer unlike sw_code, which converts data in
single buffer.
converters in dev/auconv.c, dev/mulaw.c, dev/aurateconv.c,
dev/tc/bba.c, dev/ic/msm6258.c, and arch/arm/iomd/vidcaudio.c are
reimplemented as stream_filter_t
* MI audio
- audiosetinfo() builds filter pipelines from stream_filter_list_t
filled by audio_hw_if::set_params()
- audiosetinfo() returns with EINVAL if mmapped and set_params()
requests filters
- audio_write(), audio_pint(), and audio_rint() invoke a filter
pipeline.
- ioctl() for FIONREAD, AUDIO_WSEEK, AUDIO_GETIOFFS,
AUDIO_GETOOFFS, and audio_prinfo::{seek,samples} for
AUDIO_GETINFO handle values for a buffer nearest to userland.
* add `struct device *' parameter to ac97_attach()
* all of audio HW drivers follow audio_hw_if and ac97 changes
2005-01-11 01:01:36 +03:00
|
|
|
static int vidcaudio_set_params(void *, int, int, audio_params_t *,
|
|
|
|
audio_params_t *, stream_filter_list_t *, stream_filter_list_t *);
|
|
|
|
static int vidcaudio_round_blocksize(void *, int, int, const audio_params_t *);
|
2003-12-31 18:40:31 +03:00
|
|
|
static int vidcaudio_trigger_output(void *, void *, void *, int,
|
merge kent-audio1 branch, which introduces audio filter pipeline to the MI
audio framework
Summary of changes:
* struct audio_params
- remove sw_code, factor, factor_denom, hw_sample_rate,
hw_encoding ,hw_precision, and hw_channels. Conversion information
is conveyed by stream_filter_list_t.
- change the type of sample_rate: u_long -> u_int
- add `validbits,' which represents the valid data size in
precision bits. It is required in order to distinguish 24/32bit
from 24/24bit or 32/32bit.
* audio_hw_if
- add two parameters to set_params()
stream_filter_list_t *pfil, stream_filter_list *rfil
A HW driver should set filter recipes for requested formats
- constify audio_params parameters of trigger_output() and
trigger_input(). They represent audio formats for the hardware.
- make open() and close() optional
- add int (AUMODE_PLAY or AUMODE_RECORD) and audio_params_t parameters
to round_blocksize()
* sw_code is replaced with stream_filter_t.
stream_filer_t converts audio data in an input buffer and writes
into another output buffer unlike sw_code, which converts data in
single buffer.
converters in dev/auconv.c, dev/mulaw.c, dev/aurateconv.c,
dev/tc/bba.c, dev/ic/msm6258.c, and arch/arm/iomd/vidcaudio.c are
reimplemented as stream_filter_t
* MI audio
- audiosetinfo() builds filter pipelines from stream_filter_list_t
filled by audio_hw_if::set_params()
- audiosetinfo() returns with EINVAL if mmapped and set_params()
requests filters
- audio_write(), audio_pint(), and audio_rint() invoke a filter
pipeline.
- ioctl() for FIONREAD, AUDIO_WSEEK, AUDIO_GETIOFFS,
AUDIO_GETOOFFS, and audio_prinfo::{seek,samples} for
AUDIO_GETINFO handle values for a buffer nearest to userland.
* add `struct device *' parameter to ac97_attach()
* all of audio HW drivers follow audio_hw_if and ac97 changes
2005-01-11 01:01:36 +03:00
|
|
|
void (*)(void *), void *, const audio_params_t *);
|
2003-12-31 18:40:31 +03:00
|
|
|
static int vidcaudio_trigger_input(void *, void *, void *, int,
|
merge kent-audio1 branch, which introduces audio filter pipeline to the MI
audio framework
Summary of changes:
* struct audio_params
- remove sw_code, factor, factor_denom, hw_sample_rate,
hw_encoding ,hw_precision, and hw_channels. Conversion information
is conveyed by stream_filter_list_t.
- change the type of sample_rate: u_long -> u_int
- add `validbits,' which represents the valid data size in
precision bits. It is required in order to distinguish 24/32bit
from 24/24bit or 32/32bit.
* audio_hw_if
- add two parameters to set_params()
stream_filter_list_t *pfil, stream_filter_list *rfil
A HW driver should set filter recipes for requested formats
- constify audio_params parameters of trigger_output() and
trigger_input(). They represent audio formats for the hardware.
- make open() and close() optional
- add int (AUMODE_PLAY or AUMODE_RECORD) and audio_params_t parameters
to round_blocksize()
* sw_code is replaced with stream_filter_t.
stream_filer_t converts audio data in an input buffer and writes
into another output buffer unlike sw_code, which converts data in
single buffer.
converters in dev/auconv.c, dev/mulaw.c, dev/aurateconv.c,
dev/tc/bba.c, dev/ic/msm6258.c, and arch/arm/iomd/vidcaudio.c are
reimplemented as stream_filter_t
* MI audio
- audiosetinfo() builds filter pipelines from stream_filter_list_t
filled by audio_hw_if::set_params()
- audiosetinfo() returns with EINVAL if mmapped and set_params()
requests filters
- audio_write(), audio_pint(), and audio_rint() invoke a filter
pipeline.
- ioctl() for FIONREAD, AUDIO_WSEEK, AUDIO_GETIOFFS,
AUDIO_GETOOFFS, and audio_prinfo::{seek,samples} for
AUDIO_GETINFO handle values for a buffer nearest to userland.
* add `struct device *' parameter to ac97_attach()
* all of audio HW drivers follow audio_hw_if and ac97 changes
2005-01-11 01:01:36 +03:00
|
|
|
void (*)(void *), void *, const audio_params_t *);
|
2003-12-31 18:40:31 +03:00
|
|
|
static int vidcaudio_halt_output(void *);
|
|
|
|
static int vidcaudio_halt_input(void *);
|
|
|
|
static int vidcaudio_getdev(void *, struct audio_device *);
|
|
|
|
static int vidcaudio_set_port(void *, mixer_ctrl_t *);
|
|
|
|
static int vidcaudio_get_port(void *, mixer_ctrl_t *);
|
|
|
|
static int vidcaudio_query_devinfo(void *, mixer_devinfo_t *);
|
|
|
|
static int vidcaudio_get_props(void *);
|
|
|
|
|
|
|
|
static struct audio_device vidcaudio_device = {
|
2003-12-31 18:06:24 +03:00
|
|
|
"ARM VIDC",
|
|
|
|
"",
|
2001-10-06 02:27:40 +04:00
|
|
|
"vidcaudio"
|
|
|
|
};
|
|
|
|
|
2004-10-29 16:57:15 +04:00
|
|
|
static const struct audio_hw_if vidcaudio_hw_if = {
|
merge kent-audio1 branch, which introduces audio filter pipeline to the MI
audio framework
Summary of changes:
* struct audio_params
- remove sw_code, factor, factor_denom, hw_sample_rate,
hw_encoding ,hw_precision, and hw_channels. Conversion information
is conveyed by stream_filter_list_t.
- change the type of sample_rate: u_long -> u_int
- add `validbits,' which represents the valid data size in
precision bits. It is required in order to distinguish 24/32bit
from 24/24bit or 32/32bit.
* audio_hw_if
- add two parameters to set_params()
stream_filter_list_t *pfil, stream_filter_list *rfil
A HW driver should set filter recipes for requested formats
- constify audio_params parameters of trigger_output() and
trigger_input(). They represent audio formats for the hardware.
- make open() and close() optional
- add int (AUMODE_PLAY or AUMODE_RECORD) and audio_params_t parameters
to round_blocksize()
* sw_code is replaced with stream_filter_t.
stream_filer_t converts audio data in an input buffer and writes
into another output buffer unlike sw_code, which converts data in
single buffer.
converters in dev/auconv.c, dev/mulaw.c, dev/aurateconv.c,
dev/tc/bba.c, dev/ic/msm6258.c, and arch/arm/iomd/vidcaudio.c are
reimplemented as stream_filter_t
* MI audio
- audiosetinfo() builds filter pipelines from stream_filter_list_t
filled by audio_hw_if::set_params()
- audiosetinfo() returns with EINVAL if mmapped and set_params()
requests filters
- audio_write(), audio_pint(), and audio_rint() invoke a filter
pipeline.
- ioctl() for FIONREAD, AUDIO_WSEEK, AUDIO_GETIOFFS,
AUDIO_GETOOFFS, and audio_prinfo::{seek,samples} for
AUDIO_GETINFO handle values for a buffer nearest to userland.
* add `struct device *' parameter to ac97_attach()
* all of audio HW drivers follow audio_hw_if and ac97 changes
2005-01-11 01:01:36 +03:00
|
|
|
NULL, /* open */
|
2001-10-06 02:27:40 +04:00
|
|
|
vidcaudio_close,
|
2003-12-29 19:25:30 +03:00
|
|
|
NULL,
|
2001-10-06 02:27:40 +04:00
|
|
|
vidcaudio_query_encoding,
|
|
|
|
vidcaudio_set_params,
|
|
|
|
vidcaudio_round_blocksize,
|
2003-12-29 19:25:30 +03:00
|
|
|
NULL,
|
|
|
|
NULL,
|
|
|
|
NULL,
|
2003-12-31 18:06:24 +03:00
|
|
|
NULL,
|
|
|
|
NULL,
|
2001-10-06 02:27:40 +04:00
|
|
|
vidcaudio_halt_output,
|
|
|
|
vidcaudio_halt_input,
|
2003-12-29 19:49:31 +03:00
|
|
|
NULL,
|
2001-10-06 02:27:40 +04:00
|
|
|
vidcaudio_getdev,
|
2003-12-29 19:25:30 +03:00
|
|
|
NULL,
|
2001-10-06 02:27:40 +04:00
|
|
|
vidcaudio_set_port,
|
|
|
|
vidcaudio_get_port,
|
|
|
|
vidcaudio_query_devinfo,
|
2003-12-29 19:25:30 +03:00
|
|
|
NULL,
|
|
|
|
NULL,
|
|
|
|
NULL,
|
|
|
|
NULL,
|
2001-10-06 02:27:40 +04:00
|
|
|
vidcaudio_get_props,
|
2003-12-31 18:06:24 +03:00
|
|
|
vidcaudio_trigger_output,
|
|
|
|
vidcaudio_trigger_input,
|
2003-12-29 19:25:30 +03:00
|
|
|
NULL,
|
2001-10-06 02:27:40 +04:00
|
|
|
};
|
|
|
|
|
2003-12-31 18:40:31 +03:00
|
|
|
static int
|
2003-12-29 19:11:38 +03:00
|
|
|
vidcaudio_probe(struct device *parent, struct cfdata *cf, void *aux)
|
2001-10-06 02:27:40 +04:00
|
|
|
{
|
|
|
|
int id;
|
|
|
|
|
|
|
|
id = IOMD_ID;
|
|
|
|
|
|
|
|
/* So far I only know about this IOMD */
|
|
|
|
switch (id) {
|
|
|
|
case RPC600_IOMD_ID:
|
|
|
|
case ARM7500_IOC_ID:
|
|
|
|
case ARM7500FE_IOC_ID:
|
2003-12-29 19:20:46 +03:00
|
|
|
return 1;
|
2001-10-06 02:27:40 +04:00
|
|
|
default:
|
2003-12-31 18:06:24 +03:00
|
|
|
aprint_error("vidcaudio: Unknown IOMD id=%04x", id);
|
|
|
|
return 0;
|
2001-10-06 02:27:40 +04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2003-12-31 18:40:31 +03:00
|
|
|
static void
|
2003-12-29 19:11:38 +03:00
|
|
|
vidcaudio_attach(struct device *parent, struct device *self, void *aux)
|
2001-10-06 02:27:40 +04:00
|
|
|
{
|
|
|
|
struct vidcaudio_softc *sc = (void *)self;
|
2004-01-18 00:49:24 +03:00
|
|
|
struct device *beepdev;
|
2001-10-06 02:27:40 +04:00
|
|
|
|
2003-12-31 18:06:24 +03:00
|
|
|
switch (IOMD_ID) {
|
2004-01-03 17:53:16 +03:00
|
|
|
#ifndef EB7500ATX
|
2001-10-06 02:27:40 +04:00
|
|
|
case RPC600_IOMD_ID:
|
2004-01-01 19:23:15 +03:00
|
|
|
sc->sc_is16bit = (cmos_read(0xc4) >> 5) & 1;
|
2003-12-31 18:06:24 +03:00
|
|
|
sc->sc_dma_intr = IRQ_DMASCH0;
|
2001-10-06 02:27:40 +04:00
|
|
|
break;
|
2004-01-03 17:53:16 +03:00
|
|
|
#endif
|
2001-10-06 02:27:40 +04:00
|
|
|
case ARM7500_IOC_ID:
|
|
|
|
case ARM7500FE_IOC_ID:
|
2004-01-01 19:23:15 +03:00
|
|
|
sc->sc_is16bit = TRUE;
|
2003-12-31 18:06:24 +03:00
|
|
|
sc->sc_dma_intr = IRQ_SDMA;
|
2001-10-06 02:27:40 +04:00
|
|
|
break;
|
2003-12-31 18:06:24 +03:00
|
|
|
default:
|
|
|
|
aprint_error(": strange IOMD\n");
|
|
|
|
return;
|
2001-10-06 02:27:40 +04:00
|
|
|
}
|
|
|
|
|
2004-01-01 19:23:15 +03:00
|
|
|
if (sc->sc_is16bit)
|
|
|
|
aprint_normal(": 16-bit external DAC\n");
|
|
|
|
else
|
|
|
|
aprint_normal(": 8-bit internal DAC\n");
|
|
|
|
|
2003-12-31 18:06:24 +03:00
|
|
|
/* Install the irq handler for the DMA interrupt */
|
|
|
|
sc->sc_ih.ih_func = vidcaudio_intr;
|
|
|
|
sc->sc_ih.ih_arg = sc;
|
|
|
|
sc->sc_ih.ih_level = IPL_AUDIO;
|
|
|
|
sc->sc_ih.ih_name = self->dv_xname;
|
|
|
|
|
|
|
|
if (irq_claim(sc->sc_dma_intr, &sc->sc_ih) != 0) {
|
|
|
|
aprint_error("%s: couldn't claim IRQ %d\n",
|
|
|
|
self->dv_xname, sc->sc_dma_intr);
|
|
|
|
return;
|
|
|
|
}
|
2001-10-06 02:27:40 +04:00
|
|
|
|
2003-12-31 18:06:24 +03:00
|
|
|
disable_irq(sc->sc_dma_intr);
|
2001-10-06 02:27:40 +04:00
|
|
|
|
2004-01-18 00:49:24 +03:00
|
|
|
beepdev = audio_attach_mi(&vidcaudio_hw_if, sc, self);
|
2004-03-13 20:52:02 +03:00
|
|
|
#if NPCKBD > 0
|
|
|
|
pckbd_hookup_bell(audiobell, beepdev);
|
|
|
|
#endif
|
2004-01-18 00:49:24 +03:00
|
|
|
#if NRPCKBD > 0
|
|
|
|
rpckbd_hookup_bell(audiobell, beepdev);
|
|
|
|
#endif
|
2004-01-18 01:52:42 +03:00
|
|
|
#if NVT > 0
|
|
|
|
vt_hookup_bell(audiobell, beepdev);
|
|
|
|
#endif
|
2001-10-06 02:27:40 +04:00
|
|
|
}
|
|
|
|
|
2003-12-31 18:40:31 +03:00
|
|
|
static void
|
2003-12-29 19:11:38 +03:00
|
|
|
vidcaudio_close(void *addr)
|
2001-10-06 02:27:40 +04:00
|
|
|
{
|
2004-01-01 20:52:19 +03:00
|
|
|
struct vidcaudio_softc *sc = addr;
|
2001-10-06 02:27:40 +04:00
|
|
|
|
2004-01-01 19:35:35 +03:00
|
|
|
DPRINTF(("DEBUG: vidcaudio_close called\n"));
|
2004-01-01 20:52:19 +03:00
|
|
|
/*
|
|
|
|
* We do this here rather than in vidcaudio_halt_output()
|
|
|
|
* because the latter can be called from interrupt context
|
|
|
|
* (audio_pint()->audio_clear()->vidcaudio_halt_output()).
|
|
|
|
*/
|
|
|
|
if (sc->sc_ppages != NULL) {
|
|
|
|
free(sc->sc_ppages, M_DEVBUF);
|
|
|
|
sc->sc_ppages = NULL;
|
|
|
|
}
|
2001-10-06 02:27:40 +04:00
|
|
|
}
|
|
|
|
|
2003-12-29 19:20:46 +03:00
|
|
|
/*
|
|
|
|
* Interface to the generic audio driver
|
|
|
|
*/
|
2001-10-06 02:27:40 +04:00
|
|
|
|
2003-12-31 18:40:31 +03:00
|
|
|
static int
|
2003-12-29 19:11:38 +03:00
|
|
|
vidcaudio_query_encoding(void *addr, struct audio_encoding *fp)
|
2001-10-06 02:27:40 +04:00
|
|
|
{
|
2003-12-31 18:06:24 +03:00
|
|
|
struct vidcaudio_softc *sc = addr;
|
2003-12-29 19:20:46 +03:00
|
|
|
|
2001-10-06 02:27:40 +04:00
|
|
|
switch (fp->index) {
|
|
|
|
case 0:
|
2003-12-31 18:06:24 +03:00
|
|
|
strcpy(fp->name, AudioEmulaw);
|
2001-10-06 02:27:40 +04:00
|
|
|
fp->encoding = AUDIO_ENCODING_ULAW;
|
|
|
|
fp->precision = 8;
|
2004-01-01 19:23:15 +03:00
|
|
|
fp->flags = AUDIO_ENCODINGFLAG_EMULATED;
|
2001-10-06 02:27:40 +04:00
|
|
|
break;
|
|
|
|
|
2003-12-31 18:06:24 +03:00
|
|
|
case 1:
|
2004-01-01 19:23:15 +03:00
|
|
|
if (sc->sc_is16bit) {
|
2003-12-31 18:06:24 +03:00
|
|
|
strcpy(fp->name, AudioEslinear_le);
|
|
|
|
fp->encoding = AUDIO_ENCODING_SLINEAR_LE;
|
|
|
|
fp->precision = 16;
|
|
|
|
fp->flags = 0;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
/* FALLTHROUGH */
|
2001-10-06 02:27:40 +04:00
|
|
|
default:
|
2003-12-29 19:20:46 +03:00
|
|
|
return EINVAL;
|
2001-10-06 02:27:40 +04:00
|
|
|
}
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2004-01-11 01:33:24 +03:00
|
|
|
#define MULAW_TO_VIDC(m) (~((m) << 1 | (m) >> 7))
|
2003-12-31 18:06:24 +03:00
|
|
|
|
merge kent-audio1 branch, which introduces audio filter pipeline to the MI
audio framework
Summary of changes:
* struct audio_params
- remove sw_code, factor, factor_denom, hw_sample_rate,
hw_encoding ,hw_precision, and hw_channels. Conversion information
is conveyed by stream_filter_list_t.
- change the type of sample_rate: u_long -> u_int
- add `validbits,' which represents the valid data size in
precision bits. It is required in order to distinguish 24/32bit
from 24/24bit or 32/32bit.
* audio_hw_if
- add two parameters to set_params()
stream_filter_list_t *pfil, stream_filter_list *rfil
A HW driver should set filter recipes for requested formats
- constify audio_params parameters of trigger_output() and
trigger_input(). They represent audio formats for the hardware.
- make open() and close() optional
- add int (AUMODE_PLAY or AUMODE_RECORD) and audio_params_t parameters
to round_blocksize()
* sw_code is replaced with stream_filter_t.
stream_filer_t converts audio data in an input buffer and writes
into another output buffer unlike sw_code, which converts data in
single buffer.
converters in dev/auconv.c, dev/mulaw.c, dev/aurateconv.c,
dev/tc/bba.c, dev/ic/msm6258.c, and arch/arm/iomd/vidcaudio.c are
reimplemented as stream_filter_t
* MI audio
- audiosetinfo() builds filter pipelines from stream_filter_list_t
filled by audio_hw_if::set_params()
- audiosetinfo() returns with EINVAL if mmapped and set_params()
requests filters
- audio_write(), audio_pint(), and audio_rint() invoke a filter
pipeline.
- ioctl() for FIONREAD, AUDIO_WSEEK, AUDIO_GETIOFFS,
AUDIO_GETOOFFS, and audio_prinfo::{seek,samples} for
AUDIO_GETINFO handle values for a buffer nearest to userland.
* add `struct device *' parameter to ac97_attach()
* all of audio HW drivers follow audio_hw_if and ac97 changes
2005-01-11 01:01:36 +03:00
|
|
|
static stream_filter_t *
|
|
|
|
mulaw_to_vidc(struct audio_softc *sc, const audio_params_t *from,
|
|
|
|
const audio_params_t *to)
|
2003-12-31 18:06:24 +03:00
|
|
|
{
|
merge kent-audio1 branch, which introduces audio filter pipeline to the MI
audio framework
Summary of changes:
* struct audio_params
- remove sw_code, factor, factor_denom, hw_sample_rate,
hw_encoding ,hw_precision, and hw_channels. Conversion information
is conveyed by stream_filter_list_t.
- change the type of sample_rate: u_long -> u_int
- add `validbits,' which represents the valid data size in
precision bits. It is required in order to distinguish 24/32bit
from 24/24bit or 32/32bit.
* audio_hw_if
- add two parameters to set_params()
stream_filter_list_t *pfil, stream_filter_list *rfil
A HW driver should set filter recipes for requested formats
- constify audio_params parameters of trigger_output() and
trigger_input(). They represent audio formats for the hardware.
- make open() and close() optional
- add int (AUMODE_PLAY or AUMODE_RECORD) and audio_params_t parameters
to round_blocksize()
* sw_code is replaced with stream_filter_t.
stream_filer_t converts audio data in an input buffer and writes
into another output buffer unlike sw_code, which converts data in
single buffer.
converters in dev/auconv.c, dev/mulaw.c, dev/aurateconv.c,
dev/tc/bba.c, dev/ic/msm6258.c, and arch/arm/iomd/vidcaudio.c are
reimplemented as stream_filter_t
* MI audio
- audiosetinfo() builds filter pipelines from stream_filter_list_t
filled by audio_hw_if::set_params()
- audiosetinfo() returns with EINVAL if mmapped and set_params()
requests filters
- audio_write(), audio_pint(), and audio_rint() invoke a filter
pipeline.
- ioctl() for FIONREAD, AUDIO_WSEEK, AUDIO_GETIOFFS,
AUDIO_GETOOFFS, and audio_prinfo::{seek,samples} for
AUDIO_GETINFO handle values for a buffer nearest to userland.
* add `struct device *' parameter to ac97_attach()
* all of audio HW drivers follow audio_hw_if and ac97 changes
2005-01-11 01:01:36 +03:00
|
|
|
return auconv_nocontext_filter_factory(mulaw_to_vidc_fetch_to);
|
|
|
|
}
|
2003-12-31 18:06:24 +03:00
|
|
|
|
merge kent-audio1 branch, which introduces audio filter pipeline to the MI
audio framework
Summary of changes:
* struct audio_params
- remove sw_code, factor, factor_denom, hw_sample_rate,
hw_encoding ,hw_precision, and hw_channels. Conversion information
is conveyed by stream_filter_list_t.
- change the type of sample_rate: u_long -> u_int
- add `validbits,' which represents the valid data size in
precision bits. It is required in order to distinguish 24/32bit
from 24/24bit or 32/32bit.
* audio_hw_if
- add two parameters to set_params()
stream_filter_list_t *pfil, stream_filter_list *rfil
A HW driver should set filter recipes for requested formats
- constify audio_params parameters of trigger_output() and
trigger_input(). They represent audio formats for the hardware.
- make open() and close() optional
- add int (AUMODE_PLAY or AUMODE_RECORD) and audio_params_t parameters
to round_blocksize()
* sw_code is replaced with stream_filter_t.
stream_filer_t converts audio data in an input buffer and writes
into another output buffer unlike sw_code, which converts data in
single buffer.
converters in dev/auconv.c, dev/mulaw.c, dev/aurateconv.c,
dev/tc/bba.c, dev/ic/msm6258.c, and arch/arm/iomd/vidcaudio.c are
reimplemented as stream_filter_t
* MI audio
- audiosetinfo() builds filter pipelines from stream_filter_list_t
filled by audio_hw_if::set_params()
- audiosetinfo() returns with EINVAL if mmapped and set_params()
requests filters
- audio_write(), audio_pint(), and audio_rint() invoke a filter
pipeline.
- ioctl() for FIONREAD, AUDIO_WSEEK, AUDIO_GETIOFFS,
AUDIO_GETOOFFS, and audio_prinfo::{seek,samples} for
AUDIO_GETINFO handle values for a buffer nearest to userland.
* add `struct device *' parameter to ac97_attach()
* all of audio HW drivers follow audio_hw_if and ac97 changes
2005-01-11 01:01:36 +03:00
|
|
|
static int
|
|
|
|
mulaw_to_vidc_fetch_to(stream_fetcher_t *self, audio_stream_t *dst, int max_used)
|
|
|
|
{
|
|
|
|
stream_filter_t *this;
|
|
|
|
int m, err;
|
|
|
|
|
|
|
|
this = (stream_filter_t *)self;
|
|
|
|
if ((err = this->prev->fetch_to(this->prev, this->src, max_used)))
|
|
|
|
return err;
|
|
|
|
m = dst->end - dst->start;
|
|
|
|
m = min(m, max_used);
|
|
|
|
FILTER_LOOP_PROLOGUE(this->src, 1, dst, 1, m) {
|
|
|
|
*d = MULAW_TO_VIDC(*s);
|
|
|
|
} FILTER_LOOP_EPILOGUE(this->src, dst);
|
|
|
|
return 0;
|
2003-12-31 18:06:24 +03:00
|
|
|
}
|
|
|
|
|
merge kent-audio1 branch, which introduces audio filter pipeline to the MI
audio framework
Summary of changes:
* struct audio_params
- remove sw_code, factor, factor_denom, hw_sample_rate,
hw_encoding ,hw_precision, and hw_channels. Conversion information
is conveyed by stream_filter_list_t.
- change the type of sample_rate: u_long -> u_int
- add `validbits,' which represents the valid data size in
precision bits. It is required in order to distinguish 24/32bit
from 24/24bit or 32/32bit.
* audio_hw_if
- add two parameters to set_params()
stream_filter_list_t *pfil, stream_filter_list *rfil
A HW driver should set filter recipes for requested formats
- constify audio_params parameters of trigger_output() and
trigger_input(). They represent audio formats for the hardware.
- make open() and close() optional
- add int (AUMODE_PLAY or AUMODE_RECORD) and audio_params_t parameters
to round_blocksize()
* sw_code is replaced with stream_filter_t.
stream_filer_t converts audio data in an input buffer and writes
into another output buffer unlike sw_code, which converts data in
single buffer.
converters in dev/auconv.c, dev/mulaw.c, dev/aurateconv.c,
dev/tc/bba.c, dev/ic/msm6258.c, and arch/arm/iomd/vidcaudio.c are
reimplemented as stream_filter_t
* MI audio
- audiosetinfo() builds filter pipelines from stream_filter_list_t
filled by audio_hw_if::set_params()
- audiosetinfo() returns with EINVAL if mmapped and set_params()
requests filters
- audio_write(), audio_pint(), and audio_rint() invoke a filter
pipeline.
- ioctl() for FIONREAD, AUDIO_WSEEK, AUDIO_GETIOFFS,
AUDIO_GETOOFFS, and audio_prinfo::{seek,samples} for
AUDIO_GETINFO handle values for a buffer nearest to userland.
* add `struct device *' parameter to ac97_attach()
* all of audio HW drivers follow audio_hw_if and ac97 changes
2005-01-11 01:01:36 +03:00
|
|
|
static stream_filter_t *
|
|
|
|
mulaw_to_vidc_stereo(struct audio_softc *sc, const audio_params_t *from,
|
|
|
|
const audio_params_t *to)
|
2003-12-31 18:06:24 +03:00
|
|
|
{
|
merge kent-audio1 branch, which introduces audio filter pipeline to the MI
audio framework
Summary of changes:
* struct audio_params
- remove sw_code, factor, factor_denom, hw_sample_rate,
hw_encoding ,hw_precision, and hw_channels. Conversion information
is conveyed by stream_filter_list_t.
- change the type of sample_rate: u_long -> u_int
- add `validbits,' which represents the valid data size in
precision bits. It is required in order to distinguish 24/32bit
from 24/24bit or 32/32bit.
* audio_hw_if
- add two parameters to set_params()
stream_filter_list_t *pfil, stream_filter_list *rfil
A HW driver should set filter recipes for requested formats
- constify audio_params parameters of trigger_output() and
trigger_input(). They represent audio formats for the hardware.
- make open() and close() optional
- add int (AUMODE_PLAY or AUMODE_RECORD) and audio_params_t parameters
to round_blocksize()
* sw_code is replaced with stream_filter_t.
stream_filer_t converts audio data in an input buffer and writes
into another output buffer unlike sw_code, which converts data in
single buffer.
converters in dev/auconv.c, dev/mulaw.c, dev/aurateconv.c,
dev/tc/bba.c, dev/ic/msm6258.c, and arch/arm/iomd/vidcaudio.c are
reimplemented as stream_filter_t
* MI audio
- audiosetinfo() builds filter pipelines from stream_filter_list_t
filled by audio_hw_if::set_params()
- audiosetinfo() returns with EINVAL if mmapped and set_params()
requests filters
- audio_write(), audio_pint(), and audio_rint() invoke a filter
pipeline.
- ioctl() for FIONREAD, AUDIO_WSEEK, AUDIO_GETIOFFS,
AUDIO_GETOOFFS, and audio_prinfo::{seek,samples} for
AUDIO_GETINFO handle values for a buffer nearest to userland.
* add `struct device *' parameter to ac97_attach()
* all of audio HW drivers follow audio_hw_if and ac97 changes
2005-01-11 01:01:36 +03:00
|
|
|
return auconv_nocontext_filter_factory(mulaw_to_vidc_stereo_fetch_to);
|
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
|
|
|
mulaw_to_vidc_stereo_fetch_to(stream_fetcher_t *self, audio_stream_t *dst,
|
|
|
|
int max_used)
|
|
|
|
{
|
|
|
|
stream_filter_t *this;
|
|
|
|
int m, err;
|
|
|
|
|
|
|
|
this = (stream_filter_t *)self;
|
|
|
|
max_used = (max_used + 1) & ~1;
|
|
|
|
if ((err = this->prev->fetch_to(this->prev, this->src, max_used / 2)))
|
|
|
|
return err;
|
|
|
|
m = (dst->end - dst->start) & ~1;
|
|
|
|
m = min(m, max_used);
|
|
|
|
FILTER_LOOP_PROLOGUE(this->src, 1, dst, 2, m) {
|
|
|
|
d[0] = d[1] = MULAW_TO_VIDC(*s);
|
|
|
|
} FILTER_LOOP_EPILOGUE(this->src, dst);
|
|
|
|
return 0;
|
2003-12-31 18:06:24 +03:00
|
|
|
}
|
|
|
|
|
2003-12-31 18:40:31 +03:00
|
|
|
static int
|
2003-12-29 19:11:38 +03:00
|
|
|
vidcaudio_set_params(void *addr, int setmode, int usemode,
|
merge kent-audio1 branch, which introduces audio filter pipeline to the MI
audio framework
Summary of changes:
* struct audio_params
- remove sw_code, factor, factor_denom, hw_sample_rate,
hw_encoding ,hw_precision, and hw_channels. Conversion information
is conveyed by stream_filter_list_t.
- change the type of sample_rate: u_long -> u_int
- add `validbits,' which represents the valid data size in
precision bits. It is required in order to distinguish 24/32bit
from 24/24bit or 32/32bit.
* audio_hw_if
- add two parameters to set_params()
stream_filter_list_t *pfil, stream_filter_list *rfil
A HW driver should set filter recipes for requested formats
- constify audio_params parameters of trigger_output() and
trigger_input(). They represent audio formats for the hardware.
- make open() and close() optional
- add int (AUMODE_PLAY or AUMODE_RECORD) and audio_params_t parameters
to round_blocksize()
* sw_code is replaced with stream_filter_t.
stream_filer_t converts audio data in an input buffer and writes
into another output buffer unlike sw_code, which converts data in
single buffer.
converters in dev/auconv.c, dev/mulaw.c, dev/aurateconv.c,
dev/tc/bba.c, dev/ic/msm6258.c, and arch/arm/iomd/vidcaudio.c are
reimplemented as stream_filter_t
* MI audio
- audiosetinfo() builds filter pipelines from stream_filter_list_t
filled by audio_hw_if::set_params()
- audiosetinfo() returns with EINVAL if mmapped and set_params()
requests filters
- audio_write(), audio_pint(), and audio_rint() invoke a filter
pipeline.
- ioctl() for FIONREAD, AUDIO_WSEEK, AUDIO_GETIOFFS,
AUDIO_GETOOFFS, and audio_prinfo::{seek,samples} for
AUDIO_GETINFO handle values for a buffer nearest to userland.
* add `struct device *' parameter to ac97_attach()
* all of audio HW drivers follow audio_hw_if and ac97 changes
2005-01-11 01:01:36 +03:00
|
|
|
audio_params_t *p, audio_params_t *r,
|
|
|
|
stream_filter_list_t *pfil, stream_filter_list_t *rfil)
|
2001-10-06 02:27:40 +04:00
|
|
|
{
|
merge kent-audio1 branch, which introduces audio filter pipeline to the MI
audio framework
Summary of changes:
* struct audio_params
- remove sw_code, factor, factor_denom, hw_sample_rate,
hw_encoding ,hw_precision, and hw_channels. Conversion information
is conveyed by stream_filter_list_t.
- change the type of sample_rate: u_long -> u_int
- add `validbits,' which represents the valid data size in
precision bits. It is required in order to distinguish 24/32bit
from 24/24bit or 32/32bit.
* audio_hw_if
- add two parameters to set_params()
stream_filter_list_t *pfil, stream_filter_list *rfil
A HW driver should set filter recipes for requested formats
- constify audio_params parameters of trigger_output() and
trigger_input(). They represent audio formats for the hardware.
- make open() and close() optional
- add int (AUMODE_PLAY or AUMODE_RECORD) and audio_params_t parameters
to round_blocksize()
* sw_code is replaced with stream_filter_t.
stream_filer_t converts audio data in an input buffer and writes
into another output buffer unlike sw_code, which converts data in
single buffer.
converters in dev/auconv.c, dev/mulaw.c, dev/aurateconv.c,
dev/tc/bba.c, dev/ic/msm6258.c, and arch/arm/iomd/vidcaudio.c are
reimplemented as stream_filter_t
* MI audio
- audiosetinfo() builds filter pipelines from stream_filter_list_t
filled by audio_hw_if::set_params()
- audiosetinfo() returns with EINVAL if mmapped and set_params()
requests filters
- audio_write(), audio_pint(), and audio_rint() invoke a filter
pipeline.
- ioctl() for FIONREAD, AUDIO_WSEEK, AUDIO_GETIOFFS,
AUDIO_GETOOFFS, and audio_prinfo::{seek,samples} for
AUDIO_GETINFO handle values for a buffer nearest to userland.
* add `struct device *' parameter to ac97_attach()
* all of audio HW drivers follow audio_hw_if and ac97 changes
2005-01-11 01:01:36 +03:00
|
|
|
audio_params_t hw;
|
2003-12-31 18:06:24 +03:00
|
|
|
struct vidcaudio_softc *sc = addr;
|
|
|
|
int sample_period, ch;
|
|
|
|
|
2004-01-18 02:41:20 +03:00
|
|
|
if ((setmode & AUMODE_PLAY) == 0)
|
2004-01-18 17:42:09 +03:00
|
|
|
return 0;
|
2004-01-18 02:41:20 +03:00
|
|
|
|
|
|
|
if (sc->sc_is16bit) {
|
|
|
|
/* ARM7500ish, 16-bit, two-channel */
|
merge kent-audio1 branch, which introduces audio filter pipeline to the MI
audio framework
Summary of changes:
* struct audio_params
- remove sw_code, factor, factor_denom, hw_sample_rate,
hw_encoding ,hw_precision, and hw_channels. Conversion information
is conveyed by stream_filter_list_t.
- change the type of sample_rate: u_long -> u_int
- add `validbits,' which represents the valid data size in
precision bits. It is required in order to distinguish 24/32bit
from 24/24bit or 32/32bit.
* audio_hw_if
- add two parameters to set_params()
stream_filter_list_t *pfil, stream_filter_list *rfil
A HW driver should set filter recipes for requested formats
- constify audio_params parameters of trigger_output() and
trigger_input(). They represent audio formats for the hardware.
- make open() and close() optional
- add int (AUMODE_PLAY or AUMODE_RECORD) and audio_params_t parameters
to round_blocksize()
* sw_code is replaced with stream_filter_t.
stream_filer_t converts audio data in an input buffer and writes
into another output buffer unlike sw_code, which converts data in
single buffer.
converters in dev/auconv.c, dev/mulaw.c, dev/aurateconv.c,
dev/tc/bba.c, dev/ic/msm6258.c, and arch/arm/iomd/vidcaudio.c are
reimplemented as stream_filter_t
* MI audio
- audiosetinfo() builds filter pipelines from stream_filter_list_t
filled by audio_hw_if::set_params()
- audiosetinfo() returns with EINVAL if mmapped and set_params()
requests filters
- audio_write(), audio_pint(), and audio_rint() invoke a filter
pipeline.
- ioctl() for FIONREAD, AUDIO_WSEEK, AUDIO_GETIOFFS,
AUDIO_GETOOFFS, and audio_prinfo::{seek,samples} for
AUDIO_GETINFO handle values for a buffer nearest to userland.
* add `struct device *' parameter to ac97_attach()
* all of audio HW drivers follow audio_hw_if and ac97 changes
2005-01-11 01:01:36 +03:00
|
|
|
hw = *p;
|
2004-01-18 02:41:20 +03:00
|
|
|
if (p->encoding == AUDIO_ENCODING_ULAW && p->precision == 8) {
|
merge kent-audio1 branch, which introduces audio filter pipeline to the MI
audio framework
Summary of changes:
* struct audio_params
- remove sw_code, factor, factor_denom, hw_sample_rate,
hw_encoding ,hw_precision, and hw_channels. Conversion information
is conveyed by stream_filter_list_t.
- change the type of sample_rate: u_long -> u_int
- add `validbits,' which represents the valid data size in
precision bits. It is required in order to distinguish 24/32bit
from 24/24bit or 32/32bit.
* audio_hw_if
- add two parameters to set_params()
stream_filter_list_t *pfil, stream_filter_list *rfil
A HW driver should set filter recipes for requested formats
- constify audio_params parameters of trigger_output() and
trigger_input(). They represent audio formats for the hardware.
- make open() and close() optional
- add int (AUMODE_PLAY or AUMODE_RECORD) and audio_params_t parameters
to round_blocksize()
* sw_code is replaced with stream_filter_t.
stream_filer_t converts audio data in an input buffer and writes
into another output buffer unlike sw_code, which converts data in
single buffer.
converters in dev/auconv.c, dev/mulaw.c, dev/aurateconv.c,
dev/tc/bba.c, dev/ic/msm6258.c, and arch/arm/iomd/vidcaudio.c are
reimplemented as stream_filter_t
* MI audio
- audiosetinfo() builds filter pipelines from stream_filter_list_t
filled by audio_hw_if::set_params()
- audiosetinfo() returns with EINVAL if mmapped and set_params()
requests filters
- audio_write(), audio_pint(), and audio_rint() invoke a filter
pipeline.
- ioctl() for FIONREAD, AUDIO_WSEEK, AUDIO_GETIOFFS,
AUDIO_GETOOFFS, and audio_prinfo::{seek,samples} for
AUDIO_GETINFO handle values for a buffer nearest to userland.
* add `struct device *' parameter to ac97_attach()
* all of audio HW drivers follow audio_hw_if and ac97 changes
2005-01-11 01:01:36 +03:00
|
|
|
hw.encoding = AUDIO_ENCODING_SLINEAR_LE;
|
|
|
|
hw.precision = hw.validbits = 16;
|
|
|
|
pfil->append(pfil, mulaw_to_linear16, &hw);
|
2004-01-18 02:41:20 +03:00
|
|
|
} else if (p->encoding != AUDIO_ENCODING_SLINEAR_LE ||
|
|
|
|
p->precision != 16)
|
|
|
|
return EINVAL;
|
|
|
|
sample_period = 705600 / 4 / p->sample_rate;
|
|
|
|
if (sample_period < 3) sample_period = 3;
|
|
|
|
vidcaudio_rate(sample_period - 2);
|
|
|
|
vidcaudio_ctrl(SCR_SERIAL);
|
merge kent-audio1 branch, which introduces audio filter pipeline to the MI
audio framework
Summary of changes:
* struct audio_params
- remove sw_code, factor, factor_denom, hw_sample_rate,
hw_encoding ,hw_precision, and hw_channels. Conversion information
is conveyed by stream_filter_list_t.
- change the type of sample_rate: u_long -> u_int
- add `validbits,' which represents the valid data size in
precision bits. It is required in order to distinguish 24/32bit
from 24/24bit or 32/32bit.
* audio_hw_if
- add two parameters to set_params()
stream_filter_list_t *pfil, stream_filter_list *rfil
A HW driver should set filter recipes for requested formats
- constify audio_params parameters of trigger_output() and
trigger_input(). They represent audio formats for the hardware.
- make open() and close() optional
- add int (AUMODE_PLAY or AUMODE_RECORD) and audio_params_t parameters
to round_blocksize()
* sw_code is replaced with stream_filter_t.
stream_filer_t converts audio data in an input buffer and writes
into another output buffer unlike sw_code, which converts data in
single buffer.
converters in dev/auconv.c, dev/mulaw.c, dev/aurateconv.c,
dev/tc/bba.c, dev/ic/msm6258.c, and arch/arm/iomd/vidcaudio.c are
reimplemented as stream_filter_t
* MI audio
- audiosetinfo() builds filter pipelines from stream_filter_list_t
filled by audio_hw_if::set_params()
- audiosetinfo() returns with EINVAL if mmapped and set_params()
requests filters
- audio_write(), audio_pint(), and audio_rint() invoke a filter
pipeline.
- ioctl() for FIONREAD, AUDIO_WSEEK, AUDIO_GETIOFFS,
AUDIO_GETOOFFS, and audio_prinfo::{seek,samples} for
AUDIO_GETINFO handle values for a buffer nearest to userland.
* add `struct device *' parameter to ac97_attach()
* all of audio HW drivers follow audio_hw_if and ac97 changes
2005-01-11 01:01:36 +03:00
|
|
|
hw.sample_rate = 705600 / 4 / sample_period;
|
|
|
|
hw.channels = 2;
|
|
|
|
pfil->append(pfil, aurateconv, &hw);
|
2004-01-18 02:41:20 +03:00
|
|
|
} else {
|
|
|
|
/* VIDC20ish, u-law, 8-channel */
|
|
|
|
if (p->encoding != AUDIO_ENCODING_ULAW || p->precision != 8)
|
|
|
|
return EINVAL;
|
|
|
|
/*
|
|
|
|
* We always use two hardware channels, because using
|
|
|
|
* one at 8kHz gives a nasty whining sound from the
|
|
|
|
* speaker. The aurateconv mechanism doesn't support
|
|
|
|
* ulaw, so we do the channel duplication ourselves,
|
|
|
|
* and don't try to do rate conversion.
|
|
|
|
*/
|
|
|
|
sample_period = 1000000 / 2 / p->sample_rate;
|
|
|
|
if (sample_period < 3) sample_period = 3;
|
merge kent-audio1 branch, which introduces audio filter pipeline to the MI
audio framework
Summary of changes:
* struct audio_params
- remove sw_code, factor, factor_denom, hw_sample_rate,
hw_encoding ,hw_precision, and hw_channels. Conversion information
is conveyed by stream_filter_list_t.
- change the type of sample_rate: u_long -> u_int
- add `validbits,' which represents the valid data size in
precision bits. It is required in order to distinguish 24/32bit
from 24/24bit or 32/32bit.
* audio_hw_if
- add two parameters to set_params()
stream_filter_list_t *pfil, stream_filter_list *rfil
A HW driver should set filter recipes for requested formats
- constify audio_params parameters of trigger_output() and
trigger_input(). They represent audio formats for the hardware.
- make open() and close() optional
- add int (AUMODE_PLAY or AUMODE_RECORD) and audio_params_t parameters
to round_blocksize()
* sw_code is replaced with stream_filter_t.
stream_filer_t converts audio data in an input buffer and writes
into another output buffer unlike sw_code, which converts data in
single buffer.
converters in dev/auconv.c, dev/mulaw.c, dev/aurateconv.c,
dev/tc/bba.c, dev/ic/msm6258.c, and arch/arm/iomd/vidcaudio.c are
reimplemented as stream_filter_t
* MI audio
- audiosetinfo() builds filter pipelines from stream_filter_list_t
filled by audio_hw_if::set_params()
- audiosetinfo() returns with EINVAL if mmapped and set_params()
requests filters
- audio_write(), audio_pint(), and audio_rint() invoke a filter
pipeline.
- ioctl() for FIONREAD, AUDIO_WSEEK, AUDIO_GETIOFFS,
AUDIO_GETOOFFS, and audio_prinfo::{seek,samples} for
AUDIO_GETINFO handle values for a buffer nearest to userland.
* add `struct device *' parameter to ac97_attach()
* all of audio HW drivers follow audio_hw_if and ac97 changes
2005-01-11 01:01:36 +03:00
|
|
|
p->sample_rate = 1000000 / 2 / sample_period;
|
|
|
|
hw = *p;
|
|
|
|
hw.encoding = AUDIO_ENCODING_NONE;
|
|
|
|
hw.precision = 8;
|
2004-01-18 02:41:20 +03:00
|
|
|
vidcaudio_rate(sample_period - 2);
|
|
|
|
vidcaudio_ctrl(SCR_SDAC | SCR_CLKSEL);
|
merge kent-audio1 branch, which introduces audio filter pipeline to the MI
audio framework
Summary of changes:
* struct audio_params
- remove sw_code, factor, factor_denom, hw_sample_rate,
hw_encoding ,hw_precision, and hw_channels. Conversion information
is conveyed by stream_filter_list_t.
- change the type of sample_rate: u_long -> u_int
- add `validbits,' which represents the valid data size in
precision bits. It is required in order to distinguish 24/32bit
from 24/24bit or 32/32bit.
* audio_hw_if
- add two parameters to set_params()
stream_filter_list_t *pfil, stream_filter_list *rfil
A HW driver should set filter recipes for requested formats
- constify audio_params parameters of trigger_output() and
trigger_input(). They represent audio formats for the hardware.
- make open() and close() optional
- add int (AUMODE_PLAY or AUMODE_RECORD) and audio_params_t parameters
to round_blocksize()
* sw_code is replaced with stream_filter_t.
stream_filer_t converts audio data in an input buffer and writes
into another output buffer unlike sw_code, which converts data in
single buffer.
converters in dev/auconv.c, dev/mulaw.c, dev/aurateconv.c,
dev/tc/bba.c, dev/ic/msm6258.c, and arch/arm/iomd/vidcaudio.c are
reimplemented as stream_filter_t
* MI audio
- audiosetinfo() builds filter pipelines from stream_filter_list_t
filled by audio_hw_if::set_params()
- audiosetinfo() returns with EINVAL if mmapped and set_params()
requests filters
- audio_write(), audio_pint(), and audio_rint() invoke a filter
pipeline.
- ioctl() for FIONREAD, AUDIO_WSEEK, AUDIO_GETIOFFS,
AUDIO_GETOOFFS, and audio_prinfo::{seek,samples} for
AUDIO_GETINFO handle values for a buffer nearest to userland.
* add `struct device *' parameter to ac97_attach()
* all of audio HW drivers follow audio_hw_if and ac97 changes
2005-01-11 01:01:36 +03:00
|
|
|
if (p->channels == 1) {
|
|
|
|
pfil->append(pfil, mulaw_to_vidc_stereo, &hw);
|
2004-01-18 02:41:20 +03:00
|
|
|
for (ch = 0; ch < 8; ch++)
|
|
|
|
vidcaudio_stereo(ch, SIR_CENTRE);
|
merge kent-audio1 branch, which introduces audio filter pipeline to the MI
audio framework
Summary of changes:
* struct audio_params
- remove sw_code, factor, factor_denom, hw_sample_rate,
hw_encoding ,hw_precision, and hw_channels. Conversion information
is conveyed by stream_filter_list_t.
- change the type of sample_rate: u_long -> u_int
- add `validbits,' which represents the valid data size in
precision bits. It is required in order to distinguish 24/32bit
from 24/24bit or 32/32bit.
* audio_hw_if
- add two parameters to set_params()
stream_filter_list_t *pfil, stream_filter_list *rfil
A HW driver should set filter recipes for requested formats
- constify audio_params parameters of trigger_output() and
trigger_input(). They represent audio formats for the hardware.
- make open() and close() optional
- add int (AUMODE_PLAY or AUMODE_RECORD) and audio_params_t parameters
to round_blocksize()
* sw_code is replaced with stream_filter_t.
stream_filer_t converts audio data in an input buffer and writes
into another output buffer unlike sw_code, which converts data in
single buffer.
converters in dev/auconv.c, dev/mulaw.c, dev/aurateconv.c,
dev/tc/bba.c, dev/ic/msm6258.c, and arch/arm/iomd/vidcaudio.c are
reimplemented as stream_filter_t
* MI audio
- audiosetinfo() builds filter pipelines from stream_filter_list_t
filled by audio_hw_if::set_params()
- audiosetinfo() returns with EINVAL if mmapped and set_params()
requests filters
- audio_write(), audio_pint(), and audio_rint() invoke a filter
pipeline.
- ioctl() for FIONREAD, AUDIO_WSEEK, AUDIO_GETIOFFS,
AUDIO_GETOOFFS, and audio_prinfo::{seek,samples} for
AUDIO_GETINFO handle values for a buffer nearest to userland.
* add `struct device *' parameter to ac97_attach()
* all of audio HW drivers follow audio_hw_if and ac97 changes
2005-01-11 01:01:36 +03:00
|
|
|
} else {
|
|
|
|
pfil->append(pfil, mulaw_to_vidc, &hw);
|
2004-01-18 02:41:20 +03:00
|
|
|
for (ch = 0; ch < 8; ch += 2)
|
|
|
|
vidcaudio_stereo(ch, SIR_LEFT_100);
|
|
|
|
for (ch = 1; ch < 8; ch += 2)
|
|
|
|
vidcaudio_stereo(ch, SIR_RIGHT_100);
|
2003-12-31 18:06:24 +03:00
|
|
|
}
|
|
|
|
}
|
2001-10-06 02:27:40 +04:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2003-12-31 18:40:31 +03:00
|
|
|
static int
|
merge kent-audio1 branch, which introduces audio filter pipeline to the MI
audio framework
Summary of changes:
* struct audio_params
- remove sw_code, factor, factor_denom, hw_sample_rate,
hw_encoding ,hw_precision, and hw_channels. Conversion information
is conveyed by stream_filter_list_t.
- change the type of sample_rate: u_long -> u_int
- add `validbits,' which represents the valid data size in
precision bits. It is required in order to distinguish 24/32bit
from 24/24bit or 32/32bit.
* audio_hw_if
- add two parameters to set_params()
stream_filter_list_t *pfil, stream_filter_list *rfil
A HW driver should set filter recipes for requested formats
- constify audio_params parameters of trigger_output() and
trigger_input(). They represent audio formats for the hardware.
- make open() and close() optional
- add int (AUMODE_PLAY or AUMODE_RECORD) and audio_params_t parameters
to round_blocksize()
* sw_code is replaced with stream_filter_t.
stream_filer_t converts audio data in an input buffer and writes
into another output buffer unlike sw_code, which converts data in
single buffer.
converters in dev/auconv.c, dev/mulaw.c, dev/aurateconv.c,
dev/tc/bba.c, dev/ic/msm6258.c, and arch/arm/iomd/vidcaudio.c are
reimplemented as stream_filter_t
* MI audio
- audiosetinfo() builds filter pipelines from stream_filter_list_t
filled by audio_hw_if::set_params()
- audiosetinfo() returns with EINVAL if mmapped and set_params()
requests filters
- audio_write(), audio_pint(), and audio_rint() invoke a filter
pipeline.
- ioctl() for FIONREAD, AUDIO_WSEEK, AUDIO_GETIOFFS,
AUDIO_GETOOFFS, and audio_prinfo::{seek,samples} for
AUDIO_GETINFO handle values for a buffer nearest to userland.
* add `struct device *' parameter to ac97_attach()
* all of audio HW drivers follow audio_hw_if and ac97 changes
2005-01-11 01:01:36 +03:00
|
|
|
vidcaudio_round_blocksize(void *addr, int wantblk,
|
|
|
|
int mode, const audio_params_t *param)
|
2001-10-06 02:27:40 +04:00
|
|
|
{
|
2003-12-31 18:06:24 +03:00
|
|
|
int blk;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Find the smallest power of two that's larger than the
|
|
|
|
* requested block size, but don't allow < 32 (DMA burst is 16
|
|
|
|
* bytes, and single bursts are tricky) or > PAGE_SIZE (DMA is
|
|
|
|
* confined to a page).
|
|
|
|
*/
|
|
|
|
|
|
|
|
for (blk = 32; blk < PAGE_SIZE; blk <<= 1)
|
|
|
|
if (blk >= wantblk) return blk;
|
|
|
|
return blk;
|
2001-10-06 02:27:40 +04:00
|
|
|
}
|
|
|
|
|
2003-12-31 18:40:31 +03:00
|
|
|
static int
|
2003-12-31 18:06:24 +03:00
|
|
|
vidcaudio_trigger_output(void *addr, void *start, void *end, int blksize,
|
merge kent-audio1 branch, which introduces audio filter pipeline to the MI
audio framework
Summary of changes:
* struct audio_params
- remove sw_code, factor, factor_denom, hw_sample_rate,
hw_encoding ,hw_precision, and hw_channels. Conversion information
is conveyed by stream_filter_list_t.
- change the type of sample_rate: u_long -> u_int
- add `validbits,' which represents the valid data size in
precision bits. It is required in order to distinguish 24/32bit
from 24/24bit or 32/32bit.
* audio_hw_if
- add two parameters to set_params()
stream_filter_list_t *pfil, stream_filter_list *rfil
A HW driver should set filter recipes for requested formats
- constify audio_params parameters of trigger_output() and
trigger_input(). They represent audio formats for the hardware.
- make open() and close() optional
- add int (AUMODE_PLAY or AUMODE_RECORD) and audio_params_t parameters
to round_blocksize()
* sw_code is replaced with stream_filter_t.
stream_filer_t converts audio data in an input buffer and writes
into another output buffer unlike sw_code, which converts data in
single buffer.
converters in dev/auconv.c, dev/mulaw.c, dev/aurateconv.c,
dev/tc/bba.c, dev/ic/msm6258.c, and arch/arm/iomd/vidcaudio.c are
reimplemented as stream_filter_t
* MI audio
- audiosetinfo() builds filter pipelines from stream_filter_list_t
filled by audio_hw_if::set_params()
- audiosetinfo() returns with EINVAL if mmapped and set_params()
requests filters
- audio_write(), audio_pint(), and audio_rint() invoke a filter
pipeline.
- ioctl() for FIONREAD, AUDIO_WSEEK, AUDIO_GETIOFFS,
AUDIO_GETOOFFS, and audio_prinfo::{seek,samples} for
AUDIO_GETINFO handle values for a buffer nearest to userland.
* add `struct device *' parameter to ac97_attach()
* all of audio HW drivers follow audio_hw_if and ac97 changes
2005-01-11 01:01:36 +03:00
|
|
|
void (*intr)(void *), void *arg, const audio_params_t *params)
|
2001-10-06 02:27:40 +04:00
|
|
|
{
|
2003-12-31 18:06:24 +03:00
|
|
|
struct vidcaudio_softc *sc = addr;
|
2004-01-01 20:52:19 +03:00
|
|
|
size_t npages, i;
|
2001-10-06 02:27:40 +04:00
|
|
|
|
2004-01-01 19:35:35 +03:00
|
|
|
DPRINTF(("vidcaudio_trigger_output %p-%p/0x%x\n",
|
|
|
|
start, end, blksize));
|
2001-10-06 02:27:40 +04:00
|
|
|
|
merge kent-audio1 branch, which introduces audio filter pipeline to the MI
audio framework
Summary of changes:
* struct audio_params
- remove sw_code, factor, factor_denom, hw_sample_rate,
hw_encoding ,hw_precision, and hw_channels. Conversion information
is conveyed by stream_filter_list_t.
- change the type of sample_rate: u_long -> u_int
- add `validbits,' which represents the valid data size in
precision bits. It is required in order to distinguish 24/32bit
from 24/24bit or 32/32bit.
* audio_hw_if
- add two parameters to set_params()
stream_filter_list_t *pfil, stream_filter_list *rfil
A HW driver should set filter recipes for requested formats
- constify audio_params parameters of trigger_output() and
trigger_input(). They represent audio formats for the hardware.
- make open() and close() optional
- add int (AUMODE_PLAY or AUMODE_RECORD) and audio_params_t parameters
to round_blocksize()
* sw_code is replaced with stream_filter_t.
stream_filer_t converts audio data in an input buffer and writes
into another output buffer unlike sw_code, which converts data in
single buffer.
converters in dev/auconv.c, dev/mulaw.c, dev/aurateconv.c,
dev/tc/bba.c, dev/ic/msm6258.c, and arch/arm/iomd/vidcaudio.c are
reimplemented as stream_filter_t
* MI audio
- audiosetinfo() builds filter pipelines from stream_filter_list_t
filled by audio_hw_if::set_params()
- audiosetinfo() returns with EINVAL if mmapped and set_params()
requests filters
- audio_write(), audio_pint(), and audio_rint() invoke a filter
pipeline.
- ioctl() for FIONREAD, AUDIO_WSEEK, AUDIO_GETIOFFS,
AUDIO_GETOOFFS, and audio_prinfo::{seek,samples} for
AUDIO_GETINFO handle values for a buffer nearest to userland.
* add `struct device *' parameter to ac97_attach()
* all of audio HW drivers follow audio_hw_if and ac97 changes
2005-01-11 01:01:36 +03:00
|
|
|
KASSERT(blksize == vidcaudio_round_blocksize(addr, blksize, 0, NULL));
|
2004-01-01 20:52:19 +03:00
|
|
|
KASSERT((vaddr_t)start % blksize == 0);
|
|
|
|
|
2003-12-31 18:06:24 +03:00
|
|
|
sc->sc_pblksize = blksize;
|
2004-01-01 20:52:19 +03:00
|
|
|
sc->sc_pbufsize = (char *)end - (char *)start;
|
|
|
|
npages = sc->sc_pbufsize >> PGSHIFT;
|
|
|
|
if (sc->sc_ppages != NULL)
|
|
|
|
free(sc->sc_ppages, M_DEVBUF);
|
|
|
|
sc->sc_ppages = malloc(npages * sizeof(paddr_t), M_DEVBUF, M_WAITOK);
|
|
|
|
if (sc->sc_ppages == NULL) return ENOMEM;
|
|
|
|
for (i = 0; i < npages; i++)
|
|
|
|
if (!pmap_extract(pmap_kernel(),
|
|
|
|
(vaddr_t)start + i * PAGE_SIZE, &sc->sc_ppages[i]))
|
|
|
|
return EIO;
|
|
|
|
sc->sc_poffset = 0;
|
2003-12-31 18:06:24 +03:00
|
|
|
sc->sc_pintr = intr;
|
|
|
|
sc->sc_parg = arg;
|
|
|
|
|
|
|
|
IOMD_WRITE_WORD(IOMD_SD0CR, IOMD_DMACR_CLEAR | IOMD_DMACR_QUADWORD);
|
|
|
|
IOMD_WRITE_WORD(IOMD_SD0CR, IOMD_DMACR_ENABLE | IOMD_DMACR_QUADWORD);
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Queue up the first two blocks, but don't tell audio code
|
|
|
|
* we're finished with them yet.
|
|
|
|
*/
|
|
|
|
sc->sc_pcountdown = 2;
|
|
|
|
|
|
|
|
enable_irq(sc->sc_dma_intr);
|
2001-10-06 02:27:40 +04:00
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2003-12-31 18:40:31 +03:00
|
|
|
static int
|
2003-12-31 18:06:24 +03:00
|
|
|
vidcaudio_trigger_input(void *addr, void *start, void *end, int blksize,
|
merge kent-audio1 branch, which introduces audio filter pipeline to the MI
audio framework
Summary of changes:
* struct audio_params
- remove sw_code, factor, factor_denom, hw_sample_rate,
hw_encoding ,hw_precision, and hw_channels. Conversion information
is conveyed by stream_filter_list_t.
- change the type of sample_rate: u_long -> u_int
- add `validbits,' which represents the valid data size in
precision bits. It is required in order to distinguish 24/32bit
from 24/24bit or 32/32bit.
* audio_hw_if
- add two parameters to set_params()
stream_filter_list_t *pfil, stream_filter_list *rfil
A HW driver should set filter recipes for requested formats
- constify audio_params parameters of trigger_output() and
trigger_input(). They represent audio formats for the hardware.
- make open() and close() optional
- add int (AUMODE_PLAY or AUMODE_RECORD) and audio_params_t parameters
to round_blocksize()
* sw_code is replaced with stream_filter_t.
stream_filer_t converts audio data in an input buffer and writes
into another output buffer unlike sw_code, which converts data in
single buffer.
converters in dev/auconv.c, dev/mulaw.c, dev/aurateconv.c,
dev/tc/bba.c, dev/ic/msm6258.c, and arch/arm/iomd/vidcaudio.c are
reimplemented as stream_filter_t
* MI audio
- audiosetinfo() builds filter pipelines from stream_filter_list_t
filled by audio_hw_if::set_params()
- audiosetinfo() returns with EINVAL if mmapped and set_params()
requests filters
- audio_write(), audio_pint(), and audio_rint() invoke a filter
pipeline.
- ioctl() for FIONREAD, AUDIO_WSEEK, AUDIO_GETIOFFS,
AUDIO_GETOOFFS, and audio_prinfo::{seek,samples} for
AUDIO_GETINFO handle values for a buffer nearest to userland.
* add `struct device *' parameter to ac97_attach()
* all of audio HW drivers follow audio_hw_if and ac97 changes
2005-01-11 01:01:36 +03:00
|
|
|
void (*intr)(void *), void *arg, const audio_params_t *params)
|
2001-10-06 02:27:40 +04:00
|
|
|
{
|
2003-12-31 18:06:24 +03:00
|
|
|
|
|
|
|
return ENODEV;
|
2001-10-06 02:27:40 +04:00
|
|
|
}
|
|
|
|
|
2003-12-31 18:40:31 +03:00
|
|
|
static int
|
2003-12-29 19:11:38 +03:00
|
|
|
vidcaudio_halt_output(void *addr)
|
2001-10-06 02:27:40 +04:00
|
|
|
{
|
2003-12-31 18:06:24 +03:00
|
|
|
struct vidcaudio_softc *sc = addr;
|
2003-12-29 19:20:46 +03:00
|
|
|
|
2004-01-01 19:35:35 +03:00
|
|
|
DPRINTF(("vidcaudio_halt_output\n"));
|
2003-12-31 18:06:24 +03:00
|
|
|
disable_irq(sc->sc_dma_intr);
|
2004-01-01 20:52:19 +03:00
|
|
|
IOMD_WRITE_WORD(IOMD_SD0CR, IOMD_DMACR_CLEAR | IOMD_DMACR_QUADWORD);
|
2003-12-31 18:06:24 +03:00
|
|
|
return 0;
|
2001-10-06 02:27:40 +04:00
|
|
|
}
|
|
|
|
|
2003-12-31 18:40:31 +03:00
|
|
|
static int
|
2003-12-29 19:11:38 +03:00
|
|
|
vidcaudio_halt_input(void *addr)
|
2001-10-06 02:27:40 +04:00
|
|
|
{
|
2003-12-29 19:20:46 +03:00
|
|
|
|
2003-12-31 18:06:24 +03:00
|
|
|
return ENODEV;
|
2001-10-06 02:27:40 +04:00
|
|
|
}
|
|
|
|
|
2003-12-31 18:40:31 +03:00
|
|
|
static int
|
2003-12-29 19:11:38 +03:00
|
|
|
vidcaudio_getdev(void *addr, struct audio_device *retp)
|
2001-10-06 02:27:40 +04:00
|
|
|
{
|
2003-12-29 19:20:46 +03:00
|
|
|
|
2001-10-06 02:27:40 +04:00
|
|
|
*retp = vidcaudio_device;
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2003-12-31 18:40:31 +03:00
|
|
|
static int
|
2003-12-29 19:11:38 +03:00
|
|
|
vidcaudio_set_port(void *addr, mixer_ctrl_t *cp)
|
2001-10-06 02:27:40 +04:00
|
|
|
{
|
2003-12-29 19:20:46 +03:00
|
|
|
|
2001-10-06 02:27:40 +04:00
|
|
|
return EINVAL;
|
|
|
|
}
|
|
|
|
|
2003-12-31 18:40:31 +03:00
|
|
|
static int
|
2003-12-29 19:11:38 +03:00
|
|
|
vidcaudio_get_port(void *addr, mixer_ctrl_t *cp)
|
2001-10-06 02:27:40 +04:00
|
|
|
{
|
2003-12-29 19:20:46 +03:00
|
|
|
|
2001-10-06 02:27:40 +04:00
|
|
|
return EINVAL;
|
|
|
|
}
|
|
|
|
|
2003-12-31 18:40:31 +03:00
|
|
|
static int
|
2003-12-29 19:11:38 +03:00
|
|
|
vidcaudio_query_devinfo(void *addr, mixer_devinfo_t *dip)
|
2001-10-06 02:27:40 +04:00
|
|
|
{
|
2003-12-29 19:20:46 +03:00
|
|
|
|
2001-10-06 02:27:40 +04:00
|
|
|
return ENXIO;
|
|
|
|
}
|
|
|
|
|
2003-12-31 18:40:31 +03:00
|
|
|
static int
|
2003-12-29 19:11:38 +03:00
|
|
|
vidcaudio_get_props(void *addr)
|
2001-10-06 02:27:40 +04:00
|
|
|
{
|
2003-12-29 19:20:46 +03:00
|
|
|
|
2001-10-06 02:27:40 +04:00
|
|
|
return 0;
|
|
|
|
}
|
2003-12-31 18:40:31 +03:00
|
|
|
|
|
|
|
static void
|
2003-12-29 19:11:38 +03:00
|
|
|
vidcaudio_rate(int rate)
|
2001-10-06 02:27:40 +04:00
|
|
|
{
|
2003-12-29 19:20:46 +03:00
|
|
|
|
2001-10-06 02:27:40 +04:00
|
|
|
WriteWord(vidc_base, VIDC_SFR | rate);
|
|
|
|
}
|
|
|
|
|
2003-12-31 18:40:31 +03:00
|
|
|
static void
|
2003-12-31 18:06:24 +03:00
|
|
|
vidcaudio_ctrl(int ctrl)
|
2001-10-06 02:27:40 +04:00
|
|
|
{
|
|
|
|
|
2003-12-31 18:06:24 +03:00
|
|
|
WriteWord(vidc_base, VIDC_SCR | ctrl);
|
2001-10-06 02:27:40 +04:00
|
|
|
}
|
|
|
|
|
2003-12-31 18:40:31 +03:00
|
|
|
static void
|
2003-12-31 18:06:24 +03:00
|
|
|
vidcaudio_stereo(int channel, int position)
|
2001-10-06 02:27:40 +04:00
|
|
|
{
|
2003-12-29 19:20:46 +03:00
|
|
|
|
2003-12-31 18:06:24 +03:00
|
|
|
channel = channel << 24 | VIDC_SIR0;
|
|
|
|
WriteWord(vidc_base, channel | position);
|
2001-10-06 02:27:40 +04:00
|
|
|
}
|
|
|
|
|
2003-12-31 18:40:31 +03:00
|
|
|
static int
|
2003-12-29 19:11:38 +03:00
|
|
|
vidcaudio_intr(void *arg)
|
2001-10-06 02:27:40 +04:00
|
|
|
{
|
2003-12-31 18:06:24 +03:00
|
|
|
struct vidcaudio_softc *sc = arg;
|
|
|
|
int status;
|
|
|
|
paddr_t pnext, pend;
|
2001-10-06 02:27:40 +04:00
|
|
|
|
2003-12-31 18:06:24 +03:00
|
|
|
status = IOMD_READ_BYTE(IOMD_SD0ST);
|
2004-01-01 19:35:35 +03:00
|
|
|
DPRINTF(("I[%x]", status));
|
2003-12-31 18:06:24 +03:00
|
|
|
if ((status & IOMD_DMAST_INT) == 0)
|
2001-10-06 02:27:40 +04:00
|
|
|
return 0;
|
|
|
|
|
2004-01-01 20:52:19 +03:00
|
|
|
pnext = sc->sc_ppages[sc->sc_poffset >> PGSHIFT] |
|
|
|
|
(sc->sc_poffset & PGOFSET);
|
2003-12-31 18:06:24 +03:00
|
|
|
pend = (pnext + sc->sc_pblksize - 16) & IOMD_DMAEND_OFFSET;
|
|
|
|
|
|
|
|
switch (status &
|
|
|
|
(IOMD_DMAST_OVERRUN | IOMD_DMAST_INT | IOMD_DMAST_BANKB)) {
|
2001-10-06 02:27:40 +04:00
|
|
|
|
2003-12-31 18:06:24 +03:00
|
|
|
case (IOMD_DMAST_INT | IOMD_DMAST_BANKA):
|
|
|
|
case (IOMD_DMAST_OVERRUN | IOMD_DMAST_INT | IOMD_DMAST_BANKB):
|
2004-01-01 19:35:35 +03:00
|
|
|
DPRINTF(("B<0x%08lx,0x%03lx>", pnext, pend));
|
2003-12-31 18:06:24 +03:00
|
|
|
IOMD_WRITE_WORD(IOMD_SD0CURB, pnext);
|
|
|
|
IOMD_WRITE_WORD(IOMD_SD0ENDB, pend);
|
|
|
|
break;
|
2001-10-06 02:27:40 +04:00
|
|
|
|
2003-12-31 18:06:24 +03:00
|
|
|
case (IOMD_DMAST_INT | IOMD_DMAST_BANKB):
|
|
|
|
case (IOMD_DMAST_OVERRUN | IOMD_DMAST_INT | IOMD_DMAST_BANKA):
|
2004-01-01 19:35:35 +03:00
|
|
|
DPRINTF(("A<0x%08lx,0x%03lx>", pnext, pend));
|
2003-12-31 18:06:24 +03:00
|
|
|
IOMD_WRITE_WORD(IOMD_SD0CURA, pnext);
|
|
|
|
IOMD_WRITE_WORD(IOMD_SD0ENDA, pend);
|
|
|
|
break;
|
2001-10-06 02:27:40 +04:00
|
|
|
}
|
|
|
|
|
2004-01-01 20:52:19 +03:00
|
|
|
sc->sc_poffset += sc->sc_pblksize;
|
|
|
|
if (sc->sc_poffset >= sc->sc_pbufsize)
|
|
|
|
sc->sc_poffset = 0;
|
2003-12-31 18:06:24 +03:00
|
|
|
|
|
|
|
if (sc->sc_pcountdown > 0)
|
|
|
|
sc->sc_pcountdown--;
|
|
|
|
else
|
|
|
|
(*sc->sc_pintr)(sc->sc_parg);
|
2001-10-06 02:27:40 +04:00
|
|
|
|
2003-12-31 18:06:24 +03:00
|
|
|
return 1;
|
2001-10-06 02:27:40 +04:00
|
|
|
}
|