Home | History | Annotate | Download | only in dev
History log of /src/sys/arch/x68k/dev/vs.c
RevisionDateAuthorComments
 1.56  26-May-2022  tsutsui Explicitly include "ioconf.h" for struct cfdriver.
 1.55  21-Aug-2021  andvar s/recoding/recording/ in comments where it didn't actually mean recoding.
 1.54  06-Feb-2021  isaki Remove an unused variable.
 1.53  06-Feb-2021  isaki Remove sc_active flag. sc_[pr]intr can be used instead of it.
 1.52  08-Jun-2019  isaki branches: 1.52.10;
Clean get_props().
- Make get_props() return AUDIO_PROP_{PLAYBACK,CAPTURE} properly.
This eliminates need for audio.c to take care of such (old)
drivers which don't return both of PLAYBACK and CAPTURE.
- All get_props() doesn't need to return AUDIO_PROP_MMAP.
It is handled in the audio layer now.
 1.51  08-May-2019  isaki Merge isaki-audio2 branch, the overhaul of audio subsystem.
- Interrupt-oriented system rather than thread-oriented.
- Improve stability, quality and performance.
- Split playback and record cleanly. Improve halfduplex support.
- Many bugs are fixed including deadlocks, resource leaks, abuses, etc.
- Simplify audio filter mechanism. The encoding/channels/frequency
conversions are completely handled in the upper layer. So the hard-
ware driver only converts its hardware encoding (if necessary).
- audio_hw_if changes:
- Obsoletes query_encoding and add query_format instead.
- Obsoletes set_params and add set_format instead.
- Remove drain, setfd, mappage.
- The call sequences are changed.
- ioctl AUDIO_GETFD/SETFD, AUDIO_GETCHAN/SETCHAN are obsoleted.
- ioctl AUDIO_{QUERY,GET,SET}FORMAT are introduced.
- cleanup config attributes: au*conv and mulaw.
- All hardware drivers should follow it (I've done as much as possible).

Some file paths are changed:
- dev/audio.c -> dev/audio/audio.c (rewritten)
- dev/audiovar.h -> dev/audio/audiovar.h
- dev/audio_dai.h -> dev/audio/audio_dai.h
- dev/audio_if.h -> dev/audio/audio_if.h
- dev/audiobell.c -> dev/audio/audiobell.c
- dev/audiobellvar.h -> dev/audio/audiobellvar.h
- dev/mulaw.[ch] -> dev/audio/mulaw.[ch] + dev/audio/alaw.c
 1.50  16-Mar-2019  isaki branches: 1.50.2;
Use C99 style struct initializer to audio_hw_if.
 1.49  30-Sep-2017  isaki branches: 1.49.4;
Avoid magic numbers and give appropriate names.
 1.48  02-Sep-2017  isaki - Finally MI audio supports 4bit precision format without null_filter hack!
- Fix reusing play/rec argument as local variables. It is in/out parameter.
 1.47  02-Sep-2017  isaki - Revert temporary local conversion introduced at rev 1.43.
- But does not revert to trigger method. trigger method is not suitable for
x68k ADPCM+DMA mechanism.
- Don't (re)start ADPCM when DMA is running. This solves the noise.
From Y.Sugahara.
- Cache dmac xfer.
 1.46  11-Aug-2017  isaki Allow dmac_alloc_channel() to specify DCR and OCR.
FDC uses 'Cycle Steal Mode with Hold' but ADPCM
should use 'Cycle Steal Mode without Hold' on x68k.
From Y.Suhagara and it was found by XM6i.
 1.45  11-Aug-2017  isaki Use dmac_prepare_xfer().
From Y.Sugahara.
 1.44  05-Aug-2017  isaki Merge prate and rrate. These can not be separated.
 1.43  05-Aug-2017  isaki vs(4) became to able to play audio again.
At the moment the encoding conversion using set_params() does
not seem to work for me. So vs(4) uses local conversion to/from
ADPCM instead of it. But this should be a temporary work.
XXX The playback quality is very poor compared to before...
XXX Recording is not tested.
 1.42  05-Aug-2017  isaki Remove temporary VS_USE_PREC8 option.
vs(4) now supports slinear16be and slinear8 (but now work yet).
 1.41  31-Jul-2017  isaki Update confused vs_set_params().
play and rec are identical but pfil and rfil are independent.
XXX I introduce VS_USE_PREC8 option for debugging purposes
temporarily. I'll remove it if the problem is solved.
 1.40  29-Jul-2017  nat Audio vchan auto config works again due to the use of a null_filter.

Tested and confirmed working by isaki@.
 1.39  09-Jul-2017  isaki Catch up vs_set_params() to recent MI audio (after in-kernel mixer).
Before that, MD part had to support all encodings I'd like to support,
but currently it's no longer necessary. The hardware is
4bit/1ch/15.6kHz ADPCM but it behaves as 16bit/1ch/16.0kHz PCM.

For audio.c < 1.362, the device attach succeeded and playback is
still working.
For audio.c >= 1.363, the device attach fails again.
It does not work yet but I commit it for milestone.
 1.38  25-Jun-2017  isaki Avoid panic when the device is closed when not playing.
 1.37  01-Jun-2017  chs branches: 1.37.2;
remove checks for failure after memory allocation calls that cannot fail:

kmem_alloc() with KM_SLEEP
kmem_zalloc() with KM_SLEEP
percpu_alloc()
pserialize_create()
psref_class_create()

all of these paths include an assertion that the allocation has not failed,
so callers should not assert that again.
 1.36  26-Mar-2014  christos branches: 1.36.6;
kill sprintf, fix unused.
 1.35  23-Nov-2011  jmcneill branches: 1.35.8; 1.35.12;
Merge jmcneill-audiomp3 branch, which is derived from ad-audiomp2. From
the original ad-audiomp branch notes:

Add MP locking to the audio drivers.

Making the audio drivers MP safe is necessary before efforts
can be made to make the VM system MP safe.

The are two locks per device instance, an ISR lock and
a character device lock. The ISR lock replaces calls to
splaudio()/splx(), and will be held across calls to device
methods which were called at splaudio() before (e.g.
trigger_output). The character device lock is held across
calls to nearly all of the methods, excluding some only
used for initialization, e.g. get_locks.

Welcome to 5.99.57.
 1.34  16-Oct-2011  isaki branches: 1.34.2; 1.34.4;
Switch to 2-clause license.
 1.33  25-Jun-2008  isaki Split device_t/softc. Use aprint*() and device_xname().
 1.32  11-Mar-2007  isaki branches: 1.32.38; 1.32.42; 1.32.44; 1.32.46;
white space, indent and KNF.
 1.31  04-Mar-2007  christos branches: 1.31.2;
Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.30  11-Dec-2005  christos branches: 1.30.26;
merge ktrace-lwp.
 1.29  13-Jun-2005  he branches: 1.29.2;
Make this build with -Wcast-qual by adding a few consts.
 1.28  15-Jan-2005  kent ansify and KNF
 1.27  10-Jan-2005  kent 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
 1.26  13-Dec-2004  chs for drivers that support only one instance, use a global variable to ensure
that only one instance is configured rather than requiring that its
unit number be zero.
 1.25  29-Oct-2004  yamt branches: 1.25.2;
constify audio_hw_if, midi_hw_if, and radio_hw_if.
 1.24  08-May-2004  minoura An unexported header file was #included from an exported header file.
Introduce <machine/opmreg.h> and move some definitions useful to
userland progs.
 1.23  07-Sep-2003  isaki Remove an advertising clause.
 1.22  15-Jul-2003  lukem rcsid
 1.21  01-Feb-2003  thorpej branches: 1.21.2;
Add extensible malloc types, adapted from FreeBSD. This turns
malloc types into a structure, a pointer to which is passed around,
instead of an int constant. Allow the limit to be adjusted when the
malloc type is defined, or with a function call, as suggested by
Jonathan Stone.
 1.20  24-Nov-2002  isaki Fix typo. s/cfdata/cfdriver/
 1.19  13-Oct-2002  isaki Style fixes.
 1.18  02-Oct-2002  thorpej Add trailing ; to CFATTACH_DECL.
 1.17  01-Oct-2002  thorpej Use CFATTACH_DECL().
 1.16  27-Sep-2002  thorpej Declare all cfattach structures const.
 1.15  07-Apr-2002  isaki Support slinear8, slinear16_le, slinear16_be.
 1.14  02-Apr-2002  isaki initialize codec variables every open().
 1.13  26-Mar-2002  isaki set factor=1/2 even if recording.
 1.12  16-Mar-2002  isaki Fix mis-increment bug in converter msm6258_ulinear8_to_adpcm().
This fix needs factor_denom.
 1.11  25-Nov-2001  minoura Remove unused variables.
Correct printf format strings.
 1.10  13-Nov-2001  isaki Rewrite vs_query_encoding() using array.
 1.9  13-Nov-2001  isaki Clean up debug messages. Separate it two debug levels.
 1.8  03-Oct-2001  augustss branches: 1.8.4;
Add a new optional method, dev_ioctl, to the audio hardware driver interface.
It is called when an unrecognized ioctl() is performed on a device,
thus allowing ioctl()s that frob the hardware driver (like loading
microcode).
 1.7  28-May-2001  minoura branches: 1.7.2; 1.7.4; 1.7.6;
Cleanup. Addresses port-x68k/13051.
 1.6  27-May-2001  minoura Add missing line in recording. Copy & paste error...
 1.5  22-May-2001  minoura Correct ring buffer handling in recording. From Isaki-san.
 1.4  15-May-2001  minoura Missings from the previous commit.
From Izaki-san.
 1.3  07-May-2001  minoura Encoding ulinear and mulaw are both software emulated.
From Isaki-san.
 1.2  03-May-2001  minoura Correct playing mu-law and linear.
 1.1  02-May-2001  minoura X68k built-in voice synthesizer.
 1.7.6.1  11-Oct-2001  fvdl Catch up with -current. Fix some bogons in the sparc64 kbd/ms
attach code. cd18xx conversion provided by mrg.
 1.7.4.3  10-Oct-2002  jdolecek sync kqueue with -current; this includes merge of gehenna-devsw branch,
merge of i386 MP branch, and part of autoconf rototil work
 1.7.4.2  23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.7.4.1  10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.7.2.1  21-Jun-2001  nathanw Catch up to -current.
 1.8.4.6  11-Dec-2002  thorpej Sync with HEAD.
 1.8.4.5  18-Oct-2002  nathanw Catch up to -current.
 1.8.4.4  17-Apr-2002  nathanw Catch up to -current.
 1.8.4.3  01-Apr-2002  nathanw Catch up to -current.
(CVS: It's not just a program. It's an adventure!)
 1.8.4.2  08-Jan-2002  nathanw Catch up to -current.
 1.8.4.1  03-Oct-2001  nathanw file vs.c was added on branch nathanw_sa on 2002-01-08 00:28:42 +0000
 1.21.2.7  10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.21.2.6  17-Jan-2005  skrll Sync with HEAD.
 1.21.2.5  18-Dec-2004  skrll Sync with HEAD.
 1.21.2.4  02-Nov-2004  skrll Sync with HEAD.
 1.21.2.3  21-Sep-2004  skrll Fix the sync with head I botched.
 1.21.2.2  18-Sep-2004  skrll Sync with HEAD.
 1.21.2.1  03-Aug-2004  skrll Sync with HEAD
 1.25.2.1  03-Jan-2005  kent adopt the filter pipeline framework
 1.29.2.1  03-Sep-2007  yamt sync with head.
 1.30.26.1  12-Mar-2007  rmind Sync with HEAD.
 1.31.2.1  13-Mar-2007  ad Sync with head.
 1.32.46.1  27-Jun-2008  simonb Sync with head.
 1.32.44.1  18-Sep-2008  wrstuden Sync with wrstuden-revivesa-base-2.
 1.32.42.1  04-May-2009  yamt sync with head.
 1.32.38.1  29-Jun-2008  mjf Sync with HEAD.
 1.34.4.2  22-Nov-2011  jmcneill get rid of unused 'powerstate' callback in audio_hw_if
 1.34.4.1  20-Nov-2011  jmcneill adapt to audiomp api changes
 1.34.2.2  22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.34.2.1  17-Apr-2012  yamt sync with head
 1.35.12.1  18-May-2014  rmind sync with head
 1.35.8.2  03-Dec-2017  jdolecek update from HEAD
 1.35.8.1  20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.36.6.1  28-Aug-2017  skrll Sync with HEAD
 1.37.2.2  23-Sep-2017  snj Pull up following revision(s) (requested by isaki in ticket #172):
sys/arch/x68k/dev/vs.c: 1.38-1.39, 1.41-1.44, 1.47-1.48 via patch
sys/arch/x68k/dev/vsvar.h: 1.12-1.15 via patch
Avoid panic when the device is closed when not playing.
Catch up vs_set_params() to recent MI audio (after in-kernel mixer).
Before that, MD part had to support all encodings I'd like to support,
but currently it's no longer necessary. The hardware is
4bit/1ch/15.6kHz ADPCM but it behaves as 16bit/1ch/16.0kHz PCM.
For audio.c < 1.362, the device attach succeeded and playback is
still working.
For audio.c >= 1.363, the device attach fails again.
It does not work yet but I commit it for milestone.
Update confused vs_set_params().
play and rec are identical but pfil and rfil are independent.
XXX I introduce VS_USE_PREC8 option for debugging purposes
temporarily. I'll remove it if the problem is solved.
Remove temporary VS_USE_PREC8 option.
vs(4) now supports slinear16be and slinear8 (but now work yet).
vs(4) became to able to play audio again.
At the moment the encoding conversion using set_params() does
not seem to work for me. So vs(4) uses local conversion to/from
ADPCM instead of it. But this should be a temporary work.
XXX The playback quality is very poor compared to before...
XXX Recording is not tested.
Merge prate and rrate. These can not be separated.
- Revert temporary local conversion introduced at rev 1.43.
- But does not revert to trigger method. trigger method is not suitable for
x68k ADPCM+DMA mechanism.
- Don't (re)start ADPCM when DMA is running. This solves the noise.
From Y.Sugahara.
- Cache dmac xfer.
- Finally MI audio supports 4bit precision format without null_filter hack!
- Fix reusing play/rec argument as local variables. It is in/out parameter.
 1.37.2.1  23-Sep-2017  snj Pull up following revision(s) (requested by isaki in ticket #290):
sys/arch/x68k/dev/dmacvar.h: revision 1.11-1.12 via patch
sys/arch/x68k/dev/intio_dmac.c: revision 1.36-1.37 via patch
sys/arch/x68k/dev/fd.c: revision 1.120 via patch
sys/arch/x68k/dev/vs.c: revision 1.45-1.46 via patch
Use dmac_prepare_xfer().
From Y.Sugahara.
--
Allow dmac_alloc_channel() to specify DCR and OCR.
FDC uses 'Cycle Steal Mode with Hold' but ADPCM
should use 'Cycle Steal Mode without Hold' on x68k.
From Y.Suhagara and it was found by XM6i.
--
Fix a Continue Operation.
Patch from Y.Sugahara.
 1.49.4.1  10-Jun-2019  christos Sync with HEAD
 1.50.2.2  04-May-2019  isaki Move dev/audio_if.h -> dev/audio/audio_if.h
 1.50.2.1  21-Apr-2019  isaki Adapt to audio2.
 1.52.10.1  03-Apr-2021  thorpej Sync with HEAD.

RSS XML Feed