diff options
author | Hartmut Hackmann <hartmut.hackmann@t-online.de> | 2006-11-21 17:59:27 -0500 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@infradead.org> | 2006-12-10 06:05:08 -0500 |
commit | 5cfbacd0d3ee0c9f68e1ad3f24c4e1f879cc47a7 (patch) | |
tree | ebc72f93854bdb1c764d39d6f7fc7827c2cd8d56 /drivers/media/video/saa7134 | |
parent | 444dadc4391b978b43a778a5a56dfaed1c4ddc61 (diff) |
V4L/DVB (4872): Saa7134-alsa improvements
The change does the following:
- At device open, it sets the recording source to the current
input instead of LINE2. So it is no longer necessary to set the
recording source with a mixer application.
- Connects the mixer volume control to the input sensitivity selection
of the analog sound inputs. This allows only one 6db step.
Signed-off-by: Hartmut Hackmann <hartmut.hackmann@t-online.de>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
Diffstat (limited to 'drivers/media/video/saa7134')
-rw-r--r-- | drivers/media/video/saa7134/saa7134-alsa.c | 63 |
1 files changed, 54 insertions, 9 deletions
diff --git a/drivers/media/video/saa7134/saa7134-alsa.c b/drivers/media/video/saa7134/saa7134-alsa.c index 4abf5c03a740..ffb0f647a86d 100644 --- a/drivers/media/video/saa7134/saa7134-alsa.c +++ b/drivers/media/video/saa7134/saa7134-alsa.c | |||
@@ -1,10 +1,6 @@ | |||
1 | /* | 1 | /* |
2 | * SAA713x ALSA support for V4L | 2 | * SAA713x ALSA support for V4L |
3 | * | 3 | * |
4 | * | ||
5 | * Caveats: | ||
6 | * - Volume doesn't work (it's always at max) | ||
7 | * | ||
8 | * This program is free software; you can redistribute it and/or modify | 4 | * This program is free software; you can redistribute it and/or modify |
9 | * it under the terms of the GNU General Public License as published by | 5 | * it under the terms of the GNU General Public License as published by |
10 | * the Free Software Foundation, version 2 | 6 | * the Free Software Foundation, version 2 |
@@ -614,13 +610,18 @@ static int snd_card_saa7134_capture_open(struct snd_pcm_substream * substream) | |||
614 | snd_card_saa7134_pcm_t *pcm; | 610 | snd_card_saa7134_pcm_t *pcm; |
615 | snd_card_saa7134_t *saa7134 = snd_pcm_substream_chip(substream); | 611 | snd_card_saa7134_t *saa7134 = snd_pcm_substream_chip(substream); |
616 | struct saa7134_dev *dev = saa7134->dev; | 612 | struct saa7134_dev *dev = saa7134->dev; |
617 | int err; | 613 | int amux, err; |
618 | 614 | ||
619 | mutex_lock(&dev->dmasound.lock); | 615 | mutex_lock(&dev->dmasound.lock); |
620 | 616 | ||
621 | dev->dmasound.read_count = 0; | 617 | dev->dmasound.read_count = 0; |
622 | dev->dmasound.read_offset = 0; | 618 | dev->dmasound.read_offset = 0; |
623 | 619 | ||
620 | amux = dev->input->amux; | ||
621 | if ((amux < 1) || (amux > 3)) | ||
622 | amux = 1; | ||
623 | dev->dmasound.input = amux - 1; | ||
624 | |||
624 | mutex_unlock(&dev->dmasound.lock); | 625 | mutex_unlock(&dev->dmasound.lock); |
625 | 626 | ||
626 | pcm = kzalloc(sizeof(*pcm), GFP_KERNEL); | 627 | pcm = kzalloc(sizeof(*pcm), GFP_KERNEL); |
@@ -713,6 +714,8 @@ static int snd_saa7134_volume_put(struct snd_kcontrol * kcontrol, | |||
713 | struct snd_ctl_elem_value * ucontrol) | 714 | struct snd_ctl_elem_value * ucontrol) |
714 | { | 715 | { |
715 | snd_card_saa7134_t *chip = snd_kcontrol_chip(kcontrol); | 716 | snd_card_saa7134_t *chip = snd_kcontrol_chip(kcontrol); |
717 | struct saa7134_dev *dev = chip->dev; | ||
718 | |||
716 | int change, addr = kcontrol->private_value; | 719 | int change, addr = kcontrol->private_value; |
717 | int left, right; | 720 | int left, right; |
718 | 721 | ||
@@ -727,10 +730,52 @@ static int snd_saa7134_volume_put(struct snd_kcontrol * kcontrol, | |||
727 | if (right > 20) | 730 | if (right > 20) |
728 | right = 20; | 731 | right = 20; |
729 | spin_lock_irq(&chip->mixer_lock); | 732 | spin_lock_irq(&chip->mixer_lock); |
730 | change = chip->mixer_volume[addr][0] != left || | 733 | change = 0; |
731 | chip->mixer_volume[addr][1] != right; | 734 | if (chip->mixer_volume[addr][0] != left) { |
732 | chip->mixer_volume[addr][0] = left; | 735 | change = 1; |
733 | chip->mixer_volume[addr][1] = right; | 736 | right = left; |
737 | } | ||
738 | if (chip->mixer_volume[addr][1] != right) { | ||
739 | change = 1; | ||
740 | left = right; | ||
741 | } | ||
742 | if (change) { | ||
743 | switch (dev->pci->device) { | ||
744 | case PCI_DEVICE_ID_PHILIPS_SAA7134: | ||
745 | switch (addr) { | ||
746 | case MIXER_ADDR_TVTUNER: | ||
747 | left = 20; | ||
748 | break; | ||
749 | case MIXER_ADDR_LINE1: | ||
750 | saa_andorb(SAA7134_ANALOG_IO_SELECT, 0x10, | ||
751 | (left > 10) ? 0x00 : 0x10); | ||
752 | break; | ||
753 | case MIXER_ADDR_LINE2: | ||
754 | saa_andorb(SAA7134_ANALOG_IO_SELECT, 0x20, | ||
755 | (left > 10) ? 0x00 : 0x20); | ||
756 | break; | ||
757 | } | ||
758 | break; | ||
759 | case PCI_DEVICE_ID_PHILIPS_SAA7133: | ||
760 | case PCI_DEVICE_ID_PHILIPS_SAA7135: | ||
761 | switch (addr) { | ||
762 | case MIXER_ADDR_TVTUNER: | ||
763 | left = 20; | ||
764 | break; | ||
765 | case MIXER_ADDR_LINE1: | ||
766 | saa_andorb(0x0594, 0x10, | ||
767 | (left > 10) ? 0x00 : 0x10); | ||
768 | break; | ||
769 | case MIXER_ADDR_LINE2: | ||
770 | saa_andorb(0x0594, 0x20, | ||
771 | (left > 10) ? 0x00 : 0x20); | ||
772 | break; | ||
773 | } | ||
774 | break; | ||
775 | } | ||
776 | chip->mixer_volume[addr][0] = left; | ||
777 | chip->mixer_volume[addr][1] = right; | ||
778 | } | ||
734 | spin_unlock_irq(&chip->mixer_lock); | 779 | spin_unlock_irq(&chip->mixer_lock); |
735 | return change; | 780 | return change; |
736 | } | 781 | } |