19 #include <linux/module.h>
38 static unsigned int channels_list[10] = {1, 2, 4, 6, 8, 10, 12, 14, 16, 999999};
43 static int get_firmware(
const struct firmware **fw_entry,
49 #ifdef CONFIG_PM_SLEEP
50 if (chip->fw_cache[fw_index]) {
51 DE_ACT((
"firmware requested: %s is cached\n", card_fw[fw_index].
data));
52 *fw_entry = chip->fw_cache[fw_index];
57 DE_ACT((
"firmware requested: %s\n", card_fw[fw_index].
data));
58 snprintf(name,
sizeof(name),
"ea/%s", card_fw[fw_index].
data);
62 #ifdef CONFIG_PM_SLEEP
64 chip->fw_cache[fw_index] = *fw_entry;
73 #ifdef CONFIG_PM_SLEEP
74 DE_ACT((
"firmware not released (kept in cache)\n"));
77 DE_ACT((
"firmware released\n"));
83 static void free_firmware_cache(
struct echoaudio *chip)
85 #ifdef CONFIG_PM_SLEEP
88 for (i = 0; i < 8 ; i++)
89 if (chip->fw_cache[i]) {
91 DE_ACT((
"release_firmware(%d)\n", i));
94 DE_ACT((
"firmware_cache released\n"));
125 #ifndef ECHOCARD_HAS_STEREO_BIG_ENDIAN32
129 return snd_mask_refine(f, &
fmt);
135 return snd_mask_refine(f, &
fmt);
151 snd_interval_any(&ch);
156 #ifdef ECHOCARD_HAS_STEREO_BIG_ENDIAN32
187 fmask =
fmt.bits[0] + ((
u64)
fmt.bits[1] << 32);
195 }
else if (c->
max == 1)
197 #ifndef ECHOCARD_HAS_STEREO_BIG_ENDIAN32
199 else if (c->
min == 2 && c->
max == 2)
205 fmt.bits[0] &= (
u32)fmask;
206 fmt.bits[1] &= (
u32)(fmask >> 32);
207 return snd_mask_refine(f, &
fmt);
221 snd_interval_any(&ch);
228 #ifdef ECHOCARD_HAS_STEREO_BIG_ENDIAN32
259 snd_interval_any(&
fixed);
268 signed char max_channels)
275 if (max_channels <= 0)
288 DE_HWP((
"max_channels=%d\n", max_channels));
289 pipe->
constr.list = channels_list;
291 for (i = 0; channels_list[
i] <= max_channels; i++);
293 if (pipe->
hw.channels_max > max_channels)
294 pipe->
hw.channels_max = max_channels;
296 pipe->
hw.rate_max = 48000;
300 runtime->
hw = pipe->
hw;
330 hw_rule_sample_rate, chip,
338 DE_HWP((
"s-g list allocation failed\n"));
352 DE_ACT((
"pcm_analog_in_open\n"));
353 if ((err = pcm_open(substream, num_analog_busses_in(chip) -
358 hw_rule_capture_channels_by_format,
NULL,
363 hw_rule_capture_format_by_channels,
NULL,
369 DE_HWP((
"pcm_analog_in_open cs=%d oc=%d r=%d\n",
380 int max_channels,
err;
382 #ifdef ECHOCARD_HAS_VMIXER
383 max_channels = num_pipes_out(chip);
385 max_channels = num_analog_busses_out(chip);
387 DE_ACT((
"pcm_analog_out_open\n"));
388 if ((err = pcm_open(substream, max_channels - substream->
number)) < 0)
392 hw_rule_playback_channels_by_format,
398 hw_rule_playback_format_by_channels,
405 DE_HWP((
"pcm_analog_out_open cs=%d oc=%d r=%d\n",
413 #ifdef ECHOCARD_HAS_DIGITAL_IO
418 int err, max_channels;
420 DE_ACT((
"pcm_digital_in_open\n"));
421 max_channels = num_digital_busses_in(chip) - substream->
number;
424 err = pcm_open(substream, max_channels);
435 hw_rule_capture_channels_by_format,
NULL,
440 hw_rule_capture_format_by_channels,
NULL,
455 #ifndef ECHOCARD_HAS_VMIXER
460 int err, max_channels;
462 DE_ACT((
"pcm_digital_out_open\n"));
463 max_channels = num_digital_busses_out(chip) - substream->
number;
466 err = pcm_open(substream, max_channels);
477 hw_rule_playback_channels_by_format,
483 hw_rule_playback_format_by_channels,
513 DE_ACT((
"pcm_close oc=%d cs=%d rs=%d\n", oc,
519 DE_ACT((
"pcm_close2 oc=%d cs=%d rs=%d\n", oc,
542 spin_lock_irq(&chip->
lock);
543 if (pipe->
index >= 0) {
545 err = free_pipes(chip, pipe);
550 err = allocate_pipes(chip, pipe, pipe_index, interleave);
552 spin_unlock_irq(&chip->
lock);
557 spin_unlock_irq(&chip->
lock);
560 DE_HWP((
"pcm_hw_params (bufsize=%dB periods=%d persize=%dB)\n",
562 params_period_bytes(hw_params)));
567 spin_lock_irq(&chip->
lock);
568 free_pipes(chip, pipe);
569 spin_unlock_irq(&chip->
lock);
574 sglist_init(chip, pipe);
578 rest = params_period_bytes(hw_params);
583 addr = snd_pcm_sgbuf_get_addr(substream, offs);
584 if (rest <= edge - offs) {
585 sglist_add_mapping(chip, pipe, addr, rest);
586 sglist_add_irq(chip, pipe);
590 sglist_add_mapping(chip, pipe, addr,
603 sglist_wrap(chip, pipe);
614 spin_lock_irq(&chip->
lock);
616 spin_unlock_irq(&chip->
lock);
617 DE_HWP((
"pcm_hw_params ok\n"));
628 return init_engine(substream, hw_params, px_analog_in(chip) +
637 return init_engine(substream, hw_params, substream->
number,
643 #ifdef ECHOCARD_HAS_DIGITAL_IO
650 return init_engine(substream, hw_params, px_digital_in(chip) +
656 #ifndef ECHOCARD_HAS_VMIXER
662 return init_engine(substream, hw_params, px_digital_out(chip) +
679 spin_lock_irq(&chip->
lock);
680 if (pipe->
index >= 0) {
682 free_pipes(chip, pipe);
686 spin_unlock_irq(&chip->
lock);
688 DE_HWP((
"pcm_hw_freed\n"));
702 DE_HWP((
"Prepare rate=%d format=%d channels=%d\n",
705 format.data_are_bigendian = 0;
706 format.mono_to_stereo = 0;
707 switch (runtime->
format) {
709 format.bits_per_sample = 8;
712 format.bits_per_sample = 16;
715 format.bits_per_sample = 24;
718 format.data_are_bigendian = 1;
720 format.bits_per_sample = 32;
723 DE_HWP((
"Prepare error: unsupported format %d\n",
730 if (
snd_BUG_ON(!is_pipe_allocated(chip, pipe_index)))
732 set_audio_format(chip, pipe_index, &
format);
750 channelmask |= 1 <<
i;
751 snd_pcm_trigger_done(s, substream);
756 spin_lock(&chip->
lock);
759 DE_ACT((
"pcm_trigger resume\n"));
762 DE_ACT((
"pcm_trigger start\n"));
764 if (channelmask & (1 << i)) {
765 pipe = chip->
substream[
i]->runtime->private_data;
766 switch (pipe->
state) {
780 err = start_transport(chip, channelmask,
784 DE_ACT((
"pcm_trigger suspend\n"));
786 DE_ACT((
"pcm_trigger stop\n"));
788 if (channelmask & (1 << i)) {
789 pipe = chip->
substream[
i]->runtime->private_data;
793 err = stop_transport(chip, channelmask);
796 DE_ACT((
"pcm_trigger pause\n"));
798 if (channelmask & (1 << i)) {
799 pipe = chip->
substream[
i]->runtime->private_data;
803 err = pause_transport(chip, channelmask);
808 spin_unlock(&chip->
lock);
823 bufsize = substream->
runtime->buffer_size;
826 while (pos >= bufsize) {
837 .open = pcm_analog_out_open,
840 .hw_params = pcm_analog_out_hw_params,
841 .hw_free = pcm_hw_free,
842 .prepare = pcm_prepare,
843 .trigger = pcm_trigger,
844 .pointer = pcm_pointer,
848 .open = pcm_analog_in_open,
851 .hw_params = pcm_analog_in_hw_params,
852 .hw_free = pcm_hw_free,
853 .prepare = pcm_prepare,
854 .trigger = pcm_trigger,
855 .pointer = pcm_pointer,
858 #ifdef ECHOCARD_HAS_DIGITAL_IO
859 #ifndef ECHOCARD_HAS_VMIXER
861 .
open = pcm_digital_out_open,
864 .hw_params = pcm_digital_out_hw_params,
865 .hw_free = pcm_hw_free,
866 .prepare = pcm_prepare,
867 .trigger = pcm_trigger,
868 .pointer = pcm_pointer,
873 .
open = pcm_digital_in_open,
876 .hw_params = pcm_digital_in_hw_params,
877 .hw_free = pcm_hw_free,
878 .prepare = pcm_prepare,
879 .trigger = pcm_trigger,
880 .pointer = pcm_pointer,
890 static int snd_echo_preallocate_pages(
struct snd_pcm *pcm,
struct device *
dev)
895 for (stream = 0; stream < 2; stream++)
896 for (ss = pcm->
streams[stream].substream; ss; ss = ss->
next) {
915 #ifdef ECHOCARD_HAS_VMIXER
924 num_analog_busses_in(chip), &pcm)) < 0)
935 #ifdef ECHOCARD_HAS_DIGITAL_IO
938 num_digital_busses_in(chip), &pcm)) < 0)
958 num_analog_busses_out(chip),
959 num_analog_busses_in(chip), &pcm)) < 0)
970 #ifdef ECHOCARD_HAS_DIGITAL_IO
973 num_digital_busses_out(chip),
974 num_digital_busses_in(chip), &pcm)) < 0)
998 #if !defined(ECHOCARD_HAS_VMIXER) || defined(ECHOCARD_HAS_LINE_OUT_GAIN)
1001 static int snd_echo_output_gain_info(
struct snd_kcontrol *kcontrol,
1008 uinfo->
count = num_busses_out(chip);
1014 static int snd_echo_output_gain_get(
struct snd_kcontrol *kcontrol,
1021 for (c = 0; c < num_busses_out(chip); c++)
1026 static int snd_echo_output_gain_put(
struct snd_kcontrol *kcontrol,
1034 spin_lock_irq(&chip->
lock);
1035 for (c = 0; c < num_busses_out(chip); c++) {
1036 gain = ucontrol->
value.integer.value[
c];
1041 set_output_gain(chip, c, gain);
1046 update_output_line_level(chip);
1047 spin_unlock_irq(&chip->
lock);
1051 #ifdef ECHOCARD_HAS_LINE_OUT_GAIN
1054 .name =
"Line Playback Volume",
1058 .info = snd_echo_output_gain_info,
1059 .get = snd_echo_output_gain_get,
1060 .put = snd_echo_output_gain_put,
1061 .tlv = {.p = db_scale_output_gain},
1065 .
name =
"PCM Playback Volume",
1068 .info = snd_echo_output_gain_info,
1069 .get = snd_echo_output_gain_get,
1070 .put = snd_echo_output_gain_put,
1071 .tlv = {.p = db_scale_output_gain},
1079 #ifdef ECHOCARD_HAS_INPUT_GAIN
1082 static int snd_echo_input_gain_info(
struct snd_kcontrol *kcontrol,
1089 uinfo->
count = num_analog_busses_in(chip);
1095 static int snd_echo_input_gain_get(
struct snd_kcontrol *kcontrol,
1102 for (c = 0; c < num_analog_busses_in(chip); c++)
1107 static int snd_echo_input_gain_put(
struct snd_kcontrol *kcontrol,
1115 spin_lock_irq(&chip->
lock);
1116 for (c = 0; c < num_analog_busses_in(chip); c++) {
1117 gain = ucontrol->
value.integer.value[
c];
1122 set_input_gain(chip, c, gain);
1127 update_input_line_level(chip);
1128 spin_unlock_irq(&chip->
lock);
1135 .
name =
"Line Capture Volume",
1138 .info = snd_echo_input_gain_info,
1139 .get = snd_echo_input_gain_get,
1140 .put = snd_echo_input_gain_put,
1141 .tlv = {.p = db_scale_input_gain},
1148 #ifdef ECHOCARD_HAS_OUTPUT_NOMINAL_LEVEL
1151 static int snd_echo_output_nominal_info (
struct snd_kcontrol *kcontrol,
1158 uinfo->
count = num_analog_busses_out(chip);
1164 static int snd_echo_output_nominal_get(
struct snd_kcontrol *kcontrol,
1171 for (c = 0; c < num_analog_busses_out(chip); c++)
1176 static int snd_echo_output_nominal_put(
struct snd_kcontrol *kcontrol,
1184 spin_lock_irq(&chip->
lock);
1185 for (c = 0; c < num_analog_busses_out(chip); c++) {
1187 set_nominal_level(chip, c,
1188 ucontrol->
value.integer.value[c]);
1193 update_output_line_level(chip);
1194 spin_unlock_irq(&chip->
lock);
1198 static struct snd_kcontrol_new snd_echo_output_nominal_level __devinitdata = {
1199 .
name =
"Line Playback Switch (-10dBV)",
1201 .info = snd_echo_output_nominal_info,
1202 .get = snd_echo_output_nominal_get,
1203 .put = snd_echo_output_nominal_put,
1210 #ifdef ECHOCARD_HAS_INPUT_NOMINAL_LEVEL
1213 static int snd_echo_input_nominal_info(
struct snd_kcontrol *kcontrol,
1220 uinfo->
count = num_analog_busses_in(chip);
1226 static int snd_echo_input_nominal_get(
struct snd_kcontrol *kcontrol,
1233 for (c = 0; c < num_analog_busses_in(chip); c++)
1234 ucontrol->
value.integer.value[c] =
1239 static int snd_echo_input_nominal_put(
struct snd_kcontrol *kcontrol,
1247 spin_lock_irq(&chip->
lock);
1248 for (c = 0; c < num_analog_busses_in(chip); c++) {
1250 ucontrol->
value.integer.value[
c]) {
1251 set_nominal_level(chip, bx_analog_in(chip) + c,
1252 ucontrol->
value.integer.value[c]);
1257 update_output_line_level(chip);
1260 spin_unlock_irq(&chip->
lock);
1264 static struct snd_kcontrol_new snd_echo_intput_nominal_level __devinitdata = {
1265 .
name =
"Line Capture Switch (-10dBV)",
1267 .info = snd_echo_input_nominal_info,
1268 .get = snd_echo_input_nominal_get,
1269 .put = snd_echo_input_nominal_put,
1276 #ifdef ECHOCARD_HAS_MONITOR
1279 static int snd_echo_mixer_info(
struct snd_kcontrol *kcontrol,
1289 uinfo->
dimen.
d[0] = num_busses_out(chip);
1290 uinfo->
dimen.
d[1] = num_busses_in(chip);
1294 static int snd_echo_mixer_get(
struct snd_kcontrol *kcontrol,
1300 ucontrol->
value.integer.value[0] =
1302 [ucontrol->
id.index % num_busses_in(chip)];
1306 static int snd_echo_mixer_put(
struct snd_kcontrol *kcontrol,
1315 out = ucontrol->
id.index / num_busses_in(chip);
1316 in = ucontrol->
id.index % num_busses_in(chip);
1317 gain = ucontrol->
value.integer.value[0];
1318 if (gain < ECHOGAIN_MINOUT || gain > ECHOGAIN_MAXOUT)
1321 spin_lock_irq(&chip->
lock);
1322 set_monitor_gain(chip, out, in, gain);
1323 update_output_line_level(chip);
1324 spin_unlock_irq(&chip->
lock);
1331 .
name =
"Monitor Mixer Volume",
1334 .info = snd_echo_mixer_info,
1335 .get = snd_echo_mixer_get,
1336 .put = snd_echo_mixer_put,
1337 .tlv = {.p = db_scale_output_gain},
1344 #ifdef ECHOCARD_HAS_VMIXER
1347 static int snd_echo_vmixer_info(
struct snd_kcontrol *kcontrol,
1357 uinfo->
dimen.
d[0] = num_busses_out(chip);
1358 uinfo->
dimen.
d[1] = num_pipes_out(chip);
1362 static int snd_echo_vmixer_get(
struct snd_kcontrol *kcontrol,
1368 ucontrol->
value.integer.value[0] =
1370 [ucontrol->
id.index % num_pipes_out(chip)];
1374 static int snd_echo_vmixer_put(
struct snd_kcontrol *kcontrol,
1383 out = ucontrol->
id.index / num_pipes_out(chip);
1384 vch = ucontrol->
id.index % num_pipes_out(chip);
1385 gain = ucontrol->
value.integer.value[0];
1386 if (gain < ECHOGAIN_MINOUT || gain > ECHOGAIN_MAXOUT)
1389 spin_lock_irq(&chip->
lock);
1390 set_vmixer_gain(chip, out, vch, ucontrol->
value.integer.value[0]);
1391 update_vmixer_level(chip);
1392 spin_unlock_irq(&chip->
lock);
1399 .
name =
"VMixer Volume",
1402 .info = snd_echo_vmixer_info,
1403 .get = snd_echo_vmixer_get,
1404 .put = snd_echo_vmixer_put,
1405 .tlv = {.p = db_scale_output_gain},
1412 #ifdef ECHOCARD_HAS_DIGITAL_MODE_SWITCH
1415 static int snd_echo_digital_mode_info(
struct snd_kcontrol *kcontrol,
1418 static char *names[4] = {
1419 "S/PDIF Coaxial",
"S/PDIF Optical",
"ADAT Optical",
1435 static int snd_echo_digital_mode_get(
struct snd_kcontrol *kcontrol,
1445 ucontrol->
value.enumerated.item[0] =
i;
1451 static int snd_echo_digital_mode_put(
struct snd_kcontrol *kcontrol,
1456 unsigned short emode, dmode;
1461 emode = ucontrol->
value.enumerated.item[0];
1477 changed = set_digital_mode(chip, dmode);
1483 DE_ACT((
"SDM() =%d\n", changed));
1493 static struct snd_kcontrol_new snd_echo_digital_mode_switch __devinitdata = {
1494 .
name =
"Digital mode Switch",
1496 .info = snd_echo_digital_mode_info,
1497 .get = snd_echo_digital_mode_get,
1498 .put = snd_echo_digital_mode_put,
1505 #ifdef ECHOCARD_HAS_DIGITAL_IO
1508 static int snd_echo_spdif_mode_info(
struct snd_kcontrol *kcontrol,
1511 static char *names[2] = {
"Consumer",
"Professional"};
1523 static int snd_echo_spdif_mode_get(
struct snd_kcontrol *kcontrol,
1533 static int snd_echo_spdif_mode_put(
struct snd_kcontrol *kcontrol,
1540 mode = !!ucontrol->
value.enumerated.item[0];
1542 spin_lock_irq(&chip->
lock);
1543 set_professional_spdif(chip, mode);
1544 spin_unlock_irq(&chip->
lock);
1550 static struct snd_kcontrol_new snd_echo_spdif_mode_switch __devinitdata = {
1551 .
name =
"S/PDIF mode Switch",
1553 .info = snd_echo_spdif_mode_info,
1554 .get = snd_echo_spdif_mode_get,
1555 .put = snd_echo_spdif_mode_put,
1562 #ifdef ECHOCARD_HAS_EXTERNAL_CLOCK
1565 static int snd_echo_clock_source_info(
struct snd_kcontrol *kcontrol,
1568 static char *names[8] = {
1569 "Internal",
"Word",
"Super",
"S/PDIF",
"ADAT",
"ESync",
1585 static int snd_echo_clock_source_get(
struct snd_kcontrol *kcontrol,
1596 ucontrol->
value.enumerated.item[0] =
i;
1601 static int snd_echo_clock_source_put(
struct snd_kcontrol *kcontrol,
1606 unsigned int eclock, dclock;
1610 eclock = ucontrol->
value.enumerated.item[0];
1616 spin_lock_irq(&chip->
lock);
1617 if ((changed = set_input_clock(chip, dclock)) == 0)
1619 spin_unlock_irq(&chip->
lock);
1624 DE_ACT((
"seticlk val%d err 0x%x\n", dclock, changed));
1629 static struct snd_kcontrol_new snd_echo_clock_source_switch __devinitdata = {
1630 .
name =
"Sample Clock Source",
1632 .info = snd_echo_clock_source_info,
1633 .get = snd_echo_clock_source_get,
1634 .put = snd_echo_clock_source_put,
1641 #ifdef ECHOCARD_HAS_PHANTOM_POWER
1644 #define snd_echo_phantom_power_info snd_ctl_boolean_mono_info
1646 static int snd_echo_phantom_power_get(
struct snd_kcontrol *kcontrol,
1655 static int snd_echo_phantom_power_put(
struct snd_kcontrol *kcontrol,
1659 int power, changed = 0;
1661 power = !!ucontrol->
value.integer.value[0];
1663 spin_lock_irq(&chip->
lock);
1664 changed = set_phantom_power(chip, power);
1665 spin_unlock_irq(&chip->
lock);
1672 static struct snd_kcontrol_new snd_echo_phantom_power_switch __devinitdata = {
1673 .
name =
"Phantom power Switch",
1675 .info = snd_echo_phantom_power_info,
1676 .get = snd_echo_phantom_power_get,
1677 .put = snd_echo_phantom_power_put,
1684 #ifdef ECHOCARD_HAS_DIGITAL_IN_AUTOMUTE
1687 #define snd_echo_automute_info snd_ctl_boolean_mono_info
1689 static int snd_echo_automute_get(
struct snd_kcontrol *kcontrol,
1698 static int snd_echo_automute_put(
struct snd_kcontrol *kcontrol,
1702 int automute, changed = 0;
1704 automute = !!ucontrol->
value.integer.value[0];
1706 spin_lock_irq(&chip->
lock);
1707 changed = set_input_auto_mute(chip, automute);
1708 spin_unlock_irq(&chip->
lock);
1716 .
name =
"Digital Capture Switch (automute)",
1718 .info = snd_echo_automute_info,
1719 .get = snd_echo_automute_get,
1720 .put = snd_echo_automute_put,
1728 #define snd_echo_vumeters_switch_info snd_ctl_boolean_mono_info
1730 static int snd_echo_vumeters_switch_put(
struct snd_kcontrol *kcontrol,
1736 spin_lock_irq(&chip->
lock);
1737 set_meters_on(chip, ucontrol->
value.integer.value[0]);
1738 spin_unlock_irq(&chip->
lock);
1743 .
name =
"VU-meters Switch",
1747 .put = snd_echo_vumeters_switch_put,
1753 static int snd_echo_vumeters_info(
struct snd_kcontrol *kcontrol,
1763 #ifdef ECHOCARD_HAS_VMIXER
1773 static int snd_echo_vumeters_get(
struct snd_kcontrol *kcontrol,
1779 get_audio_meters(chip, ucontrol->
value.integer.value);
1784 .
name =
"VU-meters",
1789 .info = snd_echo_vumeters_info,
1790 .get = snd_echo_vumeters_get,
1791 .tlv = {.p = db_scale_output_gain},
1797 static int snd_echo_channels_info_info(
struct snd_kcontrol *kcontrol,
1810 static int snd_echo_channels_info_get(
struct snd_kcontrol *kcontrol,
1814 int detected, clocks,
bit,
src;
1817 ucontrol->
value.integer.value[0] = num_busses_in(chip);
1818 ucontrol->
value.integer.value[1] = num_analog_busses_in(chip);
1819 ucontrol->
value.integer.value[2] = num_busses_out(chip);
1820 ucontrol->
value.integer.value[3] = num_analog_busses_out(chip);
1821 ucontrol->
value.integer.value[4] = num_pipes_out(chip);
1824 detected = detect_input_clocks(chip);
1828 if (detected & (1 << bit))
1829 for (; src >= 0; src--)
1834 ucontrol->
value.integer.value[5] = clocks;
1840 .
name =
"Channels info",
1843 .info = snd_echo_channels_info_info,
1844 .get = snd_echo_channels_info_get,
1860 spin_lock(&chip->
lock);
1861 st = service_irq(chip);
1863 spin_unlock(&chip->
lock);
1872 period = pcm_pointer(substream) /
1873 substream->
runtime->period_size;
1876 spin_unlock(&chip->
lock);
1878 spin_lock(&chip->
lock);
1882 spin_unlock(&chip->
lock);
1884 #ifdef ECHOCARD_HAS_MIDI
1885 if (st > 0 && chip->midi_in) {
1887 DE_MID((
"rawmidi_iread=%d\n", st));
1900 static int snd_echo_free(
struct echoaudio *chip)
1904 rest_in_peace(chip);
1924 free_firmware_cache(chip);
1936 DE_INIT((
"snd_echo_dev_free()...\n"));
1937 return snd_echo_free(chip);
1951 .dev_free = snd_echo_dev_free,
1992 snd_echo_free(chip);
2000 KBUILD_MODNAME, chip)) {
2001 snd_echo_free(chip);
2006 DE_INIT((
"pci=%p irq=%d subdev=%04x Init hardware...\n",
2007 chip->
pci, chip->
irq, chip->
pci->subsystem_device));
2014 snd_echo_free(chip);
2021 err = init_hw(chip, chip->
pci->device, chip->
pci->subsystem_device);
2023 err = set_mixer_defaults(chip);
2025 DE_INIT((
"init_hw err=%d\n", err));
2026 snd_echo_free(chip);
2032 snd_echo_free(chip);
2059 DE_INIT((
"Echoaudio driver starting...\n"));
2068 if ((err = snd_echo_create(card, pci, &chip)) < 0) {
2077 if (pci_id->
device == 0x3410)
2084 if ((err = snd_echo_new_pcm(chip)) < 0) {
2090 #ifdef ECHOCARD_HAS_MIDI
2092 if ((err = snd_echo_midi_create(card, chip)) < 0) {
2100 #ifdef ECHOCARD_HAS_VMIXER
2101 snd_echo_vmixer.count = num_pipes_out(chip) * num_busses_out(chip);
2104 #ifdef ECHOCARD_HAS_LINE_OUT_GAIN
2117 #ifdef ECHOCARD_HAS_INPUT_GAIN
2122 #ifdef ECHOCARD_HAS_INPUT_NOMINAL_LEVEL
2128 #ifdef ECHOCARD_HAS_OUTPUT_NOMINAL_LEVEL
2139 #ifdef ECHOCARD_HAS_MONITOR
2140 snd_echo_monitor_mixer.count = num_busses_in(chip) * num_busses_out(chip);
2145 #ifdef ECHOCARD_HAS_DIGITAL_IN_AUTOMUTE
2153 #ifdef ECHOCARD_HAS_DIGITAL_MODE_SWITCH
2156 for (i = 0; i < 6; i++)
2164 #ifdef ECHOCARD_HAS_EXTERNAL_CLOCK
2167 for (i = 0; i < 10; i++)
2178 #ifdef ECHOCARD_HAS_DIGITAL_IO
2183 #ifdef ECHOCARD_HAS_PHANTOM_POWER
2194 pci_set_drvdata(pci, chip);
2206 #if defined(CONFIG_PM_SLEEP)
2208 static int snd_echo_suspend(
struct device *dev)
2217 #ifdef ECHOCARD_HAS_MIDI
2220 snd_echo_midi_output_trigger(chip->midi_out, 0);
2222 spin_lock_irq(&chip->
lock);
2223 if (wait_handshake(chip)) {
2224 spin_unlock_irq(&chip->
lock);
2227 clear_handshake(chip);
2229 spin_unlock_irq(&chip->
lock);
2232 spin_unlock_irq(&chip->
lock);
2246 static int snd_echo_resume(
struct device *dev)
2250 struct comm_page *commpage, *commpage_bak;
2251 u32 pipe_alloc_mask;
2257 if (commpage_bak ==
NULL)
2262 err = init_hw(chip, chip->
pci->device, chip->
pci->subsystem_device);
2264 kfree(commpage_bak);
2265 DE_INIT((
"resume init_hw err=%d\n", err));
2266 snd_echo_free(chip);
2269 DE_INIT((
"resume init OK\n"));
2276 err = restore_dsp_rettings(chip);
2279 kfree(commpage_bak);
2282 DE_INIT((
"resume restore OK\n"));
2290 kfree(commpage_bak);
2293 KBUILD_MODNAME, chip)) {
2294 snd_echo_free(chip);
2301 #ifdef ECHOCARD_HAS_MIDI
2303 enable_midi_input(chip,
TRUE);
2305 snd_echo_midi_output_trigger(chip->midi_out, 1);
2313 #define SND_ECHO_PM_OPS &snd_echo_pm
2315 #define SND_ECHO_PM_OPS NULL
2323 chip = pci_get_drvdata(pci);
2326 pci_set_drvdata(pci,
NULL);
2337 .name = KBUILD_MODNAME,
2338 .id_table = snd_echo_ids,
2339 .probe = snd_echo_probe,