Lines Matching full:cif
420 struct cmdif *cif; member
483 static int sendcmd(struct cmdif *cif, u32 flags, u32 cmd, u32 parm,
485 static int getsourcesink(struct cmdif *cif, unsigned char source,
489 static int riptide_reset(struct cmdif *cif, struct snd_riptide *chip);
667 static int senddata(struct cmdif *cif, const unsigned char *in, u32 offset) in senddata() argument
676 if (SEND_SMEM(cif, 0, addr) != 0) in senddata()
681 if (SEND_WMEM(cif, 2, in senddata()
691 static int loadfirmware(struct cmdif *cif, const unsigned char *img, in loadfirmware() argument
705 err = senddata(cif, in, laddr + saddr); in loadfirmware()
715 if (SEND_GOTO(cif, val) != 0) in loadfirmware()
731 dev_dbg(cif->dev, "load firmware return %d\n", err); in loadfirmware()
736 alloclbuspath(struct cmdif *cif, unsigned char source, in alloclbuspath() argument
744 dev_dbg(cif->dev, "alloc path 0x%x->0x%x\n", source, sink); in alloclbuspath()
745 SEND_PSEL(cif, source, sink); in alloclbuspath()
769 alloclbuspath(cif, source + 1, ++npath, mixer, s); in alloclbuspath()
775 freelbuspath(struct cmdif *cif, unsigned char source, const unsigned char *path) in freelbuspath() argument
782 dev_dbg(cif->dev, "free path 0x%x->0x%x\n", source, sink); in freelbuspath()
783 SEND_PCLR(cif, source, sink); in freelbuspath()
791 freelbuspath(cif, source + 1, ++npath); in freelbuspath()
796 static int writearm(struct cmdif *cif, u32 addr, u32 data, u32 mask) in writearm() argument
802 SEND_RMEM(cif, 0x02, addr, &rptr); in writearm()
806 SEND_SMEM(cif, 0x01, addr); in writearm()
807 SEND_WMEM(cif, 0x02, (rptr.retlongs[0] | data)); in writearm()
808 SEND_RMEM(cif, 0x02, addr, &rptr); in writearm()
815 dev_dbg(cif->dev, "send arm 0x%x 0x%x 0x%x return %d\n", addr, data, mask, in writearm()
820 static int sendcmd(struct cmdif *cif, u32 flags, u32 cmd, u32 parm, in sendcmd() argument
830 if (snd_BUG_ON(!cif)) in sendcmd()
833 hwport = cif->hwport; in sendcmd()
834 if (cif->errcnt > MAX_ERROR_COUNT) { in sendcmd()
835 if (cif->is_reset) { in sendcmd()
836 dev_err(cif->dev, in sendcmd()
838 if (riptide_reset(cif, NULL) == 0) { in sendcmd()
839 cif->errcnt = 0; in sendcmd()
843 dev_err(cif->dev, "Riptide: Initialization failed.\n"); in sendcmd()
851 spin_lock_irqsave(&cif->lock, irqflags); in sendcmd()
852 while (i++ < CMDIF_TIMEOUT && !IS_READY(cif->hwport)) in sendcmd()
894 spin_unlock_irqrestore(&cif->lock, irqflags); in sendcmd()
896 cif->cmdcnt++; /* update command statistics */ in sendcmd()
897 cif->cmdtime += time; in sendcmd()
898 if (time > cif->cmdtimemax) in sendcmd()
899 cif->cmdtimemax = time; in sendcmd()
900 if (time < cif->cmdtimemin) in sendcmd()
901 cif->cmdtimemin = time; in sendcmd()
902 if ((cif->cmdcnt) % 1000 == 0) in sendcmd()
903 dev_dbg(cif->dev, in sendcmd()
905 cif->cmdcnt, cif->cmdtime, cif->cmdtimemin, in sendcmd()
906 cif->cmdtimemax, cif->errcnt); in sendcmd()
910 cif->errcnt++; in sendcmd()
911 spin_unlock_irqrestore(&cif->lock, irqflags); in sendcmd()
912 dev_dbg(cif->dev, in sendcmd()
914 cif->cmdcnt, (int)((void *)&(cmdport->stat) - (void *)hwport), in sendcmd()
922 setmixer(struct cmdif *cif, short num, unsigned short rval, unsigned short lval) in setmixer() argument
927 dev_dbg(cif->dev, "sent mixer %d: 0x%x 0x%x\n", num, rval, lval); in setmixer()
929 SEND_SDGV(cif, num, num, rval, lval); in setmixer()
930 SEND_RDGV(cif, num, num, &rptr); in setmixer()
934 dev_dbg(cif->dev, "sent mixer failed\n"); in setmixer()
938 static int getpaths(struct cmdif *cif, unsigned char *o) in getpaths() argument
945 getsourcesink(cif, i, i, &src[i], &sink[i]); in getpaths()
955 getsourcesink(struct cmdif *cif, unsigned char source, unsigned char sink, in getsourcesink() argument
960 if (SEND_RSSV(cif, source, sink, &rptr) && in getsourcesink()
961 SEND_RSSV(cif, source, sink, &rptr)) in getsourcesink()
965 dev_dbg(cif->dev, "%s 0x%x 0x%x\n", __func__, *a, *b); in getsourcesink()
970 getsamplerate(struct cmdif *cif, unsigned char *intdec, unsigned int *rate) in getsamplerate() argument
980 if (SEND_RSRC(cif, *s, &rptr) && in getsamplerate()
981 SEND_RSRC(cif, *s, &rptr)) in getsamplerate()
992 dev_dbg(cif->dev, "rates differ %d %d\n", p[0], p[1]); in getsamplerate()
996 dev_dbg(cif->dev, "getsampleformat %d %d %d\n", intdec[0], intdec[1], *rate); in getsamplerate()
1001 setsampleformat(struct cmdif *cif, in setsampleformat() argument
1007 dev_dbg(cif->dev, in setsampleformat()
1015 if (SEND_SETF(cif, mixer, w, ch, order, sig, id) && in setsampleformat()
1016 SEND_SETF(cif, mixer, w, ch, order, sig, id)) { in setsampleformat()
1017 dev_dbg(cif->dev, "%s failed\n", __func__); in setsampleformat()
1024 setsamplerate(struct cmdif *cif, unsigned char *intdec, unsigned int rate) in setsamplerate() argument
1030 dev_dbg(cif->dev, "%s intdec: %d,%d rate: %d\n", __func__, in setsamplerate()
1039 SEND_SSRC(cif, *intdec, D, M, N); in setsamplerate()
1040 SEND_RSRC(cif, *intdec, &rptr); in setsamplerate()
1046 dev_dbg(cif->dev, "sent samplerate %d: %d failed\n", in setsamplerate()
1057 getmixer(struct cmdif *cif, short num, unsigned short *rval, in getmixer() argument
1062 if (SEND_RDGV(cif, num, num, &rptr) && SEND_RDGV(cif, num, num, &rptr)) in getmixer()
1066 dev_dbg(cif->dev, "got mixer %d: 0x%x 0x%x\n", num, *rval, *lval); in getmixer()
1073 struct cmdif *cif = chip->cif; in riptide_handleirq() local
1082 if (!cif) in riptide_handleirq()
1109 dev_err(cif->dev, in riptide_handleirq()
1123 dev_dbg(cif->dev, in riptide_handleirq()
1125 READ_AUDIO_STATUS(cif->hwport), in riptide_handleirq()
1169 static int try_to_load_firmware(struct cmdif *cif, struct snd_riptide *chip) in try_to_load_firmware() argument
1175 WRITE_PORT_ULONG(cif->hwport->port[i].data1, 0); in try_to_load_firmware()
1176 WRITE_PORT_ULONG(cif->hwport->port[i].data2, 0); in try_to_load_firmware()
1178 SET_GRESET(cif->hwport); in try_to_load_firmware()
1180 UNSET_GRESET(cif->hwport); in try_to_load_firmware()
1184 if (IS_READY(cif->hwport) && !IS_GERR(cif->hwport)) in try_to_load_firmware()
1188 dev_err(cif->dev, in try_to_load_firmware()
1190 READ_AUDIO_STATUS(cif->hwport), in try_to_load_firmware()
1191 IS_READY(cif->hwport), IS_GERR(cif->hwport)); in try_to_load_firmware()
1194 dev_dbg(cif->dev, in try_to_load_firmware()
1196 READ_AUDIO_STATUS(cif->hwport), in try_to_load_firmware()
1197 IS_READY(cif->hwport), IS_GERR(cif->hwport)); in try_to_load_firmware()
1200 SEND_GETV(cif, &firmware.ret); in try_to_load_firmware()
1201 dev_dbg(cif->dev, in try_to_load_firmware()
1215 dev_dbg(cif->dev, "Writing Firmware\n"); in try_to_load_firmware()
1220 dev_err(cif->dev, in try_to_load_firmware()
1225 err = loadfirmware(cif, chip->fw_entry->data, chip->fw_entry->size); in try_to_load_firmware()
1227 dev_err(cif->dev, in try_to_load_firmware()
1237 static int riptide_reset(struct cmdif *cif, struct snd_riptide *chip) in riptide_reset() argument
1242 if (!cif) in riptide_reset()
1245 cif->cmdcnt = 0; in riptide_reset()
1246 cif->cmdtime = 0; in riptide_reset()
1247 cif->cmdtimemax = 0; in riptide_reset()
1248 cif->cmdtimemin = 0xffffffff; in riptide_reset()
1249 cif->errcnt = 0; in riptide_reset()
1250 cif->is_reset = 0; in riptide_reset()
1254 err = try_to_load_firmware(cif, chip); in riptide_reset()
1259 SEND_SACR(cif, 0, AC97_RESET); in riptide_reset()
1260 SEND_RACR(cif, AC97_RESET, &rptr); in riptide_reset()
1261 dev_dbg(cif->dev, "AC97: 0x%x 0x%x\n", rptr.retlongs[0], rptr.retlongs[1]); in riptide_reset()
1263 SEND_PLST(cif, 0); in riptide_reset()
1264 SEND_SLST(cif, 0); in riptide_reset()
1265 SEND_DLST(cif, 0); in riptide_reset()
1266 SEND_ALST(cif, 0); in riptide_reset()
1267 SEND_KDMA(cif); in riptide_reset()
1269 writearm(cif, 0x301F8, 1, 1); in riptide_reset()
1270 writearm(cif, 0x301F4, 1, 1); in riptide_reset()
1272 SEND_LSEL(cif, MODEM_CMD, 0, 0, MODEM_INTDEC, MODEM_MERGER, in riptide_reset()
1274 setmixer(cif, MODEM_MIXER, 0x7fff, 0x7fff); in riptide_reset()
1275 alloclbuspath(cif, ARM2LBUS_FIFO13, lbus_play_modem, NULL, NULL); in riptide_reset()
1277 SEND_LSEL(cif, FM_CMD, 0, 0, FM_INTDEC, FM_MERGER, FM_SPLITTER, in riptide_reset()
1279 setmixer(cif, FM_MIXER, 0x7fff, 0x7fff); in riptide_reset()
1280 writearm(cif, 0x30648 + FM_MIXER * 4, 0x01, 0x00000005); in riptide_reset()
1281 writearm(cif, 0x301A8, 0x02, 0x00000002); in riptide_reset()
1282 writearm(cif, 0x30264, 0x08, 0xffffffff); in riptide_reset()
1283 alloclbuspath(cif, OPL3_SAMPLE, lbus_play_opl3, NULL, NULL); in riptide_reset()
1285 SEND_SSRC(cif, I2S_INTDEC, 48000, in riptide_reset()
1288 SEND_LSEL(cif, I2S_CMD0, 0, 0, I2S_INTDEC, I2S_MERGER, I2S_SPLITTER, in riptide_reset()
1290 SEND_SI2S(cif, 1); in riptide_reset()
1291 alloclbuspath(cif, ARM2LBUS_FIFO0, lbus_play_i2s, NULL, NULL); in riptide_reset()
1292 alloclbuspath(cif, DIGITAL_MIXER_OUT0, lbus_play_out, NULL, NULL); in riptide_reset()
1293 alloclbuspath(cif, DIGITAL_MIXER_OUT0, lbus_play_outhp, NULL, NULL); in riptide_reset()
1295 SET_AIACK(cif->hwport); in riptide_reset()
1296 SET_AIE(cif->hwport); in riptide_reset()
1297 SET_AIACK(cif->hwport); in riptide_reset()
1298 cif->is_reset = 1; in riptide_reset()
1348 struct cmdif *cif = chip->cif; in snd_riptide_pointer() local
1352 SEND_GPOS(cif, 0, data->id, &rptr); in snd_riptide_pointer()
1354 dev_dbg(cif->dev, in snd_riptide_pointer()
1369 dev_dbg(cif->dev, 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()
1415 dev_err(cif->dev, "Riptide: Could not stop stream!"); 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()
1453 dev_dbg(cif->dev, "prepare id %d ch: %d f:0x%x r:%d\n", data->id, in snd_riptide_prepare()
1474 dev_dbg(cif->dev, "use sgdlist at 0x%p\n", data->sgdlist.area); in snd_riptide_prepare()
1487 dev_dbg(cif->dev, in snd_riptide_prepare()
1518 freelbuspath(cif, data->source, data->lbuspath); in snd_riptide_prepare()
1519 alloclbuspath(cif, data->source, lbuspath, in snd_riptide_prepare()
1530 (cif, data->mixer, data->id, channels, format) in snd_riptide_prepare()
1531 || 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()
1734 dev_dbg(cif->dev, "Write AC97 reg 0x%x 0x%x\n", reg, val); 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()
1740 dev_dbg(cif->dev, "Write AC97 reg failed\n"); 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()
1755 dev_dbg(cif->dev, "Read AC97 reg 0x%x got 0x%x\n", reg, rptr.retwords[1]); 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 cif = kzalloc(sizeof(struct cmdif), GFP_KERNEL); in snd_riptide_initialize()
1771 if (!cif) in snd_riptide_initialize()
1773 cif->dev = chip->card->dev; in snd_riptide_initialize()
1774 cif->hwport = (struct riptideport *)chip->port; in snd_riptide_initialize()
1775 spin_lock_init(&cif->lock); in snd_riptide_initialize()
1776 chip->cif = cif; in snd_riptide_initialize()
1778 cif->is_reset = 0; in snd_riptide_initialize()
1779 err = riptide_reset(cif, chip); in snd_riptide_initialize()
1787 dev_dbg(cif->dev, "Modem enable?\n"); in snd_riptide_initialize()
1788 SEND_SETDPLL(cif); in snd_riptide_initialize()
1791 dev_dbg(cif->dev, "Enabling MPU IRQs\n"); in snd_riptide_initialize()
1793 SET_EMPUIRQ(cif->hwport); in snd_riptide_initialize()
1800 struct cmdif *cif; in snd_riptide_free() local
1802 cif = chip->cif; in snd_riptide_free()
1803 if (cif) { in snd_riptide_free()
1804 SET_GRESET(cif->hwport); in snd_riptide_free()
1806 UNSET_GRESET(cif->hwport); in snd_riptide_free()
1807 kfree(chip->cif); in snd_riptide_free()
1831 chip->cif = NULL; in snd_riptide_create()
1866 struct cmdif *cif = NULL; in snd_riptide_proc_read() local
1880 cif = chip->cif; in snd_riptide_proc_read()
1881 if (cif) { in snd_riptide_proc_read()
1890 getmixer(cif, i, &rval, &lval); in snd_riptide_proc_read()
1895 cif->cmdcnt, cif->errcnt, in snd_riptide_proc_read()
1896 cif->cmdtime, cif->cmdtimemax, cif->cmdtimemin); in snd_riptide_proc_read()
1909 if (!(getsamplerate(cif, data->intdec, &rate))) in snd_riptide_proc_read()
1920 if (!(getsamplerate(cif, data->intdec, &rate))) in snd_riptide_proc_read()
1925 i = getpaths(cif, p); in snd_riptide_proc_read()