Home | History | Annotate | Download | only in sbus
History log of /src/sys/dev/sbus/dbri.c
RevisionDateAuthorComments
 1.45  06-Feb-2021  isaki Remove an extra mutex_spin_exit() in error path.
This is a part of rev 1.38.
 1.44  06-Feb-2021  isaki Remove something like counters.
- Counting {open,close} is done by the MI audio layer.
- trigger_* is not called again between trigger_* and halt_*.
 1.43  25-Aug-2020  skrll branches: 1.43.2;
Style on config_finalize_register arguments - make consistent will all
other callers of config_finalize_register
 1.42  29-Feb-2020  isaki round_blocksize must return a multiple of the framesize
even if passed blocksize is greater than the upper limit.
 1.41  08-Jun-2019  isaki branches: 1.41.2; 1.41.4;
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.40  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.39  03-Sep-2018  riastradh branches: 1.39.2;
Rename min/max -> uimin/uimax for better honesty.

These functions are defined on unsigned int. The generic name
min/max should not silently truncate to 32 bits on 64-bit systems.
This is purely a name change -- no functional change intended.

HOWEVER! Some subsystems have

#define min(a, b) ((a) < (b) ? (a) : (b))
#define max(a, b) ((a) > (b) ? (a) : (b))

even though our standard name for that is MIN/MAX. Although these
may invite multiple evaluation bugs, these do _not_ cause integer
truncation.

To avoid `fixing' these cases, I first changed the name in libkern,
and then compile-tested every file where min/max occurred in order to
confirm that it failed -- and thus confirm that nothing shadowed
min/max -- before changing it.

I have left a handful of bootloaders that are too annoying to
compile-test, and some dead code:

cobalt ews4800mips hp300 hppa ia64 luna68k vax
acorn32/if_ie.c (not included in any kernels)
macppc/if_gm.c (superseded by gem(4))

It should be easy to fix the fallout once identified -- this way of
doing things fails safe, and the goal here, after all, is to _avoid_
silent integer truncations, not introduce them.

Maybe one day we can reintroduce min/max as type-generic things that
never silently truncate. But we should avoid doing that for a while,
so that existing code has a chance to be detected by the compiler for
conversion to uimin/uimax without changing the semantics until we can
properly audit it all. (Who knows, maybe in some cases integer
truncation is actually intended!)
 1.38  12-Jan-2018  mrg branches: 1.38.2; 1.38.4;
fix several KASSERT()s and locking in a few places.
fixes DIAGNOSTIC kernels and still plays.
 1.37  21-Dec-2017  macallan overhaul the dbri driver and make it work again in the New Order Of Things
- fix switching between control and data mode
- make sure interrupts can happen in control mode
- implement audioif.commit_settings()
- switch to control mode only if needed - for changes in sample rate or format
but not for things like volume control
should fix PR 52786
 1.36  08-Dec-2017  mrg fix audiomp bugs:
- switch from tsleep/wakeup to condvar
- fix locking in a bunch of places. there were several locking
against myself issues.

also:
- don't let dbri_process_interrupt_buffer() loop more than once
over the array of intrs.

this fixes hangs when using audio on ss20 in -current, but does
not make audio work. it eventually times out with eg:

dbri0: switching to control mode timed out (0 f6)

and may leave a sample in the audio buffer repeating.
 1.35  19-Oct-2013  mrg branches: 1.35.4; 1.35.22;
- remove set but unused variable.
- put variables only inside #ifdef inside that same #ifdef.
use __USE() where appropriate.
 1.34  23-Nov-2011  jmcneill branches: 1.34.8; 1.34.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.33  09-Mar-2011  macallan branches: 1.33.4; 1.33.6;
change dbri's DMA segment size to a power of two value - the ship allows
segments up to 0x1fff bytes but even rounded to 32bit this seems to
confuse the rest of the audio code these days
TODO: we don't need to interrupt at every single segment
either way, with this mpg123 doesn't produce semi-random funny noises
anymore
 1.32  11-Jan-2011  macallan branches: 1.32.2;
use config_finalize_register() instead of config_interrupts() to detect the
codec and attach audio. For some reason we run into a locking panic with
config_interrupts().
Tested on my SS20
 1.31  24-Feb-2010  dyoung branches: 1.31.2;
A pointer typedef entails trading too much flexibility to declare const
and non-const types, and the kernel uses both const and non-const
PMF qualifiers and device suspensors, so change the pmf_qual_t and
device_suspensor_t typedefs from "pointers to const" to non-pointer,
non-const types.
 1.30  18-Feb-2010  macallan Abort setup when we find no audio codec to avoid crashing later on with
ISDN-only cards.
Should fix PR41055
 1.29  14-Jan-2010  macallan branches: 1.29.2;
set a delta value for the master channel so volume control via PMF works
 1.28  08-Jan-2010  dyoung Expand PMF_FN_* macros.
 1.27  02-Jan-2010  tsutsui Fix botches in mechanical changes to make this compile:
dbri.c:165: warning: 'dbri_sus' declared 'static' but never defined
dbri.c: In function 'dbri_resume':
dbri.c:2188: error: 'sc' undeclared
dbri.c:2189: error: break statement not within loop or switch
 1.26  02-Jan-2010  christos convert to pmf
 1.25  20-Sep-2009  tsutsui u_intNN_t -> uintNN_t
 1.24  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.23  16-May-2009  martin we can not free() a dmamap!
 1.22  12-May-2009  cegger struct cfdata * -> cfdata_t, no functional changes intended.
 1.21  03-Jan-2009  yamt branches: 1.21.2;
remove extra semicolons.
 1.20  16-May-2008  macallan branches: 1.20.6;
struct device * -> device_t
 1.19  09-May-2008  macallan move to 2 clause license
 1.18  05-Apr-2008  cegger branches: 1.18.2; 1.18.4; 1.18.6;
use aprint_*_dev and device_xname
 1.17  03-Dec-2007  ad branches: 1.17.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.16  19-Oct-2007  ad branches: 1.16.2;
machine/{bus,cpu,intr}.h -> sys/{bus,cpu,intr}.h
 1.15  20-Jul-2007  macallan branches: 1.15.4; 1.15.6; 1.15.10; 1.15.12;
make this work with the onboard codec found on my SS20
 1.14  12-Jul-2007  macallan branches: 1.14.2;
- don't pretend to support 8bit stereo - the hardware can do it but not the
way we currently use it ( needs a 2nd pipe for each direction )
- 8bit mono a-law and u-law should work now
- add support for audio input
 1.13  14-Mar-2007  macallan - add dummy input methods so we don't panic if someone tries to read
- add dummy input mixer controls
- restart tx DMA on PWR_RESUME
- power up on PWR_RESUME only if we really have to
- add an option to control wether to spin or sleep when waiting for the chip
to switch between data and control mode
 1.12  11-Mar-2007  macallan branches: 1.12.2;
whitespace police, some cleanup - no functional changes
 1.11  11-Mar-2007  macallan some more overhaul:
- use static consistently
- convert to auconv instead of pretending to support LE samples
 1.10  10-Mar-2007  macallan adjust some debug output verbosity and use aprint_*()
 1.9  08-Mar-2007  macallan branches: 1.9.2;
make the dbri driver work again
while there enforce some alignment rules, adjust some timeouts, retry when
probing the codec fails
 1.8  04-Mar-2007  mrg fix fall out from caddr_t changes.
 1.7  04-Mar-2007  christos Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.6  24-Sep-2006  jmcneill branches: 1.6.4;
Add "name" parameter to powerhook_establish, to aid debugging. No objections
on tech-kern@
 1.5  28-May-2006  blymn branches: 1.5.4; 1.5.8; 1.5.10;
Clean up bogus whitespace
 1.4  09-Mar-2006  macallan branches: 1.4.4;
keep the chip powered down when not in use on machines that support it
( like SPARCbooks ) - needs testing on other machines
tested on my SPARCbook 3GX
 1.3  11-Dec-2005  christos branches: 1.3.4; 1.3.6; 1.3.8; 1.3.10;
merge ktrace-lwp.
 1.2  28-Jul-2005  macallan branches: 1.2.6;
Updated license
 1.1  16-Jul-2005  macallan driver for the audio part of SUNW,DBRI ISDN/audio controllers
 1.2.6.2  10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.2.6.1  28-Jul-2005  skrll file dbri.c was added on branch ktrace-lwp on 2005-11-10 14:07:47 +0000
 1.3.10.1  19-Apr-2006  elad sync with head.
 1.3.8.2  26-Jun-2006  yamt sync with head.
 1.3.8.1  13-Mar-2006  yamt sync with head.
 1.3.6.2  01-Jun-2006  kardel Sync with head.
 1.3.6.1  22-Apr-2006  simonb Sync with head.
 1.3.4.1  09-Sep-2006  rpaulo sync with head
 1.4.4.1  19-Jun-2006  chap Sync with head.
 1.5.10.1  22-Oct-2006  yamt sync with head
 1.5.8.1  18-Nov-2006  ad Sync with head.
 1.5.4.6  07-Dec-2007  yamt sync with head
 1.5.4.5  27-Oct-2007  yamt sync with head.
 1.5.4.4  03-Sep-2007  yamt sync with head.
 1.5.4.3  30-Dec-2006  yamt sync with head.
 1.5.4.2  21-Jun-2006  yamt sync with head.
 1.5.4.1  28-May-2006  yamt file dbri.c was added on branch yamt-lazymbuf on 2006-06-21 15:06:47 +0000
 1.6.4.2  24-Mar-2007  yamt sync with head.
 1.6.4.1  12-Mar-2007  rmind Sync with HEAD.
 1.9.2.5  23-Oct-2007  ad Sync with head.
 1.9.2.4  20-Aug-2007  ad Sync with HEAD.
 1.9.2.3  15-Jul-2007  ad Sync with head.
 1.9.2.2  10-Apr-2007  ad Sync with head.
 1.9.2.1  13-Mar-2007  ad Sync with head.
 1.12.2.1  11-Jul-2007  mjf Sync with head.
 1.14.2.1  15-Aug-2007  skrll Sync with HEAD.
 1.15.12.2  20-Jul-2007  macallan make this work with the onboard codec found on my SS20
 1.15.12.1  20-Jul-2007  macallan file dbri.c was added on branch matt-mips64 on 2007-07-20 22:21:52 +0000
 1.15.10.1  25-Oct-2007  bouyer Sync with HEAD.
 1.15.6.2  09-Jan-2008  matt sync with HEAD
 1.15.6.1  06-Nov-2007  matt sync with HEAD
 1.15.4.2  09-Dec-2007  jmcneill Sync with HEAD.
 1.15.4.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.16.2.1  08-Dec-2007  mjf Sync with HEAD.
 1.17.14.2  17-Jan-2009  mjf Sync with HEAD.
 1.17.14.1  02-Jun-2008  mjf Sync with HEAD.
 1.18.6.1  23-Jun-2008  wrstuden Sync w/ -current. 34 merge conflicts to follow.
 1.18.4.5  11-Mar-2010  yamt sync with head
 1.18.4.4  20-Jun-2009  yamt sync with head
 1.18.4.3  16-May-2009  yamt sync with head
 1.18.4.2  04-May-2009  yamt sync with head.
 1.18.4.1  16-May-2008  yamt sync with head.
 1.18.2.1  18-May-2008  yamt sync with head.
 1.20.6.1  19-Jan-2009  skrll Sync with HEAD.
 1.21.2.2  23-Jul-2009  jym Sync with HEAD.
 1.21.2.1  13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.29.2.1  30-Apr-2010  uebayasi Sync with HEAD.
 1.31.2.2  21-Apr-2011  rmind sync with head
 1.31.2.1  05-Mar-2011  rmind sync with head
 1.32.2.1  06-Jun-2011  jruoho Sync with HEAD.
 1.33.6.2  20-Nov-2011  mrg convert spl*() to use the sc_intr_lock mutex, and hold it in a couple
of other places we should as well.
 1.33.6.1  20-Nov-2011  mrg port to audiomp: update allocm/freem, and add get_locks() support.
bots on my ss20, but i haven't really tested it yet.
 1.33.4.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.33.4.1  17-Apr-2012  yamt sync with head
 1.34.12.1  18-May-2014  rmind sync with head
 1.34.8.1  20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.35.22.2  13-Jan-2018  snj Pull up following revision(s) (requested by mrg in ticket #503):
sys/dev/sbus/dbri.c: up to 1.38
sys/dev/sbus/dbrivar.h: up to 1.15
fix audiomp bugs:
- switch from tsleep/wakeup to condvar
- fix locking in a bunch of places. there were several locking
against myself issues.

also:
- don't let dbri_process_interrupt_buffer() loop more than once
over the array of intrs.

this fixes hangs when using audio on ss20 in -current, but does
not make audio work. it eventually times out with eg:

dbri0: switching to control mode timed out (0 f6)

and may leave a sample in the audio buffer repeating.
--
fix several KASSERT()s and locking in a few places.
fixes DIAGNOSTIC kernels and still plays.
 1.35.22.1  13-Jan-2018  snj Pull up following revision(s) (requested by macallan in ticket #476):
sys/dev/sbus/dbrivar.h: revision 1.15
sys/dev/ic/cs4215reg.h: revision 1.5
sys/dev/sbus/dbri.c: revision 1.37
overhaul the dbri driver and make it work again in the New Order Of Things
- fix switching between control and data mode
- make sure interrupts can happen in control mode
- implement audioif.commit_settings()
- switch to control mode only if needed - for changes in sample rate or format
but not for things like volume control
should fix PR 52786
 1.35.4.1  21-Mar-2018  martin Pull up following revision(s) (requested by mrg in ticket #1586):
sys/dev/sbus/dbrivar.h: revision 1.14
sys/dev/sbus/dbrivar.h: revision 1.15
sys/dev/ic/cs4215reg.h: revision 1.5
sys/dev/sbus/dbri.c: revision 1.36
sys/dev/sbus/dbri.c: revision 1.37
sys/dev/sbus/dbri.c: revision 1.38

fix audiomp bugs:
- switch from tsleep/wakeup to condvar
- fix locking in a bunch of places. there were several locking
against myself issues.
also:
- don't let dbri_process_interrupt_buffer() loop more than once
over the array of intrs.

this fixes hangs when using audio on ss20 in -current, but does
not make audio work. it eventually times out with eg:
dbri0: switching to control mode timed out (0 f6)
and may leave a sample in the audio buffer repeating.

overhaul the dbri driver and make it work again in the New Order Of Things
- fix switching between control and data mode
- make sure interrupts can happen in control mode
- implement audioif.commit_settings()
- switch to control mode only if needed - for changes in sample rate or format
but not for things like volume control
should fix PR 52786

fix several KASSERT()s and locking in a few places.

fixes DIAGNOSTIC kernels and still plays.
 1.38.4.2  08-Apr-2020  martin Merge changes from current as of 20200406
 1.38.4.1  10-Jun-2019  christos Sync with HEAD
 1.38.2.1  06-Sep-2018  pgoyette Sync with HEAD

Resolve a couple of conflicts (result of the uimin/uimax changes)
 1.39.2.3  04-May-2019  isaki Move dev/audio_if.h -> dev/audio/audio_if.h
 1.39.2.2  01-May-2019  isaki Adapt dbri to audio2.
- Add some mutex_enter/exit.
- Remove DBRI_BIG_BUFFER option. Such big buffer will not necessary
in audio2.
Thank you, macallan@.
 1.39.2.1  21-Apr-2019  isaki Use C99 style struct initializer to audio_format.
 1.41.4.1  29-Feb-2020  ad Sync with head.
 1.41.2.1  21-Mar-2020  martin Pull up following revision(s) (requested by isaki in ticket #792):

sys/arch/amiga/dev/aucc.c: revision 1.48
sys/dev/pci/auixp.c: revision 1.49
sys/dev/pci/gcscaudio.c: revision 1.19
sys/dev/pci/auich.c: revision 1.159
sys/dev/sbus/dbri.c: revision 1.42
sys/dev/pci/auvia.c: revision 1.85
sys/dev/pci/auacer.c: revision 1.39

Drop 512 bytes limit on auvia_round_blocksize().

This fixes attach on 6 channels device.
PR kern/55017.

round_blocksize must return a multiple of the framesize.
aucc(4) supports 3 channels mode.

round_blocksize must return a multiple of the framesize
even if passed blocksize is greater than the upper limit.

round_blocksize must return a multiple of the framesize.

It's not divisible when blk=GCSCAUDI_PRD_SIZE_MAX and channels=4.
round_blocksize must return a multiple of the framesize
even if 6 channels mode.

I believe that keeping "good alignment" is just a wish, not constraint.
 1.43.2.1  03-Apr-2021  thorpej Sync with HEAD.

RSS XML Feed