aboutsummaryrefslogtreecommitdiffstats
path: root/sound/pci/echoaudio/mona_dsp.c
diff options
context:
space:
mode:
authorGiuliano Pochini <pochini@shiny.it>2010-02-14 12:15:34 -0500
committerTakashi Iwai <tiwai@suse.de>2010-02-15 04:36:51 -0500
commit19b50063780953563e3c3a2867c39aad7b9e64cf (patch)
tree0b26395a9d785f1684e2a7f489735ce577a8c1ac /sound/pci/echoaudio/mona_dsp.c
parenta540e13386e90f8c833c5cd0d16d877b8a277af1 (diff)
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>
Diffstat (limited to 'sound/pci/echoaudio/mona_dsp.c')
-rw-r--r--sound/pci/echoaudio/mona_dsp.c39
1 files changed, 19 insertions, 20 deletions
diff --git a/sound/pci/echoaudio/mona_dsp.c b/sound/pci/echoaudio/mona_dsp.c
index eaa619bd2a0..b28b8e4703c 100644
--- a/sound/pci/echoaudio/mona_dsp.c
+++ b/sound/pci/echoaudio/mona_dsp.c
@@ -33,8 +33,7 @@ static int write_control_reg(struct echoaudio *chip, u32 value, char force);
33static int set_input_clock(struct echoaudio *chip, u16 clock); 33static int set_input_clock(struct echoaudio *chip, u16 clock);
34static int set_professional_spdif(struct echoaudio *chip, char prof); 34static int set_professional_spdif(struct echoaudio *chip, char prof);
35static int set_digital_mode(struct echoaudio *chip, u8 mode); 35static int set_digital_mode(struct echoaudio *chip, u8 mode);
36static int load_asic_generic(struct echoaudio *chip, u32 cmd, 36static int load_asic_generic(struct echoaudio *chip, u32 cmd, short asic);
37 const struct firmware *asic);
38static int check_asic_status(struct echoaudio *chip); 37static int check_asic_status(struct echoaudio *chip);
39 38
40 39
@@ -64,9 +63,9 @@ static int init_hw(struct echoaudio *chip, u16 device_id, u16 subdevice_id)
64 63
65 /* Mona comes in both '301 and '361 flavors */ 64 /* Mona comes in both '301 and '361 flavors */
66 if (chip->device_id == DEVICE_ID_56361) 65 if (chip->device_id == DEVICE_ID_56361)
67 chip->dsp_code_to_load = &card_fw[FW_MONA_361_DSP]; 66 chip->dsp_code_to_load = FW_MONA_361_DSP;
68 else 67 else
69 chip->dsp_code_to_load = &card_fw[FW_MONA_301_DSP]; 68 chip->dsp_code_to_load = FW_MONA_301_DSP;
70 69
71 chip->digital_mode = DIGITAL_MODE_SPDIF_RCA; 70 chip->digital_mode = DIGITAL_MODE_SPDIF_RCA;
72 chip->professional_spdif = FALSE; 71 chip->professional_spdif = FALSE;
@@ -120,7 +119,7 @@ static int load_asic(struct echoaudio *chip)
120{ 119{
121 u32 control_reg; 120 u32 control_reg;
122 int err; 121 int err;
123 const struct firmware *asic; 122 short asic;
124 123
125 if (chip->asic_loaded) 124 if (chip->asic_loaded)
126 return 0; 125 return 0;
@@ -128,9 +127,9 @@ static int load_asic(struct echoaudio *chip)
128 mdelay(10); 127 mdelay(10);
129 128
130 if (chip->device_id == DEVICE_ID_56361) 129 if (chip->device_id == DEVICE_ID_56361)
131 asic = &card_fw[FW_MONA_361_1_ASIC48]; 130 asic = FW_MONA_361_1_ASIC48;
132 else 131 else
133 asic = &card_fw[FW_MONA_301_1_ASIC48]; 132 asic = FW_MONA_301_1_ASIC48;
134 133
135 err = load_asic_generic(chip, DSP_FNC_LOAD_MONA_PCI_CARD_ASIC, asic); 134 err = load_asic_generic(chip, DSP_FNC_LOAD_MONA_PCI_CARD_ASIC, asic);
136 if (err < 0) 135 if (err < 0)
@@ -141,7 +140,7 @@ static int load_asic(struct echoaudio *chip)
141 140
142 /* Do the external one */ 141 /* Do the external one */
143 err = load_asic_generic(chip, DSP_FNC_LOAD_MONA_EXTERNAL_ASIC, 142 err = load_asic_generic(chip, DSP_FNC_LOAD_MONA_EXTERNAL_ASIC,
144 &card_fw[FW_MONA_2_ASIC]); 143 FW_MONA_2_ASIC);
145 if (err < 0) 144 if (err < 0)
146 return err; 145 return err;
147 146
@@ -165,22 +164,22 @@ loaded. This function checks the ASIC needed for the new mode and sees
165if it matches the one already loaded. */ 164if it matches the one already loaded. */
166static int switch_asic(struct echoaudio *chip, char double_speed) 165static int switch_asic(struct echoaudio *chip, char double_speed)
167{ 166{
168 const struct firmware *asic;
169 int err; 167 int err;
168 short asic;
170 169
171 /* Check the clock detect bits to see if this is 170 /* Check the clock detect bits to see if this is
172 a single-speed clock or a double-speed clock; load 171 a single-speed clock or a double-speed clock; load
173 a new ASIC if necessary. */ 172 a new ASIC if necessary. */
174 if (chip->device_id == DEVICE_ID_56361) { 173 if (chip->device_id == DEVICE_ID_56361) {
175 if (double_speed) 174 if (double_speed)
176 asic = &card_fw[FW_MONA_361_1_ASIC96]; 175 asic = FW_MONA_361_1_ASIC96;
177 else 176 else
178 asic = &card_fw[FW_MONA_361_1_ASIC48]; 177 asic = FW_MONA_361_1_ASIC48;
179 } else { 178 } else {
180 if (double_speed) 179 if (double_speed)
181 asic = &card_fw[FW_MONA_301_1_ASIC96]; 180 asic = FW_MONA_301_1_ASIC96;
182 else 181 else
183 asic = &card_fw[FW_MONA_301_1_ASIC48]; 182 asic = FW_MONA_301_1_ASIC48;
184 } 183 }
185 184
186 if (asic != chip->asic_code) { 185 if (asic != chip->asic_code) {
@@ -200,7 +199,7 @@ static int switch_asic(struct echoaudio *chip, char double_speed)
200static int set_sample_rate(struct echoaudio *chip, u32 rate) 199static int set_sample_rate(struct echoaudio *chip, u32 rate)
201{ 200{
202 u32 control_reg, clock; 201 u32 control_reg, clock;
203 const struct firmware *asic; 202 short asic;
204 char force_write; 203 char force_write;
205 204
206 /* Only set the clock for internal mode. */ 205 /* Only set the clock for internal mode. */
@@ -218,14 +217,14 @@ static int set_sample_rate(struct echoaudio *chip, u32 rate)
218 if (chip->digital_mode == DIGITAL_MODE_ADAT) 217 if (chip->digital_mode == DIGITAL_MODE_ADAT)
219 return -EINVAL; 218 return -EINVAL;
220 if (chip->device_id == DEVICE_ID_56361) 219 if (chip->device_id == DEVICE_ID_56361)
221 asic = &card_fw[FW_MONA_361_1_ASIC96]; 220 asic = FW_MONA_361_1_ASIC96;
222 else 221 else
223 asic = &card_fw[FW_MONA_301_1_ASIC96]; 222 asic = FW_MONA_301_1_ASIC96;
224 } else { 223 } else {
225 if (chip->device_id == DEVICE_ID_56361) 224 if (chip->device_id == DEVICE_ID_56361)
226 asic = &card_fw[FW_MONA_361_1_ASIC48]; 225 asic = FW_MONA_361_1_ASIC48;
227 else 226 else
228 asic = &card_fw[FW_MONA_301_1_ASIC48]; 227 asic = FW_MONA_301_1_ASIC48;
229 } 228 }
230 229
231 force_write = 0; 230 force_write = 0;
@@ -410,8 +409,8 @@ static int dsp_set_digital_mode(struct echoaudio *chip, u8 mode)
410 case DIGITAL_MODE_ADAT: 409 case DIGITAL_MODE_ADAT:
411 /* If the current ASIC is the 96KHz ASIC, switch the ASIC 410 /* If the current ASIC is the 96KHz ASIC, switch the ASIC
412 and set to 48 KHz */ 411 and set to 48 KHz */
413 if (chip->asic_code == &card_fw[FW_MONA_361_1_ASIC96] || 412 if (chip->asic_code == FW_MONA_361_1_ASIC96 ||
414 chip->asic_code == &card_fw[FW_MONA_301_1_ASIC96]) { 413 chip->asic_code == FW_MONA_301_1_ASIC96) {
415 set_sample_rate(chip, 48000); 414 set_sample_rate(chip, 48000);
416 } 415 }
417 control_reg |= GML_ADAT_MODE; 416 control_reg |= GML_ADAT_MODE;