aboutsummaryrefslogtreecommitdiffstats
path: root/sound/pci/ca0106/ca0106_main.c
diff options
context:
space:
mode:
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[] = {
485 [PCM_UNKNOWN_CHANNEL] = SPI_DACD1_BIT, 485 [PCM_UNKNOWN_CHANNEL] = SPI_DACD1_BIT,
486}; 486};
487 487
488static void restore_spdif_bits(struct snd_ca0106 *chip, int idx)
489{
490 if (chip->spdif_str_bits[idx] != chip->spdif_bits[idx]) {
491 chip->spdif_str_bits[idx] = chip->spdif_bits[idx];
492 snd_ca0106_ptr_write(chip, SPCS0 + idx, 0,
493 chip->spdif_str_bits[idx]);
494 }
495}
496
488/* open_playback callback */ 497/* open_playback callback */
489static int snd_ca0106_pcm_open_playback_channel(struct snd_pcm_substream *substream, 498static int snd_ca0106_pcm_open_playback_channel(struct snd_pcm_substream *substream,
490 int channel_id) 499 int channel_id)
@@ -530,6 +539,9 @@ static int snd_ca0106_pcm_open_playback_channel(struct snd_pcm_substream *substr
530 if (err < 0) 539 if (err < 0)
531 return err; 540 return err;
532 } 541 }
542
543 restore_spdif_bits(chip, channel_id);
544
533 return 0; 545 return 0;
534} 546}
535 547
@@ -541,6 +553,8 @@ static int snd_ca0106_pcm_close_playback(struct snd_pcm_substream *substream)
541 struct snd_ca0106_pcm *epcm = runtime->private_data; 553 struct snd_ca0106_pcm *epcm = runtime->private_data;
542 chip->playback_channels[epcm->channel_id].use = 0; 554 chip->playback_channels[epcm->channel_id].use = 0;
543 555
556 restore_spdif_bits(chip, epcm->channel_id);
557
544 if (chip->details->spi_dac && epcm->channel_id != PCM_FRONT_CHANNEL) { 558 if (chip->details->spi_dac && epcm->channel_id != PCM_FRONT_CHANNEL) {
545 const int reg = spi_dacd_reg[epcm->channel_id]; 559 const int reg = spi_dacd_reg[epcm->channel_id];
546 560
@@ -1336,16 +1350,16 @@ static void ca0106_init_chip(struct snd_ca0106 *chip, int resume)
1336 SPCS_GENERATIONSTATUS | 0x00001200 | 1350 SPCS_GENERATIONSTATUS | 0x00001200 |
1337 0x00000000 | SPCS_EMPHASIS_NONE | SPCS_COPYRIGHT; 1351 0x00000000 | SPCS_EMPHASIS_NONE | SPCS_COPYRIGHT;
1338 if (!resume) { 1352 if (!resume) {
1339 chip->spdif_bits[0] = def_bits; 1353 chip->spdif_str_bits[0] = chip->spdif_bits[0] = def_bits;
1340 chip->spdif_bits[1] = def_bits; 1354 chip->spdif_str_bits[1] = chip->spdif_bits[1] = def_bits;
1341 chip->spdif_bits[2] = def_bits; 1355 chip->spdif_str_bits[2] = chip->spdif_bits[2] = def_bits;
1342 chip->spdif_bits[3] = def_bits; 1356 chip->spdif_str_bits[3] = chip->spdif_bits[3] = def_bits;
1343 } 1357 }
1344 /* Only SPCS1 has been tested */ 1358 /* Only SPCS1 has been tested */
1345 snd_ca0106_ptr_write(chip, SPCS1, 0, chip->spdif_bits[1]); 1359 snd_ca0106_ptr_write(chip, SPCS1, 0, chip->spdif_str_bits[1]);
1346 snd_ca0106_ptr_write(chip, SPCS0, 0, chip->spdif_bits[0]); 1360 snd_ca0106_ptr_write(chip, SPCS0, 0, chip->spdif_str_bits[0]);
1347 snd_ca0106_ptr_write(chip, SPCS2, 0, chip->spdif_bits[2]); 1361 snd_ca0106_ptr_write(chip, SPCS2, 0, chip->spdif_str_bits[2]);
1348 snd_ca0106_ptr_write(chip, SPCS3, 0, chip->spdif_bits[3]); 1362 snd_ca0106_ptr_write(chip, SPCS3, 0, chip->spdif_str_bits[3]);
1349 1363
1350 snd_ca0106_ptr_write(chip, PLAYBACK_MUTE, 0, 0x00fc0000); 1364 snd_ca0106_ptr_write(chip, PLAYBACK_MUTE, 0, 0x00fc0000);
1351 snd_ca0106_ptr_write(chip, CAPTURE_MUTE, 0, 0x00fc0000); 1365 snd_ca0106_ptr_write(chip, CAPTURE_MUTE, 0, 0x00fc0000);