Compare commits
No commits in common. "main" and "us200-boot-delay-fix" have entirely different histories.
main
...
us200-boot
|
|
@ -1,14 +1,9 @@
|
|||
// SPDX-License-Identifier: GPL-2.0-only
|
||||
// Copyright (c) 2025 Šerif Rami <ramiserifpersia@gmail.com>
|
||||
|
||||
#include <linux/types.h>
|
||||
#include <linux/unaligned/packed_struct.h>
|
||||
#include <asm/byteorder.h>
|
||||
#include <asm/unaligned.h>
|
||||
#include "us144mkii_pcm.h"
|
||||
|
||||
#define get_unaligned_le64(ptr) le64_to_cpu(__get_unaligned_cpu64(ptr))
|
||||
#define put_unaligned_le32(val, ptr) __put_unaligned_cpu32((val), ptr)
|
||||
|
||||
const struct snd_pcm_hardware tascam_capture_hw = {
|
||||
.info = (SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_INTERLEAVED |
|
||||
SNDRV_PCM_INFO_BLOCK_TRANSFER | SNDRV_PCM_INFO_MMAP_VALID |
|
||||
|
|
|
|||
|
|
@ -128,7 +128,6 @@ int tascam_pcm_hw_params(struct snd_pcm_substream *substream, struct snd_pcm_hw_
|
|||
usb_kill_anchored_urbs(&tascam->feedback_anchor);
|
||||
usb_kill_anchored_urbs(&tascam->capture_anchor);
|
||||
atomic_set(&tascam->active_urbs, 0);
|
||||
tascam->running_ghost_playback = false;
|
||||
|
||||
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);
|
||||
|
|
|
|||
|
|
@ -130,6 +130,8 @@ static int tascam_playback_close(struct snd_pcm_substream *substream)
|
|||
{
|
||||
struct tascam_card *tascam = snd_pcm_substream_chip(substream);
|
||||
atomic_set(&tascam->playback_active, 0);
|
||||
usb_kill_anchored_urbs(&tascam->playback_anchor);
|
||||
usb_kill_anchored_urbs(&tascam->feedback_anchor);
|
||||
tascam->playback_substream = NULL;
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -138,21 +140,18 @@ static int tascam_playback_prepare(struct snd_pcm_substream *substream)
|
|||
{
|
||||
struct tascam_card *tascam = snd_pcm_substream_chip(substream);
|
||||
|
||||
usb_kill_anchored_urbs(&tascam->playback_anchor);
|
||||
usb_kill_anchored_urbs(&tascam->feedback_anchor);
|
||||
|
||||
tascam->driver_playback_pos = 0;
|
||||
tascam->playback_frames_consumed = 0;
|
||||
tascam->last_pb_period_pos = 0;
|
||||
tascam->feedback_synced = false;
|
||||
|
||||
if (tascam->running_ghost_playback)
|
||||
return 0;
|
||||
|
||||
usb_kill_anchored_urbs(&tascam->playback_anchor);
|
||||
usb_kill_anchored_urbs(&tascam->feedback_anchor);
|
||||
|
||||
tascam->running_ghost_playback = false;
|
||||
tascam->feedback_urb_skip_count = 4;
|
||||
tascam->phase_accum = 0;
|
||||
tascam->freq_q16 = div_u64(((u64)tascam->current_rate << 16), 8000);
|
||||
tascam->running_ghost_playback = false;
|
||||
|
||||
prepare_urb_descriptors(tascam);
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -182,7 +181,9 @@ static int tascam_playback_trigger(struct snd_pcm_substream *substream, int cmd)
|
|||
case SNDRV_PCM_TRIGGER_SUSPEND:
|
||||
case SNDRV_PCM_TRIGGER_PAUSE_PUSH:
|
||||
atomic_set(&tascam->playback_active, 0);
|
||||
tascam->running_ghost_playback = true;
|
||||
/* Fall back to ghost playback if capture/midi active */
|
||||
if (atomic_read(&tascam->stream_refs) > 0)
|
||||
tascam->running_ghost_playback = true;
|
||||
break;
|
||||
default:
|
||||
ret = -EINVAL;
|
||||
|
|
@ -198,15 +199,8 @@ static snd_pcm_uframes_t tascam_playback_pointer(struct snd_pcm_substream *subst
|
|||
unsigned long flags;
|
||||
u64 pos;
|
||||
|
||||
if (!atomic_read(&tascam->playback_active)) {
|
||||
if (tascam->running_ghost_playback) {
|
||||
spin_lock_irqsave(&tascam->lock, flags);
|
||||
pos = tascam->playback_frames_consumed;
|
||||
spin_unlock_irqrestore(&tascam->lock, flags);
|
||||
return (snd_pcm_uframes_t)pos;
|
||||
}
|
||||
if (!atomic_read(&tascam->playback_active))
|
||||
return 0;
|
||||
}
|
||||
|
||||
spin_lock_irqsave(&tascam->lock, flags);
|
||||
pos = tascam->playback_frames_consumed;
|
||||
|
|
|
|||
Loading…
Reference in New Issue