aboutsummaryrefslogtreecommitdiffstats
path: root/sound/pci/hda/patch_via.c
diff options
context:
space:
mode:
authorLydia Wang <lydiawang@viatech.com.cn>2009-10-10 07:08:29 -0400
committerTakashi Iwai <tiwai@suse.de>2009-10-11 11:58:13 -0400
commit4483a2f5907fa824bd6384c36fdcee9777cab1b9 (patch)
tree01689849f05feccb274af3631afbbc864b686f74 /sound/pci/hda/patch_via.c
parent9645c2039d5cfdbdcebe297420e180b6cd262836 (diff)
ALSA: HDA VIA: Modify vt1709_auto_create_multi_out_ctls.
Rewrite nid_vol/mute assignment for clearity, and check line connection before adding control for it. Signed-off-by: Lydia Wang <lydiawang@viatech.com.cn> Signed-off-by: Logan Li <loganli@viatech.com.cn> Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/pci/hda/patch_via.c')
-rw-r--r--sound/pci/hda/patch_via.c26
1 files changed, 14 insertions, 12 deletions
diff --git a/sound/pci/hda/patch_via.c b/sound/pci/hda/patch_via.c
index efadacd60835..f9702a17fc16 100644
--- a/sound/pci/hda/patch_via.c
+++ b/sound/pci/hda/patch_via.c
@@ -2160,7 +2160,7 @@ static int vt1709_auto_create_multi_out_ctls(struct via_spec *spec,
2160{ 2160{
2161 char name[32]; 2161 char name[32];
2162 static const char *chname[4] = { "Front", "Surround", "C/LFE", "Side" }; 2162 static const char *chname[4] = { "Front", "Surround", "C/LFE", "Side" };
2163 hda_nid_t nid = 0; 2163 hda_nid_t nid, nid_vol, nid_vols[] = {0x18, 0x1a, 0x1b, 0x29};
2164 int i, err; 2164 int i, err;
2165 2165
2166 for (i = 0; i <= AUTO_SEQ_SIDE; i++) { 2166 for (i = 0; i <= AUTO_SEQ_SIDE; i++) {
@@ -2169,43 +2169,45 @@ static int vt1709_auto_create_multi_out_ctls(struct via_spec *spec,
2169 if (!nid) 2169 if (!nid)
2170 continue; 2170 continue;
2171 2171
2172 nid_vol = nid_vols[i];
2173
2172 if (i == AUTO_SEQ_CENLFE) { 2174 if (i == AUTO_SEQ_CENLFE) {
2173 /* Center/LFE */ 2175 /* Center/LFE */
2174 err = via_add_control(spec, VIA_CTL_WIDGET_VOL, 2176 err = via_add_control(spec, VIA_CTL_WIDGET_VOL,
2175 "Center Playback Volume", 2177 "Center Playback Volume",
2176 HDA_COMPOSE_AMP_VAL(0x1b, 1, 0, 2178 HDA_COMPOSE_AMP_VAL(nid_vol, 1, 0,
2177 HDA_OUTPUT)); 2179 HDA_OUTPUT));
2178 if (err < 0) 2180 if (err < 0)
2179 return err; 2181 return err;
2180 err = via_add_control(spec, VIA_CTL_WIDGET_VOL, 2182 err = via_add_control(spec, VIA_CTL_WIDGET_VOL,
2181 "LFE Playback Volume", 2183 "LFE Playback Volume",
2182 HDA_COMPOSE_AMP_VAL(0x1b, 2, 0, 2184 HDA_COMPOSE_AMP_VAL(nid_vol, 2, 0,
2183 HDA_OUTPUT)); 2185 HDA_OUTPUT));
2184 if (err < 0) 2186 if (err < 0)
2185 return err; 2187 return err;
2186 err = via_add_control(spec, VIA_CTL_WIDGET_MUTE, 2188 err = via_add_control(spec, VIA_CTL_WIDGET_MUTE,
2187 "Center Playback Switch", 2189 "Center Playback Switch",
2188 HDA_COMPOSE_AMP_VAL(0x1b, 1, 0, 2190 HDA_COMPOSE_AMP_VAL(nid_vol, 1, 0,
2189 HDA_OUTPUT)); 2191 HDA_OUTPUT));
2190 if (err < 0) 2192 if (err < 0)
2191 return err; 2193 return err;
2192 err = via_add_control(spec, VIA_CTL_WIDGET_MUTE, 2194 err = via_add_control(spec, VIA_CTL_WIDGET_MUTE,
2193 "LFE Playback Switch", 2195 "LFE Playback Switch",
2194 HDA_COMPOSE_AMP_VAL(0x1b, 2, 0, 2196 HDA_COMPOSE_AMP_VAL(nid_vol, 2, 0,
2195 HDA_OUTPUT)); 2197 HDA_OUTPUT));
2196 if (err < 0) 2198 if (err < 0)
2197 return err; 2199 return err;
2198 } else if (i == AUTO_SEQ_FRONT){ 2200 } else if (i == AUTO_SEQ_FRONT){
2199 /* add control to mixer index 0 */ 2201 /* ADD control to mixer index 0 */
2200 err = via_add_control(spec, VIA_CTL_WIDGET_VOL, 2202 err = via_add_control(spec, VIA_CTL_WIDGET_VOL,
2201 "Master Front Playback Volume", 2203 "Master Front Playback Volume",
2202 HDA_COMPOSE_AMP_VAL(0x18, 3, 0, 2204 HDA_COMPOSE_AMP_VAL(nid_vol, 3, 0,
2203 HDA_INPUT)); 2205 HDA_INPUT));
2204 if (err < 0) 2206 if (err < 0)
2205 return err; 2207 return err;
2206 err = via_add_control(spec, VIA_CTL_WIDGET_MUTE, 2208 err = via_add_control(spec, VIA_CTL_WIDGET_MUTE,
2207 "Master Front Playback Switch", 2209 "Master Front Playback Switch",
2208 HDA_COMPOSE_AMP_VAL(0x18, 3, 0, 2210 HDA_COMPOSE_AMP_VAL(nid_vol, 3, 0,
2209 HDA_INPUT)); 2211 HDA_INPUT));
2210 if (err < 0) 2212 if (err < 0)
2211 return err; 2213 return err;
@@ -2226,26 +2228,26 @@ static int vt1709_auto_create_multi_out_ctls(struct via_spec *spec,
2226 } else if (i == AUTO_SEQ_SURROUND) { 2228 } else if (i == AUTO_SEQ_SURROUND) {
2227 sprintf(name, "%s Playback Volume", chname[i]); 2229 sprintf(name, "%s Playback Volume", chname[i]);
2228 err = via_add_control(spec, VIA_CTL_WIDGET_VOL, name, 2230 err = via_add_control(spec, VIA_CTL_WIDGET_VOL, name,
2229 HDA_COMPOSE_AMP_VAL(0x1a, 3, 0, 2231 HDA_COMPOSE_AMP_VAL(nid_vol, 3, 0,
2230 HDA_OUTPUT)); 2232 HDA_OUTPUT));
2231 if (err < 0) 2233 if (err < 0)
2232 return err; 2234 return err;
2233 sprintf(name, "%s Playback Switch", chname[i]); 2235 sprintf(name, "%s Playback Switch", chname[i]);
2234 err = via_add_control(spec, VIA_CTL_WIDGET_MUTE, name, 2236 err = via_add_control(spec, VIA_CTL_WIDGET_MUTE, name,
2235 HDA_COMPOSE_AMP_VAL(0x1a, 3, 0, 2237 HDA_COMPOSE_AMP_VAL(nid_vol, 3, 0,
2236 HDA_OUTPUT)); 2238 HDA_OUTPUT));
2237 if (err < 0) 2239 if (err < 0)
2238 return err; 2240 return err;
2239 } else if (i == AUTO_SEQ_SIDE) { 2241 } else if (i == AUTO_SEQ_SIDE) {
2240 sprintf(name, "%s Playback Volume", chname[i]); 2242 sprintf(name, "%s Playback Volume", chname[i]);
2241 err = via_add_control(spec, VIA_CTL_WIDGET_VOL, name, 2243 err = via_add_control(spec, VIA_CTL_WIDGET_VOL, name,
2242 HDA_COMPOSE_AMP_VAL(0x29, 3, 0, 2244 HDA_COMPOSE_AMP_VAL(nid_vol, 3, 0,
2243 HDA_OUTPUT)); 2245 HDA_OUTPUT));
2244 if (err < 0) 2246 if (err < 0)
2245 return err; 2247 return err;
2246 sprintf(name, "%s Playback Switch", chname[i]); 2248 sprintf(name, "%s Playback Switch", chname[i]);
2247 err = via_add_control(spec, VIA_CTL_WIDGET_MUTE, name, 2249 err = via_add_control(spec, VIA_CTL_WIDGET_MUTE, name,
2248 HDA_COMPOSE_AMP_VAL(0x29, 3, 0, 2250 HDA_COMPOSE_AMP_VAL(nid_vol, 3, 0,
2249 HDA_OUTPUT)); 2251 HDA_OUTPUT));
2250 if (err < 0) 2252 if (err < 0)
2251 return err; 2253 return err;