aboutsummaryrefslogtreecommitdiff
path: root/sys/dev/sound/pcm/ac97.c
Commit message (Collapse)AuthorAgeFilesLines
* sys/dev: further adoption of SPDX licensing ID tags.Pedro F. Giffuni2017-11-271-0/+2
| | | | | | | | | | | | | | | 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. Notes: svn path=/head/; revision=326255
* Mark MALLOC_DEFINEs static that have no corresponding MALLOC_DECLAREs.Ed Schouten2011-11-071-1/+1
| | | | | | | This means that their use is restricted to a single C file. Notes: svn path=/head/; revision=227293
* Sound Mega-commit. Expect further cleanup until code freeze.Ariff Abdullah2009-06-071-13/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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. Notes: svn path=/head/; revision=193640
* Remap and virtualize mixer controls for HP nx6110 withAriff Abdullah2007-10-261-2/+26
| | | | | | | | | | | | | AD1981B AC97 codec, unifying master volume control. * Remap "phout" --> SOUND_MIXER_VOLUME (internal speakers) * Virtual "vol" --> { "phout", "ogain" (headphone) } Tested by: Frederic Chardon MFC after: 3 days Notes: svn path=/head/; revision=173039
* Flush remaining malloc() cleanups (M_NOWAIT -> M_WAITOK).Ariff Abdullah2007-06-171-4/+1
| | | | Notes: svn path=/head/; revision=170873
* - Do triple reads on reset register to detect read register bug. 2 readsAriff Abdullah2007-06-051-12/+15
| | | | | | | | | | seems not enough to verify its consistencies. - Define AC97_MIXER_SIZE as SOUND_MIXER_NRDEVICES (25), since we don't need more than that. Stop doing wild and random guess about its size since we're stricly bound to it. Notes: svn path=/head/; revision=170342
* Despite several examples in the kernel, the third argument ofDavid Malone2007-06-041-1/+1
| | | | | | | | | | | | | | | | sysctl_handle_int is not sizeof the int type you want to export. The type must always be an int or an unsigned int. Remove the instances where a sizeof(variable) is passed to stop people accidently cut and pasting these examples. In a few places this was sysctl_handle_int was being used on 64 bit types, which would truncate the value to be exported. In these cases use sysctl_handle_quad to export them and change the format to Q so that sysctl(1) can still print them. Notes: svn path=/head/; revision=170289
* Use standard pcm_get/setflags() rather than dereferencing softc whileAriff Abdullah2007-06-021-4/+2
| | | | | | | enabling SD_F_SOFTPCMVOL or any flags. Notes: svn path=/head/; revision=170207
* Fix broken "rec" and "igain" introduced by previous commit. ConvertAriff Abdullah2007-05-281-1/+1
| | | | | | | | reg to a full blown int since there's not much gain compacting it, and we do need its signess. Notes: svn path=/head/; revision=170060
* Fix broken binary issues with latest gcc 4.x due to bitfield signessAriff Abdullah2007-05-271-1/+1
| | | | | | | | | mishaps for emu10k1 [1] and few other places. Reported/Submitted/Tested by: Ed Schouten <ed@fxq.nl> [1] Notes: svn path=/head/; revision=170032
* - AC97 quirk / patch cleanups. Most quirks doesn't work in general senseAriff Abdullah2007-04-191-11/+18
| | | | | | | | | | | | | and should only be applied on certain specific card / vendor, hence the addition of ac97_getsubvendor(). - Fix low volume issue on several MSI laptops through ALC655 quirk. Reported/Tested by: Christian Mueller <raptor-freebsd-multimedia@xpls.de> MFC after: 1 week Notes: svn path=/head/; revision=168861
* Spring cleanup on irrelevant NULL checking over M_WAITOK allocations.Ariff Abdullah2007-03-151-7/+0
| | | | Notes: svn path=/head/; revision=167611
* Enable tone / 3D controls for YAMAHA YMF743, 753 and 752 (partially).Ariff Abdullah2007-03-061-0/+17
| | | | | | | | PR: kern/109599 Submitted by: Watanabe Kazuhiro <CQG00620@nifty.ne.jp> Notes: svn path=/head/; revision=167256
* Welcome to Once-a-year Sound Mega-Commit. Enjoy numerous updates and fixesAriff Abdullah2006-11-261-18/+86
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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. Notes: svn path=/head/; revision=164614
* Backout remaining changes that make most AD1981B users unhappy.Ariff Abdullah2006-10-021-0/+2
| | | | | | | | The exact situation is understood, and proper solution will follow sooner. Notes: svn path=/head/; revision=162974
* Various fixups, especially for the upcomming High Definition AudioAriff Abdullah2006-09-281-40/+50
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | commit. 1) sys/dev/sound/pcm/sound.h sys/dev/sound/pcm/channel.c * Be more specific: SD_F_SOFTVOL -> SD_F_SOFTPCMVOL 2) sys/dev/sound/pcm/mixer.[ch] * Implement mix_setparentchild() mix_setrealdev() mix_getparent() mix_getchild() The purpose of these functions is implement relative volume adjustment, such as to tie two or more mixer device into a single logical device. Usefull for the upcoming HDA driver and few AC97 codec (such as AD1981B) where the master volume "vol" need to be implemented using this logical manner. 3) sys/dev/sound/pcm/ac97_patch.[ch] * Patch for AD1981B codec to enable (automuting) headphone jack sense. 4) sys/dev/sound/pcm/ac97.c * Implement proper logical master volume for AD9181B codec through various mix_set{parentchild,realdev}(). Tie both "ogain" (headphone volume) and "phone" (speaker/lineout) to a logical "vol". 5) sys/dev/sound/pcm/usb/uaudio_pcm.c * ditto, for "vol" -> { "pcm" }. MFC after: 1 month Notes: svn path=/head/; revision=162738
* Add codec id support for Analog Device AD1986 AC'97 codec.Ariff Abdullah2006-01-071-0/+1
| | | | | | | | | Submitted by: UMENO Takashi <umeno at rr.iij4u.or.jp> PR: kern/80234 MFC after: 2 days Notes: svn path=/head/; revision=154094
* Few codec such as Conexant CX20468-21 does have this controlAriff Abdullah2005-12-301-0/+7
| | | | | | | | | register, although the only usable part is the mute bit. Noticed by: Hans Petter Selasky <hselasky@c2i.net> Notes: svn path=/head/; revision=153865
* Add codec ID for Avance Logic ALC203Pyun YongHyeon2005-11-301-0/+1
| | | | Notes: svn path=/head/; revision=152939
* Added codec id for Avance Logic (ALC250)Ariff Abdullah2005-11-261-0/+1
| | | | Notes: svn path=/head/; revision=152815
* ac97.c:Ariff Abdullah2005-11-141-2/+2
| | | | | | | | | | | | | | | | | - Added new codec id for CX20468-21 and VIA1617A. Submitted by: Chen Lihong <lihong.chen@gmail.com> - Re-enable SOUND_MIXER_IGAIN, but set the default level as 0 (mute) Suggested by: luigi mixer.c: - Set default value for SOUND_MIXER_IGAIN as 0 (mute) to avoid feedback problems on some laptops (was disabled by jhb during ac97.c revision 1.42). Approved by: netchild (mentor) Notes: svn path=/head/; revision=152422
* sys/dev/sound/pcm/ac97.c:Alexander Leidinger2005-10-021-1/+42
| | | | | | | | | | | | | | | | | | | | | | * Added codec id for CMI9761. * feeder_volume *whitelist* through ac97_fix_volume() sys/dev/sound/pcm/ac97.h: * Added AC97_F_SOFTVOL definition. sys/dev/sound/pcm/channel.c: * Slight changes for chn_setvolume() to conform with OSS. * FEEDER_VOLUME is now part of feeder building process. sys/dev/sound/pcm/mixer.c: * General spl* cleanup. It doesn't serve any purpose anymore. * Main hook for feeder_volume. Submitted by: Ariff Abdullah <skywizard@MyBSD.org.my> Tested by: multimedia@ Notes: svn path=/head/; revision=150825
* - Few buggy codecs (STAC9704, probably others) return inconsistentAlexander Leidinger2005-09-101-24/+83
| | | | | | | | | | | | ac97_rdcd() value. Enable aggresive workaround. - Fix mixer resolution detection for 5/6 bit register, carefully not to overflow others. PR: 84728 Submitted by: Ariff Abdullah <skywizard@MyBSD.org.my> Notes: svn path=/head/; revision=149949
* * Slightly new method to detect mixer capabilities and resolution.Alexander Leidinger2005-07-311-9/+41
| | | | | | | | | | | | | | | This mostly to help CT4730, but apparently it does help other cards too (especially via8233x). This probably need further test and confirmation from other people with ac97 cards other than via / es137x. * Aggresive dac power wake up call, again, to help CT4730 (and probably others). Submitted by: Ariff Abdullah <skywizard@MyBSD.org.my> Tested by: multimedia@ Notes: svn path=/head/; revision=148602
* Fix the output ports on the AD1988 codec. From the submitter:Scott Long2005-04-101-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | Affects to people WITH an AD1888 codec, the system will output to the port labeled "speaker" instead of microphone. System will work the same in multiple operating systems. If people are currently using their systems with this codec they will need to swap their output ports. I have _not_ checked audio input or line input (basically, I have checked nothing other than line-out). I believe this is an appropriate change, it makes us consistent with documentation, and other operating systems. Furthermore, this feature (playing) is the vast majority of sound activities, so if this makes is right for playback and wrong for recording... playback is more important, and we can fix recoding in the future without worries of screwing people again in the future (since we'll be "right" on the playback). Submitted by: David Cross Notes: svn path=/head/; revision=144865
* Start each of the license/copyright comments with /*-, minor shuffle of linesWarner Losh2005-01-061-1/+1
| | | | Notes: svn path=/head/; revision=139749
* Add support CS4294MIHIRA Sanpei Yoshiro2004-05-081-0/+1
| | | | | | | | PR: kern/66280 Submitted by: Christian Brueffer <chris@unixpages.org> Notes: svn path=/head/; revision=129044
* Sync with DFBSD v.1.16. Add new codecs IDs, fix some spelling.Mathew Kanner2004-01-231-3/+21
| | | | | | | Approved by: des (interim mentor) Notes: svn path=/head/; revision=124875
* Add ID for ALC658 CODEC.Jun Kuriyama2003-11-111-0/+1
| | | | | | | | Tested on: GIGABYTE GA-8S655FX-L Reviewed by: orion Notes: svn path=/head/; revision=122515
* Recognize the Avance Logic ALC655 codec found on some ICH4/5-basedDag-Erling Smørgrav2003-10-121-0/+1
| | | | | | | | | | | motherboards, such as the Gigabyte I848P. PR: kern/54176 Submitted by: Chris Keladis <chris@cmc.optus.net.au> Forgotten by: orion Notes: svn path=/head/; revision=121032
* update my email address.Cameron Grant2003-09-071-1/+1
| | | | Notes: svn path=/head/; revision=119853
* Add Creative EV1938.Orion Hodson2003-08-291-0/+2
| | | | | | | | Submitted by: David Xu <davidxu@FreeBSD.org> PR: kern/54810 Notes: svn path=/head/; revision=119547
* When present use ogain instead of master for surround sound channels.Orion Hodson2003-08-231-14/+14
| | | | | | | | | The latter has lead to reports of broken audio. Do not swap ogain and master when headphones detected. Notes: svn path=/head/; revision=119375
* Additional VT1616 id.Orion Hodson2003-08-211-1/+1
| | | | | | | Submitted by: Greg Lewis Notes: svn path=/head/; revision=119250
* Apply Rudolf Cejka's patch for:Orion Hodson2003-08-211-46/+41
| | | | | | | | | | | | | | | o AD1980 hook. o ac97_fix_auxout. and: o Associate AC97_MIX_AUXOUT with SOUND_MIXER_OGAIN rather than SOUND_MIXER_MONITOR. o Add ac97_fix_tone to remove tone controls from mixer if invalid. Notes: svn path=/head/; revision=119209
* Comment out the mixer entry for igain for the mic 20dB boost for now sinceJohn Baldwin2003-04-231-0/+2
| | | | | | | | | it can cause feedback problems on some laptops. Reviewed by: orion Notes: svn path=/head/; revision=113907
* Add eMicro codec ids.Orion Hodson2003-04-211-1/+4
| | | | Notes: svn path=/head/; revision=113788
* Use SOUND_MIXER_IGAIN to toggle 20dB mic boost for want of a betterOrion Hodson2003-04-211-18/+50
| | | | | | | | | | | place for it. Assorted comments. Submitted by: luigi Notes: svn path=/head/; revision=113783
* Additional codec ids.Orion Hodson2003-04-041-0/+6
| | | | Notes: svn path=/head/; revision=113057
* Correct vendor id for ALC101.Orion Hodson2003-03-201-1/+1
| | | | Notes: svn path=/head/; revision=112434
* Correct CS4205 base vendor id.Orion Hodson2003-03-121-1/+1
| | | | | | | Reported by: Christophe Juniet and Mark Santcroos. Notes: svn path=/head/; revision=112150
* o Move vendor ids into separate table.Orion Hodson2003-02-281-62/+139
| | | | | | | o Add assorted vendor and codec ids. Notes: svn path=/head/; revision=111679
* Add the ID for the CS4205 codec found in Dell laptops. Obtained fromScott Long2003-02-271-0/+1
| | | | | | | the CS4205 spec. Notes: svn path=/head/; revision=111590
* Add SigmaTel STAC9750 entry.Olivier Houchard2003-02-261-0/+1
| | | | | | | Submitted by: Paulius Bulotas <paulius.bulotas@microlink.lt> Notes: svn path=/head/; revision=111561
* Back out M_* changes, per decision of the TRB.Warner Losh2003-02-191-1/+1
| | | | | | | Approved by: trb Notes: svn path=/head/; revision=111119
* Print ac97 name/id on normal boot.Orion Hodson2003-02-031-6/+9
| | | | | | | Fix typo reported in pr misc/47794. Notes: svn path=/head/; revision=110258
* Add ac97_patch.[ch] that provide space for ac97 codec specific patches.Orion Hodson2003-01-251-74/+83
| | | | Notes: svn path=/head/; revision=109818
* Remove M_TRYWAIT/M_WAITOK/M_WAIT. Callers should use 0.Alfred Perlstein2003-01-211-1/+1
| | | | | | | Merge M_NOWAIT/M_DONTWAIT into a single flag M_NOWAIT. Notes: svn path=/head/; revision=109623
* Add Realtek ALC650 id.Orion Hodson2003-01-131-0/+1
| | | | | | | | Submitted by: "Mikko S. Hyvarinen" <morphy@morphy.iki.fi> MFC after: 5 days Notes: svn path=/head/; revision=109183
* (hopefully) fix build breakage some people are seeingCameron Grant2002-11-261-9/+9
| | | | | | | Approved by: re Notes: svn path=/head/; revision=107285