Commit Graph

1579 Commits

Author SHA1 Message Date
Ed Maste
b7d6b3ffec snd_hda: style(9) whitespace fixup
PR:		241299
Submitted by:	Neel Chauhan
2019-10-17 14:58:03 +00:00
Oleksandr Tymoshenko
17b984a638 snd_hda: Add Intel Cannon Lake support
Add missing header change ommitted in r352775

MFC after:	2 weeks
X-MFC-with:	352775
2019-09-26 21:04:36 +00:00
Oleksandr Tymoshenko
c314e2aff2 snd_hda: Add Intel Cannon Lake support
Add PCI ids for Intel Cannon Lake PCH

Tested on:	HP Spectre x360 13-p0043dx
PR:		240574
Submitted by:	Neel Chauhan <neel@neelc.org>
Reviewed by:	imp, mizhka, ray
MFC after:	2 weeks
Differential Revision:	https://reviews.freebsd.org/D21789
2019-09-26 21:02:21 +00:00
Hans Petter Selasky
a48a37bee2 Decrease the default audio playback latency to a maximum of 21.3ms.
This significantly improves the audio playback response time.

Discussed with:	mav@
MFC after:	1 week
Sponsored by:	Mellanox Technologies
2019-09-05 10:49:12 +00:00
Mark Johnston
7da9377b0d Properly check for an interrupted cv_wait_sig().
The returned error number may be EINTR or ERESTART depending on
whether or not the signal is supposed to interrupt the system call.

Reported and tested by:	pho
MFC after:	1 week
Sponsored by:	The FreeBSD Foundation
2019-08-30 15:40:31 +00:00
Xin LI
5473ef874e Fix sound on headset jack for ThinkPad T51. 2019-08-21 08:01:43 +00:00
Mark Johnston
35fd0fc409 Use a sleepable lock for midistat functions.
Otherwise the mutex needs to be dropped when copying out the midistat
sbuf, leading to a race which allows one to read kernel memory beyond
the end of the sbuf buffer.

Reported and tested by:	pho
Security:	CVE-2019-5612
2019-08-20 17:52:12 +00:00
Jung-uk Kim
8a3238521b Partially revert the previous commit.
It was an experiment and not meant to be committed. :-(
2019-08-19 21:45:25 +00:00
Jung-uk Kim
ff0107de44 Fix sound on headset jack for Lenovo Thinkpad X1 Carbon Gen 6 (model 20KH).
Note this commit was inspired by r350433.

MFC after:	2 weeks
2019-08-19 21:30:12 +00:00
Marcelo Araujo
145b1792a2 Fix sound on headset jack for ALC255 and ALC256 codec.
PR:		219350 [1], [2]
Submitted by:	Masachika ISHIZUKA (ish_at_amail.plala.or.jp) [1]
		Neel Chauhan (neel_at_neelc.org) [2]
		uri Momotyuk (yurkis_at_gmail.com) [3]
Reported by:	miwi
Reviewed by:	mav
Obtained from:	https://github.com/trueos/trueos/pull/279 [3]
MFC after:	2 weeks
Differential Revision:	https://reviews.freebsd.org/D19017
2019-07-30 02:01:49 +00:00
Sean Bruno
fceeeec75f I add the ability to accept the default pin widget configuration to help
with various laptops using hdaa(4) sound devices.  We don't seem to know
the "correct" configurations for these devices and the defaults are far
superiour, e.g. they work if you don't nuke the default configs.

PR:	200526
Differential Revision:	https://reviews.freebsd.org/D17772
2019-07-17 04:13:46 +00:00
Conrad Meyer
e2e050c8ef Extract eventfilter declarations to sys/_eventfilter.h
This allows replacing "sys/eventfilter.h" includes with "sys/_eventfilter.h"
in other header files (e.g., sys/{bus,conf,cpu}.h) and reduces header
pollution substantially.

EVENTHANDLER_DECLARE and EVENTHANDLER_LIST_DECLAREs were moved out of .c
files into appropriate headers (e.g., sys/proc.h, powernv/opal.h).

As a side effect of reduced header pollution, many .c files and headers no
longer contain needed definitions.  The remainder of the patch addresses
adding appropriate includes to fix those files.

LOCK_DEBUG and LOCK_FILE_LINE_ARG are moved to sys/_lock.h, as required by
sys/mutex.h since r326106 (but silently protected by header pollution prior
to this change).

No functional change (intended).  Of course, any out of tree modules that
relied on header pollution for sys/eventhandler.h, sys/lock.h, or
sys/mutex.h inclusion need to be fixed.  __FreeBSD_version has been bumped.
2019-05-20 00:38:23 +00:00
Alexander Motin
ce8291842b Tune chipset naming.
Submitted by:	Dmitry Luhtionov <dmitryluhtionov@gmail.com>
MFC after:	2 weeks
2019-03-20 17:21:17 +00:00
Hans Petter Selasky
9de921ee59 Export vendor specific USB MIDI device list to PnP info.
MFC after:		1 week
Sponsored by:		Mellanox Technologies
2019-01-30 17:11:08 +00:00
Vladimir Kondratyev
20694769bd Add quirk to enable mic and headphones redirection on HP Spectre laptops.
Tested on HP AF006UR.

MFC after:	2 weeks
2019-01-22 22:39:46 +00:00
Hans Petter Selasky
f4dbf0d82d snd_uaudio: Add quirks for Edirol UA-25EX in advanced driver mode.
Extend the vendor class USB audio quirk to cover devices without
the USB audio control descriptor.

PR:			234794
MFC after:		1 week
Sponsored by:		Mellanox Technologies
2019-01-12 11:14:59 +00:00
Hans Petter Selasky
a89c806508 Fix reading of USB sample rate descriptor for SPL Crimson Rev 1.
Read first one entry, then try to read the full rate descriptor table.

PR:			234380
MFC after:		1 week
Sponsored by:		Mellanox Technologies
2018-12-25 10:15:48 +00:00
Konstantin Belousov
d77e8982ab Add a comment noting that the additional range checks are not needed.
The object size is set in the dsp_mmap_single() which provides the
range limit by vm_fault().

Reported by:	C Turt <ecturt@gmail.com>
Reviewed by:	alc, markj
admbug:		781
MFC after:	2 weeks
Sponsored by:	The FreeBSD Foundation
2018-12-02 13:29:13 +00:00
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