History log of /linux-master/include/sound/emu10k1.h
Revision Date Author Comments
# c435d375 15-Jul-2023 Oswald Buddenhagen <oswald.buddenhagen@gmx.de>

ALSA: emu10k1: set the "no filtering" bits on PCM voices on Audigy

Given that the filter is already set to neutral for PCM voices, the
only observable effect is that the Z1/Z2/FXBUS registers don't have a
stray bit set for negative numbers anymore. The bit is below the ones
significant for output, but it would mess with 32-bit sample
recombination, which we intend to add.

kX-project does that, but I had to figure out myself why.

Signed-off-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
Link: https://lore.kernel.org/r/20230715160802.326872-1-oswald.buddenhagen@gmx.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# c960b012 15-Jul-2023 Oswald Buddenhagen <oswald.buddenhagen@gmx.de>

ALSA: emu10k1: track loss of external clock on E-MU cards
85;95;0c
This uses IRQs to track spontaneous changes to the word clock source
register.

FWIW, that this can happen in the first place is the reason why it is
futile to lock the clock source mixer setting while the device is open -
we can't consistently control the rate anyway. Though arguably, we
should reset any open streams when that happens, as they become
corrupted anyway.

Signed-off-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
Link: https://lore.kernel.org/r/20230715160738.326832-1-oswald.buddenhagen@gmx.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# fbb64eed 10-Jul-2023 Oswald Buddenhagen <oswald.buddenhagen@gmx.de>

ALSA: emu10k1: make E-MU dock monitoring interrupt-driven

... instead of using a one-second polling timer.

Signed-off-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
Link: https://lore.kernel.org/r/20230710065956.1246364-1-oswald.buddenhagen@gmx.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 19b89d15 12-Jun-2023 Oswald Buddenhagen <oswald.buddenhagen@gmx.de>

ALSA: emu10k1: fix sample rates for E-MU cards at 44.1 kHz word clock

Now that we know the actual word clock, we can:
- Put the resulting rate into the hardware info
- At 44.1 kHz word clock shift the rate for the pitch calculations,
which presume a 48 kHz word clock

Signed-off-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
Link: https://lore.kernel.org/r/20230612191325.1315854-5-oswald.buddenhagen@gmx.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# e73b597e 12-Jun-2023 Oswald Buddenhagen <oswald.buddenhagen@gmx.de>

ALSA: emu10k1: query rate of external clock sources on E-MU cards

The value isn't used yet; the subsequent commits will do that.

This ignores the existence of rates above 48 kHz, which is fine, as the
hardware will just switch to the fallback clock source when fed with a
rate which is incompatible with the base clock multiplier, which
currently is always x1.

The sample rate display in /proc spdif-in is adjusted to reflect our
understanding of the input rates.

This is tested only with an 0404b card without sync card, so there is a
lot of room for improvement.

Signed-off-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>

Link: https://lore.kernel.org/r/20230612191325.1315854-4-oswald.buddenhagen@gmx.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 60985241 12-Jun-2023 Oswald Buddenhagen <oswald.buddenhagen@gmx.de>

ALSA: emu10k1: make available E-MU clock sources card-specific

The actually available clock sources depend on the available audio input
ports and dedicated clock input ports.

This includes refactoring the code to be data-driven to remain
manageable.

Signed-off-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
Link: https://lore.kernel.org/r/20230612191325.1315854-3-oswald.buddenhagen@gmx.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 13598862 12-Jun-2023 Oswald Buddenhagen <oswald.buddenhagen@gmx.de>

ALSA: emu10k1: split off E-MU fallback clock from clock source

So far, we set the fallback as a side effect of setting the source. But
the fallback makes no sense at all when an internal clock is selected.
Defaulting to 48k for S/PDIF & ADAT makes sense, but as that is the
global default and we're not changing it automatically any more, it's
just fine to leave it entirely to the explicit setting.

This changes the name of the pre-existing control to something more
appropriate (regardless of the split), so users will need to adjust
their mixer settings.

Signed-off-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
Link: https://lore.kernel.org/r/20230612191325.1315854-2-oswald.buddenhagen@gmx.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# db987421 25-May-2023 Oswald Buddenhagen <oswald.buddenhagen@gmx.de>

ALSA: emu10k1: vastly improve usefulness of info in /proc

- Include the FX bus map, without which the already present send routing
info would require looking up the documentation.
- Include the physical I/O channels as known to the driver
- Make the multi-channel capture map actually name the mapped input
channels rather than "FXBUS" (Audigy) or even "???" (SbLive)
- The latter two are omitted for E-MU cards, as their physical I/O is
routed through the FPGA
- While at it, make the "Card" field somewhat more useful

This includes de-duplicating the label tables between emuproc and emufx,
updating/improving the FX bus label table, and making the SB Live! 5.1
multi-track capture channel mapping hack data-driven.

Tested-by: Jonathan Dowland <jon@dow.land>
Signed-off-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
Link: https://lore.kernel.org/r/20230526101659.437969-7-oswald.buddenhagen@gmx.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 6ab13291 25-May-2023 Oswald Buddenhagen <oswald.buddenhagen@gmx.de>

ALSA: emu10k1: make E-MU FPGA register dump in /proc more useful

Include the routing information, which can be actually read back.

Somewhat as a drive-by, make the register dump format less obscure - the
previous one made no sense at all.

Signed-off-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
Link: https://lore.kernel.org/r/20230526101659.437969-6-oswald.buddenhagen@gmx.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 11ee59bd 23-May-2023 Oswald Buddenhagen <oswald.buddenhagen@gmx.de>

ALSA: emu10k1: add synchronized start of multi-channel playback

We use independent voices for the channels, so we need to make an effort
to ensure that they are actually in sync.

The hardware doesn't provide atomicity, so we may need to retry a few
times, due to NMIs, PCI contention, and the wrong phase of the moon.

Solution inspired by kX-project.

Signed-off-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
Link: https://lore.kernel.org/r/20230523200709.236023-3-oswald.buddenhagen@gmx.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# a915d604 18-May-2023 Oswald Buddenhagen <oswald.buddenhagen@gmx.de>

ALSA: emu10k1: revamp playback voice allocator

Instead of separate voices, we now allocate non-interleaved channels,
which may in turn contain two interleaved voices each. The higher-level
code keeps only one pointer per channel. The channels are not allocated
in one block any more, as there is no reason to do that. As a
consequence of that, and because it is cleaner regardless, we now let
the allocator store these pointers at a specified location, rather than
returning only the first one and having the calling code deduce the
remaining ones.

Signed-off-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
Link: https://lore.kernel.org/r/20230518140947.3725394-8-oswald.buddenhagen@gmx.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# b4fea2d3 18-May-2023 Oswald Buddenhagen <oswald.buddenhagen@gmx.de>

ALSA: emu10k1: make snd_emu10k1_voice_alloc() assign voices' epcm

The voice allocator clearly knows about the field (it resets it), so
it's more consistent (and leads to less duplicated code) to have the
constructor take it as a parameter.

Signed-off-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
Link: https://lore.kernel.org/r/20230518140947.3725394-7-oswald.buddenhagen@gmx.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 82a9fa6e 18-May-2023 Oswald Buddenhagen <oswald.buddenhagen@gmx.de>

ALSA: emu10k1: make freeing untouched playback voices cheap

This allows us to drop the code that tries to preserve already allocated
voices upon repeated hw_param callback invocations. Getting it right for
multi-channel voices would otherwise get a bit hairy.

Signed-off-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
Link: https://lore.kernel.org/r/20230518140947.3725394-5-oswald.buddenhagen@gmx.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# b840f8d8 18-May-2023 Oswald Buddenhagen <oswald.buddenhagen@gmx.de>

ALSA: emu10k1: improve voice status display in /proc

Eliminate the MIDI type, as there is no such thing - the MPU401 port
doesn't have anything to do with voices.

For clarity, differentiate between regular and extra voices.

Don't atomize the enum into bits in the table display.

Simplify/optimize the storage.

Signed-off-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
Link: https://lore.kernel.org/r/20230518140947.3725394-4-oswald.buddenhagen@gmx.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# fccd6f31 18-May-2023 Oswald Buddenhagen <oswald.buddenhagen@gmx.de>

ALSA: emu10k1: enable bit-exact playback, part 4: send amounts

On Audigy, the send amounts are merely targets, presumably to avoid
sound distortion due to sudden changes, which the EMU8K docu explicitly
warns about.

However, that "soft-start" would prevent bit-for-bit reproduction, so
we now force the current send amounts to their final values at PCM
playback init.

One might want to do that for the MIDI synthesizer as well, though it
seems mostly pointless due to the attack phase each note has anyway.

Signed-off-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
Link: https://lore.kernel.org/r/20230518140339.3722279-3-oswald.buddenhagen@gmx.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 46055699 18-May-2023 Oswald Buddenhagen <oswald.buddenhagen@gmx.de>

ALSA: emu10k1: introduce and use snd_emu10k1_ptr_write_multiple()

While this nicely denoises the code, the real intent is being able to
write many registers pseudo-atomically, which will come in handy later.

Idea stolen from kX-project.

Signed-off-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>

Link: https://lore.kernel.org/r/20230518093134.3697955-1-oswald.buddenhagen@gmx.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 5b1cd21f 17-May-2023 Oswald Buddenhagen <oswald.buddenhagen@gmx.de>

ALSA: emu10k1: fix PCM playback cache and interrupt handling

The cache causes a fixed delay regardless of stream parameters.
Consequently, all that "cache invalidate size" calculation stuff was
garbage (which can be traced right back to Creative's OSS driver).

This also removes the definitions of registers CD1..CDF, because they
are accessed only relative to CD0 anyway.

Signed-off-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
Link: https://lore.kernel.org/r/20230517174256.3657060-5-oswald.buddenhagen@gmx.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 1e5323bd 17-May-2023 Oswald Buddenhagen <oswald.buddenhagen@gmx.de>

Revert "ALSA: emu10k1 - delay the PCM interrupts (add pcm_irq_delay parameter)"

This workaround fails to address the underlying problem, which is
actually wholly self-made. Subsequent patches will fix it.

This reverts commit 56385a12d9bb9e173751f74b6c430742018cafc0.

Signed-off-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
Link: https://lore.kernel.org/r/20230517174256.3657060-2-oswald.buddenhagen@gmx.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 216abe45 16-May-2023 Oswald Buddenhagen <oswald.buddenhagen@gmx.de>

ALSA: emu10k1: make struct snd_emu1010 less wasteful

Shrink the {in,out}put_source arrays and their data type to what is
actually necessary.

To be still on the safe side, add some static asserts.

Signed-off-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
Link: https://lore.kernel.org/r/20230516093612.3536508-11-oswald.buddenhagen@gmx.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 6f3609f8 16-May-2023 Oswald Buddenhagen <oswald.buddenhagen@gmx.de>

ALSA: emu10k1: add explicit support for E-MU 0404

Unlike the other models, this is actually a distinct card, rather than
an E-MU 1010 with different "dongles". It is stereo only, and supports
no ADAT (there is no trace of ADAT in the manual, switching the output
mode to ADAT has no effect, and switching the input mode to ADAT just
breaks input (presumably ... my only ADAT source is the card's output)).

Signed-off-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
Link: https://lore.kernel.org/r/20230516093612.3536508-10-oswald.buddenhagen@gmx.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 536438f1 16-May-2023 Oswald Buddenhagen <oswald.buddenhagen@gmx.de>

ALSA: emu10k1: make mixer control mass creation less wasteful

Define arrays of strings instead of snd_kcontrol_new.

While at it, move the E-MU source & destination enum defs next to their
hardware defs, which is a lot more logical and will come in handy in a
followup commit. And add some static asserts to verify that the array
sizes match.

This also applies the compactization from the previous commit to the
destination registers.
While reshuffling the arrays anyway, switch the order of the HAMOA_DAC
& HANA_SPDIF output destinations for the 1010 card, so they follow a
more regular pattern. This should have no functional impact.

The code is somewhat de-duplicated by the extraction of add_ctls().

Signed-off-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
Link: https://lore.kernel.org/r/20230516093612.3536508-4-oswald.buddenhagen@gmx.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 9b00a1e9 16-May-2023 Oswald Buddenhagen <oswald.buddenhagen@gmx.de>

ALSA: emu10k1: make some initializer arrays less wasteful

- Use bit fields in struct snd_emu_chip_details
- Use shorts in the E-MU routing register arrays

Signed-off-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
Link: https://lore.kernel.org/r/20230516093612.3536508-2-oswald.buddenhagen@gmx.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 51d652f4 16-May-2023 Oswald Buddenhagen <oswald.buddenhagen@gmx.de>

ALSA: emu10k1: factor out snd_emu10k1_compose_audigy_sendamounts()

Saves a bit of code duplication.

Signed-off-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
Link: https://lore.kernel.org/r/20230516093612.3536451-7-oswald.buddenhagen@gmx.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 77e067d0 16-May-2023 Oswald Buddenhagen <oswald.buddenhagen@gmx.de>

ALSA: emu10k1: skip needless setting of some voice registers

Many registers are meaningless for stereo slaves and the extra voices.
This patch cleans up these unnecessary register writes.

snd_emu10k1_playback_{trigger,stop}_voice() is not called for stereo
slaves any more.

snd_emu10k1_playback_prepare_voice() is renamed to
snd_emu10k1_playback_unmute_voice(), as this better reflects its
remaining function. It's not called for the extra voices any more.

Accordingly, snd_emu10k1_playback_mute_voice() is factored out from
snd_emu10k1_playback_stop_voice(), and is called selectively as well.

This doesn't add conditionals which would avoid initializing
sub-registers, as that wouldn't pull its weight.

Signed-off-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
Link: https://lore.kernel.org/r/20230516093612.3536451-6-oswald.buddenhagen@gmx.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# a61c695a 16-May-2023 Oswald Buddenhagen <oswald.buddenhagen@gmx.de>

ALSA: emu10k1: remove useless resets of stop-on-loop-end bits

We initialize them at card init and don't touch them later, so there is
no need to reset them again at voice start.

Signed-off-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
Link: https://lore.kernel.org/r/20230516093612.3536451-4-oswald.buddenhagen@gmx.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 94dabafe 16-May-2023 Oswald Buddenhagen <oswald.buddenhagen@gmx.de>

ALSA: emu10k1: cleanup envelope register init

We (rightfully) don't enable the envelope engine for PCM voices, so any
related setup is entirely pointless - the EMU8K documentation makes that
very clear, and the fact that the various open drivers all use different
values to no observable detriment pretty much confirms it.

The remaining initializations are regrouped for clarity.

Signed-off-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
Link: https://lore.kernel.org/r/20230516093612.3536451-3-oswald.buddenhagen@gmx.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# bcdbd3b7 14-May-2023 Oswald Buddenhagen <oswald.buddenhagen@gmx.de>

ALSA: emu10k1: enable bit-exact playback, part 2: voice attenuation

The voice volume is a raw fractional multiplier that can't actually
represent 1.0. To still enable real pass-through, we now set the volume
to 0.5 (which results in no loss of precision, as the FX bus provides
fractional values) and scale up the samples in DSP code.

To maintain backwards compatibility with existing configuration files,
we rescale the values in the mixer controls. The range is extended
upwards from 0xffff to 0x1fffd, which actually introduces the
possibility of specifying an amplification.

There is still a minor incompatibility with user space, namely if
someone loaded custom DSP code. They'll just get half the volume, so
this doesn't seem like a big deal.

Signed-off-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
Link: https://lore.kernel.org/r/20230514170323.3408834-8-oswald.buddenhagen@gmx.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 1298bc97 14-May-2023 Oswald Buddenhagen <oswald.buddenhagen@gmx.de>

ALSA: emu10k1: enable bit-exact playback, part 1: DSP attenuation

Fractional multiplication with the maximal value 2^31-1 causes some tiny
distortion. Instead, we want to multiply with the full 2^31. The catch
is of course that this cannot be represented in the DSP's signed 32 bit
registers.

One way to deal with this is to encode 1.0 as a negative number and
special-case it. As a matter of fact, the SbLive! code path already
contained such code, though the controls never actually exercised it.

A more efficient approach is to use negative values, which actually
extend to -2^31. Accordingly, for all the volume adjustments we now use
the MAC1 instruction which negates the X operand.

The range of the controls in highres mode is extended downwards, so -1
is the new zero/mute. At maximal excursion, real zero is not mute any
more, but I don't think anyone will notice this behavior change. ;-)

That also required making the min/max/values in the control structs
signed. This technically changes the user space interface, but it seems
implausible that someone would notice - the numbers were actually
treated as if they were signed anyway (and in the actual mixer iface
they _are_). And without this change, the min value didn't even make
sense in the first place (and no-one noticed, because it was always 0).

Tested-by: Jonathan Dowland <jon@dow.land>
Signed-off-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
Link: https://lore.kernel.org/r/20230514170323.3408834-7-oswald.buddenhagen@gmx.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 60571ac9 14-May-2023 Oswald Buddenhagen <oswald.buddenhagen@gmx.de>

ALSA: emu10k1: automate encoding of sub-register definitions

The idea to encode the bitfield manipulation in the register address is
quite clever, but doing that by hand is ugly and error-prone. So derive
it automatically from the mask instead.

Macros cannot #define other macros, so we now declare enums instead.

This also adds macros for decoding the register definitions. These will
be used by later commits.

Signed-off-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
Link: https://lore.kernel.org/r/20230514170323.3408798-1-oswald.buddenhagen@gmx.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# f549466b 10-May-2023 Oswald Buddenhagen <oswald.buddenhagen@gmx.de>

ALSA: emu10k1: apply channel delay hack to all E-MU cards

Evidently, the channel delay bug exists in all E-MU cards; it's in the
Hana FPGA program, and was never fixed.

Note that the implementation is somewhat lazy - to localize the code
paths, we actually waste a GPR and a DSP instruction by keeping two
delay registers for the same physical source.

Signed-off-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
Link: https://lore.kernel.org/r/20230510173917.3073107-6-oswald.buddenhagen@gmx.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 7002cbd6 23-Apr-2023 Oswald Buddenhagen <oswald.buddenhagen@gmx.de>

ALSA: emu10k1: use high-level I/O in set_filterQ()

This makes the code shorter and more legible.

Signed-off-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
Link: https://lore.kernel.org/r/20230423181002.1246793-2-oswald.buddenhagen@gmx.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 8d60d5ca 22-Apr-2023 Oswald Buddenhagen <oswald.buddenhagen@gmx.de>

ALSA: emu10k1: use high-level I/O functions also during init

... and also use more pre-defined constants on the way (some of which
required adjustment).

Signed-off-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>

Link: https://lore.kernel.org/r/20230422161021.1143967-1-oswald.buddenhagen@gmx.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 2696d5a3 22-Apr-2023 Oswald Buddenhagen <oswald.buddenhagen@gmx.de>

ALSA: emu10k1: fixup DSP defines

Firstly, fix the distribution between public and private headers.
Otherwise, some of the already public macros wouldn't actually work, and
the SNDRV_EMU10K1_IOCTL_DBG_READ result for Audigy would be useless.

Secondly, add condition code registers for Audigy. These are just
aliases for selected constant registers, and thus are generation-
specific. At least A_CC_REG_ZERO is actually correct ...

Finally, shuffle around some defines to more logical places while at it,
and fix up some more comments.

Signed-off-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
Link: https://lore.kernel.org/r/20230422161021.1143903-7-oswald.buddenhagen@gmx.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 145ec1fd 22-Apr-2023 Oswald Buddenhagen <oswald.buddenhagen@gmx.de>

ALSA: emu10k1: pull in some register definitions from kX-project

For documentation purposes and later use.

Some pre-existing but (mostly) unused definitions were renamed for
consistency.

Signed-off-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
Link: https://lore.kernel.org/r/20230422161021.1143903-6-oswald.buddenhagen@gmx.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# ac9219d9 22-Apr-2023 Oswald Buddenhagen <oswald.buddenhagen@gmx.de>

ALSA: emu10k1: remove some bogus defines

Firstly, remove the FXWC_* defines - the comment on FXWC implies that
the relevant defines are the (A_)EXTOUT_* ones. It's unclear where this
came from - it was in the initial ALSA import, but neither the driver
from Creative nor kX-project have these defines.

Secondly, remove A_HR, which made plain no sense (was unused, and
clashed with FXRT). Amends commit cbb7d8f9b7b ("emu10k1: Update
registers defines for the Audigy 2/emu10k2.5").

Signed-off-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
Link: https://lore.kernel.org/r/20230422161021.1143903-5-oswald.buddenhagen@gmx.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# a062b103 22-Apr-2023 Oswald Buddenhagen <oswald.buddenhagen@gmx.de>

ALSA: emu10k1: eliminate some unused defines

One might be mislead to think that these mean anything.

Signed-off-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
Link: https://lore.kernel.org/r/20230422161021.1143903-4-oswald.buddenhagen@gmx.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 6815f535 22-Apr-2023 Oswald Buddenhagen <oswald.buddenhagen@gmx.de>

ALSA: emu10k1: fix lineup of EMU_HANA_* defines

The bit values are supposed to be internally indented by one step
relative to the register addresses.

Signed-off-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
Link: https://lore.kernel.org/r/20230422161021.1143903-3-oswald.buddenhagen@gmx.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# a869057c 22-Apr-2023 Oswald Buddenhagen <oswald.buddenhagen@gmx.de>

ALSA: emu10k1: comment updates

Move comments to better locations, de-duplicate, fix/remove incorrect/
outdated ones, add new ones, and unify spacing somewhat.

While at it, also add testing credits for Jonathan Dowland (SB Live!
Platinum) and myself (E-MU 0404b).

Signed-off-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
Link: https://lore.kernel.org/r/20230422161021.1143903-2-oswald.buddenhagen@gmx.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 6fb861bb 22-Apr-2023 Oswald Buddenhagen <oswald.buddenhagen@gmx.de>

ALSA: emu10k1: fix snd_emu1010_fpga_read() input masking for rev2 cards

Unlike the Alice2 chips used on 1st generation E-MU cards, the
Tina/Tina2 chips used on the 2nd gen cards have only six GPIN pins,
which means that we need to use a smaller mask. Failure to do so would
falsify the read data if the FPGA tried to raise an IRQ right at that
moment. This wasn't a problem so far, as we didn't actually enable FPGA
IRQs, but that's going to change soon.

Signed-off-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
Link: https://lore.kernel.org/r/20230422132430.1057490-1-oswald.buddenhagen@gmx.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 8b2dd46d 22-Apr-2023 Oswald Buddenhagen <oswald.buddenhagen@gmx.de>

ALSA: emu10k1: remove unused emu->pcm_playback_efx_substream field

Amends historic commit 27ae958cf6 ("emu10k1 driver - add multichannel
device hw:x,3 [2-8/8]").

Signed-off-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
Link: https://lore.kernel.org/r/20230422132430.1057468-2-oswald.buddenhagen@gmx.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# a1c87c0b 21-Apr-2023 Oswald Buddenhagen <oswald.buddenhagen@gmx.de>

ALSA: emu10k1: fix access to Audigy GPIO port

As the register definition clearly states, this is a 16-bit register,
yet we did all accesses as 32-bit. The writes in particular would have
the potential to clear the TIMER register (depending on how the bus/card
actually handles the too long writes).

This commit also introduces a separate define A_GPIO which aliases
A_IOCFG, which better reflects the distinct usage on E-MU cards.
This is done in the same commit to keep the churn down, as we're
touching all involved lines anyway.

Signed-off-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
Link: https://lore.kernel.org/r/20230421141006.1005539-2-oswald.buddenhagen@gmx.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 10f212bd 21-Apr-2023 Oswald Buddenhagen <oswald.buddenhagen@gmx.de>

ALSA: emu10k1: properly assert E-MU FPGA access constaints

Assert the validity of the registers and values, as them being out of
range would indicate an error in the driver. Consequently, don't bother
returning error codes; they were ignored everywhere anyway.

Signed-off-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
Link: https://lore.kernel.org/r/20230421141006.1005539-1-oswald.buddenhagen@gmx.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 02a0d9c2 21-Apr-2023 Oswald Buddenhagen <oswald.buddenhagen@gmx.de>

ALSA: emu10k1: clean up P16V part somewhat

Detach it better from the main PCM driver, which it really doesn't have
much in common with.

In particular, this moves the interrupt handler implementation into
p16v.c, and makes it access the substream runtime status more directly,
so it doesn't need to abuse structs snd_emu10k1_pcm and
snd_emu10k1_voice any more.

We don't need private pcm runtime data at all, as the only thing it was
used for (except the back-link to the substream) was the `running` flag.
So store that directly in runtime->private_data.

This somewhat radical strip-down shows that this driver contains some
complexity that was never actually utilized. I suppose the right way to
fully utilize the hardware in a simple way would be introducing more
substreams. This wouldn't require any of the removed code.

Signed-off-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>

Link: https://lore.kernel.org/r/20230421141006.1005452-7-oswald.buddenhagen@gmx.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 14a5c5a4 21-Apr-2023 Oswald Buddenhagen <oswald.buddenhagen@gmx.de>

ALSA: emu10k1: remove unused snd_emu10k1_voice.emu field

It was written, but never read from. Its value is available via the epcm
field.

Signed-off-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
Link: https://lore.kernel.org/r/20230421141006.1005452-5-oswald.buddenhagen@gmx.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# d4af7ca2 21-Apr-2023 Oswald Buddenhagen <oswald.buddenhagen@gmx.de>

ALSA: emu10k1: remove obsolete card type variable and defines

The use of the variable was removed in commit 2b637da5a1b ("clean up
card features"). That commit also broke user space (the ioctl
structure), at which point the defines became meaningless, so I don't
think purging them is a problem.

Signed-off-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
Link: https://lore.kernel.org/r/20230421141006.1005452-3-oswald.buddenhagen@gmx.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# e81995a8 21-Apr-2023 Oswald Buddenhagen <oswald.buddenhagen@gmx.de>

ALSA: emu10k1: clarify various fx8010.*_mask fields

extin_mask and extout_mask are used only by the SbLive! microcode, so
they have no effect on Audigy.

Eliminate fxbus_mask entirely, as it wasn't actually used for anything.

As a drive-by, remove the pointless pad1 field from struct
snd_emu10k1_fx8010 - it is not visible to user space, so it has no
binary compatibility constraints.

Signed-off-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
Link: https://lore.kernel.org/r/20230421141006.1005509-1-oswald.buddenhagen@gmx.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 79e8b218 15-Jul-2021 Takashi Iwai <tiwai@suse.de>

ALSA: emu10k1: Allocate resources with device-managed APIs

This patch converts the resource management in PCI emu10k1 driver with
devres as a clean up. Each manual resource management is converted
with the corresponding devres helper, the page allocations are done
with the devres helper, and the card object release is managed now via
card->private_free instead of a lowlevel snd_device.

This should give no user-visible functional changes.

Link: https://lore.kernel.org/r/20210715075941.23332-34-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 1a59d1b8 27-May-2019 Thomas Gleixner <tglx@linutronix.de>

treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 156

Based on 1 normalized pattern(s):

this program is free software you can redistribute it and or modify
it under the terms of the gnu general public license as published by
the free software foundation either version 2 of the license or at
your option any later version this program is distributed in the
hope that it will be useful but without any warranty without even
the implied warranty of merchantability or fitness for a particular
purpose see the gnu general public license for more details you
should have received a copy of the gnu general public license along
with this program if not write to the free software foundation inc
59 temple place suite 330 boston ma 02111 1307 usa

extracted by the scancode license scanner the SPDX license identifier

GPL-2.0-or-later

has been chosen to replace the boilerplate/reference in 1334 file(s).

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Reviewed-by: Allison Randal <allison@lohutok.net>
Reviewed-by: Richard Fontana <rfontana@redhat.com>
Cc: linux-spdx@vger.kernel.org
Link: https://lkml.kernel.org/r/20190527070033.113240726@linutronix.de
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 057666b6 09-Apr-2018 Takashi Iwai <tiwai@suse.de>

ALSA: emu10k1: Reduce GFP_ATOMIC allocation

The emu10k1 fx8010 code allocates each irq resource dynamically and
links to the list at PCM trigger callback. Due to the nature of
trigger callback, the allocation is done with GFP_ATOMIC, hence it
may fail more often. Moreover, the irq resource isn't big at all, and
using the kmalloc for this won't save many bytes, either.

This patch removes the dynamic allocation and embeds the irq resource
into struct snd_emu10k1_fx8010_pcm.irq field instead of keeping a
pointer. As a result, it simplifies the code and removes the
unnecessary GFP_ATOMIC usage.

Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 04f8773a 13-Feb-2018 Maciej S. Szmigiero <mail@maciej.szmigiero.name>

ALSA: emu10k1: add a IOMMU workaround

The Audigy 2 CA0102 chip (but most likely others from the emu10k1 family,
too) has a problem that from time to time it likes to do few DMA reads a
bit beyond its normal allocation and gets very confused if these reads get
blocked by a IOMMU.

For the first (reserved) page this happens multiple times at every
playback, for various synth pages it happens randomly, rarely for PCM
playback buffers and the page table memory itself.
All these reads seem to follow a similar pattern, observed read offsets
beyond the allocation end were 0x00, 0x40, 0x80 and 0xc0 (PCI cache line
multiples), so it looks like the device tries to accesses up to 256 extra
bytes.

As a workaround let's widen these DMA allocations by an extra page if we
detect that the device is behind a non-passthrough IOMMU (the DMA memory
should be relatively plenty on IOMMU systems).

Signed-off-by: Maciej S. Szmigiero <mail@maciej.szmigiero.name>
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# a4463c92 13-Feb-2018 Maciej S. Szmigiero <mail@maciej.szmigiero.name>

ALSA: emu10k1: remove reserved_page

The emu10k1-family chips need the first page (index 0) reserved in their
page tables for some reason (every emu10k1 driver I've checked does this
without much of an explanation).
Using the first page for normal samples results in a broken playback.

However, we already have a dummy page allocated - so called "silent page"
and, in fact, had always been setting it as the first page in the chip page
table because an initialization of every entry of the page table to point
to a silent page happens after and overwrites the reserved_page allocation.

So the only thing remaining to remove the reserved_page allocation is a
trivial change to the page allocation logic to ignore the first page entry
and start its allocations from the second entry (index 1).

Signed-off-by: Maciej S. Szmigiero <mail@maciej.szmigiero.name>
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# aeaa6203 02-Nov-2016 Takashi Iwai <tiwai@suse.de>

ALSA: emu10k1: Use workqueue instead of kthread for emu1010 fw polling

This patch is a cleanup of EMU1010 dock probing code in emu10k1 driver
to use work instead of kthread in a loop. The work is lighter and
easier to control than kthread, in general.

Instead of a loop with the explicit sleep, we do simply
delayed-schedule the work. At suspend/resume callbacks, the work is
canceled and restarted, respectively.

Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 7241ea55 28-Apr-2015 Peter Zubaj <pzubaj@marticonet.sk>

ALSA: emu10k1: Emu10k2 32 bit DMA mode

Looks like audigy emu10k2 (probably emu10k1 - sb live too) support two
modes for DMA. Second mode is useful for 64 bit os with more then 2 GB
of ram (fixes problems with big soundfont loading)

1) 32MB from 2 GB address space using 8192 pages (used now as default)
2) 16MB from 4 GB address space using 4096 pages

Mode is set using HCFG_EXPANDED_MEM flag in HCFG register.
Also format of emu10k2 page table is then different.

Signed-off-by: Peter Zubaj <pzubaj@marticonet.sk>
Tested-by: Takashi Iwai <tiwai@suse.de>
Cc: <stable@vger.kernel.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 6cbbfe1c 28-Jan-2015 Takashi Iwai <tiwai@suse.de>

ALSA: Include linux/io.h instead of asm/io.h

Nowadays it's recommended. Replace all in a shot.

Signed-off-by: Takashi Iwai <tiwai@suse.de>


# bb814c39 01-Jan-2015 Lars-Peter Clausen <lars@metafoo.de>

ALSA: emu10k1: Remove always NULL parameters

The various PCM and hwdep allocation functions in this driver take a pointer
to a pointer of a PCM/hwdep where if this parameter is provided the newly
allocated object is stored. All callers pass NULL though, so remove the
parameter.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# f1eaaf8f 10-Mar-2014 Geert Uytterhoeven <geert@linux-m68k.org>

Revert "ALSA: emu10k1: Fix warning: "CCR" redefined"

This reverts commit 83fc3bc09518d42e8f5073e2a65884701dfadf19.

sh-specific "CCR" and "CCR2" have been prefixed by "SH_" in commit
a5f6ea29f9a918403629f8369ae55fac6b09cb53 ('sh: prefix sh-specific "CCR" and
"CCR2" by "SH_"').

Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# e08b34e8 23-Apr-2013 Takashi Iwai <tiwai@suse.de>

ALSA: emu10k1: Fix dock firmware loading

The commit [b209c4df: ALSA: emu10k1: cache emu1010 firmware] broke the
firmware loading of the dock, just (mistakenly) ignoring a different
firmware for docks on some models. This patch revives them again.

Bugzilla: https://bugs.archlinux.org/task/34865
Reported-and-tested-by: Tobias Powalowski <tobias.powalowski@googlemail.com>
Cc: <stable@vger.kernel.org> [v3.8+]
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 4f86f120 22-Nov-2012 Takashi Iwai <tiwai@suse.de>

ALSA: emu10k1: don't update firmware during suspend/resume

Add a flag to suppress the update in emu1010_firmware_thread() during
suspend/resume.

Signed-off-by: Takashi Iwai <tiwai@suse.de>


# b209c4df 22-Nov-2012 Takashi Iwai <tiwai@suse.de>

ALSA: emu10k1: cache emu1010 firmware

Instead of calling request_firmware() at each time, keep the obtained
firmware internally and reuse it.

Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 674e95ca 09-Oct-2012 David Howells <dhowells@redhat.com>

UAPI: (Scripted) Disintegrate include/sound

Signed-off-by: David Howells <dhowells@redhat.com>
Acked-by: Arnd Bergmann <arnd@arndb.de>
Acked-by: Thomas Gleixner <tglx@linutronix.de>
Acked-by: Michael Kerrisk <mtk.manpages@gmail.com>
Acked-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
Acked-by: Dave Jones <davej@redhat.com>


# c7561cd8 14-Aug-2012 Takashi Iwai <tiwai@suse.de>

ALSA: PCI: Replace CONFIG_PM with CONFIG_PM_SLEEP

Otherwise we may get compile warnings due to unused functions.

Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 83fc3bc0 17-Oct-2010 Nobuhiro Iwamatsu <nobuhiro.iwamatsu.yj@renesas.com>

ALSA: emu10k1: Fix warning: "CCR" redefined

CCR is defined in emu10k1, but SuperH is defined too.
If user use this driver with SuperH, it becomes a double definition.

Signed-off-by: Nobuhiro Iwamatsu <nobuhiro.iwamatsu.yj@renesas.com>
Cc: Paul Mundt <lethal@linux-sh.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 56385a12 18-Aug-2010 Jaroslav Kysela <perex@perex.cz>

ALSA: emu10k1 - delay the PCM interrupts (add pcm_irq_delay parameter)

With some hardware combinations, the PCM interrupts are acknowledged
before the period boundary from the emu10k1 chip. The midlevel PCM code
gets confused and the playback stream is interrupted.

It seems that the interrupt processing shift by 2 samples is enough
to fix this issue. This default value does not harm other,
non-affected hardware.

More information: Kernel bugzilla bug#16300

[A copmile warning fixed by tiwai]

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
Cc: <stable@kernel.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# f9f35677 26-Feb-2009 Arnd Bergmann <arnd@arndb.de>

emu101k1.h: fix duplicate include of <linux/types.h>

Impact: cleanup

The earlier patch 'make most exported headers use strict integer
types' accidentally includes <linux/types.h> both from the common and
from the kernel-only parts.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Acked-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>


# 9adfbfb6 25-Feb-2009 Arnd Bergmann <arnd@arndb.de>

make most exported headers use strict integer types

This takes care of all files that have only a small number
of non-strict integer type uses.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Cc: Mauro Carvalho Chehab <mchehab@redhat.com>
Cc: David Airlie <airlied@linux.ie>
Cc: Arnaldo Carvalho de Melo <acme@ghostprotocols.net>
Cc: YOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org>
Cc: netdev@vger.kernel.org
Cc: linux-ppp@vger.kernel.org
Cc: Jaroslav Kysela <perex@perex.cz>
Cc: Takashi Iwai <tiwai@suse.de>
Cc: David Woodhouse <dwmw2@infradead.org>
Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>


# d2cd74b1 02-Jun-2008 Takashi Iwai <tiwai@suse.de>

[ALSA] emu10k1 - Fix inverted Analog/Digital mixer switch on Audigy2

On Audigy2 Platinum, the Analog/Digital mixer switch is inverted.
https://bugzilla.novell.com/show_bug.cgi?id=396204

The patch adds a simple workaround.

There might be another device requiring a similar fix, too (or fix for
audigy2 generically), but right now I fix only the known broken one.

Signed-off-by: Takashi Iwai <tiwai@suse.de>


# c94fa4c9 10-Nov-2007 James Courtier-Dutton <James@superbug.co.uk>

[ALSA] emu10k1: General cleanup, add new locks, fix alsa bug#3501, kernel bug#9304.


Signed-off-by: James Courtier-Dutton <James@superbug.co.uk>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>


# 3839e4f1 21-Dec-2007 Takashi Iwai <tiwai@suse.de>

[ALSA] emu10k1 - Use enum for emu_model types

Use enum instead of digits for emu_model types.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>


# 1c02e366 13-Dec-2007 Ctirad Fertr <c.fertr@gmail.com>

[ALSA] emu10k1 - 1616(M) cardbus improvements

This patch improves E-Mu 1616(M) cardbus support. It adds definitions of the
new Microdock and 1010 cardbus registers (thanks again for descriptions
James) and improves mixer for this card. Now you can use S/PDIF and ADAT on
Mirodock and also use headpohone output on host cardbus card as another
independent output.

Signed-off-by: Ctirad Fertr <c.fertr@gmail.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>


# 190d2c46 04-Nov-2007 James Courtier-Dutton <James@superbug.co.uk>

[ALSA] snd:emu10k1: E-Mu updates. Fixes to firmware loading and support for 0404.


Signed-off-by: James Courtier-Dutton <James@superbug.co.uk>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>


# 44893a36 11-Nov-2007 James Courtier-Dutton <James@superbug.co.uk>

[ALSA] emu10k1: Add comments regarding E-Mu ins and outs.


Signed-off-by: James Courtier-Dutton <James@superbug.co.uk>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>


# c1017a4c 15-Oct-2007 Jaroslav Kysela <perex@perex.cz>

[ALSA] Changed Jaroslav Kysela's e-mail from perex@suse.cz to perex@perex.cz


Signed-off-by: Jaroslav Kysela <perex@perex.cz>


# c2d7051e 17-Sep-2007 Matthias Kaehlcke <matthias.kaehlcke@gmail.com>

[ALSA] Routines for effect processor FX8010: Use list_for_each_entry

Routines for effect processor FX8010: Use list_for_each_entry instead
of list_for_each

Signed-off-by: Matthias Kaehlcke <matthias.kaehlcke@gmail.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@suse.cz>


# f93abe51 26-Jul-2007 James Courtier-Dutton <James@superbug.co.uk>

[ALSA] snd-emu10k1:Implement SPDIF/ADAT status.


Signed-off-by: James Courtier-Dutton <James@superbug.co.uk>
Signed-off-by: Jaroslav Kysela <perex@suse.cz>


# 42f53226 23-Jul-2007 James Courtier-Dutton <James@superbug.co.uk>

[ALSA] snd-emu10k1:Improves firmware loading for E-Mu cards.

Details:
Fixes http://bugzilla.kernel.org/show_bug.cgi?id=8176

Signed-off-by: James Courtier-Dutton <James@superbug.co.uk>
Signed-off-by: Jaroslav Kysela <perex@suse.cz>


# 90fd5ce5 23-Jul-2007 James Courtier-Dutton <James@superbug.co.uk>

[ALSA] snd-emu10k1: Add support for E-Mu 1616 PCI, 1616M PCI, 0404 PCI, E-Mu

Notebook.
Description: The .device=0x0008 chips have new, but different EMU32 in/out
channels. Driver updated to make use of these EMU32 channels.

Signed-off-by: James Courtier-Dutton <James@superbug.co.uk>
Signed-off-by: Jaroslav Kysela <perex@suse.cz>


# 13d45709 10-Jun-2007 Pavel Hofman <dustin@seznam.cz>

[ALSA] emu10k1 - EMU 1212 with 16 capture channels

* adding 8 more 32-bit capture channels (total of 16) for emu1010 cards
* adding some code comments and card details description

Signed-off-by: Pavel Hofman <dustin@seznam.cz>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@suse.cz>


# 5dc5ebb7 09-Feb-2007 Clemens Ladisch <clemens@ladisch.de>

[ALSA] emu10k1: fix typo

fix a typo

Signed-off-by: Clemens Ladisch <clemens@ladisch.de>
Signed-off-by: Jaroslav Kysela <perex@suse.cz>


# 0cb29ea0 29-Jan-2007 Takashi Iwai <tiwai@suse.de>

[ALSA] Add even more 'const' to everything related to TLV

Mark TLV data as 'const'
Signed-of-by: Philipp Matthias Hahn <pmhahn@pmhahn.de>

Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@suse.cz>


# f7ba7fc6 19-Jan-2007 Takashi Iwai <tiwai@suse.de>

[ALSA] emu10k1 - Fix ABI for older ld10k1

Fix ABI for older ld10k1. When no EMU10K1_PVERSION ioctl is issued,
the driver accepts ioctls with the old struct size without TLV information.
Also, changed the struct field to make the conversion easier from the
old to the new structs.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@suse.cz>


# cbb7d8f9 13-Dec-2006 James Courtier-Dutton <James@superbug.co.uk>

[ALSA] emu10k1: Update registers defines for the Audigy 2/emu10k2.5


Signed-off-by: James Courtier-Dutton <James@superbug.co.uk>
Signed-off-by: Jaroslav Kysela <perex@suse.cz>


# 184c1e2c 06-Dec-2006 James Courtier-Dutton <James@superbug.co.uk>

[ALSA] emu10k1: Add Audio capture support for Audigy 2 ZS Notebook.

Implement functionallity in order to fixe ALSA bug#2058.

Signed-off-by: James Courtier-Dutton <James@superbug.co.uk>
Signed-off-by: Jaroslav Kysela <perex@suse.cz>


# b0dbdaea 10-Oct-2006 James Courtier-Dutton <James@superbug.co.uk>

[ALSA] snd-emu10k1: Add emu1010 internal clock rate control for 44100 or 48000.


Signed-off-by: James Courtier-Dutton <James@superbug.co.uk>
Signed-off-by: Jaroslav Kysela <perex@suse.cz>


# 9148cc50 09-Oct-2006 James Courtier-Dutton <James@superbug.co.uk>

[ALSA] snd_emu10k1: Added support for 14dB Attenuation PADS on DACs and ADCs.


Signed-off-by: James Courtier-Dutton <James@superbug.co.uk>
Signed-off-by: Jaroslav Kysela <perex@suse.cz>


# 9f4bd5dd 01-Oct-2006 James Courtier-Dutton <James@superbug.co.uk>

[ALSA] snd-emu10k1: Added support for emu1010, including E-Mu 1212m and E-Mu 1820m


Signed-off-by: James Courtier-Dutton <James@superbug.co.uk>
Signed-off-by: Jaroslav Kysela <perex@suse.cz>


# 7d12e780 05-Oct-2006 David Howells <dhowells@redhat.com>

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)


# 31508f83 22-Jul-2006 James Courtier-Dutton <James@superbug.co.uk>

[ALSA] snd-emu10k1: Implement dB gain infomation.


Signed-off-by: James Courtier-Dutton <James@superbug.co.uk>
Signed-off-by: Jaroslav Kysela <perex@suse.cz>


# 21fdddea 09-Apr-2006 James Courtier-Dutton <James@superbug.co.uk>

[ALSA] emu10k1: Add support for Audigy4 (not Pro)

Signed-off-by: James Courtier-Dutton <James@superbug.co.uk>


# 62932df8 16-Jan-2006 Ingo Molnar <mingo@elte.hu>

[ALSA] semaphore -> mutex (PCI part)

Semaphore to mutex conversion.

The conversion was generated via scripts, and the result was validated
automatically via a script as well.

Signed-off-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 27fe864e 21-Dec-2005 James Courtier-Dutton <James@superbug.co.uk>

[ALSA] snd-emu10k1: Removes some distortion from Audigy 2 ZS Notebook.

Modules: EMU10K1/EMU10K2 driver

Description:
Part way to fix ALSA bug#927
Add support for the SPI interface on the CA0108 chip.
This is used to control the registers on the DAC.
Headphone output tested.
Other outputs and Capture not tested yet.
Note: The red LED does not come on, but sound is still OK.

Signed-off-by: James Courtier-Dutton <James@superbug.co.uk>


# 19b99fba 04-Dec-2005 James Courtier-Dutton <James@superbug.co.uk>

[ALSA] emu10k1: Partial support for Creative emu1212m

Modules: EMU10K1/EMU10K2 driver

Distorted sound now comes from the Audio Out socket. Still more work to do.

Signed-off-by: James Courtier-Dutton <James@superbug.co.uk>


# 09668b44 17-Nov-2005 Takashi Iwai <tiwai@suse.de>

[ALSA] emu10k1 - Add PM support

Modules: EMU10K1/EMU10K2 driver

Add PM support to emu10k1 driver.

Signed-off-by: Takashi Iwai <tiwai@suse.de>


# eb4698f3 17-Nov-2005 Takashi Iwai <tiwai@suse.de>

[ALSA] Remove xxx_t typedefs: PCI emu10k1

Modules: EMU10K1/EMU10K2 driver

Remove xxx_t typedefs from the PCI emu10k1 driver.

Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 9529a5ba 25-Oct-2005 Lee Revell <rlrevell@joe-job.com>

[ALSA] emu10k1 - Use 31 bit DMA mask for Audigy

Modules: EMU10K1/EMU10K2 driver

It appears that either the Audigy DMA engine or the Linux kernel cannot
handle 32 bit DMA with this device. Problem manifests as noise when
using more than 2GB of RAM, possibly only on 64 bit machines.

The OSS driver actually uses a 29 bit DMA mask for both devices, this
seems like overkill for now.

Signed-off-by: Lee Revell <rlrevell@joe-job.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# d83c671f 31-Oct-2005 James Courtier-Dutton <James@superbug.co.uk>

[PATCH] Creative Audigy 2 cardbus: Add IO window wakeup magic

This adds the magic IO wakeup code for the CardBus version of the
Creative Labs Audigy 2 to the snd-emu10k1 driver.

Without the magic IO enable sequence, reading from the IO region of the
card will fail spectacularly, and the machine will hang.

My next task will be getting the driver to actually play sound without
distortion.

Signed-off-by: James Courtier-Dutton <James@superbug.co.uk>

[ This is a work-in-progress, but since it avoids a total lockup
if the emu10k module is loaded on a machine with the cardbus
card inserted, we're better off with it than without it, even
if sound quality is bad right now ]

Signed-off-by: Linus Torvalds <torvalds@osdl.org>


# f12aa40c 30-Sep-2005 Takashi Iwai <tiwai@suse.de>

[ALSA] emu10k1 - Fix loading of SBLive Game board

EMU10K1/EMU10K2 driver
Fixed the error at loading SBLive Game board (and possible other models).
The PCI SSIDs of this board conflicts with SB Live 5.1 Platinum, which has
no AC97 chip.

Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 8cdfd251 07-Sep-2005 Takashi Iwai <tiwai@suse.de>

[ALSA] Remove superfluous PCI ID definitions

CS46xx driver,EMU10K1/EMU10K2 driver,PCM Midlevel,Trident driver
YMFPCI driver,BT87x driver,CMIPCI driver,CS4281 driver
ENS1370/1+ driver,ES1938 driver,ES1968 driver,Intel8x0 driver
Intel8x0-modem driver,Maestro3 driver,RME32 driver,RME96 driver
SonicVibes driver,VIA82xx driver,ALI5451 driver,ICE1712 driver
ICE1724 driver,NM256 driver,RME HDSP driver,RME9652 driver
Remove superfluous PCI ID definitions.

Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 67ed4161 29-Jul-2005 Clemens Ladisch <clemens@ladisch.de>

[ALSA] sound - fix .iface field of mixer control elements

Documentation,CS46xx driver,EMU10K1/EMU10K2 driver,AD1848 driver
SB16/AWE driver,CMIPCI driver,ENS1370/1+ driver,RME32 driver
RME96 driver,ICE1712 driver,ICE1724 driver,KORG1212 driver
RME HDSP driver,RME9652 driver
This patch changes .iface to SNDRV_CTL_ELEM_IFACE_MIXER whre _PCM or
_HWDEP was used in controls that are not associated with a specific PCM
(sub)stream or hwdep device, and changes some controls that got
inconsitent .iface values due to copy+paste errors. Furthermore, it
makes sure that all control that do use _PCM or _HWDEP use the correct
number in the .device field.

Signed-off-by: Clemens Ladisch <clemens@ladisch.de>


# e66bc8b2 06-Jul-2005 James Courtier-Dutton <James@superbug.co.uk>

[ALSA] emu10k1: Add module option uint subsystem.

EMU10K1/EMU10K2 driver
It allows the user to force the snd-emu10k1 module to think the user
has a particular sound card. Useful if their particular sound card
is not yet recognised.

Signed-off-by: James Courtier-Dutton <James@superbug.co.uk>


# f927c8fc 07-May-2005 James Courtier-Dutton <James@superbug.co.uk>

[ALSA] Implement different capture sources.

EMU10K1/EMU10K2 driver
e.g. When HD Capture source is set to SPDIF,
setting HD Capture channel to 0 captures from CDROM digital input.
setting HD Capture channel to 1 captures from SPDIF in.

Signed-off-by: James Courtier-Dutton <James@superbug.co.uk>


# 14c7e472 04-May-2005 James Courtier-Dutton <James@superbug.co.uk>

[ALSA] Update A_SAMPLE_RATE register details.

EMU10K1/EMU10K2 driver


Signed-off-by: James Courtier-Dutton <James@superbug.co.uk>


# 001f7589 09-Apr-2005 James Courtier-Dutton <James@superbug.co.uk>

[ALSA] Improve SPDIF playback via the P16V/CA0151 chip.

EMU10K1/EMU10K2 driver
Although we can set 44100 as the output rate, the SPDIF can do it, but the Analog output cannot.
The SPDIF has the bug, whereby the Left channel arrives one sample late, so although we don't do any resampling,
it is not good for AC3 non-audio output.

Signed-off-by: James Courtier-Dutton <James@superbug.co.uk>


# bdaed502 07-Apr-2005 Takashi Iwai <tiwai@suse.de>

[ALSA] Check revision for the proper detection of audigy 2

EMU10K1/EMU10K2 driver
Check ther revision to detect non-listed audigy 2 boards.

Signed-off-by: Takashi Iwai <tiwai@suse.de>


# aec72e0a 30-Mar-2005 Takashi Iwai <tiwai@suse.de>

[ALSA] Use old default id strings for compatibility

EMU10K1/EMU10K2 driver
Use expliciitly the old default id strings for backward compatibility.
This will make 'alsactl restore' working again.

Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 2b637da5 30-Mar-2005 Lee Revell <rlrevell@joe-job.com>

[ALSA] clean up card features

EMU10K1/EMU10K2 driver
This patch converts the emu10k1 driver to use the card capabilities
structure for some more things.

Not extensively tested but seems to work.

Signed-off-by: Lee Revell <rlrevell@joe-job.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 6e4abc40 26-Mar-2005 James Courtier-Dutton <James@superbug.co.uk>

[ALSA] Adds Capture to P16V chip.

EMU10K1/EMU10K2 driver
One can select which capture source, but one cannot yet set volumes.

Signed-off-by: James Courtier-Dutton <James@superbug.co.uk>


# 1da177e4 16-Apr-2005 Linus Torvalds <torvalds@ppc970.osdl.org>

Linux-2.6.12-rc2

Initial git repository build. I'm not bothering with the full history,
even though we have it. We can create a separate "historical" git
archive of that later if we want to, and in the meantime it's about
3.2GB when imported into git - space that would just make the early
git days unnecessarily complicated, when we don't have a lot of good
infrastructure for it.

Let it rip!