Commit 902b05c1 authored by Clemens Ladisch's avatar Clemens Ladisch Committed by Linus Torvalds

[ALSA] oxygen: fix line-in recording selection

The GPIO pin 0 of the CM9780 must be set when muting the line input even
on non-Xonar cards.
Signed-off-by: default avatarClemens Ladisch <clemens@ladisch.de>
Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent cbef9789
...@@ -28,7 +28,9 @@ ...@@ -28,7 +28,9 @@
* GPIO 1 -> DFS1 of AK5385 * GPIO 1 -> DFS1 of AK5385
*/ */
#include <linux/mutex.h>
#include <linux/pci.h> #include <linux/pci.h>
#include <sound/ac97_codec.h>
#include <sound/control.h> #include <sound/control.h>
#include <sound/core.h> #include <sound/core.h>
#include <sound/initval.h> #include <sound/initval.h>
...@@ -37,6 +39,7 @@ ...@@ -37,6 +39,7 @@
#include <sound/tlv.h> #include <sound/tlv.h>
#include "oxygen.h" #include "oxygen.h"
#include "ak4396.h" #include "ak4396.h"
#include "cm9780.h"
MODULE_AUTHOR("Clemens Ladisch <clemens@ladisch.de>"); MODULE_AUTHOR("Clemens Ladisch <clemens@ladisch.de>");
MODULE_DESCRIPTION("C-Media CMI8788 driver"); MODULE_DESCRIPTION("C-Media CMI8788 driver");
...@@ -75,6 +78,8 @@ MODULE_DEVICE_TABLE(pci, oxygen_ids); ...@@ -75,6 +78,8 @@ MODULE_DEVICE_TABLE(pci, oxygen_ids);
#define GPIO_AK5385_DFS_DOUBLE 0x0001 #define GPIO_AK5385_DFS_DOUBLE 0x0001
#define GPIO_AK5385_DFS_QUAD 0x0002 #define GPIO_AK5385_DFS_QUAD 0x0002
#define GPIO_LINE_MUTE CM9780_GPO0
#define WM8785_R0 0 #define WM8785_R0 0
#define WM8785_R1 1 #define WM8785_R1 1
#define WM8785_R2 2 #define WM8785_R2 2
...@@ -180,16 +185,23 @@ static void wm8785_init(struct oxygen *chip) ...@@ -180,16 +185,23 @@ static void wm8785_init(struct oxygen *chip)
snd_component_add(chip->card, "WM8785"); snd_component_add(chip->card, "WM8785");
} }
static void cmi9780_init(struct oxygen *chip)
{
oxygen_ac97_clear_bits(chip, 0, CM9780_GPIO_STATUS, GPIO_LINE_MUTE);
}
static void generic_init(struct oxygen *chip) static void generic_init(struct oxygen *chip)
{ {
ak4396_init(chip); ak4396_init(chip);
wm8785_init(chip); wm8785_init(chip);
cmi9780_init(chip);
} }
static void meridian_init(struct oxygen *chip) static void meridian_init(struct oxygen *chip)
{ {
ak4396_init(chip); ak4396_init(chip);
ak5385_init(chip); ak5385_init(chip);
cmi9780_init(chip);
} }
static void generic_cleanup(struct oxygen *chip) static void generic_cleanup(struct oxygen *chip)
...@@ -285,6 +297,27 @@ static void set_ak5385_params(struct oxygen *chip, ...@@ -285,6 +297,27 @@ static void set_ak5385_params(struct oxygen *chip,
value, GPIO_AK5385_DFS_MASK); value, GPIO_AK5385_DFS_MASK);
} }
static void cmi9780_switch_hook(struct oxygen *chip, unsigned int codec,
unsigned int reg, int mute)
{
if (codec != 0)
return;
switch (reg) {
case AC97_LINE:
oxygen_write_ac97_masked(chip, 0, CM9780_GPIO_STATUS,
mute ? GPIO_LINE_MUTE : 0,
GPIO_LINE_MUTE);
break;
case AC97_MIC:
case AC97_CD:
case AC97_AUX:
if (!mute)
oxygen_ac97_set_bits(chip, 0, CM9780_GPIO_STATUS,
GPIO_LINE_MUTE);
break;
}
}
static const DECLARE_TLV_DB_LINEAR(ak4396_db_scale, TLV_DB_GAIN_MUTE, 0); static const DECLARE_TLV_DB_LINEAR(ak4396_db_scale, TLV_DB_GAIN_MUTE, 0);
static int ak4396_control_filter(struct snd_kcontrol_new *template) static int ak4396_control_filter(struct snd_kcontrol_new *template)
...@@ -308,6 +341,7 @@ static const struct oxygen_model model_generic = { ...@@ -308,6 +341,7 @@ static const struct oxygen_model model_generic = {
.set_adc_params = set_wm8785_params, .set_adc_params = set_wm8785_params,
.update_dac_volume = update_ak4396_volume, .update_dac_volume = update_ak4396_volume,
.update_dac_mute = update_ak4396_mute, .update_dac_mute = update_ak4396_mute,
.ac97_switch_hook = cmi9780_switch_hook,
.model_data_size = sizeof(struct generic_data), .model_data_size = sizeof(struct generic_data),
.dac_channels = 8, .dac_channels = 8,
.used_channels = OXYGEN_CHANNEL_A | .used_channels = OXYGEN_CHANNEL_A |
...@@ -331,6 +365,7 @@ static const struct oxygen_model model_meridian = { ...@@ -331,6 +365,7 @@ static const struct oxygen_model model_meridian = {
.set_adc_params = set_ak5385_params, .set_adc_params = set_ak5385_params,
.update_dac_volume = update_ak4396_volume, .update_dac_volume = update_ak4396_volume,
.update_dac_mute = update_ak4396_mute, .update_dac_mute = update_ak4396_mute,
.ac97_switch_hook = cmi9780_switch_hook,
.model_data_size = sizeof(struct generic_data), .model_data_size = sizeof(struct generic_data),
.dac_channels = 8, .dac_channels = 8,
.used_channels = OXYGEN_CHANNEL_B | .used_channels = OXYGEN_CHANNEL_B |
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment