sound/usb/line6/toneport.c
Source file repositories/reference/linux-study-clean/sound/usb/line6/toneport.c
File Facts
- System
- Linux kernel
- Corpus path
sound/usb/line6/toneport.c- Extension
.c- Size
- 14476 bytes
- Lines
- 583
- 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.
- Allocates kernel memory; connect allocation flags and lifetime to context constraints.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/wait.hlinux/usb.hlinux/slab.hlinux/module.hlinux/leds.hsound/core.hsound/control.hcapture.hdriver.hplayback.h
Detected Declarations
struct usb_line6_toneportstruct toneport_ledstruct usb_line6_toneportenum line6_device_typefunction toneport_send_cmdfunction snd_toneport_monitor_infofunction snd_toneport_monitor_getfunction snd_toneport_monitor_putfunction snd_toneport_source_infofunction snd_toneport_source_getfunction snd_toneport_source_putfunction toneport_startupfunction toneport_has_ledfunction toneport_update_ledfunction toneport_led_brightness_setfunction toneport_init_ledsfunction toneport_remove_ledsfunction toneport_has_source_selectfunction toneport_setupfunction line6_toneport_disconnectfunction toneport_initfunction toneport_reset_resumefunction toneport_probe
Annotated Snippet
struct toneport_led {
struct led_classdev dev;
char name[64];
struct usb_line6_toneport *toneport;
bool registered;
};
struct usb_line6_toneport {
/* Generic Line 6 USB data */
struct usb_line6 line6;
/* Source selector */
int source;
/* Serial number of device */
u32 serial_number;
/* Firmware version (x 100) */
u8 firmware_version;
/* Device type */
enum line6_device_type type;
/* LED instances */
struct toneport_led leds[2];
};
#define line6_to_toneport(x) container_of(x, struct usb_line6_toneport, line6)
static int toneport_send_cmd(struct usb_device *usbdev, int cmd1, int cmd2);
#define TONEPORT_PCM_DELAY 1
static const struct snd_ratden toneport_ratden = {
.num_min = 44100,
.num_max = 44100,
.num_step = 1,
.den = 1
};
static struct line6_pcm_properties toneport_pcm_properties = {
.playback_hw = {
.info = (SNDRV_PCM_INFO_MMAP |
SNDRV_PCM_INFO_INTERLEAVED |
SNDRV_PCM_INFO_BLOCK_TRANSFER |
SNDRV_PCM_INFO_MMAP_VALID |
SNDRV_PCM_INFO_PAUSE |
SNDRV_PCM_INFO_SYNC_START),
.formats = SNDRV_PCM_FMTBIT_S16_LE,
.rates = SNDRV_PCM_RATE_KNOT,
.rate_min = 44100,
.rate_max = 44100,
.channels_min = 2,
.channels_max = 2,
.buffer_bytes_max = 60000,
.period_bytes_min = 64,
.period_bytes_max = 8192,
.periods_min = 1,
.periods_max = 1024},
.capture_hw = {
.info = (SNDRV_PCM_INFO_MMAP |
SNDRV_PCM_INFO_INTERLEAVED |
SNDRV_PCM_INFO_BLOCK_TRANSFER |
SNDRV_PCM_INFO_MMAP_VALID |
SNDRV_PCM_INFO_SYNC_START),
.formats = SNDRV_PCM_FMTBIT_S16_LE,
.rates = SNDRV_PCM_RATE_KNOT,
.rate_min = 44100,
.rate_max = 44100,
.channels_min = 2,
.channels_max = 2,
.buffer_bytes_max = 60000,
.period_bytes_min = 64,
.period_bytes_max = 8192,
.periods_min = 1,
.periods_max = 1024},
.rates = {
.nrats = 1,
.rats = &toneport_ratden},
.bytes_per_channel = 2
};
static const struct {
const char *name;
int code;
} toneport_source_info[] = {
{"Microphone", 0x0a01},
{"Line", 0x0801},
{"Instrument", 0x0b01},
{"Inst & Mic", 0x0901}
Annotation
- Immediate include surface: `linux/wait.h`, `linux/usb.h`, `linux/slab.h`, `linux/module.h`, `linux/leds.h`, `sound/core.h`, `sound/control.h`, `capture.h`.
- Detected declarations: `struct usb_line6_toneport`, `struct toneport_led`, `struct usb_line6_toneport`, `enum line6_device_type`, `function toneport_send_cmd`, `function snd_toneport_monitor_info`, `function snd_toneport_monitor_get`, `function snd_toneport_monitor_put`, `function snd_toneport_source_info`, `function snd_toneport_source_get`.
- Atlas domain: Driver Families / sound/usb.
- Implementation status: source implementation candidate.
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.