aboutsummaryrefslogtreecommitdiff
path: root/sys/dev/sound/pci/cs4281.c
Commit message (Collapse)AuthorAgeFilesLines
* sound: Make device registration more intuitiveChristos Margiolis2024-11-031-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | The way a sound driver currently registers to sound(4) is using the following sequence of function calls: 1. pcm_register() to initialize snddev_info. 2. pcm_addchan() calls to create the device's primary channels. 3. pcm_setstatus() to do the final setup. While using 3 different functions in a specific order might not be very elegant, this pattern cannot be easily avoided. However, pcm_register() and pcm_setstatus() are especially confusing, since one would intuitively expect: 1. pcm_register() to actually do the registration, as opposed to a basic initialization. 2. pcm_setstatus() to, as the name suggests, set some kind of status, as opposed to finalizing the registration. This patch renames pcm_register() to pcm_init(), and pcm_setstatus() to pcm_register(). Drivers are modified accordingly. Sponsored by: The FreeBSD Foundation MFC after: 1 week Reviewed by: dev_submerge.ch Differential Revision: https://reviews.freebsd.org/D47325
* sound: remove PCM_KLDSTRING() and fix status stringsChristos Margiolis2024-01-161-3/+4
| | | | | | | | | | | | | | | | | 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
* sys: Remove SND_DECLARE_FILEJohn Baldwin2023-08-181-2/+0
| | | | | Reviewed by: kbowling, imp, emaste Differential Revision: https://reviews.freebsd.org/D41499
* sys: Remove $FreeBSD$: sound driver versionWarner Losh2023-08-161-1/+1
| | | | Remove /SND_DECLARE_FILE\("\$FreeBSD\$"\);/
* spdx: The BSD-2-Clause-FreeBSD identifier is obsolete, drop -FreeBSDWarner Losh2023-05-121-1/+1
| | | | | | | | | 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
* Remove pcm_devclass from DRIVER_MODULE invocations.John Baldwin2022-05-061-1/+1
|
* cs4281: eliminate write only variable codecnoWarner Losh2022-04-051-4/+0
| | | | Sponsored by: Netflix
* sound(4): Remove pointless Giant from bus_dma_tag_create().Alexander Motin2021-09-041-2/+2
| | | | | | None of the drivers really implement asynchronous buffer loading, so they don't need lock there. The only question is which of them have BUS_DMA_NOWAIT flag there already, and to which it should be added.
* 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
* Use uintmax_t (typedef'd to rman_res_t type) for rman ranges.Justin Hibbits2016-03-181-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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 Notes: svn path=/head/; revision=297000
* Replace several bus_alloc_resource() calls with bus_alloc_resource_any()Justin Hibbits2016-02-271-6/+5
| | | | | | | | | | | Most of these are BARs, and we allocate them in their entirety. The one outlier in this is amdsbwd, which calls bus_set_resource() prior. Reviewed by: jhb Differential Revision: https://reviews.freebsd.org/D5370 (partial) Notes: svn path=/head/; revision=296135
* Remove check for obsolete FreeBSD versionsBaptiste Daroussin2014-11-031-12/+0
| | | | | | | | PR: 194517 Submitted by: François Tigeot <ftigeot@wolfpond.org> Notes: svn path=/head/; revision=274035
* Update PCI drivers to no longer look at the MEMIO-enabled bit in the PCIScott Long2013-08-121-4/+1
| | | | | | | | | | | | | | | | | | | | command register. The lazy BAR allocation code in FreeBSD sometimes disables this bit when it detects a range conflict, and will re-enable it on demand when a driver allocates the BAR. Thus, the bit is no longer a reliable indication of capability, and should not be checked. This results in the elimination of a lot of code from drivers, and also gives the opportunity to simplify a lot of drivers to use a helper API to set the busmaster enable bit. This changes fixes some recent reports of disk controllers and their associated drives/enclosures disappearing during boot. Submitted by: jhb Reviewed by: jfv, marius, achadd, achim MFC after: 1 day Notes: svn path=/head/; revision=254263
* Sound Mega-commit. Expect further cleanup until code freeze.Ariff Abdullah2009-06-071-26/+33
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* Separate comments from the license text.Joel Dahl2009-05-271-1/+3
| | | | Notes: svn path=/head/; revision=192919
* Flush remaining malloc() cleanups (M_NOWAIT -> M_WAITOK).Ariff Abdullah2007-06-171-5/+1
| | | | Notes: svn path=/head/; revision=170873
* Filter/compress the amount of channel trigger. This should reduceAriff Abdullah2007-06-111-0/+1
| | | | | | | | | | much of lock/unlock contentions within the interrupt handler. Most of these drivers only need PCMTRIG_START or STOP (ABORT). Discussed with: scottl Notes: svn path=/head/; revision=170521
* sndbuf_alloc() now accept dmaflags argument which will be forwarded toAriff Abdullah2007-04-181-1/+1
| | | | | | | | internal bus_dmammem_alloc() for greater flexibility on setting up DMA / page attributes. Notes: svn path=/head/; revision=168847
* MFp4 (114068):Alexander Leidinger2007-02-231-1/+2
| | | | | | | | | | | | | 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 Notes: svn path=/head/; revision=166904
* Use BUS_PROBE_DEFAULT in preference to 0 and BUS_PROBE_LOW_PRIORITY inWarner Losh2005-03-011-1/+1
| | | | | | | | preference to some random negative number to allow other drivers a bite at the apple. Notes: svn path=/head/; revision=142890
* Start each of the license/copyright comments with /*-, minor shuffle of linesWarner Losh2005-01-061-1/+1
| | | | Notes: svn path=/head/; revision=139749
* Rename the sound device drivers:Seigo Tanimura2004-07-161-1/+1
| | | | | | | | | | | | | | | | | - `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 Notes: svn path=/head/; revision=132236
* Convert callers to the new bus_alloc_resource_any(9) API.Nate Lawson2004-03-171-2/+2
| | | | | | | | Submitted by: Mark Santcroos <marks@ripe.net> Reviewed by: imp, dfr, bde Notes: svn path=/head/; revision=127135
* Augment /dev/sndstat with the module names, if applicable.Mathew Kanner2004-03-061-2/+2
| | | | | | | Approved by: tanimura (mentor) Notes: svn path=/head/; revision=126695
* Use PCIR_BAR(x) instead of PCIR_MAPS.John Baldwin2003-09-021-2/+2
| | | | | | | | Glanced over by: imp, gibbs Tested by: i386 LINT Notes: svn path=/head/; revision=119690
* Prefer new location of pci include files (which have only been in theWarner Losh2003-08-221-2/+2
| | | | | | | | tree for two or more years now), except in a few places where there's code to be compatible with older versions of FreeBSD. Notes: svn path=/head/; revision=119287
* Mega busdma API commit.Scott Long2003-07-011-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | 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 Notes: svn path=/head/; revision=117126
* Implement a "sndbuf_getbufaddr" function and use it instead of vtophys().Olivier Houchard2003-02-201-1/+1
| | | | | | | Reviewed by: orion Notes: svn path=/head/; revision=111183
* Consolidate MIN/MAX macros into one place (param.h).Alfred Perlstein2003-02-021-3/+0
| | | | | | | Submitted by: Hiten Pandya <hiten@unixdaemons.com> Notes: svn path=/head/; revision=110232
* s/AC97_MIX_PHONES/AC97_MIX_AUXOUT/ to match ac97r2.{2,3}.Orion Hodson2002-08-231-1/+1
| | | | | | | | | | | | | | | 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". Notes: svn path=/head/; revision=102302
* use pcm_getbuffersize()Orion Hodson2001-10-101-5/+9
| | | | Notes: svn path=/head/; revision=84771
* Return updated blocksize from setblocksize function.Orion Hodson2001-09-031-1/+1
| | | | Notes: svn path=/head/; revision=82837
* Fix return value of cs4281chan_setblocksize.Orion Hodson2001-09-031-1/+1
| | | | Notes: svn path=/head/; revision=82836
* many changes:Cameron Grant2001-08-231-3/+3
| | | | | | | | | | | | | | | | | | * 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. Notes: svn path=/head/; revision=82180
* Use the M_ZERO flag to malloc(9)George C A Reid2001-06-211-2/+1
| | | | | | | | Reviewed by: cg MFC after: 1 week Notes: svn path=/head/; revision=78564
* use a global devclass for all drivers - i'm not entirely sure why thisCameron Grant2001-06-161-3/+1
| | | | | | | | | | | | | | | | | | worked before. mixer, dsp and sndstat are seperate devices - give them their own cdevsws instead of demuxing requests sent to a single cdevsw. use the si_drv1/si_drv2 fields in dev_t structures for holding information specific to an open instance of mixer/dsp. nuke /dev/{dsp,dspW,audio}[0-9]* links - this functionality is now provided using cloning. various locking fixes. Notes: svn path=/head/; revision=78362
* Add power on to start sequence for 4.x kernels.Orion Hodson2001-04-191-2/+11
| | | | | | | | PR: kern/26255 Submitted by: WATANABE Kiyoshi <aab10490@pop16.odn.ne.jp> Notes: svn path=/head/; revision=75702
* mega-commit.Cameron Grant2001-03-241-7/+7
| | | | | | | | | | | | | | | | | | this introduces a new buffering mechanism which results in dramatic simplification of the channel manager. as several structures have changed, we take the opportunity to move their definitions into the source files where they are used, make them private and de-typedef them. the sound drivers are updated to use snd_setup_intr instead of bus_setup_intr, and to comply with the de-typedefed structures. the ac97, mixer and channel layers have been updated with finegrained locking, as have some drivers- not all though. the rest will follow soon. Notes: svn path=/head/; revision=74763
* only mess with the power state on 5.xCameron Grant2001-03-051-1/+2
| | | | Notes: svn path=/head/; revision=73770
* add power management support.Cameron Grant2001-02-131-91/+101
| | | | | | | Submitted by: Orion Hodson <O.Hodson@cs.ucl.ac.uk> Notes: svn path=/head/; revision=72455
* add driver for CS4281 sound chipsCameron Grant2001-02-041-0/+961
Submitted by: Orion Hodson <O.Hodson@cs.ucl.ac.uk> Notes: svn path=/head/; revision=72017