Lines Matching refs:cif
420 struct cmdif *cif; member
485 static int sendcmd(struct cmdif *cif, u32 flags, u32 cmd, u32 parm,
487 static int getsourcesink(struct cmdif *cif, unsigned char source,
491 static int riptide_reset(struct cmdif *cif, struct snd_riptide *chip);
669 static int senddata(struct cmdif *cif, const unsigned char *in, u32 offset) in senddata() argument
678 if (SEND_SMEM(cif, 0, addr) != 0) in senddata()
683 if (SEND_WMEM(cif, 2, in senddata()
693 static int loadfirmware(struct cmdif *cif, const unsigned char *img, in loadfirmware() argument
707 err = senddata(cif, in, laddr + saddr); in loadfirmware()
717 if (SEND_GOTO(cif, val) != 0) in loadfirmware()
738 alloclbuspath(struct cmdif *cif, unsigned char source, in alloclbuspath() argument
747 SEND_PSEL(cif, source, sink); in alloclbuspath()
771 alloclbuspath(cif, source + 1, ++npath, mixer, s); in alloclbuspath()
777 freelbuspath(struct cmdif *cif, unsigned char source, const unsigned char *path) in freelbuspath() argument
785 SEND_PCLR(cif, source, sink); in freelbuspath()
793 freelbuspath(cif, source + 1, ++npath); in freelbuspath()
798 static int writearm(struct cmdif *cif, u32 addr, u32 data, u32 mask) in writearm() argument
804 SEND_RMEM(cif, 0x02, addr, &rptr); in writearm()
808 SEND_SMEM(cif, 0x01, addr); in writearm()
809 SEND_WMEM(cif, 0x02, (rptr.retlongs[0] | data)); in writearm()
810 SEND_RMEM(cif, 0x02, addr, &rptr); in writearm()
822 static int sendcmd(struct cmdif *cif, u32 flags, u32 cmd, u32 parm, in sendcmd() argument
832 if (snd_BUG_ON(!cif)) in sendcmd()
835 hwport = cif->hwport; in sendcmd()
836 if (cif->errcnt > MAX_ERROR_COUNT) { in sendcmd()
837 if (cif->is_reset) { in sendcmd()
840 if (riptide_reset(cif, NULL) == 0) { in sendcmd()
841 cif->errcnt = 0; in sendcmd()
853 spin_lock_irqsave(&cif->lock, irqflags); in sendcmd()
854 while (i++ < CMDIF_TIMEOUT && !IS_READY(cif->hwport)) in sendcmd()
896 spin_unlock_irqrestore(&cif->lock, irqflags); in sendcmd()
898 cif->cmdcnt++; /* update command statistics */ in sendcmd()
899 cif->cmdtime += time; in sendcmd()
900 if (time > cif->cmdtimemax) in sendcmd()
901 cif->cmdtimemax = time; in sendcmd()
902 if (time < cif->cmdtimemin) in sendcmd()
903 cif->cmdtimemin = time; in sendcmd()
904 if ((cif->cmdcnt) % 1000 == 0) in sendcmd()
907 cif->cmdcnt, cif->cmdtime, cif->cmdtimemin, in sendcmd()
908 cif->cmdtimemax, cif->errcnt); in sendcmd()
912 cif->errcnt++; in sendcmd()
913 spin_unlock_irqrestore(&cif->lock, irqflags); in sendcmd()
916 cif->cmdcnt, (int)((void *)&(cmdport->stat) - (void *)hwport), in sendcmd()
924 setmixer(struct cmdif *cif, short num, unsigned short rval, unsigned short lval) in setmixer() argument
931 SEND_SDGV(cif, num, num, rval, lval); in setmixer()
932 SEND_RDGV(cif, num, num, &rptr); in setmixer()
940 static int getpaths(struct cmdif *cif, unsigned char *o) in getpaths() argument
947 getsourcesink(cif, i, i, &src[i], &sink[i]); in getpaths()
957 getsourcesink(struct cmdif *cif, unsigned char source, unsigned char sink, in getsourcesink() argument
962 if (SEND_RSSV(cif, source, sink, &rptr) && in getsourcesink()
963 SEND_RSSV(cif, source, sink, &rptr)) in getsourcesink()
972 getsamplerate(struct cmdif *cif, unsigned char *intdec, unsigned int *rate) in getsamplerate() argument
982 if (SEND_RSRC(cif, *s, &rptr) && in getsamplerate()
983 SEND_RSRC(cif, *s, &rptr)) in getsamplerate()
1003 setsampleformat(struct cmdif *cif, in setsampleformat() argument
1017 if (SEND_SETF(cif, mixer, w, ch, order, sig, id) && in setsampleformat()
1018 SEND_SETF(cif, mixer, w, ch, order, sig, id)) { in setsampleformat()
1026 setsamplerate(struct cmdif *cif, unsigned char *intdec, unsigned int rate) in setsamplerate() argument
1041 SEND_SSRC(cif, *intdec, D, M, N); in setsamplerate()
1042 SEND_RSRC(cif, *intdec, &rptr); in setsamplerate()
1059 getmixer(struct cmdif *cif, short num, unsigned short *rval, in getmixer() argument
1064 if (SEND_RDGV(cif, num, num, &rptr) && SEND_RDGV(cif, num, num, &rptr)) in getmixer()
1075 struct cmdif *cif = chip->cif; in riptide_handleirq() local
1084 if (!cif) in riptide_handleirq()
1121 READ_AUDIO_STATUS(cif->hwport), in riptide_handleirq()
1170 static int try_to_load_firmware(struct cmdif *cif, struct snd_riptide *chip) in try_to_load_firmware() argument
1176 WRITE_PORT_ULONG(cif->hwport->port[i].data1, 0); in try_to_load_firmware()
1177 WRITE_PORT_ULONG(cif->hwport->port[i].data2, 0); in try_to_load_firmware()
1179 SET_GRESET(cif->hwport); in try_to_load_firmware()
1181 UNSET_GRESET(cif->hwport); in try_to_load_firmware()
1185 if (IS_READY(cif->hwport) && !IS_GERR(cif->hwport)) in try_to_load_firmware()
1192 READ_AUDIO_STATUS(cif->hwport), in try_to_load_firmware()
1193 IS_READY(cif->hwport), IS_GERR(cif->hwport)); in try_to_load_firmware()
1198 READ_AUDIO_STATUS(cif->hwport), in try_to_load_firmware()
1199 IS_READY(cif->hwport), IS_GERR(cif->hwport)); in try_to_load_firmware()
1202 SEND_GETV(cif, &firmware.ret); in try_to_load_firmware()
1226 err = loadfirmware(cif, chip->fw_entry->data, chip->fw_entry->size); in try_to_load_firmware()
1238 static int riptide_reset(struct cmdif *cif, struct snd_riptide *chip) in riptide_reset() argument
1243 if (!cif) in riptide_reset()
1246 cif->cmdcnt = 0; in riptide_reset()
1247 cif->cmdtime = 0; in riptide_reset()
1248 cif->cmdtimemax = 0; in riptide_reset()
1249 cif->cmdtimemin = 0xffffffff; in riptide_reset()
1250 cif->errcnt = 0; in riptide_reset()
1251 cif->is_reset = 0; in riptide_reset()
1255 err = try_to_load_firmware(cif, chip); in riptide_reset()
1260 SEND_SACR(cif, 0, AC97_RESET); in riptide_reset()
1261 SEND_RACR(cif, AC97_RESET, &rptr); in riptide_reset()
1264 SEND_PLST(cif, 0); in riptide_reset()
1265 SEND_SLST(cif, 0); in riptide_reset()
1266 SEND_DLST(cif, 0); in riptide_reset()
1267 SEND_ALST(cif, 0); in riptide_reset()
1268 SEND_KDMA(cif); in riptide_reset()
1270 writearm(cif, 0x301F8, 1, 1); in riptide_reset()
1271 writearm(cif, 0x301F4, 1, 1); in riptide_reset()
1273 SEND_LSEL(cif, MODEM_CMD, 0, 0, MODEM_INTDEC, MODEM_MERGER, in riptide_reset()
1275 setmixer(cif, MODEM_MIXER, 0x7fff, 0x7fff); in riptide_reset()
1276 alloclbuspath(cif, ARM2LBUS_FIFO13, lbus_play_modem, NULL, NULL); in riptide_reset()
1278 SEND_LSEL(cif, FM_CMD, 0, 0, FM_INTDEC, FM_MERGER, FM_SPLITTER, in riptide_reset()
1280 setmixer(cif, FM_MIXER, 0x7fff, 0x7fff); in riptide_reset()
1281 writearm(cif, 0x30648 + FM_MIXER * 4, 0x01, 0x00000005); in riptide_reset()
1282 writearm(cif, 0x301A8, 0x02, 0x00000002); in riptide_reset()
1283 writearm(cif, 0x30264, 0x08, 0xffffffff); in riptide_reset()
1284 alloclbuspath(cif, OPL3_SAMPLE, lbus_play_opl3, NULL, NULL); in riptide_reset()
1286 SEND_SSRC(cif, I2S_INTDEC, 48000, in riptide_reset()
1289 SEND_LSEL(cif, I2S_CMD0, 0, 0, I2S_INTDEC, I2S_MERGER, I2S_SPLITTER, in riptide_reset()
1291 SEND_SI2S(cif, 1); in riptide_reset()
1292 alloclbuspath(cif, ARM2LBUS_FIFO0, lbus_play_i2s, NULL, NULL); in riptide_reset()
1293 alloclbuspath(cif, DIGITAL_MIXER_OUT0, lbus_play_out, NULL, NULL); in riptide_reset()
1294 alloclbuspath(cif, DIGITAL_MIXER_OUT0, lbus_play_outhp, NULL, NULL); in riptide_reset()
1296 SET_AIACK(cif->hwport); in riptide_reset()
1297 SET_AIE(cif->hwport); in riptide_reset()
1298 SET_AIACK(cif->hwport); in riptide_reset()
1299 cif->is_reset = 1; in riptide_reset()
1349 struct cmdif *cif = chip->cif; in snd_riptide_pointer() local
1353 SEND_GPOS(cif, 0, data->id, &rptr); in snd_riptide_pointer()
1382 struct cmdif *cif = chip->cif; in snd_riptide_trigger() local
1390 SEND_SSTR(cif, data->id, data->sgdlist.addr); in snd_riptide_trigger()
1391 SET_AIE(cif->hwport); in snd_riptide_trigger()
1394 setmixer(cif, data->mixer, 0x7fff, 0x7fff); in snd_riptide_trigger()
1403 setmixer(cif, data->mixer, 0, 0); in snd_riptide_trigger()
1404 setmixer(cif, data->mixer, 0, 0); in snd_riptide_trigger()
1405 SEND_KSTR(cif, data->id); in snd_riptide_trigger()
1411 SEND_GPOS(cif, 0, data->id, &rptr); in snd_riptide_trigger()
1419 SEND_PSTR(cif, data->id); in snd_riptide_trigger()
1426 SEND_SSTR(cif, data->id, data->sgdlist.addr); in snd_riptide_trigger()
1444 struct cmdif *cif = chip->cif; in snd_riptide_prepare() local
1450 if (snd_BUG_ON(!cif || !data)) in snd_riptide_prepare()
1519 freelbuspath(cif, data->source, data->lbuspath); in snd_riptide_prepare()
1520 alloclbuspath(cif, data->source, lbuspath, in snd_riptide_prepare()
1531 (cif, data->mixer, data->id, channels, format) in snd_riptide_prepare()
1532 || setsamplerate(cif, data->intdec, rate)) in snd_riptide_prepare()
1569 struct cmdif *cif = chip->cif; in snd_riptide_hw_free() local
1571 if (cif && data) { in snd_riptide_hw_free()
1573 freelbuspath(cif, data->source, data->lbuspath); in snd_riptide_hw_free()
1702 struct cmdif *cif = chip->cif; in snd_riptide_interrupt() local
1705 if (cif) { in snd_riptide_interrupt()
1707 if (IS_EOBIRQ(cif->hwport) || IS_EOSIRQ(cif->hwport) || in snd_riptide_interrupt()
1708 IS_EOCIRQ(cif->hwport)) { in snd_riptide_interrupt()
1712 if (chip->rmidi && IS_MPUIRQ(cif->hwport)) { in snd_riptide_interrupt()
1717 SET_AIACK(cif->hwport); in snd_riptide_interrupt()
1727 struct cmdif *cif = chip->cif; in snd_riptide_codec_write() local
1731 if (snd_BUG_ON(!cif)) in snd_riptide_codec_write()
1736 SEND_SACR(cif, val, reg); in snd_riptide_codec_write()
1737 SEND_RACR(cif, reg, &rptr); in snd_riptide_codec_write()
1747 struct cmdif *cif = chip->cif; in snd_riptide_codec_read() local
1750 if (snd_BUG_ON(!cif)) in snd_riptide_codec_read()
1753 if (SEND_RACR(cif, reg, &rptr) != 0) in snd_riptide_codec_read()
1754 SEND_RACR(cif, reg, &rptr); in snd_riptide_codec_read()
1761 struct cmdif *cif; in snd_riptide_initialize() local
1768 cif = chip->cif; in snd_riptide_initialize()
1769 if (!cif) { in snd_riptide_initialize()
1770 if ((cif = kzalloc(sizeof(struct cmdif), GFP_KERNEL)) == NULL) in snd_riptide_initialize()
1772 cif->hwport = (struct riptideport *)chip->port; in snd_riptide_initialize()
1773 spin_lock_init(&cif->lock); in snd_riptide_initialize()
1774 chip->cif = cif; in snd_riptide_initialize()
1776 cif->is_reset = 0; in snd_riptide_initialize()
1777 if ((err = riptide_reset(cif, chip)) != 0) in snd_riptide_initialize()
1785 SEND_SETDPLL(cif); in snd_riptide_initialize()
1790 SET_EMPUIRQ(cif->hwport); in snd_riptide_initialize()
1796 struct cmdif *cif; in snd_riptide_free() local
1801 if ((cif = chip->cif)) { in snd_riptide_free()
1802 SET_GRESET(cif->hwport); in snd_riptide_free()
1804 UNSET_GRESET(cif->hwport); in snd_riptide_free()
1805 kfree(chip->cif); in snd_riptide_free()
1847 chip->cif = NULL; in snd_riptide_create()
1893 struct cmdif *cif = NULL; in snd_riptide_proc_read() local
1907 if ((cif = chip->cif)) { in snd_riptide_proc_read()
1916 getmixer(cif, i, &rval, &lval); in snd_riptide_proc_read()
1921 cif->cmdcnt, cif->errcnt, in snd_riptide_proc_read()
1922 cif->cmdtime, cif->cmdtimemax, cif->cmdtimemin); in snd_riptide_proc_read()
1934 if (!(getsamplerate(cif, data->intdec, &rate))) in snd_riptide_proc_read()
1945 if (!(getsamplerate(cif, data->intdec, &rate))) in snd_riptide_proc_read()
1949 i = getpaths(cif, p); in snd_riptide_proc_read()