History log of /linux-master/sound/usb/line6/toneport.c
Revision Date Author Comments
# f4000b58 25-Oct-2021 Johan Hovold <johan@kernel.org>

ALSA: line6: fix control and interrupt message timeouts

USB control and interrupt message timeouts are specified in milliseconds
and should specifically not vary with CONFIG_HZ.

Fixes: 705ececd1c60 ("Staging: add line6 usb driver")
Cc: stable@vger.kernel.org # 2.6.30
Signed-off-by: Johan Hovold <johan@kernel.org>
Link: https://lore.kernel.org/r/20211025121142.6531-3-johan@kernel.org
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 6d2d427e 23-Sep-2020 Greg Kroah-Hartman <gregkh@linuxfoundation.org>

sound: line6: move to use usb_control_msg_send() and usb_control_msg_recv()

The usb_control_msg_send() and usb_control_msg_recv() calls can return
an error if a "short" write/read happens, and they can handle data off
of the stack, so move the driver over to using those calls instead,
saving some logic when dynamically allocating memory.

v2: API change of use usb_control_msg_send() and usb_control_msg_recv()

Cc: Jaroslav Kysela <perex@perex.cz>
Cc: Vasily Khoruzhick <anarsoul@gmail.com>
Reviewed-by: Takashi Iwai <tiwai@suse.de>
Link: https://lore.kernel.org/r/20200914153756.3412156-9-gregkh@linuxfoundation.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Link: https://lore.kernel.org/r/20200923134348.23862-13-oneukum@suse.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# ec4ed7dc 23-Sep-2020 Oliver Neukum <oneukum@suse.com>

Revert "sound: line6: move to use usb_control_msg_send() and usb_control_msg_recv()"

This reverts commit f7ef7614f89e943d7511ee121b0b849f27b60cb2.
The API has to be changed.
Signed-off-by: Oliver Neukum <oneukum@suse.com>
Link: https://lore.kernel.org/r/20200923134348.23862-5-oneukum@suse.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# f7ef7614 14-Sep-2020 Greg Kroah-Hartman <gregkh@linuxfoundation.org>

sound: line6: move to use usb_control_msg_send() and usb_control_msg_recv()

The usb_control_msg_send() and usb_control_msg_recv() calls can return
an error if a "short" write/read happens, and they can handle data off
of the stack, so move the driver over to using those calls instead,
saving some logic when dynamically allocating memory.

Cc: Jaroslav Kysela <perex@perex.cz>
Cc: Vasily Khoruzhick <anarsoul@gmail.com>
Reviewed-by: Takashi Iwai <tiwai@suse.de>
Link: https://lore.kernel.org/r/20200914153756.3412156-9-gregkh@linuxfoundation.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


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

ALSA: line6: Constify snd_ratden definitions

The snd_ratden definitions used in line6 drivers are all read-only, so
they can be marked as const.

There should be no functional changes by this patch.

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


# a10e763b 31-May-2019 Thomas Gleixner <tglx@linutronix.de>

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

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 version 2

extracted by the scancode license scanner the SPDX license identifier

GPL-2.0-only

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

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


# f23a09ee 28-May-2019 Takashi Iwai <tiwai@suse.de>

ALSA: line6: Use container_of()

... instead of unconditional cast.

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


# 0b074ab7 28-May-2019 Takashi Iwai <tiwai@suse.de>

ALSA: line6: Assure canceling delayed work at disconnection

The current code performs the cancel of a delayed work at the late
stage of disconnection procedure, which may lead to the access to the
already cleared state.

This patch assures to call cancel_delayed_work_sync() at the beginning
of the disconnection procedure for avoiding that race. The delayed
work object is now assigned in the common line6 object instead of its
derivative, so that we can call cancel_delayed_work_sync().

Along with the change, the startup function is called via the new
callback instead. This will make it easier to port other LINE6
drivers to use the delayed work for startup in later patches.

Reported-by: syzbot+5255458d5e0a2b10bbb9@syzkaller.appspotmail.com
Fixes: 7f84ff68be05 ("ALSA: line6: toneport: Fix broken usage of timer for delayed execution")
Cc: <stable@vger.kernel.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 7f84ff68 08-May-2019 Takashi Iwai <tiwai@suse.de>

ALSA: line6: toneport: Fix broken usage of timer for delayed execution

The line6 toneport driver has code for some delayed initialization,
and this hits the kernel Oops because mutex and other sleepable
functions are used in the timer callback. Fix the abuse by a delayed
work instead so that everything works gracefully.

Reported-by: syzbot+a07d0142e74fdd595cfb@syzkaller.appspotmail.com
Cc: <stable@vger.kernel.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# e5c812e8 28-Apr-2019 Greg Kroah-Hartman <gregkh@linuxfoundation.org>

ALSA: line6: use dynamic buffers

The line6 driver uses a lot of USB buffers off of the stack, which is
not allowed on many systems, causing the driver to crash on some of
them. Fix this up by dynamically allocating the buffers with kmalloc()
which allows for proper DMA-able memory.

Reported-by: Christo Gouws <gouws.christo@gmail.com>
Reported-by: Alan Stern <stern@rowland.harvard.edu>
Tested-by: Christo Gouws <gouws.christo@gmail.com>
Cc: stable <stable@vger.kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 05b8ccfb 06-Apr-2019 Jacek Anaszewski <jacek.anaszewski@gmail.com>

ALSA: line6: Avoid polluting led_* namespace

led_colors clashes with the array of the same name being added
to the LED class. Do the following amendments to fix this issue
and the other prospective one.

led_colors -> toneport_led_colors
led_init_vals -> toneport_led_init_vals

Fixes: f44edd7b2bbed ("ALSA: line6/toneport: Implement LED controls via LED class")
Signed-off-by: Jacek Anaszewski <jacek.anaszewski@gmail.com>
Cc: Jaroslav Kysela <perex@perex.cz>
Cc: Arnd Bergmann <arnd@arndb.de>
Reviewed-by: Takashi Iwai <tiwai@suse.de>


# a8eaad7b 18-Jun-2018 Arnd Bergmann <arnd@arndb.de>

ALSA: line6: stop using get_seconds()

The get_seconds() function is deprecated because it truncates the
timestamp to 32 bits, so all users should change to ktime_get_seconds()
or ktime_get_real_seconds().

The firmware interface for passing the timestamp is also limited to
32 bits, so this patch only has the cosmetic effect of avoiding the
old interface.

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


# a6162afa 16-Oct-2017 Kees Cook <keescook@chromium.org>

ALSA: usb-audio: 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.

Signed-off-by: Kees Cook <keescook@chromium.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 49c41e1f 12-Apr-2017 Bhumika Goyal <bhumirks@gmail.com>

ALSA: line6: constify snd_kcontrol_new structures

Declare snd_kcontrol_new strcutures as const as they are only passed as
an argument to the function snd_ctl_new1. This argument is of type const,
so snd_kcontrol_new structures having this property can be made const too.
Done using Coccinelle:

@r disable optional_qualifier@
identifier x;
position p;
@@
static struct snd_kcontrol_new x@p={...};

@ok@
identifier r.x;
position p;
@@
snd_ctl_new1(&x@p,...)

@bad@
position p != {r.p,ok.p};
identifier r.x;
@@
x@p

@depends on !bad disable optional_qualifier@
identifier r.x;
@@
+const
struct snd_kcontrol_new x;

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


# f56742cc 18-Sep-2016 Andrej Krutak <dev@andree.sk>

ALSA: line6: Add LINE6_CAP_IN_NEEDS_OUT, a void playback stream during capture

E.g. POD X3 seems to require playback data to be sent to it to generate
capture data. Otherwise the device stalls and doesn't send any more capture
data until it's reset.

Signed-off-by: Andrej Krutak <dev@andree.sk>
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 97d78acf 18-Sep-2016 Andrej Krutak <dev@andree.sk>

ALSA: line6: Allow different channel numbers for in/out

Changes bytes_per_frame to bytes_per_channel.

Signed-off-by: Andrej Krutak <dev@andree.sk>
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 0e806151 10-Feb-2015 Chris Rorvick <chris@rorvick.com>

ALSA: line6: toneport: Use explicit type for firmware version

The firmware version is a single byte so have the variable type agree.
Since the address to this member is passed to the read function, using
an int is not even portable.

Signed-off-by: Chris Rorvick <chris@rorvick.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 12b00157 10-Feb-2015 Chris Rorvick <chris@rorvick.com>

ALSA: line6: Use explicit type for serial number

The serial number (aka ESN) is a 32-bit value.

Signed-off-by: Chris Rorvick <chris@rorvick.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 12865cac 07-Feb-2015 Chris Rorvick <chris@rorvick.com>

ALSA: line6: Pass driver name to line6_probe()

Provide a unique name for each driver instead of using "line6usb" for
all of them. This will allow for different configurations based on the
driver type.

Signed-off-by: Chris Rorvick <chris@rorvick.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# f2bd242f 07-Feb-2015 Chris Rorvick <chris@rorvick.com>

ALSA: line6: Pass toneport pointer to toneport_has_led()

It is unlikely this function would ever be used in a context without a
pointer to a `struct usb_line6_toneport', so grab the device type from
it rather than having the caller do it.

Signed-off-by: Chris Rorvick <chris@rorvick.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 89444601 07-Feb-2015 Chris Rorvick <chris@rorvick.com>

ALSA: line6: Add toneport_has_source_select()

Add a predicate for testing if the device supports source selection to
make the conditional logic around this a bit cleaner.

Signed-off-by: Chris Rorvick <chris@rorvick.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 1263f611 28-Jan-2015 Takashi Iwai <tiwai@suse.de>

ALSA: line6: Remove snd_line6_ prefix of pcm property fields

It's just superfluous and doesn't give any better readability.

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


# 129b3be6 28-Jan-2015 Takashi Iwai <tiwai@suse.de>

ALSA: line6: Move the contents of usbdefs.h into driver.h

Most of them are rather relevant with the definitions in driver.h,
and there are only a few lines, so just rip it off.

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


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

ALSA: line6: Tidy up and typo fixes in comments

Just reformatting the comments and typos fixed, no functional
changes. Particularly,
- avoid the kerneldoc marker "/**",
- reduce multiple comment lines into single lines,
- corrected wrongly referred function names

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


# 247d95ee 27-Jan-2015 Takashi Iwai <tiwai@suse.de>

ALSA: line6: Handle error from line6_pcm_acquire()

Tested-by: Chris Rorvick <chris@rorvick.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 63e20df1 27-Jan-2015 Takashi Iwai <tiwai@suse.de>

ALSA: line6: Reorganize PCM stream handling

The current code deals with the stream start / stop solely via
line6_pcm_acquire() and line6_pcm_release(). This was (supposedly)
intended to avoid the races, but it doesn't work as expected. The
concurrent acquire and release calls can be performed without proper
protections, thus this might result in memory corruption.
Furthermore, we can't take a mutex to protect the whole function
because it can be called from the PCM trigger callback that is an
atomic context. Also spinlock isn't appropriate because the function
allocates with kmalloc with GFP_KERNEL. That is, these function just
lead to singular problems.

This is an attempt to reduce the existing races. First off, separate
both the stream buffer management and the stream URB management. The
former is protected via a newly introduced state_mutex while the
latter is protected via each line6_pcm_stream lock.

Secondly, the stream state are now managed in opened and running bit
flags of each line6_pcm_stream. Not only this a bit clearer than
previous combined bit flags, this also gives a better abstraction.
These rewrites allows us to make common hw_params and hw_free
callbacks for both playback and capture directions.

For the monitor and impulse operations, still line6_pcm_acquire() and
line6_pcm_release() are used. They call internally the corresponding
functions for both playback and capture streams with proper lock or
mutex. Unlike the previous versions, these function don't take the
bit masks but the only single type value. Also they are supposed to
be applied only as duplex operations.

Tested-by: Chris Rorvick <chris@rorvick.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# aca514b8 25-Jan-2015 Takashi Iwai <tiwai@suse.de>

ALSA: line6: Let snd_card_new() allocate private data

Instead of allocating the private data individually in each driver's
probe at first, let snd_card_new() allocate the data that is called in
line6_probe(). This simplifies the primary probe functions.

Tested-by: Chris Rorvick <chris@rorvick.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# f66fd990 25-Jan-2015 Takashi Iwai <tiwai@suse.de>

ALSA: line6: Drop interface argument from private_init and disconnect callbacks

The interface argument is used just for retrieving the assigned
device, which can be already found in line6->ifcdev. Drop them from
the callbacks. Also, pass the usb id to private_init so that the
driver can deal with it there. This is a preliminary work for the
further cleanup to move the whole allocation into driver.c.

Tested-by: Chris Rorvick <chris@rorvick.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# f44edd7b 20-Jan-2015 Takashi Iwai <tiwai@suse.de>

ALSA: line6/toneport: Implement LED controls via LED class

Instead of non-standard sysfs, reimplement the LED controls on
TonePort as LED class devices.

Tested-by: Chris Rorvick <chris@rorvick.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# bf115fcf 20-Jan-2015 Takashi Iwai <tiwai@suse.de>

ALSA: line6/toneport: Fix wrong argument for toneport_has_led()

Tested-by: Chris Rorvick <chris@rorvick.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 6dd1c05c 20-Jan-2015 Takashi Iwai <tiwai@suse.de>

ALSA: line6/toneport: Move setup_timer() at the beginning

... so that timer_del_sync() in the destructor can be called safely at
any time. Also move the mod_timer() call in toneport_setup(), which
is a bit clearer place.

Tested-by: Chris Rorvick <chris@rorvick.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 8a3b7c08 20-Jan-2015 Takashi Iwai <tiwai@suse.de>

ALSA: line6: Remove superfluous NULL checks in each driver

The interface and driver objects are always set when callbacks are
called. Drop such superfluous NULL checks in init and disconnect
calls of each driver.

Tested-by: Chris Rorvick <chris@rorvick.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# c078a4aa 20-Jan-2015 Chris Rorvick <chris@rorvick.com>

ALSA: line6: Remove driver version from header comment

The driver version string was removed in an ealier commit for being
useless. These are equally useless.

Signed-off-by: Chris Rorvick <chris@rorvick.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# c6fffce9 20-Jan-2015 Chris Rorvick <chris@rorvick.com>

ALSA: line6: Refer to manufacturer as "Line 6"

The correct spelling includes the space. Fix this in strings and
comments that refer to the manufacturer.

Signed-off-by: Chris Rorvick <chris@rorvick.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>


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

ALSA: line6: Remove CHECK_RETURN macro

Such a macro doesn't improve readability.

Tested-by: Chris Rorvick <chris@rorvick.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>


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

ALSA: line6: Reorganize card resource handling

This is a fairly big rewrite regarding the card resource management in
line6 drivers:

- The card creation is moved into line6_probe(). This adds the global
destructor to private_free, so that each driver doesn't have to call
it any longer.

- The USB disconnect callback handles the card release, thus each
driver needs to concentrate on only its own resources. No need to
snd_card_*() call in the destructor.

- Fix the potential stall in disconnection by removing
snd_card_free(). It's replaced with snd_card_free_when_closed()
for asynchronous release.

- The only remaining operation for the card in each driver is the call
of snd_card_register(). All the rest are dealt in the common module
by itself.

- These ended up with removal of audio.[ch] as a result of a reduction
of one layer. Each driver just needs to call line6_probe().

Tested-by: Chris Rorvick <chris@rorvick.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>


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

ALSA: line6: Drop invalid SNDRV_PCM_INFO_RESUME flag

The line6 drivers don't support the full resume although they set
SNDRV_PCM_INFO_RESUME. These flags have to be dropped to inform
properly to the user-space.

Also, drop the CONFIG_PM in trigger callbacks, too, which are rather
superfluous.

Tested-by: Chris Rorvick <chris@rorvick.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# ccddbe4a 15-Jan-2015 Takashi Iwai <tiwai@suse.de>

ALSA: line6: Split to each driver

Split to each individual driver for POD, PODHD, TonePort and Variax
with a core LINE6 helper module. The new modules follow the standard
ALSA naming rule with snd prefix: snd-usb-pod, snd-usb-podhd,
snd-usb-toneport and snd-usb-variax, together with the corresponding
CONFIG_SND_USB_* Kconfig items.

Tested-by: Chris Rorvick <chris@rorvick.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>


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

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

No functional change, refactoring with the standard helpers.

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


# 61864d84 12-Jan-2015 Takashi Iwai <tiwai@suse.de>

ALSA: move line6 usb driver into sound/usb

Promote line6 driver from staging to sound/usb/line6 directory, and
maintain through sound subsystem tree.

This commit just moves the code and adapts Makefile / Kconfig.
The further renames and misc cleanups will follow.

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