Lines Matching refs:ichdev
153 struct ichdev { struct
191 struct ichdev ichd[2]; argument
380 static void snd_intel8x0m_setup_periods(struct intel8x0m *chip, struct ichdev *ichdev) in snd_intel8x0m_setup_periods() argument
383 __le32 *bdbar = ichdev->bdbar; in snd_intel8x0m_setup_periods()
384 unsigned long port = ichdev->reg_offset; in snd_intel8x0m_setup_periods()
386 iputdword(chip, port + ICH_REG_OFF_BDBAR, ichdev->bdbar_addr); in snd_intel8x0m_setup_periods()
387 if (ichdev->size == ichdev->fragsize) { in snd_intel8x0m_setup_periods()
388 ichdev->ack_reload = ichdev->ack = 2; in snd_intel8x0m_setup_periods()
389 ichdev->fragsize1 = ichdev->fragsize >> 1; in snd_intel8x0m_setup_periods()
391 bdbar[idx + 0] = cpu_to_le32(ichdev->physbuf); in snd_intel8x0m_setup_periods()
393 ichdev->fragsize1 >> chip->pcm_pos_shift); in snd_intel8x0m_setup_periods()
394 bdbar[idx + 2] = cpu_to_le32(ichdev->physbuf + (ichdev->size >> 1)); in snd_intel8x0m_setup_periods()
396 ichdev->fragsize1 >> chip->pcm_pos_shift); in snd_intel8x0m_setup_periods()
398 ichdev->frags = 2; in snd_intel8x0m_setup_periods()
400 ichdev->ack_reload = ichdev->ack = 1; in snd_intel8x0m_setup_periods()
401 ichdev->fragsize1 = ichdev->fragsize; in snd_intel8x0m_setup_periods()
403 bdbar[idx + 0] = cpu_to_le32(ichdev->physbuf + (((idx >> 1) * ichdev->fragsize) % ichdev->size)); in snd_intel8x0m_setup_periods()
405 ichdev->fragsize >> chip->pcm_pos_shift); in snd_intel8x0m_setup_periods()
411 ichdev->frags = ichdev->size / ichdev->fragsize; in snd_intel8x0m_setup_periods()
413 iputbyte(chip, port + ICH_REG_OFF_LVI, ichdev->lvi = ICH_REG_LVI_MASK); in snd_intel8x0m_setup_periods()
414 ichdev->civ = 0; in snd_intel8x0m_setup_periods()
416 ichdev->lvi_frag = ICH_REG_LVI_MASK % ichdev->frags; in snd_intel8x0m_setup_periods()
417 ichdev->position = 0; in snd_intel8x0m_setup_periods()
421 ichdev->lvi_frag, ichdev->frags, ichdev->fragsize, in snd_intel8x0m_setup_periods()
422 ichdev->fragsize1); in snd_intel8x0m_setup_periods()
425 iputbyte(chip, port + ichdev->roff_sr, ICH_FIFOE | ICH_BCIS | ICH_LVBCI); in snd_intel8x0m_setup_periods()
432 static inline void snd_intel8x0m_update(struct intel8x0m *chip, struct ichdev *ichdev) in snd_intel8x0m_update() argument
434 unsigned long port = ichdev->reg_offset; in snd_intel8x0m_update()
439 if (civ == ichdev->civ) { in snd_intel8x0m_update()
442 ichdev->civ++; in snd_intel8x0m_update()
443 ichdev->civ &= ICH_REG_LVI_MASK; in snd_intel8x0m_update()
445 step = civ - ichdev->civ; in snd_intel8x0m_update()
450 ichdev->civ = civ; in snd_intel8x0m_update()
453 ichdev->position += step * ichdev->fragsize1; in snd_intel8x0m_update()
454 ichdev->position %= ichdev->size; in snd_intel8x0m_update()
455 ichdev->lvi += step; in snd_intel8x0m_update()
456 ichdev->lvi &= ICH_REG_LVI_MASK; in snd_intel8x0m_update()
457 iputbyte(chip, port + ICH_REG_OFF_LVI, ichdev->lvi); in snd_intel8x0m_update()
459 ichdev->lvi_frag++; in snd_intel8x0m_update()
460 ichdev->lvi_frag %= ichdev->frags; in snd_intel8x0m_update()
461 ichdev->bdbar[ichdev->lvi * 2] = cpu_to_le32(ichdev->physbuf + in snd_intel8x0m_update()
462 ichdev->lvi_frag * in snd_intel8x0m_update()
463 ichdev->fragsize1); in snd_intel8x0m_update()
467 ichdev->lvi * 2, ichdev->bdbar[ichdev->lvi * 2], in snd_intel8x0m_update()
468 ichdev->bdbar[ichdev->lvi * 2 + 1], inb(ICH_REG_OFF_PIV + port), in snd_intel8x0m_update()
471 if (--ichdev->ack == 0) { in snd_intel8x0m_update()
472 ichdev->ack = ichdev->ack_reload; in snd_intel8x0m_update()
476 if (ack && ichdev->substream) { in snd_intel8x0m_update()
478 snd_pcm_period_elapsed(ichdev->substream); in snd_intel8x0m_update()
481 iputbyte(chip, port + ichdev->roff_sr, ICH_FIFOE | ICH_BCIS | ICH_LVBCI); in snd_intel8x0m_update()
487 struct ichdev *ichdev; in snd_intel8x0m_interrupt() local
505 ichdev = &chip->ichd[i]; in snd_intel8x0m_interrupt()
506 if (status & ichdev->int_sta_mask) in snd_intel8x0m_interrupt()
507 snd_intel8x0m_update(chip, ichdev); in snd_intel8x0m_interrupt()
524 struct ichdev *ichdev = get_ichdev(substream); in snd_intel8x0m_pcm_trigger() local
526 unsigned long port = ichdev->reg_offset; in snd_intel8x0m_pcm_trigger()
549 while (!(igetbyte(chip, port + ichdev->roff_sr) & ICH_DCH)) ; in snd_intel8x0m_pcm_trigger()
559 struct ichdev *ichdev = get_ichdev(substream); in snd_intel8x0m_pcm_pointer() local
562 ptr1 = igetword(chip, ichdev->reg_offset + ichdev->roff_picb) << chip->pcm_pos_shift; in snd_intel8x0m_pcm_pointer()
564 ptr = ichdev->fragsize1 - ptr1; in snd_intel8x0m_pcm_pointer()
567 ptr += ichdev->position; in snd_intel8x0m_pcm_pointer()
568 if (ptr >= ichdev->size) in snd_intel8x0m_pcm_pointer()
577 struct ichdev *ichdev = get_ichdev(substream); in snd_intel8x0m_pcm_prepare() local
579 ichdev->physbuf = runtime->dma_addr; in snd_intel8x0m_pcm_prepare()
580 ichdev->size = snd_pcm_lib_buffer_bytes(substream); in snd_intel8x0m_pcm_prepare()
581 ichdev->fragsize = snd_pcm_lib_period_bytes(substream); in snd_intel8x0m_pcm_prepare()
582 snd_ac97_write(ichdev->ac97, AC97_LINE1_RATE, runtime->rate); in snd_intel8x0m_pcm_prepare()
583 snd_ac97_write(ichdev->ac97, AC97_LINE1_LEVEL, 0); in snd_intel8x0m_pcm_prepare()
584 snd_intel8x0m_setup_periods(chip, ichdev); in snd_intel8x0m_pcm_prepare()
610 static int snd_intel8x0m_pcm_open(struct snd_pcm_substream *substream, struct ichdev *ichdev) in snd_intel8x0m_pcm_open() argument
621 ichdev->substream = substream; in snd_intel8x0m_pcm_open()
627 runtime->private_data = ichdev; in snd_intel8x0m_pcm_open()
1081 struct ichdev *ichdev; in snd_intel8x0m_create() local
1144 ichdev = &chip->ichd[i]; in snd_intel8x0m_create()
1145 ichdev->ichd = i; in snd_intel8x0m_create()
1146 ichdev->reg_offset = tbl[i].offset; in snd_intel8x0m_create()
1147 ichdev->int_sta_mask = tbl[i].int_sta_mask; in snd_intel8x0m_create()
1150 ichdev->roff_sr = ICH_REG_OFF_PICB; in snd_intel8x0m_create()
1151 ichdev->roff_picb = ICH_REG_OFF_SR; in snd_intel8x0m_create()
1153 ichdev->roff_sr = ICH_REG_OFF_SR; in snd_intel8x0m_create()
1154 ichdev->roff_picb = ICH_REG_OFF_PICB; in snd_intel8x0m_create()
1157 ichdev->ali_slot = (ichdev->reg_offset - 0x40) / 0x10; in snd_intel8x0m_create()
1174 ichdev = &chip->ichd[i]; in snd_intel8x0m_create()
1175 ichdev->bdbar = ((__le32 *)chip->bdbars.area) + (i * ICH_MAX_FRAGS * 2); in snd_intel8x0m_create()
1176 ichdev->bdbar_addr = chip->bdbars.addr + (i * sizeof(u32) * ICH_MAX_FRAGS * 2); in snd_intel8x0m_create()
1177 int_sta_masks |= ichdev->int_sta_mask; in snd_intel8x0m_create()