History log of /freebsd-9.3-release/sys/dev/sound/usb/
Revision Date Author Comments
267654 20-Jun-2014 gjb

Copy stable/9 to releng/9.3 as part of the 9.3-RELEASE cycle.

Approved by: re (implicit)
Sponsored by: The FreeBSD Foundation


266486 21-May-2014 hselasky

MFC r266006 and r266011:
Fix unload of USB audio kernel module.


263644 22-Mar-2014 hselasky

MFC r263159:
Workaround for USB MIDI adapters which use non-supported values of
wMaxPacketSize for BULK endpoints.


263640 22-Mar-2014 hselasky

MFC r263155:
Add support for more sample rates to USB audio driver.

PR: usb/171254


250987 25-May-2013 hselasky

MFC r250763 and r250765:
Fix some USB audio device issues.

PR: usb/178722


250561 12-May-2013 hselasky

MFC r249796, r249830, r249844 and r249845:
USB audio fixes and improvements.
- Fix runtime switching of sample rate
- Fix feedback endpoint algorithm


248085 09-Mar-2013 marius

MFC: r227309 (partial)

Mark all SYSCTL_NODEs static that have no corresponding SYSCTL_DECLs.

The SYSCTL_NODE macro defines a list that stores all child-elements of
that node. If there's no SYSCTL_DECL macro anywhere else, there's no
reason why it shouldn't be static.


246786 14-Feb-2013 hselasky

MFC r246421 and r246454:
Add support for buttons on USB audio devices,
like Volume Up, Volume Down and Mute.

Reviewed by: mav @


244815 29-Dec-2012 hselasky

MFC r244567:

Reduce stack usage in the USB audio driver by moving some large stack
elements to the USB audio softc structure.


244247 15-Dec-2012 hselasky

MFC r244027:
Add support for various Yamaha keyboards.

MFC after: 1 week
PR: usb/174254


242822 09-Nov-2012 hselasky

MFC r242127, r240078, r240609, r241988, r242129, r242223, r242438,
r242453, r242455 and r242458:

Add full support for Fast Track Ultra 8R from M-audio.

Implement support for USB Audio v2.0.

Remove some redundant USB audio v1.0 debug data. Use lsusb instead.

Implement support for the so-called USB feedback endpoint for USB
audio devices.

Export all mixer nodes into dev.pcm.X.mixer.Y sysctl nodes.

PR: usb/171254


235000 04-May-2012 hselasky

MFC r233774:
Fix compiler warnings, mostly signed issues,
when USB modules are compiled with WARNS=9.


232877 12-Mar-2012 hselasky

MFC r228485 and r227843:
Stop USB audio transfers early so that any audio applications
will time out and close opened /dev/dspX.Y device(s), if
any.


232198 26-Feb-2012 hselasky

MFC r232039:
Avoid creating PCM devices for MIDI only adapters.


229093 31-Dec-2011 hselasky

MFC r226173, r227843, r227848 and r227908:
Use DEVMETHOD_END to mark end of device methods.
Remove superfluous device methods.
Add some missing __FBSBID() macros.


225736 23-Sep-2011 kensmith

Copy head to stable/9 as part of 9.0-RELEASE release cycle.

Approved by: re (implicit)


225414 06-Sep-2011 hselasky

Fix precedence warning when compiling kernel with clang.

Approved by: re (kib)
Submitted by: dim
MFC after: 1 week


224024 14-Jul-2011 hselasky

Restore USB MIDI transmit buffer size to 1Kbyte.

MFC after: 1 week


223736 03-Jul-2011 hselasky

Introduce a quirk for broken USB MIDI hardware instead of limiting performance
in general.

MFC after: 1 week


223727 02-Jul-2011 hselasky

Fix problem about USB MIDI TX data format, that some devices only accept
a maximum of 4 bytes (one command) per short terminated USB transfer.
Optimise the TX case by sending multiple USB frames.

MFC after: 1 week


223486 24-Jun-2011 hselasky

- Move all USB device ID arrays into so-called sections,
sorted according to the mode which they support:
host, device or dual mode
- Add generic tool to extract these data:
tools/bus_autoconf

Discussed with: imp
Suggested by: Robert Millan <rmh@debian.org>
PR: misc/157903
MFC after: 14 days


222051 18-May-2011 avg

usb: change to one-pass probing of device drivers

This brings USB bus more in line with how newbus is supposed to be used.
Also, because of the two-pass probing the following message was produced
by devd in default configuration when almost any USB device was
connected:
Unknown USB device: vendor <> product <> bus <>
This should be fixed now.

Note that many USB device drivers pass some information from probe
method to attach method via ivars. For this to continue working we rely
on the fact that the subr_bus code calls probe method of a winning driver
again before calling its attach method in the case where multiple
drivers claim to support a device. This is done because device
description is set in successful probe methods and we want to get a correct
device description from a winning driver. So now this logic is re-used
for setting ivars too.

Reviewed by: hselasky
MFC after: 1 month


221695 09-May-2011 hselasky

Workaround for broken no-name USB audio devices sold by dealextreme
called "3D sound" and the alike.

MFC after: 14 days


220900 20-Apr-2011 hselasky

Only set the sample rate if the USB audio channel reports
that it supports the frequency control request.

MFC after: 7 days
Approved by: thompsa (mentor)


218988 24-Feb-2011 hselasky

- Add support for some non-standard USB MIDI devices from Roland, by
means of allowing vendor specific interface class for audio and MIDI devices.
- Add new quirks for this. The vendor and product list in OpenBSD's
dev/usb/umidi_quirks.c was used as reference.

MFC after: 14 days
Approved by: thompsa (mentor)


218791 18-Feb-2011 hselasky

- Make an enum for all the umidi USB transfers.
- Use the USB stack's builtin clear-stall feature.
- Wrap some long lines.
- Use memcpy() instead of bcopy().
- Use memset() instead of bzero().
- Tested applications:
/usr/ports/audio/fluidsynth

MFC after: 7 days
Approved by: thompsa (mentor)


217265 11-Jan-2011 jhb

Remove unneeded includes of <sys/linker_set.h>. Other headers that use
it internally contain nested includes.

Reviewed by: bde


209452 22-Jun-2010 thompsa

- fix for USB audio devices which use the 7-byte endpoint descriptor instead of
the 9-byte one.
- remove sync-endpoint code, which is currently unused.

Reported by: Antun Matanovi
Submitted by: Hans Petter Selasky


209450 22-Jun-2010 thompsa

Reduce MIDI input buffer size to one USB packet, hence some USB devices don't
properly short terminate their transfers. This fixes a problem where input
appears several seconds late.

Reported by: Alexander Yerenkow
Submitted by: Hans Petter Selasky


207077 22-Apr-2010 thompsa

Change USB_DEBUG to #ifdef and allow it to be turned off. Previously this had
the illusion of a tunable setting but was always turned on regardless.

MFC after: 1 week


203678 08-Feb-2010 brucec

Rename usb2_ structures and variables to usb_.

Approved by: rrs (mentor)
Discussed with: hps


200825 22-Dec-2009 thompsa

- add support for more than 2 audio channels. [1]
- add support for more sample rates

Submitted by: [1] ariff (earlier version), Hans Petter Selasky


199677 22-Nov-2009 thompsa

add support for MIDI devices without audio control stream.

Submitted by: Hans Petter Selasky


199576 20-Nov-2009 thompsa

remove volume alignment (was previously not correctly implemented)

Submitted by: HPS
Reported by: Jaakko Heinonen


199060 08-Nov-2009 thompsa

Improve support for High-speed USB audio devices.
- fix issues regarding the mixer, where the interface number was not set in
time.
- fix wrong use of resolution parameter.

Submitted by: Hans Petter Selasky


196487 24-Aug-2009 alfred

Remove redundant Giant reference. Giant will be dropped
automatically when the mutex argument is NULL.

Reported by: Various people
Submitted by: hps


196219 14-Aug-2009 jhb

Purge mergeinfo from files that were temporarily renamed while USB2 was
imported into the tree alongside USB.

Approved by: re (mergeinfo blanket)


195961 30-Jul-2009 alfred

USB audio:
- code factoring patch from "Eygene Ryabinkin"
- P4 ID: 166149

Submitted by: hps
Approved by: re


195640 12-Jul-2009 marcel

Isochronous transfers only have 1 frame buffer, but multiple
frame lengths. The frame buffer is at index 0.

Approved by: re (kensmith)
Obtained from: HPS


195120 27-Jun-2009 thompsa

Use the correct mutex in umidi_open()

Submitted by: Hans Petter Selasky
Approved by: re (kib)


194682 23-Jun-2009 thompsa

Fix a typeo in the frame len function to unbreak the build, make it shorter
while I am here.


194677 23-Jun-2009 thompsa

- Make struct usb_xfer opaque so that drivers can not access the internals
- Reduce the number of headers needed for a usb driver, the common case is just usb.h and usbdi.h


194228 15-Jun-2009 thompsa

s/usb2_/usb_|usbd_/ on all function names for the USB stack.


193640 07-Jun-2009 ariff

Sound Mega-commit. Expect further cleanup until code freeze.

For a slightly thorough explaination, please refer to
[1] http://people.freebsd.org/~ariff/SOUND_4.TXT.html .

Summary of changes includes:

1 Volume Per-Channel (vpc). Provides private / standalone volume control
unique per-stream pcm channel without touching master volume / pcm.
Applications can directly use SNDCTL_DSP_[GET|SET][PLAY|REC]VOL, or for
backwards compatibility, SOUND_MIXER_PCM through the opened dsp device
instead of /dev/mixer. Special "bypass" mode is enabled through
/dev/mixer which will automatically detect if the adjustment is made
through /dev/mixer and forward its request to this private volume
controller. Changes to this volume object will not interfere with
other channels.

Requirements:
- SNDCTL_DSP_[GET|SET][PLAY|REC]_VOL are newer ioctls (OSSv4) which
require specific application modifications (preferred).
- No modifications required for using bypass mode, so applications
like mplayer or xmms should work out of the box.

Kernel hints:
- hint.pcm.%d.vpc (0 = disable vpc).

Kernel sysctls:
- hw.snd.vpc_mixer_bypass (default: 1). Enable or disable /dev/mixer
bypass mode.
- hw.snd.vpc_autoreset (default: 1). By default, closing/opening
/dev/dsp will reset the volume back to 0 db gain/attenuation.
Setting this to 0 will preserve its settings across device
closing/opening.
- hw.snd.vpc_reset (default: 0). Panic/reset button to reset all
volume settings back to 0 db.
- hw.snd.vpc_0db (default: 45). 0 db relative to linear mixer value.

2 High quality fixed-point Bandlimited SINC sampling rate converter,
based on Julius O'Smith's Digital Audio Resampling -
http://ccrma.stanford.edu/~jos/resample/. It includes a filter design
script written in awk (the clumsiest joke I've ever written)
- 100% 32bit fixed-point, 64bit accumulator.
- Possibly among the fastest (if not fastest) of its kind.
- Resampling quality is tunable, either runtime or during kernel
compilation (FEEDER_RATE_PRESETS).
- Quality can be further customized during kernel compilation by
defining FEEDER_RATE_PRESETS in /etc/make.conf.

Kernel sysctls:
- hw.snd.feeder_rate_quality.
0 - Zero-order Hold (ZOH). Fastest, bad quality.
1 - Linear Interpolation (LINEAR). Slightly slower than ZOH,
better quality but still does not eliminate aliasing.
2 - (and above) - Sinc Interpolation(SINC). Best quality. SINC
quality always start from 2 and above.

Rough quality comparisons:
- http://people.freebsd.org/~ariff/z_comparison/

3 Bit-perfect mode. Bypasses all feeder/dsp effects. Pure sound will be
directly fed into the hardware.

4 Parametric (compile time) Software Equalizer (Bass/Treble mixer). Can
be customized by defining FEEDER_EQ_PRESETS in /etc/make.conf.

5 Transparent/Adaptive Virtual Channel. Now you don't have to disable
vchans in order to make digital format pass through. It also makes
vchans more dynamic by choosing a better format/rate among all the
concurrent streams, which means that dev.pcm.X.play.vchanformat/rate
becomes sort of optional.

6 Exclusive Stream, with special open() mode O_EXCL. This will "mute"
other concurrent vchan streams and only allow a single channel with
O_EXCL set to keep producing sound.

Other Changes:
* most feeder_* stuffs are compilable in userland. Let's not
speculate whether we should go all out for it (save that for
FreeBSD 16.0-RELEASE).
* kobj signature fixups, thanks to Andriy Gapon <avg@freebsd.org>
* pull out channel mixing logic out of vchan.c and create its own
feeder_mixer for world justice.
* various refactoring here and there, for good or bad.
* activation of few more OSSv4 ioctls() (see [1] above).
* opt_snd.h for possible compile time configuration:
(mostly for debugging purposes, don't try these at home)
SND_DEBUG
SND_DIAGNOSTIC
SND_FEEDER_MULTIFORMAT
SND_FEEDER_FULL_MULTIFORMAT
SND_FEEDER_RATE_HP
SND_PCM_64
SND_OLDSTEREO

Manual page updates are on the way.

Tested by: joel, Olivier SMEDTS <olivier at gid0 d org>, too many
unsung / unnamed heroes.


193465 04-Jun-2009 thompsa

revert r162516. We only support 1 or 2 channels per stream
which reflects mono and stereo.

Submitted by: Hans Petter Selasky


193045 29-May-2009 thompsa

s/usb2_/usb_/ on all typedefs for the USB stack.


192984 28-May-2009 thompsa

s/usb2_/usb_/ on all C structs for the USB stack.


192929 27-May-2009 thompsa

Provide a workaround for USB devices that do not support mono or stereo
operation by overriding the channel count.

Submitted by: Hans Petter Selasky
Reported by: MIHIRA Sanpei Yoshiro


192505 21-May-2009 thompsa

Fix a few variable renames of usb2_mode outside dev/usb.


192453 20-May-2009 joel

Remove license clauses 3 and 4 as per rev. 1.112 of uaudio.c and rev. 1.15 of
uaudioreg.h in NetBSD.


190749 05-Apr-2009 piso

Remove pointeless mergeinfo that crept in from r190633.


190734 05-Apr-2009 thompsa

MFp4 //depot/projects/usb@159909

- make usb2_power_mask_t 16-bit
- remove "usb2_config_sub" structure from "usb2_config". To compensate for this
"usb2_config" has a new field called "usb_mode" which select for which mode
the current xfer entry is active. Options are: a) Device mode only b) Host
mode only (default-by-zero) c) Both modes. This change was scripted using
the following sed script: "s/\.mh\././g".
- the standard packet size table in "usb_transfer.c" is now a function, hence
the code for the function uses less memory than the table itself.

Submitted by: Hans Petter Selasky


190633 01-Apr-2009 piso

Implement an ipfw action to reassemble ip packets: reass.


190581 30-Mar-2009 mav

Integrate user/mav/ata branch:

Add ch_suspend/ch_resume methods for PCI controllers and implement them
for AHCI. Refactor AHCI channel initialization according to it.

Fix Port Multipliers operation. It is far from perfect yet, but works now.
Tested with JMicron JMB363 AHCI + SiI 3726 PMP pair.
Previous version was also tested with SiI 4726 PMP.

Hardware sponsored by: Vitsch Electronics / VEHosting.nl


189699 11-Mar-2009 dfr

Merge in support for Xen HVM on amd64 architecture.


189275 02-Mar-2009 thompsa

Rename the ushub device class back to uhub as it was in the old usb stack,
moused(8) looks for "uhub/ums" to decide if needs to load the module.

Reported by: Garrett Cooper


189110 27-Feb-2009 thompsa

Change USB over to make_dev() for all device nodes, previously it hooked into
the devfs clone handler to open the (invisible) devices on the fly.

The /dev entries are layed out as follows,

/dev/usbctl = master device
/dev/usb/0.1.0.5 = usb device, (<bus>.<dev>.<iface>.<endpoint>)
/dev/ugen0.1 -> usb/0.1.0.0 = ugen link to ctrl endpoint

This also removes the custom permissions model from USB. Bump
__FreeBSD_version to 800066.

Submitted by: rink (earlier version)


188957 23-Feb-2009 thompsa

Move the uaudio and ata-usb drivers into their correct locations.


188955 23-Feb-2009 thompsa

Move two missed usb drivers out to the graveyard location under sys/legacy/dev.


182076 23-Aug-2008 imp

Handle the error case properly for device_get_children.


170960 20-Jun-2007 imp

s/logprintf/printf/g

Approved by: re@


170936 18-Jun-2007 imp

Explicitly use usb_port.h to get compat macros.


170873 17-Jun-2007 ariff

Flush remaining malloc() cleanups (M_NOWAIT -> M_WAITOK).


170815 16-Jun-2007 ariff

Last (again ?!?) major commit for RELENG_7, featuring total Giant
eradication in/from userland path, countless locking fixes, etc.

- General sleep call through msleep(9) has been converted to condvar(9)
with better consistencies.
- Heavily guard every possible "slow path" entries (open(), close(),
few ioctl()s, sysctls), but once it entering "fast path" (io, interrupt
started), they are free to fly on their own.
- Rearrange locking sequences, resulting better concurrency and
serialization. Large part doesn't even need locking at all, and will be
removed in future. Less clutter, except in few places due to lock
ordering.
- Anonymous mixer object creation/deletion to simplify mixer handling
beyond typical mixer ioctls.
Submitted by: chibis (with modifications)
- Add few mix_[get|set|..] functions to avoid calling mixer_ioctl()
directly using cryptic arguments.
- Locking fixes to avoid possible deadlock with (still under Giant) USB.
- Better simplex/duplex device handling.
- Recover mmap() functionality for recording, which has been lost
since 2.2.x - 3.x (the introduction of newpcm). Full-duplex mmap still
doesn't work (due to VM/page design), but people still can mmap
both by opening each direction separately. mmaped playback is guarantee
to work either way.
- New sysctl: "hw.snd.compat_linux_mmap" to allow PROT_EXEC page
mapping, due to recent changes in linux compatibility layer which
require it. All linux applications that using sound + mmap() (mostly games)
require this to be enabled. Disabled by default.
- Other goodies.. too many, that will increase releng7 shareholder value
and make users of releng6 (and below) cry ;)

* This commit should be atomic. If anything goes wrong (not counting problem
originated from elsewhere), I will not hesitate to revert everything back
within 12 hours. This substantial changes itself not a rocket science
and the process has begun for almost 2 years, and lots of incremental
changes are already in place during that period of time.
* Some issues does occur in snd_emu10kx (note the 'x') due to various
internal locking issues and it is currently being worked on by chibis.

Tested by: chibis (Yuriy Tsibizov), joel, Alexandre Vieira,
many innocent souls...


170612 12-Jun-2007 imp

Expand USB_ATTACH_{ERROR,SUCCESS}_RETURN inline and eliminate from
usb_port.h. They aren't needed, and are a legacy of this code's past.


170521 11-Jun-2007 ariff

Filter/compress the amount of channel trigger. This should reduce
much of lock/unlock contentions within the interrupt handler. Most
of these drivers only need PCMTRIG_START or STOP (ABORT).

Discussed with: scottl


170504 10-Jun-2007 mjacob

Remove const type qualifier from a function- gcc4.2 doesn't accept it.

Reviewed by: Ariff


170460 09-Jun-2007 ru

Make this compile.


170455 09-Jun-2007 imp

Expand USB_ATTACH_SETUP inline + devinfo tweaks

# looks like there's a chance that uaudio might compile on otherBSD, so leave
# those #defines alone as well as make this change in a compatible way.


170207 02-Jun-2007 ariff

Use standard pcm_get/setflags() rather than dereferencing softc while
enabling SD_F_SOFTPCMVOL or any flags.


170161 31-May-2007 ariff

Last major commit and updates for RELENG_7:

- Rework the entire pcm_channel structure:
* Remove rarely used link placeholder, instead, make each pcm_channel
as head/link of each own/each other. Unlock - Lock sequence due to
sleep malloc has been reduced.
* Implement "busy" queue which will contain list of busy/active
channels. This greatly reduce locking contention for example while
servicing interrupt for hardware with many channels or when virtual
channels reach its 256 peak channels.

- So I heard you like v chan ... O RLY?
Welcome to Virtual **Record** Channels (vrec, rec vchans, vchans for
recording, Rec-Chan, you decide), the ultimate solutions for your
nagging O_RDWR full-duplex wannabe (note: flash plugins) monopolizing
single record channel causing EBUSY. Vrec works exactly like Vchans
(or, should I rename it to "Vplay" :) , except that it operates on the
opposite direction (recording). Up to 256 vrecs (like vchans) are
possible.

Notes:
* Relocate dev.pcm.%d.{vchans,vchanformat,vchanrate} to each of its
respective node/direction:
dev.pcm.%d.play.* for "play" (cdev = dsp%d.vp%d)
dev.pcm.%d.rec.* for "record" (cdev = dsp%d.vr%d)
* Don't expect that it will magically give you ability to split
"recording source" (eg: 1 channel for cdrom, 1 channel for mic,
etc). Just admit that you only have a *single* recording source /
channel. Please bug your hardware vendor instead :)

- Bump maxautovchans from 4 to 16. For a full-fledged multimedia
desktop/workstation with too many soundservers installed (esound,
artsd, jackd, pulse/polypaudio, ding-dong pling plong mudkip fuh fuh,
etc), 4 seems inadequate. There will be no memory penalty here, since
virtual channels are allocate only by demand.

- Nuke/Rework the entire statically created cdev entries. Everything is
clonable through snd own clone manager which designed to withstand many
kind of abusive devfs droids such as:
* while : ; do /bin/test -e /dev/dsp ; done
* jot 16777216 0 | while read x ; do ls /dev/dsp0.$x ; done
* hundreds (could be thousands) concurrent threads/process opening
"/dev/dsp" (previously, this might result EBUSY even with just
3 contesting threads/procs).
o Reusable clone objects (instead of creating new one like there's no
tomorrow) after certain expiration deadline. The clone allocator will
decide whether to reuse, share, or creating new clone.
o Automatic garbage collector.

- Dynamic unit magic allocator. Maximum attached soundcards can be tuned
using tunable "hw.snd.maxunit" (Default to 512). Minimum is 16, and
maximum is 2048.

- ..other fixes, mostly related to concurrency issues.

joel@ will do the manpage updates on sound(4).

Have fun.


168244 02-Apr-2007 ariff

Provide hint / tunable for possible asynchronous USB execution. Async
execution should help us avoiding potential deadlock and illegal locking
while sleeping in various mixer -> usb calls. To enable it, use
hint.uaudio.%d.async="1" or sysctl dev.uaudio.%d.async=1. Default is
disable, to remain compatible with old behaviour (with slight risk of
potential deadlock).


168128 31-Mar-2007 netchild

Tell interested readers of the source that the return value is not
checked by intend.

Found by: Coverity Prevent (tm)
CID: 55
Reviewed by: ariff


167649 16-Mar-2007 ariff

[stage: 9/9]

- SWAPLR quirk for (unknown, luckily it is mine) broken uaudio stick.
Fixing by rewiring is impossible without damaging it. Luckily,
we can fix it using "other" methods :) .
- Add uaudio_get_vendor(), _product() and _release() in uaudio.c
(currently used by uaudio_pcm quirk).
- Implement CHANNEL_SETFRAGMENTS().
- Drop channel locking in few places where it is about to sleep
somewhere. This should help eliminating illegal locking acquisition
where the current thread is about to sleep, and also few deadlock
cases. Dropping it right here is quite safe since it is already
protected by CHN_F_BUSY flag and other threads won't bother to touch it.
Solving other illegal locking issues are quite tricky without converting
most usbd_do_request() calls to its equivalent _async() calls,
which I intend to do it later after getting full test report from
other people with different uaudio hardwares.
- Fix memory leak issues during detach. This seems common to any drivers
(notably emu10kx, csapcm?) with bridge functions.


166265 26-Jan-2007 ariff

Fix forever broken ua_chan_setblocksize() uninitialized return value
which causing divide by zero panic in other places (notably chn_sync()).


166264 26-Jan-2007 ariff

Sync uaudio_sndstat_prepare_pcm() output with sndstat_prepare_pcm() to get
simmilar (debugging) output.


165834 06-Jan-2007 netchild

Sync with NetBSD:
revision 1.98 is NOT merged, because FreeBSD does not support this
syntax.
revision 1.99 is NOT merged, "const poisoning" part is not applicable
to FreeBSD. There is no variable shadowing, GCC can't find
this one (but there are others)
revision 1.100 is NOT merged, because it was null patch (no changes)
revision 1.101 is NOT merged, there is no BIT() macro in FreeBSD
revision 1.102 is merged
revision 1.103 is partially merged. There is no ai.ifaceh in FreeBSD
revision 1.104 is NOT merged
revision 1.105 is merged
revision 1.106 is not merged, because of rev. 1.107
revision 1.107 is a backuout of 1.106

Submitted by: Yuriy Tsibizov <Yuriy.Tsibizov@gfk.ru>


164614 26-Nov-2006 ariff

Welcome to Once-a-year Sound Mega-Commit. Enjoy numerous updates and fixes
in every sense.

General
-------

- Multichannel safe, endian safe, format safe
* Large part of critical pcm filters such as vchan.c, feeder_rate.c,
feeder_volume.c, feeder_fmt.c and feeder.c has been rewritten so that
using them does not cause the pcm data to be converted to 16bit little
endian.
* Macrosses for accessing pcm data safely are defined within sound.h in
the form of PCM_READ_* / PCM_WRITE_*
* Currently, most of them are probably limited for mono/stereo handling,
but the future addition of true multichannel will be much easier.

- Low latency operation
* Well, this require lot more works to do not just within sound driver,
but we're heading towards right direction. Buffer/block sizing within
channel.c is rewritten to calculate precise allocation for various
combination of sample/data/rate size. As a result, applying correct
SNDCTL_DSP_POLICY value will achive expected latency behaviour simmilar
to what commercial 4front driver do.
* Signal handling fix. ctrl+c of "cat /dev/zero > /dev/dsp" does not
result long delay.
* Eliminate sound truncation if the sound data is too small.
DIY:
1) Download / extract
http://people.freebsd.org/~ariff/lowlatency/shortfiles.tar.gz
2) Do a comparison between "cat state*.au > /dev/dsp" and
"for x in state*.au ; do cat $x > /dev/dsp ; done"
- there should be no "perceivable" differences.
Double close for PR kern/31445.

CAVEAT: Low latency come with (unbearable) price especially for poorly
written applications. Applications that trying to act smarter
by requesting (wrong) blocksize/blockcount will suffer the most.
Fixup samples/patches can be found at:
http://people.freebsd.org/~ariff/ports/

- Switch minimum/maximum sampling rate limit to "1" and "2016000" (48k * 42)
due to closer compatibility with 4front driver.
Discussed with: marcus@ (long time ago?)

- All driver specific sysctls in the form of "hw.snd.pcm%d.*" have been
moved to their own dev sysctl nodes, notably:
hw.snd.pcm%d.vchans -> dev.pcm.%d.vchans
Bump __FreeBSD_version.

Driver specific
---------------

- Ditto for sysctls.

- snd_atiixp, snd_es137x, snd_via8233, snd_hda
* Numerous cleanups and fixes.
* _EXPERIMENTAL_ polling mode support using simple callout_* mechanisme.
This was intended for pure debugging and latency measurement, but proven
good enough in few unexpected and rare cases (such as problematic shared
IRQ with GIANT devices - USB). Polling can be enabled/disabled through
dev.pcm.0.polling. Disabled by default.

- snd_ich
* Fix possible overflow during speed calibration. Delay final
initialization (pcm_setstatus) after calibration finished.
PR: kern/100169
Tested by: Kevin Overman <oberman@es.net>
* Inverted EAPD for few Nec VersaPro.
PR: kern/104715
Submitted by: KAWATA Masahiko <kawata@mta.biglobe.ne.jp>

Thanks to various people, notably Joel Dahl, Yuriy Tsibizov, Kevin Oberman,
those at #freebsd-azalia @ freenode and others for testing.

Joel Dahl will do the manpage update.


162738 28-Sep-2006 ariff

Various fixups, especially for the upcomming High Definition Audio
commit.

1) sys/dev/sound/pcm/sound.h
sys/dev/sound/pcm/channel.c
* Be more specific: SD_F_SOFTVOL -> SD_F_SOFTPCMVOL
2) sys/dev/sound/pcm/mixer.[ch]
* Implement
mix_setparentchild()
mix_setrealdev()
mix_getparent()
mix_getchild()
The purpose of these functions is implement relative volume
adjustment, such as to tie two or more mixer device into a
single logical device. Usefull for the upcoming HDA driver
and few AC97 codec (such as AD1981B) where the master volume
"vol" need to be implemented using this logical manner.
3) sys/dev/sound/pcm/ac97_patch.[ch]
* Patch for AD1981B codec to enable (automuting) headphone jack sense.
4) sys/dev/sound/pcm/ac97.c
* Implement proper logical master volume for AD9181B codec
through various mix_set{parentchild,realdev}(). Tie both
"ogain" (headphone volume) and "phone" (speaker/lineout) to
a logical "vol".
5) sys/dev/sound/pcm/usb/uaudio_pcm.c
* ditto, for "vol" -> { "pcm" }.

MFC after: 1 month


162180 09-Sep-2006 netchild

Fix the check where we want to use the end of the supported range if the
value is out of the supported range.

Noticed by: Ed Schouten <ed@fxq.nl>
Reviewed by: Kazuhito HONDA <kazuhito@ph.noda.tus.ac.jp>


162100 07-Sep-2006 scottl

Catch up to USB changes.


155342 05-Feb-2006 netchild

Convert NULL checks into KASSERT (and move them before the first
dereferencing) since a NULL value would be a bug here.

Note: Both affected functions look very similar. A refactoring may
be beneficial.

CID: 483, 485
Found with: Coverity Prevent(tm)
Discussed with: ariff
MFC after: 5 days


153845 29-Dec-2005 netchild

Fix some kind of "off by one"-error: the min or max sample rate the
device is able to reproduce should be usable too instead of failing
in such a case.

PR: 89269
Submitted by: Don L. Belcher <don@siad.net>


153509 18-Dec-2005 ariff

Precision for AFMT_x24_yE and AFMT_x32_yE should be 24 and 32, respectively.

Submitted by: Kazuhito HONDA <kazuhito@ph.noda.tus.ac.jp>


152379 13-Nov-2005 netchild

Add support for 24/32 bit audio formats/conversion.

It may be the case that you may hear some unwanted noise while
playing back with 24/32 bit. This is a problem in the USB system.
Explanation from Hans Petter Selasky:
---snip---
The current USB sound driver only uses one isochronous
buffer, that is restarted when it is completed. This will lead to a short
period of time, +1ms, where no sound data is sent to the external USB device.
Depending on the load of your computer, this can be as much as 50ms. So the
USB sound driver must use 2 isochronous transfers. At the beginning one will
queue both. Then these are restarted on completion. This will result in a
constant-rate data stream to the external sound device, a minimum sound
buffer equal to the size of the isochronous buffer, and possibly the sound
will reach your ears with less delay. Little delay is a result of constant
data rate. Currently only my USB driver will support that. If one tries that
with the USB driver in *BSD, then it will crash at the first moment one gets
a buffer underrun.
---snip---

Submitted by: Kazuhito HONDA <kazuhito@ph.noda.tus.ac.jp>
Mono-recording still not tested by: julian


150830 02-Oct-2005 netchild

Emulate pcm mixer controller for any uaudio device without it.

Submitted by: Ariff Abdullah <skywizard@MyBSD.org.my>


150289 18-Sep-2005 netchild

Add the KLD to the sndstat info.


150288 18-Sep-2005 netchild

Merge NetBSD fixes (except for 1.97 there should be no functional change):
1.94: ansify and KNF (NetBSD KNF).
1.95: Fix DPRINTF (bug from change in 1.94).
1.96: NetBSD specific.
1.97: Fix memory leak reported by Ted Unangst as bug #3 on tech-kern.

Obtained from: NetBSD


149980 11-Sep-2005 netchild

Fix a bug in volume calculation, this sometimes gives a USB audio device an
unexpected value (when the volume is high).

Submitted by: Kazuhito HONDA <kazuhito@ph.noda.tus.ac.jp>


145599 27-Apr-2005 julian

Add code from Kazuhito HONDA that allows the user to see
the available modes in /dev/sndstat.
e.g.
pcm1: <USB Audio> at addr ? (0p/1r/0v channels duplex)
mode 1:(input) 1ch, 16/16bit, pcm, 44100Hz
mode 2:(input) 1ch, 16/16bit, pcm, 22050Hz
mode 3:(input) 1ch, 16/16bit, pcm, 11025Hz
mode 4:(input) 1ch, 16/16bit, pcm, 8000Hz


145198 17-Apr-2005 matk

Fix a bug where we call pcm_getbuffersize twice.

Pointed out by: Kazuhito HONDA <kazuhito at ph dot noda dot tus dot ac dot jp>


145195 17-Apr-2005 matk

De-dma the uaudio <-> pcm bridge. We were not capable of doing DMA from
this buffer anyway so the constraint that it had to be DMA capable only
caused pain when devices failed to aquire the memory. Use a regular
malloc instead with sndbuf_setup.

Approved by: tanimura (mentor)


145180 17-Apr-2005 julian

On record only devices, don't fail if we don't have a play channel.

MFC after: 3 days


145021 13-Apr-2005 julian

The maximum allowable alloc is 16K not (16K-1).
This whole section is actually overly restrictive and
another patch is in the works.


142890 01-Mar-2005 imp

Use BUS_PROBE_DEFAULT in preference to 0 and BUS_PROBE_LOW_PRIORITY in
preference to some random negative number to allow other drivers a
bite at the apple.


139749 06-Jan-2005 imp

Start each of the license/copyright comments with /*-, minor shuffle of lines


139289 25-Dec-2004 julian

Allow selection of a recording source on USB audio devices.

PR: 75316
Submitted by: Kazuhito HONDA <kazuhito at ph dot noda dot tus dot ac dot jp>
Obtained from: NetBSD plus changes
MFC after: 2 weeks


139288 25-Dec-2004 julian

Allow recording on at least some USB audio devices.

PR: 75311
Submitted by: Kazuhito HONDA <kazuhito at ph dot noda dot tus dot ac dot jp>
Obtained from: NetBSD plus changes
MFC after: 2 weeks


139287 25-Dec-2004 julian

Allow volume control on more channels/inputs

PR: 75276
Submitted by: Kazuhito HONDA <kazuhito at ph dot noda dot tus dot ac dot jp>
Obtained from: NetBSD with changes
MFC after: 2 weeks


139285 25-Dec-2004 julian

MFNetBSD:
One of a set of patches submitted by Kazuhito HONDA
to make the usb audio driver a lot more capable.

PR: 75274
Submitted by: Kazuhito HONDA (kazuhito at ph dot noda dot tus dot ac dot jp)
Obtained from: NetBSD (indirectly)
MFC after: 2 weeks


139196 22-Dec-2004 phk

Don't include vnode.h


132236 16-Jul-2004 tanimura

Rename the sound device drivers:

- `sound'
The generic sound driver, always required.

- `snd_*'
Device-dependent drivers, named after the sound module names.
Configure accordingly to your hardware.

In addition, rename the `snd_pcm' module to `sound' in order to sync
with the driver names.

Suggested by: cg


129890 31-May-2004 takawata

Devclass have to be shared with same 'pcm' devclass, or
unit management will corrupt.


117126 01-Jul-2003 scottl

Mega busdma API commit.

Add two new arguments to bus_dma_tag_create(): lockfunc and lockfuncarg.
Lockfunc allows a driver to provide a function for managing its locking
semantics while using busdma. At the moment, this is used for the
asynchronous busdma_swi and callback mechanism. Two lockfunc implementations
are provided: busdma_lock_mutex() performs standard mutex operations on the
mutex that is specified from lockfuncarg. dftl_lock() is a panic
implementation and is defaulted to when NULL, NULL are passed to
bus_dma_tag_create(). The only time that NULL, NULL should ever be used is
when the driver ensures that bus_dmamap_load() will not be deferred.
Drivers that do not provide their own locking can pass
busdma_lock_mutex,&Giant args in order to preserve the former behaviour.

sparc64 and powerpc do not provide real busdma_swi functions, so this is
largely a noop on those platforms. The busdma_swi on is64 is not properly
locked yet, so warnings will be emitted on this platform when busdma
callback deferrals happen.

If anyone gets panics or warnings from dflt_lock() being called, please
let me know right away.

Reviewed by: tmm, gibbs


107235 25-Nov-2002 cg

if the list of supported formats is empty, fail the attach instead of
panicing later. this is a band-aid pending further investigation.

MFC After: 7 days
Approved by: re


106529 06-Nov-2002 joe

Packed structures are defined differently in older gcc's, like the one
currently in -stable. Put the exception into usb.h instead of having it
hard coded in the sound code.


102386 25-Aug-2002 bde

Fixed editing errors in rev.1.4 which manifested as printf format errors
at compile time and probably as panics at runtime.


101521 08-Aug-2002 joe

Use the hw.usb sysctl tree instead of debug.usb.

Requested by: imp


101060 31-Jul-2002 joe

Replace the FOO_DEBUG definitions with USB_DEBUG, and switch the
debugging levels to off by default. Now that debug levels can be
tweaked by sysctl we don't need to go through hoops to get the
different usb parts to produce debug data.


101059 31-Jul-2002 joe

Make this compile with the debugging options switched on.


101053 31-Jul-2002 joe

Get bored with hard coded debug level variables and introduce a debug.usb
sysctl tree for tweaking them real-time.

Reviewed by: iedowse


100474 22-Jul-2002 peter

Make this compile.
uaudio.c:1822: warning: `uaudio_ctl_get' defined but not used


100447 21-Jul-2002 nsayer

Add uaudio -- a USB audio device driver.

This driver actually works slightly better on -stable than on -current
(the system locks on detach on -current), so it should be MFC'd somewhat
sooner.

This driver currently points out a difficulty in the sound device framework.
The PCM unregister routine is allowed to refuse the detach if the device is
in use. In the case of a USB device, however, this unregistration is much more
mandatory in nature, since the device is *actually* gone when this call is
made. The sound subsystem really should not refuse an unregistration and
should take its own steps to reject further I/O. As a result, if you detach
a USB sound device while it is in use, you can expect a panic shortly
thereafter.

This device cannot currently record audio. Some routines are unwritten as
of yet in uaudio.c to support recording.

This device hangs my -current box on detach. I don't know why. This does
not happen on my -stable machine.

Obtained from: Hiroyuki Aizu
MFC after: 2 weeks