/* load_firmware takes care of loading the DSP and any ASIC code. */ static int load_firmware(struct echoaudio *chip) { const struct firmware *fw; int box_type, err; if (snd_BUG_ON(!chip->dsp_code_to_load || !chip->comm_page)) return -EPERM; /* See if the ASIC is present and working - only if the DSP is already loaded */ if (chip->dsp_code) { if ((box_type = check_asic_status(chip)) >= 0) return box_type; /* ASIC check failed; force the DSP to reload */ chip->dsp_code = NULL; } if ((err = get_firmware(&fw, chip->dsp_code_to_load, chip)) < 0) return err; err = load_dsp(chip, (u16 *)fw->data); free_firmware(fw); if (err < 0) return err; if ((box_type = load_asic(chip)) < 0) return box_type; /* error */ if ((err = restore_dsp_rettings(chip)) < 0) return err; return box_type; }
/* This function initializes the chip structure with default values, ie. all * muted and internal clock source. Then it copies the settings to the DSP. * This MUST be called after the DSP is up and running ! */ static int init_line_levels(struct echoaudio *chip) { memset(chip->output_gain, ECHOGAIN_MUTED, sizeof(chip->output_gain)); memset(chip->input_gain, ECHOGAIN_MUTED, sizeof(chip->input_gain)); memset(chip->monitor_gain, ECHOGAIN_MUTED, sizeof(chip->monitor_gain)); memset(chip->vmixer_gain, ECHOGAIN_MUTED, sizeof(chip->vmixer_gain)); chip->input_clock = ECHO_CLOCK_INTERNAL; chip->output_clock = ECHO_CLOCK_WORD; chip->sample_rate = 44100; return restore_dsp_rettings(chip); }