Lines Matching full:ctl
473 static int cs_dsp_coeff_base_reg(struct cs_dsp_coeff_ctl *ctl, unsigned int *reg,
479 struct cs_dsp_coeff_ctl *ctl; in cs_dsp_debugfs_read_controls_show() local
482 list_for_each_entry(ctl, &dsp->ctl_list, list) { in cs_dsp_debugfs_read_controls_show()
483 cs_dsp_coeff_base_reg(ctl, ®, 0); in cs_dsp_debugfs_read_controls_show()
485 ctl->subname_len, ctl->subname, ctl->len, in cs_dsp_debugfs_read_controls_show()
486 cs_dsp_mem_region_name(ctl->alg_region.type), in cs_dsp_debugfs_read_controls_show()
487 ctl->offset, reg, ctl->fw_name, ctl->alg_region.alg, ctl->type, in cs_dsp_debugfs_read_controls_show()
488 ctl->flags & WMFW_CTL_FLAG_VOLATILE ? 'V' : '-', in cs_dsp_debugfs_read_controls_show()
489 ctl->flags & WMFW_CTL_FLAG_SYS ? 'S' : '-', in cs_dsp_debugfs_read_controls_show()
490 ctl->flags & WMFW_CTL_FLAG_READABLE ? 'R' : '-', in cs_dsp_debugfs_read_controls_show()
491 ctl->flags & WMFW_CTL_FLAG_WRITEABLE ? 'W' : '-', in cs_dsp_debugfs_read_controls_show()
492 ctl->enabled ? "enabled" : "disabled", in cs_dsp_debugfs_read_controls_show()
493 ctl->set ? "dirty" : "clean"); in cs_dsp_debugfs_read_controls_show()
663 static int cs_dsp_coeff_base_reg(struct cs_dsp_coeff_ctl *ctl, unsigned int *reg, in cs_dsp_coeff_base_reg() argument
666 const struct cs_dsp_alg_region *alg_region = &ctl->alg_region; in cs_dsp_coeff_base_reg()
667 struct cs_dsp *dsp = ctl->dsp; in cs_dsp_coeff_base_reg()
677 *reg = dsp->ops->region_to_reg(mem, ctl->alg_region.base + ctl->offset + off); in cs_dsp_coeff_base_reg()
684 * @ctl: pointer to acked coefficient control
694 int cs_dsp_coeff_write_acked_control(struct cs_dsp_coeff_ctl *ctl, unsigned int event_id) in cs_dsp_coeff_write_acked_control() argument
696 struct cs_dsp *dsp = ctl->dsp; in cs_dsp_coeff_write_acked_control()
706 ret = cs_dsp_coeff_base_reg(ctl, ®, 0); in cs_dsp_coeff_write_acked_control()
711 event_id, ctl->alg_region.alg, in cs_dsp_coeff_write_acked_control()
712 cs_dsp_mem_region_name(ctl->alg_region.type), ctl->offset); in cs_dsp_coeff_write_acked_control()
751 reg, ctl->alg_region.alg, in cs_dsp_coeff_write_acked_control()
752 cs_dsp_mem_region_name(ctl->alg_region.type), in cs_dsp_coeff_write_acked_control()
753 ctl->offset); in cs_dsp_coeff_write_acked_control()
759 static int cs_dsp_coeff_write_ctrl_raw(struct cs_dsp_coeff_ctl *ctl, in cs_dsp_coeff_write_ctrl_raw() argument
762 struct cs_dsp *dsp = ctl->dsp; in cs_dsp_coeff_write_ctrl_raw()
767 ret = cs_dsp_coeff_base_reg(ctl, ®, off); in cs_dsp_coeff_write_ctrl_raw()
792 * @ctl: pointer to coefficient control
801 int cs_dsp_coeff_write_ctrl(struct cs_dsp_coeff_ctl *ctl, in cs_dsp_coeff_write_ctrl() argument
806 if (!ctl) in cs_dsp_coeff_write_ctrl()
809 lockdep_assert_held(&ctl->dsp->pwr_lock); in cs_dsp_coeff_write_ctrl()
811 if (ctl->flags && !(ctl->flags & WMFW_CTL_FLAG_WRITEABLE)) in cs_dsp_coeff_write_ctrl()
814 if (len + off * sizeof(u32) > ctl->len) in cs_dsp_coeff_write_ctrl()
817 if (ctl->flags & WMFW_CTL_FLAG_VOLATILE) { in cs_dsp_coeff_write_ctrl()
819 } else if (buf != ctl->cache) { in cs_dsp_coeff_write_ctrl()
820 if (memcmp(ctl->cache + off * sizeof(u32), buf, len)) in cs_dsp_coeff_write_ctrl()
821 memcpy(ctl->cache + off * sizeof(u32), buf, len); in cs_dsp_coeff_write_ctrl()
826 ctl->set = 1; in cs_dsp_coeff_write_ctrl()
827 if (ctl->enabled && ctl->dsp->running) in cs_dsp_coeff_write_ctrl()
828 ret = cs_dsp_coeff_write_ctrl_raw(ctl, off, buf, len); in cs_dsp_coeff_write_ctrl()
839 * @ctl: pointer to coefficient control
848 int cs_dsp_coeff_lock_and_write_ctrl(struct cs_dsp_coeff_ctl *ctl, in cs_dsp_coeff_lock_and_write_ctrl() argument
851 struct cs_dsp *dsp = ctl->dsp; in cs_dsp_coeff_lock_and_write_ctrl()
857 ret = cs_dsp_coeff_write_ctrl(ctl, off, buf, len); in cs_dsp_coeff_lock_and_write_ctrl()
864 static int cs_dsp_coeff_read_ctrl_raw(struct cs_dsp_coeff_ctl *ctl, in cs_dsp_coeff_read_ctrl_raw() argument
867 struct cs_dsp *dsp = ctl->dsp; in cs_dsp_coeff_read_ctrl_raw()
872 ret = cs_dsp_coeff_base_reg(ctl, ®, off); in cs_dsp_coeff_read_ctrl_raw()
897 * @ctl: pointer to coefficient control
906 int cs_dsp_coeff_read_ctrl(struct cs_dsp_coeff_ctl *ctl, in cs_dsp_coeff_read_ctrl() argument
911 if (!ctl) in cs_dsp_coeff_read_ctrl()
914 lockdep_assert_held(&ctl->dsp->pwr_lock); in cs_dsp_coeff_read_ctrl()
916 if (len + off * sizeof(u32) > ctl->len) in cs_dsp_coeff_read_ctrl()
919 if (ctl->flags & WMFW_CTL_FLAG_VOLATILE) { in cs_dsp_coeff_read_ctrl()
920 if (ctl->enabled && ctl->dsp->running) in cs_dsp_coeff_read_ctrl()
921 return cs_dsp_coeff_read_ctrl_raw(ctl, off, buf, len); in cs_dsp_coeff_read_ctrl()
925 if (!ctl->flags && ctl->enabled && ctl->dsp->running) in cs_dsp_coeff_read_ctrl()
926 ret = cs_dsp_coeff_read_ctrl_raw(ctl, 0, ctl->cache, ctl->len); in cs_dsp_coeff_read_ctrl()
928 if (buf != ctl->cache) in cs_dsp_coeff_read_ctrl()
929 memcpy(buf, ctl->cache + off * sizeof(u32), len); in cs_dsp_coeff_read_ctrl()
938 * @ctl: pointer to coefficient control
947 int cs_dsp_coeff_lock_and_read_ctrl(struct cs_dsp_coeff_ctl *ctl, in cs_dsp_coeff_lock_and_read_ctrl() argument
950 struct cs_dsp *dsp = ctl->dsp; in cs_dsp_coeff_lock_and_read_ctrl()
956 ret = cs_dsp_coeff_read_ctrl(ctl, off, buf, len); in cs_dsp_coeff_lock_and_read_ctrl()
965 struct cs_dsp_coeff_ctl *ctl; in cs_dsp_coeff_init_control_caches() local
968 list_for_each_entry(ctl, &dsp->ctl_list, list) { in cs_dsp_coeff_init_control_caches()
969 if (!ctl->enabled || ctl->set) in cs_dsp_coeff_init_control_caches()
971 if (ctl->flags & WMFW_CTL_FLAG_VOLATILE) in cs_dsp_coeff_init_control_caches()
979 if (!ctl->flags || (ctl->flags & WMFW_CTL_FLAG_READABLE)) { in cs_dsp_coeff_init_control_caches()
980 ret = cs_dsp_coeff_read_ctrl_raw(ctl, 0, ctl->cache, ctl->len); in cs_dsp_coeff_init_control_caches()
991 struct cs_dsp_coeff_ctl *ctl; in cs_dsp_coeff_sync_controls() local
994 list_for_each_entry(ctl, &dsp->ctl_list, list) { in cs_dsp_coeff_sync_controls()
995 if (!ctl->enabled) in cs_dsp_coeff_sync_controls()
997 if (ctl->set && !(ctl->flags & WMFW_CTL_FLAG_VOLATILE)) { in cs_dsp_coeff_sync_controls()
998 ret = cs_dsp_coeff_write_ctrl_raw(ctl, 0, ctl->cache, in cs_dsp_coeff_sync_controls()
999 ctl->len); in cs_dsp_coeff_sync_controls()
1011 struct cs_dsp_coeff_ctl *ctl; in cs_dsp_signal_event_controls() local
1014 list_for_each_entry(ctl, &dsp->ctl_list, list) { in cs_dsp_signal_event_controls()
1015 if (ctl->type != WMFW_CTL_TYPE_HOSTEVENT) in cs_dsp_signal_event_controls()
1018 if (!ctl->enabled) in cs_dsp_signal_event_controls()
1021 ret = cs_dsp_coeff_write_acked_control(ctl, event); in cs_dsp_signal_event_controls()
1025 event, ctl->alg_region.alg, ret); in cs_dsp_signal_event_controls()
1029 static void cs_dsp_free_ctl_blk(struct cs_dsp_coeff_ctl *ctl) in cs_dsp_free_ctl_blk() argument
1031 kfree(ctl->cache); in cs_dsp_free_ctl_blk()
1032 kfree(ctl->subname); in cs_dsp_free_ctl_blk()
1033 kfree(ctl); in cs_dsp_free_ctl_blk()
1042 struct cs_dsp_coeff_ctl *ctl; in cs_dsp_create_control() local
1045 list_for_each_entry(ctl, &dsp->ctl_list, list) { in cs_dsp_create_control()
1046 if (ctl->fw_name == dsp->fw_name && in cs_dsp_create_control()
1047 ctl->alg_region.alg == alg_region->alg && in cs_dsp_create_control()
1048 ctl->alg_region.type == alg_region->type) { in cs_dsp_create_control()
1049 if ((!subname && !ctl->subname) || in cs_dsp_create_control()
1050 (subname && (ctl->subname_len == subname_len) && in cs_dsp_create_control()
1051 !strncmp(ctl->subname, subname, ctl->subname_len))) { in cs_dsp_create_control()
1052 if (!ctl->enabled) in cs_dsp_create_control()
1053 ctl->enabled = 1; in cs_dsp_create_control()
1059 ctl = kzalloc(sizeof(*ctl), GFP_KERNEL); in cs_dsp_create_control()
1060 if (!ctl) in cs_dsp_create_control()
1063 ctl->fw_name = dsp->fw_name; in cs_dsp_create_control()
1064 ctl->alg_region = *alg_region; in cs_dsp_create_control()
1066 ctl->subname_len = subname_len; in cs_dsp_create_control()
1067 ctl->subname = kasprintf(GFP_KERNEL, "%.*s", subname_len, subname); in cs_dsp_create_control()
1068 if (!ctl->subname) { in cs_dsp_create_control()
1073 ctl->enabled = 1; in cs_dsp_create_control()
1074 ctl->set = 0; in cs_dsp_create_control()
1075 ctl->dsp = dsp; in cs_dsp_create_control()
1077 ctl->flags = flags; in cs_dsp_create_control()
1078 ctl->type = type; in cs_dsp_create_control()
1079 ctl->offset = offset; in cs_dsp_create_control()
1080 ctl->len = len; in cs_dsp_create_control()
1081 ctl->cache = kzalloc(ctl->len, GFP_KERNEL); in cs_dsp_create_control()
1082 if (!ctl->cache) { in cs_dsp_create_control()
1087 list_add(&ctl->list, &dsp->ctl_list); in cs_dsp_create_control()
1090 ret = dsp->client_ops->control_add(ctl); in cs_dsp_create_control()
1098 list_del(&ctl->list); in cs_dsp_create_control()
1099 kfree(ctl->cache); in cs_dsp_create_control()
1101 kfree(ctl->subname); in cs_dsp_create_control()
1103 kfree(ctl); in cs_dsp_create_control()
1686 struct cs_dsp_coeff_ctl *ctl; in cs_dsp_ctl_fixup_base() local
1688 list_for_each_entry(ctl, &dsp->ctl_list, list) { in cs_dsp_ctl_fixup_base()
1689 if (ctl->fw_name == dsp->fw_name && in cs_dsp_ctl_fixup_base()
1690 alg_region->alg == ctl->alg_region.alg && in cs_dsp_ctl_fixup_base()
1691 alg_region->type == ctl->alg_region.type) { in cs_dsp_ctl_fixup_base()
1692 ctl->alg_region.base = alg_region->base; in cs_dsp_ctl_fixup_base()
2502 struct cs_dsp_coeff_ctl *ctl; in cs_dsp_adsp1_power_down() local
2519 list_for_each_entry(ctl, &dsp->ctl_list, list) in cs_dsp_adsp1_power_down()
2520 ctl->enabled = 0; in cs_dsp_adsp1_power_down()
2779 struct cs_dsp_coeff_ctl *ctl; in cs_dsp_power_down() local
2793 list_for_each_entry(ctl, &dsp->ctl_list, list) in cs_dsp_power_down()
2794 ctl->enabled = 0; in cs_dsp_power_down()
3014 struct cs_dsp_coeff_ctl *ctl; in cs_dsp_remove() local
3017 ctl = list_first_entry(&dsp->ctl_list, struct cs_dsp_coeff_ctl, list); in cs_dsp_remove()
3020 dsp->client_ops->control_remove(ctl); in cs_dsp_remove()
3022 list_del(&ctl->list); in cs_dsp_remove()
3023 cs_dsp_free_ctl_blk(ctl); in cs_dsp_remove()
3506 if (!wseq->ctl) { in cs_dsp_populate_wseq()
3511 words = kzalloc(wseq->ctl->len, GFP_KERNEL); in cs_dsp_populate_wseq()
3515 ret = cs_dsp_coeff_read_ctrl(wseq->ctl, 0, words, wseq->ctl->len); in cs_dsp_populate_wseq()
3517 cs_dsp_err(dsp, "Failed to read %s: %d\n", wseq->ctl->subname, ret); in cs_dsp_populate_wseq()
3523 chunk = cs_dsp_chunk(words, wseq->ctl->len); in cs_dsp_populate_wseq()
3569 cs_dsp_err(dsp, "%s missing end terminator\n", wseq->ctl->subname); in cs_dsp_populate_wseq()
3652 cs_dsp_err(dsp, "Missing terminator for %s\n", wseq->ctl->subname); in cs_dsp_wseq_write()
3690 if (wseq->ctl->len - op_end->offset < new_op_size) { in cs_dsp_wseq_write()
3691 cs_dsp_err(dsp, "Not enough memory in %s for entry\n", wseq->ctl->subname); in cs_dsp_wseq_write()
3698 ret = cs_dsp_coeff_write_ctrl(wseq->ctl, op_end->offset / sizeof(u32), in cs_dsp_wseq_write()
3706 ret = cs_dsp_coeff_write_ctrl(wseq->ctl, op_new->offset / sizeof(u32), in cs_dsp_wseq_write()