Commit Graph

328 Commits

Author SHA1 Message Date
Ariff Abdullah
7810d8e256 Fix a long standing unhandled interrupt bug which can cause
erratic system slowdown (beaten to a pulp) and possible panic. This
issue has bugged me for as long as I could remember, until I
realized that it is possible for register base offset to hold zero
value which is definitely a "FALSE".

Approved by:	netchild (mentor)
2005-11-14 18:18:52 +00:00
Ariff Abdullah
6a728ce536 - 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)
2005-11-14 18:18:12 +00:00
Ariff Abdullah
0ae68fd446 Use both (enabled by default) DAC1 and DAC2 to provide 2
distinct hardware playback channels. DAC configuration can be
accessed through kernel hint - hint.pcm.<unit>.dac="val" with
following possible values:

   0 = Enable both DACs (default)
   1 = Enable single DAC (DAC1)
   2 = Enable single DAC (DAC2)
   3 = Enable both DACs, swap position (DAC2 comes first instead
       of DAC1)

Special case for ES1370:
   Unlike ES1371,2,3/CT5880, volume for each DAC 1 and 2 can be
   controlled indepedently (synth for DAC1, pcm for DAC2). It is
   possible that user will confuse by this behaviour, since both
   DACs are enabled by default. Thus, provide a knob through sysctl
   hw.snd.pcm<unit>.single_pcm_mixer:
     0 = each DACs will be controlled separately (synth/pcm).
     1 = combine both DACs volume mixer controller into a single
         "pcm" (default)
   As a side note, fixed rate operation (provided by previous
   commit) is not a mandatory if the configuration space does not
   involve DAC2 (perhaps disabled by user through the above kernel
   hint). Unlike DAC2, DAC1 has its own register / control space,
   not affected by the speed settings of ADC.

Tested by:	multimedia@
Approved by:	netchild (mentor)
2005-11-14 18:17:31 +00:00
Ariff Abdullah
beb1654e70 Fix recording device selection based on ALS4000 datasheet.
- http://www.alsa-project.org/alsa/ftp/manuals/avance_logic/ALS4000a.PDF

Submitted by:	Watanabe Kazuhiro <CQG00620@nifty.ne.jp>
2005-11-07 09:26:17 +00:00
Alexander Leidinger
e7d2d131f1 - Locking improvements.
- Don't keep the SPDIF state in the driver private struct since it
  can be overriden by hand with pciconf(8), query it when needed instead.

Regarding the locking I let Ariff explain it himself:
---snip---
About the locking, that is what I'm intended to do since the beginning.
The reason I'm not putting that along since my first patchset was
because several people especially from amd46 camp reported that it cause
lots of LORs, which is weird considering that I've never encounter such
in a pretty much strict locking environment (i386). However, since our
previous discussion with Pyun YongHyeon about strict locking, I've
decided to bring it back for all the affected drivers, not just for
es137x. It turns out that the root of the problem was within dsp.c
during device open, which has been fixed since dsp.c revision 1.84.
---snip---

Submitted by:	Ariff Abdullah <skywizard@MyBSD.org.my>
2005-10-05 20:05:52 +00:00
Alexander Leidinger
dcbde45390 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
2005-10-05 20:00:12 +00:00
Alexander Leidinger
34ac5f0f5f * Fixed rate operation for es1370 chip to solve conflicting
sampling rate between playback and recording. This can be
  disabled / enabled via kernel hints
  (hint.pcm.<unit>.fixed_rate=0/4000-48000) or sysctl
  hw.snd.pcm<unit>.fixed_rate=0/4000-48000). Default to 48khz
  fixed rate. [1]
* Basic cleanup. *_es1371x_* -> *_es137x_*.
* Some locking fixes. [2]

Submitted by:	Ariff Abdullah <skywizard@MyBSD.org.my>
Discussed with:	yongari [2]
See also:	http://lists.freebsd.org/pipermail/freebsd-multimedia/2005-September/002758.html [1]
Reported by:	Jos Backus <jos at catnook.com> [1]
2005-10-02 15:56:36 +00:00
Pyun YongHyeon
7535accf91 Unlock driver lock before calling resource_int_value(9).
This should fix LOR(in fact it's not LOR) in device attach.
2005-09-13 10:12:28 +00:00
Alexander Leidinger
df54be7080 Fix hang at init for MagicMedia 256A[VX] chips. [1]
In case this causes trouble for some other chipsets add a comment how to
proceed. If we don't get bugreports, this should be removed after a while
(some releases?).

PR:		56617 [1], 29465, 39260, 40574,	68225
Submitted by:	Matthew E. Gove <mgove@comcast.net> [1]
2005-09-11 17:30:27 +00:00
Alexander Leidinger
5ad14b759d Power up the external amplifiers additionally to powering up the DAC and ADC.
PR:		47029
Submitted by:	Anish Mistry <mistry.7@osu.edu>
Tested by:	David Murphy <dm@dmz.ie>
2005-09-11 14:15:05 +00:00
Alexander Leidinger
01bec79c11 * Add locking / MPSAFE
* Add kernel hint option to disable DXS channels entirely. Report
  from several skype users / Pav Lucistnik indicate that disabling
  DXS may fix lots of pop / crackling noise. To disable DXS add
  hint.pcm.<unit>.via_dxs_disabled="1" to /boot/device.hints.
  Further investigation of the issues regarding DXS showed, that
  the problem is in another (more generic) place, but until the
  right fix is tested/reviewed this may help a little bit.

Added sysctl's to aid testing/debugging:
hint.pcm.<unit>.via_dxs_disabled=X - Disable / Enable DXS channels entirely
hint.pcm.<unit>.via_dxs_channels=X - Limit DXS channels up to X
hint.pcm.<unit>.via_sgd_channels=X - Limit SGD channels up to X
hint.pcm.<unit>.via_dxs_src=X      - Enable / Disable DXS sample rate
                                     converter.

Submitted by:	Ariff Abdullah <skywizard@MyBSD.org.my>
Tested by:	multimedia@
2005-07-31 13:43:42 +00:00
Alexander Leidinger
cc730bdd4a Fix a LOR introduced with the last commit (some hours ago), I had the
wrong version of the patch.

Submitted by:	Ariff Abdullah <skywizard@MyBSD.org.my>
Pointy hat to:	netchild
2005-07-31 13:24:47 +00:00
Alexander Leidinger
69e10e5a1b Fix a LOR introduced in the last commit (some hours ago), I had the wrong
version of the patch...

Submitted by:	Ariff Abdullah <skywizard@MyBSD.org.my>
Pointy hat to:	netchild
2005-07-31 13:22:48 +00:00
Alexander Leidinger
ae93e580dd * Register programming error during device initialization
especially for CT4730 / EV1938 chip, causing misconfigured mixer
  (David Xu), crippled after power cycle (Kevin Oberman). Fixed.
* Incorporate locking/spdif patches from Jon Noack / matk. Not all
  es137x can really do spdif, clean it up a bit to only let few capable
  chip. This adds a "hw.snd.pcm<unit>.spdif_enabled" sysctl until
  a more generic way of handling this from userland (by an ordinary
  user) is designed/implemented.
* Convert all bus_space_(read|write) to use es_rd/es_wr, simmilar
  with other drivers.
* Add tunable hw.snd.pcm<unit>.latency_timer sysctl to toggle pci
  latency timer value on the fly. Much noise / pop / crackling
  issues can be solved by increasing its value. Other people have
  pointed out to use pciconf instead, but this is just an added
  value specific for CT4730/EV1938.
* Remove es137x specific debug sysctl/code.

Several PRs can now be closed.

Submitted by:	Ariff Abdullah <skywizard@MyBSD.org.my>
Submitted by:	Jon Noack <noackjr@alumni.rice.edu> (implicit)
Submitted by:	matk (implicit)
PR:		59349, 68594, 73498
Tested by:	multimedia@
2005-07-31 13:19:38 +00:00
Alexander Leidinger
f769fa83d5 This driver is already MPSAFE, remove busdma_lock_mutex and Giant from
bus_dma_tag_create.

Submitted by:	Ariff Abdullah <skywizard@MyBSD.org.my>
2005-07-31 12:38:22 +00:00
Alexander Leidinger
2b379e8d35 * Add locking / MPSAFE.
Submitted by:	Ariff Abdullah <skywizard@MyBSD.org.my>
Tested by:	netchild
2005-07-31 11:04:36 +00:00
Alexander Leidinger
1adf8286e7 * als4000 can't do 48k properly (perhaps it really can't at all!).
Set maxspeed to 44.1k instead.
* Add locking / MPSAFE
* Fix recording

Submitted by:	Ariff Abdullah <skywizard@MyBSD.org.my>
2005-07-31 11:01:13 +00:00
Gleb Smirnoff
961478afd1 Implement suspend/resume operation for snd_csa(4)
PR:		kern/82243
Submitted by:	Serge Semenenko
Approved by:	re (scottl)
MFC after:	1 month
2005-06-27 07:43:57 +00:00
Seigo Tanimura
7b7c2c20d4 s/-1000/BUS_PROBE_LOW_PRIORITY/
Pointed out by:	nyan
2005-05-29 23:22:23 +00:00
Seigo Tanimura
db051dad5f Add 6300ESB, which should be treated as ICH4.
PR:		kern/81573
Submitted by:	OOTOMO Hiroyuki <ootomo@za.wakwak.com>
MFC after:	1 week
2005-05-28 09:32:43 +00:00
Pyun YongHyeon
c21880a7df Make snd_maestro3(4) mpsafe
- Let m3_pchan_trigger()/m3_rchan_trigger() acquire lock and call
   m3_pchan_trigger_locked()/m3_rchan_trigger_locked() respectivly.
 - Mark interrupt handler INTR_MPSAFE.
 - Add locks in sound/channel interface.

Tested by:	nork
2005-05-23 06:27:07 +00:00
Matthew N. Dodd
8f6a80b791 Make it clear that the statement following the conditional is a NOP. 2005-04-13 06:42:43 +00:00
Murray Stokely
ddc5ac8b73 Return BUS_PROBE_DEFAULT in preference to 0.
Pointed out by:	Nate Lawson <nate@root.org>
2005-03-20 20:13:21 +00:00
Murray Stokely
a52010a036 Add device id for nForce 4 audio controller.
PR:		kern/78482
Submitted by:	Markus Niemistö <markus.niemisto@iki.fi>
MFC after:	1 week
2005-03-19 01:39:13 +00:00
Warner Losh
d2b677bb1a 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.
2005-03-01 08:58:06 +00:00
Warner Losh
7c61c21042 BUS_SPACE_UNRESTRICTED shouldn't be used with the bus_alloc_resource
interface.  Instead, move to the convenience _any interface.
2005-02-01 07:43:34 +00:00
Warner Losh
098ca2bda9 Start each of the license/copyright comments with /*-, minor shuffle of lines 2005-01-06 01:43:34 +00:00
Ruslan Ermilov
cf7190f2ea Fix build.
Submitted by:	Taku YAMAMOTO
2004-11-11 13:01:13 +00:00
Julian Elischer
15b0a9c8f7 Add record capability.
Submitted by:	Taku Yamamoto  (original author)
2004-11-10 04:29:09 +00:00
Pyun YongHyeon
a2f4d2f5b0 Limit DMA address space to 1GB since the trident audio cards can't
handle DMA addresses located above 1GB. The LBA(loop begin address)
register which holds DMA base address is 32bits register. But the
MSB 2bits are used for other purposes. This effectivly limits the
DMA address space up to 1GB.

Approved by:	jake (mentor)
Reviewed by:	truckman, matk
2004-10-13 06:04:01 +00:00
Pyun YongHyeon
eba1cb6e3e 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
2004-10-13 05:45:16 +00:00
Paul Saab
c6eadeaa66 Add ICH6 support. 2004-09-28 01:32:58 +00:00
Dag-Erling Smørgrav
c70315d4a8 Correct the capitalization of "nVidia". 2004-09-21 13:17:55 +00:00
MIHIRA Sanpei Yoshiro
82ad8eff9e Add support Nvidia nForce2(audio)
PR:		kern/71317
Submitted by:	Mezz <mezz@freebsd.org>
MFC after:	1 week
2004-09-20 07:19:49 +00:00
MIHIRA Sanpei Yoshiro
e99e85532a Add support nForce3 250 audio
PR:		kern/71726
Submitted by:	FUJIMOTO Kou <fujimoto@j.dendai.ac.jp>
MFC after:	1 week
2004-09-20 05:59:17 +00:00
Maxim Sobolev
a02bcc107c Backout the code which tries to use undocumented way to determine if
fm801 has sound capabilities or not. Unfortunately this code doesn't
work as expected.

Submitted by:	many
MFC after:	3 days
2004-09-15 23:47:17 +00:00
Brian Feldman
bf5ab950e3 The new contigmalloc code is exposing a lot of misuses of busdma memory
allocation. Notably, in this case, the driver tries to allocate several
pieces of memory and then fails if the pieces allocated after the first
do not come after it physically, and within a specific range (8MB I
believe).  Of course, this could just as easily fail for any number of
reasons, but it almost always fails now that contiguous allocations start
at the end of possible specified memory locations rather than the beginning.

Allocate all the possibly-needed memory up front, even though it's a waste,
to get around this.  The least bogus solution would be to take the physical
address from the first allocation and create a new tag that specified that
further allocations must follow it within that 8MB window, then use that
when allocating new channels, but that's left for anyone else that really
feels like doing it.

Tested by:	Erwin Lansing <erwin@lansing.dk>
2004-08-22 18:57:40 +00:00
David E. O'Brien
6fbf600e5b Remove rev 1.50. 2004-07-24 15:30:23 +00:00
Seigo Tanimura
0739ea1de2 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
2004-07-16 04:00:08 +00:00
Bruce M Simpson
588f096065 Check the return value of bus_dmamem_alloc() correctly.
Submitted by:	Darron Broad (with cleanups)
2004-07-04 18:40:36 +00:00
David E. O'Brien
07f5454078 Add PCI identifier for Dell modified SBLive! card
Submitted by:	Joseph Dunn <joseph@magnesium.net>
2004-06-13 22:12:02 +00:00
Maxime Henrion
0547806326 Make the emu10k1 pcm driver INTR_MPSAFE. The locking is modeled
exactly as done in the cmi driver.  I am quite confident this is
safe since I'm runing this for more than two weeks now, on an SMP
box.  A few people tested this patch for me successfully as well.
2004-06-04 16:42:33 +00:00
Seigo Tanimura
a5dc42def9 Axe the old midi drivers and framework. matk has developed a new
module-friendly midi subsystem to be merged soon.
2004-06-01 06:22:59 +00:00
Mathew Kanner
3858fd7a0c Add PCI ID for via 8237.
Submitted by:	Josh Elsasser <jre@vineyard.net>
Approved by:	tanimura (mentor)
PR:		kern/61730
2004-05-26 22:05:50 +00:00
Brian Feldman
a7d7f349bd This driver certainly works fine turning INTR_MPSAFE back on. For those
of you with other cards, please do review and test the drivers for
MP-safety and disable Giant in the interrupt routines when you are
sure of proper functionality.
2004-04-21 04:23:51 +00:00
Brian Feldman
8fb9a995cf 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>
2004-04-14 14:57:49 +00:00
Mathew Kanner
236efae6a9 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)
2004-03-31 00:11:24 +00:00
Marcel Moolenaar
056dc22c4f Actually program the list of recording devices in sv_mix_setrecsrc().
This change has not been tested.

This change was triggered by a gcc(1) warning on ia64 at -O2.  The
variable v was not used after being computed, which resulted in enough
dead code elimination (DCE) to confuse the compiler and emit a bogus
warning about the use of the variable i without prior definition. The
variable i is the loop variable.

Submitted by: des
Responsibility: marcel
2004-03-20 04:38:21 +00:00
Nate Lawson
5f96beb9e0 Convert callers to the new bus_alloc_resource_any(9) API.
Submitted by:	Mark Santcroos <marks@ripe.net>
Reviewed by:	imp, dfr, bde
2004-03-17 17:50:55 +00:00
Mathew Kanner
0d8ed52ea5 Augment /dev/sndstat with the module names, if applicable.
Approved by:	  tanimura (mentor)
2004-03-06 15:52:42 +00:00