diff options
author | Takashi Iwai <tiwai@suse.de> | 2005-11-24 10:03:40 -0500 |
---|---|---|
committer | Jaroslav Kysela <perex@suse.cz> | 2006-01-03 06:29:43 -0500 |
commit | 606ad75fb5372c0edb5ee6276c8e29fcb525f3e1 (patch) | |
tree | 8ae65a6a70b4c5950788346d0c897013a03759f0 /sound/pci/hda | |
parent | 5014f193166d14e47525a34d65a1c7d77b0f6f38 (diff) |
[ALSA] hda-intel - Use position buffer as default
Modules: HDA Intel driver
- Use the position buffer for obtaining the current DMA position
as default. This seems more stable than others.
- Add probe_mask module option (mainly for test boards with multiple
codecs).
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/pci/hda')
-rw-r--r-- | sound/pci/hda/hda_intel.c | 37 |
1 files changed, 8 insertions, 29 deletions
diff --git a/sound/pci/hda/hda_intel.c b/sound/pci/hda/hda_intel.c index 3945c44440cf..8a0a0a7d5d49 100644 --- a/sound/pci/hda/hda_intel.c +++ b/sound/pci/hda/hda_intel.c | |||
@@ -52,6 +52,7 @@ static int index = SNDRV_DEFAULT_IDX1; | |||
52 | static char *id = SNDRV_DEFAULT_STR1; | 52 | static char *id = SNDRV_DEFAULT_STR1; |
53 | static char *model; | 53 | static char *model; |
54 | static int position_fix; | 54 | static int position_fix; |
55 | static int probe_mask; | ||
55 | 56 | ||
56 | module_param(index, int, 0444); | 57 | module_param(index, int, 0444); |
57 | MODULE_PARM_DESC(index, "Index value for Intel HD audio interface."); | 58 | MODULE_PARM_DESC(index, "Index value for Intel HD audio interface."); |
@@ -61,6 +62,9 @@ module_param(model, charp, 0444); | |||
61 | MODULE_PARM_DESC(model, "Use the given board model."); | 62 | MODULE_PARM_DESC(model, "Use the given board model."); |
62 | module_param(position_fix, int, 0444); | 63 | module_param(position_fix, int, 0444); |
63 | MODULE_PARM_DESC(position_fix, "Fix DMA pointer (0 = auto, 1 = none, 2 = POSBUF, 3 = FIFO size)."); | 64 | MODULE_PARM_DESC(position_fix, "Fix DMA pointer (0 = auto, 1 = none, 2 = POSBUF, 3 = FIFO size)."); |
65 | module_param(probe_mask, int, 0444); | ||
66 | MODULE_PARM_DESC(probe_mask, "Bitmask to probe codecs (default = -1)."); | ||
67 | |||
64 | 68 | ||
65 | /* just for backward compatibility */ | 69 | /* just for backward compatibility */ |
66 | static int enable; | 70 | static int enable; |
@@ -916,7 +920,7 @@ static int __devinit azx_codec_create(struct azx *chip, const char *model) | |||
916 | 920 | ||
917 | codecs = 0; | 921 | codecs = 0; |
918 | for (c = 0; c < AZX_MAX_CODECS; c++) { | 922 | for (c = 0; c < AZX_MAX_CODECS; c++) { |
919 | if (chip->codec_mask & (1 << c)) { | 923 | if ((chip->codec_mask & (1 << c)) & probe_mask) { |
920 | err = snd_hda_codec_new(chip->bus, c, NULL); | 924 | err = snd_hda_codec_new(chip->bus, c, NULL); |
921 | if (err < 0) | 925 | if (err < 0) |
922 | continue; | 926 | continue; |
@@ -1150,31 +1154,6 @@ static snd_pcm_uframes_t azx_pcm_pointer(struct snd_pcm_substream *substream) | |||
1150 | pos = azx_sd_readl(azx_dev, SD_LPIB); | 1154 | pos = azx_sd_readl(azx_dev, SD_LPIB); |
1151 | if (chip->position_fix == POS_FIX_FIFO) | 1155 | if (chip->position_fix == POS_FIX_FIFO) |
1152 | pos += azx_dev->fifo_size; | 1156 | pos += azx_dev->fifo_size; |
1153 | #if 0 /* disabled temprarily, auto-correction doesn't work well... */ | ||
1154 | else if (chip->position_fix == POS_FIX_AUTO && azx_dev->period_updating) { | ||
1155 | /* check the validity of DMA position */ | ||
1156 | unsigned int diff = 0; | ||
1157 | azx_dev->last_pos += azx_dev->fragsize; | ||
1158 | if (azx_dev->last_pos > pos) | ||
1159 | diff = azx_dev->last_pos - pos; | ||
1160 | if (azx_dev->last_pos >= azx_dev->bufsize) { | ||
1161 | if (pos < azx_dev->fragsize) | ||
1162 | diff = 0; | ||
1163 | azx_dev->last_pos = 0; | ||
1164 | } | ||
1165 | if (diff > 0 && diff <= azx_dev->fifo_size) | ||
1166 | pos += azx_dev->fifo_size; | ||
1167 | else { | ||
1168 | snd_printdd(KERN_INFO "hda_intel: DMA position fix %d, switching to posbuf\n", diff); | ||
1169 | chip->position_fix = POS_FIX_POSBUF; | ||
1170 | pos = *azx_dev->posbuf; | ||
1171 | } | ||
1172 | azx_dev->period_updating = 0; | ||
1173 | } | ||
1174 | #else | ||
1175 | else if (chip->position_fix == POS_FIX_AUTO) | ||
1176 | pos += azx_dev->fifo_size; | ||
1177 | #endif | ||
1178 | } | 1157 | } |
1179 | if (pos >= azx_dev->bufsize) | 1158 | if (pos >= azx_dev->bufsize) |
1180 | pos = 0; | 1159 | pos = 0; |
@@ -1412,7 +1391,7 @@ static int azx_dev_free(struct snd_device *device) | |||
1412 | * constructor | 1391 | * constructor |
1413 | */ | 1392 | */ |
1414 | static int __devinit azx_create(struct snd_card *card, struct pci_dev *pci, | 1393 | static int __devinit azx_create(struct snd_card *card, struct pci_dev *pci, |
1415 | int posfix, int driver_type, | 1394 | int driver_type, |
1416 | struct azx **rchip) | 1395 | struct azx **rchip) |
1417 | { | 1396 | { |
1418 | struct azx *chip; | 1397 | struct azx *chip; |
@@ -1441,7 +1420,7 @@ static int __devinit azx_create(struct snd_card *card, struct pci_dev *pci, | |||
1441 | chip->irq = -1; | 1420 | chip->irq = -1; |
1442 | chip->driver_type = driver_type; | 1421 | chip->driver_type = driver_type; |
1443 | 1422 | ||
1444 | chip->position_fix = posfix; | 1423 | chip->position_fix = position_fix ? position_fix : POS_FIX_POSBUF; |
1445 | 1424 | ||
1446 | #if BITS_PER_LONG != 64 | 1425 | #if BITS_PER_LONG != 64 |
1447 | /* Fix up base address on ULI M5461 */ | 1426 | /* Fix up base address on ULI M5461 */ |
@@ -1559,7 +1538,7 @@ static int __devinit azx_probe(struct pci_dev *pci, const struct pci_device_id * | |||
1559 | return -ENOMEM; | 1538 | return -ENOMEM; |
1560 | } | 1539 | } |
1561 | 1540 | ||
1562 | if ((err = azx_create(card, pci, position_fix, pci_id->driver_data, | 1541 | if ((err = azx_create(card, pci, pci_id->driver_data, |
1563 | &chip)) < 0) { | 1542 | &chip)) < 0) { |
1564 | snd_card_free(card); | 1543 | snd_card_free(card); |
1565 | return err; | 1544 | return err; |