Lines Matching +full:inactive +full:- +full:delay
1 /*-
2 * SPDX-License-Identifier: BSD-2-Clause
9 * Copyright (c) 1996-1998 Crystal Semiconductor Corp.
192 subcard = card->cards; in csa_findsubcard()
211 device_set_desc(dev, card->name); in csa_probe()
229 scp->dev = dev; in csa_attach()
234 resp = &scp->res; in csa_attach()
235 scp->card = csa_findsubcard(dev); in csa_attach()
236 scp->binfo.card = scp->card; in csa_attach()
237 printf("csa: card is %s\n", scp->card->name); in csa_attach()
238 resp->io_rid = PCIR_BAR(0); in csa_attach()
239 resp->io = bus_alloc_resource_any(dev, SYS_RES_MEMORY, in csa_attach()
240 &resp->io_rid, RF_ACTIVE); in csa_attach()
241 if (resp->io == NULL) in csa_attach()
243 resp->mem_rid = PCIR_BAR(1); in csa_attach()
244 resp->mem = bus_alloc_resource_any(dev, SYS_RES_MEMORY, in csa_attach()
245 &resp->mem_rid, RF_ACTIVE); in csa_attach()
246 if (resp->mem == NULL) in csa_attach()
248 resp->irq_rid = 0; in csa_attach()
249 resp->irq = bus_alloc_resource_any(dev, SYS_RES_IRQ, in csa_attach()
250 &resp->irq_rid, RF_ACTIVE | RF_SHAREABLE); in csa_attach()
251 if (resp->irq == NULL) in csa_attach()
255 if (snd_setup_intr(dev, resp->irq, 0, csa_intr, scp, &scp->ih)) in csa_attach()
277 func->varinfo = &scp->binfo; in csa_attach()
278 func->func = SCF_PCM; in csa_attach()
279 scp->pcm = device_add_child(dev, "pcm", DEVICE_UNIT_ANY); in csa_attach()
280 device_set_ivars(scp->pcm, func); in csa_attach()
284 func->varinfo = &scp->binfo; in csa_attach()
285 func->func = SCF_MIDI; in csa_attach()
286 scp->midi = device_add_child(dev, "midi", DEVICE_UNIT_ANY); in csa_attach()
287 device_set_ivars(scp->midi, func); in csa_attach()
294 bus_teardown_intr(dev, resp->irq, scp->ih); in csa_attach()
296 bus_release_resource(dev, SYS_RES_IRQ, resp->irq_rid, resp->irq); in csa_attach()
298 bus_release_resource(dev, SYS_RES_MEMORY, resp->mem_rid, resp->mem); in csa_attach()
300 bus_release_resource(dev, SYS_RES_MEMORY, resp->io_rid, resp->io); in csa_attach()
318 resp = &scp->res; in csa_detach()
320 if (scp->midi != NULL) { in csa_detach()
321 err = device_delete_child(dev, scp->midi); in csa_detach()
324 scp->midi = NULL; in csa_detach()
327 if (scp->pcm != NULL) { in csa_detach()
328 err = device_delete_child(dev, scp->pcm); in csa_detach()
331 scp->pcm = NULL; in csa_detach()
334 bus_teardown_intr(dev, resp->irq, scp->ih); in csa_detach()
335 bus_release_resource(dev, SYS_RES_IRQ, resp->irq_rid, resp->irq); in csa_detach()
336 bus_release_resource(dev, SYS_RES_MEMORY, resp->mem_rid, resp->mem); in csa_detach()
337 bus_release_resource(dev, SYS_RES_MEMORY, resp->io_rid, resp->io); in csa_detach()
349 resp = &scp->res; in csa_resume()
374 resp = &scp->res; in csa_alloc_resource()
379 res = resp->irq; in csa_alloc_resource()
384 res = resp->io; in csa_alloc_resource()
387 res = resp->mem; in csa_alloc_resource()
426 printf("ata-csa.c: we cannot use a filter here\n"); in csa_setup_intr()
430 resp = &scp->res; in csa_setup_intr()
437 if (func == NULL || irq != resp->irq) in csa_setup_intr()
440 switch (func->func) { in csa_setup_intr()
442 scp->pcmintr = intr; in csa_setup_intr()
443 scp->pcmintr_arg = arg; in csa_setup_intr()
447 scp->midiintr = intr; in csa_setup_intr()
448 scp->midiintr_arg = arg; in csa_setup_intr()
470 resp = &scp->res; in csa_teardown_intr()
477 if (func == NULL || irq != resp->irq || cookie != scp) in csa_teardown_intr()
480 switch (func->func) { in csa_teardown_intr()
482 scp->pcmintr = NULL; in csa_teardown_intr()
483 scp->pcmintr_arg = NULL; in csa_teardown_intr()
487 scp->midiintr = NULL; in csa_teardown_intr()
488 scp->midiintr_arg = NULL; in csa_teardown_intr()
506 resp = &scp->res; in csa_intr()
520 scp->binfo.hisr = hisr; in csa_intr()
523 if ((hisr & (HISR_VC0 | HISR_VC1)) != 0 && scp->pcmintr != NULL) { in csa_intr()
524 scp->pcmintr(scp->pcmintr_arg); in csa_intr()
527 if ((hisr & HISR_MIDI) != 0 && scp->midiintr != NULL) { in csa_intr()
528 scp->midiintr(scp->midiintr_arg); in csa_intr()
543 resp = &scp->res; in csa_initialize()
555 * AC-link. Otherwise, we won't be able to bring up the link. in csa_initialize()
570 DELAY(50); in csa_initialize()
572 DELAY(50); in csa_initialize()
587 DELAY(50000); in csa_initialize()
594 DELAY(700000); in csa_initialize()
613 DELAY(5000); in csa_initialize()
649 DELAY(125); in csa_initialize()
674 * the codec is pumping ADC data across the AC-link. in csa_initialize()
683 DELAY(10000000L); /* clw */ in csa_initialize()
685 DELAY(1000); in csa_initialize()
764 DELAY(100); in csa_clearserialfifos()
880 * set DCV - will clear when process completed in csa_readcodec()
881 * set CRW - Read command in csa_readcodec()
882 * set VFRM - valid frame enabled in csa_readcodec()
883 * set ESYN - ASYNC generation enabled in csa_readcodec()
884 * set RSTN - ARST# inactive, AC97 codec not reset in csa_readcodec()
890 csa_writeio(resp, BA0_ACCAD, offset - BA0_AC97_RESET); in csa_readcodec()
902 DELAY(25); in csa_readcodec()
931 * VSTS - Valid Status in csa_readcodec()
938 DELAY(25); in csa_readcodec()
968 * set DCV - will clear when process completed in csa_writecodec()
969 * set VFRM - valid frame enabled in csa_writecodec()
970 * set ESYN - ASYNC generation enabled in csa_writecodec()
971 * set RSTN - ARST# inactive, AC97 codec not reset in csa_writecodec()
977 csa_writeio(resp, BA0_ACCAD, offset - BA0_AC97_RESET); in csa_writecodec()
989 DELAY(25); in csa_writecodec()
1015 …return bus_space_read_4(rman_get_bustag(resp->io), rman_get_bushandle(resp->io), offset) & 0xfffff… in csa_readio()
1027 bus_space_write_4(rman_get_bustag(resp->io), rman_get_bushandle(resp->io), offset, data); in csa_writeio()
1035 return bus_space_read_4(rman_get_bustag(resp->mem), rman_get_bushandle(resp->mem), offset); in csa_readmem()
1041 bus_space_write_4(rman_get_bustag(resp->mem), rman_get_bushandle(resp->mem), offset, data); in csa_writemem()