History log of /linux-master/sound/usb/line6/podhd.c
Revision Date Author Comments
# 6c955a9d 01-Aug-2022 Takashi Iwai <tiwai@suse.de>

ALSA: line6: Replace sprintf() with sysfs_emit()

For sysfs outputs, it's safer to use a new helper, sysfs_emit(),
instead of the raw sprintf() & co. This patch replaces those usages
straightforwardly with a new helper, sysfs_emit().

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


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


# 71ea8eeb 17-Jul-2020 YueHaibing <yuehaibing@huawei.com>

ALSA: line6: Use kmemdup in podhd_set_monitor_level()

Use kmemdup rather than duplicating its implementation.

Signed-off-by: YueHaibing <yuehaibing@huawei.com>
Link: https://lore.kernel.org/r/20200717081710.39180-1-yuehaibing@huawei.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 0afff876 13-Jul-2020 Vasily Khoruzhick <anarsoul@gmail.com>

ALSA: line6: add hw monitor volume control for POD HD500

Add hw monitor volume control for POD HD500. The same change may
work for HD500X but I don't have it to test.

Signed-off-by: Vasily Khoruzhick <anarsoul@gmail.com>
Link: https://lore.kernel.org/r/20200713152852.65832-1-anarsoul@gmail.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# cc18b2f4 25-Apr-2020 Vasily Khoruzhick <anarsoul@gmail.com>

ALSA: line6: Fix POD HD500 audio playback

Apparently interface 1 is control interface akin to HD500X,
setting LINE6_CAP_CONTROL and choosing it as ctrl_if fixes
audio playback on POD HD500.

Signed-off-by: Vasily Khoruzhick <anarsoul@gmail.com>
Cc: <stable@vger.kernel.org>
Link: https://lore.kernel.org/r/20200425201115.3430-1-anarsoul@gmail.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>


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


# 70256b42 18-Jul-2019 Kai-Heng Feng <kai.heng.feng@canonical.com>

ALSA: line6: Fix wrong altsetting for LINE6_PODHD500_1

Commit 7b9584fa1c0b ("staging: line6: Move altsetting to properties")
set a wrong altsetting for LINE6_PODHD500_1 during refactoring.

Set the correct altsetting number to fix the issue.

BugLink: https://bugs.launchpad.net/bugs/1790595
Fixes: 7b9584fa1c0b ("staging: line6: Move altsetting to properties")
Signed-off-by: Kai-Heng Feng <kai.heng.feng@canonical.com>
Cc: <stable@vger.kernel.org>
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>


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

ALSA: line6: podhd: Rewrite complex timer & work combo with a delayed work

POD HD driver had a complex staged startup sequence with both timer
and work. This patch simplifies it to a single delayed work with a
single stage.

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>


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


# 54a4b2b4 09-Oct-2017 Takashi Iwai <tiwai@suse.de>

ALSA: line6: Fix NULL dereference at podhd_disconnect()

When podhd_init() failed with the acquiring a ctrl i/f, the line6
helper still calls the disconnect callback that eventually calls again
usb_driver_release_interface() with the NULL intf.

Put the proper NULL check before calling it for avoiding an Oops.

Fixes: fc90172ba283 ("ALSA: line6: Claim pod x3 usb data interface")
Reported-by: Andrey Konovalov <andreyknvl@google.com>
Tested-by: Andrey Konovalov <andreyknvl@google.com>
Cc: <stable@vger.kernel.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# cb02ffc7 09-Oct-2017 Takashi Iwai <tiwai@suse.de>

ALSA: line6: Fix missing initialization before error path

The error path in podhd_init() tries to clear the pending timer, while
the timer object is initialized at the end of init sequence, thus it
may hit the uninitialized object, as spotted by syzkaller:

INFO: trying to register non-static key.
the code is fine but needs lockdep annotation.
turning off the locking correctness validator.
CPU: 1 PID: 1845 Comm: kworker/1:2 Not tainted
4.14.0-rc2-42613-g1488251d1a98 #238
Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS Bochs 01/01/2011
Workqueue: usb_hub_wq hub_event
Call Trace:
__dump_stack lib/dump_stack.c:16
dump_stack+0x292/0x395 lib/dump_stack.c:52
register_lock_class+0x6c4/0x1a00 kernel/locking/lockdep.c:769
__lock_acquire+0x27e/0x4550 kernel/locking/lockdep.c:3385
lock_acquire+0x259/0x620 kernel/locking/lockdep.c:4002
del_timer_sync+0x12c/0x280 kernel/time/timer.c:1237
podhd_disconnect+0x8c/0x160 sound/usb/line6/podhd.c:299
line6_probe+0x844/0x1310 sound/usb/line6/driver.c:783
podhd_probe+0x64/0x70 sound/usb/line6/podhd.c:474
....

For addressing it, assure the initializations of timer and work by
moving them to the beginning of podhd_init().

Fixes: 790869dacc3d ("ALSA: line6: Add support for POD X3")
Reported-by: Andrey Konovalov <andreyknvl@google.com>
Tested-by: Andrey Konovalov <andreyknvl@google.com>
Cc: <stable@vger.kernel.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 729fbfc9 18-Sep-2017 Hans P. Möller Ebner <hmoller@uc.cl>

ALSA: line6: add support for POD HD DESKTOP

Add support for the Line6 POD HD500X multi effect processor for playback
and capture (in/out audio) through USB.

Signed-off-by: Hans P. Moller <hmoller@uc.cl>
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 8cad7a3d 16-Jun-2017 Hans P. Möller Ebner <hmoller@uc.cl>

ALSA: line6: remove unnecessary initialization to PODHD500X

Remove Initialization from POD HD500X because it's not needed.
Every time the device is connected dmesg gives the following output:
"receive length failed (error -11)".
To solve this problem, another flags is introduced
(LINE6_CAP_CONTROL_INFO) and it is only used for PODX3 in: sysfs
entries, call podhd_startup_finalize(pod) and disconnection.
With this patch the error disappear.

Signed-off-by: Hans P. Moller <hmoller@uc.cl>
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# c1d25075 16-Jun-2017 Hans P. Möller Ebner <hmoller@uc.cl>

ALSA: line6: add support for POD HD500X

Add support for the Line6 POD HD500X multi effect processor for
playback and capture (in/out audio) through USB.

Signed-off-by: Hans P. Moller <hmoller@uc.cl>
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# fc90172b 29-Nov-2016 Andrej Krutak <dev@andree.sk>

ALSA: line6: Claim pod x3 usb data interface

Userspace apps have to claim USB interfaces before using endpoints in
them (drivers/usb/core/devio.c:checkintf()). It's a lock mechanism so
that two "drivers" don't steal data from each other. Kernel drivers don't
have to claim interfaces to work - but they should, to lock out userspace.

While there, fix line6_properties struct to match checkpatch.pl.

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


# b907900e 05-Oct-2016 Andrej Krutak <dev@andree.sk>

ALSA: line6: Fix POD X3 Live audio input

The commit c039aaa77a7d1d9375665a8b59ec16dc7d23e259 was incomplete,
missing part of the setup for Live. This makes also audio input work,
in addition to audio output.

Fixes: c039aaa77a7d1d9375665a8b59ec16dc7d23e259
Reported-by: Eddi De Pieri <eddi@depieri.net>
Signed-off-by: Andrej Krutak <dev@andree.sk>
Signed-off-by: Takashi Iwai <tiwai@suse.de>


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

ALSA: line6: Cleanup podhd initialization

Only initialize PCM for POD HD devices that support it.
No POD HD seems to support MIDI, thus drop the initialization.

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


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

ALSA: line6: Add support for POD X3 Live (only USB ID differs from POD X3)

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


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

ALSA: line6: Add support for POD X3

This includes audio in/out and basic initialization via control EP (emulates
what original driver does). The initialization is done similarly to original
POD, firmware and serial IDs are read and exported via sysfs.

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>


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


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


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

ALSA: line6: Remove struct usb_line6_podhd

It's identical with struct usb_line6.

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>


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


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


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


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


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