ca0106 SPDIF defaults
Hi,
I previously reported problems that are still plaguing me [1] to do with SPDIF settings that don't reset properly. I am now looking at doing a patch to the ca0106 driver to fix this problem.
It appears I have to add a new control to be able to set the default settings. I presume this introduces complications with existing settings in asound.state? Is there some collected wisdom on how to add new controls while providing a migration/upgrade/interoperability path?
Ben Stanley.
[1] http://article.gmane.org/gmane.linux.alsa.devel/55406/match=independent+pcm+iec958
At Thu, 18 Dec 2008 01:40:47 +1100,
Quoted 11 lines · Ben Stanley
Hi,
I previously reported problems that are still plaguing me [1] to do with SPDIF settings that don't reset properly. I am now looking at doing a patch to the ca0106 driver to fix this problem.
It appears I have to add a new control to be able to set the default settings. I presume this introduces complications with existing settings in asound.state? Is there some collected wisdom on how to add new controls while providing a migration/upgrade/interoperability path?
Not a big problem, I guess, as the "default" setting still remains.
For example, try the patch below. This will add new iec958 controls but the default controls remain. In this patch, the default control always overrides the per-stream setting, and this isn't quite good. But it's needed for compatibility of old alsa-lib config.
Once this patch is applied, we can change the alsa-lib config to use "IEC958 PCM Stream" instead of "IEC958 Default" so that the setting will be recovered at close.
Takashi
---
sound/pci/ca0106/ca0106.h +2 -1
@@ -694,7 +694,8 @@ struct snd_ca0106 {struct snd_ca0106_channel playback_channels[4 ];struct snd_ca0106_channel capture_channels[4 ]; -u32 spdif_bits[4 ];/* s/pdif out setup */ +u32 spdif_bits[4 ];/* s/pdif out default setup */ +u32 spdif_str_bits[4 ];/* s/pdif out per-stream setup */ int spdif_enable;int capture_source;int i2c_capture_source;
sound/pci/ca0106/ca0106_main.c +14 -0
@@ -479,6 +479,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)
@@ -524,6 +533,9 @@ static int snd_ca0106_pcm_open_playback_channel(struct snd_pcm_substream *substrif (err <0 )return err; } + +restore_spdif_bits (chip, channel_id); +return 0 ; }
@@ -535,6 +547,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];
sound/pci/ca0106/ca0106_mixer.c +66 -17
120 lines not on this page · raw message