sound/usb/line6/variax.c
Source file repositories/reference/linux-study-clean/sound/usb/line6/variax.c
File Facts
- System
- Linux kernel
- Corpus path
sound/usb/line6/variax.c- Extension
.c- Size
- 6186 bytes
- Lines
- 243
- 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.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/slab.hlinux/spinlock.hlinux/usb.hlinux/wait.hlinux/module.hsound/core.hdriver.h
Detected Declarations
struct usb_line6_variaxfunction variax_activate_asyncfunction requirementsfunction line6_variax_process_messagefunction line6_variax_disconnectfunction variax_initfunction variax_probe
Annotated Snippet
struct usb_line6_variax {
/* Generic Line 6 USB data */
struct usb_line6 line6;
/* Buffer for activation code */
unsigned char *buffer_activate;
/* Current progress in startup procedure */
int startup_progress;
};
#define line6_to_variax(x) container_of(x, struct usb_line6_variax, line6)
#define VARIAX_OFFSET_ACTIVATE 7
/*
This message is sent by the device during initialization and identifies
the connected guitar version.
*/
static const char variax_init_version[] = {
0xf0, 0x7e, 0x7f, 0x06, 0x02, 0x00, 0x01, 0x0c,
0x07, 0x00, 0x00, 0x00
};
/*
This message is the last one sent by the device during initialization.
*/
static const char variax_init_done[] = {
0xf0, 0x00, 0x01, 0x0c, 0x07, 0x00, 0x6b
};
static const char variax_activate[] = {
0xf0, 0x00, 0x01, 0x0c, 0x07, 0x00, 0x2a, 0x01,
0xf7
};
static void variax_activate_async(struct usb_line6_variax *variax, int a)
{
variax->buffer_activate[VARIAX_OFFSET_ACTIVATE] = a;
line6_send_raw_message_async(&variax->line6, variax->buffer_activate,
sizeof(variax_activate));
}
/*
Variax startup procedure.
This is a sequence of functions with special requirements (e.g., must
not run immediately after initialization, must not run in interrupt
context). After the last one has finished, the device is ready to use.
*/
static void variax_startup(struct usb_line6 *line6)
{
struct usb_line6_variax *variax = line6_to_variax(line6);
switch (variax->startup_progress) {
case VARIAX_STARTUP_VERSIONREQ:
/* repeat request until getting the response */
schedule_delayed_work(&line6->startup_work,
msecs_to_jiffies(VARIAX_STARTUP_DELAY1));
/* request firmware version: */
line6_version_request_async(line6);
break;
case VARIAX_STARTUP_ACTIVATE:
/* activate device: */
variax_activate_async(variax, 1);
variax->startup_progress = VARIAX_STARTUP_SETUP;
schedule_delayed_work(&line6->startup_work,
msecs_to_jiffies(VARIAX_STARTUP_DELAY4));
break;
case VARIAX_STARTUP_SETUP:
/* ALSA audio interface: */
snd_card_register(variax->line6.card);
break;
}
}
/*
Process a completely received message.
*/
static void line6_variax_process_message(struct usb_line6 *line6)
{
struct usb_line6_variax *variax = line6_to_variax(line6);
const unsigned char *buf = variax->line6.buffer_message;
switch (buf[0]) {
case LINE6_RESET:
dev_info(variax->line6.ifcdev, "VARIAX reset\n");
break;
case LINE6_SYSEX_BEGIN:
Annotation
- Immediate include surface: `linux/slab.h`, `linux/spinlock.h`, `linux/usb.h`, `linux/wait.h`, `linux/module.h`, `sound/core.h`, `driver.h`.
- Detected declarations: `struct usb_line6_variax`, `function variax_activate_async`, `function requirements`, `function line6_variax_process_message`, `function line6_variax_disconnect`, `function variax_init`, `function variax_probe`.
- 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.