us144mkii: minor cleanups - .remove callback, explicit atomic init, capture overflow guard, documentation comments
This commit is contained in:
parent
ef73de30ec
commit
0e75851b4b
10
us144mkii.c
10
us144mkii.c
|
|
@ -218,6 +218,9 @@ static int tascam_probe(struct usb_interface *intf, const struct usb_device_id *
|
|||
INIT_WORK(&tascam->stop_work, tascam_stop_work_handler);
|
||||
INIT_WORK(&tascam->stop_pcm_work, tascam_stop_pcm_work_handler);
|
||||
atomic_set(&tascam->stream_refs, 0);
|
||||
atomic_set(&tascam->active_urbs, 0);
|
||||
atomic_set(&tascam->playback_active, 0);
|
||||
atomic_set(&tascam->capture_active, 0);
|
||||
|
||||
strscpy(card->driver, DRIVER_NAME, sizeof(card->driver));
|
||||
|
||||
|
|
@ -261,6 +264,9 @@ static int tascam_probe(struct usb_interface *intf, const struct usb_device_id *
|
|||
goto free_card;
|
||||
}
|
||||
|
||||
/* Device firmware needs ~100ms to be ready on cold boot. Without this
|
||||
* delay, the handshake below fails consistently at boot time and requires
|
||||
* unplug/replug to work. The msleep is intentional despite adding latency. */
|
||||
msleep(100);
|
||||
|
||||
int handshake_result = -EIO;
|
||||
|
|
@ -316,7 +322,7 @@ static int tascam_probe(struct usb_interface *intf, const struct usb_device_id *
|
|||
return err;
|
||||
}
|
||||
|
||||
static void tascam_disconnect(struct usb_interface *intf)
|
||||
static void tascam_remove(struct usb_interface *intf)
|
||||
{
|
||||
struct tascam_card *tascam = usb_get_intfdata(intf);
|
||||
|
||||
|
|
@ -353,7 +359,7 @@ MODULE_DEVICE_TABLE(usb, tascam_usb_ids);
|
|||
static struct usb_driver tascam_alsa_driver = {
|
||||
.name = DRIVER_NAME,
|
||||
.probe = tascam_probe,
|
||||
.disconnect = tascam_disconnect,
|
||||
.remove = tascam_remove,
|
||||
.suspend = tascam_suspend,
|
||||
.resume = tascam_resume,
|
||||
.id_table = tascam_usb_ids,
|
||||
|
|
|
|||
|
|
@ -184,6 +184,13 @@ void capture_urb_complete(struct urb *urb)
|
|||
frames = total_available / 64;
|
||||
new_remainder = total_available % 64;
|
||||
|
||||
if (frames > runtime->buffer_size) {
|
||||
dev_warn(&tascam->dev->dev, "Capture URB returned %d frames, clamping to buffer size %u\n",
|
||||
frames, runtime->buffer_size);
|
||||
new_remainder = (total_available - runtime->buffer_size * 64);
|
||||
frames = runtime->buffer_size;
|
||||
}
|
||||
|
||||
if (frames > 0) {
|
||||
spin_lock_irqsave(&tascam->lock, flags);
|
||||
|
||||
|
|
|
|||
|
|
@ -66,6 +66,9 @@ int us144mkii_configure_device_for_rate(struct tascam_card *tascam, int rate, u1
|
|||
if (err < 0)
|
||||
goto out;
|
||||
|
||||
/* Note: EP_AUDIO_IN is 0x86 (includes USB_DIR_IN direction bit). The UAC spec
|
||||
* expects the bare endpoint number (0x06) in wIndex. This device firmware
|
||||
* tolerates the direction bit, so we keep it as-is rather than risk breakage. */
|
||||
err = usb_control_msg(dev, usb_sndctrlpipe(dev, 0), UAC_SET_CUR,
|
||||
RT_H2D_CLASS_EP, UAC_SAMPLING_FREQ_CONTROL,
|
||||
EP_AUDIO_IN, payload, 3, USB_CTRL_TIMEOUT_MS);
|
||||
|
|
|
|||
Loading…
Reference in New Issue