Home | History | Annotate | Download | only in ic
History log of /src/sys/dev/ic/am7930.c
RevisionDateAuthorComments
 1.60  12-Sep-2020  isaki Improve am7930 family drivers to share more code.
audioamd(4) on sparc, vsaudio(4) on vax, and bba(4) are.
- Remove complex and useless callbacks: onopen, onclose, and
indirect_{read,write}. This makes audioamd and vsaudio almost the same.
- Remove (already disabled) assembly fast interrupt path from audioamd(4).
cf. http://mail-index.netbsd.org/source-changes/2009/12/19/msg004585.html
- Use trigger_* method rather than start_* method. It's more suitable.
vsaudio(4) was tested by naru@, bba(4) was tested by tsutsui@.
 1.59  08-Jun-2019  isaki 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.58  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.57  29-Aug-2017  isaki branches: 1.57.4; 1.57.8;
Fix two typos. pfil -> rfil for recording.
One was introduced a month ago and the other was 12 years ago.
 1.56  27-Jul-2017  nat Add a null_filter to help with the audio autoconfig of pmax.

Tested by flxd@.
 1.55  25-Jun-2017  nat Set hw parameters for linear to ulaw filters.

Tested by flxd@.
 1.54  25-Jun-2017  nat rfill and pfill mixed up.
 1.53  28-Dec-2016  nat branches: 1.53.8;
Add slinear encoding. Tested by flxd@

Addresses PR kern/51703: audio fails to attach if hardware can't do CD
quality.

Autoconfiguration of hw paramaters to be done later. For now it is
possibile to set 8 bits precision 8000 Hz 1 channel via sysctls.
 1.52  20-Dec-2014  jklos branches: 1.52.2;
Remove autoconf.h include from am7930.c as per Matt Thomas so
vax/include/autoconf.h isn't necessary.
 1.51  23-Nov-2011  jmcneill branches: 1.51.8; 1.51.26;
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.50  19-Oct-2007  ad branches: 1.50.54; 1.50.56;
machine/{bus,cpu,intr}.h -> sys/{bus,cpu,intr}.h
 1.49  11-Dec-2005  christos branches: 1.49.30; 1.49.44; 1.49.46; 1.49.50;
merge ktrace-lwp.
 1.48  22-May-2005  christos branches: 1.48.2;
No 0x in front of %p...
 1.47  15-Jan-2005  kent ansify and KNF
 1.46  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.45  09-Jul-2004  mycroft branches: 1.45.2;
Remove junk code.
 1.44  13-Nov-2001  lukem branches: 1.44.16;
add/cleanup RCSID
 1.43  02-May-2000  augustss branches: 1.43.6; 1.43.8;
Make am7930 driver machine independent. PR 10032 from Gregory McGarry.
 1.42  30-Mar-2000  augustss Remove register declarations.
 1.41  14-Mar-1999  jonathan branches: 1.41.8;
Use bus_space tags and handles, embedded in MD hooks AM7930_{READ_WRITE}_REG
to handle MD delay and bus padding. Tested on sparc2 by David Brownlee.

Should use regmaps, but that breaks sparc pDMA assembly code.
 1.40  28-Aug-1998  pk Nuke Dprintf; fix formats.
 1.39  24-Jun-1998  jonathan Split arch/sparc/dev/amd7930.c into:
* MI sys/dev/ic/{am7930.c,am7930var.h} chipset driver
* sparc frontend.
Presere revision history (this time).

TODO: bus.h'ify, and padded register mappings.
 1.38  07-May-1998  kleink Fix some arithmetics lossage on typeless pointers.
 1.37  30-Mar-1998  pk Replace direct `sparc_bus_map()' calls with bus space map method.
 1.36  21-Mar-1998  pk Account for changed bus attachment scheme.
 1.35  12-Jan-1998  thorpej Update for changes to config.
 1.34  06-Dec-1997  chuck fix mixer code that was clearly untested:
- allow get/set of enums SUNAUDIO_SOURCE and SUNAUDIO_OUTPUT rather
than returning EINVAL
- add missing SUNAUDIO_MONITOR_CLASS case in query_devinfo
- convert SUNAUDIO_MONITOR case from a MIXER_CLASS to a MIXER_VALUE
like it is supposed to be
- the labels for outputs/record class were swapped: fix it

this patch allows "mixerctl" to work properly on a sparc
 1.33  19-Oct-1997  christos branches: 1.33.2;
Make this compile again.
 1.32  19-Oct-1997  augustss Make the audio API (almost) SunOS compatible.
The changes is to allow some limited mixer manipulation through
the audio device (instead of the mixer device).
This rendered 4 methods in audio_hw_if unused so garbage collect these.
 1.31  11-Oct-1997  mycroft AudioC[A-Z] -> AudioC[a-z]
AudioElinear -> AudioEslinear
 1.30  27-Aug-1997  augustss Change match routine to use "audio" as the ROM name.
 1.29  27-Aug-1997  augustss Fix prototype for amd7930_set_params.
 1.28  24-Aug-1997  augustss - Change audio_hw_if a little: set_param now sets the play and record modes
at the same time instead by using two different calls. This enables
it to check more easily if the combined mode is all right.
- Improve the error checking in audio.c.
- Add a new audio property, AUDIO_PROP_INDEPENDENT, show if the
play and record settings are independent.
- Fix some buglets in audio.c.
 1.27  19-Aug-1997  augustss Change the MI audio driver so it attaches to the MD driver in the
normal way. This requires adding a line to the config files to
get audio to work again.
 1.26  31-Jul-1997  augustss Audio changes:
- Change the way attach and open works to allow multiple audio
devices.
- Split the mulaw.c file into two to avoid dragging in mulaw
convertsion when they are not needed. Add 16 bit alaw/mulaw tables.
- Change the way audio properties are gotten.
- Recognize more versions os SoundBlaster.
 1.25  28-Jul-1997  augustss branches: 1.25.2;
Audio: Remove the machine dependant code I put in audio.c by mistake.
This adds another method to audio_hw_if. Also remove a field from
audio_hw_if that was not read-only.
 1.24  27-Jul-1997  augustss audio: Simplify handling of AUDIO_SETFD and committing of encoding mode.
 1.23  27-Jul-1997  augustss Changes to the sudio system:
- It is now possible to handle devices that want "looping" DMA,
e.g. the SoundBlaster correctly. The WSS and SB drivers use this.
To do this several new methods were introduced in audio_hw_if.
- Different silence handling (forced by previous change).
- The audio driver can now be mmap()-ed, but due to problems in
the VM system only for writing for now.
- The OSS (Linux) audio emulation takes advantage of some of the
new features.
 1.22  24-May-1997  pk Remove all `bustype' arguments from map[io]dev() and REG2PHYS().
 1.21  15-May-1997  pk Tweak gain curve (from nsayer@kfu.com; PR#2909)
 1.20  09-May-1997  augustss Change the interface between high and lowlevel audio drivers again:
Set the encoding parameters slightly differently.
Remove the SW encoding/decodinf functions from this interface
and move them to the audio_parameter struct; this is both more efficient
and flexible.
 1.19  07-May-1997  augustss Convert to new orthogonal audio encoding scheme and implement
some of the new encodings. The change to ioctl AUDIO_GETENC is
NOT backwards compatible.
 1.18  29-Apr-1997  augustss Change the interface between the high and low level audio drivers
so that all audio encoding parameters are set at once. This simplifies
the interface and make error checking easier.
 1.17  20-Mar-1997  mycroft Implement set_format.
 1.16  13-Mar-1997  mycroft Don't share the silence block between devices. Make silence filling work for
more encodings, and make it device-independent. From Lennart Augustsson, in
PR kern/3305.
 1.15  10-Dec-1996  pk Comply with recent autoconfiguration changes. Diffs graciously
supplied by Chris Demetriou.
 1.14  01-Nov-1996  pk Drop in a sun4m version of AUDIO_SET_SWINTR; thanks to Nick Sayer for
the reminder.
 1.13  13-Oct-1996  christos backout previous kprintf change
 1.12  11-Oct-1996  christos printf -> kprintf, sprintf -> ksprintf
 1.11  28-May-1996  mrg count audio interupts (from OpenBSD).
 1.10  31-Mar-1996  pk Various cleanup; mostly trailing spaces/tabs.
 1.9  17-Mar-1996  thorpej New device attachment scheme:

- split softc size and match/attach out from cfdriver into
a new struct cfattach.

- new "attach" directive for files.*. May specify the name of
the cfattach structure, so that devices may be easily attached
to parents with different autoconfiguration semantics.
 1.8  14-Mar-1996  christos Bring prototypes into scope and fix compiler warnings.
 1.7  25-Feb-1996  pk Use CPU-type macros
 1.6  19-Feb-1996  pk Fix typo; pointed out by jtk.
 1.5  11-Dec-1995  pk Adapt to changed mapiodev() interface.
 1.4  19-Jul-1995  brezak Change DEBUG-->AUDIO_DEBUG. PR# port-sparc/1241
 1.3  28-Jun-1995  cgd note that most of dev/ic's contents have changed names
 1.2  04-May-1995  pk Add `evcnt' field.
 1.1  25-Apr-1995  pk New audio driver from Rolf Grossmann.
 1.25.2.4  14-Oct-1997  thorpej Update marc-pcmcia branch from trunk.
 1.25.2.3  01-Sep-1997  thorpej Update marc-pcmcia branch from trunk.
 1.25.2.2  27-Aug-1997  thorpej Update marc-pcmcia branch from trunk.
 1.25.2.1  23-Aug-1997  thorpej Update marc-pcmcia branch from trunk.
 1.33.2.1  09-Dec-1997  thorpej Sync w/ trunk: fix mixer code (chuck)
 1.41.8.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.43.8.1  10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.43.6.1  14-Nov-2001  nathanw Catch up to -current.
 1.44.16.5  10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.44.16.4  17-Jan-2005  skrll Sync with HEAD.
 1.44.16.3  21-Sep-2004  skrll Fix the sync with head I botched.
 1.44.16.2  18-Sep-2004  skrll Sync with HEAD.
 1.44.16.1  03-Aug-2004  skrll Sync with HEAD
 1.45.2.2  09-Jan-2005  kent audio_hw_if change
* make open() and close() optional
* add int (AUMODE_PLAY or AUMODE_RECORD) and audio_params_t parameters
to round_blocksize()
 1.45.2.1  03-Jan-2005  kent adopt the filter pipeline framework
 1.48.2.1  27-Oct-2007  yamt sync with head.
 1.49.50.1  25-Oct-2007  bouyer Sync with HEAD.
 1.49.46.1  06-Nov-2007  matt sync with HEAD
 1.49.44.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.49.30.1  23-Oct-2007  ad Sync with head.
 1.50.56.2  20-Nov-2011  mrg IPL_SCHED is enough.
 1.50.56.1  20-Nov-2011  mrg port the am7930 drivers to audiomp. sparc and pmax GENERIC builds,
but i am unable to test these drivers.
 1.50.54.1  17-Apr-2012  yamt sync with head
 1.51.26.3  28-Aug-2017  skrll Sync with HEAD
 1.51.26.2  05-Feb-2017  skrll Sync with HEAD
 1.51.26.1  06-Apr-2015  skrll Sync with HEAD
 1.51.8.1  03-Dec-2017  jdolecek update from HEAD
 1.52.2.1  07-Jan-2017  pgoyette Sync with HEAD. (Note that most of these changes are simply $NetBSD$
tag issues.)
 1.53.8.2  01-Aug-2017  snj Pull up following revision(s) (requested by nat in ticket #165):
sys/dev/auconv.c: revision 1.29
sys/dev/auconv.h: revision 1.19
sys/dev/ic/am7930.c: revision 1.56
Add a null_filter to help with the audio autoconfig of pmax.
Tested by flxd@.
 1.53.8.1  30-Jun-2017  snj Pull up following revision(s) (requested by nat in ticket #68):
sys/dev/ic/am7930.c: revision 1.54
sys/dev/ic/am7930.c: revision 1.55
rfill and pfill mixed up.
--
Set hw parameters for linear to ulaw filters.
Tested by flxd@.
 1.57.8.2  04-May-2019  isaki Move dev/audio_if.h -> dev/audio/audio_if.h
 1.57.8.1  22-Apr-2019  isaki Adapt am7930 families to audio2.
- Remove {input/output}_conv stuff from am7930_glue.
Filter pipelines for user encoding are not necessary in audio2
so the driver only needs to handle its hardware encoding.
- audioamd/vsaudio use an ordinal linear-mulaw conversion filter
and bba requires special one. dev/audio/mulaw.c supports this
variant just for bba. It might not a good way for bba but it
keeps all other drivers simple.
- Tested on vsaudio(4) by naru@, bba(4) by tsutsui@ (a few months ago).
Thanks!
 1.57.4.1  10-Jun-2019  christos Sync with HEAD

RSS XML Feed