sound/usb/usx2y/us144mkii_pcm.c
Source file repositories/reference/linux-study-clean/sound/usb/usx2y/us144mkii_pcm.c
File Facts
- System
- Linux kernel
- Corpus path
sound/usb/usx2y/us144mkii_pcm.c- Extension
.c- Size
- 10901 bytes
- Lines
- 371
- Domain
- Driver Families
- Bucket
- sound/usb
- Inferred role
- Driver Families: implementation source
- Status
- source implementation candidate
Why This File Exists
Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
- Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
- Uses kernel synchronization; read lock ordering, sleepability, and interrupt context assumptions before translating.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
us144mkii.h
Detected Declarations
function fpo_init_patternfunction process_playback_routing_us144mkiifunction process_capture_routing_us144mkiifunction us144mkii_configure_device_for_ratefunction tascam_pcm_hw_paramsfunction tascam_pcm_hw_freefunction tascam_pcm_triggerfunction scoped_guardfunction tascam_init_pcm
Annotated Snippet
if (tascam->capture_12_source == 0) { /* analog inputs */
dst_frame[0] = src_frame[0]; /* Analog L */
dst_frame[1] = src_frame[1]; /* Analog R */
} else { /* digital inputs */
dst_frame[0] = src_frame[2]; /* Digital L */
dst_frame[1] = src_frame[3]; /* Digital R */
}
/* ch3 and ch4 Source */
if (tascam->capture_34_source == 0) { /* analog inputs */
dst_frame[2] = src_frame[0]; /* Analog L (Duplicate) */
dst_frame[3] = src_frame[1]; /* Analog R (Duplicate) */
} else { /* digital inputs */
dst_frame[2] = src_frame[2]; /* Digital L */
dst_frame[3] = src_frame[3]; /* Digital R */
}
}
}
int us144mkii_configure_device_for_rate(struct tascam_card *tascam, int rate)
{
struct usb_device *dev = tascam->dev;
u16 rate_vendor_wValue;
int err = 0;
const u8 *current_payload_src;
static const u8 payload_44100[] = { 0x44, 0xac, 0x00 };
static const u8 payload_48000[] = { 0x80, 0xbb, 0x00 };
static const u8 payload_88200[] = { 0x88, 0x58, 0x01 };
static const u8 payload_96000[] = { 0x00, 0x77, 0x01 };
switch (rate) {
case 44100:
current_payload_src = payload_44100;
rate_vendor_wValue = REG_ADDR_RATE_44100;
break;
case 48000:
current_payload_src = payload_48000;
rate_vendor_wValue = REG_ADDR_RATE_48000;
break;
case 88200:
current_payload_src = payload_88200;
rate_vendor_wValue = REG_ADDR_RATE_88200;
break;
case 96000:
current_payload_src = payload_96000;
rate_vendor_wValue = REG_ADDR_RATE_96000;
break;
default:
dev_err(&dev->dev,
"Unsupported sample rate %d for configuration\n", rate);
return -EINVAL;
}
u8 *rate_payload_buf __free(kfree) =
kmemdup(current_payload_src, 3, GFP_KERNEL);
if (!rate_payload_buf)
return -ENOMEM;
dev_info(&dev->dev, "Configuring device for %d Hz\n", rate);
err = usb_control_msg(dev, usb_sndctrlpipe(dev, 0),
VENDOR_REQ_MODE_CONTROL, RT_H2D_VENDOR_DEV,
MODE_VAL_CONFIG, 0x0000, NULL, 0,
USB_CTRL_TIMEOUT_MS);
if (err < 0)
goto fail;
err = usb_control_msg(dev, usb_sndctrlpipe(dev, 0), UAC_SET_CUR,
RT_H2D_CLASS_EP, UAC_SAMPLING_FREQ_CONTROL,
EP_AUDIO_IN, rate_payload_buf, 3,
USB_CTRL_TIMEOUT_MS);
if (err < 0)
goto fail;
err = usb_control_msg(dev, usb_sndctrlpipe(dev, 0), UAC_SET_CUR,
RT_H2D_CLASS_EP, UAC_SAMPLING_FREQ_CONTROL,
EP_AUDIO_OUT, rate_payload_buf, 3,
USB_CTRL_TIMEOUT_MS);
if (err < 0)
goto fail;
err = usb_control_msg(dev, usb_sndctrlpipe(dev, 0),
VENDOR_REQ_REGISTER_WRITE, RT_H2D_VENDOR_DEV,
REG_ADDR_UNKNOWN_0D, REG_VAL_ENABLE, NULL, 0,
USB_CTRL_TIMEOUT_MS);
if (err < 0)
goto fail;
err = usb_control_msg(dev, usb_sndctrlpipe(dev, 0),
VENDOR_REQ_REGISTER_WRITE, RT_H2D_VENDOR_DEV,
REG_ADDR_UNKNOWN_0E, REG_VAL_ENABLE, NULL, 0,
USB_CTRL_TIMEOUT_MS);
if (err < 0)
Annotation
- Immediate include surface: `us144mkii.h`.
- Detected declarations: `function fpo_init_pattern`, `function process_playback_routing_us144mkii`, `function process_capture_routing_us144mkii`, `function us144mkii_configure_device_for_rate`, `function tascam_pcm_hw_params`, `function tascam_pcm_hw_free`, `function tascam_pcm_trigger`, `function scoped_guard`, `function tascam_init_pcm`.
- Atlas domain: Driver Families / sound/usb.
- Implementation status: source implementation candidate.
- Synchronization appears in or near this file; preserve lock ordering, sleepability, and interrupt-context constraints.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.