aboutsummaryrefslogtreecommitdiffstats
path: root/sound/pci/via82xx_modem.c
diff options
context:
space:
mode:
Diffstat (limited to 'sound/pci/via82xx_modem.c')
-rw-r--r--sound/pci/via82xx_modem.c13
1 files changed, 6 insertions, 7 deletions
diff --git a/sound/pci/via82xx_modem.c b/sound/pci/via82xx_modem.c
index 5896d289f9ac..4a9779cc9733 100644
--- a/sound/pci/via82xx_modem.c
+++ b/sound/pci/via82xx_modem.c
@@ -408,8 +408,7 @@ static void snd_via82xx_codec_wait(ac97_t *ac97)
408 int err; 408 int err;
409 err = snd_via82xx_codec_ready(chip, ac97->num); 409 err = snd_via82xx_codec_ready(chip, ac97->num);
410 /* here we need to wait fairly for long time.. */ 410 /* here we need to wait fairly for long time.. */
411 set_current_state(TASK_UNINTERRUPTIBLE); 411 msleep(500);
412 schedule_timeout(HZ/2);
413} 412}
414 413
415static void snd_via82xx_codec_write(ac97_t *ac97, 414static void snd_via82xx_codec_write(ac97_t *ac97,
@@ -923,7 +922,7 @@ static void __devinit snd_via82xx_proc_init(via82xx_t *chip)
923static int snd_via82xx_chip_init(via82xx_t *chip) 922static int snd_via82xx_chip_init(via82xx_t *chip)
924{ 923{
925 unsigned int val; 924 unsigned int val;
926 int max_count; 925 unsigned long end_time;
927 unsigned char pval; 926 unsigned char pval;
928 927
929 pci_read_config_byte(chip->pci, VIA_MC97_CTRL, &pval); 928 pci_read_config_byte(chip->pci, VIA_MC97_CTRL, &pval);
@@ -962,14 +961,14 @@ static int snd_via82xx_chip_init(via82xx_t *chip)
962 } 961 }
963 962
964 /* wait until codec ready */ 963 /* wait until codec ready */
965 max_count = ((3 * HZ) / 4) + 1; 964 end_time = jiffies + msecs_to_jiffies(750);
966 do { 965 do {
967 pci_read_config_byte(chip->pci, VIA_ACLINK_STAT, &pval); 966 pci_read_config_byte(chip->pci, VIA_ACLINK_STAT, &pval);
968 if (pval & VIA_ACLINK_C00_READY) /* primary codec ready */ 967 if (pval & VIA_ACLINK_C00_READY) /* primary codec ready */
969 break; 968 break;
970 set_current_state(TASK_UNINTERRUPTIBLE); 969 set_current_state(TASK_UNINTERRUPTIBLE);
971 schedule_timeout(1); 970 schedule_timeout(1);
972 } while (--max_count > 0); 971 } while (time_before(jiffies, end_time));
973 972
974 if ((val = snd_via82xx_codec_xread(chip)) & VIA_REG_AC97_BUSY) 973 if ((val = snd_via82xx_codec_xread(chip)) & VIA_REG_AC97_BUSY)
975 snd_printk("AC'97 codec is not ready [0x%x]\n", val); 974 snd_printk("AC'97 codec is not ready [0x%x]\n", val);
@@ -977,7 +976,7 @@ static int snd_via82xx_chip_init(via82xx_t *chip)
977 snd_via82xx_codec_xwrite(chip, VIA_REG_AC97_READ | 976 snd_via82xx_codec_xwrite(chip, VIA_REG_AC97_READ |
978 VIA_REG_AC97_SECONDARY_VALID | 977 VIA_REG_AC97_SECONDARY_VALID |
979 (VIA_REG_AC97_CODEC_ID_SECONDARY << VIA_REG_AC97_CODEC_ID_SHIFT)); 978 (VIA_REG_AC97_CODEC_ID_SECONDARY << VIA_REG_AC97_CODEC_ID_SHIFT));
980 max_count = ((3 * HZ) / 4) + 1; 979 end_time = jiffies + msecs_to_jiffies(750);
981 snd_via82xx_codec_xwrite(chip, VIA_REG_AC97_READ | 980 snd_via82xx_codec_xwrite(chip, VIA_REG_AC97_READ |
982 VIA_REG_AC97_SECONDARY_VALID | 981 VIA_REG_AC97_SECONDARY_VALID |
983 (VIA_REG_AC97_CODEC_ID_SECONDARY << VIA_REG_AC97_CODEC_ID_SHIFT)); 982 (VIA_REG_AC97_CODEC_ID_SECONDARY << VIA_REG_AC97_CODEC_ID_SHIFT));
@@ -988,7 +987,7 @@ static int snd_via82xx_chip_init(via82xx_t *chip)
988 } 987 }
989 set_current_state(TASK_INTERRUPTIBLE); 988 set_current_state(TASK_INTERRUPTIBLE);
990 schedule_timeout(1); 989 schedule_timeout(1);
991 } while (--max_count > 0); 990 } while (time_before(jiffies, end_time));
992 /* This is ok, the most of motherboards have only one codec */ 991 /* This is ok, the most of motherboards have only one codec */
993 992
994 __ac97_ok2: 993 __ac97_ok2: