diff options
author | Maxim Levitsky <maximlevitsky@gmail.com> | 2007-09-03 09:30:26 -0400 |
---|---|---|
committer | Jaroslav Kysela <perex@perex.cz> | 2007-10-16 09:59:50 -0400 |
commit | 6e6b88ffea81d7bc5c5da0b8433b4a21131ae340 (patch) | |
tree | 3231b311e580bcd388742f2dad8f7e0abcaaae1a /sound | |
parent | 5f10c4a9a0c02597206fe2f027026ee25d3e07ad (diff) |
[ALSA] hda-codec - make volume knob, the master volume for sigmatel codecs
VolumeKnob is present on most sigmatel codecs, it allows to decrease
volume of all DACs at once, it is a kind of post-procesing volume.
Note that all output amps of sigmatel only decrease volume, and all
input amps only increase volume.
Signed-off-by: Maxim Levitsky <maximlevitsky@gmail.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@suse.cz>
Diffstat (limited to 'sound')
-rw-r--r-- | sound/pci/hda/patch_sigmatel.c | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/sound/pci/hda/patch_sigmatel.c b/sound/pci/hda/patch_sigmatel.c index c94775c8a0bf..a2b1dd54e2ef 100644 --- a/sound/pci/hda/patch_sigmatel.c +++ b/sound/pci/hda/patch_sigmatel.c | |||
@@ -339,6 +339,39 @@ static int stac92xx_aloopback_put(struct snd_kcontrol *kcontrol, | |||
339 | return 1; | 339 | return 1; |
340 | } | 340 | } |
341 | 341 | ||
342 | static int stac92xx_volknob_info(struct snd_kcontrol *kcontrol, | ||
343 | struct snd_ctl_elem_info *uinfo) | ||
344 | { | ||
345 | uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER; | ||
346 | uinfo->count = 1; | ||
347 | uinfo->value.integer.min = 0; | ||
348 | uinfo->value.integer.max = 127; | ||
349 | return 0; | ||
350 | } | ||
351 | |||
352 | static int stac92xx_volknob_get(struct snd_kcontrol *kcontrol, | ||
353 | struct snd_ctl_elem_value *ucontrol) | ||
354 | { | ||
355 | ucontrol->value.integer.value[0] = kcontrol->private_value; | ||
356 | return 0; | ||
357 | } | ||
358 | |||
359 | static int stac92xx_volknob_put(struct snd_kcontrol *kcontrol, | ||
360 | struct snd_ctl_elem_value *ucontrol) | ||
361 | { | ||
362 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); | ||
363 | |||
364 | if (kcontrol->private_value == ucontrol->value.integer.value[0]) | ||
365 | return 0; | ||
366 | |||
367 | kcontrol->private_value = ucontrol->value.integer.value[0]; | ||
368 | |||
369 | snd_hda_codec_write_cache(codec, 0x24, 0, | ||
370 | AC_VERB_SET_VOLUME_KNOB_CONTROL, | ||
371 | kcontrol->private_value | 0x80); | ||
372 | return 1; | ||
373 | } | ||
374 | |||
342 | 375 | ||
343 | static struct hda_verb stac9200_core_init[] = { | 376 | static struct hda_verb stac9200_core_init[] = { |
344 | /* set dac0mux for dac converter */ | 377 | /* set dac0mux for dac converter */ |
@@ -401,6 +434,17 @@ static struct hda_verb stac9205_core_init[] = { | |||
401 | .private_value = verb_read | (verb_write << 16), \ | 434 | .private_value = verb_read | (verb_write << 16), \ |
402 | } | 435 | } |
403 | 436 | ||
437 | #define STAC_VOLKNOB \ | ||
438 | { \ | ||
439 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ | ||
440 | .name = "Master Playback Volume", \ | ||
441 | .count = 1, \ | ||
442 | .info = stac92xx_volknob_info, \ | ||
443 | .get = stac92xx_volknob_get, \ | ||
444 | .put = stac92xx_volknob_put, \ | ||
445 | .private_value = 127, \ | ||
446 | } | ||
447 | |||
404 | 448 | ||
405 | static struct snd_kcontrol_new stac9200_mixer[] = { | 449 | static struct snd_kcontrol_new stac9200_mixer[] = { |
406 | HDA_CODEC_VOLUME("Master Playback Volume", 0xb, 0, HDA_OUTPUT), | 450 | HDA_CODEC_VOLUME("Master Playback Volume", 0xb, 0, HDA_OUTPUT), |
@@ -423,6 +467,7 @@ static struct snd_kcontrol_new stac925x_mixer[] = { | |||
423 | /* This needs to be generated dynamically based on sequence */ | 467 | /* This needs to be generated dynamically based on sequence */ |
424 | static struct snd_kcontrol_new stac922x_mixer[] = { | 468 | static struct snd_kcontrol_new stac922x_mixer[] = { |
425 | STAC_INPUT_SOURCE, | 469 | STAC_INPUT_SOURCE, |
470 | STAC_VOLKNOB, | ||
426 | HDA_CODEC_VOLUME("Capture Volume", 0x17, 0x0, HDA_INPUT), | 471 | HDA_CODEC_VOLUME("Capture Volume", 0x17, 0x0, HDA_INPUT), |
427 | HDA_CODEC_MUTE("Capture Switch", 0x17, 0x0, HDA_INPUT), | 472 | HDA_CODEC_MUTE("Capture Switch", 0x17, 0x0, HDA_INPUT), |
428 | HDA_CODEC_VOLUME("Mux Capture Volume", 0x12, 0x0, HDA_OUTPUT), | 473 | HDA_CODEC_VOLUME("Mux Capture Volume", 0x12, 0x0, HDA_OUTPUT), |
@@ -432,6 +477,7 @@ static struct snd_kcontrol_new stac922x_mixer[] = { | |||
432 | /* This needs to be generated dynamically based on sequence */ | 477 | /* This needs to be generated dynamically based on sequence */ |
433 | static struct snd_kcontrol_new stac9227_mixer[] = { | 478 | static struct snd_kcontrol_new stac9227_mixer[] = { |
434 | STAC_INPUT_SOURCE, | 479 | STAC_INPUT_SOURCE, |
480 | STAC_VOLKNOB, | ||
435 | STAC_ANALOG_LOOPBACK(0xFEB, 0x7EB), | 481 | STAC_ANALOG_LOOPBACK(0xFEB, 0x7EB), |
436 | HDA_CODEC_VOLUME("Capture Volume", 0x15, 0x0, HDA_OUTPUT), | 482 | HDA_CODEC_VOLUME("Capture Volume", 0x15, 0x0, HDA_OUTPUT), |
437 | HDA_CODEC_MUTE("Capture Switch", 0x1b, 0x0, HDA_OUTPUT), | 483 | HDA_CODEC_MUTE("Capture Switch", 0x1b, 0x0, HDA_OUTPUT), |
@@ -440,6 +486,7 @@ static struct snd_kcontrol_new stac9227_mixer[] = { | |||
440 | 486 | ||
441 | static struct snd_kcontrol_new stac927x_mixer[] = { | 487 | static struct snd_kcontrol_new stac927x_mixer[] = { |
442 | STAC_INPUT_SOURCE, | 488 | STAC_INPUT_SOURCE, |
489 | STAC_VOLKNOB, | ||
443 | STAC_ANALOG_LOOPBACK(0xFEB, 0x7EB), | 490 | STAC_ANALOG_LOOPBACK(0xFEB, 0x7EB), |
444 | HDA_CODEC_VOLUME("InMux Capture Volume", 0x15, 0x0, HDA_OUTPUT), | 491 | HDA_CODEC_VOLUME("InMux Capture Volume", 0x15, 0x0, HDA_OUTPUT), |
445 | HDA_CODEC_VOLUME("InVol Capture Volume", 0x18, 0x0, HDA_INPUT), | 492 | HDA_CODEC_VOLUME("InVol Capture Volume", 0x18, 0x0, HDA_INPUT), |
@@ -458,6 +505,7 @@ static struct snd_kcontrol_new stac9205_mixer[] = { | |||
458 | }, | 505 | }, |
459 | STAC_INPUT_SOURCE, | 506 | STAC_INPUT_SOURCE, |
460 | STAC_ANALOG_LOOPBACK(0xFE0, 0x7E0), | 507 | STAC_ANALOG_LOOPBACK(0xFE0, 0x7E0), |
508 | STAC_VOLKNOB, | ||
461 | HDA_CODEC_VOLUME("InMux Capture Volume", 0x19, 0x0, HDA_OUTPUT), | 509 | HDA_CODEC_VOLUME("InMux Capture Volume", 0x19, 0x0, HDA_OUTPUT), |
462 | HDA_CODEC_VOLUME("InVol Capture Volume", 0x1b, 0x0, HDA_INPUT), | 510 | HDA_CODEC_VOLUME("InVol Capture Volume", 0x1b, 0x0, HDA_INPUT), |
463 | HDA_CODEC_MUTE("ADCMux Capture Switch", 0x1d, 0x0, HDA_OUTPUT), | 511 | HDA_CODEC_MUTE("ADCMux Capture Switch", 0x1d, 0x0, HDA_OUTPUT), |