Skip to contentSkip to conversation

ALSA: usb-audio: Add support for TASCAM US-144MKII

RFC PATCH In review Šerif Rami 4 participants 7 messages Aug 3, 2025 – Aug 8, 2025 Sound

lore
Share & tools
lore
#0 lore raw

RFC PATCH v3 1/1 ALSA: usb-audio: Add support for TASCAM US-144MKII

Hi,

Apologies for the invalid patches and the noise from my earlier attempts. I have corrected my workflow and am now submitting this properly.

This patch introduces a new, dedicated driver for the TASCAM US-144MKII.
It replaces the partial support that previously existed
in the us122l driver, which now no longer targets this device.
The new driver implements ALSA compatible duplex and RawMIDI implementation of proprietary MIDI protocol.

This v3 patch has been tested as follows:
The code has been checked against the kernel's coding style guidelines.
It compiles cleanly without any warnings or errors.
I have performed a full kernel build against the latest master branch, installed it, and successfully verified that the module loads and functions correctly with the hardware.

Any feedback is greatly appreciated.

---
 sound/usb/Kconfig                    |  13 +
 sound/usb/usx2y/Makefile             |   2 +
 sound/usb/usx2y/us122l.c             |   6 -
 sound/usb/usx2y/us144mkii.c          | 655 +++++++++++++++++++++++++++
 sound/usb/usx2y/us144mkii.h          | 331 ++++++++++++++
 sound/usb/usx2y/us144mkii_capture.c  | 309 +++++++++++++
 sound/usb/usx2y/us144mkii_controls.c | 424 +++++++++++++++++
 sound/usb/usx2y/us144mkii_midi.c     | 417 +++++++++++++++++
 sound/usb/usx2y/us144mkii_pcm.c      | 456 +++++++++++++++++++
 sound/usb/usx2y/us144mkii_pcm.h      | 162 +++++++
 sound/usb/usx2y/us144mkii_playback.c | 453 ++++++++++++++++++
 11 files changed, 3222 insertions(+), 6 deletions(-)
 create mode 100644 sound/usb/usx2y/us144mkii.c
 create mode 100644 sound/usb/usx2y/us144mkii.h
 create mode 100644 sound/usb/usx2y/us144mkii_capture.c
 create mode 100644 sound/usb/usx2y/us144mkii_controls.c
 create mode 100644 sound/usb/usx2y/us144mkii_midi.c
 create mode 100644 sound/usb/usx2y/us144mkii_pcm.c
 create mode 100644 sound/usb/usx2y/us144mkii_pcm.h
 create mode 100644 sound/usb/usx2y/us144mkii_playback.c
sound/usb/Kconfig +13 -0
index 41c47301bc19..ef6be7c06d89 100644
@@ -117,6 +117,19 @@ config SND_USB_US122L
 	  To compile this driver as a module, choose M here: the module
 	  will be called snd-usb-us122l.
 
+config SND_USB_US144MKII
+	tristate "Tascam US-144MKII USB driver"
+	depends on X86 || COMPILE_TEST
+	select SND_HWDEP
+	select SND_RAWMIDI
+	select SND_PCM
+	help
+	  Say Y here to include support for Tascam US-144MKII USB Audio/MIDI
+	  interfaces.
+
+	  To compile this driver as a module, choose M here: the module
+	  will be called snd-usb-us144mkii.
+
 config SND_USB_6FIRE
 	tristate "TerraTec DMX 6Fire USB"
 	select FW_LOADER
sound/usb/usx2y/Makefile +2 -0
index fc033aba03a4..eca3680ad231 100644
@@ -1,6 +1,8 @@
 # SPDX-License-Identifier: GPL-2.0
 snd-usb-usx2y-y := usbusx2y.o usX2Yhwdep.o usx2yhwdeppcm.o
 snd-usb-us122l-y := us122l.o
+snd-usb-us144mkii-y := us144mkii.o us144mkii_pcm.o us144mkii_playback.o us144mkii_capture.o us144mkii_midi.o us144mkii_controls.o
 
 obj-$(CONFIG_SND_USB_USX2Y) += snd-usb-usx2y.o
 obj-$(CONFIG_SND_USB_US122L) += snd-usb-us122l.o
+obj-$(CONFIG_SND_USB_US144MKII) += snd-usb-us144mkii.o
sound/usb/usx2y/us122l.c +0 -6
index 2ace3ba46091..8dbbefe3e730 100644
@@ -686,12 +686,6 @@ static const struct usb_device_id snd_us122l_usb_id_table[] = {
 		.idVendor =	0x0644,
 		.idProduct =	USB_ID_US122MKII
 	},
-	{
-		.match_flags =	USB_DEVICE_ID_MATCH_DEVICE,
-		.idVendor =	0x0644,
-		.idProduct =	USB_ID_US144MKII,
-		.driver_info =	US122L_FLAG_US144
-	},
 	{ /* terminator */ }
 };
 MODULE_DEVICE_TABLE(usb, snd_us122l_usb_id_table);
sound/usb/usx2y/us144mkii.c new file +655 -0

655 lines not on this page · raw message

sound/usb/usx2y/us144mkii.h new file +331 -0

331 lines not on this page · raw message

sound/usb/usx2y/us144mkii_capture.c new file +309 -0

309 lines not on this page · raw message

sound/usb/usx2y/us144mkii_controls.c new file +424 -0

424 lines not on this page · raw message

sound/usb/usx2y/us144mkii_midi.c new file +417 -0

417 lines not on this page · raw message

sound/usb/usx2y/us144mkii_pcm.c new file +456 -0

456 lines not on this page · raw message

sound/usb/usx2y/us144mkii_pcm.h new file +162 -0

162 lines not on this page · raw message

sound/usb/usx2y/us144mkii_playback.c new file +453 -0

207 lines not on this page · raw message

The rest of this diff is not shown. View the raw message.

Signature · 1 line
2.39.5

Part of the diff is not shown here. View the raw message.

#1 lore raw
Quoted 7 lines · Šerif Rami
sound/usb/usx2y/us144mkii.c new file +7 -0
+/**
+ * driver_version_show() - Sysfs attribute to display the driver version.
+ * @dev: Pointer to the device structure.
+ * @attr: Pointer to the device attribute structure.
+ * @buf: Buffer to write the version string into.
+ *
+ * This function is a sysfs callback that provides the current driver version

sound/usb/usx2y/us144mkii.c line 57

Quoted 10 lines
sound/usb/usx2y/us144mkii.c new file +10 -0
+ * string to user-space when the 'driver_version' attribute is read.
+ *
+ * Return: The number of bytes written to the buffer.
+ */
+static ssize_t driver_version_show(struct device *dev,
+				   struct device_attribute *attr, char *buf)
+{
+	return sysfs_emit(buf, "%s\n", DRIVER_VERSION);
+}
+static DEVICE_ATTR_RO(driver_version);

The driver version makes no sense when it is in the kernel tree, so this can be removed.

Also, all sysfs files need to be documented in Documentation/ABI/

thanks,

greg k-h

#2 lore raw
Quoted 2 lines

The driver version makes no sense when it is in the kernel tree, so this can be removed.

Hi Greg,

The driver version was being used in my GUI Qt control panel for the device. It's not a problem to remove it; I was following what the existing GUI for the device was doing in other operating systems.

Thanks for the feedback,
-Šerif

#3 lore raw
In reply to Šerif Rami
kernel test robot noticed the following build errors:

Hi Šerif,

[This is a private test report for your RFC patch.] kernel test robot noticed the following build errors:

[auto build test ERROR on tiwai-sound/for-next]
[also build test ERROR on tiwai-sound/for-linus linus/master v6.16 next-20250805] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/erif-Rami/ALSA-usb-audio-Add-support-for-TASCAM-US-144MKII/20250804-043506
base:   https://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound.git for-next
patch link:    https://lore.kernel.org/r/20250803203409.17005-1-ramiserifpersia%40gmail.com
patch subject: [RFC PATCH v3] ALSA: usb-audio: Add support for TASCAM US-144MKII
config: hexagon-allmodconfig (https://download.01.org/0day-ci/archive/20250805/[email protected]/config)
compiler: clang version 17.0.6 (https://github.com/llvm/llvm-project 6009708b4367171ccdbf4b5905cb6a803753fe18)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20250805/[email protected]/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/

All errors (new ones prefixed by >>, old ones prefixed by <<):

>> ERROR: modpost: "__hexagon_umoddi3" [sound/usb/usx2y/snd-usb-us144mkii.ko] undefined!
Signature · 2 lines
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
#4 lore raw
In reply to Šerif Rami
Quoted 11 lines · Šerif Rami

Hi,

Apologies for the invalid patches and the noise from my earlier attempts. I have corrected my workflow and am now submitting this properly.

This patch introduces a new, dedicated driver for the TASCAM US-144MKII.
It replaces the partial support that previously existed
in the us122l driver, which now no longer targets this device.
The new driver implements ALSA compatible duplex and RawMIDI implementation of proprietary MIDI protocol.

Quoted 6 lines

This v3 patch has been tested as follows:
The code has been checked against the kernel's coding style guidelines.
It compiles cleanly without any warnings or errors.
I have performed a full kernel build against the latest master branch, installed it, and successfully verified that the module loads and functions correctly with the hardware.

Any feedback is greatly appreciated.

Thanks for the patch. The code looks almost good and you can submit as a proper patch at the next submission.
A few points from my side:

- The sysfs file should be dropped as Greg suggested

- Try to use guard() for spinlocks. (I know other USB audio drivers don't do that yet, but I already have a bit patch set to convert those.)

Of course, there are cases where guard() and scoped_guard() don't fit well (e.g. the loop with temporary unlock/re-locking), but in most cases, you can use it well. If it doesn't fit, it's a good chance to take a look at your code again and reconsider whether the code flow can be changed better.

- Similarly, try to use __free(kfree) for temporary buffers.

- snd_pcm_lib_preallocate_*() can be replaced with snd_pcm_set_managed_buffer(). Then you can drop snd_pcm_lib_malloc_pages() and snd_pcm_lib_free_pages() calls from hw_params and hw_free callbacks, too.

- Most of enum info callbacks can be simplified with snd_ctl_enum_info() helper function.

- It's a bit big code and it'd be great if you can split the patches in a logical manner. But it'd be OK-ish to have a single patch if it's not easy, too.

thanks,

Takashi

#5 lore raw

Hi Takashi,

Thank you for your reply and for taking the time to review my patch.

Quoted 19 lines

- The sysfs file should be dropped as Greg suggested

- Try to use guard() for spinlocks. (I know other USB audio drivers don't do that yet, but I already have a bit patch set to convert those.)

Of course, there are cases where guard() and scoped_guard() don't fit well (e.g. the loop with temporary unlock/re-locking), but in most cases, you can use it well. If it doesn't fit, it's a good chance to take a look at your code again and reconsider whether the code flow can be changed better.

- Similarly, try to use __free(kfree) for temporary buffers.

- snd_pcm_lib_preallocate_*() can be replaced with snd_pcm_set_managed_buffer(). Then you can drop snd_pcm_lib_malloc_pages() and snd_pcm_lib_free_pages() calls from hw_params and hw_free callbacks, too.

Quoted 6 lines

- Most of enum info callbacks can be simplified with snd_ctl_enum_info() helper function.

- It's a bit big code and it'd be great if you can split the patches in a logical manner. But it'd be OK-ish to have a single patch if it's not easy, too.

I will implement the suggested changes.

Regarding patch splitting, since most of the driver code is new, the plan is to create two patches: one that removes the US-144MKII device binding from the existing us122l driver, and a second that adds the new driver files under sound/usb/usx2y. Please let me know if this sounds good or if you’d prefer a different approach.

Best regards,
Šerif Rami

#6 lore raw
Quoted 27 lines · Šerif Rami

Hi Takashi,

Thank you for your reply and for taking the time to review my patch.

Quoted 22 lines

- The sysfs file should be dropped as Greg suggested

- Try to use guard() for spinlocks. (I know other USB audio drivers don't do that yet, but I already have a bit patch set to convert those.)

Of course, there are cases where guard() and scoped_guard() don't fit well (e.g. the loop with temporary unlock/re-locking), but in most cases, you can use it well. If it doesn't fit, it's a good chance to take a look at your code again and reconsider whether the code flow can be changed better.

- Similarly, try to use __free(kfree) for temporary buffers.

- snd_pcm_lib_preallocate_*() can be replaced with snd_pcm_set_managed_buffer(). Then you can drop snd_pcm_lib_malloc_pages() and snd_pcm_lib_free_pages() calls from hw_params and hw_free callbacks, too.

- Most of enum info callbacks can be simplified with snd_ctl_enum_info() helper function.

Quoted 7 lines
Quoted 3 lines

- It's a bit big code and it'd be great if you can split the patches in a logical manner. But it'd be OK-ish to have a single patch if it's not easy, too.

I will implement the suggested changes.

Regarding patch splitting, since most of the driver code is new, the plan is to create two patches: one that removes the US-144MKII device binding from the existing us122l driver, and a second that adds the new driver files under sound/usb/usx2y. Please let me know if this sounds good or if you’d prefer a different approach.

I don't think this would bring so much -- the drop of the old driver binding is just a few line of entry point, after all. Rather splitting the new driver code in a few logical pieces might help for reviewing.

thanks,

Takashi