History log of /linux-master/sound/pci/echoaudio/echoaudio.h
Revision Date Author Comments
# f8f137a7 07-Feb-2024 Takashi Iwai <tiwai@suse.de>

ALSA: echoaudio: Simplify with DEFINE_SIMPLE_DEV_PM_OPS()

Use the new DEFINE_SIMPLE_DEV_PM_OPS() instead of SIMPLE_DEV_PM_OPS()
for code-simplification. We need no longer CONFIG_PM_SLEEP ifdefs.

This ends up with the allocation of firmware caches if it's not really
used without CONFIG_PM, but the code simplification should justify the
cost.

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


# 9c211bf3 15-Jul-2021 Takashi Iwai <tiwai@suse.de>

ALSA: echoaudio: Allocate resources with device-managed APIs

This patch converts the resource management in PCI echoaudio drivers
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.
The irq handler is still managed manually because it's re-acquired at
PM suspend/resume.

This should give no user-visible functional changes.

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


# 85cb905d 03-Aug-2020 Takashi Iwai <tiwai@suse.de>

ALSA: echoaduio: Drop superfluous volatile modifier

The dsp_registers field of struct echoaduio has the volatile modifier,
but it's basically superfluous; the field is accessed only for the
base pointer of readl() and writel(), hence marking with __iomem alone
should suffice. OTOH, having the volatile prefix causes a compile
warning like:
sound/pci/echoaudio/echoaudio.c:1878:14: warning: passing argument 1 of 'iounmap' discards 'volatile' qualifier from pointer target type [-Wdiscarded-qualifiers]

So it's better to drop this superfluous modifier.

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


# a0b224b9 08-Jul-2020 Mark Hills <mark@xwax.org>

ALSA: echoaudio: Address bugs in the interrupt handling

Distorted audio appears occasionally, affecting either playback or
capture and requiring the affected substream to be closed by all
applications and re-opened.

The best way I have found to reproduce the bug is to use dmix in
combination with Chromium, which opens the audio device multiple times
in threads. Anecdotally, the problems appear to have increased with
faster CPUs. I ruled out 32-bit counter wrapping; it often happens
much earlier.

Since applying this patch I have not had problems, where previously
they would occur several times a day.

The patch targets the following issues:

* Check for progress using the counter from the hardware, not after it
has been truncated to the buffer.

This is a clean way to address a possible bug where if a whole
ringbuffer advances between interrupts, it goes unnoticed.

* Move last_period state from chip to pipe

This more logically belongs as part of pipe, and code is reasier to
read if it is "counter position last time a period elapsed".

Now the code has no references to period count. A period is just
when the regular counter crosses a threshold. This increases
readability and reduces scope for bugs.

* Treat period notification and buffer advance independently:

This helps to clarify what is the responsibility of the interrupt
handler, and what is pcm_pointer().

Removing shared state between these operations means race conditions
are fixed without introducing locks. Synchronisation is only around
the read of pipe->dma_counter. There may be cache line contention
around "struct audiopipe" but I did not have cause to profile this.

Pay attention to be robust where dma_counter wrapping is not a
multiple of period_size or buffer_size.

This is a revised patch based on feedback from Takashi and Giuliano.

Signed-off-by: Mark Hills <mark@xwax.org>
Link: https://lore.kernel.org/r/20200708101848.3457-5-mark@xwax.org
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 027c7002 08-Jul-2020 Mark Hills <mark@xwax.org>

ALSA: echoaudio: Race conditions around "opencount"

Use of atomics does not make these statements robust:

atomic_inc(&chip->opencount);
if (atomic_read(&chip->opencount) > 1 && chip->rate_set)
chip->can_set_rate=0;

and

if (atomic_read(&chip->opencount)) {
if (chip->opencount) {
changed = -EAGAIN;
} else {
changed = set_digital_mode(chip, dmode);

It would be necessary to atomically increment or decrement the value
and use the returned result. And yet we still need to prevent other
threads making use of "can_set_rate" while we set it.

However in all but one case the atomic is misleading as they are already
running with "mode_mutex" held.

Decisions are made on mode setting are often intrinsically connected
to "opencount" because some operations are not permitted unless
there is sole ownership.

So instead simplify this, and use "mode_mutex" as a lock for all reference
counting and mode setting.

Signed-off-by: Mark Hills <mark@xwax.org>
Link: https://lore.kernel.org/r/20200708101848.3457-2-mark@xwax.org
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 2a833a02 25-Jul-2018 Takashi Iwai <tiwai@suse.de>

ALSA: echoaudio: Proper endian notations

Many data fields defined in echoaudio drivers are in little-endian,
hence they should be defined with __le16 or __le32. This makes it
easier to catch the forgotten conversions.

Spotted by sparse, a warning like:
sound/pci/echoaudio/echoaudio_dsp.c:990:36: warning: incorrect type in assignment (different base types)

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


# afe5da3e 24-May-2018 Takashi Iwai <tiwai@suse.de>

ALSA: echoaudio: Drop superfluous macro

Drop pci_device() macro that just leads to chip->pci->dev, and pass it
directly to request_firmware(). It was introduced for allowing the
external alsa-driver kernel module builds. Since it was discontinued
years ago, we should clean it up now.

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


# 3f6175ec 10-Aug-2015 Mark Brown <broonie@kernel.org>

ALSA: echoaudio: Use standard C definitions of true and false

The echoaudio locally defines TRUE and FALSE. Not only is this
redundant given that C now has a boolean type it results in lots of
warnings as other headers also define these macros, causing duplicate
definitions. Fix this by removing the local defines and converting all
local users to use the standard C true and false instead, simply
removing the macros is less safe due to implicit inclusion of the other
definitons.

[fixed overlooked replacement of FALSE by tiwai]

Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# b5b4a41b 03-Nov-2014 Sudip Mukherjee <sudipm.mukherjee@gmail.com>

ALSA: echoaudio: remove all snd_printk

removed all references of snd_printk with the standard dev_* macro.

[a few places degraded to dev_dbg(), too -- tiwai]

Signed-off-by: Sudip Mukherjee <sudip@vectorindia.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# e3690869 03-Nov-2014 Sudip Mukherjee <sudipm.mukherjee@gmail.com>

ALSA: echoaudio: add reference of struct echoaudio

added reference of struct echoaudio to free_firmware function.
this structure will be later used to get a reference of the card
when converting snd_printk to dev_* in the next patch of the series.

Signed-off-by: Sudip Mukherjee <sudip@vectorindia.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# e23e7a14 05-Dec-2012 Bill Pemberton <wfp5p@virginia.edu>

ALSA: pci: remove __dev* attributes

CONFIG_HOTPLUG is going away as an option. As result the __dev*
markings will be going away.

Remove use of __devinit, __devexit_p, __devinitdata, __devinitconst,
and __devexit.

Signed-off-by: Bill Pemberton <wfp5p@virginia.edu>
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 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>


# 47b5d028 14-Feb-2010 Giuliano Pochini <pochini@shiny.it>

ALSA: Echoaudio - Add suspend support #2

This patch adds rearranges parts of the initialization code and adds
suspend and resume callbacks.

This patch adds suspend and resume callbacks.
It also rearranges parts of the initialization code so it can be
used in both the first initialization (when the module is loaded we
also have to load default settings) and the resume callback (where
we have to restore the previous settings).

Signed-off-by: Giuliano Pochini <pochini@shiny.it>
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 4f8ada44 14-Feb-2010 Giuliano Pochini <pochini@shiny.it>

ALSA: Echoaudio - Add firmware cache #2

This patch implements a simple cache for the firmware files when CONFIG_PM is defined.

This patch changes get_firmware(), free_firmware() and adds
free_firmware_cache(). The first two functions implement a very
simple cache and the latter is used to actually release all the stored
firmwares when the module is unloaded.
When CONFIG_PM is not enabled those functions act as before, that is
free_firmware() releases the firmware immediately and
free_firmware_cache() does nothing.

Signed-off-by: Giuliano Pochini <pochini@shiny.it>
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 19b50063 14-Feb-2010 Giuliano Pochini <pochini@shiny.it>

ALSA: Echoaudio - Add firmware cache #1

Changes the way the firmware is passed through functions.

When CONFIG_PM is enabled the firmware cannot be released because the
driver will need it again to resume the card.
With this patch the firmware is passed as an index of the struct
firmware card_fw[] in place of a pointer. That same index is then used
to locate the firmware in the firmware cache.

Signed-off-by: Giuliano Pochini <pochini@shiny.it>
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# a2328d02 18-Mar-2009 Giuliano Pochini <pochini@shiny.it>

ALSA: Echoaudio: add support for Indigo express cards

This patch adds support for IndigoIOx and IndigoDJx.

Signed-off-by: Giuliano Pochini <pochini@shiny.it>
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# befceea9 03-Dec-2007 Takashi Iwai <tiwai@suse.de>

[ALSA] echoaudio - convert from semaphore to mutex

Converted from semaphore to mutex.

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


# dd7b254d 28-Jun-2006 Giuliano Pochini <pochini@shiny.it>

[ALSA] Add echoaudio sound drivers

From: Giuliano Pochini <pochini@shiny.it>Add echoaudio sound drivers (darla20, darla24, echo3g, gina20, gina24,
indigo, indigodj, indigoio, layla20, lala24, mia, mona)

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