2019-05-23 16:14:53 +07:00
|
|
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
2011-02-19 06:49:32 +07:00
|
|
|
/* azt3328.c - driver for Aztech AZF3328 based soundcards (e.g. PCI168).
|
|
|
|
* Copyright (C) 2002, 2005 - 2011 by Andreas Mohr <andi AT lisas.de>
|
2005-04-17 05:20:36 +07:00
|
|
|
*
|
|
|
|
* Framework borrowed from Bart Hartgers's als4000.c.
|
|
|
|
* Driver developed on PCI168 AP(W) version (PCI rev. 10, subsystem ID 1801),
|
|
|
|
* found in a Fujitsu-Siemens PC ("Cordant", aluminum case).
|
|
|
|
* Other versions are:
|
|
|
|
* PCI168 A(W), sub ID 1800
|
|
|
|
* PCI168 A/AP, sub ID 8000
|
|
|
|
* Please give me feedback in case you try my driver with one of these!!
|
|
|
|
*
|
ALSA: azt3328: large codec cleanup, add I2S port etc.
- fully separate codec I/O port handling, enabling the use of a single
function each for all codecs (playback, capture, I2S out)
- add a new separate pcm for I2S out port (UNTESTED, no I2S DAC
available yet)
- switch gameport to low frequency while idle, to try to reduce noise/power
- improve snd_azf3328_codec_setdmaa() calculation
- minor variable type cleanup (u16, bool etc.)
- add some doc updates (help those lost Windows users, debug help, ...)
Note that due to the large cleanup aspect of the codec I/O change,
I was able to fit everything including all improvements into the
same binary size!! (a measly 10 bytes more or so)
This should now be the almost last patch to this driver
(minus some possible kernel clocksource patch and x86_64 fixes or so).
I just felt like taking a break from the usual stuff and wanted to
get this driver's structure finished, and it's rather clean now...
Tested, working and checkpatch.pl:ed on 2.6.30-rc5,
applies cleanly to 2.6.30 proper.
Signed-off-by: Andreas Mohr <andi@lisas.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2009-07-05 18:55:46 +07:00
|
|
|
* Keywords: Windows XP Vista 168nt4-125.zip 168win95-125.zip PCI 168 download
|
|
|
|
* (XP/Vista do not support this card at all but every Linux distribution
|
|
|
|
* has very good support out of the box;
|
|
|
|
* just to make sure that the right people hit this and get to know that,
|
|
|
|
* despite the high level of Internet ignorance - as usual :-P -
|
2009-07-13 03:17:54 +07:00
|
|
|
* about very good support for this card - on Linux!)
|
ALSA: azt3328: large codec cleanup, add I2S port etc.
- fully separate codec I/O port handling, enabling the use of a single
function each for all codecs (playback, capture, I2S out)
- add a new separate pcm for I2S out port (UNTESTED, no I2S DAC
available yet)
- switch gameport to low frequency while idle, to try to reduce noise/power
- improve snd_azf3328_codec_setdmaa() calculation
- minor variable type cleanup (u16, bool etc.)
- add some doc updates (help those lost Windows users, debug help, ...)
Note that due to the large cleanup aspect of the codec I/O change,
I was able to fit everything including all improvements into the
same binary size!! (a measly 10 bytes more or so)
This should now be the almost last patch to this driver
(minus some possible kernel clocksource patch and x86_64 fixes or so).
I just felt like taking a break from the usual stuff and wanted to
get this driver's structure finished, and it's rather clean now...
Tested, working and checkpatch.pl:ed on 2.6.30-rc5,
applies cleanly to 2.6.30 proper.
Signed-off-by: Andreas Mohr <andi@lisas.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2009-07-05 18:55:46 +07:00
|
|
|
*
|
2005-04-17 05:20:36 +07:00
|
|
|
* NOTES
|
|
|
|
* Since Aztech does not provide any chipset documentation,
|
|
|
|
* even on repeated request to various addresses,
|
|
|
|
* and the answer that was finally given was negative
|
|
|
|
* (and I was stupid enough to manage to get hold of a PCI168 soundcard
|
|
|
|
* in the first place >:-P}),
|
|
|
|
* I was forced to base this driver on reverse engineering
|
|
|
|
* (3 weeks' worth of evenings filled with driver work).
|
2006-05-17 16:04:19 +07:00
|
|
|
* (and no, I did NOT go the easy way: to pick up a SB PCI128 for 9 Euros)
|
2005-04-17 05:20:36 +07:00
|
|
|
*
|
[ALSA] PCI168 snd-azt3328 Linux driver: another huge update
- figured out 'Digital(ly) Enhanced Game Port' functionality,
implemented support for it (eliminating gameport polling overhead)
- removed optional joystick activation, gameport now enabled unconditionally,
since we now support it via the PCI I/O space, not via conflict-prone
legacy I/O (which I was thus able to DISABLE now)!
- fix playback bug (a muted wave output would get unmuted upon start of
playback, of course this is not what we want, thus remember mute state)
- implement partial power management: when idle, lower clock rate and disable
codec (reduced noise!), and disable gameport circuit when unused
- instantiate OPL3 timer, too
- much better implementation of snd_azf3328_mixer_write_volume_gradually()
- slightly optimized interrupt handling
- lots of cleanup
This time, I also found a way to verify proper OPL3 operation
via MIDI file playback (emulation via synth hardware).
Signed-off-by: Andreas Mohr <andi@lisas.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2008-05-16 17:18:29 +07:00
|
|
|
* It is quite likely that the AZF3328 chip is the PCI cousin of the
|
|
|
|
* AZF3318 ("azt1020 pnp", "MM Pro 16") ISA chip, given very similar specs.
|
|
|
|
*
|
2005-04-17 05:20:36 +07:00
|
|
|
* The AZF3328 chip (note: AZF3328, *not* AZT3328, that's just the driver name
|
[ALSA] PCI168 snd-azt3328 Linux driver: another huge update
- figured out 'Digital(ly) Enhanced Game Port' functionality,
implemented support for it (eliminating gameport polling overhead)
- removed optional joystick activation, gameport now enabled unconditionally,
since we now support it via the PCI I/O space, not via conflict-prone
legacy I/O (which I was thus able to DISABLE now)!
- fix playback bug (a muted wave output would get unmuted upon start of
playback, of course this is not what we want, thus remember mute state)
- implement partial power management: when idle, lower clock rate and disable
codec (reduced noise!), and disable gameport circuit when unused
- instantiate OPL3 timer, too
- much better implementation of snd_azf3328_mixer_write_volume_gradually()
- slightly optimized interrupt handling
- lots of cleanup
This time, I also found a way to verify proper OPL3 operation
via MIDI file playback (emulation via synth hardware).
Signed-off-by: Andreas Mohr <andi@lisas.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2008-05-16 17:18:29 +07:00
|
|
|
* for compatibility reasons) from Azfin (joint-venture of Aztech and Fincitec,
|
|
|
|
* Fincitec acquired by National Semiconductor in 2002, together with the
|
|
|
|
* Fincitec-related company ARSmikro) has the following features:
|
2005-04-17 05:20:36 +07:00
|
|
|
*
|
[ALSA] PCI168 snd-azt3328 Linux driver: another huge update
- figured out 'Digital(ly) Enhanced Game Port' functionality,
implemented support for it (eliminating gameport polling overhead)
- removed optional joystick activation, gameport now enabled unconditionally,
since we now support it via the PCI I/O space, not via conflict-prone
legacy I/O (which I was thus able to DISABLE now)!
- fix playback bug (a muted wave output would get unmuted upon start of
playback, of course this is not what we want, thus remember mute state)
- implement partial power management: when idle, lower clock rate and disable
codec (reduced noise!), and disable gameport circuit when unused
- instantiate OPL3 timer, too
- much better implementation of snd_azf3328_mixer_write_volume_gradually()
- slightly optimized interrupt handling
- lots of cleanup
This time, I also found a way to verify proper OPL3 operation
via MIDI file playback (emulation via synth hardware).
Signed-off-by: Andreas Mohr <andi@lisas.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2008-05-16 17:18:29 +07:00
|
|
|
* - compatibility & compliance:
|
|
|
|
* - Microsoft PC 97 ("PC 97 Hardware Design Guide",
|
|
|
|
* http://www.microsoft.com/whdc/archive/pcguides.mspx)
|
|
|
|
* - Microsoft PC 98 Baseline Audio
|
|
|
|
* - MPU401 UART
|
|
|
|
* - Sound Blaster Emulation (DOS Box)
|
2005-04-17 05:20:36 +07:00
|
|
|
* - builtin AC97 conformant codec (SNR over 80dB)
|
2006-05-17 16:03:16 +07:00
|
|
|
* Note that "conformant" != "compliant"!! this chip's mixer register layout
|
|
|
|
* *differs* from the standard AC97 layout:
|
|
|
|
* they chose to not implement the headphone register (which is not a
|
|
|
|
* problem since it's merely optional), yet when doing this, they committed
|
|
|
|
* the grave sin of letting other registers follow immediately instead of
|
|
|
|
* keeping a headphone dummy register, thereby shifting the mixer register
|
|
|
|
* addresses illegally. So far unfortunately it looks like the very flexible
|
|
|
|
* ALSA AC97 support is still not enough to easily compensate for such a
|
|
|
|
* grave layout violation despite all tweaks and quirks mechanisms it offers.
|
2011-02-19 06:49:32 +07:00
|
|
|
* Well, not quite: now ac97 layer is much improved (bus-specific ops!),
|
|
|
|
* thus I was able to implement support - it's actually working quite well.
|
|
|
|
* An interesting item might be Aztech AMR 2800-W, since it's an AC97
|
|
|
|
* modem card which might reveal the Aztech-specific codec ID which
|
|
|
|
* we might want to pretend, too. Dito PCI168's brother, PCI368,
|
|
|
|
* where the advertising datasheet says it's AC97-based and has a
|
|
|
|
* Digital Enhanced Game Port.
|
[ALSA] PCI168 snd-azt3328 Linux driver: another huge update
- figured out 'Digital(ly) Enhanced Game Port' functionality,
implemented support for it (eliminating gameport polling overhead)
- removed optional joystick activation, gameport now enabled unconditionally,
since we now support it via the PCI I/O space, not via conflict-prone
legacy I/O (which I was thus able to DISABLE now)!
- fix playback bug (a muted wave output would get unmuted upon start of
playback, of course this is not what we want, thus remember mute state)
- implement partial power management: when idle, lower clock rate and disable
codec (reduced noise!), and disable gameport circuit when unused
- instantiate OPL3 timer, too
- much better implementation of snd_azf3328_mixer_write_volume_gradually()
- slightly optimized interrupt handling
- lots of cleanup
This time, I also found a way to verify proper OPL3 operation
via MIDI file playback (emulation via synth hardware).
Signed-off-by: Andreas Mohr <andi@lisas.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2008-05-16 17:18:29 +07:00
|
|
|
* - builtin genuine OPL3 - verified to work fine, 20080506
|
2005-04-17 05:20:36 +07:00
|
|
|
* - full duplex 16bit playback/record at independent sampling rate
|
[ALSA] PCI168 snd-azt3328 Linux driver: another huge update
- figured out 'Digital(ly) Enhanced Game Port' functionality,
implemented support for it (eliminating gameport polling overhead)
- removed optional joystick activation, gameport now enabled unconditionally,
since we now support it via the PCI I/O space, not via conflict-prone
legacy I/O (which I was thus able to DISABLE now)!
- fix playback bug (a muted wave output would get unmuted upon start of
playback, of course this is not what we want, thus remember mute state)
- implement partial power management: when idle, lower clock rate and disable
codec (reduced noise!), and disable gameport circuit when unused
- instantiate OPL3 timer, too
- much better implementation of snd_azf3328_mixer_write_volume_gradually()
- slightly optimized interrupt handling
- lots of cleanup
This time, I also found a way to verify proper OPL3 operation
via MIDI file playback (emulation via synth hardware).
Signed-off-by: Andreas Mohr <andi@lisas.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2008-05-16 17:18:29 +07:00
|
|
|
* - MPU401 (+ legacy address support, claimed by one official spec sheet)
|
|
|
|
* FIXME: how to enable legacy addr??
|
2005-04-17 05:20:36 +07:00
|
|
|
* - game port (legacy address support)
|
2007-03-26 17:49:45 +07:00
|
|
|
* - builtin DirectInput support, helps reduce CPU overhead (interrupt-driven
|
[ALSA] PCI168 snd-azt3328 Linux driver: another huge update
- figured out 'Digital(ly) Enhanced Game Port' functionality,
implemented support for it (eliminating gameport polling overhead)
- removed optional joystick activation, gameport now enabled unconditionally,
since we now support it via the PCI I/O space, not via conflict-prone
legacy I/O (which I was thus able to DISABLE now)!
- fix playback bug (a muted wave output would get unmuted upon start of
playback, of course this is not what we want, thus remember mute state)
- implement partial power management: when idle, lower clock rate and disable
codec (reduced noise!), and disable gameport circuit when unused
- instantiate OPL3 timer, too
- much better implementation of snd_azf3328_mixer_write_volume_gradually()
- slightly optimized interrupt handling
- lots of cleanup
This time, I also found a way to verify proper OPL3 operation
via MIDI file playback (emulation via synth hardware).
Signed-off-by: Andreas Mohr <andi@lisas.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2008-05-16 17:18:29 +07:00
|
|
|
* features supported). - See common term "Digital Enhanced Game Port"...
|
|
|
|
* (probably DirectInput 3.0 spec - confirm)
|
|
|
|
* - builtin 3D enhancement (said to be YAMAHA Ymersion)
|
2005-04-17 05:20:36 +07:00
|
|
|
* - built-in General DirectX timer having a 20 bits counter
|
2005-10-25 16:17:45 +07:00
|
|
|
* with 1us resolution (see below!)
|
[ALSA] PCI168 snd-azt3328 Linux driver: another huge update
- figured out 'Digital(ly) Enhanced Game Port' functionality,
implemented support for it (eliminating gameport polling overhead)
- removed optional joystick activation, gameport now enabled unconditionally,
since we now support it via the PCI I/O space, not via conflict-prone
legacy I/O (which I was thus able to DISABLE now)!
- fix playback bug (a muted wave output would get unmuted upon start of
playback, of course this is not what we want, thus remember mute state)
- implement partial power management: when idle, lower clock rate and disable
codec (reduced noise!), and disable gameport circuit when unused
- instantiate OPL3 timer, too
- much better implementation of snd_azf3328_mixer_write_volume_gradually()
- slightly optimized interrupt handling
- lots of cleanup
This time, I also found a way to verify proper OPL3 operation
via MIDI file playback (emulation via synth hardware).
Signed-off-by: Andreas Mohr <andi@lisas.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2008-05-16 17:18:29 +07:00
|
|
|
* - I2S serial output port for external DAC
|
ALSA: azt3328: large codec cleanup, add I2S port etc.
- fully separate codec I/O port handling, enabling the use of a single
function each for all codecs (playback, capture, I2S out)
- add a new separate pcm for I2S out port (UNTESTED, no I2S DAC
available yet)
- switch gameport to low frequency while idle, to try to reduce noise/power
- improve snd_azf3328_codec_setdmaa() calculation
- minor variable type cleanup (u16, bool etc.)
- add some doc updates (help those lost Windows users, debug help, ...)
Note that due to the large cleanup aspect of the codec I/O change,
I was able to fit everything including all improvements into the
same binary size!! (a measly 10 bytes more or so)
This should now be the almost last patch to this driver
(minus some possible kernel clocksource patch and x86_64 fixes or so).
I just felt like taking a break from the usual stuff and wanted to
get this driver's structure finished, and it's rather clean now...
Tested, working and checkpatch.pl:ed on 2.6.30-rc5,
applies cleanly to 2.6.30 proper.
Signed-off-by: Andreas Mohr <andi@lisas.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2009-07-05 18:55:46 +07:00
|
|
|
* [FIXME: 3.3V or 5V level? maximum rate is 66.2kHz right?]
|
2005-04-17 05:20:36 +07:00
|
|
|
* - supports 33MHz PCI spec 2.1, PCI power management 1.0, compliant with ACPI
|
|
|
|
* - supports hardware volume control
|
|
|
|
* - single chip low cost solution (128 pin QFP)
|
ALSA: azt3328: large codec cleanup, add I2S port etc.
- fully separate codec I/O port handling, enabling the use of a single
function each for all codecs (playback, capture, I2S out)
- add a new separate pcm for I2S out port (UNTESTED, no I2S DAC
available yet)
- switch gameport to low frequency while idle, to try to reduce noise/power
- improve snd_azf3328_codec_setdmaa() calculation
- minor variable type cleanup (u16, bool etc.)
- add some doc updates (help those lost Windows users, debug help, ...)
Note that due to the large cleanup aspect of the codec I/O change,
I was able to fit everything including all improvements into the
same binary size!! (a measly 10 bytes more or so)
This should now be the almost last patch to this driver
(minus some possible kernel clocksource patch and x86_64 fixes or so).
I just felt like taking a break from the usual stuff and wanted to
get this driver's structure finished, and it's rather clean now...
Tested, working and checkpatch.pl:ed on 2.6.30-rc5,
applies cleanly to 2.6.30 proper.
Signed-off-by: Andreas Mohr <andi@lisas.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2009-07-05 18:55:46 +07:00
|
|
|
* - supports programmable Sub-vendor and Sub-system ID [24C02 SEEPROM chip]
|
2005-04-17 05:20:36 +07:00
|
|
|
* required for Microsoft's logo compliance (FIXME: where?)
|
[ALSA] PCI168 snd-azt3328 Linux driver: another huge update
- figured out 'Digital(ly) Enhanced Game Port' functionality,
implemented support for it (eliminating gameport polling overhead)
- removed optional joystick activation, gameport now enabled unconditionally,
since we now support it via the PCI I/O space, not via conflict-prone
legacy I/O (which I was thus able to DISABLE now)!
- fix playback bug (a muted wave output would get unmuted upon start of
playback, of course this is not what we want, thus remember mute state)
- implement partial power management: when idle, lower clock rate and disable
codec (reduced noise!), and disable gameport circuit when unused
- instantiate OPL3 timer, too
- much better implementation of snd_azf3328_mixer_write_volume_gradually()
- slightly optimized interrupt handling
- lots of cleanup
This time, I also found a way to verify proper OPL3 operation
via MIDI file playback (emulation via synth hardware).
Signed-off-by: Andreas Mohr <andi@lisas.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2008-05-16 17:18:29 +07:00
|
|
|
* At least the Trident 4D Wave DX has one bit somewhere
|
|
|
|
* to enable writes to PCI subsystem VID registers, that should be it.
|
|
|
|
* This might easily be in extended PCI reg space, since PCI168 also has
|
|
|
|
* some custom data starting at 0x80. What kind of config settings
|
|
|
|
* are located in our extended PCI space anyway??
|
2005-04-17 05:20:36 +07:00
|
|
|
* - PCI168 AP(W) card: power amplifier with 4 Watts/channel at 4 Ohms
|
ALSA: azt3328: large codec cleanup, add I2S port etc.
- fully separate codec I/O port handling, enabling the use of a single
function each for all codecs (playback, capture, I2S out)
- add a new separate pcm for I2S out port (UNTESTED, no I2S DAC
available yet)
- switch gameport to low frequency while idle, to try to reduce noise/power
- improve snd_azf3328_codec_setdmaa() calculation
- minor variable type cleanup (u16, bool etc.)
- add some doc updates (help those lost Windows users, debug help, ...)
Note that due to the large cleanup aspect of the codec I/O change,
I was able to fit everything including all improvements into the
same binary size!! (a measly 10 bytes more or so)
This should now be the almost last patch to this driver
(minus some possible kernel clocksource patch and x86_64 fixes or so).
I just felt like taking a break from the usual stuff and wanted to
get this driver's structure finished, and it's rather clean now...
Tested, working and checkpatch.pl:ed on 2.6.30-rc5,
applies cleanly to 2.6.30 proper.
Signed-off-by: Andreas Mohr <andi@lisas.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2009-07-05 18:55:46 +07:00
|
|
|
* [TDA1517P chip]
|
2005-04-17 05:20:36 +07:00
|
|
|
*
|
2005-10-25 16:17:45 +07:00
|
|
|
* Note that this driver now is actually *better* than the Windows driver,
|
|
|
|
* since it additionally supports the card's 1MHz DirectX timer - just try
|
|
|
|
* the following snd-seq module parameters etc.:
|
|
|
|
* - options snd-seq seq_default_timer_class=2 seq_default_timer_sclass=0
|
|
|
|
* seq_default_timer_card=0 seq_client_load=1 seq_default_timer_device=0
|
|
|
|
* seq_default_timer_subdevice=0 seq_default_timer_resolution=1000000
|
|
|
|
* - "timidity -iAv -B2,8 -Os -EFreverb=0"
|
|
|
|
* - "pmidi -p 128:0 jazz.mid"
|
|
|
|
*
|
[ALSA] PCI168 snd-azt3328 Linux driver: another huge update
- figured out 'Digital(ly) Enhanced Game Port' functionality,
implemented support for it (eliminating gameport polling overhead)
- removed optional joystick activation, gameport now enabled unconditionally,
since we now support it via the PCI I/O space, not via conflict-prone
legacy I/O (which I was thus able to DISABLE now)!
- fix playback bug (a muted wave output would get unmuted upon start of
playback, of course this is not what we want, thus remember mute state)
- implement partial power management: when idle, lower clock rate and disable
codec (reduced noise!), and disable gameport circuit when unused
- instantiate OPL3 timer, too
- much better implementation of snd_azf3328_mixer_write_volume_gradually()
- slightly optimized interrupt handling
- lots of cleanup
This time, I also found a way to verify proper OPL3 operation
via MIDI file playback (emulation via synth hardware).
Signed-off-by: Andreas Mohr <andi@lisas.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2008-05-16 17:18:29 +07:00
|
|
|
* OPL3 hardware playback testing, try something like:
|
|
|
|
* cat /proc/asound/hwdep
|
|
|
|
* and
|
|
|
|
* aconnect -o
|
|
|
|
* Then use
|
|
|
|
* sbiload -Dhw:x,y --opl3 /usr/share/sounds/opl3/std.o3 ......./drums.o3
|
|
|
|
* where x,y is the xx-yy number as given in hwdep.
|
|
|
|
* Then try
|
|
|
|
* pmidi -p a:b jazz.mid
|
|
|
|
* where a:b is the client number plus 0 usually, as given by aconnect above.
|
|
|
|
* Oh, and make sure to unmute the FM mixer control (doh!)
|
|
|
|
* NOTE: power use during OPL3 playback is _VERY_ high (70W --> 90W!)
|
|
|
|
* despite no CPU activity, possibly due to hindering ACPI idling somehow.
|
|
|
|
* Shouldn't be a problem of the AZF3328 chip itself, I'd hope.
|
|
|
|
* Higher PCM / FM mixer levels seem to conflict (causes crackling),
|
|
|
|
* at least sometimes. Maybe even use with hardware sequencer timer above :)
|
|
|
|
* adplay/adplug-utils might soon offer hardware-based OPL3 playback, too.
|
|
|
|
*
|
2005-04-17 05:20:36 +07:00
|
|
|
* Certain PCI versions of this card are susceptible to DMA traffic underruns
|
|
|
|
* in some systems (resulting in sound crackling/clicking/popping),
|
|
|
|
* probably because they don't have a DMA FIFO buffer or so.
|
|
|
|
* Overview (PCI ID/PCI subID/PCI rev.):
|
|
|
|
* - no DMA crackling on SiS735: 0x50DC/0x1801/16
|
|
|
|
* - unknown performance: 0x50DC/0x1801/10
|
2005-10-25 16:17:45 +07:00
|
|
|
* (well, it's not bad on an Athlon 1800 with now very optimized IRQ handler)
|
|
|
|
*
|
2005-04-17 05:20:36 +07:00
|
|
|
* Crackling happens with VIA chipsets or, in my case, an SiS735, which is
|
|
|
|
* supposed to be very fast and supposed to get rid of crackling much
|
|
|
|
* better than a VIA, yet ironically I still get crackling, like many other
|
|
|
|
* people with the same chipset.
|
|
|
|
* Possible remedies:
|
[ALSA] PCI168 snd-azt3328 Linux driver: another huge update
- figured out 'Digital(ly) Enhanced Game Port' functionality,
implemented support for it (eliminating gameport polling overhead)
- removed optional joystick activation, gameport now enabled unconditionally,
since we now support it via the PCI I/O space, not via conflict-prone
legacy I/O (which I was thus able to DISABLE now)!
- fix playback bug (a muted wave output would get unmuted upon start of
playback, of course this is not what we want, thus remember mute state)
- implement partial power management: when idle, lower clock rate and disable
codec (reduced noise!), and disable gameport circuit when unused
- instantiate OPL3 timer, too
- much better implementation of snd_azf3328_mixer_write_volume_gradually()
- slightly optimized interrupt handling
- lots of cleanup
This time, I also found a way to verify proper OPL3 operation
via MIDI file playback (emulation via synth hardware).
Signed-off-by: Andreas Mohr <andi@lisas.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2008-05-16 17:18:29 +07:00
|
|
|
* - use speaker (amplifier) output instead of headphone output
|
|
|
|
* (in case crackling is due to overloaded output clipping)
|
2011-03-31 08:57:33 +07:00
|
|
|
* - plug card into a different PCI slot, preferably one that isn't shared
|
2005-04-17 05:20:36 +07:00
|
|
|
* too much (this helps a lot, but not completely!)
|
|
|
|
* - get rid of PCI VGA card, use AGP instead
|
|
|
|
* - upgrade or downgrade BIOS
|
|
|
|
* - fiddle with PCI latency settings (setpci -v -s BUSID latency_timer=XX)
|
|
|
|
* Not too helpful.
|
|
|
|
* - Disable ACPI/power management/"Auto Detect RAM/PCI Clk" in BIOS
|
[ALSA] PCI168 snd-azt3328 Linux driver: another huge update
- figured out 'Digital(ly) Enhanced Game Port' functionality,
implemented support for it (eliminating gameport polling overhead)
- removed optional joystick activation, gameport now enabled unconditionally,
since we now support it via the PCI I/O space, not via conflict-prone
legacy I/O (which I was thus able to DISABLE now)!
- fix playback bug (a muted wave output would get unmuted upon start of
playback, of course this is not what we want, thus remember mute state)
- implement partial power management: when idle, lower clock rate and disable
codec (reduced noise!), and disable gameport circuit when unused
- instantiate OPL3 timer, too
- much better implementation of snd_azf3328_mixer_write_volume_gradually()
- slightly optimized interrupt handling
- lots of cleanup
This time, I also found a way to verify proper OPL3 operation
via MIDI file playback (emulation via synth hardware).
Signed-off-by: Andreas Mohr <andi@lisas.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2008-05-16 17:18:29 +07:00
|
|
|
*
|
2005-04-17 05:20:36 +07:00
|
|
|
* BUGS
|
[ALSA] PCI168 snd-azt3328 Linux driver: another huge update
- figured out 'Digital(ly) Enhanced Game Port' functionality,
implemented support for it (eliminating gameport polling overhead)
- removed optional joystick activation, gameport now enabled unconditionally,
since we now support it via the PCI I/O space, not via conflict-prone
legacy I/O (which I was thus able to DISABLE now)!
- fix playback bug (a muted wave output would get unmuted upon start of
playback, of course this is not what we want, thus remember mute state)
- implement partial power management: when idle, lower clock rate and disable
codec (reduced noise!), and disable gameport circuit when unused
- instantiate OPL3 timer, too
- much better implementation of snd_azf3328_mixer_write_volume_gradually()
- slightly optimized interrupt handling
- lots of cleanup
This time, I also found a way to verify proper OPL3 operation
via MIDI file playback (emulation via synth hardware).
Signed-off-by: Andreas Mohr <andi@lisas.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2008-05-16 17:18:29 +07:00
|
|
|
* - full-duplex might *still* be problematic, however a recent test was fine
|
2007-03-26 17:49:45 +07:00
|
|
|
* - (non-bug) "Bass/Treble or 3D settings don't work" - they do get evaluated
|
|
|
|
* if you set PCM output switch to "pre 3D" instead of "post 3D".
|
|
|
|
* If this can't be set, then get a mixer application that Isn't Stupid (tm)
|
|
|
|
* (e.g. kmix, gamix) - unfortunately several are!!
|
[ALSA] PCI168 snd-azt3328 Linux driver: another huge update
- figured out 'Digital(ly) Enhanced Game Port' functionality,
implemented support for it (eliminating gameport polling overhead)
- removed optional joystick activation, gameport now enabled unconditionally,
since we now support it via the PCI I/O space, not via conflict-prone
legacy I/O (which I was thus able to DISABLE now)!
- fix playback bug (a muted wave output would get unmuted upon start of
playback, of course this is not what we want, thus remember mute state)
- implement partial power management: when idle, lower clock rate and disable
codec (reduced noise!), and disable gameport circuit when unused
- instantiate OPL3 timer, too
- much better implementation of snd_azf3328_mixer_write_volume_gradually()
- slightly optimized interrupt handling
- lots of cleanup
This time, I also found a way to verify proper OPL3 operation
via MIDI file playback (emulation via synth hardware).
Signed-off-by: Andreas Mohr <andi@lisas.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2008-05-16 17:18:29 +07:00
|
|
|
* - locking is not entirely clean, especially the audio stream activity
|
|
|
|
* ints --> may be racy
|
|
|
|
* - an _unconnected_ secondary joystick at the gameport will be reported
|
|
|
|
* to be "active" (floating values, not precisely -1) due to the way we need
|
|
|
|
* to read the Digital Enhanced Game Port. Not sure whether it is fixable.
|
|
|
|
*
|
2005-04-17 05:20:36 +07:00
|
|
|
* TODO
|
ALSA: azt3328: large codec cleanup, add I2S port etc.
- fully separate codec I/O port handling, enabling the use of a single
function each for all codecs (playback, capture, I2S out)
- add a new separate pcm for I2S out port (UNTESTED, no I2S DAC
available yet)
- switch gameport to low frequency while idle, to try to reduce noise/power
- improve snd_azf3328_codec_setdmaa() calculation
- minor variable type cleanup (u16, bool etc.)
- add some doc updates (help those lost Windows users, debug help, ...)
Note that due to the large cleanup aspect of the codec I/O change,
I was able to fit everything including all improvements into the
same binary size!! (a measly 10 bytes more or so)
This should now be the almost last patch to this driver
(minus some possible kernel clocksource patch and x86_64 fixes or so).
I just felt like taking a break from the usual stuff and wanted to
get this driver's structure finished, and it's rather clean now...
Tested, working and checkpatch.pl:ed on 2.6.30-rc5,
applies cleanly to 2.6.30 proper.
Signed-off-by: Andreas Mohr <andi@lisas.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2009-07-05 18:55:46 +07:00
|
|
|
* - use PCI_VDEVICE
|
|
|
|
* - verify driver status on x86_64
|
|
|
|
* - test multi-card driver operation
|
|
|
|
* - (ab)use 1MHz DirectX timer as kernel clocksource
|
2005-04-17 05:20:36 +07:00
|
|
|
* - test MPU401 MIDI playback etc.
|
[ALSA] PCI168 snd-azt3328 Linux driver: another huge update
- figured out 'Digital(ly) Enhanced Game Port' functionality,
implemented support for it (eliminating gameport polling overhead)
- removed optional joystick activation, gameport now enabled unconditionally,
since we now support it via the PCI I/O space, not via conflict-prone
legacy I/O (which I was thus able to DISABLE now)!
- fix playback bug (a muted wave output would get unmuted upon start of
playback, of course this is not what we want, thus remember mute state)
- implement partial power management: when idle, lower clock rate and disable
codec (reduced noise!), and disable gameport circuit when unused
- instantiate OPL3 timer, too
- much better implementation of snd_azf3328_mixer_write_volume_gradually()
- slightly optimized interrupt handling
- lots of cleanup
This time, I also found a way to verify proper OPL3 operation
via MIDI file playback (emulation via synth hardware).
Signed-off-by: Andreas Mohr <andi@lisas.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2008-05-16 17:18:29 +07:00
|
|
|
* - add more power micro-management (disable various units of the card
|
ALSA: azt3328: large codec cleanup, add I2S port etc.
- fully separate codec I/O port handling, enabling the use of a single
function each for all codecs (playback, capture, I2S out)
- add a new separate pcm for I2S out port (UNTESTED, no I2S DAC
available yet)
- switch gameport to low frequency while idle, to try to reduce noise/power
- improve snd_azf3328_codec_setdmaa() calculation
- minor variable type cleanup (u16, bool etc.)
- add some doc updates (help those lost Windows users, debug help, ...)
Note that due to the large cleanup aspect of the codec I/O change,
I was able to fit everything including all improvements into the
same binary size!! (a measly 10 bytes more or so)
This should now be the almost last patch to this driver
(minus some possible kernel clocksource patch and x86_64 fixes or so).
I just felt like taking a break from the usual stuff and wanted to
get this driver's structure finished, and it's rather clean now...
Tested, working and checkpatch.pl:ed on 2.6.30-rc5,
applies cleanly to 2.6.30 proper.
Signed-off-by: Andreas Mohr <andi@lisas.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2009-07-05 18:55:46 +07:00
|
|
|
* as long as they're unused, to improve audio quality and save power).
|
|
|
|
* However this requires more I/O ports which I haven't figured out yet
|
|
|
|
* and which thus might not even exist...
|
2006-05-17 16:02:24 +07:00
|
|
|
* The standard suspend/resume functionality could probably make use of
|
|
|
|
* some improvement, too...
|
2005-04-17 05:20:36 +07:00
|
|
|
* - figure out what all unknown port bits are responsible for
|
2006-05-17 16:03:16 +07:00
|
|
|
* - figure out some cleverly evil scheme to possibly make ALSA AC97 code
|
|
|
|
* fully accept our quite incompatible ""AC97"" mixer and thus save some
|
|
|
|
* code (but I'm not too optimistic that doing this is possible at all)
|
[ALSA] PCI168 snd-azt3328 Linux driver: another huge update
- figured out 'Digital(ly) Enhanced Game Port' functionality,
implemented support for it (eliminating gameport polling overhead)
- removed optional joystick activation, gameport now enabled unconditionally,
since we now support it via the PCI I/O space, not via conflict-prone
legacy I/O (which I was thus able to DISABLE now)!
- fix playback bug (a muted wave output would get unmuted upon start of
playback, of course this is not what we want, thus remember mute state)
- implement partial power management: when idle, lower clock rate and disable
codec (reduced noise!), and disable gameport circuit when unused
- instantiate OPL3 timer, too
- much better implementation of snd_azf3328_mixer_write_volume_gradually()
- slightly optimized interrupt handling
- lots of cleanup
This time, I also found a way to verify proper OPL3 operation
via MIDI file playback (emulation via synth hardware).
Signed-off-by: Andreas Mohr <andi@lisas.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2008-05-16 17:18:29 +07:00
|
|
|
* - use MMIO (memory-mapped I/O)? Slightly faster access, e.g. for gameport.
|
2005-04-17 05:20:36 +07:00
|
|
|
*/
|
|
|
|
|
2015-01-28 22:49:33 +07:00
|
|
|
#include <linux/io.h>
|
2005-04-17 05:20:36 +07:00
|
|
|
#include <linux/init.h>
|
2010-12-28 03:17:35 +07:00
|
|
|
#include <linux/bug.h> /* WARN_ONCE */
|
2005-04-17 05:20:36 +07:00
|
|
|
#include <linux/pci.h>
|
|
|
|
#include <linux/delay.h>
|
|
|
|
#include <linux/slab.h>
|
|
|
|
#include <linux/gameport.h>
|
2011-07-16 00:13:37 +07:00
|
|
|
#include <linux/module.h>
|
2006-03-28 16:56:48 +07:00
|
|
|
#include <linux/dma-mapping.h>
|
2005-04-17 05:20:36 +07:00
|
|
|
#include <sound/core.h>
|
|
|
|
#include <sound/control.h>
|
|
|
|
#include <sound/pcm.h>
|
|
|
|
#include <sound/rawmidi.h>
|
|
|
|
#include <sound/mpu401.h>
|
|
|
|
#include <sound/opl3.h>
|
|
|
|
#include <sound/initval.h>
|
2011-02-19 06:49:32 +07:00
|
|
|
/*
|
|
|
|
* Config switch, to use ALSA's AC97 layer instead of old custom mixer crap.
|
|
|
|
* If the AC97 compatibility parts we needed to implement locally turn out
|
|
|
|
* to work nicely, then remove the old implementation eventually.
|
|
|
|
*/
|
|
|
|
#define AZF_USE_AC97_LAYER 1
|
|
|
|
|
|
|
|
#ifdef AZF_USE_AC97_LAYER
|
|
|
|
#include <sound/ac97_codec.h>
|
|
|
|
#endif
|
2005-04-17 05:20:36 +07:00
|
|
|
#include "azt3328.h"
|
|
|
|
|
2005-10-25 16:17:45 +07:00
|
|
|
MODULE_AUTHOR("Andreas Mohr <andi AT lisas.de>");
|
2005-04-17 05:20:36 +07:00
|
|
|
MODULE_DESCRIPTION("Aztech AZF3328 (PCI168)");
|
|
|
|
MODULE_LICENSE("GPL");
|
|
|
|
MODULE_SUPPORTED_DEVICE("{{Aztech,AZF3328}}");
|
|
|
|
|
2016-11-13 05:26:41 +07:00
|
|
|
#if IS_REACHABLE(CONFIG_GAMEPORT)
|
[ALSA] PCI168 snd-azt3328 Linux driver: another huge update
- figured out 'Digital(ly) Enhanced Game Port' functionality,
implemented support for it (eliminating gameport polling overhead)
- removed optional joystick activation, gameport now enabled unconditionally,
since we now support it via the PCI I/O space, not via conflict-prone
legacy I/O (which I was thus able to DISABLE now)!
- fix playback bug (a muted wave output would get unmuted upon start of
playback, of course this is not what we want, thus remember mute state)
- implement partial power management: when idle, lower clock rate and disable
codec (reduced noise!), and disable gameport circuit when unused
- instantiate OPL3 timer, too
- much better implementation of snd_azf3328_mixer_write_volume_gradually()
- slightly optimized interrupt handling
- lots of cleanup
This time, I also found a way to verify proper OPL3 operation
via MIDI file playback (emulation via synth hardware).
Signed-off-by: Andreas Mohr <andi@lisas.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2008-05-16 17:18:29 +07:00
|
|
|
#define SUPPORT_GAMEPORT 1
|
2005-04-17 05:20:36 +07:00
|
|
|
#endif
|
|
|
|
|
ALSA: azt3328: large codec cleanup, add I2S port etc.
- fully separate codec I/O port handling, enabling the use of a single
function each for all codecs (playback, capture, I2S out)
- add a new separate pcm for I2S out port (UNTESTED, no I2S DAC
available yet)
- switch gameport to low frequency while idle, to try to reduce noise/power
- improve snd_azf3328_codec_setdmaa() calculation
- minor variable type cleanup (u16, bool etc.)
- add some doc updates (help those lost Windows users, debug help, ...)
Note that due to the large cleanup aspect of the codec I/O change,
I was able to fit everything including all improvements into the
same binary size!! (a measly 10 bytes more or so)
This should now be the almost last patch to this driver
(minus some possible kernel clocksource patch and x86_64 fixes or so).
I just felt like taking a break from the usual stuff and wanted to
get this driver's structure finished, and it's rather clean now...
Tested, working and checkpatch.pl:ed on 2.6.30-rc5,
applies cleanly to 2.6.30 proper.
Signed-off-by: Andreas Mohr <andi@lisas.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2009-07-05 18:55:46 +07:00
|
|
|
/* === Debug settings ===
|
|
|
|
Further diagnostic functionality than the settings below
|
2010-12-28 03:16:43 +07:00
|
|
|
does not need to be provided, since one can easily write a POSIX shell script
|
ALSA: azt3328: large codec cleanup, add I2S port etc.
- fully separate codec I/O port handling, enabling the use of a single
function each for all codecs (playback, capture, I2S out)
- add a new separate pcm for I2S out port (UNTESTED, no I2S DAC
available yet)
- switch gameport to low frequency while idle, to try to reduce noise/power
- improve snd_azf3328_codec_setdmaa() calculation
- minor variable type cleanup (u16, bool etc.)
- add some doc updates (help those lost Windows users, debug help, ...)
Note that due to the large cleanup aspect of the codec I/O change,
I was able to fit everything including all improvements into the
same binary size!! (a measly 10 bytes more or so)
This should now be the almost last patch to this driver
(minus some possible kernel clocksource patch and x86_64 fixes or so).
I just felt like taking a break from the usual stuff and wanted to
get this driver's structure finished, and it's rather clean now...
Tested, working and checkpatch.pl:ed on 2.6.30-rc5,
applies cleanly to 2.6.30 proper.
Signed-off-by: Andreas Mohr <andi@lisas.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2009-07-05 18:55:46 +07:00
|
|
|
to dump the card's I/O ports (those listed in lspci -v -v):
|
2010-12-28 03:16:43 +07:00
|
|
|
dump()
|
ALSA: azt3328: large codec cleanup, add I2S port etc.
- fully separate codec I/O port handling, enabling the use of a single
function each for all codecs (playback, capture, I2S out)
- add a new separate pcm for I2S out port (UNTESTED, no I2S DAC
available yet)
- switch gameport to low frequency while idle, to try to reduce noise/power
- improve snd_azf3328_codec_setdmaa() calculation
- minor variable type cleanup (u16, bool etc.)
- add some doc updates (help those lost Windows users, debug help, ...)
Note that due to the large cleanup aspect of the codec I/O change,
I was able to fit everything including all improvements into the
same binary size!! (a measly 10 bytes more or so)
This should now be the almost last patch to this driver
(minus some possible kernel clocksource patch and x86_64 fixes or so).
I just felt like taking a break from the usual stuff and wanted to
get this driver's structure finished, and it's rather clean now...
Tested, working and checkpatch.pl:ed on 2.6.30-rc5,
applies cleanly to 2.6.30 proper.
Signed-off-by: Andreas Mohr <andi@lisas.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2009-07-05 18:55:46 +07:00
|
|
|
{
|
|
|
|
local descr=$1; local addr=$2; local count=$3
|
|
|
|
|
|
|
|
echo "${descr}: ${count} @ ${addr}:"
|
2010-12-28 03:16:43 +07:00
|
|
|
dd if=/dev/port skip=`printf %d ${addr}` count=${count} bs=1 \
|
|
|
|
2>/dev/null| hexdump -C
|
ALSA: azt3328: large codec cleanup, add I2S port etc.
- fully separate codec I/O port handling, enabling the use of a single
function each for all codecs (playback, capture, I2S out)
- add a new separate pcm for I2S out port (UNTESTED, no I2S DAC
available yet)
- switch gameport to low frequency while idle, to try to reduce noise/power
- improve snd_azf3328_codec_setdmaa() calculation
- minor variable type cleanup (u16, bool etc.)
- add some doc updates (help those lost Windows users, debug help, ...)
Note that due to the large cleanup aspect of the codec I/O change,
I was able to fit everything including all improvements into the
same binary size!! (a measly 10 bytes more or so)
This should now be the almost last patch to this driver
(minus some possible kernel clocksource patch and x86_64 fixes or so).
I just felt like taking a break from the usual stuff and wanted to
get this driver's structure finished, and it's rather clean now...
Tested, working and checkpatch.pl:ed on 2.6.30-rc5,
applies cleanly to 2.6.30 proper.
Signed-off-by: Andreas Mohr <andi@lisas.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2009-07-05 18:55:46 +07:00
|
|
|
}
|
|
|
|
and then use something like
|
|
|
|
"dump joy200 0x200 8", "dump mpu388 0x388 4", "dump joy 0xb400 8",
|
|
|
|
"dump codec00 0xa800 32", "dump mixer 0xb800 64", "dump synth 0xbc00 8",
|
|
|
|
possibly within a "while true; do ... sleep 1; done" loop.
|
|
|
|
Tweaking ports could be done using
|
|
|
|
VALSTRING="`printf "%02x" $value`"
|
2010-12-28 03:16:43 +07:00
|
|
|
printf "\x""$VALSTRING"|dd of=/dev/port seek=`printf %d ${addr}` bs=1 \
|
|
|
|
2>/dev/null
|
ALSA: azt3328: large codec cleanup, add I2S port etc.
- fully separate codec I/O port handling, enabling the use of a single
function each for all codecs (playback, capture, I2S out)
- add a new separate pcm for I2S out port (UNTESTED, no I2S DAC
available yet)
- switch gameport to low frequency while idle, to try to reduce noise/power
- improve snd_azf3328_codec_setdmaa() calculation
- minor variable type cleanup (u16, bool etc.)
- add some doc updates (help those lost Windows users, debug help, ...)
Note that due to the large cleanup aspect of the codec I/O change,
I was able to fit everything including all improvements into the
same binary size!! (a measly 10 bytes more or so)
This should now be the almost last patch to this driver
(minus some possible kernel clocksource patch and x86_64 fixes or so).
I just felt like taking a break from the usual stuff and wanted to
get this driver's structure finished, and it's rather clean now...
Tested, working and checkpatch.pl:ed on 2.6.30-rc5,
applies cleanly to 2.6.30 proper.
Signed-off-by: Andreas Mohr <andi@lisas.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2009-07-05 18:55:46 +07:00
|
|
|
*/
|
|
|
|
|
2005-04-17 05:20:36 +07:00
|
|
|
static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-MAX */
|
|
|
|
module_param_array(index, int, NULL, 0444);
|
|
|
|
MODULE_PARM_DESC(index, "Index value for AZF3328 soundcard.");
|
|
|
|
|
|
|
|
static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */
|
|
|
|
module_param_array(id, charp, NULL, 0444);
|
|
|
|
MODULE_PARM_DESC(id, "ID string for AZF3328 soundcard.");
|
|
|
|
|
2011-12-15 10:19:36 +07:00
|
|
|
static bool enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP; /* Enable this card */
|
2005-04-17 05:20:36 +07:00
|
|
|
module_param_array(enable, bool, NULL, 0444);
|
|
|
|
MODULE_PARM_DESC(enable, "Enable AZF3328 soundcard.");
|
|
|
|
|
2005-10-25 16:17:45 +07:00
|
|
|
static int seqtimer_scaling = 128;
|
|
|
|
module_param(seqtimer_scaling, int, 0444);
|
|
|
|
MODULE_PARM_DESC(seqtimer_scaling, "Set 1024000Hz sequencer timer scale factor (lockup danger!). Default 128.");
|
2005-04-17 05:20:36 +07:00
|
|
|
|
ALSA: azt3328: large codec cleanup, add I2S port etc.
- fully separate codec I/O port handling, enabling the use of a single
function each for all codecs (playback, capture, I2S out)
- add a new separate pcm for I2S out port (UNTESTED, no I2S DAC
available yet)
- switch gameport to low frequency while idle, to try to reduce noise/power
- improve snd_azf3328_codec_setdmaa() calculation
- minor variable type cleanup (u16, bool etc.)
- add some doc updates (help those lost Windows users, debug help, ...)
Note that due to the large cleanup aspect of the codec I/O change,
I was able to fit everything including all improvements into the
same binary size!! (a measly 10 bytes more or so)
This should now be the almost last patch to this driver
(minus some possible kernel clocksource patch and x86_64 fixes or so).
I just felt like taking a break from the usual stuff and wanted to
get this driver's structure finished, and it's rather clean now...
Tested, working and checkpatch.pl:ed on 2.6.30-rc5,
applies cleanly to 2.6.30 proper.
Signed-off-by: Andreas Mohr <andi@lisas.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2009-07-05 18:55:46 +07:00
|
|
|
enum snd_azf3328_codec_type {
|
2010-12-28 03:16:43 +07:00
|
|
|
/* warning: fixed indices (also used for bitmask checks!) */
|
ALSA: azt3328: large codec cleanup, add I2S port etc.
- fully separate codec I/O port handling, enabling the use of a single
function each for all codecs (playback, capture, I2S out)
- add a new separate pcm for I2S out port (UNTESTED, no I2S DAC
available yet)
- switch gameport to low frequency while idle, to try to reduce noise/power
- improve snd_azf3328_codec_setdmaa() calculation
- minor variable type cleanup (u16, bool etc.)
- add some doc updates (help those lost Windows users, debug help, ...)
Note that due to the large cleanup aspect of the codec I/O change,
I was able to fit everything including all improvements into the
same binary size!! (a measly 10 bytes more or so)
This should now be the almost last patch to this driver
(minus some possible kernel clocksource patch and x86_64 fixes or so).
I just felt like taking a break from the usual stuff and wanted to
get this driver's structure finished, and it's rather clean now...
Tested, working and checkpatch.pl:ed on 2.6.30-rc5,
applies cleanly to 2.6.30 proper.
Signed-off-by: Andreas Mohr <andi@lisas.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2009-07-05 18:55:46 +07:00
|
|
|
AZF_CODEC_PLAYBACK = 0,
|
|
|
|
AZF_CODEC_CAPTURE = 1,
|
|
|
|
AZF_CODEC_I2S_OUT = 2,
|
[ALSA] PCI168 snd-azt3328 Linux driver: another huge update
- figured out 'Digital(ly) Enhanced Game Port' functionality,
implemented support for it (eliminating gameport polling overhead)
- removed optional joystick activation, gameport now enabled unconditionally,
since we now support it via the PCI I/O space, not via conflict-prone
legacy I/O (which I was thus able to DISABLE now)!
- fix playback bug (a muted wave output would get unmuted upon start of
playback, of course this is not what we want, thus remember mute state)
- implement partial power management: when idle, lower clock rate and disable
codec (reduced noise!), and disable gameport circuit when unused
- instantiate OPL3 timer, too
- much better implementation of snd_azf3328_mixer_write_volume_gradually()
- slightly optimized interrupt handling
- lots of cleanup
This time, I also found a way to verify proper OPL3 operation
via MIDI file playback (emulation via synth hardware).
Signed-off-by: Andreas Mohr <andi@lisas.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2008-05-16 17:18:29 +07:00
|
|
|
};
|
|
|
|
|
2010-12-28 03:17:26 +07:00
|
|
|
struct snd_azf3328_codec_data {
|
|
|
|
unsigned long io_base; /* keep first! (avoid offset calc) */
|
|
|
|
unsigned int dma_base; /* helper to avoid an indirection in hotpath */
|
|
|
|
spinlock_t *lock; /* TODO: convert to our own per-codec lock member */
|
|
|
|
struct snd_pcm_substream *substream;
|
|
|
|
bool running;
|
|
|
|
enum snd_azf3328_codec_type type;
|
|
|
|
const char *name;
|
|
|
|
};
|
|
|
|
|
2005-11-17 21:02:42 +07:00
|
|
|
struct snd_azf3328 {
|
2005-10-25 16:17:45 +07:00
|
|
|
/* often-used fields towards beginning, then grouped */
|
[ALSA] PCI168 snd-azt3328 Linux driver: another huge update
- figured out 'Digital(ly) Enhanced Game Port' functionality,
implemented support for it (eliminating gameport polling overhead)
- removed optional joystick activation, gameport now enabled unconditionally,
since we now support it via the PCI I/O space, not via conflict-prone
legacy I/O (which I was thus able to DISABLE now)!
- fix playback bug (a muted wave output would get unmuted upon start of
playback, of course this is not what we want, thus remember mute state)
- implement partial power management: when idle, lower clock rate and disable
codec (reduced noise!), and disable gameport circuit when unused
- instantiate OPL3 timer, too
- much better implementation of snd_azf3328_mixer_write_volume_gradually()
- slightly optimized interrupt handling
- lots of cleanup
This time, I also found a way to verify proper OPL3 operation
via MIDI file playback (emulation via synth hardware).
Signed-off-by: Andreas Mohr <andi@lisas.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2008-05-16 17:18:29 +07:00
|
|
|
|
ALSA: azt3328: large codec cleanup, add I2S port etc.
- fully separate codec I/O port handling, enabling the use of a single
function each for all codecs (playback, capture, I2S out)
- add a new separate pcm for I2S out port (UNTESTED, no I2S DAC
available yet)
- switch gameport to low frequency while idle, to try to reduce noise/power
- improve snd_azf3328_codec_setdmaa() calculation
- minor variable type cleanup (u16, bool etc.)
- add some doc updates (help those lost Windows users, debug help, ...)
Note that due to the large cleanup aspect of the codec I/O change,
I was able to fit everything including all improvements into the
same binary size!! (a measly 10 bytes more or so)
This should now be the almost last patch to this driver
(minus some possible kernel clocksource patch and x86_64 fixes or so).
I just felt like taking a break from the usual stuff and wanted to
get this driver's structure finished, and it's rather clean now...
Tested, working and checkpatch.pl:ed on 2.6.30-rc5,
applies cleanly to 2.6.30 proper.
Signed-off-by: Andreas Mohr <andi@lisas.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2009-07-05 18:55:46 +07:00
|
|
|
unsigned long ctrl_io; /* usually 0xb000, size 128 */
|
[ALSA] PCI168 snd-azt3328 Linux driver: another huge update
- figured out 'Digital(ly) Enhanced Game Port' functionality,
implemented support for it (eliminating gameport polling overhead)
- removed optional joystick activation, gameport now enabled unconditionally,
since we now support it via the PCI I/O space, not via conflict-prone
legacy I/O (which I was thus able to DISABLE now)!
- fix playback bug (a muted wave output would get unmuted upon start of
playback, of course this is not what we want, thus remember mute state)
- implement partial power management: when idle, lower clock rate and disable
codec (reduced noise!), and disable gameport circuit when unused
- instantiate OPL3 timer, too
- much better implementation of snd_azf3328_mixer_write_volume_gradually()
- slightly optimized interrupt handling
- lots of cleanup
This time, I also found a way to verify proper OPL3 operation
via MIDI file playback (emulation via synth hardware).
Signed-off-by: Andreas Mohr <andi@lisas.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2008-05-16 17:18:29 +07:00
|
|
|
unsigned long game_io; /* usually 0xb400, size 8 */
|
|
|
|
unsigned long mpu_io; /* usually 0xb800, size 4 */
|
|
|
|
unsigned long opl3_io; /* usually 0xbc00, size 8 */
|
|
|
|
unsigned long mixer_io; /* usually 0xc000, size 64 */
|
2005-04-17 05:20:36 +07:00
|
|
|
|
2005-10-25 16:17:45 +07:00
|
|
|
spinlock_t reg_lock;
|
2005-04-17 05:20:36 +07:00
|
|
|
|
2005-11-17 21:02:42 +07:00
|
|
|
struct snd_timer *timer;
|
[ALSA] PCI168 snd-azt3328 Linux driver: another huge update
- figured out 'Digital(ly) Enhanced Game Port' functionality,
implemented support for it (eliminating gameport polling overhead)
- removed optional joystick activation, gameport now enabled unconditionally,
since we now support it via the PCI I/O space, not via conflict-prone
legacy I/O (which I was thus able to DISABLE now)!
- fix playback bug (a muted wave output would get unmuted upon start of
playback, of course this is not what we want, thus remember mute state)
- implement partial power management: when idle, lower clock rate and disable
codec (reduced noise!), and disable gameport circuit when unused
- instantiate OPL3 timer, too
- much better implementation of snd_azf3328_mixer_write_volume_gradually()
- slightly optimized interrupt handling
- lots of cleanup
This time, I also found a way to verify proper OPL3 operation
via MIDI file playback (emulation via synth hardware).
Signed-off-by: Andreas Mohr <andi@lisas.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2008-05-16 17:18:29 +07:00
|
|
|
|
ALSA: azt3328: large codec cleanup, add I2S port etc.
- fully separate codec I/O port handling, enabling the use of a single
function each for all codecs (playback, capture, I2S out)
- add a new separate pcm for I2S out port (UNTESTED, no I2S DAC
available yet)
- switch gameport to low frequency while idle, to try to reduce noise/power
- improve snd_azf3328_codec_setdmaa() calculation
- minor variable type cleanup (u16, bool etc.)
- add some doc updates (help those lost Windows users, debug help, ...)
Note that due to the large cleanup aspect of the codec I/O change,
I was able to fit everything including all improvements into the
same binary size!! (a measly 10 bytes more or so)
This should now be the almost last patch to this driver
(minus some possible kernel clocksource patch and x86_64 fixes or so).
I just felt like taking a break from the usual stuff and wanted to
get this driver's structure finished, and it's rather clean now...
Tested, working and checkpatch.pl:ed on 2.6.30-rc5,
applies cleanly to 2.6.30 proper.
Signed-off-by: Andreas Mohr <andi@lisas.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2009-07-05 18:55:46 +07:00
|
|
|
struct snd_pcm *pcm[3];
|
|
|
|
|
|
|
|
/* playback, recording and I2S out codecs */
|
|
|
|
struct snd_azf3328_codec_data codecs[3];
|
2005-04-17 05:20:36 +07:00
|
|
|
|
2011-02-19 06:49:32 +07:00
|
|
|
#ifdef AZF_USE_AC97_LAYER
|
|
|
|
struct snd_ac97 *ac97;
|
|
|
|
#endif
|
|
|
|
|
2005-11-17 21:02:42 +07:00
|
|
|
struct snd_card *card;
|
|
|
|
struct snd_rawmidi *rmidi;
|
2005-10-25 16:17:45 +07:00
|
|
|
|
[ALSA] PCI168 snd-azt3328 Linux driver: another huge update
- figured out 'Digital(ly) Enhanced Game Port' functionality,
implemented support for it (eliminating gameport polling overhead)
- removed optional joystick activation, gameport now enabled unconditionally,
since we now support it via the PCI I/O space, not via conflict-prone
legacy I/O (which I was thus able to DISABLE now)!
- fix playback bug (a muted wave output would get unmuted upon start of
playback, of course this is not what we want, thus remember mute state)
- implement partial power management: when idle, lower clock rate and disable
codec (reduced noise!), and disable gameport circuit when unused
- instantiate OPL3 timer, too
- much better implementation of snd_azf3328_mixer_write_volume_gradually()
- slightly optimized interrupt handling
- lots of cleanup
This time, I also found a way to verify proper OPL3 operation
via MIDI file playback (emulation via synth hardware).
Signed-off-by: Andreas Mohr <andi@lisas.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2008-05-16 17:18:29 +07:00
|
|
|
#ifdef SUPPORT_GAMEPORT
|
2005-10-25 16:17:45 +07:00
|
|
|
struct gameport *gameport;
|
ALSA: azt3328: large codec cleanup, add I2S port etc.
- fully separate codec I/O port handling, enabling the use of a single
function each for all codecs (playback, capture, I2S out)
- add a new separate pcm for I2S out port (UNTESTED, no I2S DAC
available yet)
- switch gameport to low frequency while idle, to try to reduce noise/power
- improve snd_azf3328_codec_setdmaa() calculation
- minor variable type cleanup (u16, bool etc.)
- add some doc updates (help those lost Windows users, debug help, ...)
Note that due to the large cleanup aspect of the codec I/O change,
I was able to fit everything including all improvements into the
same binary size!! (a measly 10 bytes more or so)
This should now be the almost last patch to this driver
(minus some possible kernel clocksource patch and x86_64 fixes or so).
I just felt like taking a break from the usual stuff and wanted to
get this driver's structure finished, and it's rather clean now...
Tested, working and checkpatch.pl:ed on 2.6.30-rc5,
applies cleanly to 2.6.30 proper.
Signed-off-by: Andreas Mohr <andi@lisas.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2009-07-05 18:55:46 +07:00
|
|
|
u16 axes[4];
|
2005-10-25 16:17:45 +07:00
|
|
|
#endif
|
2005-04-17 05:20:36 +07:00
|
|
|
|
2005-10-25 16:17:45 +07:00
|
|
|
struct pci_dev *pci;
|
|
|
|
int irq;
|
2006-05-17 16:02:24 +07:00
|
|
|
|
2008-06-23 16:50:47 +07:00
|
|
|
/* register 0x6a is write-only, thus need to remember setting.
|
|
|
|
* If we need to add more registers here, then we might try to fold this
|
|
|
|
* into some transparent combined shadow register handling with
|
|
|
|
* CONFIG_PM register storage below, but that's slightly difficult. */
|
ALSA: azt3328: large codec cleanup, add I2S port etc.
- fully separate codec I/O port handling, enabling the use of a single
function each for all codecs (playback, capture, I2S out)
- add a new separate pcm for I2S out port (UNTESTED, no I2S DAC
available yet)
- switch gameport to low frequency while idle, to try to reduce noise/power
- improve snd_azf3328_codec_setdmaa() calculation
- minor variable type cleanup (u16, bool etc.)
- add some doc updates (help those lost Windows users, debug help, ...)
Note that due to the large cleanup aspect of the codec I/O change,
I was able to fit everything including all improvements into the
same binary size!! (a measly 10 bytes more or so)
This should now be the almost last patch to this driver
(minus some possible kernel clocksource patch and x86_64 fixes or so).
I just felt like taking a break from the usual stuff and wanted to
get this driver's structure finished, and it's rather clean now...
Tested, working and checkpatch.pl:ed on 2.6.30-rc5,
applies cleanly to 2.6.30 proper.
Signed-off-by: Andreas Mohr <andi@lisas.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2009-07-05 18:55:46 +07:00
|
|
|
u16 shadow_reg_ctrl_6AH;
|
2008-06-23 16:50:47 +07:00
|
|
|
|
2012-08-14 23:12:04 +07:00
|
|
|
#ifdef CONFIG_PM_SLEEP
|
2006-05-17 16:02:24 +07:00
|
|
|
/* register value containers for power management
|
2009-07-13 03:17:54 +07:00
|
|
|
* Note: not always full I/O range preserved (similar to Win driver!) */
|
|
|
|
u32 saved_regs_ctrl[AZF_ALIGN(AZF_IO_SIZE_CTRL_PM) / 4];
|
|
|
|
u32 saved_regs_game[AZF_ALIGN(AZF_IO_SIZE_GAME_PM) / 4];
|
|
|
|
u32 saved_regs_mpu[AZF_ALIGN(AZF_IO_SIZE_MPU_PM) / 4];
|
|
|
|
u32 saved_regs_opl3[AZF_ALIGN(AZF_IO_SIZE_OPL3_PM) / 4];
|
|
|
|
u32 saved_regs_mixer[AZF_ALIGN(AZF_IO_SIZE_MIXER_PM) / 4];
|
2006-05-17 16:02:24 +07:00
|
|
|
#endif
|
2005-11-17 21:02:42 +07:00
|
|
|
};
|
2005-10-25 16:17:45 +07:00
|
|
|
|
2014-08-08 20:56:03 +07:00
|
|
|
static const struct pci_device_id snd_azf3328_ids[] = {
|
2005-04-17 05:20:36 +07:00
|
|
|
{ 0x122D, 0x50DC, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 }, /* PCI168/3328 */
|
|
|
|
{ 0x122D, 0x80DA, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 }, /* 3328 */
|
|
|
|
{ 0, }
|
|
|
|
};
|
|
|
|
|
|
|
|
MODULE_DEVICE_TABLE(pci, snd_azf3328_ids);
|
|
|
|
|
[ALSA] PCI168 snd-azt3328 Linux driver: another huge update
- figured out 'Digital(ly) Enhanced Game Port' functionality,
implemented support for it (eliminating gameport polling overhead)
- removed optional joystick activation, gameport now enabled unconditionally,
since we now support it via the PCI I/O space, not via conflict-prone
legacy I/O (which I was thus able to DISABLE now)!
- fix playback bug (a muted wave output would get unmuted upon start of
playback, of course this is not what we want, thus remember mute state)
- implement partial power management: when idle, lower clock rate and disable
codec (reduced noise!), and disable gameport circuit when unused
- instantiate OPL3 timer, too
- much better implementation of snd_azf3328_mixer_write_volume_gradually()
- slightly optimized interrupt handling
- lots of cleanup
This time, I also found a way to verify proper OPL3 operation
via MIDI file playback (emulation via synth hardware).
Signed-off-by: Andreas Mohr <andi@lisas.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2008-05-16 17:18:29 +07:00
|
|
|
|
|
|
|
static int
|
ALSA: azt3328: large codec cleanup, add I2S port etc.
- fully separate codec I/O port handling, enabling the use of a single
function each for all codecs (playback, capture, I2S out)
- add a new separate pcm for I2S out port (UNTESTED, no I2S DAC
available yet)
- switch gameport to low frequency while idle, to try to reduce noise/power
- improve snd_azf3328_codec_setdmaa() calculation
- minor variable type cleanup (u16, bool etc.)
- add some doc updates (help those lost Windows users, debug help, ...)
Note that due to the large cleanup aspect of the codec I/O change,
I was able to fit everything including all improvements into the
same binary size!! (a measly 10 bytes more or so)
This should now be the almost last patch to this driver
(minus some possible kernel clocksource patch and x86_64 fixes or so).
I just felt like taking a break from the usual stuff and wanted to
get this driver's structure finished, and it's rather clean now...
Tested, working and checkpatch.pl:ed on 2.6.30-rc5,
applies cleanly to 2.6.30 proper.
Signed-off-by: Andreas Mohr <andi@lisas.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2009-07-05 18:55:46 +07:00
|
|
|
snd_azf3328_io_reg_setb(unsigned reg, u8 mask, bool do_set)
|
[ALSA] PCI168 snd-azt3328 Linux driver: another huge update
- figured out 'Digital(ly) Enhanced Game Port' functionality,
implemented support for it (eliminating gameport polling overhead)
- removed optional joystick activation, gameport now enabled unconditionally,
since we now support it via the PCI I/O space, not via conflict-prone
legacy I/O (which I was thus able to DISABLE now)!
- fix playback bug (a muted wave output would get unmuted upon start of
playback, of course this is not what we want, thus remember mute state)
- implement partial power management: when idle, lower clock rate and disable
codec (reduced noise!), and disable gameport circuit when unused
- instantiate OPL3 timer, too
- much better implementation of snd_azf3328_mixer_write_volume_gradually()
- slightly optimized interrupt handling
- lots of cleanup
This time, I also found a way to verify proper OPL3 operation
via MIDI file playback (emulation via synth hardware).
Signed-off-by: Andreas Mohr <andi@lisas.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2008-05-16 17:18:29 +07:00
|
|
|
{
|
2010-12-28 03:16:43 +07:00
|
|
|
/* Well, strictly spoken, the inb/outb sequence isn't atomic
|
|
|
|
and would need locking. However we currently don't care
|
|
|
|
since it potentially complicates matters. */
|
[ALSA] PCI168 snd-azt3328 Linux driver: another huge update
- figured out 'Digital(ly) Enhanced Game Port' functionality,
implemented support for it (eliminating gameport polling overhead)
- removed optional joystick activation, gameport now enabled unconditionally,
since we now support it via the PCI I/O space, not via conflict-prone
legacy I/O (which I was thus able to DISABLE now)!
- fix playback bug (a muted wave output would get unmuted upon start of
playback, of course this is not what we want, thus remember mute state)
- implement partial power management: when idle, lower clock rate and disable
codec (reduced noise!), and disable gameport circuit when unused
- instantiate OPL3 timer, too
- much better implementation of snd_azf3328_mixer_write_volume_gradually()
- slightly optimized interrupt handling
- lots of cleanup
This time, I also found a way to verify proper OPL3 operation
via MIDI file playback (emulation via synth hardware).
Signed-off-by: Andreas Mohr <andi@lisas.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2008-05-16 17:18:29 +07:00
|
|
|
u8 prev = inb(reg), new;
|
|
|
|
|
|
|
|
new = (do_set) ? (prev|mask) : (prev & ~mask);
|
|
|
|
/* we need to always write the new value no matter whether it differs
|
|
|
|
* or not, since some register bits don't indicate their setting */
|
|
|
|
outb(new, reg);
|
|
|
|
if (new != prev)
|
|
|
|
return 1;
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2005-10-25 16:17:45 +07:00
|
|
|
static inline void
|
ALSA: azt3328: large codec cleanup, add I2S port etc.
- fully separate codec I/O port handling, enabling the use of a single
function each for all codecs (playback, capture, I2S out)
- add a new separate pcm for I2S out port (UNTESTED, no I2S DAC
available yet)
- switch gameport to low frequency while idle, to try to reduce noise/power
- improve snd_azf3328_codec_setdmaa() calculation
- minor variable type cleanup (u16, bool etc.)
- add some doc updates (help those lost Windows users, debug help, ...)
Note that due to the large cleanup aspect of the codec I/O change,
I was able to fit everything including all improvements into the
same binary size!! (a measly 10 bytes more or so)
This should now be the almost last patch to this driver
(minus some possible kernel clocksource patch and x86_64 fixes or so).
I just felt like taking a break from the usual stuff and wanted to
get this driver's structure finished, and it's rather clean now...
Tested, working and checkpatch.pl:ed on 2.6.30-rc5,
applies cleanly to 2.6.30 proper.
Signed-off-by: Andreas Mohr <andi@lisas.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2009-07-05 18:55:46 +07:00
|
|
|
snd_azf3328_codec_outb(const struct snd_azf3328_codec_data *codec,
|
|
|
|
unsigned reg,
|
|
|
|
u8 value
|
|
|
|
)
|
2005-10-25 16:17:45 +07:00
|
|
|
{
|
ALSA: azt3328: large codec cleanup, add I2S port etc.
- fully separate codec I/O port handling, enabling the use of a single
function each for all codecs (playback, capture, I2S out)
- add a new separate pcm for I2S out port (UNTESTED, no I2S DAC
available yet)
- switch gameport to low frequency while idle, to try to reduce noise/power
- improve snd_azf3328_codec_setdmaa() calculation
- minor variable type cleanup (u16, bool etc.)
- add some doc updates (help those lost Windows users, debug help, ...)
Note that due to the large cleanup aspect of the codec I/O change,
I was able to fit everything including all improvements into the
same binary size!! (a measly 10 bytes more or so)
This should now be the almost last patch to this driver
(minus some possible kernel clocksource patch and x86_64 fixes or so).
I just felt like taking a break from the usual stuff and wanted to
get this driver's structure finished, and it's rather clean now...
Tested, working and checkpatch.pl:ed on 2.6.30-rc5,
applies cleanly to 2.6.30 proper.
Signed-off-by: Andreas Mohr <andi@lisas.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2009-07-05 18:55:46 +07:00
|
|
|
outb(value, codec->io_base + reg);
|
2005-10-25 16:17:45 +07:00
|
|
|
}
|
|
|
|
|
|
|
|
static inline u8
|
ALSA: azt3328: large codec cleanup, add I2S port etc.
- fully separate codec I/O port handling, enabling the use of a single
function each for all codecs (playback, capture, I2S out)
- add a new separate pcm for I2S out port (UNTESTED, no I2S DAC
available yet)
- switch gameport to low frequency while idle, to try to reduce noise/power
- improve snd_azf3328_codec_setdmaa() calculation
- minor variable type cleanup (u16, bool etc.)
- add some doc updates (help those lost Windows users, debug help, ...)
Note that due to the large cleanup aspect of the codec I/O change,
I was able to fit everything including all improvements into the
same binary size!! (a measly 10 bytes more or so)
This should now be the almost last patch to this driver
(minus some possible kernel clocksource patch and x86_64 fixes or so).
I just felt like taking a break from the usual stuff and wanted to
get this driver's structure finished, and it's rather clean now...
Tested, working and checkpatch.pl:ed on 2.6.30-rc5,
applies cleanly to 2.6.30 proper.
Signed-off-by: Andreas Mohr <andi@lisas.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2009-07-05 18:55:46 +07:00
|
|
|
snd_azf3328_codec_inb(const struct snd_azf3328_codec_data *codec, unsigned reg)
|
2005-10-25 16:17:45 +07:00
|
|
|
{
|
ALSA: azt3328: large codec cleanup, add I2S port etc.
- fully separate codec I/O port handling, enabling the use of a single
function each for all codecs (playback, capture, I2S out)
- add a new separate pcm for I2S out port (UNTESTED, no I2S DAC
available yet)
- switch gameport to low frequency while idle, to try to reduce noise/power
- improve snd_azf3328_codec_setdmaa() calculation
- minor variable type cleanup (u16, bool etc.)
- add some doc updates (help those lost Windows users, debug help, ...)
Note that due to the large cleanup aspect of the codec I/O change,
I was able to fit everything including all improvements into the
same binary size!! (a measly 10 bytes more or so)
This should now be the almost last patch to this driver
(minus some possible kernel clocksource patch and x86_64 fixes or so).
I just felt like taking a break from the usual stuff and wanted to
get this driver's structure finished, and it's rather clean now...
Tested, working and checkpatch.pl:ed on 2.6.30-rc5,
applies cleanly to 2.6.30 proper.
Signed-off-by: Andreas Mohr <andi@lisas.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2009-07-05 18:55:46 +07:00
|
|
|
return inb(codec->io_base + reg);
|
2005-10-25 16:17:45 +07:00
|
|
|
}
|
|
|
|
|
|
|
|
static inline void
|
ALSA: azt3328: large codec cleanup, add I2S port etc.
- fully separate codec I/O port handling, enabling the use of a single
function each for all codecs (playback, capture, I2S out)
- add a new separate pcm for I2S out port (UNTESTED, no I2S DAC
available yet)
- switch gameport to low frequency while idle, to try to reduce noise/power
- improve snd_azf3328_codec_setdmaa() calculation
- minor variable type cleanup (u16, bool etc.)
- add some doc updates (help those lost Windows users, debug help, ...)
Note that due to the large cleanup aspect of the codec I/O change,
I was able to fit everything including all improvements into the
same binary size!! (a measly 10 bytes more or so)
This should now be the almost last patch to this driver
(minus some possible kernel clocksource patch and x86_64 fixes or so).
I just felt like taking a break from the usual stuff and wanted to
get this driver's structure finished, and it's rather clean now...
Tested, working and checkpatch.pl:ed on 2.6.30-rc5,
applies cleanly to 2.6.30 proper.
Signed-off-by: Andreas Mohr <andi@lisas.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2009-07-05 18:55:46 +07:00
|
|
|
snd_azf3328_codec_outw(const struct snd_azf3328_codec_data *codec,
|
|
|
|
unsigned reg,
|
|
|
|
u16 value
|
|
|
|
)
|
2005-10-25 16:17:45 +07:00
|
|
|
{
|
ALSA: azt3328: large codec cleanup, add I2S port etc.
- fully separate codec I/O port handling, enabling the use of a single
function each for all codecs (playback, capture, I2S out)
- add a new separate pcm for I2S out port (UNTESTED, no I2S DAC
available yet)
- switch gameport to low frequency while idle, to try to reduce noise/power
- improve snd_azf3328_codec_setdmaa() calculation
- minor variable type cleanup (u16, bool etc.)
- add some doc updates (help those lost Windows users, debug help, ...)
Note that due to the large cleanup aspect of the codec I/O change,
I was able to fit everything including all improvements into the
same binary size!! (a measly 10 bytes more or so)
This should now be the almost last patch to this driver
(minus some possible kernel clocksource patch and x86_64 fixes or so).
I just felt like taking a break from the usual stuff and wanted to
get this driver's structure finished, and it's rather clean now...
Tested, working and checkpatch.pl:ed on 2.6.30-rc5,
applies cleanly to 2.6.30 proper.
Signed-off-by: Andreas Mohr <andi@lisas.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2009-07-05 18:55:46 +07:00
|
|
|
outw(value, codec->io_base + reg);
|
2005-10-25 16:17:45 +07:00
|
|
|
}
|
|
|
|
|
|
|
|
static inline u16
|
ALSA: azt3328: large codec cleanup, add I2S port etc.
- fully separate codec I/O port handling, enabling the use of a single
function each for all codecs (playback, capture, I2S out)
- add a new separate pcm for I2S out port (UNTESTED, no I2S DAC
available yet)
- switch gameport to low frequency while idle, to try to reduce noise/power
- improve snd_azf3328_codec_setdmaa() calculation
- minor variable type cleanup (u16, bool etc.)
- add some doc updates (help those lost Windows users, debug help, ...)
Note that due to the large cleanup aspect of the codec I/O change,
I was able to fit everything including all improvements into the
same binary size!! (a measly 10 bytes more or so)
This should now be the almost last patch to this driver
(minus some possible kernel clocksource patch and x86_64 fixes or so).
I just felt like taking a break from the usual stuff and wanted to
get this driver's structure finished, and it's rather clean now...
Tested, working and checkpatch.pl:ed on 2.6.30-rc5,
applies cleanly to 2.6.30 proper.
Signed-off-by: Andreas Mohr <andi@lisas.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2009-07-05 18:55:46 +07:00
|
|
|
snd_azf3328_codec_inw(const struct snd_azf3328_codec_data *codec, unsigned reg)
|
[ALSA] PCI168 snd-azt3328 Linux driver: another huge update
- figured out 'Digital(ly) Enhanced Game Port' functionality,
implemented support for it (eliminating gameport polling overhead)
- removed optional joystick activation, gameport now enabled unconditionally,
since we now support it via the PCI I/O space, not via conflict-prone
legacy I/O (which I was thus able to DISABLE now)!
- fix playback bug (a muted wave output would get unmuted upon start of
playback, of course this is not what we want, thus remember mute state)
- implement partial power management: when idle, lower clock rate and disable
codec (reduced noise!), and disable gameport circuit when unused
- instantiate OPL3 timer, too
- much better implementation of snd_azf3328_mixer_write_volume_gradually()
- slightly optimized interrupt handling
- lots of cleanup
This time, I also found a way to verify proper OPL3 operation
via MIDI file playback (emulation via synth hardware).
Signed-off-by: Andreas Mohr <andi@lisas.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2008-05-16 17:18:29 +07:00
|
|
|
{
|
ALSA: azt3328: large codec cleanup, add I2S port etc.
- fully separate codec I/O port handling, enabling the use of a single
function each for all codecs (playback, capture, I2S out)
- add a new separate pcm for I2S out port (UNTESTED, no I2S DAC
available yet)
- switch gameport to low frequency while idle, to try to reduce noise/power
- improve snd_azf3328_codec_setdmaa() calculation
- minor variable type cleanup (u16, bool etc.)
- add some doc updates (help those lost Windows users, debug help, ...)
Note that due to the large cleanup aspect of the codec I/O change,
I was able to fit everything including all improvements into the
same binary size!! (a measly 10 bytes more or so)
This should now be the almost last patch to this driver
(minus some possible kernel clocksource patch and x86_64 fixes or so).
I just felt like taking a break from the usual stuff and wanted to
get this driver's structure finished, and it's rather clean now...
Tested, working and checkpatch.pl:ed on 2.6.30-rc5,
applies cleanly to 2.6.30 proper.
Signed-off-by: Andreas Mohr <andi@lisas.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2009-07-05 18:55:46 +07:00
|
|
|
return inw(codec->io_base + reg);
|
[ALSA] PCI168 snd-azt3328 Linux driver: another huge update
- figured out 'Digital(ly) Enhanced Game Port' functionality,
implemented support for it (eliminating gameport polling overhead)
- removed optional joystick activation, gameport now enabled unconditionally,
since we now support it via the PCI I/O space, not via conflict-prone
legacy I/O (which I was thus able to DISABLE now)!
- fix playback bug (a muted wave output would get unmuted upon start of
playback, of course this is not what we want, thus remember mute state)
- implement partial power management: when idle, lower clock rate and disable
codec (reduced noise!), and disable gameport circuit when unused
- instantiate OPL3 timer, too
- much better implementation of snd_azf3328_mixer_write_volume_gradually()
- slightly optimized interrupt handling
- lots of cleanup
This time, I also found a way to verify proper OPL3 operation
via MIDI file playback (emulation via synth hardware).
Signed-off-by: Andreas Mohr <andi@lisas.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2008-05-16 17:18:29 +07:00
|
|
|
}
|
|
|
|
|
|
|
|
static inline void
|
ALSA: azt3328: large codec cleanup, add I2S port etc.
- fully separate codec I/O port handling, enabling the use of a single
function each for all codecs (playback, capture, I2S out)
- add a new separate pcm for I2S out port (UNTESTED, no I2S DAC
available yet)
- switch gameport to low frequency while idle, to try to reduce noise/power
- improve snd_azf3328_codec_setdmaa() calculation
- minor variable type cleanup (u16, bool etc.)
- add some doc updates (help those lost Windows users, debug help, ...)
Note that due to the large cleanup aspect of the codec I/O change,
I was able to fit everything including all improvements into the
same binary size!! (a measly 10 bytes more or so)
This should now be the almost last patch to this driver
(minus some possible kernel clocksource patch and x86_64 fixes or so).
I just felt like taking a break from the usual stuff and wanted to
get this driver's structure finished, and it's rather clean now...
Tested, working and checkpatch.pl:ed on 2.6.30-rc5,
applies cleanly to 2.6.30 proper.
Signed-off-by: Andreas Mohr <andi@lisas.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2009-07-05 18:55:46 +07:00
|
|
|
snd_azf3328_codec_outl(const struct snd_azf3328_codec_data *codec,
|
|
|
|
unsigned reg,
|
|
|
|
u32 value
|
|
|
|
)
|
[ALSA] PCI168 snd-azt3328 Linux driver: another huge update
- figured out 'Digital(ly) Enhanced Game Port' functionality,
implemented support for it (eliminating gameport polling overhead)
- removed optional joystick activation, gameport now enabled unconditionally,
since we now support it via the PCI I/O space, not via conflict-prone
legacy I/O (which I was thus able to DISABLE now)!
- fix playback bug (a muted wave output would get unmuted upon start of
playback, of course this is not what we want, thus remember mute state)
- implement partial power management: when idle, lower clock rate and disable
codec (reduced noise!), and disable gameport circuit when unused
- instantiate OPL3 timer, too
- much better implementation of snd_azf3328_mixer_write_volume_gradually()
- slightly optimized interrupt handling
- lots of cleanup
This time, I also found a way to verify proper OPL3 operation
via MIDI file playback (emulation via synth hardware).
Signed-off-by: Andreas Mohr <andi@lisas.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2008-05-16 17:18:29 +07:00
|
|
|
{
|
ALSA: azt3328: large codec cleanup, add I2S port etc.
- fully separate codec I/O port handling, enabling the use of a single
function each for all codecs (playback, capture, I2S out)
- add a new separate pcm for I2S out port (UNTESTED, no I2S DAC
available yet)
- switch gameport to low frequency while idle, to try to reduce noise/power
- improve snd_azf3328_codec_setdmaa() calculation
- minor variable type cleanup (u16, bool etc.)
- add some doc updates (help those lost Windows users, debug help, ...)
Note that due to the large cleanup aspect of the codec I/O change,
I was able to fit everything including all improvements into the
same binary size!! (a measly 10 bytes more or so)
This should now be the almost last patch to this driver
(minus some possible kernel clocksource patch and x86_64 fixes or so).
I just felt like taking a break from the usual stuff and wanted to
get this driver's structure finished, and it's rather clean now...
Tested, working and checkpatch.pl:ed on 2.6.30-rc5,
applies cleanly to 2.6.30 proper.
Signed-off-by: Andreas Mohr <andi@lisas.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2009-07-05 18:55:46 +07:00
|
|
|
outl(value, codec->io_base + reg);
|
[ALSA] PCI168 snd-azt3328 Linux driver: another huge update
- figured out 'Digital(ly) Enhanced Game Port' functionality,
implemented support for it (eliminating gameport polling overhead)
- removed optional joystick activation, gameport now enabled unconditionally,
since we now support it via the PCI I/O space, not via conflict-prone
legacy I/O (which I was thus able to DISABLE now)!
- fix playback bug (a muted wave output would get unmuted upon start of
playback, of course this is not what we want, thus remember mute state)
- implement partial power management: when idle, lower clock rate and disable
codec (reduced noise!), and disable gameport circuit when unused
- instantiate OPL3 timer, too
- much better implementation of snd_azf3328_mixer_write_volume_gradually()
- slightly optimized interrupt handling
- lots of cleanup
This time, I also found a way to verify proper OPL3 operation
via MIDI file playback (emulation via synth hardware).
Signed-off-by: Andreas Mohr <andi@lisas.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2008-05-16 17:18:29 +07:00
|
|
|
}
|
|
|
|
|
2010-12-28 03:17:35 +07:00
|
|
|
static inline void
|
|
|
|
snd_azf3328_codec_outl_multi(const struct snd_azf3328_codec_data *codec,
|
|
|
|
unsigned reg, const void *buffer, int count
|
|
|
|
)
|
|
|
|
{
|
|
|
|
unsigned long addr = codec->io_base + reg;
|
|
|
|
if (count) {
|
|
|
|
const u32 *buf = buffer;
|
|
|
|
do {
|
|
|
|
outl(*buf++, addr);
|
|
|
|
addr += 4;
|
|
|
|
} while (--count);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
[ALSA] PCI168 snd-azt3328 Linux driver: another huge update
- figured out 'Digital(ly) Enhanced Game Port' functionality,
implemented support for it (eliminating gameport polling overhead)
- removed optional joystick activation, gameport now enabled unconditionally,
since we now support it via the PCI I/O space, not via conflict-prone
legacy I/O (which I was thus able to DISABLE now)!
- fix playback bug (a muted wave output would get unmuted upon start of
playback, of course this is not what we want, thus remember mute state)
- implement partial power management: when idle, lower clock rate and disable
codec (reduced noise!), and disable gameport circuit when unused
- instantiate OPL3 timer, too
- much better implementation of snd_azf3328_mixer_write_volume_gradually()
- slightly optimized interrupt handling
- lots of cleanup
This time, I also found a way to verify proper OPL3 operation
via MIDI file playback (emulation via synth hardware).
Signed-off-by: Andreas Mohr <andi@lisas.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2008-05-16 17:18:29 +07:00
|
|
|
static inline u32
|
ALSA: azt3328: large codec cleanup, add I2S port etc.
- fully separate codec I/O port handling, enabling the use of a single
function each for all codecs (playback, capture, I2S out)
- add a new separate pcm for I2S out port (UNTESTED, no I2S DAC
available yet)
- switch gameport to low frequency while idle, to try to reduce noise/power
- improve snd_azf3328_codec_setdmaa() calculation
- minor variable type cleanup (u16, bool etc.)
- add some doc updates (help those lost Windows users, debug help, ...)
Note that due to the large cleanup aspect of the codec I/O change,
I was able to fit everything including all improvements into the
same binary size!! (a measly 10 bytes more or so)
This should now be the almost last patch to this driver
(minus some possible kernel clocksource patch and x86_64 fixes or so).
I just felt like taking a break from the usual stuff and wanted to
get this driver's structure finished, and it's rather clean now...
Tested, working and checkpatch.pl:ed on 2.6.30-rc5,
applies cleanly to 2.6.30 proper.
Signed-off-by: Andreas Mohr <andi@lisas.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2009-07-05 18:55:46 +07:00
|
|
|
snd_azf3328_codec_inl(const struct snd_azf3328_codec_data *codec, unsigned reg)
|
|
|
|
{
|
|
|
|
return inl(codec->io_base + reg);
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline void
|
|
|
|
snd_azf3328_ctrl_outb(const struct snd_azf3328 *chip, unsigned reg, u8 value)
|
2005-10-25 16:17:45 +07:00
|
|
|
{
|
ALSA: azt3328: large codec cleanup, add I2S port etc.
- fully separate codec I/O port handling, enabling the use of a single
function each for all codecs (playback, capture, I2S out)
- add a new separate pcm for I2S out port (UNTESTED, no I2S DAC
available yet)
- switch gameport to low frequency while idle, to try to reduce noise/power
- improve snd_azf3328_codec_setdmaa() calculation
- minor variable type cleanup (u16, bool etc.)
- add some doc updates (help those lost Windows users, debug help, ...)
Note that due to the large cleanup aspect of the codec I/O change,
I was able to fit everything including all improvements into the
same binary size!! (a measly 10 bytes more or so)
This should now be the almost last patch to this driver
(minus some possible kernel clocksource patch and x86_64 fixes or so).
I just felt like taking a break from the usual stuff and wanted to
get this driver's structure finished, and it's rather clean now...
Tested, working and checkpatch.pl:ed on 2.6.30-rc5,
applies cleanly to 2.6.30 proper.
Signed-off-by: Andreas Mohr <andi@lisas.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2009-07-05 18:55:46 +07:00
|
|
|
outb(value, chip->ctrl_io + reg);
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline u8
|
|
|
|
snd_azf3328_ctrl_inb(const struct snd_azf3328 *chip, unsigned reg)
|
|
|
|
{
|
|
|
|
return inb(chip->ctrl_io + reg);
|
|
|
|
}
|
|
|
|
|
2014-02-25 20:04:46 +07:00
|
|
|
static inline u16
|
|
|
|
snd_azf3328_ctrl_inw(const struct snd_azf3328 *chip, unsigned reg)
|
|
|
|
{
|
|
|
|
return inw(chip->ctrl_io + reg);
|
|
|
|
}
|
|
|
|
|
ALSA: azt3328: large codec cleanup, add I2S port etc.
- fully separate codec I/O port handling, enabling the use of a single
function each for all codecs (playback, capture, I2S out)
- add a new separate pcm for I2S out port (UNTESTED, no I2S DAC
available yet)
- switch gameport to low frequency while idle, to try to reduce noise/power
- improve snd_azf3328_codec_setdmaa() calculation
- minor variable type cleanup (u16, bool etc.)
- add some doc updates (help those lost Windows users, debug help, ...)
Note that due to the large cleanup aspect of the codec I/O change,
I was able to fit everything including all improvements into the
same binary size!! (a measly 10 bytes more or so)
This should now be the almost last patch to this driver
(minus some possible kernel clocksource patch and x86_64 fixes or so).
I just felt like taking a break from the usual stuff and wanted to
get this driver's structure finished, and it's rather clean now...
Tested, working and checkpatch.pl:ed on 2.6.30-rc5,
applies cleanly to 2.6.30 proper.
Signed-off-by: Andreas Mohr <andi@lisas.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2009-07-05 18:55:46 +07:00
|
|
|
static inline void
|
|
|
|
snd_azf3328_ctrl_outw(const struct snd_azf3328 *chip, unsigned reg, u16 value)
|
|
|
|
{
|
|
|
|
outw(value, chip->ctrl_io + reg);
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline void
|
|
|
|
snd_azf3328_ctrl_outl(const struct snd_azf3328 *chip, unsigned reg, u32 value)
|
|
|
|
{
|
|
|
|
outl(value, chip->ctrl_io + reg);
|
2005-10-25 16:17:45 +07:00
|
|
|
}
|
|
|
|
|
|
|
|
static inline void
|
[ALSA] PCI168 snd-azt3328 Linux driver: another huge update
- figured out 'Digital(ly) Enhanced Game Port' functionality,
implemented support for it (eliminating gameport polling overhead)
- removed optional joystick activation, gameport now enabled unconditionally,
since we now support it via the PCI I/O space, not via conflict-prone
legacy I/O (which I was thus able to DISABLE now)!
- fix playback bug (a muted wave output would get unmuted upon start of
playback, of course this is not what we want, thus remember mute state)
- implement partial power management: when idle, lower clock rate and disable
codec (reduced noise!), and disable gameport circuit when unused
- instantiate OPL3 timer, too
- much better implementation of snd_azf3328_mixer_write_volume_gradually()
- slightly optimized interrupt handling
- lots of cleanup
This time, I also found a way to verify proper OPL3 operation
via MIDI file playback (emulation via synth hardware).
Signed-off-by: Andreas Mohr <andi@lisas.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2008-05-16 17:18:29 +07:00
|
|
|
snd_azf3328_game_outb(const struct snd_azf3328 *chip, unsigned reg, u8 value)
|
2005-10-25 16:17:45 +07:00
|
|
|
{
|
[ALSA] PCI168 snd-azt3328 Linux driver: another huge update
- figured out 'Digital(ly) Enhanced Game Port' functionality,
implemented support for it (eliminating gameport polling overhead)
- removed optional joystick activation, gameport now enabled unconditionally,
since we now support it via the PCI I/O space, not via conflict-prone
legacy I/O (which I was thus able to DISABLE now)!
- fix playback bug (a muted wave output would get unmuted upon start of
playback, of course this is not what we want, thus remember mute state)
- implement partial power management: when idle, lower clock rate and disable
codec (reduced noise!), and disable gameport circuit when unused
- instantiate OPL3 timer, too
- much better implementation of snd_azf3328_mixer_write_volume_gradually()
- slightly optimized interrupt handling
- lots of cleanup
This time, I also found a way to verify proper OPL3 operation
via MIDI file playback (emulation via synth hardware).
Signed-off-by: Andreas Mohr <andi@lisas.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2008-05-16 17:18:29 +07:00
|
|
|
outb(value, chip->game_io + reg);
|
2005-10-25 16:17:45 +07:00
|
|
|
}
|
|
|
|
|
|
|
|
static inline void
|
[ALSA] PCI168 snd-azt3328 Linux driver: another huge update
- figured out 'Digital(ly) Enhanced Game Port' functionality,
implemented support for it (eliminating gameport polling overhead)
- removed optional joystick activation, gameport now enabled unconditionally,
since we now support it via the PCI I/O space, not via conflict-prone
legacy I/O (which I was thus able to DISABLE now)!
- fix playback bug (a muted wave output would get unmuted upon start of
playback, of course this is not what we want, thus remember mute state)
- implement partial power management: when idle, lower clock rate and disable
codec (reduced noise!), and disable gameport circuit when unused
- instantiate OPL3 timer, too
- much better implementation of snd_azf3328_mixer_write_volume_gradually()
- slightly optimized interrupt handling
- lots of cleanup
This time, I also found a way to verify proper OPL3 operation
via MIDI file playback (emulation via synth hardware).
Signed-off-by: Andreas Mohr <andi@lisas.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2008-05-16 17:18:29 +07:00
|
|
|
snd_azf3328_game_outw(const struct snd_azf3328 *chip, unsigned reg, u16 value)
|
2005-04-17 05:20:36 +07:00
|
|
|
{
|
[ALSA] PCI168 snd-azt3328 Linux driver: another huge update
- figured out 'Digital(ly) Enhanced Game Port' functionality,
implemented support for it (eliminating gameport polling overhead)
- removed optional joystick activation, gameport now enabled unconditionally,
since we now support it via the PCI I/O space, not via conflict-prone
legacy I/O (which I was thus able to DISABLE now)!
- fix playback bug (a muted wave output would get unmuted upon start of
playback, of course this is not what we want, thus remember mute state)
- implement partial power management: when idle, lower clock rate and disable
codec (reduced noise!), and disable gameport circuit when unused
- instantiate OPL3 timer, too
- much better implementation of snd_azf3328_mixer_write_volume_gradually()
- slightly optimized interrupt handling
- lots of cleanup
This time, I also found a way to verify proper OPL3 operation
via MIDI file playback (emulation via synth hardware).
Signed-off-by: Andreas Mohr <andi@lisas.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2008-05-16 17:18:29 +07:00
|
|
|
outw(value, chip->game_io + reg);
|
2005-04-17 05:20:36 +07:00
|
|
|
}
|
|
|
|
|
2005-10-25 16:17:45 +07:00
|
|
|
static inline u8
|
[ALSA] PCI168 snd-azt3328 Linux driver: another huge update
- figured out 'Digital(ly) Enhanced Game Port' functionality,
implemented support for it (eliminating gameport polling overhead)
- removed optional joystick activation, gameport now enabled unconditionally,
since we now support it via the PCI I/O space, not via conflict-prone
legacy I/O (which I was thus able to DISABLE now)!
- fix playback bug (a muted wave output would get unmuted upon start of
playback, of course this is not what we want, thus remember mute state)
- implement partial power management: when idle, lower clock rate and disable
codec (reduced noise!), and disable gameport circuit when unused
- instantiate OPL3 timer, too
- much better implementation of snd_azf3328_mixer_write_volume_gradually()
- slightly optimized interrupt handling
- lots of cleanup
This time, I also found a way to verify proper OPL3 operation
via MIDI file playback (emulation via synth hardware).
Signed-off-by: Andreas Mohr <andi@lisas.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2008-05-16 17:18:29 +07:00
|
|
|
snd_azf3328_game_inb(const struct snd_azf3328 *chip, unsigned reg)
|
|
|
|
{
|
|
|
|
return inb(chip->game_io + reg);
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline u16
|
|
|
|
snd_azf3328_game_inw(const struct snd_azf3328 *chip, unsigned reg)
|
2005-04-17 05:20:36 +07:00
|
|
|
{
|
[ALSA] PCI168 snd-azt3328 Linux driver: another huge update
- figured out 'Digital(ly) Enhanced Game Port' functionality,
implemented support for it (eliminating gameport polling overhead)
- removed optional joystick activation, gameport now enabled unconditionally,
since we now support it via the PCI I/O space, not via conflict-prone
legacy I/O (which I was thus able to DISABLE now)!
- fix playback bug (a muted wave output would get unmuted upon start of
playback, of course this is not what we want, thus remember mute state)
- implement partial power management: when idle, lower clock rate and disable
codec (reduced noise!), and disable gameport circuit when unused
- instantiate OPL3 timer, too
- much better implementation of snd_azf3328_mixer_write_volume_gradually()
- slightly optimized interrupt handling
- lots of cleanup
This time, I also found a way to verify proper OPL3 operation
via MIDI file playback (emulation via synth hardware).
Signed-off-by: Andreas Mohr <andi@lisas.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2008-05-16 17:18:29 +07:00
|
|
|
return inw(chip->game_io + reg);
|
2005-04-17 05:20:36 +07:00
|
|
|
}
|
|
|
|
|
2005-10-25 16:17:45 +07:00
|
|
|
static inline void
|
[ALSA] PCI168 snd-azt3328 Linux driver: another huge update
- figured out 'Digital(ly) Enhanced Game Port' functionality,
implemented support for it (eliminating gameport polling overhead)
- removed optional joystick activation, gameport now enabled unconditionally,
since we now support it via the PCI I/O space, not via conflict-prone
legacy I/O (which I was thus able to DISABLE now)!
- fix playback bug (a muted wave output would get unmuted upon start of
playback, of course this is not what we want, thus remember mute state)
- implement partial power management: when idle, lower clock rate and disable
codec (reduced noise!), and disable gameport circuit when unused
- instantiate OPL3 timer, too
- much better implementation of snd_azf3328_mixer_write_volume_gradually()
- slightly optimized interrupt handling
- lots of cleanup
This time, I also found a way to verify proper OPL3 operation
via MIDI file playback (emulation via synth hardware).
Signed-off-by: Andreas Mohr <andi@lisas.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2008-05-16 17:18:29 +07:00
|
|
|
snd_azf3328_mixer_outw(const struct snd_azf3328 *chip, unsigned reg, u16 value)
|
2005-04-17 05:20:36 +07:00
|
|
|
{
|
[ALSA] PCI168 snd-azt3328 Linux driver: another huge update
- figured out 'Digital(ly) Enhanced Game Port' functionality,
implemented support for it (eliminating gameport polling overhead)
- removed optional joystick activation, gameport now enabled unconditionally,
since we now support it via the PCI I/O space, not via conflict-prone
legacy I/O (which I was thus able to DISABLE now)!
- fix playback bug (a muted wave output would get unmuted upon start of
playback, of course this is not what we want, thus remember mute state)
- implement partial power management: when idle, lower clock rate and disable
codec (reduced noise!), and disable gameport circuit when unused
- instantiate OPL3 timer, too
- much better implementation of snd_azf3328_mixer_write_volume_gradually()
- slightly optimized interrupt handling
- lots of cleanup
This time, I also found a way to verify proper OPL3 operation
via MIDI file playback (emulation via synth hardware).
Signed-off-by: Andreas Mohr <andi@lisas.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2008-05-16 17:18:29 +07:00
|
|
|
outw(value, chip->mixer_io + reg);
|
2005-10-25 16:17:45 +07:00
|
|
|
}
|
|
|
|
|
|
|
|
static inline u16
|
[ALSA] PCI168 snd-azt3328 Linux driver: another huge update
- figured out 'Digital(ly) Enhanced Game Port' functionality,
implemented support for it (eliminating gameport polling overhead)
- removed optional joystick activation, gameport now enabled unconditionally,
since we now support it via the PCI I/O space, not via conflict-prone
legacy I/O (which I was thus able to DISABLE now)!
- fix playback bug (a muted wave output would get unmuted upon start of
playback, of course this is not what we want, thus remember mute state)
- implement partial power management: when idle, lower clock rate and disable
codec (reduced noise!), and disable gameport circuit when unused
- instantiate OPL3 timer, too
- much better implementation of snd_azf3328_mixer_write_volume_gradually()
- slightly optimized interrupt handling
- lots of cleanup
This time, I also found a way to verify proper OPL3 operation
via MIDI file playback (emulation via synth hardware).
Signed-off-by: Andreas Mohr <andi@lisas.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2008-05-16 17:18:29 +07:00
|
|
|
snd_azf3328_mixer_inw(const struct snd_azf3328 *chip, unsigned reg)
|
2005-10-25 16:17:45 +07:00
|
|
|
{
|
[ALSA] PCI168 snd-azt3328 Linux driver: another huge update
- figured out 'Digital(ly) Enhanced Game Port' functionality,
implemented support for it (eliminating gameport polling overhead)
- removed optional joystick activation, gameport now enabled unconditionally,
since we now support it via the PCI I/O space, not via conflict-prone
legacy I/O (which I was thus able to DISABLE now)!
- fix playback bug (a muted wave output would get unmuted upon start of
playback, of course this is not what we want, thus remember mute state)
- implement partial power management: when idle, lower clock rate and disable
codec (reduced noise!), and disable gameport circuit when unused
- instantiate OPL3 timer, too
- much better implementation of snd_azf3328_mixer_write_volume_gradually()
- slightly optimized interrupt handling
- lots of cleanup
This time, I also found a way to verify proper OPL3 operation
via MIDI file playback (emulation via synth hardware).
Signed-off-by: Andreas Mohr <andi@lisas.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2008-05-16 17:18:29 +07:00
|
|
|
return inw(chip->mixer_io + reg);
|
2005-04-17 05:20:36 +07:00
|
|
|
}
|
|
|
|
|
[ALSA] PCI168 snd-azt3328 Linux driver: another huge update
- figured out 'Digital(ly) Enhanced Game Port' functionality,
implemented support for it (eliminating gameport polling overhead)
- removed optional joystick activation, gameport now enabled unconditionally,
since we now support it via the PCI I/O space, not via conflict-prone
legacy I/O (which I was thus able to DISABLE now)!
- fix playback bug (a muted wave output would get unmuted upon start of
playback, of course this is not what we want, thus remember mute state)
- implement partial power management: when idle, lower clock rate and disable
codec (reduced noise!), and disable gameport circuit when unused
- instantiate OPL3 timer, too
- much better implementation of snd_azf3328_mixer_write_volume_gradually()
- slightly optimized interrupt handling
- lots of cleanup
This time, I also found a way to verify proper OPL3 operation
via MIDI file playback (emulation via synth hardware).
Signed-off-by: Andreas Mohr <andi@lisas.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2008-05-16 17:18:29 +07:00
|
|
|
#define AZF_MUTE_BIT 0x80
|
|
|
|
|
ALSA: azt3328: large codec cleanup, add I2S port etc.
- fully separate codec I/O port handling, enabling the use of a single
function each for all codecs (playback, capture, I2S out)
- add a new separate pcm for I2S out port (UNTESTED, no I2S DAC
available yet)
- switch gameport to low frequency while idle, to try to reduce noise/power
- improve snd_azf3328_codec_setdmaa() calculation
- minor variable type cleanup (u16, bool etc.)
- add some doc updates (help those lost Windows users, debug help, ...)
Note that due to the large cleanup aspect of the codec I/O change,
I was able to fit everything including all improvements into the
same binary size!! (a measly 10 bytes more or so)
This should now be the almost last patch to this driver
(minus some possible kernel clocksource patch and x86_64 fixes or so).
I just felt like taking a break from the usual stuff and wanted to
get this driver's structure finished, and it's rather clean now...
Tested, working and checkpatch.pl:ed on 2.6.30-rc5,
applies cleanly to 2.6.30 proper.
Signed-off-by: Andreas Mohr <andi@lisas.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2009-07-05 18:55:46 +07:00
|
|
|
static bool
|
2011-02-19 06:49:32 +07:00
|
|
|
snd_azf3328_mixer_mute_control(const struct snd_azf3328 *chip,
|
ALSA: azt3328: large codec cleanup, add I2S port etc.
- fully separate codec I/O port handling, enabling the use of a single
function each for all codecs (playback, capture, I2S out)
- add a new separate pcm for I2S out port (UNTESTED, no I2S DAC
available yet)
- switch gameport to low frequency while idle, to try to reduce noise/power
- improve snd_azf3328_codec_setdmaa() calculation
- minor variable type cleanup (u16, bool etc.)
- add some doc updates (help those lost Windows users, debug help, ...)
Note that due to the large cleanup aspect of the codec I/O change,
I was able to fit everything including all improvements into the
same binary size!! (a measly 10 bytes more or so)
This should now be the almost last patch to this driver
(minus some possible kernel clocksource patch and x86_64 fixes or so).
I just felt like taking a break from the usual stuff and wanted to
get this driver's structure finished, and it's rather clean now...
Tested, working and checkpatch.pl:ed on 2.6.30-rc5,
applies cleanly to 2.6.30 proper.
Signed-off-by: Andreas Mohr <andi@lisas.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2009-07-05 18:55:46 +07:00
|
|
|
unsigned reg, bool do_mute
|
[ALSA] PCI168 snd-azt3328 Linux driver: another huge update
- figured out 'Digital(ly) Enhanced Game Port' functionality,
implemented support for it (eliminating gameport polling overhead)
- removed optional joystick activation, gameport now enabled unconditionally,
since we now support it via the PCI I/O space, not via conflict-prone
legacy I/O (which I was thus able to DISABLE now)!
- fix playback bug (a muted wave output would get unmuted upon start of
playback, of course this is not what we want, thus remember mute state)
- implement partial power management: when idle, lower clock rate and disable
codec (reduced noise!), and disable gameport circuit when unused
- instantiate OPL3 timer, too
- much better implementation of snd_azf3328_mixer_write_volume_gradually()
- slightly optimized interrupt handling
- lots of cleanup
This time, I also found a way to verify proper OPL3 operation
via MIDI file playback (emulation via synth hardware).
Signed-off-by: Andreas Mohr <andi@lisas.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2008-05-16 17:18:29 +07:00
|
|
|
)
|
2005-04-17 05:20:36 +07:00
|
|
|
{
|
[ALSA] PCI168 snd-azt3328 Linux driver: another huge update
- figured out 'Digital(ly) Enhanced Game Port' functionality,
implemented support for it (eliminating gameport polling overhead)
- removed optional joystick activation, gameport now enabled unconditionally,
since we now support it via the PCI I/O space, not via conflict-prone
legacy I/O (which I was thus able to DISABLE now)!
- fix playback bug (a muted wave output would get unmuted upon start of
playback, of course this is not what we want, thus remember mute state)
- implement partial power management: when idle, lower clock rate and disable
codec (reduced noise!), and disable gameport circuit when unused
- instantiate OPL3 timer, too
- much better implementation of snd_azf3328_mixer_write_volume_gradually()
- slightly optimized interrupt handling
- lots of cleanup
This time, I also found a way to verify proper OPL3 operation
via MIDI file playback (emulation via synth hardware).
Signed-off-by: Andreas Mohr <andi@lisas.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2008-05-16 17:18:29 +07:00
|
|
|
unsigned long portbase = chip->mixer_io + reg + 1;
|
ALSA: azt3328: large codec cleanup, add I2S port etc.
- fully separate codec I/O port handling, enabling the use of a single
function each for all codecs (playback, capture, I2S out)
- add a new separate pcm for I2S out port (UNTESTED, no I2S DAC
available yet)
- switch gameport to low frequency while idle, to try to reduce noise/power
- improve snd_azf3328_codec_setdmaa() calculation
- minor variable type cleanup (u16, bool etc.)
- add some doc updates (help those lost Windows users, debug help, ...)
Note that due to the large cleanup aspect of the codec I/O change,
I was able to fit everything including all improvements into the
same binary size!! (a measly 10 bytes more or so)
This should now be the almost last patch to this driver
(minus some possible kernel clocksource patch and x86_64 fixes or so).
I just felt like taking a break from the usual stuff and wanted to
get this driver's structure finished, and it's rather clean now...
Tested, working and checkpatch.pl:ed on 2.6.30-rc5,
applies cleanly to 2.6.30 proper.
Signed-off-by: Andreas Mohr <andi@lisas.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2009-07-05 18:55:46 +07:00
|
|
|
bool updated;
|
2005-04-17 05:20:36 +07:00
|
|
|
|
|
|
|
/* the mute bit is on the *second* (i.e. right) register of a
|
|
|
|
* left/right channel setting */
|
[ALSA] PCI168 snd-azt3328 Linux driver: another huge update
- figured out 'Digital(ly) Enhanced Game Port' functionality,
implemented support for it (eliminating gameport polling overhead)
- removed optional joystick activation, gameport now enabled unconditionally,
since we now support it via the PCI I/O space, not via conflict-prone
legacy I/O (which I was thus able to DISABLE now)!
- fix playback bug (a muted wave output would get unmuted upon start of
playback, of course this is not what we want, thus remember mute state)
- implement partial power management: when idle, lower clock rate and disable
codec (reduced noise!), and disable gameport circuit when unused
- instantiate OPL3 timer, too
- much better implementation of snd_azf3328_mixer_write_volume_gradually()
- slightly optimized interrupt handling
- lots of cleanup
This time, I also found a way to verify proper OPL3 operation
via MIDI file playback (emulation via synth hardware).
Signed-off-by: Andreas Mohr <andi@lisas.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2008-05-16 17:18:29 +07:00
|
|
|
updated = snd_azf3328_io_reg_setb(portbase, AZF_MUTE_BIT, do_mute);
|
|
|
|
|
|
|
|
/* indicate whether it was muted before */
|
|
|
|
return (do_mute) ? !updated : updated;
|
2005-04-17 05:20:36 +07:00
|
|
|
}
|
|
|
|
|
2011-02-19 06:49:32 +07:00
|
|
|
static inline bool
|
|
|
|
snd_azf3328_mixer_mute_control_master(const struct snd_azf3328 *chip,
|
|
|
|
bool do_mute
|
|
|
|
)
|
|
|
|
{
|
|
|
|
return snd_azf3328_mixer_mute_control(
|
|
|
|
chip,
|
|
|
|
IDX_MIXER_PLAY_MASTER,
|
|
|
|
do_mute
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline bool
|
|
|
|
snd_azf3328_mixer_mute_control_pcm(const struct snd_azf3328 *chip,
|
|
|
|
bool do_mute
|
|
|
|
)
|
|
|
|
{
|
|
|
|
return snd_azf3328_mixer_mute_control(
|
|
|
|
chip,
|
|
|
|
IDX_MIXER_WAVEOUT,
|
|
|
|
do_mute
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline void
|
|
|
|
snd_azf3328_mixer_reset(const struct snd_azf3328 *chip)
|
|
|
|
{
|
|
|
|
/* reset (close) mixer:
|
|
|
|
* first mute master volume, then reset
|
|
|
|
*/
|
|
|
|
snd_azf3328_mixer_mute_control_master(chip, 1);
|
|
|
|
snd_azf3328_mixer_outw(chip, IDX_MIXER_RESET, 0x0000);
|
|
|
|
}
|
|
|
|
|
|
|
|
#ifdef AZF_USE_AC97_LAYER
|
|
|
|
|
|
|
|
static inline void
|
2014-02-25 20:04:46 +07:00
|
|
|
snd_azf3328_mixer_ac97_map_unsupported(const struct snd_azf3328 *chip,
|
|
|
|
unsigned short reg, const char *mode)
|
2011-02-19 06:49:32 +07:00
|
|
|
{
|
|
|
|
/* need to add some more or less clever emulation? */
|
2014-02-25 20:04:46 +07:00
|
|
|
dev_warn(chip->card->dev,
|
|
|
|
"missing %s emulation for AC97 register 0x%02x!\n",
|
2011-02-19 06:49:32 +07:00
|
|
|
mode, reg);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Need to have _special_ AC97 mixer hardware register index mapper,
|
|
|
|
* to compensate for the issue of a rather AC97-incompatible hardware layout.
|
|
|
|
*/
|
|
|
|
#define AZF_REG_MASK 0x3f
|
|
|
|
#define AZF_AC97_REG_UNSUPPORTED 0x8000
|
|
|
|
#define AZF_AC97_REG_REAL_IO_READ 0x4000
|
|
|
|
#define AZF_AC97_REG_REAL_IO_WRITE 0x2000
|
|
|
|
#define AZF_AC97_REG_REAL_IO_RW \
|
|
|
|
(AZF_AC97_REG_REAL_IO_READ | AZF_AC97_REG_REAL_IO_WRITE)
|
|
|
|
#define AZF_AC97_REG_EMU_IO_READ 0x0400
|
|
|
|
#define AZF_AC97_REG_EMU_IO_WRITE 0x0200
|
|
|
|
#define AZF_AC97_REG_EMU_IO_RW \
|
|
|
|
(AZF_AC97_REG_EMU_IO_READ | AZF_AC97_REG_EMU_IO_WRITE)
|
|
|
|
static unsigned short
|
|
|
|
snd_azf3328_mixer_ac97_map_reg_idx(unsigned short reg)
|
|
|
|
{
|
|
|
|
static const struct {
|
|
|
|
unsigned short azf_reg;
|
|
|
|
} azf_reg_mapper[] = {
|
|
|
|
/* Especially when taking into consideration
|
|
|
|
* mono/stereo-based sequence of azf vs. AC97 control series,
|
|
|
|
* it's quite obvious that azf simply got rid
|
|
|
|
* of the AC97_HEADPHONE control at its intended offset,
|
|
|
|
* thus shifted _all_ controls by one,
|
|
|
|
* and _then_ simply added it as an FMSYNTH control at the end,
|
|
|
|
* to make up for the offset.
|
|
|
|
* This means we'll have to translate indices here as
|
|
|
|
* needed and then do some tiny AC97 patch action
|
|
|
|
* (snd_ac97_rename_vol_ctl() etc.) - that's it.
|
|
|
|
*/
|
|
|
|
{ /* AC97_RESET */ IDX_MIXER_RESET
|
|
|
|
| AZF_AC97_REG_REAL_IO_WRITE
|
|
|
|
| AZF_AC97_REG_EMU_IO_READ },
|
|
|
|
{ /* AC97_MASTER */ IDX_MIXER_PLAY_MASTER },
|
|
|
|
/* note large shift: AC97_HEADPHONE to IDX_MIXER_FMSYNTH! */
|
|
|
|
{ /* AC97_HEADPHONE */ IDX_MIXER_FMSYNTH },
|
|
|
|
{ /* AC97_MASTER_MONO */ IDX_MIXER_MODEMOUT },
|
|
|
|
{ /* AC97_MASTER_TONE */ IDX_MIXER_BASSTREBLE },
|
|
|
|
{ /* AC97_PC_BEEP */ IDX_MIXER_PCBEEP },
|
|
|
|
{ /* AC97_PHONE */ IDX_MIXER_MODEMIN },
|
|
|
|
{ /* AC97_MIC */ IDX_MIXER_MIC },
|
|
|
|
{ /* AC97_LINE */ IDX_MIXER_LINEIN },
|
|
|
|
{ /* AC97_CD */ IDX_MIXER_CDAUDIO },
|
|
|
|
{ /* AC97_VIDEO */ IDX_MIXER_VIDEO },
|
|
|
|
{ /* AC97_AUX */ IDX_MIXER_AUX },
|
|
|
|
{ /* AC97_PCM */ IDX_MIXER_WAVEOUT },
|
|
|
|
{ /* AC97_REC_SEL */ IDX_MIXER_REC_SELECT },
|
|
|
|
{ /* AC97_REC_GAIN */ IDX_MIXER_REC_VOLUME },
|
|
|
|
{ /* AC97_REC_GAIN_MIC */ AZF_AC97_REG_EMU_IO_RW },
|
|
|
|
{ /* AC97_GENERAL_PURPOSE */ IDX_MIXER_ADVCTL2 },
|
|
|
|
{ /* AC97_3D_CONTROL */ IDX_MIXER_ADVCTL1 },
|
|
|
|
};
|
|
|
|
|
|
|
|
unsigned short reg_azf = AZF_AC97_REG_UNSUPPORTED;
|
|
|
|
|
|
|
|
/* azf3328 supports the low-numbered and low-spec:ed range
|
|
|
|
of AC97 regs only */
|
|
|
|
if (reg <= AC97_3D_CONTROL) {
|
|
|
|
unsigned short reg_idx = reg / 2;
|
|
|
|
reg_azf = azf_reg_mapper[reg_idx].azf_reg;
|
|
|
|
/* a translation-only entry means it's real read/write: */
|
|
|
|
if (!(reg_azf & ~AZF_REG_MASK))
|
|
|
|
reg_azf |= AZF_AC97_REG_REAL_IO_RW;
|
|
|
|
} else {
|
|
|
|
switch (reg) {
|
|
|
|
case AC97_POWERDOWN:
|
|
|
|
reg_azf = AZF_AC97_REG_EMU_IO_RW;
|
|
|
|
break;
|
|
|
|
case AC97_EXTENDED_ID:
|
|
|
|
reg_azf = AZF_AC97_REG_EMU_IO_READ;
|
|
|
|
break;
|
|
|
|
case AC97_EXTENDED_STATUS:
|
|
|
|
/* I don't know what the h*ll AC97 layer
|
|
|
|
* would consult this _extended_ register for
|
|
|
|
* given a base-AC97-advertised card,
|
|
|
|
* but let's just emulate it anyway :-P
|
|
|
|
*/
|
|
|
|
reg_azf = AZF_AC97_REG_EMU_IO_RW;
|
|
|
|
break;
|
|
|
|
case AC97_VENDOR_ID1:
|
|
|
|
case AC97_VENDOR_ID2:
|
|
|
|
reg_azf = AZF_AC97_REG_EMU_IO_READ;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return reg_azf;
|
|
|
|
}
|
|
|
|
|
|
|
|
static const unsigned short
|
|
|
|
azf_emulated_ac97_caps =
|
|
|
|
AC97_BC_DEDICATED_MIC |
|
|
|
|
AC97_BC_BASS_TREBLE |
|
|
|
|
/* Headphone is an FM Synth control here */
|
|
|
|
AC97_BC_HEADPHONE |
|
|
|
|
/* no AC97_BC_LOUDNESS! */
|
|
|
|
/* mask 0x7c00 is
|
|
|
|
vendor-specific 3D enhancement
|
|
|
|
vendor indicator.
|
|
|
|
Since there actually _is_ an
|
|
|
|
entry for Aztech Labs
|
|
|
|
(13), make damn sure
|
|
|
|
to indicate it. */
|
|
|
|
(13 << 10);
|
|
|
|
|
|
|
|
static const unsigned short
|
|
|
|
azf_emulated_ac97_powerdown =
|
|
|
|
/* pretend everything to be active */
|
|
|
|
AC97_PD_ADC_STATUS |
|
|
|
|
AC97_PD_DAC_STATUS |
|
|
|
|
AC97_PD_MIXER_STATUS |
|
|
|
|
AC97_PD_VREF_STATUS;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Emulated, _inofficial_ vendor ID
|
|
|
|
* (there might be some devices such as the MR 2800-W
|
|
|
|
* which could reveal the real Aztech AC97 ID).
|
|
|
|
* We choose to use "AZT" prefix, and then use 1 to indicate PCI168
|
|
|
|
* (better don't use 0x68 since there's a PCI368 as well).
|
|
|
|
*/
|
|
|
|
static const unsigned int
|
|
|
|
azf_emulated_ac97_vendor_id = 0x415a5401;
|
|
|
|
|
|
|
|
static unsigned short
|
|
|
|
snd_azf3328_mixer_ac97_read(struct snd_ac97 *ac97, unsigned short reg_ac97)
|
|
|
|
{
|
|
|
|
const struct snd_azf3328 *chip = ac97->private_data;
|
|
|
|
unsigned short reg_azf = snd_azf3328_mixer_ac97_map_reg_idx(reg_ac97);
|
|
|
|
unsigned short reg_val = 0;
|
2013-09-23 01:44:12 +07:00
|
|
|
bool unsupported = false;
|
2011-02-19 06:49:32 +07:00
|
|
|
|
2014-02-25 20:04:46 +07:00
|
|
|
dev_dbg(chip->card->dev, "snd_azf3328_mixer_ac97_read reg_ac97 %u\n",
|
|
|
|
reg_ac97);
|
2011-02-19 06:49:32 +07:00
|
|
|
if (reg_azf & AZF_AC97_REG_UNSUPPORTED)
|
2013-09-23 01:44:12 +07:00
|
|
|
unsupported = true;
|
2011-02-19 06:49:32 +07:00
|
|
|
else {
|
|
|
|
if (reg_azf & AZF_AC97_REG_REAL_IO_READ)
|
|
|
|
reg_val = snd_azf3328_mixer_inw(chip,
|
|
|
|
reg_azf & AZF_REG_MASK);
|
|
|
|
else {
|
|
|
|
/*
|
|
|
|
* Proceed with dummy I/O read,
|
|
|
|
* to ensure compatible timing where this may matter.
|
|
|
|
* (ALSA AC97 layer usually doesn't call I/O functions
|
|
|
|
* due to intelligent I/O caching anyway)
|
|
|
|
* Choose a mixer register that's thoroughly unrelated
|
|
|
|
* to common audio (try to minimize distortion).
|
|
|
|
*/
|
|
|
|
snd_azf3328_mixer_inw(chip, IDX_MIXER_SOMETHING30H);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (reg_azf & AZF_AC97_REG_EMU_IO_READ) {
|
|
|
|
switch (reg_ac97) {
|
|
|
|
case AC97_RESET:
|
|
|
|
reg_val |= azf_emulated_ac97_caps;
|
|
|
|
break;
|
|
|
|
case AC97_POWERDOWN:
|
|
|
|
reg_val |= azf_emulated_ac97_powerdown;
|
|
|
|
break;
|
|
|
|
case AC97_EXTENDED_ID:
|
|
|
|
case AC97_EXTENDED_STATUS:
|
|
|
|
/* AFAICS we simply can't support anything: */
|
|
|
|
reg_val |= 0;
|
|
|
|
break;
|
|
|
|
case AC97_VENDOR_ID1:
|
|
|
|
reg_val = azf_emulated_ac97_vendor_id >> 16;
|
|
|
|
break;
|
|
|
|
case AC97_VENDOR_ID2:
|
|
|
|
reg_val = azf_emulated_ac97_vendor_id & 0xffff;
|
|
|
|
break;
|
|
|
|
default:
|
2013-09-23 01:44:12 +07:00
|
|
|
unsupported = true;
|
2011-02-19 06:49:32 +07:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (unsupported)
|
2014-02-25 20:04:46 +07:00
|
|
|
snd_azf3328_mixer_ac97_map_unsupported(chip, reg_ac97, "read");
|
2011-02-19 06:49:32 +07:00
|
|
|
|
|
|
|
return reg_val;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
snd_azf3328_mixer_ac97_write(struct snd_ac97 *ac97,
|
|
|
|
unsigned short reg_ac97, unsigned short val)
|
|
|
|
{
|
|
|
|
const struct snd_azf3328 *chip = ac97->private_data;
|
|
|
|
unsigned short reg_azf = snd_azf3328_mixer_ac97_map_reg_idx(reg_ac97);
|
2013-09-23 01:44:12 +07:00
|
|
|
bool unsupported = false;
|
2011-02-19 06:49:32 +07:00
|
|
|
|
2014-02-25 20:04:46 +07:00
|
|
|
dev_dbg(chip->card->dev,
|
2011-02-19 06:49:32 +07:00
|
|
|
"snd_azf3328_mixer_ac97_write reg_ac97 %u val %u\n",
|
2014-02-25 20:04:46 +07:00
|
|
|
reg_ac97, val);
|
2011-02-19 06:49:32 +07:00
|
|
|
if (reg_azf & AZF_AC97_REG_UNSUPPORTED)
|
2013-09-23 01:44:12 +07:00
|
|
|
unsupported = true;
|
2011-02-19 06:49:32 +07:00
|
|
|
else {
|
|
|
|
if (reg_azf & AZF_AC97_REG_REAL_IO_WRITE)
|
|
|
|
snd_azf3328_mixer_outw(
|
|
|
|
chip,
|
|
|
|
reg_azf & AZF_REG_MASK,
|
|
|
|
val
|
|
|
|
);
|
|
|
|
else
|
|
|
|
if (reg_azf & AZF_AC97_REG_EMU_IO_WRITE) {
|
|
|
|
switch (reg_ac97) {
|
|
|
|
case AC97_REC_GAIN_MIC:
|
|
|
|
case AC97_POWERDOWN:
|
|
|
|
case AC97_EXTENDED_STATUS:
|
|
|
|
/*
|
|
|
|
* Silently swallow these writes.
|
|
|
|
* Since for most registers our card doesn't
|
|
|
|
* actually support a comparable feature,
|
|
|
|
* this is exactly what we should do here.
|
|
|
|
* The AC97 layer's I/O caching probably
|
|
|
|
* automatically takes care of all the rest...
|
|
|
|
* (remembers written values etc.)
|
|
|
|
*/
|
|
|
|
break;
|
|
|
|
default:
|
2013-09-23 01:44:12 +07:00
|
|
|
unsupported = true;
|
2011-02-19 06:49:32 +07:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (unsupported)
|
2014-02-25 20:04:46 +07:00
|
|
|
snd_azf3328_mixer_ac97_map_unsupported(chip, reg_ac97, "write");
|
2011-02-19 06:49:32 +07:00
|
|
|
}
|
|
|
|
|
2012-12-07 00:35:10 +07:00
|
|
|
static int
|
2011-02-19 06:49:32 +07:00
|
|
|
snd_azf3328_mixer_new(struct snd_azf3328 *chip)
|
|
|
|
{
|
|
|
|
struct snd_ac97_bus *bus;
|
|
|
|
struct snd_ac97_template ac97;
|
2020-01-03 15:16:43 +07:00
|
|
|
static const struct snd_ac97_bus_ops ops = {
|
2011-02-19 06:49:32 +07:00
|
|
|
.write = snd_azf3328_mixer_ac97_write,
|
|
|
|
.read = snd_azf3328_mixer_ac97_read,
|
|
|
|
};
|
|
|
|
int rc;
|
|
|
|
|
|
|
|
memset(&ac97, 0, sizeof(ac97));
|
|
|
|
ac97.scaps = AC97_SCAP_SKIP_MODEM
|
|
|
|
| AC97_SCAP_AUDIO /* we support audio! */
|
|
|
|
| AC97_SCAP_NO_SPDIF;
|
|
|
|
ac97.private_data = chip;
|
|
|
|
ac97.pci = chip->pci;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* ALSA's AC97 layer has terrible init crackling issues,
|
|
|
|
* unfortunately, and since it makes use of AC97_RESET,
|
|
|
|
* there's no use trying to mute Master Playback proactively.
|
|
|
|
*/
|
|
|
|
|
|
|
|
rc = snd_ac97_bus(chip->card, 0, &ops, NULL, &bus);
|
|
|
|
if (!rc)
|
|
|
|
rc = snd_ac97_mixer(bus, &ac97, &chip->ac97);
|
|
|
|
/*
|
|
|
|
* Make sure to complain loudly in case of AC97 init failure,
|
|
|
|
* since failure may happen quite often,
|
|
|
|
* due to this card being a very quirky AC97 "lookalike".
|
|
|
|
*/
|
|
|
|
if (rc)
|
2014-02-25 20:04:46 +07:00
|
|
|
dev_err(chip->card->dev, "AC97 init failed, err %d!\n", rc);
|
2011-02-19 06:49:32 +07:00
|
|
|
|
|
|
|
/* If we return an error here, then snd_card_free() should
|
|
|
|
* free up any ac97 codecs that got created, as well as the bus.
|
|
|
|
*/
|
|
|
|
return rc;
|
|
|
|
}
|
|
|
|
#else /* AZF_USE_AC97_LAYER */
|
2005-10-25 16:17:45 +07:00
|
|
|
static void
|
[ALSA] PCI168 snd-azt3328 Linux driver: another huge update
- figured out 'Digital(ly) Enhanced Game Port' functionality,
implemented support for it (eliminating gameport polling overhead)
- removed optional joystick activation, gameport now enabled unconditionally,
since we now support it via the PCI I/O space, not via conflict-prone
legacy I/O (which I was thus able to DISABLE now)!
- fix playback bug (a muted wave output would get unmuted upon start of
playback, of course this is not what we want, thus remember mute state)
- implement partial power management: when idle, lower clock rate and disable
codec (reduced noise!), and disable gameport circuit when unused
- instantiate OPL3 timer, too
- much better implementation of snd_azf3328_mixer_write_volume_gradually()
- slightly optimized interrupt handling
- lots of cleanup
This time, I also found a way to verify proper OPL3 operation
via MIDI file playback (emulation via synth hardware).
Signed-off-by: Andreas Mohr <andi@lisas.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2008-05-16 17:18:29 +07:00
|
|
|
snd_azf3328_mixer_write_volume_gradually(const struct snd_azf3328 *chip,
|
|
|
|
unsigned reg,
|
|
|
|
unsigned char dst_vol_left,
|
|
|
|
unsigned char dst_vol_right,
|
|
|
|
int chan_sel, int delay
|
|
|
|
)
|
2005-04-17 05:20:36 +07:00
|
|
|
{
|
[ALSA] PCI168 snd-azt3328 Linux driver: another huge update
- figured out 'Digital(ly) Enhanced Game Port' functionality,
implemented support for it (eliminating gameport polling overhead)
- removed optional joystick activation, gameport now enabled unconditionally,
since we now support it via the PCI I/O space, not via conflict-prone
legacy I/O (which I was thus able to DISABLE now)!
- fix playback bug (a muted wave output would get unmuted upon start of
playback, of course this is not what we want, thus remember mute state)
- implement partial power management: when idle, lower clock rate and disable
codec (reduced noise!), and disable gameport circuit when unused
- instantiate OPL3 timer, too
- much better implementation of snd_azf3328_mixer_write_volume_gradually()
- slightly optimized interrupt handling
- lots of cleanup
This time, I also found a way to verify proper OPL3 operation
via MIDI file playback (emulation via synth hardware).
Signed-off-by: Andreas Mohr <andi@lisas.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2008-05-16 17:18:29 +07:00
|
|
|
unsigned long portbase = chip->mixer_io + reg;
|
2005-04-17 05:20:36 +07:00
|
|
|
unsigned char curr_vol_left = 0, curr_vol_right = 0;
|
[ALSA] PCI168 snd-azt3328 Linux driver: another huge update
- figured out 'Digital(ly) Enhanced Game Port' functionality,
implemented support for it (eliminating gameport polling overhead)
- removed optional joystick activation, gameport now enabled unconditionally,
since we now support it via the PCI I/O space, not via conflict-prone
legacy I/O (which I was thus able to DISABLE now)!
- fix playback bug (a muted wave output would get unmuted upon start of
playback, of course this is not what we want, thus remember mute state)
- implement partial power management: when idle, lower clock rate and disable
codec (reduced noise!), and disable gameport circuit when unused
- instantiate OPL3 timer, too
- much better implementation of snd_azf3328_mixer_write_volume_gradually()
- slightly optimized interrupt handling
- lots of cleanup
This time, I also found a way to verify proper OPL3 operation
via MIDI file playback (emulation via synth hardware).
Signed-off-by: Andreas Mohr <andi@lisas.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2008-05-16 17:18:29 +07:00
|
|
|
int left_change = 0, right_change = 0;
|
|
|
|
|
|
|
|
if (chan_sel & SET_CHAN_LEFT) {
|
2005-10-25 16:17:45 +07:00
|
|
|
curr_vol_left = inb(portbase + 1);
|
[ALSA] PCI168 snd-azt3328 Linux driver: another huge update
- figured out 'Digital(ly) Enhanced Game Port' functionality,
implemented support for it (eliminating gameport polling overhead)
- removed optional joystick activation, gameport now enabled unconditionally,
since we now support it via the PCI I/O space, not via conflict-prone
legacy I/O (which I was thus able to DISABLE now)!
- fix playback bug (a muted wave output would get unmuted upon start of
playback, of course this is not what we want, thus remember mute state)
- implement partial power management: when idle, lower clock rate and disable
codec (reduced noise!), and disable gameport circuit when unused
- instantiate OPL3 timer, too
- much better implementation of snd_azf3328_mixer_write_volume_gradually()
- slightly optimized interrupt handling
- lots of cleanup
This time, I also found a way to verify proper OPL3 operation
via MIDI file playback (emulation via synth hardware).
Signed-off-by: Andreas Mohr <andi@lisas.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2008-05-16 17:18:29 +07:00
|
|
|
|
|
|
|
/* take care of muting flag contained in left channel */
|
|
|
|
if (curr_vol_left & AZF_MUTE_BIT)
|
|
|
|
dst_vol_left |= AZF_MUTE_BIT;
|
|
|
|
else
|
|
|
|
dst_vol_left &= ~AZF_MUTE_BIT;
|
|
|
|
|
|
|
|
left_change = (curr_vol_left > dst_vol_left) ? -1 : 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (chan_sel & SET_CHAN_RIGHT) {
|
2005-10-25 16:17:45 +07:00
|
|
|
curr_vol_right = inb(portbase + 0);
|
[ALSA] PCI168 snd-azt3328 Linux driver: another huge update
- figured out 'Digital(ly) Enhanced Game Port' functionality,
implemented support for it (eliminating gameport polling overhead)
- removed optional joystick activation, gameport now enabled unconditionally,
since we now support it via the PCI I/O space, not via conflict-prone
legacy I/O (which I was thus able to DISABLE now)!
- fix playback bug (a muted wave output would get unmuted upon start of
playback, of course this is not what we want, thus remember mute state)
- implement partial power management: when idle, lower clock rate and disable
codec (reduced noise!), and disable gameport circuit when unused
- instantiate OPL3 timer, too
- much better implementation of snd_azf3328_mixer_write_volume_gradually()
- slightly optimized interrupt handling
- lots of cleanup
This time, I also found a way to verify proper OPL3 operation
via MIDI file playback (emulation via synth hardware).
Signed-off-by: Andreas Mohr <andi@lisas.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2008-05-16 17:18:29 +07:00
|
|
|
|
|
|
|
right_change = (curr_vol_right > dst_vol_right) ? -1 : 1;
|
|
|
|
}
|
2005-04-17 05:20:36 +07:00
|
|
|
|
2006-05-17 16:04:19 +07:00
|
|
|
do {
|
[ALSA] PCI168 snd-azt3328 Linux driver: another huge update
- figured out 'Digital(ly) Enhanced Game Port' functionality,
implemented support for it (eliminating gameport polling overhead)
- removed optional joystick activation, gameport now enabled unconditionally,
since we now support it via the PCI I/O space, not via conflict-prone
legacy I/O (which I was thus able to DISABLE now)!
- fix playback bug (a muted wave output would get unmuted upon start of
playback, of course this is not what we want, thus remember mute state)
- implement partial power management: when idle, lower clock rate and disable
codec (reduced noise!), and disable gameport circuit when unused
- instantiate OPL3 timer, too
- much better implementation of snd_azf3328_mixer_write_volume_gradually()
- slightly optimized interrupt handling
- lots of cleanup
This time, I also found a way to verify proper OPL3 operation
via MIDI file playback (emulation via synth hardware).
Signed-off-by: Andreas Mohr <andi@lisas.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2008-05-16 17:18:29 +07:00
|
|
|
if (left_change) {
|
|
|
|
if (curr_vol_left != dst_vol_left) {
|
|
|
|
curr_vol_left += left_change;
|
|
|
|
outb(curr_vol_left, portbase + 1);
|
|
|
|
} else
|
|
|
|
left_change = 0;
|
2005-04-17 05:20:36 +07:00
|
|
|
}
|
[ALSA] PCI168 snd-azt3328 Linux driver: another huge update
- figured out 'Digital(ly) Enhanced Game Port' functionality,
implemented support for it (eliminating gameport polling overhead)
- removed optional joystick activation, gameport now enabled unconditionally,
since we now support it via the PCI I/O space, not via conflict-prone
legacy I/O (which I was thus able to DISABLE now)!
- fix playback bug (a muted wave output would get unmuted upon start of
playback, of course this is not what we want, thus remember mute state)
- implement partial power management: when idle, lower clock rate and disable
codec (reduced noise!), and disable gameport circuit when unused
- instantiate OPL3 timer, too
- much better implementation of snd_azf3328_mixer_write_volume_gradually()
- slightly optimized interrupt handling
- lots of cleanup
This time, I also found a way to verify proper OPL3 operation
via MIDI file playback (emulation via synth hardware).
Signed-off-by: Andreas Mohr <andi@lisas.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2008-05-16 17:18:29 +07:00
|
|
|
if (right_change) {
|
|
|
|
if (curr_vol_right != dst_vol_right) {
|
|
|
|
curr_vol_right += right_change;
|
|
|
|
|
2005-04-17 05:20:36 +07:00
|
|
|
/* during volume change, the right channel is crackling
|
|
|
|
* somewhat more than the left channel, unfortunately.
|
|
|
|
* This seems to be a hardware issue. */
|
[ALSA] PCI168 snd-azt3328 Linux driver: another huge update
- figured out 'Digital(ly) Enhanced Game Port' functionality,
implemented support for it (eliminating gameport polling overhead)
- removed optional joystick activation, gameport now enabled unconditionally,
since we now support it via the PCI I/O space, not via conflict-prone
legacy I/O (which I was thus able to DISABLE now)!
- fix playback bug (a muted wave output would get unmuted upon start of
playback, of course this is not what we want, thus remember mute state)
- implement partial power management: when idle, lower clock rate and disable
codec (reduced noise!), and disable gameport circuit when unused
- instantiate OPL3 timer, too
- much better implementation of snd_azf3328_mixer_write_volume_gradually()
- slightly optimized interrupt handling
- lots of cleanup
This time, I also found a way to verify proper OPL3 operation
via MIDI file playback (emulation via synth hardware).
Signed-off-by: Andreas Mohr <andi@lisas.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2008-05-16 17:18:29 +07:00
|
|
|
outb(curr_vol_right, portbase + 0);
|
|
|
|
} else
|
|
|
|
right_change = 0;
|
2005-04-17 05:20:36 +07:00
|
|
|
}
|
|
|
|
if (delay)
|
|
|
|
mdelay(delay);
|
[ALSA] PCI168 snd-azt3328 Linux driver: another huge update
- figured out 'Digital(ly) Enhanced Game Port' functionality,
implemented support for it (eliminating gameport polling overhead)
- removed optional joystick activation, gameport now enabled unconditionally,
since we now support it via the PCI I/O space, not via conflict-prone
legacy I/O (which I was thus able to DISABLE now)!
- fix playback bug (a muted wave output would get unmuted upon start of
playback, of course this is not what we want, thus remember mute state)
- implement partial power management: when idle, lower clock rate and disable
codec (reduced noise!), and disable gameport circuit when unused
- instantiate OPL3 timer, too
- much better implementation of snd_azf3328_mixer_write_volume_gradually()
- slightly optimized interrupt handling
- lots of cleanup
This time, I also found a way to verify proper OPL3 operation
via MIDI file playback (emulation via synth hardware).
Signed-off-by: Andreas Mohr <andi@lisas.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2008-05-16 17:18:29 +07:00
|
|
|
} while ((left_change) || (right_change));
|
2005-04-17 05:20:36 +07:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* general mixer element
|
|
|
|
*/
|
2005-11-17 21:02:42 +07:00
|
|
|
struct azf3328_mixer_reg {
|
[ALSA] PCI168 snd-azt3328 Linux driver: another huge update
- figured out 'Digital(ly) Enhanced Game Port' functionality,
implemented support for it (eliminating gameport polling overhead)
- removed optional joystick activation, gameport now enabled unconditionally,
since we now support it via the PCI I/O space, not via conflict-prone
legacy I/O (which I was thus able to DISABLE now)!
- fix playback bug (a muted wave output would get unmuted upon start of
playback, of course this is not what we want, thus remember mute state)
- implement partial power management: when idle, lower clock rate and disable
codec (reduced noise!), and disable gameport circuit when unused
- instantiate OPL3 timer, too
- much better implementation of snd_azf3328_mixer_write_volume_gradually()
- slightly optimized interrupt handling
- lots of cleanup
This time, I also found a way to verify proper OPL3 operation
via MIDI file playback (emulation via synth hardware).
Signed-off-by: Andreas Mohr <andi@lisas.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2008-05-16 17:18:29 +07:00
|
|
|
unsigned reg;
|
2005-04-17 05:20:36 +07:00
|
|
|
unsigned int lchan_shift, rchan_shift;
|
|
|
|
unsigned int mask;
|
|
|
|
unsigned int invert: 1;
|
|
|
|
unsigned int stereo: 1;
|
|
|
|
unsigned int enum_c: 4;
|
2005-11-17 21:02:42 +07:00
|
|
|
};
|
2005-04-17 05:20:36 +07:00
|
|
|
|
|
|
|
#define COMPOSE_MIXER_REG(reg,lchan_shift,rchan_shift,mask,invert,stereo,enum_c) \
|
2005-10-25 16:17:45 +07:00
|
|
|
((reg) | (lchan_shift << 8) | (rchan_shift << 12) | \
|
|
|
|
(mask << 16) | \
|
|
|
|
(invert << 24) | \
|
|
|
|
(stereo << 25) | \
|
|
|
|
(enum_c << 26))
|
2005-04-17 05:20:36 +07:00
|
|
|
|
2005-11-17 21:02:42 +07:00
|
|
|
static void snd_azf3328_mixer_reg_decode(struct azf3328_mixer_reg *r, unsigned long val)
|
2005-04-17 05:20:36 +07:00
|
|
|
{
|
|
|
|
r->reg = val & 0xff;
|
|
|
|
r->lchan_shift = (val >> 8) & 0x0f;
|
|
|
|
r->rchan_shift = (val >> 12) & 0x0f;
|
|
|
|
r->mask = (val >> 16) & 0xff;
|
|
|
|
r->invert = (val >> 24) & 1;
|
|
|
|
r->stereo = (val >> 25) & 1;
|
|
|
|
r->enum_c = (val >> 26) & 0x0f;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* mixer switches/volumes
|
|
|
|
*/
|
|
|
|
|
|
|
|
#define AZF3328_MIXER_SWITCH(xname, reg, shift, invert) \
|
|
|
|
{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, \
|
|
|
|
.info = snd_azf3328_info_mixer, \
|
|
|
|
.get = snd_azf3328_get_mixer, .put = snd_azf3328_put_mixer, \
|
|
|
|
.private_value = COMPOSE_MIXER_REG(reg, shift, 0, 0x1, invert, 0, 0), \
|
|
|
|
}
|
|
|
|
|
|
|
|
#define AZF3328_MIXER_VOL_STEREO(xname, reg, mask, invert) \
|
|
|
|
{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, \
|
|
|
|
.info = snd_azf3328_info_mixer, \
|
|
|
|
.get = snd_azf3328_get_mixer, .put = snd_azf3328_put_mixer, \
|
|
|
|
.private_value = COMPOSE_MIXER_REG(reg, 8, 0, mask, invert, 1, 0), \
|
|
|
|
}
|
|
|
|
|
|
|
|
#define AZF3328_MIXER_VOL_MONO(xname, reg, mask, is_right_chan) \
|
|
|
|
{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, \
|
|
|
|
.info = snd_azf3328_info_mixer, \
|
|
|
|
.get = snd_azf3328_get_mixer, .put = snd_azf3328_put_mixer, \
|
|
|
|
.private_value = COMPOSE_MIXER_REG(reg, is_right_chan ? 0 : 8, 0, mask, 1, 0, 0), \
|
|
|
|
}
|
|
|
|
|
|
|
|
#define AZF3328_MIXER_VOL_SPECIAL(xname, reg, mask, shift, invert) \
|
|
|
|
{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, \
|
|
|
|
.info = snd_azf3328_info_mixer, \
|
|
|
|
.get = snd_azf3328_get_mixer, .put = snd_azf3328_put_mixer, \
|
|
|
|
.private_value = COMPOSE_MIXER_REG(reg, shift, 0, mask, invert, 0, 0), \
|
|
|
|
}
|
|
|
|
|
|
|
|
#define AZF3328_MIXER_ENUM(xname, reg, enum_c, shift) \
|
|
|
|
{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, \
|
|
|
|
.info = snd_azf3328_info_mixer_enum, \
|
|
|
|
.get = snd_azf3328_get_mixer_enum, .put = snd_azf3328_put_mixer_enum, \
|
|
|
|
.private_value = COMPOSE_MIXER_REG(reg, shift, 0, 0, 0, 0, enum_c), \
|
|
|
|
}
|
|
|
|
|
2005-10-25 16:17:45 +07:00
|
|
|
static int
|
2005-11-17 21:02:42 +07:00
|
|
|
snd_azf3328_info_mixer(struct snd_kcontrol *kcontrol,
|
|
|
|
struct snd_ctl_elem_info *uinfo)
|
2005-04-17 05:20:36 +07:00
|
|
|
{
|
2005-11-17 21:02:42 +07:00
|
|
|
struct azf3328_mixer_reg reg;
|
2005-04-17 05:20:36 +07:00
|
|
|
|
|
|
|
snd_azf3328_mixer_reg_decode(®, kcontrol->private_value);
|
2005-10-25 16:17:45 +07:00
|
|
|
uinfo->type = reg.mask == 1 ?
|
|
|
|
SNDRV_CTL_ELEM_TYPE_BOOLEAN : SNDRV_CTL_ELEM_TYPE_INTEGER;
|
2005-04-17 05:20:36 +07:00
|
|
|
uinfo->count = reg.stereo + 1;
|
|
|
|
uinfo->value.integer.min = 0;
|
|
|
|
uinfo->value.integer.max = reg.mask;
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2005-10-25 16:17:45 +07:00
|
|
|
static int
|
2005-11-17 21:02:42 +07:00
|
|
|
snd_azf3328_get_mixer(struct snd_kcontrol *kcontrol,
|
|
|
|
struct snd_ctl_elem_value *ucontrol)
|
2005-04-17 05:20:36 +07:00
|
|
|
{
|
2005-11-17 21:02:42 +07:00
|
|
|
struct snd_azf3328 *chip = snd_kcontrol_chip(kcontrol);
|
|
|
|
struct azf3328_mixer_reg reg;
|
ALSA: azt3328: large codec cleanup, add I2S port etc.
- fully separate codec I/O port handling, enabling the use of a single
function each for all codecs (playback, capture, I2S out)
- add a new separate pcm for I2S out port (UNTESTED, no I2S DAC
available yet)
- switch gameport to low frequency while idle, to try to reduce noise/power
- improve snd_azf3328_codec_setdmaa() calculation
- minor variable type cleanup (u16, bool etc.)
- add some doc updates (help those lost Windows users, debug help, ...)
Note that due to the large cleanup aspect of the codec I/O change,
I was able to fit everything including all improvements into the
same binary size!! (a measly 10 bytes more or so)
This should now be the almost last patch to this driver
(minus some possible kernel clocksource patch and x86_64 fixes or so).
I just felt like taking a break from the usual stuff and wanted to
get this driver's structure finished, and it's rather clean now...
Tested, working and checkpatch.pl:ed on 2.6.30-rc5,
applies cleanly to 2.6.30 proper.
Signed-off-by: Andreas Mohr <andi@lisas.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2009-07-05 18:55:46 +07:00
|
|
|
u16 oreg, val;
|
2005-04-17 05:20:36 +07:00
|
|
|
|
|
|
|
snd_azf3328_mixer_reg_decode(®, kcontrol->private_value);
|
|
|
|
|
2005-10-25 16:17:45 +07:00
|
|
|
oreg = snd_azf3328_mixer_inw(chip, reg.reg);
|
2005-04-17 05:20:36 +07:00
|
|
|
val = (oreg >> reg.lchan_shift) & reg.mask;
|
|
|
|
if (reg.invert)
|
|
|
|
val = reg.mask - val;
|
|
|
|
ucontrol->value.integer.value[0] = val;
|
|
|
|
if (reg.stereo) {
|
|
|
|
val = (oreg >> reg.rchan_shift) & reg.mask;
|
|
|
|
if (reg.invert)
|
|
|
|
val = reg.mask - val;
|
|
|
|
ucontrol->value.integer.value[1] = val;
|
|
|
|
}
|
2014-02-25 20:04:46 +07:00
|
|
|
dev_dbg(chip->card->dev,
|
|
|
|
"get: %02x is %04x -> vol %02lx|%02lx (shift %02d|%02d, mask %02x, inv. %d, stereo %d)\n",
|
2005-10-25 16:17:45 +07:00
|
|
|
reg.reg, oreg,
|
|
|
|
ucontrol->value.integer.value[0], ucontrol->value.integer.value[1],
|
|
|
|
reg.lchan_shift, reg.rchan_shift, reg.mask, reg.invert, reg.stereo);
|
2005-04-17 05:20:36 +07:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2005-10-25 16:17:45 +07:00
|
|
|
static int
|
2005-11-17 21:02:42 +07:00
|
|
|
snd_azf3328_put_mixer(struct snd_kcontrol *kcontrol,
|
|
|
|
struct snd_ctl_elem_value *ucontrol)
|
2005-04-17 05:20:36 +07:00
|
|
|
{
|
2005-11-17 21:02:42 +07:00
|
|
|
struct snd_azf3328 *chip = snd_kcontrol_chip(kcontrol);
|
|
|
|
struct azf3328_mixer_reg reg;
|
ALSA: azt3328: large codec cleanup, add I2S port etc.
- fully separate codec I/O port handling, enabling the use of a single
function each for all codecs (playback, capture, I2S out)
- add a new separate pcm for I2S out port (UNTESTED, no I2S DAC
available yet)
- switch gameport to low frequency while idle, to try to reduce noise/power
- improve snd_azf3328_codec_setdmaa() calculation
- minor variable type cleanup (u16, bool etc.)
- add some doc updates (help those lost Windows users, debug help, ...)
Note that due to the large cleanup aspect of the codec I/O change,
I was able to fit everything including all improvements into the
same binary size!! (a measly 10 bytes more or so)
This should now be the almost last patch to this driver
(minus some possible kernel clocksource patch and x86_64 fixes or so).
I just felt like taking a break from the usual stuff and wanted to
get this driver's structure finished, and it's rather clean now...
Tested, working and checkpatch.pl:ed on 2.6.30-rc5,
applies cleanly to 2.6.30 proper.
Signed-off-by: Andreas Mohr <andi@lisas.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2009-07-05 18:55:46 +07:00
|
|
|
u16 oreg, nreg, val;
|
2005-04-17 05:20:36 +07:00
|
|
|
|
|
|
|
snd_azf3328_mixer_reg_decode(®, kcontrol->private_value);
|
2005-10-25 16:17:45 +07:00
|
|
|
oreg = snd_azf3328_mixer_inw(chip, reg.reg);
|
2005-04-17 05:20:36 +07:00
|
|
|
val = ucontrol->value.integer.value[0] & reg.mask;
|
|
|
|
if (reg.invert)
|
|
|
|
val = reg.mask - val;
|
|
|
|
nreg = oreg & ~(reg.mask << reg.lchan_shift);
|
|
|
|
nreg |= (val << reg.lchan_shift);
|
|
|
|
if (reg.stereo) {
|
|
|
|
val = ucontrol->value.integer.value[1] & reg.mask;
|
|
|
|
if (reg.invert)
|
|
|
|
val = reg.mask - val;
|
|
|
|
nreg &= ~(reg.mask << reg.rchan_shift);
|
|
|
|
nreg |= (val << reg.rchan_shift);
|
|
|
|
}
|
|
|
|
if (reg.mask >= 0x07) /* it's a volume control, so better take care */
|
2005-10-25 16:17:45 +07:00
|
|
|
snd_azf3328_mixer_write_volume_gradually(
|
|
|
|
chip, reg.reg, nreg >> 8, nreg & 0xff,
|
|
|
|
/* just set both channels, doesn't matter */
|
|
|
|
SET_CHAN_LEFT|SET_CHAN_RIGHT,
|
|
|
|
0);
|
2005-04-17 05:20:36 +07:00
|
|
|
else
|
2005-10-25 16:17:45 +07:00
|
|
|
snd_azf3328_mixer_outw(chip, reg.reg, nreg);
|
2005-04-17 05:20:36 +07:00
|
|
|
|
2014-02-25 20:04:46 +07:00
|
|
|
dev_dbg(chip->card->dev,
|
|
|
|
"put: %02x to %02lx|%02lx, oreg %04x; shift %02d|%02d -> nreg %04x; after: %04x\n",
|
2005-10-25 16:17:45 +07:00
|
|
|
reg.reg, ucontrol->value.integer.value[0], ucontrol->value.integer.value[1],
|
|
|
|
oreg, reg.lchan_shift, reg.rchan_shift,
|
|
|
|
nreg, snd_azf3328_mixer_inw(chip, reg.reg));
|
2005-04-17 05:20:36 +07:00
|
|
|
return (nreg != oreg);
|
|
|
|
}
|
|
|
|
|
2005-10-25 16:17:45 +07:00
|
|
|
static int
|
2005-11-17 21:02:42 +07:00
|
|
|
snd_azf3328_info_mixer_enum(struct snd_kcontrol *kcontrol,
|
|
|
|
struct snd_ctl_elem_info *uinfo)
|
2005-04-17 05:20:36 +07:00
|
|
|
{
|
2005-10-25 16:17:45 +07:00
|
|
|
static const char * const texts1[] = {
|
2006-05-17 16:03:16 +07:00
|
|
|
"Mic1", "Mic2"
|
2005-10-25 16:17:45 +07:00
|
|
|
};
|
|
|
|
static const char * const texts2[] = {
|
2006-05-17 16:03:16 +07:00
|
|
|
"Mix", "Mic"
|
2005-10-25 16:17:45 +07:00
|
|
|
};
|
|
|
|
static const char * const texts3[] = {
|
[ALSA] PCI168 snd-azt3328 Linux driver: another huge update
- figured out 'Digital(ly) Enhanced Game Port' functionality,
implemented support for it (eliminating gameport polling overhead)
- removed optional joystick activation, gameport now enabled unconditionally,
since we now support it via the PCI I/O space, not via conflict-prone
legacy I/O (which I was thus able to DISABLE now)!
- fix playback bug (a muted wave output would get unmuted upon start of
playback, of course this is not what we want, thus remember mute state)
- implement partial power management: when idle, lower clock rate and disable
codec (reduced noise!), and disable gameport circuit when unused
- instantiate OPL3 timer, too
- much better implementation of snd_azf3328_mixer_write_volume_gradually()
- slightly optimized interrupt handling
- lots of cleanup
This time, I also found a way to verify proper OPL3 operation
via MIDI file playback (emulation via synth hardware).
Signed-off-by: Andreas Mohr <andi@lisas.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2008-05-16 17:18:29 +07:00
|
|
|
"Mic", "CD", "Video", "Aux",
|
2005-10-25 16:17:45 +07:00
|
|
|
"Line", "Mix", "Mix Mono", "Phone"
|
2005-04-17 05:20:36 +07:00
|
|
|
};
|
2006-05-17 16:03:16 +07:00
|
|
|
static const char * const texts4[] = {
|
|
|
|
"pre 3D", "post 3D"
|
|
|
|
};
|
2005-11-17 21:02:42 +07:00
|
|
|
struct azf3328_mixer_reg reg;
|
2008-06-23 16:50:47 +07:00
|
|
|
const char * const *p = NULL;
|
2005-04-17 05:20:36 +07:00
|
|
|
|
|
|
|
snd_azf3328_mixer_reg_decode(®, kcontrol->private_value);
|
2006-05-17 16:04:19 +07:00
|
|
|
if (reg.reg == IDX_MIXER_ADVCTL2) {
|
2006-05-17 16:03:16 +07:00
|
|
|
switch(reg.lchan_shift) {
|
|
|
|
case 8: /* modem out sel */
|
2008-06-23 16:50:47 +07:00
|
|
|
p = texts1;
|
2006-05-17 16:03:16 +07:00
|
|
|
break;
|
|
|
|
case 9: /* mono sel source */
|
2008-06-23 16:50:47 +07:00
|
|
|
p = texts2;
|
2006-05-17 16:03:16 +07:00
|
|
|
break;
|
|
|
|
case 15: /* PCM Out Path */
|
2008-06-23 16:50:47 +07:00
|
|
|
p = texts4;
|
2006-05-17 16:03:16 +07:00
|
|
|
break;
|
|
|
|
}
|
2014-10-20 23:16:13 +07:00
|
|
|
} else if (reg.reg == IDX_MIXER_REC_SELECT)
|
2008-06-23 16:50:47 +07:00
|
|
|
p = texts3;
|
[ALSA] PCI168 snd-azt3328 Linux driver: another huge update
- figured out 'Digital(ly) Enhanced Game Port' functionality,
implemented support for it (eliminating gameport polling overhead)
- removed optional joystick activation, gameport now enabled unconditionally,
since we now support it via the PCI I/O space, not via conflict-prone
legacy I/O (which I was thus able to DISABLE now)!
- fix playback bug (a muted wave output would get unmuted upon start of
playback, of course this is not what we want, thus remember mute state)
- implement partial power management: when idle, lower clock rate and disable
codec (reduced noise!), and disable gameport circuit when unused
- instantiate OPL3 timer, too
- much better implementation of snd_azf3328_mixer_write_volume_gradually()
- slightly optimized interrupt handling
- lots of cleanup
This time, I also found a way to verify proper OPL3 operation
via MIDI file playback (emulation via synth hardware).
Signed-off-by: Andreas Mohr <andi@lisas.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2008-05-16 17:18:29 +07:00
|
|
|
|
2014-10-20 23:16:13 +07:00
|
|
|
return snd_ctl_enum_info(uinfo,
|
|
|
|
(reg.reg == IDX_MIXER_REC_SELECT) ? 2 : 1,
|
|
|
|
reg.enum_c, p);
|
2005-04-17 05:20:36 +07:00
|
|
|
}
|
|
|
|
|
2005-10-25 16:17:45 +07:00
|
|
|
static int
|
2005-11-17 21:02:42 +07:00
|
|
|
snd_azf3328_get_mixer_enum(struct snd_kcontrol *kcontrol,
|
|
|
|
struct snd_ctl_elem_value *ucontrol)
|
2005-04-17 05:20:36 +07:00
|
|
|
{
|
2005-11-17 21:02:42 +07:00
|
|
|
struct snd_azf3328 *chip = snd_kcontrol_chip(kcontrol);
|
|
|
|
struct azf3328_mixer_reg reg;
|
2005-04-17 05:20:36 +07:00
|
|
|
unsigned short val;
|
[ALSA] PCI168 snd-azt3328 Linux driver: another huge update
- figured out 'Digital(ly) Enhanced Game Port' functionality,
implemented support for it (eliminating gameport polling overhead)
- removed optional joystick activation, gameport now enabled unconditionally,
since we now support it via the PCI I/O space, not via conflict-prone
legacy I/O (which I was thus able to DISABLE now)!
- fix playback bug (a muted wave output would get unmuted upon start of
playback, of course this is not what we want, thus remember mute state)
- implement partial power management: when idle, lower clock rate and disable
codec (reduced noise!), and disable gameport circuit when unused
- instantiate OPL3 timer, too
- much better implementation of snd_azf3328_mixer_write_volume_gradually()
- slightly optimized interrupt handling
- lots of cleanup
This time, I also found a way to verify proper OPL3 operation
via MIDI file playback (emulation via synth hardware).
Signed-off-by: Andreas Mohr <andi@lisas.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2008-05-16 17:18:29 +07:00
|
|
|
|
2005-04-17 05:20:36 +07:00
|
|
|
snd_azf3328_mixer_reg_decode(®, kcontrol->private_value);
|
2005-10-25 16:17:45 +07:00
|
|
|
val = snd_azf3328_mixer_inw(chip, reg.reg);
|
2006-05-17 16:04:19 +07:00
|
|
|
if (reg.reg == IDX_MIXER_REC_SELECT) {
|
2005-04-17 05:20:36 +07:00
|
|
|
ucontrol->value.enumerated.item[0] = (val >> 8) & (reg.enum_c - 1);
|
|
|
|
ucontrol->value.enumerated.item[1] = (val >> 0) & (reg.enum_c - 1);
|
2006-05-17 16:04:19 +07:00
|
|
|
} else
|
2005-04-17 05:20:36 +07:00
|
|
|
ucontrol->value.enumerated.item[0] = (val >> reg.lchan_shift) & (reg.enum_c - 1);
|
2005-10-25 16:17:45 +07:00
|
|
|
|
2014-02-25 20:04:46 +07:00
|
|
|
dev_dbg(chip->card->dev,
|
|
|
|
"get_enum: %02x is %04x -> %d|%d (shift %02d, enum_c %d)\n",
|
2005-10-25 16:17:45 +07:00
|
|
|
reg.reg, val, ucontrol->value.enumerated.item[0], ucontrol->value.enumerated.item[1],
|
|
|
|
reg.lchan_shift, reg.enum_c);
|
2005-04-17 05:20:36 +07:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2005-10-25 16:17:45 +07:00
|
|
|
static int
|
2005-11-17 21:02:42 +07:00
|
|
|
snd_azf3328_put_mixer_enum(struct snd_kcontrol *kcontrol,
|
|
|
|
struct snd_ctl_elem_value *ucontrol)
|
2005-04-17 05:20:36 +07:00
|
|
|
{
|
2005-11-17 21:02:42 +07:00
|
|
|
struct snd_azf3328 *chip = snd_kcontrol_chip(kcontrol);
|
|
|
|
struct azf3328_mixer_reg reg;
|
ALSA: azt3328: large codec cleanup, add I2S port etc.
- fully separate codec I/O port handling, enabling the use of a single
function each for all codecs (playback, capture, I2S out)
- add a new separate pcm for I2S out port (UNTESTED, no I2S DAC
available yet)
- switch gameport to low frequency while idle, to try to reduce noise/power
- improve snd_azf3328_codec_setdmaa() calculation
- minor variable type cleanup (u16, bool etc.)
- add some doc updates (help those lost Windows users, debug help, ...)
Note that due to the large cleanup aspect of the codec I/O change,
I was able to fit everything including all improvements into the
same binary size!! (a measly 10 bytes more or so)
This should now be the almost last patch to this driver
(minus some possible kernel clocksource patch and x86_64 fixes or so).
I just felt like taking a break from the usual stuff and wanted to
get this driver's structure finished, and it's rather clean now...
Tested, working and checkpatch.pl:ed on 2.6.30-rc5,
applies cleanly to 2.6.30 proper.
Signed-off-by: Andreas Mohr <andi@lisas.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2009-07-05 18:55:46 +07:00
|
|
|
u16 oreg, nreg, val;
|
[ALSA] PCI168 snd-azt3328 Linux driver: another huge update
- figured out 'Digital(ly) Enhanced Game Port' functionality,
implemented support for it (eliminating gameport polling overhead)
- removed optional joystick activation, gameport now enabled unconditionally,
since we now support it via the PCI I/O space, not via conflict-prone
legacy I/O (which I was thus able to DISABLE now)!
- fix playback bug (a muted wave output would get unmuted upon start of
playback, of course this is not what we want, thus remember mute state)
- implement partial power management: when idle, lower clock rate and disable
codec (reduced noise!), and disable gameport circuit when unused
- instantiate OPL3 timer, too
- much better implementation of snd_azf3328_mixer_write_volume_gradually()
- slightly optimized interrupt handling
- lots of cleanup
This time, I also found a way to verify proper OPL3 operation
via MIDI file playback (emulation via synth hardware).
Signed-off-by: Andreas Mohr <andi@lisas.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2008-05-16 17:18:29 +07:00
|
|
|
|
2005-04-17 05:20:36 +07:00
|
|
|
snd_azf3328_mixer_reg_decode(®, kcontrol->private_value);
|
2005-10-25 16:17:45 +07:00
|
|
|
oreg = snd_azf3328_mixer_inw(chip, reg.reg);
|
2005-04-17 05:20:36 +07:00
|
|
|
val = oreg;
|
2006-05-17 16:04:19 +07:00
|
|
|
if (reg.reg == IDX_MIXER_REC_SELECT) {
|
2005-04-17 05:20:36 +07:00
|
|
|
if (ucontrol->value.enumerated.item[0] > reg.enum_c - 1U ||
|
|
|
|
ucontrol->value.enumerated.item[1] > reg.enum_c - 1U)
|
|
|
|
return -EINVAL;
|
|
|
|
val = (ucontrol->value.enumerated.item[0] << 8) |
|
|
|
|
(ucontrol->value.enumerated.item[1] << 0);
|
2006-05-17 16:04:19 +07:00
|
|
|
} else {
|
2005-04-17 05:20:36 +07:00
|
|
|
if (ucontrol->value.enumerated.item[0] > reg.enum_c - 1U)
|
|
|
|
return -EINVAL;
|
|
|
|
val &= ~((reg.enum_c - 1) << reg.lchan_shift);
|
|
|
|
val |= (ucontrol->value.enumerated.item[0] << reg.lchan_shift);
|
|
|
|
}
|
2005-10-25 16:17:45 +07:00
|
|
|
snd_azf3328_mixer_outw(chip, reg.reg, val);
|
2005-04-17 05:20:36 +07:00
|
|
|
nreg = val;
|
|
|
|
|
2014-02-25 20:04:46 +07:00
|
|
|
dev_dbg(chip->card->dev,
|
|
|
|
"put_enum: %02x to %04x, oreg %04x\n", reg.reg, val, oreg);
|
2005-04-17 05:20:36 +07:00
|
|
|
return (nreg != oreg);
|
|
|
|
}
|
|
|
|
|
2020-01-03 15:16:53 +07:00
|
|
|
static const struct snd_kcontrol_new snd_azf3328_mixer_controls[] = {
|
2005-04-17 05:20:36 +07:00
|
|
|
AZF3328_MIXER_SWITCH("Master Playback Switch", IDX_MIXER_PLAY_MASTER, 15, 1),
|
|
|
|
AZF3328_MIXER_VOL_STEREO("Master Playback Volume", IDX_MIXER_PLAY_MASTER, 0x1f, 1),
|
2008-06-23 16:50:47 +07:00
|
|
|
AZF3328_MIXER_SWITCH("PCM Playback Switch", IDX_MIXER_WAVEOUT, 15, 1),
|
|
|
|
AZF3328_MIXER_VOL_STEREO("PCM Playback Volume",
|
|
|
|
IDX_MIXER_WAVEOUT, 0x1f, 1),
|
|
|
|
AZF3328_MIXER_SWITCH("PCM 3D Bypass Playback Switch",
|
|
|
|
IDX_MIXER_ADVCTL2, 7, 1),
|
2005-04-17 05:20:36 +07:00
|
|
|
AZF3328_MIXER_SWITCH("FM Playback Switch", IDX_MIXER_FMSYNTH, 15, 1),
|
|
|
|
AZF3328_MIXER_VOL_STEREO("FM Playback Volume", IDX_MIXER_FMSYNTH, 0x1f, 1),
|
|
|
|
AZF3328_MIXER_SWITCH("CD Playback Switch", IDX_MIXER_CDAUDIO, 15, 1),
|
|
|
|
AZF3328_MIXER_VOL_STEREO("CD Playback Volume", IDX_MIXER_CDAUDIO, 0x1f, 1),
|
|
|
|
AZF3328_MIXER_SWITCH("Capture Switch", IDX_MIXER_REC_VOLUME, 15, 1),
|
|
|
|
AZF3328_MIXER_VOL_STEREO("Capture Volume", IDX_MIXER_REC_VOLUME, 0x0f, 0),
|
|
|
|
AZF3328_MIXER_ENUM("Capture Source", IDX_MIXER_REC_SELECT, 8, 0),
|
|
|
|
AZF3328_MIXER_SWITCH("Mic Playback Switch", IDX_MIXER_MIC, 15, 1),
|
|
|
|
AZF3328_MIXER_VOL_MONO("Mic Playback Volume", IDX_MIXER_MIC, 0x1f, 1),
|
|
|
|
AZF3328_MIXER_SWITCH("Mic Boost (+20dB)", IDX_MIXER_MIC, 6, 0),
|
|
|
|
AZF3328_MIXER_SWITCH("Line Playback Switch", IDX_MIXER_LINEIN, 15, 1),
|
|
|
|
AZF3328_MIXER_VOL_STEREO("Line Playback Volume", IDX_MIXER_LINEIN, 0x1f, 1),
|
2009-11-03 21:47:25 +07:00
|
|
|
AZF3328_MIXER_SWITCH("Beep Playback Switch", IDX_MIXER_PCBEEP, 15, 1),
|
|
|
|
AZF3328_MIXER_VOL_SPECIAL("Beep Playback Volume", IDX_MIXER_PCBEEP, 0x0f, 1, 1),
|
2005-04-17 05:20:36 +07:00
|
|
|
AZF3328_MIXER_SWITCH("Video Playback Switch", IDX_MIXER_VIDEO, 15, 1),
|
|
|
|
AZF3328_MIXER_VOL_STEREO("Video Playback Volume", IDX_MIXER_VIDEO, 0x1f, 1),
|
|
|
|
AZF3328_MIXER_SWITCH("Aux Playback Switch", IDX_MIXER_AUX, 15, 1),
|
|
|
|
AZF3328_MIXER_VOL_STEREO("Aux Playback Volume", IDX_MIXER_AUX, 0x1f, 1),
|
|
|
|
AZF3328_MIXER_SWITCH("Modem Playback Switch", IDX_MIXER_MODEMOUT, 15, 1),
|
|
|
|
AZF3328_MIXER_VOL_MONO("Modem Playback Volume", IDX_MIXER_MODEMOUT, 0x1f, 1),
|
|
|
|
AZF3328_MIXER_SWITCH("Modem Capture Switch", IDX_MIXER_MODEMIN, 15, 1),
|
|
|
|
AZF3328_MIXER_VOL_MONO("Modem Capture Volume", IDX_MIXER_MODEMIN, 0x1f, 1),
|
2006-05-17 16:03:16 +07:00
|
|
|
AZF3328_MIXER_ENUM("Mic Select", IDX_MIXER_ADVCTL2, 2, 8),
|
|
|
|
AZF3328_MIXER_ENUM("Mono Output Select", IDX_MIXER_ADVCTL2, 2, 9),
|
2007-03-26 17:49:45 +07:00
|
|
|
AZF3328_MIXER_ENUM("PCM Output Route", IDX_MIXER_ADVCTL2, 2, 15), /* PCM Out Path, place in front since it controls *both* 3D and Bass/Treble! */
|
2005-04-17 05:20:36 +07:00
|
|
|
AZF3328_MIXER_VOL_SPECIAL("Tone Control - Treble", IDX_MIXER_BASSTREBLE, 0x07, 1, 0),
|
|
|
|
AZF3328_MIXER_VOL_SPECIAL("Tone Control - Bass", IDX_MIXER_BASSTREBLE, 0x07, 9, 0),
|
2005-10-25 16:17:45 +07:00
|
|
|
AZF3328_MIXER_SWITCH("3D Control - Switch", IDX_MIXER_ADVCTL2, 13, 0),
|
2006-05-17 16:03:16 +07:00
|
|
|
AZF3328_MIXER_VOL_SPECIAL("3D Control - Width", IDX_MIXER_ADVCTL1, 0x07, 1, 0), /* "3D Width" */
|
|
|
|
AZF3328_MIXER_VOL_SPECIAL("3D Control - Depth", IDX_MIXER_ADVCTL1, 0x03, 8, 0), /* "Hifi 3D" */
|
2005-04-17 05:20:36 +07:00
|
|
|
#if MIXER_TESTING
|
|
|
|
AZF3328_MIXER_SWITCH("0", IDX_MIXER_ADVCTL2, 0, 0),
|
|
|
|
AZF3328_MIXER_SWITCH("1", IDX_MIXER_ADVCTL2, 1, 0),
|
|
|
|
AZF3328_MIXER_SWITCH("2", IDX_MIXER_ADVCTL2, 2, 0),
|
|
|
|
AZF3328_MIXER_SWITCH("3", IDX_MIXER_ADVCTL2, 3, 0),
|
|
|
|
AZF3328_MIXER_SWITCH("4", IDX_MIXER_ADVCTL2, 4, 0),
|
|
|
|
AZF3328_MIXER_SWITCH("5", IDX_MIXER_ADVCTL2, 5, 0),
|
|
|
|
AZF3328_MIXER_SWITCH("6", IDX_MIXER_ADVCTL2, 6, 0),
|
|
|
|
AZF3328_MIXER_SWITCH("7", IDX_MIXER_ADVCTL2, 7, 0),
|
|
|
|
AZF3328_MIXER_SWITCH("8", IDX_MIXER_ADVCTL2, 8, 0),
|
|
|
|
AZF3328_MIXER_SWITCH("9", IDX_MIXER_ADVCTL2, 9, 0),
|
|
|
|
AZF3328_MIXER_SWITCH("10", IDX_MIXER_ADVCTL2, 10, 0),
|
|
|
|
AZF3328_MIXER_SWITCH("11", IDX_MIXER_ADVCTL2, 11, 0),
|
|
|
|
AZF3328_MIXER_SWITCH("12", IDX_MIXER_ADVCTL2, 12, 0),
|
|
|
|
AZF3328_MIXER_SWITCH("13", IDX_MIXER_ADVCTL2, 13, 0),
|
|
|
|
AZF3328_MIXER_SWITCH("14", IDX_MIXER_ADVCTL2, 14, 0),
|
|
|
|
AZF3328_MIXER_SWITCH("15", IDX_MIXER_ADVCTL2, 15, 0),
|
|
|
|
#endif
|
|
|
|
};
|
|
|
|
|
2020-01-05 21:48:15 +07:00
|
|
|
static const u16 snd_azf3328_init_values[][2] = {
|
2005-04-17 05:20:36 +07:00
|
|
|
{ IDX_MIXER_PLAY_MASTER, MIXER_MUTE_MASK|0x1f1f },
|
|
|
|
{ IDX_MIXER_MODEMOUT, MIXER_MUTE_MASK|0x1f1f },
|
|
|
|
{ IDX_MIXER_BASSTREBLE, 0x0000 },
|
|
|
|
{ IDX_MIXER_PCBEEP, MIXER_MUTE_MASK|0x1f1f },
|
|
|
|
{ IDX_MIXER_MODEMIN, MIXER_MUTE_MASK|0x1f1f },
|
|
|
|
{ IDX_MIXER_MIC, MIXER_MUTE_MASK|0x001f },
|
|
|
|
{ IDX_MIXER_LINEIN, MIXER_MUTE_MASK|0x1f1f },
|
|
|
|
{ IDX_MIXER_CDAUDIO, MIXER_MUTE_MASK|0x1f1f },
|
|
|
|
{ IDX_MIXER_VIDEO, MIXER_MUTE_MASK|0x1f1f },
|
|
|
|
{ IDX_MIXER_AUX, MIXER_MUTE_MASK|0x1f1f },
|
|
|
|
{ IDX_MIXER_WAVEOUT, MIXER_MUTE_MASK|0x1f1f },
|
|
|
|
{ IDX_MIXER_FMSYNTH, MIXER_MUTE_MASK|0x1f1f },
|
|
|
|
{ IDX_MIXER_REC_VOLUME, MIXER_MUTE_MASK|0x0707 },
|
|
|
|
};
|
|
|
|
|
2012-12-07 00:35:10 +07:00
|
|
|
static int
|
2005-11-17 21:02:42 +07:00
|
|
|
snd_azf3328_mixer_new(struct snd_azf3328 *chip)
|
2005-04-17 05:20:36 +07:00
|
|
|
{
|
2005-11-17 21:02:42 +07:00
|
|
|
struct snd_card *card;
|
|
|
|
const struct snd_kcontrol_new *sw;
|
2005-04-17 05:20:36 +07:00
|
|
|
unsigned int idx;
|
|
|
|
int err;
|
|
|
|
|
2008-08-08 22:12:14 +07:00
|
|
|
if (snd_BUG_ON(!chip || !chip->card))
|
|
|
|
return -EINVAL;
|
2005-04-17 05:20:36 +07:00
|
|
|
|
|
|
|
card = chip->card;
|
|
|
|
|
|
|
|
/* mixer reset */
|
2005-10-25 16:17:45 +07:00
|
|
|
snd_azf3328_mixer_outw(chip, IDX_MIXER_RESET, 0x0000);
|
2005-04-17 05:20:36 +07:00
|
|
|
|
|
|
|
/* mute and zero volume channels */
|
[ALSA] PCI168 snd-azt3328 Linux driver: another huge update
- figured out 'Digital(ly) Enhanced Game Port' functionality,
implemented support for it (eliminating gameport polling overhead)
- removed optional joystick activation, gameport now enabled unconditionally,
since we now support it via the PCI I/O space, not via conflict-prone
legacy I/O (which I was thus able to DISABLE now)!
- fix playback bug (a muted wave output would get unmuted upon start of
playback, of course this is not what we want, thus remember mute state)
- implement partial power management: when idle, lower clock rate and disable
codec (reduced noise!), and disable gameport circuit when unused
- instantiate OPL3 timer, too
- much better implementation of snd_azf3328_mixer_write_volume_gradually()
- slightly optimized interrupt handling
- lots of cleanup
This time, I also found a way to verify proper OPL3 operation
via MIDI file playback (emulation via synth hardware).
Signed-off-by: Andreas Mohr <andi@lisas.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2008-05-16 17:18:29 +07:00
|
|
|
for (idx = 0; idx < ARRAY_SIZE(snd_azf3328_init_values); ++idx) {
|
2005-10-25 16:17:45 +07:00
|
|
|
snd_azf3328_mixer_outw(chip,
|
|
|
|
snd_azf3328_init_values[idx][0],
|
|
|
|
snd_azf3328_init_values[idx][1]);
|
2005-04-17 05:20:36 +07:00
|
|
|
}
|
[ALSA] PCI168 snd-azt3328 Linux driver: another huge update
- figured out 'Digital(ly) Enhanced Game Port' functionality,
implemented support for it (eliminating gameport polling overhead)
- removed optional joystick activation, gameport now enabled unconditionally,
since we now support it via the PCI I/O space, not via conflict-prone
legacy I/O (which I was thus able to DISABLE now)!
- fix playback bug (a muted wave output would get unmuted upon start of
playback, of course this is not what we want, thus remember mute state)
- implement partial power management: when idle, lower clock rate and disable
codec (reduced noise!), and disable gameport circuit when unused
- instantiate OPL3 timer, too
- much better implementation of snd_azf3328_mixer_write_volume_gradually()
- slightly optimized interrupt handling
- lots of cleanup
This time, I also found a way to verify proper OPL3 operation
via MIDI file playback (emulation via synth hardware).
Signed-off-by: Andreas Mohr <andi@lisas.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2008-05-16 17:18:29 +07:00
|
|
|
|
2005-04-17 05:20:36 +07:00
|
|
|
/* add mixer controls */
|
|
|
|
sw = snd_azf3328_mixer_controls;
|
[ALSA] PCI168 snd-azt3328 Linux driver: another huge update
- figured out 'Digital(ly) Enhanced Game Port' functionality,
implemented support for it (eliminating gameport polling overhead)
- removed optional joystick activation, gameport now enabled unconditionally,
since we now support it via the PCI I/O space, not via conflict-prone
legacy I/O (which I was thus able to DISABLE now)!
- fix playback bug (a muted wave output would get unmuted upon start of
playback, of course this is not what we want, thus remember mute state)
- implement partial power management: when idle, lower clock rate and disable
codec (reduced noise!), and disable gameport circuit when unused
- instantiate OPL3 timer, too
- much better implementation of snd_azf3328_mixer_write_volume_gradually()
- slightly optimized interrupt handling
- lots of cleanup
This time, I also found a way to verify proper OPL3 operation
via MIDI file playback (emulation via synth hardware).
Signed-off-by: Andreas Mohr <andi@lisas.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2008-05-16 17:18:29 +07:00
|
|
|
for (idx = 0; idx < ARRAY_SIZE(snd_azf3328_mixer_controls);
|
|
|
|
++idx, ++sw) {
|
2005-04-17 05:20:36 +07:00
|
|
|
if ((err = snd_ctl_add(chip->card, snd_ctl_new1(sw, chip))) < 0)
|
|
|
|
return err;
|
|
|
|
}
|
|
|
|
snd_component_add(card, "AZF3328 mixer");
|
|
|
|
strcpy(card->mixername, "AZF3328 mixer");
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
2011-02-19 06:49:32 +07:00
|
|
|
#endif /* AZF_USE_AC97_LAYER */
|
2005-04-17 05:20:36 +07:00
|
|
|
|
2005-10-25 16:17:45 +07:00
|
|
|
static void
|
2010-12-28 03:17:26 +07:00
|
|
|
snd_azf3328_codec_setfmt(struct snd_azf3328_codec_data *codec,
|
2008-06-23 16:50:47 +07:00
|
|
|
enum azf_freq_t bitrate,
|
2005-04-17 05:20:36 +07:00
|
|
|
unsigned int format_width,
|
|
|
|
unsigned int channels
|
|
|
|
)
|
|
|
|
{
|
|
|
|
unsigned long flags;
|
ALSA: azt3328: large codec cleanup, add I2S port etc.
- fully separate codec I/O port handling, enabling the use of a single
function each for all codecs (playback, capture, I2S out)
- add a new separate pcm for I2S out port (UNTESTED, no I2S DAC
available yet)
- switch gameport to low frequency while idle, to try to reduce noise/power
- improve snd_azf3328_codec_setdmaa() calculation
- minor variable type cleanup (u16, bool etc.)
- add some doc updates (help those lost Windows users, debug help, ...)
Note that due to the large cleanup aspect of the codec I/O change,
I was able to fit everything including all improvements into the
same binary size!! (a measly 10 bytes more or so)
This should now be the almost last patch to this driver
(minus some possible kernel clocksource patch and x86_64 fixes or so).
I just felt like taking a break from the usual stuff and wanted to
get this driver's structure finished, and it's rather clean now...
Tested, working and checkpatch.pl:ed on 2.6.30-rc5,
applies cleanly to 2.6.30 proper.
Signed-off-by: Andreas Mohr <andi@lisas.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2009-07-05 18:55:46 +07:00
|
|
|
u16 val = 0xff00;
|
2010-12-28 03:16:49 +07:00
|
|
|
u8 freq = 0;
|
2005-04-17 05:20:36 +07:00
|
|
|
|
|
|
|
switch (bitrate) {
|
2011-01-25 12:46:31 +07:00
|
|
|
case AZF_FREQ_4000: freq = SOUNDFORMAT_FREQ_SUSPECTED_4000; break;
|
|
|
|
case AZF_FREQ_4800: freq = SOUNDFORMAT_FREQ_SUSPECTED_4800; break;
|
|
|
|
case AZF_FREQ_5512:
|
|
|
|
/* the AZF3328 names it "5510" for some strange reason */
|
|
|
|
freq = SOUNDFORMAT_FREQ_5510; break;
|
|
|
|
case AZF_FREQ_6620: freq = SOUNDFORMAT_FREQ_6620; break;
|
|
|
|
case AZF_FREQ_8000: freq = SOUNDFORMAT_FREQ_8000; break;
|
|
|
|
case AZF_FREQ_9600: freq = SOUNDFORMAT_FREQ_9600; break;
|
|
|
|
case AZF_FREQ_11025: freq = SOUNDFORMAT_FREQ_11025; break;
|
|
|
|
case AZF_FREQ_13240: freq = SOUNDFORMAT_FREQ_SUSPECTED_13240; break;
|
|
|
|
case AZF_FREQ_16000: freq = SOUNDFORMAT_FREQ_16000; break;
|
|
|
|
case AZF_FREQ_22050: freq = SOUNDFORMAT_FREQ_22050; break;
|
|
|
|
case AZF_FREQ_32000: freq = SOUNDFORMAT_FREQ_32000; break;
|
2005-04-17 05:20:36 +07:00
|
|
|
default:
|
2005-10-20 23:26:44 +07:00
|
|
|
snd_printk(KERN_WARNING "unknown bitrate %d, assuming 44.1kHz!\n", bitrate);
|
2020-07-09 03:32:36 +07:00
|
|
|
fallthrough;
|
2011-01-25 12:46:31 +07:00
|
|
|
case AZF_FREQ_44100: freq = SOUNDFORMAT_FREQ_44100; break;
|
|
|
|
case AZF_FREQ_48000: freq = SOUNDFORMAT_FREQ_48000; break;
|
|
|
|
case AZF_FREQ_66200: freq = SOUNDFORMAT_FREQ_SUSPECTED_66200; break;
|
2005-04-17 05:20:36 +07:00
|
|
|
}
|
2005-10-25 16:17:45 +07:00
|
|
|
/* val = 0xff07; 3m27.993s (65301Hz; -> 64000Hz???) hmm, 66120, 65967, 66123 */
|
|
|
|
/* val = 0xff09; 17m15.098s (13123,478Hz; -> 12000Hz???) hmm, 13237.2Hz? */
|
|
|
|
/* val = 0xff0a; 47m30.599s (4764,891Hz; -> 4800Hz???) yup, 4803Hz */
|
|
|
|
/* val = 0xff0c; 57m0.510s (4010,263Hz; -> 4000Hz???) yup, 4003Hz */
|
2005-04-17 05:20:36 +07:00
|
|
|
/* val = 0xff05; 5m11.556s (... -> 44100Hz) */
|
|
|
|
/* val = 0xff03; 10m21.529s (21872,463Hz; -> 22050Hz???) */
|
|
|
|
/* val = 0xff0f; 20m41.883s (10937,993Hz; -> 11025Hz???) */
|
|
|
|
/* val = 0xff0d; 41m23.135s (5523,600Hz; -> 5512Hz???) */
|
|
|
|
/* val = 0xff0e; 28m30.777s (8017Hz; -> 8000Hz???) */
|
2005-10-25 16:17:45 +07:00
|
|
|
|
2010-12-28 03:16:49 +07:00
|
|
|
val |= freq;
|
|
|
|
|
2005-04-17 05:20:36 +07:00
|
|
|
if (channels == 2)
|
|
|
|
val |= SOUNDFORMAT_FLAG_2CHANNELS;
|
|
|
|
|
|
|
|
if (format_width == 16)
|
|
|
|
val |= SOUNDFORMAT_FLAG_16BIT;
|
|
|
|
|
2010-12-28 03:17:26 +07:00
|
|
|
spin_lock_irqsave(codec->lock, flags);
|
[ALSA] PCI168 snd-azt3328 Linux driver: another huge update
- figured out 'Digital(ly) Enhanced Game Port' functionality,
implemented support for it (eliminating gameport polling overhead)
- removed optional joystick activation, gameport now enabled unconditionally,
since we now support it via the PCI I/O space, not via conflict-prone
legacy I/O (which I was thus able to DISABLE now)!
- fix playback bug (a muted wave output would get unmuted upon start of
playback, of course this is not what we want, thus remember mute state)
- implement partial power management: when idle, lower clock rate and disable
codec (reduced noise!), and disable gameport circuit when unused
- instantiate OPL3 timer, too
- much better implementation of snd_azf3328_mixer_write_volume_gradually()
- slightly optimized interrupt handling
- lots of cleanup
This time, I also found a way to verify proper OPL3 operation
via MIDI file playback (emulation via synth hardware).
Signed-off-by: Andreas Mohr <andi@lisas.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2008-05-16 17:18:29 +07:00
|
|
|
|
2005-04-17 05:20:36 +07:00
|
|
|
/* set bitrate/format */
|
ALSA: azt3328: large codec cleanup, add I2S port etc.
- fully separate codec I/O port handling, enabling the use of a single
function each for all codecs (playback, capture, I2S out)
- add a new separate pcm for I2S out port (UNTESTED, no I2S DAC
available yet)
- switch gameport to low frequency while idle, to try to reduce noise/power
- improve snd_azf3328_codec_setdmaa() calculation
- minor variable type cleanup (u16, bool etc.)
- add some doc updates (help those lost Windows users, debug help, ...)
Note that due to the large cleanup aspect of the codec I/O change,
I was able to fit everything including all improvements into the
same binary size!! (a measly 10 bytes more or so)
This should now be the almost last patch to this driver
(minus some possible kernel clocksource patch and x86_64 fixes or so).
I just felt like taking a break from the usual stuff and wanted to
get this driver's structure finished, and it's rather clean now...
Tested, working and checkpatch.pl:ed on 2.6.30-rc5,
applies cleanly to 2.6.30 proper.
Signed-off-by: Andreas Mohr <andi@lisas.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2009-07-05 18:55:46 +07:00
|
|
|
snd_azf3328_codec_outw(codec, IDX_IO_CODEC_SOUNDFORMAT, val);
|
[ALSA] PCI168 snd-azt3328 Linux driver: another huge update
- figured out 'Digital(ly) Enhanced Game Port' functionality,
implemented support for it (eliminating gameport polling overhead)
- removed optional joystick activation, gameport now enabled unconditionally,
since we now support it via the PCI I/O space, not via conflict-prone
legacy I/O (which I was thus able to DISABLE now)!
- fix playback bug (a muted wave output would get unmuted upon start of
playback, of course this is not what we want, thus remember mute state)
- implement partial power management: when idle, lower clock rate and disable
codec (reduced noise!), and disable gameport circuit when unused
- instantiate OPL3 timer, too
- much better implementation of snd_azf3328_mixer_write_volume_gradually()
- slightly optimized interrupt handling
- lots of cleanup
This time, I also found a way to verify proper OPL3 operation
via MIDI file playback (emulation via synth hardware).
Signed-off-by: Andreas Mohr <andi@lisas.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2008-05-16 17:18:29 +07:00
|
|
|
|
2005-04-17 05:20:36 +07:00
|
|
|
/* changing the bitrate/format settings switches off the
|
|
|
|
* audio output with an annoying click in case of 8/16bit format change
|
|
|
|
* (maybe shutting down DAC/ADC?), thus immediately
|
|
|
|
* do some tweaking to reenable it and get rid of the clicking
|
|
|
|
* (FIXME: yes, it works, but what exactly am I doing here?? :)
|
|
|
|
* FIXME: does this have some side effects for full-duplex
|
|
|
|
* or other dramatic side effects? */
|
2010-12-28 03:16:43 +07:00
|
|
|
/* do it for non-capture codecs only */
|
2010-12-28 03:17:26 +07:00
|
|
|
if (codec->type != AZF_CODEC_CAPTURE)
|
ALSA: azt3328: large codec cleanup, add I2S port etc.
- fully separate codec I/O port handling, enabling the use of a single
function each for all codecs (playback, capture, I2S out)
- add a new separate pcm for I2S out port (UNTESTED, no I2S DAC
available yet)
- switch gameport to low frequency while idle, to try to reduce noise/power
- improve snd_azf3328_codec_setdmaa() calculation
- minor variable type cleanup (u16, bool etc.)
- add some doc updates (help those lost Windows users, debug help, ...)
Note that due to the large cleanup aspect of the codec I/O change,
I was able to fit everything including all improvements into the
same binary size!! (a measly 10 bytes more or so)
This should now be the almost last patch to this driver
(minus some possible kernel clocksource patch and x86_64 fixes or so).
I just felt like taking a break from the usual stuff and wanted to
get this driver's structure finished, and it's rather clean now...
Tested, working and checkpatch.pl:ed on 2.6.30-rc5,
applies cleanly to 2.6.30 proper.
Signed-off-by: Andreas Mohr <andi@lisas.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2009-07-05 18:55:46 +07:00
|
|
|
snd_azf3328_codec_outw(codec, IDX_IO_CODEC_DMA_FLAGS,
|
|
|
|
snd_azf3328_codec_inw(codec, IDX_IO_CODEC_DMA_FLAGS) |
|
|
|
|
DMA_RUN_SOMETHING1 |
|
|
|
|
DMA_RUN_SOMETHING2 |
|
2005-10-25 16:17:45 +07:00
|
|
|
SOMETHING_ALMOST_ALWAYS_SET |
|
|
|
|
DMA_EPILOGUE_SOMETHING |
|
|
|
|
DMA_SOMETHING_ELSE
|
|
|
|
);
|
2005-04-17 05:20:36 +07:00
|
|
|
|
2010-12-28 03:17:26 +07:00
|
|
|
spin_unlock_irqrestore(codec->lock, flags);
|
2005-04-17 05:20:36 +07:00
|
|
|
}
|
|
|
|
|
[ALSA] PCI168 snd-azt3328 Linux driver: another huge update
- figured out 'Digital(ly) Enhanced Game Port' functionality,
implemented support for it (eliminating gameport polling overhead)
- removed optional joystick activation, gameport now enabled unconditionally,
since we now support it via the PCI I/O space, not via conflict-prone
legacy I/O (which I was thus able to DISABLE now)!
- fix playback bug (a muted wave output would get unmuted upon start of
playback, of course this is not what we want, thus remember mute state)
- implement partial power management: when idle, lower clock rate and disable
codec (reduced noise!), and disable gameport circuit when unused
- instantiate OPL3 timer, too
- much better implementation of snd_azf3328_mixer_write_volume_gradually()
- slightly optimized interrupt handling
- lots of cleanup
This time, I also found a way to verify proper OPL3 operation
via MIDI file playback (emulation via synth hardware).
Signed-off-by: Andreas Mohr <andi@lisas.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2008-05-16 17:18:29 +07:00
|
|
|
static inline void
|
2010-12-28 03:17:26 +07:00
|
|
|
snd_azf3328_codec_setfmt_lowpower(struct snd_azf3328_codec_data *codec
|
[ALSA] PCI168 snd-azt3328 Linux driver: another huge update
- figured out 'Digital(ly) Enhanced Game Port' functionality,
implemented support for it (eliminating gameport polling overhead)
- removed optional joystick activation, gameport now enabled unconditionally,
since we now support it via the PCI I/O space, not via conflict-prone
legacy I/O (which I was thus able to DISABLE now)!
- fix playback bug (a muted wave output would get unmuted upon start of
playback, of course this is not what we want, thus remember mute state)
- implement partial power management: when idle, lower clock rate and disable
codec (reduced noise!), and disable gameport circuit when unused
- instantiate OPL3 timer, too
- much better implementation of snd_azf3328_mixer_write_volume_gradually()
- slightly optimized interrupt handling
- lots of cleanup
This time, I also found a way to verify proper OPL3 operation
via MIDI file playback (emulation via synth hardware).
Signed-off-by: Andreas Mohr <andi@lisas.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2008-05-16 17:18:29 +07:00
|
|
|
)
|
|
|
|
{
|
|
|
|
/* choose lowest frequency for low power consumption.
|
|
|
|
* While this will cause louder noise due to rather coarse frequency,
|
|
|
|
* it should never matter since output should always
|
|
|
|
* get disabled properly when idle anyway. */
|
2010-12-28 03:17:26 +07:00
|
|
|
snd_azf3328_codec_setfmt(codec, AZF_FREQ_4000, 8, 1);
|
[ALSA] PCI168 snd-azt3328 Linux driver: another huge update
- figured out 'Digital(ly) Enhanced Game Port' functionality,
implemented support for it (eliminating gameport polling overhead)
- removed optional joystick activation, gameport now enabled unconditionally,
since we now support it via the PCI I/O space, not via conflict-prone
legacy I/O (which I was thus able to DISABLE now)!
- fix playback bug (a muted wave output would get unmuted upon start of
playback, of course this is not what we want, thus remember mute state)
- implement partial power management: when idle, lower clock rate and disable
codec (reduced noise!), and disable gameport circuit when unused
- instantiate OPL3 timer, too
- much better implementation of snd_azf3328_mixer_write_volume_gradually()
- slightly optimized interrupt handling
- lots of cleanup
This time, I also found a way to verify proper OPL3 operation
via MIDI file playback (emulation via synth hardware).
Signed-off-by: Andreas Mohr <andi@lisas.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2008-05-16 17:18:29 +07:00
|
|
|
}
|
|
|
|
|
2008-06-23 16:50:47 +07:00
|
|
|
static void
|
ALSA: azt3328: large codec cleanup, add I2S port etc.
- fully separate codec I/O port handling, enabling the use of a single
function each for all codecs (playback, capture, I2S out)
- add a new separate pcm for I2S out port (UNTESTED, no I2S DAC
available yet)
- switch gameport to low frequency while idle, to try to reduce noise/power
- improve snd_azf3328_codec_setdmaa() calculation
- minor variable type cleanup (u16, bool etc.)
- add some doc updates (help those lost Windows users, debug help, ...)
Note that due to the large cleanup aspect of the codec I/O change,
I was able to fit everything including all improvements into the
same binary size!! (a measly 10 bytes more or so)
This should now be the almost last patch to this driver
(minus some possible kernel clocksource patch and x86_64 fixes or so).
I just felt like taking a break from the usual stuff and wanted to
get this driver's structure finished, and it's rather clean now...
Tested, working and checkpatch.pl:ed on 2.6.30-rc5,
applies cleanly to 2.6.30 proper.
Signed-off-by: Andreas Mohr <andi@lisas.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2009-07-05 18:55:46 +07:00
|
|
|
snd_azf3328_ctrl_reg_6AH_update(struct snd_azf3328 *chip,
|
2008-06-23 16:50:47 +07:00
|
|
|
unsigned bitmask,
|
ALSA: azt3328: large codec cleanup, add I2S port etc.
- fully separate codec I/O port handling, enabling the use of a single
function each for all codecs (playback, capture, I2S out)
- add a new separate pcm for I2S out port (UNTESTED, no I2S DAC
available yet)
- switch gameport to low frequency while idle, to try to reduce noise/power
- improve snd_azf3328_codec_setdmaa() calculation
- minor variable type cleanup (u16, bool etc.)
- add some doc updates (help those lost Windows users, debug help, ...)
Note that due to the large cleanup aspect of the codec I/O change,
I was able to fit everything including all improvements into the
same binary size!! (a measly 10 bytes more or so)
This should now be the almost last patch to this driver
(minus some possible kernel clocksource patch and x86_64 fixes or so).
I just felt like taking a break from the usual stuff and wanted to
get this driver's structure finished, and it's rather clean now...
Tested, working and checkpatch.pl:ed on 2.6.30-rc5,
applies cleanly to 2.6.30 proper.
Signed-off-by: Andreas Mohr <andi@lisas.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2009-07-05 18:55:46 +07:00
|
|
|
bool enable
|
2008-06-23 16:50:47 +07:00
|
|
|
)
|
|
|
|
{
|
2009-07-13 03:17:54 +07:00
|
|
|
bool do_mask = !enable;
|
|
|
|
if (do_mask)
|
ALSA: azt3328: large codec cleanup, add I2S port etc.
- fully separate codec I/O port handling, enabling the use of a single
function each for all codecs (playback, capture, I2S out)
- add a new separate pcm for I2S out port (UNTESTED, no I2S DAC
available yet)
- switch gameport to low frequency while idle, to try to reduce noise/power
- improve snd_azf3328_codec_setdmaa() calculation
- minor variable type cleanup (u16, bool etc.)
- add some doc updates (help those lost Windows users, debug help, ...)
Note that due to the large cleanup aspect of the codec I/O change,
I was able to fit everything including all improvements into the
same binary size!! (a measly 10 bytes more or so)
This should now be the almost last patch to this driver
(minus some possible kernel clocksource patch and x86_64 fixes or so).
I just felt like taking a break from the usual stuff and wanted to
get this driver's structure finished, and it's rather clean now...
Tested, working and checkpatch.pl:ed on 2.6.30-rc5,
applies cleanly to 2.6.30 proper.
Signed-off-by: Andreas Mohr <andi@lisas.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2009-07-05 18:55:46 +07:00
|
|
|
chip->shadow_reg_ctrl_6AH |= bitmask;
|
2009-07-13 03:17:54 +07:00
|
|
|
else
|
|
|
|
chip->shadow_reg_ctrl_6AH &= ~bitmask;
|
2014-02-25 20:04:46 +07:00
|
|
|
dev_dbg(chip->card->dev,
|
|
|
|
"6AH_update mask 0x%04x do_mask %d: val 0x%04x\n",
|
|
|
|
bitmask, do_mask, chip->shadow_reg_ctrl_6AH);
|
ALSA: azt3328: large codec cleanup, add I2S port etc.
- fully separate codec I/O port handling, enabling the use of a single
function each for all codecs (playback, capture, I2S out)
- add a new separate pcm for I2S out port (UNTESTED, no I2S DAC
available yet)
- switch gameport to low frequency while idle, to try to reduce noise/power
- improve snd_azf3328_codec_setdmaa() calculation
- minor variable type cleanup (u16, bool etc.)
- add some doc updates (help those lost Windows users, debug help, ...)
Note that due to the large cleanup aspect of the codec I/O change,
I was able to fit everything including all improvements into the
same binary size!! (a measly 10 bytes more or so)
This should now be the almost last patch to this driver
(minus some possible kernel clocksource patch and x86_64 fixes or so).
I just felt like taking a break from the usual stuff and wanted to
get this driver's structure finished, and it's rather clean now...
Tested, working and checkpatch.pl:ed on 2.6.30-rc5,
applies cleanly to 2.6.30 proper.
Signed-off-by: Andreas Mohr <andi@lisas.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2009-07-05 18:55:46 +07:00
|
|
|
snd_azf3328_ctrl_outw(chip, IDX_IO_6AH, chip->shadow_reg_ctrl_6AH);
|
2008-06-23 16:50:47 +07:00
|
|
|
}
|
|
|
|
|
[ALSA] PCI168 snd-azt3328 Linux driver: another huge update
- figured out 'Digital(ly) Enhanced Game Port' functionality,
implemented support for it (eliminating gameport polling overhead)
- removed optional joystick activation, gameport now enabled unconditionally,
since we now support it via the PCI I/O space, not via conflict-prone
legacy I/O (which I was thus able to DISABLE now)!
- fix playback bug (a muted wave output would get unmuted upon start of
playback, of course this is not what we want, thus remember mute state)
- implement partial power management: when idle, lower clock rate and disable
codec (reduced noise!), and disable gameport circuit when unused
- instantiate OPL3 timer, too
- much better implementation of snd_azf3328_mixer_write_volume_gradually()
- slightly optimized interrupt handling
- lots of cleanup
This time, I also found a way to verify proper OPL3 operation
via MIDI file playback (emulation via synth hardware).
Signed-off-by: Andreas Mohr <andi@lisas.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2008-05-16 17:18:29 +07:00
|
|
|
static inline void
|
ALSA: azt3328: large codec cleanup, add I2S port etc.
- fully separate codec I/O port handling, enabling the use of a single
function each for all codecs (playback, capture, I2S out)
- add a new separate pcm for I2S out port (UNTESTED, no I2S DAC
available yet)
- switch gameport to low frequency while idle, to try to reduce noise/power
- improve snd_azf3328_codec_setdmaa() calculation
- minor variable type cleanup (u16, bool etc.)
- add some doc updates (help those lost Windows users, debug help, ...)
Note that due to the large cleanup aspect of the codec I/O change,
I was able to fit everything including all improvements into the
same binary size!! (a measly 10 bytes more or so)
This should now be the almost last patch to this driver
(minus some possible kernel clocksource patch and x86_64 fixes or so).
I just felt like taking a break from the usual stuff and wanted to
get this driver's structure finished, and it's rather clean now...
Tested, working and checkpatch.pl:ed on 2.6.30-rc5,
applies cleanly to 2.6.30 proper.
Signed-off-by: Andreas Mohr <andi@lisas.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2009-07-05 18:55:46 +07:00
|
|
|
snd_azf3328_ctrl_enable_codecs(struct snd_azf3328 *chip, bool enable)
|
[ALSA] PCI168 snd-azt3328 Linux driver: another huge update
- figured out 'Digital(ly) Enhanced Game Port' functionality,
implemented support for it (eliminating gameport polling overhead)
- removed optional joystick activation, gameport now enabled unconditionally,
since we now support it via the PCI I/O space, not via conflict-prone
legacy I/O (which I was thus able to DISABLE now)!
- fix playback bug (a muted wave output would get unmuted upon start of
playback, of course this is not what we want, thus remember mute state)
- implement partial power management: when idle, lower clock rate and disable
codec (reduced noise!), and disable gameport circuit when unused
- instantiate OPL3 timer, too
- much better implementation of snd_azf3328_mixer_write_volume_gradually()
- slightly optimized interrupt handling
- lots of cleanup
This time, I also found a way to verify proper OPL3 operation
via MIDI file playback (emulation via synth hardware).
Signed-off-by: Andreas Mohr <andi@lisas.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2008-05-16 17:18:29 +07:00
|
|
|
{
|
2014-02-25 20:04:46 +07:00
|
|
|
dev_dbg(chip->card->dev, "codec_enable %d\n", enable);
|
[ALSA] PCI168 snd-azt3328 Linux driver: another huge update
- figured out 'Digital(ly) Enhanced Game Port' functionality,
implemented support for it (eliminating gameport polling overhead)
- removed optional joystick activation, gameport now enabled unconditionally,
since we now support it via the PCI I/O space, not via conflict-prone
legacy I/O (which I was thus able to DISABLE now)!
- fix playback bug (a muted wave output would get unmuted upon start of
playback, of course this is not what we want, thus remember mute state)
- implement partial power management: when idle, lower clock rate and disable
codec (reduced noise!), and disable gameport circuit when unused
- instantiate OPL3 timer, too
- much better implementation of snd_azf3328_mixer_write_volume_gradually()
- slightly optimized interrupt handling
- lots of cleanup
This time, I also found a way to verify proper OPL3 operation
via MIDI file playback (emulation via synth hardware).
Signed-off-by: Andreas Mohr <andi@lisas.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2008-05-16 17:18:29 +07:00
|
|
|
/* no idea what exactly is being done here, but I strongly assume it's
|
|
|
|
* PM related */
|
ALSA: azt3328: large codec cleanup, add I2S port etc.
- fully separate codec I/O port handling, enabling the use of a single
function each for all codecs (playback, capture, I2S out)
- add a new separate pcm for I2S out port (UNTESTED, no I2S DAC
available yet)
- switch gameport to low frequency while idle, to try to reduce noise/power
- improve snd_azf3328_codec_setdmaa() calculation
- minor variable type cleanup (u16, bool etc.)
- add some doc updates (help those lost Windows users, debug help, ...)
Note that due to the large cleanup aspect of the codec I/O change,
I was able to fit everything including all improvements into the
same binary size!! (a measly 10 bytes more or so)
This should now be the almost last patch to this driver
(minus some possible kernel clocksource patch and x86_64 fixes or so).
I just felt like taking a break from the usual stuff and wanted to
get this driver's structure finished, and it's rather clean now...
Tested, working and checkpatch.pl:ed on 2.6.30-rc5,
applies cleanly to 2.6.30 proper.
Signed-off-by: Andreas Mohr <andi@lisas.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2009-07-05 18:55:46 +07:00
|
|
|
snd_azf3328_ctrl_reg_6AH_update(
|
2008-06-23 16:50:47 +07:00
|
|
|
chip, IO_6A_PAUSE_PLAYBACK_BIT8, enable
|
[ALSA] PCI168 snd-azt3328 Linux driver: another huge update
- figured out 'Digital(ly) Enhanced Game Port' functionality,
implemented support for it (eliminating gameport polling overhead)
- removed optional joystick activation, gameport now enabled unconditionally,
since we now support it via the PCI I/O space, not via conflict-prone
legacy I/O (which I was thus able to DISABLE now)!
- fix playback bug (a muted wave output would get unmuted upon start of
playback, of course this is not what we want, thus remember mute state)
- implement partial power management: when idle, lower clock rate and disable
codec (reduced noise!), and disable gameport circuit when unused
- instantiate OPL3 timer, too
- much better implementation of snd_azf3328_mixer_write_volume_gradually()
- slightly optimized interrupt handling
- lots of cleanup
This time, I also found a way to verify proper OPL3 operation
via MIDI file playback (emulation via synth hardware).
Signed-off-by: Andreas Mohr <andi@lisas.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2008-05-16 17:18:29 +07:00
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
ALSA: azt3328: large codec cleanup, add I2S port etc.
- fully separate codec I/O port handling, enabling the use of a single
function each for all codecs (playback, capture, I2S out)
- add a new separate pcm for I2S out port (UNTESTED, no I2S DAC
available yet)
- switch gameport to low frequency while idle, to try to reduce noise/power
- improve snd_azf3328_codec_setdmaa() calculation
- minor variable type cleanup (u16, bool etc.)
- add some doc updates (help those lost Windows users, debug help, ...)
Note that due to the large cleanup aspect of the codec I/O change,
I was able to fit everything including all improvements into the
same binary size!! (a measly 10 bytes more or so)
This should now be the almost last patch to this driver
(minus some possible kernel clocksource patch and x86_64 fixes or so).
I just felt like taking a break from the usual stuff and wanted to
get this driver's structure finished, and it's rather clean now...
Tested, working and checkpatch.pl:ed on 2.6.30-rc5,
applies cleanly to 2.6.30 proper.
Signed-off-by: Andreas Mohr <andi@lisas.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2009-07-05 18:55:46 +07:00
|
|
|
snd_azf3328_ctrl_codec_activity(struct snd_azf3328 *chip,
|
|
|
|
enum snd_azf3328_codec_type codec_type,
|
|
|
|
bool enable
|
[ALSA] PCI168 snd-azt3328 Linux driver: another huge update
- figured out 'Digital(ly) Enhanced Game Port' functionality,
implemented support for it (eliminating gameport polling overhead)
- removed optional joystick activation, gameport now enabled unconditionally,
since we now support it via the PCI I/O space, not via conflict-prone
legacy I/O (which I was thus able to DISABLE now)!
- fix playback bug (a muted wave output would get unmuted upon start of
playback, of course this is not what we want, thus remember mute state)
- implement partial power management: when idle, lower clock rate and disable
codec (reduced noise!), and disable gameport circuit when unused
- instantiate OPL3 timer, too
- much better implementation of snd_azf3328_mixer_write_volume_gradually()
- slightly optimized interrupt handling
- lots of cleanup
This time, I also found a way to verify proper OPL3 operation
via MIDI file playback (emulation via synth hardware).
Signed-off-by: Andreas Mohr <andi@lisas.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2008-05-16 17:18:29 +07:00
|
|
|
)
|
|
|
|
{
|
ALSA: azt3328: large codec cleanup, add I2S port etc.
- fully separate codec I/O port handling, enabling the use of a single
function each for all codecs (playback, capture, I2S out)
- add a new separate pcm for I2S out port (UNTESTED, no I2S DAC
available yet)
- switch gameport to low frequency while idle, to try to reduce noise/power
- improve snd_azf3328_codec_setdmaa() calculation
- minor variable type cleanup (u16, bool etc.)
- add some doc updates (help those lost Windows users, debug help, ...)
Note that due to the large cleanup aspect of the codec I/O change,
I was able to fit everything including all improvements into the
same binary size!! (a measly 10 bytes more or so)
This should now be the almost last patch to this driver
(minus some possible kernel clocksource patch and x86_64 fixes or so).
I just felt like taking a break from the usual stuff and wanted to
get this driver's structure finished, and it's rather clean now...
Tested, working and checkpatch.pl:ed on 2.6.30-rc5,
applies cleanly to 2.6.30 proper.
Signed-off-by: Andreas Mohr <andi@lisas.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2009-07-05 18:55:46 +07:00
|
|
|
struct snd_azf3328_codec_data *codec = &chip->codecs[codec_type];
|
|
|
|
bool need_change = (codec->running != enable);
|
[ALSA] PCI168 snd-azt3328 Linux driver: another huge update
- figured out 'Digital(ly) Enhanced Game Port' functionality,
implemented support for it (eliminating gameport polling overhead)
- removed optional joystick activation, gameport now enabled unconditionally,
since we now support it via the PCI I/O space, not via conflict-prone
legacy I/O (which I was thus able to DISABLE now)!
- fix playback bug (a muted wave output would get unmuted upon start of
playback, of course this is not what we want, thus remember mute state)
- implement partial power management: when idle, lower clock rate and disable
codec (reduced noise!), and disable gameport circuit when unused
- instantiate OPL3 timer, too
- much better implementation of snd_azf3328_mixer_write_volume_gradually()
- slightly optimized interrupt handling
- lots of cleanup
This time, I also found a way to verify proper OPL3 operation
via MIDI file playback (emulation via synth hardware).
Signed-off-by: Andreas Mohr <andi@lisas.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2008-05-16 17:18:29 +07:00
|
|
|
|
2014-02-25 20:04:46 +07:00
|
|
|
dev_dbg(chip->card->dev,
|
ALSA: azt3328: large codec cleanup, add I2S port etc.
- fully separate codec I/O port handling, enabling the use of a single
function each for all codecs (playback, capture, I2S out)
- add a new separate pcm for I2S out port (UNTESTED, no I2S DAC
available yet)
- switch gameport to low frequency while idle, to try to reduce noise/power
- improve snd_azf3328_codec_setdmaa() calculation
- minor variable type cleanup (u16, bool etc.)
- add some doc updates (help those lost Windows users, debug help, ...)
Note that due to the large cleanup aspect of the codec I/O change,
I was able to fit everything including all improvements into the
same binary size!! (a measly 10 bytes more or so)
This should now be the almost last patch to this driver
(minus some possible kernel clocksource patch and x86_64 fixes or so).
I just felt like taking a break from the usual stuff and wanted to
get this driver's structure finished, and it's rather clean now...
Tested, working and checkpatch.pl:ed on 2.6.30-rc5,
applies cleanly to 2.6.30 proper.
Signed-off-by: Andreas Mohr <andi@lisas.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2009-07-05 18:55:46 +07:00
|
|
|
"codec_activity: %s codec, enable %d, need_change %d\n",
|
|
|
|
codec->name, enable, need_change
|
[ALSA] PCI168 snd-azt3328 Linux driver: another huge update
- figured out 'Digital(ly) Enhanced Game Port' functionality,
implemented support for it (eliminating gameport polling overhead)
- removed optional joystick activation, gameport now enabled unconditionally,
since we now support it via the PCI I/O space, not via conflict-prone
legacy I/O (which I was thus able to DISABLE now)!
- fix playback bug (a muted wave output would get unmuted upon start of
playback, of course this is not what we want, thus remember mute state)
- implement partial power management: when idle, lower clock rate and disable
codec (reduced noise!), and disable gameport circuit when unused
- instantiate OPL3 timer, too
- much better implementation of snd_azf3328_mixer_write_volume_gradually()
- slightly optimized interrupt handling
- lots of cleanup
This time, I also found a way to verify proper OPL3 operation
via MIDI file playback (emulation via synth hardware).
Signed-off-by: Andreas Mohr <andi@lisas.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2008-05-16 17:18:29 +07:00
|
|
|
);
|
|
|
|
if (need_change) {
|
ALSA: azt3328: large codec cleanup, add I2S port etc.
- fully separate codec I/O port handling, enabling the use of a single
function each for all codecs (playback, capture, I2S out)
- add a new separate pcm for I2S out port (UNTESTED, no I2S DAC
available yet)
- switch gameport to low frequency while idle, to try to reduce noise/power
- improve snd_azf3328_codec_setdmaa() calculation
- minor variable type cleanup (u16, bool etc.)
- add some doc updates (help those lost Windows users, debug help, ...)
Note that due to the large cleanup aspect of the codec I/O change,
I was able to fit everything including all improvements into the
same binary size!! (a measly 10 bytes more or so)
This should now be the almost last patch to this driver
(minus some possible kernel clocksource patch and x86_64 fixes or so).
I just felt like taking a break from the usual stuff and wanted to
get this driver's structure finished, and it's rather clean now...
Tested, working and checkpatch.pl:ed on 2.6.30-rc5,
applies cleanly to 2.6.30 proper.
Signed-off-by: Andreas Mohr <andi@lisas.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2009-07-05 18:55:46 +07:00
|
|
|
static const struct {
|
|
|
|
enum snd_azf3328_codec_type other1;
|
|
|
|
enum snd_azf3328_codec_type other2;
|
|
|
|
} peer_codecs[3] =
|
|
|
|
{ { AZF_CODEC_CAPTURE, AZF_CODEC_I2S_OUT },
|
|
|
|
{ AZF_CODEC_PLAYBACK, AZF_CODEC_I2S_OUT },
|
|
|
|
{ AZF_CODEC_PLAYBACK, AZF_CODEC_CAPTURE } };
|
|
|
|
bool call_function;
|
|
|
|
|
|
|
|
if (enable)
|
|
|
|
/* if enable codec, call enable_codecs func
|
|
|
|
to enable codec supply... */
|
|
|
|
call_function = 1;
|
|
|
|
else {
|
|
|
|
/* ...otherwise call enable_codecs func
|
|
|
|
(which globally shuts down operation of codecs)
|
|
|
|
only in case the other codecs are currently
|
|
|
|
not active either! */
|
2009-07-13 03:17:54 +07:00
|
|
|
call_function =
|
|
|
|
((!chip->codecs[peer_codecs[codec_type].other1]
|
|
|
|
.running)
|
|
|
|
&& (!chip->codecs[peer_codecs[codec_type].other2]
|
|
|
|
.running));
|
2015-02-25 20:32:45 +07:00
|
|
|
}
|
|
|
|
if (call_function)
|
ALSA: azt3328: large codec cleanup, add I2S port etc.
- fully separate codec I/O port handling, enabling the use of a single
function each for all codecs (playback, capture, I2S out)
- add a new separate pcm for I2S out port (UNTESTED, no I2S DAC
available yet)
- switch gameport to low frequency while idle, to try to reduce noise/power
- improve snd_azf3328_codec_setdmaa() calculation
- minor variable type cleanup (u16, bool etc.)
- add some doc updates (help those lost Windows users, debug help, ...)
Note that due to the large cleanup aspect of the codec I/O change,
I was able to fit everything including all improvements into the
same binary size!! (a measly 10 bytes more or so)
This should now be the almost last patch to this driver
(minus some possible kernel clocksource patch and x86_64 fixes or so).
I just felt like taking a break from the usual stuff and wanted to
get this driver's structure finished, and it's rather clean now...
Tested, working and checkpatch.pl:ed on 2.6.30-rc5,
applies cleanly to 2.6.30 proper.
Signed-off-by: Andreas Mohr <andi@lisas.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2009-07-05 18:55:46 +07:00
|
|
|
snd_azf3328_ctrl_enable_codecs(chip, enable);
|
[ALSA] PCI168 snd-azt3328 Linux driver: another huge update
- figured out 'Digital(ly) Enhanced Game Port' functionality,
implemented support for it (eliminating gameport polling overhead)
- removed optional joystick activation, gameport now enabled unconditionally,
since we now support it via the PCI I/O space, not via conflict-prone
legacy I/O (which I was thus able to DISABLE now)!
- fix playback bug (a muted wave output would get unmuted upon start of
playback, of course this is not what we want, thus remember mute state)
- implement partial power management: when idle, lower clock rate and disable
codec (reduced noise!), and disable gameport circuit when unused
- instantiate OPL3 timer, too
- much better implementation of snd_azf3328_mixer_write_volume_gradually()
- slightly optimized interrupt handling
- lots of cleanup
This time, I also found a way to verify proper OPL3 operation
via MIDI file playback (emulation via synth hardware).
Signed-off-by: Andreas Mohr <andi@lisas.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2008-05-16 17:18:29 +07:00
|
|
|
|
|
|
|
/* ...and adjust clock, too
|
|
|
|
* (reduce noise and power consumption) */
|
|
|
|
if (!enable)
|
2010-12-28 03:17:26 +07:00
|
|
|
snd_azf3328_codec_setfmt_lowpower(codec);
|
2009-07-13 03:17:54 +07:00
|
|
|
codec->running = enable;
|
[ALSA] PCI168 snd-azt3328 Linux driver: another huge update
- figured out 'Digital(ly) Enhanced Game Port' functionality,
implemented support for it (eliminating gameport polling overhead)
- removed optional joystick activation, gameport now enabled unconditionally,
since we now support it via the PCI I/O space, not via conflict-prone
legacy I/O (which I was thus able to DISABLE now)!
- fix playback bug (a muted wave output would get unmuted upon start of
playback, of course this is not what we want, thus remember mute state)
- implement partial power management: when idle, lower clock rate and disable
codec (reduced noise!), and disable gameport circuit when unused
- instantiate OPL3 timer, too
- much better implementation of snd_azf3328_mixer_write_volume_gradually()
- slightly optimized interrupt handling
- lots of cleanup
This time, I also found a way to verify proper OPL3 operation
via MIDI file playback (emulation via synth hardware).
Signed-off-by: Andreas Mohr <andi@lisas.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2008-05-16 17:18:29 +07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2005-10-25 16:17:45 +07:00
|
|
|
static void
|
2014-02-25 20:04:46 +07:00
|
|
|
snd_azf3328_codec_setdmaa(struct snd_azf3328 *chip,
|
|
|
|
struct snd_azf3328_codec_data *codec,
|
|
|
|
unsigned long addr,
|
|
|
|
unsigned int period_bytes,
|
|
|
|
unsigned int buffer_bytes
|
[ALSA] PCI168 snd-azt3328 Linux driver: another huge update
- figured out 'Digital(ly) Enhanced Game Port' functionality,
implemented support for it (eliminating gameport polling overhead)
- removed optional joystick activation, gameport now enabled unconditionally,
since we now support it via the PCI I/O space, not via conflict-prone
legacy I/O (which I was thus able to DISABLE now)!
- fix playback bug (a muted wave output would get unmuted upon start of
playback, of course this is not what we want, thus remember mute state)
- implement partial power management: when idle, lower clock rate and disable
codec (reduced noise!), and disable gameport circuit when unused
- instantiate OPL3 timer, too
- much better implementation of snd_azf3328_mixer_write_volume_gradually()
- slightly optimized interrupt handling
- lots of cleanup
This time, I also found a way to verify proper OPL3 operation
via MIDI file playback (emulation via synth hardware).
Signed-off-by: Andreas Mohr <andi@lisas.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2008-05-16 17:18:29 +07:00
|
|
|
)
|
2005-04-17 05:20:36 +07:00
|
|
|
{
|
2010-12-28 03:17:35 +07:00
|
|
|
WARN_ONCE(period_bytes & 1, "odd period length!?\n");
|
|
|
|
WARN_ONCE(buffer_bytes != 2 * period_bytes,
|
|
|
|
"missed our input expectations! %u vs. %u\n",
|
|
|
|
buffer_bytes, period_bytes);
|
ALSA: azt3328: large codec cleanup, add I2S port etc.
- fully separate codec I/O port handling, enabling the use of a single
function each for all codecs (playback, capture, I2S out)
- add a new separate pcm for I2S out port (UNTESTED, no I2S DAC
available yet)
- switch gameport to low frequency while idle, to try to reduce noise/power
- improve snd_azf3328_codec_setdmaa() calculation
- minor variable type cleanup (u16, bool etc.)
- add some doc updates (help those lost Windows users, debug help, ...)
Note that due to the large cleanup aspect of the codec I/O change,
I was able to fit everything including all improvements into the
same binary size!! (a measly 10 bytes more or so)
This should now be the almost last patch to this driver
(minus some possible kernel clocksource patch and x86_64 fixes or so).
I just felt like taking a break from the usual stuff and wanted to
get this driver's structure finished, and it's rather clean now...
Tested, working and checkpatch.pl:ed on 2.6.30-rc5,
applies cleanly to 2.6.30 proper.
Signed-off-by: Andreas Mohr <andi@lisas.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2009-07-05 18:55:46 +07:00
|
|
|
if (!codec->running) {
|
|
|
|
/* AZF3328 uses a two buffer pointer DMA transfer approach */
|
[ALSA] PCI168 snd-azt3328 Linux driver: another huge update
- figured out 'Digital(ly) Enhanced Game Port' functionality,
implemented support for it (eliminating gameport polling overhead)
- removed optional joystick activation, gameport now enabled unconditionally,
since we now support it via the PCI I/O space, not via conflict-prone
legacy I/O (which I was thus able to DISABLE now)!
- fix playback bug (a muted wave output would get unmuted upon start of
playback, of course this is not what we want, thus remember mute state)
- implement partial power management: when idle, lower clock rate and disable
codec (reduced noise!), and disable gameport circuit when unused
- instantiate OPL3 timer, too
- much better implementation of snd_azf3328_mixer_write_volume_gradually()
- slightly optimized interrupt handling
- lots of cleanup
This time, I also found a way to verify proper OPL3 operation
via MIDI file playback (emulation via synth hardware).
Signed-off-by: Andreas Mohr <andi@lisas.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2008-05-16 17:18:29 +07:00
|
|
|
|
2010-12-28 03:17:35 +07:00
|
|
|
unsigned long flags;
|
[ALSA] PCI168 snd-azt3328 Linux driver: another huge update
- figured out 'Digital(ly) Enhanced Game Port' functionality,
implemented support for it (eliminating gameport polling overhead)
- removed optional joystick activation, gameport now enabled unconditionally,
since we now support it via the PCI I/O space, not via conflict-prone
legacy I/O (which I was thus able to DISABLE now)!
- fix playback bug (a muted wave output would get unmuted upon start of
playback, of course this is not what we want, thus remember mute state)
- implement partial power management: when idle, lower clock rate and disable
codec (reduced noise!), and disable gameport circuit when unused
- instantiate OPL3 timer, too
- much better implementation of snd_azf3328_mixer_write_volume_gradually()
- slightly optimized interrupt handling
- lots of cleanup
This time, I also found a way to verify proper OPL3 operation
via MIDI file playback (emulation via synth hardware).
Signed-off-by: Andreas Mohr <andi@lisas.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2008-05-16 17:18:29 +07:00
|
|
|
|
|
|
|
/* width 32bit (prevent overflow): */
|
2010-12-28 03:17:35 +07:00
|
|
|
u32 area_length;
|
|
|
|
struct codec_setup_io {
|
|
|
|
u32 dma_start_1;
|
|
|
|
u32 dma_start_2;
|
|
|
|
u32 dma_lengths;
|
|
|
|
} __attribute__((packed)) setup_io;
|
2005-10-25 16:17:45 +07:00
|
|
|
|
2010-12-28 03:17:35 +07:00
|
|
|
area_length = buffer_bytes/2;
|
2005-10-25 16:17:45 +07:00
|
|
|
|
2010-12-28 03:17:35 +07:00
|
|
|
setup_io.dma_start_1 = addr;
|
|
|
|
setup_io.dma_start_2 = addr+area_length;
|
|
|
|
|
2014-02-25 20:04:46 +07:00
|
|
|
dev_dbg(chip->card->dev,
|
2010-12-28 03:17:35 +07:00
|
|
|
"setdma: buffers %08x[%u] / %08x[%u], %u, %u\n",
|
|
|
|
setup_io.dma_start_1, area_length,
|
|
|
|
setup_io.dma_start_2, area_length,
|
|
|
|
period_bytes, buffer_bytes);
|
|
|
|
|
|
|
|
/* Hmm, are we really supposed to decrement this by 1??
|
|
|
|
Most definitely certainly not: configuring full length does
|
|
|
|
work properly (i.e. likely better), and BTW we
|
|
|
|
violated possibly differing frame sizes with this...
|
|
|
|
|
|
|
|
area_length--; |* max. index *|
|
|
|
|
*/
|
2010-11-21 18:09:32 +07:00
|
|
|
|
2005-10-25 16:17:45 +07:00
|
|
|
/* build combined I/O buffer length word */
|
2010-12-28 03:17:35 +07:00
|
|
|
setup_io.dma_lengths = (area_length << 16) | (area_length);
|
|
|
|
|
2010-12-28 03:17:26 +07:00
|
|
|
spin_lock_irqsave(codec->lock, flags);
|
2010-12-28 03:17:35 +07:00
|
|
|
snd_azf3328_codec_outl_multi(
|
|
|
|
codec, IDX_IO_CODEC_DMA_START_1, &setup_io, 3
|
|
|
|
);
|
2010-12-28 03:17:26 +07:00
|
|
|
spin_unlock_irqrestore(codec->lock, flags);
|
2005-04-17 05:20:36 +07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2005-10-25 16:17:45 +07:00
|
|
|
static int
|
2010-12-28 03:17:26 +07:00
|
|
|
snd_azf3328_pcm_prepare(struct snd_pcm_substream *substream)
|
2005-04-17 05:20:36 +07:00
|
|
|
{
|
2005-11-17 21:02:42 +07:00
|
|
|
struct snd_pcm_runtime *runtime = substream->runtime;
|
2010-12-28 03:17:26 +07:00
|
|
|
struct snd_azf3328_codec_data *codec = runtime->private_data;
|
2010-12-28 03:17:11 +07:00
|
|
|
#if 0
|
2005-04-17 05:20:36 +07:00
|
|
|
unsigned int size = snd_pcm_lib_buffer_bytes(substream);
|
|
|
|
unsigned int count = snd_pcm_lib_period_bytes(substream);
|
|
|
|
#endif
|
|
|
|
|
2010-12-28 03:17:11 +07:00
|
|
|
codec->dma_base = runtime->dma_addr;
|
|
|
|
|
2005-04-17 05:20:36 +07:00
|
|
|
#if 0
|
2010-12-28 03:17:26 +07:00
|
|
|
snd_azf3328_codec_setfmt(codec,
|
2005-10-25 16:17:45 +07:00
|
|
|
runtime->rate,
|
|
|
|
snd_pcm_format_width(runtime->format),
|
|
|
|
runtime->channels);
|
2014-02-25 20:04:46 +07:00
|
|
|
snd_azf3328_codec_setdmaa(chip, codec,
|
ALSA: azt3328: large codec cleanup, add I2S port etc.
- fully separate codec I/O port handling, enabling the use of a single
function each for all codecs (playback, capture, I2S out)
- add a new separate pcm for I2S out port (UNTESTED, no I2S DAC
available yet)
- switch gameport to low frequency while idle, to try to reduce noise/power
- improve snd_azf3328_codec_setdmaa() calculation
- minor variable type cleanup (u16, bool etc.)
- add some doc updates (help those lost Windows users, debug help, ...)
Note that due to the large cleanup aspect of the codec I/O change,
I was able to fit everything including all improvements into the
same binary size!! (a measly 10 bytes more or so)
This should now be the almost last patch to this driver
(minus some possible kernel clocksource patch and x86_64 fixes or so).
I just felt like taking a break from the usual stuff and wanted to
get this driver's structure finished, and it's rather clean now...
Tested, working and checkpatch.pl:ed on 2.6.30-rc5,
applies cleanly to 2.6.30 proper.
Signed-off-by: Andreas Mohr <andi@lisas.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2009-07-05 18:55:46 +07:00
|
|
|
runtime->dma_addr, count, size);
|
2005-04-17 05:20:36 +07:00
|
|
|
#endif
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2005-10-25 16:17:45 +07:00
|
|
|
static int
|
2010-12-28 03:17:26 +07:00
|
|
|
snd_azf3328_pcm_trigger(struct snd_pcm_substream *substream, int cmd)
|
2005-04-17 05:20:36 +07:00
|
|
|
{
|
2005-11-17 21:02:42 +07:00
|
|
|
struct snd_azf3328 *chip = snd_pcm_substream_chip(substream);
|
|
|
|
struct snd_pcm_runtime *runtime = substream->runtime;
|
2010-12-28 03:17:26 +07:00
|
|
|
struct snd_azf3328_codec_data *codec = runtime->private_data;
|
2005-04-17 05:20:36 +07:00
|
|
|
int result = 0;
|
ALSA: azt3328: large codec cleanup, add I2S port etc.
- fully separate codec I/O port handling, enabling the use of a single
function each for all codecs (playback, capture, I2S out)
- add a new separate pcm for I2S out port (UNTESTED, no I2S DAC
available yet)
- switch gameport to low frequency while idle, to try to reduce noise/power
- improve snd_azf3328_codec_setdmaa() calculation
- minor variable type cleanup (u16, bool etc.)
- add some doc updates (help those lost Windows users, debug help, ...)
Note that due to the large cleanup aspect of the codec I/O change,
I was able to fit everything including all improvements into the
same binary size!! (a measly 10 bytes more or so)
This should now be the almost last patch to this driver
(minus some possible kernel clocksource patch and x86_64 fixes or so).
I just felt like taking a break from the usual stuff and wanted to
get this driver's structure finished, and it's rather clean now...
Tested, working and checkpatch.pl:ed on 2.6.30-rc5,
applies cleanly to 2.6.30 proper.
Signed-off-by: Andreas Mohr <andi@lisas.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2009-07-05 18:55:46 +07:00
|
|
|
u16 flags1;
|
2013-09-23 01:44:12 +07:00
|
|
|
bool previously_muted = false;
|
2010-12-28 03:17:26 +07:00
|
|
|
bool is_main_mixer_playback_codec = (AZF_CODEC_PLAYBACK == codec->type);
|
2005-04-17 05:20:36 +07:00
|
|
|
|
|
|
|
switch (cmd) {
|
|
|
|
case SNDRV_PCM_TRIGGER_START:
|
2014-02-25 20:04:46 +07:00
|
|
|
dev_dbg(chip->card->dev, "START PCM %s\n", codec->name);
|
ALSA: azt3328: large codec cleanup, add I2S port etc.
- fully separate codec I/O port handling, enabling the use of a single
function each for all codecs (playback, capture, I2S out)
- add a new separate pcm for I2S out port (UNTESTED, no I2S DAC
available yet)
- switch gameport to low frequency while idle, to try to reduce noise/power
- improve snd_azf3328_codec_setdmaa() calculation
- minor variable type cleanup (u16, bool etc.)
- add some doc updates (help those lost Windows users, debug help, ...)
Note that due to the large cleanup aspect of the codec I/O change,
I was able to fit everything including all improvements into the
same binary size!! (a measly 10 bytes more or so)
This should now be the almost last patch to this driver
(minus some possible kernel clocksource patch and x86_64 fixes or so).
I just felt like taking a break from the usual stuff and wanted to
get this driver's structure finished, and it's rather clean now...
Tested, working and checkpatch.pl:ed on 2.6.30-rc5,
applies cleanly to 2.6.30 proper.
Signed-off-by: Andreas Mohr <andi@lisas.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2009-07-05 18:55:46 +07:00
|
|
|
|
2010-12-28 03:17:26 +07:00
|
|
|
if (is_main_mixer_playback_codec) {
|
ALSA: azt3328: large codec cleanup, add I2S port etc.
- fully separate codec I/O port handling, enabling the use of a single
function each for all codecs (playback, capture, I2S out)
- add a new separate pcm for I2S out port (UNTESTED, no I2S DAC
available yet)
- switch gameport to low frequency while idle, to try to reduce noise/power
- improve snd_azf3328_codec_setdmaa() calculation
- minor variable type cleanup (u16, bool etc.)
- add some doc updates (help those lost Windows users, debug help, ...)
Note that due to the large cleanup aspect of the codec I/O change,
I was able to fit everything including all improvements into the
same binary size!! (a measly 10 bytes more or so)
This should now be the almost last patch to this driver
(minus some possible kernel clocksource patch and x86_64 fixes or so).
I just felt like taking a break from the usual stuff and wanted to
get this driver's structure finished, and it's rather clean now...
Tested, working and checkpatch.pl:ed on 2.6.30-rc5,
applies cleanly to 2.6.30 proper.
Signed-off-by: Andreas Mohr <andi@lisas.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2009-07-05 18:55:46 +07:00
|
|
|
/* mute WaveOut (avoid clicking during setup) */
|
|
|
|
previously_muted =
|
2011-02-19 06:49:32 +07:00
|
|
|
snd_azf3328_mixer_mute_control_pcm(
|
|
|
|
chip, 1
|
ALSA: azt3328: large codec cleanup, add I2S port etc.
- fully separate codec I/O port handling, enabling the use of a single
function each for all codecs (playback, capture, I2S out)
- add a new separate pcm for I2S out port (UNTESTED, no I2S DAC
available yet)
- switch gameport to low frequency while idle, to try to reduce noise/power
- improve snd_azf3328_codec_setdmaa() calculation
- minor variable type cleanup (u16, bool etc.)
- add some doc updates (help those lost Windows users, debug help, ...)
Note that due to the large cleanup aspect of the codec I/O change,
I was able to fit everything including all improvements into the
same binary size!! (a measly 10 bytes more or so)
This should now be the almost last patch to this driver
(minus some possible kernel clocksource patch and x86_64 fixes or so).
I just felt like taking a break from the usual stuff and wanted to
get this driver's structure finished, and it's rather clean now...
Tested, working and checkpatch.pl:ed on 2.6.30-rc5,
applies cleanly to 2.6.30 proper.
Signed-off-by: Andreas Mohr <andi@lisas.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2009-07-05 18:55:46 +07:00
|
|
|
);
|
|
|
|
}
|
2005-04-17 05:20:36 +07:00
|
|
|
|
2010-12-28 03:17:26 +07:00
|
|
|
snd_azf3328_codec_setfmt(codec,
|
2005-10-25 16:17:45 +07:00
|
|
|
runtime->rate,
|
|
|
|
snd_pcm_format_width(runtime->format),
|
|
|
|
runtime->channels);
|
2005-04-17 05:20:36 +07:00
|
|
|
|
2010-12-28 03:17:26 +07:00
|
|
|
spin_lock(codec->lock);
|
[ALSA] PCI168 snd-azt3328 Linux driver: another huge update
- figured out 'Digital(ly) Enhanced Game Port' functionality,
implemented support for it (eliminating gameport polling overhead)
- removed optional joystick activation, gameport now enabled unconditionally,
since we now support it via the PCI I/O space, not via conflict-prone
legacy I/O (which I was thus able to DISABLE now)!
- fix playback bug (a muted wave output would get unmuted upon start of
playback, of course this is not what we want, thus remember mute state)
- implement partial power management: when idle, lower clock rate and disable
codec (reduced noise!), and disable gameport circuit when unused
- instantiate OPL3 timer, too
- much better implementation of snd_azf3328_mixer_write_volume_gradually()
- slightly optimized interrupt handling
- lots of cleanup
This time, I also found a way to verify proper OPL3 operation
via MIDI file playback (emulation via synth hardware).
Signed-off-by: Andreas Mohr <andi@lisas.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2008-05-16 17:18:29 +07:00
|
|
|
/* first, remember current value: */
|
ALSA: azt3328: large codec cleanup, add I2S port etc.
- fully separate codec I/O port handling, enabling the use of a single
function each for all codecs (playback, capture, I2S out)
- add a new separate pcm for I2S out port (UNTESTED, no I2S DAC
available yet)
- switch gameport to low frequency while idle, to try to reduce noise/power
- improve snd_azf3328_codec_setdmaa() calculation
- minor variable type cleanup (u16, bool etc.)
- add some doc updates (help those lost Windows users, debug help, ...)
Note that due to the large cleanup aspect of the codec I/O change,
I was able to fit everything including all improvements into the
same binary size!! (a measly 10 bytes more or so)
This should now be the almost last patch to this driver
(minus some possible kernel clocksource patch and x86_64 fixes or so).
I just felt like taking a break from the usual stuff and wanted to
get this driver's structure finished, and it's rather clean now...
Tested, working and checkpatch.pl:ed on 2.6.30-rc5,
applies cleanly to 2.6.30 proper.
Signed-off-by: Andreas Mohr <andi@lisas.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2009-07-05 18:55:46 +07:00
|
|
|
flags1 = snd_azf3328_codec_inw(codec, IDX_IO_CODEC_DMA_FLAGS);
|
[ALSA] PCI168 snd-azt3328 Linux driver: another huge update
- figured out 'Digital(ly) Enhanced Game Port' functionality,
implemented support for it (eliminating gameport polling overhead)
- removed optional joystick activation, gameport now enabled unconditionally,
since we now support it via the PCI I/O space, not via conflict-prone
legacy I/O (which I was thus able to DISABLE now)!
- fix playback bug (a muted wave output would get unmuted upon start of
playback, of course this is not what we want, thus remember mute state)
- implement partial power management: when idle, lower clock rate and disable
codec (reduced noise!), and disable gameport circuit when unused
- instantiate OPL3 timer, too
- much better implementation of snd_azf3328_mixer_write_volume_gradually()
- slightly optimized interrupt handling
- lots of cleanup
This time, I also found a way to verify proper OPL3 operation
via MIDI file playback (emulation via synth hardware).
Signed-off-by: Andreas Mohr <andi@lisas.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2008-05-16 17:18:29 +07:00
|
|
|
|
ALSA: azt3328: large codec cleanup, add I2S port etc.
- fully separate codec I/O port handling, enabling the use of a single
function each for all codecs (playback, capture, I2S out)
- add a new separate pcm for I2S out port (UNTESTED, no I2S DAC
available yet)
- switch gameport to low frequency while idle, to try to reduce noise/power
- improve snd_azf3328_codec_setdmaa() calculation
- minor variable type cleanup (u16, bool etc.)
- add some doc updates (help those lost Windows users, debug help, ...)
Note that due to the large cleanup aspect of the codec I/O change,
I was able to fit everything including all improvements into the
same binary size!! (a measly 10 bytes more or so)
This should now be the almost last patch to this driver
(minus some possible kernel clocksource patch and x86_64 fixes or so).
I just felt like taking a break from the usual stuff and wanted to
get this driver's structure finished, and it's rather clean now...
Tested, working and checkpatch.pl:ed on 2.6.30-rc5,
applies cleanly to 2.6.30 proper.
Signed-off-by: Andreas Mohr <andi@lisas.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2009-07-05 18:55:46 +07:00
|
|
|
/* stop transfer */
|
|
|
|
flags1 &= ~DMA_RESUME;
|
|
|
|
snd_azf3328_codec_outw(codec, IDX_IO_CODEC_DMA_FLAGS, flags1);
|
[ALSA] PCI168 snd-azt3328 Linux driver: another huge update
- figured out 'Digital(ly) Enhanced Game Port' functionality,
implemented support for it (eliminating gameport polling overhead)
- removed optional joystick activation, gameport now enabled unconditionally,
since we now support it via the PCI I/O space, not via conflict-prone
legacy I/O (which I was thus able to DISABLE now)!
- fix playback bug (a muted wave output would get unmuted upon start of
playback, of course this is not what we want, thus remember mute state)
- implement partial power management: when idle, lower clock rate and disable
codec (reduced noise!), and disable gameport circuit when unused
- instantiate OPL3 timer, too
- much better implementation of snd_azf3328_mixer_write_volume_gradually()
- slightly optimized interrupt handling
- lots of cleanup
This time, I also found a way to verify proper OPL3 operation
via MIDI file playback (emulation via synth hardware).
Signed-off-by: Andreas Mohr <andi@lisas.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2008-05-16 17:18:29 +07:00
|
|
|
|
2005-04-17 05:20:36 +07:00
|
|
|
/* FIXME: clear interrupts or what??? */
|
ALSA: azt3328: large codec cleanup, add I2S port etc.
- fully separate codec I/O port handling, enabling the use of a single
function each for all codecs (playback, capture, I2S out)
- add a new separate pcm for I2S out port (UNTESTED, no I2S DAC
available yet)
- switch gameport to low frequency while idle, to try to reduce noise/power
- improve snd_azf3328_codec_setdmaa() calculation
- minor variable type cleanup (u16, bool etc.)
- add some doc updates (help those lost Windows users, debug help, ...)
Note that due to the large cleanup aspect of the codec I/O change,
I was able to fit everything including all improvements into the
same binary size!! (a measly 10 bytes more or so)
This should now be the almost last patch to this driver
(minus some possible kernel clocksource patch and x86_64 fixes or so).
I just felt like taking a break from the usual stuff and wanted to
get this driver's structure finished, and it's rather clean now...
Tested, working and checkpatch.pl:ed on 2.6.30-rc5,
applies cleanly to 2.6.30 proper.
Signed-off-by: Andreas Mohr <andi@lisas.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2009-07-05 18:55:46 +07:00
|
|
|
snd_azf3328_codec_outw(codec, IDX_IO_CODEC_IRQTYPE, 0xffff);
|
2010-12-28 03:17:26 +07:00
|
|
|
spin_unlock(codec->lock);
|
2005-04-17 05:20:36 +07:00
|
|
|
|
2014-02-25 20:04:46 +07:00
|
|
|
snd_azf3328_codec_setdmaa(chip, codec, runtime->dma_addr,
|
2005-10-25 16:17:45 +07:00
|
|
|
snd_pcm_lib_period_bytes(substream),
|
ALSA: azt3328: large codec cleanup, add I2S port etc.
- fully separate codec I/O port handling, enabling the use of a single
function each for all codecs (playback, capture, I2S out)
- add a new separate pcm for I2S out port (UNTESTED, no I2S DAC
available yet)
- switch gameport to low frequency while idle, to try to reduce noise/power
- improve snd_azf3328_codec_setdmaa() calculation
- minor variable type cleanup (u16, bool etc.)
- add some doc updates (help those lost Windows users, debug help, ...)
Note that due to the large cleanup aspect of the codec I/O change,
I was able to fit everything including all improvements into the
same binary size!! (a measly 10 bytes more or so)
This should now be the almost last patch to this driver
(minus some possible kernel clocksource patch and x86_64 fixes or so).
I just felt like taking a break from the usual stuff and wanted to
get this driver's structure finished, and it's rather clean now...
Tested, working and checkpatch.pl:ed on 2.6.30-rc5,
applies cleanly to 2.6.30 proper.
Signed-off-by: Andreas Mohr <andi@lisas.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2009-07-05 18:55:46 +07:00
|
|
|
snd_pcm_lib_buffer_bytes(substream)
|
|
|
|
);
|
2005-04-17 05:20:36 +07:00
|
|
|
|
2010-12-28 03:17:26 +07:00
|
|
|
spin_lock(codec->lock);
|
2005-04-17 05:20:36 +07:00
|
|
|
#ifdef WIN9X
|
|
|
|
/* FIXME: enable playback/recording??? */
|
ALSA: azt3328: large codec cleanup, add I2S port etc.
- fully separate codec I/O port handling, enabling the use of a single
function each for all codecs (playback, capture, I2S out)
- add a new separate pcm for I2S out port (UNTESTED, no I2S DAC
available yet)
- switch gameport to low frequency while idle, to try to reduce noise/power
- improve snd_azf3328_codec_setdmaa() calculation
- minor variable type cleanup (u16, bool etc.)
- add some doc updates (help those lost Windows users, debug help, ...)
Note that due to the large cleanup aspect of the codec I/O change,
I was able to fit everything including all improvements into the
same binary size!! (a measly 10 bytes more or so)
This should now be the almost last patch to this driver
(minus some possible kernel clocksource patch and x86_64 fixes or so).
I just felt like taking a break from the usual stuff and wanted to
get this driver's structure finished, and it's rather clean now...
Tested, working and checkpatch.pl:ed on 2.6.30-rc5,
applies cleanly to 2.6.30 proper.
Signed-off-by: Andreas Mohr <andi@lisas.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2009-07-05 18:55:46 +07:00
|
|
|
flags1 |= DMA_RUN_SOMETHING1 | DMA_RUN_SOMETHING2;
|
|
|
|
snd_azf3328_codec_outw(codec, IDX_IO_CODEC_DMA_FLAGS, flags1);
|
2005-04-17 05:20:36 +07:00
|
|
|
|
ALSA: azt3328: large codec cleanup, add I2S port etc.
- fully separate codec I/O port handling, enabling the use of a single
function each for all codecs (playback, capture, I2S out)
- add a new separate pcm for I2S out port (UNTESTED, no I2S DAC
available yet)
- switch gameport to low frequency while idle, to try to reduce noise/power
- improve snd_azf3328_codec_setdmaa() calculation
- minor variable type cleanup (u16, bool etc.)
- add some doc updates (help those lost Windows users, debug help, ...)
Note that due to the large cleanup aspect of the codec I/O change,
I was able to fit everything including all improvements into the
same binary size!! (a measly 10 bytes more or so)
This should now be the almost last patch to this driver
(minus some possible kernel clocksource patch and x86_64 fixes or so).
I just felt like taking a break from the usual stuff and wanted to
get this driver's structure finished, and it's rather clean now...
Tested, working and checkpatch.pl:ed on 2.6.30-rc5,
applies cleanly to 2.6.30 proper.
Signed-off-by: Andreas Mohr <andi@lisas.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2009-07-05 18:55:46 +07:00
|
|
|
/* start transfer again */
|
2005-04-17 05:20:36 +07:00
|
|
|
/* FIXME: what is this value (0x0010)??? */
|
ALSA: azt3328: large codec cleanup, add I2S port etc.
- fully separate codec I/O port handling, enabling the use of a single
function each for all codecs (playback, capture, I2S out)
- add a new separate pcm for I2S out port (UNTESTED, no I2S DAC
available yet)
- switch gameport to low frequency while idle, to try to reduce noise/power
- improve snd_azf3328_codec_setdmaa() calculation
- minor variable type cleanup (u16, bool etc.)
- add some doc updates (help those lost Windows users, debug help, ...)
Note that due to the large cleanup aspect of the codec I/O change,
I was able to fit everything including all improvements into the
same binary size!! (a measly 10 bytes more or so)
This should now be the almost last patch to this driver
(minus some possible kernel clocksource patch and x86_64 fixes or so).
I just felt like taking a break from the usual stuff and wanted to
get this driver's structure finished, and it's rather clean now...
Tested, working and checkpatch.pl:ed on 2.6.30-rc5,
applies cleanly to 2.6.30 proper.
Signed-off-by: Andreas Mohr <andi@lisas.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2009-07-05 18:55:46 +07:00
|
|
|
flags1 |= DMA_RESUME | DMA_EPILOGUE_SOMETHING;
|
|
|
|
snd_azf3328_codec_outw(codec, IDX_IO_CODEC_DMA_FLAGS, flags1);
|
2005-04-17 05:20:36 +07:00
|
|
|
#else /* NT4 */
|
ALSA: azt3328: large codec cleanup, add I2S port etc.
- fully separate codec I/O port handling, enabling the use of a single
function each for all codecs (playback, capture, I2S out)
- add a new separate pcm for I2S out port (UNTESTED, no I2S DAC
available yet)
- switch gameport to low frequency while idle, to try to reduce noise/power
- improve snd_azf3328_codec_setdmaa() calculation
- minor variable type cleanup (u16, bool etc.)
- add some doc updates (help those lost Windows users, debug help, ...)
Note that due to the large cleanup aspect of the codec I/O change,
I was able to fit everything including all improvements into the
same binary size!! (a measly 10 bytes more or so)
This should now be the almost last patch to this driver
(minus some possible kernel clocksource patch and x86_64 fixes or so).
I just felt like taking a break from the usual stuff and wanted to
get this driver's structure finished, and it's rather clean now...
Tested, working and checkpatch.pl:ed on 2.6.30-rc5,
applies cleanly to 2.6.30 proper.
Signed-off-by: Andreas Mohr <andi@lisas.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2009-07-05 18:55:46 +07:00
|
|
|
snd_azf3328_codec_outw(codec, IDX_IO_CODEC_DMA_FLAGS,
|
2005-10-25 16:17:45 +07:00
|
|
|
0x0000);
|
ALSA: azt3328: large codec cleanup, add I2S port etc.
- fully separate codec I/O port handling, enabling the use of a single
function each for all codecs (playback, capture, I2S out)
- add a new separate pcm for I2S out port (UNTESTED, no I2S DAC
available yet)
- switch gameport to low frequency while idle, to try to reduce noise/power
- improve snd_azf3328_codec_setdmaa() calculation
- minor variable type cleanup (u16, bool etc.)
- add some doc updates (help those lost Windows users, debug help, ...)
Note that due to the large cleanup aspect of the codec I/O change,
I was able to fit everything including all improvements into the
same binary size!! (a measly 10 bytes more or so)
This should now be the almost last patch to this driver
(minus some possible kernel clocksource patch and x86_64 fixes or so).
I just felt like taking a break from the usual stuff and wanted to
get this driver's structure finished, and it's rather clean now...
Tested, working and checkpatch.pl:ed on 2.6.30-rc5,
applies cleanly to 2.6.30 proper.
Signed-off-by: Andreas Mohr <andi@lisas.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2009-07-05 18:55:46 +07:00
|
|
|
snd_azf3328_codec_outw(codec, IDX_IO_CODEC_DMA_FLAGS,
|
|
|
|
DMA_RUN_SOMETHING1);
|
|
|
|
snd_azf3328_codec_outw(codec, IDX_IO_CODEC_DMA_FLAGS,
|
|
|
|
DMA_RUN_SOMETHING1 |
|
|
|
|
DMA_RUN_SOMETHING2);
|
|
|
|
snd_azf3328_codec_outw(codec, IDX_IO_CODEC_DMA_FLAGS,
|
2005-10-25 16:17:45 +07:00
|
|
|
DMA_RESUME |
|
|
|
|
SOMETHING_ALMOST_ALWAYS_SET |
|
|
|
|
DMA_EPILOGUE_SOMETHING |
|
|
|
|
DMA_SOMETHING_ELSE);
|
2005-04-17 05:20:36 +07:00
|
|
|
#endif
|
2010-12-28 03:17:26 +07:00
|
|
|
spin_unlock(codec->lock);
|
|
|
|
snd_azf3328_ctrl_codec_activity(chip, codec->type, 1);
|
ALSA: azt3328: large codec cleanup, add I2S port etc.
- fully separate codec I/O port handling, enabling the use of a single
function each for all codecs (playback, capture, I2S out)
- add a new separate pcm for I2S out port (UNTESTED, no I2S DAC
available yet)
- switch gameport to low frequency while idle, to try to reduce noise/power
- improve snd_azf3328_codec_setdmaa() calculation
- minor variable type cleanup (u16, bool etc.)
- add some doc updates (help those lost Windows users, debug help, ...)
Note that due to the large cleanup aspect of the codec I/O change,
I was able to fit everything including all improvements into the
same binary size!! (a measly 10 bytes more or so)
This should now be the almost last patch to this driver
(minus some possible kernel clocksource patch and x86_64 fixes or so).
I just felt like taking a break from the usual stuff and wanted to
get this driver's structure finished, and it's rather clean now...
Tested, working and checkpatch.pl:ed on 2.6.30-rc5,
applies cleanly to 2.6.30 proper.
Signed-off-by: Andreas Mohr <andi@lisas.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2009-07-05 18:55:46 +07:00
|
|
|
|
2010-12-28 03:17:26 +07:00
|
|
|
if (is_main_mixer_playback_codec) {
|
ALSA: azt3328: large codec cleanup, add I2S port etc.
- fully separate codec I/O port handling, enabling the use of a single
function each for all codecs (playback, capture, I2S out)
- add a new separate pcm for I2S out port (UNTESTED, no I2S DAC
available yet)
- switch gameport to low frequency while idle, to try to reduce noise/power
- improve snd_azf3328_codec_setdmaa() calculation
- minor variable type cleanup (u16, bool etc.)
- add some doc updates (help those lost Windows users, debug help, ...)
Note that due to the large cleanup aspect of the codec I/O change,
I was able to fit everything including all improvements into the
same binary size!! (a measly 10 bytes more or so)
This should now be the almost last patch to this driver
(minus some possible kernel clocksource patch and x86_64 fixes or so).
I just felt like taking a break from the usual stuff and wanted to
get this driver's structure finished, and it's rather clean now...
Tested, working and checkpatch.pl:ed on 2.6.30-rc5,
applies cleanly to 2.6.30 proper.
Signed-off-by: Andreas Mohr <andi@lisas.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2009-07-05 18:55:46 +07:00
|
|
|
/* now unmute WaveOut */
|
|
|
|
if (!previously_muted)
|
2011-02-19 06:49:32 +07:00
|
|
|
snd_azf3328_mixer_mute_control_pcm(
|
|
|
|
chip, 0
|
ALSA: azt3328: large codec cleanup, add I2S port etc.
- fully separate codec I/O port handling, enabling the use of a single
function each for all codecs (playback, capture, I2S out)
- add a new separate pcm for I2S out port (UNTESTED, no I2S DAC
available yet)
- switch gameport to low frequency while idle, to try to reduce noise/power
- improve snd_azf3328_codec_setdmaa() calculation
- minor variable type cleanup (u16, bool etc.)
- add some doc updates (help those lost Windows users, debug help, ...)
Note that due to the large cleanup aspect of the codec I/O change,
I was able to fit everything including all improvements into the
same binary size!! (a measly 10 bytes more or so)
This should now be the almost last patch to this driver
(minus some possible kernel clocksource patch and x86_64 fixes or so).
I just felt like taking a break from the usual stuff and wanted to
get this driver's structure finished, and it's rather clean now...
Tested, working and checkpatch.pl:ed on 2.6.30-rc5,
applies cleanly to 2.6.30 proper.
Signed-off-by: Andreas Mohr <andi@lisas.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2009-07-05 18:55:46 +07:00
|
|
|
);
|
|
|
|
}
|
2005-04-17 05:20:36 +07:00
|
|
|
|
2014-02-25 20:04:46 +07:00
|
|
|
dev_dbg(chip->card->dev, "PCM STARTED %s\n", codec->name);
|
2005-04-17 05:20:36 +07:00
|
|
|
break;
|
2006-05-17 16:02:24 +07:00
|
|
|
case SNDRV_PCM_TRIGGER_RESUME:
|
2014-02-25 20:04:46 +07:00
|
|
|
dev_dbg(chip->card->dev, "PCM RESUME %s\n", codec->name);
|
ALSA: azt3328: large codec cleanup, add I2S port etc.
- fully separate codec I/O port handling, enabling the use of a single
function each for all codecs (playback, capture, I2S out)
- add a new separate pcm for I2S out port (UNTESTED, no I2S DAC
available yet)
- switch gameport to low frequency while idle, to try to reduce noise/power
- improve snd_azf3328_codec_setdmaa() calculation
- minor variable type cleanup (u16, bool etc.)
- add some doc updates (help those lost Windows users, debug help, ...)
Note that due to the large cleanup aspect of the codec I/O change,
I was able to fit everything including all improvements into the
same binary size!! (a measly 10 bytes more or so)
This should now be the almost last patch to this driver
(minus some possible kernel clocksource patch and x86_64 fixes or so).
I just felt like taking a break from the usual stuff and wanted to
get this driver's structure finished, and it's rather clean now...
Tested, working and checkpatch.pl:ed on 2.6.30-rc5,
applies cleanly to 2.6.30 proper.
Signed-off-by: Andreas Mohr <andi@lisas.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2009-07-05 18:55:46 +07:00
|
|
|
/* resume codec if we were active */
|
2010-12-28 03:17:26 +07:00
|
|
|
spin_lock(codec->lock);
|
ALSA: azt3328: large codec cleanup, add I2S port etc.
- fully separate codec I/O port handling, enabling the use of a single
function each for all codecs (playback, capture, I2S out)
- add a new separate pcm for I2S out port (UNTESTED, no I2S DAC
available yet)
- switch gameport to low frequency while idle, to try to reduce noise/power
- improve snd_azf3328_codec_setdmaa() calculation
- minor variable type cleanup (u16, bool etc.)
- add some doc updates (help those lost Windows users, debug help, ...)
Note that due to the large cleanup aspect of the codec I/O change,
I was able to fit everything including all improvements into the
same binary size!! (a measly 10 bytes more or so)
This should now be the almost last patch to this driver
(minus some possible kernel clocksource patch and x86_64 fixes or so).
I just felt like taking a break from the usual stuff and wanted to
get this driver's structure finished, and it's rather clean now...
Tested, working and checkpatch.pl:ed on 2.6.30-rc5,
applies cleanly to 2.6.30 proper.
Signed-off-by: Andreas Mohr <andi@lisas.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2009-07-05 18:55:46 +07:00
|
|
|
if (codec->running)
|
|
|
|
snd_azf3328_codec_outw(codec, IDX_IO_CODEC_DMA_FLAGS,
|
|
|
|
snd_azf3328_codec_inw(
|
|
|
|
codec, IDX_IO_CODEC_DMA_FLAGS
|
|
|
|
) | DMA_RESUME
|
|
|
|
);
|
2010-12-28 03:17:26 +07:00
|
|
|
spin_unlock(codec->lock);
|
2006-05-17 16:02:24 +07:00
|
|
|
break;
|
2005-10-25 16:17:45 +07:00
|
|
|
case SNDRV_PCM_TRIGGER_STOP:
|
2014-02-25 20:04:46 +07:00
|
|
|
dev_dbg(chip->card->dev, "PCM STOP %s\n", codec->name);
|
ALSA: azt3328: large codec cleanup, add I2S port etc.
- fully separate codec I/O port handling, enabling the use of a single
function each for all codecs (playback, capture, I2S out)
- add a new separate pcm for I2S out port (UNTESTED, no I2S DAC
available yet)
- switch gameport to low frequency while idle, to try to reduce noise/power
- improve snd_azf3328_codec_setdmaa() calculation
- minor variable type cleanup (u16, bool etc.)
- add some doc updates (help those lost Windows users, debug help, ...)
Note that due to the large cleanup aspect of the codec I/O change,
I was able to fit everything including all improvements into the
same binary size!! (a measly 10 bytes more or so)
This should now be the almost last patch to this driver
(minus some possible kernel clocksource patch and x86_64 fixes or so).
I just felt like taking a break from the usual stuff and wanted to
get this driver's structure finished, and it's rather clean now...
Tested, working and checkpatch.pl:ed on 2.6.30-rc5,
applies cleanly to 2.6.30 proper.
Signed-off-by: Andreas Mohr <andi@lisas.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2009-07-05 18:55:46 +07:00
|
|
|
|
2010-12-28 03:17:26 +07:00
|
|
|
if (is_main_mixer_playback_codec) {
|
ALSA: azt3328: large codec cleanup, add I2S port etc.
- fully separate codec I/O port handling, enabling the use of a single
function each for all codecs (playback, capture, I2S out)
- add a new separate pcm for I2S out port (UNTESTED, no I2S DAC
available yet)
- switch gameport to low frequency while idle, to try to reduce noise/power
- improve snd_azf3328_codec_setdmaa() calculation
- minor variable type cleanup (u16, bool etc.)
- add some doc updates (help those lost Windows users, debug help, ...)
Note that due to the large cleanup aspect of the codec I/O change,
I was able to fit everything including all improvements into the
same binary size!! (a measly 10 bytes more or so)
This should now be the almost last patch to this driver
(minus some possible kernel clocksource patch and x86_64 fixes or so).
I just felt like taking a break from the usual stuff and wanted to
get this driver's structure finished, and it's rather clean now...
Tested, working and checkpatch.pl:ed on 2.6.30-rc5,
applies cleanly to 2.6.30 proper.
Signed-off-by: Andreas Mohr <andi@lisas.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2009-07-05 18:55:46 +07:00
|
|
|
/* mute WaveOut (avoid clicking during setup) */
|
|
|
|
previously_muted =
|
2011-02-19 06:49:32 +07:00
|
|
|
snd_azf3328_mixer_mute_control_pcm(
|
|
|
|
chip, 1
|
ALSA: azt3328: large codec cleanup, add I2S port etc.
- fully separate codec I/O port handling, enabling the use of a single
function each for all codecs (playback, capture, I2S out)
- add a new separate pcm for I2S out port (UNTESTED, no I2S DAC
available yet)
- switch gameport to low frequency while idle, to try to reduce noise/power
- improve snd_azf3328_codec_setdmaa() calculation
- minor variable type cleanup (u16, bool etc.)
- add some doc updates (help those lost Windows users, debug help, ...)
Note that due to the large cleanup aspect of the codec I/O change,
I was able to fit everything including all improvements into the
same binary size!! (a measly 10 bytes more or so)
This should now be the almost last patch to this driver
(minus some possible kernel clocksource patch and x86_64 fixes or so).
I just felt like taking a break from the usual stuff and wanted to
get this driver's structure finished, and it's rather clean now...
Tested, working and checkpatch.pl:ed on 2.6.30-rc5,
applies cleanly to 2.6.30 proper.
Signed-off-by: Andreas Mohr <andi@lisas.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2009-07-05 18:55:46 +07:00
|
|
|
);
|
|
|
|
}
|
2005-04-17 05:20:36 +07:00
|
|
|
|
2010-12-28 03:17:26 +07:00
|
|
|
spin_lock(codec->lock);
|
[ALSA] PCI168 snd-azt3328 Linux driver: another huge update
- figured out 'Digital(ly) Enhanced Game Port' functionality,
implemented support for it (eliminating gameport polling overhead)
- removed optional joystick activation, gameport now enabled unconditionally,
since we now support it via the PCI I/O space, not via conflict-prone
legacy I/O (which I was thus able to DISABLE now)!
- fix playback bug (a muted wave output would get unmuted upon start of
playback, of course this is not what we want, thus remember mute state)
- implement partial power management: when idle, lower clock rate and disable
codec (reduced noise!), and disable gameport circuit when unused
- instantiate OPL3 timer, too
- much better implementation of snd_azf3328_mixer_write_volume_gradually()
- slightly optimized interrupt handling
- lots of cleanup
This time, I also found a way to verify proper OPL3 operation
via MIDI file playback (emulation via synth hardware).
Signed-off-by: Andreas Mohr <andi@lisas.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2008-05-16 17:18:29 +07:00
|
|
|
/* first, remember current value: */
|
ALSA: azt3328: large codec cleanup, add I2S port etc.
- fully separate codec I/O port handling, enabling the use of a single
function each for all codecs (playback, capture, I2S out)
- add a new separate pcm for I2S out port (UNTESTED, no I2S DAC
available yet)
- switch gameport to low frequency while idle, to try to reduce noise/power
- improve snd_azf3328_codec_setdmaa() calculation
- minor variable type cleanup (u16, bool etc.)
- add some doc updates (help those lost Windows users, debug help, ...)
Note that due to the large cleanup aspect of the codec I/O change,
I was able to fit everything including all improvements into the
same binary size!! (a measly 10 bytes more or so)
This should now be the almost last patch to this driver
(minus some possible kernel clocksource patch and x86_64 fixes or so).
I just felt like taking a break from the usual stuff and wanted to
get this driver's structure finished, and it's rather clean now...
Tested, working and checkpatch.pl:ed on 2.6.30-rc5,
applies cleanly to 2.6.30 proper.
Signed-off-by: Andreas Mohr <andi@lisas.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2009-07-05 18:55:46 +07:00
|
|
|
flags1 = snd_azf3328_codec_inw(codec, IDX_IO_CODEC_DMA_FLAGS);
|
2005-04-17 05:20:36 +07:00
|
|
|
|
ALSA: azt3328: large codec cleanup, add I2S port etc.
- fully separate codec I/O port handling, enabling the use of a single
function each for all codecs (playback, capture, I2S out)
- add a new separate pcm for I2S out port (UNTESTED, no I2S DAC
available yet)
- switch gameport to low frequency while idle, to try to reduce noise/power
- improve snd_azf3328_codec_setdmaa() calculation
- minor variable type cleanup (u16, bool etc.)
- add some doc updates (help those lost Windows users, debug help, ...)
Note that due to the large cleanup aspect of the codec I/O change,
I was able to fit everything including all improvements into the
same binary size!! (a measly 10 bytes more or so)
This should now be the almost last patch to this driver
(minus some possible kernel clocksource patch and x86_64 fixes or so).
I just felt like taking a break from the usual stuff and wanted to
get this driver's structure finished, and it's rather clean now...
Tested, working and checkpatch.pl:ed on 2.6.30-rc5,
applies cleanly to 2.6.30 proper.
Signed-off-by: Andreas Mohr <andi@lisas.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2009-07-05 18:55:46 +07:00
|
|
|
/* stop transfer */
|
|
|
|
flags1 &= ~DMA_RESUME;
|
|
|
|
snd_azf3328_codec_outw(codec, IDX_IO_CODEC_DMA_FLAGS, flags1);
|
2005-04-17 05:20:36 +07:00
|
|
|
|
2005-10-25 16:17:45 +07:00
|
|
|
/* hmm, is this really required? we're resetting the same bit
|
|
|
|
* immediately thereafter... */
|
ALSA: azt3328: large codec cleanup, add I2S port etc.
- fully separate codec I/O port handling, enabling the use of a single
function each for all codecs (playback, capture, I2S out)
- add a new separate pcm for I2S out port (UNTESTED, no I2S DAC
available yet)
- switch gameport to low frequency while idle, to try to reduce noise/power
- improve snd_azf3328_codec_setdmaa() calculation
- minor variable type cleanup (u16, bool etc.)
- add some doc updates (help those lost Windows users, debug help, ...)
Note that due to the large cleanup aspect of the codec I/O change,
I was able to fit everything including all improvements into the
same binary size!! (a measly 10 bytes more or so)
This should now be the almost last patch to this driver
(minus some possible kernel clocksource patch and x86_64 fixes or so).
I just felt like taking a break from the usual stuff and wanted to
get this driver's structure finished, and it's rather clean now...
Tested, working and checkpatch.pl:ed on 2.6.30-rc5,
applies cleanly to 2.6.30 proper.
Signed-off-by: Andreas Mohr <andi@lisas.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2009-07-05 18:55:46 +07:00
|
|
|
flags1 |= DMA_RUN_SOMETHING1;
|
|
|
|
snd_azf3328_codec_outw(codec, IDX_IO_CODEC_DMA_FLAGS, flags1);
|
2005-04-17 05:20:36 +07:00
|
|
|
|
ALSA: azt3328: large codec cleanup, add I2S port etc.
- fully separate codec I/O port handling, enabling the use of a single
function each for all codecs (playback, capture, I2S out)
- add a new separate pcm for I2S out port (UNTESTED, no I2S DAC
available yet)
- switch gameport to low frequency while idle, to try to reduce noise/power
- improve snd_azf3328_codec_setdmaa() calculation
- minor variable type cleanup (u16, bool etc.)
- add some doc updates (help those lost Windows users, debug help, ...)
Note that due to the large cleanup aspect of the codec I/O change,
I was able to fit everything including all improvements into the
same binary size!! (a measly 10 bytes more or so)
This should now be the almost last patch to this driver
(minus some possible kernel clocksource patch and x86_64 fixes or so).
I just felt like taking a break from the usual stuff and wanted to
get this driver's structure finished, and it's rather clean now...
Tested, working and checkpatch.pl:ed on 2.6.30-rc5,
applies cleanly to 2.6.30 proper.
Signed-off-by: Andreas Mohr <andi@lisas.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2009-07-05 18:55:46 +07:00
|
|
|
flags1 &= ~DMA_RUN_SOMETHING1;
|
|
|
|
snd_azf3328_codec_outw(codec, IDX_IO_CODEC_DMA_FLAGS, flags1);
|
2010-12-28 03:17:26 +07:00
|
|
|
spin_unlock(codec->lock);
|
|
|
|
snd_azf3328_ctrl_codec_activity(chip, codec->type, 0);
|
ALSA: azt3328: large codec cleanup, add I2S port etc.
- fully separate codec I/O port handling, enabling the use of a single
function each for all codecs (playback, capture, I2S out)
- add a new separate pcm for I2S out port (UNTESTED, no I2S DAC
available yet)
- switch gameport to low frequency while idle, to try to reduce noise/power
- improve snd_azf3328_codec_setdmaa() calculation
- minor variable type cleanup (u16, bool etc.)
- add some doc updates (help those lost Windows users, debug help, ...)
Note that due to the large cleanup aspect of the codec I/O change,
I was able to fit everything including all improvements into the
same binary size!! (a measly 10 bytes more or so)
This should now be the almost last patch to this driver
(minus some possible kernel clocksource patch and x86_64 fixes or so).
I just felt like taking a break from the usual stuff and wanted to
get this driver's structure finished, and it's rather clean now...
Tested, working and checkpatch.pl:ed on 2.6.30-rc5,
applies cleanly to 2.6.30 proper.
Signed-off-by: Andreas Mohr <andi@lisas.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2009-07-05 18:55:46 +07:00
|
|
|
|
2010-12-28 03:17:26 +07:00
|
|
|
if (is_main_mixer_playback_codec) {
|
ALSA: azt3328: large codec cleanup, add I2S port etc.
- fully separate codec I/O port handling, enabling the use of a single
function each for all codecs (playback, capture, I2S out)
- add a new separate pcm for I2S out port (UNTESTED, no I2S DAC
available yet)
- switch gameport to low frequency while idle, to try to reduce noise/power
- improve snd_azf3328_codec_setdmaa() calculation
- minor variable type cleanup (u16, bool etc.)
- add some doc updates (help those lost Windows users, debug help, ...)
Note that due to the large cleanup aspect of the codec I/O change,
I was able to fit everything including all improvements into the
same binary size!! (a measly 10 bytes more or so)
This should now be the almost last patch to this driver
(minus some possible kernel clocksource patch and x86_64 fixes or so).
I just felt like taking a break from the usual stuff and wanted to
get this driver's structure finished, and it's rather clean now...
Tested, working and checkpatch.pl:ed on 2.6.30-rc5,
applies cleanly to 2.6.30 proper.
Signed-off-by: Andreas Mohr <andi@lisas.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2009-07-05 18:55:46 +07:00
|
|
|
/* now unmute WaveOut */
|
|
|
|
if (!previously_muted)
|
2011-02-19 06:49:32 +07:00
|
|
|
snd_azf3328_mixer_mute_control_pcm(
|
|
|
|
chip, 0
|
ALSA: azt3328: large codec cleanup, add I2S port etc.
- fully separate codec I/O port handling, enabling the use of a single
function each for all codecs (playback, capture, I2S out)
- add a new separate pcm for I2S out port (UNTESTED, no I2S DAC
available yet)
- switch gameport to low frequency while idle, to try to reduce noise/power
- improve snd_azf3328_codec_setdmaa() calculation
- minor variable type cleanup (u16, bool etc.)
- add some doc updates (help those lost Windows users, debug help, ...)
Note that due to the large cleanup aspect of the codec I/O change,
I was able to fit everything including all improvements into the
same binary size!! (a measly 10 bytes more or so)
This should now be the almost last patch to this driver
(minus some possible kernel clocksource patch and x86_64 fixes or so).
I just felt like taking a break from the usual stuff and wanted to
get this driver's structure finished, and it's rather clean now...
Tested, working and checkpatch.pl:ed on 2.6.30-rc5,
applies cleanly to 2.6.30 proper.
Signed-off-by: Andreas Mohr <andi@lisas.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2009-07-05 18:55:46 +07:00
|
|
|
);
|
|
|
|
}
|
[ALSA] PCI168 snd-azt3328 Linux driver: another huge update
- figured out 'Digital(ly) Enhanced Game Port' functionality,
implemented support for it (eliminating gameport polling overhead)
- removed optional joystick activation, gameport now enabled unconditionally,
since we now support it via the PCI I/O space, not via conflict-prone
legacy I/O (which I was thus able to DISABLE now)!
- fix playback bug (a muted wave output would get unmuted upon start of
playback, of course this is not what we want, thus remember mute state)
- implement partial power management: when idle, lower clock rate and disable
codec (reduced noise!), and disable gameport circuit when unused
- instantiate OPL3 timer, too
- much better implementation of snd_azf3328_mixer_write_volume_gradually()
- slightly optimized interrupt handling
- lots of cleanup
This time, I also found a way to verify proper OPL3 operation
via MIDI file playback (emulation via synth hardware).
Signed-off-by: Andreas Mohr <andi@lisas.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2008-05-16 17:18:29 +07:00
|
|
|
|
2014-02-25 20:04:46 +07:00
|
|
|
dev_dbg(chip->card->dev, "PCM STOPPED %s\n", codec->name);
|
2005-04-17 05:20:36 +07:00
|
|
|
break;
|
2006-05-17 16:02:24 +07:00
|
|
|
case SNDRV_PCM_TRIGGER_SUSPEND:
|
2014-02-25 20:04:46 +07:00
|
|
|
dev_dbg(chip->card->dev, "PCM SUSPEND %s\n", codec->name);
|
ALSA: azt3328: large codec cleanup, add I2S port etc.
- fully separate codec I/O port handling, enabling the use of a single
function each for all codecs (playback, capture, I2S out)
- add a new separate pcm for I2S out port (UNTESTED, no I2S DAC
available yet)
- switch gameport to low frequency while idle, to try to reduce noise/power
- improve snd_azf3328_codec_setdmaa() calculation
- minor variable type cleanup (u16, bool etc.)
- add some doc updates (help those lost Windows users, debug help, ...)
Note that due to the large cleanup aspect of the codec I/O change,
I was able to fit everything including all improvements into the
same binary size!! (a measly 10 bytes more or so)
This should now be the almost last patch to this driver
(minus some possible kernel clocksource patch and x86_64 fixes or so).
I just felt like taking a break from the usual stuff and wanted to
get this driver's structure finished, and it's rather clean now...
Tested, working and checkpatch.pl:ed on 2.6.30-rc5,
applies cleanly to 2.6.30 proper.
Signed-off-by: Andreas Mohr <andi@lisas.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2009-07-05 18:55:46 +07:00
|
|
|
/* make sure codec is stopped */
|
|
|
|
snd_azf3328_codec_outw(codec, IDX_IO_CODEC_DMA_FLAGS,
|
|
|
|
snd_azf3328_codec_inw(
|
|
|
|
codec, IDX_IO_CODEC_DMA_FLAGS
|
|
|
|
) & ~DMA_RESUME
|
|
|
|
);
|
2006-05-17 16:02:24 +07:00
|
|
|
break;
|
2005-04-17 05:20:36 +07:00
|
|
|
case SNDRV_PCM_TRIGGER_PAUSE_PUSH:
|
2014-02-25 20:04:46 +07:00
|
|
|
WARN(1, "FIXME: SNDRV_PCM_TRIGGER_PAUSE_PUSH NIY!\n");
|
2005-04-17 05:20:36 +07:00
|
|
|
break;
|
|
|
|
case SNDRV_PCM_TRIGGER_PAUSE_RELEASE:
|
2014-02-25 20:04:46 +07:00
|
|
|
WARN(1, "FIXME: SNDRV_PCM_TRIGGER_PAUSE_RELEASE NIY!\n");
|
2005-04-17 05:20:36 +07:00
|
|
|
break;
|
|
|
|
default:
|
2014-02-25 20:04:46 +07:00
|
|
|
WARN(1, "FIXME: unknown trigger mode!\n");
|
2005-04-17 05:20:36 +07:00
|
|
|
return -EINVAL;
|
|
|
|
}
|
[ALSA] PCI168 snd-azt3328 Linux driver: another huge update
- figured out 'Digital(ly) Enhanced Game Port' functionality,
implemented support for it (eliminating gameport polling overhead)
- removed optional joystick activation, gameport now enabled unconditionally,
since we now support it via the PCI I/O space, not via conflict-prone
legacy I/O (which I was thus able to DISABLE now)!
- fix playback bug (a muted wave output would get unmuted upon start of
playback, of course this is not what we want, thus remember mute state)
- implement partial power management: when idle, lower clock rate and disable
codec (reduced noise!), and disable gameport circuit when unused
- instantiate OPL3 timer, too
- much better implementation of snd_azf3328_mixer_write_volume_gradually()
- slightly optimized interrupt handling
- lots of cleanup
This time, I also found a way to verify proper OPL3 operation
via MIDI file playback (emulation via synth hardware).
Signed-off-by: Andreas Mohr <andi@lisas.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2008-05-16 17:18:29 +07:00
|
|
|
|
2005-04-17 05:20:36 +07:00
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
2005-10-25 16:17:45 +07:00
|
|
|
static snd_pcm_uframes_t
|
2010-12-28 03:17:26 +07:00
|
|
|
snd_azf3328_pcm_pointer(struct snd_pcm_substream *substream
|
ALSA: azt3328: large codec cleanup, add I2S port etc.
- fully separate codec I/O port handling, enabling the use of a single
function each for all codecs (playback, capture, I2S out)
- add a new separate pcm for I2S out port (UNTESTED, no I2S DAC
available yet)
- switch gameport to low frequency while idle, to try to reduce noise/power
- improve snd_azf3328_codec_setdmaa() calculation
- minor variable type cleanup (u16, bool etc.)
- add some doc updates (help those lost Windows users, debug help, ...)
Note that due to the large cleanup aspect of the codec I/O change,
I was able to fit everything including all improvements into the
same binary size!! (a measly 10 bytes more or so)
This should now be the almost last patch to this driver
(minus some possible kernel clocksource patch and x86_64 fixes or so).
I just felt like taking a break from the usual stuff and wanted to
get this driver's structure finished, and it's rather clean now...
Tested, working and checkpatch.pl:ed on 2.6.30-rc5,
applies cleanly to 2.6.30 proper.
Signed-off-by: Andreas Mohr <andi@lisas.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2009-07-05 18:55:46 +07:00
|
|
|
)
|
2005-04-17 05:20:36 +07:00
|
|
|
{
|
2010-12-28 03:17:26 +07:00
|
|
|
const struct snd_azf3328_codec_data *codec =
|
|
|
|
substream->runtime->private_data;
|
2010-12-28 03:17:11 +07:00
|
|
|
unsigned long result;
|
2005-04-17 05:20:36 +07:00
|
|
|
snd_pcm_uframes_t frmres;
|
|
|
|
|
ALSA: azt3328: large codec cleanup, add I2S port etc.
- fully separate codec I/O port handling, enabling the use of a single
function each for all codecs (playback, capture, I2S out)
- add a new separate pcm for I2S out port (UNTESTED, no I2S DAC
available yet)
- switch gameport to low frequency while idle, to try to reduce noise/power
- improve snd_azf3328_codec_setdmaa() calculation
- minor variable type cleanup (u16, bool etc.)
- add some doc updates (help those lost Windows users, debug help, ...)
Note that due to the large cleanup aspect of the codec I/O change,
I was able to fit everything including all improvements into the
same binary size!! (a measly 10 bytes more or so)
This should now be the almost last patch to this driver
(minus some possible kernel clocksource patch and x86_64 fixes or so).
I just felt like taking a break from the usual stuff and wanted to
get this driver's structure finished, and it's rather clean now...
Tested, working and checkpatch.pl:ed on 2.6.30-rc5,
applies cleanly to 2.6.30 proper.
Signed-off-by: Andreas Mohr <andi@lisas.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2009-07-05 18:55:46 +07:00
|
|
|
result = snd_azf3328_codec_inl(codec, IDX_IO_CODEC_DMA_CURRPOS);
|
2005-04-17 05:20:36 +07:00
|
|
|
|
2005-10-25 16:17:45 +07:00
|
|
|
/* calculate offset */
|
2010-12-28 03:17:11 +07:00
|
|
|
#ifdef QUERY_HARDWARE
|
|
|
|
result -= snd_azf3328_codec_inl(codec, IDX_IO_CODEC_DMA_START_1);
|
|
|
|
#else
|
|
|
|
result -= codec->dma_base;
|
|
|
|
#endif
|
2005-10-25 16:17:45 +07:00
|
|
|
frmres = bytes_to_frames( substream->runtime, result);
|
2014-02-25 20:04:46 +07:00
|
|
|
dev_dbg(substream->pcm->card->dev, "%08li %s @ 0x%8lx, frames %8ld\n",
|
|
|
|
jiffies, codec->name, result, frmres);
|
2005-04-17 05:20:36 +07:00
|
|
|
return frmres;
|
|
|
|
}
|
|
|
|
|
[ALSA] PCI168 snd-azt3328 Linux driver: another huge update
- figured out 'Digital(ly) Enhanced Game Port' functionality,
implemented support for it (eliminating gameport polling overhead)
- removed optional joystick activation, gameport now enabled unconditionally,
since we now support it via the PCI I/O space, not via conflict-prone
legacy I/O (which I was thus able to DISABLE now)!
- fix playback bug (a muted wave output would get unmuted upon start of
playback, of course this is not what we want, thus remember mute state)
- implement partial power management: when idle, lower clock rate and disable
codec (reduced noise!), and disable gameport circuit when unused
- instantiate OPL3 timer, too
- much better implementation of snd_azf3328_mixer_write_volume_gradually()
- slightly optimized interrupt handling
- lots of cleanup
This time, I also found a way to verify proper OPL3 operation
via MIDI file playback (emulation via synth hardware).
Signed-off-by: Andreas Mohr <andi@lisas.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2008-05-16 17:18:29 +07:00
|
|
|
/******************************************************************/
|
|
|
|
|
|
|
|
#ifdef SUPPORT_GAMEPORT
|
|
|
|
static inline void
|
ALSA: azt3328: large codec cleanup, add I2S port etc.
- fully separate codec I/O port handling, enabling the use of a single
function each for all codecs (playback, capture, I2S out)
- add a new separate pcm for I2S out port (UNTESTED, no I2S DAC
available yet)
- switch gameport to low frequency while idle, to try to reduce noise/power
- improve snd_azf3328_codec_setdmaa() calculation
- minor variable type cleanup (u16, bool etc.)
- add some doc updates (help those lost Windows users, debug help, ...)
Note that due to the large cleanup aspect of the codec I/O change,
I was able to fit everything including all improvements into the
same binary size!! (a measly 10 bytes more or so)
This should now be the almost last patch to this driver
(minus some possible kernel clocksource patch and x86_64 fixes or so).
I just felt like taking a break from the usual stuff and wanted to
get this driver's structure finished, and it's rather clean now...
Tested, working and checkpatch.pl:ed on 2.6.30-rc5,
applies cleanly to 2.6.30 proper.
Signed-off-by: Andreas Mohr <andi@lisas.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2009-07-05 18:55:46 +07:00
|
|
|
snd_azf3328_gameport_irq_enable(struct snd_azf3328 *chip,
|
|
|
|
bool enable
|
|
|
|
)
|
[ALSA] PCI168 snd-azt3328 Linux driver: another huge update
- figured out 'Digital(ly) Enhanced Game Port' functionality,
implemented support for it (eliminating gameport polling overhead)
- removed optional joystick activation, gameport now enabled unconditionally,
since we now support it via the PCI I/O space, not via conflict-prone
legacy I/O (which I was thus able to DISABLE now)!
- fix playback bug (a muted wave output would get unmuted upon start of
playback, of course this is not what we want, thus remember mute state)
- implement partial power management: when idle, lower clock rate and disable
codec (reduced noise!), and disable gameport circuit when unused
- instantiate OPL3 timer, too
- much better implementation of snd_azf3328_mixer_write_volume_gradually()
- slightly optimized interrupt handling
- lots of cleanup
This time, I also found a way to verify proper OPL3 operation
via MIDI file playback (emulation via synth hardware).
Signed-off-by: Andreas Mohr <andi@lisas.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2008-05-16 17:18:29 +07:00
|
|
|
{
|
|
|
|
snd_azf3328_io_reg_setb(
|
|
|
|
chip->game_io+IDX_GAME_HWCONFIG,
|
|
|
|
GAME_HWCFG_IRQ_ENABLE,
|
|
|
|
enable
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline void
|
ALSA: azt3328: large codec cleanup, add I2S port etc.
- fully separate codec I/O port handling, enabling the use of a single
function each for all codecs (playback, capture, I2S out)
- add a new separate pcm for I2S out port (UNTESTED, no I2S DAC
available yet)
- switch gameport to low frequency while idle, to try to reduce noise/power
- improve snd_azf3328_codec_setdmaa() calculation
- minor variable type cleanup (u16, bool etc.)
- add some doc updates (help those lost Windows users, debug help, ...)
Note that due to the large cleanup aspect of the codec I/O change,
I was able to fit everything including all improvements into the
same binary size!! (a measly 10 bytes more or so)
This should now be the almost last patch to this driver
(minus some possible kernel clocksource patch and x86_64 fixes or so).
I just felt like taking a break from the usual stuff and wanted to
get this driver's structure finished, and it's rather clean now...
Tested, working and checkpatch.pl:ed on 2.6.30-rc5,
applies cleanly to 2.6.30 proper.
Signed-off-by: Andreas Mohr <andi@lisas.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2009-07-05 18:55:46 +07:00
|
|
|
snd_azf3328_gameport_legacy_address_enable(struct snd_azf3328 *chip,
|
|
|
|
bool enable
|
|
|
|
)
|
[ALSA] PCI168 snd-azt3328 Linux driver: another huge update
- figured out 'Digital(ly) Enhanced Game Port' functionality,
implemented support for it (eliminating gameport polling overhead)
- removed optional joystick activation, gameport now enabled unconditionally,
since we now support it via the PCI I/O space, not via conflict-prone
legacy I/O (which I was thus able to DISABLE now)!
- fix playback bug (a muted wave output would get unmuted upon start of
playback, of course this is not what we want, thus remember mute state)
- implement partial power management: when idle, lower clock rate and disable
codec (reduced noise!), and disable gameport circuit when unused
- instantiate OPL3 timer, too
- much better implementation of snd_azf3328_mixer_write_volume_gradually()
- slightly optimized interrupt handling
- lots of cleanup
This time, I also found a way to verify proper OPL3 operation
via MIDI file playback (emulation via synth hardware).
Signed-off-by: Andreas Mohr <andi@lisas.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2008-05-16 17:18:29 +07:00
|
|
|
{
|
|
|
|
snd_azf3328_io_reg_setb(
|
|
|
|
chip->game_io+IDX_GAME_HWCONFIG,
|
|
|
|
GAME_HWCFG_LEGACY_ADDRESS_ENABLE,
|
|
|
|
enable
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
ALSA: azt3328: large codec cleanup, add I2S port etc.
- fully separate codec I/O port handling, enabling the use of a single
function each for all codecs (playback, capture, I2S out)
- add a new separate pcm for I2S out port (UNTESTED, no I2S DAC
available yet)
- switch gameport to low frequency while idle, to try to reduce noise/power
- improve snd_azf3328_codec_setdmaa() calculation
- minor variable type cleanup (u16, bool etc.)
- add some doc updates (help those lost Windows users, debug help, ...)
Note that due to the large cleanup aspect of the codec I/O change,
I was able to fit everything including all improvements into the
same binary size!! (a measly 10 bytes more or so)
This should now be the almost last patch to this driver
(minus some possible kernel clocksource patch and x86_64 fixes or so).
I just felt like taking a break from the usual stuff and wanted to
get this driver's structure finished, and it's rather clean now...
Tested, working and checkpatch.pl:ed on 2.6.30-rc5,
applies cleanly to 2.6.30 proper.
Signed-off-by: Andreas Mohr <andi@lisas.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2009-07-05 18:55:46 +07:00
|
|
|
static void
|
|
|
|
snd_azf3328_gameport_set_counter_frequency(struct snd_azf3328 *chip,
|
|
|
|
unsigned int freq_cfg
|
|
|
|
)
|
|
|
|
{
|
|
|
|
snd_azf3328_io_reg_setb(
|
|
|
|
chip->game_io+IDX_GAME_HWCONFIG,
|
|
|
|
0x02,
|
|
|
|
(freq_cfg & 1) != 0
|
|
|
|
);
|
|
|
|
snd_azf3328_io_reg_setb(
|
|
|
|
chip->game_io+IDX_GAME_HWCONFIG,
|
|
|
|
0x04,
|
|
|
|
(freq_cfg & 2) != 0
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
[ALSA] PCI168 snd-azt3328 Linux driver: another huge update
- figured out 'Digital(ly) Enhanced Game Port' functionality,
implemented support for it (eliminating gameport polling overhead)
- removed optional joystick activation, gameport now enabled unconditionally,
since we now support it via the PCI I/O space, not via conflict-prone
legacy I/O (which I was thus able to DISABLE now)!
- fix playback bug (a muted wave output would get unmuted upon start of
playback, of course this is not what we want, thus remember mute state)
- implement partial power management: when idle, lower clock rate and disable
codec (reduced noise!), and disable gameport circuit when unused
- instantiate OPL3 timer, too
- much better implementation of snd_azf3328_mixer_write_volume_gradually()
- slightly optimized interrupt handling
- lots of cleanup
This time, I also found a way to verify proper OPL3 operation
via MIDI file playback (emulation via synth hardware).
Signed-off-by: Andreas Mohr <andi@lisas.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2008-05-16 17:18:29 +07:00
|
|
|
static inline void
|
ALSA: azt3328: large codec cleanup, add I2S port etc.
- fully separate codec I/O port handling, enabling the use of a single
function each for all codecs (playback, capture, I2S out)
- add a new separate pcm for I2S out port (UNTESTED, no I2S DAC
available yet)
- switch gameport to low frequency while idle, to try to reduce noise/power
- improve snd_azf3328_codec_setdmaa() calculation
- minor variable type cleanup (u16, bool etc.)
- add some doc updates (help those lost Windows users, debug help, ...)
Note that due to the large cleanup aspect of the codec I/O change,
I was able to fit everything including all improvements into the
same binary size!! (a measly 10 bytes more or so)
This should now be the almost last patch to this driver
(minus some possible kernel clocksource patch and x86_64 fixes or so).
I just felt like taking a break from the usual stuff and wanted to
get this driver's structure finished, and it's rather clean now...
Tested, working and checkpatch.pl:ed on 2.6.30-rc5,
applies cleanly to 2.6.30 proper.
Signed-off-by: Andreas Mohr <andi@lisas.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2009-07-05 18:55:46 +07:00
|
|
|
snd_azf3328_gameport_axis_circuit_enable(struct snd_azf3328 *chip, bool enable)
|
[ALSA] PCI168 snd-azt3328 Linux driver: another huge update
- figured out 'Digital(ly) Enhanced Game Port' functionality,
implemented support for it (eliminating gameport polling overhead)
- removed optional joystick activation, gameport now enabled unconditionally,
since we now support it via the PCI I/O space, not via conflict-prone
legacy I/O (which I was thus able to DISABLE now)!
- fix playback bug (a muted wave output would get unmuted upon start of
playback, of course this is not what we want, thus remember mute state)
- implement partial power management: when idle, lower clock rate and disable
codec (reduced noise!), and disable gameport circuit when unused
- instantiate OPL3 timer, too
- much better implementation of snd_azf3328_mixer_write_volume_gradually()
- slightly optimized interrupt handling
- lots of cleanup
This time, I also found a way to verify proper OPL3 operation
via MIDI file playback (emulation via synth hardware).
Signed-off-by: Andreas Mohr <andi@lisas.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2008-05-16 17:18:29 +07:00
|
|
|
{
|
ALSA: azt3328: large codec cleanup, add I2S port etc.
- fully separate codec I/O port handling, enabling the use of a single
function each for all codecs (playback, capture, I2S out)
- add a new separate pcm for I2S out port (UNTESTED, no I2S DAC
available yet)
- switch gameport to low frequency while idle, to try to reduce noise/power
- improve snd_azf3328_codec_setdmaa() calculation
- minor variable type cleanup (u16, bool etc.)
- add some doc updates (help those lost Windows users, debug help, ...)
Note that due to the large cleanup aspect of the codec I/O change,
I was able to fit everything including all improvements into the
same binary size!! (a measly 10 bytes more or so)
This should now be the almost last patch to this driver
(minus some possible kernel clocksource patch and x86_64 fixes or so).
I just felt like taking a break from the usual stuff and wanted to
get this driver's structure finished, and it's rather clean now...
Tested, working and checkpatch.pl:ed on 2.6.30-rc5,
applies cleanly to 2.6.30 proper.
Signed-off-by: Andreas Mohr <andi@lisas.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2009-07-05 18:55:46 +07:00
|
|
|
snd_azf3328_ctrl_reg_6AH_update(
|
2008-06-23 16:50:47 +07:00
|
|
|
chip, IO_6A_SOMETHING2_GAMEPORT, enable
|
[ALSA] PCI168 snd-azt3328 Linux driver: another huge update
- figured out 'Digital(ly) Enhanced Game Port' functionality,
implemented support for it (eliminating gameport polling overhead)
- removed optional joystick activation, gameport now enabled unconditionally,
since we now support it via the PCI I/O space, not via conflict-prone
legacy I/O (which I was thus able to DISABLE now)!
- fix playback bug (a muted wave output would get unmuted upon start of
playback, of course this is not what we want, thus remember mute state)
- implement partial power management: when idle, lower clock rate and disable
codec (reduced noise!), and disable gameport circuit when unused
- instantiate OPL3 timer, too
- much better implementation of snd_azf3328_mixer_write_volume_gradually()
- slightly optimized interrupt handling
- lots of cleanup
This time, I also found a way to verify proper OPL3 operation
via MIDI file playback (emulation via synth hardware).
Signed-off-by: Andreas Mohr <andi@lisas.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2008-05-16 17:18:29 +07:00
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline void
|
|
|
|
snd_azf3328_gameport_interrupt(struct snd_azf3328 *chip)
|
|
|
|
{
|
|
|
|
/*
|
|
|
|
* skeleton handler only
|
|
|
|
* (we do not want axis reading in interrupt handler - too much load!)
|
|
|
|
*/
|
2014-02-25 20:04:46 +07:00
|
|
|
dev_dbg(chip->card->dev, "gameport irq\n");
|
[ALSA] PCI168 snd-azt3328 Linux driver: another huge update
- figured out 'Digital(ly) Enhanced Game Port' functionality,
implemented support for it (eliminating gameport polling overhead)
- removed optional joystick activation, gameport now enabled unconditionally,
since we now support it via the PCI I/O space, not via conflict-prone
legacy I/O (which I was thus able to DISABLE now)!
- fix playback bug (a muted wave output would get unmuted upon start of
playback, of course this is not what we want, thus remember mute state)
- implement partial power management: when idle, lower clock rate and disable
codec (reduced noise!), and disable gameport circuit when unused
- instantiate OPL3 timer, too
- much better implementation of snd_azf3328_mixer_write_volume_gradually()
- slightly optimized interrupt handling
- lots of cleanup
This time, I also found a way to verify proper OPL3 operation
via MIDI file playback (emulation via synth hardware).
Signed-off-by: Andreas Mohr <andi@lisas.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2008-05-16 17:18:29 +07:00
|
|
|
|
|
|
|
/* this should ACK the gameport IRQ properly, hopefully. */
|
|
|
|
snd_azf3328_game_inw(chip, IDX_GAME_AXIS_VALUE);
|
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
|
|
|
snd_azf3328_gameport_open(struct gameport *gameport, int mode)
|
|
|
|
{
|
|
|
|
struct snd_azf3328 *chip = gameport_get_port_data(gameport);
|
|
|
|
int res;
|
|
|
|
|
2014-02-25 20:04:46 +07:00
|
|
|
dev_dbg(chip->card->dev, "gameport_open, mode %d\n", mode);
|
[ALSA] PCI168 snd-azt3328 Linux driver: another huge update
- figured out 'Digital(ly) Enhanced Game Port' functionality,
implemented support for it (eliminating gameport polling overhead)
- removed optional joystick activation, gameport now enabled unconditionally,
since we now support it via the PCI I/O space, not via conflict-prone
legacy I/O (which I was thus able to DISABLE now)!
- fix playback bug (a muted wave output would get unmuted upon start of
playback, of course this is not what we want, thus remember mute state)
- implement partial power management: when idle, lower clock rate and disable
codec (reduced noise!), and disable gameport circuit when unused
- instantiate OPL3 timer, too
- much better implementation of snd_azf3328_mixer_write_volume_gradually()
- slightly optimized interrupt handling
- lots of cleanup
This time, I also found a way to verify proper OPL3 operation
via MIDI file playback (emulation via synth hardware).
Signed-off-by: Andreas Mohr <andi@lisas.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2008-05-16 17:18:29 +07:00
|
|
|
switch (mode) {
|
|
|
|
case GAMEPORT_MODE_COOKED:
|
|
|
|
case GAMEPORT_MODE_RAW:
|
|
|
|
res = 0;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
res = -1;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
ALSA: azt3328: large codec cleanup, add I2S port etc.
- fully separate codec I/O port handling, enabling the use of a single
function each for all codecs (playback, capture, I2S out)
- add a new separate pcm for I2S out port (UNTESTED, no I2S DAC
available yet)
- switch gameport to low frequency while idle, to try to reduce noise/power
- improve snd_azf3328_codec_setdmaa() calculation
- minor variable type cleanup (u16, bool etc.)
- add some doc updates (help those lost Windows users, debug help, ...)
Note that due to the large cleanup aspect of the codec I/O change,
I was able to fit everything including all improvements into the
same binary size!! (a measly 10 bytes more or so)
This should now be the almost last patch to this driver
(minus some possible kernel clocksource patch and x86_64 fixes or so).
I just felt like taking a break from the usual stuff and wanted to
get this driver's structure finished, and it's rather clean now...
Tested, working and checkpatch.pl:ed on 2.6.30-rc5,
applies cleanly to 2.6.30 proper.
Signed-off-by: Andreas Mohr <andi@lisas.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2009-07-05 18:55:46 +07:00
|
|
|
snd_azf3328_gameport_set_counter_frequency(chip,
|
|
|
|
GAME_HWCFG_ADC_COUNTER_FREQ_STD);
|
[ALSA] PCI168 snd-azt3328 Linux driver: another huge update
- figured out 'Digital(ly) Enhanced Game Port' functionality,
implemented support for it (eliminating gameport polling overhead)
- removed optional joystick activation, gameport now enabled unconditionally,
since we now support it via the PCI I/O space, not via conflict-prone
legacy I/O (which I was thus able to DISABLE now)!
- fix playback bug (a muted wave output would get unmuted upon start of
playback, of course this is not what we want, thus remember mute state)
- implement partial power management: when idle, lower clock rate and disable
codec (reduced noise!), and disable gameport circuit when unused
- instantiate OPL3 timer, too
- much better implementation of snd_azf3328_mixer_write_volume_gradually()
- slightly optimized interrupt handling
- lots of cleanup
This time, I also found a way to verify proper OPL3 operation
via MIDI file playback (emulation via synth hardware).
Signed-off-by: Andreas Mohr <andi@lisas.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2008-05-16 17:18:29 +07:00
|
|
|
snd_azf3328_gameport_axis_circuit_enable(chip, (res == 0));
|
|
|
|
|
|
|
|
return res;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
snd_azf3328_gameport_close(struct gameport *gameport)
|
|
|
|
{
|
|
|
|
struct snd_azf3328 *chip = gameport_get_port_data(gameport);
|
|
|
|
|
2014-02-25 20:04:46 +07:00
|
|
|
dev_dbg(chip->card->dev, "gameport_close\n");
|
ALSA: azt3328: large codec cleanup, add I2S port etc.
- fully separate codec I/O port handling, enabling the use of a single
function each for all codecs (playback, capture, I2S out)
- add a new separate pcm for I2S out port (UNTESTED, no I2S DAC
available yet)
- switch gameport to low frequency while idle, to try to reduce noise/power
- improve snd_azf3328_codec_setdmaa() calculation
- minor variable type cleanup (u16, bool etc.)
- add some doc updates (help those lost Windows users, debug help, ...)
Note that due to the large cleanup aspect of the codec I/O change,
I was able to fit everything including all improvements into the
same binary size!! (a measly 10 bytes more or so)
This should now be the almost last patch to this driver
(minus some possible kernel clocksource patch and x86_64 fixes or so).
I just felt like taking a break from the usual stuff and wanted to
get this driver's structure finished, and it's rather clean now...
Tested, working and checkpatch.pl:ed on 2.6.30-rc5,
applies cleanly to 2.6.30 proper.
Signed-off-by: Andreas Mohr <andi@lisas.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2009-07-05 18:55:46 +07:00
|
|
|
snd_azf3328_gameport_set_counter_frequency(chip,
|
|
|
|
GAME_HWCFG_ADC_COUNTER_FREQ_1_200);
|
[ALSA] PCI168 snd-azt3328 Linux driver: another huge update
- figured out 'Digital(ly) Enhanced Game Port' functionality,
implemented support for it (eliminating gameport polling overhead)
- removed optional joystick activation, gameport now enabled unconditionally,
since we now support it via the PCI I/O space, not via conflict-prone
legacy I/O (which I was thus able to DISABLE now)!
- fix playback bug (a muted wave output would get unmuted upon start of
playback, of course this is not what we want, thus remember mute state)
- implement partial power management: when idle, lower clock rate and disable
codec (reduced noise!), and disable gameport circuit when unused
- instantiate OPL3 timer, too
- much better implementation of snd_azf3328_mixer_write_volume_gradually()
- slightly optimized interrupt handling
- lots of cleanup
This time, I also found a way to verify proper OPL3 operation
via MIDI file playback (emulation via synth hardware).
Signed-off-by: Andreas Mohr <andi@lisas.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2008-05-16 17:18:29 +07:00
|
|
|
snd_azf3328_gameport_axis_circuit_enable(chip, 0);
|
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
|
|
|
snd_azf3328_gameport_cooked_read(struct gameport *gameport,
|
|
|
|
int *axes,
|
|
|
|
int *buttons
|
|
|
|
)
|
|
|
|
{
|
|
|
|
struct snd_azf3328 *chip = gameport_get_port_data(gameport);
|
|
|
|
int i;
|
|
|
|
u8 val;
|
|
|
|
unsigned long flags;
|
|
|
|
|
2008-08-08 22:12:14 +07:00
|
|
|
if (snd_BUG_ON(!chip))
|
|
|
|
return 0;
|
[ALSA] PCI168 snd-azt3328 Linux driver: another huge update
- figured out 'Digital(ly) Enhanced Game Port' functionality,
implemented support for it (eliminating gameport polling overhead)
- removed optional joystick activation, gameport now enabled unconditionally,
since we now support it via the PCI I/O space, not via conflict-prone
legacy I/O (which I was thus able to DISABLE now)!
- fix playback bug (a muted wave output would get unmuted upon start of
playback, of course this is not what we want, thus remember mute state)
- implement partial power management: when idle, lower clock rate and disable
codec (reduced noise!), and disable gameport circuit when unused
- instantiate OPL3 timer, too
- much better implementation of snd_azf3328_mixer_write_volume_gradually()
- slightly optimized interrupt handling
- lots of cleanup
This time, I also found a way to verify proper OPL3 operation
via MIDI file playback (emulation via synth hardware).
Signed-off-by: Andreas Mohr <andi@lisas.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2008-05-16 17:18:29 +07:00
|
|
|
|
|
|
|
spin_lock_irqsave(&chip->reg_lock, flags);
|
|
|
|
val = snd_azf3328_game_inb(chip, IDX_GAME_LEGACY_COMPATIBLE);
|
|
|
|
*buttons = (~(val) >> 4) & 0xf;
|
|
|
|
|
|
|
|
/* ok, this one is a bit dirty: cooked_read is being polled by a timer,
|
|
|
|
* thus we're atomic and cannot actively wait in here
|
|
|
|
* (which would be useful for us since it probably would be better
|
|
|
|
* to trigger a measurement in here, then wait a short amount of
|
|
|
|
* time until it's finished, then read values of _this_ measurement).
|
|
|
|
*
|
|
|
|
* Thus we simply resort to reading values if they're available already
|
|
|
|
* and trigger the next measurement.
|
|
|
|
*/
|
|
|
|
|
|
|
|
val = snd_azf3328_game_inb(chip, IDX_GAME_AXES_CONFIG);
|
|
|
|
if (val & GAME_AXES_SAMPLING_READY) {
|
ALSA: azt3328: large codec cleanup, add I2S port etc.
- fully separate codec I/O port handling, enabling the use of a single
function each for all codecs (playback, capture, I2S out)
- add a new separate pcm for I2S out port (UNTESTED, no I2S DAC
available yet)
- switch gameport to low frequency while idle, to try to reduce noise/power
- improve snd_azf3328_codec_setdmaa() calculation
- minor variable type cleanup (u16, bool etc.)
- add some doc updates (help those lost Windows users, debug help, ...)
Note that due to the large cleanup aspect of the codec I/O change,
I was able to fit everything including all improvements into the
same binary size!! (a measly 10 bytes more or so)
This should now be the almost last patch to this driver
(minus some possible kernel clocksource patch and x86_64 fixes or so).
I just felt like taking a break from the usual stuff and wanted to
get this driver's structure finished, and it's rather clean now...
Tested, working and checkpatch.pl:ed on 2.6.30-rc5,
applies cleanly to 2.6.30 proper.
Signed-off-by: Andreas Mohr <andi@lisas.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2009-07-05 18:55:46 +07:00
|
|
|
for (i = 0; i < ARRAY_SIZE(chip->axes); ++i) {
|
[ALSA] PCI168 snd-azt3328 Linux driver: another huge update
- figured out 'Digital(ly) Enhanced Game Port' functionality,
implemented support for it (eliminating gameport polling overhead)
- removed optional joystick activation, gameport now enabled unconditionally,
since we now support it via the PCI I/O space, not via conflict-prone
legacy I/O (which I was thus able to DISABLE now)!
- fix playback bug (a muted wave output would get unmuted upon start of
playback, of course this is not what we want, thus remember mute state)
- implement partial power management: when idle, lower clock rate and disable
codec (reduced noise!), and disable gameport circuit when unused
- instantiate OPL3 timer, too
- much better implementation of snd_azf3328_mixer_write_volume_gradually()
- slightly optimized interrupt handling
- lots of cleanup
This time, I also found a way to verify proper OPL3 operation
via MIDI file playback (emulation via synth hardware).
Signed-off-by: Andreas Mohr <andi@lisas.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2008-05-16 17:18:29 +07:00
|
|
|
/* configure the axis to read */
|
|
|
|
val = (i << 4) | 0x0f;
|
|
|
|
snd_azf3328_game_outb(chip, IDX_GAME_AXES_CONFIG, val);
|
|
|
|
|
|
|
|
chip->axes[i] = snd_azf3328_game_inw(
|
|
|
|
chip, IDX_GAME_AXIS_VALUE
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2010-12-28 03:16:43 +07:00
|
|
|
/* trigger next sampling of axes, to be evaluated the next time we
|
[ALSA] PCI168 snd-azt3328 Linux driver: another huge update
- figured out 'Digital(ly) Enhanced Game Port' functionality,
implemented support for it (eliminating gameport polling overhead)
- removed optional joystick activation, gameport now enabled unconditionally,
since we now support it via the PCI I/O space, not via conflict-prone
legacy I/O (which I was thus able to DISABLE now)!
- fix playback bug (a muted wave output would get unmuted upon start of
playback, of course this is not what we want, thus remember mute state)
- implement partial power management: when idle, lower clock rate and disable
codec (reduced noise!), and disable gameport circuit when unused
- instantiate OPL3 timer, too
- much better implementation of snd_azf3328_mixer_write_volume_gradually()
- slightly optimized interrupt handling
- lots of cleanup
This time, I also found a way to verify proper OPL3 operation
via MIDI file playback (emulation via synth hardware).
Signed-off-by: Andreas Mohr <andi@lisas.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2008-05-16 17:18:29 +07:00
|
|
|
* enter this function */
|
|
|
|
|
|
|
|
/* for some very, very strange reason we cannot enable
|
|
|
|
* Measurement Ready monitoring for all axes here,
|
|
|
|
* at least not when only one joystick connected */
|
|
|
|
val = 0x03; /* we're able to monitor axes 1 and 2 only */
|
|
|
|
snd_azf3328_game_outb(chip, IDX_GAME_AXES_CONFIG, val);
|
|
|
|
|
|
|
|
snd_azf3328_game_outw(chip, IDX_GAME_AXIS_VALUE, 0xffff);
|
|
|
|
spin_unlock_irqrestore(&chip->reg_lock, flags);
|
|
|
|
|
ALSA: azt3328: large codec cleanup, add I2S port etc.
- fully separate codec I/O port handling, enabling the use of a single
function each for all codecs (playback, capture, I2S out)
- add a new separate pcm for I2S out port (UNTESTED, no I2S DAC
available yet)
- switch gameport to low frequency while idle, to try to reduce noise/power
- improve snd_azf3328_codec_setdmaa() calculation
- minor variable type cleanup (u16, bool etc.)
- add some doc updates (help those lost Windows users, debug help, ...)
Note that due to the large cleanup aspect of the codec I/O change,
I was able to fit everything including all improvements into the
same binary size!! (a measly 10 bytes more or so)
This should now be the almost last patch to this driver
(minus some possible kernel clocksource patch and x86_64 fixes or so).
I just felt like taking a break from the usual stuff and wanted to
get this driver's structure finished, and it's rather clean now...
Tested, working and checkpatch.pl:ed on 2.6.30-rc5,
applies cleanly to 2.6.30 proper.
Signed-off-by: Andreas Mohr <andi@lisas.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2009-07-05 18:55:46 +07:00
|
|
|
for (i = 0; i < ARRAY_SIZE(chip->axes); i++) {
|
[ALSA] PCI168 snd-azt3328 Linux driver: another huge update
- figured out 'Digital(ly) Enhanced Game Port' functionality,
implemented support for it (eliminating gameport polling overhead)
- removed optional joystick activation, gameport now enabled unconditionally,
since we now support it via the PCI I/O space, not via conflict-prone
legacy I/O (which I was thus able to DISABLE now)!
- fix playback bug (a muted wave output would get unmuted upon start of
playback, of course this is not what we want, thus remember mute state)
- implement partial power management: when idle, lower clock rate and disable
codec (reduced noise!), and disable gameport circuit when unused
- instantiate OPL3 timer, too
- much better implementation of snd_azf3328_mixer_write_volume_gradually()
- slightly optimized interrupt handling
- lots of cleanup
This time, I also found a way to verify proper OPL3 operation
via MIDI file playback (emulation via synth hardware).
Signed-off-by: Andreas Mohr <andi@lisas.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2008-05-16 17:18:29 +07:00
|
|
|
axes[i] = chip->axes[i];
|
|
|
|
if (axes[i] == 0xffff)
|
|
|
|
axes[i] = -1;
|
|
|
|
}
|
|
|
|
|
2014-02-25 20:04:46 +07:00
|
|
|
dev_dbg(chip->card->dev, "cooked_read: axes %d %d %d %d buttons %d\n",
|
|
|
|
axes[0], axes[1], axes[2], axes[3], *buttons);
|
[ALSA] PCI168 snd-azt3328 Linux driver: another huge update
- figured out 'Digital(ly) Enhanced Game Port' functionality,
implemented support for it (eliminating gameport polling overhead)
- removed optional joystick activation, gameport now enabled unconditionally,
since we now support it via the PCI I/O space, not via conflict-prone
legacy I/O (which I was thus able to DISABLE now)!
- fix playback bug (a muted wave output would get unmuted upon start of
playback, of course this is not what we want, thus remember mute state)
- implement partial power management: when idle, lower clock rate and disable
codec (reduced noise!), and disable gameport circuit when unused
- instantiate OPL3 timer, too
- much better implementation of snd_azf3328_mixer_write_volume_gradually()
- slightly optimized interrupt handling
- lots of cleanup
This time, I also found a way to verify proper OPL3 operation
via MIDI file playback (emulation via synth hardware).
Signed-off-by: Andreas Mohr <andi@lisas.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2008-05-16 17:18:29 +07:00
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2012-12-07 00:35:10 +07:00
|
|
|
static int
|
[ALSA] PCI168 snd-azt3328 Linux driver: another huge update
- figured out 'Digital(ly) Enhanced Game Port' functionality,
implemented support for it (eliminating gameport polling overhead)
- removed optional joystick activation, gameport now enabled unconditionally,
since we now support it via the PCI I/O space, not via conflict-prone
legacy I/O (which I was thus able to DISABLE now)!
- fix playback bug (a muted wave output would get unmuted upon start of
playback, of course this is not what we want, thus remember mute state)
- implement partial power management: when idle, lower clock rate and disable
codec (reduced noise!), and disable gameport circuit when unused
- instantiate OPL3 timer, too
- much better implementation of snd_azf3328_mixer_write_volume_gradually()
- slightly optimized interrupt handling
- lots of cleanup
This time, I also found a way to verify proper OPL3 operation
via MIDI file playback (emulation via synth hardware).
Signed-off-by: Andreas Mohr <andi@lisas.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2008-05-16 17:18:29 +07:00
|
|
|
snd_azf3328_gameport(struct snd_azf3328 *chip, int dev)
|
|
|
|
{
|
|
|
|
struct gameport *gp;
|
|
|
|
|
|
|
|
chip->gameport = gp = gameport_allocate_port();
|
|
|
|
if (!gp) {
|
2014-02-25 20:04:46 +07:00
|
|
|
dev_err(chip->card->dev, "cannot alloc memory for gameport\n");
|
[ALSA] PCI168 snd-azt3328 Linux driver: another huge update
- figured out 'Digital(ly) Enhanced Game Port' functionality,
implemented support for it (eliminating gameport polling overhead)
- removed optional joystick activation, gameport now enabled unconditionally,
since we now support it via the PCI I/O space, not via conflict-prone
legacy I/O (which I was thus able to DISABLE now)!
- fix playback bug (a muted wave output would get unmuted upon start of
playback, of course this is not what we want, thus remember mute state)
- implement partial power management: when idle, lower clock rate and disable
codec (reduced noise!), and disable gameport circuit when unused
- instantiate OPL3 timer, too
- much better implementation of snd_azf3328_mixer_write_volume_gradually()
- slightly optimized interrupt handling
- lots of cleanup
This time, I also found a way to verify proper OPL3 operation
via MIDI file playback (emulation via synth hardware).
Signed-off-by: Andreas Mohr <andi@lisas.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2008-05-16 17:18:29 +07:00
|
|
|
return -ENOMEM;
|
|
|
|
}
|
|
|
|
|
|
|
|
gameport_set_name(gp, "AZF3328 Gameport");
|
|
|
|
gameport_set_phys(gp, "pci%s/gameport0", pci_name(chip->pci));
|
|
|
|
gameport_set_dev_parent(gp, &chip->pci->dev);
|
2008-06-23 16:50:47 +07:00
|
|
|
gp->io = chip->game_io;
|
[ALSA] PCI168 snd-azt3328 Linux driver: another huge update
- figured out 'Digital(ly) Enhanced Game Port' functionality,
implemented support for it (eliminating gameport polling overhead)
- removed optional joystick activation, gameport now enabled unconditionally,
since we now support it via the PCI I/O space, not via conflict-prone
legacy I/O (which I was thus able to DISABLE now)!
- fix playback bug (a muted wave output would get unmuted upon start of
playback, of course this is not what we want, thus remember mute state)
- implement partial power management: when idle, lower clock rate and disable
codec (reduced noise!), and disable gameport circuit when unused
- instantiate OPL3 timer, too
- much better implementation of snd_azf3328_mixer_write_volume_gradually()
- slightly optimized interrupt handling
- lots of cleanup
This time, I also found a way to verify proper OPL3 operation
via MIDI file playback (emulation via synth hardware).
Signed-off-by: Andreas Mohr <andi@lisas.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2008-05-16 17:18:29 +07:00
|
|
|
gameport_set_port_data(gp, chip);
|
|
|
|
|
|
|
|
gp->open = snd_azf3328_gameport_open;
|
|
|
|
gp->close = snd_azf3328_gameport_close;
|
|
|
|
gp->fuzz = 16; /* seems ok */
|
|
|
|
gp->cooked_read = snd_azf3328_gameport_cooked_read;
|
|
|
|
|
|
|
|
/* DISABLE legacy address: we don't need it! */
|
|
|
|
snd_azf3328_gameport_legacy_address_enable(chip, 0);
|
|
|
|
|
ALSA: azt3328: large codec cleanup, add I2S port etc.
- fully separate codec I/O port handling, enabling the use of a single
function each for all codecs (playback, capture, I2S out)
- add a new separate pcm for I2S out port (UNTESTED, no I2S DAC
available yet)
- switch gameport to low frequency while idle, to try to reduce noise/power
- improve snd_azf3328_codec_setdmaa() calculation
- minor variable type cleanup (u16, bool etc.)
- add some doc updates (help those lost Windows users, debug help, ...)
Note that due to the large cleanup aspect of the codec I/O change,
I was able to fit everything including all improvements into the
same binary size!! (a measly 10 bytes more or so)
This should now be the almost last patch to this driver
(minus some possible kernel clocksource patch and x86_64 fixes or so).
I just felt like taking a break from the usual stuff and wanted to
get this driver's structure finished, and it's rather clean now...
Tested, working and checkpatch.pl:ed on 2.6.30-rc5,
applies cleanly to 2.6.30 proper.
Signed-off-by: Andreas Mohr <andi@lisas.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2009-07-05 18:55:46 +07:00
|
|
|
snd_azf3328_gameport_set_counter_frequency(chip,
|
|
|
|
GAME_HWCFG_ADC_COUNTER_FREQ_1_200);
|
[ALSA] PCI168 snd-azt3328 Linux driver: another huge update
- figured out 'Digital(ly) Enhanced Game Port' functionality,
implemented support for it (eliminating gameport polling overhead)
- removed optional joystick activation, gameport now enabled unconditionally,
since we now support it via the PCI I/O space, not via conflict-prone
legacy I/O (which I was thus able to DISABLE now)!
- fix playback bug (a muted wave output would get unmuted upon start of
playback, of course this is not what we want, thus remember mute state)
- implement partial power management: when idle, lower clock rate and disable
codec (reduced noise!), and disable gameport circuit when unused
- instantiate OPL3 timer, too
- much better implementation of snd_azf3328_mixer_write_volume_gradually()
- slightly optimized interrupt handling
- lots of cleanup
This time, I also found a way to verify proper OPL3 operation
via MIDI file playback (emulation via synth hardware).
Signed-off-by: Andreas Mohr <andi@lisas.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2008-05-16 17:18:29 +07:00
|
|
|
snd_azf3328_gameport_axis_circuit_enable(chip, 0);
|
|
|
|
|
|
|
|
gameport_register_port(chip->gameport);
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
snd_azf3328_gameport_free(struct snd_azf3328 *chip)
|
|
|
|
{
|
|
|
|
if (chip->gameport) {
|
|
|
|
gameport_unregister_port(chip->gameport);
|
|
|
|
chip->gameport = NULL;
|
|
|
|
}
|
|
|
|
snd_azf3328_gameport_irq_enable(chip, 0);
|
|
|
|
}
|
|
|
|
#else
|
|
|
|
static inline int
|
|
|
|
snd_azf3328_gameport(struct snd_azf3328 *chip, int dev) { return -ENOSYS; }
|
|
|
|
static inline void
|
|
|
|
snd_azf3328_gameport_free(struct snd_azf3328 *chip) { }
|
|
|
|
static inline void
|
|
|
|
snd_azf3328_gameport_interrupt(struct snd_azf3328 *chip)
|
|
|
|
{
|
2014-02-25 20:04:46 +07:00
|
|
|
dev_warn(chip->card->dev, "huh, game port IRQ occurred!?\n");
|
[ALSA] PCI168 snd-azt3328 Linux driver: another huge update
- figured out 'Digital(ly) Enhanced Game Port' functionality,
implemented support for it (eliminating gameport polling overhead)
- removed optional joystick activation, gameport now enabled unconditionally,
since we now support it via the PCI I/O space, not via conflict-prone
legacy I/O (which I was thus able to DISABLE now)!
- fix playback bug (a muted wave output would get unmuted upon start of
playback, of course this is not what we want, thus remember mute state)
- implement partial power management: when idle, lower clock rate and disable
codec (reduced noise!), and disable gameport circuit when unused
- instantiate OPL3 timer, too
- much better implementation of snd_azf3328_mixer_write_volume_gradually()
- slightly optimized interrupt handling
- lots of cleanup
This time, I also found a way to verify proper OPL3 operation
via MIDI file playback (emulation via synth hardware).
Signed-off-by: Andreas Mohr <andi@lisas.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2008-05-16 17:18:29 +07:00
|
|
|
}
|
|
|
|
#endif /* SUPPORT_GAMEPORT */
|
|
|
|
|
|
|
|
/******************************************************************/
|
|
|
|
|
2008-06-23 16:50:47 +07:00
|
|
|
static inline void
|
2014-02-25 20:04:46 +07:00
|
|
|
snd_azf3328_irq_log_unknown_type(struct snd_azf3328 *chip, u8 which)
|
2008-06-23 16:50:47 +07:00
|
|
|
{
|
2014-02-25 20:04:46 +07:00
|
|
|
dev_dbg(chip->card->dev,
|
|
|
|
"unknown IRQ type (%x) occurred, please report!\n",
|
|
|
|
which);
|
2008-06-23 16:50:47 +07:00
|
|
|
}
|
|
|
|
|
ALSA: azt3328: large codec cleanup, add I2S port etc.
- fully separate codec I/O port handling, enabling the use of a single
function each for all codecs (playback, capture, I2S out)
- add a new separate pcm for I2S out port (UNTESTED, no I2S DAC
available yet)
- switch gameport to low frequency while idle, to try to reduce noise/power
- improve snd_azf3328_codec_setdmaa() calculation
- minor variable type cleanup (u16, bool etc.)
- add some doc updates (help those lost Windows users, debug help, ...)
Note that due to the large cleanup aspect of the codec I/O change,
I was able to fit everything including all improvements into the
same binary size!! (a measly 10 bytes more or so)
This should now be the almost last patch to this driver
(minus some possible kernel clocksource patch and x86_64 fixes or so).
I just felt like taking a break from the usual stuff and wanted to
get this driver's structure finished, and it's rather clean now...
Tested, working and checkpatch.pl:ed on 2.6.30-rc5,
applies cleanly to 2.6.30 proper.
Signed-off-by: Andreas Mohr <andi@lisas.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2009-07-05 18:55:46 +07:00
|
|
|
static inline void
|
2014-02-25 20:04:46 +07:00
|
|
|
snd_azf3328_pcm_interrupt(struct snd_azf3328 *chip,
|
|
|
|
const struct snd_azf3328_codec_data *first_codec,
|
2010-12-28 03:17:26 +07:00
|
|
|
u8 status
|
|
|
|
)
|
ALSA: azt3328: large codec cleanup, add I2S port etc.
- fully separate codec I/O port handling, enabling the use of a single
function each for all codecs (playback, capture, I2S out)
- add a new separate pcm for I2S out port (UNTESTED, no I2S DAC
available yet)
- switch gameport to low frequency while idle, to try to reduce noise/power
- improve snd_azf3328_codec_setdmaa() calculation
- minor variable type cleanup (u16, bool etc.)
- add some doc updates (help those lost Windows users, debug help, ...)
Note that due to the large cleanup aspect of the codec I/O change,
I was able to fit everything including all improvements into the
same binary size!! (a measly 10 bytes more or so)
This should now be the almost last patch to this driver
(minus some possible kernel clocksource patch and x86_64 fixes or so).
I just felt like taking a break from the usual stuff and wanted to
get this driver's structure finished, and it's rather clean now...
Tested, working and checkpatch.pl:ed on 2.6.30-rc5,
applies cleanly to 2.6.30 proper.
Signed-off-by: Andreas Mohr <andi@lisas.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2009-07-05 18:55:46 +07:00
|
|
|
{
|
|
|
|
u8 which;
|
|
|
|
enum snd_azf3328_codec_type codec_type;
|
2010-12-28 03:17:26 +07:00
|
|
|
const struct snd_azf3328_codec_data *codec = first_codec;
|
ALSA: azt3328: large codec cleanup, add I2S port etc.
- fully separate codec I/O port handling, enabling the use of a single
function each for all codecs (playback, capture, I2S out)
- add a new separate pcm for I2S out port (UNTESTED, no I2S DAC
available yet)
- switch gameport to low frequency while idle, to try to reduce noise/power
- improve snd_azf3328_codec_setdmaa() calculation
- minor variable type cleanup (u16, bool etc.)
- add some doc updates (help those lost Windows users, debug help, ...)
Note that due to the large cleanup aspect of the codec I/O change,
I was able to fit everything including all improvements into the
same binary size!! (a measly 10 bytes more or so)
This should now be the almost last patch to this driver
(minus some possible kernel clocksource patch and x86_64 fixes or so).
I just felt like taking a break from the usual stuff and wanted to
get this driver's structure finished, and it's rather clean now...
Tested, working and checkpatch.pl:ed on 2.6.30-rc5,
applies cleanly to 2.6.30 proper.
Signed-off-by: Andreas Mohr <andi@lisas.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2009-07-05 18:55:46 +07:00
|
|
|
|
|
|
|
for (codec_type = AZF_CODEC_PLAYBACK;
|
|
|
|
codec_type <= AZF_CODEC_I2S_OUT;
|
2010-12-28 03:17:26 +07:00
|
|
|
++codec_type, ++codec) {
|
ALSA: azt3328: large codec cleanup, add I2S port etc.
- fully separate codec I/O port handling, enabling the use of a single
function each for all codecs (playback, capture, I2S out)
- add a new separate pcm for I2S out port (UNTESTED, no I2S DAC
available yet)
- switch gameport to low frequency while idle, to try to reduce noise/power
- improve snd_azf3328_codec_setdmaa() calculation
- minor variable type cleanup (u16, bool etc.)
- add some doc updates (help those lost Windows users, debug help, ...)
Note that due to the large cleanup aspect of the codec I/O change,
I was able to fit everything including all improvements into the
same binary size!! (a measly 10 bytes more or so)
This should now be the almost last patch to this driver
(minus some possible kernel clocksource patch and x86_64 fixes or so).
I just felt like taking a break from the usual stuff and wanted to
get this driver's structure finished, and it's rather clean now...
Tested, working and checkpatch.pl:ed on 2.6.30-rc5,
applies cleanly to 2.6.30 proper.
Signed-off-by: Andreas Mohr <andi@lisas.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2009-07-05 18:55:46 +07:00
|
|
|
|
|
|
|
/* skip codec if there's no interrupt for it */
|
|
|
|
if (!(status & (1 << codec_type)))
|
|
|
|
continue;
|
|
|
|
|
2010-12-28 03:17:26 +07:00
|
|
|
spin_lock(codec->lock);
|
ALSA: azt3328: large codec cleanup, add I2S port etc.
- fully separate codec I/O port handling, enabling the use of a single
function each for all codecs (playback, capture, I2S out)
- add a new separate pcm for I2S out port (UNTESTED, no I2S DAC
available yet)
- switch gameport to low frequency while idle, to try to reduce noise/power
- improve snd_azf3328_codec_setdmaa() calculation
- minor variable type cleanup (u16, bool etc.)
- add some doc updates (help those lost Windows users, debug help, ...)
Note that due to the large cleanup aspect of the codec I/O change,
I was able to fit everything including all improvements into the
same binary size!! (a measly 10 bytes more or so)
This should now be the almost last patch to this driver
(minus some possible kernel clocksource patch and x86_64 fixes or so).
I just felt like taking a break from the usual stuff and wanted to
get this driver's structure finished, and it's rather clean now...
Tested, working and checkpatch.pl:ed on 2.6.30-rc5,
applies cleanly to 2.6.30 proper.
Signed-off-by: Andreas Mohr <andi@lisas.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2009-07-05 18:55:46 +07:00
|
|
|
which = snd_azf3328_codec_inb(codec, IDX_IO_CODEC_IRQTYPE);
|
|
|
|
/* ack all IRQ types immediately */
|
|
|
|
snd_azf3328_codec_outb(codec, IDX_IO_CODEC_IRQTYPE, which);
|
2010-12-28 03:17:26 +07:00
|
|
|
spin_unlock(codec->lock);
|
ALSA: azt3328: large codec cleanup, add I2S port etc.
- fully separate codec I/O port handling, enabling the use of a single
function each for all codecs (playback, capture, I2S out)
- add a new separate pcm for I2S out port (UNTESTED, no I2S DAC
available yet)
- switch gameport to low frequency while idle, to try to reduce noise/power
- improve snd_azf3328_codec_setdmaa() calculation
- minor variable type cleanup (u16, bool etc.)
- add some doc updates (help those lost Windows users, debug help, ...)
Note that due to the large cleanup aspect of the codec I/O change,
I was able to fit everything including all improvements into the
same binary size!! (a measly 10 bytes more or so)
This should now be the almost last patch to this driver
(minus some possible kernel clocksource patch and x86_64 fixes or so).
I just felt like taking a break from the usual stuff and wanted to
get this driver's structure finished, and it's rather clean now...
Tested, working and checkpatch.pl:ed on 2.6.30-rc5,
applies cleanly to 2.6.30 proper.
Signed-off-by: Andreas Mohr <andi@lisas.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2009-07-05 18:55:46 +07:00
|
|
|
|
2010-12-28 03:17:26 +07:00
|
|
|
if (codec->substream) {
|
2009-07-13 03:17:54 +07:00
|
|
|
snd_pcm_period_elapsed(codec->substream);
|
2014-02-25 20:04:46 +07:00
|
|
|
dev_dbg(chip->card->dev, "%s period done (#%x), @ %x\n",
|
ALSA: azt3328: large codec cleanup, add I2S port etc.
- fully separate codec I/O port handling, enabling the use of a single
function each for all codecs (playback, capture, I2S out)
- add a new separate pcm for I2S out port (UNTESTED, no I2S DAC
available yet)
- switch gameport to low frequency while idle, to try to reduce noise/power
- improve snd_azf3328_codec_setdmaa() calculation
- minor variable type cleanup (u16, bool etc.)
- add some doc updates (help those lost Windows users, debug help, ...)
Note that due to the large cleanup aspect of the codec I/O change,
I was able to fit everything including all improvements into the
same binary size!! (a measly 10 bytes more or so)
This should now be the almost last patch to this driver
(minus some possible kernel clocksource patch and x86_64 fixes or so).
I just felt like taking a break from the usual stuff and wanted to
get this driver's structure finished, and it's rather clean now...
Tested, working and checkpatch.pl:ed on 2.6.30-rc5,
applies cleanly to 2.6.30 proper.
Signed-off-by: Andreas Mohr <andi@lisas.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2009-07-05 18:55:46 +07:00
|
|
|
codec->name,
|
|
|
|
which,
|
|
|
|
snd_azf3328_codec_inl(
|
2014-02-25 20:04:46 +07:00
|
|
|
codec, IDX_IO_CODEC_DMA_CURRPOS));
|
ALSA: azt3328: large codec cleanup, add I2S port etc.
- fully separate codec I/O port handling, enabling the use of a single
function each for all codecs (playback, capture, I2S out)
- add a new separate pcm for I2S out port (UNTESTED, no I2S DAC
available yet)
- switch gameport to low frequency while idle, to try to reduce noise/power
- improve snd_azf3328_codec_setdmaa() calculation
- minor variable type cleanup (u16, bool etc.)
- add some doc updates (help those lost Windows users, debug help, ...)
Note that due to the large cleanup aspect of the codec I/O change,
I was able to fit everything including all improvements into the
same binary size!! (a measly 10 bytes more or so)
This should now be the almost last patch to this driver
(minus some possible kernel clocksource patch and x86_64 fixes or so).
I just felt like taking a break from the usual stuff and wanted to
get this driver's structure finished, and it's rather clean now...
Tested, working and checkpatch.pl:ed on 2.6.30-rc5,
applies cleanly to 2.6.30 proper.
Signed-off-by: Andreas Mohr <andi@lisas.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2009-07-05 18:55:46 +07:00
|
|
|
} else
|
2014-02-25 20:04:46 +07:00
|
|
|
dev_warn(chip->card->dev, "irq handler problem!\n");
|
ALSA: azt3328: large codec cleanup, add I2S port etc.
- fully separate codec I/O port handling, enabling the use of a single
function each for all codecs (playback, capture, I2S out)
- add a new separate pcm for I2S out port (UNTESTED, no I2S DAC
available yet)
- switch gameport to low frequency while idle, to try to reduce noise/power
- improve snd_azf3328_codec_setdmaa() calculation
- minor variable type cleanup (u16, bool etc.)
- add some doc updates (help those lost Windows users, debug help, ...)
Note that due to the large cleanup aspect of the codec I/O change,
I was able to fit everything including all improvements into the
same binary size!! (a measly 10 bytes more or so)
This should now be the almost last patch to this driver
(minus some possible kernel clocksource patch and x86_64 fixes or so).
I just felt like taking a break from the usual stuff and wanted to
get this driver's structure finished, and it's rather clean now...
Tested, working and checkpatch.pl:ed on 2.6.30-rc5,
applies cleanly to 2.6.30 proper.
Signed-off-by: Andreas Mohr <andi@lisas.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2009-07-05 18:55:46 +07:00
|
|
|
if (which & IRQ_SOMETHING)
|
2014-02-25 20:04:46 +07:00
|
|
|
snd_azf3328_irq_log_unknown_type(chip, which);
|
ALSA: azt3328: large codec cleanup, add I2S port etc.
- fully separate codec I/O port handling, enabling the use of a single
function each for all codecs (playback, capture, I2S out)
- add a new separate pcm for I2S out port (UNTESTED, no I2S DAC
available yet)
- switch gameport to low frequency while idle, to try to reduce noise/power
- improve snd_azf3328_codec_setdmaa() calculation
- minor variable type cleanup (u16, bool etc.)
- add some doc updates (help those lost Windows users, debug help, ...)
Note that due to the large cleanup aspect of the codec I/O change,
I was able to fit everything including all improvements into the
same binary size!! (a measly 10 bytes more or so)
This should now be the almost last patch to this driver
(minus some possible kernel clocksource patch and x86_64 fixes or so).
I just felt like taking a break from the usual stuff and wanted to
get this driver's structure finished, and it's rather clean now...
Tested, working and checkpatch.pl:ed on 2.6.30-rc5,
applies cleanly to 2.6.30 proper.
Signed-off-by: Andreas Mohr <andi@lisas.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2009-07-05 18:55:46 +07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2005-10-25 16:17:45 +07:00
|
|
|
static irqreturn_t
|
IRQ: Maintain regs pointer globally rather than passing to IRQ handlers
Maintain a per-CPU global "struct pt_regs *" variable which can be used instead
of passing regs around manually through all ~1800 interrupt handlers in the
Linux kernel.
The regs pointer is used in few places, but it potentially costs both stack
space and code to pass it around. On the FRV arch, removing the regs parameter
from all the genirq function results in a 20% speed up of the IRQ exit path
(ie: from leaving timer_interrupt() to leaving do_IRQ()).
Where appropriate, an arch may override the generic storage facility and do
something different with the variable. On FRV, for instance, the address is
maintained in GR28 at all times inside the kernel as part of general exception
handling.
Having looked over the code, it appears that the parameter may be handed down
through up to twenty or so layers of functions. Consider a USB character
device attached to a USB hub, attached to a USB controller that posts its
interrupts through a cascaded auxiliary interrupt controller. A character
device driver may want to pass regs to the sysrq handler through the input
layer which adds another few layers of parameter passing.
I've build this code with allyesconfig for x86_64 and i386. I've runtested the
main part of the code on FRV and i386, though I can't test most of the drivers.
I've also done partial conversion for powerpc and MIPS - these at least compile
with minimal configurations.
This will affect all archs. Mostly the changes should be relatively easy.
Take do_IRQ(), store the regs pointer at the beginning, saving the old one:
struct pt_regs *old_regs = set_irq_regs(regs);
And put the old one back at the end:
set_irq_regs(old_regs);
Don't pass regs through to generic_handle_irq() or __do_IRQ().
In timer_interrupt(), this sort of change will be necessary:
- update_process_times(user_mode(regs));
- profile_tick(CPU_PROFILING, regs);
+ update_process_times(user_mode(get_irq_regs()));
+ profile_tick(CPU_PROFILING);
I'd like to move update_process_times()'s use of get_irq_regs() into itself,
except that i386, alone of the archs, uses something other than user_mode().
Some notes on the interrupt handling in the drivers:
(*) input_dev() is now gone entirely. The regs pointer is no longer stored in
the input_dev struct.
(*) finish_unlinks() in drivers/usb/host/ohci-q.c needs checking. It does
something different depending on whether it's been supplied with a regs
pointer or not.
(*) Various IRQ handler function pointers have been moved to type
irq_handler_t.
Signed-Off-By: David Howells <dhowells@redhat.com>
(cherry picked from 1b16e7ac850969f38b375e511e3fa2f474a33867 commit)
2006-10-05 20:55:46 +07:00
|
|
|
snd_azf3328_interrupt(int irq, void *dev_id)
|
2005-04-17 05:20:36 +07:00
|
|
|
{
|
2005-11-17 21:02:42 +07:00
|
|
|
struct snd_azf3328 *chip = dev_id;
|
ALSA: azt3328: large codec cleanup, add I2S port etc.
- fully separate codec I/O port handling, enabling the use of a single
function each for all codecs (playback, capture, I2S out)
- add a new separate pcm for I2S out port (UNTESTED, no I2S DAC
available yet)
- switch gameport to low frequency while idle, to try to reduce noise/power
- improve snd_azf3328_codec_setdmaa() calculation
- minor variable type cleanup (u16, bool etc.)
- add some doc updates (help those lost Windows users, debug help, ...)
Note that due to the large cleanup aspect of the codec I/O change,
I was able to fit everything including all improvements into the
same binary size!! (a measly 10 bytes more or so)
This should now be the almost last patch to this driver
(minus some possible kernel clocksource patch and x86_64 fixes or so).
I just felt like taking a break from the usual stuff and wanted to
get this driver's structure finished, and it's rather clean now...
Tested, working and checkpatch.pl:ed on 2.6.30-rc5,
applies cleanly to 2.6.30 proper.
Signed-off-by: Andreas Mohr <andi@lisas.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2009-07-05 18:55:46 +07:00
|
|
|
u8 status;
|
2005-10-25 16:17:45 +07:00
|
|
|
static unsigned long irq_count;
|
2005-04-17 05:20:36 +07:00
|
|
|
|
ALSA: azt3328: large codec cleanup, add I2S port etc.
- fully separate codec I/O port handling, enabling the use of a single
function each for all codecs (playback, capture, I2S out)
- add a new separate pcm for I2S out port (UNTESTED, no I2S DAC
available yet)
- switch gameport to low frequency while idle, to try to reduce noise/power
- improve snd_azf3328_codec_setdmaa() calculation
- minor variable type cleanup (u16, bool etc.)
- add some doc updates (help those lost Windows users, debug help, ...)
Note that due to the large cleanup aspect of the codec I/O change,
I was able to fit everything including all improvements into the
same binary size!! (a measly 10 bytes more or so)
This should now be the almost last patch to this driver
(minus some possible kernel clocksource patch and x86_64 fixes or so).
I just felt like taking a break from the usual stuff and wanted to
get this driver's structure finished, and it's rather clean now...
Tested, working and checkpatch.pl:ed on 2.6.30-rc5,
applies cleanly to 2.6.30 proper.
Signed-off-by: Andreas Mohr <andi@lisas.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2009-07-05 18:55:46 +07:00
|
|
|
status = snd_azf3328_ctrl_inb(chip, IDX_IO_IRQSTATUS);
|
2005-04-17 05:20:36 +07:00
|
|
|
|
|
|
|
/* fast path out, to ease interrupt sharing */
|
[ALSA] PCI168 snd-azt3328 Linux driver: another huge update
- figured out 'Digital(ly) Enhanced Game Port' functionality,
implemented support for it (eliminating gameport polling overhead)
- removed optional joystick activation, gameport now enabled unconditionally,
since we now support it via the PCI I/O space, not via conflict-prone
legacy I/O (which I was thus able to DISABLE now)!
- fix playback bug (a muted wave output would get unmuted upon start of
playback, of course this is not what we want, thus remember mute state)
- implement partial power management: when idle, lower clock rate and disable
codec (reduced noise!), and disable gameport circuit when unused
- instantiate OPL3 timer, too
- much better implementation of snd_azf3328_mixer_write_volume_gradually()
- slightly optimized interrupt handling
- lots of cleanup
This time, I also found a way to verify proper OPL3 operation
via MIDI file playback (emulation via synth hardware).
Signed-off-by: Andreas Mohr <andi@lisas.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2008-05-16 17:18:29 +07:00
|
|
|
if (!(status &
|
ALSA: azt3328: large codec cleanup, add I2S port etc.
- fully separate codec I/O port handling, enabling the use of a single
function each for all codecs (playback, capture, I2S out)
- add a new separate pcm for I2S out port (UNTESTED, no I2S DAC
available yet)
- switch gameport to low frequency while idle, to try to reduce noise/power
- improve snd_azf3328_codec_setdmaa() calculation
- minor variable type cleanup (u16, bool etc.)
- add some doc updates (help those lost Windows users, debug help, ...)
Note that due to the large cleanup aspect of the codec I/O change,
I was able to fit everything including all improvements into the
same binary size!! (a measly 10 bytes more or so)
This should now be the almost last patch to this driver
(minus some possible kernel clocksource patch and x86_64 fixes or so).
I just felt like taking a break from the usual stuff and wanted to
get this driver's structure finished, and it's rather clean now...
Tested, working and checkpatch.pl:ed on 2.6.30-rc5,
applies cleanly to 2.6.30 proper.
Signed-off-by: Andreas Mohr <andi@lisas.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2009-07-05 18:55:46 +07:00
|
|
|
(IRQ_PLAYBACK|IRQ_RECORDING|IRQ_I2S_OUT
|
|
|
|
|IRQ_GAMEPORT|IRQ_MPU401|IRQ_TIMER)
|
[ALSA] PCI168 snd-azt3328 Linux driver: another huge update
- figured out 'Digital(ly) Enhanced Game Port' functionality,
implemented support for it (eliminating gameport polling overhead)
- removed optional joystick activation, gameport now enabled unconditionally,
since we now support it via the PCI I/O space, not via conflict-prone
legacy I/O (which I was thus able to DISABLE now)!
- fix playback bug (a muted wave output would get unmuted upon start of
playback, of course this is not what we want, thus remember mute state)
- implement partial power management: when idle, lower clock rate and disable
codec (reduced noise!), and disable gameport circuit when unused
- instantiate OPL3 timer, too
- much better implementation of snd_azf3328_mixer_write_volume_gradually()
- slightly optimized interrupt handling
- lots of cleanup
This time, I also found a way to verify proper OPL3 operation
via MIDI file playback (emulation via synth hardware).
Signed-off-by: Andreas Mohr <andi@lisas.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2008-05-16 17:18:29 +07:00
|
|
|
))
|
2005-04-17 05:20:36 +07:00
|
|
|
return IRQ_NONE; /* must be interrupt for another device */
|
|
|
|
|
2014-02-25 20:04:46 +07:00
|
|
|
dev_dbg(chip->card->dev,
|
ALSA: azt3328: large codec cleanup, add I2S port etc.
- fully separate codec I/O port handling, enabling the use of a single
function each for all codecs (playback, capture, I2S out)
- add a new separate pcm for I2S out port (UNTESTED, no I2S DAC
available yet)
- switch gameport to low frequency while idle, to try to reduce noise/power
- improve snd_azf3328_codec_setdmaa() calculation
- minor variable type cleanup (u16, bool etc.)
- add some doc updates (help those lost Windows users, debug help, ...)
Note that due to the large cleanup aspect of the codec I/O change,
I was able to fit everything including all improvements into the
same binary size!! (a measly 10 bytes more or so)
This should now be the almost last patch to this driver
(minus some possible kernel clocksource patch and x86_64 fixes or so).
I just felt like taking a break from the usual stuff and wanted to
get this driver's structure finished, and it's rather clean now...
Tested, working and checkpatch.pl:ed on 2.6.30-rc5,
applies cleanly to 2.6.30 proper.
Signed-off-by: Andreas Mohr <andi@lisas.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2009-07-05 18:55:46 +07:00
|
|
|
"irq_count %ld! IDX_IO_IRQSTATUS %04x\n",
|
2008-06-23 16:50:47 +07:00
|
|
|
irq_count++ /* debug-only */,
|
2014-02-25 20:04:46 +07:00
|
|
|
status);
|
[ALSA] PCI168 snd-azt3328 Linux driver: another huge update
- figured out 'Digital(ly) Enhanced Game Port' functionality,
implemented support for it (eliminating gameport polling overhead)
- removed optional joystick activation, gameport now enabled unconditionally,
since we now support it via the PCI I/O space, not via conflict-prone
legacy I/O (which I was thus able to DISABLE now)!
- fix playback bug (a muted wave output would get unmuted upon start of
playback, of course this is not what we want, thus remember mute state)
- implement partial power management: when idle, lower clock rate and disable
codec (reduced noise!), and disable gameport circuit when unused
- instantiate OPL3 timer, too
- much better implementation of snd_azf3328_mixer_write_volume_gradually()
- slightly optimized interrupt handling
- lots of cleanup
This time, I also found a way to verify proper OPL3 operation
via MIDI file playback (emulation via synth hardware).
Signed-off-by: Andreas Mohr <andi@lisas.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2008-05-16 17:18:29 +07:00
|
|
|
|
2006-05-17 16:04:19 +07:00
|
|
|
if (status & IRQ_TIMER) {
|
2014-02-25 20:04:46 +07:00
|
|
|
/* dev_dbg(chip->card->dev, "timer %ld\n",
|
[ALSA] PCI168 snd-azt3328 Linux driver: another huge update
- figured out 'Digital(ly) Enhanced Game Port' functionality,
implemented support for it (eliminating gameport polling overhead)
- removed optional joystick activation, gameport now enabled unconditionally,
since we now support it via the PCI I/O space, not via conflict-prone
legacy I/O (which I was thus able to DISABLE now)!
- fix playback bug (a muted wave output would get unmuted upon start of
playback, of course this is not what we want, thus remember mute state)
- implement partial power management: when idle, lower clock rate and disable
codec (reduced noise!), and disable gameport circuit when unused
- instantiate OPL3 timer, too
- much better implementation of snd_azf3328_mixer_write_volume_gradually()
- slightly optimized interrupt handling
- lots of cleanup
This time, I also found a way to verify proper OPL3 operation
via MIDI file playback (emulation via synth hardware).
Signed-off-by: Andreas Mohr <andi@lisas.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2008-05-16 17:18:29 +07:00
|
|
|
snd_azf3328_codec_inl(chip, IDX_IO_TIMER_VALUE)
|
|
|
|
& TIMER_VALUE_MASK
|
|
|
|
); */
|
2005-10-25 16:17:45 +07:00
|
|
|
if (chip->timer)
|
|
|
|
snd_timer_interrupt(chip->timer, chip->timer->sticks);
|
|
|
|
/* ACK timer */
|
|
|
|
spin_lock(&chip->reg_lock);
|
ALSA: azt3328: large codec cleanup, add I2S port etc.
- fully separate codec I/O port handling, enabling the use of a single
function each for all codecs (playback, capture, I2S out)
- add a new separate pcm for I2S out port (UNTESTED, no I2S DAC
available yet)
- switch gameport to low frequency while idle, to try to reduce noise/power
- improve snd_azf3328_codec_setdmaa() calculation
- minor variable type cleanup (u16, bool etc.)
- add some doc updates (help those lost Windows users, debug help, ...)
Note that due to the large cleanup aspect of the codec I/O change,
I was able to fit everything including all improvements into the
same binary size!! (a measly 10 bytes more or so)
This should now be the almost last patch to this driver
(minus some possible kernel clocksource patch and x86_64 fixes or so).
I just felt like taking a break from the usual stuff and wanted to
get this driver's structure finished, and it's rather clean now...
Tested, working and checkpatch.pl:ed on 2.6.30-rc5,
applies cleanly to 2.6.30 proper.
Signed-off-by: Andreas Mohr <andi@lisas.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2009-07-05 18:55:46 +07:00
|
|
|
snd_azf3328_ctrl_outb(chip, IDX_IO_TIMER_VALUE + 3, 0x07);
|
2005-10-25 16:17:45 +07:00
|
|
|
spin_unlock(&chip->reg_lock);
|
2014-02-25 20:04:46 +07:00
|
|
|
dev_dbg(chip->card->dev, "timer IRQ\n");
|
2005-10-25 16:17:45 +07:00
|
|
|
}
|
|
|
|
|
ALSA: azt3328: large codec cleanup, add I2S port etc.
- fully separate codec I/O port handling, enabling the use of a single
function each for all codecs (playback, capture, I2S out)
- add a new separate pcm for I2S out port (UNTESTED, no I2S DAC
available yet)
- switch gameport to low frequency while idle, to try to reduce noise/power
- improve snd_azf3328_codec_setdmaa() calculation
- minor variable type cleanup (u16, bool etc.)
- add some doc updates (help those lost Windows users, debug help, ...)
Note that due to the large cleanup aspect of the codec I/O change,
I was able to fit everything including all improvements into the
same binary size!! (a measly 10 bytes more or so)
This should now be the almost last patch to this driver
(minus some possible kernel clocksource patch and x86_64 fixes or so).
I just felt like taking a break from the usual stuff and wanted to
get this driver's structure finished, and it's rather clean now...
Tested, working and checkpatch.pl:ed on 2.6.30-rc5,
applies cleanly to 2.6.30 proper.
Signed-off-by: Andreas Mohr <andi@lisas.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2009-07-05 18:55:46 +07:00
|
|
|
if (status & (IRQ_PLAYBACK|IRQ_RECORDING|IRQ_I2S_OUT))
|
2014-02-25 20:04:46 +07:00
|
|
|
snd_azf3328_pcm_interrupt(chip, chip->codecs, status);
|
2005-10-25 16:17:45 +07:00
|
|
|
|
[ALSA] PCI168 snd-azt3328 Linux driver: another huge update
- figured out 'Digital(ly) Enhanced Game Port' functionality,
implemented support for it (eliminating gameport polling overhead)
- removed optional joystick activation, gameport now enabled unconditionally,
since we now support it via the PCI I/O space, not via conflict-prone
legacy I/O (which I was thus able to DISABLE now)!
- fix playback bug (a muted wave output would get unmuted upon start of
playback, of course this is not what we want, thus remember mute state)
- implement partial power management: when idle, lower clock rate and disable
codec (reduced noise!), and disable gameport circuit when unused
- instantiate OPL3 timer, too
- much better implementation of snd_azf3328_mixer_write_volume_gradually()
- slightly optimized interrupt handling
- lots of cleanup
This time, I also found a way to verify proper OPL3 operation
via MIDI file playback (emulation via synth hardware).
Signed-off-by: Andreas Mohr <andi@lisas.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2008-05-16 17:18:29 +07:00
|
|
|
if (status & IRQ_GAMEPORT)
|
|
|
|
snd_azf3328_gameport_interrupt(chip);
|
ALSA: azt3328: large codec cleanup, add I2S port etc.
- fully separate codec I/O port handling, enabling the use of a single
function each for all codecs (playback, capture, I2S out)
- add a new separate pcm for I2S out port (UNTESTED, no I2S DAC
available yet)
- switch gameport to low frequency while idle, to try to reduce noise/power
- improve snd_azf3328_codec_setdmaa() calculation
- minor variable type cleanup (u16, bool etc.)
- add some doc updates (help those lost Windows users, debug help, ...)
Note that due to the large cleanup aspect of the codec I/O change,
I was able to fit everything including all improvements into the
same binary size!! (a measly 10 bytes more or so)
This should now be the almost last patch to this driver
(minus some possible kernel clocksource patch and x86_64 fixes or so).
I just felt like taking a break from the usual stuff and wanted to
get this driver's structure finished, and it's rather clean now...
Tested, working and checkpatch.pl:ed on 2.6.30-rc5,
applies cleanly to 2.6.30 proper.
Signed-off-by: Andreas Mohr <andi@lisas.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2009-07-05 18:55:46 +07:00
|
|
|
|
2005-10-25 16:17:45 +07:00
|
|
|
/* MPU401 has less critical IRQ requirements
|
|
|
|
* than timer and playback/recording, right? */
|
2006-05-17 16:04:19 +07:00
|
|
|
if (status & IRQ_MPU401) {
|
IRQ: Maintain regs pointer globally rather than passing to IRQ handlers
Maintain a per-CPU global "struct pt_regs *" variable which can be used instead
of passing regs around manually through all ~1800 interrupt handlers in the
Linux kernel.
The regs pointer is used in few places, but it potentially costs both stack
space and code to pass it around. On the FRV arch, removing the regs parameter
from all the genirq function results in a 20% speed up of the IRQ exit path
(ie: from leaving timer_interrupt() to leaving do_IRQ()).
Where appropriate, an arch may override the generic storage facility and do
something different with the variable. On FRV, for instance, the address is
maintained in GR28 at all times inside the kernel as part of general exception
handling.
Having looked over the code, it appears that the parameter may be handed down
through up to twenty or so layers of functions. Consider a USB character
device attached to a USB hub, attached to a USB controller that posts its
interrupts through a cascaded auxiliary interrupt controller. A character
device driver may want to pass regs to the sysrq handler through the input
layer which adds another few layers of parameter passing.
I've build this code with allyesconfig for x86_64 and i386. I've runtested the
main part of the code on FRV and i386, though I can't test most of the drivers.
I've also done partial conversion for powerpc and MIPS - these at least compile
with minimal configurations.
This will affect all archs. Mostly the changes should be relatively easy.
Take do_IRQ(), store the regs pointer at the beginning, saving the old one:
struct pt_regs *old_regs = set_irq_regs(regs);
And put the old one back at the end:
set_irq_regs(old_regs);
Don't pass regs through to generic_handle_irq() or __do_IRQ().
In timer_interrupt(), this sort of change will be necessary:
- update_process_times(user_mode(regs));
- profile_tick(CPU_PROFILING, regs);
+ update_process_times(user_mode(get_irq_regs()));
+ profile_tick(CPU_PROFILING);
I'd like to move update_process_times()'s use of get_irq_regs() into itself,
except that i386, alone of the archs, uses something other than user_mode().
Some notes on the interrupt handling in the drivers:
(*) input_dev() is now gone entirely. The regs pointer is no longer stored in
the input_dev struct.
(*) finish_unlinks() in drivers/usb/host/ohci-q.c needs checking. It does
something different depending on whether it's been supplied with a regs
pointer or not.
(*) Various IRQ handler function pointers have been moved to type
irq_handler_t.
Signed-Off-By: David Howells <dhowells@redhat.com>
(cherry picked from 1b16e7ac850969f38b375e511e3fa2f474a33867 commit)
2006-10-05 20:55:46 +07:00
|
|
|
snd_mpu401_uart_interrupt(irq, chip->rmidi->private_data);
|
2005-10-25 16:17:45 +07:00
|
|
|
|
|
|
|
/* hmm, do we have to ack the IRQ here somehow?
|
ALSA: azt3328: large codec cleanup, add I2S port etc.
- fully separate codec I/O port handling, enabling the use of a single
function each for all codecs (playback, capture, I2S out)
- add a new separate pcm for I2S out port (UNTESTED, no I2S DAC
available yet)
- switch gameport to low frequency while idle, to try to reduce noise/power
- improve snd_azf3328_codec_setdmaa() calculation
- minor variable type cleanup (u16, bool etc.)
- add some doc updates (help those lost Windows users, debug help, ...)
Note that due to the large cleanup aspect of the codec I/O change,
I was able to fit everything including all improvements into the
same binary size!! (a measly 10 bytes more or so)
This should now be the almost last patch to this driver
(minus some possible kernel clocksource patch and x86_64 fixes or so).
I just felt like taking a break from the usual stuff and wanted to
get this driver's structure finished, and it's rather clean now...
Tested, working and checkpatch.pl:ed on 2.6.30-rc5,
applies cleanly to 2.6.30 proper.
Signed-off-by: Andreas Mohr <andi@lisas.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2009-07-05 18:55:46 +07:00
|
|
|
* If so, then I don't know how yet... */
|
2014-02-25 20:04:46 +07:00
|
|
|
dev_dbg(chip->card->dev, "MPU401 IRQ\n");
|
2005-10-25 16:17:45 +07:00
|
|
|
}
|
2005-04-17 05:20:36 +07:00
|
|
|
return IRQ_HANDLED;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*****************************************************************/
|
|
|
|
|
ALSA: azt3328: large codec cleanup, add I2S port etc.
- fully separate codec I/O port handling, enabling the use of a single
function each for all codecs (playback, capture, I2S out)
- add a new separate pcm for I2S out port (UNTESTED, no I2S DAC
available yet)
- switch gameport to low frequency while idle, to try to reduce noise/power
- improve snd_azf3328_codec_setdmaa() calculation
- minor variable type cleanup (u16, bool etc.)
- add some doc updates (help those lost Windows users, debug help, ...)
Note that due to the large cleanup aspect of the codec I/O change,
I was able to fit everything including all improvements into the
same binary size!! (a measly 10 bytes more or so)
This should now be the almost last patch to this driver
(minus some possible kernel clocksource patch and x86_64 fixes or so).
I just felt like taking a break from the usual stuff and wanted to
get this driver's structure finished, and it's rather clean now...
Tested, working and checkpatch.pl:ed on 2.6.30-rc5,
applies cleanly to 2.6.30 proper.
Signed-off-by: Andreas Mohr <andi@lisas.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2009-07-05 18:55:46 +07:00
|
|
|
/* as long as we think we have identical snd_pcm_hardware parameters
|
|
|
|
for playback, capture and i2s out, we can use the same physical struct
|
|
|
|
since the struct is simply being copied into a member.
|
|
|
|
*/
|
|
|
|
static const struct snd_pcm_hardware snd_azf3328_hardware =
|
2005-04-17 05:20:36 +07:00
|
|
|
{
|
|
|
|
/* FIXME!! Correct? */
|
2005-10-25 16:17:45 +07:00
|
|
|
.info = SNDRV_PCM_INFO_MMAP |
|
|
|
|
SNDRV_PCM_INFO_INTERLEAVED |
|
|
|
|
SNDRV_PCM_INFO_MMAP_VALID,
|
|
|
|
.formats = SNDRV_PCM_FMTBIT_S8 |
|
|
|
|
SNDRV_PCM_FMTBIT_U8 |
|
|
|
|
SNDRV_PCM_FMTBIT_S16_LE |
|
|
|
|
SNDRV_PCM_FMTBIT_U16_LE,
|
|
|
|
.rates = SNDRV_PCM_RATE_5512 |
|
|
|
|
SNDRV_PCM_RATE_8000_48000 |
|
|
|
|
SNDRV_PCM_RATE_KNOT,
|
[ALSA] PCI168 snd-azt3328 Linux driver: another huge update
- figured out 'Digital(ly) Enhanced Game Port' functionality,
implemented support for it (eliminating gameport polling overhead)
- removed optional joystick activation, gameport now enabled unconditionally,
since we now support it via the PCI I/O space, not via conflict-prone
legacy I/O (which I was thus able to DISABLE now)!
- fix playback bug (a muted wave output would get unmuted upon start of
playback, of course this is not what we want, thus remember mute state)
- implement partial power management: when idle, lower clock rate and disable
codec (reduced noise!), and disable gameport circuit when unused
- instantiate OPL3 timer, too
- much better implementation of snd_azf3328_mixer_write_volume_gradually()
- slightly optimized interrupt handling
- lots of cleanup
This time, I also found a way to verify proper OPL3 operation
via MIDI file playback (emulation via synth hardware).
Signed-off-by: Andreas Mohr <andi@lisas.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2008-05-16 17:18:29 +07:00
|
|
|
.rate_min = AZF_FREQ_4000,
|
|
|
|
.rate_max = AZF_FREQ_66200,
|
2005-04-17 05:20:36 +07:00
|
|
|
.channels_min = 1,
|
|
|
|
.channels_max = 2,
|
2010-11-21 18:09:32 +07:00
|
|
|
.buffer_bytes_max = (64*1024),
|
|
|
|
.period_bytes_min = 1024,
|
|
|
|
.period_bytes_max = (32*1024),
|
|
|
|
/* We simply have two DMA areas (instead of a list of descriptors
|
|
|
|
such as other cards); I believe that this is a fixed hardware
|
|
|
|
attribute and there isn't much driver magic to be done to expand it.
|
|
|
|
Thus indicate that we have at least and at most 2 periods. */
|
|
|
|
.periods_min = 2,
|
|
|
|
.periods_max = 2,
|
2005-04-17 05:20:36 +07:00
|
|
|
/* FIXME: maybe that card actually has a FIFO?
|
|
|
|
* Hmm, it seems newer revisions do have one, but we still don't know
|
|
|
|
* its size... */
|
|
|
|
.fifo_size = 0,
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2017-06-07 19:18:16 +07:00
|
|
|
static const unsigned int snd_azf3328_fixed_rates[] = {
|
[ALSA] PCI168 snd-azt3328 Linux driver: another huge update
- figured out 'Digital(ly) Enhanced Game Port' functionality,
implemented support for it (eliminating gameport polling overhead)
- removed optional joystick activation, gameport now enabled unconditionally,
since we now support it via the PCI I/O space, not via conflict-prone
legacy I/O (which I was thus able to DISABLE now)!
- fix playback bug (a muted wave output would get unmuted upon start of
playback, of course this is not what we want, thus remember mute state)
- implement partial power management: when idle, lower clock rate and disable
codec (reduced noise!), and disable gameport circuit when unused
- instantiate OPL3 timer, too
- much better implementation of snd_azf3328_mixer_write_volume_gradually()
- slightly optimized interrupt handling
- lots of cleanup
This time, I also found a way to verify proper OPL3 operation
via MIDI file playback (emulation via synth hardware).
Signed-off-by: Andreas Mohr <andi@lisas.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2008-05-16 17:18:29 +07:00
|
|
|
AZF_FREQ_4000,
|
|
|
|
AZF_FREQ_4800,
|
|
|
|
AZF_FREQ_5512,
|
|
|
|
AZF_FREQ_6620,
|
|
|
|
AZF_FREQ_8000,
|
|
|
|
AZF_FREQ_9600,
|
|
|
|
AZF_FREQ_11025,
|
|
|
|
AZF_FREQ_13240,
|
|
|
|
AZF_FREQ_16000,
|
|
|
|
AZF_FREQ_22050,
|
|
|
|
AZF_FREQ_32000,
|
|
|
|
AZF_FREQ_44100,
|
|
|
|
AZF_FREQ_48000,
|
|
|
|
AZF_FREQ_66200
|
|
|
|
};
|
|
|
|
|
2017-06-07 19:18:16 +07:00
|
|
|
static const struct snd_pcm_hw_constraint_list snd_azf3328_hw_constraints_rates = {
|
[ALSA] PCI168 snd-azt3328 Linux driver: another huge update
- figured out 'Digital(ly) Enhanced Game Port' functionality,
implemented support for it (eliminating gameport polling overhead)
- removed optional joystick activation, gameport now enabled unconditionally,
since we now support it via the PCI I/O space, not via conflict-prone
legacy I/O (which I was thus able to DISABLE now)!
- fix playback bug (a muted wave output would get unmuted upon start of
playback, of course this is not what we want, thus remember mute state)
- implement partial power management: when idle, lower clock rate and disable
codec (reduced noise!), and disable gameport circuit when unused
- instantiate OPL3 timer, too
- much better implementation of snd_azf3328_mixer_write_volume_gradually()
- slightly optimized interrupt handling
- lots of cleanup
This time, I also found a way to verify proper OPL3 operation
via MIDI file playback (emulation via synth hardware).
Signed-off-by: Andreas Mohr <andi@lisas.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2008-05-16 17:18:29 +07:00
|
|
|
.count = ARRAY_SIZE(snd_azf3328_fixed_rates),
|
2005-04-17 05:20:36 +07:00
|
|
|
.list = snd_azf3328_fixed_rates,
|
|
|
|
.mask = 0,
|
|
|
|
};
|
|
|
|
|
|
|
|
/*****************************************************************/
|
|
|
|
|
2005-10-25 16:17:45 +07:00
|
|
|
static int
|
ALSA: azt3328: large codec cleanup, add I2S port etc.
- fully separate codec I/O port handling, enabling the use of a single
function each for all codecs (playback, capture, I2S out)
- add a new separate pcm for I2S out port (UNTESTED, no I2S DAC
available yet)
- switch gameport to low frequency while idle, to try to reduce noise/power
- improve snd_azf3328_codec_setdmaa() calculation
- minor variable type cleanup (u16, bool etc.)
- add some doc updates (help those lost Windows users, debug help, ...)
Note that due to the large cleanup aspect of the codec I/O change,
I was able to fit everything including all improvements into the
same binary size!! (a measly 10 bytes more or so)
This should now be the almost last patch to this driver
(minus some possible kernel clocksource patch and x86_64 fixes or so).
I just felt like taking a break from the usual stuff and wanted to
get this driver's structure finished, and it's rather clean now...
Tested, working and checkpatch.pl:ed on 2.6.30-rc5,
applies cleanly to 2.6.30 proper.
Signed-off-by: Andreas Mohr <andi@lisas.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2009-07-05 18:55:46 +07:00
|
|
|
snd_azf3328_pcm_open(struct snd_pcm_substream *substream,
|
|
|
|
enum snd_azf3328_codec_type codec_type
|
|
|
|
)
|
2005-04-17 05:20:36 +07:00
|
|
|
{
|
2005-11-17 21:02:42 +07:00
|
|
|
struct snd_azf3328 *chip = snd_pcm_substream_chip(substream);
|
|
|
|
struct snd_pcm_runtime *runtime = substream->runtime;
|
2010-12-28 03:17:26 +07:00
|
|
|
struct snd_azf3328_codec_data *codec = &chip->codecs[codec_type];
|
2005-04-17 05:20:36 +07:00
|
|
|
|
2010-12-28 03:17:26 +07:00
|
|
|
codec->substream = substream;
|
ALSA: azt3328: large codec cleanup, add I2S port etc.
- fully separate codec I/O port handling, enabling the use of a single
function each for all codecs (playback, capture, I2S out)
- add a new separate pcm for I2S out port (UNTESTED, no I2S DAC
available yet)
- switch gameport to low frequency while idle, to try to reduce noise/power
- improve snd_azf3328_codec_setdmaa() calculation
- minor variable type cleanup (u16, bool etc.)
- add some doc updates (help those lost Windows users, debug help, ...)
Note that due to the large cleanup aspect of the codec I/O change,
I was able to fit everything including all improvements into the
same binary size!! (a measly 10 bytes more or so)
This should now be the almost last patch to this driver
(minus some possible kernel clocksource patch and x86_64 fixes or so).
I just felt like taking a break from the usual stuff and wanted to
get this driver's structure finished, and it's rather clean now...
Tested, working and checkpatch.pl:ed on 2.6.30-rc5,
applies cleanly to 2.6.30 proper.
Signed-off-by: Andreas Mohr <andi@lisas.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2009-07-05 18:55:46 +07:00
|
|
|
|
|
|
|
/* same parameters for all our codecs - at least we think so... */
|
|
|
|
runtime->hw = snd_azf3328_hardware;
|
|
|
|
|
2005-04-17 05:20:36 +07:00
|
|
|
snd_pcm_hw_constraint_list(runtime, 0, SNDRV_PCM_HW_PARAM_RATE,
|
|
|
|
&snd_azf3328_hw_constraints_rates);
|
2010-12-28 03:17:26 +07:00
|
|
|
runtime->private_data = codec;
|
2005-04-17 05:20:36 +07:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
ALSA: azt3328: large codec cleanup, add I2S port etc.
- fully separate codec I/O port handling, enabling the use of a single
function each for all codecs (playback, capture, I2S out)
- add a new separate pcm for I2S out port (UNTESTED, no I2S DAC
available yet)
- switch gameport to low frequency while idle, to try to reduce noise/power
- improve snd_azf3328_codec_setdmaa() calculation
- minor variable type cleanup (u16, bool etc.)
- add some doc updates (help those lost Windows users, debug help, ...)
Note that due to the large cleanup aspect of the codec I/O change,
I was able to fit everything including all improvements into the
same binary size!! (a measly 10 bytes more or so)
This should now be the almost last patch to this driver
(minus some possible kernel clocksource patch and x86_64 fixes or so).
I just felt like taking a break from the usual stuff and wanted to
get this driver's structure finished, and it's rather clean now...
Tested, working and checkpatch.pl:ed on 2.6.30-rc5,
applies cleanly to 2.6.30 proper.
Signed-off-by: Andreas Mohr <andi@lisas.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2009-07-05 18:55:46 +07:00
|
|
|
static int
|
2010-12-28 03:17:26 +07:00
|
|
|
snd_azf3328_pcm_playback_open(struct snd_pcm_substream *substream)
|
ALSA: azt3328: large codec cleanup, add I2S port etc.
- fully separate codec I/O port handling, enabling the use of a single
function each for all codecs (playback, capture, I2S out)
- add a new separate pcm for I2S out port (UNTESTED, no I2S DAC
available yet)
- switch gameport to low frequency while idle, to try to reduce noise/power
- improve snd_azf3328_codec_setdmaa() calculation
- minor variable type cleanup (u16, bool etc.)
- add some doc updates (help those lost Windows users, debug help, ...)
Note that due to the large cleanup aspect of the codec I/O change,
I was able to fit everything including all improvements into the
same binary size!! (a measly 10 bytes more or so)
This should now be the almost last patch to this driver
(minus some possible kernel clocksource patch and x86_64 fixes or so).
I just felt like taking a break from the usual stuff and wanted to
get this driver's structure finished, and it's rather clean now...
Tested, working and checkpatch.pl:ed on 2.6.30-rc5,
applies cleanly to 2.6.30 proper.
Signed-off-by: Andreas Mohr <andi@lisas.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2009-07-05 18:55:46 +07:00
|
|
|
{
|
|
|
|
return snd_azf3328_pcm_open(substream, AZF_CODEC_PLAYBACK);
|
|
|
|
}
|
|
|
|
|
2005-10-25 16:17:45 +07:00
|
|
|
static int
|
2010-12-28 03:17:26 +07:00
|
|
|
snd_azf3328_pcm_capture_open(struct snd_pcm_substream *substream)
|
2005-04-17 05:20:36 +07:00
|
|
|
{
|
ALSA: azt3328: large codec cleanup, add I2S port etc.
- fully separate codec I/O port handling, enabling the use of a single
function each for all codecs (playback, capture, I2S out)
- add a new separate pcm for I2S out port (UNTESTED, no I2S DAC
available yet)
- switch gameport to low frequency while idle, to try to reduce noise/power
- improve snd_azf3328_codec_setdmaa() calculation
- minor variable type cleanup (u16, bool etc.)
- add some doc updates (help those lost Windows users, debug help, ...)
Note that due to the large cleanup aspect of the codec I/O change,
I was able to fit everything including all improvements into the
same binary size!! (a measly 10 bytes more or so)
This should now be the almost last patch to this driver
(minus some possible kernel clocksource patch and x86_64 fixes or so).
I just felt like taking a break from the usual stuff and wanted to
get this driver's structure finished, and it's rather clean now...
Tested, working and checkpatch.pl:ed on 2.6.30-rc5,
applies cleanly to 2.6.30 proper.
Signed-off-by: Andreas Mohr <andi@lisas.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2009-07-05 18:55:46 +07:00
|
|
|
return snd_azf3328_pcm_open(substream, AZF_CODEC_CAPTURE);
|
|
|
|
}
|
2005-04-17 05:20:36 +07:00
|
|
|
|
ALSA: azt3328: large codec cleanup, add I2S port etc.
- fully separate codec I/O port handling, enabling the use of a single
function each for all codecs (playback, capture, I2S out)
- add a new separate pcm for I2S out port (UNTESTED, no I2S DAC
available yet)
- switch gameport to low frequency while idle, to try to reduce noise/power
- improve snd_azf3328_codec_setdmaa() calculation
- minor variable type cleanup (u16, bool etc.)
- add some doc updates (help those lost Windows users, debug help, ...)
Note that due to the large cleanup aspect of the codec I/O change,
I was able to fit everything including all improvements into the
same binary size!! (a measly 10 bytes more or so)
This should now be the almost last patch to this driver
(minus some possible kernel clocksource patch and x86_64 fixes or so).
I just felt like taking a break from the usual stuff and wanted to
get this driver's structure finished, and it's rather clean now...
Tested, working and checkpatch.pl:ed on 2.6.30-rc5,
applies cleanly to 2.6.30 proper.
Signed-off-by: Andreas Mohr <andi@lisas.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2009-07-05 18:55:46 +07:00
|
|
|
static int
|
2010-12-28 03:17:26 +07:00
|
|
|
snd_azf3328_pcm_i2s_out_open(struct snd_pcm_substream *substream)
|
ALSA: azt3328: large codec cleanup, add I2S port etc.
- fully separate codec I/O port handling, enabling the use of a single
function each for all codecs (playback, capture, I2S out)
- add a new separate pcm for I2S out port (UNTESTED, no I2S DAC
available yet)
- switch gameport to low frequency while idle, to try to reduce noise/power
- improve snd_azf3328_codec_setdmaa() calculation
- minor variable type cleanup (u16, bool etc.)
- add some doc updates (help those lost Windows users, debug help, ...)
Note that due to the large cleanup aspect of the codec I/O change,
I was able to fit everything including all improvements into the
same binary size!! (a measly 10 bytes more or so)
This should now be the almost last patch to this driver
(minus some possible kernel clocksource patch and x86_64 fixes or so).
I just felt like taking a break from the usual stuff and wanted to
get this driver's structure finished, and it's rather clean now...
Tested, working and checkpatch.pl:ed on 2.6.30-rc5,
applies cleanly to 2.6.30 proper.
Signed-off-by: Andreas Mohr <andi@lisas.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2009-07-05 18:55:46 +07:00
|
|
|
{
|
|
|
|
return snd_azf3328_pcm_open(substream, AZF_CODEC_I2S_OUT);
|
2005-04-17 05:20:36 +07:00
|
|
|
}
|
|
|
|
|
2005-10-25 16:17:45 +07:00
|
|
|
static int
|
2010-12-28 03:17:26 +07:00
|
|
|
snd_azf3328_pcm_close(struct snd_pcm_substream *substream
|
ALSA: azt3328: large codec cleanup, add I2S port etc.
- fully separate codec I/O port handling, enabling the use of a single
function each for all codecs (playback, capture, I2S out)
- add a new separate pcm for I2S out port (UNTESTED, no I2S DAC
available yet)
- switch gameport to low frequency while idle, to try to reduce noise/power
- improve snd_azf3328_codec_setdmaa() calculation
- minor variable type cleanup (u16, bool etc.)
- add some doc updates (help those lost Windows users, debug help, ...)
Note that due to the large cleanup aspect of the codec I/O change,
I was able to fit everything including all improvements into the
same binary size!! (a measly 10 bytes more or so)
This should now be the almost last patch to this driver
(minus some possible kernel clocksource patch and x86_64 fixes or so).
I just felt like taking a break from the usual stuff and wanted to
get this driver's structure finished, and it's rather clean now...
Tested, working and checkpatch.pl:ed on 2.6.30-rc5,
applies cleanly to 2.6.30 proper.
Signed-off-by: Andreas Mohr <andi@lisas.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2009-07-05 18:55:46 +07:00
|
|
|
)
|
2005-04-17 05:20:36 +07:00
|
|
|
{
|
2010-12-28 03:17:26 +07:00
|
|
|
struct snd_azf3328_codec_data *codec =
|
|
|
|
substream->runtime->private_data;
|
2005-04-17 05:20:36 +07:00
|
|
|
|
2010-12-28 03:17:26 +07:00
|
|
|
codec->substream = NULL;
|
2005-04-17 05:20:36 +07:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
/******************************************************************/
|
|
|
|
|
2016-09-02 05:13:10 +07:00
|
|
|
static const struct snd_pcm_ops snd_azf3328_playback_ops = {
|
2010-12-28 03:17:26 +07:00
|
|
|
.open = snd_azf3328_pcm_playback_open,
|
|
|
|
.close = snd_azf3328_pcm_close,
|
|
|
|
.prepare = snd_azf3328_pcm_prepare,
|
|
|
|
.trigger = snd_azf3328_pcm_trigger,
|
|
|
|
.pointer = snd_azf3328_pcm_pointer
|
2005-04-17 05:20:36 +07:00
|
|
|
};
|
|
|
|
|
2016-09-02 05:13:10 +07:00
|
|
|
static const struct snd_pcm_ops snd_azf3328_capture_ops = {
|
2010-12-28 03:17:26 +07:00
|
|
|
.open = snd_azf3328_pcm_capture_open,
|
|
|
|
.close = snd_azf3328_pcm_close,
|
|
|
|
.prepare = snd_azf3328_pcm_prepare,
|
|
|
|
.trigger = snd_azf3328_pcm_trigger,
|
|
|
|
.pointer = snd_azf3328_pcm_pointer
|
ALSA: azt3328: large codec cleanup, add I2S port etc.
- fully separate codec I/O port handling, enabling the use of a single
function each for all codecs (playback, capture, I2S out)
- add a new separate pcm for I2S out port (UNTESTED, no I2S DAC
available yet)
- switch gameport to low frequency while idle, to try to reduce noise/power
- improve snd_azf3328_codec_setdmaa() calculation
- minor variable type cleanup (u16, bool etc.)
- add some doc updates (help those lost Windows users, debug help, ...)
Note that due to the large cleanup aspect of the codec I/O change,
I was able to fit everything including all improvements into the
same binary size!! (a measly 10 bytes more or so)
This should now be the almost last patch to this driver
(minus some possible kernel clocksource patch and x86_64 fixes or so).
I just felt like taking a break from the usual stuff and wanted to
get this driver's structure finished, and it's rather clean now...
Tested, working and checkpatch.pl:ed on 2.6.30-rc5,
applies cleanly to 2.6.30 proper.
Signed-off-by: Andreas Mohr <andi@lisas.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2009-07-05 18:55:46 +07:00
|
|
|
};
|
|
|
|
|
2016-09-02 05:13:10 +07:00
|
|
|
static const struct snd_pcm_ops snd_azf3328_i2s_out_ops = {
|
2010-12-28 03:17:26 +07:00
|
|
|
.open = snd_azf3328_pcm_i2s_out_open,
|
|
|
|
.close = snd_azf3328_pcm_close,
|
|
|
|
.prepare = snd_azf3328_pcm_prepare,
|
|
|
|
.trigger = snd_azf3328_pcm_trigger,
|
|
|
|
.pointer = snd_azf3328_pcm_pointer
|
2005-04-17 05:20:36 +07:00
|
|
|
};
|
|
|
|
|
2012-12-07 00:35:10 +07:00
|
|
|
static int
|
ALSA: azt3328: large codec cleanup, add I2S port etc.
- fully separate codec I/O port handling, enabling the use of a single
function each for all codecs (playback, capture, I2S out)
- add a new separate pcm for I2S out port (UNTESTED, no I2S DAC
available yet)
- switch gameport to low frequency while idle, to try to reduce noise/power
- improve snd_azf3328_codec_setdmaa() calculation
- minor variable type cleanup (u16, bool etc.)
- add some doc updates (help those lost Windows users, debug help, ...)
Note that due to the large cleanup aspect of the codec I/O change,
I was able to fit everything including all improvements into the
same binary size!! (a measly 10 bytes more or so)
This should now be the almost last patch to this driver
(minus some possible kernel clocksource patch and x86_64 fixes or so).
I just felt like taking a break from the usual stuff and wanted to
get this driver's structure finished, and it's rather clean now...
Tested, working and checkpatch.pl:ed on 2.6.30-rc5,
applies cleanly to 2.6.30 proper.
Signed-off-by: Andreas Mohr <andi@lisas.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2009-07-05 18:55:46 +07:00
|
|
|
snd_azf3328_pcm(struct snd_azf3328 *chip)
|
2005-04-17 05:20:36 +07:00
|
|
|
{
|
2015-02-25 20:32:45 +07:00
|
|
|
/* pcm devices */
|
|
|
|
enum { AZF_PCMDEV_STD, AZF_PCMDEV_I2S_OUT, NUM_AZF_PCMDEVS };
|
ALSA: azt3328: large codec cleanup, add I2S port etc.
- fully separate codec I/O port handling, enabling the use of a single
function each for all codecs (playback, capture, I2S out)
- add a new separate pcm for I2S out port (UNTESTED, no I2S DAC
available yet)
- switch gameport to low frequency while idle, to try to reduce noise/power
- improve snd_azf3328_codec_setdmaa() calculation
- minor variable type cleanup (u16, bool etc.)
- add some doc updates (help those lost Windows users, debug help, ...)
Note that due to the large cleanup aspect of the codec I/O change,
I was able to fit everything including all improvements into the
same binary size!! (a measly 10 bytes more or so)
This should now be the almost last patch to this driver
(minus some possible kernel clocksource patch and x86_64 fixes or so).
I just felt like taking a break from the usual stuff and wanted to
get this driver's structure finished, and it's rather clean now...
Tested, working and checkpatch.pl:ed on 2.6.30-rc5,
applies cleanly to 2.6.30 proper.
Signed-off-by: Andreas Mohr <andi@lisas.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2009-07-05 18:55:46 +07:00
|
|
|
|
2005-11-17 21:02:42 +07:00
|
|
|
struct snd_pcm *pcm;
|
2005-04-17 05:20:36 +07:00
|
|
|
int err;
|
|
|
|
|
ALSA: azt3328: large codec cleanup, add I2S port etc.
- fully separate codec I/O port handling, enabling the use of a single
function each for all codecs (playback, capture, I2S out)
- add a new separate pcm for I2S out port (UNTESTED, no I2S DAC
available yet)
- switch gameport to low frequency while idle, to try to reduce noise/power
- improve snd_azf3328_codec_setdmaa() calculation
- minor variable type cleanup (u16, bool etc.)
- add some doc updates (help those lost Windows users, debug help, ...)
Note that due to the large cleanup aspect of the codec I/O change,
I was able to fit everything including all improvements into the
same binary size!! (a measly 10 bytes more or so)
This should now be the almost last patch to this driver
(minus some possible kernel clocksource patch and x86_64 fixes or so).
I just felt like taking a break from the usual stuff and wanted to
get this driver's structure finished, and it's rather clean now...
Tested, working and checkpatch.pl:ed on 2.6.30-rc5,
applies cleanly to 2.6.30 proper.
Signed-off-by: Andreas Mohr <andi@lisas.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2009-07-05 18:55:46 +07:00
|
|
|
err = snd_pcm_new(chip->card, "AZF3328 DSP", AZF_PCMDEV_STD,
|
|
|
|
1, 1, &pcm);
|
|
|
|
if (err < 0)
|
2005-04-17 05:20:36 +07:00
|
|
|
return err;
|
ALSA: azt3328: large codec cleanup, add I2S port etc.
- fully separate codec I/O port handling, enabling the use of a single
function each for all codecs (playback, capture, I2S out)
- add a new separate pcm for I2S out port (UNTESTED, no I2S DAC
available yet)
- switch gameport to low frequency while idle, to try to reduce noise/power
- improve snd_azf3328_codec_setdmaa() calculation
- minor variable type cleanup (u16, bool etc.)
- add some doc updates (help those lost Windows users, debug help, ...)
Note that due to the large cleanup aspect of the codec I/O change,
I was able to fit everything including all improvements into the
same binary size!! (a measly 10 bytes more or so)
This should now be the almost last patch to this driver
(minus some possible kernel clocksource patch and x86_64 fixes or so).
I just felt like taking a break from the usual stuff and wanted to
get this driver's structure finished, and it's rather clean now...
Tested, working and checkpatch.pl:ed on 2.6.30-rc5,
applies cleanly to 2.6.30 proper.
Signed-off-by: Andreas Mohr <andi@lisas.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2009-07-05 18:55:46 +07:00
|
|
|
snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_PLAYBACK,
|
|
|
|
&snd_azf3328_playback_ops);
|
|
|
|
snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_CAPTURE,
|
|
|
|
&snd_azf3328_capture_ops);
|
2005-04-17 05:20:36 +07:00
|
|
|
|
|
|
|
pcm->private_data = chip;
|
|
|
|
pcm->info_flags = 0;
|
|
|
|
strcpy(pcm->name, chip->card->shortname);
|
ALSA: azt3328: large codec cleanup, add I2S port etc.
- fully separate codec I/O port handling, enabling the use of a single
function each for all codecs (playback, capture, I2S out)
- add a new separate pcm for I2S out port (UNTESTED, no I2S DAC
available yet)
- switch gameport to low frequency while idle, to try to reduce noise/power
- improve snd_azf3328_codec_setdmaa() calculation
- minor variable type cleanup (u16, bool etc.)
- add some doc updates (help those lost Windows users, debug help, ...)
Note that due to the large cleanup aspect of the codec I/O change,
I was able to fit everything including all improvements into the
same binary size!! (a measly 10 bytes more or so)
This should now be the almost last patch to this driver
(minus some possible kernel clocksource patch and x86_64 fixes or so).
I just felt like taking a break from the usual stuff and wanted to
get this driver's structure finished, and it's rather clean now...
Tested, working and checkpatch.pl:ed on 2.6.30-rc5,
applies cleanly to 2.6.30 proper.
Signed-off-by: Andreas Mohr <andi@lisas.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2009-07-05 18:55:46 +07:00
|
|
|
/* same pcm object for playback/capture (see snd_pcm_new() above) */
|
|
|
|
chip->pcm[AZF_CODEC_PLAYBACK] = pcm;
|
|
|
|
chip->pcm[AZF_CODEC_CAPTURE] = pcm;
|
2005-04-17 05:20:36 +07:00
|
|
|
|
2019-12-09 16:48:59 +07:00
|
|
|
snd_pcm_set_managed_buffer_all(pcm, SNDRV_DMA_TYPE_DEV, &chip->pci->dev,
|
|
|
|
64*1024, 64*1024);
|
ALSA: azt3328: large codec cleanup, add I2S port etc.
- fully separate codec I/O port handling, enabling the use of a single
function each for all codecs (playback, capture, I2S out)
- add a new separate pcm for I2S out port (UNTESTED, no I2S DAC
available yet)
- switch gameport to low frequency while idle, to try to reduce noise/power
- improve snd_azf3328_codec_setdmaa() calculation
- minor variable type cleanup (u16, bool etc.)
- add some doc updates (help those lost Windows users, debug help, ...)
Note that due to the large cleanup aspect of the codec I/O change,
I was able to fit everything including all improvements into the
same binary size!! (a measly 10 bytes more or so)
This should now be the almost last patch to this driver
(minus some possible kernel clocksource patch and x86_64 fixes or so).
I just felt like taking a break from the usual stuff and wanted to
get this driver's structure finished, and it's rather clean now...
Tested, working and checkpatch.pl:ed on 2.6.30-rc5,
applies cleanly to 2.6.30 proper.
Signed-off-by: Andreas Mohr <andi@lisas.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2009-07-05 18:55:46 +07:00
|
|
|
|
|
|
|
err = snd_pcm_new(chip->card, "AZF3328 I2S OUT", AZF_PCMDEV_I2S_OUT,
|
|
|
|
1, 0, &pcm);
|
|
|
|
if (err < 0)
|
|
|
|
return err;
|
|
|
|
snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_PLAYBACK,
|
|
|
|
&snd_azf3328_i2s_out_ops);
|
|
|
|
|
|
|
|
pcm->private_data = chip;
|
|
|
|
pcm->info_flags = 0;
|
|
|
|
strcpy(pcm->name, chip->card->shortname);
|
|
|
|
chip->pcm[AZF_CODEC_I2S_OUT] = pcm;
|
|
|
|
|
2019-12-09 16:48:59 +07:00
|
|
|
snd_pcm_set_managed_buffer_all(pcm, SNDRV_DMA_TYPE_DEV, &chip->pci->dev,
|
|
|
|
64*1024, 64*1024);
|
2005-04-17 05:20:36 +07:00
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
/******************************************************************/
|
|
|
|
|
[ALSA] PCI168 snd-azt3328 Linux driver: another huge update
- figured out 'Digital(ly) Enhanced Game Port' functionality,
implemented support for it (eliminating gameport polling overhead)
- removed optional joystick activation, gameport now enabled unconditionally,
since we now support it via the PCI I/O space, not via conflict-prone
legacy I/O (which I was thus able to DISABLE now)!
- fix playback bug (a muted wave output would get unmuted upon start of
playback, of course this is not what we want, thus remember mute state)
- implement partial power management: when idle, lower clock rate and disable
codec (reduced noise!), and disable gameport circuit when unused
- instantiate OPL3 timer, too
- much better implementation of snd_azf3328_mixer_write_volume_gradually()
- slightly optimized interrupt handling
- lots of cleanup
This time, I also found a way to verify proper OPL3 operation
via MIDI file playback (emulation via synth hardware).
Signed-off-by: Andreas Mohr <andi@lisas.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2008-05-16 17:18:29 +07:00
|
|
|
/*** NOTE: the physical timer resolution actually is 1024000 ticks per second
|
|
|
|
*** (probably derived from main crystal via a divider of 24),
|
2005-10-25 16:17:45 +07:00
|
|
|
*** but announcing those attributes to user-space would make programs
|
|
|
|
*** configure the timer to a 1 tick value, resulting in an absolutely fatal
|
|
|
|
*** timer IRQ storm.
|
|
|
|
*** Thus I chose to announce a down-scaled virtual timer to the outside and
|
|
|
|
*** calculate real timer countdown values internally.
|
|
|
|
*** (the scale factor can be set via module parameter "seqtimer_scaling").
|
|
|
|
***/
|
|
|
|
|
|
|
|
static int
|
2005-11-17 21:02:42 +07:00
|
|
|
snd_azf3328_timer_start(struct snd_timer *timer)
|
2005-10-25 16:17:45 +07:00
|
|
|
{
|
2005-11-17 21:02:42 +07:00
|
|
|
struct snd_azf3328 *chip;
|
2005-10-25 16:17:45 +07:00
|
|
|
unsigned long flags;
|
|
|
|
unsigned int delay;
|
|
|
|
|
|
|
|
chip = snd_timer_chip(timer);
|
|
|
|
delay = ((timer->sticks * seqtimer_scaling) - 1) & TIMER_VALUE_MASK;
|
2006-05-17 16:04:19 +07:00
|
|
|
if (delay < 49) {
|
2005-10-25 16:17:45 +07:00
|
|
|
/* uhoh, that's not good, since user-space won't know about
|
|
|
|
* this timing tweak
|
|
|
|
* (we need to do it to avoid a lockup, though) */
|
|
|
|
|
2014-02-25 20:04:46 +07:00
|
|
|
dev_dbg(chip->card->dev, "delay was too low (%d)!\n", delay);
|
2005-10-25 16:17:45 +07:00
|
|
|
delay = 49; /* minimum time is 49 ticks */
|
|
|
|
}
|
2014-02-25 20:04:46 +07:00
|
|
|
dev_dbg(chip->card->dev, "setting timer countdown value %d\n", delay);
|
[ALSA] PCI168 snd-azt3328 Linux driver: another huge update
- figured out 'Digital(ly) Enhanced Game Port' functionality,
implemented support for it (eliminating gameport polling overhead)
- removed optional joystick activation, gameport now enabled unconditionally,
since we now support it via the PCI I/O space, not via conflict-prone
legacy I/O (which I was thus able to DISABLE now)!
- fix playback bug (a muted wave output would get unmuted upon start of
playback, of course this is not what we want, thus remember mute state)
- implement partial power management: when idle, lower clock rate and disable
codec (reduced noise!), and disable gameport circuit when unused
- instantiate OPL3 timer, too
- much better implementation of snd_azf3328_mixer_write_volume_gradually()
- slightly optimized interrupt handling
- lots of cleanup
This time, I also found a way to verify proper OPL3 operation
via MIDI file playback (emulation via synth hardware).
Signed-off-by: Andreas Mohr <andi@lisas.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2008-05-16 17:18:29 +07:00
|
|
|
delay |= TIMER_COUNTDOWN_ENABLE | TIMER_IRQ_ENABLE;
|
2005-10-25 16:17:45 +07:00
|
|
|
spin_lock_irqsave(&chip->reg_lock, flags);
|
ALSA: azt3328: large codec cleanup, add I2S port etc.
- fully separate codec I/O port handling, enabling the use of a single
function each for all codecs (playback, capture, I2S out)
- add a new separate pcm for I2S out port (UNTESTED, no I2S DAC
available yet)
- switch gameport to low frequency while idle, to try to reduce noise/power
- improve snd_azf3328_codec_setdmaa() calculation
- minor variable type cleanup (u16, bool etc.)
- add some doc updates (help those lost Windows users, debug help, ...)
Note that due to the large cleanup aspect of the codec I/O change,
I was able to fit everything including all improvements into the
same binary size!! (a measly 10 bytes more or so)
This should now be the almost last patch to this driver
(minus some possible kernel clocksource patch and x86_64 fixes or so).
I just felt like taking a break from the usual stuff and wanted to
get this driver's structure finished, and it's rather clean now...
Tested, working and checkpatch.pl:ed on 2.6.30-rc5,
applies cleanly to 2.6.30 proper.
Signed-off-by: Andreas Mohr <andi@lisas.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2009-07-05 18:55:46 +07:00
|
|
|
snd_azf3328_ctrl_outl(chip, IDX_IO_TIMER_VALUE, delay);
|
2005-10-25 16:17:45 +07:00
|
|
|
spin_unlock_irqrestore(&chip->reg_lock, flags);
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
2005-11-17 21:02:42 +07:00
|
|
|
snd_azf3328_timer_stop(struct snd_timer *timer)
|
2005-10-25 16:17:45 +07:00
|
|
|
{
|
2005-11-17 21:02:42 +07:00
|
|
|
struct snd_azf3328 *chip;
|
2005-10-25 16:17:45 +07:00
|
|
|
unsigned long flags;
|
|
|
|
|
|
|
|
chip = snd_timer_chip(timer);
|
|
|
|
spin_lock_irqsave(&chip->reg_lock, flags);
|
|
|
|
/* disable timer countdown and interrupt */
|
2010-11-21 18:09:32 +07:00
|
|
|
/* Hmm, should we write TIMER_IRQ_ACK here?
|
|
|
|
YES indeed, otherwise a rogue timer operation - which prompts
|
|
|
|
ALSA(?) to call repeated stop() in vain, but NOT start() -
|
|
|
|
will never end (value 0x03 is kept shown in control byte).
|
|
|
|
Simply manually poking 0x04 _once_ immediately successfully stops
|
|
|
|
the hardware/ALSA interrupt activity. */
|
|
|
|
snd_azf3328_ctrl_outb(chip, IDX_IO_TIMER_VALUE + 3, 0x04);
|
2005-10-25 16:17:45 +07:00
|
|
|
spin_unlock_irqrestore(&chip->reg_lock, flags);
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static int
|
2005-11-17 21:02:42 +07:00
|
|
|
snd_azf3328_timer_precise_resolution(struct snd_timer *timer,
|
2005-10-25 16:17:45 +07:00
|
|
|
unsigned long *num, unsigned long *den)
|
|
|
|
{
|
|
|
|
*num = 1;
|
|
|
|
*den = 1024000 / seqtimer_scaling;
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2005-11-17 21:02:42 +07:00
|
|
|
static struct snd_timer_hardware snd_azf3328_timer_hw = {
|
2005-10-25 16:17:45 +07:00
|
|
|
.flags = SNDRV_TIMER_HW_AUTO,
|
|
|
|
.resolution = 977, /* 1000000/1024000 = 0.9765625us */
|
|
|
|
.ticks = 1024000, /* max tick count, defined by the value register; actually it's not 1024000, but 1048576, but we don't care */
|
|
|
|
.start = snd_azf3328_timer_start,
|
|
|
|
.stop = snd_azf3328_timer_stop,
|
|
|
|
.precise_resolution = snd_azf3328_timer_precise_resolution,
|
|
|
|
};
|
|
|
|
|
2012-12-07 00:35:10 +07:00
|
|
|
static int
|
2005-11-17 21:02:42 +07:00
|
|
|
snd_azf3328_timer(struct snd_azf3328 *chip, int device)
|
2005-10-25 16:17:45 +07:00
|
|
|
{
|
2005-11-17 21:02:42 +07:00
|
|
|
struct snd_timer *timer = NULL;
|
|
|
|
struct snd_timer_id tid;
|
2005-10-25 16:17:45 +07:00
|
|
|
int err;
|
|
|
|
|
|
|
|
tid.dev_class = SNDRV_TIMER_CLASS_CARD;
|
|
|
|
tid.dev_sclass = SNDRV_TIMER_SCLASS_NONE;
|
|
|
|
tid.card = chip->card->number;
|
|
|
|
tid.device = device;
|
|
|
|
tid.subdevice = 0;
|
|
|
|
|
|
|
|
snd_azf3328_timer_hw.resolution *= seqtimer_scaling;
|
|
|
|
snd_azf3328_timer_hw.ticks /= seqtimer_scaling;
|
[ALSA] PCI168 snd-azt3328 Linux driver: another huge update
- figured out 'Digital(ly) Enhanced Game Port' functionality,
implemented support for it (eliminating gameport polling overhead)
- removed optional joystick activation, gameport now enabled unconditionally,
since we now support it via the PCI I/O space, not via conflict-prone
legacy I/O (which I was thus able to DISABLE now)!
- fix playback bug (a muted wave output would get unmuted upon start of
playback, of course this is not what we want, thus remember mute state)
- implement partial power management: when idle, lower clock rate and disable
codec (reduced noise!), and disable gameport circuit when unused
- instantiate OPL3 timer, too
- much better implementation of snd_azf3328_mixer_write_volume_gradually()
- slightly optimized interrupt handling
- lots of cleanup
This time, I also found a way to verify proper OPL3 operation
via MIDI file playback (emulation via synth hardware).
Signed-off-by: Andreas Mohr <andi@lisas.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2008-05-16 17:18:29 +07:00
|
|
|
|
|
|
|
err = snd_timer_new(chip->card, "AZF3328", &tid, &timer);
|
|
|
|
if (err < 0)
|
2005-10-25 16:17:45 +07:00
|
|
|
goto out;
|
|
|
|
|
|
|
|
strcpy(timer->name, "AZF3328 timer");
|
|
|
|
timer->private_data = chip;
|
|
|
|
timer->hw = snd_azf3328_timer_hw;
|
|
|
|
|
|
|
|
chip->timer = timer;
|
|
|
|
|
[ALSA] PCI168 snd-azt3328 Linux driver: another huge update
- figured out 'Digital(ly) Enhanced Game Port' functionality,
implemented support for it (eliminating gameport polling overhead)
- removed optional joystick activation, gameport now enabled unconditionally,
since we now support it via the PCI I/O space, not via conflict-prone
legacy I/O (which I was thus able to DISABLE now)!
- fix playback bug (a muted wave output would get unmuted upon start of
playback, of course this is not what we want, thus remember mute state)
- implement partial power management: when idle, lower clock rate and disable
codec (reduced noise!), and disable gameport circuit when unused
- instantiate OPL3 timer, too
- much better implementation of snd_azf3328_mixer_write_volume_gradually()
- slightly optimized interrupt handling
- lots of cleanup
This time, I also found a way to verify proper OPL3 operation
via MIDI file playback (emulation via synth hardware).
Signed-off-by: Andreas Mohr <andi@lisas.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2008-05-16 17:18:29 +07:00
|
|
|
snd_azf3328_timer_stop(timer);
|
|
|
|
|
2005-10-25 16:17:45 +07:00
|
|
|
err = 0;
|
|
|
|
|
|
|
|
out:
|
|
|
|
return err;
|
|
|
|
}
|
|
|
|
|
|
|
|
/******************************************************************/
|
|
|
|
|
[ALSA] PCI168 snd-azt3328 Linux driver: another huge update
- figured out 'Digital(ly) Enhanced Game Port' functionality,
implemented support for it (eliminating gameport polling overhead)
- removed optional joystick activation, gameport now enabled unconditionally,
since we now support it via the PCI I/O space, not via conflict-prone
legacy I/O (which I was thus able to DISABLE now)!
- fix playback bug (a muted wave output would get unmuted upon start of
playback, of course this is not what we want, thus remember mute state)
- implement partial power management: when idle, lower clock rate and disable
codec (reduced noise!), and disable gameport circuit when unused
- instantiate OPL3 timer, too
- much better implementation of snd_azf3328_mixer_write_volume_gradually()
- slightly optimized interrupt handling
- lots of cleanup
This time, I also found a way to verify proper OPL3 operation
via MIDI file playback (emulation via synth hardware).
Signed-off-by: Andreas Mohr <andi@lisas.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2008-05-16 17:18:29 +07:00
|
|
|
static int
|
|
|
|
snd_azf3328_free(struct snd_azf3328 *chip)
|
|
|
|
{
|
|
|
|
if (chip->irq < 0)
|
|
|
|
goto __end_hw;
|
|
|
|
|
2011-02-19 06:49:32 +07:00
|
|
|
snd_azf3328_mixer_reset(chip);
|
[ALSA] PCI168 snd-azt3328 Linux driver: another huge update
- figured out 'Digital(ly) Enhanced Game Port' functionality,
implemented support for it (eliminating gameport polling overhead)
- removed optional joystick activation, gameport now enabled unconditionally,
since we now support it via the PCI I/O space, not via conflict-prone
legacy I/O (which I was thus able to DISABLE now)!
- fix playback bug (a muted wave output would get unmuted upon start of
playback, of course this is not what we want, thus remember mute state)
- implement partial power management: when idle, lower clock rate and disable
codec (reduced noise!), and disable gameport circuit when unused
- instantiate OPL3 timer, too
- much better implementation of snd_azf3328_mixer_write_volume_gradually()
- slightly optimized interrupt handling
- lots of cleanup
This time, I also found a way to verify proper OPL3 operation
via MIDI file playback (emulation via synth hardware).
Signed-off-by: Andreas Mohr <andi@lisas.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2008-05-16 17:18:29 +07:00
|
|
|
|
|
|
|
snd_azf3328_timer_stop(chip->timer);
|
|
|
|
snd_azf3328_gameport_free(chip);
|
|
|
|
|
|
|
|
__end_hw:
|
|
|
|
if (chip->irq >= 0)
|
|
|
|
free_irq(chip->irq, chip);
|
|
|
|
pci_release_regions(chip->pci);
|
|
|
|
pci_disable_device(chip->pci);
|
|
|
|
|
|
|
|
kfree(chip);
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
|
|
|
snd_azf3328_dev_free(struct snd_device *device)
|
|
|
|
{
|
|
|
|
struct snd_azf3328 *chip = device->device_data;
|
|
|
|
return snd_azf3328_free(chip);
|
|
|
|
}
|
|
|
|
|
2005-04-17 05:20:36 +07:00
|
|
|
#if 0
|
|
|
|
/* check whether a bit can be modified */
|
2005-10-25 16:17:45 +07:00
|
|
|
static void
|
[ALSA] PCI168 snd-azt3328 Linux driver: another huge update
- figured out 'Digital(ly) Enhanced Game Port' functionality,
implemented support for it (eliminating gameport polling overhead)
- removed optional joystick activation, gameport now enabled unconditionally,
since we now support it via the PCI I/O space, not via conflict-prone
legacy I/O (which I was thus able to DISABLE now)!
- fix playback bug (a muted wave output would get unmuted upon start of
playback, of course this is not what we want, thus remember mute state)
- implement partial power management: when idle, lower clock rate and disable
codec (reduced noise!), and disable gameport circuit when unused
- instantiate OPL3 timer, too
- much better implementation of snd_azf3328_mixer_write_volume_gradually()
- slightly optimized interrupt handling
- lots of cleanup
This time, I also found a way to verify proper OPL3 operation
via MIDI file playback (emulation via synth hardware).
Signed-off-by: Andreas Mohr <andi@lisas.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2008-05-16 17:18:29 +07:00
|
|
|
snd_azf3328_test_bit(unsigned unsigned reg, int bit)
|
2005-04-17 05:20:36 +07:00
|
|
|
{
|
|
|
|
unsigned char val, valoff, valon;
|
|
|
|
|
|
|
|
val = inb(reg);
|
|
|
|
|
|
|
|
outb(val & ~(1 << bit), reg);
|
|
|
|
valoff = inb(reg);
|
|
|
|
|
|
|
|
outb(val|(1 << bit), reg);
|
|
|
|
valon = inb(reg);
|
[ALSA] PCI168 snd-azt3328 Linux driver: another huge update
- figured out 'Digital(ly) Enhanced Game Port' functionality,
implemented support for it (eliminating gameport polling overhead)
- removed optional joystick activation, gameport now enabled unconditionally,
since we now support it via the PCI I/O space, not via conflict-prone
legacy I/O (which I was thus able to DISABLE now)!
- fix playback bug (a muted wave output would get unmuted upon start of
playback, of course this is not what we want, thus remember mute state)
- implement partial power management: when idle, lower clock rate and disable
codec (reduced noise!), and disable gameport circuit when unused
- instantiate OPL3 timer, too
- much better implementation of snd_azf3328_mixer_write_volume_gradually()
- slightly optimized interrupt handling
- lots of cleanup
This time, I also found a way to verify proper OPL3 operation
via MIDI file playback (emulation via synth hardware).
Signed-off-by: Andreas Mohr <andi@lisas.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2008-05-16 17:18:29 +07:00
|
|
|
|
2005-04-17 05:20:36 +07:00
|
|
|
outb(val, reg);
|
|
|
|
|
2009-07-13 03:17:54 +07:00
|
|
|
printk(KERN_DEBUG "reg %04x bit %d: %02x %02x %02x\n",
|
[ALSA] PCI168 snd-azt3328 Linux driver: another huge update
- figured out 'Digital(ly) Enhanced Game Port' functionality,
implemented support for it (eliminating gameport polling overhead)
- removed optional joystick activation, gameport now enabled unconditionally,
since we now support it via the PCI I/O space, not via conflict-prone
legacy I/O (which I was thus able to DISABLE now)!
- fix playback bug (a muted wave output would get unmuted upon start of
playback, of course this is not what we want, thus remember mute state)
- implement partial power management: when idle, lower clock rate and disable
codec (reduced noise!), and disable gameport circuit when unused
- instantiate OPL3 timer, too
- much better implementation of snd_azf3328_mixer_write_volume_gradually()
- slightly optimized interrupt handling
- lots of cleanup
This time, I also found a way to verify proper OPL3 operation
via MIDI file playback (emulation via synth hardware).
Signed-off-by: Andreas Mohr <andi@lisas.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2008-05-16 17:18:29 +07:00
|
|
|
reg, bit, val, valoff, valon
|
|
|
|
);
|
2005-04-17 05:20:36 +07:00
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
[ALSA] PCI168 snd-azt3328 Linux driver: another huge update
- figured out 'Digital(ly) Enhanced Game Port' functionality,
implemented support for it (eliminating gameport polling overhead)
- removed optional joystick activation, gameport now enabled unconditionally,
since we now support it via the PCI I/O space, not via conflict-prone
legacy I/O (which I was thus able to DISABLE now)!
- fix playback bug (a muted wave output would get unmuted upon start of
playback, of course this is not what we want, thus remember mute state)
- implement partial power management: when idle, lower clock rate and disable
codec (reduced noise!), and disable gameport circuit when unused
- instantiate OPL3 timer, too
- much better implementation of snd_azf3328_mixer_write_volume_gradually()
- slightly optimized interrupt handling
- lots of cleanup
This time, I also found a way to verify proper OPL3 operation
via MIDI file playback (emulation via synth hardware).
Signed-off-by: Andreas Mohr <andi@lisas.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2008-05-16 17:18:29 +07:00
|
|
|
static inline void
|
2005-11-17 21:02:42 +07:00
|
|
|
snd_azf3328_debug_show_ports(const struct snd_azf3328 *chip)
|
2005-10-25 16:17:45 +07:00
|
|
|
{
|
|
|
|
u16 tmp;
|
|
|
|
|
2014-02-25 20:04:46 +07:00
|
|
|
dev_dbg(chip->card->dev,
|
ALSA: azt3328: large codec cleanup, add I2S port etc.
- fully separate codec I/O port handling, enabling the use of a single
function each for all codecs (playback, capture, I2S out)
- add a new separate pcm for I2S out port (UNTESTED, no I2S DAC
available yet)
- switch gameport to low frequency while idle, to try to reduce noise/power
- improve snd_azf3328_codec_setdmaa() calculation
- minor variable type cleanup (u16, bool etc.)
- add some doc updates (help those lost Windows users, debug help, ...)
Note that due to the large cleanup aspect of the codec I/O change,
I was able to fit everything including all improvements into the
same binary size!! (a measly 10 bytes more or so)
This should now be the almost last patch to this driver
(minus some possible kernel clocksource patch and x86_64 fixes or so).
I just felt like taking a break from the usual stuff and wanted to
get this driver's structure finished, and it's rather clean now...
Tested, working and checkpatch.pl:ed on 2.6.30-rc5,
applies cleanly to 2.6.30 proper.
Signed-off-by: Andreas Mohr <andi@lisas.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2009-07-05 18:55:46 +07:00
|
|
|
"ctrl_io 0x%lx, game_io 0x%lx, mpu_io 0x%lx, "
|
[ALSA] PCI168 snd-azt3328 Linux driver: another huge update
- figured out 'Digital(ly) Enhanced Game Port' functionality,
implemented support for it (eliminating gameport polling overhead)
- removed optional joystick activation, gameport now enabled unconditionally,
since we now support it via the PCI I/O space, not via conflict-prone
legacy I/O (which I was thus able to DISABLE now)!
- fix playback bug (a muted wave output would get unmuted upon start of
playback, of course this is not what we want, thus remember mute state)
- implement partial power management: when idle, lower clock rate and disable
codec (reduced noise!), and disable gameport circuit when unused
- instantiate OPL3 timer, too
- much better implementation of snd_azf3328_mixer_write_volume_gradually()
- slightly optimized interrupt handling
- lots of cleanup
This time, I also found a way to verify proper OPL3 operation
via MIDI file playback (emulation via synth hardware).
Signed-off-by: Andreas Mohr <andi@lisas.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2008-05-16 17:18:29 +07:00
|
|
|
"opl3_io 0x%lx, mixer_io 0x%lx, irq %d\n",
|
ALSA: azt3328: large codec cleanup, add I2S port etc.
- fully separate codec I/O port handling, enabling the use of a single
function each for all codecs (playback, capture, I2S out)
- add a new separate pcm for I2S out port (UNTESTED, no I2S DAC
available yet)
- switch gameport to low frequency while idle, to try to reduce noise/power
- improve snd_azf3328_codec_setdmaa() calculation
- minor variable type cleanup (u16, bool etc.)
- add some doc updates (help those lost Windows users, debug help, ...)
Note that due to the large cleanup aspect of the codec I/O change,
I was able to fit everything including all improvements into the
same binary size!! (a measly 10 bytes more or so)
This should now be the almost last patch to this driver
(minus some possible kernel clocksource patch and x86_64 fixes or so).
I just felt like taking a break from the usual stuff and wanted to
get this driver's structure finished, and it's rather clean now...
Tested, working and checkpatch.pl:ed on 2.6.30-rc5,
applies cleanly to 2.6.30 proper.
Signed-off-by: Andreas Mohr <andi@lisas.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2009-07-05 18:55:46 +07:00
|
|
|
chip->ctrl_io, chip->game_io, chip->mpu_io,
|
2014-02-25 20:04:46 +07:00
|
|
|
chip->opl3_io, chip->mixer_io, chip->irq);
|
[ALSA] PCI168 snd-azt3328 Linux driver: another huge update
- figured out 'Digital(ly) Enhanced Game Port' functionality,
implemented support for it (eliminating gameport polling overhead)
- removed optional joystick activation, gameport now enabled unconditionally,
since we now support it via the PCI I/O space, not via conflict-prone
legacy I/O (which I was thus able to DISABLE now)!
- fix playback bug (a muted wave output would get unmuted upon start of
playback, of course this is not what we want, thus remember mute state)
- implement partial power management: when idle, lower clock rate and disable
codec (reduced noise!), and disable gameport circuit when unused
- instantiate OPL3 timer, too
- much better implementation of snd_azf3328_mixer_write_volume_gradually()
- slightly optimized interrupt handling
- lots of cleanup
This time, I also found a way to verify proper OPL3 operation
via MIDI file playback (emulation via synth hardware).
Signed-off-by: Andreas Mohr <andi@lisas.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2008-05-16 17:18:29 +07:00
|
|
|
|
2014-02-25 20:04:46 +07:00
|
|
|
dev_dbg(chip->card->dev,
|
|
|
|
"game %02x %02x %02x %02x %02x %02x\n",
|
[ALSA] PCI168 snd-azt3328 Linux driver: another huge update
- figured out 'Digital(ly) Enhanced Game Port' functionality,
implemented support for it (eliminating gameport polling overhead)
- removed optional joystick activation, gameport now enabled unconditionally,
since we now support it via the PCI I/O space, not via conflict-prone
legacy I/O (which I was thus able to DISABLE now)!
- fix playback bug (a muted wave output would get unmuted upon start of
playback, of course this is not what we want, thus remember mute state)
- implement partial power management: when idle, lower clock rate and disable
codec (reduced noise!), and disable gameport circuit when unused
- instantiate OPL3 timer, too
- much better implementation of snd_azf3328_mixer_write_volume_gradually()
- slightly optimized interrupt handling
- lots of cleanup
This time, I also found a way to verify proper OPL3 operation
via MIDI file playback (emulation via synth hardware).
Signed-off-by: Andreas Mohr <andi@lisas.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2008-05-16 17:18:29 +07:00
|
|
|
snd_azf3328_game_inb(chip, 0),
|
|
|
|
snd_azf3328_game_inb(chip, 1),
|
|
|
|
snd_azf3328_game_inb(chip, 2),
|
|
|
|
snd_azf3328_game_inb(chip, 3),
|
|
|
|
snd_azf3328_game_inb(chip, 4),
|
2014-02-25 20:04:46 +07:00
|
|
|
snd_azf3328_game_inb(chip, 5));
|
[ALSA] PCI168 snd-azt3328 Linux driver: another huge update
- figured out 'Digital(ly) Enhanced Game Port' functionality,
implemented support for it (eliminating gameport polling overhead)
- removed optional joystick activation, gameport now enabled unconditionally,
since we now support it via the PCI I/O space, not via conflict-prone
legacy I/O (which I was thus able to DISABLE now)!
- fix playback bug (a muted wave output would get unmuted upon start of
playback, of course this is not what we want, thus remember mute state)
- implement partial power management: when idle, lower clock rate and disable
codec (reduced noise!), and disable gameport circuit when unused
- instantiate OPL3 timer, too
- much better implementation of snd_azf3328_mixer_write_volume_gradually()
- slightly optimized interrupt handling
- lots of cleanup
This time, I also found a way to verify proper OPL3 operation
via MIDI file playback (emulation via synth hardware).
Signed-off-by: Andreas Mohr <andi@lisas.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2008-05-16 17:18:29 +07:00
|
|
|
|
|
|
|
for (tmp = 0; tmp < 0x07; tmp += 1)
|
2014-02-25 20:04:46 +07:00
|
|
|
dev_dbg(chip->card->dev,
|
|
|
|
"mpu_io 0x%04x\n", inb(chip->mpu_io + tmp));
|
[ALSA] PCI168 snd-azt3328 Linux driver: another huge update
- figured out 'Digital(ly) Enhanced Game Port' functionality,
implemented support for it (eliminating gameport polling overhead)
- removed optional joystick activation, gameport now enabled unconditionally,
since we now support it via the PCI I/O space, not via conflict-prone
legacy I/O (which I was thus able to DISABLE now)!
- fix playback bug (a muted wave output would get unmuted upon start of
playback, of course this is not what we want, thus remember mute state)
- implement partial power management: when idle, lower clock rate and disable
codec (reduced noise!), and disable gameport circuit when unused
- instantiate OPL3 timer, too
- much better implementation of snd_azf3328_mixer_write_volume_gradually()
- slightly optimized interrupt handling
- lots of cleanup
This time, I also found a way to verify proper OPL3 operation
via MIDI file playback (emulation via synth hardware).
Signed-off-by: Andreas Mohr <andi@lisas.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2008-05-16 17:18:29 +07:00
|
|
|
|
|
|
|
for (tmp = 0; tmp <= 0x07; tmp += 1)
|
2014-02-25 20:04:46 +07:00
|
|
|
dev_dbg(chip->card->dev,
|
|
|
|
"0x%02x: game200 0x%04x, game208 0x%04x\n",
|
[ALSA] PCI168 snd-azt3328 Linux driver: another huge update
- figured out 'Digital(ly) Enhanced Game Port' functionality,
implemented support for it (eliminating gameport polling overhead)
- removed optional joystick activation, gameport now enabled unconditionally,
since we now support it via the PCI I/O space, not via conflict-prone
legacy I/O (which I was thus able to DISABLE now)!
- fix playback bug (a muted wave output would get unmuted upon start of
playback, of course this is not what we want, thus remember mute state)
- implement partial power management: when idle, lower clock rate and disable
codec (reduced noise!), and disable gameport circuit when unused
- instantiate OPL3 timer, too
- much better implementation of snd_azf3328_mixer_write_volume_gradually()
- slightly optimized interrupt handling
- lots of cleanup
This time, I also found a way to verify proper OPL3 operation
via MIDI file playback (emulation via synth hardware).
Signed-off-by: Andreas Mohr <andi@lisas.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2008-05-16 17:18:29 +07:00
|
|
|
tmp, inb(0x200 + tmp), inb(0x208 + tmp));
|
|
|
|
|
|
|
|
for (tmp = 0; tmp <= 0x01; tmp += 1)
|
2014-02-25 20:04:46 +07:00
|
|
|
dev_dbg(chip->card->dev,
|
[ALSA] PCI168 snd-azt3328 Linux driver: another huge update
- figured out 'Digital(ly) Enhanced Game Port' functionality,
implemented support for it (eliminating gameport polling overhead)
- removed optional joystick activation, gameport now enabled unconditionally,
since we now support it via the PCI I/O space, not via conflict-prone
legacy I/O (which I was thus able to DISABLE now)!
- fix playback bug (a muted wave output would get unmuted upon start of
playback, of course this is not what we want, thus remember mute state)
- implement partial power management: when idle, lower clock rate and disable
codec (reduced noise!), and disable gameport circuit when unused
- instantiate OPL3 timer, too
- much better implementation of snd_azf3328_mixer_write_volume_gradually()
- slightly optimized interrupt handling
- lots of cleanup
This time, I also found a way to verify proper OPL3 operation
via MIDI file playback (emulation via synth hardware).
Signed-off-by: Andreas Mohr <andi@lisas.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2008-05-16 17:18:29 +07:00
|
|
|
"0x%02x: mpu300 0x%04x, mpu310 0x%04x, mpu320 0x%04x, "
|
|
|
|
"mpu330 0x%04x opl388 0x%04x opl38c 0x%04x\n",
|
|
|
|
tmp,
|
|
|
|
inb(0x300 + tmp),
|
|
|
|
inb(0x310 + tmp),
|
|
|
|
inb(0x320 + tmp),
|
|
|
|
inb(0x330 + tmp),
|
|
|
|
inb(0x388 + tmp),
|
2014-02-25 20:04:46 +07:00
|
|
|
inb(0x38c + tmp));
|
2005-10-25 16:17:45 +07:00
|
|
|
|
ALSA: azt3328: large codec cleanup, add I2S port etc.
- fully separate codec I/O port handling, enabling the use of a single
function each for all codecs (playback, capture, I2S out)
- add a new separate pcm for I2S out port (UNTESTED, no I2S DAC
available yet)
- switch gameport to low frequency while idle, to try to reduce noise/power
- improve snd_azf3328_codec_setdmaa() calculation
- minor variable type cleanup (u16, bool etc.)
- add some doc updates (help those lost Windows users, debug help, ...)
Note that due to the large cleanup aspect of the codec I/O change,
I was able to fit everything including all improvements into the
same binary size!! (a measly 10 bytes more or so)
This should now be the almost last patch to this driver
(minus some possible kernel clocksource patch and x86_64 fixes or so).
I just felt like taking a break from the usual stuff and wanted to
get this driver's structure finished, and it's rather clean now...
Tested, working and checkpatch.pl:ed on 2.6.30-rc5,
applies cleanly to 2.6.30 proper.
Signed-off-by: Andreas Mohr <andi@lisas.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2009-07-05 18:55:46 +07:00
|
|
|
for (tmp = 0; tmp < AZF_IO_SIZE_CTRL; tmp += 2)
|
2014-02-25 20:04:46 +07:00
|
|
|
dev_dbg(chip->card->dev,
|
|
|
|
"ctrl 0x%02x: 0x%04x\n",
|
|
|
|
tmp, snd_azf3328_ctrl_inw(chip, tmp));
|
2007-03-26 17:49:45 +07:00
|
|
|
|
|
|
|
for (tmp = 0; tmp < AZF_IO_SIZE_MIXER; tmp += 2)
|
2014-02-25 20:04:46 +07:00
|
|
|
dev_dbg(chip->card->dev,
|
|
|
|
"mixer 0x%02x: 0x%04x\n",
|
|
|
|
tmp, snd_azf3328_mixer_inw(chip, tmp));
|
2005-10-25 16:17:45 +07:00
|
|
|
}
|
|
|
|
|
2012-12-07 00:35:10 +07:00
|
|
|
static int
|
2005-11-17 21:02:42 +07:00
|
|
|
snd_azf3328_create(struct snd_card *card,
|
[ALSA] PCI168 snd-azt3328 Linux driver: another huge update
- figured out 'Digital(ly) Enhanced Game Port' functionality,
implemented support for it (eliminating gameport polling overhead)
- removed optional joystick activation, gameport now enabled unconditionally,
since we now support it via the PCI I/O space, not via conflict-prone
legacy I/O (which I was thus able to DISABLE now)!
- fix playback bug (a muted wave output would get unmuted upon start of
playback, of course this is not what we want, thus remember mute state)
- implement partial power management: when idle, lower clock rate and disable
codec (reduced noise!), and disable gameport circuit when unused
- instantiate OPL3 timer, too
- much better implementation of snd_azf3328_mixer_write_volume_gradually()
- slightly optimized interrupt handling
- lots of cleanup
This time, I also found a way to verify proper OPL3 operation
via MIDI file playback (emulation via synth hardware).
Signed-off-by: Andreas Mohr <andi@lisas.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2008-05-16 17:18:29 +07:00
|
|
|
struct pci_dev *pci,
|
|
|
|
unsigned long device_type,
|
|
|
|
struct snd_azf3328 **rchip)
|
2005-04-17 05:20:36 +07:00
|
|
|
{
|
2005-11-17 21:02:42 +07:00
|
|
|
struct snd_azf3328 *chip;
|
2005-04-17 05:20:36 +07:00
|
|
|
int err;
|
2020-01-03 15:16:25 +07:00
|
|
|
static const struct snd_device_ops ops = {
|
2005-04-17 05:20:36 +07:00
|
|
|
.dev_free = snd_azf3328_dev_free,
|
|
|
|
};
|
ALSA: azt3328: large codec cleanup, add I2S port etc.
- fully separate codec I/O port handling, enabling the use of a single
function each for all codecs (playback, capture, I2S out)
- add a new separate pcm for I2S out port (UNTESTED, no I2S DAC
available yet)
- switch gameport to low frequency while idle, to try to reduce noise/power
- improve snd_azf3328_codec_setdmaa() calculation
- minor variable type cleanup (u16, bool etc.)
- add some doc updates (help those lost Windows users, debug help, ...)
Note that due to the large cleanup aspect of the codec I/O change,
I was able to fit everything including all improvements into the
same binary size!! (a measly 10 bytes more or so)
This should now be the almost last patch to this driver
(minus some possible kernel clocksource patch and x86_64 fixes or so).
I just felt like taking a break from the usual stuff and wanted to
get this driver's structure finished, and it's rather clean now...
Tested, working and checkpatch.pl:ed on 2.6.30-rc5,
applies cleanly to 2.6.30 proper.
Signed-off-by: Andreas Mohr <andi@lisas.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2009-07-05 18:55:46 +07:00
|
|
|
u8 dma_init;
|
|
|
|
enum snd_azf3328_codec_type codec_type;
|
2010-12-28 03:17:26 +07:00
|
|
|
struct snd_azf3328_codec_data *codec_setup;
|
2005-04-17 05:20:36 +07:00
|
|
|
|
|
|
|
*rchip = NULL;
|
|
|
|
|
[ALSA] PCI168 snd-azt3328 Linux driver: another huge update
- figured out 'Digital(ly) Enhanced Game Port' functionality,
implemented support for it (eliminating gameport polling overhead)
- removed optional joystick activation, gameport now enabled unconditionally,
since we now support it via the PCI I/O space, not via conflict-prone
legacy I/O (which I was thus able to DISABLE now)!
- fix playback bug (a muted wave output would get unmuted upon start of
playback, of course this is not what we want, thus remember mute state)
- implement partial power management: when idle, lower clock rate and disable
codec (reduced noise!), and disable gameport circuit when unused
- instantiate OPL3 timer, too
- much better implementation of snd_azf3328_mixer_write_volume_gradually()
- slightly optimized interrupt handling
- lots of cleanup
This time, I also found a way to verify proper OPL3 operation
via MIDI file playback (emulation via synth hardware).
Signed-off-by: Andreas Mohr <andi@lisas.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2008-05-16 17:18:29 +07:00
|
|
|
err = pci_enable_device(pci);
|
|
|
|
if (err < 0)
|
2005-04-17 05:20:36 +07:00
|
|
|
return err;
|
|
|
|
|
[ALSA] Replace with kzalloc() - pci stuff
AD1889 driver,ATIIXP driver,ATIIXP-modem driver,AZT3328 driver
BT87x driver,CMIPCI driver,CS4281 driver,ENS1370/1+ driver
ES1938 driver,ES1968 driver,FM801 driver,Intel8x0 driver
Intel8x0-modem driver,Maestro3 driver,SonicVibes driver,VIA82xx driver
VIA82xx-modem driver,AC97 Codec,AK4531 codec,au88x0 driver
CA0106 driver,CS46xx driver,EMU10K1/EMU10K2 driver,HDA Codec driver
HDA generic driver,HDA Intel driver,ICE1712 driver,ICE1724 driver
KORG1212 driver,MIXART driver,NM256 driver,Trident driver,YMFPCI driver
Replace kcalloc(1,..) with kzalloc().
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2005-09-09 19:21:46 +07:00
|
|
|
chip = kzalloc(sizeof(*chip), GFP_KERNEL);
|
2005-04-17 05:20:36 +07:00
|
|
|
if (chip == NULL) {
|
2005-10-25 16:17:45 +07:00
|
|
|
err = -ENOMEM;
|
|
|
|
goto out_err;
|
2005-04-17 05:20:36 +07:00
|
|
|
}
|
|
|
|
spin_lock_init(&chip->reg_lock);
|
|
|
|
chip->card = card;
|
|
|
|
chip->pci = pci;
|
|
|
|
chip->irq = -1;
|
|
|
|
|
|
|
|
/* check if we can restrict PCI DMA transfers to 24 bits */
|
ALSA: remove deprecated use of pci api
Replace occurences of the pci api by appropriate call to the dma api.
A simplified version of the semantic patch that finds this problem is as
follows: (http://coccinelle.lip6.fr)
@deprecated@
idexpression id;
position p;
@@
(
pci_dma_supported@p ( id, ...)
|
pci_alloc_consistent@p ( id, ...)
)
@bad1@
idexpression id;
position deprecated.p;
@@
...when != &id->dev
when != pci_get_drvdata ( id )
when != pci_enable_device ( id )
(
pci_dma_supported@p ( id, ...)
|
pci_alloc_consistent@p ( id, ...)
)
@depends on !bad1@
idexpression id;
expression direction;
position deprecated.p;
@@
(
- pci_dma_supported@p ( id,
+ dma_supported ( &id->dev,
...
+ , GFP_ATOMIC
)
|
- pci_alloc_consistent@p ( id,
+ dma_alloc_coherent ( &id->dev,
...
+ , GFP_ATOMIC
)
)
Signed-off-by: Quentin Lambert <lambert.quentin@gmail.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-04-15 21:10:17 +07:00
|
|
|
if (dma_set_mask(&pci->dev, DMA_BIT_MASK(24)) < 0 ||
|
|
|
|
dma_set_coherent_mask(&pci->dev, DMA_BIT_MASK(24)) < 0) {
|
2014-02-25 20:04:46 +07:00
|
|
|
dev_err(card->dev,
|
|
|
|
"architecture does not support 24bit PCI busmaster DMA\n"
|
[ALSA] PCI168 snd-azt3328 Linux driver: another huge update
- figured out 'Digital(ly) Enhanced Game Port' functionality,
implemented support for it (eliminating gameport polling overhead)
- removed optional joystick activation, gameport now enabled unconditionally,
since we now support it via the PCI I/O space, not via conflict-prone
legacy I/O (which I was thus able to DISABLE now)!
- fix playback bug (a muted wave output would get unmuted upon start of
playback, of course this is not what we want, thus remember mute state)
- implement partial power management: when idle, lower clock rate and disable
codec (reduced noise!), and disable gameport circuit when unused
- instantiate OPL3 timer, too
- much better implementation of snd_azf3328_mixer_write_volume_gradually()
- slightly optimized interrupt handling
- lots of cleanup
This time, I also found a way to verify proper OPL3 operation
via MIDI file playback (emulation via synth hardware).
Signed-off-by: Andreas Mohr <andi@lisas.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2008-05-16 17:18:29 +07:00
|
|
|
);
|
2005-10-25 16:17:45 +07:00
|
|
|
err = -ENXIO;
|
|
|
|
goto out_err;
|
2005-04-17 05:20:36 +07:00
|
|
|
}
|
|
|
|
|
[ALSA] PCI168 snd-azt3328 Linux driver: another huge update
- figured out 'Digital(ly) Enhanced Game Port' functionality,
implemented support for it (eliminating gameport polling overhead)
- removed optional joystick activation, gameport now enabled unconditionally,
since we now support it via the PCI I/O space, not via conflict-prone
legacy I/O (which I was thus able to DISABLE now)!
- fix playback bug (a muted wave output would get unmuted upon start of
playback, of course this is not what we want, thus remember mute state)
- implement partial power management: when idle, lower clock rate and disable
codec (reduced noise!), and disable gameport circuit when unused
- instantiate OPL3 timer, too
- much better implementation of snd_azf3328_mixer_write_volume_gradually()
- slightly optimized interrupt handling
- lots of cleanup
This time, I also found a way to verify proper OPL3 operation
via MIDI file playback (emulation via synth hardware).
Signed-off-by: Andreas Mohr <andi@lisas.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2008-05-16 17:18:29 +07:00
|
|
|
err = pci_request_regions(pci, "Aztech AZF3328");
|
|
|
|
if (err < 0)
|
2005-10-25 16:17:45 +07:00
|
|
|
goto out_err;
|
2005-04-17 05:20:36 +07:00
|
|
|
|
ALSA: azt3328: large codec cleanup, add I2S port etc.
- fully separate codec I/O port handling, enabling the use of a single
function each for all codecs (playback, capture, I2S out)
- add a new separate pcm for I2S out port (UNTESTED, no I2S DAC
available yet)
- switch gameport to low frequency while idle, to try to reduce noise/power
- improve snd_azf3328_codec_setdmaa() calculation
- minor variable type cleanup (u16, bool etc.)
- add some doc updates (help those lost Windows users, debug help, ...)
Note that due to the large cleanup aspect of the codec I/O change,
I was able to fit everything including all improvements into the
same binary size!! (a measly 10 bytes more or so)
This should now be the almost last patch to this driver
(minus some possible kernel clocksource patch and x86_64 fixes or so).
I just felt like taking a break from the usual stuff and wanted to
get this driver's structure finished, and it's rather clean now...
Tested, working and checkpatch.pl:ed on 2.6.30-rc5,
applies cleanly to 2.6.30 proper.
Signed-off-by: Andreas Mohr <andi@lisas.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2009-07-05 18:55:46 +07:00
|
|
|
chip->ctrl_io = pci_resource_start(pci, 0);
|
[ALSA] PCI168 snd-azt3328 Linux driver: another huge update
- figured out 'Digital(ly) Enhanced Game Port' functionality,
implemented support for it (eliminating gameport polling overhead)
- removed optional joystick activation, gameport now enabled unconditionally,
since we now support it via the PCI I/O space, not via conflict-prone
legacy I/O (which I was thus able to DISABLE now)!
- fix playback bug (a muted wave output would get unmuted upon start of
playback, of course this is not what we want, thus remember mute state)
- implement partial power management: when idle, lower clock rate and disable
codec (reduced noise!), and disable gameport circuit when unused
- instantiate OPL3 timer, too
- much better implementation of snd_azf3328_mixer_write_volume_gradually()
- slightly optimized interrupt handling
- lots of cleanup
This time, I also found a way to verify proper OPL3 operation
via MIDI file playback (emulation via synth hardware).
Signed-off-by: Andreas Mohr <andi@lisas.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2008-05-16 17:18:29 +07:00
|
|
|
chip->game_io = pci_resource_start(pci, 1);
|
|
|
|
chip->mpu_io = pci_resource_start(pci, 2);
|
ALSA: azt3328: large codec cleanup, add I2S port etc.
- fully separate codec I/O port handling, enabling the use of a single
function each for all codecs (playback, capture, I2S out)
- add a new separate pcm for I2S out port (UNTESTED, no I2S DAC
available yet)
- switch gameport to low frequency while idle, to try to reduce noise/power
- improve snd_azf3328_codec_setdmaa() calculation
- minor variable type cleanup (u16, bool etc.)
- add some doc updates (help those lost Windows users, debug help, ...)
Note that due to the large cleanup aspect of the codec I/O change,
I was able to fit everything including all improvements into the
same binary size!! (a measly 10 bytes more or so)
This should now be the almost last patch to this driver
(minus some possible kernel clocksource patch and x86_64 fixes or so).
I just felt like taking a break from the usual stuff and wanted to
get this driver's structure finished, and it's rather clean now...
Tested, working and checkpatch.pl:ed on 2.6.30-rc5,
applies cleanly to 2.6.30 proper.
Signed-off-by: Andreas Mohr <andi@lisas.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2009-07-05 18:55:46 +07:00
|
|
|
chip->opl3_io = pci_resource_start(pci, 3);
|
[ALSA] PCI168 snd-azt3328 Linux driver: another huge update
- figured out 'Digital(ly) Enhanced Game Port' functionality,
implemented support for it (eliminating gameport polling overhead)
- removed optional joystick activation, gameport now enabled unconditionally,
since we now support it via the PCI I/O space, not via conflict-prone
legacy I/O (which I was thus able to DISABLE now)!
- fix playback bug (a muted wave output would get unmuted upon start of
playback, of course this is not what we want, thus remember mute state)
- implement partial power management: when idle, lower clock rate and disable
codec (reduced noise!), and disable gameport circuit when unused
- instantiate OPL3 timer, too
- much better implementation of snd_azf3328_mixer_write_volume_gradually()
- slightly optimized interrupt handling
- lots of cleanup
This time, I also found a way to verify proper OPL3 operation
via MIDI file playback (emulation via synth hardware).
Signed-off-by: Andreas Mohr <andi@lisas.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2008-05-16 17:18:29 +07:00
|
|
|
chip->mixer_io = pci_resource_start(pci, 4);
|
|
|
|
|
2010-12-28 03:17:00 +07:00
|
|
|
codec_setup = &chip->codecs[AZF_CODEC_PLAYBACK];
|
|
|
|
codec_setup->io_base = chip->ctrl_io + AZF_IO_OFFS_CODEC_PLAYBACK;
|
2010-12-28 03:17:26 +07:00
|
|
|
codec_setup->lock = &chip->reg_lock;
|
|
|
|
codec_setup->type = AZF_CODEC_PLAYBACK;
|
2010-12-28 03:17:00 +07:00
|
|
|
codec_setup->name = "PLAYBACK";
|
|
|
|
|
|
|
|
codec_setup = &chip->codecs[AZF_CODEC_CAPTURE];
|
|
|
|
codec_setup->io_base = chip->ctrl_io + AZF_IO_OFFS_CODEC_CAPTURE;
|
2010-12-28 03:17:26 +07:00
|
|
|
codec_setup->lock = &chip->reg_lock;
|
|
|
|
codec_setup->type = AZF_CODEC_CAPTURE;
|
2010-12-28 03:17:00 +07:00
|
|
|
codec_setup->name = "CAPTURE";
|
|
|
|
|
|
|
|
codec_setup = &chip->codecs[AZF_CODEC_I2S_OUT];
|
|
|
|
codec_setup->io_base = chip->ctrl_io + AZF_IO_OFFS_CODEC_I2S_OUT;
|
2010-12-28 03:17:26 +07:00
|
|
|
codec_setup->lock = &chip->reg_lock;
|
|
|
|
codec_setup->type = AZF_CODEC_I2S_OUT;
|
2010-12-28 03:17:00 +07:00
|
|
|
codec_setup->name = "I2S_OUT";
|
2005-04-17 05:20:36 +07:00
|
|
|
|
2006-11-21 18:14:23 +07:00
|
|
|
if (request_irq(pci->irq, snd_azf3328_interrupt,
|
2011-06-10 21:36:37 +07:00
|
|
|
IRQF_SHARED, KBUILD_MODNAME, chip)) {
|
2014-02-25 20:04:46 +07:00
|
|
|
dev_err(card->dev, "unable to grab IRQ %d\n", pci->irq);
|
2005-10-25 16:17:45 +07:00
|
|
|
err = -EBUSY;
|
|
|
|
goto out_err;
|
2005-04-17 05:20:36 +07:00
|
|
|
}
|
|
|
|
chip->irq = pci->irq;
|
2019-12-10 13:34:06 +07:00
|
|
|
card->sync_irq = chip->irq;
|
2005-04-17 05:20:36 +07:00
|
|
|
pci_set_master(pci);
|
|
|
|
|
2005-10-25 16:17:45 +07:00
|
|
|
snd_azf3328_debug_show_ports(chip);
|
[ALSA] PCI168 snd-azt3328 Linux driver: another huge update
- figured out 'Digital(ly) Enhanced Game Port' functionality,
implemented support for it (eliminating gameport polling overhead)
- removed optional joystick activation, gameport now enabled unconditionally,
since we now support it via the PCI I/O space, not via conflict-prone
legacy I/O (which I was thus able to DISABLE now)!
- fix playback bug (a muted wave output would get unmuted upon start of
playback, of course this is not what we want, thus remember mute state)
- implement partial power management: when idle, lower clock rate and disable
codec (reduced noise!), and disable gameport circuit when unused
- instantiate OPL3 timer, too
- much better implementation of snd_azf3328_mixer_write_volume_gradually()
- slightly optimized interrupt handling
- lots of cleanup
This time, I also found a way to verify proper OPL3 operation
via MIDI file playback (emulation via synth hardware).
Signed-off-by: Andreas Mohr <andi@lisas.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2008-05-16 17:18:29 +07:00
|
|
|
|
|
|
|
err = snd_device_new(card, SNDRV_DEV_LOWLEVEL, chip, &ops);
|
|
|
|
if (err < 0)
|
2005-10-25 16:17:45 +07:00
|
|
|
goto out_err;
|
2005-04-17 05:20:36 +07:00
|
|
|
|
|
|
|
/* create mixer interface & switches */
|
[ALSA] PCI168 snd-azt3328 Linux driver: another huge update
- figured out 'Digital(ly) Enhanced Game Port' functionality,
implemented support for it (eliminating gameport polling overhead)
- removed optional joystick activation, gameport now enabled unconditionally,
since we now support it via the PCI I/O space, not via conflict-prone
legacy I/O (which I was thus able to DISABLE now)!
- fix playback bug (a muted wave output would get unmuted upon start of
playback, of course this is not what we want, thus remember mute state)
- implement partial power management: when idle, lower clock rate and disable
codec (reduced noise!), and disable gameport circuit when unused
- instantiate OPL3 timer, too
- much better implementation of snd_azf3328_mixer_write_volume_gradually()
- slightly optimized interrupt handling
- lots of cleanup
This time, I also found a way to verify proper OPL3 operation
via MIDI file playback (emulation via synth hardware).
Signed-off-by: Andreas Mohr <andi@lisas.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2008-05-16 17:18:29 +07:00
|
|
|
err = snd_azf3328_mixer_new(chip);
|
|
|
|
if (err < 0)
|
2005-10-25 16:17:45 +07:00
|
|
|
goto out_err;
|
2005-04-17 05:20:36 +07:00
|
|
|
|
ALSA: azt3328: large codec cleanup, add I2S port etc.
- fully separate codec I/O port handling, enabling the use of a single
function each for all codecs (playback, capture, I2S out)
- add a new separate pcm for I2S out port (UNTESTED, no I2S DAC
available yet)
- switch gameport to low frequency while idle, to try to reduce noise/power
- improve snd_azf3328_codec_setdmaa() calculation
- minor variable type cleanup (u16, bool etc.)
- add some doc updates (help those lost Windows users, debug help, ...)
Note that due to the large cleanup aspect of the codec I/O change,
I was able to fit everything including all improvements into the
same binary size!! (a measly 10 bytes more or so)
This should now be the almost last patch to this driver
(minus some possible kernel clocksource patch and x86_64 fixes or so).
I just felt like taking a break from the usual stuff and wanted to
get this driver's structure finished, and it's rather clean now...
Tested, working and checkpatch.pl:ed on 2.6.30-rc5,
applies cleanly to 2.6.30 proper.
Signed-off-by: Andreas Mohr <andi@lisas.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2009-07-05 18:55:46 +07:00
|
|
|
/* standard codec init stuff */
|
|
|
|
/* default DMA init value */
|
|
|
|
dma_init = DMA_RUN_SOMETHING2|DMA_EPILOGUE_SOMETHING|DMA_SOMETHING_ELSE;
|
|
|
|
|
|
|
|
for (codec_type = AZF_CODEC_PLAYBACK;
|
|
|
|
codec_type <= AZF_CODEC_I2S_OUT; ++codec_type) {
|
|
|
|
struct snd_azf3328_codec_data *codec =
|
|
|
|
&chip->codecs[codec_type];
|
2005-04-17 05:20:36 +07:00
|
|
|
|
2010-12-28 03:16:43 +07:00
|
|
|
/* shutdown codecs to reduce power / noise */
|
ALSA: azt3328: large codec cleanup, add I2S port etc.
- fully separate codec I/O port handling, enabling the use of a single
function each for all codecs (playback, capture, I2S out)
- add a new separate pcm for I2S out port (UNTESTED, no I2S DAC
available yet)
- switch gameport to low frequency while idle, to try to reduce noise/power
- improve snd_azf3328_codec_setdmaa() calculation
- minor variable type cleanup (u16, bool etc.)
- add some doc updates (help those lost Windows users, debug help, ...)
Note that due to the large cleanup aspect of the codec I/O change,
I was able to fit everything including all improvements into the
same binary size!! (a measly 10 bytes more or so)
This should now be the almost last patch to this driver
(minus some possible kernel clocksource patch and x86_64 fixes or so).
I just felt like taking a break from the usual stuff and wanted to
get this driver's structure finished, and it's rather clean now...
Tested, working and checkpatch.pl:ed on 2.6.30-rc5,
applies cleanly to 2.6.30 proper.
Signed-off-by: Andreas Mohr <andi@lisas.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2009-07-05 18:55:46 +07:00
|
|
|
/* have ...ctrl_codec_activity() act properly */
|
|
|
|
codec->running = 1;
|
|
|
|
snd_azf3328_ctrl_codec_activity(chip, codec_type, 0);
|
2005-04-17 05:20:36 +07:00
|
|
|
|
2010-12-28 03:17:26 +07:00
|
|
|
spin_lock_irq(codec->lock);
|
ALSA: azt3328: large codec cleanup, add I2S port etc.
- fully separate codec I/O port handling, enabling the use of a single
function each for all codecs (playback, capture, I2S out)
- add a new separate pcm for I2S out port (UNTESTED, no I2S DAC
available yet)
- switch gameport to low frequency while idle, to try to reduce noise/power
- improve snd_azf3328_codec_setdmaa() calculation
- minor variable type cleanup (u16, bool etc.)
- add some doc updates (help those lost Windows users, debug help, ...)
Note that due to the large cleanup aspect of the codec I/O change,
I was able to fit everything including all improvements into the
same binary size!! (a measly 10 bytes more or so)
This should now be the almost last patch to this driver
(minus some possible kernel clocksource patch and x86_64 fixes or so).
I just felt like taking a break from the usual stuff and wanted to
get this driver's structure finished, and it's rather clean now...
Tested, working and checkpatch.pl:ed on 2.6.30-rc5,
applies cleanly to 2.6.30 proper.
Signed-off-by: Andreas Mohr <andi@lisas.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2009-07-05 18:55:46 +07:00
|
|
|
snd_azf3328_codec_outb(codec, IDX_IO_CODEC_DMA_FLAGS,
|
|
|
|
dma_init);
|
2010-12-28 03:17:26 +07:00
|
|
|
spin_unlock_irq(codec->lock);
|
ALSA: azt3328: large codec cleanup, add I2S port etc.
- fully separate codec I/O port handling, enabling the use of a single
function each for all codecs (playback, capture, I2S out)
- add a new separate pcm for I2S out port (UNTESTED, no I2S DAC
available yet)
- switch gameport to low frequency while idle, to try to reduce noise/power
- improve snd_azf3328_codec_setdmaa() calculation
- minor variable type cleanup (u16, bool etc.)
- add some doc updates (help those lost Windows users, debug help, ...)
Note that due to the large cleanup aspect of the codec I/O change,
I was able to fit everything including all improvements into the
same binary size!! (a measly 10 bytes more or so)
This should now be the almost last patch to this driver
(minus some possible kernel clocksource patch and x86_64 fixes or so).
I just felt like taking a break from the usual stuff and wanted to
get this driver's structure finished, and it's rather clean now...
Tested, working and checkpatch.pl:ed on 2.6.30-rc5,
applies cleanly to 2.6.30 proper.
Signed-off-by: Andreas Mohr <andi@lisas.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2009-07-05 18:55:46 +07:00
|
|
|
}
|
2005-04-17 05:20:36 +07:00
|
|
|
|
|
|
|
*rchip = chip;
|
2005-10-25 16:17:45 +07:00
|
|
|
|
|
|
|
err = 0;
|
|
|
|
goto out;
|
|
|
|
|
|
|
|
out_err:
|
|
|
|
if (chip)
|
|
|
|
snd_azf3328_free(chip);
|
|
|
|
pci_disable_device(pci);
|
|
|
|
|
|
|
|
out:
|
|
|
|
return err;
|
2005-04-17 05:20:36 +07:00
|
|
|
}
|
|
|
|
|
2012-12-07 00:35:10 +07:00
|
|
|
static int
|
2005-10-25 16:17:45 +07:00
|
|
|
snd_azf3328_probe(struct pci_dev *pci, const struct pci_device_id *pci_id)
|
2005-04-17 05:20:36 +07:00
|
|
|
{
|
|
|
|
static int dev;
|
2005-11-17 21:02:42 +07:00
|
|
|
struct snd_card *card;
|
|
|
|
struct snd_azf3328 *chip;
|
|
|
|
struct snd_opl3 *opl3;
|
2005-04-17 05:20:36 +07:00
|
|
|
int err;
|
|
|
|
|
2011-08-10 16:49:04 +07:00
|
|
|
if (dev >= SNDRV_CARDS) {
|
|
|
|
err = -ENODEV;
|
|
|
|
goto out;
|
|
|
|
}
|
2005-04-17 05:20:36 +07:00
|
|
|
if (!enable[dev]) {
|
|
|
|
dev++;
|
2011-08-10 16:49:04 +07:00
|
|
|
err = -ENOENT;
|
|
|
|
goto out;
|
2005-04-17 05:20:36 +07:00
|
|
|
}
|
|
|
|
|
2014-01-29 20:20:19 +07:00
|
|
|
err = snd_card_new(&pci->dev, index[dev], id[dev], THIS_MODULE,
|
|
|
|
0, &card);
|
2008-12-28 22:44:30 +07:00
|
|
|
if (err < 0)
|
2011-08-10 16:49:04 +07:00
|
|
|
goto out;
|
2005-04-17 05:20:36 +07:00
|
|
|
|
|
|
|
strcpy(card->driver, "AZF3328");
|
|
|
|
strcpy(card->shortname, "Aztech AZF3328 (PCI168)");
|
|
|
|
|
[ALSA] PCI168 snd-azt3328 Linux driver: another huge update
- figured out 'Digital(ly) Enhanced Game Port' functionality,
implemented support for it (eliminating gameport polling overhead)
- removed optional joystick activation, gameport now enabled unconditionally,
since we now support it via the PCI I/O space, not via conflict-prone
legacy I/O (which I was thus able to DISABLE now)!
- fix playback bug (a muted wave output would get unmuted upon start of
playback, of course this is not what we want, thus remember mute state)
- implement partial power management: when idle, lower clock rate and disable
codec (reduced noise!), and disable gameport circuit when unused
- instantiate OPL3 timer, too
- much better implementation of snd_azf3328_mixer_write_volume_gradually()
- slightly optimized interrupt handling
- lots of cleanup
This time, I also found a way to verify proper OPL3 operation
via MIDI file playback (emulation via synth hardware).
Signed-off-by: Andreas Mohr <andi@lisas.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2008-05-16 17:18:29 +07:00
|
|
|
err = snd_azf3328_create(card, pci, pci_id->driver_data, &chip);
|
|
|
|
if (err < 0)
|
2005-10-25 16:17:45 +07:00
|
|
|
goto out_err;
|
2005-04-17 05:20:36 +07:00
|
|
|
|
2006-05-17 16:02:24 +07:00
|
|
|
card->private_data = chip;
|
|
|
|
|
2009-07-13 03:17:54 +07:00
|
|
|
/* chose to use MPU401_HW_AZT2320 ID instead of MPU401_HW_MPU401,
|
|
|
|
since our hardware ought to be similar, thus use same ID. */
|
[ALSA] PCI168 snd-azt3328 Linux driver: another huge update
- figured out 'Digital(ly) Enhanced Game Port' functionality,
implemented support for it (eliminating gameport polling overhead)
- removed optional joystick activation, gameport now enabled unconditionally,
since we now support it via the PCI I/O space, not via conflict-prone
legacy I/O (which I was thus able to DISABLE now)!
- fix playback bug (a muted wave output would get unmuted upon start of
playback, of course this is not what we want, thus remember mute state)
- implement partial power management: when idle, lower clock rate and disable
codec (reduced noise!), and disable gameport circuit when unused
- instantiate OPL3 timer, too
- much better implementation of snd_azf3328_mixer_write_volume_gradually()
- slightly optimized interrupt handling
- lots of cleanup
This time, I also found a way to verify proper OPL3 operation
via MIDI file playback (emulation via synth hardware).
Signed-off-by: Andreas Mohr <andi@lisas.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2008-05-16 17:18:29 +07:00
|
|
|
err = snd_mpu401_uart_new(
|
2009-07-13 03:17:54 +07:00
|
|
|
card, 0,
|
ALSA: mpu401: clean up interrupt specification
The semantics of snd_mpu401_uart_new()'s interrupt parameters are
somewhat counterintuitive: To prevent the function from allocating its
own interrupt, either the irq number must be invalid, or the irq_flags
parameter must be zero. At the same time, the irq parameter being
invalid specifies that the mpu401 code has to work without an interrupt
allocated by the caller. This implies that, if there is an interrupt
and it is allocated by the caller, the irq parameter must be set to
a valid-looking number which then isn't actually used.
With the removal of IRQF_DISABLED, zero becomes a valid irq_flags value,
which forces us to handle the parameters differently.
This patch introduces a new flag MPU401_INFO_IRQ_HOOK for when the
device interrupt is handled by the caller, and makes the allocation of
the interrupt to depend only on the irq parameter. As suggested by
Takashi, the irq_flags parameter was dropped because, when used, it had
the constant value IRQF_DISABLED.
Signed-off-by: Clemens Ladisch <clemens@ladisch.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2011-09-13 16:24:41 +07:00
|
|
|
MPU401_HW_AZT2320, chip->mpu_io,
|
|
|
|
MPU401_INFO_INTEGRATED | MPU401_INFO_IRQ_HOOK,
|
|
|
|
-1, &chip->rmidi
|
[ALSA] PCI168 snd-azt3328 Linux driver: another huge update
- figured out 'Digital(ly) Enhanced Game Port' functionality,
implemented support for it (eliminating gameport polling overhead)
- removed optional joystick activation, gameport now enabled unconditionally,
since we now support it via the PCI I/O space, not via conflict-prone
legacy I/O (which I was thus able to DISABLE now)!
- fix playback bug (a muted wave output would get unmuted upon start of
playback, of course this is not what we want, thus remember mute state)
- implement partial power management: when idle, lower clock rate and disable
codec (reduced noise!), and disable gameport circuit when unused
- instantiate OPL3 timer, too
- much better implementation of snd_azf3328_mixer_write_volume_gradually()
- slightly optimized interrupt handling
- lots of cleanup
This time, I also found a way to verify proper OPL3 operation
via MIDI file playback (emulation via synth hardware).
Signed-off-by: Andreas Mohr <andi@lisas.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2008-05-16 17:18:29 +07:00
|
|
|
);
|
|
|
|
if (err < 0) {
|
2014-02-25 20:04:46 +07:00
|
|
|
dev_err(card->dev, "no MPU-401 device at 0x%lx?\n",
|
[ALSA] PCI168 snd-azt3328 Linux driver: another huge update
- figured out 'Digital(ly) Enhanced Game Port' functionality,
implemented support for it (eliminating gameport polling overhead)
- removed optional joystick activation, gameport now enabled unconditionally,
since we now support it via the PCI I/O space, not via conflict-prone
legacy I/O (which I was thus able to DISABLE now)!
- fix playback bug (a muted wave output would get unmuted upon start of
playback, of course this is not what we want, thus remember mute state)
- implement partial power management: when idle, lower clock rate and disable
codec (reduced noise!), and disable gameport circuit when unused
- instantiate OPL3 timer, too
- much better implementation of snd_azf3328_mixer_write_volume_gradually()
- slightly optimized interrupt handling
- lots of cleanup
This time, I also found a way to verify proper OPL3 operation
via MIDI file playback (emulation via synth hardware).
Signed-off-by: Andreas Mohr <andi@lisas.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2008-05-16 17:18:29 +07:00
|
|
|
chip->mpu_io
|
|
|
|
);
|
2005-10-25 16:17:45 +07:00
|
|
|
goto out_err;
|
|
|
|
}
|
|
|
|
|
[ALSA] PCI168 snd-azt3328 Linux driver: another huge update
- figured out 'Digital(ly) Enhanced Game Port' functionality,
implemented support for it (eliminating gameport polling overhead)
- removed optional joystick activation, gameport now enabled unconditionally,
since we now support it via the PCI I/O space, not via conflict-prone
legacy I/O (which I was thus able to DISABLE now)!
- fix playback bug (a muted wave output would get unmuted upon start of
playback, of course this is not what we want, thus remember mute state)
- implement partial power management: when idle, lower clock rate and disable
codec (reduced noise!), and disable gameport circuit when unused
- instantiate OPL3 timer, too
- much better implementation of snd_azf3328_mixer_write_volume_gradually()
- slightly optimized interrupt handling
- lots of cleanup
This time, I also found a way to verify proper OPL3 operation
via MIDI file playback (emulation via synth hardware).
Signed-off-by: Andreas Mohr <andi@lisas.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2008-05-16 17:18:29 +07:00
|
|
|
err = snd_azf3328_timer(chip, 0);
|
|
|
|
if (err < 0)
|
2005-10-25 16:17:45 +07:00
|
|
|
goto out_err;
|
2005-04-17 05:20:36 +07:00
|
|
|
|
ALSA: azt3328: large codec cleanup, add I2S port etc.
- fully separate codec I/O port handling, enabling the use of a single
function each for all codecs (playback, capture, I2S out)
- add a new separate pcm for I2S out port (UNTESTED, no I2S DAC
available yet)
- switch gameport to low frequency while idle, to try to reduce noise/power
- improve snd_azf3328_codec_setdmaa() calculation
- minor variable type cleanup (u16, bool etc.)
- add some doc updates (help those lost Windows users, debug help, ...)
Note that due to the large cleanup aspect of the codec I/O change,
I was able to fit everything including all improvements into the
same binary size!! (a measly 10 bytes more or so)
This should now be the almost last patch to this driver
(minus some possible kernel clocksource patch and x86_64 fixes or so).
I just felt like taking a break from the usual stuff and wanted to
get this driver's structure finished, and it's rather clean now...
Tested, working and checkpatch.pl:ed on 2.6.30-rc5,
applies cleanly to 2.6.30 proper.
Signed-off-by: Andreas Mohr <andi@lisas.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2009-07-05 18:55:46 +07:00
|
|
|
err = snd_azf3328_pcm(chip);
|
[ALSA] PCI168 snd-azt3328 Linux driver: another huge update
- figured out 'Digital(ly) Enhanced Game Port' functionality,
implemented support for it (eliminating gameport polling overhead)
- removed optional joystick activation, gameport now enabled unconditionally,
since we now support it via the PCI I/O space, not via conflict-prone
legacy I/O (which I was thus able to DISABLE now)!
- fix playback bug (a muted wave output would get unmuted upon start of
playback, of course this is not what we want, thus remember mute state)
- implement partial power management: when idle, lower clock rate and disable
codec (reduced noise!), and disable gameport circuit when unused
- instantiate OPL3 timer, too
- much better implementation of snd_azf3328_mixer_write_volume_gradually()
- slightly optimized interrupt handling
- lots of cleanup
This time, I also found a way to verify proper OPL3 operation
via MIDI file playback (emulation via synth hardware).
Signed-off-by: Andreas Mohr <andi@lisas.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2008-05-16 17:18:29 +07:00
|
|
|
if (err < 0)
|
2005-10-25 16:17:45 +07:00
|
|
|
goto out_err;
|
2005-04-17 05:20:36 +07:00
|
|
|
|
[ALSA] PCI168 snd-azt3328 Linux driver: another huge update
- figured out 'Digital(ly) Enhanced Game Port' functionality,
implemented support for it (eliminating gameport polling overhead)
- removed optional joystick activation, gameport now enabled unconditionally,
since we now support it via the PCI I/O space, not via conflict-prone
legacy I/O (which I was thus able to DISABLE now)!
- fix playback bug (a muted wave output would get unmuted upon start of
playback, of course this is not what we want, thus remember mute state)
- implement partial power management: when idle, lower clock rate and disable
codec (reduced noise!), and disable gameport circuit when unused
- instantiate OPL3 timer, too
- much better implementation of snd_azf3328_mixer_write_volume_gradually()
- slightly optimized interrupt handling
- lots of cleanup
This time, I also found a way to verify proper OPL3 operation
via MIDI file playback (emulation via synth hardware).
Signed-off-by: Andreas Mohr <andi@lisas.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2008-05-16 17:18:29 +07:00
|
|
|
if (snd_opl3_create(card, chip->opl3_io, chip->opl3_io+2,
|
2005-04-17 05:20:36 +07:00
|
|
|
OPL3_HW_AUTO, 1, &opl3) < 0) {
|
2014-02-25 20:04:46 +07:00
|
|
|
dev_err(card->dev, "no OPL3 device at 0x%lx-0x%lx?\n",
|
[ALSA] PCI168 snd-azt3328 Linux driver: another huge update
- figured out 'Digital(ly) Enhanced Game Port' functionality,
implemented support for it (eliminating gameport polling overhead)
- removed optional joystick activation, gameport now enabled unconditionally,
since we now support it via the PCI I/O space, not via conflict-prone
legacy I/O (which I was thus able to DISABLE now)!
- fix playback bug (a muted wave output would get unmuted upon start of
playback, of course this is not what we want, thus remember mute state)
- implement partial power management: when idle, lower clock rate and disable
codec (reduced noise!), and disable gameport circuit when unused
- instantiate OPL3 timer, too
- much better implementation of snd_azf3328_mixer_write_volume_gradually()
- slightly optimized interrupt handling
- lots of cleanup
This time, I also found a way to verify proper OPL3 operation
via MIDI file playback (emulation via synth hardware).
Signed-off-by: Andreas Mohr <andi@lisas.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2008-05-16 17:18:29 +07:00
|
|
|
chip->opl3_io, chip->opl3_io+2
|
|
|
|
);
|
2005-04-17 05:20:36 +07:00
|
|
|
} else {
|
[ALSA] PCI168 snd-azt3328 Linux driver: another huge update
- figured out 'Digital(ly) Enhanced Game Port' functionality,
implemented support for it (eliminating gameport polling overhead)
- removed optional joystick activation, gameport now enabled unconditionally,
since we now support it via the PCI I/O space, not via conflict-prone
legacy I/O (which I was thus able to DISABLE now)!
- fix playback bug (a muted wave output would get unmuted upon start of
playback, of course this is not what we want, thus remember mute state)
- implement partial power management: when idle, lower clock rate and disable
codec (reduced noise!), and disable gameport circuit when unused
- instantiate OPL3 timer, too
- much better implementation of snd_azf3328_mixer_write_volume_gradually()
- slightly optimized interrupt handling
- lots of cleanup
This time, I also found a way to verify proper OPL3 operation
via MIDI file playback (emulation via synth hardware).
Signed-off-by: Andreas Mohr <andi@lisas.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2008-05-16 17:18:29 +07:00
|
|
|
/* need to use IDs 1, 2 since ID 0 is snd_azf3328_timer above */
|
|
|
|
err = snd_opl3_timer_new(opl3, 1, 2);
|
|
|
|
if (err < 0)
|
|
|
|
goto out_err;
|
|
|
|
err = snd_opl3_hwdep_new(opl3, 0, 1, NULL);
|
|
|
|
if (err < 0)
|
2005-10-25 16:17:45 +07:00
|
|
|
goto out_err;
|
2012-02-25 22:15:57 +07:00
|
|
|
opl3->private_data = chip;
|
2005-04-17 05:20:36 +07:00
|
|
|
}
|
|
|
|
|
|
|
|
sprintf(card->longname, "%s at 0x%lx, irq %i",
|
ALSA: azt3328: large codec cleanup, add I2S port etc.
- fully separate codec I/O port handling, enabling the use of a single
function each for all codecs (playback, capture, I2S out)
- add a new separate pcm for I2S out port (UNTESTED, no I2S DAC
available yet)
- switch gameport to low frequency while idle, to try to reduce noise/power
- improve snd_azf3328_codec_setdmaa() calculation
- minor variable type cleanup (u16, bool etc.)
- add some doc updates (help those lost Windows users, debug help, ...)
Note that due to the large cleanup aspect of the codec I/O change,
I was able to fit everything including all improvements into the
same binary size!! (a measly 10 bytes more or so)
This should now be the almost last patch to this driver
(minus some possible kernel clocksource patch and x86_64 fixes or so).
I just felt like taking a break from the usual stuff and wanted to
get this driver's structure finished, and it's rather clean now...
Tested, working and checkpatch.pl:ed on 2.6.30-rc5,
applies cleanly to 2.6.30 proper.
Signed-off-by: Andreas Mohr <andi@lisas.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2009-07-05 18:55:46 +07:00
|
|
|
card->shortname, chip->ctrl_io, chip->irq);
|
2005-04-17 05:20:36 +07:00
|
|
|
|
[ALSA] PCI168 snd-azt3328 Linux driver: another huge update
- figured out 'Digital(ly) Enhanced Game Port' functionality,
implemented support for it (eliminating gameport polling overhead)
- removed optional joystick activation, gameport now enabled unconditionally,
since we now support it via the PCI I/O space, not via conflict-prone
legacy I/O (which I was thus able to DISABLE now)!
- fix playback bug (a muted wave output would get unmuted upon start of
playback, of course this is not what we want, thus remember mute state)
- implement partial power management: when idle, lower clock rate and disable
codec (reduced noise!), and disable gameport circuit when unused
- instantiate OPL3 timer, too
- much better implementation of snd_azf3328_mixer_write_volume_gradually()
- slightly optimized interrupt handling
- lots of cleanup
This time, I also found a way to verify proper OPL3 operation
via MIDI file playback (emulation via synth hardware).
Signed-off-by: Andreas Mohr <andi@lisas.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2008-05-16 17:18:29 +07:00
|
|
|
err = snd_card_register(card);
|
|
|
|
if (err < 0)
|
2005-10-25 16:17:45 +07:00
|
|
|
goto out_err;
|
2005-04-17 05:20:36 +07:00
|
|
|
|
|
|
|
#ifdef MODULE
|
2014-02-25 20:04:46 +07:00
|
|
|
dev_info(card->dev,
|
|
|
|
"Sound driver for Aztech AZF3328-based soundcards such as PCI168.\n");
|
|
|
|
dev_info(card->dev,
|
|
|
|
"Hardware was completely undocumented, unfortunately.\n");
|
|
|
|
dev_info(card->dev,
|
|
|
|
"Feel free to contact andi AT lisas.de for bug reports etc.!\n");
|
|
|
|
dev_info(card->dev,
|
|
|
|
"User-scalable sequencer timer set to %dHz (1024000Hz / %d).\n",
|
|
|
|
1024000 / seqtimer_scaling, seqtimer_scaling);
|
2005-04-17 05:20:36 +07:00
|
|
|
#endif
|
|
|
|
|
[ALSA] PCI168 snd-azt3328 Linux driver: another huge update
- figured out 'Digital(ly) Enhanced Game Port' functionality,
implemented support for it (eliminating gameport polling overhead)
- removed optional joystick activation, gameport now enabled unconditionally,
since we now support it via the PCI I/O space, not via conflict-prone
legacy I/O (which I was thus able to DISABLE now)!
- fix playback bug (a muted wave output would get unmuted upon start of
playback, of course this is not what we want, thus remember mute state)
- implement partial power management: when idle, lower clock rate and disable
codec (reduced noise!), and disable gameport circuit when unused
- instantiate OPL3 timer, too
- much better implementation of snd_azf3328_mixer_write_volume_gradually()
- slightly optimized interrupt handling
- lots of cleanup
This time, I also found a way to verify proper OPL3 operation
via MIDI file playback (emulation via synth hardware).
Signed-off-by: Andreas Mohr <andi@lisas.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2008-05-16 17:18:29 +07:00
|
|
|
snd_azf3328_gameport(chip, dev);
|
2005-04-17 05:20:36 +07:00
|
|
|
|
|
|
|
pci_set_drvdata(pci, card);
|
|
|
|
dev++;
|
|
|
|
|
2005-10-25 16:17:45 +07:00
|
|
|
err = 0;
|
|
|
|
goto out;
|
[ALSA] PCI168 snd-azt3328 Linux driver: another huge update
- figured out 'Digital(ly) Enhanced Game Port' functionality,
implemented support for it (eliminating gameport polling overhead)
- removed optional joystick activation, gameport now enabled unconditionally,
since we now support it via the PCI I/O space, not via conflict-prone
legacy I/O (which I was thus able to DISABLE now)!
- fix playback bug (a muted wave output would get unmuted upon start of
playback, of course this is not what we want, thus remember mute state)
- implement partial power management: when idle, lower clock rate and disable
codec (reduced noise!), and disable gameport circuit when unused
- instantiate OPL3 timer, too
- much better implementation of snd_azf3328_mixer_write_volume_gradually()
- slightly optimized interrupt handling
- lots of cleanup
This time, I also found a way to verify proper OPL3 operation
via MIDI file playback (emulation via synth hardware).
Signed-off-by: Andreas Mohr <andi@lisas.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2008-05-16 17:18:29 +07:00
|
|
|
|
2005-10-25 16:17:45 +07:00
|
|
|
out_err:
|
2014-02-25 20:04:46 +07:00
|
|
|
dev_err(card->dev, "something failed, exiting\n");
|
2005-10-25 16:17:45 +07:00
|
|
|
snd_card_free(card);
|
[ALSA] PCI168 snd-azt3328 Linux driver: another huge update
- figured out 'Digital(ly) Enhanced Game Port' functionality,
implemented support for it (eliminating gameport polling overhead)
- removed optional joystick activation, gameport now enabled unconditionally,
since we now support it via the PCI I/O space, not via conflict-prone
legacy I/O (which I was thus able to DISABLE now)!
- fix playback bug (a muted wave output would get unmuted upon start of
playback, of course this is not what we want, thus remember mute state)
- implement partial power management: when idle, lower clock rate and disable
codec (reduced noise!), and disable gameport circuit when unused
- instantiate OPL3 timer, too
- much better implementation of snd_azf3328_mixer_write_volume_gradually()
- slightly optimized interrupt handling
- lots of cleanup
This time, I also found a way to verify proper OPL3 operation
via MIDI file playback (emulation via synth hardware).
Signed-off-by: Andreas Mohr <andi@lisas.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2008-05-16 17:18:29 +07:00
|
|
|
|
2005-10-25 16:17:45 +07:00
|
|
|
out:
|
|
|
|
return err;
|
2005-04-17 05:20:36 +07:00
|
|
|
}
|
|
|
|
|
2012-12-07 00:35:10 +07:00
|
|
|
static void
|
2005-10-25 16:17:45 +07:00
|
|
|
snd_azf3328_remove(struct pci_dev *pci)
|
2005-04-17 05:20:36 +07:00
|
|
|
{
|
|
|
|
snd_card_free(pci_get_drvdata(pci));
|
|
|
|
}
|
|
|
|
|
2012-08-14 23:12:04 +07:00
|
|
|
#ifdef CONFIG_PM_SLEEP
|
2009-07-13 03:17:54 +07:00
|
|
|
static inline void
|
2014-02-25 20:04:46 +07:00
|
|
|
snd_azf3328_suspend_regs(const struct snd_azf3328 *chip,
|
|
|
|
unsigned long io_addr, unsigned count, u32 *saved_regs)
|
2009-07-13 03:17:54 +07:00
|
|
|
{
|
|
|
|
unsigned reg;
|
|
|
|
|
|
|
|
for (reg = 0; reg < count; ++reg) {
|
|
|
|
*saved_regs = inl(io_addr);
|
2014-02-25 20:04:46 +07:00
|
|
|
dev_dbg(chip->card->dev, "suspend: io 0x%04lx: 0x%08x\n",
|
2009-07-13 03:17:54 +07:00
|
|
|
io_addr, *saved_regs);
|
|
|
|
++saved_regs;
|
|
|
|
io_addr += sizeof(*saved_regs);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-02-19 06:49:32 +07:00
|
|
|
static inline void
|
2014-02-25 20:04:46 +07:00
|
|
|
snd_azf3328_resume_regs(const struct snd_azf3328 *chip,
|
|
|
|
const u32 *saved_regs,
|
2011-02-19 06:49:32 +07:00
|
|
|
unsigned long io_addr,
|
|
|
|
unsigned count
|
|
|
|
)
|
|
|
|
{
|
|
|
|
unsigned reg;
|
|
|
|
|
|
|
|
for (reg = 0; reg < count; ++reg) {
|
|
|
|
outl(*saved_regs, io_addr);
|
2014-02-25 20:04:46 +07:00
|
|
|
dev_dbg(chip->card->dev,
|
|
|
|
"resume: io 0x%04lx: 0x%08x --> 0x%08x\n",
|
2011-02-19 06:49:32 +07:00
|
|
|
io_addr, *saved_regs, inl(io_addr));
|
|
|
|
++saved_regs;
|
|
|
|
io_addr += sizeof(*saved_regs);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline void
|
|
|
|
snd_azf3328_suspend_ac97(struct snd_azf3328 *chip)
|
|
|
|
{
|
|
|
|
#ifdef AZF_USE_AC97_LAYER
|
|
|
|
snd_ac97_suspend(chip->ac97);
|
|
|
|
#else
|
2014-02-25 20:04:46 +07:00
|
|
|
snd_azf3328_suspend_regs(chip, chip->mixer_io,
|
2011-02-19 06:49:32 +07:00
|
|
|
ARRAY_SIZE(chip->saved_regs_mixer), chip->saved_regs_mixer);
|
|
|
|
|
|
|
|
/* make sure to disable master volume etc. to prevent looping sound */
|
|
|
|
snd_azf3328_mixer_mute_control_master(chip, 1);
|
|
|
|
snd_azf3328_mixer_mute_control_pcm(chip, 1);
|
|
|
|
#endif /* AZF_USE_AC97_LAYER */
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline void
|
|
|
|
snd_azf3328_resume_ac97(const struct snd_azf3328 *chip)
|
|
|
|
{
|
|
|
|
#ifdef AZF_USE_AC97_LAYER
|
|
|
|
snd_ac97_resume(chip->ac97);
|
|
|
|
#else
|
2014-02-25 20:04:46 +07:00
|
|
|
snd_azf3328_resume_regs(chip, chip->saved_regs_mixer, chip->mixer_io,
|
2011-02-19 06:49:32 +07:00
|
|
|
ARRAY_SIZE(chip->saved_regs_mixer));
|
|
|
|
|
|
|
|
/* unfortunately with 32bit transfers, IDX_MIXER_PLAY_MASTER (0x02)
|
|
|
|
and IDX_MIXER_RESET (offset 0x00) get touched at the same time,
|
|
|
|
resulting in a mixer reset condition persisting until _after_
|
|
|
|
master vol was restored. Thus master vol needs an extra restore. */
|
|
|
|
outw(((u16 *)chip->saved_regs_mixer)[1], chip->mixer_io + 2);
|
|
|
|
#endif /* AZF_USE_AC97_LAYER */
|
|
|
|
}
|
|
|
|
|
2006-05-17 16:02:24 +07:00
|
|
|
static int
|
2012-07-02 20:20:37 +07:00
|
|
|
snd_azf3328_suspend(struct device *dev)
|
2006-05-17 16:02:24 +07:00
|
|
|
{
|
2012-07-02 20:20:37 +07:00
|
|
|
struct snd_card *card = dev_get_drvdata(dev);
|
2006-05-17 16:02:24 +07:00
|
|
|
struct snd_azf3328 *chip = card->private_data;
|
2009-07-13 03:17:54 +07:00
|
|
|
u16 *saved_regs_ctrl_u16;
|
2006-05-17 16:02:24 +07:00
|
|
|
|
|
|
|
snd_power_change_state(card, SNDRV_CTL_POWER_D3hot);
|
[ALSA] PCI168 snd-azt3328 Linux driver: another huge update
- figured out 'Digital(ly) Enhanced Game Port' functionality,
implemented support for it (eliminating gameport polling overhead)
- removed optional joystick activation, gameport now enabled unconditionally,
since we now support it via the PCI I/O space, not via conflict-prone
legacy I/O (which I was thus able to DISABLE now)!
- fix playback bug (a muted wave output would get unmuted upon start of
playback, of course this is not what we want, thus remember mute state)
- implement partial power management: when idle, lower clock rate and disable
codec (reduced noise!), and disable gameport circuit when unused
- instantiate OPL3 timer, too
- much better implementation of snd_azf3328_mixer_write_volume_gradually()
- slightly optimized interrupt handling
- lots of cleanup
This time, I also found a way to verify proper OPL3 operation
via MIDI file playback (emulation via synth hardware).
Signed-off-by: Andreas Mohr <andi@lisas.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2008-05-16 17:18:29 +07:00
|
|
|
|
2011-02-19 06:49:32 +07:00
|
|
|
snd_azf3328_suspend_ac97(chip);
|
[ALSA] PCI168 snd-azt3328 Linux driver: another huge update
- figured out 'Digital(ly) Enhanced Game Port' functionality,
implemented support for it (eliminating gameport polling overhead)
- removed optional joystick activation, gameport now enabled unconditionally,
since we now support it via the PCI I/O space, not via conflict-prone
legacy I/O (which I was thus able to DISABLE now)!
- fix playback bug (a muted wave output would get unmuted upon start of
playback, of course this is not what we want, thus remember mute state)
- implement partial power management: when idle, lower clock rate and disable
codec (reduced noise!), and disable gameport circuit when unused
- instantiate OPL3 timer, too
- much better implementation of snd_azf3328_mixer_write_volume_gradually()
- slightly optimized interrupt handling
- lots of cleanup
This time, I also found a way to verify proper OPL3 operation
via MIDI file playback (emulation via synth hardware).
Signed-off-by: Andreas Mohr <andi@lisas.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2008-05-16 17:18:29 +07:00
|
|
|
|
2014-02-25 20:04:46 +07:00
|
|
|
snd_azf3328_suspend_regs(chip, chip->ctrl_io,
|
2009-07-13 03:17:54 +07:00
|
|
|
ARRAY_SIZE(chip->saved_regs_ctrl), chip->saved_regs_ctrl);
|
2008-06-23 16:50:47 +07:00
|
|
|
|
|
|
|
/* manually store the one currently relevant write-only reg, too */
|
2009-07-13 03:17:54 +07:00
|
|
|
saved_regs_ctrl_u16 = (u16 *)chip->saved_regs_ctrl;
|
|
|
|
saved_regs_ctrl_u16[IDX_IO_6AH / 2] = chip->shadow_reg_ctrl_6AH;
|
2008-06-23 16:50:47 +07:00
|
|
|
|
2014-02-25 20:04:46 +07:00
|
|
|
snd_azf3328_suspend_regs(chip, chip->game_io,
|
2009-07-13 03:17:54 +07:00
|
|
|
ARRAY_SIZE(chip->saved_regs_game), chip->saved_regs_game);
|
2014-02-25 20:04:46 +07:00
|
|
|
snd_azf3328_suspend_regs(chip, chip->mpu_io,
|
2009-07-13 03:17:54 +07:00
|
|
|
ARRAY_SIZE(chip->saved_regs_mpu), chip->saved_regs_mpu);
|
2014-02-25 20:04:46 +07:00
|
|
|
snd_azf3328_suspend_regs(chip, chip->opl3_io,
|
2009-07-13 03:17:54 +07:00
|
|
|
ARRAY_SIZE(chip->saved_regs_opl3), chip->saved_regs_opl3);
|
2006-05-17 16:02:24 +07:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
2012-07-02 20:20:37 +07:00
|
|
|
snd_azf3328_resume(struct device *dev)
|
2006-05-17 16:02:24 +07:00
|
|
|
{
|
2012-07-02 20:20:37 +07:00
|
|
|
struct snd_card *card = dev_get_drvdata(dev);
|
ALSA: azt3328: large codec cleanup, add I2S port etc.
- fully separate codec I/O port handling, enabling the use of a single
function each for all codecs (playback, capture, I2S out)
- add a new separate pcm for I2S out port (UNTESTED, no I2S DAC
available yet)
- switch gameport to low frequency while idle, to try to reduce noise/power
- improve snd_azf3328_codec_setdmaa() calculation
- minor variable type cleanup (u16, bool etc.)
- add some doc updates (help those lost Windows users, debug help, ...)
Note that due to the large cleanup aspect of the codec I/O change,
I was able to fit everything including all improvements into the
same binary size!! (a measly 10 bytes more or so)
This should now be the almost last patch to this driver
(minus some possible kernel clocksource patch and x86_64 fixes or so).
I just felt like taking a break from the usual stuff and wanted to
get this driver's structure finished, and it's rather clean now...
Tested, working and checkpatch.pl:ed on 2.6.30-rc5,
applies cleanly to 2.6.30 proper.
Signed-off-by: Andreas Mohr <andi@lisas.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2009-07-05 18:55:46 +07:00
|
|
|
const struct snd_azf3328 *chip = card->private_data;
|
2006-05-17 16:02:24 +07:00
|
|
|
|
2014-02-25 20:04:46 +07:00
|
|
|
snd_azf3328_resume_regs(chip, chip->saved_regs_game, chip->game_io,
|
2009-07-13 03:17:54 +07:00
|
|
|
ARRAY_SIZE(chip->saved_regs_game));
|
2014-02-25 20:04:46 +07:00
|
|
|
snd_azf3328_resume_regs(chip, chip->saved_regs_mpu, chip->mpu_io,
|
2009-07-13 03:17:54 +07:00
|
|
|
ARRAY_SIZE(chip->saved_regs_mpu));
|
2014-02-25 20:04:46 +07:00
|
|
|
snd_azf3328_resume_regs(chip, chip->saved_regs_opl3, chip->opl3_io,
|
2009-07-13 03:17:54 +07:00
|
|
|
ARRAY_SIZE(chip->saved_regs_opl3));
|
|
|
|
|
2011-02-19 06:49:32 +07:00
|
|
|
snd_azf3328_resume_ac97(chip);
|
2009-07-13 03:17:54 +07:00
|
|
|
|
2014-02-25 20:04:46 +07:00
|
|
|
snd_azf3328_resume_regs(chip, chip->saved_regs_ctrl, chip->ctrl_io,
|
2009-07-13 03:17:54 +07:00
|
|
|
ARRAY_SIZE(chip->saved_regs_ctrl));
|
2006-05-17 16:02:24 +07:00
|
|
|
|
|
|
|
snd_power_change_state(card, SNDRV_CTL_POWER_D0);
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2012-07-02 20:20:37 +07:00
|
|
|
static SIMPLE_DEV_PM_OPS(snd_azf3328_pm, snd_azf3328_suspend, snd_azf3328_resume);
|
|
|
|
#define SND_AZF3328_PM_OPS &snd_azf3328_pm
|
|
|
|
#else
|
|
|
|
#define SND_AZF3328_PM_OPS NULL
|
2012-08-14 23:12:04 +07:00
|
|
|
#endif /* CONFIG_PM_SLEEP */
|
2006-05-17 16:02:24 +07:00
|
|
|
|
2012-04-24 17:25:00 +07:00
|
|
|
static struct pci_driver azf3328_driver = {
|
2011-06-10 21:20:20 +07:00
|
|
|
.name = KBUILD_MODNAME,
|
2005-04-17 05:20:36 +07:00
|
|
|
.id_table = snd_azf3328_ids,
|
|
|
|
.probe = snd_azf3328_probe,
|
2012-12-07 00:35:10 +07:00
|
|
|
.remove = snd_azf3328_remove,
|
2012-07-02 20:20:37 +07:00
|
|
|
.driver = {
|
|
|
|
.pm = SND_AZF3328_PM_OPS,
|
|
|
|
},
|
2005-04-17 05:20:36 +07:00
|
|
|
};
|
|
|
|
|
2012-04-24 17:25:00 +07:00
|
|
|
module_pci_driver(azf3328_driver);
|