aboutsummaryrefslogtreecommitdiffstats
path: root/sound/pci/oxygen/oxygen_mixer.c
diff options
context:
space:
mode:
authorClemens Ladisch <clemens@ladisch.de>2008-04-01 10:02:18 +0200
committerTakashi Iwai <tiwai@suse.de>2008-04-24 12:00:30 +0200
commite97f79994ac715e4c8724b201bd3328463ec9314 (patch)
treea8cc01dc674185458964ee4636fabce8e71d3726 /sound/pci/oxygen/oxygen_mixer.c
parent0c4cc4430f40089bb85557e309038faa458247f1 (diff)
downloadkernel_samsung_smdk4412-e97f79994ac715e4c8724b201bd3328463ec9314.zip
kernel_samsung_smdk4412-e97f79994ac715e4c8724b201bd3328463ec9314.tar.gz
kernel_samsung_smdk4412-e97f79994ac715e4c8724b201bd3328463ec9314.tar.bz2
[ALSA] oxygen: fix line-in recording selection (now for real)
On C-Media cards, the GPIO pin 0 of the CM9780 must be handled exactly like on Xonar cards, so move the Xonar code to the common mixer code. Signed-off-by: Clemens Ladisch <clemens@ladisch.de> Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/pci/oxygen/oxygen_mixer.c')
-rw-r--r--sound/pci/oxygen/oxygen_mixer.c33
1 files changed, 29 insertions, 4 deletions
diff --git a/sound/pci/oxygen/oxygen_mixer.c b/sound/pci/oxygen/oxygen_mixer.c
index 6b5ff6e..9a7c880 100644
--- a/sound/pci/oxygen/oxygen_mixer.c
+++ b/sound/pci/oxygen/oxygen_mixer.c
@@ -510,6 +510,19 @@ static int ac97_switch_get(struct snd_kcontrol *ctl,
return 0;
}
+static void mute_ac97_ctl(struct oxygen *chip, unsigned int control)
+{
+ unsigned int priv_idx = chip->controls[control]->private_value & 0xff;
+ u16 value;
+
+ value = oxygen_read_ac97(chip, 0, priv_idx);
+ if (!(value & 0x8000)) {
+ oxygen_write_ac97(chip, 0, priv_idx, value | 0x8000);
+ snd_ctl_notify(chip->card, SNDRV_CTL_EVENT_MASK_VALUE,
+ &chip->controls[control]->id);
+ }
+}
+
static int ac97_switch_put(struct snd_kcontrol *ctl,
struct snd_ctl_elem_value *value)
{
@@ -531,9 +544,22 @@ static int ac97_switch_put(struct snd_kcontrol *ctl,
change = newreg != oldreg;
if (change) {
oxygen_write_ac97(chip, codec, index, newreg);
- if (bitnr == 15 && chip->model->ac97_switch_hook)
- chip->model->ac97_switch_hook(chip, codec, index,
- newreg & 0x8000);
+ if (index == AC97_LINE) {
+ oxygen_write_ac97_masked(chip, 0, CM9780_GPIO_STATUS,
+ newreg & 0x8000 ?
+ CM9780_GPO0 : 0, CM9780_GPO0);
+ if (!(newreg & 0x8000)) {
+ mute_ac97_ctl(chip, CONTROL_MIC_CAPTURE_SWITCH);
+ mute_ac97_ctl(chip, CONTROL_CD_CAPTURE_SWITCH);
+ mute_ac97_ctl(chip, CONTROL_AUX_CAPTURE_SWITCH);
+ }
+ } else if ((index == AC97_MIC || index == AC97_CD ||
+ index == AC97_VIDEO || index == AC97_AUX) &&
+ bitnr == 15 && !(newreg & 0x8000)) {
+ mute_ac97_ctl(chip, CONTROL_LINE_CAPTURE_SWITCH);
+ oxygen_write_ac97_masked(chip, 0, CM9780_GPIO_STATUS,
+ CM9780_GPO0, CM9780_GPO0);
+ }
}
mutex_unlock(&chip->mutex);
return change;
@@ -849,7 +875,6 @@ static const struct snd_kcontrol_new ac97_controls[] = {
AC97_VOLUME("Mic Capture Volume", 0, AC97_MIC),
AC97_SWITCH("Mic Capture Switch", 0, AC97_MIC, 15, 1),
AC97_SWITCH("Mic Boost (+20dB)", 0, AC97_MIC, 6, 0),
- AC97_VOLUME("Line Capture Volume", 0, AC97_LINE),
AC97_SWITCH("Line Capture Switch", 0, AC97_LINE, 15, 1),
AC97_VOLUME("CD Capture Volume", 0, AC97_CD),
AC97_SWITCH("CD Capture Switch", 0, AC97_CD, 15, 1),