Lines Matching refs:chip
415 struct via82xx *chip = snd_pcm_substream_chip(substream);
422 if (snd_dma_alloc_pages(SNDRV_DMA_TYPE_DEV, &chip->pci->dev,
501 static inline unsigned int snd_via82xx_codec_xread(struct via82xx *chip)
503 return inl(VIAREG(chip, AC97));
506 static inline void snd_via82xx_codec_xwrite(struct via82xx *chip, unsigned int val)
508 outl(val, VIAREG(chip, AC97));
511 static int snd_via82xx_codec_ready(struct via82xx *chip, int secondary)
518 val = snd_via82xx_codec_xread(chip);
522 dev_err(chip->card->dev, "codec_ready: codec %i is not ready [0x%x]\n",
523 secondary, snd_via82xx_codec_xread(chip));
527 static int snd_via82xx_codec_valid(struct via82xx *chip, int secondary)
535 val = snd_via82xx_codec_xread(chip);
546 struct via82xx *chip = ac97->private_data;
548 err = snd_via82xx_codec_ready(chip, ac97->num);
558 struct via82xx *chip = ac97->private_data;
565 snd_via82xx_codec_xwrite(chip, xval);
566 snd_via82xx_codec_ready(chip, ac97->num);
571 struct via82xx *chip = ac97->private_data;
581 dev_err(chip->card->dev,
583 ac97->num, snd_via82xx_codec_xread(chip));
586 snd_via82xx_codec_xwrite(chip, xval);
588 if (snd_via82xx_codec_valid(chip, ac97->num) >= 0) {
590 val = snd_via82xx_codec_xread(chip);
597 static void snd_via82xx_channel_reset(struct via82xx *chip, struct viadev *viadev)
620 struct via82xx *chip = dev_id;
624 status = inl(VIAREG(chip, SGD_SHADOW));
625 if (! (status & chip->intr_mask)) {
626 if (chip->rmidi)
628 return snd_mpu401_uart_interrupt(irq, chip->rmidi->private_data);
633 spin_lock(&chip->reg_lock);
634 for (i = 0; i < chip->num_devs; i++) {
635 struct viadev *viadev = &chip->devs[i];
642 * interrupts. We'll use it, when the chip returns 0
650 spin_unlock(&chip->reg_lock);
652 spin_lock(&chip->reg_lock);
657 spin_unlock(&chip->reg_lock);
666 struct via82xx *chip = dev_id;
672 spin_lock(&chip->reg_lock);
673 status = inl(VIAREG(chip, SGD_SHADOW));
675 for (i = 0; i < chip->num_devs; i++) {
676 struct viadev *viadev = &chip->devs[i];
691 * interrupts. We'll use it, when the chip returns 0
701 spin_unlock(&chip->reg_lock);
705 spin_lock(&chip->reg_lock);
711 spin_unlock(&chip->reg_lock);
724 struct via82xx *chip = snd_pcm_substream_chip(substream);
728 if (chip->chip_type != TYPE_VIA686)
755 snd_via82xx_channel_reset(chip, viadev);
772 static inline unsigned int calc_linear_pos(struct via82xx *chip,
787 dev_dbg(chip->card->dev,
805 dev_dbg(chip->card->dev,
815 dev_dbg(chip->card->dev,
829 struct via82xx *chip = snd_pcm_substream_chip(substream);
838 spin_lock(&chip->reg_lock);
848 res = calc_linear_pos(chip, viadev, idx, count);
850 spin_unlock(&chip->reg_lock);
860 struct via82xx *chip = snd_pcm_substream_chip(substream);
868 spin_lock(&chip->reg_lock);
876 if (chip->revision == VIA_REV_8251 && (status & VIA_REG_STAT_EOL))
887 dev_dbg(chip->card->dev,
894 res = calc_linear_pos(chip, viadev, idx, count);
909 spin_unlock(&chip->reg_lock);
922 struct via82xx *chip = snd_pcm_substream_chip(substream);
925 return build_via_table(viadev, substream, chip->pci,
936 struct via82xx *chip = snd_pcm_substream_chip(substream);
939 clean_via_table(viadev, substream, chip->pci);
947 static void snd_via82xx_set_table_ptr(struct via82xx *chip, struct viadev *viadev)
949 snd_via82xx_codec_ready(chip, 0);
952 snd_via82xx_codec_ready(chip, 0);
958 static void via686_setup_format(struct via82xx *chip, struct viadev *viadev,
961 snd_via82xx_channel_reset(chip, viadev);
963 snd_via82xx_set_table_ptr(chip, viadev);
974 struct via82xx *chip = snd_pcm_substream_chip(substream);
978 snd_ac97_set_rate(chip->ac97, AC97_PCM_FRONT_DAC_RATE, runtime->rate);
979 snd_ac97_set_rate(chip->ac97, AC97_SPDIF, runtime->rate);
980 via686_setup_format(chip, viadev, runtime);
986 struct via82xx *chip = snd_pcm_substream_chip(substream);
990 snd_ac97_set_rate(chip->ac97, AC97_PCM_LR_ADC_RATE, runtime->rate);
991 via686_setup_format(chip, viadev, runtime);
1020 struct via82xx *chip = snd_pcm_substream_chip(substream);
1023 int ac97_rate = chip->dxs_src ? 48000 : runtime->rate;
1027 rate_changed = via_lock_rate(&chip->rates[0], ac97_rate);
1031 snd_ac97_set_rate(chip->ac97, AC97_PCM_FRONT_DAC_RATE,
1032 chip->no_vra ? 48000 : runtime->rate);
1033 if (chip->spdif_on && viadev->reg_offset == 0x30)
1034 snd_ac97_set_rate(chip->ac97, AC97_SPDIF, runtime->rate);
1042 snd_via82xx_channel_reset(chip, viadev);
1043 snd_via82xx_set_table_ptr(chip, viadev);
1044 outb(chip->playback_volume[viadev->reg_offset / 0x10][0],
1046 outb(chip->playback_volume[viadev->reg_offset / 0x10][1],
1054 snd_via82xx_codec_ready(chip, 0);
1063 struct via82xx *chip = snd_pcm_substream_chip(substream);
1069 if (via_lock_rate(&chip->rates[0], runtime->rate) < 0)
1071 snd_ac97_set_rate(chip->ac97, AC97_PCM_FRONT_DAC_RATE, runtime->rate);
1072 snd_ac97_set_rate(chip->ac97, AC97_PCM_SURR_DAC_RATE, runtime->rate);
1073 snd_ac97_set_rate(chip->ac97, AC97_PCM_LFE_DAC_RATE, runtime->rate);
1074 snd_ac97_set_rate(chip->ac97, AC97_SPDIF, runtime->rate);
1075 snd_via82xx_channel_reset(chip, viadev);
1076 snd_via82xx_set_table_ptr(chip, viadev);
1083 if (chip->revision == VIA_REV_8233A)
1103 snd_via82xx_codec_ready(chip, 0);
1112 struct via82xx *chip = snd_pcm_substream_chip(substream);
1116 if (via_lock_rate(&chip->rates[1], runtime->rate) < 0)
1118 snd_ac97_set_rate(chip->ac97, AC97_PCM_LR_ADC_RATE, runtime->rate);
1119 snd_via82xx_channel_reset(chip, viadev);
1120 snd_via82xx_set_table_ptr(chip, viadev);
1127 snd_via82xx_codec_ready(chip, 0);
1160 static int snd_via82xx_pcm_open(struct via82xx *chip, struct viadev *viadev,
1171 ratep = &chip->rates[viadev->direction];
1174 if (chip->spdif_on && viadev->reg_offset == 0x30) {
1176 runtime->hw.rates = chip->ac97->rates[AC97_RATES_SPDIF];
1178 } else if (chip->dxs_fixed && viadev->reg_offset < 0x40) {
1182 } else if (chip->dxs_src && viadev->reg_offset < 0x40) {
1191 runtime->hw.rates = chip->ac97->rates[idx];
1224 struct via82xx *chip = snd_pcm_substream_chip(substream);
1225 struct viadev *viadev = &chip->devs[chip->playback_devno + substream->number];
1228 err = snd_via82xx_pcm_open(chip, viadev, substream);
1239 struct via82xx *chip = snd_pcm_substream_chip(substream);
1244 viadev = &chip->devs[chip->playback_devno + substream->number];
1245 err = snd_via82xx_pcm_open(chip, viadev, substream);
1249 if (chip->dxs_controls[stream]) {
1250 chip->playback_volume[stream][0] =
1252 chip->playback_volume[stream][1] =
1254 chip->dxs_controls[stream]->vd[0].access &=
1256 snd_ctl_notify(chip->card, SNDRV_CTL_EVENT_MASK_VALUE |
1258 &chip->dxs_controls[stream]->id);
1268 struct via82xx *chip = snd_pcm_substream_chip(substream);
1269 struct viadev *viadev = &chip->devs[chip->multi_devno];
1283 err = snd_via82xx_pcm_open(chip, viadev, substream);
1287 if (chip->revision == VIA_REV_8233A)
1299 struct via82xx *chip = snd_pcm_substream_chip(substream);
1300 struct viadev *viadev = &chip->devs[chip->capture_devno + substream->pcm->device];
1302 return snd_via82xx_pcm_open(chip, viadev, substream);
1310 struct via82xx *chip = snd_pcm_substream_chip(substream);
1315 ratep = &chip->rates[viadev->direction];
1323 snd_ac97_update_power(chip->ac97,
1325 snd_ac97_update_power(chip->ac97,
1327 snd_ac97_update_power(chip->ac97,
1330 snd_ac97_update_power(chip->ac97,
1339 struct via82xx *chip = snd_pcm_substream_chip(substream);
1344 if (chip->dxs_controls[stream]) {
1345 chip->dxs_controls[stream]->vd[0].access |=
1347 snd_ctl_notify(chip->card, SNDRV_CTL_EVENT_MASK_INFO,
1348 &chip->dxs_controls[stream]->id);
1410 static void init_viadev(struct via82xx *chip, int idx, unsigned int reg_offset,
1413 chip->devs[idx].reg_offset = reg_offset;
1414 chip->devs[idx].shadow_shift = shadow_pos * 4;
1415 chip->devs[idx].direction = direction;
1416 chip->devs[idx].port = chip->port + reg_offset;
1422 static int snd_via8233_pcm_new(struct via82xx *chip)
1428 chip->playback_devno = 0; /* x 4 */
1429 chip->multi_devno = 4; /* x 1 */
1430 chip->capture_devno = 5; /* x 2 */
1431 chip->num_devs = 7;
1432 chip->intr_mask = 0x33033333; /* FLAG|EOL for rec0-1, mc, sdx0-3 */
1435 err = snd_pcm_new(chip->card, chip->card->shortname, 0, 4, 1, &pcm);
1440 pcm->private_data = chip;
1441 strcpy(pcm->name, chip->card->shortname);
1442 chip->pcms[0] = pcm;
1445 init_viadev(chip, i, 0x10 * i, i, 0);
1447 init_viadev(chip, chip->capture_devno, VIA_REG_CAPTURE_8233_STATUS, 6, 1);
1450 &chip->pci->dev,
1460 err = snd_pcm_new(chip->card, chip->card->shortname, 1, 1, 1, &pcm);
1465 pcm->private_data = chip;
1466 strcpy(pcm->name, chip->card->shortname);
1467 chip->pcms[1] = pcm;
1469 init_viadev(chip, chip->multi_devno, VIA_REG_MULTPLAY_STATUS, 4, 0);
1471 init_viadev(chip, chip->capture_devno + 1, VIA_REG_CAPTURE_8233_STATUS + 0x10, 7, 1);
1474 &chip->pci->dev,
1482 chip->ac97->chmaps[SNDRV_PCM_STREAM_PLAYBACK] = chmap;
1490 static int snd_via8233a_pcm_new(struct via82xx *chip)
1496 chip->multi_devno = 0;
1497 chip->playback_devno = 1;
1498 chip->capture_devno = 2;
1499 chip->num_devs = 3;
1500 chip->intr_mask = 0x03033000; /* FLAG|EOL for rec0, mc, sdx3 */
1503 err = snd_pcm_new(chip->card, chip->card->shortname, 0, 1, 1, &pcm);
1508 pcm->private_data = chip;
1509 strcpy(pcm->name, chip->card->shortname);
1510 chip->pcms[0] = pcm;
1512 init_viadev(chip, chip->multi_devno, VIA_REG_MULTPLAY_STATUS, 4, 0);
1514 init_viadev(chip, chip->capture_devno, VIA_REG_CAPTURE_8233_STATUS, 6, 1);
1517 &chip->pci->dev,
1525 chip->ac97->chmaps[SNDRV_PCM_STREAM_PLAYBACK] = chmap;
1528 if (! ac97_can_spdif(chip->ac97))
1532 err = snd_pcm_new(chip->card, chip->card->shortname, 1, 1, 0, &pcm);
1536 pcm->private_data = chip;
1537 strcpy(pcm->name, chip->card->shortname);
1538 chip->pcms[1] = pcm;
1540 init_viadev(chip, chip->playback_devno, 0x30, 3, 0);
1543 &chip->pci->dev,
1551 static int snd_via686_pcm_new(struct via82xx *chip)
1556 chip->playback_devno = 0;
1557 chip->capture_devno = 1;
1558 chip->num_devs = 2;
1559 chip->intr_mask = 0x77; /* FLAG | EOL for PB, CP, FM */
1561 err = snd_pcm_new(chip->card, chip->card->shortname, 0, 1, 1, &pcm);
1566 pcm->private_data = chip;
1567 strcpy(pcm->name, chip->card->shortname);
1568 chip->pcms[0] = pcm;
1569 init_viadev(chip, 0, VIA_REG_PLAYBACK_STATUS, 0, 0);
1570 init_viadev(chip, 1, VIA_REG_CAPTURE_STATUS, 0, 1);
1573 &chip->pci->dev,
1598 struct via82xx *chip = snd_kcontrol_chip(kcontrol);
1599 unsigned long port = chip->port + (kcontrol->id.index ? (VIA_REG_CAPTURE_CHANNEL + 0x10) : VIA_REG_CAPTURE_CHANNEL);
1607 struct via82xx *chip = snd_kcontrol_chip(kcontrol);
1608 unsigned long port = chip->port + (kcontrol->id.index ? (VIA_REG_CAPTURE_CHANNEL + 0x10) : VIA_REG_CAPTURE_CHANNEL);
1611 spin_lock_irq(&chip->reg_lock);
1618 spin_unlock_irq(&chip->reg_lock);
1635 struct via82xx *chip = snd_kcontrol_chip(kcontrol);
1638 pci_read_config_byte(chip->pci, VIA8233_SPDIF_CTRL, &val);
1646 struct via82xx *chip = snd_kcontrol_chip(kcontrol);
1649 pci_read_config_byte(chip->pci, VIA8233_SPDIF_CTRL, &oval);
1654 chip->spdif_on = ucontrol->value.integer.value[0] ? 1 : 0;
1656 pci_write_config_byte(chip->pci, VIA8233_SPDIF_CTRL, val);
1683 struct via82xx *chip = snd_kcontrol_chip(kcontrol);
1686 ucontrol->value.integer.value[0] = VIA_DXS_MAX_VOLUME - chip->playback_volume[idx][0];
1687 ucontrol->value.integer.value[1] = VIA_DXS_MAX_VOLUME - chip->playback_volume[idx][1];
1694 struct via82xx *chip = snd_kcontrol_chip(kcontrol);
1695 ucontrol->value.integer.value[0] = VIA_DXS_MAX_VOLUME - chip->playback_volume_c[0];
1696 ucontrol->value.integer.value[1] = VIA_DXS_MAX_VOLUME - chip->playback_volume_c[1];
1703 struct via82xx *chip = snd_kcontrol_chip(kcontrol);
1705 unsigned long port = chip->port + 0x10 * idx;
1714 change |= val != chip->playback_volume[idx][i];
1716 chip->playback_volume[idx][i] = val;
1726 struct via82xx *chip = snd_kcontrol_chip(kcontrol);
1736 if (val != chip->playback_volume_c[i]) {
1738 chip->playback_volume_c[i] = val;
1740 unsigned long port = chip->port + 0x10 * idx;
1741 chip->playback_volume[idx][i] = val;
1781 struct via82xx *chip = bus->private_data;
1782 chip->ac97_bus = NULL;
1787 struct via82xx *chip = ac97->private_data;
1788 chip->ac97 = NULL;
1874 static int snd_via82xx_mixer_new(struct via82xx *chip, const char *quirk_override)
1884 err = snd_ac97_bus(chip->card, 0, &ops, chip, &chip->ac97_bus);
1887 chip->ac97_bus->private_free = snd_via82xx_mixer_free_ac97_bus;
1888 chip->ac97_bus->clock = chip->ac97_clock;
1891 ac97.private_data = chip;
1893 ac97.pci = chip->pci;
1895 err = snd_ac97_mixer(chip->ac97_bus, &ac97, &chip->ac97);
1899 snd_ac97_tune_hardware(chip->ac97, ac97_quirks, quirk_override);
1901 if (chip->chip_type != TYPE_VIA686) {
1903 snd_ac97_update_bits(chip->ac97, AC97_EXTENDED_STATUS, 0x03 << 4, 0x03 << 4);
1911 static int snd_via686_create_gameport(struct via82xx *chip, unsigned char *legacy)
1918 if (!devm_request_region(chip->card->dev, JOYSTICK_ADDR, 8,
1920 dev_warn(chip->card->dev, "cannot reserve joystick port %#x\n",
1925 chip->gameport = gp = gameport_allocate_port();
1927 dev_err(chip->card->dev,
1933 gameport_set_phys(gp, "pci%s/gameport0", pci_name(chip->pci));
1934 gameport_set_dev_parent(gp, &chip->pci->dev);
1939 pci_write_config_byte(chip->pci, VIA_FUNC_ENABLE, *legacy);
1941 gameport_register_port(chip->gameport);
1946 static void snd_via686_free_gameport(struct via82xx *chip)
1948 if (chip->gameport) {
1949 gameport_unregister_port(chip->gameport);
1950 chip->gameport = NULL;
1954 static inline int snd_via686_create_gameport(struct via82xx *chip, unsigned char *legacy)
1958 static inline void snd_via686_free_gameport(struct via82xx *chip) { }
1966 static int snd_via8233_init_misc(struct via82xx *chip)
1971 caps = chip->chip_type == TYPE_VIA8233A ? 1 : 2;
1974 err = snd_ctl_add(chip->card, snd_ctl_new1(&snd_via8233_capture_source, chip));
1978 if (ac97_can_spdif(chip->ac97)) {
1979 err = snd_ctl_add(chip->card, snd_ctl_new1(&snd_via8233_dxs3_spdif_control, chip));
1983 if (chip->chip_type != TYPE_VIA8233A) {
1987 if (!snd_ctl_find_id_mixer(chip->card, "PCM Playback Volume")) {
1988 dev_info(chip->card->dev,
1990 err = snd_ctl_add(chip->card, snd_ctl_new1(&snd_via8233_pcmdxs_volume_control, chip));
2000 &snd_via8233_dxs_volume_control, chip);
2004 err = snd_ctl_add(chip->card, kctl);
2007 chip->dxs_controls[i] = kctl;
2012 pci_read_config_byte(chip->pci, VIA8233_SPDIF_CTRL, &val);
2015 pci_write_config_byte(chip->pci, VIA8233_SPDIF_CTRL, val);
2020 static int snd_via686_init_misc(struct via82xx *chip)
2025 legacy = chip->old_legacy;
2026 legacy_cfg = chip->old_legacy_cfg;
2029 if (chip->revision >= VIA_REV_686_H) {
2033 pci_write_config_dword(chip->pci, 0x18, mpu_port | 0x01);
2035 chip->mpu_port_saved = mpu_port;
2038 mpu_port = pci_resource_start(chip->pci, 2);
2056 chip->mpu_res = devm_request_region(&chip->pci->dev, mpu_port,
2058 if (chip->mpu_res) {
2069 pci_write_config_byte(chip->pci, VIA_FUNC_ENABLE, legacy);
2070 pci_write_config_byte(chip->pci, VIA_PNP_CONTROL, legacy_cfg);
2071 if (chip->mpu_res) {
2072 if (snd_mpu401_uart_new(chip->card, 0, MPU401_HW_VIA686A,
2075 &chip->rmidi) < 0) {
2076 dev_warn(chip->card->dev,
2083 pci_write_config_byte(chip->pci, VIA_FUNC_ENABLE, legacy);
2086 snd_via686_create_gameport(chip, &legacy);
2089 chip->legacy_saved = legacy;
2090 chip->legacy_cfg_saved = legacy_cfg;
2103 struct via82xx *chip = entry->private_data;
2106 snd_iprintf(buffer, "%s\n\n", chip->card->longname);
2108 snd_iprintf(buffer, "%02x: %08x\n", i, inl(chip->port + i));
2112 static void snd_via82xx_proc_init(struct via82xx *chip)
2114 snd_card_ro_proc_new(chip->card, "via82xx", chip,
2122 static int snd_via82xx_chip_init(struct via82xx *chip)
2129 if (chip->chip_type == TYPE_VIA686)
2131 pci_write_config_byte(chip->pci, VIA_FUNC_ENABLE, 0);
2133 pci_read_config_byte(chip->pci, VIA_ACLINK_STAT, &pval);
2136 pci_write_config_byte(chip->pci, VIA_ACLINK_CTRL,
2141 #if 1 /* FIXME: should we do full reset here for all chip models? */
2142 pci_write_config_byte(chip->pci, VIA_ACLINK_CTRL, 0x00);
2146 pci_write_config_byte(chip->pci, VIA_ACLINK_CTRL,
2152 pci_write_config_byte(chip->pci, VIA_ACLINK_CTRL, VIA_ACLINK_CTRL_INIT);
2158 pci_read_config_byte(chip->pci, VIA_ACLINK_CTRL, &pval);
2162 pci_write_config_byte(chip->pci, VIA_ACLINK_CTRL, VIA_ACLINK_CTRL_INIT);
2169 pci_read_config_byte(chip->pci, VIA_ACLINK_STAT, &pval);
2175 val = snd_via82xx_codec_xread(chip);
2177 dev_err(chip->card->dev,
2181 snd_via82xx_codec_xwrite(chip, VIA_REG_AC97_READ |
2185 snd_via82xx_codec_xwrite(chip, VIA_REG_AC97_READ |
2189 val = snd_via82xx_codec_xread(chip);
2191 chip->ac97_secondary = 1;
2201 if (chip->chip_type == TYPE_VIA686) {
2203 pci_write_config_byte(chip->pci, VIA_FM_NMI_CTRL, 0);
2205 outl(0, VIAREG(chip, GPI_INTR));
2208 if (chip->chip_type != TYPE_VIA686) {
2222 if (chip->chip_type != TYPE_VIA8233A) {
2225 unsigned long port = chip->port + 0x10 * idx;
2227 chip->playback_volume[idx][i]=chip->playback_volume_c[i];
2228 outb(chip->playback_volume_c[i],
2244 struct via82xx *chip = card->private_data;
2248 for (i = 0; i < chip->num_devs; i++)
2249 snd_via82xx_channel_reset(chip, &chip->devs[i]);
2250 snd_ac97_suspend(chip->ac97);
2253 if (chip->chip_type != TYPE_VIA686) {
2254 pci_read_config_byte(chip->pci, VIA8233_SPDIF_CTRL, &chip->spdif_ctrl_saved);
2255 chip->capture_src_saved[0] = inb(chip->port + VIA_REG_CAPTURE_CHANNEL);
2256 chip->capture_src_saved[1] = inb(chip->port + VIA_REG_CAPTURE_CHANNEL + 0x10);
2265 struct via82xx *chip = card->private_data;
2268 snd_via82xx_chip_init(chip);
2270 if (chip->chip_type == TYPE_VIA686) {
2271 if (chip->mpu_port_saved)
2272 pci_write_config_dword(chip->pci, 0x18, chip->mpu_port_saved | 0x01);
2273 pci_write_config_byte(chip->pci, VIA_FUNC_ENABLE, chip->legacy_saved);
2274 pci_write_config_byte(chip->pci, VIA_PNP_CONTROL, chip->legacy_cfg_saved);
2276 pci_write_config_byte(chip->pci, VIA8233_SPDIF_CTRL, chip->spdif_ctrl_saved);
2277 outb(chip->capture_src_saved[0], chip->port + VIA_REG_CAPTURE_CHANNEL);
2278 outb(chip->capture_src_saved[1], chip->port + VIA_REG_CAPTURE_CHANNEL + 0x10);
2281 snd_ac97_resume(chip->ac97);
2283 for (i = 0; i < chip->num_devs; i++)
2284 snd_via82xx_channel_reset(chip, &chip->devs[i]);
2298 struct via82xx *chip = card->private_data;
2302 for (i = 0; i < chip->num_devs; i++)
2303 snd_via82xx_channel_reset(chip, &chip->devs[i]);
2305 if (chip->chip_type == TYPE_VIA686) {
2306 snd_via686_free_gameport(chip);
2307 pci_write_config_byte(chip->pci, VIA_FUNC_ENABLE, chip->old_legacy);
2308 pci_write_config_byte(chip->pci, VIA_PNP_CONTROL, chip->old_legacy_cfg);
2318 struct via82xx *chip = card->private_data;
2325 chip->chip_type = chip_type;
2326 chip->revision = revision;
2328 spin_lock_init(&chip->reg_lock);
2329 spin_lock_init(&chip->rates[0].lock);
2330 spin_lock_init(&chip->rates[1].lock);
2331 chip->card = card;
2332 chip->pci = pci;
2333 chip->irq = -1;
2335 pci_read_config_byte(pci, VIA_FUNC_ENABLE, &chip->old_legacy);
2336 pci_read_config_byte(pci, VIA_PNP_CONTROL, &chip->old_legacy_cfg);
2337 pci_write_config_byte(chip->pci, VIA_FUNC_ENABLE,
2338 chip->old_legacy & ~(VIA_FUNC_ENABLE_SB|VIA_FUNC_ENABLE_FM));
2343 chip->port = pci_resource_start(pci, 0);
2348 KBUILD_MODNAME, chip)) {
2352 chip->irq = pci->irq;
2353 card->sync_irq = chip->irq;
2356 chip->ac97_clock = ac97_clock;
2358 err = snd_via82xx_chip_init(chip);
2461 struct via82xx *chip;
2467 sizeof(*chip), &card);
2470 chip = card->private_data;
2516 err = snd_via82xx_mixer_new(chip, ac97_quirk);
2521 err = snd_via686_pcm_new(chip);
2524 err = snd_via686_init_misc(chip);
2529 err = snd_via8233a_pcm_new(chip);
2532 // chip->dxs_fixed = 1; /* FIXME: use 48k for DXS #3? */
2534 err = snd_via8233_pcm_new(chip);
2538 chip->dxs_fixed = 1;
2540 chip->no_vra = 1;
2542 chip->no_vra = 1;
2543 chip->dxs_src = 1;
2546 err = snd_via8233_init_misc(chip);
2552 for (i = 0; i < chip->num_devs; i++)
2553 snd_via82xx_channel_reset(chip, &chip->devs[i]);
2557 snd_ac97_get_short_name(chip->ac97), chip->port, chip->irq);
2559 snd_via82xx_proc_init(chip);