Lines Matching +full:playback +full:- +full:dma

1 /*-
2 * SPDX-License-Identifier: BSD-2-Clause
33 * * 16bit playback / recording
34 * * 32bit native playback - yay!
54 * Takashi Iwai (ALSA snd-atiixp), for register definitions and some
79 #define ATI_IXP_BLK_ALIGN (~(ATI_IXP_BLK_MIN - 1))
138 bus_space_read_4((_sc)->st, (_sc)->sh, _reg)
140 bus_space_write_4((_sc)->st, (_sc)->sh, _reg, _val)
142 #define atiixp_lock(_sc) snd_mtxlock((_sc)->lock)
143 #define atiixp_unlock(_sc) snd_mtxunlock((_sc)->lock)
144 #define atiixp_assert(_sc) snd_mtxassert((_sc)->lock)
288 /* check if the ac-link is working; reset device otherwise */ in atiixp_reset_aclink()
291 while (!(value & ATI_REG_CMD_ACLINK_ACTIVE) && --timeout) { in atiixp_reset_aclink()
293 device_printf(sc->dev, "not up; resetting aclink hardware\n"); in atiixp_reset_aclink()
315 device_printf(sc->dev, "giving up aclink reset\n"); in atiixp_reset_aclink()
318 device_printf(sc->dev, "aclink hardware reset successful\n"); in atiixp_reset_aclink()
330 atiixp_wr(ch->parent, ATI_REG_FIFO_FLUSH, ch->flush_bit); in atiixp_flush_dma()
338 value = atiixp_rd(ch->parent, ATI_REG_CMD); in atiixp_enable_dma()
339 if (!(value & ch->enable_bit)) { in atiixp_enable_dma()
340 value |= ch->enable_bit; in atiixp_enable_dma()
341 atiixp_wr(ch->parent, ATI_REG_CMD, value); in atiixp_enable_dma()
350 value = atiixp_rd(ch->parent, ATI_REG_CMD); in atiixp_disable_dma()
351 if (value & ch->enable_bit) { in atiixp_disable_dma()
352 value &= ~ch->enable_bit; in atiixp_disable_dma()
353 atiixp_wr(ch->parent, ATI_REG_CMD, value); in atiixp_disable_dma()
370 } while (--timeout); in atiixp_waitready_codec()
372 return (-1); in atiixp_waitready_codec()
383 return (-1); in atiixp_rdcd()
386 ATI_REG_PHYS_OUT_ADDR_EN | ATI_REG_PHYS_OUT_RW | sc->codec_idx; in atiixp_rdcd()
391 return (-1); in atiixp_rdcd()
399 } while (--timeout); in atiixp_rdcd()
402 device_printf(sc->dev, "codec read timeout! (reg 0x%x)\n", reg); in atiixp_rdcd()
404 return (-1); in atiixp_rdcd()
413 return (-1); in atiixp_wrcd()
417 ATI_REG_PHYS_OUT_ADDR_EN | sc->codec_idx; in atiixp_wrcd()
432 * Playback / Record channel interface
445 ch = &sc->pch; in atiixp_chan_init()
446 ch->linkptr_bit = ATI_REG_OUT_DMA_LINKPTR; in atiixp_chan_init()
447 ch->enable_bit = ATI_REG_CMD_OUT_DMA_EN | ATI_REG_CMD_SEND_EN; in atiixp_chan_init()
448 ch->flush_bit = ATI_REG_FIFO_OUT_FLUSH; in atiixp_chan_init()
449 ch->dt_cur_bit = ATI_REG_OUT_DMA_DT_CUR; in atiixp_chan_init()
450 /* Native 32bit playback working properly */ in atiixp_chan_init()
451 ch->caps_32bit = 1; in atiixp_chan_init()
453 ch = &sc->rch; in atiixp_chan_init()
454 ch->linkptr_bit = ATI_REG_IN_DMA_LINKPTR; in atiixp_chan_init()
455 ch->enable_bit = ATI_REG_CMD_IN_DMA_EN | ATI_REG_CMD_RECEIVE_EN; in atiixp_chan_init()
456 ch->flush_bit = ATI_REG_FIFO_IN_FLUSH; in atiixp_chan_init()
457 ch->dt_cur_bit = ATI_REG_IN_DMA_DT_CUR; in atiixp_chan_init()
459 ch->caps_32bit = 1; in atiixp_chan_init()
462 ch->buffer = b; in atiixp_chan_init()
463 ch->parent = sc; in atiixp_chan_init()
464 ch->channel = c; in atiixp_chan_init()
465 ch->dir = dir; in atiixp_chan_init()
466 ch->blkcnt = sc->blkcnt; in atiixp_chan_init()
467 ch->blksz = sc->bufsz / ch->blkcnt; in atiixp_chan_init()
471 if (sndbuf_alloc(ch->buffer, sc->parent_dmat, 0, sc->bufsz) == -1) in atiixp_chan_init()
475 num = sc->registered_channels++; in atiixp_chan_init()
476 ch->sgd_table = &sc->sgd_table[num * ATI_IXP_DMA_CHSEGS_MAX]; in atiixp_chan_init()
477 ch->sgd_addr = sc->sgd_addr + (num * ATI_IXP_DMA_CHSEGS_MAX * in atiixp_chan_init()
489 struct atiixp_info *sc = ch->parent; in atiixp_chan_setformat()
493 if (ch->dir == PCMDIR_REC) { in atiixp_chan_setformat()
516 ch->fmt = format; in atiixp_chan_setformat()
534 struct atiixp_info *sc = ch->parent; in atiixp_chan_setfragments()
538 if (blksz > (sndbuf_getmaxsize(ch->buffer) / ATI_IXP_DMA_CHSEGS_MIN)) in atiixp_chan_setfragments()
539 blksz = sndbuf_getmaxsize(ch->buffer) / ATI_IXP_DMA_CHSEGS_MIN; in atiixp_chan_setfragments()
547 while ((blksz * blkcnt) > sndbuf_getmaxsize(ch->buffer)) { in atiixp_chan_setfragments()
556 if ((sndbuf_getblksz(ch->buffer) != blksz || in atiixp_chan_setfragments()
557 sndbuf_getblkcnt(ch->buffer) != blkcnt) && in atiixp_chan_setfragments()
558 sndbuf_resize(ch->buffer, blkcnt, blksz) != 0) in atiixp_chan_setfragments()
559 device_printf(sc->dev, "%s: failed blksz=%u blkcnt=%u\n", in atiixp_chan_setfragments()
562 ch->blksz = sndbuf_getblksz(ch->buffer); in atiixp_chan_setfragments()
563 ch->blkcnt = sndbuf_getblkcnt(ch->buffer); in atiixp_chan_setfragments()
572 struct atiixp_info *sc = ch->parent; in atiixp_chan_setblocksize()
574 atiixp_chan_setfragments(obj, data, blksz, sc->blkcnt); in atiixp_chan_setblocksize()
576 return (ch->blksz); in atiixp_chan_setblocksize()
582 struct atiixp_info *sc = ch->parent; in atiixp_buildsgdt()
586 addr = sndbuf_getbufaddr(ch->buffer); in atiixp_buildsgdt()
588 if (sc->polling != 0) { in atiixp_buildsgdt()
589 blksz = ch->blksz * ch->blkcnt; in atiixp_buildsgdt()
592 blksz = ch->blksz; in atiixp_buildsgdt()
593 blkcnt = ch->blkcnt; in atiixp_buildsgdt()
597 ch->sgd_table[i].addr = htole32(addr + (i * blksz)); in atiixp_buildsgdt()
598 ch->sgd_table[i].status = htole16(0); in atiixp_buildsgdt()
599 ch->sgd_table[i].size = htole16(blksz >> 2); in atiixp_buildsgdt()
600 ch->sgd_table[i].next = htole32((uint32_t)ch->sgd_addr + in atiixp_buildsgdt()
608 struct atiixp_info *sc = ch->parent; in atiixp_dmapos()
612 reg = ch->dt_cur_bit; in atiixp_dmapos()
613 addr = sndbuf_getbufaddr(ch->buffer); in atiixp_dmapos()
614 sz = ch->blkcnt * ch->blksz; in atiixp_dmapos()
621 ptr -= addr; in atiixp_dmapos()
625 if ((ptr & ~(ch->blksz - 1)) != ch->ptr) { in atiixp_dmapos()
628 delta = (sz + ptr - ch->prevptr) % sz; in atiixp_dmapos()
630 if (delta < ch->blksz) in atiixp_dmapos()
632 device_printf(sc->dev, in atiixp_dmapos()
633 "PCMDIR_%s: incoherent DMA " in atiixp_dmapos()
638 (ch->dir == PCMDIR_PLAY) ? in atiixp_dmapos()
640 ch->prevptr, ptr, in atiixp_dmapos()
641 ch->ptr, ch->blkcnt, in atiixp_dmapos()
642 delta, ch->blksz, in atiixp_dmapos()
643 (delta < ch->blksz) ? in atiixp_dmapos()
645 ch->ptr = ptr & ~(ch->blksz - 1); in atiixp_dmapos()
647 ch->prevptr = ptr; in atiixp_dmapos()
652 } while (--retry); in atiixp_dmapos()
654 device_printf(sc->dev, "PCMDIR_%s: invalid DMA pointer ptr=%u\n", in atiixp_dmapos()
655 (ch->dir == PCMDIR_PLAY) ? "PLAY" : "REC", ptr); in atiixp_dmapos()
666 if (!(ch->flags & ATI_IXP_CHN_RUNNING)) in atiixp_poll_channel()
669 sz = ch->blksz * ch->blkcnt; in atiixp_poll_channel()
671 ch->ptr = ptr; in atiixp_poll_channel()
673 ptr &= ~(ch->blksz - 1); in atiixp_poll_channel()
674 delta = (sz + ptr - ch->prevptr) % sz; in atiixp_poll_channel()
676 if (delta < ch->blksz) in atiixp_poll_channel()
679 ch->prevptr = ptr; in atiixp_poll_channel()
684 #define atiixp_chan_active(sc) (((sc)->pch.flags | (sc)->rch.flags) & \
697 if (sc->polling == 0 || atiixp_chan_active(sc) == 0) { in atiixp_poll_callback()
702 trigger |= (atiixp_poll_channel(&sc->pch) != 0) ? 1 : 0; in atiixp_poll_callback()
703 trigger |= (atiixp_poll_channel(&sc->rch) != 0) ? 2 : 0; in atiixp_poll_callback()
706 callout_reset(&sc->poll_timer, 1/*sc->poll_ticks*/, in atiixp_poll_callback()
712 chn_intr(sc->pch.channel); in atiixp_poll_callback()
714 chn_intr(sc->rch.channel); in atiixp_poll_callback()
721 struct atiixp_info *sc = ch->parent; in atiixp_chan_trigger()
734 atiixp_wr(sc, ch->linkptr_bit, 0); in atiixp_chan_trigger()
736 atiixp_wr(sc, ch->linkptr_bit, in atiixp_chan_trigger()
737 (uint32_t)ch->sgd_addr | ATI_REG_LINKPTR_EN); in atiixp_chan_trigger()
738 if (sc->polling != 0) { in atiixp_chan_trigger()
739 ch->ptr = 0; in atiixp_chan_trigger()
740 ch->prevptr = 0; in atiixp_chan_trigger()
741 pollticks = ((uint64_t)hz * ch->blksz) / in atiixp_chan_trigger()
742 ((uint64_t)sndbuf_getalign(ch->buffer) * in atiixp_chan_trigger()
743 sndbuf_getspd(ch->buffer)); in atiixp_chan_trigger()
750 pollticks < sc->poll_ticks) { in atiixp_chan_trigger()
753 device_printf(sc->dev, in atiixp_chan_trigger()
757 device_printf(sc->dev, in atiixp_chan_trigger()
758 "%s: pollticks %d -> %d\n", in atiixp_chan_trigger()
759 __func__, sc->poll_ticks, in atiixp_chan_trigger()
762 sc->poll_ticks = pollticks; in atiixp_chan_trigger()
763 callout_reset(&sc->poll_timer, 1, in atiixp_chan_trigger()
767 ch->flags |= ATI_IXP_CHN_RUNNING; in atiixp_chan_trigger()
773 ch->flags &= ~ATI_IXP_CHN_RUNNING; in atiixp_chan_trigger()
774 if (sc->polling != 0) { in atiixp_chan_trigger()
776 callout_stop(&sc->poll_timer); in atiixp_chan_trigger()
777 sc->poll_ticks = 1; in atiixp_chan_trigger()
779 if (sc->pch.flags & ATI_IXP_CHN_RUNNING) in atiixp_chan_trigger()
780 ch = &sc->pch; in atiixp_chan_trigger()
782 ch = &sc->rch; in atiixp_chan_trigger()
783 pollticks = ((uint64_t)hz * ch->blksz) / in atiixp_chan_trigger()
784 ((uint64_t)sndbuf_getalign(ch->buffer) * in atiixp_chan_trigger()
785 sndbuf_getspd(ch->buffer)); in atiixp_chan_trigger()
791 if (pollticks > sc->poll_ticks) { in atiixp_chan_trigger()
793 device_printf(sc->dev, in atiixp_chan_trigger()
794 "%s: pollticks %d -> %d\n", in atiixp_chan_trigger()
795 __func__, sc->poll_ticks, in atiixp_chan_trigger()
797 sc->poll_ticks = pollticks; in atiixp_chan_trigger()
798 callout_reset(&sc->poll_timer, in atiixp_chan_trigger()
829 struct atiixp_info *sc = ch->parent; in atiixp_chan_getptr()
833 if (sc->polling != 0) in atiixp_chan_getptr()
834 ptr = ch->ptr; in atiixp_chan_getptr()
847 if (ch->caps_32bit) in atiixp_chan_getcaps()
876 if (sc->polling != 0) { in atiixp_intr()
888 (sc->pch.flags & ATI_IXP_CHN_RUNNING)) in atiixp_intr()
891 (sc->rch.flags & ATI_IXP_CHN_RUNNING)) in atiixp_intr()
896 device_printf(sc->dev, in atiixp_intr()
900 device_printf(sc->dev, in atiixp_intr()
908 sc->codec_not_ready_bits |= detected_codecs; in atiixp_intr()
922 chn_intr(sc->pch.channel); in atiixp_intr()
924 chn_intr(sc->rch.channel); in atiixp_intr()
931 sc->sgd_addr = bds->ds_addr; in atiixp_dma_cb()
944 /* clear all DMA enables (preserving rest of settings) */ in atiixp_chip_pre_init()
953 sc->codec_not_ready_bits = 0; in atiixp_chip_pre_init()
968 dev = oidp->oid_arg1; in sysctl_atiixp_polling()
973 val = sc->polling; in sysctl_atiixp_polling()
977 if (err || req->newptr == NULL) in sysctl_atiixp_polling()
983 if (val != sc->polling) { in sysctl_atiixp_polling()
988 sc->polling = 0; in sysctl_atiixp_polling()
992 sc->polling = 1; in sysctl_atiixp_polling()
1011 if (sc->delayed_attach.ich_func) { in atiixp_chip_post_init()
1012 config_intrhook_disestablish(&sc->delayed_attach); in atiixp_chip_post_init()
1013 sc->delayed_attach.ich_func = NULL; in atiixp_chip_post_init()
1016 polling = sc->polling; in atiixp_chip_post_init()
1017 sc->polling = 0; in atiixp_chip_post_init()
1020 if (sc->codec_not_ready_bits == 0) { in atiixp_chip_post_init()
1023 msleep(sc, sc->lock, PWAIT, "ixpslp", max(hz / 10, 1)); in atiixp_chip_post_init()
1024 if (sc->codec_not_ready_bits != 0) in atiixp_chip_post_init()
1026 } while (--timeout); in atiixp_chip_post_init()
1029 sc->polling = polling; in atiixp_chip_post_init()
1032 if (sc->codec_not_ready_bits == 0 && timeout == 0) { in atiixp_chip_post_init()
1033 device_printf(sc->dev, in atiixp_chip_post_init()
1046 if (!(sc->codec_not_ready_bits & ATI_REG_ISR_CODEC0_NOT_READY)) { in atiixp_chip_post_init()
1048 sc->codec_found++; in atiixp_chip_post_init()
1049 sc->codec_idx = 0; in atiixp_chip_post_init()
1053 if (!(sc->codec_not_ready_bits & ATI_REG_ISR_CODEC1_NOT_READY)) { in atiixp_chip_post_init()
1055 sc->codec_found++; in atiixp_chip_post_init()
1058 if (!(sc->codec_not_ready_bits & ATI_REG_ISR_CODEC2_NOT_READY)) { in atiixp_chip_post_init()
1060 sc->codec_found++; in atiixp_chip_post_init()
1069 sc->codec = AC97_CREATE(sc->dev, sc, atiixp_ac97); in atiixp_chip_post_init()
1070 if (sc->codec == NULL) in atiixp_chip_post_init()
1073 subdev = (pci_get_subdevice(sc->dev) << 16) | in atiixp_chip_post_init()
1074 pci_get_subvendor(sc->dev); in atiixp_chip_post_init()
1077 case 0x2043161f: /* Maxselect x710s - http://maxselect.ru/ */ in atiixp_chip_post_init()
1078 ac97_setflags(sc->codec, ac97_getflags(sc->codec) | in atiixp_chip_post_init()
1085 mixer_init(sc->dev, ac97_getmixerclass(), sc->codec); in atiixp_chip_post_init()
1087 pcm_init(sc->dev, sc); in atiixp_chip_post_init()
1090 pcm_addchan(sc->dev, PCMDIR_PLAY, &atiixp_chan_class, sc); in atiixp_chip_post_init()
1092 pcm_addchan(sc->dev, PCMDIR_REC, &atiixp_chan_class, sc); in atiixp_chip_post_init()
1094 SYSCTL_ADD_PROC(device_get_sysctl_ctx(sc->dev), in atiixp_chip_post_init()
1095 SYSCTL_CHILDREN(device_get_sysctl_tree(sc->dev)), OID_AUTO, in atiixp_chip_post_init()
1096 "polling", CTLTYPE_INT | CTLFLAG_RW | CTLFLAG_MPSAFE, sc->dev, in atiixp_chip_post_init()
1097 sizeof(sc->dev), sysctl_atiixp_polling, "I", "Enable polling mode"); in atiixp_chip_post_init()
1100 rman_get_start(sc->reg), rman_get_start(sc->irq), in atiixp_chip_post_init()
1101 device_get_nameunit(device_get_parent(sc->dev))); in atiixp_chip_post_init()
1103 if (pcm_register(sc->dev, status)) in atiixp_chip_post_init()
1107 if (sc->polling == 0) in atiixp_chip_post_init()
1122 if (sc->registered_channels != 0) { in atiixp_release_resource()
1124 sc->polling = 0; in atiixp_release_resource()
1125 callout_stop(&sc->poll_timer); in atiixp_release_resource()
1127 callout_drain(&sc->poll_timer); in atiixp_release_resource()
1129 if (sc->codec) { in atiixp_release_resource()
1130 ac97_destroy(sc->codec); in atiixp_release_resource()
1131 sc->codec = NULL; in atiixp_release_resource()
1133 if (sc->ih) { in atiixp_release_resource()
1134 bus_teardown_intr(sc->dev, sc->irq, sc->ih); in atiixp_release_resource()
1135 sc->ih = NULL; in atiixp_release_resource()
1137 if (sc->reg) { in atiixp_release_resource()
1138 bus_release_resource(sc->dev, sc->regtype, sc->regid, sc->reg); in atiixp_release_resource()
1139 sc->reg = NULL; in atiixp_release_resource()
1141 if (sc->irq) { in atiixp_release_resource()
1142 bus_release_resource(sc->dev, SYS_RES_IRQ, sc->irqid, sc->irq); in atiixp_release_resource()
1143 sc->irq = NULL; in atiixp_release_resource()
1145 if (sc->parent_dmat) { in atiixp_release_resource()
1146 bus_dma_tag_destroy(sc->parent_dmat); in atiixp_release_resource()
1147 sc->parent_dmat = NULL; in atiixp_release_resource()
1149 if (sc->sgd_addr) { in atiixp_release_resource()
1150 bus_dmamap_unload(sc->sgd_dmat, sc->sgd_dmamap); in atiixp_release_resource()
1151 sc->sgd_addr = 0; in atiixp_release_resource()
1153 if (sc->sgd_table) { in atiixp_release_resource()
1154 bus_dmamem_free(sc->sgd_dmat, sc->sgd_table, sc->sgd_dmamap); in atiixp_release_resource()
1155 sc->sgd_table = NULL; in atiixp_release_resource()
1157 if (sc->sgd_dmat) { in atiixp_release_resource()
1158 bus_dma_tag_destroy(sc->sgd_dmat); in atiixp_release_resource()
1159 sc->sgd_dmat = NULL; in atiixp_release_resource()
1161 if (sc->lock) { in atiixp_release_resource()
1162 snd_mtxfree(sc->lock); in atiixp_release_resource()
1163 sc->lock = NULL; in atiixp_release_resource()
1194 sc->lock = snd_mtxcreate(device_get_nameunit(dev), "snd_atiixp softc"); in atiixp_pci_attach()
1195 sc->dev = dev; in atiixp_pci_attach()
1197 callout_init(&sc->poll_timer, 1); in atiixp_pci_attach()
1198 sc->poll_ticks = 1; in atiixp_pci_attach()
1200 if (resource_int_value(device_get_name(sc->dev), in atiixp_pci_attach()
1201 device_get_unit(sc->dev), "polling", &i) == 0 && i != 0) in atiixp_pci_attach()
1202 sc->polling = 1; in atiixp_pci_attach()
1204 sc->polling = 0; in atiixp_pci_attach()
1208 sc->regid = PCIR_BAR(0); in atiixp_pci_attach()
1209 sc->regtype = SYS_RES_MEMORY; in atiixp_pci_attach()
1210 sc->reg = bus_alloc_resource_any(dev, sc->regtype, in atiixp_pci_attach()
1211 &sc->regid, RF_ACTIVE); in atiixp_pci_attach()
1213 if (!sc->reg) { in atiixp_pci_attach()
1218 sc->st = rman_get_bustag(sc->reg); in atiixp_pci_attach()
1219 sc->sh = rman_get_bushandle(sc->reg); in atiixp_pci_attach()
1221 sc->bufsz = pcm_getbuffersize(dev, ATI_IXP_BUFSZ_MIN, in atiixp_pci_attach()
1224 sc->irqid = 0; in atiixp_pci_attach()
1225 sc->irq = bus_alloc_resource_any(dev, SYS_RES_IRQ, &sc->irqid, in atiixp_pci_attach()
1227 if (!sc->irq || snd_setup_intr(dev, sc->irq, INTR_MPSAFE, in atiixp_pci_attach()
1228 atiixp_intr, sc, &sc->ih)) { in atiixp_pci_attach()
1234 * Let the user choose the best DMA segments. in atiixp_pci_attach()
1241 sc->blkcnt = sc->bufsz / i; in atiixp_pci_attach()
1243 while (sc->blkcnt >> i) in atiixp_pci_attach()
1245 sc->blkcnt = 1 << (i - 1); in atiixp_pci_attach()
1246 if (sc->blkcnt < ATI_IXP_DMA_CHSEGS_MIN) in atiixp_pci_attach()
1247 sc->blkcnt = ATI_IXP_DMA_CHSEGS_MIN; in atiixp_pci_attach()
1248 else if (sc->blkcnt > ATI_IXP_DMA_CHSEGS_MAX) in atiixp_pci_attach()
1249 sc->blkcnt = ATI_IXP_DMA_CHSEGS_MAX; in atiixp_pci_attach()
1252 sc->blkcnt = ATI_IXP_DMA_CHSEGS; in atiixp_pci_attach()
1255 * DMA tag for scatter-gather buffers and link pointers in atiixp_pci_attach()
1262 /*maxsize*/sc->bufsz, /*nsegments*/1, /*maxsegz*/0x3ffff, in atiixp_pci_attach()
1264 /*lockarg*/NULL, &sc->parent_dmat) != 0) { in atiixp_pci_attach()
1265 device_printf(dev, "unable to create dma tag\n"); in atiixp_pci_attach()
1278 /*lockarg*/NULL, &sc->sgd_dmat) != 0) { in atiixp_pci_attach()
1279 device_printf(dev, "unable to create dma tag\n"); in atiixp_pci_attach()
1283 if (bus_dmamem_alloc(sc->sgd_dmat, (void **)&sc->sgd_table, in atiixp_pci_attach()
1284 BUS_DMA_NOWAIT, &sc->sgd_dmamap) == -1) in atiixp_pci_attach()
1287 if (bus_dmamap_load(sc->sgd_dmat, sc->sgd_dmamap, sc->sgd_table, in atiixp_pci_attach()
1294 sc->delayed_attach.ich_func = atiixp_chip_post_init; in atiixp_pci_attach()
1295 sc->delayed_attach.ich_arg = sc; in atiixp_pci_attach()
1297 config_intrhook_establish(&sc->delayed_attach) != 0) { in atiixp_pci_attach()
1298 sc->delayed_attach.ich_func = NULL; in atiixp_pci_attach()
1317 if (sc->codec != NULL) { in atiixp_pci_detach()
1322 sc->codec = NULL; in atiixp_pci_detach()
1323 if (sc->st != 0 && sc->sh != 0) in atiixp_pci_detach()
1341 if (sc->pch.flags & ATI_IXP_CHN_RUNNING) { in atiixp_pci_suspend()
1342 atiixp_chan_trigger(NULL, &sc->pch, PCMTRIG_STOP); in atiixp_pci_suspend()
1343 sc->pch.flags |= ATI_IXP_CHN_SUSPEND; in atiixp_pci_suspend()
1345 if (sc->rch.flags & ATI_IXP_CHN_RUNNING) { in atiixp_pci_suspend()
1346 atiixp_chan_trigger(NULL, &sc->rch, PCMTRIG_STOP); in atiixp_pci_suspend()
1347 sc->rch.flags |= ATI_IXP_CHN_SUSPEND; in atiixp_pci_suspend()
1368 if (mixer_reinit(dev) == -1) { in atiixp_pci_resume()
1377 if (sc->pch.channel != NULL) { in atiixp_pci_resume()
1378 if (sc->pch.fmt != 0) in atiixp_pci_resume()
1379 atiixp_chan_setformat(NULL, &sc->pch, sc->pch.fmt); in atiixp_pci_resume()
1380 if (sc->pch.flags & ATI_IXP_CHN_SUSPEND) { in atiixp_pci_resume()
1381 sc->pch.flags &= ~ATI_IXP_CHN_SUSPEND; in atiixp_pci_resume()
1382 atiixp_chan_trigger(NULL, &sc->pch, PCMTRIG_START); in atiixp_pci_resume()
1385 if (sc->rch.channel != NULL) { in atiixp_pci_resume()
1386 if (sc->rch.fmt != 0) in atiixp_pci_resume()
1387 atiixp_chan_setformat(NULL, &sc->rch, sc->rch.fmt); in atiixp_pci_resume()
1388 if (sc->rch.flags & ATI_IXP_CHN_SUSPEND) { in atiixp_pci_resume()
1389 sc->rch.flags &= ~ATI_IXP_CHN_SUSPEND; in atiixp_pci_resume()
1390 atiixp_chan_trigger(NULL, &sc->rch, PCMTRIG_START); in atiixp_pci_resume()
1396 if (sc->polling == 0) in atiixp_pci_resume()