sound/firewire/oxfw/oxfw-spkr.c
Source file repositories/reference/linux-study-clean/sound/firewire/oxfw/oxfw-spkr.c
File Facts
- System
- Linux kernel
- Corpus path
sound/firewire/oxfw/oxfw-spkr.c- Extension
.c- Size
- 7509 bytes
- Lines
- 321
- Domain
- Driver Families
- Bucket
- sound/firewire
- 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
oxfw.h
Detected Declarations
struct fw_spkrenum control_actionenum control_attributefunction avc_audio_feature_mutefunction avc_audio_feature_volumefunction spkr_mute_getfunction spkr_mute_putfunction spkr_volume_infofunction spkr_volume_getfunction spkr_volume_putfunction snd_oxfw_add_spkr
Annotated Snippet
struct fw_spkr {
bool mute;
s16 volume[6];
s16 volume_min;
s16 volume_max;
unsigned int mixer_channels;
u8 mute_fb_id;
u8 volume_fb_id;
};
enum control_action { CTL_READ, CTL_WRITE };
enum control_attribute {
CTL_MIN = 0x02,
CTL_MAX = 0x03,
CTL_CURRENT = 0x10,
};
static int avc_audio_feature_mute(struct fw_unit *unit, u8 fb_id, bool *value,
enum control_action action)
{
u8 *buf;
u8 response_ok;
int err;
buf = kmalloc(11, GFP_KERNEL);
if (!buf)
return -ENOMEM;
if (action == CTL_READ) {
buf[0] = 0x01; /* AV/C, STATUS */
response_ok = 0x0c; /* STABLE */
} else {
buf[0] = 0x00; /* AV/C, CONTROL */
response_ok = 0x09; /* ACCEPTED */
}
buf[1] = 0x08; /* audio unit 0 */
buf[2] = 0xb8; /* FUNCTION BLOCK */
buf[3] = 0x81; /* function block type: feature */
buf[4] = fb_id; /* function block ID */
buf[5] = 0x10; /* control attribute: current */
buf[6] = 0x02; /* selector length */
buf[7] = 0x00; /* audio channel number */
buf[8] = 0x01; /* control selector: mute */
buf[9] = 0x01; /* control data length */
if (action == CTL_READ)
buf[10] = 0xff;
else
buf[10] = *value ? 0x70 : 0x60;
err = fcp_avc_transaction(unit, buf, 11, buf, 11, 0x3fe);
if (err < 0)
goto error;
if (err < 11) {
dev_err(&unit->device, "short FCP response\n");
err = -EIO;
goto error;
}
if (buf[0] != response_ok) {
dev_err(&unit->device, "mute command failed\n");
err = -EIO;
goto error;
}
if (action == CTL_READ)
*value = buf[10] == 0x70;
err = 0;
error:
kfree(buf);
return err;
}
static int avc_audio_feature_volume(struct fw_unit *unit, u8 fb_id, s16 *value,
unsigned int channel,
enum control_attribute attribute,
enum control_action action)
{
u8 *buf;
u8 response_ok;
int err;
buf = kmalloc(12, GFP_KERNEL);
if (!buf)
return -ENOMEM;
if (action == CTL_READ) {
buf[0] = 0x01; /* AV/C, STATUS */
response_ok = 0x0c; /* STABLE */
Annotation
- Immediate include surface: `oxfw.h`.
- Detected declarations: `struct fw_spkr`, `enum control_action`, `enum control_attribute`, `function avc_audio_feature_mute`, `function avc_audio_feature_volume`, `function spkr_mute_get`, `function spkr_mute_put`, `function spkr_volume_info`, `function spkr_volume_get`, `function spkr_volume_put`.
- Atlas domain: Driver Families / sound/firewire.
- 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.