sound/pci/echoaudio/layla20_dsp.c
Source file repositories/reference/linux-study-clean/sound/pci/echoaudio/layla20_dsp.c
File Facts
- System
- Linux kernel
- Corpus path
sound/pci/echoaudio/layla20_dsp.c- Extension
.c- Size
- 6592 bytes
- Lines
- 277
- Domain
- Driver Families
- Bucket
- sound/pci
- 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
- No C-style include directives detected by the generator.
Detected Declarations
function init_hwfunction set_mixer_defaultsfunction detect_input_clocksfunction check_asic_statusfunction load_asicfunction set_sample_ratefunction set_input_clockfunction set_output_clockfunction set_input_gainfunction update_flagsfunction set_professional_spdif
Annotated Snippet
if (read_dsp(chip, &asic_status) < 0) {
dev_err(chip->card->dev,
"check_asic_status: failed on read_dsp\n");
return -EIO;
}
if (asic_status == ASIC_ALREADY_LOADED) {
if (++goodcnt == 3) {
chip->asic_loaded = true;
return 0;
}
}
}
return -EIO;
}
/* Layla20 has an ASIC in the external box */
static int load_asic(struct echoaudio *chip)
{
int err;
if (chip->asic_loaded)
return 0;
err = load_asic_generic(chip, DSP_FNC_LOAD_LAYLA_ASIC,
FW_LAYLA20_ASIC);
if (err < 0)
return err;
/* Check if ASIC is alive and well. */
return check_asic_status(chip);
}
static int set_sample_rate(struct echoaudio *chip, u32 rate)
{
if (snd_BUG_ON(rate < 8000 || rate > 50000))
return -EINVAL;
/* Only set the clock for internal mode. Do not return failure,
simply treat it as a non-event. */
if (chip->input_clock != ECHO_CLOCK_INTERNAL) {
dev_warn(chip->card->dev,
"Cannot set sample rate - clock not set to CLK_CLOCKININTERNAL\n");
chip->comm_page->sample_rate = cpu_to_le32(rate);
chip->sample_rate = rate;
return 0;
}
if (wait_handshake(chip))
return -EIO;
dev_dbg(chip->card->dev, "set_sample_rate(%d)\n", rate);
chip->sample_rate = rate;
chip->comm_page->sample_rate = cpu_to_le32(rate);
clear_handshake(chip);
return send_vector(chip, DSP_VC_SET_LAYLA_SAMPLE_RATE);
}
static int set_input_clock(struct echoaudio *chip, u16 clock_source)
{
u16 clock;
u32 rate;
rate = 0;
switch (clock_source) {
case ECHO_CLOCK_INTERNAL:
rate = chip->sample_rate;
clock = LAYLA20_CLOCK_INTERNAL;
break;
case ECHO_CLOCK_SPDIF:
clock = LAYLA20_CLOCK_SPDIF;
break;
case ECHO_CLOCK_WORD:
clock = LAYLA20_CLOCK_WORD;
break;
case ECHO_CLOCK_SUPER:
clock = LAYLA20_CLOCK_SUPER;
break;
default:
dev_err(chip->card->dev,
"Input clock 0x%x not supported for Layla24\n",
clock_source);
return -EINVAL;
}
Annotation
- Detected declarations: `function init_hw`, `function set_mixer_defaults`, `function detect_input_clocks`, `function check_asic_status`, `function load_asic`, `function set_sample_rate`, `function set_input_clock`, `function set_output_clock`, `function set_input_gain`, `function update_flags`.
- Atlas domain: Driver Families / sound/pci.
- 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.