diff options
Diffstat (limited to 'sound/pci/hda/hda_intel.c')
-rw-r--r-- | sound/pci/hda/hda_intel.c | 201 |
1 files changed, 131 insertions, 70 deletions
diff --git a/sound/pci/hda/hda_intel.c b/sound/pci/hda/hda_intel.c index f9603443f086..21e99cfa8c49 100644 --- a/sound/pci/hda/hda_intel.c +++ b/sound/pci/hda/hda_intel.c | |||
@@ -312,6 +312,8 @@ struct azx_dev { | |||
312 | unsigned int period_bytes; /* size of the period in bytes */ | 312 | unsigned int period_bytes; /* size of the period in bytes */ |
313 | unsigned int frags; /* number for period in the play buffer */ | 313 | unsigned int frags; /* number for period in the play buffer */ |
314 | unsigned int fifo_size; /* FIFO size */ | 314 | unsigned int fifo_size; /* FIFO size */ |
315 | unsigned long start_jiffies; /* start + minimum jiffies */ | ||
316 | unsigned long min_jiffies; /* minimum jiffies before position is valid */ | ||
315 | 317 | ||
316 | void __iomem *sd_addr; /* stream descriptor pointer */ | 318 | void __iomem *sd_addr; /* stream descriptor pointer */ |
317 | 319 | ||
@@ -330,7 +332,7 @@ struct azx_dev { | |||
330 | unsigned int opened :1; | 332 | unsigned int opened :1; |
331 | unsigned int running :1; | 333 | unsigned int running :1; |
332 | unsigned int irq_pending :1; | 334 | unsigned int irq_pending :1; |
333 | unsigned int irq_ignore :1; | 335 | unsigned int start_flag: 1; /* stream full start flag */ |
334 | /* | 336 | /* |
335 | * For VIA: | 337 | * For VIA: |
336 | * A flag to ensure DMA position is 0 | 338 | * A flag to ensure DMA position is 0 |
@@ -381,6 +383,7 @@ struct azx { | |||
381 | 383 | ||
382 | /* HD codec */ | 384 | /* HD codec */ |
383 | unsigned short codec_mask; | 385 | unsigned short codec_mask; |
386 | int codec_probe_mask; /* copied from probe_mask option */ | ||
384 | struct hda_bus *bus; | 387 | struct hda_bus *bus; |
385 | 388 | ||
386 | /* CORB/RIRB */ | 389 | /* CORB/RIRB */ |
@@ -858,13 +861,18 @@ static void azx_stream_start(struct azx *chip, struct azx_dev *azx_dev) | |||
858 | SD_CTL_DMA_START | SD_INT_MASK); | 861 | SD_CTL_DMA_START | SD_INT_MASK); |
859 | } | 862 | } |
860 | 863 | ||
861 | /* stop a stream */ | 864 | /* stop DMA */ |
862 | static void azx_stream_stop(struct azx *chip, struct azx_dev *azx_dev) | 865 | static void azx_stream_clear(struct azx *chip, struct azx_dev *azx_dev) |
863 | { | 866 | { |
864 | /* stop DMA */ | ||
865 | azx_sd_writeb(azx_dev, SD_CTL, azx_sd_readb(azx_dev, SD_CTL) & | 867 | azx_sd_writeb(azx_dev, SD_CTL, azx_sd_readb(azx_dev, SD_CTL) & |
866 | ~(SD_CTL_DMA_START | SD_INT_MASK)); | 868 | ~(SD_CTL_DMA_START | SD_INT_MASK)); |
867 | azx_sd_writeb(azx_dev, SD_STS, SD_INT_MASK); /* to be sure */ | 869 | azx_sd_writeb(azx_dev, SD_STS, SD_INT_MASK); /* to be sure */ |
870 | } | ||
871 | |||
872 | /* stop a stream */ | ||
873 | static void azx_stream_stop(struct azx *chip, struct azx_dev *azx_dev) | ||
874 | { | ||
875 | azx_stream_clear(chip, azx_dev); | ||
868 | /* disable SIE */ | 876 | /* disable SIE */ |
869 | azx_writeb(chip, INTCTL, | 877 | azx_writeb(chip, INTCTL, |
870 | azx_readb(chip, INTCTL) & ~(1 << azx_dev->index)); | 878 | azx_readb(chip, INTCTL) & ~(1 << azx_dev->index)); |
@@ -969,7 +977,7 @@ static irqreturn_t azx_interrupt(int irq, void *dev_id) | |||
969 | struct azx *chip = dev_id; | 977 | struct azx *chip = dev_id; |
970 | struct azx_dev *azx_dev; | 978 | struct azx_dev *azx_dev; |
971 | u32 status; | 979 | u32 status; |
972 | int i; | 980 | int i, ok; |
973 | 981 | ||
974 | spin_lock(&chip->reg_lock); | 982 | spin_lock(&chip->reg_lock); |
975 | 983 | ||
@@ -985,18 +993,14 @@ static irqreturn_t azx_interrupt(int irq, void *dev_id) | |||
985 | azx_sd_writeb(azx_dev, SD_STS, SD_INT_MASK); | 993 | azx_sd_writeb(azx_dev, SD_STS, SD_INT_MASK); |
986 | if (!azx_dev->substream || !azx_dev->running) | 994 | if (!azx_dev->substream || !azx_dev->running) |
987 | continue; | 995 | continue; |
988 | /* ignore the first dummy IRQ (due to pos_adj) */ | ||
989 | if (azx_dev->irq_ignore) { | ||
990 | azx_dev->irq_ignore = 0; | ||
991 | continue; | ||
992 | } | ||
993 | /* check whether this IRQ is really acceptable */ | 996 | /* check whether this IRQ is really acceptable */ |
994 | if (azx_position_ok(chip, azx_dev)) { | 997 | ok = azx_position_ok(chip, azx_dev); |
998 | if (ok == 1) { | ||
995 | azx_dev->irq_pending = 0; | 999 | azx_dev->irq_pending = 0; |
996 | spin_unlock(&chip->reg_lock); | 1000 | spin_unlock(&chip->reg_lock); |
997 | snd_pcm_period_elapsed(azx_dev->substream); | 1001 | snd_pcm_period_elapsed(azx_dev->substream); |
998 | spin_lock(&chip->reg_lock); | 1002 | spin_lock(&chip->reg_lock); |
999 | } else if (chip->bus && chip->bus->workq) { | 1003 | } else if (ok == 0 && chip->bus && chip->bus->workq) { |
1000 | /* bogus IRQ, process it later */ | 1004 | /* bogus IRQ, process it later */ |
1001 | azx_dev->irq_pending = 1; | 1005 | azx_dev->irq_pending = 1; |
1002 | queue_work(chip->bus->workq, | 1006 | queue_work(chip->bus->workq, |
@@ -1075,15 +1079,13 @@ static int azx_setup_periods(struct azx *chip, | |||
1075 | azx_sd_writel(azx_dev, SD_BDLPL, 0); | 1079 | azx_sd_writel(azx_dev, SD_BDLPL, 0); |
1076 | azx_sd_writel(azx_dev, SD_BDLPU, 0); | 1080 | azx_sd_writel(azx_dev, SD_BDLPU, 0); |
1077 | 1081 | ||
1078 | period_bytes = snd_pcm_lib_period_bytes(substream); | 1082 | period_bytes = azx_dev->period_bytes; |
1079 | azx_dev->period_bytes = period_bytes; | ||
1080 | periods = azx_dev->bufsize / period_bytes; | 1083 | periods = azx_dev->bufsize / period_bytes; |
1081 | 1084 | ||
1082 | /* program the initial BDL entries */ | 1085 | /* program the initial BDL entries */ |
1083 | bdl = (u32 *)azx_dev->bdl.area; | 1086 | bdl = (u32 *)azx_dev->bdl.area; |
1084 | ofs = 0; | 1087 | ofs = 0; |
1085 | azx_dev->frags = 0; | 1088 | azx_dev->frags = 0; |
1086 | azx_dev->irq_ignore = 0; | ||
1087 | pos_adj = bdl_pos_adj[chip->dev_index]; | 1089 | pos_adj = bdl_pos_adj[chip->dev_index]; |
1088 | if (pos_adj > 0) { | 1090 | if (pos_adj > 0) { |
1089 | struct snd_pcm_runtime *runtime = substream->runtime; | 1091 | struct snd_pcm_runtime *runtime = substream->runtime; |
@@ -1104,7 +1106,6 @@ static int azx_setup_periods(struct azx *chip, | |||
1104 | &bdl, ofs, pos_adj, 1); | 1106 | &bdl, ofs, pos_adj, 1); |
1105 | if (ofs < 0) | 1107 | if (ofs < 0) |
1106 | goto error; | 1108 | goto error; |
1107 | azx_dev->irq_ignore = 1; | ||
1108 | } | 1109 | } |
1109 | } else | 1110 | } else |
1110 | pos_adj = 0; | 1111 | pos_adj = 0; |
@@ -1123,24 +1124,17 @@ static int azx_setup_periods(struct azx *chip, | |||
1123 | error: | 1124 | error: |
1124 | snd_printk(KERN_ERR "Too many BDL entries: buffer=%d, period=%d\n", | 1125 | snd_printk(KERN_ERR "Too many BDL entries: buffer=%d, period=%d\n", |
1125 | azx_dev->bufsize, period_bytes); | 1126 | azx_dev->bufsize, period_bytes); |
1126 | /* reset */ | ||
1127 | azx_sd_writel(azx_dev, SD_BDLPL, 0); | ||
1128 | azx_sd_writel(azx_dev, SD_BDLPU, 0); | ||
1129 | return -EINVAL; | 1127 | return -EINVAL; |
1130 | } | 1128 | } |
1131 | 1129 | ||
1132 | /* | 1130 | /* reset stream */ |
1133 | * set up the SD for streaming | 1131 | static void azx_stream_reset(struct azx *chip, struct azx_dev *azx_dev) |
1134 | */ | ||
1135 | static int azx_setup_controller(struct azx *chip, struct azx_dev *azx_dev) | ||
1136 | { | 1132 | { |
1137 | unsigned char val; | 1133 | unsigned char val; |
1138 | int timeout; | 1134 | int timeout; |
1139 | 1135 | ||
1140 | /* make sure the run bit is zero for SD */ | 1136 | azx_stream_clear(chip, azx_dev); |
1141 | azx_sd_writeb(azx_dev, SD_CTL, azx_sd_readb(azx_dev, SD_CTL) & | 1137 | |
1142 | ~SD_CTL_DMA_START); | ||
1143 | /* reset stream */ | ||
1144 | azx_sd_writeb(azx_dev, SD_CTL, azx_sd_readb(azx_dev, SD_CTL) | | 1138 | azx_sd_writeb(azx_dev, SD_CTL, azx_sd_readb(azx_dev, SD_CTL) | |
1145 | SD_CTL_STREAM_RESET); | 1139 | SD_CTL_STREAM_RESET); |
1146 | udelay(3); | 1140 | udelay(3); |
@@ -1158,6 +1152,17 @@ static int azx_setup_controller(struct azx *chip, struct azx_dev *azx_dev) | |||
1158 | --timeout) | 1152 | --timeout) |
1159 | ; | 1153 | ; |
1160 | 1154 | ||
1155 | /* reset first position - may not be synced with hw at this time */ | ||
1156 | *azx_dev->posbuf = 0; | ||
1157 | } | ||
1158 | |||
1159 | /* | ||
1160 | * set up the SD for streaming | ||
1161 | */ | ||
1162 | static int azx_setup_controller(struct azx *chip, struct azx_dev *azx_dev) | ||
1163 | { | ||
1164 | /* make sure the run bit is zero for SD */ | ||
1165 | azx_stream_clear(chip, azx_dev); | ||
1161 | /* program the stream_tag */ | 1166 | /* program the stream_tag */ |
1162 | azx_sd_writel(azx_dev, SD_CTL, | 1167 | azx_sd_writel(azx_dev, SD_CTL, |
1163 | (azx_sd_readl(azx_dev, SD_CTL) & ~SD_CTL_STREAM_TAG_MASK)| | 1168 | (azx_sd_readl(azx_dev, SD_CTL) & ~SD_CTL_STREAM_TAG_MASK)| |
@@ -1228,7 +1233,6 @@ static unsigned int azx_max_codecs[AZX_NUM_DRIVERS] __devinitdata = { | |||
1228 | }; | 1233 | }; |
1229 | 1234 | ||
1230 | static int __devinit azx_codec_create(struct azx *chip, const char *model, | 1235 | static int __devinit azx_codec_create(struct azx *chip, const char *model, |
1231 | unsigned int codec_probe_mask, | ||
1232 | int no_init) | 1236 | int no_init) |
1233 | { | 1237 | { |
1234 | struct hda_bus_template bus_temp; | 1238 | struct hda_bus_template bus_temp; |
@@ -1261,7 +1265,7 @@ static int __devinit azx_codec_create(struct azx *chip, const char *model, | |||
1261 | 1265 | ||
1262 | /* First try to probe all given codec slots */ | 1266 | /* First try to probe all given codec slots */ |
1263 | for (c = 0; c < max_slots; c++) { | 1267 | for (c = 0; c < max_slots; c++) { |
1264 | if ((chip->codec_mask & (1 << c)) & codec_probe_mask) { | 1268 | if ((chip->codec_mask & (1 << c)) & chip->codec_probe_mask) { |
1265 | if (probe_codec(chip, c) < 0) { | 1269 | if (probe_codec(chip, c) < 0) { |
1266 | /* Some BIOSen give you wrong codec addresses | 1270 | /* Some BIOSen give you wrong codec addresses |
1267 | * that don't exist | 1271 | * that don't exist |
@@ -1285,7 +1289,7 @@ static int __devinit azx_codec_create(struct azx *chip, const char *model, | |||
1285 | 1289 | ||
1286 | /* Then create codec instances */ | 1290 | /* Then create codec instances */ |
1287 | for (c = 0; c < max_slots; c++) { | 1291 | for (c = 0; c < max_slots; c++) { |
1288 | if ((chip->codec_mask & (1 << c)) & codec_probe_mask) { | 1292 | if ((chip->codec_mask & (1 << c)) & chip->codec_probe_mask) { |
1289 | struct hda_codec *codec; | 1293 | struct hda_codec *codec; |
1290 | err = snd_hda_codec_new(chip->bus, c, !no_init, &codec); | 1294 | err = snd_hda_codec_new(chip->bus, c, !no_init, &codec); |
1291 | if (err < 0) | 1295 | if (err < 0) |
@@ -1403,6 +1407,7 @@ static int azx_pcm_open(struct snd_pcm_substream *substream) | |||
1403 | runtime->private_data = azx_dev; | 1407 | runtime->private_data = azx_dev; |
1404 | snd_pcm_set_sync(substream); | 1408 | snd_pcm_set_sync(substream); |
1405 | mutex_unlock(&chip->open_mutex); | 1409 | mutex_unlock(&chip->open_mutex); |
1410 | |||
1406 | return 0; | 1411 | return 0; |
1407 | } | 1412 | } |
1408 | 1413 | ||
@@ -1429,6 +1434,11 @@ static int azx_pcm_close(struct snd_pcm_substream *substream) | |||
1429 | static int azx_pcm_hw_params(struct snd_pcm_substream *substream, | 1434 | static int azx_pcm_hw_params(struct snd_pcm_substream *substream, |
1430 | struct snd_pcm_hw_params *hw_params) | 1435 | struct snd_pcm_hw_params *hw_params) |
1431 | { | 1436 | { |
1437 | struct azx_dev *azx_dev = get_azx_dev(substream); | ||
1438 | |||
1439 | azx_dev->bufsize = 0; | ||
1440 | azx_dev->period_bytes = 0; | ||
1441 | azx_dev->format_val = 0; | ||
1432 | return snd_pcm_lib_malloc_pages(substream, | 1442 | return snd_pcm_lib_malloc_pages(substream, |
1433 | params_buffer_bytes(hw_params)); | 1443 | params_buffer_bytes(hw_params)); |
1434 | } | 1444 | } |
@@ -1443,6 +1453,9 @@ static int azx_pcm_hw_free(struct snd_pcm_substream *substream) | |||
1443 | azx_sd_writel(azx_dev, SD_BDLPL, 0); | 1453 | azx_sd_writel(azx_dev, SD_BDLPL, 0); |
1444 | azx_sd_writel(azx_dev, SD_BDLPU, 0); | 1454 | azx_sd_writel(azx_dev, SD_BDLPU, 0); |
1445 | azx_sd_writel(azx_dev, SD_CTL, 0); | 1455 | azx_sd_writel(azx_dev, SD_CTL, 0); |
1456 | azx_dev->bufsize = 0; | ||
1457 | azx_dev->period_bytes = 0; | ||
1458 | azx_dev->format_val = 0; | ||
1446 | 1459 | ||
1447 | hinfo->ops.cleanup(hinfo, apcm->codec, substream); | 1460 | hinfo->ops.cleanup(hinfo, apcm->codec, substream); |
1448 | 1461 | ||
@@ -1456,23 +1469,40 @@ static int azx_pcm_prepare(struct snd_pcm_substream *substream) | |||
1456 | struct azx_dev *azx_dev = get_azx_dev(substream); | 1469 | struct azx_dev *azx_dev = get_azx_dev(substream); |
1457 | struct hda_pcm_stream *hinfo = apcm->hinfo[substream->stream]; | 1470 | struct hda_pcm_stream *hinfo = apcm->hinfo[substream->stream]; |
1458 | struct snd_pcm_runtime *runtime = substream->runtime; | 1471 | struct snd_pcm_runtime *runtime = substream->runtime; |
1472 | unsigned int bufsize, period_bytes, format_val; | ||
1473 | int err; | ||
1459 | 1474 | ||
1460 | azx_dev->bufsize = snd_pcm_lib_buffer_bytes(substream); | 1475 | azx_stream_reset(chip, azx_dev); |
1461 | azx_dev->format_val = snd_hda_calc_stream_format(runtime->rate, | 1476 | format_val = snd_hda_calc_stream_format(runtime->rate, |
1462 | runtime->channels, | 1477 | runtime->channels, |
1463 | runtime->format, | 1478 | runtime->format, |
1464 | hinfo->maxbps); | 1479 | hinfo->maxbps); |
1465 | if (!azx_dev->format_val) { | 1480 | if (!format_val) { |
1466 | snd_printk(KERN_ERR SFX | 1481 | snd_printk(KERN_ERR SFX |
1467 | "invalid format_val, rate=%d, ch=%d, format=%d\n", | 1482 | "invalid format_val, rate=%d, ch=%d, format=%d\n", |
1468 | runtime->rate, runtime->channels, runtime->format); | 1483 | runtime->rate, runtime->channels, runtime->format); |
1469 | return -EINVAL; | 1484 | return -EINVAL; |
1470 | } | 1485 | } |
1471 | 1486 | ||
1487 | bufsize = snd_pcm_lib_buffer_bytes(substream); | ||
1488 | period_bytes = snd_pcm_lib_period_bytes(substream); | ||
1489 | |||
1472 | snd_printdd("azx_pcm_prepare: bufsize=0x%x, format=0x%x\n", | 1490 | snd_printdd("azx_pcm_prepare: bufsize=0x%x, format=0x%x\n", |
1473 | azx_dev->bufsize, azx_dev->format_val); | 1491 | bufsize, format_val); |
1474 | if (azx_setup_periods(chip, substream, azx_dev) < 0) | 1492 | |
1475 | return -EINVAL; | 1493 | if (bufsize != azx_dev->bufsize || |
1494 | period_bytes != azx_dev->period_bytes || | ||
1495 | format_val != azx_dev->format_val) { | ||
1496 | azx_dev->bufsize = bufsize; | ||
1497 | azx_dev->period_bytes = period_bytes; | ||
1498 | azx_dev->format_val = format_val; | ||
1499 | err = azx_setup_periods(chip, substream, azx_dev); | ||
1500 | if (err < 0) | ||
1501 | return err; | ||
1502 | } | ||
1503 | |||
1504 | azx_dev->min_jiffies = (runtime->period_size * HZ) / | ||
1505 | (runtime->rate * 2); | ||
1476 | azx_setup_controller(chip, azx_dev); | 1506 | azx_setup_controller(chip, azx_dev); |
1477 | if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) | 1507 | if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) |
1478 | azx_dev->fifo_size = azx_sd_readw(azx_dev, SD_FIFOSIZE) + 1; | 1508 | azx_dev->fifo_size = azx_sd_readw(azx_dev, SD_FIFOSIZE) + 1; |
@@ -1489,13 +1519,14 @@ static int azx_pcm_trigger(struct snd_pcm_substream *substream, int cmd) | |||
1489 | struct azx *chip = apcm->chip; | 1519 | struct azx *chip = apcm->chip; |
1490 | struct azx_dev *azx_dev; | 1520 | struct azx_dev *azx_dev; |
1491 | struct snd_pcm_substream *s; | 1521 | struct snd_pcm_substream *s; |
1492 | int start, nsync = 0, sbits = 0; | 1522 | int rstart = 0, start, nsync = 0, sbits = 0; |
1493 | int nwait, timeout; | 1523 | int nwait, timeout; |
1494 | 1524 | ||
1495 | switch (cmd) { | 1525 | switch (cmd) { |
1526 | case SNDRV_PCM_TRIGGER_START: | ||
1527 | rstart = 1; | ||
1496 | case SNDRV_PCM_TRIGGER_PAUSE_RELEASE: | 1528 | case SNDRV_PCM_TRIGGER_PAUSE_RELEASE: |
1497 | case SNDRV_PCM_TRIGGER_RESUME: | 1529 | case SNDRV_PCM_TRIGGER_RESUME: |
1498 | case SNDRV_PCM_TRIGGER_START: | ||
1499 | start = 1; | 1530 | start = 1; |
1500 | break; | 1531 | break; |
1501 | case SNDRV_PCM_TRIGGER_PAUSE_PUSH: | 1532 | case SNDRV_PCM_TRIGGER_PAUSE_PUSH: |
@@ -1525,6 +1556,10 @@ static int azx_pcm_trigger(struct snd_pcm_substream *substream, int cmd) | |||
1525 | if (s->pcm->card != substream->pcm->card) | 1556 | if (s->pcm->card != substream->pcm->card) |
1526 | continue; | 1557 | continue; |
1527 | azx_dev = get_azx_dev(s); | 1558 | azx_dev = get_azx_dev(s); |
1559 | if (rstart) { | ||
1560 | azx_dev->start_flag = 1; | ||
1561 | azx_dev->start_jiffies = jiffies + azx_dev->min_jiffies; | ||
1562 | } | ||
1528 | if (start) | 1563 | if (start) |
1529 | azx_stream_start(chip, azx_dev); | 1564 | azx_stream_start(chip, azx_dev); |
1530 | else | 1565 | else |
@@ -1674,6 +1709,11 @@ static int azx_position_ok(struct azx *chip, struct azx_dev *azx_dev) | |||
1674 | { | 1709 | { |
1675 | unsigned int pos; | 1710 | unsigned int pos; |
1676 | 1711 | ||
1712 | if (azx_dev->start_flag && | ||
1713 | time_before_eq(jiffies, azx_dev->start_jiffies)) | ||
1714 | return -1; /* bogus (too early) interrupt */ | ||
1715 | azx_dev->start_flag = 0; | ||
1716 | |||
1677 | pos = azx_get_position(chip, azx_dev); | 1717 | pos = azx_get_position(chip, azx_dev); |
1678 | if (chip->position_fix == POS_FIX_AUTO) { | 1718 | if (chip->position_fix == POS_FIX_AUTO) { |
1679 | if (!pos) { | 1719 | if (!pos) { |
@@ -1947,16 +1987,13 @@ static int azx_suspend(struct pci_dev *pci, pm_message_t state) | |||
1947 | return 0; | 1987 | return 0; |
1948 | } | 1988 | } |
1949 | 1989 | ||
1950 | static int azx_resume_early(struct pci_dev *pci) | ||
1951 | { | ||
1952 | return pci_restore_state(pci); | ||
1953 | } | ||
1954 | |||
1955 | static int azx_resume(struct pci_dev *pci) | 1990 | static int azx_resume(struct pci_dev *pci) |
1956 | { | 1991 | { |
1957 | struct snd_card *card = pci_get_drvdata(pci); | 1992 | struct snd_card *card = pci_get_drvdata(pci); |
1958 | struct azx *chip = card->private_data; | 1993 | struct azx *chip = card->private_data; |
1959 | 1994 | ||
1995 | pci_set_power_state(pci, PCI_D0); | ||
1996 | pci_restore_state(pci); | ||
1960 | if (pci_enable_device(pci) < 0) { | 1997 | if (pci_enable_device(pci) < 0) { |
1961 | printk(KERN_ERR "hda-intel: pci_enable_device failed, " | 1998 | printk(KERN_ERR "hda-intel: pci_enable_device failed, " |
1962 | "disabling device\n"); | 1999 | "disabling device\n"); |
@@ -2062,26 +2099,31 @@ static int __devinit check_position_fix(struct azx *chip, int fix) | |||
2062 | { | 2099 | { |
2063 | const struct snd_pci_quirk *q; | 2100 | const struct snd_pci_quirk *q; |
2064 | 2101 | ||
2065 | /* Check VIA HD Audio Controller exist */ | 2102 | switch (fix) { |
2066 | if (chip->pci->vendor == PCI_VENDOR_ID_VIA && | 2103 | case POS_FIX_LPIB: |
2067 | chip->pci->device == VIA_HDAC_DEVICE_ID) { | 2104 | case POS_FIX_POSBUF: |
2105 | return fix; | ||
2106 | } | ||
2107 | |||
2108 | /* Check VIA/ATI HD Audio Controller exist */ | ||
2109 | switch (chip->driver_type) { | ||
2110 | case AZX_DRIVER_VIA: | ||
2111 | case AZX_DRIVER_ATI: | ||
2068 | chip->via_dmapos_patch = 1; | 2112 | chip->via_dmapos_patch = 1; |
2069 | /* Use link position directly, avoid any transfer problem. */ | 2113 | /* Use link position directly, avoid any transfer problem. */ |
2070 | return POS_FIX_LPIB; | 2114 | return POS_FIX_LPIB; |
2071 | } | 2115 | } |
2072 | chip->via_dmapos_patch = 0; | 2116 | chip->via_dmapos_patch = 0; |
2073 | 2117 | ||
2074 | if (fix == POS_FIX_AUTO) { | 2118 | q = snd_pci_quirk_lookup(chip->pci, position_fix_list); |
2075 | q = snd_pci_quirk_lookup(chip->pci, position_fix_list); | 2119 | if (q) { |
2076 | if (q) { | 2120 | printk(KERN_INFO |
2077 | printk(KERN_INFO | 2121 | "hda_intel: position_fix set to %d " |
2078 | "hda_intel: position_fix set to %d " | 2122 | "for device %04x:%04x\n", |
2079 | "for device %04x:%04x\n", | 2123 | q->value, q->subvendor, q->subdevice); |
2080 | q->value, q->subvendor, q->subdevice); | 2124 | return q->value; |
2081 | return q->value; | ||
2082 | } | ||
2083 | } | 2125 | } |
2084 | return fix; | 2126 | return POS_FIX_AUTO; |
2085 | } | 2127 | } |
2086 | 2128 | ||
2087 | /* | 2129 | /* |
@@ -2098,23 +2140,36 @@ static struct snd_pci_quirk probe_mask_list[] __devinitdata = { | |||
2098 | SND_PCI_QUIRK(0x1028, 0x20ac, "Dell Studio Desktop", 0x01), | 2140 | SND_PCI_QUIRK(0x1028, 0x20ac, "Dell Studio Desktop", 0x01), |
2099 | /* including bogus ALC268 in slot#2 that conflicts with ALC888 */ | 2141 | /* including bogus ALC268 in slot#2 that conflicts with ALC888 */ |
2100 | SND_PCI_QUIRK(0x17c0, 0x4085, "Medion MD96630", 0x01), | 2142 | SND_PCI_QUIRK(0x17c0, 0x4085, "Medion MD96630", 0x01), |
2143 | /* forced codec slots */ | ||
2144 | SND_PCI_QUIRK(0x1046, 0x1262, "ASUS W5F", 0x103), | ||
2101 | {} | 2145 | {} |
2102 | }; | 2146 | }; |
2103 | 2147 | ||
2148 | #define AZX_FORCE_CODEC_MASK 0x100 | ||
2149 | |||
2104 | static void __devinit check_probe_mask(struct azx *chip, int dev) | 2150 | static void __devinit check_probe_mask(struct azx *chip, int dev) |
2105 | { | 2151 | { |
2106 | const struct snd_pci_quirk *q; | 2152 | const struct snd_pci_quirk *q; |
2107 | 2153 | ||
2108 | if (probe_mask[dev] == -1) { | 2154 | chip->codec_probe_mask = probe_mask[dev]; |
2155 | if (chip->codec_probe_mask == -1) { | ||
2109 | q = snd_pci_quirk_lookup(chip->pci, probe_mask_list); | 2156 | q = snd_pci_quirk_lookup(chip->pci, probe_mask_list); |
2110 | if (q) { | 2157 | if (q) { |
2111 | printk(KERN_INFO | 2158 | printk(KERN_INFO |
2112 | "hda_intel: probe_mask set to 0x%x " | 2159 | "hda_intel: probe_mask set to 0x%x " |
2113 | "for device %04x:%04x\n", | 2160 | "for device %04x:%04x\n", |
2114 | q->value, q->subvendor, q->subdevice); | 2161 | q->value, q->subvendor, q->subdevice); |
2115 | probe_mask[dev] = q->value; | 2162 | chip->codec_probe_mask = q->value; |
2116 | } | 2163 | } |
2117 | } | 2164 | } |
2165 | |||
2166 | /* check forced option */ | ||
2167 | if (chip->codec_probe_mask != -1 && | ||
2168 | (chip->codec_probe_mask & AZX_FORCE_CODEC_MASK)) { | ||
2169 | chip->codec_mask = chip->codec_probe_mask & 0xff; | ||
2170 | printk(KERN_INFO "hda_intel: codec_mask forced to 0x%x\n", | ||
2171 | chip->codec_mask); | ||
2172 | } | ||
2118 | } | 2173 | } |
2119 | 2174 | ||
2120 | 2175 | ||
@@ -2211,9 +2266,17 @@ static int __devinit azx_create(struct snd_card *card, struct pci_dev *pci, | |||
2211 | gcap = azx_readw(chip, GCAP); | 2266 | gcap = azx_readw(chip, GCAP); |
2212 | snd_printdd("chipset global capabilities = 0x%x\n", gcap); | 2267 | snd_printdd("chipset global capabilities = 0x%x\n", gcap); |
2213 | 2268 | ||
2269 | /* ATI chips seems buggy about 64bit DMA addresses */ | ||
2270 | if (chip->driver_type == AZX_DRIVER_ATI) | ||
2271 | gcap &= ~0x01; | ||
2272 | |||
2214 | /* allow 64bit DMA address if supported by H/W */ | 2273 | /* allow 64bit DMA address if supported by H/W */ |
2215 | if ((gcap & 0x01) && !pci_set_dma_mask(pci, DMA_64BIT_MASK)) | 2274 | if ((gcap & 0x01) && !pci_set_dma_mask(pci, DMA_BIT_MASK(64))) |
2216 | pci_set_consistent_dma_mask(pci, DMA_64BIT_MASK); | 2275 | pci_set_consistent_dma_mask(pci, DMA_BIT_MASK(64)); |
2276 | else { | ||
2277 | pci_set_dma_mask(pci, DMA_BIT_MASK(32)); | ||
2278 | pci_set_consistent_dma_mask(pci, DMA_BIT_MASK(32)); | ||
2279 | } | ||
2217 | 2280 | ||
2218 | /* read number of streams from GCAP register instead of using | 2281 | /* read number of streams from GCAP register instead of using |
2219 | * hardcoded value | 2282 | * hardcoded value |
@@ -2347,8 +2410,7 @@ static int __devinit azx_probe(struct pci_dev *pci, | |||
2347 | card->private_data = chip; | 2410 | card->private_data = chip; |
2348 | 2411 | ||
2349 | /* create codec instances */ | 2412 | /* create codec instances */ |
2350 | err = azx_codec_create(chip, model[dev], probe_mask[dev], | 2413 | err = azx_codec_create(chip, model[dev], probe_only[dev]); |
2351 | probe_only[dev]); | ||
2352 | if (err < 0) | 2414 | if (err < 0) |
2353 | goto out_free; | 2415 | goto out_free; |
2354 | 2416 | ||
@@ -2445,10 +2507,10 @@ static struct pci_device_id azx_ids[] = { | |||
2445 | { PCI_DEVICE(0x10de, 0x0ac1), .driver_data = AZX_DRIVER_NVIDIA }, | 2507 | { PCI_DEVICE(0x10de, 0x0ac1), .driver_data = AZX_DRIVER_NVIDIA }, |
2446 | { PCI_DEVICE(0x10de, 0x0ac2), .driver_data = AZX_DRIVER_NVIDIA }, | 2508 | { PCI_DEVICE(0x10de, 0x0ac2), .driver_data = AZX_DRIVER_NVIDIA }, |
2447 | { PCI_DEVICE(0x10de, 0x0ac3), .driver_data = AZX_DRIVER_NVIDIA }, | 2509 | { PCI_DEVICE(0x10de, 0x0ac3), .driver_data = AZX_DRIVER_NVIDIA }, |
2448 | { PCI_DEVICE(0x10de, 0x0bd4), .driver_data = AZX_DRIVER_NVIDIA }, | 2510 | { PCI_DEVICE(0x10de, 0x0d94), .driver_data = AZX_DRIVER_NVIDIA }, |
2449 | { PCI_DEVICE(0x10de, 0x0bd5), .driver_data = AZX_DRIVER_NVIDIA }, | 2511 | { PCI_DEVICE(0x10de, 0x0d95), .driver_data = AZX_DRIVER_NVIDIA }, |
2450 | { PCI_DEVICE(0x10de, 0x0bd6), .driver_data = AZX_DRIVER_NVIDIA }, | 2512 | { PCI_DEVICE(0x10de, 0x0d96), .driver_data = AZX_DRIVER_NVIDIA }, |
2451 | { PCI_DEVICE(0x10de, 0x0bd7), .driver_data = AZX_DRIVER_NVIDIA }, | 2513 | { PCI_DEVICE(0x10de, 0x0d97), .driver_data = AZX_DRIVER_NVIDIA }, |
2452 | /* Teradici */ | 2514 | /* Teradici */ |
2453 | { PCI_DEVICE(0x6549, 0x1200), .driver_data = AZX_DRIVER_TERA }, | 2515 | { PCI_DEVICE(0x6549, 0x1200), .driver_data = AZX_DRIVER_TERA }, |
2454 | /* AMD Generic, PCI class code and Vendor ID for HD Audio */ | 2516 | /* AMD Generic, PCI class code and Vendor ID for HD Audio */ |
@@ -2468,7 +2530,6 @@ static struct pci_driver driver = { | |||
2468 | .remove = __devexit_p(azx_remove), | 2530 | .remove = __devexit_p(azx_remove), |
2469 | #ifdef CONFIG_PM | 2531 | #ifdef CONFIG_PM |
2470 | .suspend = azx_suspend, | 2532 | .suspend = azx_suspend, |
2471 | .resume_early = azx_resume_early, | ||
2472 | .resume = azx_resume, | 2533 | .resume = azx_resume, |
2473 | #endif | 2534 | #endif |
2474 | }; | 2535 | }; |