Home | History | Annotate | Download | only in broadcom
History log of /src/sys/arch/arm/broadcom/bcm2835_vcaudio.c
RevisionDateAuthorComments
 1.20  16-Feb-2024  skrll Trailing whitespace
 1.19  30-Apr-2023  mlelstv codec translates to 16bit slinear_le, not the internal format.
 1.18  24-Apr-2021  thorpej branches: 1.18.16;
Merge thorpej-cfargs branch:

Simplify and make extensible the config_search() / config_found() /
config_attach() interfaces: rather than having different variants for
which arguments you want pass along, just have a single call that
takes a variadic list of tag-value arguments.

Adjust all call sites:
- Simplify wherever possible; don't pass along arguments that aren't
actually needed.
- Don't be explicit about what interface attribute is attaching if
the device only has one. (More simplification.)
- Add a config_probe() function to be used in indirect configuiration
situations, making is visibly easier to see when indirect config is
in play, and allowing for future change in semantics. (As of now,
this is just a wrapper around config_match(), but that is an
implementation detail.)

Remove unnecessary or redundant interface attributes where they're not
needed.

There are currently 5 "cfargs" defined:
- CFARG_SUBMATCH (submatch function for direct config)
- CFARG_SEARCH (search function for indirect config)
- CFARG_IATTR (interface attribte)
- CFARG_LOCATORS (locators array)
- CFARG_DEVHANDLE (devhandle_t - wraps OFW, ACPI, etc. handles)

...and a sentinel value CFARG_EOL.

Add some extra sanity checking to ensure that interface attributes
aren't ambiguous.

Use CFARG_DEVHANDLE in MI FDT, OFW, and ACPI code, and macppc and shark
ports to associate those device handles with device_t instance. This
will trickle trough to more places over time (need back-end for pre-OFW
Sun OBP; any others?).
 1.17  27-Jan-2021  nia branches: 1.17.2;
vcaudio: Do not report recording mode in hardware format
 1.16  23-Jan-2021  nia vcaudio: don't advertise CAPTURE when all functions return EINVAL
 1.15  22-Jan-2020  mlelstv branches: 1.15.6;
Adapt to changed 64bit vchiq interface.
 1.14  08-May-2019  isaki branches: 1.14.2; 1.14.4;
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.13  02-Apr-2019  isaki branches: 1.13.2;
Fix indent.
 1.12  03-Sep-2018  riastradh 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.11  14-Oct-2016  nat branches: 1.11.14; 1.11.16;
Only run interrupt during playback.

OK skrll@
 1.10  28-Jul-2015  skrll branches: 1.10.2;
Reduce latency a bit. From nat@
 1.9  15-Mar-2015  jmcneill port-arm/49057: Raspberry Pi Audio volume control does not work

AUDS server messages expect volume to be expressed in units of 1/256 dB,
where we previously (incorrectly) treated it as as percentage. Map the
NetBSD audio level (0-255) to 20 steps (levels from FreeBSD bcm2835_audio.c)
and provide independent volume knobs for outputs.auto, outputs.hdmi, and
outputs.headphones.
 1.8  13-Mar-2015  jmcneill port-arm/49057: Raspberry Pi Audio volume control does not work

- Use software volume control for outputs.master/inputs.dac
- Previous volume control (for analog output only) is available on new
outputs.headphones mixer control.
- Add an outputs.select enum to choose between "auto", "headphones", and
"hdmi" outputs.
 1.7  06-Oct-2014  skrll branches: 1.7.2;
Some improvements that make playback mostly reliable for me - the final
piece of the jigaw is probably in vchiq:

- prefill vchiq with a number (currently 2) blocks of audio before
starting

- use a kthread as workqueue isn't suited to our usage.

- don't drain on stopping as for some reason it leaves data behind.
 1.6  02-Sep-2014  jmcneill capture peer version; if less than 2, bail out as bulk mode is not supported. report the peer version with "audioctl version"
 1.5  02-Sep-2014  jmcneill improved playback error handling, and get rid of junk+silence insertion at the beginning of playback
 1.4  02-Sep-2014  jmcneill use a fixed frequency (48kHz) and configure the audio server at attach time, instead of at the beginning of playback
 1.3  05-May-2014  skrll branches: 1.3.2; 1.3.4;
Improve locking and kcondvar usage.

The "interrupt" lock doesn't need to be a spin mutex as the vchi
completions we're synchronising with are done in thread context.

Don't share the interrupt lock for the msg_sync done synchronisation.
 1.2  14-Apr-2013  skrll branches: 1.2.4; 1.2.6; 1.2.10;
Trailing whitespace
 1.1  24-Mar-2013  jmcneill add wip videocore4 audio driver
 1.2.10.1  10-Aug-2014  tls Rebase.
 1.2.6.1  18-May-2014  rmind sync with head
 1.2.4.4  03-Dec-2017  jdolecek update from HEAD
 1.2.4.3  20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.2.4.2  23-Jun-2013  tls resync from head
 1.2.4.1  14-Apr-2013  tls file bcm2835_vcaudio.c was added on branch tls-maxphys on 2013-06-23 06:20:00 +0000
 1.3.4.2  15-Mar-2015  snj Pull up following revision(s) (requested by jmcneill in ticket #594):
sys/arch/arm/broadcom/bcm2835_vcaudio.c: revision 1.8, 1.9
sys/arch/arm/broadcom/files.bcm2835: revision 1.25
port-arm/49057: Raspberry Pi Audio volume control does not work
- Use software volume control for outputs.master/inputs.dac
- Previous volume control (for analog output only) is available on new
outputs.headphones mixer control.
- Add an outputs.select enum to choose between "auto", "headphones", and
"hdmi" outputs.
--
port-arm/49057: Raspberry Pi Audio volume control does not work
AUDS server messages expect volume to be expressed in units of 1/256 dB,
where we previously (incorrectly) treated it as as percentage. Map the
NetBSD audio level (0-255) to 20 steps (levels from FreeBSD bcm2835_audio.c)
and provide independent volume knobs for outputs.auto, outputs.hdmi, and
outputs.headphones.
 1.3.4.1  19-Oct-2014  martin Pull up following revision(s) (requested by skrll in ticket #151):
sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_shim.c: revision 1.5
sys/arch/arm/broadcom/bcm2835_vcaudio.c: revision 1.4
sys/arch/arm/broadcom/bcm2835_vcaudio.c: revision 1.5
sys/arch/arm/broadcom/bcm2835_vcaudio.c: revision 1.6
sys/arch/arm/broadcom/bcm2835_vcaudio.c: revision 1.7
use a fixed frequency (48kHz) and configure the audio server at attach time, instead of at the beginning of playback
improved playback error handling, and get rid of junk+silence insertion at the beginning of playback
expose vchi_get_peer_version
capture peer version; if less than 2, bail out as bulk mode is not supported. report the peer version with "audioctl version"
Some improvements that make playback mostly reliable for me - the final
piece of the jigaw is probably in vchiq:
- prefill vchiq with a number (currently 2) blocks of audio before
starting
- use a kthread as workqueue isn't suited to our usage.
- don't drain on stopping as for some reason it leaves data behind.
 1.3.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.3.2.1  05-May-2014  yamt file bcm2835_vcaudio.c was added on branch yamt-pagecache on 2014-05-22 11:39:31 +0000
 1.7.2.3  05-Dec-2016  skrll Sync with HEAD
 1.7.2.2  22-Sep-2015  skrll Sync with HEAD
 1.7.2.1  06-Apr-2015  skrll Sync with HEAD
 1.10.2.1  04-Nov-2016  pgoyette Sync with HEAD
 1.11.16.2  08-Apr-2020  martin Merge changes from current as of 20200406
 1.11.16.1  10-Jun-2019  christos Sync with HEAD
 1.11.14.1  06-Sep-2018  pgoyette Sync with HEAD

Resolve a couple of conflicts (result of the uimin/uimax changes)
 1.13.2.2  04-May-2019  isaki Move dev/audio_if.h -> dev/audio/audio_if.h
 1.13.2.1  21-Apr-2019  isaki Adapt to audio2.
 1.14.4.1  25-Jan-2020  ad Sync with head.
 1.14.2.1  25-Jan-2021  martin Pull up following revision(s) (requested by nia in ticket #1188):

sys/arch/arm/broadcom/bcm2835_vcaudio.c: revision 1.16

vcaudio: don't advertise CAPTURE when all functions return EINVAL
 1.15.6.1  03-Apr-2021  thorpej Sync with HEAD.
 1.17.2.1  24-Mar-2021  thorpej Don't filter interface attributes in rescan functions for devices that
carry only a single interface attribute. The autoconfiguration machinery
already considers interface attributes when searching for possible parents.
 1.18.16.1  16-Feb-2024  skrll Trailing whitespace

RSS XML Feed