diff options
author | Takashi Iwai <tiwai@suse.de> | 2007-08-10 11:12:15 -0400 |
---|---|---|
committer | Jaroslav Kysela <perex@perex.cz> | 2007-10-16 09:58:45 -0400 |
commit | cca3b3718ca96dca51daf1129ac03003bcede751 (patch) | |
tree | 32dc0ee54e783fe0021f26061dfbdd37beef4d1f /sound/pci/hda/patch_conexant.c | |
parent | 47fd830acf0b6b5bc75db55d0f2cc64f59a23b5f (diff) |
[ALSA] hda-codec - Clean up bind-controls
We have already a generic bind-control helper, so let's clean up the codes
using it.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@suse.cz>
Diffstat (limited to 'sound/pci/hda/patch_conexant.c')
-rw-r--r-- | sound/pci/hda/patch_conexant.c | 68 |
1 files changed, 18 insertions, 50 deletions
diff --git a/sound/pci/hda/patch_conexant.c b/sound/pci/hda/patch_conexant.c index ebf83275756e..080e3001d9c5 100644 --- a/sound/pci/hda/patch_conexant.c +++ b/sound/pci/hda/patch_conexant.c | |||
@@ -483,23 +483,14 @@ static int cxt5045_hp_master_sw_put(struct snd_kcontrol *kcontrol, | |||
483 | } | 483 | } |
484 | 484 | ||
485 | /* bind volumes of both NID 0x10 and 0x11 */ | 485 | /* bind volumes of both NID 0x10 and 0x11 */ |
486 | static int cxt5045_hp_master_vol_put(struct snd_kcontrol *kcontrol, | 486 | static struct hda_bind_ctls cxt5045_hp_bind_master_vol = { |
487 | struct snd_ctl_elem_value *ucontrol) | 487 | .ops = &snd_hda_bind_vol, |
488 | { | 488 | .values = { |
489 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); | 489 | HDA_COMPOSE_AMP_VAL(0x10, 3, 0, HDA_OUTPUT), |
490 | long *valp = ucontrol->value.integer.value; | 490 | HDA_COMPOSE_AMP_VAL(0x11, 3, 0, HDA_OUTPUT), |
491 | int change; | 491 | 0 |
492 | 492 | }, | |
493 | change = snd_hda_codec_amp_update(codec, 0x10, 0, HDA_OUTPUT, 0, | 493 | }; |
494 | HDA_AMP_VOLMASK, valp[0]); | ||
495 | change |= snd_hda_codec_amp_update(codec, 0x10, 1, HDA_OUTPUT, 0, | ||
496 | HDA_AMP_VOLMASK, valp[1]); | ||
497 | snd_hda_codec_amp_update(codec, 0x11, 0, HDA_OUTPUT, 0, | ||
498 | HDA_AMP_VOLMASK, valp[0]); | ||
499 | snd_hda_codec_amp_update(codec, 0x11, 1, HDA_OUTPUT, 0, | ||
500 | HDA_AMP_VOLMASK, valp[1]); | ||
501 | return change; | ||
502 | } | ||
503 | 494 | ||
504 | /* toggle input of built-in and mic jack appropriately */ | 495 | /* toggle input of built-in and mic jack appropriately */ |
505 | static void cxt5045_hp_automic(struct hda_codec *codec) | 496 | static void cxt5045_hp_automic(struct hda_codec *codec) |
@@ -567,14 +558,7 @@ static struct snd_kcontrol_new cxt5045_mixers[] = { | |||
567 | HDA_CODEC_MUTE("Int Mic Switch", 0x1a, 0x01, HDA_INPUT), | 558 | HDA_CODEC_MUTE("Int Mic Switch", 0x1a, 0x01, HDA_INPUT), |
568 | HDA_CODEC_VOLUME("Ext Mic Volume", 0x1a, 0x02, HDA_INPUT), | 559 | HDA_CODEC_VOLUME("Ext Mic Volume", 0x1a, 0x02, HDA_INPUT), |
569 | HDA_CODEC_MUTE("Ext Mic Switch", 0x1a, 0x02, HDA_INPUT), | 560 | HDA_CODEC_MUTE("Ext Mic Switch", 0x1a, 0x02, HDA_INPUT), |
570 | { | 561 | HDA_BIND_VOL("Master Playback Volume", &cxt5045_hp_bind_master_vol), |
571 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | ||
572 | .name = "Master Playback Volume", | ||
573 | .info = snd_hda_mixer_amp_volume_info, | ||
574 | .get = snd_hda_mixer_amp_volume_get, | ||
575 | .put = cxt5045_hp_master_vol_put, | ||
576 | .private_value = HDA_COMPOSE_AMP_VAL(0x10, 3, 0, HDA_OUTPUT), | ||
577 | }, | ||
578 | { | 562 | { |
579 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | 563 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
580 | .name = "Master Playback Switch", | 564 | .name = "Master Playback Switch", |
@@ -897,23 +881,14 @@ static int cxt5047_hp_master_sw_put(struct snd_kcontrol *kcontrol, | |||
897 | } | 881 | } |
898 | 882 | ||
899 | /* bind volumes of both NID 0x13 (Headphones) and 0x1d (Speakers) */ | 883 | /* bind volumes of both NID 0x13 (Headphones) and 0x1d (Speakers) */ |
900 | static int cxt5047_hp_master_vol_put(struct snd_kcontrol *kcontrol, | 884 | static struct hda_bind_ctls cxt5047_bind_master_vol = { |
901 | struct snd_ctl_elem_value *ucontrol) | 885 | .ops = &snd_hda_bind_vol, |
902 | { | 886 | .values = { |
903 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); | 887 | HDA_COMPOSE_AMP_VAL(0x13, 3, 0, HDA_OUTPUT), |
904 | long *valp = ucontrol->value.integer.value; | 888 | HDA_COMPOSE_AMP_VAL(0x1d, 3, 0, HDA_OUTPUT), |
905 | int change; | 889 | 0 |
906 | 890 | }, | |
907 | change = snd_hda_codec_amp_update(codec, 0x1d, 0, HDA_OUTPUT, 0, | 891 | }; |
908 | HDA_AMP_VOLMASK, valp[0]); | ||
909 | change |= snd_hda_codec_amp_update(codec, 0x1d, 1, HDA_OUTPUT, 0, | ||
910 | HDA_AMP_VOLMASK, valp[1]); | ||
911 | snd_hda_codec_amp_update(codec, 0x13, 0, HDA_OUTPUT, 0, | ||
912 | HDA_AMP_VOLMASK, valp[0]); | ||
913 | snd_hda_codec_amp_update(codec, 0x13, 1, HDA_OUTPUT, 0, | ||
914 | HDA_AMP_VOLMASK, valp[1]); | ||
915 | return change; | ||
916 | } | ||
917 | 892 | ||
918 | /* mute internal speaker if HP is plugged */ | 893 | /* mute internal speaker if HP is plugged */ |
919 | static void cxt5047_hp_automute(struct hda_codec *codec) | 894 | static void cxt5047_hp_automute(struct hda_codec *codec) |
@@ -1035,14 +1010,7 @@ static struct snd_kcontrol_new cxt5047_toshiba_mixers[] = { | |||
1035 | HDA_CODEC_MUTE("Capture Switch", 0x12, 0x03, HDA_INPUT), | 1010 | HDA_CODEC_MUTE("Capture Switch", 0x12, 0x03, HDA_INPUT), |
1036 | HDA_CODEC_VOLUME("PCM Volume", 0x10, 0x00, HDA_OUTPUT), | 1011 | HDA_CODEC_VOLUME("PCM Volume", 0x10, 0x00, HDA_OUTPUT), |
1037 | HDA_CODEC_MUTE("PCM Switch", 0x10, 0x00, HDA_OUTPUT), | 1012 | HDA_CODEC_MUTE("PCM Switch", 0x10, 0x00, HDA_OUTPUT), |
1038 | { | 1013 | HDA_BIND_VOL("Master Playback Volume", &cxt5047_bind_master_vol), |
1039 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | ||
1040 | .name = "Master Playback Volume", | ||
1041 | .info = snd_hda_mixer_amp_volume_info, | ||
1042 | .get = snd_hda_mixer_amp_volume_get, | ||
1043 | .put = cxt5047_hp_master_vol_put, | ||
1044 | .private_value = HDA_COMPOSE_AMP_VAL(0x13, 3, 0, HDA_OUTPUT), | ||
1045 | }, | ||
1046 | { | 1014 | { |
1047 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | 1015 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
1048 | .name = "Master Playback Switch", | 1016 | .name = "Master Playback Switch", |