Commit Graph

96 Commits

Author SHA1 Message Date
atatat df13e3579e Change the rest of the sysctl subsystem to use const consistently.
The __UNCONST macro is now used only where necessary and the RW macros
are gone.  Most of the changes here are consumers of the
sysctl_createv(9) interface that now takes a pair of const pointers
which used not to be.
2005-06-20 02:49:18 +00:00
jmcneill eddca7ac5f Some broken codecs don't release the CAS on reads to AC97_REG_GPIO_STATUS.
In auich_read_codec, do a dummy read to the RESET register if we're
reading GPIO_STATUS to be safe.
2005-04-12 17:30:51 +00:00
jmcneill cc976626a7 i82801CA is an ICH3, not ICH2. Fix typo in auich_modem_devices. Pointed out
by Nicolas Joly.
2005-04-11 11:20:45 +00:00
jmcneill 702c19a270 Add identifiers for Intel ICH3 AC'97 modems and CXT33 modem codecs, from
Nicolas Joly <njoly _at_ pasteur _dot_ fr>.
2005-04-08 12:50:00 +00:00
jmcneill c7acb3a606 More modem fixes:
* Ignore ICH_PCM246_MASK for modem devices
 * Set LINE1 rate and level in set_params
 * Enable mmap for modem devices. This was previously disallowed due to
   the ext_id field not advertising that the device supported variable
   rates. Since modems don't use ext_id (they use ext_mid instead), enable
   mmap. Multiple rates are supported on AC'97 modems.
2005-04-07 23:21:10 +00:00
jmcneill 7309363062 Work-in-progress of AC'97 modem support. Currently disabled by default
(can be enabled by options AUICH_ATTACH_MODEM), and untested. Shouldn't
have any impact on auich audio capabilities.
2005-04-04 19:41:50 +00:00
mycroft 487f02d9cd Three changes:
1) After setting an input or output channel to pause, watch for DCH (DMA
   halted) to be set before resetting the registers.  The manual says this is
   required.  This *may* fix random auich lockups.
2) Add auich_{trigger,intr,halt}_pipe(), which can operate on any of the
   input and output channels.  This reduces code duplication quite a bit.
   While I'm at it, fill in the mic interrupt handling.
3) The mic in interrupt is MINT, not MIINT.  (The latter is modem input.)
2005-03-11 22:29:16 +00:00
perry f31bd063e9 nuke trailing whitespace 2005-02-27 00:26:58 +00:00
jdolecek f9b584bd58 match nForce2 Ultra 400 audio 2005-01-27 21:49:29 +00:00
kent 0e68407cf6 support nForce 4 2005-01-27 13:35:05 +00:00
jmcneill f9fc6336b1 Add pci_conf_{capture,restore} to auich(4) powerhook 2005-01-26 21:53:42 +00:00
kent 93293b9ec7 ansify and KNF 2005-01-15 15:19:51 +00:00
kent 23b5d91433 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
2005-01-10 22:01:36 +00:00
cube 909aa49296 Some SiS 7012 chips come muted by default, so un-mute all SiS 7012 chips at
attach time the way Linux does it.  Reported and tested by Jonathan
Schleifer, I checked it didn't break my own 7012 device which doesn't need
that manipulation.
2004-12-11 17:48:56 +00:00
kent ca2819710c implement auich_activate() and auich_detach() 2004-11-17 15:19:30 +00:00
kent d1afddf792 make functions static as possible 2004-11-17 15:14:38 +00:00
kent c1653144ff adopt auconv_set_converter() 2004-11-13 15:00:48 +00:00
kent ad6e9b1b34 device matching by pcireg_t, not a pair of vendor ID and product ID.
This change reduces 170 Byte of i386 kernel size.
2004-11-11 03:06:21 +00:00
cube 6f5a5c1814 Add support for the ICH6 AC97 controller. 2004-11-10 17:22:25 +00:00
cube cf1fc8341b Return an error when a read operation fails, instead of pretending it
succeeded and transmitting a bogus value.
2004-11-10 17:17:14 +00:00
cube a6f37c0203 In auich_calibrate, set sc_ac97_clock to a default value of 48000 first.
That way, if the calibration fails or times out, sc_ac97_clock won't be 0
and there won't be a division by zero later in ac97_set_rate.
2004-11-10 14:14:09 +00:00
kent 145085fc2f move IS_FIXED_RATE(), SUPPORTS_4CH(), and SUPPORTS_6CH to ac97var.h 2004-11-10 04:20:26 +00:00
xtraeme 537252716c Add support for "nForce3 250 MCP-T AC-97 Audio", from Kouichirou Hiratsuka
in PR 27843.

Ok'ed christos@
2004-11-06 08:41:14 +00:00
mycroft 74c82c0ec4 Some miscellaneous cleanup:
* Encapsulate all the ring-specific variables into a substructure.  (This will
  help with some potential code sharing.)
* Don't bother with "last buffer complete" interrupts -- we should be taking an
  interrupt anyway because we set IOC on every buffer.
* Likewise, ignore CELV; it's meaningless to us.
* Get rid of the FIFO error counters, since this doesn't actually happen any
  more.
2004-11-01 06:25:35 +00:00
mycroft 170f82c2c3 Copyright maintenance. 2004-10-31 20:15:16 +00:00
mycroft 43670bc418 More code reduction.
Also, allow any sample rate between 8000 and 48000Hz.  (This range should
probably be larger, but this is what's known to work.)

Another 180 bytes shaved.
2004-10-31 20:00:42 +00:00
mycroft 62405c408b Shave another 112 bytes by reducing some divisions to shifts. 2004-10-31 19:28:31 +00:00
mycroft 53a18a1af1 Fix a regression -- my previous changes made the kernel slightly larger. 2004-10-31 18:30:52 +00:00
mycroft f37709ef90 In the trigger routines, start *all* the blocks, not just the first one. This
was causing some "fifo under/overrun" errors during the initial trigger.

Also fixes a ring synchronization problem introduced in the earlier changes.

This should completely fix the FIFO errors with auich.
2004-10-31 16:49:27 +00:00
mycroft 04699fb576 Reorder some register writes just to be safe. 2004-10-31 06:25:55 +00:00
mycroft 91c9307af1 Attempt to mitigate "fifo underrun" errors in two ways:
1) Update the queue pointers any time we get a block completion interrupt,
   not just when we hit the last block.
2) Set the "back-to-back enable" bit.
In addition:
3) Make sure we ack every block we transfer; there was a bug that could cause
   the audio layer to get out of sync.
2004-10-31 05:50:58 +00:00
yamt 18f717bb90 constify audio_hw_if, midi_hw_if, and radio_hw_if. 2004-10-29 12:57:15 +00:00
kent 15afb616fc add "hw.auichN.ac97rate" sysctl MIB to specify AC'97 link rate.
It is needed because automatic calibration by auich_calibrate() is not
so precise.

- Why not ioctl?
  It is not good idea to add a new ioctl operation to MI audio for
a specific audio device.
- Why not mixerctl item?
  AC'97 linke rate is not related to audio mixing.
2004-10-27 13:26:43 +00:00
kent 3b95460806 no need to restore AC97_REG_EXT_AUDIO_CTRL value on resuming
because ac97_codec_if_vtbl::restore_ports() does it.
2004-10-17 09:10:28 +00:00
kent 54cf6460d6 ac97_host_if::reset() returns non-zero value if codec reset fails, and
ac97 is not attached in that case.

PR: kern/26973
2004-09-22 12:20:24 +00:00
soren 3dce04c6cd - Don't attempt to clear the CELV bit by setting it high like the
FIFOE/BCIS/LVBCI bits; it's is cleared automatically by the hardware.
- Separate AUICH_DEBUG out from AUDIO_DEBUG and make it possible to debug
  interrupt handling separately.
- A little KNF.
2004-08-07 16:12:57 +00:00
mycroft 2728fe0f3f Clean up. Attempt to make these safer against stray interrupts. 2004-07-09 02:42:45 +00:00
mycroft 921c2474ad There's no need to halt the input and output pipes in the close routine --
audio_close() takes care of this.
2004-07-09 01:02:32 +00:00
kent 2adc11f1f3 remove/modify confusing error messsges. 2004-01-13 14:42:50 +00:00
soren 04fd7f9383 Only report codec readiness if DEBUG to avoid printing it on every resume. 2004-01-03 14:11:36 +00:00
kent a92ed9fb69 ICH4/ICH5:
When native i/o mapping fails, try compatible i/o mapping.
2003-12-28 12:31:30 +00:00
kent f9ae2a22c1 For ICH4/ICH5, use native BARs instead of compatible BARs.
The patch was provided by Lars Heidieker.
2003-11-22 08:49:41 +00:00
mycroft 2ef56c13e8 Force the codec into a known state before trying to determine its speed. 2003-11-06 07:13:33 +00:00
kent 26aa3703e4 auich_calibrate():
- make the buffer longer to improve the precision of measurement
 - round off the result to the nearest multiple of 1000.
2003-10-31 08:15:53 +00:00
kent c88bf03d33 For ICH4/ICH5, set IOSE flag to make them compatible to old ICHs. 2003-10-30 19:30:26 +00:00
mycroft c976b0b592 Eliminate bogus initializer (the code was technically wrong). 2003-10-28 22:56:19 +00:00
christos 125ccd91b1 Fix uninitialized variable warnings 2003-10-25 18:29:12 +00:00
kent cc9f31d5b2 auich_reset_codec:
wait for readiness of one of all codecs.
2003-10-24 04:06:44 +00:00
kent 5286b24afb Change the short names of nForce:
nForce-MCP -> nForce
 nForce-MCP-T -> nForce2
 nForce-MCP-T -> nForce3

Use snprintf() and strlcpy() instead of sprintf() and strcpy().
2003-10-23 17:14:54 +00:00
kent 3afd3b3671 - remove unused code
- print diagnostic messages if the primary codec does not get ready in
auich_reset_codec().
2003-10-23 17:05:26 +00:00