Add US-200 support with backward compatibility
- Add USB_PID_TASCAM_US200 (0x8034) product ID constant - Introduce MODE_VAL_STREAM_START_US200 (0x0032) for device-specific stream mode - Parameterize us144mkii_configure_device_for_rate() to accept stream_mode value - Extend model naming logic to display "US-200" for US-200 devices - Add US-200 to USB device ID table for automatic recognition
This commit is contained in:
parent
58ae1534f0
commit
71662b10e4
19
us144mkii.c
19
us144mkii.c
|
|
@ -163,8 +163,10 @@ static int tascam_resume(struct usb_interface *intf)
|
|||
|
||||
usb_set_interface(tascam->dev, 0, 1);
|
||||
usb_set_interface(tascam->dev, 1, 1);
|
||||
if (tascam->current_rate > 0)
|
||||
us144mkii_configure_device_for_rate(tascam, tascam->current_rate);
|
||||
if (tascam->current_rate > 0) {
|
||||
u16 stream_mode = (tascam->dev_id == USB_PID_TASCAM_US200) ? MODE_VAL_STREAM_START_US200 : MODE_VAL_STREAM_START;
|
||||
us144mkii_configure_device_for_rate(tascam, tascam->current_rate, stream_mode);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
@ -212,7 +214,13 @@ static int tascam_probe(struct usb_interface *intf, const struct usb_device_id *
|
|||
strscpy(card->driver, DRIVER_NAME, sizeof(card->driver));
|
||||
|
||||
/* Correct naming logic based on Device ID */
|
||||
model_name = (tascam->dev_id == USB_PID_TASCAM_US144) ? "US-144" : "US-144MKII";
|
||||
if (tascam->dev_id == USB_PID_TASCAM_US144)
|
||||
model_name = "US-144";
|
||||
else if (tascam->dev_id == USB_PID_TASCAM_US200)
|
||||
model_name = "US-200";
|
||||
else
|
||||
model_name = "US-144MKII";
|
||||
|
||||
strscpy(card->shortname, model_name, sizeof(card->shortname));
|
||||
|
||||
snprintf(card->longname, sizeof(card->longname), "%s (%04x:%04x) at %s",
|
||||
|
|
@ -252,7 +260,9 @@ static int tascam_probe(struct usb_interface *intf, const struct usb_device_id *
|
|||
usb_set_interface(dev, 0, 1);
|
||||
usb_set_interface(dev, 1, 1);
|
||||
|
||||
if (us144mkii_configure_device_for_rate(tascam, 48000) < 0)
|
||||
u16 stream_mode = (tascam->dev_id == USB_PID_TASCAM_US200) ? MODE_VAL_STREAM_START_US200 : MODE_VAL_STREAM_START;
|
||||
|
||||
if (us144mkii_configure_device_for_rate(tascam, 48000, stream_mode) < 0)
|
||||
dev_warn(&dev->dev, "Failed to initialize device at 48khz\n");
|
||||
else
|
||||
tascam->current_rate = 48000;
|
||||
|
|
@ -299,6 +309,7 @@ static void tascam_disconnect(struct usb_interface *intf)
|
|||
static const struct usb_device_id tascam_usb_ids[] = {
|
||||
{ USB_DEVICE(USB_VID_TASCAM, USB_PID_TASCAM_US144) },
|
||||
{ USB_DEVICE(USB_VID_TASCAM, USB_PID_TASCAM_US144MKII) },
|
||||
{ USB_DEVICE(USB_VID_TASCAM, USB_PID_TASCAM_US200) }, /* US-200 support */
|
||||
{ }
|
||||
};
|
||||
MODULE_DEVICE_TABLE(usb, tascam_usb_ids);
|
||||
|
|
|
|||
10
us144mkii.h
10
us144mkii.h
|
|
@ -16,8 +16,9 @@
|
|||
#define DRIVER_NAME "us144mkii"
|
||||
|
||||
#define USB_VID_TASCAM 0x0644
|
||||
#define USB_PID_TASCAM_US144 0x800f
|
||||
#define USB_PID_TASCAM_US144 0x800f
|
||||
#define USB_PID_TASCAM_US144MKII 0x8020
|
||||
#define USB_PID_TASCAM_US200 0x8034
|
||||
|
||||
#define EP_PLAYBACK_FEEDBACK 0x81
|
||||
#define EP_AUDIO_OUT 0x02
|
||||
|
|
@ -41,9 +42,10 @@ enum tascam_vendor_request {
|
|||
};
|
||||
|
||||
enum tascam_mode_value {
|
||||
MODE_VAL_HANDSHAKE_READ = 0x0000,
|
||||
MODE_VAL_CONFIG = 0x0010,
|
||||
MODE_VAL_STREAM_START = 0x0030,
|
||||
MODE_VAL_HANDSHAKE_READ = 0x0000,
|
||||
MODE_VAL_CONFIG = 0x0010,
|
||||
MODE_VAL_STREAM_START = 0x0030, /* US-144 MKII */
|
||||
MODE_VAL_STREAM_START_US200 = 0x0032, /* US-200 only */
|
||||
};
|
||||
|
||||
#define REG_VAL_ENABLE 0x0101
|
||||
|
|
|
|||
|
|
@ -168,7 +168,14 @@ int tascam_create_midi(struct tascam_card *tascam)
|
|||
struct snd_rawmidi *rmidi;
|
||||
int err;
|
||||
char midi_name[48];
|
||||
const char *model_name = (tascam->dev_id == USB_PID_TASCAM_US144) ? "US-144" : "US-144MKII";
|
||||
const char *model_name;
|
||||
|
||||
if (tascam->dev_id == USB_PID_TASCAM_US144)
|
||||
model_name = "US-144";
|
||||
else if (tascam->dev_id == USB_PID_TASCAM_US200)
|
||||
model_name = "US-200";
|
||||
else
|
||||
model_name = "US-144MKII";
|
||||
|
||||
err = snd_rawmidi_new(tascam->card, "TASCAM MIDI", 0, 1, 1, &rmidi);
|
||||
if (err < 0)
|
||||
|
|
|
|||
|
|
@ -41,7 +41,7 @@ static int tascam_write_regs(struct tascam_card *tascam, const u16 *regs, size_t
|
|||
*
|
||||
* Return: 0 on success, or a negative error code on failure.
|
||||
*/
|
||||
int us144mkii_configure_device_for_rate(struct tascam_card *tascam, int rate)
|
||||
int us144mkii_configure_device_for_rate(struct tascam_card *tascam, int rate, u16 stream_mode)
|
||||
{
|
||||
struct usb_device *dev = tascam->dev;
|
||||
int i, err;
|
||||
|
|
@ -88,7 +88,7 @@ int us144mkii_configure_device_for_rate(struct tascam_card *tascam, int rate)
|
|||
}
|
||||
|
||||
err = usb_control_msg(dev, usb_sndctrlpipe(dev, 0), VENDOR_REQ_MODE_CONTROL,
|
||||
RT_H2D_VENDOR_DEV, MODE_VAL_STREAM_START, 0x0000, NULL, 0, USB_CTRL_TIMEOUT_MS);
|
||||
RT_H2D_VENDOR_DEV, stream_mode, 0x0000, NULL, 0, USB_CTRL_TIMEOUT_MS);
|
||||
|
||||
out:
|
||||
kfree(payload);
|
||||
|
|
@ -129,7 +129,8 @@ int tascam_pcm_hw_params(struct snd_pcm_substream *substream, struct snd_pcm_hw_
|
|||
usb_kill_anchored_urbs(&tascam->capture_anchor);
|
||||
atomic_set(&tascam->active_urbs, 0);
|
||||
|
||||
err = us144mkii_configure_device_for_rate(tascam, rate);
|
||||
u16 stream_mode = (tascam->dev_id == USB_PID_TASCAM_US200) ? MODE_VAL_STREAM_START_US200 : MODE_VAL_STREAM_START;
|
||||
err = us144mkii_configure_device_for_rate(tascam, rate, stream_mode);
|
||||
if (err < 0) {
|
||||
spin_lock_irqsave(&tascam->lock, flags);
|
||||
tascam->current_rate = 0;
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@ extern const struct snd_pcm_ops tascam_capture_ops;
|
|||
void playback_urb_complete(struct urb *urb);
|
||||
void feedback_urb_complete(struct urb *urb);
|
||||
void capture_urb_complete(struct urb *urb);
|
||||
int us144mkii_configure_device_for_rate(struct tascam_card *tascam, int rate);
|
||||
int us144mkii_configure_device_for_rate(struct tascam_card *tascam, int rate, u16 stream_mode);
|
||||
void tascam_stop_pcm_work_handler(struct work_struct *work);
|
||||
int tascam_pcm_hw_params(struct snd_pcm_substream *substream, struct snd_pcm_hw_params *params);
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue