aboutsummaryrefslogtreecommitdiffstats
path: root/sound
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2006-09-06 06:13:37 -0400
committerJaroslav Kysela <perex@suse.cz>2006-09-23 04:46:07 -0400
commit311e70a4741c736795da082da7290164d9cf3726 (patch)
tree17e746d945ad674fc20841f10566554958d47bd8 /sound
parentea543f1ee61bbfdf6cac4b79d66c7840d5b00037 (diff)
[ALSA] hdsp - Fix auto-updating of firmware
Fixed the auto-updating of firmware if the breakout box was switched off/on. The firmware binary itself was already cached but it wasn't loaded properly. Also, request_firmware() is issued if the box was with firmware at module loading time but later it's erased. The auto-update is triggered at each PCM action (open, prepare, etc) and at opening proc files. Signed-off-by: Takashi Iwai <tiwai@suse.de> Signed-off-by: Jaroslav Kysela <perex@suse.cz>
Diffstat (limited to 'sound')
-rw-r--r--sound/pci/rme9652/hdsp.c48
1 files changed, 35 insertions, 13 deletions
diff --git a/sound/pci/rme9652/hdsp.c b/sound/pci/rme9652/hdsp.c
index e5a52da77b85..d3e07de433b0 100644
--- a/sound/pci/rme9652/hdsp.c
+++ b/sound/pci/rme9652/hdsp.c
@@ -726,22 +726,36 @@ static int hdsp_get_iobox_version (struct hdsp *hdsp)
726} 726}
727 727
728 728
729static int hdsp_check_for_firmware (struct hdsp *hdsp, int show_err) 729#ifdef HDSP_FW_LOADER
730static int __devinit hdsp_request_fw_loader(struct hdsp *hdsp);
731#endif
732
733static int hdsp_check_for_firmware (struct hdsp *hdsp, int load_on_demand)
730{ 734{
731 if (hdsp->io_type == H9652 || hdsp->io_type == H9632) return 0; 735 if (hdsp->io_type == H9652 || hdsp->io_type == H9632)
736 return 0;
732 if ((hdsp_read (hdsp, HDSP_statusRegister) & HDSP_DllError) != 0) { 737 if ((hdsp_read (hdsp, HDSP_statusRegister) & HDSP_DllError) != 0) {
733 snd_printk(KERN_ERR "Hammerfall-DSP: firmware not present.\n");
734 hdsp->state &= ~HDSP_FirmwareLoaded; 738 hdsp->state &= ~HDSP_FirmwareLoaded;
735 if (! show_err) 739 if (! load_on_demand)
736 return -EIO; 740 return -EIO;
741 snd_printk(KERN_ERR "Hammerfall-DSP: firmware not present.\n");
737 /* try to load firmware */ 742 /* try to load firmware */
738 if (hdsp->state & HDSP_FirmwareCached) { 743 if (! (hdsp->state & HDSP_FirmwareCached)) {
739 if (snd_hdsp_load_firmware_from_cache(hdsp) != 0) 744#ifdef HDSP_FW_LOADER
740 snd_printk(KERN_ERR "Hammerfall-DSP: Firmware loading from cache failed, please upload manually.\n"); 745 if (! hdsp_request_fw_loader(hdsp))
741 } else { 746 return 0;
742 snd_printk(KERN_ERR "Hammerfall-DSP: No firmware loaded nor cached, please upload firmware.\n"); 747#endif
748 snd_printk(KERN_ERR
749 "Hammerfall-DSP: No firmware loaded nor "
750 "cached, please upload firmware.\n");
751 return -EIO;
752 }
753 if (snd_hdsp_load_firmware_from_cache(hdsp) != 0) {
754 snd_printk(KERN_ERR
755 "Hammerfall-DSP: Firmware loading from "
756 "cache failed, please upload manually.\n");
757 return -EIO;
743 } 758 }
744 return -EIO;
745 } 759 }
746 return 0; 760 return 0;
747} 761}
@@ -3181,8 +3195,16 @@ snd_hdsp_proc_read(struct snd_info_entry *entry, struct snd_info_buffer *buffer)
3181 return; 3195 return;
3182 } 3196 }
3183 } else { 3197 } else {
3184 snd_iprintf(buffer, "No firmware loaded nor cached, please upload firmware.\n"); 3198 int err = -EINVAL;
3185 return; 3199#ifdef HDSP_FW_LOADER
3200 err = hdsp_request_fw_loader(hdsp);
3201#endif
3202 if (err < 0) {
3203 snd_iprintf(buffer,
3204 "No firmware loaded nor cached, "
3205 "please upload firmware.\n");
3206 return;
3207 }
3186 } 3208 }
3187 } 3209 }
3188 3210
@@ -3851,7 +3873,7 @@ static int snd_hdsp_trigger(struct snd_pcm_substream *substream, int cmd)
3851 if (hdsp_check_for_iobox (hdsp)) 3873 if (hdsp_check_for_iobox (hdsp))
3852 return -EIO; 3874 return -EIO;
3853 3875
3854 if (hdsp_check_for_firmware(hdsp, 1)) 3876 if (hdsp_check_for_firmware(hdsp, 0)) /* no auto-loading in trigger */
3855 return -EIO; 3877 return -EIO;
3856 3878
3857 spin_lock(&hdsp->lock); 3879 spin_lock(&hdsp->lock);