diff options
author | Takashi Iwai <tiwai@suse.de> | 2008-12-19 06:13:18 -0500 |
---|---|---|
committer | Takashi Iwai <tiwai@suse.de> | 2008-12-19 06:13:18 -0500 |
commit | 3d4758299fa6180ff9304634c67ffdd44272c8e8 (patch) | |
tree | c3ba2244cd191cfc4b9904b076e8d61fc9fb8834 /sound/pci/ca0106/ca0106_main.c | |
parent | 86effd7e12ca63cecfd218717473d606e138e5e1 (diff) |
ALSA: ca0106 - Add IEC958 PCM Stream controls
Added "IEC958 PCM Stream" controls for the per-stream IEC958 status
bits. Using this instead of "IEC958 Default" is safer since the status
bits will be recovered to the default states after closing the PCM
stream.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/pci/ca0106/ca0106_main.c')
-rw-r--r-- | sound/pci/ca0106/ca0106_main.c | 30 |
1 files changed, 22 insertions, 8 deletions
diff --git a/sound/pci/ca0106/ca0106_main.c b/sound/pci/ca0106/ca0106_main.c index 2c71f9b896cd..c27fd90101d6 100644 --- a/sound/pci/ca0106/ca0106_main.c +++ b/sound/pci/ca0106/ca0106_main.c | |||
@@ -479,6 +479,15 @@ static const int spi_dacd_bit[] = { | |||
479 | [PCM_UNKNOWN_CHANNEL] = SPI_DACD1_BIT, | 479 | [PCM_UNKNOWN_CHANNEL] = SPI_DACD1_BIT, |
480 | }; | 480 | }; |
481 | 481 | ||
482 | static void restore_spdif_bits(struct snd_ca0106 *chip, int idx) | ||
483 | { | ||
484 | if (chip->spdif_str_bits[idx] != chip->spdif_bits[idx]) { | ||
485 | chip->spdif_str_bits[idx] = chip->spdif_bits[idx]; | ||
486 | snd_ca0106_ptr_write(chip, SPCS0 + idx, 0, | ||
487 | chip->spdif_str_bits[idx]); | ||
488 | } | ||
489 | } | ||
490 | |||
482 | /* open_playback callback */ | 491 | /* open_playback callback */ |
483 | static int snd_ca0106_pcm_open_playback_channel(struct snd_pcm_substream *substream, | 492 | static int snd_ca0106_pcm_open_playback_channel(struct snd_pcm_substream *substream, |
484 | int channel_id) | 493 | int channel_id) |
@@ -524,6 +533,9 @@ static int snd_ca0106_pcm_open_playback_channel(struct snd_pcm_substream *substr | |||
524 | if (err < 0) | 533 | if (err < 0) |
525 | return err; | 534 | return err; |
526 | } | 535 | } |
536 | |||
537 | restore_spdif_bits(chip, channel_id); | ||
538 | |||
527 | return 0; | 539 | return 0; |
528 | } | 540 | } |
529 | 541 | ||
@@ -535,6 +547,8 @@ static int snd_ca0106_pcm_close_playback(struct snd_pcm_substream *substream) | |||
535 | struct snd_ca0106_pcm *epcm = runtime->private_data; | 547 | struct snd_ca0106_pcm *epcm = runtime->private_data; |
536 | chip->playback_channels[epcm->channel_id].use = 0; | 548 | chip->playback_channels[epcm->channel_id].use = 0; |
537 | 549 | ||
550 | restore_spdif_bits(chip, epcm->channel_id); | ||
551 | |||
538 | if (chip->details->spi_dac && epcm->channel_id != PCM_FRONT_CHANNEL) { | 552 | if (chip->details->spi_dac && epcm->channel_id != PCM_FRONT_CHANNEL) { |
539 | const int reg = spi_dacd_reg[epcm->channel_id]; | 553 | const int reg = spi_dacd_reg[epcm->channel_id]; |
540 | 554 | ||
@@ -1330,16 +1344,16 @@ static void ca0106_init_chip(struct snd_ca0106 *chip, int resume) | |||
1330 | SPCS_GENERATIONSTATUS | 0x00001200 | | 1344 | SPCS_GENERATIONSTATUS | 0x00001200 | |
1331 | 0x00000000 | SPCS_EMPHASIS_NONE | SPCS_COPYRIGHT; | 1345 | 0x00000000 | SPCS_EMPHASIS_NONE | SPCS_COPYRIGHT; |
1332 | if (!resume) { | 1346 | if (!resume) { |
1333 | chip->spdif_bits[0] = def_bits; | 1347 | chip->spdif_str_bits[0] = chip->spdif_bits[0] = def_bits; |
1334 | chip->spdif_bits[1] = def_bits; | 1348 | chip->spdif_str_bits[1] = chip->spdif_bits[1] = def_bits; |
1335 | chip->spdif_bits[2] = def_bits; | 1349 | chip->spdif_str_bits[2] = chip->spdif_bits[2] = def_bits; |
1336 | chip->spdif_bits[3] = def_bits; | 1350 | chip->spdif_str_bits[3] = chip->spdif_bits[3] = def_bits; |
1337 | } | 1351 | } |
1338 | /* Only SPCS1 has been tested */ | 1352 | /* Only SPCS1 has been tested */ |
1339 | snd_ca0106_ptr_write(chip, SPCS1, 0, chip->spdif_bits[1]); | 1353 | snd_ca0106_ptr_write(chip, SPCS1, 0, chip->spdif_str_bits[1]); |
1340 | snd_ca0106_ptr_write(chip, SPCS0, 0, chip->spdif_bits[0]); | 1354 | snd_ca0106_ptr_write(chip, SPCS0, 0, chip->spdif_str_bits[0]); |
1341 | snd_ca0106_ptr_write(chip, SPCS2, 0, chip->spdif_bits[2]); | 1355 | snd_ca0106_ptr_write(chip, SPCS2, 0, chip->spdif_str_bits[2]); |
1342 | snd_ca0106_ptr_write(chip, SPCS3, 0, chip->spdif_bits[3]); | 1356 | snd_ca0106_ptr_write(chip, SPCS3, 0, chip->spdif_str_bits[3]); |
1343 | 1357 | ||
1344 | snd_ca0106_ptr_write(chip, PLAYBACK_MUTE, 0, 0x00fc0000); | 1358 | snd_ca0106_ptr_write(chip, PLAYBACK_MUTE, 0, 0x00fc0000); |
1345 | snd_ca0106_ptr_write(chip, CAPTURE_MUTE, 0, 0x00fc0000); | 1359 | snd_ca0106_ptr_write(chip, CAPTURE_MUTE, 0, 0x00fc0000); |