Lines Matching +full:- +full:chs

1 // SPDX-License-Identifier: GPL-2.0-only
205 hda_nid_t cvt_nid, int chs) in hdmi_set_channel_count() argument
207 if (chs != hdmi_get_channel_count(codec, cvt_nid)) in hdmi_set_channel_count()
209 AC_VERB_SET_CVT_CHAN_COUNT, chs - 1); in hdmi_set_channel_count()
226 p->channels = 0; in init_channel_allocations()
227 p->spk_mask = 0; in init_channel_allocations()
228 for (j = 0; j < ARRAY_SIZE(p->speakers); j++) in init_channel_allocations()
229 if (p->speakers[j]) { in init_channel_allocations()
230 p->channels++; in init_channel_allocations()
231 p->spk_mask |= p->speakers[j]; in init_channel_allocations()
253 j += scnprintf(buf + j, buflen - j, " %s", in snd_hdac_print_channel_allocation()
263 * eld->spk_alloc => (eld_speaker_allocation_bits[]) => spk_mask
264 * spk_mask => (channel_allocations[]) => ai->CA
317 dev_dbg(&codec->dev, "HDMI: select CA 0x%x for %d-channel allocation: %s\n", in hdmi_channel_allocation_spk_alloc_blk()
331 channel = chmap->ops.pin_get_slot_channel( in hdmi_debug_channel_mapping()
332 chmap->hdac, pin_nid, i); in hdmi_debug_channel_mapping()
333 dev_dbg(&chmap->hdac->dev, "HDMI: ASP channel %d => slot %d\n", in hdmi_debug_channel_mapping()
356 for (i = 0; i < ch_alloc->channels; i++) { in hdmi_std_setup_channel_mapping()
358 !ch_alloc->speakers[7 - hdmi_slot]) in hdmi_std_setup_channel_mapping()
365 if (!ch_alloc->speakers[7 - hdmi_slot]) in hdmi_std_setup_channel_mapping()
370 for (i = 0; i < ch_alloc->channels; i++) in hdmi_std_setup_channel_mapping()
381 err = chmap->ops.pin_set_slot_channel(chmap->hdac, in hdmi_std_setup_channel_mapping()
384 dev_dbg(&chmap->hdac->dev, "HDMI: channel mapping failed\n"); in hdmi_std_setup_channel_mapping()
421 for (; t->map; t++) { in snd_hdac_chmap_to_spk_mask()
422 if (t->map == c) in snd_hdac_chmap_to_spk_mask()
423 return t->spk_mask; in snd_hdac_chmap_to_spk_mask()
439 return -1; in to_cea_slot()
443 if (channel_allocations[ordered_ca].speakers[7 - i] == mask) in to_cea_slot()
448 return -1; in to_cea_slot()
456 for (; t->map; t++) { in snd_hdac_spk_to_chmap()
457 if (t->spk_mask == spk) in snd_hdac_spk_to_chmap()
458 return t->map; in snd_hdac_spk_to_chmap()
475 mask = channel_allocations[ordered_ca].speakers[7 - slot]; in from_cea_slot()
481 static int hdmi_manual_channel_allocation(int chs, unsigned char *map) in hdmi_manual_channel_allocation() argument
485 for (i = 0; i < chs; i++) { in hdmi_manual_channel_allocation()
495 if ((chs == channel_allocations[i].channels || in hdmi_manual_channel_allocation()
501 return -1; in hdmi_manual_channel_allocation()
507 int chs, unsigned char *map, in hdmi_manual_setup_channel_mapping() argument
514 for (alsa_pos = 0; alsa_pos < chs; alsa_pos++) { in hdmi_manual_setup_channel_mapping()
527 err = chmap->ops.pin_set_slot_channel(chmap->hdac, in hdmi_manual_setup_channel_mapping()
530 return -EINVAL; in hdmi_manual_setup_channel_mapping()
606 * ALSA API channel-map control callbacks
612 struct hdac_chmap *chmap = info->private_data; in hdmi_chmap_ctl_info()
614 uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER; in hdmi_chmap_ctl_info()
615 uinfo->count = chmap->channels_max; in hdmi_chmap_ctl_info()
616 uinfo->value.integer.min = 0; in hdmi_chmap_ctl_info()
617 uinfo->value.integer.max = SNDRV_CHMAP_LAST; in hdmi_chmap_ctl_info()
625 if (cap->channels != channels) in hdmi_chmap_cea_alloc_validate_get_type()
626 return -1; in hdmi_chmap_cea_alloc_validate_get_type()
639 for (c = 7; c >= 0; c--) { in hdmi_cea_alloc_to_tlv_chmap()
640 int spk = cap->speakers[c]; in hdmi_cea_alloc_to_tlv_chmap()
668 struct hdac_chmap *chmap = info->private_data; in hdmi_chmap_ctl_tlv()
669 int pcm_idx = kcontrol->private_value; in hdmi_chmap_ctl_tlv()
671 int chs, count = 0; in hdmi_chmap_ctl_tlv() local
677 return -ENOMEM; in hdmi_chmap_ctl_tlv()
679 return -EFAULT; in hdmi_chmap_ctl_tlv()
680 size -= 8; in hdmi_chmap_ctl_tlv()
683 spk_alloc = chmap->ops.get_spk_alloc(chmap->hdac, pcm_idx); in hdmi_chmap_ctl_tlv()
688 for (chs = 2; chs <= max_chs; chs++) { in hdmi_chmap_ctl_tlv()
694 int chs_bytes = chs * 4; in hdmi_chmap_ctl_tlv()
697 if (cap->channels != chs) in hdmi_chmap_ctl_tlv()
700 if (!(cap->spk_mask == (spk_mask & cap->spk_mask))) in hdmi_chmap_ctl_tlv()
703 type = chmap->ops.chmap_cea_alloc_validate_get_type( in hdmi_chmap_ctl_tlv()
704 chmap, cap, chs); in hdmi_chmap_ctl_tlv()
706 return -ENODEV; in hdmi_chmap_ctl_tlv()
708 return -ENOMEM; in hdmi_chmap_ctl_tlv()
712 return -EFAULT; in hdmi_chmap_ctl_tlv()
715 size -= 8; in hdmi_chmap_ctl_tlv()
719 return -ENOMEM; in hdmi_chmap_ctl_tlv()
721 size -= chs_bytes; in hdmi_chmap_ctl_tlv()
723 chmap->ops.cea_alloc_to_tlv_chmap(chmap, cap, in hdmi_chmap_ctl_tlv()
724 tlv_chmap, chs); in hdmi_chmap_ctl_tlv()
727 return -EFAULT; in hdmi_chmap_ctl_tlv()
728 dst += chs; in hdmi_chmap_ctl_tlv()
733 return -EFAULT; in hdmi_chmap_ctl_tlv()
742 struct hdac_chmap *chmap = info->private_data; in hdmi_chmap_ctl_get()
743 int pcm_idx = kcontrol->private_value; in hdmi_chmap_ctl_get()
748 chmap->ops.get_chmap(chmap->hdac, pcm_idx, pcm_chmap); in hdmi_chmap_ctl_get()
751 ucontrol->value.integer.value[i] = pcm_chmap[i]; in hdmi_chmap_ctl_get()
762 for (i = 0; i < hchmap->channels_max; i++) { in chmap_value_check()
763 if (ucontrol->value.integer.value[i] < 0 || in chmap_value_check()
764 ucontrol->value.integer.value[i] > SNDRV_CHMAP_LAST) in chmap_value_check()
765 return -EINVAL; in chmap_value_check()
774 struct hdac_chmap *hchmap = info->private_data; in hdmi_chmap_ctl_put()
775 int pcm_idx = kcontrol->private_value; in hdmi_chmap_ctl_put()
788 if (!hchmap->ops.is_pcm_attached(hchmap->hdac, pcm_idx)) in hdmi_chmap_ctl_put()
791 ctl_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); in hdmi_chmap_ctl_put()
793 if (!substream || !substream->runtime) in hdmi_chmap_ctl_put()
795 switch (substream->runtime->state) { in hdmi_chmap_ctl_put()
803 return -EBUSY; in hdmi_chmap_ctl_put()
807 chmap[i] = ucontrol->value.integer.value[i]; in hdmi_chmap_ctl_put()
809 hchmap->ops.get_chmap(hchmap->hdac, pcm_idx, per_pin_chmap); in hdmi_chmap_ctl_put()
814 return -EINVAL; in hdmi_chmap_ctl_put()
815 if (hchmap->ops.chmap_validate) { in hdmi_chmap_ctl_put()
816 err = hchmap->ops.chmap_validate(hchmap, ca, in hdmi_chmap_ctl_put()
822 hchmap->ops.set_chmap(hchmap->hdac, pcm_idx, chmap, prepared); in hdmi_chmap_ctl_put()
838 chmap->ops = chmap_ops; in snd_hdac_register_chmap_ops()
839 chmap->hdac = hdac; in snd_hdac_register_chmap_ops()
857 chmap->private_data = hchmap; in snd_hdac_add_chmap_ctls()
858 kctl = chmap->kctl; in snd_hdac_add_chmap_ctls()
859 for (i = 0; i < kctl->count; i++) in snd_hdac_add_chmap_ctls()
860 kctl->vd[i].access |= SNDRV_CTL_ELEM_ACCESS_WRITE; in snd_hdac_add_chmap_ctls()
861 kctl->info = hdmi_chmap_ctl_info; in snd_hdac_add_chmap_ctls()
862 kctl->get = hdmi_chmap_ctl_get; in snd_hdac_add_chmap_ctls()
863 kctl->put = hdmi_chmap_ctl_put; in snd_hdac_add_chmap_ctls()
864 kctl->tlv.c = hdmi_chmap_ctl_tlv; in snd_hdac_add_chmap_ctls()