All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] ALSA: hdsp: check for iobox and upload firmware during ioctl
@ 2008-11-08 13:42 Tim Blechmann
  2008-11-09 11:58 ` Takashi Iwai
  0 siblings, 1 reply; 2+ messages in thread
From: Tim Blechmann @ 2008-11-08 13:42 UTC (permalink / raw)
  To: alsa-devel


[-- Attachment #1.1: Type: text/plain, Size: 2011 bytes --]

currently, the error message when trying to run hdspmixer or hdspconf
if the breakout box is not connected is somehow misleading, since it
asks the user to upload the firmware.

this patch adds a test, whether the breakout box is connected and
tries to upload the firmware in the case, that it is not present, e.g.
because of power failures of the breakout box.

Signed-off-by: Tim Blechmann <tim@klingt.org>
---
 sound/pci/rme9652/hdsp.c |   17 +++++++++++++----
 1 files changed, 13 insertions(+), 4 deletions(-)

diff --git a/sound/pci/rme9652/hdsp.c b/sound/pci/rme9652/hdsp.c
index cf9eb41..5bd0be6 100644
--- a/sound/pci/rme9652/hdsp.c
+++ b/sound/pci/rme9652/hdsp.c
@@ -4548,11 +4548,18 @@ static int snd_hdsp_hwdep_ioctl(struct snd_hwdep *hw, struct file *file, unsigne
 {
 	struct hdsp *hdsp = (struct hdsp *)hw->private_data;	
 	void __user *argp = (void __user *)arg;
+	int err;
 
 	switch (cmd) {
 	case SNDRV_HDSP_IOCTL_GET_PEAK_RMS: {
 		struct hdsp_peak_rms __user *peak_rms = (struct hdsp_peak_rms __user *)arg;
 
+		if ((err = hdsp_check_for_iobox (hdsp)) < 0)
+			return err;
+
+		if ((err = hdsp_check_for_firmware(hdsp, 1)) < 0)
+			return err;
+
 		if (!(hdsp->state & HDSP_FirmwareLoaded)) {
 			snd_printk(KERN_ERR "Hammerfall-DSP: firmware needs to be uploaded to the card.\n");
 			return -EINVAL;
@@ -4572,10 +4579,12 @@ static int snd_hdsp_hwdep_ioctl(struct snd_hwdep *hw, struct file *file, unsigne
 		unsigned long flags;
 		int i;
 		
-		if (!(hdsp->state & HDSP_FirmwareLoaded)) {
-			snd_printk(KERN_ERR "Hammerfall-DSP: Firmware needs to be uploaded to the card.\n");	
-			return -EINVAL;
-		}
+		if ((err = hdsp_check_for_iobox (hdsp)) < 0)
+			return err;
+
+		if ((err = hdsp_check_for_firmware(hdsp, 1)) < 0)
+			return err;
+
 		spin_lock_irqsave(&hdsp->lock, flags);
 		info.pref_sync_ref = (unsigned char)hdsp_pref_sync_ref(hdsp);
 		info.wordclock_sync_check = (unsigned char)hdsp_wc_sync_check(hdsp);
-- 
1.5.6.3

[-- Attachment #1.2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 197 bytes --]

[-- Attachment #2: Type: text/plain, Size: 160 bytes --]

_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] ALSA: hdsp: check for iobox and upload firmware during ioctl
  2008-11-08 13:42 [PATCH] ALSA: hdsp: check for iobox and upload firmware during ioctl Tim Blechmann
@ 2008-11-09 11:58 ` Takashi Iwai
  0 siblings, 0 replies; 2+ messages in thread
From: Takashi Iwai @ 2008-11-09 11:58 UTC (permalink / raw)
  To: Tim Blechmann; +Cc: alsa-devel

At Sat, 08 Nov 2008 14:42:18 +0100,
Tim Blechmann wrote:
> 
> currently, the error message when trying to run hdspmixer or hdspconf
> if the breakout box is not connected is somehow misleading, since it
> asks the user to upload the firmware.
> 
> this patch adds a test, whether the breakout box is connected and
> tries to upload the firmware in the case, that it is not present, e.g.
> because of power failures of the breakout box.
> 
> Signed-off-by: Tim Blechmann <tim@klingt.org>

Thanks, applied both patches (with minor coding-style fixes) now.


Takashi

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2008-11-09 11:58 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-11-08 13:42 [PATCH] ALSA: hdsp: check for iobox and upload firmware during ioctl Tim Blechmann
2008-11-09 11:58 ` Takashi Iwai

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.