25 #include <linux/pci.h>
26 #include <linux/sched.h>
27 #include <linux/slab.h>
30 #include <linux/module.h>
41 #include <asm/byteorder.h>
79 static int snd_ymfpci_codec_ready(
struct snd_ymfpci *
chip,
int secondary)
81 unsigned long end_time;
86 if ((snd_ymfpci_readw(chip, reg) & 0x8000) == 0)
90 snd_printk(
KERN_ERR "codec_ready: codec %i is not ready [0x%x]\n", secondary, snd_ymfpci_readw(chip, reg));
99 snd_ymfpci_codec_ready(chip, 0);
108 if (snd_ymfpci_codec_ready(chip, 0))
111 if (snd_ymfpci_codec_ready(chip, 0))
115 for (i = 0; i < 600; i++)
128 case 8000:
return 0x02aaab00;
129 case 11025:
return 0x03accd00;
130 case 16000:
return 0x05555500;
131 case 22050:
return 0x07599a00;
132 case 32000:
return 0x0aaaab00;
133 case 44100:
return 0x0eb33300;
134 default:
return ((rate << 16) / 375) << 5;
138 static u32 def_rate[8] = {
139 100, 2000, 8000, 11025, 16000, 22050, 32000, 48000
142 static u32 snd_ymfpci_calc_lpfK(
u32 rate)
146 0x00570000, 0x06AA0000, 0x18B20000, 0x20930000,
147 0x2B9A0000, 0x35A10000, 0x3EAA0000, 0x40000000
152 for (i = 0; i < 8; i++)
153 if (rate <= def_rate[i])
158 static u32 snd_ymfpci_calc_lpfQ(
u32 rate)
161 static u32 val[8] = {
162 0x35280000, 0x34A70000, 0x32020000, 0x31770000,
163 0x31390000, 0x31C90000, 0x33D00000, 0x40000000
168 for (i = 0; i < 8; i++)
169 if (rate <= def_rate[i])
178 static void snd_ymfpci_hw_start(
struct snd_ymfpci *chip)
189 spin_unlock_irqrestore(&chip->
reg_lock, flags);
192 static void snd_ymfpci_hw_stop(
struct snd_ymfpci *chip)
202 while (timeout-- > 0) {
211 spin_unlock_irqrestore(&chip->
reg_lock, flags);
218 static int voice_alloc(
struct snd_ymfpci *chip,
229 if (voice->
use || (voice2 && voice2->
use))
247 snd_ymfpci_hw_start(chip);
249 snd_ymfpci_hw_start(chip);
256 static int snd_ymfpci_voice_alloc(
struct snd_ymfpci *chip,
270 result = voice_alloc(chip, type, pair, rvoice);
276 spin_unlock_irqrestore(&chip->
voice_lock, flags);
286 snd_ymfpci_hw_stop(chip);
290 pvoice->
ypcm->use_441_slot = 0;
295 spin_unlock_irqrestore(&chip->
voice_lock, flags);
335 unsigned int subs = ypcm->
substream->number;
340 bank = &voice->
bank[next_bank];
346 bank = &ypcm->
voices[1]->bank[next_bank];
357 static void snd_ymfpci_pcm_capture_interrupt(
struct snd_pcm_substream *substream)
367 if (pos < ypcm->last_pos)
471 snd_ymfpci_voice_free(ypcm->
chip, ypcm->
voices[1]);
480 snd_ymfpci_voice_free(ypcm->
chip, ypcm->
voices[0]);
487 ypcm->
voices[0]->ypcm = ypcm;
488 ypcm->
voices[0]->interrupt = snd_ymfpci_pcm_interrupt;
491 ypcm->
voices[1]->ypcm = ypcm;
496 static void snd_ymfpci_pcm_init_voice(
struct snd_ymfpci_pcm *ypcm,
unsigned int voiceidx,
502 u32 delta = snd_ymfpci_calc_delta(runtime->
rate);
503 u32 lpfQ = snd_ymfpci_calc_lpfQ(runtime->
rate);
504 u32 lpfK = snd_ymfpci_calc_lpfK(runtime->
rate);
507 u32 vol_left, vol_right;
508 u8 use_left, use_right;
517 use_left = (voiceidx & 1) == 0;
518 use_right = !use_left;
520 if (has_pcm_volume) {
530 format = runtime->
channels == 2 ? 0x00010000 : 0;
532 format |= 0x80000000;
535 voiceidx == 0 && (ypcm->
chip->src441_used == -1 ||
539 format |= 0x10000000;
541 if (ypcm->
chip->src441_used == voice->
number &&
542 (format & 0x10000000) == 0) {
543 ypcm->
chip->src441_used = -1;
546 if (runtime->
channels == 2 && (voiceidx & 1) != 0)
548 spin_unlock_irqrestore(&ypcm->
chip->voice_lock, flags);
549 for (nbank = 0; nbank < 2; nbank++) {
550 bank = &voice->
bank[nbank];
551 memset(bank, 0,
sizeof(*bank));
623 static int snd_ymfpci_ac3_done(
struct snd_ymfpci *chip)
646 if ((err = snd_ymfpci_pcm_voice_alloc(ypcm,
params_channels(hw_params))) < 0)
662 snd_ymfpci_irq_wait(chip);
665 snd_ymfpci_voice_free(chip, ypcm->
voices[1]);
669 snd_ymfpci_voice_free(chip, ypcm->
voices[0]);
687 for (nvoice = 0; nvoice < runtime->
channels; nvoice++)
688 snd_ymfpci_pcm_init_voice(ypcm, nvoice, runtime,
689 substream->
pcm == chip->
pcm);
710 snd_ymfpci_irq_wait(chip);
728 rate = ((48000 * 4096) / runtime->
rate) - 1;
748 for (nbank = 0; nbank < 2; nbank++) {
781 static void snd_ymfpci_irq_wait(
struct snd_ymfpci *chip)
786 while (loops-- > 0) {
787 if ((snd_ymfpci_readl(chip,
YDSXGR_MODE) & 3) == 0)
789 init_waitqueue_entry(&wait,
current);
804 if (status & 0x80000000) {
808 voice = &chip->
voices[nvoice];
891 static void snd_ymfpci_pcm_free_substream(
struct snd_pcm_runtime *runtime)
903 runtime->
hw = snd_ymfpci_playback;
926 static void ymfpci_open_extension(
struct snd_ymfpci *chip)
939 static void ymfpci_close_extension(
struct snd_ymfpci *chip)
957 if ((err = snd_ymfpci_playback_open_1(substream)) < 0)
965 ymfpci_open_extension(chip);
979 if ((err = snd_ymfpci_playback_open_1(substream)) < 0)
988 ymfpci_open_extension(chip);
1007 if ((err = snd_ymfpci_playback_open_1(substream)) < 0)
1014 ymfpci_open_extension(chip);
1028 runtime->
hw = snd_ymfpci_capture;
1049 snd_ymfpci_hw_start(chip);
1055 return snd_ymfpci_capture_open(substream, 0);
1060 return snd_ymfpci_capture_open(substream, 1);
1076 ymfpci_close_extension(chip);
1079 return snd_ymfpci_playback_close_1(substream);
1088 ymfpci_close_extension(chip);
1096 return snd_ymfpci_playback_close_1(substream);
1106 ymfpci_close_extension(chip);
1109 return snd_ymfpci_playback_close_1(substream);
1120 snd_ymfpci_hw_stop(chip);
1125 static struct snd_pcm_ops snd_ymfpci_playback_ops = {
1126 .open = snd_ymfpci_playback_open,
1127 .close = snd_ymfpci_playback_close,
1129 .hw_params = snd_ymfpci_playback_hw_params,
1130 .hw_free = snd_ymfpci_playback_hw_free,
1131 .prepare = snd_ymfpci_playback_prepare,
1132 .trigger = snd_ymfpci_playback_trigger,
1133 .pointer = snd_ymfpci_playback_pointer,
1136 static struct snd_pcm_ops snd_ymfpci_capture_rec_ops = {
1137 .open = snd_ymfpci_capture_rec_open,
1138 .close = snd_ymfpci_capture_close,
1140 .hw_params = snd_ymfpci_capture_hw_params,
1141 .hw_free = snd_ymfpci_capture_hw_free,
1142 .prepare = snd_ymfpci_capture_prepare,
1143 .trigger = snd_ymfpci_capture_trigger,
1144 .pointer = snd_ymfpci_capture_pointer,
1154 if ((err =
snd_pcm_new(chip->
card,
"YMFPCI", device, 32, 1, &pcm)) < 0)
1179 static struct snd_pcm_ops snd_ymfpci_capture_ac97_ops = {
1180 .open = snd_ymfpci_capture_ac97_open,
1181 .close = snd_ymfpci_capture_close,
1183 .hw_params = snd_ymfpci_capture_hw_params,
1184 .hw_free = snd_ymfpci_capture_hw_free,
1185 .prepare = snd_ymfpci_capture_prepare,
1186 .trigger = snd_ymfpci_capture_trigger,
1187 .pointer = snd_ymfpci_capture_pointer,
1197 if ((err =
snd_pcm_new(chip->
card,
"YMFPCI - PCM2", device, 0, 1, &pcm)) < 0)
1217 static struct snd_pcm_ops snd_ymfpci_playback_spdif_ops = {
1218 .open = snd_ymfpci_playback_spdif_open,
1219 .close = snd_ymfpci_playback_spdif_close,
1221 .hw_params = snd_ymfpci_playback_hw_params,
1222 .hw_free = snd_ymfpci_playback_hw_free,
1223 .prepare = snd_ymfpci_playback_prepare,
1224 .trigger = snd_ymfpci_playback_trigger,
1225 .pointer = snd_ymfpci_playback_pointer,
1235 if ((err =
snd_pcm_new(chip->
card,
"YMFPCI - IEC958", device, 1, 0, &pcm)) < 0)
1254 static struct snd_pcm_ops snd_ymfpci_playback_4ch_ops = {
1255 .open = snd_ymfpci_playback_4ch_open,
1256 .close = snd_ymfpci_playback_4ch_close,
1258 .hw_params = snd_ymfpci_playback_hw_params,
1259 .hw_free = snd_ymfpci_playback_hw_free,
1260 .prepare = snd_ymfpci_playback_prepare,
1261 .trigger = snd_ymfpci_playback_trigger,
1262 .pointer = snd_ymfpci_playback_pointer,
1280 if ((err =
snd_pcm_new(chip->
card,
"YMFPCI - Rear", device, 1, 0, &pcm)) < 0)
1295 surround_map, 2, 0,
NULL);
1311 static int snd_ymfpci_spdif_default_get(
struct snd_kcontrol *kcontrol,
1324 static int snd_ymfpci_spdif_default_put(
struct snd_kcontrol *kcontrol,
1331 val = ((ucontrol->
value.iec958.status[0] & 0x3e) << 0) |
1332 (ucontrol->
value.iec958.status[1] << 8);
1346 .info = snd_ymfpci_spdif_default_info,
1347 .get = snd_ymfpci_spdif_default_get,
1348 .put = snd_ymfpci_spdif_default_put
1358 static int snd_ymfpci_spdif_mask_get(
struct snd_kcontrol *kcontrol,
1364 ucontrol->
value.iec958.status[0] = 0x3e;
1365 ucontrol->
value.iec958.status[1] = 0xff;
1375 .info = snd_ymfpci_spdif_mask_info,
1376 .get = snd_ymfpci_spdif_mask_get,
1386 static int snd_ymfpci_spdif_stream_get(
struct snd_kcontrol *kcontrol,
1399 static int snd_ymfpci_spdif_stream_put(
struct snd_kcontrol *kcontrol,
1406 val = ((ucontrol->
value.iec958.status[0] & 0x3e) << 0) |
1407 (ucontrol->
value.iec958.status[1] << 8);
1422 .info = snd_ymfpci_spdif_stream_info,
1423 .get = snd_ymfpci_spdif_stream_get,
1424 .put = snd_ymfpci_spdif_stream_put
1429 static const char *
const texts[3] = {
"AC'97",
"IEC958",
"ZV Port"};
1443 value->
value.enumerated.item[0] = 0;
1445 value->
value.enumerated.item[0] = 1 + ((reg & 0x200) != 0);
1456 if (value->
value.enumerated.item[0] == 0)
1457 reg = old_reg & ~0x100;
1459 reg = (old_reg & ~0x300) | 0x100 | ((value->
value.enumerated.item[0] == 2) << 9);
1462 return reg != old_reg;
1468 .name =
"Direct Recording Source",
1469 .info = snd_ymfpci_drec_source_info,
1470 .get = snd_ymfpci_drec_source_get,
1471 .put = snd_ymfpci_drec_source_put
1478 #define YMFPCI_SINGLE(xname, xindex, reg, shift) \
1479 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = xindex, \
1480 .info = snd_ymfpci_info_single, \
1481 .get = snd_ymfpci_get_single, .put = snd_ymfpci_put_single, \
1482 .private_value = ((reg) | ((shift) << 16)) }
1484 #define snd_ymfpci_info_single snd_ctl_boolean_mono_info
1486 static int snd_ymfpci_get_single(
struct snd_kcontrol *kcontrol,
1491 unsigned int shift = (kcontrol->
private_value >> 16) & 0xff;
1492 unsigned int mask = 1;
1499 ucontrol->
value.integer.value[0] =
1500 (snd_ymfpci_readl(chip, reg) >> shift) & mask;
1504 static int snd_ymfpci_put_single(
struct snd_kcontrol *kcontrol,
1509 unsigned int shift = (kcontrol->
private_value >> 16) & 0xff;
1510 unsigned int mask = 1;
1512 unsigned int val, oval;
1519 val = (ucontrol->
value.integer.value[0] &
mask);
1522 oval = snd_ymfpci_readl(chip, reg);
1523 val = (oval & ~(mask << shift)) |
val;
1524 change = val != oval;
1525 snd_ymfpci_writel(chip, reg, val);
1532 #define YMFPCI_DOUBLE(xname, xindex, reg) \
1533 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = xindex, \
1534 .access = SNDRV_CTL_ELEM_ACCESS_READWRITE | SNDRV_CTL_ELEM_ACCESS_TLV_READ, \
1535 .info = snd_ymfpci_info_double, \
1536 .get = snd_ymfpci_get_double, .put = snd_ymfpci_put_double, \
1537 .private_value = reg, \
1538 .tlv = { .p = db_scale_native } }
1557 unsigned int shift_left = 0,
shift_right = 16, mask = 16383;
1563 val = snd_ymfpci_readl(chip, reg);
1565 ucontrol->
value.integer.value[0] = (val >> shift_left) & mask;
1574 unsigned int shift_left = 0,
shift_right = 16, mask = 16383;
1576 unsigned int val1, val2, oval;
1580 val1 = ucontrol->
value.integer.value[0] &
mask;
1581 val2 = ucontrol->
value.integer.value[1] &
mask;
1582 val1 <<= shift_left;
1585 oval = snd_ymfpci_readl(chip, reg);
1586 val1 = (oval & ~((mask << shift_left) | (mask <<
shift_right))) | val1 | val2;
1587 change = val1 != oval;
1588 snd_ymfpci_writel(chip, reg, val1);
1593 static int snd_ymfpci_put_nativedacvol(
struct snd_kcontrol *kcontrol,
1600 unsigned int value, oval;
1602 value = ucontrol->
value.integer.value[0] & 0x3fff;
1603 value |= (ucontrol->
value.integer.value[1] & 0x3fff) << 16;
1605 oval = snd_ymfpci_readl(chip, reg);
1606 change = value != oval;
1607 snd_ymfpci_writel(chip, reg, value);
1608 snd_ymfpci_writel(chip, reg2, value);
1616 #define snd_ymfpci_info_dup4ch snd_ctl_boolean_mono_info
1637 .name =
"4ch Duplication",
1640 .get = snd_ymfpci_get_dup4ch,
1641 .put = snd_ymfpci_put_dup4ch,
1647 .name =
"Wave Playback Volume",
1650 .info = snd_ymfpci_info_double,
1651 .get = snd_ymfpci_get_double,
1652 .put = snd_ymfpci_put_nativedacvol,
1654 .tlv = { .p = db_scale_native },
1678 static int snd_ymfpci_get_gpio_out(
struct snd_ymfpci *chip,
int pin)
1681 unsigned long flags;
1685 reg &= ~(1 << (pin + 8));
1690 mode &= ~(3 << (pin * 2));
1694 spin_unlock_irqrestore(&chip->
reg_lock, flags);
1695 return (mode >> pin) & 1;
1698 static int snd_ymfpci_set_gpio_out(
struct snd_ymfpci *chip,
int pin,
int enable)
1701 unsigned long flags;
1706 reg &= ~(1 << (pin + 8));
1710 spin_unlock_irqrestore(&chip->
reg_lock, flags);
1715 #define snd_ymfpci_gpio_sw_info snd_ctl_boolean_mono_info
1721 ucontrol->
value.integer.value[0] = snd_ymfpci_get_gpio_out(chip, pin);
1730 if (snd_ymfpci_get_gpio_out(chip, pin) != ucontrol->
value.integer.value[0]) {
1731 snd_ymfpci_set_gpio_out(chip, pin, !!ucontrol->
value.integer.value[0]);
1732 ucontrol->
value.integer.value[0] = snd_ymfpci_get_gpio_out(chip, pin);
1739 .
name =
"Shared Rear/Line-In Switch",
1742 .get = snd_ymfpci_gpio_sw_get,
1743 .put = snd_ymfpci_gpio_sw_put,
1751 static int snd_ymfpci_pcm_vol_info(
struct snd_kcontrol *kcontrol,
1761 static int snd_ymfpci_pcm_vol_get(
struct snd_kcontrol *kcontrol,
1765 unsigned int subs = kcontrol->
id.subdevice;
1772 static int snd_ymfpci_pcm_vol_put(
struct snd_kcontrol *kcontrol,
1776 unsigned int subs = kcontrol->
id.subdevice;
1778 unsigned long flags;
1780 if (ucontrol->
value.integer.value[0] != chip->
pcm_mixer[subs].left ||
1781 ucontrol->
value.integer.value[1] != chip->
pcm_mixer[subs].right) {
1784 if (chip->
pcm_mixer[subs].left > 0x8000)
1786 if (chip->
pcm_mixer[subs].right > 0x8000)
1796 spin_unlock_irqrestore(&chip->
voice_lock, flags);
1804 .name =
"PCM Playback Volume",
1807 .info = snd_ymfpci_pcm_vol_info,
1808 .get = snd_ymfpci_pcm_vol_get,
1809 .put = snd_ymfpci_pcm_vol_put,
1823 static void snd_ymfpci_mixer_free_ac97(
struct snd_ac97 *ac97)
1837 .
write = snd_ymfpci_codec_write,
1838 .read = snd_ymfpci_codec_read,
1843 chip->
ac97_bus->private_free = snd_ymfpci_mixer_free_ac97_bus;
1846 memset(&ac97, 0,
sizeof(ac97));
1856 for (idx = 0; idx <
ARRAY_SIZE(snd_ymfpci_controls); idx++) {
1896 for (idx = 0; idx < 32; ++
idx) {
1900 kctl->
id.device = chip->
pcm->device;
1901 kctl->
id.subdevice =
idx;
1908 substream = substream->
next;
1922 unsigned long flags;
1929 count = timer->
sticks - 1;
1940 spin_unlock_irqrestore(&chip->
reg_lock, flags);
1944 static int snd_ymfpci_timer_stop(
struct snd_timer *timer)
1947 unsigned long flags;
1952 spin_unlock_irqrestore(&chip->
reg_lock, flags);
1956 static int snd_ymfpci_timer_precise_resolution(
struct snd_timer *timer,
1957 unsigned long *num,
unsigned long *
den)
1966 .resolution = 10417,
1968 .start = snd_ymfpci_timer_start,
1969 .stop = snd_ymfpci_timer_stop,
1970 .precise_resolution = snd_ymfpci_timer_precise_resolution,
1987 timer->
hw = snd_ymfpci_timer_hw;
2004 snd_iprintf(buffer,
"YMFPCI\n\n");
2006 snd_iprintf(buffer,
"%04x: %04x\n", i, snd_ymfpci_readl(chip, i));
2013 if (! snd_card_proc_new(card,
"ymfpci", &entry))
2014 snd_info_set_text_ops(entry, chip, snd_ymfpci_proc_read);
2022 static void snd_ymfpci_aclink_reset(
struct pci_dev * pci)
2027 #if 0 // force to reset
2040 static void snd_ymfpci_enable_dsp(
struct snd_ymfpci *chip)
2045 static void snd_ymfpci_disable_dsp(
struct snd_ymfpci *chip)
2053 while (timeout-- > 0) {
2055 if ((val & 0x00000002) == 0)
2060 static int snd_ymfpci_request_firmware(
struct snd_ymfpci *chip)
2079 name = is_1e ?
"yamaha/ds1e_ctrl.fw" :
"yamaha/ds1_ctrl.fw";
2085 " has wrong size\n");
2098 static void snd_ymfpci_download_image(
struct snd_ymfpci *chip)
2105 snd_ymfpci_disable_dsp(chip);
2128 snd_ymfpci_enable_dsp(chip);
2133 long size, playback_ctrl_size;
2134 int voice, bank,
reg;
2144 size =
ALIGN(playback_ctrl_size, 0x100) +
2162 ptr +=
ALIGN(playback_ctrl_size, 0x100);
2163 ptr_addr +=
ALIGN(playback_ctrl_size, 0x100);
2165 chip->
voices[voice].number = voice;
2167 chip->
voices[voice].bank_addr = ptr_addr;
2168 for (bank = 0; bank < 2; bank++) {
2174 ptr = (
char *)
ALIGN((
unsigned long)
ptr, 0x100);
2175 ptr_addr =
ALIGN(ptr_addr, 0x100);
2179 for (bank = 0; bank < 2; bank++) {
2184 ptr = (
char *)
ALIGN((
unsigned long)
ptr, 0x100);
2185 ptr_addr =
ALIGN(ptr_addr, 0x100);
2189 for (bank = 0; bank < 2; bank++) {
2194 ptr = (
char *)
ALIGN((
unsigned long)
ptr, 0x100);
2195 ptr_addr =
ALIGN(ptr_addr, 0x100);
2217 for (reg = 0x80; reg < 0xc0; reg += 4)
2218 snd_ymfpci_writel(chip, reg, 0);
2231 static int snd_ymfpci_free(
struct snd_ymfpci *chip)
2243 snd_ymfpci_disable_dsp(chip);
2253 snd_ymfpci_ac3_done(chip);
2263 #ifdef CONFIG_PM_SLEEP
2264 vfree(chip->saved_regs);
2290 return snd_ymfpci_free(chip);
2293 #ifdef CONFIG_PM_SLEEP
2294 static int saved_regs_index[] = {
2321 #define YDSXGR_NUM_SAVED_REGS ARRAY_SIZE(saved_regs_index)
2323 static int snd_ymfpci_suspend(
struct device *
dev)
2331 snd_pcm_suspend_all(chip->
pcm);
2332 snd_pcm_suspend_all(chip->
pcm2);
2334 snd_pcm_suspend_all(chip->
pcm_4ch);
2335 snd_ac97_suspend(chip->
ac97);
2336 for (i = 0; i < YDSXGR_NUM_SAVED_REGS; i++)
2337 chip->saved_regs[i] = snd_ymfpci_readl(chip, saved_regs_index[i]);
2338 chip->saved_ydsxgr_mode = snd_ymfpci_readl(chip,
YDSXGR_MODE);
2340 &chip->saved_dsxg_legacy);
2342 &chip->saved_dsxg_elegacy);
2345 snd_ymfpci_disable_dsp(chip);
2352 static int snd_ymfpci_resume(
struct device *dev)
2363 "disabling device\n");
2368 snd_ymfpci_aclink_reset(pci);
2369 snd_ymfpci_codec_ready(chip, 0);
2370 snd_ymfpci_download_image(chip);
2373 for (i = 0; i < YDSXGR_NUM_SAVED_REGS; i++)
2374 snd_ymfpci_writel(chip, saved_regs_index[i], chip->saved_regs[i]);
2376 snd_ac97_resume(chip->
ac97);
2379 chip->saved_dsxg_legacy);
2381 chip->saved_dsxg_elegacy);
2386 snd_ymfpci_writel(chip,
YDSXGR_MODE, chip->saved_ydsxgr_mode);
2436 snd_ymfpci_free(chip);
2440 KBUILD_MODNAME, chip)) {
2442 snd_ymfpci_free(chip);
2447 snd_ymfpci_aclink_reset(pci);
2448 if (snd_ymfpci_codec_ready(chip, 0) < 0) {
2449 snd_ymfpci_free(chip);
2453 err = snd_ymfpci_request_firmware(chip);
2456 snd_ymfpci_free(chip);
2459 snd_ymfpci_download_image(chip);
2463 if (snd_ymfpci_memalloc(chip) < 0) {
2464 snd_ymfpci_free(chip);
2468 if ((err = snd_ymfpci_ac3_init(chip)) < 0) {
2469 snd_ymfpci_free(chip);
2473 #ifdef CONFIG_PM_SLEEP
2474 chip->saved_regs =
vmalloc(YDSXGR_NUM_SAVED_REGS *
sizeof(
u32));
2475 if (chip->saved_regs ==
NULL) {
2476 snd_ymfpci_free(chip);
2482 snd_ymfpci_free(chip);
2486 snd_ymfpci_proc_init(card, chip);