Lines Matching refs:ctl
529 struct wm_coeff_ctl *ctl = (struct wm_coeff_ctl *)kcontrol->private_value; in wm_coeff_info() local
532 uinfo->count = ctl->len; in wm_coeff_info()
536 static int wm_coeff_write_control(struct wm_coeff_ctl *ctl, in wm_coeff_write_control() argument
539 struct wm_adsp_alg_region *alg_region = &ctl->alg_region; in wm_coeff_write_control()
541 struct wm_adsp *dsp = ctl->dsp; in wm_coeff_write_control()
553 reg = ctl->alg_region.base + ctl->offset; in wm_coeff_write_control()
556 scratch = kmemdup(buf, ctl->len, GFP_KERNEL | GFP_DMA); in wm_coeff_write_control()
561 ctl->len); in wm_coeff_write_control()
564 ctl->len, reg, ret); in wm_coeff_write_control()
568 adsp_dbg(dsp, "Wrote %zu bytes to %x\n", ctl->len, reg); in wm_coeff_write_control()
578 struct wm_coeff_ctl *ctl = (struct wm_coeff_ctl *)kcontrol->private_value; in wm_coeff_put() local
581 memcpy(ctl->cache, p, ctl->len); in wm_coeff_put()
583 ctl->set = 1; in wm_coeff_put()
584 if (!ctl->enabled) in wm_coeff_put()
587 return wm_coeff_write_control(ctl, p, ctl->len); in wm_coeff_put()
590 static int wm_coeff_read_control(struct wm_coeff_ctl *ctl, in wm_coeff_read_control() argument
593 struct wm_adsp_alg_region *alg_region = &ctl->alg_region; in wm_coeff_read_control()
595 struct wm_adsp *dsp = ctl->dsp; in wm_coeff_read_control()
607 reg = ctl->alg_region.base + ctl->offset; in wm_coeff_read_control()
610 scratch = kmalloc(ctl->len, GFP_KERNEL | GFP_DMA); in wm_coeff_read_control()
614 ret = regmap_raw_read(dsp->regmap, reg, scratch, ctl->len); in wm_coeff_read_control()
617 ctl->len, reg, ret); in wm_coeff_read_control()
621 adsp_dbg(dsp, "Read %zu bytes from %x\n", ctl->len, reg); in wm_coeff_read_control()
623 memcpy(buf, scratch, ctl->len); in wm_coeff_read_control()
632 struct wm_coeff_ctl *ctl = (struct wm_coeff_ctl *)kcontrol->private_value; in wm_coeff_get() local
635 if (ctl->flags & WMFW_CTL_FLAG_VOLATILE) { in wm_coeff_get()
636 if (ctl->enabled) in wm_coeff_get()
637 return wm_coeff_read_control(ctl, p, ctl->len); in wm_coeff_get()
642 memcpy(p, ctl->cache, ctl->len); in wm_coeff_get()
649 struct wm_coeff_ctl *ctl; member
653 static int wmfw_add_ctl(struct wm_adsp *dsp, struct wm_coeff_ctl *ctl) in wmfw_add_ctl() argument
658 if (!ctl || !ctl->name) in wmfw_add_ctl()
666 kcontrol->name = ctl->name; in wmfw_add_ctl()
670 kcontrol->private_value = (unsigned long)ctl; in wmfw_add_ctl()
672 if (ctl->flags) { in wmfw_add_ctl()
673 if (ctl->flags & WMFW_CTL_FLAG_WRITEABLE) in wmfw_add_ctl()
675 if (ctl->flags & WMFW_CTL_FLAG_READABLE) in wmfw_add_ctl()
677 if (ctl->flags & WMFW_CTL_FLAG_VOLATILE) in wmfw_add_ctl()
688 ctl->kcontrol = snd_soc_card_get_kcontrol(dsp->card, in wmfw_add_ctl()
689 ctl->name); in wmfw_add_ctl()
700 struct wm_coeff_ctl *ctl; in wm_coeff_init_control_caches() local
703 list_for_each_entry(ctl, &dsp->ctl_list, list) { in wm_coeff_init_control_caches()
704 if (!ctl->enabled || ctl->set) in wm_coeff_init_control_caches()
706 if (ctl->flags & WMFW_CTL_FLAG_VOLATILE) in wm_coeff_init_control_caches()
709 ret = wm_coeff_read_control(ctl, in wm_coeff_init_control_caches()
710 ctl->cache, in wm_coeff_init_control_caches()
711 ctl->len); in wm_coeff_init_control_caches()
721 struct wm_coeff_ctl *ctl; in wm_coeff_sync_controls() local
724 list_for_each_entry(ctl, &dsp->ctl_list, list) { in wm_coeff_sync_controls()
725 if (!ctl->enabled) in wm_coeff_sync_controls()
727 if (ctl->set && !(ctl->flags & WMFW_CTL_FLAG_VOLATILE)) { in wm_coeff_sync_controls()
728 ret = wm_coeff_write_control(ctl, in wm_coeff_sync_controls()
729 ctl->cache, in wm_coeff_sync_controls()
730 ctl->len); in wm_coeff_sync_controls()
745 wmfw_add_ctl(ctl_work->dsp, ctl_work->ctl); in wm_adsp_ctl_work()
755 struct wm_coeff_ctl *ctl; in wm_adsp_create_control() local
811 list_for_each_entry(ctl, &dsp->ctl_list, in wm_adsp_create_control()
813 if (!strcmp(ctl->name, name)) { in wm_adsp_create_control()
814 if (!ctl->enabled) in wm_adsp_create_control()
815 ctl->enabled = 1; in wm_adsp_create_control()
820 ctl = kzalloc(sizeof(*ctl), GFP_KERNEL); in wm_adsp_create_control()
821 if (!ctl) in wm_adsp_create_control()
823 ctl->fw_name = wm_adsp_fw_text[dsp->fw]; in wm_adsp_create_control()
824 ctl->alg_region = *alg_region; in wm_adsp_create_control()
825 ctl->name = kmemdup(name, strlen(name) + 1, GFP_KERNEL); in wm_adsp_create_control()
826 if (!ctl->name) { in wm_adsp_create_control()
830 ctl->enabled = 1; in wm_adsp_create_control()
831 ctl->set = 0; in wm_adsp_create_control()
832 ctl->ops.xget = wm_coeff_get; in wm_adsp_create_control()
833 ctl->ops.xput = wm_coeff_put; in wm_adsp_create_control()
834 ctl->dsp = dsp; in wm_adsp_create_control()
836 ctl->flags = flags; in wm_adsp_create_control()
837 ctl->offset = offset; in wm_adsp_create_control()
840 ctl->name, len); in wm_adsp_create_control()
843 ctl->len = len; in wm_adsp_create_control()
844 ctl->cache = kzalloc(ctl->len, GFP_KERNEL); in wm_adsp_create_control()
845 if (!ctl->cache) { in wm_adsp_create_control()
850 list_add(&ctl->list, &dsp->ctl_list); in wm_adsp_create_control()
859 ctl_work->ctl = ctl; in wm_adsp_create_control()
866 kfree(ctl->cache); in wm_adsp_create_control()
868 kfree(ctl->name); in wm_adsp_create_control()
870 kfree(ctl); in wm_adsp_create_control()
1281 struct wm_coeff_ctl *ctl; in wm_adsp_ctl_fixup_base() local
1283 list_for_each_entry(ctl, &dsp->ctl_list, list) { in wm_adsp_ctl_fixup_base()
1284 if (ctl->fw_name == wm_adsp_fw_text[dsp->fw] && in wm_adsp_ctl_fixup_base()
1285 alg_region->alg == ctl->alg_region.alg && in wm_adsp_ctl_fixup_base()
1286 alg_region->type == ctl->alg_region.type) { in wm_adsp_ctl_fixup_base()
1287 ctl->alg_region.base = alg_region->base; in wm_adsp_ctl_fixup_base()
1796 struct wm_coeff_ctl *ctl; in wm_adsp1_event() local
1871 list_for_each_entry(ctl, &dsp->ctl_list, list) in wm_adsp1_event()
1872 ctl->enabled = 0; in wm_adsp1_event()
2020 struct wm_coeff_ctl *ctl; in wm_adsp2_event() local
2057 list_for_each_entry(ctl, &dsp->ctl_list, list) in wm_adsp2_event()
2058 ctl->enabled = 0; in wm_adsp2_event()