Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 353249
b: refs/heads/master
c: c3b4eea
h: refs/heads/master
i:
  353247: b1518a4
v: v3
  • Loading branch information
Ian Minett authored and Takashi Iwai committed Nov 28, 2012
1 parent ed3fa6c commit ff75d86
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 7 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 01ef7dbffb411d9d78d1150b268d9c757f9f2f93
refs/heads/master: c3b4eea26208b8e247ece9d3a9ec8b2eab48c464
28 changes: 22 additions & 6 deletions trunk/sound/pci/hda/patch_ca0132.c
Original file line number Diff line number Diff line change
Expand Up @@ -2025,6 +2025,24 @@ static int dspload_image(struct hda_codec *codec,
return status;
}

static const struct firmware *fw_efx;

static int request_firmware_cached(const struct firmware **firmware_p,
const char *name, struct device *device)
{
if (*firmware_p)
return 0; /* already loaded */
return request_firmware(firmware_p, name, device);
}

static void release_cached_firmware(void)
{
if (fw_efx) {
release_firmware(fw_efx);
fw_efx = NULL;
}
}

static bool dspload_is_loaded(struct hda_codec *codec)
{
unsigned int data = 0;
Expand Down Expand Up @@ -2542,18 +2560,15 @@ static bool ca0132_download_dsp_images(struct hda_codec *codec)
{
bool dsp_loaded = false;
const struct dsp_image_seg *dsp_os_image;
const struct firmware *fw_entry;

if (request_firmware(&fw_entry, EFX_FILE, codec->bus->card->dev) != 0)
if (request_firmware_cached(&fw_efx, EFX_FILE,
codec->bus->card->dev) != 0)
return false;

dsp_os_image = (struct dsp_image_seg *)(fw_entry->data);
dsp_os_image = (struct dsp_image_seg *)(fw_efx->data);
dspload_image(codec, dsp_os_image, 0, 0, true, 0);
dsp_loaded = dspload_wait_loaded(codec);

release_firmware(fw_entry);


return dsp_loaded;
}

Expand Down Expand Up @@ -2665,6 +2680,7 @@ static int __init patch_ca0132_init(void)

static void __exit patch_ca0132_exit(void)
{
release_cached_firmware();
snd_hda_delete_codec_preset(&ca0132_list);
}

Expand Down

0 comments on commit ff75d86

Please sign in to comment.