Skip to contentSkip to conversation

ALSA: snd-usb-caiaq: drop version number

PATCH In review Daniel Mack 2 participants 5 messages Sep 10, 2010

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/3 ALSA: snd-usb-caiaq: drop version number

Let git do the job.

---
 sound/usb/caiaq/device.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
sound/usb/caiaq/device.c +1 -1
index cdfb856..da9cb6d 100644
@@ -36,7 +36,7 @@
 #include "input.h"
 
 MODULE_AUTHOR("Daniel Mack <[email protected]>");
-MODULE_DESCRIPTION("caiaq USB audio, version 1.3.21");
+MODULE_DESCRIPTION("caiaq USB audio");
 MODULE_LICENSE("GPL");
 MODULE_SUPPORTED_DEVICE("{{Native Instruments, RigKontrol2},"
 			 "{Native Instruments, RigKontrol3},"
Signature · 1 line
1.7.0.4
#1 lore raw

PATCH 2/3 ALSA: snd-usb-caiaq: set up internal sample pointer positions in trigger callback

Calling prepare() on a stream which is already active shouldn't touch the sample pointer positions. This code belongs into the trigger callback, so move it there.

---
 sound/usb/caiaq/audio.c |   21 +++++++++++----------
 1 files changed, 11 insertions(+), 10 deletions(-)
sound/usb/caiaq/audio.c +11 -10
index 4328cad..db85320 100644
@@ -194,21 +194,11 @@ static unsigned int rates[] = { 5512, 8000, 11025, 16000, 22050, 32000, 44100,
 static int snd_usb_caiaq_pcm_prepare(struct snd_pcm_substream *substream)
 {
 	int bytes_per_sample, bpp, ret, i;
-	int index = substream->number;
 	struct snd_usb_caiaqdev *dev = snd_pcm_substream_chip(substream);
 	struct snd_pcm_runtime *runtime = substream->runtime;
 
 	debug("%s(%p)\n", __func__, substream);
 
-	if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
-		dev->period_out_count[index] = BYTES_PER_SAMPLE + 1;
-		dev->audio_out_buf_pos[index] = BYTES_PER_SAMPLE + 1;
-	} else {
-		int in_pos = (dev->spec.data_alignment == 2) ? 0 : 2;
-		dev->period_in_count[index] = BYTES_PER_SAMPLE + in_pos;
-		dev->audio_in_buf_pos[index] = BYTES_PER_SAMPLE + in_pos;
-	}
-
 	if (dev->streaming)
 		return 0;
 
@@ -251,10 +241,21 @@ static int snd_usb_caiaq_pcm_prepare(struct snd_pcm_substream *substream)
 
 static int snd_usb_caiaq_pcm_trigger(struct snd_pcm_substream *sub, int cmd)
 {
+	int index = sub->number;
 	struct snd_usb_caiaqdev *dev = snd_pcm_substream_chip(sub);
 
 	switch (cmd) {
 	case SNDRV_PCM_TRIGGER_START:
+		if (sub->stream == SNDRV_PCM_STREAM_PLAYBACK) {
+			dev->period_out_count[index] = BYTES_PER_SAMPLE + 1;
+			dev->audio_out_buf_pos[index] = BYTES_PER_SAMPLE + 1;
+		} else {
+			int in_pos = (dev->spec.data_alignment == 2) ? 0 : 2;
+			dev->period_in_count[index] = BYTES_PER_SAMPLE + in_pos;
+			dev->audio_in_buf_pos[index] = BYTES_PER_SAMPLE + in_pos;
+		}
+
+		/* fall thru */
 	case SNDRV_PCM_TRIGGER_PAUSE_RELEASE:
 		activate_substream(dev, sub);
 		break;
Signature · 1 line
1.7.0.4
#2 lore raw

Re: [PATCH 2/3] ALSA: snd-usb-caiaq: set up internal sample pointer positions in trigger callback

Quoted 1 line · Daniel Mack

Calling prepare() on a stream which is already active

... would be a bug; snd_pcm_pre_prepare() in sound/core/pcm_native.c should prevent this. Why do you feel the need for this patch?

Quoted 2 lines

shouldn't touch the sample pointer positions. This code belongs into the trigger callback, so move it there.

The trigger callback should execute as fast as possible; any initialization that isn't need to directly start the stream should go into the prepare callback.

Regards,
Clemens

#3 lore raw

Re: [PATCH 2/3] ALSA: snd-usb-caiaq: set up internal sample pointer positions in trigger callback

Quoted 5 lines · Clemens Ladisch
Quoted 1 line · Daniel Mack

Calling prepare() on a stream which is already active

... would be a bug; snd_pcm_pre_prepare() in sound/core/pcm_native.c should prevent this. Why do you feel the need for this patch?

You're right, thanks for the heads-up. It was indeed a bug in a different part of my driver which only affected the newly added model it supports. I was increasing the periods counter for inactive streams, which confused the ALSA core.

Forget about this one, I'll repost a new series in a second.

Thanks,
Daniel

#4 lore raw

PATCH 3/3 ALSA: snd-usb-caiaq: Add support for Traktor Kontrol S4

In reply to Daniel Mack

This patch adds support for the new Traktor Kontrol S4 by Native Instruments. It features a new audio data streaming model, MIDI in and out ports, a huge number of 174 dimmable LEDs, 96 buttons and 46 absolute encoder axis, including some rotary encoders.

All features are supported by the driver now.

Did some code refactoring along the way.

---
 sound/usb/Kconfig         |    2 +
 sound/usb/caiaq/audio.c   |  176 ++++++++++++++++++++++++++++----
 sound/usb/caiaq/control.c |  208 ++++++++++++++++++++++++++++++++++++-
 sound/usb/caiaq/device.c  |    8 ++-
 sound/usb/caiaq/device.h  |    6 +-
 sound/usb/caiaq/input.c   |  248 ++++++++++++++++++++++++++++++++++++++++-----
 6 files changed, 596 insertions(+), 52 deletions(-)
sound/usb/Kconfig +2 -0
index 44d6d2e..112984f 100644
@@ -65,6 +65,7 @@ config SND_USB_CAIAQ
 	    * Native Instruments Guitar Rig Session I/O
 	    * Native Instruments Guitar Rig mobile
 	    * Native Instruments Traktor Kontrol X1
+	    * Native Instruments Traktor Kontrol S4
 
 	   To compile this driver as a module, choose M here: the module
 	   will be called snd-usb-caiaq.
@@ -82,6 +83,7 @@ config SND_USB_CAIAQ_INPUT
 	   * Native Instruments Kore Controller
 	   * Native Instruments Kore Controller 2
 	   * Native Instruments Audio Kontrol 1
+	   * Native Instruments Traktor Kontrol S4
 
 config SND_USB_US122L
 	tristate "Tascam US-122L USB driver"
sound/usb/caiaq/audio.c +158 -18

248 lines not on this page · raw message

sound/usb/caiaq/control.c +203 -5

239 lines not on this page · raw message

sound/usb/caiaq/device.c +7 -1
index da9cb6d..6480c32 100644
@@ -48,7 +48,8 @@ MODULE_SUPPORTED_DEVICE("{{Native Instruments, RigKontrol2},"
 			 "{Native Instruments, Audio 8 DJ},"
 			 "{Native Instruments, Session I/O},"
 			 "{Native Instruments, GuitarRig mobile}"
-			 "{Native Instruments, Traktor Kontrol X1}");
+			 "{Native Instruments, Traktor Kontrol X1}"
+			 "{Native Instruments, Traktor Kontrol S4}");
 
 static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-max */
 static char* id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* Id for this card */
@@ -134,6 +135,11 @@ static struct usb_device_id snd_usb_id_table[] = {
 		.idVendor =     USB_VID_NATIVEINSTRUMENTS,
 		.idProduct =    USB_PID_TRAKTORKONTROLX1
 	},
+	{
+		.match_flags =  USB_DEVICE_ID_MATCH_DEVICE,
+		.idVendor =     USB_VID_NATIVEINSTRUMENTS,
+		.idProduct =    USB_PID_TRAKTORKONTROLS4
+	},
 	{ /* terminator */ }
 };
 
sound/usb/caiaq/device.h +4 -2
index f1117ec..e3d8a3e 100644
@@ -16,6 +16,7 @@
 #define USB_PID_SESSIONIO		0x1915
 #define USB_PID_GUITARRIGMOBILE		0x0d8d
 #define USB_PID_TRAKTORKONTROLX1	0x2305
+#define USB_PID_TRAKTORKONTROLS4	0xbaff
 
 #define EP1_BUFSIZE 64
 #define EP4_BUFSIZE 512
@@ -99,13 +100,14 @@ struct snd_usb_caiaqdev {
 	struct snd_pcm_substream *sub_capture[MAX_STREAMS];
 
 	/* Controls */
-	unsigned char control_state[64];
+	unsigned char control_state[256];
+	unsigned char ep8_out_buf[2];
 
 	/* Linux input */
 #ifdef CONFIG_SND_USB_CAIAQ_INPUT
 	struct input_dev *input_dev;
 	char phys[64];			/* physical device path */
-	unsigned short keycode[64];
+	unsigned short keycode[128];
 	struct urb *ep4_in_urb;
 	unsigned char ep4_in_buf[EP4_BUFSIZE];
 #endif
sound/usb/caiaq/input.c +222 -26

312 lines not on this page · raw message

Signature · 1 line
1.7.0.4