History log of /linux-master/sound/pci/rme9652/hdspm.c
Revision Date Author Comments
# 2c759890 23-Mar-2023 Tom Rix <trix@redhat.com>

ALSA: hdspm: remove unused copy_u32_le function

clang with W=1 reports
sound/pci/rme9652/hdspm.c:6149:19: error: unused function
'copy_u32_le' [-Werror,-Wunused-function]
static inline int copy_u32_le(void __user *dest, void __iomem *src)
^
This function is not used so remove it.

Signed-off-by: Tom Rix <trix@redhat.com>
Link: https://lore.kernel.org/r/20230323202713.2637150-1-trix@redhat.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# eab521ae 11-Apr-2022 Takashi Iwai <tiwai@suse.de>

ALSA: hdspm: Fix the missing snd_card_free() call at probe error

The previous cleanup with devres may lead to the incorrect release
orders at the probe error handling due to the devres's nature. Until
we register the card, snd_card_free() has to be called at first for
releasing the stuff properly when the driver tries to manage and
release the stuff via card->private_free().

This patch fixes it by calling snd_card_free() manually on the error
from the probe callback.

Fixes: 0195ca5fd1f4 ("ALSA: hdspm: Allocate resources with device-managed APIs")
Cc: <stable@vger.kernel.org>
Link: https://lore.kernel.org/r/20220412102636.16000-37-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 0195ca5f 15-Jul-2021 Takashi Iwai <tiwai@suse.de>

ALSA: hdspm: Allocate resources with device-managed APIs

This patch converts the resource management in PCI hdspm driver with
devres as a clean up. Each manual resource management is converted
with the corresponding 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-47-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 790f5719 21-Mar-2021 Tong Zhang <ztong0001@gmail.com>

ALSA: hdspm: don't disable if not enabled

hdspm wants to disable a not enabled pci device, which makes kernel
throw a warning. Make sure the device is enabled before calling disable.

[ 1.786391] snd_hdspm 0000:00:03.0: disabling already-disabled device
[ 1.786400] WARNING: CPU: 0 PID: 182 at drivers/pci/pci.c:2146 pci_disable_device+0x91/0xb0
[ 1.795181] Call Trace:
[ 1.795320] snd_hdspm_card_free+0x58/0xa0 [snd_hdspm]
[ 1.795595] release_card_device+0x4b/0x80 [snd]
[ 1.795860] device_release+0x3b/0xa0
[ 1.796072] kobject_put+0x94/0x1b0
[ 1.796260] put_device+0x13/0x20
[ 1.796438] snd_card_free+0x61/0x90 [snd]
[ 1.796659] snd_hdspm_probe+0x97b/0x1440 [snd_hdspm]

Suggested-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Tong Zhang <ztong0001@gmail.com>
Link: https://lore.kernel.org/r/20210321153840.378226-3-ztong0001@gmail.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 6417f031 16-Mar-2021 Leon Romanovsky <leon@kernel.org>

module: remove never implemented MODULE_SUPPORTED_DEVICE

MODULE_SUPPORTED_DEVICE was added in pre-git era and never was
implemented. We can safely remove it, because the kernel has grown
to have many more reliable mechanisms to determine if device is
supported or not.

Signed-off-by: Leon Romanovsky <leonro@nvidia.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>


# 75b1a8f9 04-Jan-2021 Joe Perches <joe@perches.com>

ALSA: Convert strlcpy to strscpy when return value is unused

strlcpy is deprecated. see: Documentation/process/deprecated.rst

Change the calls that do not use the strlcpy return value to the
preferred strscpy.

Done with cocci script:

@@
expression e1, e2, e3;
@@

- strlcpy(
+ strscpy(
e1, e2, e3);

This cocci script leaves the instances where the return value is
used unchanged.

After this patch, sound/ has 3 uses of strlcpy() that need to be
manually inspected for conversion and changed one day.

$ git grep -w strlcpy sound/
sound/usb/card.c: len = strlcpy(card->longname, s, sizeof(card->longname));
sound/usb/mixer.c: return strlcpy(buf, p->name, buflen);
sound/usb/mixer.c: return strlcpy(buf, p->names[index], buflen);

Miscellenea:

o Remove trailing whitespace in conversion of sound/core/hwdep.c

Link: https://lore.kernel.org/lkml/CAHk-=wgfRnXz0W3D37d01q3JFkr_i_uTL=V6A6G1oUZcprmknw@mail.gmail.com/

Signed-off-by: Joe Perches <joe@perches.com>
Acked-by: Mark Brown <broonie@kernel.org>
Link: https://lore.kernel.org/r/22b393d1790bb268769d0bab7bacf0866dcb0c14.camel@perches.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 704cbc4e 19-Nov-2020 Gustavo A. R. Silva <gustavoars@kernel.org>

ALSA: hdspm: Fix fall-through warnings for Clang

In preparation to enable -Wimplicit-fallthrough for Clang, fix a warning
by explicitly adding a break statement instead of letting the code fall
through to the next case.

Link: https://github.com/KSPP/linux/issues/115
Signed-off-by: Gustavo A. R. Silva <gustavoars@kernel.org>
Link: https://lore.kernel.org/r/3f70182b366fca7e085a3b57cb2eb193be04eed8.1605896059.git.gustavoars@kernel.org
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# ad260989 19-Oct-2020 Tom Rix <trix@redhat.com>

ALSA: remove unneeded break

A break is not needed if it is preceded by a return, goto
or break

Signed-off-by: Tom Rix <trix@redhat.com>
Acked-by: Mark Brown <broonie@kernel.org>
Link: https://lore.kernel.org/r/20201019164857.27223-1-trix@redhat.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 7dcd5612 08-Oct-2020 Naoki Hayama <naoki.hayama@lineo.co.jp>

ALSA: hdspm: Fix typo arbitary

Fix comment typo.
s/arbitary/arbitrary/

Signed-off-by: Naoki Hayama <naoki.hayama@lineo.co.jp>
Link: https://lore.kernel.org/r/e04a8c5b-8c59-3f02-34d3-c1a871d08cc2@lineo.co.jp
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# a2e527c5 02-Sep-2020 Takashi Iwai <tiwai@suse.de>

ALSA: hdspm: Replace tasklet with work

The tasklet is an old API that should be deprecated, usually can be
converted to another decent API. In HDSP-MADI driver, a tasklet is
still used for offloading the MIDI I/O handling (optional via mixer
switch). It can be achieved gracefully with a work queued, too.

This patch replaces the tasklet usage in HDSP-MADI driver with a
simple work. The conversion is fairly straightforward. The only
significant difference is that the work initialization is moved to the
right place in snd_hdspm_create() and cancel_work_sync() is always
called in snd_hdspm_free() to assure killing the pending works.

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


# 1a1575a1 01-Sep-2020 Allen Pais <allen.lkml@gmail.com>

ALSA: hdsp: convert tasklets to use new tasklet_setup() API

In preparation for unconditionally passing the
struct tasklet_struct pointer to all tasklet
callbacks, switch to using the new tasklet_setup()
and from_tasklet() to pass the tasklet pointer explicitly.

Signed-off-by: Romain Perier <romain.perier@gmail.com>
Signed-off-by: Allen Pais <allen.lkml@gmail.com>
Link: https://lore.kernel.org/r/20200902040221.354941-6-allen.lkml@gmail.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# ab3ee092 02-Jul-2020 Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>

ALSA: pci/rme9652/hdspm: remove always true condition

Fix W=1 warning:

sound/pci/rme9652/hdspm.c: In function ‘hdspm_autosync_ref’:
sound/pci/rme9652/hdspm.c:3030:16: warning: comparison of unsigned
expression >= 0 is always true [-Wtype-limits]
3030 | if ((syncref >= HDSPM_AES32_AUTOSYNC_FROM_WORD) &&
| ^~

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20200702193604.169059-16-pierre-louis.bossart@linux.intel.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 4bdc0d67 06-Jan-2020 Christoph Hellwig <hch@lst.de>

remove ioremap_nocache and devm_ioremap_nocache

ioremap has provided non-cached semantics by default since the Linux 2.6
days, so remove the additional ioremap_nocache interface.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Acked-by: Arnd Bergmann <arnd@arndb.de>


# e315cc3f 05-Jan-2020 Takashi Iwai <tiwai@suse.de>

ALSA: hdspm: More constifications

Apply const prefix to each possible place: the string arrays, the
channel map tables and callers.

Just for minor optimization and no functional changes.

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


# b4e5e707 03-Jan-2020 Takashi Iwai <tiwai@suse.de>

ALSA: pci: Constify snd_kcontrol_new items

Most of snd_kcontrol_new definitions are read-only and passed as-is.
Let's declare them as const for further optimization.

There should be no functional changes by this patch.

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


# c1c3981f 03-Jan-2020 Takashi Iwai <tiwai@suse.de>

ALSA: pci: Constify snd_pcm_hardware definitions

Most of snd_pcm_hardware definitions are just copied to another object
as-is, hence we can define them as const for further optimization.

There should be no functional changes by this patch.

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


# 39cccf45 09-Dec-2019 Takashi Iwai <tiwai@suse.de>

ALSA: rme9652: Support PCM sync_stop

The driver invokes snd_pcm_period_elapsed() simply from the interrupt
handler. Set card->sync_irq for enabling the missing sync_stop PCM
operation.

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


# 1a810436 05-Nov-2019 Takashi Iwai <tiwai@suse.de>

ALSA: rme: Avoid non-standard macro usage

Pass the device pointer from the PCI pointer directly, instead of a
non-standard macro. The macro didn't give any better readability.

Along with it, drop the unnecessary assignment before the
snd_dma_alloc_pages() call and simplify by returning the error code
directly.

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


# 16ccca11 05-Nov-2019 Takashi Iwai <tiwai@suse.de>

ALSA: pci: Drop superfluous snd_pcm_sgbuf_ops_page

snd_pcm_sgbuf_ops_page is no longer needed to be set explicitly to PCM
page ops since the recent change in the PCM core (*). Leaving it NULL
should work as long as the preallocation has been done properly.

This patch drops the redundant lines.

(*) 7e8edae39fd1: ALSA: pcm: Handle special page mapping in the
default mmap handler

Link: https://lore.kernel.org/r/20191105151856.10785-19-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>


# e4e07c6c 23-May-2019 Philippe Bekaert <Philippe.Bekaert@panokkel.be>

ALSA: hdspm: Fix single speed ADAT capture and playback with RME HDSPe AIO

By taking into account the mapping from logical to DMA channels when
enabling or disabling audio channels, ADAT channels 3 to 8 on the RME
HDSPe AIO card are now correctly captured and played back in single speed
mode.

Since the mapping is an identity mapping for all cards except AIO and
RayDAT, only those cards should be affected by this patch. It was tested on
an AIO card. The patch needs testing on other cards, in particular RayDAT.

Note: this patch does not solve ADAT capture and playback issues in double
or triple speed mode. That seems to be another problem.

Signed-off-by: Philippe Bekaert <Philippe.Bekaert@panokkel.be>
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 47f2769b 04-Feb-2019 Takashi Iwai <tiwai@suse.de>

ALSA: pci: Clean up with new procfs helpers

Simplify the proc fs creation code with new helper functions,
snd_card_ro_proc_new() and snd_card_rw_proc_new().
Just a code refactoring and no functional changes.

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


# 5116b94a 04-Feb-2019 Takashi Iwai <tiwai@suse.de>

ALSA: pci: Drop superfluous PCM preallocation error checks

snd_pcm_lib_preallocate_pages() and co always succeed, so the error
check is simply redundant. Drop it.

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


# 1bb6d9e2 26-Aug-2018 Colin Ian King <colin.king@canonical.com>

ALSA: hdspm: fix spelling mistake "Initializeing" -> "Initializing"

Trivial fix to spelling mistake in dev_dbg message and also remove
extraneous white space and repeated question marks.

Signed-off-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 10513142 24-Apr-2018 Takashi Iwai <tiwai@suse.de>

ALSA: hdspm: Hardening for potential Spectre v1

As recently Smatch suggested, a couple of places in HDSP MADI driver
may expand the array directly from the user-space value with
speculation:
sound/pci/rme9652/hdspm.c:5717 snd_hdspm_channel_info() warn: potential spectre issue 'hdspm->channel_map_out' (local cap)
sound/pci/rme9652/hdspm.c:5734 snd_hdspm_channel_info() warn: potential spectre issue 'hdspm->channel_map_in' (local cap)

This patch puts array_index_nospec() for hardening against them.

BugLink: https://marc.info/?l=linux-kernel&m=152411496503418&w=2
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Cc: <stable@vger.kernel.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 7211ec63 25-Oct-2017 Kees Cook <keescook@chromium.org>

ALSA: Convert timers to use timer_setup()

In preparation for unconditionally passing the struct timer_list
pointer to all timer callbacks, switch to using the new timer_setup()
and from_timer() to pass the timer pointer explicitly. These are all the
"mechanical" changes remaining in the sound subsystem.

Signed-off-by: Kees Cook <keescook@chromium.org>
Acked-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# e35e9ddf 05-Sep-2017 Markus Elfring <elfring@users.sourceforge.net>

ALSA: hdspm: Use common error handling code in snd_hdspm_probe()

Add a jump target so that a bit of exception handling can be better reused
at the end of this function.

This issue was detected by using the Coccinelle software.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# da2ea374 12-Aug-2017 Markus Elfring <elfring@users.sourceforge.net>

ALSA: rme9652: Adjust seven checks for null pointers

The script “checkpatch.pl” pointed information out like the following.

Comparison to NULL could be written …

Thus fix the affected source code places.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 7dfec507 12-Aug-2017 Markus Elfring <elfring@users.sourceforge.net>

ALSA: rme9652: Improve eight size determinations

Replace the specification of data structures by variable references
as the parameter for the operator "sizeof" to make the corresponding size
determination a bit safer according to the Linux coding style convention.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 9dba5429 12-Aug-2017 Markus Elfring <elfring@users.sourceforge.net>

ALSA: rme9652: Delete an error message for a failed memory allocation in snd_hdspm_create()

Omit an extra message for a memory allocation failure in this function.

This issue was detected by using the Coccinelle software.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 7ad210ac 18-Jul-2017 Arnd Bergmann <arnd@arndb.de>

ALSA: rme9652: fix format overflow warnings

gcc-7 warns about a possible sprintf format string overflow with a
temporary buffer that is used to print from another buffer of the same
size:

sound/pci/rme9652/hdspm.c: In function 'snd_hdspm_create_alsa_devices':
sound/pci/rme9652/hdspm.c:2123:17: error: ' MIDIoverMADI' directive writing 13 bytes into a region of size between 1 and 32 [-Werror=format-overflow=]

This extends the temporary buffer to twice the size, and changes
the code to use the safer snprintf() across the entire file.
The longer buffer is still necessary to avoid a format-truncation
warning.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# bdf84db7 07-Jun-2017 Takashi Iwai <tiwai@suse.de>

ALSA: hdspm: Constify hw_constraints

snd_pcm_hw_constraint_list(), *_ratnums() and *_ratdens() receive the
const pointers. Constify the corresponding static objects for better
hardening.

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


# 485885b9 05-Jan-2017 Takashi Iwai <tiwai@suse.de>

ALSA: pci: Constify snd_rawmidi_ops

Now snd_rawmidi_ops is maintained as a const pointer in snd_rawmidi,
we can constify the definitions.

Reviewed-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 6769e988 01-Sep-2016 Julia Lawall <Julia.Lawall@lip6.fr>

ALSA: constify snd_pcm_ops structures

Check for snd_pcm_ops structures that are only stored in the ops field of a
snd_soc_platform_driver structure or passed as the third argument to
snd_pcm_set_ops. The corresponding field or parameter is declared const,
so snd_pcm_ops structures that have this property can be declared as const
also.

The semantic patch that makes this change is as follows:
(http://coccinelle.lip6.fr/)

// <smpl>
@r disable optional_qualifier@
identifier i;
position p;
@@
static struct snd_pcm_ops i@p = { ... };

@ok1@
identifier r.i;
struct snd_soc_platform_driver e;
position p;
@@
e.ops = &i@p;

@ok2@
identifier r.i;
expression e1, e2;
position p;
@@
snd_pcm_set_ops(e1, e2, &i@p)

@bad@
position p != {r.p,ok1.p,ok2.p};
identifier r.i;
struct snd_pcm_ops e;
@@
e@i@p

@depends on !bad disable optional_qualifier@
identifier r.i;
@@
static
+const
struct snd_pcm_ops i = { ... };
// </smpl>

Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 07cb3272 21-Aug-2016 Colin Ian King <colin.king@canonical.com>

ALSA: hdspm: fix spelling mistake "Externel" -> "External"

Trivial fix to spelling mistake in dev_warn message.

Signed-off-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# c1099c32 29-Feb-2016 Takashi Iwai <tiwai@suse.de>

ALSA: hdspm: Fix zero-division

HDSPM driver contains a code issuing zero-division potentially in
system sample rate ctl code. This patch fixes it by not processing
a zero or invalid rate value as a divisor, as well as excluding the
invalid value to be passed via the given ctl element.

Cc: <stable@vger.kernel.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 537e4813 29-Feb-2016 Takashi Iwai <tiwai@suse.de>

ALSA: hdspm: Fix wrong boolean ctl value accesses

snd-hdspm driver accesses enum item values (int) instead of boolean
values (long) wrongly for some ctl elements. This patch fixes them.

Cc: <stable@vger.kernel.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# b4ffc1be 18-Oct-2015 Lars-Peter Clausen <lars@metafoo.de>

ALSA: rme9652: Use snd_pcm_hw_constraint_single()

Use the new snd_pcm_hw_constraint_single() helper function instead of
calling snd_pcm_hw_constraint_minmax() with the same value for min and max
to install a constraint that limits the possible configuration values to a
single value. Using snd_pcm_hw_constraint_single() makes the indented
result clearer.

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


# 0c8d9485 16-Feb-2015 Adrian Knoth <aknoth@google.com>

ALSA: hdspm - DRY cleanup of snd_pcm_ops

This commit removes code duplication between
snd_hdspm_{capture,playback}_ops. No semantic changes intended, this is
purely cosmetic.

Signed-off-by: Adrian Knoth <aknoth@google.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 8b73b867 16-Feb-2015 Adrian Knoth <aknoth@google.com>

ALSA: hdspm - DRY cleanup in .release callback

This commit removes code duplication between
snd_hdspm_{capture,playback}_release. No semantic changes intended, this
is purely cosmetic.

Signed-off-by: Adrian Knoth <aknoth@google.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 5ecc5dc7 16-Feb-2015 Adrian Knoth <aknoth@google.com>

ALSA: hdspm - DRY cleanup in .open callbacks

This commit removes code duplication between
snd_hdspm_{capture,playback}_open. No semantic changes intended, this is
purely cosmetic.

Signed-off-by: Adrian Knoth <aknoth@google.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# f0153c3d 10-Feb-2015 Adrian Knoth <adi@drcomp.erfurt.thur.de>

ALSA: hdspm - Constrain periods to 2 on older cards

RME RayDAT and AIO use a fixed buffer size of 16384 samples. With period
sizes of 32-4096, this translates to 4-512 periods.

The older RME cards have a variable buffer size but require exactly two
periods.

This patch enforces nperiods=2 on those cards.

Signed-off-by: Adrian Knoth <adi@drcomp.erfurt.thur.de>
Cc: <stable@vger.kernel.org> # 2.6.39+
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>


# 04018e13 19-Jan-2015 Takashi Iwai <tiwai@suse.de>

ALSA: hdspm: Use setup_timer() and mod_timer()

No functional change, refactoring with the standard helpers.

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


# ff6defa6 03-Jan-2015 Markus Elfring <elfring@users.sourceforge.net>

ALSA: Deletion of checks before the function call "iounmap"

The iounmap() function performs also input parameter validation.
Thus the test around the call is not needed.

This issue was detected by using the Coccinelle software.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# ddcecf6b 10-Nov-2014 Takashi Iwai <tiwai@suse.de>

ALSA: Fix invalid kerneldoc markers

They are no real kerneldoc comments, so drop such markers.

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


# df57de17 29-Oct-2014 Sudip Mukherjee <sudipm.mukherjee@gmail.com>

ALSA: hdspm: remove unused variable

removed the unused variables. These variables were only being
assigned some value, but the values were never being used.

it has been build tested after removing the variables.

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


# c69a637b 20-Oct-2014 Takashi Iwai <tiwai@suse.de>

ALSA: hdspm: Use snd_ctl_enum_info()

... and reduce the open codes.

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


# 9baa3c34 08-Aug-2014 Benoit Taine <benoit.taine@lip6.fr>

PCI: Remove DEFINE_PCI_DEVICE_TABLE macro use

We should prefer `struct pci_device_id` over `DEFINE_PCI_DEVICE_TABLE` to
meet kernel coding style guidelines. This issue was reported by checkpatch.

A simplified version of the semantic patch that makes this change is as
follows (http://coccinelle.lip6.fr/):

// <smpl>

@@
identifier i;
declarer name DEFINE_PCI_DEVICE_TABLE;
initializer z;
@@

- DEFINE_PCI_DEVICE_TABLE(i)
+ const struct pci_device_id i[]
= z;

// </smpl>

[bhelgaas: add semantic patch]
Signed-off-by: Benoit Taine <benoit.taine@lip6.fr>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>


# e3a471d6 25-Feb-2014 Takashi Iwai <tiwai@suse.de>

ALSA: hdspm: Use standard printk helpers

Convert with dev_err() and co from snd_printk(), etc.

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


# 60c5772b 29-Jan-2014 Takashi Iwai <tiwai@suse.de>

ALSA: pci: Convert to snd_card_new() with a device pointer

Also remove superfluous snd_card_set_dev() calls.

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


# 57a4451d 29-Oct-2013 Takashi Iwai <tiwai@suse.de>

ALSA: Use strlcpy() instead of strncpy()

We tend to make stupid mistakes with strncpy(). Let's take a safer
one, strlcpy().

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


# bf69aa90 13-Sep-2013 Sachin Kamat <sachin.kamat@linaro.org>

ALSA: rme9652: Remove redundant break

'break' after return statement is not necessary.

Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 1568b880 19-Aug-2013 Adrian Knoth <adi@drcomp.erfurt.thur.de>

ALSA: hdspm - Use enums in hdspm_tco_ltc_frames()

This patch doesn't change functionality, it only improves readability
and fixes a copy&paste error in a comment.

Signed-off-by: Adrian Knoth <adi@drcomp.erfurt.thur.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 17d2f008 19-Aug-2013 Adrian Knoth <adi@drcomp.erfurt.thur.de>

ALSA: hdspm - Fix default value in SNDRV_HDSPM_IOCTL_GET_LTC

Use enum hdspm_ltc_format's fps_30 (corresponds to 4) instead of 30,
Other case branches return 1, 2 or 3 respectively, so 30 obviously is
wrong.

Since SNDRV_HDSPM_IOCTL_GET_LTC had never been working due to a
copy&paste error in hdspm.h, this change doesn't break userspace.

Signed-off-by: Adrian Knoth <adi@drcomp.erfurt.thur.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 68593c93 15-Jul-2013 Fengguang Wu <fengguang.wu@intel.com>

ALSA: hdspm - remove unneeded semicolon

sound/pci/rme9652/hdspm.c:1110:2-3: Unneeded semicolon

Generated by: coccinelle/misc/semicolon.cocci

Reported-by: Fengguang Wu <fengguang.wu@intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 69358fca 05-Jul-2013 Martin Dausel <martin.dausel@iosono-sound.com>

ALSA: hdspm - Added some comments and control register documentation

Signed-off-by: Martin Dausel <martin.dausel@iosono-sound.com>
Signed-off-by: Adrian Knoth <adi@drcomp.erfurt.thur.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 04659f9e 05-Jul-2013 Adrian Knoth <adi@drcomp.erfurt.thur.de>

ALSA: hdspm - Use snd_ctl_enum_info() in snd_hdspm_info_autosync_ref

Also use snd_ctl_enum_info() to fill the autosync text fields on AES32
and MADI cards (only users of snd_hdspm_info_autosync_ref).

Signed-off-by: Adrian Knoth <adi@drcomp.erfurt.thur.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# eb0d4dbf 05-Jul-2013 Adrian Knoth <adi@drcomp.erfurt.thur.de>

ALSA: hdspm - Use snd_ctl_enum_info() for texts_autosync

Also use snd_ctl_enum_info() to fill the autosync enumerated controls.

Signed-off-by: Adrian Knoth <adi@drcomp.erfurt.thur.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 38816545 05-Jul-2013 Adrian Knoth <adi@drcomp.erfurt.thur.de>

ALSA: hdspm - Use snd_ctl_enum_info for most text arrays

Use snd_ctl_enum_info() to fill most of the enumerated controls. More
non-trivial occurrences will follow in separate commits.

Signed-off-by: Adrian Knoth <adi@drcomp.erfurt.thur.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 0dc831b9 05-Jul-2013 Adrian Knoth <adi@drcomp.erfurt.thur.de>

ALSA: hdspm - AES32: Enable TCO support

This patch finally enables TCO support on RME AES(32) cards.

Signed-off-by: Adrian Knoth <adi@drcomp.erfurt.thur.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 2d63ec38 05-Jul-2013 Adrian Knoth <adi@drcomp.erfurt.thur.de>

ALSA: hdspm - AES32: Report external sample rate to userspace

This patch adds a new ALSA control to read the external sample rate from
userspace on RME AES(32) cards.

Signed-off-by: Adrian Knoth <adi@drcomp.erfurt.thur.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 2336142f 05-Jul-2013 Adrian Knoth <adi@drcomp.erfurt.thur.de>

ALSA: hdspm - Introduce hdspm_external_rate_to_enum() helper function

This patch refactors the code to query the external sample rate and its
translation into the corresponding enum into a helper function to
prevent future code duplication.

A later commit will make use of this new helper function.

Signed-off-by: Adrian Knoth <adi@drcomp.erfurt.thur.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 194062da 05-Jul-2013 Adrian Knoth <adi@drcomp.erfurt.thur.de>

ALSA: hdspm - AES32: Include TCO and Sync-In in proc output

Also report TCO status and Sync-In via /proc/ on AES(32) cards.

Signed-off-by: Adrian Knoth <adi@drcomp.erfurt.thur.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 2d60fc7f 05-Jul-2013 Adrian Knoth <adi@drcomp.erfurt.thur.de>

ALSA: hdspm - AES32: Enable TCO/Sync-In in snd_hdspm_put_sync_ref()

This patch enables the user to select "TCO" and "Sync In" as a preferred
sync reference on RME AES(32) cards.

Signed-off-by: Adrian Knoth <adi@drcomp.erfurt.thur.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# dbae4a0c 05-Jul-2013 Adrian Knoth <adi@drcomp.erfurt.thur.de>

ALSA: hdspm - AES32: Enable TCO input in hdspm_external_sample_rate()

This patch adds support to read the TCO sample rate in
hdspm_external_sample_rate() on RME AES(32) cards.

Signed-off-by: Adrian Knoth <adi@drcomp.erfurt.thur.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 3ac9b0ac 05-Jul-2013 Adrian Knoth <adi@drcomp.erfurt.thur.de>

ALSA: hdspm - AES32: Ignore float/int format bit

As mentioned in the comment, the AES32 cards must not set the format
bit, since it is used to indicate the preferred sync setting instead.

We hence simply skip the corresponding part in the hw_params function.

Signed-off-by: Adrian Knoth <adi@drcomp.erfurt.thur.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 051c44fe 05-Jul-2013 Adrian Knoth <adi@drcomp.erfurt.thur.de>

ALSA: hdspm - Enable AES32 in hdspm_get_tco_sample_rate

This patch adds AES32 specific code to hdspm_get_tco_sample_rate to
query the TCO sample rate.

Signed-off-by: Adrian Knoth <adi@drcomp.erfurt.thur.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# a57fea8e 05-Jul-2013 Adrian Knoth <adi@drcomp.erfurt.thur.de>

ALSA: hdspm - Enable AES32 in hdspm_get_wc_sample_rate

This patch adds AES32 specific code to hdspm_get_wc_sample_rate() to
query the wordclock frequency.

Signed-off-by: Adrian Knoth <adi@drcomp.erfurt.thur.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 5b266354 05-Jul-2013 Adrian Knoth <adi@drcomp.erfurt.thur.de>

ALSA: hdspm - Add prototype declarations

This patch only introduces prototype declarations, no real change. The
functions themselves are already present.

Signed-off-by: Adrian Knoth <adi@drcomp.erfurt.thur.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# d3c36ed8 05-Jul-2013 Adrian Knoth <adi@drcomp.erfurt.thur.de>

ALSA: hdspm - Introduce hdspm_get_aes_sample_rate()

Helper function to return the AES sample rate class. This class needs to
be translated via HDSPM_bit2freq() to get the more common
representation.

Signed-off-by: Adrian Knoth <adi@drcomp.erfurt.thur.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# db2d1a91 05-Jul-2013 Adrian Knoth <adi@drcomp.erfurt.thur.de>

ALSA: hdspm - AES32: Add TCO and Sync-In text entries

Provide the text for the two new clock options "TCO" and "Sync In" on
AES32 cards.

Signed-off-by: Adrian Knoth <adi@drcomp.erfurt.thur.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 3c32de58 05-Jul-2013 Adrian Knoth <adi@drcomp.erfurt.thur.de>

ALSA: hdspm - AIO: Drop superfluous HDSPM_AUTOSYNC_REF

The HDSPM_AUTOSYNC_REF macro is only implemented for MADI and AES32
cards, so it doesn't make sense to call it on AIO boards.

Signed-off-by: Adrian Knoth <adi@drcomp.erfurt.thur.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# e71b95ad 05-Jul-2013 Adrian Knoth <adi@drcomp.erfurt.thur.de>

ALSA: hdspm - Cosmetics, no real change

This patch does nothing, it's sole intent is to clean up the code.

Signed-off-by: Adrian Knoth <adi@drcomp.erfurt.thur.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# b0bf5504 05-Jul-2013 Adrian Knoth <adi@drcomp.erfurt.thur.de>

ALSA: hdspm - AES32: Fix TCO sync check reporting

HDSPM_tco_lock and HDSPM_tcoLock were too close, so the previous code
didn't honour the difference between the two.

Let's be more verbose and use HDSPM_tcoLockMadi for MADI cards,
HDSPM_tcoLockAes for AES(32) and fix the code that makes use of both.

Signed-off-by: Adrian Knoth <adi@drcomp.erfurt.thur.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 5760107c 05-Jul-2013 Adrian Knoth <adi@drcomp.erfurt.thur.de>

ALSA: hdspm - Create TCO readout function

This patch separates the TCO bits from snd_hdspm_proc_read_madi(), so
the new function can later be shared between MADI and AES32 cards.

It's essentially only moving code around, no new functionality.

Signed-off-by: Adrian Knoth <adi@drcomp.erfurt.thur.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 1cb7dbf4 05-Jul-2013 Adrian Knoth <adi@drcomp.erfurt.thur.de>

ALSA: hdspm - Fix S/PDIF Sync status and frequency on RME AIO

This is a left-over mistake from old code, the correct register offset is
provided in kcontrol->private_value, not in the index.
Cf. RayDAT case, where it has already been corrected.

Signed-off-by: Adrian Knoth <adi@drcomp.erfurt.thur.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 3de9db26 05-Jul-2013 Adrian Knoth <adi@drcomp.erfurt.thur.de>

ALSA: hdspm - Add support for AEBs on RME AIO

AIO cards allow to use AEB (Analogue Expansion Boards) to add four
input and/or output channels.

This patch adds the necessary code to detect and enable the additional
I/O channels.

Signed-off-by: Adrian Knoth <adi@drcomp.erfurt.thur.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 42f4c12d 05-Jul-2013 Adrian Knoth <adi@drcomp.erfurt.thur.de>

ALSA: hdspm - Enable AD/DA/PH gains and S/PDIF-Input select on AIO

This patch uses the newly introduced HDSPM_CONTROL_TRISTATE functions to
create and expose the following ALSA controls:

- Gain selection for Input, Output and Phones (HiGain, +4dBu, -10dbV)
- S/PDIF Input select (Coaxial, Optical, Internal)

Signed-off-by: Adrian Knoth <adi@drcomp.erfurt.thur.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# acf14767 05-Jul-2013 Adrian Knoth <adi@drcomp.erfurt.thur.de>

ALSA: hdspm - Introduce generic AIO tristate control

AIO cards offer at least four individual settings options with three
states each. Those settings are represented as two bits in the settings
register with the following meaning:

0*some_base_bit --> Option value 0
1*some_base_bit --> Option value 1
2*some_base_bit --> Option value 2
3*some_base_bit --> mask to select the two involved bits

This patch adds a generic ALSA control macro for such a value-to-bit
pattern mapping. It will be used in a later commit to expose four new
controls.

Signed-off-by: Adrian Knoth <adi@drcomp.erfurt.thur.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 8cea5710 05-Jul-2013 Adrian Knoth <adi@drcomp.erfurt.thur.de>

ALSA: hdspm - Refactor ENUMERATED_CTL_INFO into function

ENUMERATED_CTL_INFO is a macro, so the binary code is generated multiple
times. To avoid code duplication, refactor the involved functionality
into a function and make ENUMERATED_CTL_INFO a call to this function.

Signed-off-by: Adrian Knoth <adi@drcomp.erfurt.thur.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# fb0f121e 05-Jul-2013 Adrian Knoth <adi@drcomp.erfurt.thur.de>

ALSA: hdspm - Add S/PDIF, XLR, WCK48 and ADAT-in controls for RME AIO cards

This commit adds the following ALSA controls:

- S/PDIF Out Optical to switch S/PDIF Out from coaxial to optical
- S/PDIF Out Professional to send the Pro bit in the output stream
- ADAT-Internal to enable ADAT/TDIF Expansion Board (AEB/TEB)
- XLR Breakout Cable if analogue I/O uses the XLR breakout cable
- WCK48 to force WordClock to the 32-48kHz range (single speed) if
the card is operating at higher frequencies

Signed-off-by: Adrian Knoth <adi@drcomp.erfurt.thur.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 11a5cd3c 05-Jul-2013 Adrian Knoth <adi@drcomp.erfurt.thur.de>

ALSA: hdspm - Add S/PDIF and WCK48 controls for RME RayDAT

This commit adds new ALSA controls to send single-speed WordClock and
S/PDIF-Professional on RME RayDAT cards.

Signed-off-by: Adrian Knoth <adi@drcomp.erfurt.thur.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 34be7ebb 05-Jul-2013 Adrian Knoth <adi@drcomp.erfurt.thur.de>

ALSA: hdspm - Drop duplicate code in hdspm_set_system_clock_mode()

hdspm_set_system_clock_mode() is almost a one-by-one copy of
hdspm_set_toggle_setting(). To improve code quality, remove the
duplication.

Signed-off-by: Adrian Knoth <adi@drcomp.erfurt.thur.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# ce13f3f3 05-Jul-2013 Adrian Knoth <adi@drcomp.erfurt.thur.de>

ALSA: hdspm - Augment HDSPM_TOGGLE_SETTING for AIO/RayDAT

The HDSPM_TOGGLE_SETTING functions alter the control_register on older
cards. On newer cards (AIO/RayDAT), they have to operate on the
settings_register instead.

This patch augments the existing functions to work with AIO/RayDAT, too.

Signed-off-by: Adrian Knoth <adi@drcomp.erfurt.thur.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# b2ed6326 05-Jul-2013 Adrian Knoth <adi@drcomp.erfurt.thur.de>

ALSA: hdspm - Introduce hdspm_is_raydat_or_aio()

RME RayDAT and AIO cards are new designs with different register
settings. Since we need to distinguish them from older cards multiple
times in the driver, refactor the code into a separate helper function.

No functional change intended.

Signed-off-by: Adrian Knoth <adi@drcomp.erfurt.thur.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 384f778f 05-Jul-2013 Adrian Knoth <adi@drcomp.erfurt.thur.de>

ALSA: hdspm - Add missing defines for RME AIO and RayDAT

The driver did not support all possible configurations. These defines
will be used by later commits to add the missing functionality.

Signed-off-by: Adrian Knoth <adi@drcomp.erfurt.thur.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 7b559397 30-May-2013 Adrian Knoth <adi@drcomp.erfurt.thur.de>

ALSA: hdspm - Allow SingleSpeed WordClock when in DS/QS mode

Similarly to MADI, WordClock can also be at SingleSpeed while the card
is actually working at twice or four times this rate. If so, multiply
the base rate accordingly.

Signed-off-by: Adrian Knoth <adi@drcomp.erfurt.thur.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# a8a729fa 30-May-2013 Adrian Knoth <adi@drcomp.erfurt.thur.de>

ALSA: hdspm - Refactor SS/DS/QS clock multiplier into function

When the DoubleSpeed or QuadSpeed bit is set, the SingleSpeed frequency
has to be multiplied accordingly. Since this functionality will be
required at least twice, refactor it into a separate function.

The second reference to the newly introduced hdspm_rate_multiplier()
will be in a separate commit.

Signed-off-by: Adrian Knoth <adi@drcomp.erfurt.thur.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# a8cd7148 30-May-2013 Adrian Knoth <adi@drcomp.erfurt.thur.de>

ALSA: hdspm - Add support for 128-192kHz WordClock input

Allow WordClock input rates of 128, 176.4 and 192kHz.

Signed-off-by: Adrian Knoth <adi@drcomp.erfurt.thur.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 20a24225 28-May-2013 Takashi Iwai <tiwai@suse.de>

ALSA: PCI: Remove superfluous pci_set_drvdata(pci, NULL) at remove

As drvdata is cleared to NULL at probe failure or at removal by the
driver core, we don't have to call pci_set_drvdata(pci, NULL) any
longer in each driver.

The only remaining pci_set_drvdata(NULL) is in azx_firmware_cb() in
hda_intel.c. Since this function itself releases the card instance,
we need to clear drvdata here as well, so that it won't be released
doubly in the remove callback.

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


# a817650e 09-Mar-2013 Adrian Knoth <adi@drcomp.erfurt.thur.de>

ALSA: hdspm - Enable new TCO ALSA controls

Expose the newly added TCO LTC and sync check functions to userspace.

Signed-off-by: Adrian Knoth <adi@drcomp.erfurt.thur.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# f99c7881 09-Mar-2013 Adrian Knoth <adi@drcomp.erfurt.thur.de>

ALSA: hdspm - Add ALSA controls to read the TCO LTC state

This patch adds new ALSA controls to query the LTC state from userspace.

Signed-off-by: Adrian Knoth <adi@drcomp.erfurt.thur.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 34542213 09-Mar-2013 Adrian Knoth <adi@drcomp.erfurt.thur.de>

ALSA: hdspm - Also check for TCO sync states

This patch prepares snd_hdspm_get_sync_check() to also check the TCO
sync state. The added feature will be exposed to the user in a later
commit.

Signed-off-by: Adrian Knoth <adi@drcomp.erfurt.thur.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# e5b7b1fe 09-Mar-2013 Adrian Knoth <adi@drcomp.erfurt.thur.de>

ALSA: hdspm - Remove duplicate code from ALSA controls

Considerably shorten the code by using a macro. Though this won't lower
the binary size, it makes the source more readable.

Signed-off-by: Adrian Knoth <adi@drcomp.erfurt.thur.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 696be0fb 09-Mar-2013 Adrian Knoth <adi@drcomp.erfurt.thur.de>

ALSA: hdspm - Provide ALSA control to disable 96K frames

For 96kHz, MADI allows to multiplex the samples (SMUX) or to use a
dedicated 96K mode. The RME cards default to 96K mode, but since not all
external MADI equipment supports this, provide a switch to users that
changes the on-wire protocol to SMUX.

Signed-off-by: Adrian Knoth <adi@drcomp.erfurt.thur.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# fcdc4ba1 09-Mar-2013 Adrian Knoth <adi@drcomp.erfurt.thur.de>

ALSA: hdspm - Allow the TCO and SYNC-IN to be used in slave mode

When using the additional Time Code Option module in slave mode or the
SYNC-In wordclock connector, the sample rate needs to be returned by
hdspm_external_sample_rate().

Since this sample rate may contain any value with 1Hz granularity, we
need to round it to a common rate as done by the OSX driver.

[Fixed missing function declarations by tiwai]

Signed-off-by: Adrian Knoth <adi@drcomp.erfurt.thur.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 3f7bf918 09-Mar-2013 Adrian Knoth <adi@drcomp.erfurt.thur.de>

ALSA: hdspm - Refactor sample rate acquisition

This commit introduces hdspm_get_pll_freq() to avoid code duplication.
Reading the sample rate from the DDS register will be required by
upcoming code.

Signed-off-by: Adrian Knoth <adi@drcomp.erfurt.thur.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 56bde0f3 09-Jan-2013 Andre Schramm <andre.schramm@iosono-sound.com>

ALSA: hdspm - Fix wordclock status on AES32

Use correct bitmask for AES32 cards to determine wordclock lock state,
add missing bitmask for sync check and make output of the corresponding
control and /proc coherent.

Signed-off-by: Andre Schramm <andre.schramm@iosono-sound.com>
Signed-off-by: Adrian Knoth <adi@drcomp.erfurt.thur.de>
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>


# 467b1035 03-Dec-2012 Adrian Knoth <adi@drcomp.erfurt.thur.de>

ALSA: hdspm - Remove obsolete settings functions

With HDSPM_TOGGLE_SETTING in place, these functions are no longer
required. Removing them makes the code DRY and considerably shorter.

Signed-off-by: Adrian Knoth <adi@drcomp.erfurt.thur.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# c9e1668c 03-Dec-2012 Adrian Knoth <adi@drcomp.erfurt.thur.de>

ALSA: hdspm - Use HDSPM_TOGGLE_SETTING to alter settings

HDSPM_TOGGLE_SETTING and its corresponding functions allow to change
settings in the control register. Instead of using the specialised
functions, use the generic code to make the code DRY.

Signed-off-by: Adrian Knoth <adi@drcomp.erfurt.thur.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# bf0ff87b 03-Dec-2012 Adrian Knoth <adi@drcomp.erfurt.thur.de>

ALSA: hdspm - Implement generic function to toggle settings

The driver contains at least six similar functions that change only a
single bit in the control register, only the bit position varies.

This patch implements a generic function to toggle a certain bit
position that will be used to replace the old code.

Signed-off-by: Adrian Knoth <adi@drcomp.erfurt.thur.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# d1a3c98d 07-Nov-2012 Adrian Knoth <adi@drcomp.erfurt.thur.de>

ALSA: hdspm - Fix sync check reporting on RME RayDAT

The RayDAT reports the sync status of its inputs in consecutive bit
positions, so all we do in hdspm_s1_sync_check is to iterate over idx:

status = hdspm_read(hdspm, HDSPM_RD_STATUS_1);

lock = (status & (0x1<<idx)) ? 1 : 0;
sync = (status & (0x100<<idx)) ? 1 : 0;

The index is given in kcontrol->private_value:

HDSPM_SYNC_CHECK("WC SyncCheck", 0),
HDSPM_SYNC_CHECK("AES SyncCheck", 1),
HDSPM_SYNC_CHECK("SPDIF SyncCheck", 2),
HDSPM_SYNC_CHECK("ADAT1 SyncCheck", 3),
HDSPM_SYNC_CHECK("ADAT2 SyncCheck", 4),
HDSPM_SYNC_CHECK("ADAT3 SyncCheck", 5),
HDSPM_SYNC_CHECK("ADAT4 SyncCheck", 6),
HDSPM_SYNC_CHECK("TCO SyncCheck", 7),
HDSPM_SYNC_CHECK("SYNC IN SyncCheck", 8),

The patch corrects the indicated sync flags by passing the proper index
value to hdspm_s1_sync_check().

Signed-off-by: Adrian Knoth <adi@drcomp.erfurt.thur.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# ec8f53fb 01-Nov-2012 Masanari Iida <standby24x7@gmail.com>

ALSA: Fix typo in drivers sound

Correct spelling typo in debug messages within drivers/sound

Signed-off-by: Masanari Iida <standby24x7@gmail.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# f27a64f9 19-Oct-2012 Adrian Knoth <adi@drcomp.erfurt.thur.de>

ALSA: hdspm - Fix coding style in CTL_ELEM macros

checkpatch.pl discourages the use of spaces at the beginning of lines.
Some of the CTL_ELEM defines were not properly indented.

This patch replaces the leading spaces by tabs. No functionality is
changed, the commit is purely cosmetic.

Signed-off-by: Adrian Knoth <adi@drcomp.erfurt.thur.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 930f4ff0 19-Oct-2012 Adrian Knoth <adi@drcomp.erfurt.thur.de>

ALSA: hdspm - Fix typo in kcontrol element on RME MADI cards

Signed-off-by: Adrian Knoth <adi@drcomp.erfurt.thur.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 9a215f47 19-Oct-2012 Adrian Knoth <adi@drcomp.erfurt.thur.de>

ALSA: hdspm - Fix sync_in detection on AES/AES32

According to the documentation, AES32 cards use a different bit position
for reporting the sync_in status.

Signed-off-by: Adrian Knoth <adi@drcomp.erfurt.thur.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 2e0452f5 19-Oct-2012 Adrian Knoth <adi@drcomp.erfurt.thur.de>

ALSA: hdspm - Fix sync_in reporting on RME MADI cards

In contrast to AES32, MADI uses the first status register to report the
sync_in status.

Signed-off-by: Adrian Knoth <adi@drcomp.erfurt.thur.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# b8812c55 19-Oct-2012 Adrian Knoth <adi@drcomp.erfurt.thur.de>

ALSA: hdspm - Also report autosync_sample_rate on MADI and MADIface

MADI and MADIface used to report the autosync_sample_rate. This
functionality was lost in commit
0dca1793063c28dde8f6c49c9c72203fe5cb6efc, this commit now adds it back.

Signed-off-by: Adrian Knoth <adi@drcomp.erfurt.thur.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# d681deaa 19-Oct-2012 Adrian Knoth <adi@drcomp.erfurt.thur.de>

ALSA: hdspm - Fix reported autosync_sample_rate

Missing breaks lead to a fall-through, thus causing the wrong
autosync_sample_rate to be reported.

Signed-off-by: Adrian Knoth <adi@drcomp.erfurt.thur.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# fba30fd3 19-Oct-2012 Adrian Knoth <adi@drcomp.erfurt.thur.de>

ALSA: hdspm - Fix sync check reporting on all RME HDSPM cards

Due to missing breaks and the resulting fall-through, card subtype
selection was effectively missing, thus causing the wrong sync check
functions to be called.

Signed-off-by: Adrian Knoth <adi@drcomp.erfurt.thur.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 21a164df 19-Oct-2012 Adrian Knoth <adi@drcomp.erfurt.thur.de>

ALSA: hdspm - Report external rate in slave mode on PCI MADI

As a follow-up to a97bda7d29d02a2e9c6609d0947b15e55f5200e5, report the
external sample rate as system_sample_rate when in slave mode.

For PCIe MADI cards, the DDS value automatically contains the external
sample rate, but the PCI version needs this manual workaround.

Signed-off-by: Adrian Knoth <adi@drcomp.erfurt.thur.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 41285a98 19-Oct-2012 Adrian Knoth <adi@drcomp.erfurt.thur.de>

ALSA: hdspm - Allow DDS/Varispeed to be set from userspace

The DDS value is the actual physical sample rate. We set it indirectly
when selecting 44100, 48000 and so on via snd_hdspm_hw_params or
hdspm_set_clock_source.

This commit now allows the DDS value to be altered at runtime, thus
speeding up or slowing down the physical sample rate. This is required
for MADI's varispeed that allows for ±12.5% speed adjustment from the
"selected" rate (32kHz, 44100kHz, 48kHz and so on).

Signed-off-by: Adrian Knoth <adi@drcomp.erfurt.thur.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# b17cbdd8 19-Aug-2012 Julia Lawall <Julia.Lawall@lip6.fr>

ALSA: sound/pci/rme9652/hdspm.c: fix error return code

Convert a nonnegative error return code to a negative one, as returned
elsewhere in the function.

A simplified version of the semantic match that finds this problem is as
follows: (http://coccinelle.lip6.fr/)

// <smpl>
(
if@p1 (\(ret < 0\|ret != 0\))
{ ... return ret; }
|
ret@p1 = 0
)
... when != ret = e1
when != &ret
*if(...)
{
... when != ret = e2
when forall
return ret;
}

// </smpl>

Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# a97bda7d 30-May-2012 Adrian Knoth <adi@drcomp.erfurt.thur.de>

ALSA: hdspm - Work around broken DDS value on PCI RME MADI

On PCI RME MADI cards, the PLL register does not contain the proper
value, so the calculated system_sample_rate is wrong. In this case, we
simply return the cached rate from struct hdspm.

Signed-off-by: Adrian Knoth <adi@drcomp.erfurt.thur.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# e9f66d9b 23-Apr-2012 Takashi Iwai <tiwai@suse.de>

ALSA: pci: clean up using module_pci_driver()

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


# 8de5d6f1 08-Mar-2012 Adrian Knoth <adi@drcomp.erfurt.thur.de>

ALSA: hdspm - Provide ioctl_compat

snd_hdspm uses its own ioctls to acquire config- and status information.
Expose the corresponding ioctl handler via ioctl_compat, so that 32bit
applications can use it on 64bit kernels.

Signed-off-by: Adrian Knoth <adi@drcomp.erfurt.thur.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# f7de8ba3 10-Jan-2012 Adrian Knoth <adi@drcomp.erfurt.thur.de>

ALSA: hdspm - Provide unique driver id based on card serial

Before, /proc/asound looked like this:

2 [Default ]: HDSPM - RME RayDAT_f1cd85
RME RayDAT S/N 0xf1cd85 at 0xf7300000, irq 18

In case of a second HDSPM card, its name would be Default_1. This is
cumbersome, because the order of the cards isn't stable across reboots.

To help userspace tools referring to the correct card, this commit
provides a unique id for each card:

2 [HDSPMxf1cd85 ]: HDSPM - RME RayDAT_f1cd85
RME RayDAT S/N 0xf1cd85 at 0xf7300000, irq 18

In this example, userspace (configuration files) would then use
hw:HDSPMxf1cd85 to choose the right card.

The serial is masked to 24bits, so this string is always shorter than
sixteen chars.

Signed-off-by: Adrian Knoth <adi@drcomp.erfurt.thur.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 7d53a631 04-Jan-2012 Adrian Knoth <adi@drcomp.erfurt.thur.de>

ALSA: hdspm - Refactor serial number to avoid code duplication

The serial number is used multiple times in hdspm.c. Since it belongs
to the card, let's store it in struct hdspm and refer to it whenever
necessary.

Signed-off-by: Adrian Knoth <adi@drcomp.erfurt.thur.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# a67ff6a5 14-Dec-2011 Rusty Russell <rusty@rustcorp.com.au>

ALSA: module_param: make bool parameters really bool

module_param(bool) used to counter-intuitively take an int. In
fddd5201 (mid-2009) we allowed bool or int/unsigned int using a messy
trick.

It's time to remove the int/unsigned int option. For this version
it'll simply give a warning, but it'll break next kernel version.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 05c7cc9c 21-Nov-2011 Adrian Knoth <adi@drcomp.erfurt.thur.de>

ALSA: hdspm - Fix PCI ID for PCIe RME MADI cards

Commit c09403dcc5698abf214329fbbf3cf8dbb5558bea has introduced a
regression: PCIe versions of RME MADI were no longer detected, because
the MADIface ID (0xd5) was used instead of the correct 0xd2.

This commit fixes the problem.

Signed-off-by: Adrian Knoth <adi@drcomp.erfurt.thur.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 65a77217 15-Jul-2011 Paul Gortmaker <paul.gortmaker@windriver.com>

sound: fix drivers needing module.h not moduleparam.h

The implicit presence of module.h lured several users into
incorrectly thinking that they only needed/used modparam.h
but once we clean up the module.h presence, these will show
up as build failures, so fix 'em now.

Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>


# c09403dc 27-Oct-2011 Adrian Knoth <adi@drcomp.erfurt.thur.de>

ALSA: hdspm - Enable all firmware ranges for PCI MADI/AES cards

From the Windows INF file, we know the firmware ranges for all RME
cards. For PCIe, a single revision ID per device (RayDAT, MADI, AIO,
AES) is used. Contrary, the older PCI versions use ranges, that is,
one revision ID per firmware version.

Instead of listing all possible revisions individually, match the range.

This commit enables all MADI and AES PCI versions ever shipped.

Signed-off-by: Adrian Knoth <adi@drcomp.erfurt.thur.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 9e6ff520 27-Oct-2011 Adrian Knoth <adi@drcomp.erfurt.thur.de>

ALSA: hdspm - Fix MADI channel format in the status ioctl

SNDRV_HDSPM_IOCTL_GET_STATUS is supposed to query the current card
status, so we have to return what we receive on the MADI wire (RX), not
what we transmit (TX) to others. The latter is a config item to be
queried via SNDRV_HDSPM_IOCTL_GET_CONFIG.

Signed-off-by: Adrian Knoth <adi@drcomp.erfurt.thur.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 2ca595ab 23-Sep-2011 Dan Carpenter <dan.carpenter@oracle.com>

ALSA: hdspm - cleanup __user tags in ioctl()

This makes the code cleaner and silences a Sparse complaint:
sound/pci/rme9652/hdspm.c:6341:23: warning: incorrect type in assignment (incompatible argument 4 (different address spaces))
sound/pci/rme9652/hdspm.c:6341:23: expected int ( *ioctl )( ... )
sound/pci/rme9652/hdspm.c:6341:23: got int ( static [toplevel] *<noident> )( ... )
sound/pci/rme9652/hdspm.c:6102:44: warning: dereference of noderef expression
sound/pci/rme9652/hdspm.c:6225:50: warning: dereference of noderef expression
sound/pci/rme9652/hdspm.c:6264:50: warning: dereference of noderef expression
sound/pci/rme9652/hdspm.c:6283:50: warning: dereference of noderef expression
sound/pci/rme9652/hdspm.c:6289:59: warning: dereference of noderef expression

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 643d6bbb 23-Sep-2011 Dan Carpenter <dan.carpenter@oracle.com>

ALSA: hdspm - potential info leak in snd_hdspm_hwdep_ioctl()

Smatch has a new check for Rosenberg type information leaks where
structs are copied to the user with uninitialized stack data in them.

The status struct has a hole in it, and on some paths not all the
members were initialized.

struct hdspm_status {
unsigned char card_type; /* 0 1 */
/* XXX 3 bytes hole, try to pack */
enum hdspm_syncsource autosync_source; /* 4 4 */
long long unsigned int card_clock; /* 8 8 */

The hdspm_version struct had holes in it as well.

struct hdspm_version {
unsigned char card_type; /* 0 1 */
char cardname[20]; /* 1 20 */
/* XXX 3 bytes hole, try to pack */
unsigned int serial; /* 24 4 */
short unsigned int firmware_rev; /* 28 2 */
/* XXX 2 bytes hole, try to pack */
int addons; /* 32 4 */

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# d877681d 15-Aug-2011 Takashi Iwai <tiwai@suse.de>

ALSA: hdspm - Simplify with snd_pcm_hw_constraint_pow2()

Refactoring the code using snd_pcm_hw_constraint_pow2() helper function.

Tested-by: Adrian Knoth <adi@drcomp.erfurt.thur.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 3fa9e3d2 15-Aug-2011 Takashi Iwai <tiwai@suse.de>

ALSA: hdspm - Add missing KNOT flag for AES32 rate restriction

AES32 supports the non-standard 128kHZ, and this is enabled only when
SNDRV_PCM_RATE_KNOT is set in hw.rates field.

Tested-by: Adrian Knoth <adi@drcomp.erfurt.thur.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 52e6fb48 15-Aug-2011 Takashi Iwai <tiwai@suse.de>

ALSA: hdspm - Correct max buffer size limit

Some modesl can support up to 8192 frames per period.

Tested-by: Adrian Knoth <adi@drcomp.erfurt.thur.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 2e610270 14-Aug-2011 Adrian Knoth <adi@drcomp.erfurt.thur.de>

ALSA: hdspm - Enable 32 samples/period on RME RayDAT/AIO

Newer RME cards like RayDAT and AIO support 32 samples per period. This
value is encoded as {1,1,1} in the HDSP_LatencyMask bits in the control
register.

Since {1,1,1} is also the representation for 8192 samples/period on
older RME cards, we have to special case 32 samples and 32768 bytes
according to the actual card.

Signed-off-by: Adrian Knoth <adi@drcomp.erfurt.thur.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 7cb155ff 14-Aug-2011 Adrian Knoth <adi@drcomp.erfurt.thur.de>

ALSA: hdspm - Introduce hdspm_get_latency() to harmonize latency calculation

Currently, hdspm_decode_latency is called several times, violating the
DRY principle. Given that we need to distinguish between old and new
cards when decoding the latency bits in the control register, introduce
hdspm_get_latency() to provide the required functionality.

Signed-off-by: Adrian Knoth <adi@drcomp.erfurt.thur.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 1ad5972f 14-Aug-2011 Adrian Knoth <adi@drcomp.erfurt.thur.de>

ALSA: hdspm - Reorder period sizes according to their bit representation

On newer RME cards like RayDAT and AIO, the 8192 samples per period size
are no longer supported. Instead, setting all three bits of
HDSP_LatencyMask to one ({1,1,1}) now corresponds to 32 samples per
period.

To make this more obvious to future developers, let's reorder the array
according to their bit representation, starting at 64 ({0,0,0}) up to
4096 ({1,1,0}) and finally 32 ({1,1,1}).

Note that this patch doesn't change semantics.

Signed-off-by: Adrian Knoth <adi@drcomp.erfurt.thur.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 1b6fa108 14-Aug-2011 Adrian Knoth <adi@drcomp.erfurt.thur.de>

ALSA: hdspm - Set period_bytes_min to 32 * 4 for new RME cards

On newer RME cards like RayDAT and AIO, the lower bound is 32 samples
per period in contrast to 64 samples as seen on older cards.

We hence lower period_bytes_min to 32 * 4. Four bytes per sample.

Signed-off-by: Adrian Knoth <adi@drcomp.erfurt.thur.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 135d1535 14-Aug-2011 Adrian Knoth <adi@drcomp.erfurt.thur.de>

ALSA: hdspm - Allow for 8192 period size on RME MADI and AES cards

Older RME cards like MADI and AES support period sizes of 8192 samples.
The original hdspm driver already featured this value, apparently, it
was lost during the rewrite.

Signed-off-by: Adrian Knoth <adi@drcomp.erfurt.thur.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 3d56c8e6 04-Aug-2011 Takashi Iwai <tiwai@suse.de>

ALSA: hdspm - Fix uninitialized compile warnings

Put the exception checks for io_type switch() for possible mistakes in
future. Also this shuts up annoying compile warnings.

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


# 5f8b4d53 28-Jul-2011 Adrian Knoth <adi@drcomp.erfurt.thur.de>

ALSA: hdspm - Add firmware revision 0xcc for RME MADI

Apparently, there are multiple old firmware revisions in the wild for
the PCI RME MADI cards. Just add them to the list of supported devices
and treat them like their modern counterparts.

Signed-off-by: Adrian Knoth <adi@drcomp.erfurt.thur.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# d12c51d8 28-Jul-2011 Adrian Knoth <adi@drcomp.erfurt.thur.de>

ALSA: hdspm - Fix reported external sample rate on RME MADI and MADIface

In slave mode, the card can only detect the base frequency (32..48kHz)
on the MADI link (exception: 96k frames), so the real external sample
rate is this base frequency multiplied by 1, 2 or 4 depending on the
speed mode.

This patch enables 64..192kHz sample rates in clock slave mode, which
failed before due to an alleged sample rate mismatch between the MADI
link (e.g., 48kHz) and the application in DS/QS mode (e.g., 96kHz,
192kHz).

Signed-off-by: Adrian Knoth <adi@drcomp.erfurt.thur.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 700d1ef3 28-Jul-2011 Adrian Knoth <adi@drcomp.erfurt.thur.de>

ALSA: hdspm - Provide MADI speed mode selector on RME MADI and MADIface

When running in slave mode (no clock master), there is no way to
determine the real wirespeed on the MADI link (single/double/quad
speed). Like physical gear, simply provide the user with a tristate
switch to select the appropriate format.

Signed-off-by: Adrian Knoth <adi@drcomp.erfurt.thur.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 286bed0f 29-Jun-2011 Takashi Iwai <tiwai@suse.de>

ALSA: hdspm - Fix compile warnings with PPC

The char can be unsigned on some architectures. Since the code checks
the negative values, they should be declared as signed char explicitly.

sound/pci/rme9652/hdspm.c:5449: warning: comparison is always false due to limited range of data type
sound/pci/rme9652/hdspm.c:5462: warning: comparison is always false due to limited range of data type

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


# efef054e 12-Jun-2011 Adrian Knoth <adi@drcomp.erfurt.thur.de>

ALSA: hdspm - Add firmware revision ID for RME MADI PCI version

The PCI version of the RME HDSP MADI card uses 0xcf as revision ID. Just
add this to the list of supported cards.

Signed-off-by: Adrian Knoth <adi@drcomp.erfurt.thur.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# fedf1535 12-Jun-2011 Adrian Knoth <adi@drcomp.erfurt.thur.de>

ALSA: hdspm - Fix jumping external wordclock frequency in AutoSync mode

When using Word Clock on RME MADI cards, AutoSync mode was alternating
betweeen MADI and WC due to a typo: AutoSync is indicated in the second
status register (status2), not the first one (status).

While the proc output was always correct, the reported WC frequency to
ALSA was unstable as mentioned in

http://mailman.alsa-project.org/pipermail/alsa-devel/2008-March/006723.html

Signed-off-by: Adrian Knoth <adi@drcomp.erfurt.thur.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# c0da0014 12-Jun-2011 Adrian Knoth <adi@drcomp.erfurt.thur.de>

ALSA: hdspm - Fix locking in snd_hdspm_midi_input_read

For the MIDI part, we need to acquire (and release) the hmidi->lock,
access to the global hdspm structure is serialized through
hmidi->hdspm->lock instead.

Signed-off-by: Adrian Knoth <adi@drcomp.erfurt.thur.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 934c2b6d 10-Jun-2011 Takashi Iwai <tiwai@suse.de>

ALSA: use KBUILD_MODNAME for request_irq argument in sound/pci/*

The name argument of request_irq() appears in /proc/interrupts, and
it's quite ugly when the name entry contains a space or special letters.
In general, it's simpler and more readable when the module name appears
there, so let's replace all entries with KBUILD_MODNAME.

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


# 3733e424 10-Jun-2011 Takashi Iwai <tiwai@suse.de>

ALSA: Use KBUILD_MODNAME for pci_driver.name entries

The convention for pci_driver.name entry in kernel drivers seem to be
the module name or equivalent ones. But, so far, almost all PCI sound
drivers use more verbose name like "ABC Xyz (12)", and these are fairly
confusing when appearing as a file name.

This patch converts the all pci_driver.name entries in sound/pci/* to
use KBUILD_MODNAME for more unified appearance.

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


# 25985edc 30-Mar-2011 Lucas De Marchi <lucas.demarchi@profusion.mobi>

Fix common misspellings

Fixes generated by 'codespell' and manually reviewed.

Signed-off-by: Lucas De Marchi <lucas.demarchi@profusion.mobi>


# bdd3255d 07-Mar-2011 Adrian Knoth <adi@drcomp.erfurt.thur.de>

ALSA: hdspm - Add firmware ID for older AES32 cards.

The current AES32 firmware revision ID is 234, however, a user confirmed
that everything works fine with the previous revision, too.

Signed-off-by: Adrian Knoth <adi@drcomp.erfurt.thur.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 7c7102b7 28-Feb-2011 Adrian Knoth <adi@drcomp.erfurt.thur.de>

ALSA: hdspm - Fix midi port initialization

Depending on the model and the presence of a TCO module, the number of
midi ports varies. Some have 1 port (MADIface), some have 2 (default),
with TCO, there are 3.

Don't hardcode the number of midi ports to initialize.

This patch also fixes a boot lockup on MADIface.

[Coding-style fixes by tiwai]

Signed-off-by: Adrian Knoth <adi@drcomp.erfurt.thur.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 5027f347 28-Feb-2011 Adrian Knoth <adi@drcomp.erfurt.thur.de>

ALSA: hdspm - Abort on unknown firmware revision

Don't continue if we cannot detect the real card type, otherwise, all
subsequent functions, especially strcpy(), would fail, leaving the whole
driver in an unusable state.

Without such a protection, dmesg would look like this:

Pid: 1525, comm: modprobe Not tainted 2.6.38-rc6 #1 MSI MS-7250/MS-7250
EIP: 0060:[<c114e700>] EFLAGS: 00010296 CPU: 1
EIP is at strcpy+0x10/0x30
EAX: f4d33e58 EBX: f5990800 ECX: f4d33e58 EDX: 00000000
ESI: 00000000 EDI: f4d33e58 EBP: f5990930 ESP: f3dd3e0c
DS: 007b ES: 007b FS: 00d8 GS: 0033 SS: 0068
f53d4204 00000000 f90bfc03 00000001 00000001 f3dd3e64 c10fedff f3dd3e7c
f3d854e4 f53d4000 c10307b8 00000001 c10307b8 f5990860 c10307b8 00000001
c10332e5 f59908bc c12f4339 f59908bc f5990860 c11ef207 f4d33e00 f53d4000
[<f90bfc03>] ? snd_hdspm_probe+0x7e7/0x1166 [snd_hdspm]
[<c10fedff>] ? __sysfs_add_one+0x1f/0xf0
[<c10307b8>] ? get_parent_ip+0x8/0x20
[<c10307b8>] ? get_parent_ip+0x8/0x20
[<c10307b8>] ? get_parent_ip+0x8/0x20
[<c10332e5>] ? add_preempt_count+0xa5/0xd0
[<c12f4339>] ? _raw_spin_lock_irqsave+0x19/0x40
[<c11ef207>] ? pm_runtime_enable+0x17/0x80
[<c1160172>] ? local_pci_probe+0x42/0xb0
[<c1161091>] ? pci_device_probe+0x61/0x80
[<c11e9587>] ? driver_probe_device+0x77/0x180
[<c11600f0>] ? pci_match_device+0xa0/0xc0
[<c11e9709>] ? __driver_attach+0x79/0x80
[<c11e9690>] ? __driver_attach+0x0/0x80
[<c11e8e32>] ? bus_for_each_dev+0x52/0x80
[<c11e9416>] ? driver_attach+0x16/0x20
[<c11e9690>] ? __driver_attach+0x0/0x80
[<c11e8771>] ? bus_add_driver+0xa1/0x220
[<c1160f20>] ? pci_device_remove+0x0/0xf0
[<c11e99a3>] ? driver_register+0x63/0x120
[<c11612bd>] ? __pci_register_driver+0x3d/0xb0
[<c1001132>] ? do_one_initcall+0x32/0x160
[<f90d6000>] ? alsa_card_hdspm_init+0x0/0x14 [snd_hdspm]
[<c10676a9>] ? sys_init_module+0x99/0x1e0
[<c10ade3d>] ? sys_close+0x6d/0xc0
[<c1002c90>] ? sysenter_do_call+0x12/0x26
---[ end trace 239f0661c558378b ]---

Signed-off-by: Adrian Knoth <adi@drcomp.erfurt.thur.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 526ea867 28-Feb-2011 Adrian Knoth <adi@drcomp.erfurt.thur.de>

ALSA: hdspm - Add updated firmware revision for AES32

In contrast to the PCIe version (RME AES), the PCI version (RME AES32)
has a different firmware revision.

This patch adds the missing PCI revision.

Signed-off-by: Adrian Knoth <adi@drcomp.erfurt.thur.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# d2d10a21 28-Feb-2011 Adrian Knoth <adi@drcomp.erfurt.thur.de>

ALSA: hdspm - AES32: Use define instead of hardcoded channel count

Signed-off-by: Adrian Knoth <adi@drcomp.erfurt.thur.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# a7edbd5b 23-Feb-2011 Adrian Knoth <adi@drcomp.erfurt.thur.de>

ALSA: hdspm - Fix lock/sync reporting on MADI and AES32

Signed-off-by: Adrian Knoth <adi@drcomp.erfurt.thur.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 4ab69a2b 23-Feb-2011 Adrian Knoth <adi@drcomp.erfurt.thur.de>

ALSA: hdspm - prevent reading unitialized stack memory

Original patch by Dan Rosenberg <drosenberg@vsecurity.com> under commit
e68d3b316ab7b02a074edc4f770e6a746390cb7d. I'm copying his text here:

The SNDRV_HDSPM_IOCTL_GET_CONFIG_INFO ioctl in hdspm.c allow unprivileged
users to read uninitialized kernel stack memory, because several fields
of the hdspm_config struct declared on the stack are not altered
or zeroed before being copied back to the user. This patch takes care
of it.

Signed-off-by: Adrian Knoth <adi@drcomp.erfurt.thur.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 7c4a95b5 23-Feb-2011 Adrian Knoth <adi@drcomp.erfurt.thur.de>

ALSA: hdspm - fix sync check on AES32

Fredrik Lingvall <fredrik.lingvall@gmail.com> has discovered wrong
frequency and sync detection on AES32. According to him, the provided
patch fixes these issues.

Signed-off-by: Adrian Knoth <adi@drcomp.erfurt.thur.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# f6ea805f 23-Feb-2011 Adrian Knoth <adi@drcomp.erfurt.thur.de>

ALSA: hdspm - Remove input selector on MADIface

In contrast to the RME MADI card, coax/optical selection on the MADIface
is done via a physical switch located at the breakout box. Obviously,
the driver cannot switch ports in software.

Signed-off-by: Adrian Knoth <adi@drcomp.erfurt.thur.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 01e96078 23-Feb-2011 Adrian Knoth <adi@drcomp.erfurt.thur.de>

ALSA: hdspm - Fix DS/QS output channel mappings on RME MADI/MADIface

Caused by two typos, no output channel mappings were assigned for
MADI/MADIface at double/quad speed.

The channel mapping is indeed identical to the single speed mapping, the
cards will simply use the first N channels.

Signed-off-by: Florian Faber <faber@faberman.de>
Signed-off-by: Fredrik Lingvall <fredrik.lingvall@gmail.com>
Signed-off-by: Adrian Knoth <adi@drcomp.erfurt.thur.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 88fabbfc 23-Feb-2011 Adrian Knoth <adi@drcomp.erfurt.thur.de>

ALSA: hdspm - Restrict channel count on RME AES/AES32

Without calling an appropriate rule, AES/AES32 cards would announce a
theoretical channel count of 64 (HDSPM_MAX_CHANNELS), leading to the
already known bug:

[37422.640481] ------------[ cut here ]------------
[37422.640487] WARNING: at sound/pci/rme9652/hdspm.c:5449
snd_hdspm_ioctl+0x18f/0x202 [snd_hdspm]()
[37422.640489] Hardware name: PRIMERGY RX100 S6
[37422.640490] BUG? (info->channel >= hdspm->max_channels_in)
[37422.640492] Modules linked in: snd_hdspm snd_seq_midi ipmi_watchdog
ipmi_poweroff ipmi_si ipmi_devintf ipmi_msghandler i2c_i801 e1000e
snd_rawmidi power_meter [last unloaded: snd_hdspm]
[37422.640501] Pid: 22231, comm: jackd Tainted: G D W
2.6.36-gentoo-r5 #5
[37422.640502] Call Trace:
[37422.640508] [<ffffffff8103db3a>] warn_slowpath_common+0x80/0x98
[37422.640511] [<ffffffff8103dbe6>] warn_slowpath_fmt+0x41/0x43
[37422.640514] [<ffffffff81034306>] ? get_parent_ip+0x11/0x42
[37422.640518] [<ffffffffa0055763>] snd_hdspm_ioctl+0x18f/0x202
[snd_hdspm]
[37422.640522] [<ffffffff813fd626>] snd_pcm_channel_info+0x73/0x7c
[37422.640525] [<ffffffff814001e9>] snd_pcm_common_ioctl1+0x326/0xb01
[37422.640527] [<ffffffff81034306>] ? get_parent_ip+0x11/0x42
[37422.640531] [<ffffffff8105be6c>] ? __srcu_read_unlock+0x3b/0x59
[37422.640533] [<ffffffff81400bce>] snd_pcm_capture_ioctl1+0x20a/0x227
[37422.640537] [<ffffffff811e599c>] ? file_has_perm+0x90/0x9e
[37422.640540] [<ffffffff81400c15>] snd_pcm_capture_ioctl+0x2a/0x2e
[37422.640543] [<ffffffff810f2c69>] do_vfs_ioctl+0x404/0x453
[37422.640546] [<ffffffff810f2d09>] sys_ioctl+0x51/0x74
[37422.640549] [<ffffffff81002aab>] system_call_fastpath+0x16/0x1b
[37422.640552] ---[ end trace 0cd919cd68118082 ]---

We already have all the right values in place, we simply have to inform
the upper layers about this restriction.

Note that snd_hdspm_hw_rule_rate_out_channels and
snd_hdspm_hw_rule_rate_in_channels must not be called on AES32, because
the channel count is always 16, no matter of the samplerate in use.

Signed-off-by: Adrian Knoth <adi@drcomp.erfurt.thur.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 483cee77 23-Feb-2011 Adrian Knoth <adi@drcomp.erfurt.thur.de>

ALSA: hdspm - Fix buffer handling on RME MADI/MADIface/AES(32)

Only RayDAT and AIO provide sane buffer pointers that can be used with
HDSPM_BufferPositionMask, on all other cards, this would result in a
wrong HW pointer leading to xruns and these messages:

[260808.916788] BUG: pcmC0D0p:0, pos = 2976, buffer size = 1024, period size = 512
[260808.961124] BUG: pcmC0D0c:0, pos = 4944, buffer size = 1024, period size = 512

Signed-off-by: Adrian Knoth <adi@drcomp.erfurt.thur.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 432d2500 23-Feb-2011 Adrian Knoth <adi@drcomp.erfurt.thur.de>

ALSA: hpdsm - RME AES(32): Fix missing channel mappings

On RME AES and AES(32), none of the required information
(max_channels_in, max_channels_out, channel mappings, port names) was
set, leading to the BUG below.

This patch adds the missing bits, thus fixing the bug.

125.058768] ------------[ cut here ]------------
[ 125.058773] WARNING: at sound/pci/rme9652/hdspm.c:5389
snd_hdspm_ioctl+0x10c/0x1d8 [snd_hdspm]()
[ 125.058775] Hardware name: PRIMERGY RX100 S6
[ 125.058777] BUG? (info->channel >= hdspm->max_channels_out)
[ 125.058778] Modules linked in: ipmi_watchdog ipmi_poweroff ipmi_si
ipmi_devintf ipmi_msghandler snd_hdspm power_meter e1000e snd_rawmidi
i2c_i801
[ 125.058787] Pid: 3652, comm: audacity Tainted: G W
2.6.36-gentoo-r5 #5
[ 125.058788] Call Trace:
[ 125.058792] [<ffffffff8103db3a>] warn_slowpath_common+0x80/0x98
[ 125.058796] [<ffffffff8103dbe6>] warn_slowpath_fmt+0x41/0x43
[ 125.058800] [<ffffffffa006761a>] snd_hdspm_ioctl+0x10c/0x1d8
[snd_hdspm]
[ 125.058803] [<ffffffff813fd626>] snd_pcm_channel_info+0x73/0x7c
[ 125.058806] [<ffffffff814001e9>] snd_pcm_common_ioctl1+0x326/0xb01
[ 125.058809] [<ffffffff810c604c>] ? __do_fault+0x361/0x3a6
[ 125.058812] [<ffffffff81400e23>] snd_pcm_playback_ioctl1+0x20a/0x227
[ 125.058815] [<ffffffff811e599c>] ? file_has_perm+0x90/0x9e
[ 125.058818] [<ffffffff81400e6a>] snd_pcm_playback_ioctl+0x2a/0x2e
[ 125.058821] [<ffffffff810f2c69>] do_vfs_ioctl+0x404/0x453
[ 125.058824] [<ffffffff810f2d09>] sys_ioctl+0x51/0x74
[ 125.058827] [<ffffffff81002aab>] system_call_fastpath+0x16/0x1b
[ 125.058830] ---[ end trace 5bddb08e5d4cbeb1 ]---

Signed-off-by: Adrian Knoth <adi@drcomp.erfurt.thur.de>
Signed-off-by: Florian Faber <faber@faberman.de>
Signed-off-by: Fredrik Lingvall <fredrik.lingvall@gmail.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 730a5865 27-Jan-2011 Jaroslav Kysela <perex@perex.cz>

ALSA: hdspm - remove unused arrays, reduce stack usage in hwdep_ioctl

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


# 55a57606 27-Jan-2011 Adrian Knoth <adi@drcomp.erfurt.thur.de>

ALSA: [hdspm] Move static mapping arrays to .c

As requested by Takashi and Jaroslav, these arrays should not be in the
header file.

Signed-off-by: Adrian Knoth <adi@drcomp.erfurt.thur.de>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 0dca1793 26-Jan-2011 Adrian Knoth <adi@drcomp.erfurt.thur.de>

ALSA: hdspm - Add support for RME RayDAT and AIO

Incorporate changes by Florian Faber into hdspm.c. Code taken from

http://wiki.linuxproaudio.org/index.php/Driver:hdspe

Heavily reworked to mostly comply with the coding standard (whitespace
fixes, line width, C++ style comments)

The code was tested and confirmed to be working on RME RayDAT.

Signed-off-by: Adrian Knoth <adi@drcomp.erfurt.thur.de>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# b595076a 01-Nov-2010 Uwe Kleine-König <u.kleine-koenig@pengutronix.de>

tree-wide: fix comment/printk typos

"gadget", "through", "command", "maintain", "maintain", "controller", "address",
"between", "initiali[zs]e", "instead", "function", "select", "already",
"equal", "access", "management", "hierarchy", "registration", "interest",
"relative", "memory", "offset", "already",

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>


# e68d3b31 25-Sep-2010 Dan Rosenberg <drosenberg@vsecurity.com>

ALSA: sound/pci/rme9652: prevent reading uninitialized stack memory

The SNDRV_HDSP_IOCTL_GET_CONFIG_INFO and
SNDRV_HDSP_IOCTL_GET_CONFIG_INFO ioctls in hdspm.c and hdsp.c allow
unprivileged users to read uninitialized kernel stack memory, because
several fields of the hdsp{m}_config_info structs declared on the stack
are not altered or zeroed before being copied back to the user. This
patch takes care of it.

Signed-off-by: Dan Rosenberg <dan.j.rosenberg@gmail.com>
Cc: <stable@kernel.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 3ad2f3fb 02-Feb-2010 Daniel Mack <daniel@caiaq.de>

tree-wide: Assorted spelling fixes

In particular, several occurances of funny versions of 'success',
'unknown', 'therefore', 'acknowledge', 'argument', 'achieve', 'address',
'beginning', 'desirable', 'separate' and 'necessary' are fixed.

Signed-off-by: Daniel Mack <daniel@caiaq.de>
Cc: Joe Perches <joe@perches.com>
Cc: Junio C Hamano <gitster@pobox.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>


# cebe41d4 05-Feb-2010 Alexey Dobriyan <adobriyan@gmail.com>

sound: use DEFINE_PCI_DEVICE_TABLE

Use DEFINE_PCI_DEVICE_TABLE() to make PCI device ids go to
.devinit.rodata section, so they can be discarded in some cases,
and make them const.

Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# af901ca1 14-Nov-2009 André Goddard Rosa <andre.goddard@gmail.com>

tree-wide: fix assorted typos all over the place

That is "success", "unknown", "through", "performance", "[re|un]mapping"
, "access", "default", "reasonable", "[con]currently", "temperature"
, "channel", "[un]used", "application", "example","hierarchy", "therefore"
, "[over|under]flow", "contiguous", "threshold", "enough" and others.

Signed-off-by: André Goddard Rosa <andre.goddard@gmail.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>


# 3f7440a6 05-Jun-2009 Takashi Iwai <tiwai@suse.de>

ALSA: Clean up 64bit division functions

Replace the house-made div64_32() with the standard div_u64*() functions.

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


# 28b7e343 05-Feb-2009 Takashi Iwai <tiwai@suse.de>

ALSA: Remove superfluous hwdep ops

Remove NOP hwdep ops in sound drivers.

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


# e58de7ba 28-Dec-2008 Takashi Iwai <tiwai@alsa3.local>

ALSA: Convert to snd_card_create() in sound/pci/*

Convert from snd_card_new() to the new snd_card_create() function
in sound/pci/*.

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


# 1f04128a 17-Dec-2008 Takashi Iwai <tiwai@suse.de>

ALSA: hda - Convert from takslet_hi_schedule() to tasklet_schedule()

Replace all tasklet_hi_schedule() callers with the normal
tasklet_schedule(). The former often causes troubles with
RT-kernels, and has actually no merit.

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


# 972d4c50 12-Nov-2008 Jaroslav Kysela <perex@perex.cz>

ALSA: hdsp/hdspm: remove card->id from rawmidi device name

The card->id (card text identification) can be changed at runtime.
It might be confusing to have old text identification in device name.

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


# 77a23f26 21-Aug-2008 Takashi Iwai <tiwai@suse.de>

ALSA: Clean up SG-buffer helper functions and macros

Clean up SG-buffer helper functions and macros. Helpers take substream
as arguments now.

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


# da3cec35 08-Aug-2008 Takashi Iwai <tiwai@suse.de>

ALSA: Kill snd_assert() in sound/pci/*

Kill snd_assert() in sound/pci/*, either removed or replaced with
if () with snd_BUG_ON().

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


# 62cef821 14-Apr-2008 Denys Vlasenko <vda.linux@googlemail.com>

[ALSA] sound/pci/rme9652/hdspm.c: stop inlining largish static functions

sound/pci/rme9652/hdspm.c has unusually large number of static inline
functions - 22.

I looked through them and some of them seem to be too big to warrant inlining.

This patch removes "inline" from these static functions (regardless of number
of callsites - gcc nowadays auto-inlines statics with one callsite).

Size difference on 32bit x86:
text data bss dec hex filename
20437 2160 516 23113 5a49 linux-2.6-ALLYES/sound/pci/rme9652/hdspm.o
18036 2160 516 20712 50e8 linux-2.6.inline-ALLYES/sound/pci/rme9652/hdspm.o

[coding fix by Takashi Iwai <tiwai@suse.de>]

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 0b76b51e 29-Feb-2008 Harvey Harrison <harvey.harrison@gmail.com>

[ALSA] sound: hdspm.c fix returning void expression warnings

Just drop the returns.
sound/pci/rme9652/hdspm.c:1031:3: warning: returning void-valued expression
sound/pci/rme9652/hdspm.c:1033:3: warning: returning void-valued expression

Signed-off-by: Harvey Harrison <harvey.harrison@gmail.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 9004acc7 08-Jan-2008 Takashi Iwai <tiwai@suse.de>

[ALSA] Remove sound/driver.h

This header file exists only for some hacks to adapt alsa-driver
tree. It's useless for building in the kernel. Let's move a few
lines in it to sound/core.h and remove it.
With this patch, sound/driver.h isn't removed but has just a single
compile warning to include it. This should be really killed in
future.

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


# 561de31a 18-Dec-2007 Joe Perches <joe@perches.com>

[ALSA] sound/: Spelling fixes


Signed-off-by: Joe Perches <joe@perches.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>


# 6534599d 30-Aug-2007 Remy Bruno <remy.bruno@trinnov.com>

[ALSA] hdspm - Fix autosync bug

* better report of speed mode change failures
* autosync_ref control bugfix (was reporting pref_sync_ref instead)
(changed HDSPM_AES32_AUTOSYNC_FROM_NONE value to comply with array
indexing in snd_hdspm_info_autosync_ref())
* added support for master modes up to 192kHz (clock source control
value was restricted up to 96kHz)

Signed-off-by: Remy Bruno <remy.bruno@trinnov.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@suse.cz>


# ef5fa1a4 27-Jul-2007 Takashi Iwai <tiwai@suse.de>

[ALSA] hdspm - Coding style fixes

Fix codes to follow more to the standard kernel coding style.

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


# a5ce8890 23-Jul-2007 Takashi Iwai <tiwai@suse.de>

[ALSA] Clean up with common snd_ctl_boolean_*_info callbacks

Clean up codes using the new common snd_ctl_boolean_*_info() callbacks.

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


# ffb2c3c0 07-Mar-2007 Remy Bruno <remy.bruno@trinnov.com>

[ALSA] hdspm - Support for Master mode of AES32 and recent MADI

The current MADI driver was found not to completely work, at least on recent
MADI cards (rev 204), in particular at 96kHz. This patch solves this:
* Add support of DDS feature
* Channel map fixed
* Channel/rate rules fixed
* DMA allocation fixed (need to alloc for all channels and not only for the
used ones)
Full support for AES32 master mode was added:
* Add support of DDS feature
* Channel map fixed
* Channel/rate rules fixed

Signed-off-by: Remy Bruno <remy.bruno@trinnov.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@suse.cz>


# ef991b95 21-Feb-2007 Takashi Iwai <tiwai@suse.de>

[ALSA] Add snd_pcm_group_for_each_entry() for code cleanup

Added a new macro snd_pcm_group_for_each_entry() just for code cleanup.
Old macros, snd_pcm_group_for_each() and snd_pcm_group_substream_entry(),
are removed.

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


# c187c041 19-Feb-2007 Takashi Iwai <tiwai@suse.de>

[ALSA] Add missing sysfs device assignment for ALSA PCI drivers

Added the missing sysfs device assignment for ALSA PCI drivers.

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


# 54bf5dd9 06-Nov-2006 Takashi Iwai <tiwai@suse.de>

[ALSA] hdspm - Fix printk warnings

sound/pci/rme9652/hdspm.c: In function 'snd_hdspm_hw_params':
sound/pci/rme9652/hdspm.c:3681: warning: format '%08X' expects type 'unsigned int', but argument 4 has type 'unsigned char *'
sound/pci/rme9652/hdspm.c:3692: warning: format '%08X' expects type 'unsigned int', but argument 4 has type 'unsigned char *'

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


# 3cee5a60 15-Oct-2006 Remy Bruno <remy.bruno@trinnov.com>

[ALSA] hdspm: Add support for AES32

Add support for AES32. Difference between MADI and AES32 is done
through revision. Master support is not finished for now (RME so-called DDS
feature is not supported yet)

Signed-off-by: Remy Bruno <remy.bruno@trinnov.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@suse.cz>


# 437a5a46 20-Nov-2006 Takashi Iwai <tiwai@suse.de>

[ALSA] Remove IRQF_DISABLED for shared PCI irqs

Fix IRQ flags for PCI devices.
The shared IRQs for PCI devices shouldn't be allocated with
IRQF_DISABLED. Also, when MSI is enabled, IRQF_SHARED shouldn't
be used.
The patch removes unnecessary cast in request_irq and free_irq,
too.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
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)


# 65ca68b3 01-Jul-2006 Thomas Gleixner <tglx@linutronix.de>

[PATCH] irq-flags: sound: Use the new IRQF_ constants

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: "David S. Miller" <davem@davemloft.net>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: Jaroslav Kysela <perex@suse.cz>
Cc: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>


# bf850204 28-Apr-2006 Takashi Iwai <tiwai@suse.de>

[ALSA] Remove unneeded read/write_size fields in proc text ops

Remove unneeded read/write_size fields in proc text ops.
snd_info_set_text_ops() is fixed, too.

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


# 396c9b92 24-Apr-2006 Henrik Kretzschmar <henne@nachtwindheim.de>

[ALSA] add __devinitdata to all pci_device_id

Signed-off-by: Henrik Kretzschmar <henne@nachtwindheim.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 7f927fcc 28-Mar-2006 Alexey Dobriyan <adobriyan@gmail.com>

[PATCH] Typo fixes

Fix a lot of typos. Eyeballed by jmc@ in OpenBSD.

Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>


# 5bab2482 13-Mar-2006 Adrian Bunk <bunk@stusta.de>

[ALSA] sound/pci/rme9652/hdspm.c: fix off-by-one errors

Modules: RME9652 driver

This patch fixes off-by-one errors found by the Coverity checker.

Signed-off-by: Adrian Bunk <bunk@stusta.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# e2eba3e7 20-Jan-2006 Andrew Morton <akpm@osdl.org>

[ALSA] hdsp - Fix printk warnings

Modules: RME9652 driver

sound/pci/rme9652/hdspm.c: In function 'snd_hdspm_preallocate_memory':
sound/pci/rme9652/hdspm.c:3327: warning: int format, different type arg (arg 4)
sound/pci/rme9652/hdspm.c:3331: warning: int format, different type arg (arg 4)
sound/pci/rme9652/hdspm.c: In function 'snd_hdspm_create':
sound/pci/rme9652/hdspm.c:3513: warning: int format, different type arg (arg 4)

Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>


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

[ALSA] Remove xxx_t typedefs: PCI HDSP-MADI

Modules: HDSPM driver,RME9652 driver

Remove xxx_t typedefs from the PCI HDSP-MADI driver.

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


# c3e6f7d8 16-Nov-2005 Takashi Iwai <tiwai@suse.de>

[ALSA] Remove superfluous pcm_free callbacks

Remove superflous pcm_free callbacks.

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


# 249bb070 04-Nov-2005 Greg Kroah-Hartman <gregkh@suse.de>

[PATCH] PCI: removed unneeded .owner field from struct pci_driver

Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>


# fc58422a 24-Oct-2005 Jesper Juhl <jesper.juhl@gmail.com>

[ALSA] Big kfree NULL check cleanup - sound

Modules: AD1889 driver,RME9652 driver

This is the sound/ part of the big kfree cleanup patch.

Remove pointless checks for NULL prior to calling kfree() in sound/.

Signed-off-by: Jesper Juhl <jesper.juhl@gmail.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 3bcd4649 12-Sep-2005 Clemens Ladisch <clemens@ladisch.de>

[ALSA] set owner field in struct pci_driver

AD1889 driver,ALS4000 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,RME32 driver
RME96 driver,SonicVibes driver,VIA82xx driver,VIA82xx-modem driver
ALI5451 driver,au88x0 driver,CS46xx driver,EMU10K1/EMU10K2 driver
HDA Intel driver,ICE1712 driver,ICE1724 driver,KORG1212 driver
MIXART driver,NM256 driver,RME HDSP driver,RME9652 driver
Trident driver,Digigram VX222 driver,YMFPCI driver
Set the module owner field in each driver's struct pci_driver to get
the driver symlink in the sysfs device directory.

Signed-off-by: Clemens Ladisch <clemens@ladisch.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>


# e8da2fbc 16-Aug-2005 Takashi Iwai <tiwai@suse.de>

[ALSA] hdspm - Fix module parameter description

RME9652 driver
Fix the module parameter description after proofreading.

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


# a53fc188 11-Aug-2005 Clemens Ladisch <clemens@ladisch.de>

[ALSA] make local objects static

Memalloc module,PCM Midlevel,Timer Midlevel,GUS Library,AC97 Codec
ALI5451 driver,RME9652 driver
Make some functions/variables that are used in only one file static.

Signed-off-by: Clemens Ladisch <clemens@ladisch.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>


# 763f356c 03-Jun-2005 Takashi Iwai <tiwai@suse.de>

[ALSA] Add HDSP MADI driver

HDSPM driver,PCI drivers,RME9652 driver
Added RME Hammerfall DSP MADI driver by Winfried Ritsch.
(Moved from alsa-driver tree to mainline.)

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