Lines Matching refs:ctl
619 static int cs_dsp_coeff_base_reg(struct cs_dsp_coeff_ctl *ctl, unsigned int *reg, in cs_dsp_coeff_base_reg() argument
622 const struct cs_dsp_alg_region *alg_region = &ctl->alg_region; in cs_dsp_coeff_base_reg()
623 struct cs_dsp *dsp = ctl->dsp; in cs_dsp_coeff_base_reg()
633 *reg = dsp->ops->region_to_reg(mem, ctl->alg_region.base + ctl->offset + off); in cs_dsp_coeff_base_reg()
650 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
652 struct cs_dsp *dsp = ctl->dsp; in cs_dsp_coeff_write_acked_control()
662 ret = cs_dsp_coeff_base_reg(ctl, ®, 0); in cs_dsp_coeff_write_acked_control()
667 event_id, ctl->alg_region.alg, in cs_dsp_coeff_write_acked_control()
668 cs_dsp_mem_region_name(ctl->alg_region.type), ctl->offset); in cs_dsp_coeff_write_acked_control()
707 reg, ctl->alg_region.alg, in cs_dsp_coeff_write_acked_control()
708 cs_dsp_mem_region_name(ctl->alg_region.type), in cs_dsp_coeff_write_acked_control()
709 ctl->offset); in cs_dsp_coeff_write_acked_control()
715 static int cs_dsp_coeff_write_ctrl_raw(struct cs_dsp_coeff_ctl *ctl, in cs_dsp_coeff_write_ctrl_raw() argument
718 struct cs_dsp *dsp = ctl->dsp; in cs_dsp_coeff_write_ctrl_raw()
723 ret = cs_dsp_coeff_base_reg(ctl, ®, off); in cs_dsp_coeff_write_ctrl_raw()
757 int cs_dsp_coeff_write_ctrl(struct cs_dsp_coeff_ctl *ctl, in cs_dsp_coeff_write_ctrl() argument
762 if (!ctl) in cs_dsp_coeff_write_ctrl()
765 lockdep_assert_held(&ctl->dsp->pwr_lock); in cs_dsp_coeff_write_ctrl()
767 if (len + off * sizeof(u32) > ctl->len) in cs_dsp_coeff_write_ctrl()
770 if (ctl->flags & WMFW_CTL_FLAG_VOLATILE) in cs_dsp_coeff_write_ctrl()
772 else if (buf != ctl->cache) in cs_dsp_coeff_write_ctrl()
773 memcpy(ctl->cache + off * sizeof(u32), buf, len); in cs_dsp_coeff_write_ctrl()
775 ctl->set = 1; in cs_dsp_coeff_write_ctrl()
776 if (ctl->enabled && ctl->dsp->running) in cs_dsp_coeff_write_ctrl()
777 ret = cs_dsp_coeff_write_ctrl_raw(ctl, off, buf, len); in cs_dsp_coeff_write_ctrl()
783 static int cs_dsp_coeff_read_ctrl_raw(struct cs_dsp_coeff_ctl *ctl, in cs_dsp_coeff_read_ctrl_raw() argument
786 struct cs_dsp *dsp = ctl->dsp; in cs_dsp_coeff_read_ctrl_raw()
791 ret = cs_dsp_coeff_base_reg(ctl, ®, off); in cs_dsp_coeff_read_ctrl_raw()
825 int cs_dsp_coeff_read_ctrl(struct cs_dsp_coeff_ctl *ctl, in cs_dsp_coeff_read_ctrl() argument
830 if (!ctl) in cs_dsp_coeff_read_ctrl()
833 lockdep_assert_held(&ctl->dsp->pwr_lock); in cs_dsp_coeff_read_ctrl()
835 if (len + off * sizeof(u32) > ctl->len) in cs_dsp_coeff_read_ctrl()
838 if (ctl->flags & WMFW_CTL_FLAG_VOLATILE) { in cs_dsp_coeff_read_ctrl()
839 if (ctl->enabled && ctl->dsp->running) in cs_dsp_coeff_read_ctrl()
840 return cs_dsp_coeff_read_ctrl_raw(ctl, off, buf, len); in cs_dsp_coeff_read_ctrl()
844 if (!ctl->flags && ctl->enabled && ctl->dsp->running) in cs_dsp_coeff_read_ctrl()
845 ret = cs_dsp_coeff_read_ctrl_raw(ctl, 0, ctl->cache, ctl->len); in cs_dsp_coeff_read_ctrl()
847 if (buf != ctl->cache) in cs_dsp_coeff_read_ctrl()
848 memcpy(buf, ctl->cache + off * sizeof(u32), len); in cs_dsp_coeff_read_ctrl()
857 struct cs_dsp_coeff_ctl *ctl; in cs_dsp_coeff_init_control_caches() local
860 list_for_each_entry(ctl, &dsp->ctl_list, list) { in cs_dsp_coeff_init_control_caches()
861 if (!ctl->enabled || ctl->set) in cs_dsp_coeff_init_control_caches()
863 if (ctl->flags & WMFW_CTL_FLAG_VOLATILE) in cs_dsp_coeff_init_control_caches()
871 if (!ctl->flags || (ctl->flags & WMFW_CTL_FLAG_READABLE)) { in cs_dsp_coeff_init_control_caches()
872 ret = cs_dsp_coeff_read_ctrl_raw(ctl, 0, ctl->cache, ctl->len); in cs_dsp_coeff_init_control_caches()
883 struct cs_dsp_coeff_ctl *ctl; in cs_dsp_coeff_sync_controls() local
886 list_for_each_entry(ctl, &dsp->ctl_list, list) { in cs_dsp_coeff_sync_controls()
887 if (!ctl->enabled) in cs_dsp_coeff_sync_controls()
889 if (ctl->set && !(ctl->flags & WMFW_CTL_FLAG_VOLATILE)) { in cs_dsp_coeff_sync_controls()
890 ret = cs_dsp_coeff_write_ctrl_raw(ctl, 0, ctl->cache, in cs_dsp_coeff_sync_controls()
891 ctl->len); in cs_dsp_coeff_sync_controls()
903 struct cs_dsp_coeff_ctl *ctl; in cs_dsp_signal_event_controls() local
906 list_for_each_entry(ctl, &dsp->ctl_list, list) { in cs_dsp_signal_event_controls()
907 if (ctl->type != WMFW_CTL_TYPE_HOSTEVENT) in cs_dsp_signal_event_controls()
910 if (!ctl->enabled) in cs_dsp_signal_event_controls()
913 ret = cs_dsp_coeff_write_acked_control(ctl, event); in cs_dsp_signal_event_controls()
917 event, ctl->alg_region.alg, ret); in cs_dsp_signal_event_controls()
921 static void cs_dsp_free_ctl_blk(struct cs_dsp_coeff_ctl *ctl) in cs_dsp_free_ctl_blk() argument
923 kfree(ctl->cache); in cs_dsp_free_ctl_blk()
924 kfree(ctl->subname); in cs_dsp_free_ctl_blk()
925 kfree(ctl); in cs_dsp_free_ctl_blk()
934 struct cs_dsp_coeff_ctl *ctl; in cs_dsp_create_control() local
937 list_for_each_entry(ctl, &dsp->ctl_list, list) { in cs_dsp_create_control()
938 if (ctl->fw_name == dsp->fw_name && in cs_dsp_create_control()
939 ctl->alg_region.alg == alg_region->alg && in cs_dsp_create_control()
940 ctl->alg_region.type == alg_region->type) { in cs_dsp_create_control()
941 if ((!subname && !ctl->subname) || in cs_dsp_create_control()
942 (subname && (ctl->subname_len == subname_len) && in cs_dsp_create_control()
943 !strncmp(ctl->subname, subname, ctl->subname_len))) { in cs_dsp_create_control()
944 if (!ctl->enabled) in cs_dsp_create_control()
945 ctl->enabled = 1; in cs_dsp_create_control()
951 ctl = kzalloc(sizeof(*ctl), GFP_KERNEL); in cs_dsp_create_control()
952 if (!ctl) in cs_dsp_create_control()
955 ctl->fw_name = dsp->fw_name; in cs_dsp_create_control()
956 ctl->alg_region = *alg_region; in cs_dsp_create_control()
958 ctl->subname_len = subname_len; in cs_dsp_create_control()
959 ctl->subname = kasprintf(GFP_KERNEL, "%.*s", subname_len, subname); in cs_dsp_create_control()
960 if (!ctl->subname) { in cs_dsp_create_control()
965 ctl->enabled = 1; in cs_dsp_create_control()
966 ctl->set = 0; in cs_dsp_create_control()
967 ctl->dsp = dsp; in cs_dsp_create_control()
969 ctl->flags = flags; in cs_dsp_create_control()
970 ctl->type = type; in cs_dsp_create_control()
971 ctl->offset = offset; in cs_dsp_create_control()
972 ctl->len = len; in cs_dsp_create_control()
973 ctl->cache = kzalloc(ctl->len, GFP_KERNEL); in cs_dsp_create_control()
974 if (!ctl->cache) { in cs_dsp_create_control()
979 list_add(&ctl->list, &dsp->ctl_list); in cs_dsp_create_control()
982 ret = dsp->client_ops->control_add(ctl); in cs_dsp_create_control()
990 list_del(&ctl->list); in cs_dsp_create_control()
991 kfree(ctl->cache); in cs_dsp_create_control()
993 kfree(ctl->subname); in cs_dsp_create_control()
995 kfree(ctl); in cs_dsp_create_control()
1502 struct cs_dsp_coeff_ctl *ctl; in cs_dsp_ctl_fixup_base() local
1504 list_for_each_entry(ctl, &dsp->ctl_list, list) { in cs_dsp_ctl_fixup_base()
1505 if (ctl->fw_name == dsp->fw_name && in cs_dsp_ctl_fixup_base()
1506 alg_region->alg == ctl->alg_region.alg && in cs_dsp_ctl_fixup_base()
1507 alg_region->type == ctl->alg_region.type) { in cs_dsp_ctl_fixup_base()
1508 ctl->alg_region.base = alg_region->base; in cs_dsp_ctl_fixup_base()
2321 struct cs_dsp_coeff_ctl *ctl; in cs_dsp_adsp1_power_down() local
2338 list_for_each_entry(ctl, &dsp->ctl_list, list) in cs_dsp_adsp1_power_down()
2339 ctl->enabled = 0; in cs_dsp_adsp1_power_down()
2598 struct cs_dsp_coeff_ctl *ctl; in cs_dsp_power_down() local
2612 list_for_each_entry(ctl, &dsp->ctl_list, list) in cs_dsp_power_down()
2613 ctl->enabled = 0; in cs_dsp_power_down()
2830 struct cs_dsp_coeff_ctl *ctl; in cs_dsp_remove() local
2833 ctl = list_first_entry(&dsp->ctl_list, struct cs_dsp_coeff_ctl, list); in cs_dsp_remove()
2836 dsp->client_ops->control_remove(ctl); in cs_dsp_remove()
2838 list_del(&ctl->list); in cs_dsp_remove()
2839 cs_dsp_free_ctl_blk(ctl); in cs_dsp_remove()