aboutsummaryrefslogtreecommitdiffstats
path: root/sound/pci
diff options
context:
space:
mode:
Diffstat (limited to 'sound/pci')
-rw-r--r--sound/pci/oxygen/oxygen.c33
-rw-r--r--sound/pci/oxygen/oxygen.h2
-rw-r--r--sound/pci/oxygen/oxygen_lib.c2
-rw-r--r--sound/pci/oxygen/oxygen_mixer.c33
-rw-r--r--sound/pci/oxygen/virtuoso.c53
5 files changed, 31 insertions, 92 deletions
diff --git a/sound/pci/oxygen/oxygen.c b/sound/pci/oxygen/oxygen.c
index 511ef34a43ca..b3b7771b54c0 100644
--- a/sound/pci/oxygen/oxygen.c
+++ b/sound/pci/oxygen/oxygen.c
@@ -39,7 +39,6 @@
39#include <sound/tlv.h> 39#include <sound/tlv.h>
40#include "oxygen.h" 40#include "oxygen.h"
41#include "ak4396.h" 41#include "ak4396.h"
42#include "cm9780.h"
43#include "wm8785.h" 42#include "wm8785.h"
44 43
45MODULE_AUTHOR("Clemens Ladisch <clemens@ladisch.de>"); 44MODULE_AUTHOR("Clemens Ladisch <clemens@ladisch.de>");
@@ -79,8 +78,6 @@ MODULE_DEVICE_TABLE(pci, oxygen_ids);
79#define GPIO_AK5385_DFS_DOUBLE 0x0001 78#define GPIO_AK5385_DFS_DOUBLE 0x0001
80#define GPIO_AK5385_DFS_QUAD 0x0002 79#define GPIO_AK5385_DFS_QUAD 0x0002
81 80
82#define GPIO_LINE_MUTE CM9780_GPO0
83
84struct generic_data { 81struct generic_data {
85 u8 ak4396_ctl2; 82 u8 ak4396_ctl2;
86}; 83};
@@ -145,23 +142,16 @@ static void wm8785_init(struct oxygen *chip)
145 snd_component_add(chip->card, "WM8785"); 142 snd_component_add(chip->card, "WM8785");
146} 143}
147 144
148static void cmi9780_init(struct oxygen *chip)
149{
150 oxygen_ac97_clear_bits(chip, 0, CM9780_GPIO_STATUS, GPIO_LINE_MUTE);
151}
152
153static void generic_init(struct oxygen *chip) 145static void generic_init(struct oxygen *chip)
154{ 146{
155 ak4396_init(chip); 147 ak4396_init(chip);
156 wm8785_init(chip); 148 wm8785_init(chip);
157 cmi9780_init(chip);
158} 149}
159 150
160static void meridian_init(struct oxygen *chip) 151static void meridian_init(struct oxygen *chip)
161{ 152{
162 ak4396_init(chip); 153 ak4396_init(chip);
163 ak5385_init(chip); 154 ak5385_init(chip);
164 cmi9780_init(chip);
165} 155}
166 156
167static void generic_cleanup(struct oxygen *chip) 157static void generic_cleanup(struct oxygen *chip)
@@ -257,27 +247,6 @@ static void set_ak5385_params(struct oxygen *chip,
257 value, GPIO_AK5385_DFS_MASK); 247 value, GPIO_AK5385_DFS_MASK);
258} 248}
259 249
260static void cmi9780_switch_hook(struct oxygen *chip, unsigned int codec,
261 unsigned int reg, int mute)
262{
263 if (codec != 0)
264 return;
265 switch (reg) {
266 case AC97_LINE:
267 oxygen_write_ac97_masked(chip, 0, CM9780_GPIO_STATUS,
268 mute ? GPIO_LINE_MUTE : 0,
269 GPIO_LINE_MUTE);
270 break;
271 case AC97_MIC:
272 case AC97_CD:
273 case AC97_AUX:
274 if (!mute)
275 oxygen_ac97_set_bits(chip, 0, CM9780_GPIO_STATUS,
276 GPIO_LINE_MUTE);
277 break;
278 }
279}
280
281static const DECLARE_TLV_DB_LINEAR(ak4396_db_scale, TLV_DB_GAIN_MUTE, 0); 250static const DECLARE_TLV_DB_LINEAR(ak4396_db_scale, TLV_DB_GAIN_MUTE, 0);
282 251
283static int ak4396_control_filter(struct snd_kcontrol_new *template) 252static int ak4396_control_filter(struct snd_kcontrol_new *template)
@@ -301,7 +270,6 @@ static const struct oxygen_model model_generic = {
301 .set_adc_params = set_wm8785_params, 270 .set_adc_params = set_wm8785_params,
302 .update_dac_volume = update_ak4396_volume, 271 .update_dac_volume = update_ak4396_volume,
303 .update_dac_mute = update_ak4396_mute, 272 .update_dac_mute = update_ak4396_mute,
304 .ac97_switch_hook = cmi9780_switch_hook,
305 .model_data_size = sizeof(struct generic_data), 273 .model_data_size = sizeof(struct generic_data),
306 .pcm_dev_cfg = PLAYBACK_0_TO_I2S | 274 .pcm_dev_cfg = PLAYBACK_0_TO_I2S |
307 PLAYBACK_1_TO_SPDIF | 275 PLAYBACK_1_TO_SPDIF |
@@ -327,7 +295,6 @@ static const struct oxygen_model model_meridian = {
327 .set_adc_params = set_ak5385_params, 295 .set_adc_params = set_ak5385_params,
328 .update_dac_volume = update_ak4396_volume, 296 .update_dac_volume = update_ak4396_volume,
329 .update_dac_mute = update_ak4396_mute, 297 .update_dac_mute = update_ak4396_mute,
330 .ac97_switch_hook = cmi9780_switch_hook,
331 .model_data_size = sizeof(struct generic_data), 298 .model_data_size = sizeof(struct generic_data),
332 .pcm_dev_cfg = PLAYBACK_0_TO_I2S | 299 .pcm_dev_cfg = PLAYBACK_0_TO_I2S |
333 PLAYBACK_1_TO_SPDIF | 300 PLAYBACK_1_TO_SPDIF |
diff --git a/sound/pci/oxygen/oxygen.h b/sound/pci/oxygen/oxygen.h
index 5103482f65e4..2f25c8dbaf85 100644
--- a/sound/pci/oxygen/oxygen.h
+++ b/sound/pci/oxygen/oxygen.h
@@ -97,8 +97,6 @@ struct oxygen_model {
97 struct snd_pcm_hw_params *params); 97 struct snd_pcm_hw_params *params);
98 void (*update_dac_volume)(struct oxygen *chip); 98 void (*update_dac_volume)(struct oxygen *chip);
99 void (*update_dac_mute)(struct oxygen *chip); 99 void (*update_dac_mute)(struct oxygen *chip);
100 void (*ac97_switch_hook)(struct oxygen *chip, unsigned int codec,
101 unsigned int reg, int mute);
102 void (*gpio_changed)(struct oxygen *chip); 100 void (*gpio_changed)(struct oxygen *chip);
103 size_t model_data_size; 101 size_t model_data_size;
104 unsigned int pcm_dev_cfg; 102 unsigned int pcm_dev_cfg;
diff --git a/sound/pci/oxygen/oxygen_lib.c b/sound/pci/oxygen/oxygen_lib.c
index 858e6d4c9194..4f3d9e5fc5db 100644
--- a/sound/pci/oxygen/oxygen_lib.c
+++ b/sound/pci/oxygen/oxygen_lib.c
@@ -360,6 +360,8 @@ static void oxygen_init(struct oxygen *chip)
360 oxygen_write_ac97(chip, 0, AC97_REC_GAIN, 0x8000); 360 oxygen_write_ac97(chip, 0, AC97_REC_GAIN, 0x8000);
361 oxygen_write_ac97(chip, 0, AC97_CENTER_LFE_MASTER, 0x8080); 361 oxygen_write_ac97(chip, 0, AC97_CENTER_LFE_MASTER, 0x8080);
362 oxygen_write_ac97(chip, 0, AC97_SURROUND_MASTER, 0x8080); 362 oxygen_write_ac97(chip, 0, AC97_SURROUND_MASTER, 0x8080);
363 oxygen_ac97_clear_bits(chip, 0, CM9780_GPIO_STATUS,
364 CM9780_GPO0);
363 /* power down unused ADCs and DACs */ 365 /* power down unused ADCs and DACs */
364 oxygen_ac97_set_bits(chip, 0, AC97_POWERDOWN, 366 oxygen_ac97_set_bits(chip, 0, AC97_POWERDOWN,
365 AC97_PD_PR0 | AC97_PD_PR1); 367 AC97_PD_PR0 | AC97_PD_PR1);
diff --git a/sound/pci/oxygen/oxygen_mixer.c b/sound/pci/oxygen/oxygen_mixer.c
index 6b5ff6e0fadd..9a7c880eddbd 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,
510 return 0; 510 return 0;
511} 511}
512 512
513static void mute_ac97_ctl(struct oxygen *chip, unsigned int control)
514{
515 unsigned int priv_idx = chip->controls[control]->private_value & 0xff;
516 u16 value;
517
518 value = oxygen_read_ac97(chip, 0, priv_idx);
519 if (!(value & 0x8000)) {
520 oxygen_write_ac97(chip, 0, priv_idx, value | 0x8000);
521 snd_ctl_notify(chip->card, SNDRV_CTL_EVENT_MASK_VALUE,
522 &chip->controls[control]->id);
523 }
524}
525
513static int ac97_switch_put(struct snd_kcontrol *ctl, 526static int ac97_switch_put(struct snd_kcontrol *ctl,
514 struct snd_ctl_elem_value *value) 527 struct snd_ctl_elem_value *value)
515{ 528{
@@ -531,9 +544,22 @@ static int ac97_switch_put(struct snd_kcontrol *ctl,
531 change = newreg != oldreg; 544 change = newreg != oldreg;
532 if (change) { 545 if (change) {
533 oxygen_write_ac97(chip, codec, index, newreg); 546 oxygen_write_ac97(chip, codec, index, newreg);
534 if (bitnr == 15 && chip->model->ac97_switch_hook) 547 if (index == AC97_LINE) {
535 chip->model->ac97_switch_hook(chip, codec, index, 548 oxygen_write_ac97_masked(chip, 0, CM9780_GPIO_STATUS,
536 newreg & 0x8000); 549 newreg & 0x8000 ?
550 CM9780_GPO0 : 0, CM9780_GPO0);
551 if (!(newreg & 0x8000)) {
552 mute_ac97_ctl(chip, CONTROL_MIC_CAPTURE_SWITCH);
553 mute_ac97_ctl(chip, CONTROL_CD_CAPTURE_SWITCH);
554 mute_ac97_ctl(chip, CONTROL_AUX_CAPTURE_SWITCH);
555 }
556 } else if ((index == AC97_MIC || index == AC97_CD ||
557 index == AC97_VIDEO || index == AC97_AUX) &&
558 bitnr == 15 && !(newreg & 0x8000)) {
559 mute_ac97_ctl(chip, CONTROL_LINE_CAPTURE_SWITCH);
560 oxygen_write_ac97_masked(chip, 0, CM9780_GPIO_STATUS,
561 CM9780_GPO0, CM9780_GPO0);
562 }
537 } 563 }
538 mutex_unlock(&chip->mutex); 564 mutex_unlock(&chip->mutex);
539 return change; 565 return change;
@@ -849,7 +875,6 @@ static const struct snd_kcontrol_new ac97_controls[] = {
849 AC97_VOLUME("Mic Capture Volume", 0, AC97_MIC), 875 AC97_VOLUME("Mic Capture Volume", 0, AC97_MIC),
850 AC97_SWITCH("Mic Capture Switch", 0, AC97_MIC, 15, 1), 876 AC97_SWITCH("Mic Capture Switch", 0, AC97_MIC, 15, 1),
851 AC97_SWITCH("Mic Boost (+20dB)", 0, AC97_MIC, 6, 0), 877 AC97_SWITCH("Mic Boost (+20dB)", 0, AC97_MIC, 6, 0),
852 AC97_VOLUME("Line Capture Volume", 0, AC97_LINE),
853 AC97_SWITCH("Line Capture Switch", 0, AC97_LINE, 15, 1), 878 AC97_SWITCH("Line Capture Switch", 0, AC97_LINE, 15, 1),
854 AC97_VOLUME("CD Capture Volume", 0, AC97_CD), 879 AC97_VOLUME("CD Capture Volume", 0, AC97_CD),
855 AC97_SWITCH("CD Capture Switch", 0, AC97_CD, 15, 1), 880 AC97_SWITCH("CD Capture Switch", 0, AC97_CD, 15, 1),
diff --git a/sound/pci/oxygen/virtuoso.c b/sound/pci/oxygen/virtuoso.c
index fa79db696e2d..2c3daf3ae4c3 100644
--- a/sound/pci/oxygen/virtuoso.c
+++ b/sound/pci/oxygen/virtuoso.c
@@ -30,10 +30,6 @@
30 * GPIO 5 <- external power present (D2X only) 30 * GPIO 5 <- external power present (D2X only)
31 * GPIO 7 -> ALT 31 * GPIO 7 -> ALT
32 * GPIO 8 -> enable output to speakers 32 * GPIO 8 -> enable output to speakers
33 *
34 * CM9780:
35 *
36 * GPIO 0 -> enable AC'97 bypass (line in -> ADC)
37 */ 33 */
38 34
39#include <linux/pci.h> 35#include <linux/pci.h>
@@ -81,8 +77,6 @@ MODULE_DEVICE_TABLE(pci, xonar_ids);
81#define GPIO_ALT 0x0080 77#define GPIO_ALT 0x0080
82#define GPIO_OUTPUT_ENABLE 0x0100 78#define GPIO_OUTPUT_ENABLE 0x0100
83 79
84#define GPIO_LINE_MUTE CM9780_GPO0
85
86struct xonar_data { 80struct xonar_data {
87 u8 is_d2x; 81 u8 is_d2x;
88 u8 has_power; 82 u8 has_power;
@@ -134,7 +128,6 @@ static void xonar_init(struct oxygen *chip)
134 & GPIO_EXT_POWER); 128 & GPIO_EXT_POWER);
135 } 129 }
136 oxygen_ac97_set_bits(chip, 0, CM9780_JACK, CM9780_FMIC2MIC); 130 oxygen_ac97_set_bits(chip, 0, CM9780_JACK, CM9780_FMIC2MIC);
137 oxygen_ac97_clear_bits(chip, 0, CM9780_GPIO_STATUS, GPIO_LINE_MUTE);
138 msleep(300); 131 msleep(300);
139 oxygen_set_bits16(chip, OXYGEN_GPIO_CONTROL, GPIO_OUTPUT_ENABLE); 132 oxygen_set_bits16(chip, OXYGEN_GPIO_CONTROL, GPIO_OUTPUT_ENABLE);
140 oxygen_set_bits16(chip, OXYGEN_GPIO_DATA, GPIO_OUTPUT_ENABLE); 133 oxygen_set_bits16(chip, OXYGEN_GPIO_DATA, GPIO_OUTPUT_ENABLE);
@@ -219,49 +212,6 @@ static void xonar_gpio_changed(struct oxygen *chip)
219 } 212 }
220} 213}
221 214
222static void mute_ac97_ctl(struct oxygen *chip, unsigned int control)
223{
224 unsigned int priv_idx = chip->controls[control]->private_value & 0xff;
225 u16 value;
226
227 value = oxygen_read_ac97(chip, 0, priv_idx);
228 if (!(value & 0x8000)) {
229 oxygen_write_ac97(chip, 0, priv_idx, value | 0x8000);
230 snd_ctl_notify(chip->card, SNDRV_CTL_EVENT_MASK_VALUE,
231 &chip->controls[control]->id);
232 }
233}
234
235static void xonar_ac97_switch_hook(struct oxygen *chip, unsigned int codec,
236 unsigned int reg, int mute)
237{
238 if (codec != 0)
239 return;
240 /* line-in is exclusive */
241 switch (reg) {
242 case AC97_LINE:
243 oxygen_write_ac97_masked(chip, 0, CM9780_GPIO_STATUS,
244 mute ? GPIO_LINE_MUTE : 0,
245 GPIO_LINE_MUTE);
246 if (!mute) {
247 mute_ac97_ctl(chip, CONTROL_MIC_CAPTURE_SWITCH);
248 mute_ac97_ctl(chip, CONTROL_CD_CAPTURE_SWITCH);
249 mute_ac97_ctl(chip, CONTROL_AUX_CAPTURE_SWITCH);
250 }
251 break;
252 case AC97_MIC:
253 case AC97_CD:
254 case AC97_VIDEO:
255 case AC97_AUX:
256 if (!mute) {
257 oxygen_ac97_set_bits(chip, 0, CM9780_GPIO_STATUS,
258 GPIO_LINE_MUTE);
259 mute_ac97_ctl(chip, CONTROL_LINE_CAPTURE_SWITCH);
260 }
261 break;
262 }
263}
264
265static int pcm1796_volume_info(struct snd_kcontrol *ctl, 215static int pcm1796_volume_info(struct snd_kcontrol *ctl,
266 struct snd_ctl_elem_info *info) 216 struct snd_ctl_elem_info *info)
267{ 217{
@@ -321,8 +271,6 @@ static int xonar_control_filter(struct snd_kcontrol_new *template)
321 } else if (!strncmp(template->name, "CD Capture ", 11)) { 271 } else if (!strncmp(template->name, "CD Capture ", 11)) {
322 /* CD in is actually connected to the video in pin */ 272 /* CD in is actually connected to the video in pin */
323 template->private_value ^= AC97_CD ^ AC97_VIDEO; 273 template->private_value ^= AC97_CD ^ AC97_VIDEO;
324 } else if (!strcmp(template->name, "Line Capture Volume")) {
325 return 1; /* line-in bypasses the AC'97 mixer */
326 } 274 }
327 return 0; 275 return 0;
328} 276}
@@ -345,7 +293,6 @@ static const struct oxygen_model model_xonar = {
345 .set_adc_params = set_cs5381_params, 293 .set_adc_params = set_cs5381_params,
346 .update_dac_volume = update_pcm1796_volume, 294 .update_dac_volume = update_pcm1796_volume,
347 .update_dac_mute = update_pcm1796_mute, 295 .update_dac_mute = update_pcm1796_mute,
348 .ac97_switch_hook = xonar_ac97_switch_hook,
349 .gpio_changed = xonar_gpio_changed, 296 .gpio_changed = xonar_gpio_changed,
350 .model_data_size = sizeof(struct xonar_data), 297 .model_data_size = sizeof(struct xonar_data),
351 .pcm_dev_cfg = PLAYBACK_0_TO_I2S | 298 .pcm_dev_cfg = PLAYBACK_0_TO_I2S |