History log of /linux-master/sound/pci/rme9652/hdsp.c
Revision Date Author Comments
# 90ed2311 15-Aug-2023 Takashi Iwai <tiwai@suse.de>

ALSA: hdsp: Convert to generic PCM copy ops

This patch converts the hdsp driver code to use the new unified PCM
copy callback. It's a straightforward conversion from *_user() to
*_iter() variants.

Note that copy_from/to_iter() returns the copied bytes, hence the
error condition is adjusted accordingly.

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


# 50895a55 24-Oct-2022 Jason A. Donenfeld <Jason@zx2c4.com>

ALSA: rme9652: use explicitly signed char

With char becoming unsigned by default, and with `char` alone being
ambiguous and based on architecture, signed chars need to be marked
explicitly as such. This fixes warnings like:

sound/pci/rme9652/hdsp.c:3953 hdsp_channel_buffer_location() warn: 'hdsp->channel_map[channel]' is unsigned
sound/pci/rme9652/hdsp.c:4153 snd_hdsp_channel_info() warn: impossible condition '(hdsp->channel_map[channel] < 0) => (0-255 < 0)'
sound/pci/rme9652/rme9652.c:1833 rme9652_channel_buffer_location() warn: 'rme9652->channel_map[channel]' is unsigned

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Cc: <stable@vger.kernel.org>
Link: https://lore.kernel.org/r/20221025000313.546261-1-Jason@zx2c4.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# d06130dc 08-May-2022 Colin Ian King <colin.king@intel.com>

ALSA: hdsp: remove redundant assignment to pointer kctl

Pointer kctl is being assigned a value that is not being read, buf
is being re-assigned later. The assignment is redundant and can be
removed.

Cleans up clang scan build warning:
sound/pci/rme9652/hdsp.c:3317:28: warning: Although the value stored
to 'kctl' is used in the enclosing expression, the value is never
actually read from 'kctl' [deadcode.DeadStores]

Signed-off-by: Colin Ian King <colin.i.king@gmail.com>
Link: https://lore.kernel.org/r/20220508212819.59188-1-colin.i.king@gmail.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>


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

ALSA: hdsp: 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: d136b8e54f92 ("ALSA: hdsp: Allocate resources with device-managed APIs")
Cc: <stable@vger.kernel.org>
Link: https://lore.kernel.org/r/20220412102636.16000-36-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 43d35ccc 08-Nov-2021 Takashi Iwai <tiwai@suse.de>

ALSA: pci: rme: Fix unaligned buffer addresses

The recent fix for setting up the DMA buffer type on RME drivers tried
to address the non-standard memory managements and changed the DMA
buffer information to the standard snd_dma_buffer object that is
allocated at the probe time. However, I overlooked that the RME
drivers handle the buffer addresses based on 64k alignment, and the
previous conversion broke that silently.

This patch is an attempt to fix the regression. The snd_dma_buffer
objects are copied to the original data with the correction to the
aligned accesses, and those are passed to snd_pcm_set_runtime_buffer()
helpers instead. The original snd_dma_buffer objects are managed by
devres, hence they'll be released automagically.

Fixes: 0899a7a23047 ("ALSA: pci: rme: Set up buffer type properly")
Cc: <stable@vger.kernel.org>
Link: https://lore.kernel.org/r/20211108145752.30572-1-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 0899a7a2 09-Aug-2021 Takashi Iwai <tiwai@suse.de>

ALSA: pci: rme: Set up buffer type properly

Although the regression of the mmap was fixed in the recent commit
dc0dc8a73e8e ("ALSA: pcm: Fix mmap breakage without explicit buffer
setup"), RME9652 and HDSP drivers have still potential issues with
their mmap handling. Namely, they use the default mmap handler
without the standard buffer preallocation, and PCM core wouldn't use
the coherent DMA mapping. It's practically OK on x86, but on some
exotic architectures, it wouldn't work.

This patch addresses the potential breakage by replacing the buffer
setup with the proper macro. It also simplifies the source code,
too.

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


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

ALSA: hdsp: Allocate resources with device-managed APIs

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

This should give no user-visible functional changes.

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


# 0f7c9565 22-Jun-2021 Dan Carpenter <dan.carpenter@oracle.com>

ALSA: hdsp: fix a test for copy_to_user() failure

The copy_to_user() function returns the number of bytes remaining to be
copied. It doesn't return negatives.

Fixes: 66c8f75919dd ("ALSA: hdsp: Fix assignment in if condition")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Link: https://lore.kernel.org/r/YNIzqpVR6L2t/RwJ@mwanda
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 66c8f759 08-Jun-2021 Takashi Iwai <tiwai@suse.de>

ALSA: hdsp: Fix assignment in if condition

PCI HDSP driver code contains lots of assignments in if condition,
which is a bad coding style that may confuse readers and occasionally
lead to bugs.

This patch is merely for coding-style fixes, no functional changes.

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


# d0f5137b 11-May-2021 Huilong Deng <denghuilong@cdjrlc.com>

ALSA: Remove trailing semicolon in macros

Macros should not use a trailing semicolon.

Signed-off-by: Huilong Deng <denghuilong@cdjrlc.com>
Link: https://lore.kernel.org/r/20210511154710.24481-1-denghuilong@cdjrlc.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 507cdb9a 21-Mar-2021 Tong Zhang <ztong0001@gmail.com>

ALSA: hdsp: don't disable if not enabled

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

[ 1.758292] snd_hdsp 0000:00:03.0: disabling already-disabled device
[ 1.758327] WARNING: CPU: 0 PID: 180 at drivers/pci/pci.c:2146 pci_disable_device+0x91/0xb0
[ 1.766985] Call Trace:
[ 1.767121] snd_hdsp_card_free+0x94/0xf0 [snd_hdsp]
[ 1.767388] release_card_device+0x4b/0x80 [snd]
[ 1.767639] device_release+0x3b/0xa0
[ 1.767838] kobject_put+0x94/0x1b0
[ 1.768027] put_device+0x13/0x20
[ 1.768207] snd_card_free+0x61/0x90 [snd]
[ 1.768430] snd_hdsp_probe+0x524/0x5e0 [snd_hdsp]

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


# da2a040e 01-Feb-2021 Jasmin Fazlic <superfassl@gmail.com>

ALSA: hdsp: hardware output loopback

Output loopback is a feature where you can record what you hear.
The HDSP series of the RME interfaces provides this functionality
at the hardware level and this patch exposes controls to enable or
disable it per output (playback) channel.

This probably works on other cards but due to a lack of hardware
it is only tested and enabled for the HDSP9632 card with this patch.

Should this patch be accepted a separate patch will be posted to
https://github.com/alsa-project/alsa-tools/tree/master/hdspmixer
which adds "LPBK" buttons to each output in the playback strip for
the user to be able to control this feature from the user land.
Users from Windows tool TotalMixFX should be familiar with this.

Signed-off-by: Jasmin Fazlic <superfassl@gmail.com>
Link: https://lore.kernel.org/r/95cb3117-e85a-51a6-c2ce-bf736e70fc4c@gmail.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>


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

ALSA: hdsp: Replace tasklet with work

The tasklet is an old API that should be deprecated, usually can be
converted to another decent API. In HDSP 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 driver with a simple
work. The conversion is fairly straightforward. The only significant
difference is that a superfluous tasklet_kill() call is removed from
snd_hdap_midi_input_trigger().

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


# 0cc62972 08-Feb-2020 Colin Ian King <colin.king@canonical.com>

ALSA: hdsp: remove redundant assignment to variable err

Variable err is being assigned with a value that is never read, it is
assigned a new value in the next statement. The assignment is redundant
and can be removed.

Addresses-Coverity: ("Unused value")
Signed-off-by: Colin Ian King <colin.king@canonical.com>
Link: https://lore.kernel.org/r/20200208222006.37376-1-colin.king@canonical.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 112e3f5a 02-Feb-2020 Takashi Iwai <tiwai@suse.de>

ALSA: hdsp: Make the firmware loading ioctl a bit more readable

The firmware loading ioctl that is implemented for hdsp hwdep device
takes the reference of the address pointer, hence the current code is
rather confusing. Also, due to the recent change in uapi header,
sparse also complains about the cast.

This patch tries to improve the readability by converting the
straightforward copy_from_user of the whole struct (which contains
only the pointer).

Fixes: d63e63d42107 ("ALSA: hdsp: Make uapi/hdsp.h compilable again")
Link: https://lore.kernel.org/r/20200202090724.18232-2-tiwai@suse.de
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>


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

ALSA: hdsp: More constifications

Apply const prefix to each channel map table and its callers.

Just for minor optimization and no functional changes.

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


# d63e63d4 20-Dec-2019 Takashi Iwai <tiwai@suse.de>

ALSA: hdsp: Make uapi/hdsp.h compilable again

Recently alsa-lib updated its content of sound/hdsp.h just by copying
the latest Linus kernel uapi/*.h, and this broke the build of
alsa-tools programs. We used to modify the headers so that they can
be built without asoundlib.h and linux kernel headers, and the
verbatim copy doesn't work as is.

This patch removes again the linux/types.h inclusion and drop __user
prefix that broke the build and adjusts the corresponding code.

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


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


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


# 0b84304e 18-Dec-2018 Gustavo A. R. Silva <gustavo@embeddedor.com>

ALSA: rme9652: Fix potential Spectre v1 vulnerability

info->channel is indirectly controlled by user-space, hence leading to
a potential exploitation of the Spectre variant 1 vulnerability.

This issue was detected with the help of Smatch:

sound/pci/rme9652/hdsp.c:4100 snd_hdsp_channel_info() warn: potential spectre issue 'hdsp->channel_map' [r] (local cap)

Fix this by sanitizing info->channel before using it to index hdsp->channel_map

Notice that given that speculation windows are large, the policy is
to kill the speculation on the first load and not worry if it can be
completed with a dependent load/store [1].

Also, notice that I refactored the code a bit in order to get rid of the
following checkpatch warning:

ERROR: do not use assignment in if condition
FILE: sound/pci/rme9652/hdsp.c:4103:
if ((mapped_channel = hdsp->channel_map[info->channel]) < 0)

[1] https://marc.info/?l=linux-kernel&m=152449131114778&w=2

Cc: stable@vger.kernel.org
Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com>
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>


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

ALSA: rme9652: Use common code in hdsp_get_iobox_version()

Add a jump target so that a bit of common code 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>


# 2675be5a 14-Aug-2017 Markus Elfring <elfring@users.sourceforge.net>

ALSA: rme9652: Use common error handling code in two functions

Add a jump target so that a bit of exception handling can be better reused
in these functions.

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>


# 18ed1cf0 12-Aug-2017 Bhumika Goyal <bhumirks@gmail.com>

ALSA: rme9652: make snd_pcm_hardware const

Make these const as they are only used during a copy operation.
Done using Coccinelle.

Signed-off-by: Bhumika Goyal <bhumirks@gmail.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>


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

ALSA: hdsp: 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>


# 0925e6b2 10-May-2017 Takashi Iwai <tiwai@suse.de>

ALSA: hdsp: Convert to the new PCM ops

Replace the copy and the silence ops with the new PCM ops.
The conversion is straightforward with standard helper functions.

Reviewed-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
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>


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

ALSA: hdsp: Fix wrong boolean ctl value accesses

snd-hdsp 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>


# 29d28c50 11-Sep-2015 Sudip Mukherjee <sudipm.mukherjee@gmail.com>

ALSA: hdsp: fix memory leak

If the size of the firmware is less than expected size then we are
exiting with the error code but we missed releasing the firmware.

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


# a3b3a9db 21-Aug-2015 Dan Carpenter <dan.carpenter@oracle.com>

ALSA: hdsp: silence a sprinft() overflow warning

card->shortname is a 32 char string so the sprintf() can theoretically
overflow. snd_rawmidi_new() can accept strings up to 64 bytes long.

I have made the temporay buf[] array 40 bytes long and changed the
sprintf() to snprintf().

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


# 9e46aeda 21-Aug-2015 Dan Carpenter <dan.carpenter@oracle.com>

ALSA: hdsp: silence and underflow warning

I believe this probably cannot happen, as the code suggests. There
would have to be an kcontrol->index.id which was zero, otherwise this
would be prevented in snd_ctl_find_id(). But snd_BUG_ON() is just a
WARN() or a no-op so static checkers complain that we keep on going with
a negative offset. Let's just handle the error as well as printing
a warning.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
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>


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

ALSA: hdsp: 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>


# c2836610 17-Nov-2014 Markus Elfring <elfring@users.sourceforge.net>

ALSA: hdsp: Deletion of an unnecessary check before the function call "release_firmware"

The release_firmware() function tests whether its argument is NULL and then
return immediately. 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>


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

ALSA: hdsp: Use snd_ctl_enum_info()

... and reduce the open codes. Also add missing const to text arrays.

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>


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

ALSA: hdsp: 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>


# 47d98c02 08-Jan-2014 Takashi Iwai <tiwai@suse.de>

ALSA: Remove memory reservation code from memalloc helper

Nowadays we have CMA for obtaining the contiguous memory pages
efficiently. Let's kill the old kludge for reserving the memory pages
for large buffers. It was rarely useful (only for preserving pages
among module reloading or a little help by an early boot scripting),
used only by a couple of drivers, and yet it gives too much ugliness
than its benefit.

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


# d14df339 16-Oct-2013 Dan Carpenter <dan.carpenter@oracle.com>

ALSA: hdsp - info leak in snd_hdsp_hwdep_ioctl()

In GCC the sizeof(hdsp_version) is 8 because there is a 2 byte hole at
the end of the struct after ->firmware_rev.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
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>


# 49ba4f94 15-Jan-2013 Adrian Knoth <adi@drcomp.erfurt.thur.de>

ALSA: hdsp - Remove obsolete settings functions

With HDSP_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>


# 4833c673 15-Jan-2013 Adrian Knoth <adi@drcomp.erfurt.thur.de>

ALSA: hdsp - Use HDSP_TOGGLE_SETTING to alter settings

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


# 66d9244e 15-Jan-2013 Adrian Knoth <adi@drcomp.erfurt.thur.de>

ALSA: hdsp - Implement generic function to toggle settings

The driver contains multiple 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>


# 0c2bc7c7 15-Jan-2013 Adrian Knoth <adi@drcomp.erfurt.thur.de>

ALSA: hdsp - Fix detection for RME RPM/Multiface/Digiface ioboxes

The current iobox detection code reportedly fails for various users, so
simply do what the Win32 driver does instead.

Patch originally by Karl Grill <kgrill@chello.at> and then modified to
comply with kernel coding guidelines + current HEAD.

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>


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

ALSA: hdsp: Add missing inclusion of linux/vmalloc.h

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


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

ALSA: hdsp: improve firmware caching

As the recent firmware code tries to reread and cache the firmware by
itself, it's even better to keep the struct firmware data instead of
keeping a local copy. Also, it makes little sense to disable the fw
loader for this driver, so added the explicit dependency, too.

Last, but not least, allocate the firmware data loaded via ioctl in
vmalloc'ed buffer instead, as the firmware size isn't that small.

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


# 42eb9238 07-May-2012 Andre Schramm <andre.schramm@iosono-sound.com>

ALSA: hdsp - Provide ioctl_compat

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


# 9badda0a 09-Jan-2012 Takashi Iwai <tiwai@suse.de>

ALSA: hdsp - Fix potential Oops in snd_hdsp_info_pref_sync_ref()

Dan Carpenter reported that setting 0 to uinfo->value.enumerated.items
in snd_hdsp_info_pref_sync_ref() may lead to Oops. This function should
return an error immediately in such a case instead.

Cc: Dan Carpenter <dan.carpenter@oracle.com>
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>


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


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

ALSA: hdsp - Correct HDSP_VERSION_BIT constant, thus partly fixing RPM detection

HDSP_VERSION_BIT has to be ORed with HDSP_S_LOAD. This fixes the detection
of at least some RME RPM boxes.

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>


# 28b26e15 30-Nov-2010 Florian Faber <faberman@linuxproaudio.org>

ALSA: hdsp - Add support for RPM io box

Add support for the RME HDSP RPM IO box. Changes have been made in the identification of the IO box and the neccessary controls have been added.

Signed-off-by: Florian Faber <faberman@linuxproaudio.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>


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


# 9fe856e4 04-Sep-2010 Joe Perches <joe@perches.com>

sound: Remove unnecessary casts of private_data

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


# 5a0e3ad6 24-Mar-2010 Tejun Heo <tj@kernel.org>

include cleanup: Update gfp.h and slab.h includes to prepare for breaking implicit slab.h inclusion from percpu.h

percpu.h is included by sched.h and module.h and thus ends up being
included when building most .c files. percpu.h includes slab.h which
in turn includes gfp.h making everything defined by the two files
universally available and complicating inclusion dependencies.

percpu.h -> slab.h dependency is about to be removed. Prepare for
this change by updating users of gfp and slab facilities include those
headers directly instead of assuming availability. As this conversion
needs to touch large number of source files, the following script is
used as the basis of conversion.

http://userweb.kernel.org/~tj/misc/slabh-sweep.py

The script does the followings.

* Scan files for gfp and slab usages and update includes such that
only the necessary includes are there. ie. if only gfp is used,
gfp.h, if slab is used, slab.h.

* When the script inserts a new include, it looks at the include
blocks and try to put the new include such that its order conforms
to its surrounding. It's put in the include block which contains
core kernel includes, in the same order that the rest are ordered -
alphabetical, Christmas tree, rev-Xmas-tree or at the end if there
doesn't seem to be any matching order.

* If the script can't find a place to put a new include (mostly
because the file doesn't have fitting include block), it prints out
an error message indicating which .h file needs to be added to the
file.

The conversion was done in the following steps.

1. The initial automatic conversion of all .c files updated slightly
over 4000 files, deleting around 700 includes and adding ~480 gfp.h
and ~3000 slab.h inclusions. The script emitted errors for ~400
files.

2. Each error was manually checked. Some didn't need the inclusion,
some needed manual addition while adding it to implementation .h or
embedding .c file was more appropriate for others. This step added
inclusions to around 150 files.

3. The script was run again and the output was compared to the edits
from #2 to make sure no file was left behind.

4. Several build tests were done and a couple of problems were fixed.
e.g. lib/decompress_*.c used malloc/free() wrappers around slab
APIs requiring slab.h to be added manually.

5. The script was run on all .h files but without automatically
editing them as sprinkling gfp.h and slab.h inclusions around .h
files could easily lead to inclusion dependency hell. Most gfp.h
inclusion directives were ignored as stuff from gfp.h was usually
wildly available and often used in preprocessor macros. Each
slab.h inclusion directive was examined and added manually as
necessary.

6. percpu.h was updated not to include slab.h.

7. Build test were done on the following configurations and failures
were fixed. CONFIG_GCOV_KERNEL was turned off for all tests (as my
distributed build env didn't work with gcov compiles) and a few
more options had to be turned off depending on archs to make things
build (like ipr on powerpc/64 which failed due to missing writeq).

* x86 and x86_64 UP and SMP allmodconfig and a custom test config.
* powerpc and powerpc64 SMP allmodconfig
* sparc and sparc64 SMP allmodconfig
* ia64 SMP allmodconfig
* s390 SMP allmodconfig
* alpha SMP allmodconfig
* um on x86_64 SMP allmodconfig

8. percpu.h modifications were reverted so that it could be applied as
a separate patch and serve as bisection point.

Given the fact that I had only a couple of failures from tests on step
6, I'm fairly confident about the coverage of this conversion patch.
If there is a breakage, it's likely to be something in one of the arch
headers which should be easily discoverable easily on most builds of
the specific arch.

Signed-off-by: Tejun Heo <tj@kernel.org>
Guess-its-ok-by: Christoph Lameter <cl@linux-foundation.org>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Lee Schermerhorn <Lee.Schermerhorn@hp.com>


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


# c18bc9b9 12-Aug-2009 Tim Blechmann <tim@klingt.org>

ALSA: hdsp - allow proc reporting with disconnected io box

the hdsp driver refuses to report any information via the proc
interface, if the io box is not connected. with this patch, the
content of the control and status registers is printed before the
iobox check.

Signed-off-by: Tim Blechmann <tim@klingt.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>


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


# 8e365f9b 12-May-2009 Raphael Doursenaud <rdoursenaud@free.fr>

ALSA: hdsp: allow firmware loading from inside the kernel

Allow the use of the FIRMWARE_IN_KERNEL option with hdsp cards and
in-kernel driver.
Also corrected a typo in the comment.

Signed-off-by: Raphael Doursenaud <rdoursenaud@free.fr>
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# c2503cd3 05-Mar-2009 Takashi Iwai <tiwai@suse.de>

ALSA: hdsp - Ignore MIDI and PCM events in interrupts until initialized

Ignore MIDI and PCM events in the interrupt handler until the device
gets initialized properly. Otherwise you may get kernel panic by the
access to uninitialized devices via hotplugging.

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


# f9ffc5d6 20-Feb-2009 Tim Blechmann <tim@klingt.org>

ALSA: hdsp - whitespace cleanup

Impact: remove trailing spaces

Signed-off-by: Tim Blechmann <tim@klingt.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# e588ed83 20-Feb-2009 Tim Blechmann <tim@klingt.org>

ALSA: hdsp - poll for iobox

sleeping for 2 seconds before checking for the iobox is not enough
on some systems.
this patch increases the timeout, but polls the card during that
time. it thus speeds up the module loading when the card has already
been initialized, while being more robust on systems, which require
a higher timeout than the predefined 2 seconds.

Signed-off-by: Tim Blechmann <tim@klingt.org>
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>


# 3ae7e2e2 08-Nov-2008 Tim Blechmann <tim@klingt.org>

ALSA: hdsp: check for iobox and upload firmware during ioctl

currently, the error message when trying to run hdspmixer or hdspconf
if the breakout box is not connected is somehow misleading, since it
asks the user to upload the firmware.

this patch adds a test, whether the breakout box is connected and
tries to upload the firmware in the case, that it is not present, e.g.
because of power failures of the breakout box.

[Minor coding-style fixes by tiwai]

Signed-off-by: Tim Blechmann <tim@klingt.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 00c9ddd1 08-Nov-2008 Tim Blechmann <tim@klingt.org>

ALSA: HDSP: check for io box before uploading firmware

currently the hdsp driver tries to upload the firmware, even if the
io box is not connected. this patch adds a check for the io box
before trying to upload the firmware.
thus instead of messages complaining about the fifo status and firmware
loading failure, the driver gives a message that no multiface or
digiface is connected.

[A minor coding-style fix by tiwai]

Signed-off-by: Tim Blechmann <tim@klingt.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>


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


# 47ba97f8 22-Feb-2008 Remy Bruno <remy.bruno@trinnov.com>

[ALSA] hdsp - RME 9632 fix at 192kHz

The bits indicating SPDIF frequency in the status register are not the same for
the 9632 than for the other cards, because it also supports 192kHz. A specific
bitmask has thus been added (used in hdsp_spdif_sample_rate()).
The 9632 does not seem to report external sample rates greater than 96kHz. In
this case, the best seems to report spdif rate when autosync reference is
spdif. This also required to move function hdsp_spdif_sample_rate().

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


# 92eed66d 22-Feb-2008 Takashi Iwai <tiwai@suse.de>

[ALSA] hdsp - Fix section mismatch

Removed invalid __devinit from hdsp_request_fw_loader() and
snd_hwdep_create_hwdep() that aren't always init functions.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>


# 192b8e39 16-Jan-2008 Andreas Degert <ad@papyrus-gmbh.de>

[ALSA] hdsp: make Multiface II work again

This device has io_type == 1 (Multiface) and firmware_rev > 0xa
(fixes regression from changeset 5326)

Signed-off-by: Andreas Degert <ad@papyrus-gmbh.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>


# 1374f8ce 16-Jan-2008 Randy Dunlap <randy.dunlap@oracle.com>

[ALSA] sound: fix rme9652 section mismatch

Fix section mismatch in hdsp: snd_hdsp_proc_init() can be called from
an ioctl at any time.
WARNING: vmlinux.o(.text+0x1089bc2): Section mismatch: reference to .init.text: (between 'snd_hdsp_create_alsa_devices' and 'snd_hdsp_free')

Signed-off-by: Randy Dunlap <randy.dunlap@oracle.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>


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


# 4e98d6a7 15-Nov-2007 Takashi Iwai <tiwai@suse.de>

[ALSA] pci - check value range in ctl callbacks

Check the value ranges in ctl put callbacks properly in the rest of
PCI drivers.

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


# 27caac81 11-Nov-2007 Nicolas Kaiser <nikai@nikai.net>

[ALSA] sound/pci: remove duplicated defines

Remove duplicated defines.
(From their use it looks like 'midiDataOutx are written to
rather than read from.)

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


# 2a3988f6 16-Oct-2007 Takashi Iwai <tiwai@suse.de>

[ALSA] hdsp - Fix zero division

Fix zero-division bug in the calculation dds offset.

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


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

[ALSA] hdsp - Add support for latset RME9632 revisions

added support for the latest revision of the 9632 (and hopefully a few
following ones). The DSP matrix was not working because of wrong
identification of the card in this part of the code.

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>


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


# 7e0af29d 03-May-2007 Clemens Ladisch <clemens@ladisch.de>

[ALSA] add MODULE_FIRMWARE entries

Add MODULE_FIRMWARE() entries, where appropriate.

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


# e4b6088c 19-Mar-2007 Julian Cable <julian_cable@yahoo.com>

[ALSA] hdsp - Add support for fine tuning of sample rate support to HDSP 9632

Add 'DDS Sample Rate Offset' control. Allows values in Hz from -5000 to +5000.
The value is added to the nominal sample rate and written to the DDS register.

Signed-off-by: Julian Cable <julian_cable@yahoo.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>


# d7923b2a 16-Oct-2006 Remy Bruno <remy.bruno@trinnov.com>

[ALSA] hdsp - Add DDS register support for RME9632 rev >= 152

Add DDS register support for RME9632 rev >= 152.
This register sets the sample rate for these cards and is required
in addition to the standard control register. It corresponds to a
quartz divisor.

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>


# 6add0f42 09-Oct-2006 Remy Bruno <remy.bruno@trinnov.com>

[ALSA] hdsp: support for mixer matrix of RME9632 rev 152

Added the support for mixer matrix of RME9632 rev 152.

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>


# 176546ab 15-Oct-2006 Remy Bruno <remy.bruno@trinnov.com>

[ALSA] hdsp: precise_ptr control switched off by default

precise_ptr option causes dysfunction with hdsp driver.
Turn it off as default.

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>


# 7ab39926 09-Oct-2006 Clemens Ladisch <clemens@ladisch.de>

[ALSA] use the ALIGN macro

Use the ALIGN macro instead of manual calculations.

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


# 311e70a4 05-Sep-2006 Takashi Iwai <tiwai@suse.de>

[ALSA] hdsp - Fix auto-updating of firmware

Fixed the auto-updating of firmware if the breakout box was switched
off/on. The firmware binary itself was already cached but it wasn't
loaded properly. Also, request_firmware() is issued if the box was
with firmware at module loading time but later it's erased.
The auto-update is triggered at each PCM action (open, prepare, etc)
and at opening proc files.

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


# f40b6890 05-Jul-2006 Takashi Iwai <tiwai@suse.de>

[ALSA] Fix section mismatch errors in ALSA PCI drivers

Fixed 'section mismatch' errors in ALSA PCI drivers:
- removed invalid __devinitdata from pci id tables
- fix/remove __devinit of functions called in suspend/resume

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


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


# ecb594e6 12-Jun-2006 Remy Bruno <remy.bruno@trinnov.com>

[ALSA] RME HDSP - fixed proc interface (missing {})

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


# 140432fd 22-May-2006 Takashi Iwai <tiwai@suse.de>

[ALSA] hdsp - Fix compilation with hdsp driver built in kernel

Fixed the compilation with hdsp driver built in kernel.
The traditional hwdep loader is used in this case.

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


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


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

[ALSA] Remove xxx_t typedefs: PCI HDSP

Modules: RME HDSP driver

Remove xxx_t typedefs from the PCI HDSP driver.

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>


# b0b98119 20-Oct-2005 Takashi Iwai <tiwai@suse.de>

[ALSA] hdsp - Code clean up

Modules: RME HDSP driver

- Add missing KERN_* suffix to printk.
- Clean up parentheses.
- clean up the firmware check code.

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>


# b73c1c12 02-Sep-2005 Clemens Ladisch <clemens@ladisch.de>

[ALSA] hdsp: always initialize card name

RME HDSP driver
When using the kernel firmware loader, initialize the card shortname
before registering the card with ALSA to prevent it from using a
default card ID.

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


# 5549d549 03-Aug-2005 Clemens Ladisch <clemens@ladisch.de>

[ALSA] use PCM interface for IEC958 controls

Digigram VX core,ENS1370/1+ driver,CA0106 driver,EMU10K1/EMU10K2 driver
RME HDSP driver,RME9652 driver
For consistency, use the PCM interface instead of MIXER for IEC958
default/mask/stream mixer controls.

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>


# ef21ca24 09-Jul-2005 Nishanth Aravamudan <nacc@us.ibm.com>

[ALSA] sound/pci: fix-up sleeping paths

ENS1370/1+ driver,ES1968 driver,Intel8x0 driver,VIA82xx driver
VIA82xx-modem driver,AC97 Codec,ALI5451 driver,CS46xx driver
MIXART driver,RME HDSP driver,Trident driver,YMFPCI driver
Description: Fix-up sleeping in sound/pci. These changes fall under the
following two categories:

1) Replace schedule_timeout() with msleep() to guarantee the
task delays as expected. This also involved replacing/removing
custom sleep functions.
2) Do not assume jiffies will only increment by one if you
request a 1 jiffy sleep, i.e. use time_after/time_before in
while loops.

Signed-off-by: Nishanth Aravamudan <nacc@us.ibm.com>
Signed-off-by: Jaroslav Kysela <perex@suse.cz>


# e3ea4d89 04-Jul-2005 Takashi Iwai <tiwai@suse.de>

[ALSA] hdsp - Add 'Sample Clock Source Locking' control

RME HDSP driver
Added 'Sample Clock Source Locking' control. If this switch is on,
the clock source can't be changed via PCM hw_params API (as sample rate).
This will fix the problem of OSS-emulation, for example.

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


# b6a96915 30-May-2005 Takashi Iwai <tiwai@suse.de>

[ALSA] Add write support to snd-page-alloc proc file

Documentation,Memalloc module,RME HDSP driver,RME9652 driver
Add the write support to snd-page-alloc proc file for buffer pre-allocation.
Removed the pre-allocation codes via module options.

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


# 7679a030 25-Apr-2005 Thomas Charbonnel <thomas@undata.org>

[ALSA] hdsp - solved big endian problem

RME HDSP driver
ppc firmware upload fix

Signed-off-by: Thomas Charbonnel <thomas@undata.org>
Signed-off-by: Jaroslav Kysela <perex@suse.cz>


# 01d25d46 11-Apr-2005 Takashi Iwai <tiwai@suse.de>

[ALSA] Replace pci_module_init() with pci_register_driver()

Documentation,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,CA0106 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
Replace the obsolete pci_module_init() with pci_register_driver().

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


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

Linux-2.6.12-rc2

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

Let it rip!