Home | History | Annotate | Download | only in sbus
History log of /src/sys/dev/sbus/cs4231_sbus.c
RevisionDateAuthorComments
 1.53  21-Jul-2022  andvar s/pedning/pending/
 1.52  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.51  16-Mar-2019  isaki branches: 1.51.2;
Use C99 style struct initializer to audio_hw_if.
 1.50  02-May-2017  martin branches: 1.50.10;
Make it compile with AUDIODEBUG
 1.49  23-Nov-2011  jmcneill branches: 1.49.8; 1.49.26; 1.49.40;
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.48  02-Jun-2011  christos branches: 1.48.2; 1.48.4;
split audiocs
 1.47  18-Sep-2009  tsutsui branches: 1.47.4; 1.47.6; 1.47.10;
- use device_private(), proper types and variables for device_t/softc
- remove unnecessary casts against void pointer

XXX: many inconsistent use of aprint_*(9) and printf(9)
 1.46  17-Sep-2009  tsutsui Remove struct sbusdev and related functions sbus_establish() and sbusreset().
They are derived from 4.4BSD/sparc and have been there since initial import
of NetBSD/sparc in 1993, but the struct sbusdev is almost unused for years,
nothing calls sbusreset(), and all (*sd->sd_reset)() functions look bogus.

Suggested by mrg@ and martin@, and tested on SS1+ and SS20.
 1.45  12-May-2009  cegger struct device * -> device_t, no functional changes intended.
 1.44  12-May-2009  cegger struct cfdata * -> cfdata_t, no functional changes intended.
 1.43  16-Dec-2008  christos branches: 1.43.2;
replace bitmask_snprintf(9) with snprintb(3)
 1.42  29-Apr-2008  ad branches: 1.42.8;
Another compile fix.
 1.41  29-Apr-2008  martin Pass the "right" softc to the soft interrupt handler
 1.40  29-Apr-2008  martin Make it compile
 1.39  29-Apr-2008  ad Use sparc_softintr to pass down device interrupt to the correct IPL.
MI slowpath softints are fine for notifications but have to much latency
to provide the card with the next block to play/record. PR kern/37540.
 1.38  28-Apr-2008  martin Remove clause 3 and 4 from TNF licenses
 1.37  05-Apr-2008  cegger branches: 1.37.2; 1.37.4;
use aprint_*_dev and device_xname
 1.36  03-Dec-2007  ad branches: 1.36.14;
Interrupt handling changes, in discussion since February:

- Reduce available SPL levels for hardware devices to none, vm, sched, high.
- Acquire kernel_lock only for interrupts at IPL_VM.
- Implement threaded soft interrupts.
 1.35  19-Oct-2007  ad branches: 1.35.2;
machine/{bus,cpu,intr}.h -> sys/{bus,cpu,intr}.h
 1.34  15-Oct-2006  martin branches: 1.34.6; 1.34.8; 1.34.22; 1.34.24; 1.34.28;
Add missing initializer
 1.33  11-Dec-2005  christos branches: 1.33.20; 1.33.22;
merge ktrace-lwp.
 1.32  15-Jan-2005  kent branches: 1.32.10;
ansify and KNF
 1.31  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.30  29-Oct-2004  yamt branches: 1.30.2;
constify audio_hw_if, midi_hw_if, and radio_hw_if.
 1.29  10-Sep-2003  uwe Get rid of the disgusting struct apc_dma *dma = NULL; hack now that we
have proper definitions for offsets of APM DMA registers.

NULL out round_buffersize and round_blocksize in audio_hw_if. We
don't seem to have any special requirements and audio(9) already
provides enough rounding.
 1.28  03-May-2003  wiz branches: 1.28.2;
DMA, not dma nor Dma.
 1.27  27-Feb-2003  pk Back out rev. 1.26; I forgot about the Javastations..
 1.26  27-Feb-2003  pk Some machine have a `SUNW,CS4231' node, but no actual hardware. It seems
these can be identified by a `serial' device type.
From Julian Coleman.
 1.25  10-Dec-2002  pk Remove the `flags' argument from bus_intr_establish().
 1.24  02-Oct-2002  thorpej Add trailing ; to CFATTACH_DECL.
 1.23  30-Sep-2002  thorpej Use CFATTACH_DECL().
 1.22  27-Sep-2002  thorpej Declare all cfattach structures const.
 1.21  16-Jul-2002  mrg fix a bug introduced in rev 1.19:
- finish bus_space-ification of cs4231_sbus_trigger_input().

this stops recording on the sbus cs4231 from crashing.
 1.20  27-Mar-2002  pk branches: 1.20.2; 1.20.4;
cs4231_sbus_regdump(): add missing ')'
 1.19  21-Mar-2002  eeh Properly bus_space_*=ify this so it uses accessors.
 1.18  12-Mar-2002  uwe Rework the driver to add EBus DMA support and improve APC DMA support.
Audio-related stuff is left almost intact.

* support audiocs at ebus playback and capture
tested on krups and u5 (thanks, martin)
* make first attempt at supporting audiocs at sbus capture
* nb: full-duplex is not tested
* while here, fix CSAUDIO_MONITOR_MUTE to be of CSAUDIO_MONITOR_CLASS
i.e. outputs.monitor.mute -> monitor.monitor.mute

Ok by pk, eeh.
 1.17  11-Mar-2002  pk Get rid of `bus_type_t' and use BUS_ADDR() (in sbus_bus_map()) to construct
a `bus_addr_t' to pass on to bus_space_map().

Drop `va' argument from sbus_bus_map(); it should not be used by MI Sbus
drivers.
 1.16  13-Nov-2001  lukem add RCSIDs
 1.15  09-Jul-2000  pk branches: 1.15.2; 1.15.4;
Add a `device class' interrupt level argument (from machine/intr.h)
to bus_interrupt_establish().

It's currently only used in sparc64/dev/psycho.c to assign a CPU interrupt
level to devices in PCI slots.
 1.14  04-Jun-2000  cgd branches: 1.14.2;
Implement the more flexiable `evcnt' interface as discussed (briefly) on
tech-kern and now documented in evcnt(9).
 1.13  14-Apr-2000  mrg branches: 1.13.2;
add some casts to (u_long) to shut up gcc
 1.12  21-Nov-1999  pk Check presence of Sbus interrupt properties before using them.
Only one case is known to trigger this omission: a Sparc Classic
configured as X terminal.
 1.11  05-Jun-1999  mrg branches: 1.11.2; 1.11.8;
split sbus audiocs code up so we can share it with the ebus. XXX ebus DMA is probably different.
 1.10  19-Mar-1999  eeh branches: 1.10.4;
Use correctly bus_space_*() macros to access device registers.
 1.9  17-Feb-1999  mycroft Update comments.
 1.8  17-Feb-1999  mycroft Pass the direction to the allocm and round_buffersize methods.
Some drivers need this to properly allocate DMAable memory.
 1.7  12-Jan-1999  kleink Avoid arithmetic on void *.
 1.6  25-Sep-1998  pk Fix a silly yank-o.
 1.5  07-Sep-1998  pk Missing bits in DEBUG mode.
 1.4  29-Aug-1998  pk Nuke unnecessary header files.
 1.3  29-Aug-1998  pk Make compile without AUDIO_DEBUG
 1.2  28-Aug-1998  pk Nuke Dprintf; fix formats.
Add missing copyright.
 1.1  27-Aug-1998  pk CS4231 audio driver. Play only for now.
 1.10.4.1  21-Jun-1999  thorpej Sync w/ -current.
 1.11.8.1  27-Dec-1999  wrstuden Pull up to last week's -current.
 1.11.2.1  20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.13.2.1  22-Jun-2000  minoura Sync w/ netbsd-1-5-base.
 1.14.2.1  19-Jul-2000  mrg pull up sparc/sparc64 bus_intr_establish() changes, necessary for sparc64
(originally done by pk, approved by thorpej):

>Add a `device class' interrupt level argument (from machine/intr.h)
>to bus_interrupt_establish().
>
>It's currently only used in sparc64/dev/psycho.c to assign a CPU interrupt
>level to devices in PCI slots.
 1.15.4.5  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.15.4.4  06-Sep-2002  jdolecek sync kqueue branch with HEAD
 1.15.4.3  23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.15.4.2  16-Mar-2002  jdolecek Catch up with -current.
 1.15.4.1  10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.15.2.5  11-Dec-2002  thorpej Sync with HEAD.
 1.15.2.4  18-Oct-2002  nathanw Catch up to -current.
 1.15.2.3  01-Aug-2002  nathanw Catch up to -current.
 1.15.2.2  01-Apr-2002  nathanw Catch up to -current.
(CVS: It's not just a program. It's an adventure!)
 1.15.2.1  14-Nov-2001  nathanw Catch up to -current.
 1.20.4.1  18-Jul-2002  lukem Pull up revision 1.21 (requested by mrg in ticket #512):
fix a bug introduced in rev 1.19:
- finish bus_space-ification of cs4231_sbus_trigger_input().
this stops recording on the sbus cs4231 from crashing.
 1.20.2.1  20-Jul-2002  gehenna catch up with -current.
 1.28.2.5  17-Jan-2005  skrll Sync with HEAD.
 1.28.2.4  02-Nov-2004  skrll Sync with HEAD.
 1.28.2.3  21-Sep-2004  skrll Fix the sync with head I botched.
 1.28.2.2  18-Sep-2004  skrll Sync with HEAD.
 1.28.2.1  03-Aug-2004  skrll Sync with HEAD
 1.30.2.1  03-Jan-2005  kent adopt the filter pipeline framework
 1.32.10.3  07-Dec-2007  yamt sync with head
 1.32.10.2  27-Oct-2007  yamt sync with head.
 1.32.10.1  30-Dec-2006  yamt sync with head.
 1.33.22.1  22-Oct-2006  yamt sync with head
 1.33.20.1  18-Nov-2006  ad Sync with head.
 1.34.28.1  25-Oct-2007  bouyer Sync with HEAD.
 1.34.24.2  09-Jan-2008  matt sync with HEAD
 1.34.24.1  06-Nov-2007  matt sync with HEAD
 1.34.22.2  09-Dec-2007  jmcneill Sync with HEAD.
 1.34.22.1  26-Oct-2007  joerg Sync with HEAD.

Follow the merge of pmap.c on i386 and amd64 and move
pmap_init_tmp_pgtbl into arch/x86/x86/pmap.c. Modify the ACPI wakeup
code to restore CR4 before jumping back into kernel space as the large
page option might cover that.
 1.34.8.1  23-Oct-2007  ad Sync with head.
 1.34.6.1  27-Feb-2007  ad Add MP locking for audio drivers.
 1.35.2.1  08-Dec-2007  mjf Sync with HEAD.
 1.36.14.2  17-Jan-2009  mjf Sync with HEAD.
 1.36.14.1  02-Jun-2008  mjf Sync with HEAD.
 1.37.4.4  11-Mar-2010  yamt sync with head
 1.37.4.3  16-May-2009  yamt sync with head
 1.37.4.2  04-May-2009  yamt sync with head.
 1.37.4.1  16-May-2008  yamt sync with head.
 1.37.2.1  18-May-2008  yamt sync with head.
 1.42.8.1  19-Jan-2009  skrll Sync with HEAD.
 1.43.2.1  13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.47.10.1  23-Jun-2011  cherry Catchup with rmind-uvmplock merge.
 1.47.6.1  06-Jun-2011  jruoho Sync with HEAD.
 1.47.4.1  12-Jun-2011  rmind sync with head
 1.48.4.4  22-Nov-2011  jmcneill get rid of unused 'powerstate' callback in audio_hw_if
 1.48.4.3  22-Nov-2011  macallan we need to initialize the locks before using them
Now this works on my Ultra 1
 1.48.4.2  20-Nov-2011  mrg complete the port to audiomp: don't forget to take sc_intr_lock in the
hardware interrupt routines.
 1.48.4.1  20-Nov-2011  mrg make audiocs(4) compile. i don't have anything handy to actually test
this easily, but this was just updating the alloc/free to kmem and
hooking into ad1848_get_locks().
 1.48.2.1  17-Apr-2012  yamt sync with head
 1.49.40.1  11-May-2017  pgoyette Sync with HEAD
 1.49.26.1  28-Aug-2017  skrll Sync with HEAD
 1.49.8.1  03-Dec-2017  jdolecek update from HEAD
 1.50.10.1  10-Jun-2019  christos Sync with HEAD
 1.51.2.2  04-May-2019  isaki Move dev/audio_if.h -> dev/audio/audio_if.h
 1.51.2.1  21-Apr-2019  isaki Adapt ad1848/cs4231 families to audio2.

RSS XML Feed