diff options
author | Andy Owen <andy-alsa@ultra-premium.com> | 2010-10-23 07:12:32 -0400 |
---|---|---|
committer | Takashi Iwai <tiwai@suse.de> | 2010-10-23 10:59:40 -0400 |
commit | 6fef153afa8b25f81417488150e04db7c6b0b229 (patch) | |
tree | 84d03bfe267bf85eb80fedaa70823968840de7bf /sound | |
parent | 861391d3a037fab38020c741baffdb147e1c732a (diff) |
ALSA: ca0106: Allow different sound cards to use different SPI channel mappings.
Signed-off-by: Andy Owen <andy-alsa@ultra-premium.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound')
-rw-r--r-- | sound/pci/ca0106/ca0106.h | 5 | ||||
-rw-r--r-- | sound/pci/ca0106/ca0106_main.c | 26 | ||||
-rw-r--r-- | sound/pci/ca0106/ca0106_mixer.c | 4 |
3 files changed, 21 insertions, 14 deletions
diff --git a/sound/pci/ca0106/ca0106.h b/sound/pci/ca0106/ca0106.h index 14b8d9a91aae..f19c11077255 100644 --- a/sound/pci/ca0106/ca0106.h +++ b/sound/pci/ca0106/ca0106.h | |||
@@ -670,8 +670,9 @@ struct snd_ca0106_details { | |||
670 | gpio_type = 2 -> shared side-out/line-in. */ | 670 | gpio_type = 2 -> shared side-out/line-in. */ |
671 | int i2c_adc; /* with i2c_adc=1, the driver adds some capture volume | 671 | int i2c_adc; /* with i2c_adc=1, the driver adds some capture volume |
672 | controls, phone, mic, line-in and aux. */ | 672 | controls, phone, mic, line-in and aux. */ |
673 | int spi_dac; /* spi_dac=1 adds the mute switch for each analog | 673 | u16 spi_dac; /* spi_dac = 0 -> no spi interface for DACs |
674 | output, front, rear, etc. */ | 674 | spi_dac = 0x<front><rear><center-lfe><side> |
675 | -> specifies DAC id for each channel pair. */ | ||
675 | }; | 676 | }; |
676 | 677 | ||
677 | // definition of the chip-specific record | 678 | // definition of the chip-specific record |
diff --git a/sound/pci/ca0106/ca0106_main.c b/sound/pci/ca0106/ca0106_main.c index da910031edfa..d2d12c08f937 100644 --- a/sound/pci/ca0106/ca0106_main.c +++ b/sound/pci/ca0106/ca0106_main.c | |||
@@ -227,7 +227,7 @@ static struct snd_ca0106_details ca0106_chip_details[] = { | |||
227 | .name = "Audigy SE [SB0570]", | 227 | .name = "Audigy SE [SB0570]", |
228 | .gpio_type = 1, | 228 | .gpio_type = 1, |
229 | .i2c_adc = 1, | 229 | .i2c_adc = 1, |
230 | .spi_dac = 1 } , | 230 | .spi_dac = 0x4021 } , |
231 | /* New Audigy LS. Has a different DAC. */ | 231 | /* New Audigy LS. Has a different DAC. */ |
232 | /* SB0570: | 232 | /* SB0570: |
233 | * CTRL:CA0106-DAT | 233 | * CTRL:CA0106-DAT |
@@ -238,7 +238,7 @@ static struct snd_ca0106_details ca0106_chip_details[] = { | |||
238 | .name = "Audigy SE OEM [SB0570a]", | 238 | .name = "Audigy SE OEM [SB0570a]", |
239 | .gpio_type = 1, | 239 | .gpio_type = 1, |
240 | .i2c_adc = 1, | 240 | .i2c_adc = 1, |
241 | .spi_dac = 1 } , | 241 | .spi_dac = 0x4021 } , |
242 | /* Sound Blaster 5.1vx | 242 | /* Sound Blaster 5.1vx |
243 | * Tested: Playback on front, rear, center/lfe speakers | 243 | * Tested: Playback on front, rear, center/lfe speakers |
244 | * Not-Tested: Capture | 244 | * Not-Tested: Capture |
@@ -247,7 +247,7 @@ static struct snd_ca0106_details ca0106_chip_details[] = { | |||
247 | .name = "Sound Blaster 5.1vx [SB1070]", | 247 | .name = "Sound Blaster 5.1vx [SB1070]", |
248 | .gpio_type = 1, | 248 | .gpio_type = 1, |
249 | .i2c_adc = 0, | 249 | .i2c_adc = 0, |
250 | .spi_dac = 1 | 250 | .spi_dac = 0x0124 |
251 | } , | 251 | } , |
252 | /* MSI K8N Diamond Motherboard with onboard SB Live 24bit without AC97 */ | 252 | /* MSI K8N Diamond Motherboard with onboard SB Live 24bit without AC97 */ |
253 | /* SB0438 | 253 | /* SB0438 |
@@ -264,7 +264,7 @@ static struct snd_ca0106_details ca0106_chip_details[] = { | |||
264 | .name = "MSI K8N Diamond MB", | 264 | .name = "MSI K8N Diamond MB", |
265 | .gpio_type = 2, | 265 | .gpio_type = 2, |
266 | .i2c_adc = 1, | 266 | .i2c_adc = 1, |
267 | .spi_dac = 1 } , | 267 | .spi_dac = 0x4021 } , |
268 | /* Giga-byte GA-G1975X mobo | 268 | /* Giga-byte GA-G1975X mobo |
269 | * Novell bnc#395807 | 269 | * Novell bnc#395807 |
270 | */ | 270 | */ |
@@ -520,12 +520,18 @@ static int snd_ca0106_channel_dac(struct snd_ca0106_details *details, | |||
520 | int channel_id) | 520 | int channel_id) |
521 | { | 521 | { |
522 | switch (channel_id) { | 522 | switch (channel_id) { |
523 | case PCM_FRONT_CHANNEL: return 4; | 523 | case PCM_FRONT_CHANNEL: |
524 | case PCM_REAR_CHANNEL: return 0; | 524 | return (details->spi_dac & 0xf000) >> (4 * 3); |
525 | case PCM_CENTER_LFE_CHANNEL: return 2; | 525 | case PCM_REAR_CHANNEL: |
526 | case PCM_UNKNOWN_CHANNEL: return 1; | 526 | return (details->spi_dac & 0x0f00) >> (4 * 2); |
527 | case PCM_CENTER_LFE_CHANNEL: | ||
528 | return (details->spi_dac & 0x00f0) >> (4 * 1); | ||
529 | case PCM_UNKNOWN_CHANNEL: | ||
530 | return (details->spi_dac & 0x000f) >> (4 * 0); | ||
531 | default: | ||
532 | snd_printk(KERN_DEBUG "ca0106: unknown channel_id %d\n", | ||
533 | channel_id); | ||
527 | } | 534 | } |
528 | snd_printk(KERN_DEBUG "ca0106: unknown channel_id %d\n", channel_id); | ||
529 | return 0; | 535 | return 0; |
530 | } | 536 | } |
531 | 537 | ||
@@ -1582,7 +1588,7 @@ static void ca0106_init_chip(struct snd_ca0106 *chip, int resume) | |||
1582 | /* snd_ca0106_i2c_write(chip, ADC_MUX, ADC_MUX_LINEIN); */ | 1588 | /* snd_ca0106_i2c_write(chip, ADC_MUX, ADC_MUX_LINEIN); */ |
1583 | } | 1589 | } |
1584 | 1590 | ||
1585 | if (chip->details->spi_dac == 1) { | 1591 | if (chip->details->spi_dac) { |
1586 | /* The SB0570 use SPI to control DAC. */ | 1592 | /* The SB0570 use SPI to control DAC. */ |
1587 | int size, n; | 1593 | int size, n; |
1588 | 1594 | ||
diff --git a/sound/pci/ca0106/ca0106_mixer.c b/sound/pci/ca0106/ca0106_mixer.c index 85fd315d9999..b522401b0318 100644 --- a/sound/pci/ca0106/ca0106_mixer.c +++ b/sound/pci/ca0106/ca0106_mixer.c | |||
@@ -832,7 +832,7 @@ int __devinit snd_ca0106_mixer(struct snd_ca0106 *emu) | |||
832 | if (err < 0) | 832 | if (err < 0) |
833 | return err; | 833 | return err; |
834 | } | 834 | } |
835 | if (emu->details->spi_dac == 1) | 835 | if (emu->details->spi_dac) |
836 | ADD_CTLS(emu, snd_ca0106_volume_spi_dac_ctls); | 836 | ADD_CTLS(emu, snd_ca0106_volume_spi_dac_ctls); |
837 | 837 | ||
838 | /* Create virtual master controls */ | 838 | /* Create virtual master controls */ |
@@ -845,7 +845,7 @@ int __devinit snd_ca0106_mixer(struct snd_ca0106 *emu) | |||
845 | return err; | 845 | return err; |
846 | add_slaves(card, vmaster, slave_vols); | 846 | add_slaves(card, vmaster, slave_vols); |
847 | 847 | ||
848 | if (emu->details->spi_dac == 1) { | 848 | if (emu->details->spi_dac) { |
849 | vmaster = snd_ctl_make_virtual_master("Master Playback Switch", | 849 | vmaster = snd_ctl_make_virtual_master("Master Playback Switch", |
850 | NULL); | 850 | NULL); |
851 | if (!vmaster) | 851 | if (!vmaster) |