summaryrefslogtreecommitdiffstats
path: root/sys/dev/sound/pcm/ac97.c
Commit message (Collapse)AuthorAgeFilesLines
* Mark MALLOC_DEFINEs static that have no corresponding MALLOC_DECLAREs.ed2011-11-071-1/+1
| | | | This means that their use is restricted to a single C file.
* Sound Mega-commit. Expect further cleanup until code freeze.ariff2009-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.
* Remap and virtualize mixer controls for HP nx6110 withariff2007-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
* Flush remaining malloc() cleanups (M_NOWAIT -> M_WAITOK).ariff2007-06-171-4/+1
|
* - Do triple reads on reset register to detect read register bug. 2 readsariff2007-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.
* Despite several examples in the kernel, the third argument ofdwmalone2007-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.
* Use standard pcm_get/setflags() rather than dereferencing softc whileariff2007-06-021-4/+2
| | | | enabling SD_F_SOFTPCMVOL or any flags.
* Fix broken "rec" and "igain" introduced by previous commit. Convertariff2007-05-281-1/+1
| | | | | reg to a full blown int since there's not much gain compacting it, and we do need its signess.
* Fix broken binary issues with latest gcc 4.x due to bitfield signessariff2007-05-271-1/+1
| | | | | | mishaps for emu10k1 [1] and few other places. Reported/Submitted/Tested by: Ed Schouten <ed@fxq.nl> [1]
* - AC97 quirk / patch cleanups. Most quirks doesn't work in general senseariff2007-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
* Spring cleanup on irrelevant NULL checking over M_WAITOK allocations.ariff2007-03-151-7/+0
|
* Enable tone / 3D controls for YAMAHA YMF743, 753 and 752 (partially).ariff2007-03-061-0/+17
| | | | | PR: kern/109599 Submitted by: Watanabe Kazuhiro <CQG00620@nifty.ne.jp>
* Welcome to Once-a-year Sound Mega-Commit. Enjoy numerous updates and fixesariff2006-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.
* Backout remaining changes that make most AD1981B users unhappy.ariff2006-10-021-0/+2
| | | | | The exact situation is understood, and proper solution will follow sooner.
* Various fixups, especially for the upcomming High Definition Audioariff2006-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
* Add codec id support for Analog Device AD1986 AC'97 codec.ariff2006-01-071-0/+1
| | | | | | Submitted by: UMENO Takashi <umeno at rr.iij4u.or.jp> PR: kern/80234 MFC after: 2 days
* Few codec such as Conexant CX20468-21 does have this controlariff2005-12-301-0/+7
| | | | | | register, although the only usable part is the mute bit. Noticed by: Hans Petter Selasky <hselasky@c2i.net>
* Add codec ID for Avance Logic ALC203yongari2005-11-301-0/+1
|
* Added codec id for Avance Logic (ALC250)ariff2005-11-261-0/+1
|
* ac97.c:ariff2005-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)
* sys/dev/sound/pcm/ac97.c:netchild2005-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@
* - Few buggy codecs (STAC9704, probably others) return inconsistentnetchild2005-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>
* * Slightly new method to detect mixer capabilities and resolution.netchild2005-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@
* Fix the output ports on the AD1988 codec. From the submitter:scottl2005-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
* Start each of the license/copyright comments with /*-, minor shuffle of linesimp2005-01-061-1/+1
|
* Add support CS4294sanpei2004-05-081-0/+1
| | | | | PR: kern/66280 Submitted by: Christian Brueffer <chris@unixpages.org>
* Sync with DFBSD v.1.16. Add new codecs IDs, fix some spelling.matk2004-01-231-3/+21
| | | | Approved by: des (interim mentor)
* Add ID for ALC658 CODEC.kuriyama2003-11-111-0/+1
| | | | | Tested on: GIGABYTE GA-8S655FX-L Reviewed by: orion
* Recognize the Avance Logic ALC655 codec found on some ICH4/5-baseddes2003-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
* update my email address.cg2003-09-071-1/+1
|
* Add Creative EV1938.orion2003-08-291-0/+2
| | | | | Submitted by: David Xu <davidxu@FreeBSD.org> PR: kern/54810
* When present use ogain instead of master for surround sound channels.orion2003-08-231-14/+14
| | | | | | The latter has lead to reports of broken audio. Do not swap ogain and master when headphones detected.
* Additional VT1616 id.orion2003-08-211-1/+1
| | | | Submitted by: Greg Lewis
* Apply Rudolf Cejka's patch for:orion2003-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.
* Comment out the mixer entry for igain for the mic 20dB boost for now sincejhb2003-04-231-0/+2
| | | | | | it can cause feedback problems on some laptops. Reviewed by: orion
* Add eMicro codec ids.orion2003-04-211-1/+4
|
* Use SOUND_MIXER_IGAIN to toggle 20dB mic boost for want of a betterorion2003-04-211-18/+50
| | | | | | | | place for it. Assorted comments. Submitted by: luigi
* Additional codec ids.orion2003-04-041-0/+6
|
* Correct vendor id for ALC101.orion2003-03-201-1/+1
|
* Correct CS4205 base vendor id.orion2003-03-121-1/+1
| | | | Reported by: Christophe Juniet and Mark Santcroos.
* o Move vendor ids into separate table.orion2003-02-281-62/+139
| | | | o Add assorted vendor and codec ids.
* Add the ID for the CS4205 codec found in Dell laptops. Obtained fromscottl2003-02-271-0/+1
| | | | the CS4205 spec.
* Add SigmaTel STAC9750 entry.cognet2003-02-261-0/+1
| | | | Submitted by: Paulius Bulotas <paulius.bulotas@microlink.lt>
* Back out M_* changes, per decision of the TRB.imp2003-02-191-1/+1
| | | | Approved by: trb
* Print ac97 name/id on normal boot.orion2003-02-031-6/+9
| | | | Fix typo reported in pr misc/47794.
* Add ac97_patch.[ch] that provide space for ac97 codec specific patches.orion2003-01-251-74/+83
|
* Remove M_TRYWAIT/M_WAITOK/M_WAIT. Callers should use 0.alfred2003-01-211-1/+1
| | | | Merge M_NOWAIT/M_DONTWAIT into a single flag M_NOWAIT.
* Add Realtek ALC650 id.orion2003-01-131-0/+1
| | | | | Submitted by: "Mikko S. Hyvarinen" <morphy@morphy.iki.fi> MFC after: 5 days
* (hopefully) fix build breakage some people are seeingcg2002-11-261-9/+9
| | | | Approved by: re
* s/AC97_MIX_PHONES/AC97_MIX_AUXOUT/ to match ac97r2.{2,3}.orion2002-08-231-4/+35
| | | | | | | | | | | | Attempt to determine what function of AUX_OUT is: "True line level out", "Headphone out", or "4-Channel out" and frig OSS mixer label accordingly. Addresses problem raised by Randy Bush on -multimedia of not being able to hear audio on ich2 m/b which was eventually found to be because the mixer monitor value was 0. On this h/w the label "monitor" should now be presented as the marginally more intuitive "ogain".
OpenPOWER on IntegriCloud