diff options
author | Takashi Iwai <tiwai@suse.de> | 2007-07-27 13:02:40 -0400 |
---|---|---|
committer | Jaroslav Kysela <perex@perex.cz> | 2007-10-16 09:58:11 -0400 |
commit | 532d5381793f3c824f8ff68d7067fab8c76bb811 (patch) | |
tree | 41a27e08a905c28576167b711ccc2b06ea234a9f /sound/pci/hda/patch_realtek.c | |
parent | 2807314d467e7dd929c42050031aabbd28e78f0b (diff) |
[ALSA] hda-codec - Add a generic bind-control helper
Added callbacks for a generic bind-control of mixer elements.
This can be used for creating a mixer element controlling multiple
widgets at the same time. Two macros, HDA_BIND_VOL() and HDA_BIND_SW(),
are introduced for creating bind-volume and bind-switch, respectively.
It taks the mixer element name and struct hda_bind_ctls pointer, which
contains the real control callbacks in ops field and long array for
private_value of each bound widget.
All widgets have to be the same type (i.e. the same amp capability).
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@suse.cz>
Diffstat (limited to 'sound/pci/hda/patch_realtek.c')
-rw-r--r-- | sound/pci/hda/patch_realtek.c | 28 |
1 files changed, 9 insertions, 19 deletions
diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c index d839d567f8e4..f27e073d22b1 100644 --- a/sound/pci/hda/patch_realtek.c +++ b/sound/pci/hda/patch_realtek.c | |||
@@ -7140,28 +7140,18 @@ static struct snd_kcontrol_new alc262_HP_BPC_WildWest_option_mixer[] = { | |||
7140 | { } /* end */ | 7140 | { } /* end */ |
7141 | }; | 7141 | }; |
7142 | 7142 | ||
7143 | static int alc262_sony_sw_put(struct snd_kcontrol *kcontrol, | 7143 | static struct hda_bind_ctls alc262_sony_bind_sw = { |
7144 | struct snd_ctl_elem_value *ucontrol) | 7144 | .ops = &snd_hda_bind_sw, |
7145 | { | 7145 | .values = { |
7146 | unsigned long private_save = kcontrol->private_value; | 7146 | HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT), |
7147 | int change; | 7147 | HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
7148 | kcontrol->private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT); | 7148 | 0, |
7149 | change = snd_hda_mixer_amp_switch_put(kcontrol, ucontrol); | 7149 | }, |
7150 | kcontrol->private_value = private_save; | 7150 | }; |
7151 | change |= snd_hda_mixer_amp_switch_put(kcontrol, ucontrol); | ||
7152 | return change; | ||
7153 | } | ||
7154 | 7151 | ||
7155 | static struct snd_kcontrol_new alc262_sony_mixer[] = { | 7152 | static struct snd_kcontrol_new alc262_sony_mixer[] = { |
7156 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), | 7153 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
7157 | { | 7154 | HDA_BIND_SW("Front Playback Switch", &alc262_sony_bind_sw), |
7158 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | ||
7159 | .name = "Front Playback Switch", | ||
7160 | .info = snd_hda_mixer_amp_switch_info, | ||
7161 | .get = snd_hda_mixer_amp_switch_get, | ||
7162 | .put = alc262_sony_sw_put, | ||
7163 | .private_value = HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT), | ||
7164 | }, | ||
7165 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | 7155 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
7166 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | 7156 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
7167 | HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), | 7157 | HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |