Commit Graph

83 Commits

Author SHA1 Message Date
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
kent 27d4af4355 No need to check the codec ready flag in read_codec() and write_codec().
According to the ICH datasheets, the flag is unchanged unless resetting
the codec.

The flag is useless after enabling bus mastering.  This behavior is common
to all ICH chips.  The quirk handling code is removed.
2003-10-23 05:25:29 +00:00
manu 8beb6e32ae Patch from http://mail-index.netbsd.org/current-users/2003/09/04/0018.html
to fix problems with a sound card
2003-10-22 15:57:33 +00:00
fvdl ba07312903 Match the nForce3 AC-97 chip. 2003-10-22 11:32:12 +00:00
fvdl 5e8b006a17 Add missing field initializer. 2003-10-21 01:12:42 +00:00
mycroft aeeaf47b01 Cleanup:
* auich_calibrate() assumes that the AC97 part is in its reset state.  To
  ensure this, call audio_attach_mi() after auich_calibrate().
* Explicitly support 12000Hz and 24000Hz.  (Why is there a discrete list at
  all?)
* Fix an obvious recording bug -- we were acking the wrong interrupt.
* Ensure that we don't get an interrupt during the AC97 speed probe by clearing
  the "interrupt on completion" bit in the DMA setup.
2003-10-02 07:41:53 +00:00
kent 0eb86c3701 Support for 4ch/6ch audio playback. 2003-09-28 13:37:19 +00:00
erh a22558465d Add entry for Intel 82801EB AC-97 audio. Audio sounds fine with this,
although the mixer settings are a bit odd: outputs.master doesn't do anything,
but outputs.surround does.
2003-08-19 21:04:22 +00:00
kent 53af708049 Fix a regression of the last commit.
ICH4 needs IGNORE_CODEC_READY_MAYBE.
2003-06-13 07:27:17 +00:00
kent 93695b73fb Not only ICH4 but also ICH0 and ICH2 might set no ICH_PCR.
The patch was provided by lha.

PR: kern/21031
2003-06-13 05:13:42 +00:00
wiz 1ffa7b76c4 DMA, not dma nor Dma. 2003-05-03 18:10:37 +00:00
thorpej b193480908 Add extensible malloc types, adapted from FreeBSD. This turns
malloc types into a structure, a pointer to which is passed around,
instead of an int constant.  Allow the limit to be adjusted when the
malloc type is defined, or with a function call, as suggested by
Jonathan Stone.
2003-02-01 06:23:35 +00:00
thorpej 7ec10e2d99 Use aprint_*(). 2003-01-31 00:07:39 +00:00
kent e45b3e7121 Apply BUS_DMA_NOCACHE for the buffers in the case of 440MX. The
code was provided by DHOYASHIKI Shinichi in kern/19919, and
address kern/19435.
2003-01-28 02:09:34 +00:00