diff options
author | Clemens Ladisch <clemens@ladisch.de> | 2008-02-22 12:40:56 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2008-02-22 17:20:08 -0500 |
commit | 902b05c117c33c50075b21c293bf60958dedb92d (patch) | |
tree | b4d7c9eec87eac8d72a6786d8b7be98ea6ab3b6b /sound/pci/oxygen/oxygen.c | |
parent | cbef97892e0c545575342332d0d84a910ca4c587 (diff) |
[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: Clemens Ladisch <clemens@ladisch.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'sound/pci/oxygen/oxygen.c')
-rw-r--r-- | sound/pci/oxygen/oxygen.c | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/sound/pci/oxygen/oxygen.c b/sound/pci/oxygen/oxygen.c index f31a0eb409b0..9a9941bb0460 100644 --- a/sound/pci/oxygen/oxygen.c +++ b/sound/pci/oxygen/oxygen.c | |||
@@ -28,7 +28,9 @@ | |||
28 | * GPIO 1 -> DFS1 of AK5385 | 28 | * GPIO 1 -> DFS1 of AK5385 |
29 | */ | 29 | */ |
30 | 30 | ||
31 | #include <linux/mutex.h> | ||
31 | #include <linux/pci.h> | 32 | #include <linux/pci.h> |
33 | #include <sound/ac97_codec.h> | ||
32 | #include <sound/control.h> | 34 | #include <sound/control.h> |
33 | #include <sound/core.h> | 35 | #include <sound/core.h> |
34 | #include <sound/initval.h> | 36 | #include <sound/initval.h> |
@@ -37,6 +39,7 @@ | |||
37 | #include <sound/tlv.h> | 39 | #include <sound/tlv.h> |
38 | #include "oxygen.h" | 40 | #include "oxygen.h" |
39 | #include "ak4396.h" | 41 | #include "ak4396.h" |
42 | #include "cm9780.h" | ||
40 | 43 | ||
41 | MODULE_AUTHOR("Clemens Ladisch <clemens@ladisch.de>"); | 44 | MODULE_AUTHOR("Clemens Ladisch <clemens@ladisch.de>"); |
42 | MODULE_DESCRIPTION("C-Media CMI8788 driver"); | 45 | MODULE_DESCRIPTION("C-Media CMI8788 driver"); |
@@ -75,6 +78,8 @@ MODULE_DEVICE_TABLE(pci, oxygen_ids); | |||
75 | #define GPIO_AK5385_DFS_DOUBLE 0x0001 | 78 | #define GPIO_AK5385_DFS_DOUBLE 0x0001 |
76 | #define GPIO_AK5385_DFS_QUAD 0x0002 | 79 | #define GPIO_AK5385_DFS_QUAD 0x0002 |
77 | 80 | ||
81 | #define GPIO_LINE_MUTE CM9780_GPO0 | ||
82 | |||
78 | #define WM8785_R0 0 | 83 | #define WM8785_R0 0 |
79 | #define WM8785_R1 1 | 84 | #define WM8785_R1 1 |
80 | #define WM8785_R2 2 | 85 | #define WM8785_R2 2 |
@@ -180,16 +185,23 @@ static void wm8785_init(struct oxygen *chip) | |||
180 | snd_component_add(chip->card, "WM8785"); | 185 | snd_component_add(chip->card, "WM8785"); |
181 | } | 186 | } |
182 | 187 | ||
188 | static void cmi9780_init(struct oxygen *chip) | ||
189 | { | ||
190 | oxygen_ac97_clear_bits(chip, 0, CM9780_GPIO_STATUS, GPIO_LINE_MUTE); | ||
191 | } | ||
192 | |||
183 | static void generic_init(struct oxygen *chip) | 193 | static void generic_init(struct oxygen *chip) |
184 | { | 194 | { |
185 | ak4396_init(chip); | 195 | ak4396_init(chip); |
186 | wm8785_init(chip); | 196 | wm8785_init(chip); |
197 | cmi9780_init(chip); | ||
187 | } | 198 | } |
188 | 199 | ||
189 | static void meridian_init(struct oxygen *chip) | 200 | static void meridian_init(struct oxygen *chip) |
190 | { | 201 | { |
191 | ak4396_init(chip); | 202 | ak4396_init(chip); |
192 | ak5385_init(chip); | 203 | ak5385_init(chip); |
204 | cmi9780_init(chip); | ||
193 | } | 205 | } |
194 | 206 | ||
195 | static void generic_cleanup(struct oxygen *chip) | 207 | static void generic_cleanup(struct oxygen *chip) |
@@ -285,6 +297,27 @@ static void set_ak5385_params(struct oxygen *chip, | |||
285 | value, GPIO_AK5385_DFS_MASK); | 297 | value, GPIO_AK5385_DFS_MASK); |
286 | } | 298 | } |
287 | 299 | ||
300 | static void cmi9780_switch_hook(struct oxygen *chip, unsigned int codec, | ||
301 | unsigned int reg, int mute) | ||
302 | { | ||
303 | if (codec != 0) | ||
304 | return; | ||
305 | switch (reg) { | ||
306 | case AC97_LINE: | ||
307 | oxygen_write_ac97_masked(chip, 0, CM9780_GPIO_STATUS, | ||
308 | mute ? GPIO_LINE_MUTE : 0, | ||
309 | GPIO_LINE_MUTE); | ||
310 | break; | ||
311 | case AC97_MIC: | ||
312 | case AC97_CD: | ||
313 | case AC97_AUX: | ||
314 | if (!mute) | ||
315 | oxygen_ac97_set_bits(chip, 0, CM9780_GPIO_STATUS, | ||
316 | GPIO_LINE_MUTE); | ||
317 | break; | ||
318 | } | ||
319 | } | ||
320 | |||
288 | static const DECLARE_TLV_DB_LINEAR(ak4396_db_scale, TLV_DB_GAIN_MUTE, 0); | 321 | static const DECLARE_TLV_DB_LINEAR(ak4396_db_scale, TLV_DB_GAIN_MUTE, 0); |
289 | 322 | ||
290 | static int ak4396_control_filter(struct snd_kcontrol_new *template) | 323 | static int ak4396_control_filter(struct snd_kcontrol_new *template) |
@@ -308,6 +341,7 @@ static const struct oxygen_model model_generic = { | |||
308 | .set_adc_params = set_wm8785_params, | 341 | .set_adc_params = set_wm8785_params, |
309 | .update_dac_volume = update_ak4396_volume, | 342 | .update_dac_volume = update_ak4396_volume, |
310 | .update_dac_mute = update_ak4396_mute, | 343 | .update_dac_mute = update_ak4396_mute, |
344 | .ac97_switch_hook = cmi9780_switch_hook, | ||
311 | .model_data_size = sizeof(struct generic_data), | 345 | .model_data_size = sizeof(struct generic_data), |
312 | .dac_channels = 8, | 346 | .dac_channels = 8, |
313 | .used_channels = OXYGEN_CHANNEL_A | | 347 | .used_channels = OXYGEN_CHANNEL_A | |
@@ -331,6 +365,7 @@ static const struct oxygen_model model_meridian = { | |||
331 | .set_adc_params = set_ak5385_params, | 365 | .set_adc_params = set_ak5385_params, |
332 | .update_dac_volume = update_ak4396_volume, | 366 | .update_dac_volume = update_ak4396_volume, |
333 | .update_dac_mute = update_ak4396_mute, | 367 | .update_dac_mute = update_ak4396_mute, |
368 | .ac97_switch_hook = cmi9780_switch_hook, | ||
334 | .model_data_size = sizeof(struct generic_data), | 369 | .model_data_size = sizeof(struct generic_data), |
335 | .dac_channels = 8, | 370 | .dac_channels = 8, |
336 | .used_channels = OXYGEN_CHANNEL_B | | 371 | .used_channels = OXYGEN_CHANNEL_B | |