Lines Matching refs:pcm
18 #include <sound/pcm.h>
144 static unsigned char get_slot_reg(struct ac97_pcm *pcm, unsigned short cidx,
151 if (pcm->spdif)
153 if (pcm->stream == SNDRV_PCM_STREAM_PLAYBACK)
154 return rate_reg_tables[dbl][pcm->r[dbl].rate_table[cidx]][slot - 3];
393 static unsigned int get_rates(struct ac97_pcm *pcm, unsigned int cidx, unsigned short slots, int dbl)
402 reg = get_slot_reg(pcm, cidx, i, dbl);
411 rates &= pcm->r[dbl].codec[cidx]->rates[idx];
426 * some slots are available, pcm->xxx.slots and pcm->xxx.rslots[] members
436 const struct ac97_pcm *pcm;
466 pcm = &pcms[i];
469 if (pcm->copy_flag) {
470 *rpcm = *pcm;
473 rpcm->stream = pcm->stream;
474 rpcm->exclusive = pcm->exclusive;
475 rpcm->spdif = pcm->spdif;
476 rpcm->private_value = pcm->private_value;
479 slots = pcm->r[0].slots;
484 if (pcm->spdif && pcm->stream == 0)
487 tmp = avail_slots[pcm->stream][j];
488 if (pcm->exclusive) {
497 tmp &= pcm->r[0].slots;
502 rpcm->r[0].rate_table[j] = rate_table[pcm->stream][j];
507 if (pcm->exclusive)
508 avail_slots[pcm->stream][j] &= ~tmp;
515 if (pcm->stream == SNDRV_PCM_STREAM_PLAYBACK &&
517 rate_table[pcm->stream][0] == 0) {
520 if ((tmp & pcm->r[1].slots) == tmp) {
525 if (pcm->exclusive)
526 avail_slots[pcm->stream][0] &= ~tmp;
545 * snd_ac97_pcm_open - opens the given AC97 pcm
546 * @pcm: the ac97 pcm instance
549 * @slots: a subset of allocated slots (snd_ac97_pcm_assign) for this pcm
555 int snd_ac97_pcm_open(struct ac97_pcm *pcm, unsigned int rate,
565 bus = pcm->bus;
574 spin_lock_irq(&pcm->bus->bus_lock);
580 if (bus->used_slots[pcm->stream][cidx] & (1 << i)) {
581 spin_unlock_irq(&pcm->bus->bus_lock);
585 if (pcm->r[r].rslots[cidx] & (1 << i)) {
586 bus->used_slots[pcm->stream][cidx] |= (1 << i);
591 spin_unlock_irq(&pcm->bus->bus_lock);
599 pcm->cur_dbl = r;
600 spin_unlock_irq(&pcm->bus->bus_lock);
605 if (pcm->r[r].rslots[cidx] & (1 << i)) {
606 reg = get_slot_reg(pcm, cidx, i, r);
617 err = snd_ac97_set_rate(pcm->r[r].codec[cidx], reg, rate);
627 pcm->aslots = slots;
631 pcm->aslots = slots;
632 snd_ac97_pcm_close(pcm);
639 * snd_ac97_pcm_close - closes the given AC97 pcm
640 * @pcm: the ac97 pcm instance
646 int snd_ac97_pcm_close(struct ac97_pcm *pcm)
649 unsigned short slots = pcm->aslots;
653 int r = pcm->cur_dbl;
658 if (pcm->r[r].rslots[cidx] & (1 << i)) {
659 int reg = get_slot_reg(pcm, cidx, i, r);
660 snd_ac97_update_power(pcm->r[r].codec[cidx],
667 bus = pcm->bus;
668 spin_lock_irq(&pcm->bus->bus_lock);
673 bus->used_slots[pcm->stream][cidx] &= ~(1 << i);
675 pcm->aslots = 0;
676 pcm->cur_dbl = 0;
677 spin_unlock_irq(&pcm->bus->bus_lock);
715 * @runtime: the runtime of the ac97 front playback pcm