Lines Matching defs:cif

419 	struct cmdif *cif;
484 static int sendcmd(struct cmdif *cif, u32 flags, u32 cmd, u32 parm,
486 static int getsourcesink(struct cmdif *cif, unsigned char source,
490 static int riptide_reset(struct cmdif *cif, struct snd_riptide *chip);
668 static int senddata(struct cmdif *cif, const unsigned char *in, u32 offset)
677 if (SEND_SMEM(cif, 0, addr) != 0)
682 if (SEND_WMEM(cif, 2,
692 static int loadfirmware(struct cmdif *cif, const unsigned char *img,
706 err = senddata(cif, in, laddr + saddr);
716 if (SEND_GOTO(cif, val) != 0)
737 alloclbuspath(struct cmdif *cif, unsigned char source,
746 SEND_PSEL(cif, source, sink);
770 alloclbuspath(cif, source + 1, ++npath, mixer, s);
776 freelbuspath(struct cmdif *cif, unsigned char source, const unsigned char *path)
784 SEND_PCLR(cif, source, sink);
792 freelbuspath(cif, source + 1, ++npath);
797 static int writearm(struct cmdif *cif, u32 addr, u32 data, u32 mask)
803 SEND_RMEM(cif, 0x02, addr, &rptr);
807 SEND_SMEM(cif, 0x01, addr);
808 SEND_WMEM(cif, 0x02, (rptr.retlongs[0] | data));
809 SEND_RMEM(cif, 0x02, addr, &rptr);
821 static int sendcmd(struct cmdif *cif, u32 flags, u32 cmd, u32 parm,
831 if (snd_BUG_ON(!cif))
834 hwport = cif->hwport;
835 if (cif->errcnt > MAX_ERROR_COUNT) {
836 if (cif->is_reset) {
839 if (riptide_reset(cif, NULL) == 0) {
840 cif->errcnt = 0;
852 spin_lock_irqsave(&cif->lock, irqflags);
853 while (i++ < CMDIF_TIMEOUT && !IS_READY(cif->hwport))
895 spin_unlock_irqrestore(&cif->lock, irqflags);
897 cif->cmdcnt++; /* update command statistics */
898 cif->cmdtime += time;
899 if (time > cif->cmdtimemax)
900 cif->cmdtimemax = time;
901 if (time < cif->cmdtimemin)
902 cif->cmdtimemin = time;
903 if ((cif->cmdcnt) % 1000 == 0)
906 cif->cmdcnt, cif->cmdtime, cif->cmdtimemin,
907 cif->cmdtimemax, cif->errcnt);
911 cif->errcnt++;
912 spin_unlock_irqrestore(&cif->lock, irqflags);
915 cif->cmdcnt, (int)((void *)&(cmdport->stat) - (void *)hwport),
923 setmixer(struct cmdif *cif, short num, unsigned short rval, unsigned short lval)
930 SEND_SDGV(cif, num, num, rval, lval);
931 SEND_RDGV(cif, num, num, &rptr);
939 static int getpaths(struct cmdif *cif, unsigned char *o)
946 getsourcesink(cif, i, i, &src[i], &sink[i]);
956 getsourcesink(struct cmdif *cif, unsigned char source, unsigned char sink,
961 if (SEND_RSSV(cif, source, sink, &rptr) &&
962 SEND_RSSV(cif, source, sink, &rptr))
971 getsamplerate(struct cmdif *cif, unsigned char *intdec, unsigned int *rate)
981 if (SEND_RSRC(cif, *s, &rptr) &&
982 SEND_RSRC(cif, *s, &rptr))
1002 setsampleformat(struct cmdif *cif,
1016 if (SEND_SETF(cif, mixer, w, ch, order, sig, id) &&
1017 SEND_SETF(cif, mixer, w, ch, order, sig, id)) {
1025 setsamplerate(struct cmdif *cif, unsigned char *intdec, unsigned int rate)
1040 SEND_SSRC(cif, *intdec, D, M, N);
1041 SEND_RSRC(cif, *intdec, &rptr);
1058 getmixer(struct cmdif *cif, short num, unsigned short *rval,
1063 if (SEND_RDGV(cif, num, num, &rptr) && SEND_RDGV(cif, num, num, &rptr))
1074 struct cmdif *cif = chip->cif;
1083 if (!cif)
1126 READ_AUDIO_STATUS(cif->hwport),
1175 static int try_to_load_firmware(struct cmdif *cif, struct snd_riptide *chip)
1181 WRITE_PORT_ULONG(cif->hwport->port[i].data1, 0);
1182 WRITE_PORT_ULONG(cif->hwport->port[i].data2, 0);
1184 SET_GRESET(cif->hwport);
1186 UNSET_GRESET(cif->hwport);
1190 if (IS_READY(cif->hwport) && !IS_GERR(cif->hwport))
1197 READ_AUDIO_STATUS(cif->hwport),
1198 IS_READY(cif->hwport), IS_GERR(cif->hwport));
1203 READ_AUDIO_STATUS(cif->hwport),
1204 IS_READY(cif->hwport), IS_GERR(cif->hwport));
1207 SEND_GETV(cif, &firmware.ret);
1231 err = loadfirmware(cif, chip->fw_entry->data, chip->fw_entry->size);
1243 static int riptide_reset(struct cmdif *cif, struct snd_riptide *chip)
1248 if (!cif)
1251 cif->cmdcnt = 0;
1252 cif->cmdtime = 0;
1253 cif->cmdtimemax = 0;
1254 cif->cmdtimemin = 0xffffffff;
1255 cif->errcnt = 0;
1256 cif->is_reset = 0;
1260 err = try_to_load_firmware(cif, chip);
1265 SEND_SACR(cif, 0, AC97_RESET);
1266 SEND_RACR(cif, AC97_RESET, &rptr);
1269 SEND_PLST(cif, 0);
1270 SEND_SLST(cif, 0);
1271 SEND_DLST(cif, 0);
1272 SEND_ALST(cif, 0);
1273 SEND_KDMA(cif);
1275 writearm(cif, 0x301F8, 1, 1);
1276 writearm(cif, 0x301F4, 1, 1);
1278 SEND_LSEL(cif, MODEM_CMD, 0, 0, MODEM_INTDEC, MODEM_MERGER,
1280 setmixer(cif, MODEM_MIXER, 0x7fff, 0x7fff);
1281 alloclbuspath(cif, ARM2LBUS_FIFO13, lbus_play_modem, NULL, NULL);
1283 SEND_LSEL(cif, FM_CMD, 0, 0, FM_INTDEC, FM_MERGER, FM_SPLITTER,
1285 setmixer(cif, FM_MIXER, 0x7fff, 0x7fff);
1286 writearm(cif, 0x30648 + FM_MIXER * 4, 0x01, 0x00000005);
1287 writearm(cif, 0x301A8, 0x02, 0x00000002);
1288 writearm(cif, 0x30264, 0x08, 0xffffffff);
1289 alloclbuspath(cif, OPL3_SAMPLE, lbus_play_opl3, NULL, NULL);
1291 SEND_SSRC(cif, I2S_INTDEC, 48000,
1294 SEND_LSEL(cif, I2S_CMD0, 0, 0, I2S_INTDEC, I2S_MERGER, I2S_SPLITTER,
1296 SEND_SI2S(cif, 1);
1297 alloclbuspath(cif, ARM2LBUS_FIFO0, lbus_play_i2s, NULL, NULL);
1298 alloclbuspath(cif, DIGITAL_MIXER_OUT0, lbus_play_out, NULL, NULL);
1299 alloclbuspath(cif, DIGITAL_MIXER_OUT0, lbus_play_outhp, NULL, NULL);
1301 SET_AIACK(cif->hwport);
1302 SET_AIE(cif->hwport);
1303 SET_AIACK(cif->hwport);
1304 cif->is_reset = 1;
1354 struct cmdif *cif = chip->cif;
1358 SEND_GPOS(cif, 0, data->id, &rptr);
1387 struct cmdif *cif = chip->cif;
1395 SEND_SSTR(cif, data->id, data->sgdlist.addr);
1396 SET_AIE(cif->hwport);
1399 setmixer(cif, data->mixer, 0x7fff, 0x7fff);
1408 setmixer(cif, data->mixer, 0, 0);
1409 setmixer(cif, data->mixer, 0, 0);
1410 SEND_KSTR(cif, data->id);
1416 SEND_GPOS(cif, 0, data->id, &rptr);
1424 SEND_PSTR(cif, data->id);
1431 SEND_SSTR(cif, data->id, data->sgdlist.addr);
1449 struct cmdif *cif = chip->cif;
1455 if (snd_BUG_ON(!cif || !data))
1524 freelbuspath(cif, data->source, data->lbuspath);
1525 alloclbuspath(cif, data->source, lbuspath,
1536 (cif, data->mixer, data->id, channels, format)
1537 || setsamplerate(cif, data->intdec, rate))
1574 struct cmdif *cif = chip->cif;
1576 if (cif && data) {
1578 freelbuspath(cif, data->source, data->lbuspath);
1707 struct cmdif *cif = chip->cif;
1710 if (cif) {
1712 if (IS_EOBIRQ(cif->hwport) || IS_EOSIRQ(cif->hwport) ||
1713 IS_EOCIRQ(cif->hwport)) {
1717 if (chip->rmidi && IS_MPUIRQ(cif->hwport)) {
1722 SET_AIACK(cif->hwport);
1732 struct cmdif *cif = chip->cif;
1736 if (snd_BUG_ON(!cif))
1741 SEND_SACR(cif, val, reg);
1742 SEND_RACR(cif, reg, &rptr);
1752 struct cmdif *cif = chip->cif;
1755 if (snd_BUG_ON(!cif))
1758 if (SEND_RACR(cif, reg, &rptr) != 0)
1759 SEND_RACR(cif, reg, &rptr);
1766 struct cmdif *cif;
1773 cif = chip->cif;
1774 if (!cif) {
1775 cif = kzalloc(sizeof(struct cmdif), GFP_KERNEL);
1776 if (!cif)
1778 cif->hwport = (struct riptideport *)chip->port;
1779 spin_lock_init(&cif->lock);
1780 chip->cif = cif;
1782 cif->is_reset = 0;
1783 err = riptide_reset(cif, chip);
1792 SEND_SETDPLL(cif);
1797 SET_EMPUIRQ(cif->hwport);
1804 struct cmdif *cif;
1806 cif = chip->cif;
1807 if (cif) {
1808 SET_GRESET(cif->hwport);
1810 UNSET_GRESET(cif->hwport);
1811 kfree(chip->cif);
1835 chip->cif = NULL;
1870 struct cmdif *cif = NULL;
1884 cif = chip->cif;
1885 if (cif) {
1894 getmixer(cif, i, &rval, &lval);
1899 cif->cmdcnt, cif->errcnt,
1900 cif->cmdtime, cif->cmdtimemax, cif->cmdtimemin);
1913 if (!(getsamplerate(cif, data->intdec, &rate)))
1924 if (!(getsamplerate(cif, data->intdec, &rate)))
1929 i = getpaths(cif, p);