Lines Matching refs:info
266 static void amd7930_enable_ints(struct amd7930_info *info) in amd7930_enable_ints() argument
271 if (!info->ints_on) { in amd7930_enable_ints()
272 sbus_writeb(AMR_INIT, info->regs + CR); in amd7930_enable_ints()
273 sbus_writeb(AM_INIT_ACTIVE, info->regs + DR); in amd7930_enable_ints()
274 info->ints_on = 1; in amd7930_enable_ints()
280 static __inline__ void amd7930_disable_ints(struct amd7930_info *info) in amd7930_disable_ints() argument
285 if (info->ints_on) { in amd7930_disable_ints()
286 sbus_writeb(AMR_INIT, info->regs + CR); in amd7930_disable_ints()
288 info->regs + DR); in amd7930_disable_ints()
289 info->ints_on = 0; in amd7930_disable_ints()
296 static __inline__ void amd7930_idle(struct amd7930_info *info) in amd7930_idle() argument
301 if (info->ints_on) { in amd7930_idle()
302 sbus_writeb(AMR_INIT, info->regs + CR); in amd7930_idle()
303 sbus_writeb(0, info->regs + DR); in amd7930_idle()
304 info->ints_on = 0; in amd7930_idle()
312 struct amd7930_info *info = (struct amd7930_info *) drv->private; in amd7930_write_map() local
313 unsigned long regs = info->regs; in amd7930_write_map()
314 struct amd7930_map *map = &info->map; in amd7930_write_map()
343 struct amd7930_info *info = (struct amd7930_info *) drv->private; in amd7930_update_map() local
344 struct amd7930_map *map = &info->map; in amd7930_update_map()
347 map->gx = gx_coeff[info->rgain]; in amd7930_update_map()
348 map->stgr = gx_coeff[info->mgain]; in amd7930_update_map()
350 level = (info->pgain * (256 + NR_GER_COEFFS)) >> 8; in amd7930_update_map()
377 inline void debug_info(struct amd7930_info *info, char c) in debug_info() argument
381 if (!info || !info->D.output_callback_arg) in debug_info()
384 cs = (struct IsdnCardState *) info->D.output_callback_arg; in debug_info()
398 #define debug_info(info,c) argument
402 static void fill_D_xmit_fifo(struct amd7930_info *info) in fill_D_xmit_fifo() argument
405 while (info->D.output_ptr && info->D.output_count > 0 && in fill_D_xmit_fifo()
406 (sbus_readb(info->regs + DSR2) & AMR_DSR2_TBE)) { in fill_D_xmit_fifo()
407 u8 byte = *(info->D.output_ptr); in fill_D_xmit_fifo()
410 sbus_writeb(byte, info->regs + DCTB); in fill_D_xmit_fifo()
411 info->D.output_ptr++; in fill_D_xmit_fifo()
412 info->D.output_count--; in fill_D_xmit_fifo()
414 debug_info(info, '>'); in fill_D_xmit_fifo()
418 static void transceive_Dchannel(struct amd7930_info *info) in transceive_Dchannel() argument
427 fill_D_xmit_fifo(info); in transceive_Dchannel()
430 if (info->D.output_ptr != NULL && info->D.output_count == 0) { in transceive_Dchannel()
431 info->D.output_ptr = NULL; in transceive_Dchannel()
432 info->D.output_count = 0; in transceive_Dchannel()
433 debug_info(info, '+'); in transceive_Dchannel()
434 if (info->D.output_callback) in transceive_Dchannel()
435 (*info->D.output_callback) in transceive_Dchannel()
436 (info->D.output_callback_arg, in transceive_Dchannel()
437 sbus_readb(info->regs + DER)); in transceive_Dchannel()
443 while (sbus_readb(info->regs + DSR2) & AMR_DSR2_RBA) { in transceive_Dchannel()
444 if (info->D.input_ptr && in transceive_Dchannel()
445 (info->D.input_count < info->D.input_limit)) { in transceive_Dchannel()
447 *(info->D.input_ptr) = sbus_readb(info->regs + DCRB); in transceive_Dchannel()
448 info->D.input_ptr++; in transceive_Dchannel()
449 info->D.input_count++; in transceive_Dchannel()
454 dummy = sbus_readb(info->regs + DCRB); in transceive_Dchannel()
457 debug_info(info, '<'); in transceive_Dchannel()
459 if (sbus_readb(info->regs + DSR2) & AMR_DSR2_LBRP) { in transceive_Dchannel()
463 debug_info(info, '!'); in transceive_Dchannel()
464 info->D.input_ptr = NULL; in transceive_Dchannel()
465 der = sbus_readb(info->regs + DER) & D_RECV_ERRORS; in transceive_Dchannel()
468 sbus_writeb(AMR_DLC_DRCR, info->regs + CR); in transceive_Dchannel()
469 dummy = sbus_readb(info->regs + DR); in transceive_Dchannel()
470 dummy = sbus_readb(info->regs + DR); in transceive_Dchannel()
472 if (info->D.input_callback) in transceive_Dchannel()
473 (*info->D.input_callback) in transceive_Dchannel()
474 (info->D.input_callback_arg, der, in transceive_Dchannel()
475 info->D.input_count); in transceive_Dchannel()
569 struct amd7930_info *info = (struct amd7930_info *) drv->private; in amd7930_interrupt() local
570 unsigned long regs = info->regs; in amd7930_interrupt()
577 if (info->Bb.channel_status == CHANNEL_INUSE) in amd7930_interrupt()
578 transceive_Bchannel(&info->Bb, info->regs + BBTB); in amd7930_interrupt()
579 if (info->Bc.channel_status == CHANNEL_INUSE) in amd7930_interrupt()
580 transceive_Bchannel(&info->Bc, info->regs + BCTB); in amd7930_interrupt()
584 debug_info(info, 'i'); in amd7930_interrupt()
585 debug_info(info, '0' + (ir&7)); in amd7930_interrupt()
586 transceive_Dchannel(info); in amd7930_interrupt()
595 info->liu_state = (lsr & 0x7) + 2; in amd7930_interrupt()
597 if (info->liu_callback) in amd7930_interrupt()
598 (*info->liu_callback)(info->liu_callback_arg); in amd7930_interrupt()
605 struct amd7930_info *info = (struct amd7930_info *) drv->private; in amd7930_open() local
609 info->format_type = AUDIO_ENCODING_ULAW; in amd7930_open()
612 info->format_type = AUDIO_ENCODING_LINEAR8; in amd7930_open()
615 info->format_type = AUDIO_ENCODING_LINEAR; in amd7930_open()
630 static void request_Baudio(struct amd7930_info *info) in request_Baudio() argument
632 if (info->Bb.channel_status == CHANNEL_AVAILABLE) { in request_Baudio()
633 info->Bb.channel_status = CHANNEL_INUSE; in request_Baudio()
634 info->Baudio = &info->Bb; in request_Baudio()
637 sbus_writeb(AMR_MUX_MCR1, info->regs + CR); in request_Baudio()
639 info->regs + DR); in request_Baudio()
642 sbus_writeb(AMR_MUX_MCR4, info->regs + CR); in request_Baudio()
643 sbus_writeb(AM_MUX_MCR4_ENABLE_INTS, info->regs + DR); in request_Baudio()
644 } else if (info->Bc.channel_status == CHANNEL_AVAILABLE) { in request_Baudio()
645 info->Bc.channel_status = CHANNEL_INUSE; in request_Baudio()
646 info->Baudio = &info->Bc; in request_Baudio()
649 sbus_writeb(AMR_MUX_MCR1, info->regs + CR); in request_Baudio()
651 info->regs + DR); in request_Baudio()
654 sbus_writeb(AMR_MUX_MCR4, info->regs + CR); in request_Baudio()
655 sbus_writeb(AM_MUX_MCR4_ENABLE_INTS, info->regs + DR); in request_Baudio()
659 static void release_Baudio(struct amd7930_info *info) in release_Baudio() argument
661 if (info->Baudio) { in release_Baudio()
662 info->Baudio->channel_status = CHANNEL_AVAILABLE; in release_Baudio()
663 sbus_writeb(AMR_MUX_MCR1, info->regs + CR); in release_Baudio()
664 sbus_writeb(0, info->regs + DR); in release_Baudio()
665 info->Baudio = NULL; in release_Baudio()
667 if (info->Bb.channel_status == CHANNEL_AVAILABLE && in release_Baudio()
668 info->Bc.channel_status == CHANNEL_AVAILABLE) { in release_Baudio()
670 sbus_writeb(AMR_MUX_MCR4, info->regs + CR); in release_Baudio()
671 sbus_writeb(0, info->regs + DR); in release_Baudio()
679 struct amd7930_info *info = (struct amd7930_info *) drv->private; in amd7930_start_output() local
681 if (! info->Baudio) in amd7930_start_output()
682 request_Baudio(info); in amd7930_start_output()
684 if (info->Baudio) { in amd7930_start_output()
685 info->Baudio->output_ptr = buffer; in amd7930_start_output()
686 info->Baudio->output_count = count; in amd7930_start_output()
687 info->Baudio->output_format = info->format_type; in amd7930_start_output()
688 info->Baudio->output_callback = (void *) &sparcaudio_output_done; in amd7930_start_output()
689 info->Baudio->output_callback_arg = (void *) drv; in amd7930_start_output()
690 info->Baudio->xmit_idle_char = 0; in amd7930_start_output()
696 struct amd7930_info *info = (struct amd7930_info *) drv->private; in amd7930_stop_output() local
698 if (info->Baudio) { in amd7930_stop_output()
699 info->Baudio->output_ptr = NULL; in amd7930_stop_output()
700 info->Baudio->output_count = 0; in amd7930_stop_output()
701 if (! info->Baudio->input_ptr) in amd7930_stop_output()
702 release_Baudio(info); in amd7930_stop_output()
709 struct amd7930_info *info = (struct amd7930_info *) drv->private; in amd7930_start_input() local
711 if (! info->Baudio) in amd7930_start_input()
712 request_Baudio(info); in amd7930_start_input()
714 if (info->Baudio) { in amd7930_start_input()
715 info->Baudio->input_ptr = buffer; in amd7930_start_input()
716 info->Baudio->input_count = count; in amd7930_start_input()
717 info->Baudio->input_format = info->format_type; in amd7930_start_input()
718 info->Baudio->input_callback = (void *) &sparcaudio_input_done; in amd7930_start_input()
719 info->Baudio->input_callback_arg = (void *) drv; in amd7930_start_input()
725 struct amd7930_info *info = (struct amd7930_info *) drv->private; in amd7930_stop_input() local
727 if (info->Baudio) { in amd7930_stop_input()
728 info->Baudio->input_ptr = NULL; in amd7930_stop_input()
729 info->Baudio->input_count = 0; in amd7930_stop_input()
730 if (! info->Baudio->output_ptr) in amd7930_stop_input()
731 release_Baudio(info); in amd7930_stop_input()
766 struct amd7930_info *info = (struct amd7930_info *) drv->private; in amd7930_set_output_volume() local
768 info->pgain = vol; in amd7930_set_output_volume()
775 struct amd7930_info *info = (struct amd7930_info *) drv->private; in amd7930_get_output_volume() local
777 return info->pgain; in amd7930_get_output_volume()
782 struct amd7930_info *info = (struct amd7930_info *) drv->private; in amd7930_set_input_volume() local
784 info->rgain = vol; in amd7930_set_input_volume()
791 struct amd7930_info *info = (struct amd7930_info *) drv->private; in amd7930_get_input_volume() local
793 return info->rgain; in amd7930_get_input_volume()
798 struct amd7930_info *info = (struct amd7930_info *) drv->private; in amd7930_set_monitor_volume() local
800 info->mgain = vol; in amd7930_set_monitor_volume()
807 struct amd7930_info *info = (struct amd7930_info *) drv->private; in amd7930_get_monitor_volume() local
809 return info->mgain; in amd7930_get_monitor_volume()
869 struct amd7930_info *info = (struct amd7930_info *) drv->private; in amd7930_get_output_port() local
871 if (info->map.mmr2 & AM_MAP_MMR2_LS) in amd7930_get_output_port()
879 struct amd7930_info *info = (struct amd7930_info *) drv->private; in amd7930_set_output_port() local
883 info->map.mmr2 &= ~AM_MAP_MMR2_LS; in amd7930_set_output_port()
886 info->map.mmr2 |= AM_MAP_MMR2_LS; in amd7930_set_output_port()
904 struct amd7930_info *info = (struct amd7930_info *) drv->private; in amd7930_get_encoding() local
906 if ((info->map.mmr1 & AM_MAP_MMR1_ALAW) && in amd7930_get_encoding()
907 (info->format_type == AUDIO_ENCODING_ALAW)) in amd7930_get_encoding()
910 return info->format_type; in amd7930_get_encoding()
916 struct amd7930_info *info = (struct amd7930_info *) drv->private; in amd7930_set_encoding() local
920 info->map.mmr1 |= AM_MAP_MMR1_ALAW; in amd7930_set_encoding()
925 info->map.mmr1 &= ~AM_MAP_MMR1_ALAW; in amd7930_set_encoding()
931 info->format_type = value; in amd7930_set_encoding()
967 struct amd7930_info *info = (struct amd7930_info *) drv->private; in amd7930_loopback() local
970 info->map.mmr1 |= AM_MAP_MMR1_LOOPBACK; in amd7930_loopback()
972 info->map.mmr1 &= ~AM_MAP_MMR1_LOOPBACK; in amd7930_loopback()
1137 struct amd7930_info *info; in amd7930_get_irqnum() local
1142 info = (struct amd7930_info *) drivers[dev].private; in amd7930_get_irqnum()
1144 return info->irq; in amd7930_get_irqnum()
1149 struct amd7930_info *info; in amd7930_get_liu_state() local
1154 info = (struct amd7930_info *) drivers[dev].private; in amd7930_get_liu_state()
1156 return info->liu_state; in amd7930_get_liu_state()
1161 struct amd7930_info *info; in amd7930_liu_init() local
1167 info = (struct amd7930_info *) drivers[dev].private; in amd7930_liu_init()
1172 info->liu_callback = callback; in amd7930_liu_init()
1173 info->liu_callback_arg = callback_arg; in amd7930_liu_init()
1176 sbus_writeb(AMR_LIU_LMR1, info->regs + CR); in amd7930_liu_init()
1177 sbus_writeb(0, info->regs + DR); in amd7930_liu_init()
1180 sbus_writeb(AMR_LIU_LMR2, info->regs + CR); in amd7930_liu_init()
1184 info->regs + DR); in amd7930_liu_init()
1189 sbus_writeb(AMR_LIU_LMR1, info->regs + CR); in amd7930_liu_init()
1190 sbus_writeb(AM_LIU_LMR1_LIU_ENABL, info->regs + DR); in amd7930_liu_init()
1197 struct amd7930_info *info; in amd7930_liu_activate() local
1203 info = (struct amd7930_info *) drivers[dev].private; in amd7930_liu_activate()
1214 sbus_writeb(AMR_LIU_LPR, info->regs + CR); in amd7930_liu_activate()
1215 sbus_writeb(priority & 0x0f, info->regs + DR); in amd7930_liu_activate()
1218 sbus_writeb(AMR_LIU_LMR1, info->regs + CR); in amd7930_liu_activate()
1220 info->regs + DR); in amd7930_liu_activate()
1227 struct amd7930_info *info; in amd7930_liu_deactivate() local
1233 info = (struct amd7930_info *) drivers[dev].private; in amd7930_liu_deactivate()
1238 sbus_writeb(AMR_LIU_LMR1, info->regs + CR); in amd7930_liu_deactivate()
1239 sbus_writeb(0, info->regs + DR); in amd7930_liu_deactivate()
1247 struct amd7930_info *info; in amd7930_dxmit() local
1254 info = (struct amd7930_info *) drivers[dev].private; in amd7930_dxmit()
1258 if (info->D.output_ptr) { in amd7930_dxmit()
1264 info->D.output_ptr = buffer; in amd7930_dxmit()
1265 info->D.output_count = count; in amd7930_dxmit()
1266 info->D.output_callback = callback; in amd7930_dxmit()
1267 info->D.output_callback_arg = callback_arg; in amd7930_dxmit()
1270 sbus_writeb(AMR_DLC_DMR1, info->regs + CR); in amd7930_dxmit()
1271 dmr1 = sbus_readb(info->regs + DR); in amd7930_dxmit()
1274 sbus_writeb(dmr1, info->regs + DR); in amd7930_dxmit()
1277 sbus_writeb(AMR_DLC_DTCR, info->regs + CR); in amd7930_dxmit()
1278 sbus_writeb(count & 0xff, info->regs + DR); in amd7930_dxmit()
1279 sbus_writeb((count >> 8) & 0xff, info->regs + DR); in amd7930_dxmit()
1283 transceive_Dchannel(info); in amd7930_dxmit()
1292 struct amd7930_info *info; in amd7930_drecv() local
1299 info = (struct amd7930_info *) drivers[dev].private; in amd7930_drecv()
1303 if (info->D.input_ptr) { in amd7930_drecv()
1309 info->D.input_ptr = buffer; in amd7930_drecv()
1310 info->D.input_count = 0; in amd7930_drecv()
1311 info->D.input_limit = size; in amd7930_drecv()
1312 info->D.input_callback = callback; in amd7930_drecv()
1313 info->D.input_callback_arg = callback_arg; in amd7930_drecv()
1319 sbus_writeb(AMR_DLC_DMR1, info->regs + CR); in amd7930_drecv()
1320 dmr1 = sbus_readb(info->regs + DR); in amd7930_drecv()
1323 sbus_writeb(dmr1, info->regs + DR); in amd7930_drecv()
1326 sbus_writeb(AMR_DLC_DRCR, info->regs + CR); in amd7930_drecv()
1327 sbus_writeb(size & 0xff, info->regs + DR); in amd7930_drecv()
1328 sbus_writeb((size >> 8) & 0xff, info->regs + DR); in amd7930_drecv()
1336 struct amd7930_info *info; in amd7930_bopen() local
1346 info = (struct amd7930_info *) drivers[dev].private; in amd7930_bopen()
1350 if (info->Bb.channel_status == CHANNEL_AVAILABLE) { in amd7930_bopen()
1351 info->Bb.channel_status = CHANNEL_INUSE; in amd7930_bopen()
1352 info->Bb.xmit_idle_char = xmit_idle_char; in amd7930_bopen()
1353 info->Bisdn[chan] = &info->Bb; in amd7930_bopen()
1356 sbus_writeb(AMR_MUX_MCR2 + chan, info->regs + CR); in amd7930_bopen()
1359 info->regs + DR); in amd7930_bopen()
1360 } else if (info->Bc.channel_status == CHANNEL_AVAILABLE) { in amd7930_bopen()
1361 info->Bc.channel_status = CHANNEL_INUSE; in amd7930_bopen()
1362 info->Bc.xmit_idle_char = xmit_idle_char; in amd7930_bopen()
1363 info->Bisdn[chan] = &info->Bc; in amd7930_bopen()
1366 sbus_writeb(AMR_MUX_MCR2 + chan, info->regs + CR); in amd7930_bopen()
1369 info->regs + DR); in amd7930_bopen()
1376 sbus_writeb(AMR_LIU_LMR1, info->regs + CR); in amd7930_bopen()
1377 tmp = sbus_readb(info->regs + DR); in amd7930_bopen()
1379 sbus_writeb(tmp, info->regs + DR); in amd7930_bopen()
1382 sbus_writeb(AMR_MUX_MCR4, info->regs + CR); in amd7930_bopen()
1386 info->regs + DR); in amd7930_bopen()
1394 struct amd7930_info *info; in amd7930_bclose() local
1400 info = (struct amd7930_info *) drivers[dev].private; in amd7930_bclose()
1404 if (info->Bisdn[chan]) { in amd7930_bclose()
1407 info->Bisdn[chan]->channel_status = CHANNEL_AVAILABLE; in amd7930_bclose()
1409 sbus_writeb(AMR_MUX_MCR2 + chan, info->regs + CR); in amd7930_bclose()
1410 sbus_writeb(0, info->regs + DR); in amd7930_bclose()
1412 info->Bisdn[chan] = NULL; in amd7930_bclose()
1415 sbus_writeb(AMR_LIU_LMR1, info->regs + CR); in amd7930_bclose()
1416 tmp = sbus_readb(info->regs + DR); in amd7930_bclose()
1418 sbus_writeb(tmp, info->regs + DR); in amd7930_bclose()
1420 if (info->Bb.channel_status == CHANNEL_AVAILABLE && in amd7930_bclose()
1421 info->Bc.channel_status == CHANNEL_AVAILABLE) { in amd7930_bclose()
1423 sbus_writeb(AMR_MUX_MCR4, info->regs + CR); in amd7930_bclose()
1424 sbus_writeb(0, info->regs + DR); in amd7930_bclose()
1435 struct amd7930_info *info; in amd7930_bxmit() local
1442 info = (struct amd7930_info *) drivers[dev].private; in amd7930_bxmit()
1443 Bchan = info->Bisdn[chan]; in amd7930_bxmit()
1463 struct amd7930_info *info; in amd7930_brecv() local
1470 info = (struct amd7930_info *) drivers[dev].private; in amd7930_brecv()
1471 Bchan = info->Bisdn[chan]; in amd7930_brecv()
1573 struct amd7930_info *info; in amd7930_attach() local
1583 info = (struct amd7930_info *)drv->private; in amd7930_attach()
1584 memset(info, 0, sizeof(*info)); in amd7930_attach()
1585 info->ints_on = 1; /* force disable below */ in amd7930_attach()
1599 info->regs_size = regs.reg_size; in amd7930_attach()
1600 info->regs = sbus_ioremap(resp, 0, regs.reg_size, "amd7930"); in amd7930_attach()
1601 if (!info->regs) { in amd7930_attach()
1608 amd7930_idle(info); in amd7930_attach()
1611 sbus_writeb(AMR_DLC_EFCR, info->regs + CR); in amd7930_attach()
1612 sbus_writeb(AMR_DLC_EFCR_EXTEND_FIFO, info->regs + DR); in amd7930_attach()
1613 sbus_writeb(AMR_DLC_DMR4, info->regs + CR); in amd7930_attach()
1615 info->regs + DR); in amd7930_attach()
1619 info->irq = irq.pri; in amd7930_attach()
1620 request_irq(info->irq, amd7930_interrupt, in amd7930_attach()
1622 amd7930_enable_ints(info); in amd7930_attach()
1625 memset(&info->map, 0, sizeof(info->map)); in amd7930_attach()
1626 info->map.mmr1 = AM_MAP_MMR1_GX | AM_MAP_MMR1_GER | in amd7930_attach()
1629 info->map.mmr2 |= (AM_MAP_MMR2_LS | AM_MAP_MMR2_AINB); in amd7930_attach()
1632 info->rgain = 128; in amd7930_attach()
1633 info->pgain = 200; in amd7930_attach()
1634 info->mgain = 0; in amd7930_attach()
1635 info->format_type = AUDIO_ENCODING_ULAW; in amd7930_attach()
1636 info->Bb.input_format = AUDIO_ENCODING_ULAW; in amd7930_attach()
1637 info->Bb.output_format = AUDIO_ENCODING_ULAW; in amd7930_attach()
1638 info->Bc.input_format = AUDIO_ENCODING_ULAW; in amd7930_attach()
1639 info->Bc.output_format = AUDIO_ENCODING_ULAW; in amd7930_attach()
1646 free_irq(info->irq, drv); in amd7930_attach()
1647 sbus_iounmap(info->regs, info->regs_size); in amd7930_attach()
1654 info->regs, info->irq); in amd7930_attach()
1663 struct amd7930_info *info = (struct amd7930_info *)drv->private; in amd7930_detach() local
1666 amd7930_idle(info); in amd7930_detach()
1667 free_irq(info->irq, drv); in amd7930_detach()
1668 sbus_iounmap(info->regs, info->regs_size); in amd7930_detach()