Lines Matching defs: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];
392 static unsigned int get_rates(struct ac97_pcm *pcm, unsigned int cidx, unsigned short slots, int dbl)
401 reg = get_slot_reg(pcm, cidx, i, dbl);
410 rates &= pcm->r[dbl].codec[cidx]->rates[idx];
425 * some slots are available, pcm->xxx.slots and pcm->xxx.rslots[] members
435 const struct ac97_pcm *pcm;
465 pcm = &pcms[i];
468 if (pcm->copy_flag) {
469 *rpcm = *pcm;
472 rpcm->stream = pcm->stream;
473 rpcm->exclusive = pcm->exclusive;
474 rpcm->spdif = pcm->spdif;
475 rpcm->private_value = pcm->private_value;
478 slots = pcm->r[0].slots;
483 if (pcm->spdif && pcm->stream == 0)
486 tmp = avail_slots[pcm->stream][j];
487 if (pcm->exclusive) {
496 tmp &= pcm->r[0].slots;
501 rpcm->r[0].rate_table[j] = rate_table[pcm->stream][j];
506 if (pcm->exclusive)
507 avail_slots[pcm->stream][j] &= ~tmp;
514 if (pcm->stream == SNDRV_PCM_STREAM_PLAYBACK &&
516 rate_table[pcm->stream][0] == 0) {
519 if ((tmp & pcm->r[1].slots) == tmp) {
524 if (pcm->exclusive)
525 avail_slots[pcm->stream][0] &= ~tmp;
544 * snd_ac97_pcm_open - opens the given AC97 pcm
545 * @pcm: the ac97 pcm instance
548 * @slots: a subset of allocated slots (snd_ac97_pcm_assign) for this pcm
554 int snd_ac97_pcm_open(struct ac97_pcm *pcm, unsigned int rate,
564 bus = pcm->bus;
573 scoped_guard(spinlock_irq, &pcm->bus->bus_lock) {
579 if (bus->used_slots[pcm->stream][cidx] & (1 << i)) {
583 if (pcm->r[r].rslots[cidx] & (1 << i)) {
584 bus->used_slots[pcm->stream][cidx] |= (1 << i);
596 pcm->cur_dbl = r;
602 if (pcm->r[r].rslots[cidx] & (1 << i)) {
603 reg = get_slot_reg(pcm, cidx, i, r);
614 err = snd_ac97_set_rate(pcm->r[r].codec[cidx], reg, rate);
624 pcm->aslots = slots;
628 pcm->aslots = slots;
629 snd_ac97_pcm_close(pcm);
636 * snd_ac97_pcm_close - closes the given AC97 pcm
637 * @pcm: the ac97 pcm instance
643 int snd_ac97_pcm_close(struct ac97_pcm *pcm)
646 unsigned short slots = pcm->aslots;
650 int r = pcm->cur_dbl;
655 if (pcm->r[r].rslots[cidx] & (1 << i)) {
656 int reg = get_slot_reg(pcm, cidx, i, r);
657 snd_ac97_update_power(pcm->r[r].codec[cidx],
664 bus = pcm->bus;
665 guard(spinlock_irq)(&pcm->bus->bus_lock);
670 bus->used_slots[pcm->stream][cidx] &= ~(1 << i);
672 pcm->aslots = 0;
673 pcm->cur_dbl = 0;
711 * @runtime: the runtime of the ac97 front playback pcm