diff options
author | Tim Blechmann <tim@klingt.org> | 2009-02-20 13:30:35 -0500 |
---|---|---|
committer | Takashi Iwai <tiwai@suse.de> | 2009-02-23 02:20:01 -0500 |
commit | e588ed8304f76cbb396ee85e657a58990298a675 (patch) | |
tree | 8f87b81c85bd1c1caffa3256dba1f3dbcd81ed95 /sound/pci/rme9652 | |
parent | 66a101dda6b26ee566aa9cadcbea904a41d2b268 (diff) |
ALSA: hdsp - poll for iobox
sleeping for 2 seconds before checking for the iobox is not enough
on some systems.
this patch increases the timeout, but polls the card during that
time. it thus speeds up the module loading when the card has already
been initialized, while being more robust on systems, which require
a higher timeout than the predefined 2 seconds.
Signed-off-by: Tim Blechmann <tim@klingt.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/pci/rme9652')
-rw-r--r-- | sound/pci/rme9652/hdsp.c | 29 |
1 files changed, 25 insertions, 4 deletions
diff --git a/sound/pci/rme9652/hdsp.c b/sound/pci/rme9652/hdsp.c index bacfdd12619b..12c6b4305ec1 100644 --- a/sound/pci/rme9652/hdsp.c +++ b/sound/pci/rme9652/hdsp.c | |||
@@ -653,7 +653,6 @@ static unsigned int hdsp_read(struct hdsp *hdsp, int reg) | |||
653 | 653 | ||
654 | static int hdsp_check_for_iobox (struct hdsp *hdsp) | 654 | static int hdsp_check_for_iobox (struct hdsp *hdsp) |
655 | { | 655 | { |
656 | |||
657 | if (hdsp->io_type == H9652 || hdsp->io_type == H9632) return 0; | 656 | if (hdsp->io_type == H9652 || hdsp->io_type == H9632) return 0; |
658 | if (hdsp_read (hdsp, HDSP_statusRegister) & HDSP_ConfigError) { | 657 | if (hdsp_read (hdsp, HDSP_statusRegister) & HDSP_ConfigError) { |
659 | snd_printk ("Hammerfall-DSP: no Digiface or Multiface connected!\n"); | 658 | snd_printk ("Hammerfall-DSP: no Digiface or Multiface connected!\n"); |
@@ -661,7 +660,29 @@ static int hdsp_check_for_iobox (struct hdsp *hdsp) | |||
661 | return -EIO; | 660 | return -EIO; |
662 | } | 661 | } |
663 | return 0; | 662 | return 0; |
663 | } | ||
664 | 664 | ||
665 | static int hdsp_wait_for_iobox(struct hdsp *hdsp, unsigned int loops, | ||
666 | unsigned int delay) | ||
667 | { | ||
668 | unsigned int i; | ||
669 | |||
670 | if (hdsp->io_type == H9652 || hdsp->io_type == H9632) | ||
671 | return 0; | ||
672 | |||
673 | for (i = 0; i != loops; ++i) { | ||
674 | if (hdsp_read(hdsp, HDSP_statusRegister) & HDSP_ConfigError) | ||
675 | msleep(delay); | ||
676 | else { | ||
677 | snd_printd("Hammerfall-DSP: iobox found after %ums!\n", | ||
678 | i * delay); | ||
679 | return 0; | ||
680 | } | ||
681 | } | ||
682 | |||
683 | snd_printk("Hammerfall-DSP: no Digiface or Multiface connected!\n"); | ||
684 | hdsp->state &= ~HDSP_FirmwareLoaded; | ||
685 | return -EIO; | ||
665 | } | 686 | } |
666 | 687 | ||
667 | static int snd_hdsp_load_firmware_from_cache(struct hdsp *hdsp) { | 688 | static int snd_hdsp_load_firmware_from_cache(struct hdsp *hdsp) { |
@@ -5046,10 +5067,10 @@ static int __devinit snd_hdsp_create(struct snd_card *card, | |||
5046 | return err; | 5067 | return err; |
5047 | 5068 | ||
5048 | if (!is_9652 && !is_9632) { | 5069 | if (!is_9652 && !is_9632) { |
5049 | /* we wait 2 seconds to let freshly inserted cardbus cards do their hardware init */ | 5070 | /* we wait a maximum of 10 seconds to let freshly |
5050 | ssleep(2); | 5071 | * inserted cardbus cards do their hardware init */ |
5072 | err = hdsp_wait_for_iobox(hdsp, 1000, 10); | ||
5051 | 5073 | ||
5052 | err = hdsp_check_for_iobox(hdsp); | ||
5053 | if (err < 0) | 5074 | if (err < 0) |
5054 | return err; | 5075 | return err; |
5055 | 5076 | ||