Commit Graph

1561 Commits

Author SHA1 Message Date
Hans Petter Selasky
fb8a716d28 Don't read the USB audio sync endpoint when we don't use it to save
isochronous bandwidth.

MFC after:		3 days
Sponsored by:		Mellanox Technologies
2018-11-08 12:46:47 +00:00
Alexander Motin
af6a86eb9a Adjust SiS 966/968 HDA controller naming.
Submitted by:	Dmitry Luhtionov <dmitryluhtionov@gmail.com>
2018-11-02 17:02:10 +00:00
Hans Petter Selasky
cb8bfb4830 The event bytes should be unsigned char.
Found by:		Peter Holm <peter@holm.cc>
MFC after:		3 days
Sponsored by:		Mellanox Technologies
2018-10-22 08:59:20 +00:00
Hans Petter Selasky
f46bdfe14f Drop sequencer mutex around uiomove() and make sure we don't move more bytes
than is available, else a panic might happen.

Found by:		Peter Holm <peter@holm.cc>
MFC after:		3 days
Sponsored by:		Mellanox Technologies
2018-10-22 08:58:27 +00:00
Hans Petter Selasky
bb415b2a5f Fix off-by-one which can lead to panics.
Found by:		Peter Holm <peter@holm.cc>
MFC after:		3 days
Sponsored by:		Mellanox Technologies
2018-10-22 08:55:58 +00:00
Glen Barber
bf466ddcff Revert r338423, reapplying r338422, which did get approval but
communication lines got crossed.

Apologies to avatar@ for the confusion.

Approved by:	re (implicit)
Sponsored by:	The FreeBSD Foundation
2018-09-01 15:07:38 +00:00
Glen Barber
b5a3b728c5 Revert r338422, which was did not get official approval from re@.
Approved by:	re (implicit)
Sponsored by:	The FreeBSD Foundation
2018-09-01 13:43:14 +00:00
Tai-hwa Liang
8578932ddb Adding support for CS46xx MIDI output. With this patch, users can
play the MIDI files through /dev/sequencer device with tools like
playmidi. The audio output will go through the external MIDI device
such like wavetable synthesis card.

Reviewed by:	matk (a long time ago), kib
Approved by:	re (kib)
Tested with: 	Terratec SiXPack 5.1+ + Yamaha DB50XG
MFC after:	4 weeks
2018-09-01 11:26:53 +00:00
Tai-hwa Liang
1e814084c9 Adding device ID for Terratec SiXPack 5.1+.
MFC after:	3 days
2018-08-22 14:06:31 +00:00
Tai-hwa Liang
d17f8070a1 Extending the delay cycles to give the codec more time to pump ADC data across the AC-link.
Without this patch, some CS4614 cards will need users to reload the driver manually or
the hardware won't be initialised properly. Something like:

	# kldload snd_csa
	# kldunload snd_csa
	# kldload snd_csa

Tested with:	Terratec SiXPack 5.1+
2018-08-19 01:14:46 +00:00
Justin Hibbits
80a79189ef snd_hda: Synchronize DMA buffers for the control path
Make sure both sides of the DMA buffer memory accesses for the CORB and RIRB
(control buffers) in snd_hda (device and CPU) can see coherent memory.  This
is needed on weakly ordered architectures including PowerPC and ARM.  Patch
originally by mmel, with small changes.

This does not cover the data path of snd_hda.  We don't have sync operations
for in-progress DMA buffers, to sync ranges of a map.

Reviewed By: mmel
Differential Revision: https://reviews.freebsd.org/D16517
2018-08-01 14:50:41 +00:00
Justin Hibbits
212de33eaf snd_hda: Byteswap the buffer descriptor entries as needed
The buffer descriptor list entries should be in little endian format.  Byte swap
them on BE.  This is the last piece of the puzzle for snd_hda(4) to work on
PowerPC.
2018-07-31 17:18:58 +00:00
Justin Hibbits
2a9ee5fcfe snd_hda: Make codec control path endian safe
The CORB and RIRB buffers exist in DMA memory, but the device reads them as
little-endian only.  Read and write as LE into the DMA memory block, to work on
BE platforms.
2018-07-30 20:00:56 +00:00
Justin Hibbits
bdafaf0aee snd_hda: Print error codes in decimal, rather than hex
It's easy to confuse the error code as naked it looks decimal (EINVAL is
reported as error 16, instead of error 22, so first reading looks like EBUSY).
2018-07-30 15:19:59 +00:00
Justin Hibbits
cf40916b63 snd_hda: Only free streams DMA maps if the streams list has been created
If hdac_attach fails prior to allocating sc->streams, cleanup in the
hdac_attach_fail label will dereference a NULL pointer, panicking.
2018-07-30 15:15:33 +00:00
Eitan Adler
33f4bccaa6 Use https over http for FreeBSD pages 2018-07-27 10:40:48 +00:00
Hans Petter Selasky
79449a9a7f Update modify counter when setting a mixer control.
PR:		229969
MFC after:	1 week
2018-07-23 09:16:23 +00:00
Sean Bruno
49de5ec359 hda(4)
- add quirk for Dell XPS9560 audio gleaned and massages from linux

https://github.com/freebsd/freebsd/pull/137

Submitted by:	K Staring
MFC after:	3 days
Relnotes:	yes
2018-04-23 16:38:27 +00:00
Warner Losh
d6b6639713 Add ISA PNP tables to ISA drivers. Fix a few incidental comments.
ACPI ISA PBP tables not tagged, there's bigger issues with them.
2018-01-29 00:22:30 +00:00
Pedro F. Giffuni
ac2fffa4b7 Revert r327828, r327949, r327953, r328016-r328026, r328041:
Uses of mallocarray(9).

The use of mallocarray(9) has rocketed the required swap to build FreeBSD.
This is likely caused by the allocation size attributes which put extra pressure
on the compiler.

Given that most of these checks are superfluous we have to choose better
where to use mallocarray(9). We still have more uses of mallocarray(9) but
hopefully this is enough to bring swap usage to a reasonable level.

Reported by:	wosch
PR:		225197
2018-01-21 15:42:36 +00:00
Pedro F. Giffuni
26c1d774b5 dev: make some use of mallocarray(9).
Focus on code where we are doing multiplications within malloc(9). None of
these is likely to overflow, however the change is still useful as some
static checkers can benefit from the allocation attributes we use for
mallocarray.

This initial sweep only covers malloc(9) calls with M_NOWAIT. No good
reason but I started doing the changes before r327796 and at that time it
was convenient to make sure the sorrounding code could handle NULL values.
2018-01-13 22:30:30 +00:00
Eitan Adler
caa7e52f3f kernel: Fix several typos and minor errors
- duplicate words
- typos
- references to old versions of FreeBSD

Reviewed by:	imp, benno
2017-12-27 03:23:21 +00:00
Pedro F. Giffuni
718cf2ccb9 sys/dev: further adoption of SPDX licensing ID tags.
Mainly focus on files that use BSD 2-Clause license, however the tool I
was using misidentified many licenses so this was mostly a manual - error
prone - task.

The Software Package Data Exchange (SPDX) group provides a specification
to make it easier for automated tools to detect and summarize well known
opensource licenses. We are gradually adopting the specification, noting
that the tags are considered only advisory and do not, in any way,
superceed or replace the license texts.
2017-11-27 14:52:40 +00:00
Alexander Motin
3228add807 Slightly fix bidirectional stream number allocation.
This logic is still imperfect, since it allows at most 15 bidirectional
streams out of 30 allowed by specification, but at least now those should
work better.  On the other side I don't remember I ever saw controller
supporting the bidirectional streams, so this is likely a nop change.

MFC after:	1 month
2017-11-25 09:42:14 +00:00
Alexander Motin
eeec68eae7 Add Creative vendor ID.
MFC after:	1 week
2017-10-16 12:54:53 +00:00
Alexander Motin
6750c3d0fa Use "Ibex Peak" codename for "5 Series/3400 Series" chipsets.
This is shorter and unifies naming with later chipsets.

MFC after:	1 week
2017-08-09 12:21:17 +00:00
Alexander Motin
aaa9b2b3f3 Add new Intel Lewisburg and Union Point chipset PCI IDs.
While there, polish some old AHCI ones, since they are still reused.

MFC after:	1 week
2017-08-09 12:03:12 +00:00
Hans Petter Selasky
3f9dcc588d Declare the "snd_fxdiv_table" once. This shaves around 24Kbytes of
binary data from sound.ko and the kernel.

MFC after:		3 days
2017-05-25 05:23:47 +00:00
Hans Petter Selasky
0f86d40bf5 Increase the allowed maximum number of audio channels from 31 to 127
in the PCM feeder mixer. Without this change a value of 32 channels is
treated like zero, due to using a mask of 0x1f, causing a kernel
assert when trying to playback bitperfect 32-channel audio. Also
update the AWK script which is generating the division tables to
handle more than 18 channels. This commit complements r282650.

MFC after:		3 days
2017-05-24 21:42:48 +00:00
Ed Maste
3e85b721d6 Remove register keyword from sys/ and ANSIfy prototypes
A long long time ago the register keyword told the compiler to store
the corresponding variable in a CPU register, but it is not relevant
for any compiler used in the FreeBSD world today.

ANSIfy related prototypes while here.

Reviewed by:	cem, jhb
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D10193
2017-05-17 00:34:34 +00:00
Pedro F. Giffuni
336c5fb5cd Fix some cases where an index was used before its limits check.
Obtained from:	DragonFlyBSD (git 799ba435)
MFC after:	5 days
2017-04-29 06:41:51 +00:00
Alexander Motin
35e492f3bd Update list of Conexant and Realtek codecs.
MFC after:	2 weeks
2017-04-13 14:40:48 +00:00
Sean Bruno
e407efca16 Add ids for ALC233 found on Intel Skull Mountain NUC. 2017-03-25 19:12:09 +00:00
Yoshihiro Takahashi
2b375b4edd Remove pc98 support completely.
I thank all developers and contributors for pc98.

Relnotes:	yes
2017-01-28 02:22:15 +00:00
Hans Petter Selasky
067e471a24 Add USB audio support for S/PDIF output with C-Media CM6206 devices.
Submitted by:		Julien Nadeau <vedge@hypertriton.com>
PR:			216131
MFC after:		1 week
2017-01-17 08:15:10 +00:00
Michal Meloun
4642c8c5ea Limit number of stripes supported by HDA codec to maximum number
announced by HDA controller.
Incorrectly implermented HDA codec may report support for more stripes
that HDA controller already have. Due to this, always limit number of
enabled stripes by global controller maximum.

Reviewed by:	mav
MFC after:	1 month
Differential Revision: https://reviews.freebsd.org/D8922
2016-12-28 07:37:26 +00:00
Ruslan Bukin
20a9f7715e Style fix.
Sponsored by:	DARPA, AFRL
2016-12-07 13:19:19 +00:00
Michal Meloun
bea8daa364 Add IDs for HDA codecs found on Nvidia Tegra SoCs.
MFC after: 2 weeks
2016-12-04 15:28:30 +00:00
Pyun YongHyeon
6861837c7a Fix too low volume on MSI H170 GAMING M3 board by poking vendor
specific COEF.
2016-12-04 05:55:18 +00:00
Pyun YongHyeon
b899778526 Recognize RealTek ALC1150 7.1 channel HD audio codec. 2016-12-04 05:46:30 +00:00
Alexander Motin
c925d87e2a Fix copy/paste bug in r308464.
MFC after:	1 week
2016-11-09 17:57:55 +00:00
Alexander Motin
2b064d4653 Add some device IDs found in my new laptop. 2016-11-09 08:57:59 +00:00
Hans Petter Selasky
82364f24b5 Allow higher sample rates to have more jitter than lower ones.
PR:		208791
MFC after:	3 days
2016-11-09 07:09:27 +00:00
Bryan Drewery
28323add09 Fix improper use of "its".
Sponsored by:	Dell EMC Isilon
2016-11-08 23:59:41 +00:00
Hans Petter Selasky
dd3dde9828 Range check the jitter values to avoid bogus sample rate adjustments.
The expected deviation should not be more than 1Hz per second. The USB
v2.0 specification also mandates this requirement. Refer to chapter
5.12.4.2 about feedback.

PR:		208791
MFC after:	3 days
2016-11-08 08:09:48 +00:00
Hans Petter Selasky
4d76235fe3 Add support for adjusting the hardware buffering delay for USB audio.
Requested by:	Goran Mekic <meka@tilda.center>
MFC after:	1 week
2016-10-19 18:45:06 +00:00
Jean-Sébastien Pédron
bd937497ea Consistently use device_t
Several files use the internal name of `struct device` instead of
`device_t` which is part of the public API. This patch changes all
`struct device *` to `device_t`.

The remaining occurrences of `struct device` are those referring to the
Linux or OpenBSD version of the structure, or the code is not built on
FreeBSD and it's unclear what to do.

Submitted by:	Matthew Macy <mmacy@nextbsd.org> (previous version)
Approved by:	emaste, jhibbits, sbruno
MFC after:	3 days
Differential Revision:	https://reviews.freebsd.org/D7447
2016-08-09 19:32:06 +00:00
Hans Petter Selasky
d56d9e27c7 Add support for simplex USB MIDI devices, which only provide BULK or
INTERRUPT endpoints for moving data in one direction, like the KeyRig
49 from M-Audio.

Requested by:	Ivan Klymenko <fidaj@ukr.net>
MFC after:	1 week
2016-05-31 15:05:50 +00:00
Conrad Meyer
5b81187fa9 snd_hda(4): Don't pass bogus sizeof()s to unused sysctl arg2 parameter (again)
More of the same sort of issue as r299503, just missed some sysctls added in a
different place than the others.

Reported by:	Coverity
CIDs:		1007692, 1009677, 1009678
Sponsored by:	EMC / Isilon Storage Division
2016-05-12 02:46:29 +00:00
Conrad Meyer
e6f79ac571 snd_hda(4): Don't pass bogus sizeof()s to unused sysctl arg2 parameter
None of the sysctl handlers in hdaa use the arg2 parameter, so just pass zero
instead.  Additionally, the sizes being passed in were suspect (size of the
pointer rather than the value).

Reported by:	Coverity
CIDs:		1007694, 1009679
Sponsored by:	EMC / Isilon Storage Division
2016-05-12 02:41:38 +00:00