Update of /cvsroot/alsa/alsa-kernel/pci
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19775
Modified Files:
via82xx.c
Log Message:
- use snd_pcm_limit_hw_rates() and removed redundant codes.
- fixed the rate constraints when 'IEC958 Output Switch' is on.
- check the SPDIF support on AC97 and don't build IEC958 stuffs if not available.
Index: via82xx.c
===================================================================
RCS file: /cvsroot/alsa/alsa-kernel/pci/via82xx.c,v
retrieving revision 1.102
retrieving revision 1.103
diff -u -r1.102 -r1.103
--- via82xx.c 25 May 2004 15:10:38 -0000 1.102
+++ via82xx.c 25 May 2004 17:54:55 -0000 1.103
@@ -1060,19 +1060,6 @@
int err;
unsigned long flags;
struct via_rate_lock *ratep;
- struct ratetbl {
- int rate;
- unsigned int bit;
- } ratebits[] = {
- {8000, SNDRV_PCM_RATE_8000},
- {11025, SNDRV_PCM_RATE_11025},
- {16000, SNDRV_PCM_RATE_16000},
- {22050, SNDRV_PCM_RATE_22050},
- {32000, SNDRV_PCM_RATE_32000},
- {44100, SNDRV_PCM_RATE_44100},
- {48000, SNDRV_PCM_RATE_48000},
- };
- int i;
runtime->hw = snd_via82xx_hw;
@@ -1080,10 +1067,10 @@
ratep = &chip->rates[viadev->direction];
spin_lock_irqsave(&ratep->lock, flags);
ratep->used++;
- if (chip->spdif_on) {
- runtime->hw.rates =
SNDRV_PCM_RATE_32000|SNDRV_PCM_RATE_44100|SNDRV_PCM_RATE_48000;
- runtime->hw.rate_min = 32000;
- runtime->hw.rate_max = 48000;
+ if (chip->spdif_on && viadev->reg_offset == 0x30) {
+ /* DXS#3 and spdif is on */
+ runtime->hw.rates = chip->ac97->rates[AC97_RATES_SPDIF];
+ snd_pcm_limit_hw_rates(runtime);
} else if (chip->dxs_fixed && viadev->reg_offset < 0x40) {
/* fixed DXS playback rate */
runtime->hw.rates = SNDRV_PCM_RATE_48000;
@@ -1091,27 +1078,10 @@
} else if (! ratep->rate) {
int idx = viadev->direction ? AC97_RATES_ADC : AC97_RATES_FRONT_DAC;
runtime->hw.rates = chip->ac97->rates[idx];
- for (i = 0; i < (int)ARRAY_SIZE(ratebits); i++) {
- if (runtime->hw.rates & ratebits[i].bit) {
- runtime->hw.rate_min = ratebits[i].rate;
- break;
- }
- }
- for (i = ARRAY_SIZE(ratebits) - 1; i >= 0; i--) {
- if (runtime->hw.rates & ratebits[i].bit) {
- runtime->hw.rate_max = ratebits[i].rate;
- break;
- }
- }
+ snd_pcm_limit_hw_rates(runtime);
} else {
/* a fixed rate */
runtime->hw.rates = SNDRV_PCM_RATE_KNOT;
- for (i = 0; i < (int)ARRAY_SIZE(ratebits); i++) {
- if (ratep->rate == ratebits[i].rate) {
- runtime->hw.rates = ratebits[i].bit;
- break;
- }
- }
runtime->hw.rate_max = runtime->hw.rate_min = ratep->rate;
}
spin_unlock_irqrestore(&ratep->lock, flags);
@@ -1363,6 +1333,10 @@
snd_dma_pci_data(chip->pci),
64*1024, 128*1024)) < 0)
return err;
+ /* SPDIF supported? */
+ if (! ac97_can_spdif(chip->ac97))
+ return 0;
+
/* PCM #1: DXS3 playback (for spdif) */
err = snd_pcm_new(chip->card, chip->card->shortname, 1, 1, 0, &pcm);
if (err < 0)
@@ -1660,9 +1634,11 @@
if (err < 0)
return err;
}
- err = snd_ctl_add(chip->card, snd_ctl_new1(&snd_via8233_dxs3_spdif_control,
chip));
- if (err < 0)
- return err;
+ if (ac97_can_spdif(chip->ac97)) {
+ err = snd_ctl_add(chip->card,
snd_ctl_new1(&snd_via8233_dxs3_spdif_control, chip));
+ if (err < 0)
+ return err;
+ }
if (chip->chip_type != TYPE_VIA8233A) {
err = snd_ctl_add(chip->card,
snd_ctl_new1(&snd_via8233_dxs_volume_control, chip));
if (err < 0)
@@ -1672,6 +1648,7 @@
/* select spdif data slot 10/11 */
pci_read_config_byte(chip->pci, VIA8233_SPDIF_CTRL, &val);
val = (val & ~VIA8233_SPDIF_SLOT_MASK) | VIA8233_SPDIF_SLOT_1011;
+ val &= ~VIA8233_SPDIF_DX3; /* SPDIF off as default */
pci_write_config_byte(chip->pci, VIA8233_SPDIF_CTRL, val);
return 0;
-------------------------------------------------------
This SF.Net email is sponsored by: Oracle 10g
Get certified on the hottest thing ever to hit the market... Oracle 10g.
Take an Oracle 10g class now, and we'll give you the exam FREE.
http://ads.osdn.com/?ad_id=3149&alloc_id=8166&op=click
_______________________________________________
Alsa-cvslog mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/alsa-cvslog