[PATCH] [UBUNTU:sound/pci/rme9652/] Fix firmware autoupdate for hdsp

crimsun at fungus.sh.nu crimsun at fungus.sh.nu
Sat Sep 9 20:30:01 UTC 2006


From b3fe1f44dcf7c632072b56dc1aaf8c9bc9b26e4c Mon Sep 17 00:00:00 2001
From: Daniel T. Chen <crimsun at garnish.localdomain>
Date: Wed, 6 Sep 2006 16:16:00 -0400
Subject: [PATCH] [UBUNTU:sound/pci/rme9652/] Fix firmware autoupdate for hdsp

UpstreamStatus: Added in upstream alsa-kernel hg changeset:
		59b3ce172f09 [http://hg-mirror.alsa-project.org/alsa-kernel?cmd=changeset;node=59b3ce172f09aeb5bd72189fcf1ecb2d8e4c34f4;style=raw]

This commit from Takashi Iwai fixes autoloading of firmware on
hdsp if the breakout box is toggled.

Signed-off-by: Daniel T Chen <crimsun at ubuntu.com>
---
 sound/pci/rme9652/hdsp.c |   45 +++++++++++++++++++++++++++++++++------------
 1 files changed, 33 insertions(+), 12 deletions(-)

diff --git a/sound/pci/rme9652/hdsp.c b/sound/pci/rme9652/hdsp.c
index d15ffb3..269f730 100644
--- a/sound/pci/rme9652/hdsp.c
+++ b/sound/pci/rme9652/hdsp.c
@@ -730,22 +730,35 @@ static int hdsp_get_iobox_version (hdsp_
 }
 
 
-static int hdsp_check_for_firmware (hdsp_t *hdsp, int show_err)
+#ifdef HDSP_FW_LOADER
+static int __devinit hdsp_request_fw_loader(hdsp_t *hdsp);
+#endif
+
+static int hdsp_check_for_firmware (hdsp_t *hdsp, int load_on_demand)
 {
 	if (hdsp->io_type == H9652 || hdsp->io_type == H9632) return 0;
 	if ((hdsp_read (hdsp, HDSP_statusRegister) & HDSP_DllError) != 0) {
-		snd_printk(KERN_ERR "Hammerfall-DSP: firmware not present.\n");
 		hdsp->state &= ~HDSP_FirmwareLoaded;
-		if (! show_err)
+		if (! load_on_demand)
 			return -EIO;
+		snd_printk(KERN_ERR "Hammerfall-DSP: firmware not present.\n");
 		/* try to load firmware */
-		if (hdsp->state & HDSP_FirmwareCached) {
-			if (snd_hdsp_load_firmware_from_cache(hdsp) != 0)
-				snd_printk(KERN_ERR "Hammerfall-DSP: Firmware loading from cache failed, please upload manually.\n");
-		} else {
-			snd_printk(KERN_ERR "Hammerfall-DSP: No firmware loaded nor cached, please upload firmware.\n");
+		if (! (hdsp->state & HDSP_FirmwareCached)) {
+#ifdef HDSP_FW_LOADER
+			if (! hdsp_request_fw_loader(hdsp))
+				return 0;
+#endif
+			snd_printk(KERN_ERR
+				   "Hammerfall-DSP: No firmware loaded nor "
+				   "cached, please upload firmware.\n");
+			return -EIO;
+		}
+		if (snd_hdsp_load_firmware_from_cache(hdsp) != 0) {
+			snd_printk(KERN_ERR
+				   "Hammerfall-DSP: Firmware loading from "
+				   "cache failed, please upload manually.\n");
+			return -EIO;
 		}
-		return -EIO;
 	}
 	return 0;
 }
@@ -3184,8 +3197,16 @@ snd_hdsp_proc_read(snd_info_entry_t *ent
 				return;
 			}
 		} else {
-			snd_iprintf(buffer, "No firmware loaded nor cached, please upload firmware.\n");
-			return;
+			int err = -EINVAL;
+#ifdef HDSP_FW_LOADER
+			err = hdsp_request_fw_loader(hdsp);
+#endif
+			if (err < 0) {
+				snd_iprintf(buffer,
+					    "No firmware loaded nor cached, "
+					    "please upload firmware.\n");
+				return;
+			}
 		}
 	}
 	
@@ -3854,7 +3875,7 @@ static int snd_hdsp_trigger(snd_pcm_subs
 	if (hdsp_check_for_iobox (hdsp))
 		return -EIO;
 
-	if (hdsp_check_for_firmware(hdsp, 1))
+	if (hdsp_check_for_firmware(hdsp, 0)) /* no auto-loading in trigger */
 		return -EIO;
 
 	spin_lock(&hdsp->lock);
-- 
1.4.1

-- 
Daniel T. Chen            crimsun at ubuntu.com
GPG key:  0xC88ABDA3
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
URL: <https://lists.ubuntu.com/archives/kernel-team/attachments/20060909/89c8dbb3/attachment.sig>


More information about the kernel-team mailing list