Lines Matching +full:0 +full:x20930000
66 if ((snd_ymfpci_readw(chip, reg) & 0x8000) == 0)
67 return 0;
71 "codec_ready: codec %i is not ready [0x%x]\n",
81 snd_ymfpci_codec_ready(chip, 0);
90 if (snd_ymfpci_codec_ready(chip, 0))
91 return ~0;
93 if (snd_ymfpci_codec_ready(chip, 0))
94 return ~0;
97 for (i = 0; i < 600; i++)
110 case 8000: return 0x02aaab00;
111 case 11025: return 0x03accd00;
112 case 16000: return 0x05555500;
113 case 22050: return 0x07599a00;
114 case 32000: return 0x0aaaab00;
115 case 44100: return 0x0eb33300;
128 0x00570000, 0x06AA0000, 0x18B20000, 0x20930000,
129 0x2B9A0000, 0x35A10000, 0x3EAA0000, 0x40000000
133 return 0x40000000; /* FIXME: What's the right value? */
134 for (i = 0; i < 8; i++)
137 return val[0];
144 0x35280000, 0x34A70000, 0x32020000, 0x31770000,
145 0x31390000, 0x31C90000, 0x33D00000, 0x40000000
149 return 0x370A0000;
150 for (i = 0; i < 8; i++)
153 return val[0];
163 if (chip->start_count++ > 0)
175 if (--chip->start_count > 0)
179 while (timeout-- > 0) {
180 if ((snd_ymfpci_readl(chip, YDSXGR_STATUS) & 2) == 0)
184 atomic_set(&chip->interrupt_sleep_count, 0);
201 for (idx = 0; idx < YDSXG_PLAYBACK_VOICES; idx += pair ? 2 : 1) {
226 return 0;
245 if (result == 0 || type != YMFPCI_PCM)
261 pvoice->ypcm->use_441_slot = 0;
263 pvoice->use = pvoice->pcm = pvoice->synth = pvoice->midi = 0;
266 return 0;
295 "done - active_bank = 0x%x, start = 0x%x\n",
347 "done - active_bank = 0x%x, start = 0x%x\n",
364 int result = 0;
367 if (ypcm->voices[0] == NULL)
373 chip->ctrl_playback[ypcm->voices[0]->number + 1] = cpu_to_le32(ypcm->voices[0]->bank_addr);
381 kctl->vd[0].access |= SNDRV_CTL_ELEM_ACCESS_INACTIVE;
386 chip->ctrl_playback[ypcm->voices[0]->number + 1] = 0;
388 chip->ctrl_playback[ypcm->voices[1]->number + 1] = 0;
389 ypcm->running = 0;
403 int result = 0;
420 ypcm->running = 0;
437 if (voices == 1 && ypcm->voices[0] != NULL)
438 return 0; /* already allocated */
439 if (voices == 2 && ypcm->voices[0] != NULL && ypcm->voices[1] != NULL)
440 return 0; /* already allocated */
442 if (ypcm->voices[0] != NULL && ypcm->voices[1] == NULL) {
443 snd_ymfpci_voice_free(ypcm->chip, ypcm->voices[0]);
444 ypcm->voices[0] = NULL;
447 err = snd_ymfpci_voice_alloc(ypcm->chip, YMFPCI_PCM, voices > 1, &ypcm->voices[0]);
448 if (err < 0)
450 ypcm->voices[0]->ypcm = ypcm;
451 ypcm->voices[0]->interrupt = snd_ymfpci_pcm_interrupt;
453 ypcm->voices[1] = &ypcm->chip->voices[ypcm->voices[0]->number + 1];
456 return 0;
479 use_left = (voiceidx & 1) == 0;
488 vol_left = cpu_to_le32(0x40000000);
489 vol_right = cpu_to_le32(0x40000000);
492 format = runtime->channels == 2 ? 0x00010000 : 0;
494 format |= 0x80000000;
497 voiceidx == 0 && (ypcm->chip->src441_used == -1 ||
501 format |= 0x10000000;
504 (format & 0x10000000) == 0) {
506 ypcm->use_441_slot = 0;
508 if (runtime->channels == 2 && (voiceidx & 1) != 0)
511 for (nbank = 0; nbank < 2; nbank++) {
513 memset(bank, 0, sizeof(*bank));
523 bank->eg_gain_end = cpu_to_le32(0x40000000);
566 4096, &chip->ac3_tmp_base) < 0)
569 chip->bank_effect[3][0]->base =
571 chip->bank_effect[3][0]->loop_end =
573 chip->bank_effect[4][0]->base =
575 chip->bank_effect[4][0]->loop_end =
581 return 0;
595 return 0;
606 if (err < 0)
608 return 0;
618 return 0;
627 if (ypcm->voices[0]) {
628 snd_ymfpci_voice_free(chip, ypcm->voices[0]);
629 ypcm->voices[0] = NULL;
631 return 0;
644 ypcm->period_pos = 0;
645 ypcm->last_pos = 0;
646 for (nvoice = 0; nvoice < runtime->channels; nvoice++)
652 kctl->vd[0].access &= ~SNDRV_CTL_ELEM_ACCESS_INACTIVE;
655 return 0;
664 return 0;
678 ypcm->period_pos = 0;
679 ypcm->last_pos = 0;
680 ypcm->shift = 0;
682 format = 0;
692 case 0:
701 for (nbank = 0; nbank < 2; nbank++) {
705 bank->start = 0;
706 bank->num_of_loops = 0;
708 return 0;
716 struct snd_ymfpci_voice *voice = ypcm->voices[0];
719 return 0;
730 return 0;
739 while (loops-- > 0) {
740 if ((snd_ymfpci_readl(chip, YDSXGR_MODE) & 3) == 0)
757 if (status & 0x80000000) {
760 for (nvoice = 0; nvoice < YDSXG_PLAYBACK_VOICES; nvoice++) {
765 for (nvoice = 0; nvoice < YDSXG_CAPTURE_VOICES; nvoice++) {
769 #if 0
770 for (nvoice = 0; nvoice < YDSXG_EFFECT_VOICES; nvoice++) {
777 snd_ymfpci_writel(chip, YDSXGR_STATUS, 0x80000000);
783 atomic_set(&chip->interrupt_sleep_count, 0);
819 .fifo_size = 0,
841 .fifo_size = 0,
861 if (err < 0)
864 if (err < 0)
875 return 0;
887 (snd_ymfpci_readw(chip, YDSXGR_SECCONFIG) & ~0x0330) | 0x0010);
899 (snd_ymfpci_readw(chip, YDSXGR_SECCONFIG) & ~0x0330) & ~0x0010);
911 if (err < 0)
915 ypcm->output_rear = chip->mode_dup4ch ? 1 : 0;
916 ypcm->swap_rear = 0;
922 return 0;
933 if (err < 0)
936 ypcm->output_front = 0;
948 chip->spdif_pcm_ctl->vd[0].access &= ~SNDRV_CTL_ELEM_ACCESS_INACTIVE;
951 return 0;
962 if (err < 0)
965 ypcm->output_front = 0;
967 ypcm->swap_rear = 0;
971 return 0;
987 if (err < 0)
990 if (err < 0)
1004 return 0;
1009 return snd_ymfpci_capture_open(substream, 0);
1019 return 0;
1028 if (ypcm->output_rear && chip->rear_opened > 0) {
1041 chip->spdif_opened = 0;
1047 chip->spdif_pcm_ctl->vd[0].access |= SNDRV_CTL_ELEM_ACCESS_INACTIVE;
1058 if (chip->rear_opened > 0) {
1076 return 0;
1104 if (err < 0)
1112 pcm->info_flags = 0;
1120 snd_pcm_std_chmaps, 2, 0, NULL);
1137 err = snd_pcm_new(chip->card, "YMFPCI - PCM2", device, 0, 1, &pcm);
1138 if (err < 0)
1145 pcm->info_flags = 0;
1153 return 0;
1171 err = snd_pcm_new(chip->card, "YMFPCI - IEC958", device, 1, 0, &pcm);
1172 if (err < 0)
1179 pcm->info_flags = 0;
1186 return 0;
1212 err = snd_pcm_new(chip->card, "YMFPCI - Rear", device, 1, 0, &pcm);
1213 if (err < 0)
1220 pcm->info_flags = 0;
1228 surround_map, 2, 0, NULL);
1235 return 0;
1244 ucontrol->value.iec958.status[0] = (chip->spdif_bits >> 0) & 0xff;
1245 ucontrol->value.iec958.status[1] = (chip->spdif_bits >> 8) & 0xff;
1247 return 0;
1257 val = ((ucontrol->value.iec958.status[0] & 0x3e) << 0) |
1280 return 0;
1289 ucontrol->value.iec958.status[0] = 0x3e;
1290 ucontrol->value.iec958.status[1] = 0xff;
1291 return 0;
1307 return 0;
1316 ucontrol->value.iec958.status[0] = (chip->spdif_pcm_bits >> 0) & 0xff;
1317 ucontrol->value.iec958.status[1] = (chip->spdif_pcm_bits >> 8) & 0xff;
1319 return 0;
1329 val = ((ucontrol->value.iec958.status[0] & 0x3e) << 0) |
1363 if (!(reg & 0x100))
1364 value->value.enumerated.item[0] = 0;
1366 value->value.enumerated.item[0] = 1 + ((reg & 0x200) != 0);
1367 return 0;
1377 if (value->value.enumerated.item[0] == 0)
1378 reg = old_reg & ~0x100;
1380 reg = (old_reg & ~0x300) | 0x100 | ((value->value.enumerated.item[0] == 2) << 9);
1410 int reg = kcontrol->private_value & 0xffff;
1411 unsigned int shift = (kcontrol->private_value >> 16) & 0xff;
1419 ucontrol->value.integer.value[0] =
1421 return 0;
1428 int reg = kcontrol->private_value & 0xffff;
1429 unsigned int shift = (kcontrol->private_value >> 16) & 0xff;
1439 val = (ucontrol->value.integer.value[0] & mask);
1449 static const DECLARE_TLV_DB_LINEAR(db_scale_native, TLV_DB_GAIN_MUTE, 0);
1463 if (reg < 0x80 || reg >= 0xc0)
1467 uinfo->value.integer.min = 0;
1469 return 0;
1476 unsigned int shift_left = 0, shift_right = 16, mask = 16383;
1479 if (reg < 0x80 || reg >= 0xc0)
1483 ucontrol->value.integer.value[0] = (val >> shift_left) & mask;
1485 return 0;
1492 unsigned int shift_left = 0, shift_right = 16, mask = 16383;
1496 if (reg < 0x80 || reg >= 0xc0)
1498 val1 = ucontrol->value.integer.value[0] & mask;
1519 value = ucontrol->value.integer.value[0] & 0x3fff;
1520 value |= (ucontrol->value.integer.value[1] & 0x3fff) << 16;
1537 ucontrol->value.integer.value[0] = chip->mode_dup4ch;
1538 return 0;
1545 change = (ucontrol->value.integer.value[0] != chip->mode_dup4ch);
1547 chip->mode_dup4ch = !!ucontrol->value.integer.value[0];
1572 YMFPCI_DOUBLE("Wave Capture Volume", 0, YDSXGR_NATIVEDACLOOPVOL),
1573 YMFPCI_DOUBLE("Digital Capture Volume", 0, YDSXGR_NATIVEDACINVOL),
1575 YMFPCI_DOUBLE("ADC Playback Volume", 0, YDSXGR_PRIADCOUTVOL),
1576 YMFPCI_DOUBLE("ADC Capture Volume", 0, YDSXGR_PRIADCLOOPVOL),
1579 YMFPCI_DOUBLE("FM Legacy Playback Volume", 0, YDSXGR_LEGACYOUTVOL),
1580 YMFPCI_DOUBLE(SNDRV_CTL_NAME_IEC958("AC97 ", PLAYBACK,VOLUME), 0, YDSXGR_ZVOUTVOL),
1581 YMFPCI_DOUBLE(SNDRV_CTL_NAME_IEC958("", CAPTURE,VOLUME), 0, YDSXGR_ZVLOOPVOL),
1584 YMFPCI_SINGLE(SNDRV_CTL_NAME_IEC958("",PLAYBACK,SWITCH), 0, YDSXGR_SPDIFOUTCTRL, 0),
1585 YMFPCI_SINGLE(SNDRV_CTL_NAME_IEC958("",CAPTURE,SWITCH), 0, YDSXGR_SPDIFINCTRL, 0),
1586 YMFPCI_SINGLE(SNDRV_CTL_NAME_IEC958("Loop",NONE,NONE), 0, YDSXGR_SPDIFINCTRL, 4),
1624 return 0;
1633 ucontrol->value.integer.value[0] = snd_ymfpci_get_gpio_out(chip, pin);
1634 return 0;
1642 if (snd_ymfpci_get_gpio_out(chip, pin) != ucontrol->value.integer.value[0]) {
1643 snd_ymfpci_set_gpio_out(chip, pin, !!ucontrol->value.integer.value[0]);
1644 ucontrol->value.integer.value[0] = snd_ymfpci_get_gpio_out(chip, pin);
1647 return 0;
1668 uinfo->value.integer.min = 0;
1669 uinfo->value.integer.max = 0x8000;
1670 return 0;
1679 ucontrol->value.integer.value[0] = chip->pcm_mixer[subs].left;
1681 return 0;
1691 if (ucontrol->value.integer.value[0] != chip->pcm_mixer[subs].left ||
1693 chip->pcm_mixer[subs].left = ucontrol->value.integer.value[0];
1695 if (chip->pcm_mixer[subs].left > 0x8000)
1696 chip->pcm_mixer[subs].left = 0x8000;
1697 if (chip->pcm_mixer[subs].right > 0x8000)
1698 chip->pcm_mixer[subs].right = 0x8000;
1709 return 0;
1751 err = snd_ac97_bus(chip->card, 0, &ops, chip, &chip->ac97_bus);
1752 if (err < 0)
1757 memset(&ac97, 0, sizeof(ac97));
1761 if (err < 0)
1766 AC97_EA_VRA|AC97_EA_VRM, 0);
1768 for (idx = 0; idx < ARRAY_SIZE(snd_ymfpci_controls); idx++) {
1770 if (err < 0)
1776 if (err < 0)
1786 if (err < 0)
1791 if (err < 0)
1796 if (err < 0)
1804 if (err < 0)
1813 if (err < 0)
1819 for (idx = 0; idx < 32; ++idx) {
1827 if (err < 0)
1829 chip->pcm_mixer[idx].left = 0x8000;
1830 chip->pcm_mixer[idx].right = 0x8000;
1835 return 0;
1862 snd_ymfpci_writeb(chip, YDSXGR_TIMERCTRL, 0x03);
1863 return 0;
1872 snd_ymfpci_writeb(chip, YDSXGR_TIMERCTRL, 0x00);
1873 return 0;
1881 return 0;
1887 .ticks = 0x10000,
1903 tid.subdevice = 0;
1905 if (err >= 0) {
1926 for (i = 0; i <= YDSXGR_WORKBASE; i += 4)
1944 #if 0 // force to reset
1945 if (cmd & 0x03) {
1947 pci_write_config_byte(pci, PCIR_DSXG_CTRL, cmd & 0xfc);
1948 pci_write_config_byte(pci, PCIR_DSXG_CTRL, cmd | 0x03);
1949 pci_write_config_byte(pci, PCIR_DSXG_CTRL, cmd & 0xfc);
1950 pci_write_config_word(pci, PCIR_DSXG_PWRCTRL1, 0);
1951 pci_write_config_word(pci, PCIR_DSXG_PWRCTRL2, 0);
1952 #if 0
1959 snd_ymfpci_writel(chip, YDSXGR_CONFIG, 0x00000001);
1969 snd_ymfpci_writel(chip, YDSXGR_CONFIG, 0x00000000);
1970 while (timeout-- > 0) {
1972 if ((val & 0x00000002) == 0)
1984 if (err >= 0) {
1991 if (err < 0)
2000 if (err >= 0) {
2007 if (err < 0)
2009 return 0;
2022 snd_ymfpci_writel(chip, YDSXGR_NATIVEDACOUTVOL, 0x00000000);
2024 snd_ymfpci_writel(chip, YDSXGR_MODE, 0x00010000);
2025 snd_ymfpci_writel(chip, YDSXGR_MODE, 0x00000000);
2026 snd_ymfpci_writel(chip, YDSXGR_MAPOFREC, 0x00000000);
2027 snd_ymfpci_writel(chip, YDSXGR_MAPOFEFFECT, 0x00000000);
2028 snd_ymfpci_writel(chip, YDSXGR_PLAYCTRLBASE, 0x00000000);
2029 snd_ymfpci_writel(chip, YDSXGR_RECCTRLBASE, 0x00000000);
2030 snd_ymfpci_writel(chip, YDSXGR_EFFCTRLBASE, 0x00000000);
2032 snd_ymfpci_writew(chip, YDSXGR_GLOBALCTRL, ctrl & ~0x0007);
2036 for (i = 0; i < YDSXG_DSPLENGTH / 4; i++)
2042 for (i = 0; i < YDSXG_CTRLLENGTH / 4; i++)
2062 size = ALIGN(playback_ctrl_size, 0x100) +
2063 ALIGN(chip->bank_size_playback * 2 * YDSXG_PLAYBACK_VOICES, 0x100) +
2064 ALIGN(chip->bank_size_capture * 2 * YDSXG_CAPTURE_VOICES, 0x100) +
2065 ALIGN(chip->bank_size_effect * 2 * YDSXG_EFFECT_VOICES, 0x100) +
2075 memset(ptr, 0, size); /* for sure */
2080 chip->ctrl_playback[0] = cpu_to_le32(YDSXG_PLAYBACK_VOICES);
2081 ptr += ALIGN(playback_ctrl_size, 0x100);
2082 ptr_addr += ALIGN(playback_ctrl_size, 0x100);
2083 for (voice = 0; voice < YDSXG_PLAYBACK_VOICES; voice++) {
2087 for (bank = 0; bank < 2; bank++) {
2093 ptr = (char *)ALIGN((unsigned long)ptr, 0x100);
2094 ptr_addr = ALIGN(ptr_addr, 0x100);
2097 for (voice = 0; voice < YDSXG_CAPTURE_VOICES; voice++)
2098 for (bank = 0; bank < 2; bank++) {
2103 ptr = (char *)ALIGN((unsigned long)ptr, 0x100);
2104 ptr_addr = ALIGN(ptr_addr, 0x100);
2107 for (voice = 0; voice < YDSXG_EFFECT_VOICES; voice++)
2108 for (bank = 0; bank < 2; bank++) {
2113 ptr = (char *)ALIGN((unsigned long)ptr, 0x100);
2114 ptr_addr = ALIGN(ptr_addr, 0x100);
2128 chip->spdif_bits = chip->spdif_pcm_bits = SNDRV_PCM_DEFAULT_CON_SPDIF & 0xffff;
2129 snd_ymfpci_writew(chip, YDSXGR_SPDIFOUTCTRL, 0);
2133 snd_ymfpci_writew(chip, YDSXGR_SPDIFINCTRL, 0);
2136 for (reg = 0x80; reg < 0xc0; reg += 4)
2137 snd_ymfpci_writel(chip, reg, 0);
2138 snd_ymfpci_writel(chip, YDSXGR_NATIVEDACOUTVOL, 0x3fff3fff);
2139 snd_ymfpci_writel(chip, YDSXGR_BUF441OUTVOL, 0x3fff3fff);
2140 snd_ymfpci_writel(chip, YDSXGR_ZVOUTVOL, 0x3fff3fff);
2141 snd_ymfpci_writel(chip, YDSXGR_SPDIFOUTVOL, 0x3fff3fff);
2142 snd_ymfpci_writel(chip, YDSXGR_NATIVEADCINVOL, 0x3fff3fff);
2143 snd_ymfpci_writel(chip, YDSXGR_NATIVEDACINVOL, 0x3fff3fff);
2144 snd_ymfpci_writel(chip, YDSXGR_PRIADCLOOPVOL, 0x3fff3fff);
2145 snd_ymfpci_writel(chip, YDSXGR_LEGACYOUTVOL, 0x3fff3fff);
2147 return 0;
2155 snd_ymfpci_writel(chip, YDSXGR_NATIVEDACOUTVOL, 0);
2156 snd_ymfpci_writel(chip, YDSXGR_BUF441OUTVOL, 0);
2157 snd_ymfpci_writel(chip, YDSXGR_LEGACYOUTVOL, 0);
2158 snd_ymfpci_writel(chip, YDSXGR_STATUS, ~0);
2160 snd_ymfpci_writel(chip, YDSXGR_PLAYCTRLBASE, 0);
2161 snd_ymfpci_writel(chip, YDSXGR_RECCTRLBASE, 0);
2162 snd_ymfpci_writel(chip, YDSXGR_EFFCTRLBASE, 0);
2163 snd_ymfpci_writel(chip, YDSXGR_WORKBASE, 0);
2164 snd_ymfpci_writel(chip, YDSXGR_WORKSIZE, 0);
2166 snd_ymfpci_writew(chip, YDSXGR_GLOBALCTRL, ctrl & ~0x0007);
2184 if (chip->pci->device >= 0x0010) /* YMF 744/754 */
2190 for (i = 0; i < YDSXGR_NUM_SAVED_REGS; i++)
2195 for (i = 0; i < legacy_reg_count; i++)
2199 snd_ymfpci_writel(chip, YDSXGR_NATIVEDACOUTVOL, 0);
2200 snd_ymfpci_writel(chip, YDSXGR_BUF441OUTVOL, 0);
2202 return 0;
2212 if (chip->pci->device >= 0x0010) /* YMF 744/754 */
2216 snd_ymfpci_codec_ready(chip, 0);
2220 for (i = 0; i < YDSXGR_NUM_SAVED_REGS; i++)
2225 for (i = 0; i < legacy_reg_count; i++)
2230 if (chip->start_count > 0) {
2236 return 0;
2250 if (err < 0)
2257 atomic_set(&chip->interrupt_sleep_count, 0);
2265 if (err < 0)
2268 chip->reg_area_phys = pci_resource_start(pci, 0);
2269 chip->reg_area_virt = devm_ioremap(&pci->dev, chip->reg_area_phys, 0x8000);
2272 "unable to grab memory region 0x%lx-0x%lx\n",
2273 chip->reg_area_phys, chip->reg_area_phys + 0x8000 - 1);
2289 if (snd_ymfpci_codec_ready(chip, 0) < 0)
2293 if (err < 0) {
2301 if (snd_ymfpci_memalloc(chip) < 0)
2305 if (err < 0)
2310 return 0;