static int init_hw(struct echoaudio *chip, u16 device_id, u16 subdevice_id) { int err; DE_INIT(("init_hw() - Mia\n")); if (snd_BUG_ON((subdevice_id & 0xfff0) != MIA)) return -ENODEV; if ((err = init_dsp_comm_page(chip))) { DE_INIT(("init_hw - could not initialize DSP comm page\n")); return err; } chip->device_id = device_id; chip->subdevice_id = subdevice_id; chip->bad_board = TRUE; chip->dsp_code_to_load = &card_fw[FW_MIA_DSP]; /* Since this card has no ASIC, mark it as loaded so everything works OK */ chip->asic_loaded = TRUE; if ((subdevice_id & 0x0000f) == MIA_MIDI_REV) chip->has_midi = TRUE; chip->input_clock_types = ECHO_CLOCK_BIT_INTERNAL | ECHO_CLOCK_BIT_SPDIF; if ((err = load_firmware(chip)) < 0) return err; chip->bad_board = FALSE; if ((err = init_line_levels(chip))) return err; /* Default routing of the virtual channels: vchannels 0-3 go to analog outputs and vchannels 4-7 go to S/PDIF outputs */ set_vmixer_gain(chip, 0, 0, 0); set_vmixer_gain(chip, 1, 1, 0); set_vmixer_gain(chip, 0, 2, 0); set_vmixer_gain(chip, 1, 3, 0); set_vmixer_gain(chip, 2, 4, 0); set_vmixer_gain(chip, 3, 5, 0); set_vmixer_gain(chip, 2, 6, 0); set_vmixer_gain(chip, 3, 7, 0); err = update_vmixer_level(chip); DE_INIT(("init_hw done\n")); return err; }
static int init_hw(struct echoaudio *chip, u16 device_id, u16 subdevice_id) { int err; DE_INIT(("init_hw() - Indigo\n")); if (snd_BUG_ON((subdevice_id & 0xfff0) != INDIGO)) return -ENODEV; if ((err = init_dsp_comm_page(chip))) { DE_INIT(("init_hw - could not initialize DSP comm page\n")); return err; } chip->device_id = device_id; chip->subdevice_id = subdevice_id; chip->bad_board = TRUE; chip->dsp_code_to_load = &card_fw[FW_INDIGO_DSP]; /* Since this card has no ASIC, mark it as loaded so everything works OK */ chip->asic_loaded = TRUE; chip->input_clock_types = ECHO_CLOCK_BIT_INTERNAL; if ((err = load_firmware(chip)) < 0) return err; chip->bad_board = FALSE; if ((err = init_line_levels(chip)) < 0) return err; /* Default routing of the virtual channels: all vchannels are routed to the stereo output */ set_vmixer_gain(chip, 0, 0, 0); set_vmixer_gain(chip, 1, 1, 0); set_vmixer_gain(chip, 0, 2, 0); set_vmixer_gain(chip, 1, 3, 0); set_vmixer_gain(chip, 0, 4, 0); set_vmixer_gain(chip, 1, 5, 0); set_vmixer_gain(chip, 0, 6, 0); set_vmixer_gain(chip, 1, 7, 0); err = update_vmixer_level(chip); DE_INIT(("init_hw done\n")); return err; }
/* This function initializes the several volume controls for busses and pipes. This MUST be called after the DSP is up and running ! */ static int init_line_levels(struct echoaudio *chip) { int st, i, o; DE_INIT(("init_line_levels\n")); /* Mute output busses */ for (i = 0; i < num_busses_out(chip); i++) if ((st = set_output_gain(chip, i, ECHOGAIN_MUTED))) return st; if ((st = update_output_line_level(chip))) return st; #ifdef ECHOCARD_HAS_VMIXER /* Mute the Vmixer */ for (i = 0; i < num_pipes_out(chip); i++) for (o = 0; o < num_busses_out(chip); o++) if ((st = set_vmixer_gain(chip, o, i, ECHOGAIN_MUTED))) return st; if ((st = update_vmixer_level(chip))) return st; #endif /* ECHOCARD_HAS_VMIXER */ #ifdef ECHOCARD_HAS_MONITOR /* Mute the monitor mixer */ for (o = 0; o < num_busses_out(chip); o++) for (i = 0; i < num_busses_in(chip); i++) if ((st = set_monitor_gain(chip, o, i, ECHOGAIN_MUTED))) return st; if ((st = update_output_line_level(chip))) return st; #endif /* ECHOCARD_HAS_MONITOR */ #ifdef ECHOCARD_HAS_INPUT_GAIN for (i = 0; i < num_busses_in(chip); i++) if ((st = set_input_gain(chip, i, ECHOGAIN_MUTED))) return st; if ((st = update_input_line_level(chip))) return st; #endif /* ECHOCARD_HAS_INPUT_GAIN */ return 0; }
static int restore_dsp_rettings(struct echoaudio *chip) { int i, o, err; DE_INIT(("restore_dsp_settings\n")); if ((err = check_asic_status(chip)) < 0) return err; /* */ chip->comm_page->gd_clock_state = GD_CLOCK_UNDEF; chip->comm_page->gd_spdif_status = GD_SPDIF_STATUS_UNDEF; chip->comm_page->handshake = 0xffffffff; /* */ for (i = 0; i < num_busses_out(chip); i++) { err = set_output_gain(chip, i, chip->output_gain[i]); if (err < 0) return err; } #ifdef ECHOCARD_HAS_VMIXER for (i = 0; i < num_pipes_out(chip); i++) for (o = 0; o < num_busses_out(chip); o++) { err = set_vmixer_gain(chip, o, i, chip->vmixer_gain[o][i]); if (err < 0) return err; } if (update_vmixer_level(chip) < 0) return -EIO; #endif /* */ #ifdef ECHOCARD_HAS_MONITOR for (o = 0; o < num_busses_out(chip); o++) for (i = 0; i < num_busses_in(chip); i++) { err = set_monitor_gain(chip, o, i, chip->monitor_gain[o][i]); if (err < 0) return err; } #endif /* */ #ifdef ECHOCARD_HAS_INPUT_GAIN for (i = 0; i < num_busses_in(chip); i++) { err = set_input_gain(chip, i, chip->input_gain[i]); if (err < 0) return err; } #endif /* */ err = update_output_line_level(chip); if (err < 0) return err; err = update_input_line_level(chip); if (err < 0) return err; err = set_sample_rate(chip, chip->sample_rate); if (err < 0) return err; if (chip->meters_enabled) { err = send_vector(chip, DSP_VC_METERS_ON); if (err < 0) return err; } #ifdef ECHOCARD_HAS_DIGITAL_MODE_SWITCH if (set_digital_mode(chip, chip->digital_mode) < 0) return -EIO; #endif #ifdef ECHOCARD_HAS_DIGITAL_IO if (set_professional_spdif(chip, chip->professional_spdif) < 0) return -EIO; #endif #ifdef ECHOCARD_HAS_PHANTOM_POWER if (set_phantom_power(chip, chip->phantom_power) < 0) return -EIO; #endif #ifdef ECHOCARD_HAS_EXTERNAL_CLOCK /* */ if (set_input_clock(chip, chip->input_clock) < 0) return -EIO; #endif #ifdef ECHOCARD_HAS_OUTPUT_CLOCK_SWITCH if (set_output_clock(chip, chip->output_clock) < 0) return -EIO; #endif if (wait_handshake(chip) < 0) return -EIO; clear_handshake(chip); if (send_vector(chip, DSP_VC_UPDATE_FLAGS) < 0) return -EIO; DE_INIT(("restore_dsp_rettings done\n")); return 0; }