aboutsummaryrefslogtreecommitdiffstats
path: root/sound
diff options
context:
space:
mode:
authorTrent Piepho <xyzzy@speakeasy.org>2007-09-07 07:18:50 -0400
committerJaroslav Kysela <perex@perex.cz>2007-10-16 10:49:15 -0400
commit950fb626dc28e17ae4ad01dba07957bdc6e0b997 (patch)
tree9f2dd67fcf9a3dc01fc9f72e704803783c54191e /sound
parent57bd68b8b18608cf2729f97fcb984b8521d19551 (diff)
[ALSA] snd-bt87x: Power down audio ADC when not in use
Sets a bit to power down the Bt87x's internal audio ADC when the ALSA device isn't open, or when it is in 'digital mode' using an external ADC. Signed-off-by: Trent Piepho <xyzzy@speakeasy.org> Signed-off-by: Takashi Iwai <tiwai@suse.de> Signed-off-by: Jaroslav Kysela <perex@suse.cz>
Diffstat (limited to 'sound')
-rw-r--r--sound/pci/bt87x.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/sound/pci/bt87x.c b/sound/pci/bt87x.c
index 10c8af1b736..42e57fd02d3 100644
--- a/sound/pci/bt87x.c
+++ b/sound/pci/bt87x.c
@@ -377,7 +377,7 @@ static struct snd_pcm_hardware snd_bt87x_analog_hw = {
377 377
378static int snd_bt87x_set_digital_hw(struct snd_bt87x *chip, struct snd_pcm_runtime *runtime) 378static int snd_bt87x_set_digital_hw(struct snd_bt87x *chip, struct snd_pcm_runtime *runtime)
379{ 379{
380 chip->reg_control |= CTL_DA_IOM_DA; 380 chip->reg_control |= CTL_DA_IOM_DA | CTL_A_PWRDN;
381 runtime->hw = snd_bt87x_digital_hw; 381 runtime->hw = snd_bt87x_digital_hw;
382 runtime->hw.rates = snd_pcm_rate_to_rate_bit(chip->board.dig_rate); 382 runtime->hw.rates = snd_pcm_rate_to_rate_bit(chip->board.dig_rate);
383 runtime->hw.rate_min = chip->board.dig_rate; 383 runtime->hw.rate_min = chip->board.dig_rate;
@@ -398,7 +398,7 @@ static int snd_bt87x_set_analog_hw(struct snd_bt87x *chip, struct snd_pcm_runtim
398 .rats = &analog_clock 398 .rats = &analog_clock
399 }; 399 };
400 400
401 chip->reg_control &= ~CTL_DA_IOM_DA; 401 chip->reg_control &= ~(CTL_DA_IOM_DA | CTL_A_PWRDN);
402 runtime->hw = snd_bt87x_analog_hw; 402 runtime->hw = snd_bt87x_analog_hw;
403 return snd_pcm_hw_constraint_ratnums(runtime, 0, SNDRV_PCM_HW_PARAM_RATE, 403 return snd_pcm_hw_constraint_ratnums(runtime, 0, SNDRV_PCM_HW_PARAM_RATE,
404 &constraint_rates); 404 &constraint_rates);
@@ -437,6 +437,11 @@ static int snd_bt87x_close(struct snd_pcm_substream *substream)
437{ 437{
438 struct snd_bt87x *chip = snd_pcm_substream_chip(substream); 438 struct snd_bt87x *chip = snd_pcm_substream_chip(substream);
439 439
440 spin_lock_irq(&chip->reg_lock);
441 chip->reg_control |= CTL_A_PWRDN;
442 snd_bt87x_writel(chip, REG_GPIO_DMA_CTL, chip->reg_control);
443 spin_unlock_irq(&chip->reg_lock);
444
440 chip->substream = NULL; 445 chip->substream = NULL;
441 clear_bit(0, &chip->opened); 446 clear_bit(0, &chip->opened);
442 smp_mb__after_clear_bit(); 447 smp_mb__after_clear_bit();
@@ -751,7 +756,8 @@ static int __devinit snd_bt87x_create(struct snd_card *card,
751 goto fail; 756 goto fail;
752 } 757 }
753 758
754 chip->reg_control = CTL_DA_ES2 | CTL_PKTP_16 | (15 << CTL_DA_SDR_SHIFT); 759 chip->reg_control = CTL_A_PWRDN | CTL_DA_ES2 |
760 CTL_PKTP_16 | (15 << CTL_DA_SDR_SHIFT);
755 chip->interrupt_mask = MY_INTERRUPTS; 761 chip->interrupt_mask = MY_INTERRUPTS;
756 snd_bt87x_writel(chip, REG_GPIO_DMA_CTL, chip->reg_control); 762 snd_bt87x_writel(chip, REG_GPIO_DMA_CTL, chip->reg_control);
757 snd_bt87x_writel(chip, REG_INT_MASK, 0); 763 snd_bt87x_writel(chip, REG_INT_MASK, 0);