sound/usb/6fire/control.c
Source file repositories/reference/linux-study-clean/sound/usb/6fire/control.c
File Facts
- System
- Linux kernel
- Corpus path
sound/usb/6fire/control.c- Extension
.c- Size
- 16285 bytes
- Lines
- 620
- 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/interrupt.hsound/control.hsound/tlv.hcontrol.hcomm.hchip.h
Detected Declarations
function usb6fire_control_output_vol_updatefunction usb6fire_control_output_mute_updatefunction usb6fire_control_input_vol_updatefunction usb6fire_control_line_phono_updatefunction usb6fire_control_opt_coax_updatefunction usb6fire_control_set_ratefunction usb6fire_control_set_channelsfunction usb6fire_control_streaming_updatefunction usb6fire_control_output_vol_infofunction usb6fire_control_output_vol_putfunction usb6fire_control_output_vol_getfunction usb6fire_control_output_mute_putfunction usb6fire_control_output_mute_getfunction usb6fire_control_input_vol_infofunction usb6fire_control_input_vol_putfunction usb6fire_control_input_vol_getfunction usb6fire_control_line_phono_infofunction usb6fire_control_line_phono_putfunction usb6fire_control_line_phono_getfunction usb6fire_control_opt_coax_infofunction usb6fire_control_opt_coax_putfunction usb6fire_control_opt_coax_getfunction usb6fire_control_digital_thru_putfunction usb6fire_control_digital_thru_getfunction usb6fire_control_add_virtualfunction usb6fire_control_initfunction usb6fire_control_abort
Annotated Snippet
if (!(rt->ovol_updated & (1 << i))) {
comm_rt->write8(comm_rt, 0x12, 0x0f + i,
180 - rt->output_vol[i]);
rt->ovol_updated |= 1 << i;
}
}
static void usb6fire_control_output_mute_update(struct control_runtime *rt)
{
struct comm_runtime *comm_rt = rt->chip->comm;
if (comm_rt)
comm_rt->write8(comm_rt, 0x12, 0x0e, ~rt->output_mute);
}
static void usb6fire_control_input_vol_update(struct control_runtime *rt)
{
struct comm_runtime *comm_rt = rt->chip->comm;
int i;
if (comm_rt)
for (i = 0; i < 2; i++)
if (!(rt->ivol_updated & (1 << i))) {
comm_rt->write8(comm_rt, 0x12, 0x1c + i,
rt->input_vol[i] & 0x3f);
rt->ivol_updated |= 1 << i;
}
}
static void usb6fire_control_line_phono_update(struct control_runtime *rt)
{
struct comm_runtime *comm_rt = rt->chip->comm;
if (comm_rt) {
comm_rt->write8(comm_rt, 0x22, 0x02, rt->line_phono_switch);
comm_rt->write8(comm_rt, 0x21, 0x02, rt->line_phono_switch);
}
}
static void usb6fire_control_opt_coax_update(struct control_runtime *rt)
{
struct comm_runtime *comm_rt = rt->chip->comm;
if (comm_rt) {
comm_rt->write8(comm_rt, 0x22, 0x00, rt->opt_coax_switch);
comm_rt->write8(comm_rt, 0x21, 0x00, rt->opt_coax_switch);
}
}
static int usb6fire_control_set_rate(struct control_runtime *rt, int rate)
{
int ret;
struct usb_device *device = rt->chip->dev;
struct comm_runtime *comm_rt = rt->chip->comm;
if (rate < 0 || rate >= CONTROL_N_RATES)
return -EINVAL;
ret = usb_set_interface(device, 1, rates_altsetting[rate]);
if (ret < 0)
return ret;
/* set soundcard clock */
ret = comm_rt->write16(comm_rt, 0x02, 0x01, rates_6fire_vl[rate],
rates_6fire_vh[rate]);
if (ret < 0)
return ret;
return 0;
}
static int usb6fire_control_set_channels(
struct control_runtime *rt, int n_analog_out,
int n_analog_in, bool spdif_out, bool spdif_in)
{
int ret;
struct comm_runtime *comm_rt = rt->chip->comm;
/* enable analog inputs and outputs
* (one bit per stereo-channel) */
ret = comm_rt->write16(comm_rt, 0x02, 0x02,
(1 << (n_analog_out / 2)) - 1,
(1 << (n_analog_in / 2)) - 1);
if (ret < 0)
return ret;
/* disable digital inputs and outputs */
/* TODO: use spdif_x to enable/disable digital channels */
ret = comm_rt->write16(comm_rt, 0x02, 0x03, 0x00, 0x00);
if (ret < 0)
return ret;
Annotation
- Immediate include surface: `linux/interrupt.h`, `sound/control.h`, `sound/tlv.h`, `control.h`, `comm.h`, `chip.h`.
- Detected declarations: `function usb6fire_control_output_vol_update`, `function usb6fire_control_output_mute_update`, `function usb6fire_control_input_vol_update`, `function usb6fire_control_line_phono_update`, `function usb6fire_control_opt_coax_update`, `function usb6fire_control_set_rate`, `function usb6fire_control_set_channels`, `function usb6fire_control_streaming_update`, `function usb6fire_control_output_vol_info`, `function usb6fire_control_output_vol_put`.
- 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.