summaryrefslogtreecommitdiff
path: root/sound/pci/ca0106/ca0106_main.c
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2008-12-20 23:43:06 +0100
committerTakashi Iwai <tiwai@suse.de>2008-12-20 23:43:06 +0100
commitebef7cfc81942686a994ca6239b195040f5d1e4d (patch)
tree3e2c7c1d4d80a20bc48dce5f334ea532bcf60dbd /sound/pci/ca0106/ca0106_main.c
parent6bcdbd55b4c603d9741398d081133fcc50a10b6c (diff)
parent3d4758299fa6180ff9304634c67ffdd44272c8e8 (diff)
Merge branch 'topic/ca0106-spdif-stream' into topic/ca0106
Diffstat (limited to 'sound/pci/ca0106/ca0106_main.c')
-rw-r--r--sound/pci/ca0106/ca0106_main.c30
1 files changed, 22 insertions, 8 deletions
diff --git a/sound/pci/ca0106/ca0106_main.c b/sound/pci/ca0106/ca0106_main.c
index 3e6dda37ef21..0e62205d4081 100644
--- a/sound/pci/ca0106/ca0106_main.c
+++ b/sound/pci/ca0106/ca0106_main.c
@@ -485,6 +485,15 @@ static const int spi_dacd_bit[] = {
[PCM_UNKNOWN_CHANNEL] = SPI_DACD1_BIT,
};
+static void restore_spdif_bits(struct snd_ca0106 *chip, int idx)
+{
+ if (chip->spdif_str_bits[idx] != chip->spdif_bits[idx]) {
+ chip->spdif_str_bits[idx] = chip->spdif_bits[idx];
+ snd_ca0106_ptr_write(chip, SPCS0 + idx, 0,
+ chip->spdif_str_bits[idx]);
+ }
+}
+
/* open_playback callback */
static int snd_ca0106_pcm_open_playback_channel(struct snd_pcm_substream *substream,
int channel_id)
@@ -530,6 +539,9 @@ static int snd_ca0106_pcm_open_playback_channel(struct snd_pcm_substream *substr
if (err < 0)
return err;
}
+
+ restore_spdif_bits(chip, channel_id);
+
return 0;
}
@@ -541,6 +553,8 @@ static int snd_ca0106_pcm_close_playback(struct snd_pcm_substream *substream)
struct snd_ca0106_pcm *epcm = runtime->private_data;
chip->playback_channels[epcm->channel_id].use = 0;
+ restore_spdif_bits(chip, epcm->channel_id);
+
if (chip->details->spi_dac && epcm->channel_id != PCM_FRONT_CHANNEL) {
const int reg = spi_dacd_reg[epcm->channel_id];
@@ -1336,16 +1350,16 @@ static void ca0106_init_chip(struct snd_ca0106 *chip, int resume)
SPCS_GENERATIONSTATUS | 0x00001200 |
0x00000000 | SPCS_EMPHASIS_NONE | SPCS_COPYRIGHT;
if (!resume) {
- chip->spdif_bits[0] = def_bits;
- chip->spdif_bits[1] = def_bits;
- chip->spdif_bits[2] = def_bits;
- chip->spdif_bits[3] = def_bits;
+ chip->spdif_str_bits[0] = chip->spdif_bits[0] = def_bits;
+ chip->spdif_str_bits[1] = chip->spdif_bits[1] = def_bits;
+ chip->spdif_str_bits[2] = chip->spdif_bits[2] = def_bits;
+ chip->spdif_str_bits[3] = chip->spdif_bits[3] = def_bits;
}
/* Only SPCS1 has been tested */
- snd_ca0106_ptr_write(chip, SPCS1, 0, chip->spdif_bits[1]);
- snd_ca0106_ptr_write(chip, SPCS0, 0, chip->spdif_bits[0]);
- snd_ca0106_ptr_write(chip, SPCS2, 0, chip->spdif_bits[2]);
- snd_ca0106_ptr_write(chip, SPCS3, 0, chip->spdif_bits[3]);
+ snd_ca0106_ptr_write(chip, SPCS1, 0, chip->spdif_str_bits[1]);
+ snd_ca0106_ptr_write(chip, SPCS0, 0, chip->spdif_str_bits[0]);
+ snd_ca0106_ptr_write(chip, SPCS2, 0, chip->spdif_str_bits[2]);
+ snd_ca0106_ptr_write(chip, SPCS3, 0, chip->spdif_str_bits[3]);
snd_ca0106_ptr_write(chip, PLAYBACK_MUTE, 0, 0x00fc0000);
snd_ca0106_ptr_write(chip, CAPTURE_MUTE, 0, 0x00fc0000);