Commit Graph

1404 Commits

Author SHA1 Message Date
Hans Petter Selasky
d3e08ca9f0 Correct buffer size printout.
MFC after:	1 week
2012-11-01 20:58:55 +00:00
Hans Petter Selasky
58e8ac5c34 Increase default volume for FastTracker playback channels.
MFC after:	1 week
2012-11-01 20:43:23 +00:00
Hans Petter Selasky
ff4d595304 Fix sysctl free bug in last commit, which eventually leads to a panic.
Add software mixer table for FastTrack Ultra.
Only set volume controls which are valid at startup for standard
USB audio devices, so that settings like treble and bass use
the reset defaults.

MFC after:	1 week
2012-11-01 20:09:48 +00:00
Hans Petter Selasky
902514f628 Export all mixer nodes into dev.pcm.X.mixer.Y sysctl nodes, hence the
PCM API doesn't support showing all the knobs. Make sure all the USB audio
mixer nodes are freed at detach. Before this patch USB audio would leak
some memory at detach. Print out buffer sizes in number of samples at attach.
Fix setting of volume controls when the number of channels is greater than two.

MFC after:	1 week
2012-11-01 16:54:26 +00:00
Hans Petter Selasky
3f5171b17f Add missing inclusion guard. 2012-11-01 16:39:01 +00:00
Alexander Motin
3049555773 ASUS EeePC 1001px has strange variant of ALC269 CODEC, that mutes speaker
if unused in that configuration mixer at NID 15 is muted.  Probably CODEC
incorrectly reports its internal connections.  Hide that muter from the
driver to avoid muting and make built-in speaker work.

There are several different CODECs sharing this ID and I have not enough
information about them and the bug to implement more universal solution.

Tested by:	Big Yuuta <init.py@gmail.com>
MFC after:	2 weeks
2012-10-31 22:11:51 +00:00
Alexander Motin
401f7c11ff Set all pins initial connection status to unknown (2) and then update it
with the real value in regular way if sensing is supported.  This fixes
minor inconsistency when playback redirection appeared in undefined state
on boot if headphones were not connected.
2012-10-30 12:44:30 +00:00
Alexander Motin
ed228e403f Print card and subsystem IDs in verbose logs to help to identify system.
Hide some less iseful messages under debug.
2012-10-30 10:59:42 +00:00
Hans Petter Selasky
b4380da796 Implement support for the so-called USB feedback endpoint for USB
audio devices. This endpoint gives clues to the USB host about the
actual data rate on asynchronous endpoints and makes the more
expensive USB audio devices usable under FreeBSD.
The Linux USB audio driver was used as reference for the
automagic shift of the received value.

MFC after:	1 week
2012-10-28 14:37:17 +00:00
Hans Petter Selasky
76eaf53752 Make sure the vendor class quirk only matches the vendor specific
class, else multiple pcm devices can appear on certain USB audio
devices.

MFC after:	1 week
2012-10-26 12:41:01 +00:00
Hans Petter Selasky
1234097efb Fix USB audio specification compliance by filtering which descriptors can
appear on which interface. This fixes detection of some USB audio adapters.
Also increase the channel limit for FULL speed devices to 4 channels.

Tested by:	gavin
MFC after:	1 week
2012-10-24 08:00:01 +00:00
Eitan Adler
2da1951583 Now that device disabling is generic, remove extraneous code from the
device drivers that used to provide this feature.

This is a subset of 241856 (which was reverted)

Reviewed by:	des
Approved by:	cperciva (implicit)
MFC after:	1 week
2012-10-22 22:29:48 +00:00
Eitan Adler
a8de37b024 This isn't functionally identical. In some cases a hint to disable
unit 0 would in fact disable all units.

This reverts r241856

Approved by: cperciva (implicit)
2012-10-22 13:06:09 +00:00
Eitan Adler
76b7512247 Now that device disabling is generic, remove extraneous code from the
device drivers that used to provide this feature.

Reviewed by:	des
Approved by:	cperciva
MFC after:	1 week
2012-10-22 03:41:14 +00:00
Eitan Adler
db702c59cf remove duplicate semicolons where possible.
Approved by:	cperciva
MFC after:	1 week
2012-10-22 03:00:37 +00:00
Alexander Motin
675dce071a Cast vendor-specific spell on VIA VT1818S codecs alike to VT1708S to
make analog input loopback and dual-stream playback work by enabling
signal mixing by nid 22, as it should be according to info returned by
the CODEC.  Otherwise pin nid 28 receives only signal from DAC nid 16.

PR:		kern/169124
MFC after:	1 week
2012-10-09 17:06:31 +00:00
Kevin Lo
b5db12bfb5 Free result of device_get_children(9). 2012-09-30 09:21:10 +00:00
Alexander Motin
076b76e871 Fix panic caused by wrong pointer dereference, left after pin sense rewrite
at r230551.

Also while there, make sense polling use reported for each node separately
instead of reporting accumulated total status.

Submitted by:	Barbara <barbara.freebsd@gmail.com> (1)
MFC after:	3 days
2012-09-24 08:23:05 +00:00
Hans Petter Selasky
e2524b2ec9 Implement support for USB Audio v2.0. Remove some redundant
USB audio v1.0 debug data, hence userspace tools like lsusb
exist to show this information properly.
2012-09-17 15:43:57 +00:00
Hans Petter Selasky
aead9631e7 Add required USB AUDIO v2.0 structure definitions.
PR:	misc/171254
2012-09-03 19:17:25 +00:00
Alexander Motin
7d0ec9dd3f Add bunch of ATI HDMI HDA controller IDs.
Submitted by:	Dmitry Luhtionov <dmitryluhtionov@gmail.com>
MFC after:	1 week
2012-08-30 15:47:20 +00:00
Andreas Tobler
9c3fbfbd6a Add a new sound driver for PowerMacs, found here on my Quad G5.
It allows simple playback and volume control like the other Mac drivers,
not more.
2012-08-19 19:40:33 +00:00
Alexander Motin
52e9cf7de5 Fix "speaker" volume control, broken at r230451.
Reported and tested by:	Slawa Olhovchenkov <slw@zxy.spb.ru>
MFC after:	1 month
2012-08-16 07:43:15 +00:00
Alexander Motin
8684fef07d Fix multichannel input signals tracing on some CODECs like ALC260.
Reported and tested by:	Slawa Olhovchenkov <slw@zxy.spb.ru>
MFC after:	1 month
2012-08-14 14:07:34 +00:00
Andreas Tobler
6e8fcacda4 Fix typo in comment. 2012-08-14 05:16:35 +00:00
Alexander Motin
52ce0de418 Remove 14 not very useful characters " HDA CODEC PCM" from HDA pcm device
names to shorten them. PulseAudio reported to have problems with names
longer then 63 chars and at least in XMMS long names are inconvinient.

Reported by:	hselasky
MFC after:	3 days
2012-07-02 20:25:50 +00:00
Alexander Motin
3c461fd01b Restore GPIO config quirks handling, lost during last big refactoring.
Tested by:	hselasky
MFC after:	3 days
2012-07-02 18:35:08 +00:00
Gleb Smirnoff
35d393bf63 - Call bus_generic_attach() at end of hdspe_attach().
- Use own devclass_t in DRIVER_MODULE().

This fixes operation of hdspe(4) when built as loadable module.

Submitted by:	Ruslan Bukin <br bsdpad.com>
2012-07-02 07:39:55 +00:00
Peter Holm
85f6230a1d Added D_TRACKCLOSE to sndstat_cdevsw to fix the situation when
another process is in open() or stat() for the device node, then
close() from the owning process does not result in cdevsw close
method call. This fixes the pemanent "Device busy" seen.

Changed the sndstat_lock from mutex to sx.  This allows to extend
the region covered by the lock, to include the uiomove() call in
sndstat_read() and bufptr increment. This fixes the "panic:
sbuf_put_byte called with finished or corrupt sbuf" seen.

In collaboration with:	kib
MFC after:	1 week
2012-05-02 19:32:11 +00:00
Hans Petter Selasky
6d917491f5 Fix compiler warnings, mostly signed issues,
when USB modules are compiled with WARNS=9.

MFC after:	1 weeks
2012-04-02 10:50:42 +00:00
Alexander Motin
742963ff31 Reenable unsolicited responses on CODEC if hdaa_sense_init() called again.
This fixes jack connection events handling after suspend/resume.

PR:		kern/166382
MFC after:	1 week
2012-03-30 08:33:08 +00:00
Alexander Motin
16b8ad6420 Stop HDA controller polling callout on suspend and reset it on resume.
PR:		kern/166382
MFC after:	1 week
2012-03-28 13:28:09 +00:00
John Baldwin
d02a6470bf Don't cast a bus address to a uint8_t pointer just to add an offset to
it.  Instead, add the offset directly to the bus address.
2012-03-23 12:34:39 +00:00
Alexander Motin
e4afd792df Add driver for the RME HDSPe AIO/RayDAT sound cards -- snd_hdspe(4).
Cards are expensive and so rare, so leave the driver as module.

Submitted by:	Ruslan Bukin <br@bsdpad.com>
MFC after:	2 weeks
2012-03-01 13:10:18 +00:00
Hans Petter Selasky
9b5da8166e Avoid creating PCM devices for MIDI adapters.
MFC after:	3 days
2012-02-23 07:56:19 +00:00
Alexander Motin
5525b53de5 Do not handle MOD_SHUTDOWN equally to MOD_UNLOAD in sound kernel module.
MOD_SHUTDOWN is not an end of existence, and there is a life after it.
In particular, code previously called on MOD_SHUTDOWN grabbed lock and
deallocated unit numbering. That caused infinite wait loop if snd_uaudio
tried to destroy its PCM device after that point.

MFC after:	3 days
2012-02-14 09:19:30 +00:00
Ed Schouten
7870adb640 Remove direct access to si_name.
Code should just use the devtoname() function to obtain the name of a
character device. Also add const keywords to pieces of code that need it
to build properly.

MFC after:	2 weeks
2012-02-10 12:35:57 +00:00
Alexander Motin
2345f2a366 Remove extra semicolon.
Submitted by:	emaste
2012-02-05 16:41:06 +00:00
Pedro F. Giffuni
7106ed257d Use new OSS-based BSD-licensed header for cs sound driver.
The cs driver requires a table with firmware values. An
alternative firmware is available in a similar Open Sound
System driver. This is actually a partial revert of
Revision 77504.

Special thanks to joel@ for patiently testing several
replacement attempts.

The csa driver and the complete sound system are now free
of the GPL.

Tested by:	joel
Approved by:	jhb (mentor)
MFC after:	3 weeks
2012-02-01 21:38:01 +00:00
Alexander Motin
fd578f6543 Make sound(4) more flexible in setting soft buffer and block sizes when
hardware imposes strict limitations on hard buffer and block sizes.

Previous code set soft buffer to be no smaller then hard buffer. On some
cards with fixed 64K physical buffer that caused up to 800ms play latency.
New code allows to set soft buffer size down to just two blocks of the hard
buffer and to not write more then that size ahead to the hardware buffer.
As result of that change I was able to reduce full practically measured
record-playback loop delay in those conditions down to only about 115ms
with theoretical playback latency of only about 50ms.

New code works fine for both vchans and direct cases. In both cases sound(4)
tries to follow hw.snd.latency_profile and hw.snd.latency values and
application-requested buffer and block sizes as much as limitation of two
hardware blocks allows.

Reviewed by:	silence on multimedia@
2012-01-31 21:46:28 +00:00
Alexander Motin
c6c4eaa848 Just in case, clear stream interrupts before enabling them. 2012-01-31 12:57:21 +00:00
Alexander Motin
4bff0fc61b Fix typo in comments. 2012-01-30 09:59:33 +00:00
Alexander Motin
f4cb8238fd Fix HBR enabling condition. cchs is from 0 to 7, not from 1 to 8. 2012-01-28 09:24:57 +00:00
Pedro F. Giffuni
bb9e5fb3bd Minor cleanups to the csa snd driver.
Remove unneeded temporary variable (data) to better match the OSS code.
Remove some unused constants and type definitions.

Tested by:	joel
Approved by:	jhb (mentor)
MFC after:	3 weeks
2012-01-26 21:43:11 +00:00
Alexander Motin
c0e199f61b Press some more info into the PCM device name:
- add "+HP" in case of headphones redirection;
 - add device type for analog devices, if all pins have the same.

As result now it may look like "Analog 5.1+HP/2.0" or "Front Analog Mic".
I hope it will be more useful than long and confusing.

MFC after:	2 months
Sponsored by:	iXsystems, Inc.
2012-01-26 12:09:04 +00:00
Alexander Motin
586ec6d396 Fix typo in r230571.
Submitted by:	trasz
2012-01-26 10:30:50 +00:00
Alexander Motin
5409d3ee9e Add another bunch of CODEC IDs. 2012-01-26 09:45:14 +00:00
Alexander Motin
7599ae7787 Oops, fix the loader tunable name added in r230551. 2012-01-25 20:54:16 +00:00
Alexander Motin
d9360bbfc4 Rewrite jack presence detection and implement automatic recording source
selection in snd_hda(4) driver.

Now driver tracks jack presence detection status for every CODEC pin. For
playback associations, when configured, that information, same as before,
can be used to automatically redirect audio to headphones. Also same as
before, these events are used to track digital display connection status
and fetch ELD. Now in addition to that driver uses that information to
automatically switch recording source of the mixer to the connected input.

When there are devices with no jack detection and with one both connected,
last ones will have the precedence. As result, on most laptops after boot
internal microphone should be automatically selected. But if external one
(for example, headset) connected, it will be selected automatically.
When external mic disconnected, internal one will be selected again.

Automatic recording source selection is enabled by default now to make
recording work out of the box without touching mixer. But it can be
disabled or limited only to attach time using hint.pcm.X.rec.autosrc loader
tunables or dev.pcm.X.rec.autosrc sysctls.

MFC after:	2 months
Sponsored by:	iXsystems, Inc.
2012-01-25 20:46:10 +00:00
Alexander Motin
3ba9d9e926 Allow PASSTHROUGH (AC3) to have more then 2 channels.
8 channels can be used to get more then 6.144Mbps bandwidth.
2012-01-25 11:45:50 +00:00