Lines Matching defs:cif
433 struct cmdif *cif;
499 static int sendcmd(struct cmdif *cif, u32 flags, u32 cmd, u32 parm,
501 static int getsourcesink(struct cmdif *cif, unsigned char source,
505 static int riptide_reset(struct cmdif *cif, struct snd_riptide *chip);
683 static int senddata(struct cmdif *cif, const unsigned char *in, u32 offset)
692 if (SEND_SMEM(cif, 0, addr) != 0)
697 if (SEND_WMEM(cif, 2,
707 static int loadfirmware(struct cmdif *cif, const unsigned char *img,
721 err = senddata(cif, in, laddr + saddr);
731 if (SEND_GOTO(cif, val) != 0)
752 alloclbuspath(struct cmdif *cif, unsigned char source,
761 SEND_PSEL(cif, source, sink);
785 alloclbuspath(cif, source + 1, ++npath, mixer, s);
791 freelbuspath(struct cmdif *cif, unsigned char source, unsigned char *path)
799 SEND_PCLR(cif, source, sink);
807 freelbuspath(cif, source + 1, ++npath);
812 static int writearm(struct cmdif *cif, u32 addr, u32 data, u32 mask)
818 SEND_RMEM(cif, 0x02, addr, &rptr);
822 SEND_SMEM(cif, 0x01, addr);
823 SEND_WMEM(cif, 0x02, (rptr.retlongs[0] | data));
824 SEND_RMEM(cif, 0x02, addr, &rptr);
836 static int sendcmd(struct cmdif *cif, u32 flags, u32 cmd, u32 parm,
846 if (snd_BUG_ON(!cif))
849 hwport = cif->hwport;
850 if (cif->errcnt > MAX_ERROR_COUNT) {
851 if (cif->is_reset) {
854 if (riptide_reset(cif, NULL) == 0) {
855 cif->errcnt = 0;
867 spin_lock_irqsave(&cif->lock, irqflags);
868 while (i++ < CMDIF_TIMEOUT && !IS_READY(cif->hwport))
910 spin_unlock_irqrestore(&cif->lock, irqflags);
912 cif->cmdcnt++; /* update command statistics */
913 cif->cmdtime += time;
914 if (time > cif->cmdtimemax)
915 cif->cmdtimemax = time;
916 if (time < cif->cmdtimemin)
917 cif->cmdtimemin = time;
918 if ((cif->cmdcnt) % 1000 == 0)
921 cif->cmdcnt, cif->cmdtime, cif->cmdtimemin,
922 cif->cmdtimemax, cif->errcnt);
926 cif->errcnt++;
927 spin_unlock_irqrestore(&cif->lock, irqflags);
930 cif->cmdcnt, (int)((void *)&(cmdport->stat) - (void *)hwport),
938 setmixer(struct cmdif *cif, short num, unsigned short rval, unsigned short lval)
945 SEND_SDGV(cif, num, num, rval, lval);
946 SEND_RDGV(cif, num, num, &rptr);
954 static int getpaths(struct cmdif *cif, unsigned char *o)
961 getsourcesink(cif, i, i, &src[i], &sink[i]);
971 getsourcesink(struct cmdif *cif, unsigned char source, unsigned char sink,
976 if (SEND_RSSV(cif, source, sink, &rptr) &&
977 SEND_RSSV(cif, source, sink, &rptr))
986 getsamplerate(struct cmdif *cif, unsigned char *intdec, unsigned int *rate)
996 if (SEND_RSRC(cif, *s, &rptr) &&
997 SEND_RSRC(cif, *s, &rptr))
1017 setsampleformat(struct cmdif *cif,
1031 if (SEND_SETF(cif, mixer, w, ch, order, sig, id) &&
1032 SEND_SETF(cif, mixer, w, ch, order, sig, id)) {
1040 setsamplerate(struct cmdif *cif, unsigned char *intdec, unsigned int rate)
1055 SEND_SSRC(cif, *intdec, D, M, N);
1056 SEND_RSRC(cif, *intdec, &rptr);
1073 getmixer(struct cmdif *cif, short num, unsigned short *rval,
1078 if (SEND_RDGV(cif, num, num, &rptr) && SEND_RDGV(cif, num, num, &rptr))
1089 struct cmdif *cif = chip->cif;
1098 if (!cif)
1135 READ_AUDIO_STATUS(cif->hwport),
1190 static int try_to_load_firmware(struct cmdif *cif, struct snd_riptide *chip)
1196 WRITE_PORT_ULONG(cif->hwport->port[i].data1, 0);
1197 WRITE_PORT_ULONG(cif->hwport->port[i].data2, 0);
1199 SET_GRESET(cif->hwport);
1201 UNSET_GRESET(cif->hwport);
1205 if (IS_READY(cif->hwport) && !IS_GERR(cif->hwport))
1212 READ_AUDIO_STATUS(cif->hwport),
1213 IS_READY(cif->hwport), IS_GERR(cif->hwport));
1218 READ_AUDIO_STATUS(cif->hwport),
1219 IS_READY(cif->hwport), IS_GERR(cif->hwport));
1222 SEND_GETV(cif, &firmware.ret);
1246 err = loadfirmware(cif, chip->fw_entry->data, chip->fw_entry->size);
1258 static int riptide_reset(struct cmdif *cif, struct snd_riptide *chip)
1263 if (!cif)
1266 cif->cmdcnt = 0;
1267 cif->cmdtime = 0;
1268 cif->cmdtimemax = 0;
1269 cif->cmdtimemin = 0xffffffff;
1270 cif->errcnt = 0;
1271 cif->is_reset = 0;
1275 err = try_to_load_firmware(cif, chip);
1280 SEND_SACR(cif, 0, AC97_RESET);
1281 SEND_RACR(cif, AC97_RESET, &rptr);
1284 SEND_PLST(cif, 0);
1285 SEND_SLST(cif, 0);
1286 SEND_DLST(cif, 0);
1287 SEND_ALST(cif, 0);
1288 SEND_KDMA(cif);
1290 writearm(cif, 0x301F8, 1, 1);
1291 writearm(cif, 0x301F4, 1, 1);
1293 SEND_LSEL(cif, MODEM_CMD, 0, 0, MODEM_INTDEC, MODEM_MERGER,
1295 setmixer(cif, MODEM_MIXER, 0x7fff, 0x7fff);
1296 alloclbuspath(cif, ARM2LBUS_FIFO13, lbus_play_modem, NULL, NULL);
1298 SEND_LSEL(cif, FM_CMD, 0, 0, FM_INTDEC, FM_MERGER, FM_SPLITTER,
1300 setmixer(cif, FM_MIXER, 0x7fff, 0x7fff);
1301 writearm(cif, 0x30648 + FM_MIXER * 4, 0x01, 0x00000005);
1302 writearm(cif, 0x301A8, 0x02, 0x00000002);
1303 writearm(cif, 0x30264, 0x08, 0xffffffff);
1304 alloclbuspath(cif, OPL3_SAMPLE, lbus_play_opl3, NULL, NULL);
1306 SEND_SSRC(cif, I2S_INTDEC, 48000,
1309 SEND_LSEL(cif, I2S_CMD0, 0, 0, I2S_INTDEC, I2S_MERGER, I2S_SPLITTER,
1311 SEND_SI2S(cif, 1);
1312 alloclbuspath(cif, ARM2LBUS_FIFO0, lbus_play_i2s, NULL, NULL);
1313 alloclbuspath(cif, DIGITAL_MIXER_OUT0, lbus_play_out, NULL, NULL);
1314 alloclbuspath(cif, DIGITAL_MIXER_OUT0, lbus_play_outhp, NULL, NULL);
1316 SET_AIACK(cif->hwport);
1317 SET_AIE(cif->hwport);
1318 SET_AIACK(cif->hwport);
1319 cif->is_reset = 1;
1369 struct cmdif *cif = chip->cif;
1373 SEND_GPOS(cif, 0, data->id, &rptr);
1402 struct cmdif *cif = chip->cif;
1410 SEND_SSTR(cif, data->id, data->sgdlist.addr);
1411 SET_AIE(cif->hwport);
1414 setmixer(cif, data->mixer, 0x7fff, 0x7fff);
1423 setmixer(cif, data->mixer, 0, 0);
1424 setmixer(cif, data->mixer, 0, 0);
1425 SEND_KSTR(cif, data->id);
1431 SEND_GPOS(cif, 0, data->id, &rptr);
1439 SEND_PSTR(cif, data->id);
1446 SEND_SSTR(cif, data->id, data->sgdlist.addr);
1464 struct cmdif *cif = chip->cif;
1470 if (snd_BUG_ON(!cif || !data))
1539 freelbuspath(cif, data->source, data->lbuspath);
1540 alloclbuspath(cif, data->source, lbuspath,
1551 (cif, data->mixer, data->id, channels, format)
1552 || setsamplerate(cif, data->intdec, rate))
1590 struct cmdif *cif = chip->cif;
1592 if (cif && data) {
1594 freelbuspath(cif, data->source, data->lbuspath);
1733 struct cmdif *cif = chip->cif;
1735 if (cif) {
1737 if (IS_EOBIRQ(cif->hwport) || IS_EOSIRQ(cif->hwport) ||
1738 IS_EOCIRQ(cif->hwport)) {
1742 if (chip->rmidi && IS_MPUIRQ(cif->hwport)) {
1747 SET_AIACK(cif->hwport);
1757 struct cmdif *cif = chip->cif;
1761 if (snd_BUG_ON(!cif))
1766 SEND_SACR(cif, val, reg);
1767 SEND_RACR(cif, reg, &rptr);
1777 struct cmdif *cif = chip->cif;
1780 if (snd_BUG_ON(!cif))
1783 if (SEND_RACR(cif, reg, &rptr) != 0)
1784 SEND_RACR(cif, reg, &rptr);
1791 struct cmdif *cif;
1798 cif = chip->cif;
1799 if (!cif) {
1800 if ((cif = kzalloc(sizeof(struct cmdif), GFP_KERNEL)) == NULL)
1802 cif->hwport = (struct riptideport *)chip->port;
1803 spin_lock_init(&cif->lock);
1804 chip->cif = cif;
1806 cif->is_reset = 0;
1807 if ((err = riptide_reset(cif, chip)) != 0)
1815 SEND_SETDPLL(cif);
1820 SET_EMPUIRQ(cif->hwport);
1826 struct cmdif *cif;
1831 if ((cif = chip->cif)) {
1832 SET_GRESET(cif->hwport);
1834 UNSET_GRESET(cif->hwport);
1835 kfree(chip->cif);
1878 chip->cif = NULL;
1925 struct cmdif *cif = NULL;
1939 if ((cif = chip->cif)) {
1948 getmixer(cif, i, &rval, &lval);
1953 cif->cmdcnt, cif->errcnt,
1954 cif->cmdtime, cif->cmdtimemax, cif->cmdtimemin);
1966 if (!(getsamplerate(cif, data->intdec, &rate)))
1977 if (!(getsamplerate(cif, data->intdec, &rate)))
1981 i = getpaths(cif, p);