Lines Matching refs:ichdev

138 struct ichdev {  struct
176 struct ichdev ichd[2]; argument
366 static void snd_intel8x0m_setup_periods(struct intel8x0m *chip, struct ichdev *ichdev) in snd_intel8x0m_setup_periods() argument
369 __le32 *bdbar = ichdev->bdbar; in snd_intel8x0m_setup_periods()
370 unsigned long port = ichdev->reg_offset; in snd_intel8x0m_setup_periods()
372 iputdword(chip, port + ICH_REG_OFF_BDBAR, ichdev->bdbar_addr); in snd_intel8x0m_setup_periods()
373 if (ichdev->size == ichdev->fragsize) { in snd_intel8x0m_setup_periods()
374 ichdev->ack_reload = ichdev->ack = 2; in snd_intel8x0m_setup_periods()
375 ichdev->fragsize1 = ichdev->fragsize >> 1; in snd_intel8x0m_setup_periods()
377 bdbar[idx + 0] = cpu_to_le32(ichdev->physbuf); in snd_intel8x0m_setup_periods()
379 ichdev->fragsize1 >> chip->pcm_pos_shift); in snd_intel8x0m_setup_periods()
380 bdbar[idx + 2] = cpu_to_le32(ichdev->physbuf + (ichdev->size >> 1)); in snd_intel8x0m_setup_periods()
382 ichdev->fragsize1 >> chip->pcm_pos_shift); in snd_intel8x0m_setup_periods()
384 ichdev->frags = 2; in snd_intel8x0m_setup_periods()
386 ichdev->ack_reload = ichdev->ack = 1; in snd_intel8x0m_setup_periods()
387 ichdev->fragsize1 = ichdev->fragsize; in snd_intel8x0m_setup_periods()
389 bdbar[idx + 0] = cpu_to_le32(ichdev->physbuf + (((idx >> 1) * ichdev->fragsize) % ichdev->size)); in snd_intel8x0m_setup_periods()
391 ichdev->fragsize >> chip->pcm_pos_shift); in snd_intel8x0m_setup_periods()
397 ichdev->frags = ichdev->size / ichdev->fragsize; in snd_intel8x0m_setup_periods()
399 iputbyte(chip, port + ICH_REG_OFF_LVI, ichdev->lvi = ICH_REG_LVI_MASK); in snd_intel8x0m_setup_periods()
400 ichdev->civ = 0; in snd_intel8x0m_setup_periods()
402 ichdev->lvi_frag = ICH_REG_LVI_MASK % ichdev->frags; in snd_intel8x0m_setup_periods()
403 ichdev->position = 0; in snd_intel8x0m_setup_periods()
407 ichdev->lvi_frag, ichdev->frags, ichdev->fragsize, in snd_intel8x0m_setup_periods()
408 ichdev->fragsize1); in snd_intel8x0m_setup_periods()
411 iputbyte(chip, port + ichdev->roff_sr, ICH_FIFOE | ICH_BCIS | ICH_LVBCI); in snd_intel8x0m_setup_periods()
418 static inline void snd_intel8x0m_update(struct intel8x0m *chip, struct ichdev *ichdev) in snd_intel8x0m_update() argument
420 unsigned long port = ichdev->reg_offset; in snd_intel8x0m_update()
425 if (civ == ichdev->civ) { in snd_intel8x0m_update()
427 ichdev->civ++; in snd_intel8x0m_update()
428 ichdev->civ &= ICH_REG_LVI_MASK; in snd_intel8x0m_update()
430 step = civ - ichdev->civ; in snd_intel8x0m_update()
433 ichdev->civ = civ; in snd_intel8x0m_update()
436 ichdev->position += step * ichdev->fragsize1; in snd_intel8x0m_update()
437 ichdev->position %= ichdev->size; in snd_intel8x0m_update()
438 ichdev->lvi += step; in snd_intel8x0m_update()
439 ichdev->lvi &= ICH_REG_LVI_MASK; in snd_intel8x0m_update()
440 iputbyte(chip, port + ICH_REG_OFF_LVI, ichdev->lvi); in snd_intel8x0m_update()
442 ichdev->lvi_frag++; in snd_intel8x0m_update()
443 ichdev->lvi_frag %= ichdev->frags; in snd_intel8x0m_update()
444 ichdev->bdbar[ichdev->lvi * 2] = cpu_to_le32(ichdev->physbuf + in snd_intel8x0m_update()
445 ichdev->lvi_frag * in snd_intel8x0m_update()
446 ichdev->fragsize1); in snd_intel8x0m_update()
450 ichdev->lvi * 2, ichdev->bdbar[ichdev->lvi * 2], in snd_intel8x0m_update()
451 ichdev->bdbar[ichdev->lvi * 2 + 1], inb(ICH_REG_OFF_PIV + port), in snd_intel8x0m_update()
454 if (--ichdev->ack == 0) { in snd_intel8x0m_update()
455 ichdev->ack = ichdev->ack_reload; in snd_intel8x0m_update()
459 if (ack && ichdev->substream) { in snd_intel8x0m_update()
461 snd_pcm_period_elapsed(ichdev->substream); in snd_intel8x0m_update()
464 iputbyte(chip, port + ichdev->roff_sr, ICH_FIFOE | ICH_BCIS | ICH_LVBCI); in snd_intel8x0m_update()
470 struct ichdev *ichdev; in snd_intel8x0m_interrupt() local
488 ichdev = &chip->ichd[i]; in snd_intel8x0m_interrupt()
489 if (status & ichdev->int_sta_mask) in snd_intel8x0m_interrupt()
490 snd_intel8x0m_update(chip, ichdev); in snd_intel8x0m_interrupt()
507 struct ichdev *ichdev = get_ichdev(substream); in snd_intel8x0m_pcm_trigger() local
509 unsigned long port = ichdev->reg_offset; in snd_intel8x0m_pcm_trigger()
532 while (!(igetbyte(chip, port + ichdev->roff_sr) & ICH_DCH)) ; in snd_intel8x0m_pcm_trigger()
542 struct ichdev *ichdev = get_ichdev(substream); in snd_intel8x0m_pcm_pointer() local
545 ptr1 = igetword(chip, ichdev->reg_offset + ichdev->roff_picb) << chip->pcm_pos_shift; in snd_intel8x0m_pcm_pointer()
547 ptr = ichdev->fragsize1 - ptr1; in snd_intel8x0m_pcm_pointer()
550 ptr += ichdev->position; in snd_intel8x0m_pcm_pointer()
551 if (ptr >= ichdev->size) in snd_intel8x0m_pcm_pointer()
560 struct ichdev *ichdev = get_ichdev(substream); in snd_intel8x0m_pcm_prepare() local
562 ichdev->physbuf = runtime->dma_addr; in snd_intel8x0m_pcm_prepare()
563 ichdev->size = snd_pcm_lib_buffer_bytes(substream); in snd_intel8x0m_pcm_prepare()
564 ichdev->fragsize = snd_pcm_lib_period_bytes(substream); in snd_intel8x0m_pcm_prepare()
565 snd_ac97_write(ichdev->ac97, AC97_LINE1_RATE, runtime->rate); in snd_intel8x0m_pcm_prepare()
566 snd_ac97_write(ichdev->ac97, AC97_LINE1_LEVEL, 0); in snd_intel8x0m_pcm_prepare()
567 snd_intel8x0m_setup_periods(chip, ichdev); in snd_intel8x0m_pcm_prepare()
593 static int snd_intel8x0m_pcm_open(struct snd_pcm_substream *substream, struct ichdev *ichdev) in snd_intel8x0m_pcm_open() argument
604 ichdev->substream = substream; in snd_intel8x0m_pcm_open()
610 runtime->private_data = ichdev; in snd_intel8x0m_pcm_open()
1046 struct ichdev *ichdev; in snd_intel8x0m_init() local
1086 ichdev = &chip->ichd[i]; in snd_intel8x0m_init()
1087 ichdev->ichd = i; in snd_intel8x0m_init()
1088 ichdev->reg_offset = tbl[i].offset; in snd_intel8x0m_init()
1089 ichdev->int_sta_mask = tbl[i].int_sta_mask; in snd_intel8x0m_init()
1092 ichdev->roff_sr = ICH_REG_OFF_PICB; in snd_intel8x0m_init()
1093 ichdev->roff_picb = ICH_REG_OFF_SR; in snd_intel8x0m_init()
1095 ichdev->roff_sr = ICH_REG_OFF_SR; in snd_intel8x0m_init()
1096 ichdev->roff_picb = ICH_REG_OFF_PICB; in snd_intel8x0m_init()
1099 ichdev->ali_slot = (ichdev->reg_offset - 0x40) / 0x10; in snd_intel8x0m_init()
1116 ichdev = &chip->ichd[i]; in snd_intel8x0m_init()
1117 ichdev->bdbar = ((__le32 *)chip->bdbars->area) + (i * ICH_MAX_FRAGS * 2); in snd_intel8x0m_init()
1118 ichdev->bdbar_addr = chip->bdbars->addr + (i * sizeof(u32) * ICH_MAX_FRAGS * 2); in snd_intel8x0m_init()
1119 int_sta_masks |= ichdev->int_sta_mask; in snd_intel8x0m_init()