Lines Matching refs:cif
434 struct cmdif *cif; member
500 static int sendcmd(struct cmdif *cif, u32 flags, u32 cmd, u32 parm,
502 static int getsourcesink(struct cmdif *cif, unsigned char source,
506 static int riptide_reset(struct cmdif *cif, struct snd_riptide *chip);
684 static int senddata(struct cmdif *cif, const unsigned char *in, u32 offset) in senddata() argument
693 if (SEND_SMEM(cif, 0, addr) != 0) in senddata()
698 if (SEND_WMEM(cif, 2, in senddata()
708 static int loadfirmware(struct cmdif *cif, const unsigned char *img, in loadfirmware() argument
722 err = senddata(cif, in, laddr + saddr); in loadfirmware()
732 if (SEND_GOTO(cif, val) != 0) in loadfirmware()
753 alloclbuspath(struct cmdif *cif, unsigned char source, in alloclbuspath() argument
762 SEND_PSEL(cif, source, sink); in alloclbuspath()
786 alloclbuspath(cif, source + 1, ++npath, mixer, s); in alloclbuspath()
792 freelbuspath(struct cmdif *cif, unsigned char source, unsigned char *path) in freelbuspath() argument
800 SEND_PCLR(cif, source, sink); in freelbuspath()
808 freelbuspath(cif, source + 1, ++npath); in freelbuspath()
813 static int writearm(struct cmdif *cif, u32 addr, u32 data, u32 mask) in writearm() argument
819 SEND_RMEM(cif, 0x02, addr, &rptr); in writearm()
823 SEND_SMEM(cif, 0x01, addr); in writearm()
824 SEND_WMEM(cif, 0x02, (rptr.retlongs[0] | data)); in writearm()
825 SEND_RMEM(cif, 0x02, addr, &rptr); in writearm()
837 static int sendcmd(struct cmdif *cif, u32 flags, u32 cmd, u32 parm, in sendcmd() argument
847 if (snd_BUG_ON(!cif)) in sendcmd()
850 hwport = cif->hwport; in sendcmd()
851 if (cif->errcnt > MAX_ERROR_COUNT) { in sendcmd()
852 if (cif->is_reset) { in sendcmd()
855 if (riptide_reset(cif, NULL) == 0) { in sendcmd()
856 cif->errcnt = 0; in sendcmd()
868 spin_lock_irqsave(&cif->lock, irqflags); in sendcmd()
869 while (i++ < CMDIF_TIMEOUT && !IS_READY(cif->hwport)) in sendcmd()
911 spin_unlock_irqrestore(&cif->lock, irqflags); in sendcmd()
913 cif->cmdcnt++; /* update command statistics */ in sendcmd()
914 cif->cmdtime += time; in sendcmd()
915 if (time > cif->cmdtimemax) in sendcmd()
916 cif->cmdtimemax = time; in sendcmd()
917 if (time < cif->cmdtimemin) in sendcmd()
918 cif->cmdtimemin = time; in sendcmd()
919 if ((cif->cmdcnt) % 1000 == 0) in sendcmd()
922 cif->cmdcnt, cif->cmdtime, cif->cmdtimemin, in sendcmd()
923 cif->cmdtimemax, cif->errcnt); in sendcmd()
927 cif->errcnt++; in sendcmd()
928 spin_unlock_irqrestore(&cif->lock, irqflags); in sendcmd()
931 cif->cmdcnt, (int)((void *)&(cmdport->stat) - (void *)hwport), in sendcmd()
939 setmixer(struct cmdif *cif, short num, unsigned short rval, unsigned short lval) in setmixer() argument
946 SEND_SDGV(cif, num, num, rval, lval); in setmixer()
947 SEND_RDGV(cif, num, num, &rptr); in setmixer()
955 static int getpaths(struct cmdif *cif, unsigned char *o) in getpaths() argument
962 getsourcesink(cif, i, i, &src[i], &sink[i]); in getpaths()
972 getsourcesink(struct cmdif *cif, unsigned char source, unsigned char sink, in getsourcesink() argument
977 if (SEND_RSSV(cif, source, sink, &rptr) && in getsourcesink()
978 SEND_RSSV(cif, source, sink, &rptr)) in getsourcesink()
987 getsamplerate(struct cmdif *cif, unsigned char *intdec, unsigned int *rate) in getsamplerate() argument
997 if (SEND_RSRC(cif, *s, &rptr) && in getsamplerate()
998 SEND_RSRC(cif, *s, &rptr)) in getsamplerate()
1018 setsampleformat(struct cmdif *cif, in setsampleformat() argument
1032 if (SEND_SETF(cif, mixer, w, ch, order, sig, id) && in setsampleformat()
1033 SEND_SETF(cif, mixer, w, ch, order, sig, id)) { in setsampleformat()
1041 setsamplerate(struct cmdif *cif, unsigned char *intdec, unsigned int rate) in setsamplerate() argument
1056 SEND_SSRC(cif, *intdec, D, M, N); in setsamplerate()
1057 SEND_RSRC(cif, *intdec, &rptr); in setsamplerate()
1074 getmixer(struct cmdif *cif, short num, unsigned short *rval, in getmixer() argument
1079 if (SEND_RDGV(cif, num, num, &rptr) && SEND_RDGV(cif, num, num, &rptr)) in getmixer()
1090 struct cmdif *cif = chip->cif; in riptide_handleirq() local
1099 if (!cif) in riptide_handleirq()
1136 READ_AUDIO_STATUS(cif->hwport), in riptide_handleirq()
1184 static int try_to_load_firmware(struct cmdif *cif, struct snd_riptide *chip) in try_to_load_firmware() argument
1190 WRITE_PORT_ULONG(cif->hwport->port[i].data1, 0); in try_to_load_firmware()
1191 WRITE_PORT_ULONG(cif->hwport->port[i].data2, 0); in try_to_load_firmware()
1193 SET_GRESET(cif->hwport); in try_to_load_firmware()
1195 UNSET_GRESET(cif->hwport); in try_to_load_firmware()
1199 if (IS_READY(cif->hwport) && !IS_GERR(cif->hwport)) in try_to_load_firmware()
1206 READ_AUDIO_STATUS(cif->hwport), in try_to_load_firmware()
1207 IS_READY(cif->hwport), IS_GERR(cif->hwport)); in try_to_load_firmware()
1212 READ_AUDIO_STATUS(cif->hwport), in try_to_load_firmware()
1213 IS_READY(cif->hwport), IS_GERR(cif->hwport)); in try_to_load_firmware()
1216 SEND_GETV(cif, &firmware.ret); in try_to_load_firmware()
1240 err = loadfirmware(cif, chip->fw_entry->data, chip->fw_entry->size); in try_to_load_firmware()
1252 static int riptide_reset(struct cmdif *cif, struct snd_riptide *chip) in riptide_reset() argument
1257 if (!cif) in riptide_reset()
1260 cif->cmdcnt = 0; in riptide_reset()
1261 cif->cmdtime = 0; in riptide_reset()
1262 cif->cmdtimemax = 0; in riptide_reset()
1263 cif->cmdtimemin = 0xffffffff; in riptide_reset()
1264 cif->errcnt = 0; in riptide_reset()
1265 cif->is_reset = 0; in riptide_reset()
1269 err = try_to_load_firmware(cif, chip); in riptide_reset()
1274 SEND_SACR(cif, 0, AC97_RESET); in riptide_reset()
1275 SEND_RACR(cif, AC97_RESET, &rptr); in riptide_reset()
1278 SEND_PLST(cif, 0); in riptide_reset()
1279 SEND_SLST(cif, 0); in riptide_reset()
1280 SEND_DLST(cif, 0); in riptide_reset()
1281 SEND_ALST(cif, 0); in riptide_reset()
1282 SEND_KDMA(cif); in riptide_reset()
1284 writearm(cif, 0x301F8, 1, 1); in riptide_reset()
1285 writearm(cif, 0x301F4, 1, 1); in riptide_reset()
1287 SEND_LSEL(cif, MODEM_CMD, 0, 0, MODEM_INTDEC, MODEM_MERGER, in riptide_reset()
1289 setmixer(cif, MODEM_MIXER, 0x7fff, 0x7fff); in riptide_reset()
1290 alloclbuspath(cif, ARM2LBUS_FIFO13, lbus_play_modem, NULL, NULL); in riptide_reset()
1292 SEND_LSEL(cif, FM_CMD, 0, 0, FM_INTDEC, FM_MERGER, FM_SPLITTER, in riptide_reset()
1294 setmixer(cif, FM_MIXER, 0x7fff, 0x7fff); in riptide_reset()
1295 writearm(cif, 0x30648 + FM_MIXER * 4, 0x01, 0x00000005); in riptide_reset()
1296 writearm(cif, 0x301A8, 0x02, 0x00000002); in riptide_reset()
1297 writearm(cif, 0x30264, 0x08, 0xffffffff); in riptide_reset()
1298 alloclbuspath(cif, OPL3_SAMPLE, lbus_play_opl3, NULL, NULL); in riptide_reset()
1300 SEND_SSRC(cif, I2S_INTDEC, 48000, in riptide_reset()
1303 SEND_LSEL(cif, I2S_CMD0, 0, 0, I2S_INTDEC, I2S_MERGER, I2S_SPLITTER, in riptide_reset()
1305 SEND_SI2S(cif, 1); in riptide_reset()
1306 alloclbuspath(cif, ARM2LBUS_FIFO0, lbus_play_i2s, NULL, NULL); in riptide_reset()
1307 alloclbuspath(cif, DIGITAL_MIXER_OUT0, lbus_play_out, NULL, NULL); in riptide_reset()
1308 alloclbuspath(cif, DIGITAL_MIXER_OUT0, lbus_play_outhp, NULL, NULL); in riptide_reset()
1310 SET_AIACK(cif->hwport); in riptide_reset()
1311 SET_AIE(cif->hwport); in riptide_reset()
1312 SET_AIACK(cif->hwport); in riptide_reset()
1313 cif->is_reset = 1; in riptide_reset()
1363 struct cmdif *cif = chip->cif; in snd_riptide_pointer() local
1367 SEND_GPOS(cif, 0, data->id, &rptr); in snd_riptide_pointer()
1396 struct cmdif *cif = chip->cif; in snd_riptide_trigger() local
1404 SEND_SSTR(cif, data->id, data->sgdlist.addr); in snd_riptide_trigger()
1405 SET_AIE(cif->hwport); in snd_riptide_trigger()
1408 setmixer(cif, data->mixer, 0x7fff, 0x7fff); in snd_riptide_trigger()
1417 setmixer(cif, data->mixer, 0, 0); in snd_riptide_trigger()
1418 setmixer(cif, data->mixer, 0, 0); in snd_riptide_trigger()
1419 SEND_KSTR(cif, data->id); in snd_riptide_trigger()
1425 SEND_GPOS(cif, 0, data->id, &rptr); in snd_riptide_trigger()
1433 SEND_PSTR(cif, data->id); in snd_riptide_trigger()
1440 SEND_SSTR(cif, data->id, data->sgdlist.addr); in snd_riptide_trigger()
1458 struct cmdif *cif = chip->cif; in snd_riptide_prepare() local
1464 if (snd_BUG_ON(!cif || !data)) in snd_riptide_prepare()
1533 freelbuspath(cif, data->source, data->lbuspath); in snd_riptide_prepare()
1534 alloclbuspath(cif, data->source, lbuspath, in snd_riptide_prepare()
1545 (cif, data->mixer, data->id, channels, format) in snd_riptide_prepare()
1546 || setsamplerate(cif, data->intdec, rate)) in snd_riptide_prepare()
1584 struct cmdif *cif = chip->cif; in snd_riptide_hw_free() local
1586 if (cif && data) { in snd_riptide_hw_free()
1588 freelbuspath(cif, data->source, data->lbuspath); in snd_riptide_hw_free()
1722 struct cmdif *cif = chip->cif; in snd_riptide_interrupt() local
1724 if (cif) { in snd_riptide_interrupt()
1726 if (IS_EOBIRQ(cif->hwport) || IS_EOSIRQ(cif->hwport) || in snd_riptide_interrupt()
1727 IS_EOCIRQ(cif->hwport)) { in snd_riptide_interrupt()
1731 if (chip->rmidi && IS_MPUIRQ(cif->hwport)) { in snd_riptide_interrupt()
1736 SET_AIACK(cif->hwport); in snd_riptide_interrupt()
1746 struct cmdif *cif = chip->cif; in snd_riptide_codec_write() local
1750 if (snd_BUG_ON(!cif)) in snd_riptide_codec_write()
1755 SEND_SACR(cif, val, reg); in snd_riptide_codec_write()
1756 SEND_RACR(cif, reg, &rptr); in snd_riptide_codec_write()
1766 struct cmdif *cif = chip->cif; in snd_riptide_codec_read() local
1769 if (snd_BUG_ON(!cif)) in snd_riptide_codec_read()
1772 if (SEND_RACR(cif, reg, &rptr) != 0) in snd_riptide_codec_read()
1773 SEND_RACR(cif, reg, &rptr); in snd_riptide_codec_read()
1780 struct cmdif *cif; in snd_riptide_initialize() local
1787 cif = chip->cif; in snd_riptide_initialize()
1788 if (!cif) { in snd_riptide_initialize()
1789 if ((cif = kzalloc(sizeof(struct cmdif), GFP_KERNEL)) == NULL) in snd_riptide_initialize()
1791 cif->hwport = (struct riptideport *)chip->port; in snd_riptide_initialize()
1792 spin_lock_init(&cif->lock); in snd_riptide_initialize()
1793 chip->cif = cif; in snd_riptide_initialize()
1795 cif->is_reset = 0; in snd_riptide_initialize()
1796 if ((err = riptide_reset(cif, chip)) != 0) in snd_riptide_initialize()
1804 SEND_SETDPLL(cif); in snd_riptide_initialize()
1809 SET_EMPUIRQ(cif->hwport); in snd_riptide_initialize()
1815 struct cmdif *cif; in snd_riptide_free() local
1820 if ((cif = chip->cif)) { in snd_riptide_free()
1821 SET_GRESET(cif->hwport); in snd_riptide_free()
1823 UNSET_GRESET(cif->hwport); in snd_riptide_free()
1824 kfree(chip->cif); in snd_riptide_free()
1866 chip->cif = NULL; in snd_riptide_create()
1911 struct cmdif *cif = NULL; in snd_riptide_proc_read() local
1925 if ((cif = chip->cif)) { in snd_riptide_proc_read()
1934 getmixer(cif, i, &rval, &lval); in snd_riptide_proc_read()
1939 cif->cmdcnt, cif->errcnt, in snd_riptide_proc_read()
1940 cif->cmdtime, cif->cmdtimemax, cif->cmdtimemin); in snd_riptide_proc_read()
1952 if (!(getsamplerate(cif, data->intdec, &rate))) in snd_riptide_proc_read()
1963 if (!(getsamplerate(cif, data->intdec, &rate))) in snd_riptide_proc_read()
1967 i = getpaths(cif, p); in snd_riptide_proc_read()