emumixer.c (bc88ba0cad64a4aa85f9deca79c6f3addcd21795) | emumixer.c (a8661af513040ed522e27d0e5339b3f757c1a351) |
---|---|
1// SPDX-License-Identifier: GPL-2.0-or-later 2/* 3 * Copyright (c) by Jaroslav Kysela <perex@perex.cz>, 4 * Takashi Iwai <tiwai@suse.de> 5 * Creative Labs, Inc. 6 * Routines for control of EMU10K1 chips / mixer routines 7 * Multichannel PCM support Copyright (c) Lee Revell <rlrevell@joe-job.com> 8 * --- 27 unchanged lines hidden (view full) --- 36 return 0; 37} 38 39static int snd_emu10k1_spdif_get(struct snd_kcontrol *kcontrol, 40 struct snd_ctl_elem_value *ucontrol) 41{ 42 struct snd_emu10k1 *emu = snd_kcontrol_chip(kcontrol); 43 unsigned int idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); | 1// SPDX-License-Identifier: GPL-2.0-or-later 2/* 3 * Copyright (c) by Jaroslav Kysela <perex@perex.cz>, 4 * Takashi Iwai <tiwai@suse.de> 5 * Creative Labs, Inc. 6 * Routines for control of EMU10K1 chips / mixer routines 7 * Multichannel PCM support Copyright (c) Lee Revell <rlrevell@joe-job.com> 8 * --- 27 unchanged lines hidden (view full) --- 36 return 0; 37} 38 39static int snd_emu10k1_spdif_get(struct snd_kcontrol *kcontrol, 40 struct snd_ctl_elem_value *ucontrol) 41{ 42 struct snd_emu10k1 *emu = snd_kcontrol_chip(kcontrol); 43 unsigned int idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); |
44 unsigned long flags; | |
45 46 /* Limit: emu->spdif_bits */ 47 if (idx >= 3) 48 return -EINVAL; | 44 45 /* Limit: emu->spdif_bits */ 46 if (idx >= 3) 47 return -EINVAL; |
49 spin_lock_irqsave(&emu->reg_lock, flags); | |
50 ucontrol->value.iec958.status[0] = (emu->spdif_bits[idx] >> 0) & 0xff; 51 ucontrol->value.iec958.status[1] = (emu->spdif_bits[idx] >> 8) & 0xff; 52 ucontrol->value.iec958.status[2] = (emu->spdif_bits[idx] >> 16) & 0xff; 53 ucontrol->value.iec958.status[3] = (emu->spdif_bits[idx] >> 24) & 0xff; | 48 ucontrol->value.iec958.status[0] = (emu->spdif_bits[idx] >> 0) & 0xff; 49 ucontrol->value.iec958.status[1] = (emu->spdif_bits[idx] >> 8) & 0xff; 50 ucontrol->value.iec958.status[2] = (emu->spdif_bits[idx] >> 16) & 0xff; 51 ucontrol->value.iec958.status[3] = (emu->spdif_bits[idx] >> 24) & 0xff; |
54 spin_unlock_irqrestore(&emu->reg_lock, flags); | |
55 return 0; 56} 57 58static int snd_emu10k1_spdif_get_mask(struct snd_kcontrol *kcontrol, 59 struct snd_ctl_elem_value *ucontrol) 60{ 61 ucontrol->value.iec958.status[0] = 0xff; 62 ucontrol->value.iec958.status[1] = 0xff; --- 13 unchanged lines hidden (view full) --- 76 "Dock ADC1 Left", 77 "Dock ADC1 Right", 78 "Dock ADC2 Left", 79 "Dock ADC2 Right", 80 "Dock ADC3 Left", 81 "Dock ADC3 Right", 82 "0202 ADC Left", 83 "0202 ADC Right", | 52 return 0; 53} 54 55static int snd_emu10k1_spdif_get_mask(struct snd_kcontrol *kcontrol, 56 struct snd_ctl_elem_value *ucontrol) 57{ 58 ucontrol->value.iec958.status[0] = 0xff; 59 ucontrol->value.iec958.status[1] = 0xff; --- 13 unchanged lines hidden (view full) --- 73 "Dock ADC1 Left", 74 "Dock ADC1 Right", 75 "Dock ADC2 Left", 76 "Dock ADC2 Right", 77 "Dock ADC3 Left", 78 "Dock ADC3 Right", 79 "0202 ADC Left", 80 "0202 ADC Right", |
84 "0202 SPDIF Left", 85 "0202 SPDIF Right", 86 "ADAT 0", 87 "ADAT 1", 88 "ADAT 2", 89 "ADAT 3", 90 "ADAT 4", 91 "ADAT 5", 92 "ADAT 6", 93 "ADAT 7", | 81 "1010 SPDIF Left", 82 "1010 SPDIF Right", 83 "1010 ADAT 0", 84 "1010 ADAT 1", 85 "1010 ADAT 2", 86 "1010 ADAT 3", 87 "1010 ADAT 4", 88 "1010 ADAT 5", 89 "1010 ADAT 6", 90 "1010 ADAT 7", |
94 "DSP 0", 95 "DSP 1", 96 "DSP 2", 97 "DSP 3", 98 "DSP 4", 99 "DSP 5", 100 "DSP 6", 101 "DSP 7", --- 22 unchanged lines hidden (view full) --- 124 "DSP 30", 125 "DSP 31", 126}; 127 128/* 1616(m) cardbus */ 129 130static const char * const emu1616_src_texts[] = { 131 "Silence", | 91 "DSP 0", 92 "DSP 1", 93 "DSP 2", 94 "DSP 3", 95 "DSP 4", 96 "DSP 5", 97 "DSP 6", 98 "DSP 7", --- 22 unchanged lines hidden (view full) --- 121 "DSP 30", 122 "DSP 31", 123}; 124 125/* 1616(m) cardbus */ 126 127static const char * const emu1616_src_texts[] = { 128 "Silence", |
132 "Dock Mic A", 133 "Dock Mic B", 134 "Dock ADC1 Left", 135 "Dock ADC1 Right", 136 "Dock ADC2 Left", 137 "Dock ADC2 Right", 138 "Dock SPDIF Left", 139 "Dock SPDIF Right", | 129 "Mic A", 130 "Mic B", 131 "ADC1 Left", 132 "ADC1 Right", 133 "ADC2 Left", 134 "ADC2 Right", 135 "SPDIF Left", 136 "SPDIF Right", |
140 "ADAT 0", 141 "ADAT 1", 142 "ADAT 2", 143 "ADAT 3", 144 "ADAT 4", 145 "ADAT 5", 146 "ADAT 6", 147 "ADAT 7", --- 917 unchanged lines hidden (view full) --- 1065 return snd_ctl_enum_info(uinfo, 1, 3, texts); 1066} 1067 1068static int snd_audigy_spdif_output_rate_get(struct snd_kcontrol *kcontrol, 1069 struct snd_ctl_elem_value *ucontrol) 1070{ 1071 struct snd_emu10k1 *emu = snd_kcontrol_chip(kcontrol); 1072 unsigned int tmp; | 137 "ADAT 0", 138 "ADAT 1", 139 "ADAT 2", 140 "ADAT 3", 141 "ADAT 4", 142 "ADAT 5", 143 "ADAT 6", 144 "ADAT 7", --- 917 unchanged lines hidden (view full) --- 1062 return snd_ctl_enum_info(uinfo, 1, 3, texts); 1063} 1064 1065static int snd_audigy_spdif_output_rate_get(struct snd_kcontrol *kcontrol, 1066 struct snd_ctl_elem_value *ucontrol) 1067{ 1068 struct snd_emu10k1 *emu = snd_kcontrol_chip(kcontrol); 1069 unsigned int tmp; |
1073 unsigned long flags; 1074 | |
1075 | 1070 |
1076 spin_lock_irqsave(&emu->reg_lock, flags); | |
1077 tmp = snd_emu10k1_ptr_read(emu, A_SPDIF_SAMPLERATE, 0); 1078 switch (tmp & A_SPDIF_RATE_MASK) { 1079 case A_SPDIF_44100: 1080 ucontrol->value.enumerated.item[0] = 0; 1081 break; 1082 case A_SPDIF_48000: 1083 ucontrol->value.enumerated.item[0] = 1; 1084 break; 1085 case A_SPDIF_96000: 1086 ucontrol->value.enumerated.item[0] = 2; 1087 break; 1088 default: 1089 ucontrol->value.enumerated.item[0] = 1; 1090 } | 1071 tmp = snd_emu10k1_ptr_read(emu, A_SPDIF_SAMPLERATE, 0); 1072 switch (tmp & A_SPDIF_RATE_MASK) { 1073 case A_SPDIF_44100: 1074 ucontrol->value.enumerated.item[0] = 0; 1075 break; 1076 case A_SPDIF_48000: 1077 ucontrol->value.enumerated.item[0] = 1; 1078 break; 1079 case A_SPDIF_96000: 1080 ucontrol->value.enumerated.item[0] = 2; 1081 break; 1082 default: 1083 ucontrol->value.enumerated.item[0] = 1; 1084 } |
1091 spin_unlock_irqrestore(&emu->reg_lock, flags); | |
1092 return 0; 1093} 1094 1095static int snd_audigy_spdif_output_rate_put(struct snd_kcontrol *kcontrol, 1096 struct snd_ctl_elem_value *ucontrol) 1097{ 1098 struct snd_emu10k1 *emu = snd_kcontrol_chip(kcontrol); 1099 int change; --- 41 unchanged lines hidden (view full) --- 1141 1142static int snd_emu10k1_spdif_put(struct snd_kcontrol *kcontrol, 1143 struct snd_ctl_elem_value *ucontrol) 1144{ 1145 struct snd_emu10k1 *emu = snd_kcontrol_chip(kcontrol); 1146 unsigned int idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); 1147 int change; 1148 unsigned int val; | 1085 return 0; 1086} 1087 1088static int snd_audigy_spdif_output_rate_put(struct snd_kcontrol *kcontrol, 1089 struct snd_ctl_elem_value *ucontrol) 1090{ 1091 struct snd_emu10k1 *emu = snd_kcontrol_chip(kcontrol); 1092 int change; --- 41 unchanged lines hidden (view full) --- 1134 1135static int snd_emu10k1_spdif_put(struct snd_kcontrol *kcontrol, 1136 struct snd_ctl_elem_value *ucontrol) 1137{ 1138 struct snd_emu10k1 *emu = snd_kcontrol_chip(kcontrol); 1139 unsigned int idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); 1140 int change; 1141 unsigned int val; |
1149 unsigned long flags; | |
1150 1151 /* Limit: emu->spdif_bits */ 1152 if (idx >= 3) 1153 return -EINVAL; 1154 val = (ucontrol->value.iec958.status[0] << 0) | 1155 (ucontrol->value.iec958.status[1] << 8) | 1156 (ucontrol->value.iec958.status[2] << 16) | 1157 (ucontrol->value.iec958.status[3] << 24); | 1142 1143 /* Limit: emu->spdif_bits */ 1144 if (idx >= 3) 1145 return -EINVAL; 1146 val = (ucontrol->value.iec958.status[0] << 0) | 1147 (ucontrol->value.iec958.status[1] << 8) | 1148 (ucontrol->value.iec958.status[2] << 16) | 1149 (ucontrol->value.iec958.status[3] << 24); |
1158 spin_lock_irqsave(&emu->reg_lock, flags); | |
1159 change = val != emu->spdif_bits[idx]; 1160 if (change) { 1161 snd_emu10k1_ptr_write(emu, SPCS0 + idx, 0, val); 1162 emu->spdif_bits[idx] = val; 1163 } | 1150 change = val != emu->spdif_bits[idx]; 1151 if (change) { 1152 snd_emu10k1_ptr_write(emu, SPCS0 + idx, 0, val); 1153 emu->spdif_bits[idx] = val; 1154 } |
1164 spin_unlock_irqrestore(&emu->reg_lock, flags); | |
1165 return change; 1166} 1167 1168static const struct snd_kcontrol_new snd_emu10k1_spdif_mask_control = 1169{ 1170 .access = SNDRV_CTL_ELEM_ACCESS_READ, 1171 .iface = SNDRV_CTL_ELEM_IFACE_PCM, 1172 .name = SNDRV_CTL_NAME_IEC958("",PLAYBACK,MASK), --- 51 unchanged lines hidden (view full) --- 1224 uinfo->value.integer.min = 0; 1225 uinfo->value.integer.max = emu->audigy ? 0x3f : 0x0f; 1226 return 0; 1227} 1228 1229static int snd_emu10k1_send_routing_get(struct snd_kcontrol *kcontrol, 1230 struct snd_ctl_elem_value *ucontrol) 1231{ | 1155 return change; 1156} 1157 1158static const struct snd_kcontrol_new snd_emu10k1_spdif_mask_control = 1159{ 1160 .access = SNDRV_CTL_ELEM_ACCESS_READ, 1161 .iface = SNDRV_CTL_ELEM_IFACE_PCM, 1162 .name = SNDRV_CTL_NAME_IEC958("",PLAYBACK,MASK), --- 51 unchanged lines hidden (view full) --- 1214 uinfo->value.integer.min = 0; 1215 uinfo->value.integer.max = emu->audigy ? 0x3f : 0x0f; 1216 return 0; 1217} 1218 1219static int snd_emu10k1_send_routing_get(struct snd_kcontrol *kcontrol, 1220 struct snd_ctl_elem_value *ucontrol) 1221{ |
1232 unsigned long flags; | |
1233 struct snd_emu10k1 *emu = snd_kcontrol_chip(kcontrol); 1234 struct snd_emu10k1_pcm_mixer *mix = 1235 &emu->pcm_mixer[snd_ctl_get_ioffidx(kcontrol, &ucontrol->id)]; 1236 int voice, idx; 1237 int num_efx = emu->audigy ? 8 : 4; 1238 int mask = emu->audigy ? 0x3f : 0x0f; 1239 | 1222 struct snd_emu10k1 *emu = snd_kcontrol_chip(kcontrol); 1223 struct snd_emu10k1_pcm_mixer *mix = 1224 &emu->pcm_mixer[snd_ctl_get_ioffidx(kcontrol, &ucontrol->id)]; 1225 int voice, idx; 1226 int num_efx = emu->audigy ? 8 : 4; 1227 int mask = emu->audigy ? 0x3f : 0x0f; 1228 |
1240 spin_lock_irqsave(&emu->reg_lock, flags); | |
1241 for (voice = 0; voice < 3; voice++) 1242 for (idx = 0; idx < num_efx; idx++) 1243 ucontrol->value.integer.value[(voice * num_efx) + idx] = 1244 mix->send_routing[voice][idx] & mask; | 1229 for (voice = 0; voice < 3; voice++) 1230 for (idx = 0; idx < num_efx; idx++) 1231 ucontrol->value.integer.value[(voice * num_efx) + idx] = 1232 mix->send_routing[voice][idx] & mask; |
1245 spin_unlock_irqrestore(&emu->reg_lock, flags); | |
1246 return 0; 1247} 1248 1249static int snd_emu10k1_send_routing_put(struct snd_kcontrol *kcontrol, 1250 struct snd_ctl_elem_value *ucontrol) 1251{ 1252 unsigned long flags; 1253 struct snd_emu10k1 *emu = snd_kcontrol_chip(kcontrol); --- 46 unchanged lines hidden (view full) --- 1300 uinfo->value.integer.min = 0; 1301 uinfo->value.integer.max = 255; 1302 return 0; 1303} 1304 1305static int snd_emu10k1_send_volume_get(struct snd_kcontrol *kcontrol, 1306 struct snd_ctl_elem_value *ucontrol) 1307{ | 1233 return 0; 1234} 1235 1236static int snd_emu10k1_send_routing_put(struct snd_kcontrol *kcontrol, 1237 struct snd_ctl_elem_value *ucontrol) 1238{ 1239 unsigned long flags; 1240 struct snd_emu10k1 *emu = snd_kcontrol_chip(kcontrol); --- 46 unchanged lines hidden (view full) --- 1287 uinfo->value.integer.min = 0; 1288 uinfo->value.integer.max = 255; 1289 return 0; 1290} 1291 1292static int snd_emu10k1_send_volume_get(struct snd_kcontrol *kcontrol, 1293 struct snd_ctl_elem_value *ucontrol) 1294{ |
1308 unsigned long flags; | |
1309 struct snd_emu10k1 *emu = snd_kcontrol_chip(kcontrol); 1310 struct snd_emu10k1_pcm_mixer *mix = 1311 &emu->pcm_mixer[snd_ctl_get_ioffidx(kcontrol, &ucontrol->id)]; 1312 int idx; 1313 int num_efx = emu->audigy ? 8 : 4; 1314 | 1295 struct snd_emu10k1 *emu = snd_kcontrol_chip(kcontrol); 1296 struct snd_emu10k1_pcm_mixer *mix = 1297 &emu->pcm_mixer[snd_ctl_get_ioffidx(kcontrol, &ucontrol->id)]; 1298 int idx; 1299 int num_efx = emu->audigy ? 8 : 4; 1300 |
1315 spin_lock_irqsave(&emu->reg_lock, flags); | |
1316 for (idx = 0; idx < 3*num_efx; idx++) 1317 ucontrol->value.integer.value[idx] = mix->send_volume[idx/num_efx][idx%num_efx]; | 1301 for (idx = 0; idx < 3*num_efx; idx++) 1302 ucontrol->value.integer.value[idx] = mix->send_volume[idx/num_efx][idx%num_efx]; |
1318 spin_unlock_irqrestore(&emu->reg_lock, flags); | |
1319 return 0; 1320} 1321 1322static int snd_emu10k1_send_volume_put(struct snd_kcontrol *kcontrol, 1323 struct snd_ctl_elem_value *ucontrol) 1324{ 1325 unsigned long flags; 1326 struct snd_emu10k1 *emu = snd_kcontrol_chip(kcontrol); --- 46 unchanged lines hidden (view full) --- 1373} 1374 1375static int snd_emu10k1_attn_get(struct snd_kcontrol *kcontrol, 1376 struct snd_ctl_elem_value *ucontrol) 1377{ 1378 struct snd_emu10k1 *emu = snd_kcontrol_chip(kcontrol); 1379 struct snd_emu10k1_pcm_mixer *mix = 1380 &emu->pcm_mixer[snd_ctl_get_ioffidx(kcontrol, &ucontrol->id)]; | 1303 return 0; 1304} 1305 1306static int snd_emu10k1_send_volume_put(struct snd_kcontrol *kcontrol, 1307 struct snd_ctl_elem_value *ucontrol) 1308{ 1309 unsigned long flags; 1310 struct snd_emu10k1 *emu = snd_kcontrol_chip(kcontrol); --- 46 unchanged lines hidden (view full) --- 1357} 1358 1359static int snd_emu10k1_attn_get(struct snd_kcontrol *kcontrol, 1360 struct snd_ctl_elem_value *ucontrol) 1361{ 1362 struct snd_emu10k1 *emu = snd_kcontrol_chip(kcontrol); 1363 struct snd_emu10k1_pcm_mixer *mix = 1364 &emu->pcm_mixer[snd_ctl_get_ioffidx(kcontrol, &ucontrol->id)]; |
1381 unsigned long flags; | |
1382 int idx; 1383 | 1365 int idx; 1366 |
1384 spin_lock_irqsave(&emu->reg_lock, flags); | |
1385 for (idx = 0; idx < 3; idx++) 1386 ucontrol->value.integer.value[idx] = mix->attn[idx]; | 1367 for (idx = 0; idx < 3; idx++) 1368 ucontrol->value.integer.value[idx] = mix->attn[idx]; |
1387 spin_unlock_irqrestore(&emu->reg_lock, flags); | |
1388 return 0; 1389} 1390 1391static int snd_emu10k1_attn_put(struct snd_kcontrol *kcontrol, 1392 struct snd_ctl_elem_value *ucontrol) 1393{ 1394 unsigned long flags; 1395 struct snd_emu10k1 *emu = snd_kcontrol_chip(kcontrol); --- 42 unchanged lines hidden (view full) --- 1438 uinfo->value.integer.min = 0; 1439 uinfo->value.integer.max = emu->audigy ? 0x3f : 0x0f; 1440 return 0; 1441} 1442 1443static int snd_emu10k1_efx_send_routing_get(struct snd_kcontrol *kcontrol, 1444 struct snd_ctl_elem_value *ucontrol) 1445{ | 1369 return 0; 1370} 1371 1372static int snd_emu10k1_attn_put(struct snd_kcontrol *kcontrol, 1373 struct snd_ctl_elem_value *ucontrol) 1374{ 1375 unsigned long flags; 1376 struct snd_emu10k1 *emu = snd_kcontrol_chip(kcontrol); --- 42 unchanged lines hidden (view full) --- 1419 uinfo->value.integer.min = 0; 1420 uinfo->value.integer.max = emu->audigy ? 0x3f : 0x0f; 1421 return 0; 1422} 1423 1424static int snd_emu10k1_efx_send_routing_get(struct snd_kcontrol *kcontrol, 1425 struct snd_ctl_elem_value *ucontrol) 1426{ |
1446 unsigned long flags; | |
1447 struct snd_emu10k1 *emu = snd_kcontrol_chip(kcontrol); 1448 struct snd_emu10k1_pcm_mixer *mix = 1449 &emu->efx_pcm_mixer[snd_ctl_get_ioffidx(kcontrol, &ucontrol->id)]; 1450 int idx; 1451 int num_efx = emu->audigy ? 8 : 4; 1452 int mask = emu->audigy ? 0x3f : 0x0f; 1453 | 1427 struct snd_emu10k1 *emu = snd_kcontrol_chip(kcontrol); 1428 struct snd_emu10k1_pcm_mixer *mix = 1429 &emu->efx_pcm_mixer[snd_ctl_get_ioffidx(kcontrol, &ucontrol->id)]; 1430 int idx; 1431 int num_efx = emu->audigy ? 8 : 4; 1432 int mask = emu->audigy ? 0x3f : 0x0f; 1433 |
1454 spin_lock_irqsave(&emu->reg_lock, flags); | |
1455 for (idx = 0; idx < num_efx; idx++) 1456 ucontrol->value.integer.value[idx] = 1457 mix->send_routing[0][idx] & mask; | 1434 for (idx = 0; idx < num_efx; idx++) 1435 ucontrol->value.integer.value[idx] = 1436 mix->send_routing[0][idx] & mask; |
1458 spin_unlock_irqrestore(&emu->reg_lock, flags); | |
1459 return 0; 1460} 1461 1462static int snd_emu10k1_efx_send_routing_put(struct snd_kcontrol *kcontrol, 1463 struct snd_ctl_elem_value *ucontrol) 1464{ 1465 unsigned long flags; 1466 struct snd_emu10k1 *emu = snd_kcontrol_chip(kcontrol); --- 41 unchanged lines hidden (view full) --- 1508 uinfo->value.integer.min = 0; 1509 uinfo->value.integer.max = 255; 1510 return 0; 1511} 1512 1513static int snd_emu10k1_efx_send_volume_get(struct snd_kcontrol *kcontrol, 1514 struct snd_ctl_elem_value *ucontrol) 1515{ | 1437 return 0; 1438} 1439 1440static int snd_emu10k1_efx_send_routing_put(struct snd_kcontrol *kcontrol, 1441 struct snd_ctl_elem_value *ucontrol) 1442{ 1443 unsigned long flags; 1444 struct snd_emu10k1 *emu = snd_kcontrol_chip(kcontrol); --- 41 unchanged lines hidden (view full) --- 1486 uinfo->value.integer.min = 0; 1487 uinfo->value.integer.max = 255; 1488 return 0; 1489} 1490 1491static int snd_emu10k1_efx_send_volume_get(struct snd_kcontrol *kcontrol, 1492 struct snd_ctl_elem_value *ucontrol) 1493{ |
1516 unsigned long flags; | |
1517 struct snd_emu10k1 *emu = snd_kcontrol_chip(kcontrol); 1518 struct snd_emu10k1_pcm_mixer *mix = 1519 &emu->efx_pcm_mixer[snd_ctl_get_ioffidx(kcontrol, &ucontrol->id)]; 1520 int idx; 1521 int num_efx = emu->audigy ? 8 : 4; 1522 | 1494 struct snd_emu10k1 *emu = snd_kcontrol_chip(kcontrol); 1495 struct snd_emu10k1_pcm_mixer *mix = 1496 &emu->efx_pcm_mixer[snd_ctl_get_ioffidx(kcontrol, &ucontrol->id)]; 1497 int idx; 1498 int num_efx = emu->audigy ? 8 : 4; 1499 |
1523 spin_lock_irqsave(&emu->reg_lock, flags); | |
1524 for (idx = 0; idx < num_efx; idx++) 1525 ucontrol->value.integer.value[idx] = mix->send_volume[0][idx]; | 1500 for (idx = 0; idx < num_efx; idx++) 1501 ucontrol->value.integer.value[idx] = mix->send_volume[0][idx]; |
1526 spin_unlock_irqrestore(&emu->reg_lock, flags); | |
1527 return 0; 1528} 1529 1530static int snd_emu10k1_efx_send_volume_put(struct snd_kcontrol *kcontrol, 1531 struct snd_ctl_elem_value *ucontrol) 1532{ 1533 unsigned long flags; 1534 struct snd_emu10k1 *emu = snd_kcontrol_chip(kcontrol); --- 42 unchanged lines hidden (view full) --- 1577} 1578 1579static int snd_emu10k1_efx_attn_get(struct snd_kcontrol *kcontrol, 1580 struct snd_ctl_elem_value *ucontrol) 1581{ 1582 struct snd_emu10k1 *emu = snd_kcontrol_chip(kcontrol); 1583 struct snd_emu10k1_pcm_mixer *mix = 1584 &emu->efx_pcm_mixer[snd_ctl_get_ioffidx(kcontrol, &ucontrol->id)]; | 1502 return 0; 1503} 1504 1505static int snd_emu10k1_efx_send_volume_put(struct snd_kcontrol *kcontrol, 1506 struct snd_ctl_elem_value *ucontrol) 1507{ 1508 unsigned long flags; 1509 struct snd_emu10k1 *emu = snd_kcontrol_chip(kcontrol); --- 42 unchanged lines hidden (view full) --- 1552} 1553 1554static int snd_emu10k1_efx_attn_get(struct snd_kcontrol *kcontrol, 1555 struct snd_ctl_elem_value *ucontrol) 1556{ 1557 struct snd_emu10k1 *emu = snd_kcontrol_chip(kcontrol); 1558 struct snd_emu10k1_pcm_mixer *mix = 1559 &emu->efx_pcm_mixer[snd_ctl_get_ioffidx(kcontrol, &ucontrol->id)]; |
1585 unsigned long flags; | |
1586 | 1560 |
1587 spin_lock_irqsave(&emu->reg_lock, flags); | |
1588 ucontrol->value.integer.value[0] = mix->attn[0]; | 1561 ucontrol->value.integer.value[0] = mix->attn[0]; |
1589 spin_unlock_irqrestore(&emu->reg_lock, flags); | |
1590 return 0; 1591} 1592 1593static int snd_emu10k1_efx_attn_put(struct snd_kcontrol *kcontrol, 1594 struct snd_ctl_elem_value *ucontrol) 1595{ 1596 unsigned long flags; 1597 struct snd_emu10k1 *emu = snd_kcontrol_chip(kcontrol); --- 51 unchanged lines hidden (view full) --- 1649 unsigned long flags; 1650 struct snd_emu10k1 *emu = snd_kcontrol_chip(kcontrol); 1651 unsigned int reg, val, sw; 1652 int change = 0; 1653 1654 sw = ucontrol->value.integer.value[0]; 1655 if (emu->card_capabilities->invert_shared_spdif) 1656 sw = !sw; | 1562 return 0; 1563} 1564 1565static int snd_emu10k1_efx_attn_put(struct snd_kcontrol *kcontrol, 1566 struct snd_ctl_elem_value *ucontrol) 1567{ 1568 unsigned long flags; 1569 struct snd_emu10k1 *emu = snd_kcontrol_chip(kcontrol); --- 51 unchanged lines hidden (view full) --- 1621 unsigned long flags; 1622 struct snd_emu10k1 *emu = snd_kcontrol_chip(kcontrol); 1623 unsigned int reg, val, sw; 1624 int change = 0; 1625 1626 sw = ucontrol->value.integer.value[0]; 1627 if (emu->card_capabilities->invert_shared_spdif) 1628 sw = !sw; |
1657 spin_lock_irqsave(&emu->reg_lock, flags); | 1629 spin_lock_irqsave(&emu->emu_lock, flags); |
1658 if ( emu->card_capabilities->i2c_adc) { 1659 /* Do nothing for Audigy 2 ZS Notebook */ 1660 } else if (emu->audigy) { 1661 reg = inw(emu->port + A_IOCFG); 1662 val = sw ? A_IOCFG_GPOUT0 : 0; 1663 change = (reg & A_IOCFG_GPOUT0) != val; 1664 if (change) { 1665 reg &= ~A_IOCFG_GPOUT0; --- 4 unchanged lines hidden (view full) --- 1670 reg = inl(emu->port + HCFG); 1671 val = sw ? HCFG_GPOUT0 : 0; 1672 change |= (reg & HCFG_GPOUT0) != val; 1673 if (change) { 1674 reg &= ~HCFG_GPOUT0; 1675 reg |= val; 1676 outl(reg | val, emu->port + HCFG); 1677 } | 1630 if ( emu->card_capabilities->i2c_adc) { 1631 /* Do nothing for Audigy 2 ZS Notebook */ 1632 } else if (emu->audigy) { 1633 reg = inw(emu->port + A_IOCFG); 1634 val = sw ? A_IOCFG_GPOUT0 : 0; 1635 change = (reg & A_IOCFG_GPOUT0) != val; 1636 if (change) { 1637 reg &= ~A_IOCFG_GPOUT0; --- 4 unchanged lines hidden (view full) --- 1642 reg = inl(emu->port + HCFG); 1643 val = sw ? HCFG_GPOUT0 : 0; 1644 change |= (reg & HCFG_GPOUT0) != val; 1645 if (change) { 1646 reg &= ~HCFG_GPOUT0; 1647 reg |= val; 1648 outl(reg | val, emu->port + HCFG); 1649 } |
1678 spin_unlock_irqrestore(&emu->reg_lock, flags); | 1650 spin_unlock_irqrestore(&emu->emu_lock, flags); |
1679 return change; 1680} 1681 1682static const struct snd_kcontrol_new snd_emu10k1_shared_spdif = 1683{ 1684 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 1685 .name = "SB Live Analog/Digital Output Jack", 1686 .info = snd_emu10k1_shared_spdif_info, --- 391 unchanged lines hidden (view full) --- 2078 mix->send_routing[0][4+v] = 60+v; 2079 2080 memset(&mix->send_volume, 0, sizeof(mix->send_volume)); 2081 mix->send_volume[0][0] = 255; 2082 2083 mix->attn[0] = 0xffff; 2084 } 2085 | 1651 return change; 1652} 1653 1654static const struct snd_kcontrol_new snd_emu10k1_shared_spdif = 1655{ 1656 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 1657 .name = "SB Live Analog/Digital Output Jack", 1658 .info = snd_emu10k1_shared_spdif_info, --- 391 unchanged lines hidden (view full) --- 2050 mix->send_routing[0][4+v] = 60+v; 2051 2052 memset(&mix->send_volume, 0, sizeof(mix->send_volume)); 2053 mix->send_volume[0][0] = 255; 2054 2055 mix->attn[0] = 0xffff; 2056 } 2057 |
2086 if (! emu->card_capabilities->ecard) { /* FIXME: APS has these controls? */ | 2058 if (!emu->card_capabilities->ecard && !emu->card_capabilities->emu_model) { |
2087 /* sb live! and audigy */ 2088 kctl = snd_ctl_new1(&snd_emu10k1_spdif_mask_control, emu); 2089 if (!kctl) 2090 return -ENOMEM; 2091 if (!emu->audigy) 2092 kctl->id.device = emu->pcm_efx->device; 2093 err = snd_ctl_add(card, kctl); 2094 if (err) --- 153 unchanged lines hidden --- | 2059 /* sb live! and audigy */ 2060 kctl = snd_ctl_new1(&snd_emu10k1_spdif_mask_control, emu); 2061 if (!kctl) 2062 return -ENOMEM; 2063 if (!emu->audigy) 2064 kctl->id.device = emu->pcm_efx->device; 2065 err = snd_ctl_add(card, kctl); 2066 if (err) --- 153 unchanged lines hidden --- |