rename & cleanup for ALSA submission candidate

This commit is contained in:
serifpersia 2025-08-02 15:25:09 +02:00
parent 4a1008d070
commit b06eca1e68
9 changed files with 25 additions and 26 deletions

View File

@ -1,5 +1,5 @@
obj-m += snd-usb-us144mkii.o obj-m += snd-usb-us144mkii.o
snd-usb-us144mkii-y := us144mkii.o pcm.o playback.o capture.o midi.o controls.o snd-usb-us144mkii-y := us144mkii.o us144mkii_pcm.o us144mkii_playback.o us144mkii_capture.o us144mkii_midi.o us144mkii_controls.o
all: all:
make -C /lib/modules/$(shell uname -r)/build M=$(PWD) modules make -C /lib/modules/$(shell uname -r)/build M=$(PWD) modules

View File

@ -1,12 +1,12 @@
// SPDX-License-Identifier: GPL-2.0-only // SPDX-License-Identifier: GPL-2.0-only
// Copyright (c) 2025 serifpersia <ramiserifpersia@gmail.com> // Copyright (c) 2025 Šerif Rami <ramiserifpersia@gmail.com>
/* /*
* ALSA Driver for TASCAM US-144MKII Audio Interface * ALSA Driver for TASCAM US-144MKII Audio Interface
*/ */
#include "us144mkii.h" #include "us144mkii.h"
MODULE_AUTHOR("serifpersia <ramiserifpersia@gmail.com>"); MODULE_AUTHOR("Šerif Rami <ramiserifpersia@gmail.com>");
MODULE_DESCRIPTION("ALSA Driver for TASCAM US-144MKII"); MODULE_DESCRIPTION("ALSA Driver for TASCAM US-144MKII");
MODULE_LICENSE("GPL v2"); MODULE_LICENSE("GPL v2");
@ -440,7 +440,11 @@ static int tascam_probe(struct usb_interface *intf, const struct usb_device_id *
int err; int err;
char *handshake_buf; char *handshake_buf;
if (dev->speed != USB_SPEED_HIGH)
dev_info(&dev->dev, "Device is connected to a USB 1.1 port, this is not supported.\n");
if (intf->cur_altsetting->desc.bInterfaceNumber == 1) { if (intf->cur_altsetting->desc.bInterfaceNumber == 1) {
tascam = usb_get_intfdata(usb_ifnum_to_if(dev, 0)); tascam = usb_get_intfdata(usb_ifnum_to_if(dev, 0));
if (tascam) { if (tascam) {
usb_set_intfdata(intf, tascam); usb_set_intfdata(intf, tascam);

View File

@ -1,5 +1,5 @@
/* SPDX-License-Identifier: GPL-2.0-only */ /* SPDX-License-Identifier: GPL-2.0-only */
// Copyright (c) 2025 serifpersia <ramiserifpersia@gmail.com> // Copyright (c) 2025 Šerif Rami <ramiserifpersia@gmail.com>
#ifndef __US144MKII_H #ifndef __US144MKII_H
#define __US144MKII_H #define __US144MKII_H
@ -284,10 +284,10 @@ int tascam_alloc_urbs(struct tascam_card *tascam);
*/ */
void tascam_stop_work_handler(struct work_struct *work); void tascam_stop_work_handler(struct work_struct *work);
/* pcm.h */ /* us144mkii_pcm.h */
#include "pcm.h" #include "us144mkii_pcm.h"
/* midi.c */ /* us144mkii_midi.c */
/** /**
* tascam_midi_in_urb_complete() - Completion handler for MIDI IN URBs * tascam_midi_in_urb_complete() - Completion handler for MIDI IN URBs
* @urb: The completed URB. * @urb: The completed URB.
@ -317,7 +317,7 @@ void tascam_midi_out_urb_complete(struct urb *urb);
*/ */
int tascam_create_midi(struct tascam_card *tascam); int tascam_create_midi(struct tascam_card *tascam);
/* controls.c */ /* us144mkii_controls.c */
/** /**
* tascam_create_controls() - Creates and adds ALSA mixer controls for the device. * tascam_create_controls() - Creates and adds ALSA mixer controls for the device.
* @tascam: The driver instance. * @tascam: The driver instance.

View File

@ -1,8 +1,7 @@
// SPDX-License-Identifier: GPL-2.0-only // SPDX-License-Identifier: GPL-2.0-only
// Copyright (c) 2025 serifpersia <ramiserifpersia@gmail.com> // Copyright (c) 2025 Šerif Rami <ramiserifpersia@gmail.com>
#include "us144mkii.h" #include "us144mkii.h"
#include "pcm.h"
/** /**
* tascam_capture_open() - Opens the PCM capture substream. * tascam_capture_open() - Opens the PCM capture substream.
@ -96,7 +95,7 @@ static snd_pcm_uframes_t tascam_capture_pointer(struct snd_pcm_substream *substr
* including open, close, ioctl, hardware parameters, hardware free, prepare, * including open, close, ioctl, hardware parameters, hardware free, prepare,
* trigger, and pointer. * trigger, and pointer.
*/ */
struct snd_pcm_ops tascam_capture_ops = { const struct snd_pcm_ops tascam_capture_ops = {
.open = tascam_capture_open, .open = tascam_capture_open,
.close = tascam_capture_close, .close = tascam_capture_close,
.ioctl = snd_pcm_lib_ioctl, .ioctl = snd_pcm_lib_ioctl,

View File

@ -1,5 +1,5 @@
// SPDX-License-Identifier: GPL-2.0-only // SPDX-License-Identifier: GPL-2.0-only
// Copyright (c) 2025 serifpersia <ramiserifpersia@gmail.com> // Copyright (c) 2025 Šerif Rami <ramiserifpersia@gmail.com>
#include "us144mkii.h" #include "us144mkii.h"

View File

@ -1,10 +1,8 @@
// SPDX-License-Identifier: GPL-2.0-only // SPDX-License-Identifier: GPL-2.0-only
// Copyright (c) 2025 serifpersia <ramiserifpersia@gmail.com> // Copyright (c) 2025 Šerif Rami <ramiserifpersia@gmail.com>
#include "us144mkii.h" #include "us144mkii.h"
/** /**
* tascam_midi_in_work_handler() - Deferred work for processing MIDI input. * tascam_midi_in_work_handler() - Deferred work for processing MIDI input.
* @work: The work_struct instance. * @work: The work_struct instance.
@ -166,7 +164,7 @@ static void tascam_midi_in_trigger(struct snd_rawmidi_substream *substream, int
* This structure defines the callback functions for MIDI input stream operations, * This structure defines the callback functions for MIDI input stream operations,
* including open, close, and trigger. * including open, close, and trigger.
*/ */
static struct snd_rawmidi_ops tascam_midi_in_ops = { static const struct snd_rawmidi_ops tascam_midi_in_ops = {
.open = tascam_midi_in_open, .open = tascam_midi_in_open,
.close = tascam_midi_in_close, .close = tascam_midi_in_close,
.trigger = tascam_midi_in_trigger, .trigger = tascam_midi_in_trigger,
@ -365,7 +363,7 @@ static void tascam_midi_out_trigger(struct snd_rawmidi_substream *substream, int
* This structure defines the callback functions for MIDI output stream operations, * This structure defines the callback functions for MIDI output stream operations,
* including open, close, trigger, and drain. * including open, close, trigger, and drain.
*/ */
static struct snd_rawmidi_ops tascam_midi_out_ops = { static const struct snd_rawmidi_ops tascam_midi_out_ops = {
.open = tascam_midi_out_open, .open = tascam_midi_out_open,
.close = tascam_midi_out_close, .close = tascam_midi_out_close,
.trigger = tascam_midi_out_trigger, .trigger = tascam_midi_out_trigger,

View File

@ -1,11 +1,10 @@
// SPDX-License-Identifier: GPL-2.0-only // SPDX-License-Identifier: GPL-2.0-only
// Copyright (c) 2025 serifpersia <ramiserifpersia@gmail.com> // Copyright (c) 2025 Šerif Rami <ramiserifpersia@gmail.com>
#include "us144mkii.h" #include "us144mkii.h"
#include "pcm.h"
/** /**
* @brief Rate-to-Packet Fixing Data (Verified) * @brief Rate-to-Packet Fixing Data
* *
* These static arrays define the number of audio frames per USB isochronous * These static arrays define the number of audio frames per USB isochronous
* packet for various sample rates. This data is crucial for maintaining * packet for various sample rates. This data is crucial for maintaining

View File

@ -1,5 +1,5 @@
/* SPDX-License-Identifier: GPL-2.0-only */ /* SPDX-License-Identifier: GPL-2.0-only */
// Copyright (c) 2025 serifpersia <ramiserifpersia@gmail.com> // Copyright (c) 2025 Šerif Rami <ramiserifpersia@gmail.com>
#ifndef __US144MKII_PCM_H #ifndef __US144MKII_PCM_H
#define __US144MKII_PCM_H #define __US144MKII_PCM_H
@ -21,7 +21,7 @@ extern const struct snd_pcm_hardware tascam_pcm_hw;
* including open, close, ioctl, hardware parameters, hardware free, prepare, * including open, close, ioctl, hardware parameters, hardware free, prepare,
* trigger, and pointer. * trigger, and pointer.
*/ */
extern struct snd_pcm_ops tascam_playback_ops; extern const struct snd_pcm_ops tascam_playback_ops;
/** /**
* tascam_capture_ops - ALSA PCM operations for capture. * tascam_capture_ops - ALSA PCM operations for capture.
@ -30,7 +30,7 @@ extern struct snd_pcm_ops tascam_playback_ops;
* including open, close, ioctl, hardware parameters, hardware free, prepare, * including open, close, ioctl, hardware parameters, hardware free, prepare,
* trigger, and pointer. * trigger, and pointer.
*/ */
extern struct snd_pcm_ops tascam_capture_ops; extern const struct snd_pcm_ops tascam_capture_ops;
/** /**
* playback_urb_complete() - Completion handler for playback isochronous URBs. * playback_urb_complete() - Completion handler for playback isochronous URBs.

View File

@ -1,8 +1,7 @@
// SPDX-License-Identifier: GPL-2.0-only // SPDX-License-Identifier: GPL-2.0-only
// Copyright (c) 2025 serifpersia <ramiserifpersia@gmail.com> // Copyright (c) 2025 Šerif Rami <ramiserifpersia@gmail.com>
#include "us144mkii.h" #include "us144mkii.h"
#include "pcm.h"
/** /**
* tascam_playback_open() - Opens the PCM playback substream. * tascam_playback_open() - Opens the PCM playback substream.
@ -139,7 +138,7 @@ static snd_pcm_uframes_t tascam_playback_pointer(struct snd_pcm_substream *subst
* including open, close, ioctl, hardware parameters, hardware free, prepare, * including open, close, ioctl, hardware parameters, hardware free, prepare,
* trigger, and pointer. * trigger, and pointer.
*/ */
struct snd_pcm_ops tascam_playback_ops = { const struct snd_pcm_ops tascam_playback_ops = {
.open = tascam_playback_open, .open = tascam_playback_open,
.close = tascam_playback_close, .close = tascam_playback_close,
.ioctl = snd_pcm_lib_ioctl, .ioctl = snd_pcm_lib_ioctl,