• Home
  • History
  • Annotate
  • Raw
  • Download
  • only in /netgear-R7000-V1.0.7.12_1.2.5/components/opensource/linux/linux-2.6.36/sound/oss/

Lines Matching refs:lith

103  *	The lowest level lock is lith->lithium_lock.  It is a
247 static void li_destroy(lithium_t *lith)
249 if (lith->page0) {
250 iounmap(lith->page0);
251 lith->page0 = NULL;
253 if (lith->page1) {
254 iounmap(lith->page1);
255 lith->page1 = NULL;
257 if (lith->page2) {
258 iounmap(lith->page2);
259 lith->page2 = NULL;
269 static int __init li_create(lithium_t *lith, unsigned long baseaddr)
271 spin_lock_init(&lith->lock);
272 lith->page0 = ioremap_nocache(baseaddr + LI_PAGE0_OFFSET, PAGE_SIZE);
273 lith->page1 = ioremap_nocache(baseaddr + LI_PAGE1_OFFSET, PAGE_SIZE);
274 lith->page2 = ioremap_nocache(baseaddr + LI_PAGE2_OFFSET, PAGE_SIZE);
275 if (!lith->page0 || !lith->page1 || !lith->page2) {
276 li_destroy(lith);
286 static __inline__ unsigned long li_readl(lithium_t *lith, int off)
288 return * (volatile unsigned long *) (lith->page0 + off);
291 static __inline__ unsigned char li_readb(lithium_t *lith, int off)
293 return * (volatile unsigned char *) (lith->page0 + off);
296 static __inline__ void li_writel(lithium_t *lith, int off, unsigned long val)
298 * (volatile unsigned long *) (lith->page0 + off) = val;
301 static __inline__ void li_writeb(lithium_t *lith, int off, unsigned char val)
303 * (volatile unsigned char *) (lith->page0 + off) = val;
491 * The lith field points to a lithium_t which is passed
498 lithium_t *lith;
522 static int li_ad1843_wait(lithium_t *lith)
525 while (li_readl(lith, LI_CODEC_COMMAND) & LI_CC_BUSY)
537 static int li_read_ad1843_reg(lithium_t *lith, int reg)
542 spin_lock(&lith->lock);
544 val = li_ad1843_wait(lith);
546 li_writel(lith, LI_CODEC_COMMAND, LI_CC_DIR_RD | reg);
547 val = li_ad1843_wait(lith);
550 val = li_readl(lith, LI_CODEC_DATA);
552 spin_unlock(&lith->lock);
554 DBGXV("li_read_ad1843_reg(lith=0x%p, reg=%d) returns 0x%04x\n",
555 lith, reg, val);
564 static void li_write_ad1843_reg(lithium_t *lith, int reg, int newval)
566 spin_lock(&lith->lock);
568 if (li_ad1843_wait(lith) == 0) {
569 li_writel(lith, LI_CODEC_DATA, newval);
570 li_writel(lith, LI_CODEC_COMMAND, LI_CC_DIR_WR | reg);
573 spin_unlock(&lith->lock);
583 lithium_t *lith,
593 DBGEV("(chan=0x%p, desc=0x%p, lith=0x%p, buffer_paddr=0x%lx, "
595 chan, desc, lith, buffer_paddr,
600 li_writel(lith, desc->ctlreg, LI_CCTL_RESET);
613 chan->lith = lith;
644 li_writel(lith, desc->basereg, chan->baseval);
645 li_writel(lith, desc->cfgreg, chan->cfgval);
646 li_writel(lith, desc->ctlreg, chan->ctlval);
653 lithium_t *lith = chan->lith;
654 void * lith1 = lith->page1;
660 li_writel(lith, chan->desc->ctlreg, chan->ctlval);
687 li_writel(chan->lith, chan->desc->ctlreg, chan->ctlval);
692 lithium_t *lith = chan->lith;
693 void * lith2 = lith->page2;
698 li_writel(lith, chan->desc->ctlreg, chan->ctlval);
730 return CHUNKS_TO_BYTES(li_readb(chan->lith, chan->desc->hwptrreg));
740 li_writeb(chan->lith, chan->desc->swptrreg, val);
747 lithium_t *lith = chan->lith;
751 spin_lock(&lith->lock);
759 now_high0 = li_readl(lith, LI_UST_HIGH);
760 now_low = li_readl(lith, LI_UST_LOW);
768 ustmsc->msc = li_readl(lith, desc->mscreg);
769 chan_ust = li_readl(lith, desc->ustreg);
771 now_high1 = li_readl(lith, LI_UST_HIGH);
774 spin_unlock(&lith->lock);
778 static void li_enable_interrupts(lithium_t *lith, unsigned int mask)
780 DBGEV("(lith=0x%p, mask=0x%x)\n", lith, mask);
784 li_writel(lith, LI_INTR_STATUS, mask);
788 mask |= li_readl(lith, LI_INTR_MASK);
789 li_writel(lith, LI_INTR_MASK, mask);
792 static void li_disable_interrupts(lithium_t *lith, unsigned int mask)
796 DBGEV("(lith=0x%p, mask=0x%x)\n", lith, mask);
800 keepmask = li_readl(lith, LI_INTR_MASK) & ~mask;
801 li_writel(lith, LI_INTR_MASK, keepmask);
805 li_writel(lith, LI_INTR_STATUS, mask);
810 static unsigned int li_get_clear_intr_status(lithium_t *lith)
814 status = li_readl(lith, LI_INTR_STATUS);
815 li_writel(lith, LI_INTR_STATUS, ~0);
816 return status & li_readl(lith, LI_INTR_MASK);
819 static int li_init(lithium_t *lith)
825 li_writel(lith, LI_HOST_CONTROLLER, LI_HC_RESET);
832 li_writel(lith, LI_HOST_CONTROLLER, LI_HC_LINK_ENABLE);
936 static int ad1843_read_bits(lithium_t *lith, const ad1843_bitfield_t *field)
938 int w = li_read_ad1843_reg(lith, field->reg);
941 DBGXV("ad1843_read_bits(lith=0x%p, field->{%d %d %d}) returns 0x%x\n",
942 lith, field->reg, field->lo_bit, field->nbits, val);
951 static int ad1843_write_bits(lithium_t *lith,
955 int w = li_read_ad1843_reg(lith, field->reg);
960 (void) li_write_ad1843_reg(lith, field->reg, w);
962 DBGXV("ad1843_write_bits(lith=0x%p, field->{%d %d %d}, val=0x%x) "
964 lith, field->reg, field->lo_bit, field->nbits, newval,
978 * ad1843_read_multi(lith, nfields,
983 static void ad1843_read_multi(lithium_t *lith, int argcount, ...)
995 w = li_read_ad1843_reg(lith, reg);
1010 * ad1843_write_multi(lith, nfields,
1015 static void ad1843_write_multi(lithium_t *lith, int argcount, ...)
1041 w = li_read_ad1843_reg(lith, reg);
1045 (void) li_write_ad1843_reg(lith, reg, w);
1053 static int ad1843_get_gain(lithium_t *lith, const ad1843_gain_t *gp)
1058 ad1843_read_multi(lith, 2, gp->lfield, &lg, gp->rfield, &rg);
1075 static int ad1843_set_gain(lithium_t *lith,
1091 ad1843_write_multi(lith, 2, gp->lfield, lg, gp->rfield, rg);
1092 return ad1843_get_gain(lith, gp);
1097 static int ad1843_get_recsrc(lithium_t *lith)
1099 int ls = ad1843_read_bits(lith, &ad1843_LSS);
1131 static void ad1843_set_resample_mode(lithium_t *lith, int onoff)
1134 int save_da1 = li_read_ad1843_reg(lith, 9);
1137 ad1843_write_multi(lith, 4,
1145 ad1843_write_bits(lith, &ad1843_DRSFLT, onoff);
1148 ad1843_write_multi(lith, 3,
1154 li_write_ad1843_reg(lith, 9, save_da1);
1167 static int ad1843_set_recsrc(lithium_t *lith, int newsrc)
1192 oldbits = ad1843_read_bits(lith, &ad1843_LSS);
1195 ad1843_set_resample_mode(lith, 1);
1196 ad1843_write_multi(lith, 2,
1201 ad1843_set_resample_mode(lith, 0);
1202 ad1843_write_multi(lith, 2,
1206 ad1843_write_multi(lith, 2, &ad1843_LSS, bits, &ad1843_RSS, bits);
1214 static int ad1843_get_outsrc(lithium_t *lith)
1218 pcm = ad1843_read_bits(lith, &ad1843_LDA1GM) ? 0 : SOUND_MASK_PCM;
1219 line = ad1843_read_bits(lith, &ad1843_LX1MM) ? 0 : SOUND_MASK_LINE;
1220 cd = ad1843_read_bits(lith, &ad1843_LX2MM) ? 0 : SOUND_MASK_CD;
1221 mic = ad1843_read_bits(lith, &ad1843_LMCMM) ? 0 : SOUND_MASK_MIC;
1232 static int ad1843_set_outsrc(lithium_t *lith, int mask)
1244 ad1843_write_multi(lith, 2, &ad1843_LDA1GM, pcm, &ad1843_RDA1GM, pcm);
1245 ad1843_write_multi(lith, 2, &ad1843_LX1MM, line, &ad1843_RX1MM, line);
1246 ad1843_write_multi(lith, 2, &ad1843_LX2MM, cd, &ad1843_RX2MM, cd);
1247 ad1843_write_multi(lith, 2, &ad1843_LMCMM, mic, &ad1843_RMCMM, mic);
1254 static void ad1843_setup_dac(lithium_t *lith,
1261 DBGEV("(lith=0x%p, framerate=%d, fmt=%d, channels=%d)\n",
1262 lith, framerate, fmt, channels);
1281 ad1843_write_bits(lith, &ad1843_C1C, framerate);
1282 ad1843_write_multi(lith, 2,
1286 static void ad1843_shutdown_dac(lithium_t *lith)
1288 ad1843_write_bits(lith, &ad1843_DA1F, 1);
1291 static void ad1843_setup_adc(lithium_t *lith, int framerate, int fmt, int channels)
1295 DBGEV("(lith=0x%p, framerate=%d, fmt=%d, channels=%d)\n",
1296 lith, framerate, fmt, channels);
1309 ad1843_write_bits(lith, &ad1843_C2C, framerate);
1310 ad1843_write_multi(lith, 2,
1314 static void ad1843_shutdown_adc(lithium_t *lith)
1327 static int __init ad1843_init(lithium_t *lith)
1332 err = li_init(lith);
1336 if (ad1843_read_bits(lith, &ad1843_INIT) != 0) {
1341 ad1843_write_bits(lith, &ad1843_SCF, 1);
1345 ad1843_write_bits(lith, &ad1843_PDNI, 0);
1348 while (ad1843_read_bits(lith, &ad1843_PDNO)) {
1360 ad1843_write_multi(lith, 2, &ad1843_C1EN, 1, &ad1843_C2EN, 1);
1366 ad1843_write_multi(lith, 3,
1373 ad1843_write_bits(lith, &ad1843_ADTLK, 1);
1374 ad1843_write_multi(lith, 5,
1383 ad1843_write_bits(lith, &ad1843_DA1C, 1);
1387 ad1843_set_outsrc(lith,
1390 ad1843_write_multi(lith, 2, &ad1843_LDA1AM, 0, &ad1843_RDA1AM, 0);
1396 ad1843_set_recsrc(lith, SOUND_MASK_LINE);
1397 ad1843_write_multi(lith, 2, &ad1843_LMGE, 1, &ad1843_RMGE, 1);
1401 ad1843_write_multi(lith, 2, &ad1843_HPOS, 1, &ad1843_HPOM, 0);
1508 lithium_t lith;
1748 &devc->lith,
1754 ad1843_setup_adc(&devc->lith,
1758 li_enable_interrupts(&devc->lith, READ_INTR_MASK);
1776 &devc->lith,
1782 ad1843_setup_dac(&devc->lith,
1786 li_enable_interrupts(&devc->lith, WRITE_INTR_MASK);
1820 li_disable_interrupts(&devc->lith, mask);
1822 ad1843_shutdown_adc(&devc->lith);
1824 ad1843_shutdown_dac(&devc->lith);
2224 status = li_get_clear_intr_status(&devc->lith);
3109 val = ad1843_get_gain(&devc->lith, &ad1843_gain_PCM);
3113 val = ad1843_get_gain(&devc->lith, &ad1843_gain_LINE);
3117 val = ad1843_get_gain(&devc->lith, &ad1843_gain_MIC);
3121 val = ad1843_get_gain(&devc->lith, &ad1843_gain_CD);
3125 val = ad1843_get_gain(&devc->lith, &ad1843_gain_RECLEV);
3129 val = ad1843_get_recsrc(&devc->lith);
3133 val = ad1843_get_outsrc(&devc->lith);
3156 val = ad1843_set_gain(&devc->lith, &ad1843_gain_PCM, val);
3160 val = ad1843_set_gain(&devc->lith, &ad1843_gain_LINE, val);
3164 val = ad1843_set_gain(&devc->lith, &ad1843_gain_MIC, val);
3168 val = ad1843_set_gain(&devc->lith, &ad1843_gain_CD, val);
3172 val = ad1843_set_gain(&devc->lith, &ad1843_gain_RECLEV, val);
3178 val = ad1843_set_recsrc(&devc->lith, val);
3182 val = ad1843_set_outsrc(&devc->lith, val);
3236 lithium_t lith;
3243 if (li_create(&lith, hw_config->io_base) != 0) {
3248 li_writel(&lith, LI_HOST_CONTROLLER, LI_HC_LINK_ENABLE);
3250 w = li_readl(&lith, LI_HOST_CONTROLLER);
3253 li_destroy(&lith);
3297 err = li_create(&devc->lith, hw_config->io_base);
3323 li_writel(&devc->lith, LI_COMM1_BASE,
3335 err = ad1843_init(&devc->lith);
3405 li_destroy(&devc->lith);
3435 li_destroy(&devc->lith);