ALSA: Echoaudio - Add firmware cache #1

Changes the way the firmware is passed through functions.

When CONFIG_PM is enabled the firmware cannot be released because the
driver will need it again to resume the card. 
With this patch the firmware is passed as an index of the struct
firmware card_fw[] in place of a pointer. That same index is then used
to locate the firmware in the firmware cache.

Signed-off-by: Giuliano Pochini <pochini@shiny.it>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
This commit is contained in:
Giuliano Pochini
2010-02-14 18:15:34 +01:00
committed by Takashi Iwai
父節點 a540e13386
當前提交 19b5006378
共有 18 個文件被更改,包括 69 次插入65 次删除

查看文件

@@ -33,8 +33,7 @@ static int write_control_reg(struct echoaudio *chip, u32 value, char force);
static int set_input_clock(struct echoaudio *chip, u16 clock);
static int set_professional_spdif(struct echoaudio *chip, char prof);
static int set_digital_mode(struct echoaudio *chip, u8 mode);
static int load_asic_generic(struct echoaudio *chip, u32 cmd,
const struct firmware *asic);
static int load_asic_generic(struct echoaudio *chip, u32 cmd, short asic);
static int check_asic_status(struct echoaudio *chip);
@@ -64,13 +63,13 @@ static int init_hw(struct echoaudio *chip, u16 device_id, u16 subdevice_id)
/* Gina24 comes in both '301 and '361 flavors */
if (chip->device_id == DEVICE_ID_56361) {
chip->dsp_code_to_load = &card_fw[FW_GINA24_361_DSP];
chip->dsp_code_to_load = FW_GINA24_361_DSP;
chip->digital_modes =
ECHOCAPS_HAS_DIGITAL_MODE_SPDIF_RCA |
ECHOCAPS_HAS_DIGITAL_MODE_SPDIF_OPTICAL |
ECHOCAPS_HAS_DIGITAL_MODE_ADAT;
} else {
chip->dsp_code_to_load = &card_fw[FW_GINA24_301_DSP];
chip->dsp_code_to_load = FW_GINA24_301_DSP;
chip->digital_modes =
ECHOCAPS_HAS_DIGITAL_MODE_SPDIF_RCA |
ECHOCAPS_HAS_DIGITAL_MODE_SPDIF_OPTICAL |
@@ -125,7 +124,7 @@ static int load_asic(struct echoaudio *chip)
{
u32 control_reg;
int err;
const struct firmware *fw;
short asic;
if (chip->asic_loaded)
return 1;
@@ -135,14 +134,15 @@ static int load_asic(struct echoaudio *chip)
/* Pick the correct ASIC for '301 or '361 Gina24 */
if (chip->device_id == DEVICE_ID_56361)
fw = &card_fw[FW_GINA24_361_ASIC];
asic = FW_GINA24_361_ASIC;
else
fw = &card_fw[FW_GINA24_301_ASIC];
asic = FW_GINA24_301_ASIC;
if ((err = load_asic_generic(chip, DSP_FNC_LOAD_GINA24_ASIC, fw)) < 0)
err = load_asic_generic(chip, DSP_FNC_LOAD_GINA24_ASIC, asic);
if (err < 0)
return err;
chip->asic_code = fw;
chip->asic_code = asic;
/* Now give the new ASIC a little time to set up */
mdelay(10);