History log of /freebsd-current/sys/dev/sound/pci/ich.c
Revision Date Author Comments
# c597c557 06-May-2024 Christos Margiolis <christos@FreeBSD.org>

sound: Use nitems() where possible

No functional change intended.

Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Reviewed by: markj, emaste
Differential Revision: https://reviews.freebsd.org/D45014


# 837cd192 16-Jan-2024 Christos Margiolis <christos@FreeBSD.org>

sound: remove PCM_KLDSTRING() and fix status strings

PCM_KLDSTRING() prints the kernel module associated with a given audio
device only when that module is not compiled in. Get rid of
PCM_KLDSTRING() altogether and print the driver name (even for modules
that are compiled in) instead, as it implies the module as well.

While here, convert all status strings to the following dmesg-like
format:

[<port|mem> <irq>] on <driver>

Sponsored by: The FreeBSD Foundation
MFC after: 2 weeks
Reviewed by: markj, imp
Differential Revision: https://reviews.freebsd.org/D43349


# 5aacf339 18-Aug-2023 John Baldwin <jhb@FreeBSD.org>

sys: Remove SND_DECLARE_FILE

Reviewed by: kbowling, imp, emaste
Differential Revision: https://reviews.freebsd.org/D41499


# 82a265ad 16-Aug-2023 Warner Losh <imp@FreeBSD.org>

sys: Remove $FreeBSD$: sound driver version

Remove /SND_DECLARE_FILE\("\$FreeBSD\$"\);/


# 4d846d26 10-May-2023 Warner Losh <imp@FreeBSD.org>

spdx: The BSD-2-Clause-FreeBSD identifier is obsolete, drop -FreeBSD

The SPDX folks have obsoleted the BSD-2-Clause-FreeBSD identifier. Catch
up to that fact and revert to their recommended match of BSD-2-Clause.

Discussed with: pfg
MFC After: 3 days
Sponsored by: Netflix


# 2287364e 06-May-2022 John Baldwin <jhb@FreeBSD.org>

Remove pcm_devclass from DRIVER_MODULE invocations.


# 378503af 01-Sep-2020 Mateusz Guzik <mjg@FreeBSD.org>

sound: clean up empty lines in .c and .h files


# 555e9989 27-Aug-2020 Mark Johnston <markj@FreeBSD.org>

snd_ich(4): Handle errors from ich_init() properly during resume.

ich_init() returns an errno value or 0, but ich_pci_resume() was
comparing the return value with -1 to determine whether an error had
occurred.

PR: 248941
Submitted by: Tong Zhang <ztong0001@gmail.com>
MFC after: 1 week


# 718cf2cc 27-Nov-2017 Pedro F. Giffuni <pfg@FreeBSD.org>

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.


# da1b038a 17-Mar-2016 Justin Hibbits <jhibbits@FreeBSD.org>

Use uintmax_t (typedef'd to rman_res_t type) for rman ranges.

On some architectures, u_long isn't large enough for resource definitions.
Particularly, powerpc and arm allow 36-bit (or larger) physical addresses, but
type `long' is only 32-bit. This extends rman's resources to uintmax_t. With
this change, any resource can feasibly be placed anywhere in physical memory
(within the constraints of the driver).

Why uintmax_t and not something machine dependent, or uint64_t? Though it's
possible for uintmax_t to grow, it's highly unlikely it will become 128-bit on
32-bit architectures. 64-bit architectures should have plenty of RAM to absorb
the increase on resource sizes if and when this occurs, and the number of
resources on memory-constrained systems should be sufficiently small as to not
pose a drastic overhead. That being said, uintmax_t was chosen for source
clarity. If it's specified as uint64_t, all printf()-like calls would either
need casts to uintmax_t, or be littered with PRI*64 macros. Casts to uintmax_t
aren't horrible, but it would also bake into the API for
resource_list_print_type() either a hidden assumption that entries get cast to
uintmax_t for printing, or these calls would need the PRI*64 macros. Since
source code is meant to be read more often than written, I chose the clearest
path of simply using uintmax_t.

Tested on a PowerPC p5020-based board, which places all device resources in
0xfxxxxxxxx, and has 8GB RAM.
Regression tested on qemu-system-i386
Regression tested on qemu-system-mips (malta profile)

Tested PAE and devinfo on virtualbox (live CD)

Special thanks to bz for his testing on ARM.

Reviewed By: bz, jhb (previous)
Relnotes: Yes
Sponsored by: Alex Perez/Inertial Computing
Differential Revision: https://reviews.freebsd.org/D4544


# 0e4e9e17 18-Dec-2010 Tijl Coosemans <tijl@FreeBSD.org>

Use convenience functions where possible instead of accessing the PCI
configuration registers directly.

Remove pci_enable_io calls where they are redundant. The PCI bus driver
will set the right bits when the corresponding bus resource is activated.

Remove redundant pci_* function calls from suspend/resume methods. The
bus driver already saves and restores the PCI configuration.

Reviewed by: jhb
Approved by: kib (mentor)


# a7d5f7eb 19-Oct-2010 Jamie Gritton <jamie@FreeBSD.org>

A new jail(8) with a configuration file, to replace the work currently done
by /etc/rc.d/jail.


# 90da2b28 07-Jun-2009 Ariff Abdullah <ariff@FreeBSD.org>

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.


# 6e8e2779 07-May-2009 Alexander Motin <mav@FreeBSD.org>

Add one more board ID with inverted external amplifier control.

PR: kern/121156


# d7f03759 19-Oct-2008 Ulf Lilleengen <lulf@FreeBSD.org>

- Import the HEAD csup code which is the basis for the cvsmode work.


# 909f7f7f 12-Dec-2007 Ariff Abdullah <ariff@FreeBSD.org>

Disable AC97 microphone channel. Due to the channel allocation priority
that favours true hardware channel, the first instance of recording
request will grab this channel (the first channel is being used as
vchan master). In many cases, it is not really work as intended and give
false impression of broken recording.

PR: kern/118546
MFC after: 3 days


# 05cba740 11-Jul-2007 Ariff Abdullah <ariff@FreeBSD.org>

Protect against divide by zero while calculating bus speed due to
possible broken kernel timecounter.

Reported/Tested by: silby
Approved by: re (hrs)
MFC after: 1 day


# 082f6383 17-Jun-2007 Ariff Abdullah <ariff@FreeBSD.org>

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


# bdfbdcec 10-Jun-2007 Ariff Abdullah <ariff@FreeBSD.org>

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


# 3419bf5a 05-May-2007 Ariff Abdullah <ariff@FreeBSD.org>

Fix (or rather workaround) Intel 440MX Errata #36
- http://www.intel.com/design/chipsets/specupdt/245051.htm

AC97 Soft Audio and Soft Modem Master Abort Errata

Issue:
Use of either soft audio or soft modem on an Intel® 82443MX PCISet
based platform running a 100 MHz Processor System Bus and an AC97 codec
may result in failures. The system continues to function normally while
the AC97 hardware may not resume and may require a cold-boot to
recover. As a result of the failure, the Master Abort Status bit will
be set in the audio or modem function PCI header space.

Workaround:
Force uncacheable DMA on both BDL and pcm buffers.

Tested by: Emil Holmstr|m <emil@linux.se>


# 2e334adf 18-Apr-2007 Ariff Abdullah <ariff@FreeBSD.org>

sndbuf_alloc() now accept dmaflags argument which will be forwarded to
internal bus_dmammem_alloc() for greater flexibility on setting up DMA /
page attributes.


# 703c934a 21-Mar-2007 Ariff Abdullah <ariff@FreeBSD.org>

Memory leak killing spree, mostly bus_dma(9) related.


# 4582b3a1 15-Mar-2007 Ariff Abdullah <ariff@FreeBSD.org>

Fix severe out-of-bound mtx "type" pointer, causing WITNESS refcount
confusions and panic provided that the following conditions are met:

1) WITNESS is enabled (watch/trace).
2) Using modules, instead of statically linked (Not a strict
requirement, but easier to reproduce this way).
3) 2 or more modules share the same mtx type ("sound softc").
- They might share the same name (strcmp() == 0), but it always
point to different address.
4) Repetitive kldunload/load on any module that shares the same mtx
type (Not a strict requirement, but easier to reproduce this way).

Consider module A and module B:
- From enroll() - subr_witness.c:
* Load module A. Everything seems fine right now.
wA-w_refcount == 1 ; wA-w_name = "sound softc"
* Load module B.
* w->w_name == description will always fail.
("sound softc" from A and B point to different address).
* wA->w_refcount > 0 && strcmp(description, wA->w_name) == 0
* enroll() will return wA instead of returning (possibly unique)
wB.
wA->w_refcount++ , == 2.
* Unload module A, mtx_destroy(), wA->w_name become invalid,
but wA->w_refcount-- become 1 instead of 0. wA will not be
removed from witness list.
* Some other places call mtx_init(), iterating witness list,
found wA, failed on wA->w_name == description
* wA->w_refcount > 0 && strcmp(description, wA->w_name)
* Panic on strcmp() since wA->w_name no longer point to valid
address.

Note that this could happened in other places as well, not just sound
(eg. consider lots of drivers that share simmilar MTX_NETWORK_LOCK).

Solutions (for sound case):
1) Provide unique mtx type string for each mutex creation (chosen)
or
2) Put "sound softc" global variable somewhere and use it.


# 0b989078 23-Feb-2007 Alexander Leidinger <netchild@FreeBSD.org>

MFp4 (114068):
Use bus_get_dma_tag() to obtain the parent DMA tag to make the drivers
a little bit more non-ia32/amd64 friendly.

There is no man page for bus_get_dma_tag, so this is modelled after
rev. 1.62 of src/sys/dev/sound/pci/es137x.c by marius.

Inspired by: commit by marius


# dc9e52cf 17-Dec-2006 Ariff Abdullah <ariff@FreeBSD.org>

Add support for Nvidia Nforce MCP04 AC97 controller.

PR: kern/106829
Submitted by: Frédéric Petit <fredantispam@free.fr>


# fbf953b5 30-Nov-2006 Ariff Abdullah <ariff@FreeBSD.org>

Add inverted amplifier sense quirk for HP Compaq nx4300.

PR: kern/106104
Submitted by: Shun-ichi Kobayashi <koba@mbox.kudpc.kyoto-u.ac.jp>
MFC after: 3 days


# a580b31a 25-Nov-2006 Ariff Abdullah <ariff@FreeBSD.org>

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.


# 03923cd3 15-Aug-2006 Pyun YongHyeon <yongari@FreeBSD.org>

Add inverted amplifier sense quirks for Compaq Presario B3800

Reported by: Nick Withers < nick AT nickwithers DOT com >
Tested by: Nick Withers < nick AT nickwithers DOT com >
No objection from: ariff
MFC after: 1 week


# 851a904a 18-Jun-2006 Alexander Leidinger <netchild@FreeBSD.org>

- Rename hw.snd.unit to hw.snd.default_unit to make the purpose more obvious.
- Enable 4 automatic vchan's by default.
- Add some comments which provide ides/questions for improvement.
- Prefix some temporary sysctl's with an underscore to denote that it is not
an official API but a workaround until the real solution is implemented.


# 14055d2a 01-May-2006 Ariff Abdullah <ariff@FreeBSD.org>

Add inverted amplifier sense quirks for Sony VAIO VGN B1VP/B1XP.

Reported by: Stan Behrens <s.behrens at kon.de>


# facebb04 03-Apr-2006 Ariff Abdullah <ariff@FreeBSD.org>

Add device ID for nForce 410 MCP audio controller.

PR: kern/95257
Submitted by: cenix <cenixxx at gmail dot com>
MFC after: 3 days


# 6d52c3bf 22-Mar-2006 Ariff Abdullah <ariff@FreeBSD.org>

Don't set primary resume interrupt flag during channel initialization
since it can cause high interrupt rate (storm) and slowdown the entire
system.

Note: Please report back to me if this commit cause any abnormal
behaviour, especially during suspend / resume.

Reported/Submitted by: [1] Daan Vreeken [PA4DAN] <Danovitsch_at_vitsch dot net>
Reported/Confirmed by: [2] Angka H. K. <harikurniawan at gmail dot com>

MFC after: 5 days

[1] http://lists.freebsd.org/mailman/htdig/freebsd-hackers/2004-December/009335.html
[2] http://lists.freebsd.org/pipermail/freebsd-multimedia/2006-March/003830.html


# ead3cc43 06-Mar-2006 Ariff Abdullah <ariff@FreeBSD.org>

Add another inverted amplifier sense quirk for Kvazar-Micro Senator 3592XT.

Submitted by: [1] Alexandr Krivulya <admin at marcom-group.com>
MFC after: 3 days

[1] http://lists.freebsd.org/pipermail/freebsd-multimedia/2006-March/003773.html


# 428feeb3 04-Mar-2006 Ariff Abdullah <ariff@FreeBSD.org>

Add another inverted amplifier sense quirk for Sony VAIO Type T.

PR: kern/94056
Submitted by: Yoshihiko Sarumaru <mistral at imasy.or.jp>
MFC after: 3 days


# 34733eb5 12-Feb-2006 Ariff Abdullah <ariff@FreeBSD.org>

Fix possible DMA leak and locking violation especially
during suspend <-> resume and module load <-> unload.

PR: kern/92764
MFC after: 3 days


# f432c562 14-Jan-2006 Ariff Abdullah <ariff@FreeBSD.org>

Add another inverted EAPD quirk for Gateway 7326GZ.

Tested by: Jeff Cross <jeff.cross at averageadmins.com>
MFC after: 3 days


# c02b454d 09-Jan-2006 Ariff Abdullah <ariff@FreeBSD.org>

More thorough fixes to enable inverted external amplifier sense flag.
Instead of dragging the entire ICH4/82801DB into this mess, select
only few boards based on pci subdevice / subvendor.

Tested by: Daisuke Orikasa <luxury-acura-3.5rl at nifty.com>
MFC after: 3 days


# be0fee94 09-Jan-2006 Ariff Abdullah <ariff@FreeBSD.org>

Turn on inverted external amplifier sense flags for ICH4/82801DB.

PR: kern/66422, kern/75687, kern/84471
MFC after: 2 days


# d0ddbe88 20-Nov-2005 Pyun YongHyeon <yongari@FreeBSD.org>

Add a hack to ignore PCR bit for 6300ESB, 82801[D-G]B chips. It seems
that enabling busmastering would result in PCR bit ON after codec
reset.
While I'm here add DELAY(1) to codec access routine to give reasonable
time to codec operation. Without the delay, it would cause problems on
super-fast machines(> 2GHz). Also enable legacy audio for all 6300ESB,
82801[D-G]B chips. Previously, it enabled legacy audio for 82801DB(ICH4)
chip only.

Reported by: Maxim Maximov mcsi AT mcsi DOT pp DOT ru
Andrew Bliznak andriko.b AT gmail DOT com
Tested by: brueffer, Maxim Maximov, Andrew Bliznak


# 6a728ce5 14-Nov-2005 Ariff Abdullah <ariff@FreeBSD.org>

- Added few more Intel HDA ids (ICH 6/7) which does have backward
compatible AC97 codec.
- As the driver supports so many variants, create a table ids for
ease of probing and maintenance.
Submitted by: yongari
Reviewed/Tested by: multimedia@
- From luigi:
The code to compute fragment sizes in the ich driver almost
invariably ends up using the full buffer available, no matter
how the user specifies fragment size and number.
With audio telephony (8khz, 16bit-stereo) and the 16k buffer
size this results in an unbearable 500ms delay.
This patch makes sure that we never use more than 4 fragments,
(i don't think we need more unless there are huge interrupt
servicing latencies), and obey to the requested fragment size,
so that latency is acceptable.
Based on this (and after much regression tests), I can conclude
that this driver works best with 2 fragments, thus solving various
long standing issues of ICH driver not capable to flush or play
short files perfectly.
Suggested by: luigi (the idea of smaller fragments)
- MPSAFE conversion.

Approved by: netchild (mentor)


# dcbde453 05-Oct-2005 Alexander Leidinger <netchild@FreeBSD.org>

Add a comment regarding problems with NForce 2 mainboards and add disabled
code which may help.

People with a ich compatible soundcard which want to help out should
change the "#if 1" to a "#if 0" and try if the soundcard still works.
Reports about working or not-working soundcards with this change to
multimedia@ please.

PR: 73987


# 7b7c2c20 29-May-2005 Seigo Tanimura <tanimura@FreeBSD.org>

s/-1000/BUS_PROBE_LOW_PRIORITY/

Pointed out by: nyan


# db051dad 28-May-2005 Seigo Tanimura <tanimura@FreeBSD.org>

Add 6300ESB, which should be treated as ICH4.

PR: kern/81573
Submitted by: OOTOMO Hiroyuki <ootomo@za.wakwak.com>
MFC after: 1 week


# ddc5ac8b 20-Mar-2005 Murray Stokely <murray@FreeBSD.org>

Return BUS_PROBE_DEFAULT in preference to 0.

Pointed out by: Nate Lawson <nate@root.org>


# a52010a0 18-Mar-2005 Murray Stokely <murray@FreeBSD.org>

Add device id for nForce 4 audio controller.

PR: kern/78482
Submitted by: Markus Niemistö <markus.niemisto@iki.fi>
MFC after: 1 week


# d2b677bb 01-Mar-2005 Warner Losh <imp@FreeBSD.org>

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.


# 098ca2bd 05-Jan-2005 Warner Losh <imp@FreeBSD.org>

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


# eba1cb6e 12-Oct-2004 Pyun YongHyeon <yongari@FreeBSD.org>

Audio drivers failed to detect failure condition and attempted to
assign DMA address to the wrong address. It can cause system lockup
or other mysterious errors. Since most sound cards requires low DMA
address(BUS_SPACE_MAXADDR_24BIT) sndbuf_alloc() would fail when the
audio driver is loaded after long running of operations.

Approved by: jake (mentor)
Reviewed by: truckman, matk


# c6eadeaa 27-Sep-2004 Paul Saab <ps@FreeBSD.org>

Add ICH6 support.


# c70315d4 21-Sep-2004 Dag-Erling Smørgrav <des@FreeBSD.org>

Correct the capitalization of "nVidia".


# 82ad8eff 20-Sep-2004 MIHIRA Sanpei Yoshiro <sanpei@FreeBSD.org>

Add support Nvidia nForce2(audio)

PR: kern/71317
Submitted by: Mezz <mezz@freebsd.org>
MFC after: 1 week


# e99e8553 19-Sep-2004 MIHIRA Sanpei Yoshiro <sanpei@FreeBSD.org>

Add support nForce3 250 audio

PR: kern/71726
Submitted by: FUJIMOTO Kou <fujimoto@j.dendai.ac.jp>
MFC after: 1 week


# 0739ea1d 15-Jul-2004 Seigo Tanimura <tanimura@FreeBSD.org>

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


# 8fb9a995 14-Apr-2004 Brian Feldman <green@FreeBSD.org>

The newpcm headers currently #define away INTR_MPSAFE and INTR_TYPE_AV
because they bogusly check for defined(INTR_MPSAFE) -- something which
never was a #define. Correct the definitions.

This make INTR_TYPE_AV finally get used instead of the lower-priority
INTR_TYPE_TTY, so it's quite possible some improvement will be had
on sound driver performance. It would also make all the drivers
marked INTR_MPSAFE actually run without Giant (which does seem to
work for me), but:
INTR_MPSAFE HAS BEEN REMOVED FROM EVERY SOUND DRIVER!
It needs to be re-added on a case-by-case basis since there is no one
who will vouch for which sound drivers, if any, willy actually operate
correctly without Giant, since there hasn't been testing because of
this bug disabling INTR_MPSAFE.

Found by: "Yuriy Tsibizov" <Yuriy.Tsibizov@gfk.ru>


# 236efae6 30-Mar-2004 Mathew Kanner <matk@FreeBSD.org>

By default, ich4 has NAMBAR and NABMBAR i/o spaces as
read-only. Need to enable "legacy support", by poking
into pci config space. (comment from the patch)

Submited by: Autrijus Tang <autrijus@autrijus.org>
Approved by: tanimura (mentor)


# 5f96beb9 17-Mar-2004 Nate Lawson <njl@FreeBSD.org>

Convert callers to the new bus_alloc_resource_any(9) API.

Submitted by: Mark Santcroos <marks@ripe.net>
Reviewed by: imp, dfr, bde


# 0d8ed52e 06-Mar-2004 Mathew Kanner <matk@FreeBSD.org>

Augment /dev/sndstat with the module names, if applicable.

Approved by: tanimura (mentor)


# feec6a7a 15-Sep-2003 Nate Lawson <njl@FreeBSD.org>

Correctly reset ich[3-5] sound cards on resume. This fixes audio playback
after suspend/resume for me.

PR:
Submitted by: iwasaki
Reviewed by: orion
Approved by: cg
Obtained from:
MFC after:


# bbee2640 03-Sep-2003 David E. O'Brien <obrien@FreeBSD.org>

Recognize the sound chip on the Opteron-based nForce3 motherboards
(such as the Asus SK8N).


# d4aeb0ed 28-Aug-2003 David E. O'Brien <obrien@FreeBSD.org>

Add sound support for the AMD64 8111 chip.

PR: kern/55932
Submitted by: Mark Kettenis <kettenis@chello.nl>


# 90cf0136 22-Aug-2003 Warner Losh <imp@FreeBSD.org>

Prefer new location of pci include files (which have only been in the
tree for two or more years now), except in a few places where there's
code to be compatible with older versions of FreeBSD.


# 4cca7f0a 10-Aug-2003 Orion Hodson <orion@FreeBSD.org>

Switch from legacy to native mode for ICH4 and ICH5.

Submitted by: Shin-ichi YOSHIMOTO <yosimoto@waishi.jp>
Test by: Markko Merzin <markko@short.cut.ee>
PR: kern/53242
MFC after: 5 days


# e2df1783 06-Jul-2003 Cameron Grant <cg@FreeBSD.org>

* support ich5

PR: kern/53242
Submitted by: Shin-ichi Yoshimoto <yosimoto@waishi.jp> (partly)
Tested by: Dominic Marks <dom@cus.org.uk> (version in PR)
MFC after: 1 week


# b6eb8f8a 05-Jul-2003 Cameron Grant <cg@FreeBSD.org>

* add support for amd-768 audio, as used on many dual athlon boards. only
tested for playback.

* modify device name strings for ich chips to better conform with their
common names.

* remove superflous 'AC97 controller' from nforce device names.

MFC after: 1 week


# f6b1c44d 01-Jul-2003 Scott Long <scottl@FreeBSD.org>

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


# 533294b9 15-Apr-2003 Matthew N. Dodd <mdodd@FreeBSD.org>

- Don't call pci_enable_io() in drivers (unless needed for resume).
- Don't test memory/port status and emit an error message; the PCI
bus code will do this now.


# 538b04e4 04-Apr-2003 Orion Hodson <orion@FreeBSD.org>

Fix mismatch between bus address stored for buffer descriptors and
actual address of buffer descriptor. This should fix the reported
calibration failures and subsequent speed problems with ich chipsets.

Minor calibration comment updates.


# 38cc9942 20-Feb-2003 Olivier Houchard <cognet@FreeBSD.org>

Implement a "sndbuf_getbufaddr" function and use it instead of vtophys().

Reviewed by: orion


# a7697e55 13-Jan-2003 Orion Hodson <orion@FreeBSD.org>

Add nForce2 device id.

Submitted by: "Mikko S. Hyvarinen" <morphy@morphy.iki.fi>
MFC after: 5 days


# 14213e7d 19-Aug-2002 Orion Hodson <orion@FreeBSD.org>

Cater for ich4 quirks.

Reported by: Jacob Rhoden
Tested by: Jacob Rhoden, mp


# eabc182e 12-Aug-2002 Mark Peek <mp@FreeBSD.org>

Add PCI ID for the ICH4 AC97 controller.


# f4df40b2 27-Jun-2002 Scott Long <scottl@FreeBSD.org>

Delay the AC97 calibration until after the system clock has been
calibrated. This fixes the problem where playback and recording do
not run at the correct speed. It probably also eliminates the
need for the hacks/workarounds/sysctl's that were previously
devised to deal with this, but I will leave that for a different
time.

Reviewed by: orion


# 7dace039 05-May-2002 Orion Hodson <orion@FreeBSD.org>

No longer attempt to power off the ACLINK during suspend - luigi
reports this causes his ich machine to hang.


# 77b6db94 15-Apr-2002 John Baldwin <jhb@FreeBSD.org>

Recognize the AC97 interface to the onboard sound controller on the Nvidia
nForce chipset. Playback at least seems to work fine with the ich driver
out of the box.

Sponsored by: The Weather Channel
Help from: cg


# fcd47847 14-Apr-2002 John Hay <jhay@FreeBSD.org>

Fix the play / record rate setting so that it actually works.

The extra microphone channel capability is part of the "normal" ac97
capabilities and not an extended ac97 capability. Now recording on
codecs without a seperate mic channel works.

MFC after: 1 week


# 472cd8b5 18-Feb-2002 Alfred Perlstein <alfred@FreeBSD.org>

Add play (but not record) support for the Sis 7012.

Submitted by: Mike Meyer <mwm@mired.org>


# bd8e0aee 18-Jan-2002 Orion Hodson <orion@FreeBSD.org>

Change ich_calibrate to busy wait on buffer fill level and use a more
likely looking rate calculation.

Install interrupt handler before calling ich_init as the initialization
occasionally generates spurious interrupts.

These changes are derived from cg's work in progress version of this
driver.


# aaa16787 21-Dec-2001 Orion Hodson <orion@FreeBSD.org>

Save and restore state for suspend/resume.

PR: kern/28692
Obtained from: SAKIYAMA Nobuo <sakichan@sakichan.org>


# df6ee7b7 19-Dec-2001 Orion Hodson <orion@FreeBSD.org>

Correct unexpected interrupt detection.


# faee2703 19-Dec-2001 Orion Hodson <orion@FreeBSD.org>

Nitlets.


# 23d21797 19-Dec-2001 Orion Hodson <orion@FreeBSD.org>

Clear resume interrupts - these can occur during initialization and
must be cleared to prevent machine hanging (presently aflicts -current
and -stable).

Problem reported by Bruce Montague <brucem@cse.iitkgp.ernet.in>

PR: kern/29769 (probably)


# 0225c5ac 17-Dec-2001 Orion Hodson <orion@FreeBSD.org>

Add calibration test to determine extent of AC97 overclocking (if any).


# 2ae4ee83 16-Dec-2001 Orion Hodson <orion@FreeBSD.org>

Added a sysctl control variable "ac97rate" to allow manual tuning of
the link rate - some ich motherboards overclock ac97 out of the box.

Will hopefully replace this with a callibration loop in time for 4.5R
freeze.

Problem reported by Luigi Rizzo and fix derived from his code (put
diff in ich.c rather than ac97.c).

MFC after: 3 days


# 21f30688 22-Nov-2001 Orion Hodson <orion@FreeBSD.org>

Fix typo introduced with last commit.


# eb5b9d0b 20-Nov-2001 Orion Hodson <orion@FreeBSD.org>

Correct extmode initialization.

MFC after: 3


# aaa3add4 02-Nov-2001 Peter Wemm <peter@FreeBSD.org>

Add Id for 82801CA (ICH3?). The ich driver seems to work fine on the
laptop that had it.


# 82ab7a3b 07-Oct-2001 Cameron Grant <cg@FreeBSD.org>

* register the correct number of channels
* include hw buffer size in sndstat info


# fca71897 18-Sep-2001 Cameron Grant <cg@FreeBSD.org>

don't enable the mic record channel unless the codec supports it.

allow hardware buffer size to be specified using hints.


# 9924faf6 28-Aug-2001 Cameron Grant <cg@FreeBSD.org>

* change buffering method a bit
* swap record/mic channels
* initialise all channels
* align dma buffers to 8 bytes

Submitted by: Katsurajima Naoto <raven@katsurajima.seya.yokohama.jp>
(mostly)


# 67b1dce3 23-Aug-2001 Cameron Grant <cg@FreeBSD.org>

many changes:

* add new channels to the end of the list so channels used in order of
addition

* de-globalise definition of struct snddev_info and provide accessor
functions where necessary.

* move the $FreeBSD$ tag in each .c file into a macro and allow the
/dev/sndstat handler to display these when set to maximum verbosity to aid
debugging.

* allow each device to register its own sndstat handler to reduce the amount
of groping sndstat must do in foreign structs.


# 41a019c0 03-Jul-2001 Cameron Grant <cg@FreeBSD.org>

* simplify

* add support for mic record channel

* add support for setblocksize

* make mpsafe

* make getptr accurate

* reduce buffer size from 64k to 16k for better synchronisation


# 5e6abe66 02-Jul-2001 Brian Feldman <green@FreeBSD.org>

Detect the device on e.g. Dell OptiPlex GX110s.


# 1b6c76a2 01-Jul-2001 Cameron Grant <cg@FreeBSD.org>

intel ich/ich2 driver - this needs some work but is functional enough for
the impatient.

Hardware...
Provided by: ps
Lost by: <censored>
Found by: <censored>
Not delivered by: Ashley Penney <ashp@unloved.org>
Retrieved by: greid, Andrew McKay <andy@openirc.co.uk>
Delivered by: Andrew McKay <andy@openirc.co.uk>

PR: kern/25507
Submitted by: Katsurajima Naoto <raven@katsurajima.seya.yokohama.jp>