summaryrefslogtreecommitdiff
path: root/sound/pci/ca0106
diff options
context:
space:
mode:
authorAndy Owen <andy-alsa@ultra-premium.com>2010-10-23 15:12:31 +0400
committerTakashi Iwai <tiwai@suse.de>2010-10-23 18:59:16 +0400
commit861391d3a037fab38020c741baffdb147e1c732a (patch)
tree4c036318d4ff911da8537f750e70020498d4759b /sound/pci/ca0106
parent9bfd94132dd97b76af41024eb7e980a5cb41afee (diff)
downloadlinux-861391d3a037fab38020c741baffdb147e1c732a.tar.xz
ALSA: ca0106: Create a nice spot for mapping channels to dacs.
This is to allow a future patch to have card specific mappings between dacs, which is required since the Sound Blaster 5.1vx seems to have a different mapping to what was previously used. Signed-off-by: Andy Owen <andy-alsa@ultra-premium.com> Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/pci/ca0106')
-rw-r--r--sound/pci/ca0106/ca0106_main.c40
1 files changed, 29 insertions, 11 deletions
diff --git a/sound/pci/ca0106/ca0106_main.c b/sound/pci/ca0106/ca0106_main.c
index 46ae98d9cb49..da910031edfa 100644
--- a/sound/pci/ca0106/ca0106_main.c
+++ b/sound/pci/ca0106/ca0106_main.c
@@ -493,16 +493,18 @@ static void snd_ca0106_pcm_free_substream(struct snd_pcm_runtime *runtime)
}
static const int spi_dacd_reg[] = {
- [PCM_FRONT_CHANNEL] = SPI_DACD4_REG,
- [PCM_REAR_CHANNEL] = SPI_DACD0_REG,
- [PCM_CENTER_LFE_CHANNEL]= SPI_DACD2_REG,
- [PCM_UNKNOWN_CHANNEL] = SPI_DACD1_REG,
+ SPI_DACD0_REG,
+ SPI_DACD1_REG,
+ SPI_DACD2_REG,
+ 0,
+ SPI_DACD4_REG,
};
static const int spi_dacd_bit[] = {
- [PCM_FRONT_CHANNEL] = SPI_DACD4_BIT,
- [PCM_REAR_CHANNEL] = SPI_DACD0_BIT,
- [PCM_CENTER_LFE_CHANNEL]= SPI_DACD2_BIT,
- [PCM_UNKNOWN_CHANNEL] = SPI_DACD1_BIT,
+ SPI_DACD0_BIT,
+ SPI_DACD1_BIT,
+ SPI_DACD2_BIT,
+ 0,
+ SPI_DACD4_BIT,
};
static void restore_spdif_bits(struct snd_ca0106 *chip, int idx)
@@ -514,18 +516,34 @@ static void restore_spdif_bits(struct snd_ca0106 *chip, int idx)
}
}
+static int snd_ca0106_channel_dac(struct snd_ca0106_details *details,
+ int channel_id)
+{
+ switch (channel_id) {
+ case PCM_FRONT_CHANNEL: return 4;
+ case PCM_REAR_CHANNEL: return 0;
+ case PCM_CENTER_LFE_CHANNEL: return 2;
+ case PCM_UNKNOWN_CHANNEL: return 1;
+ }
+ snd_printk(KERN_DEBUG "ca0106: unknown channel_id %d\n", channel_id);
+ return 0;
+}
+
static int snd_ca0106_pcm_power_dac(struct snd_ca0106 *chip, int channel_id,
int power)
{
if (chip->details->spi_dac) {
- const int reg = spi_dacd_reg[channel_id];
+ const int dac = snd_ca0106_channel_dac(chip->details,
+ channel_id);
+ const int reg = spi_dacd_reg[dac];
+ const int bit = spi_dacd_bit[dac];
if (power)
/* Power up */
- chip->spi_dac_reg[reg] &= ~spi_dacd_bit[channel_id];
+ chip->spi_dac_reg[reg] &= ~bit;
else
/* Power down */
- chip->spi_dac_reg[reg] |= spi_dacd_bit[channel_id];
+ chip->spi_dac_reg[reg] |= bit;
return snd_ca0106_spi_write(chip, chip->spi_dac_reg[reg]);
}
return 0;