Commit Graph

1012 Commits

Author SHA1 Message Date
Joel Dahl
5bcbb3c5e8 Orion originally wrote and added these files in 2002/2003, so with his
approval, change the copyright statement to point at him instead of
"FreeBSD, Inc".

Encouraged by:	rwatson
Reviewed by:	imp
Discussed with and approved by:	orion
2007-02-04 06:52:33 +00:00
Joel Dahl
155414e2e4 Remove dead email address.
Requested by:	luigi
2007-02-02 13:44:09 +00:00
Joel Dahl
a0afd24d9c Clean up the BSD license to match the preferred license in
/usr/share/examples/etc/bsd-style-copyright.  I've fixed a
few minor wording and formatting differences.

Approved by:	luigi, Hannu Savolainen <hannu@opensound.com>
2007-02-02 13:39:20 +00:00
Joel Dahl
262e034444 Add a standard BSD license to these files.
Discussed with:	rwatson
Approved by:	luigi
2007-02-02 13:33:35 +00:00
Ariff Abdullah
9e4c8259a3 Fix huge memory leak within sound buffer (during channel destruction,
buffer resizing, etc.) that was here since eon. Free all (unmanaged)
allocated buffer through sndbuf_destroy() in case we forgot to call
sndbuf_free(). For a managed buffer (mostly hw specific managed buffer),
either provide CHANNEL_FREE() method with appropriate return value to
invoke semi-automatic sndbuf_free() or simply do it on their own. If
everything is failed, sndbuf_destroy() will come to the rescue as a
final measure.

MFC after:	3 days
2007-02-01 09:46:03 +00:00
Ariff Abdullah
e444a20971 Fix apparent memory leak (during vchan destruction) that was here
since eon.
2007-02-01 09:30:01 +00:00
Joel Dahl
fcacf52ec7 Put #ifndef... after the license.
Approved by:	ariff
2007-01-31 12:10:48 +00:00
Joel Dahl
22821dadfc s/WHETHERIN/WHETHER IN/ & s/THEPOSSIBILITY/THE POSSIBILITY/ in the
license text.

Approved by:	imp
2007-01-31 08:53:45 +00:00
Joel Dahl
48351eaf73 Clean up the BSD license to match the preferred license in
/usr/share/examples/etc/bsd-style-copyright.  I've fixed a
few minor wording and formatting differences.

Approved by:	matk, Hannu Savolainen <hannu@opensound.com>
Reviewed by:	imp
2007-01-28 20:38:07 +00:00
Ariff Abdullah
5430d30e44 Add speaker control for HP xw4300. This hardware doesn't respond to
unsolicited pin sense event and need manual control to turn off speaker
volume while attaching headphone.

Tested by:		Ingeborg Hellemo <Ingeborg.Hellemo@cc.uit.no>

Disable global Acer + ALC883 headphone automute settings since there are
few models that does not respect this and causing broken behaviour.

Reported/Tested by:	Pavel Argentov <argentoff@rtelekom.ru>
2007-01-28 03:16:54 +00:00
Ariff Abdullah
d130d86519 Rearrange locking order to avoid LOR (cat /dev/midistat).
Reported by:	rodrigc
2007-01-27 15:55:59 +00:00
Ariff Abdullah
b9ba7b9e78 Massive inlining cleanups/removal to make it survive on WARNS=2. 2007-01-27 13:30:19 +00:00
Ariff Abdullah
a12b5a0728 Reduce maximum DMA segments from 128 to 64. We don't need more than that. 2007-01-27 07:35:05 +00:00
Ariff Abdullah
f39ee7ef2e Total DMA segments should include total number of record channel(s). 2007-01-26 23:53:56 +00:00
Ariff Abdullah
b1d922169b Fix forever broken ua_chan_setblocksize() uninitialized return value
which causing divide by zero panic in other places (notably chn_sync()).
2007-01-26 19:14:41 +00:00
Ariff Abdullah
3ad47bdd54 Sync uaudio_sndstat_prepare_pcm() output with sndstat_prepare_pcm() to get
simmilar (debugging) output.
2007-01-26 19:06:17 +00:00
Marius Strobl
c2175ff5ca Change the remainder of the drivers for DMA'ing devices enabled in the
sparc64 GENERIC and the sound device drivers known working on sparc64
to use bus_get_dma_tag() to obtain the parent DMA tag so we can get rid
of the sparc64_root_dma_tag kludge eventually. Except for ath(4), sk(4),
stge(4) and ti(4) these changes are runtime tested (unless I booted up
the wrong kernels again...).
2007-01-21 19:32:51 +00:00
Marius Strobl
3284c150d2 - Probe the CS4231 in USIII machines.
- Remove unused variables. [1]

Reported by:	Coverity Prevent (CID 700, 701) [1]
2007-01-18 19:19:19 +00:00
Joel Dahl
5c92405025 Fix typo in a comment. 2007-01-16 12:27:13 +00:00
Ariff Abdullah
95af1064dc Fix headphone/speaker automute for [1] Acer Aspire 5050 and [2] MSI MS-1034
laptops.

Tested by:	[1] Lion G. <liontanker@hotmail.com>
          	[2] Pietro Cerutti <pietro.cerutti@gmail.com>

Specialized mixer initialization for STAC9221, much like STAC9220.

Tested by:	Devon H. O'Dell
2007-01-13 00:24:44 +00:00
Alexander Leidinger
36d448450f Fixes module build with DEB(x) defined to x.
Submitted by:	Yuriy Tsibizov <Yuriy.Tsibizov@gfk.ru>
2007-01-06 19:11:48 +00:00
Alexander Leidinger
cea9c751eb Sync with NetBSD:
revision 1.98 is NOT merged, because FreeBSD does not support this
 		syntax.
 	revision 1.99 is NOT merged, "const poisoning" part is not applicable
 		to FreeBSD. There is no variable shadowing, GCC can't find
 		this one (but there are others)
 	revision 1.100 is NOT merged, because it was null patch (no changes)
 	revision 1.101 is NOT merged, there is no BIT() macro in FreeBSD
 	revision 1.102 is merged
 	revision 1.103 is partially merged. There is no ai.ifaceh in FreeBSD
 	revision 1.104 is NOT merged
 	revision 1.105 is merged
 	revision 1.106 is not merged, because of rev. 1.107
 	revision 1.107 is a backuout of 1.106

Submitted by:	Yuriy Tsibizov <Yuriy.Tsibizov@gfk.ru>
2007-01-06 19:08:39 +00:00
Alexander Leidinger
f856af0466 Extend the emu10kx driver. With the words of the author:
---snip---
New features:
1.	Optional multichannel recording (32 channels on Live!, 64 channels
 	on Audigy).

 	All channels are 16bit/48000Hz/mono, format is fixed.
 	Half of them are copied from sound output, another half can be
 	used to record any data from DSP. What should be recorded is
 	hardcoded in DSP code. In this version it records dummy data, but
 	can be used to record all DSP inputs, for example..

 	Because there are no support of more-than-stereo sound streams
 	multichannell stream is presented as one 32(64)*48000 Hz 16bit mono
 	stream.

 	Channel map:

 	SB Live! (4.0/5.1)
 	offset (words)	substream
 	0x00		Front L
 	0x01		Front R
 	0x02		Digital Front L
 	0x03		Digital Front R
 	0x04		Digital Center
 	0x05		Digital Sub
 	0x06		Headphones L
 	0x07		Headphones R
 	0x08		Rear L
 	0x09		Rear R
 	0x0A		ADC (multi-rate recording) L
 	0x0B		ADC (multi-rate recording) R
 	0x0C		unused
 	0x0D		unused
 	0x0E		unused
 	0x0F		unused
 	0x10		Analog Center (Live! 5.1) / dummy (Live! 4.0)
 	0x11		Analog Sub (Live! 5.1) / dummy (Live! 4.0)
 	0x12..-0x1F	dummy

 	Audigy / Audigy 2 / Audigy 2 Value / Audigy 4
 	offset (words)	substream
 	0x00		Digital Front L
 	0x01		Digital Front R
 	0x02		Digital Center
 	0x03		Digital Sub
 	0x04		Digital Side L (7.1 cards) / Headphones L (5.1 cards)
 	0x05		Digital Side R (7.1 cards) / Headphones R (5.1 cards)
 	0x06		Digital Rear L
 	0x07		Digital Rear R
 	0x08		Front L
 	0x09		Front R
 	0x0A		Center
 	0x0B		Sub
 	0x0C		Side L
 	0x0D		Side R
 	0x0E		Rear L
 	0x0F		Rear R
 	0x10		output to AC97 input L (muted)
 	0x11		output to AC97 input R (muted)
 	0x12		unused
 	0x13		unused
 	0x14		unused
 	0x15		unused
 	0x16		ADC (multi-rate recording) L
 	0x17		ADC (multi-rate recording) R
 	0x18		unused
 	0x19		unused
 	0x1A		unused
 	0x1B		unused
 	0x1C		unused
 	0x1D		unused
 	0x1E		unused
 	0x1F		unused
 	0x20..0x3F	dummy

Fixes:
1.	Do not assign negative values to variables used to index emu_cards
 	array. This array was never accessed when index is negative, but
 	Alexander (netchild@) told me that Coverity does not like it.
 	After this change emu_cards[0] should never be used to identify
 	valid sound card.
2.	Fix off-by-one errors in interrupt manager. Add more checks there.
3.	Fixes to sound buffering code now allows driver to use large playback
 	buffers.
4.	Fix memory allocation bug when multichannel recording is not
 	enabled.
5.	Fix interrupt timeout when recording with low bitrate (8kHz).

Hardware:
1.	Add one more known Audigy ZS card to list. Add two cards with
 	PCI IDs betwen old known cards and new one.

Other changes:
1.	Do not use ALL CAPS in messages.

Incomplete code:
1.	Automute S/PDIF when S/PDIF signal is lost.

Tested on i386 only, gcc 3.4.6 & gcc41/gcc42 (syntax only).
---snip---

This commits enables a little bit of debugging output when the driver is
loaded as a module. I did a cross-build test for amd64.

The code has some style issues, this will be addressed later.

The multichannel recording part is some work in progress to allow playing
around with it until the generic sound code is better able to handle
multichannel streams.

This is supposed to fix
CID:		171187
Found by:	Coverity Prevent

Submitted by:	Yuriy Tsibizov <Yuriy.Tsibizov@gfk.ru>
2007-01-06 18:59:35 +00:00
Ariff Abdullah
048b52987d Fix headphone/speaker automute for Toshiba Satellite Pro U200.
Reported/Tested by:	keramida
2007-01-04 18:13:04 +00:00
Ariff Abdullah
65de329ee2 Fix distorted sound on Intel Desktop Board D101GGC (ATI SB450/ALC861).
Turn on ALC861 quirk as default since it seems affecting all hardwares
with the same codec.

Reported/Tested by:	Darryl Yeoh <drl@MyBSD.org.my>
2006-12-22 11:55:59 +00:00
Ariff Abdullah
303f62b8a2 Fix distorted sound on Fujitsu Siemens AMILO Pa 1510.
Reported/Tested by:	infofarmer
2006-12-19 16:52:09 +00:00
Ariff Abdullah
378e0c5c89 Latest updates for Envy24/24HT. Fix various issues with LOR and panic
during verbose booting.

Submitted by:	Konstantin Dimitrov <kosio.dimitrov@gmail.com>
2006-12-17 16:06:45 +00:00
Ariff Abdullah
5c46f47bd3 Add codec id for [1] Realtek ALC888 and [2] Sigmatel STAC9227
Found/Tested by:	[1] luigi
                	[2] Jean-Baptiste Quenot <jbq@caraldi.com>
2006-12-17 15:19:33 +00:00
Ariff Abdullah
dc9e52cfda Add support for Nvidia Nforce MCP04 AC97 controller.
PR:		kern/106829
Submitted by:	Frédéric Petit <fredantispam@free.fr>
2006-12-17 13:23:00 +00:00
Ariff Abdullah
210bece19a Miscellaneous fixups and quirks for ASUS A7M, LG LW20 and
HP NX6325 laptops.
2006-12-16 09:14:58 +00:00
Ariff Abdullah
7c302801bd Fix compilation using gcc 4.1.
Submitted by:	dougb
2006-12-15 05:15:17 +00:00
Ariff Abdullah
4ed06071e6 Fix distorted sound on ASUS P1-AH2 caused by accumulated input / output.
Reported/Tested by:	Hiroharu Tamaru <tamaru@myn.rcast.u-tokyo.ac.jp>
2006-12-11 18:45:11 +00:00
Ariff Abdullah
e150f641d0 Fix AD1986A (and possibily other codecs too) microphone issues.
Tested by:	xride (using skype, xanalyser, etc. ; play/record)
2006-12-10 06:13:41 +00:00
Ariff Abdullah
1b5c0d50f6 - Fix headphone/speakers automute on Lenovo 3000 N100.
Tested by:	xride

- GPIO commit cleanups and fixes for possible breakage during
  previous commit.
2006-12-09 17:52:54 +00:00
Ariff Abdullah
cc726a7f98 Don't try to workaround broken apps (if any). If this still the case,
lets fix the broken apps instead.
2006-12-07 07:48:58 +00:00
Ariff Abdullah
b45d0ec80d Remove comment that is no longer relevant since previous
buffering fix.
2006-12-07 07:48:20 +00:00
Ariff Abdullah
2229d0cfa2 Add support for Apple Intel/Mac.
- Playback and headphone/speaker automute works.
 - Recording untested due to me being deaf doing back-and-forth
   remote debugging.

Free Macbook donation is highly appreciated :)

Tested by:	Dennis Pielken <mips128@gmx.net>
2006-12-02 17:12:24 +00:00
Ariff Abdullah
fbf953b58e 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
2006-12-01 06:53:13 +00:00
Ariff Abdullah
57d90e7fbe Fix support for Medion MD MD95257 (GPIO2 quirk).
Reported by:	Chris Tophe <cohika@gmail.com>
2006-11-29 15:15:30 +00:00
Ariff Abdullah
a799d1cd22 - LNV -> LENOVO
- Fix support for Samsung Q1 UltraMobile PC (inverted EAPD).

Reported by:	benno
2006-11-27 06:16:36 +00:00
Ariff Abdullah
a580b31a54 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.
2006-11-26 12:24:06 +00:00
Alexander Leidinger
4bc4dc4c4b MFP4 (109713):
Add OSS_GETVERSION ioctl for compatibility.

Some ports expect this and fail to compile on -current ATM.

Submitted by:	ryanb
2006-11-26 11:55:48 +00:00
Alexander Leidinger
394ebd352c MFP4:
Rename MAX_SAMPLE_RATES macro to OSS_MAX_SAMPLE_RATES.  The old
	macro clashed with those used in other applications and libaries
	(ex: RtAudio).  4Front responded by updating their spec, so we
	will follow suit.

Submitted by:	ryanb
Noticed by:	pointyhat/kris
2006-10-28 09:51:10 +00:00
Ariff Abdullah
55be51bf55 - Inverted EAPD quirk for ASUS A8Jc.
- Take the literal meaning of eapdbtl, but do the inversion during
  write.

Tested by:	Chung-liang Wei <idreamer@gmail.com>
2006-10-16 14:43:22 +00:00
Ariff Abdullah
503ee05bc3 Wrap debug printfs into SEQ_DEBUG() to avoid kernel messages clutter
during module unload.
2006-10-15 08:23:48 +00:00
Ariff Abdullah
1409858b3b - Fix support for ASUS U5F laptop. This laptop (and possibly others)
need a special inverted EAPD quirk.
- Add "eapdinv" config for future testing purposes.

Tested by:	Yuriy Tsibizov <Yuriy.Tsibizov@gfk.ru>
          	#freebsd-azalia @ irc.freenode.net
2006-10-12 15:37:43 +00:00
Ariff Abdullah
0b414ccace Fix support for IBM/Lenovo Thinkcentre M52 series. Its vendorid / 0x1014
accidentally match with HP vendorid / 0x103c.

Reported by:	Robert Noland <rnoland@2hip.net>
2006-10-12 04:19:37 +00:00
Ariff Abdullah
bfb06714ec Added few more pci ids for Intel, ATI, NVidia, VIA and SiS. 2006-10-08 18:51:58 +00:00
Alexander Leidinger
0f85b689a5 Remove unnecessary test case. (As written, that branch will never
be followed.)

Submitted by:	ryanb
Found with:	Coverity Prevent
CID:		239860
2006-10-08 17:13:54 +00:00
Ariff Abdullah
8d999aa8a1 - Fix wrong id for ALC882, add ALC883 id.
- Add support for the Conexant Waikiki/CX20551-22, found
  in most Toshiba P100 series laptops. Despite of growing
  urban legend of "unsupported Conexant", this codec is fully
  supported in this driver.
  Note: Toshiba P100 has broken (acpi) BIOS, thus rendering
        its soundchip useless. Please disable ACPI, or get
        BIOS updates (if any).

  Found/tested by: Vulpes Velox <v.velox@vvelox.net>
  URL: http://lists.freebsd.org/pipermail/freebsd-multimedia/2006-September/004896.html

- Parser cleanups to handle possible oss/mixer collision. Found
  after parsing Conexant Waikiki nodes.

- Increase resilient against resource failure during attach/detach.

- Implement simple config through hint.pcm.<unit>.config. Supported
  options:
    gpio0 (default on Acer), gpio1, gpio2, softpcmvol,
    fixedrate (default), forcestereo (default)
  * Option prefixed with "no" (such as "nofixedrate") will do
    the opposite.
  * Options can be separated using space " " or comma ",".
  * The "no" option will take precedence over anything else.
  Example:
    hint.pcm.0.config="gpio2,nofixedrate,noforcestereo,nogpio0,softpcmvol"
    hint.pcm.0.config="softpcmvol noforcestereo"
2006-10-06 18:59:27 +00:00