Home | History | Annotate | Download | only in pci
History log of /src/sys/dev/pci/cs4281.c
RevisionDateAuthorComments
 1.61  07-Jan-2025  andvar Fix typos in the word 'Control' in comments.
 1.60  14-Sep-2024  andvar s/intterupt/interrupt/ in comments.
 1.59  20-Dec-2023  thorpej branches: 1.59.2;
Remove unnecessary <sys/malloc.h>.
 1.58  29-Mar-2022  riastradh cs4281(4): Fix lock ordering in suspend.

No idea if this code works -- obviously this path has never been
tested in the >decade it's been here!
 1.57  03-Feb-2021  isaki Remove code no longer used.
The code that used sc->{halt_input,halt_output} function pointer
was removed in 2004. (see cs428x.c rev 1.7)
 1.56  08-May-2020  simonb branches: 1.56.2;
Whitespace nit.
 1.55  08-May-2019  isaki Merge isaki-audio2 branch, the overhaul of audio subsystem.
- Interrupt-oriented system rather than thread-oriented.
- Improve stability, quality and performance.
- Split playback and record cleanly. Improve halfduplex support.
- Many bugs are fixed including deadlocks, resource leaks, abuses, etc.
- Simplify audio filter mechanism. The encoding/channels/frequency
conversions are completely handled in the upper layer. So the hard-
ware driver only converts its hardware encoding (if necessary).
- audio_hw_if changes:
- Obsoletes query_encoding and add query_format instead.
- Obsoletes set_params and add set_format instead.
- Remove drain, setfd, mappage.
- The call sequences are changed.
- ioctl AUDIO_GETFD/SETFD, AUDIO_GETCHAN/SETCHAN are obsoleted.
- ioctl AUDIO_{QUERY,GET,SET}FORMAT are introduced.
- cleanup config attributes: au*conv and mulaw.
- All hardware drivers should follow it (I've done as much as possible).

Some file paths are changed:
- dev/audio.c -> dev/audio/audio.c (rewritten)
- dev/audiovar.h -> dev/audio/audiovar.h
- dev/audio_dai.h -> dev/audio/audio_dai.h
- dev/audio_if.h -> dev/audio/audio_if.h
- dev/audiobell.c -> dev/audio/audiobell.c
- dev/audiobellvar.h -> dev/audio/audiobellvar.h
- dev/mulaw.[ch] -> dev/audio/mulaw.[ch] + dev/audio/alaw.c
 1.54  16-Mar-2019  isaki branches: 1.54.2;
Use C99 style struct initializer to audio_hw_if.
 1.53  09-Dec-2018  jdolecek use pci_intr_establish_xname() everywhere
 1.52  07-Jul-2016  msaitoh branches: 1.52.16; 1.52.18;
KNF. Remove extra spaces. No functional change.
 1.51  29-Mar-2014  christos branches: 1.51.6;
make pci_intr_string and eisa_intr_string take a buffer and a length
instead of relying in local static storage.
 1.50  16-Oct-2013  christos use __USE()
 1.49  16-Oct-2013  christos use variables that are only used in debugging.
 1.48  27-Oct-2012  chs branches: 1.48.2;
split device_t/softc for all remaining drivers.
replace "struct device *" with "device_t".
use device_xname(), device_unit(), etc.
 1.47  30-Jan-2012  drochner branches: 1.47.6;
Use pci_aprint_devinfo(9) instead of pci_devinfo+aprint_{normal,naive}
where it looks straightforward, and pci_aprint_devinfo_fancy in a few
others where drivers want to supply their own device names instead
of the pcidevs generated one. More complicated cases, where names
are composed at runtime, are left alone for now. It certainly makes
sense to simplify the drivers here rather than inventing a catch-all API.
This should serve as as example for new drivers, and also ensure
consistent output in the AB_QUIET ("boot -q") case. Also, it avoids
excessive stack usage where drivers attach child devices because the
buffer for the device name is not kept on the local stack anymore.
 1.46  24-Nov-2011  mrg branches: 1.46.2;
put back IPL_AUDIO and splaudio(), at the request of rmind. they are
aliases and now we can easily revert audio to IPL_VM if necessary,
without having to revert the whole branch.
 1.45  23-Nov-2011  jmcneill Merge jmcneill-audiomp3 branch, which is derived from ad-audiomp2. From
the original ad-audiomp branch notes:

Add MP locking to the audio drivers.

Making the audio drivers MP safe is necessary before efforts
can be made to make the VM system MP safe.

The are two locks per device instance, an ISR lock and
a character device lock. The ISR lock replaces calls to
splaudio()/splx(), and will be held across calls to device
methods which were called at splaudio() before (e.g.
trigger_output). The character device lock is held across
calls to nearly all of the methods, excluding some only
used for initialization, e.g. get_locks.

Welcome to 5.99.57.
 1.44  24-Feb-2010  dyoung branches: 1.44.10; 1.44.12;
A pointer typedef entails trading too much flexibility to declare const
and non-const types, and the kernel uses both const and non-const
PMF qualifiers and device suspensors, so change the pmf_qual_t and
device_suspensor_t typedefs from "pointers to const" to non-pointer,
non-const types.
 1.43  08-Jan-2010  dyoung branches: 1.43.2;
Expand PMF_FN_* macros.
 1.42  12-May-2009  cegger use device_private().
"looks good" ad@
XXX for the device_t/softc split, please check the driver that no cases have been missed.
 1.41  06-May-2009  cegger struct device * -> device_t, no functional changes intended.
 1.40  06-May-2009  cegger struct cfdata * -> cfdata_t, no functional changes intended.
 1.39  21-Mar-2008  dyoung branches: 1.39.4; 1.39.16; 1.39.18;
Use aprint_*_dev() instead of accessing struct device member dv_xname
directly.
 1.38  21-Mar-2008  dyoung pci_activate() expects for its void * argument to be a device_t,
so change the type of the argument to device_t. Update each use
of pci_activate().

Use device_t and accessors. Use aprint_*_dev().
 1.37  29-Feb-2008  dyoung Use PMF_FN_ARGS, PMF_FN_PROTO.
 1.36  09-Dec-2007  jmcneill branches: 1.36.6; 1.36.10;
Merge jmcneill-pm branch.
 1.35  19-Oct-2007  ad branches: 1.35.4; 1.35.6;
machine/{bus,cpu,intr}.h -> sys/{bus,cpu,intr}.h
 1.34  15-Jun-2007  joerg branches: 1.34.6; 1.34.8; 1.34.12;
Fix ACPI suspend/resume support of clcs and clct. Based on auich and
hints from jmcneill@.
 1.33  16-Nov-2006  christos branches: 1.33.2; 1.33.6; 1.33.8; 1.33.10; 1.33.16;
__unused removal on arguments; approved by core.
 1.32  12-Oct-2006  christos - sprinkle __unused on function decls.
- fix a couple of unused bugs
- no more -Wno-unused for i386
 1.31  24-Sep-2006  jmcneill Add "name" parameter to powerhook_establish, to aid debugging. No objections
on tech-kern@
 1.30  29-Aug-2006  christos branches: 1.30.2; 1.30.4;
fix incomplete initializer
 1.29  17-Jun-2006  christos re-factor the pci powestate api. reviewed by gimpy
 1.28  15-Apr-2006  jmcneill branches: 1.28.2; 1.28.4;
Add support for the Turtle Beach Santa Cruz. Special thanks to Stephane
Witzmann for spending so much time debugging this.

Fixes: kern/18880, kern/24488, port-i386/14260, kern/12603, kern/12723,
kern/24957, kern/23584

Tested on i386 (Stephane Witzmann), alpha (me).
 1.27  11-Dec-2005  christos branches: 1.27.4; 1.27.6; 1.27.8; 1.27.10; 1.27.12;
merge ktrace-lwp.
 1.26  28-Jun-2005  thorpej branches: 1.26.2;
Use ANSI function decls and static.
 1.25  06-Jun-2005  yamt cs4281_set_params: fix printf format.
 1.24  27-Feb-2005  perry nuke trailing whitespace
 1.23  15-Jan-2005  kent branches: 1.23.2; 1.23.4;
ansify and KNF
 1.22  10-Jan-2005  kent merge kent-audio1 branch, which introduces audio filter pipeline to the MI
audio framework


Summary of changes:

* struct audio_params
- remove sw_code, factor, factor_denom, hw_sample_rate,
hw_encoding ,hw_precision, and hw_channels. Conversion information
is conveyed by stream_filter_list_t.
- change the type of sample_rate: u_long -> u_int
- add `validbits,' which represents the valid data size in
precision bits. It is required in order to distinguish 24/32bit
from 24/24bit or 32/32bit.

* audio_hw_if
- add two parameters to set_params()
stream_filter_list_t *pfil, stream_filter_list *rfil
A HW driver should set filter recipes for requested formats
- constify audio_params parameters of trigger_output() and
trigger_input(). They represent audio formats for the hardware.
- make open() and close() optional
- add int (AUMODE_PLAY or AUMODE_RECORD) and audio_params_t parameters
to round_blocksize()

* sw_code is replaced with stream_filter_t.
stream_filer_t converts audio data in an input buffer and writes
into another output buffer unlike sw_code, which converts data in
single buffer.
converters in dev/auconv.c, dev/mulaw.c, dev/aurateconv.c,
dev/tc/bba.c, dev/ic/msm6258.c, and arch/arm/iomd/vidcaudio.c are
reimplemented as stream_filter_t

* MI audio
- audiosetinfo() builds filter pipelines from stream_filter_list_t
filled by audio_hw_if::set_params()
- audiosetinfo() returns with EINVAL if mmapped and set_params()
requests filters
- audio_write(), audio_pint(), and audio_rint() invoke a filter
pipeline.
- ioctl() for FIONREAD, AUDIO_WSEEK, AUDIO_GETIOFFS,
AUDIO_GETOOFFS, and audio_prinfo::{seek,samples} for
AUDIO_GETINFO handle values for a buffer nearest to userland.

* add `struct device *' parameter to ac97_attach()

* all of audio HW drivers follow audio_hw_if and ac97 changes
 1.21  02-Nov-2004  yamt branches: 1.21.2;
make recording of clct(4) work. namely,
- cs4281_intr: advance a pointer after copying data.
- cs4281_trigger_input: fix an inverted condition about dma mode.
 1.20  29-Oct-2004  yamt constify audio_hw_if, midi_hw_if, and radio_hw_if.
 1.19  22-Sep-2004  kent ac97_host_if::reset() returns non-zero value if codec reset fails, and
ac97 is not attached in that case.

PR: kern/26973
 1.18  09-Jul-2004  mycroft Attempt to make these safer against stray interrupts.
 1.17  23-Apr-2004  itojun pass string length (= boundary info) to pci_devinfo so that we do not run over
the end of memory region
 1.16  03-May-2003  wiz branches: 1.16.2; 1.16.4;
DMA, not dma nor Dma.
 1.15  31-Jan-2003  thorpej Use aprint_*().
 1.14  23-Dec-2002  tsutsui Replace magic numbers for power management control with PCI_PMCSR* macros.

XXX Should we use pci_get_powerstate() and pci_set_powerstate() in pci.c?
 1.13  02-Oct-2002  thorpej Add trailing ; to CFATTACH_DECL.
 1.12  30-Sep-2002  thorpej Use CFATTACH_DECL().
 1.11  27-Sep-2002  thorpej Declare all cfattach structures const.
 1.10  15-May-2002  simonb Print some error messages when the codec fails to initialise (some errors
were already reported, others weren't).
Sprinkle some KNF around.
 1.9  13-Dec-2001  tacha remove bogus printf.
 1.8  15-Nov-2001  lukem don't need <sys/types.h> when including <sys/param.h>
 1.7  13-Nov-2001  lukem add RCSID
 1.6  03-Oct-2001  augustss Add a new optional method, dev_ioctl, to the audio hardware driver interface.
It is called when an unrecognized ioctl() is performed on a device,
thus allowing ioctl()s that frob the hardware driver (like loading
microcode).
 1.5  16-Sep-2001  wiz Spell 'occurred' with two 'r's.
 1.4  18-Apr-2001  tacha branches: 1.4.2; 1.4.4; 1.4.6;
rewrite suspend/resume routine. If you suspend while playing audio,
clcs and clct continue playing when resume.
 1.3  07-Feb-2001  tacha branches: 1.3.2; 1.3.4;
Split out common code to cs428x.c and cosmetic change to introduce
higher symmetry between cs4280.c and cs4281.c.

Also fix the problem rebooting from Windows. Relevant patch is contributed
from Shingo WATANABE <nabe@nabechan.org>.
 1.2  22-Jan-2001  augustss Clean up a little.
 1.1  22-Jan-2001  augustss Add clct driver for Cirrus Logic CrystalClear PCI Audio CS4281.
Driver written by Tatoku Ogaito.
 1.3.4.8  29-Dec-2002  thorpej Sync with HEAD.
 1.3.4.7  18-Oct-2002  nathanw Catch up to -current.
 1.3.4.6  20-Jun-2002  nathanw Catch up to -current.
 1.3.4.5  08-Jan-2002  nathanw Catch up to -current.
 1.3.4.4  14-Nov-2001  nathanw Catch up to -current.
 1.3.4.3  08-Oct-2001  nathanw Catch up to -current.
 1.3.4.2  21-Sep-2001  nathanw Catch up to -current.
 1.3.4.1  21-Jun-2001  nathanw Catch up to -current.
 1.3.2.3  21-Apr-2001  bouyer Sync with HEAD
 1.3.2.2  11-Feb-2001  bouyer Sync with HEAD.
 1.3.2.1  07-Feb-2001  bouyer file cs4281.c was added on branch thorpej_scsipi on 2001-02-11 19:15:50 +0000
 1.4.6.2  11-Oct-2001  fvdl Catch up with -current. Fix some bogons in the sparc64 kbd/ms
attach code. cd18xx conversion provided by mrg.
 1.4.6.1  01-Oct-2001  fvdl Catch up with -current.
 1.4.4.3  10-Oct-2002  jdolecek sync kqueue with -current; this includes merge of gehenna-devsw branch,
merge of i386 MP branch, and part of autoconf rototil work
 1.4.4.2  23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.4.4.1  10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.4.2.4  27-Dec-2001  he Pull up revision 1.9 (requested by tacha):
Remove spurious warning which is no longer valid.
 1.4.2.3  29-Jul-2001  he Apply patch (requested by minoura):
Correct argument to pci_intr_map(). Fixes PR#13508.
 1.4.2.2  06-May-2001  he Pull up revisions 1.1-1.4 (new, via patch, requested by he):
Add driver for Cirrus Logic CrystalClear PCI Audio CS4281.
 1.4.2.1  18-Apr-2001  he file cs4281.c was added on branch netbsd-1-5 on 2001-05-06 15:12:08 +0000
 1.16.4.1  22-Sep-2004  jmc branches: 1.16.4.1.2;
Pullup rev 1.19 (requested by kent in ticket #867)

ac97_host_if::reset() returns non-zero value if codec reset fails, and
ac97 is not attached in that case. PR#26973
 1.16.4.1.2.1  30-Jan-2005  he Pull up revision 1.21 (requested by yamt in ticket #967):
Make recording of clct(4) work, namely:
o cs_4281_intr: advance a pointer after copying data
o cs_4281_trigger_input: fix an inverted condition about
dma mode
 1.16.2.9  10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.16.2.8  04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.16.2.7  17-Jan-2005  skrll Sync with HEAD.
 1.16.2.6  14-Nov-2004  skrll Sync with HEAD.
 1.16.2.5  02-Nov-2004  skrll Sync with HEAD.
 1.16.2.4  24-Sep-2004  skrll Sync with HEAD.
 1.16.2.3  21-Sep-2004  skrll Fix the sync with head I botched.
 1.16.2.2  18-Sep-2004  skrll Sync with HEAD.
 1.16.2.1  03-Aug-2004  skrll Sync with HEAD
 1.21.2.3  09-Jan-2005  kent audio_hw_if change
* make open() and close() optional
* add int (AUMODE_PLAY or AUMODE_RECORD) and audio_params_t parameters
to round_blocksize()
 1.21.2.2  03-Jan-2005  kent * remove stream_filter_list_append and stream_filter_list_prepend
* add stream_filter_list_t::{append(), prepend(), set()}
 1.21.2.1  02-Jan-2005  kent * adopt the filter pipeline framework
* follow ac97_attach() change
 1.23.4.1  19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.23.2.1  29-Apr-2005  kent sync with -current
 1.26.2.7  24-Mar-2008  yamt sync with head.
 1.26.2.6  17-Mar-2008  yamt sync with head.
 1.26.2.5  21-Jan-2008  yamt sync with head
 1.26.2.4  27-Oct-2007  yamt sync with head.
 1.26.2.3  03-Sep-2007  yamt sync with head.
 1.26.2.2  30-Dec-2006  yamt sync with head.
 1.26.2.1  21-Jun-2006  yamt sync with head.
 1.27.12.1  24-May-2006  tron Merge 2006-05-24 NetBSD-current into the "peter-altq" branch.
 1.27.10.1  19-Apr-2006  elad sync with head.
 1.27.8.3  03-Sep-2006  yamt sync with head.
 1.27.8.2  26-Jun-2006  yamt sync with head.
 1.27.8.1  24-May-2006  yamt sync with head.
 1.27.6.1  22-Apr-2006  simonb Sync with head.
 1.27.4.1  09-Sep-2006  rpaulo sync with head
 1.28.4.1  13-Jul-2006  gdamore Merge from HEAD.
 1.28.2.1  19-Jun-2006  chap Sync with head.
 1.30.4.2  10-Dec-2006  yamt sync with head.
 1.30.4.1  22-Oct-2006  yamt sync with head
 1.30.2.1  18-Nov-2006  ad Sync with head.
 1.33.16.1  03-Sep-2007  wrstuden Sync w/ NetBSD-4-RC_1
 1.33.10.1  11-Jul-2007  mjf Sync with head.
 1.33.8.2  23-Oct-2007  ad Sync with head.
 1.33.8.1  15-Jul-2007  ad Sync with head.
 1.33.6.1  27-Feb-2007  ad Add MP locking for audio drivers.
 1.33.2.1  18-Jun-2007  liamjfoy Pull up following revision(s) (requested by joerg in ticket #733):
sys/dev/pci/cs4280.c: revision 1.46
sys/dev/pci/cs4281.c: revision 1.34
sys/dev/pci/cs428x.h: revision 1.13
Fix ACPI suspend/resume support of clcs and clct. Based on auich and
hints from jmcneill@.
 1.34.12.1  25-Oct-2007  bouyer Sync with HEAD.
 1.34.8.3  23-Mar-2008  matt sync with HEAD
 1.34.8.2  09-Jan-2008  matt sync with HEAD
 1.34.8.1  06-Nov-2007  matt sync with HEAD
 1.34.6.4  08-Dec-2007  jmcneill Rename pnp(9) -> pmf(9), as requested by many.
 1.34.6.3  06-Nov-2007  joerg Refactor PNP API:
- Make suspend/resume directly a device functionality. It consists of
three layers (class logic, device logic, bus logic), all of them being
optional. This replaces D0/D3 transitions.
- device_is_active returns true if the device was not disabled and was
not suspended (even partially), device_is_enabled returns true if the
device was enabled.
- Change pnp_global_transition into pnp_system_suspend and
pnp_system_resume. Before running any suspend/resume handlers, check
that all currently attached devices support power management and bail
out otherwise. The latter is not done for the shutdown/panic case.
- Make the former bus-specific generic network handlers a class handler.
- Make PNP message like volume up/down/toogle PNP events. Each device
can register what events they are interested in and whether the handler
should be global or not.
- Introduce device_active API for devices to mark themselve in use from
either the system or the device. Use this to implement the idle handling
for audio and input devices. This is intended to replace most ad-hoc
watchdogs as well.
- Fix somes situations in which audio resume would lose mixer settings.
- Make USB host controllers better deal with suspend in the light of
shared interrupts.
- Flush filesystem cache on suspend.
- Flush disk caches on suspend. Put ATA disks into standby on suspend as
well.
- Adopt drivers to use the new PNP API.
- Fix a critical bug in the generic cardbus layer that made D0->D3
break.
- Fix ral(4) to set if_stop.
- Convert cbb(4) to the new PNP API.
- Apply the PCI Express SCI fix on resume again.
 1.34.6.2  26-Oct-2007  joerg Sync with HEAD.

Follow the merge of pmap.c on i386 and amd64 and move
pmap_init_tmp_pgtbl into arch/x86/x86/pmap.c. Modify the ACPI wakeup
code to restore CR4 before jumping back into kernel space as the large
page option might cover that.
 1.34.6.1  04-Oct-2007  joerg Convert clcs(4) and clct(4) to PNP power management. This should also
allow more then one instance of each to resume correctly.
 1.35.6.1  11-Dec-2007  yamt sync with head.
 1.35.4.1  26-Dec-2007  ad Sync with head.
 1.36.10.1  03-Apr-2008  mjf Sync with HEAD.
 1.36.6.1  24-Mar-2008  keiichi sync with head.
 1.39.18.1  13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.39.16.1  12-Dec-2008  ad Checkpoint work in progress.
 1.39.4.2  11-Mar-2010  yamt sync with head
 1.39.4.1  16-May-2009  yamt sync with head
 1.43.2.1  30-Apr-2010  uebayasi Sync with HEAD.
 1.44.12.2  22-Nov-2011  jmcneill get rid of unused 'powerstate' callback in audio_hw_if
 1.44.12.1  19-Nov-2011  jmcneill port ad-audiomp2 branch changes to 5.99.56
todo:
- port ad-audiomp2 pcppi changes
- these drivers need to be fixed:
- emuxki
- gcscaudio
- hdafg
- uaudio
- umidi
- MD audio drivers
 1.44.10.3  22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.44.10.2  30-Oct-2012  yamt sync with head
 1.44.10.1  17-Apr-2012  yamt sync with head
 1.46.2.1  18-Feb-2012  mrg merge to -current.
 1.47.6.3  03-Dec-2017  jdolecek update from HEAD
 1.47.6.2  20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.47.6.1  20-Nov-2012  tls Resync to 2012-11-19 00:00:00 UTC
 1.48.2.1  18-May-2014  rmind sync with head
 1.51.6.1  09-Jul-2016  skrll Sync with HEAD
 1.52.18.1  10-Jun-2019  christos Sync with HEAD
 1.52.16.1  26-Dec-2018  pgoyette Sync with HEAD, resolve a few conflicts
 1.54.2.2  04-May-2019  isaki Move dev/audio_if.h -> dev/audio/audio_if.h
 1.54.2.1  21-Apr-2019  isaki Adapt cs428x families to audio2.
- recording on cs4280 seems to have its own conversion.
I will see it later but first make it compilable.
 1.56.2.1  03-Apr-2021  thorpej Sync with HEAD.
 1.59.2.1  02-Aug-2025  perseant Sync with HEAD

RSS XML Feed