Lines Matching defs:cif

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