Lines Matching refs:ctl

461 static int cs_dsp_coeff_base_reg(struct cs_dsp_coeff_ctl *ctl, unsigned int *reg,
467 struct cs_dsp_coeff_ctl *ctl; in cs_dsp_debugfs_read_controls_show() local
470 list_for_each_entry(ctl, &dsp->ctl_list, list) { in cs_dsp_debugfs_read_controls_show()
471 cs_dsp_coeff_base_reg(ctl, &reg, 0); in cs_dsp_debugfs_read_controls_show()
473 ctl->subname_len, ctl->subname, ctl->len, in cs_dsp_debugfs_read_controls_show()
474 cs_dsp_mem_region_name(ctl->alg_region.type), in cs_dsp_debugfs_read_controls_show()
475 ctl->offset, reg, ctl->fw_name, ctl->alg_region.alg, ctl->type, in cs_dsp_debugfs_read_controls_show()
476 ctl->flags & WMFW_CTL_FLAG_VOLATILE ? 'V' : '-', in cs_dsp_debugfs_read_controls_show()
477 ctl->flags & WMFW_CTL_FLAG_SYS ? 'S' : '-', in cs_dsp_debugfs_read_controls_show()
478 ctl->flags & WMFW_CTL_FLAG_READABLE ? 'R' : '-', in cs_dsp_debugfs_read_controls_show()
479 ctl->flags & WMFW_CTL_FLAG_WRITEABLE ? 'W' : '-', in cs_dsp_debugfs_read_controls_show()
480 ctl->enabled ? "enabled" : "disabled", in cs_dsp_debugfs_read_controls_show()
481 ctl->set ? "dirty" : "clean"); in cs_dsp_debugfs_read_controls_show()
651 static int cs_dsp_coeff_base_reg(struct cs_dsp_coeff_ctl *ctl, unsigned int *reg, in cs_dsp_coeff_base_reg() argument
654 const struct cs_dsp_alg_region *alg_region = &ctl->alg_region; in cs_dsp_coeff_base_reg()
655 struct cs_dsp *dsp = ctl->dsp; in cs_dsp_coeff_base_reg()
665 *reg = dsp->ops->region_to_reg(mem, ctl->alg_region.base + ctl->offset + off); in cs_dsp_coeff_base_reg()
682 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
684 struct cs_dsp *dsp = ctl->dsp; in cs_dsp_coeff_write_acked_control()
694 ret = cs_dsp_coeff_base_reg(ctl, &reg, 0); in cs_dsp_coeff_write_acked_control()
699 event_id, ctl->alg_region.alg, in cs_dsp_coeff_write_acked_control()
700 cs_dsp_mem_region_name(ctl->alg_region.type), ctl->offset); in cs_dsp_coeff_write_acked_control()
739 reg, ctl->alg_region.alg, in cs_dsp_coeff_write_acked_control()
740 cs_dsp_mem_region_name(ctl->alg_region.type), in cs_dsp_coeff_write_acked_control()
741 ctl->offset); in cs_dsp_coeff_write_acked_control()
747 static int cs_dsp_coeff_write_ctrl_raw(struct cs_dsp_coeff_ctl *ctl, in cs_dsp_coeff_write_ctrl_raw() argument
750 struct cs_dsp *dsp = ctl->dsp; in cs_dsp_coeff_write_ctrl_raw()
755 ret = cs_dsp_coeff_base_reg(ctl, &reg, off); in cs_dsp_coeff_write_ctrl_raw()
789 int cs_dsp_coeff_write_ctrl(struct cs_dsp_coeff_ctl *ctl, in cs_dsp_coeff_write_ctrl() argument
794 if (!ctl) in cs_dsp_coeff_write_ctrl()
797 lockdep_assert_held(&ctl->dsp->pwr_lock); in cs_dsp_coeff_write_ctrl()
799 if (len + off * sizeof(u32) > ctl->len) in cs_dsp_coeff_write_ctrl()
802 if (ctl->flags & WMFW_CTL_FLAG_VOLATILE) { in cs_dsp_coeff_write_ctrl()
804 } else if (buf != ctl->cache) { in cs_dsp_coeff_write_ctrl()
805 if (memcmp(ctl->cache + off * sizeof(u32), buf, len)) in cs_dsp_coeff_write_ctrl()
806 memcpy(ctl->cache + off * sizeof(u32), buf, len); in cs_dsp_coeff_write_ctrl()
811 ctl->set = 1; in cs_dsp_coeff_write_ctrl()
812 if (ctl->enabled && ctl->dsp->running) in cs_dsp_coeff_write_ctrl()
813 ret = cs_dsp_coeff_write_ctrl_raw(ctl, off, buf, len); in cs_dsp_coeff_write_ctrl()
822 static int cs_dsp_coeff_read_ctrl_raw(struct cs_dsp_coeff_ctl *ctl, in cs_dsp_coeff_read_ctrl_raw() argument
825 struct cs_dsp *dsp = ctl->dsp; in cs_dsp_coeff_read_ctrl_raw()
830 ret = cs_dsp_coeff_base_reg(ctl, &reg, off); in cs_dsp_coeff_read_ctrl_raw()
864 int cs_dsp_coeff_read_ctrl(struct cs_dsp_coeff_ctl *ctl, in cs_dsp_coeff_read_ctrl() argument
869 if (!ctl) in cs_dsp_coeff_read_ctrl()
872 lockdep_assert_held(&ctl->dsp->pwr_lock); in cs_dsp_coeff_read_ctrl()
874 if (len + off * sizeof(u32) > ctl->len) in cs_dsp_coeff_read_ctrl()
877 if (ctl->flags & WMFW_CTL_FLAG_VOLATILE) { in cs_dsp_coeff_read_ctrl()
878 if (ctl->enabled && ctl->dsp->running) in cs_dsp_coeff_read_ctrl()
879 return cs_dsp_coeff_read_ctrl_raw(ctl, off, buf, len); in cs_dsp_coeff_read_ctrl()
883 if (!ctl->flags && ctl->enabled && ctl->dsp->running) in cs_dsp_coeff_read_ctrl()
884 ret = cs_dsp_coeff_read_ctrl_raw(ctl, 0, ctl->cache, ctl->len); in cs_dsp_coeff_read_ctrl()
886 if (buf != ctl->cache) in cs_dsp_coeff_read_ctrl()
887 memcpy(buf, ctl->cache + off * sizeof(u32), len); in cs_dsp_coeff_read_ctrl()
896 struct cs_dsp_coeff_ctl *ctl; in cs_dsp_coeff_init_control_caches() local
899 list_for_each_entry(ctl, &dsp->ctl_list, list) { in cs_dsp_coeff_init_control_caches()
900 if (!ctl->enabled || ctl->set) in cs_dsp_coeff_init_control_caches()
902 if (ctl->flags & WMFW_CTL_FLAG_VOLATILE) in cs_dsp_coeff_init_control_caches()
910 if (!ctl->flags || (ctl->flags & WMFW_CTL_FLAG_READABLE)) { in cs_dsp_coeff_init_control_caches()
911 ret = cs_dsp_coeff_read_ctrl_raw(ctl, 0, ctl->cache, ctl->len); in cs_dsp_coeff_init_control_caches()
922 struct cs_dsp_coeff_ctl *ctl; in cs_dsp_coeff_sync_controls() local
925 list_for_each_entry(ctl, &dsp->ctl_list, list) { in cs_dsp_coeff_sync_controls()
926 if (!ctl->enabled) in cs_dsp_coeff_sync_controls()
928 if (ctl->set && !(ctl->flags & WMFW_CTL_FLAG_VOLATILE)) { in cs_dsp_coeff_sync_controls()
929 ret = cs_dsp_coeff_write_ctrl_raw(ctl, 0, ctl->cache, in cs_dsp_coeff_sync_controls()
930 ctl->len); in cs_dsp_coeff_sync_controls()
942 struct cs_dsp_coeff_ctl *ctl; in cs_dsp_signal_event_controls() local
945 list_for_each_entry(ctl, &dsp->ctl_list, list) { in cs_dsp_signal_event_controls()
946 if (ctl->type != WMFW_CTL_TYPE_HOSTEVENT) in cs_dsp_signal_event_controls()
949 if (!ctl->enabled) in cs_dsp_signal_event_controls()
952 ret = cs_dsp_coeff_write_acked_control(ctl, event); in cs_dsp_signal_event_controls()
956 event, ctl->alg_region.alg, ret); in cs_dsp_signal_event_controls()
960 static void cs_dsp_free_ctl_blk(struct cs_dsp_coeff_ctl *ctl) in cs_dsp_free_ctl_blk() argument
962 kfree(ctl->cache); in cs_dsp_free_ctl_blk()
963 kfree(ctl->subname); in cs_dsp_free_ctl_blk()
964 kfree(ctl); in cs_dsp_free_ctl_blk()
973 struct cs_dsp_coeff_ctl *ctl; in cs_dsp_create_control() local
976 list_for_each_entry(ctl, &dsp->ctl_list, list) { in cs_dsp_create_control()
977 if (ctl->fw_name == dsp->fw_name && in cs_dsp_create_control()
978 ctl->alg_region.alg == alg_region->alg && in cs_dsp_create_control()
979 ctl->alg_region.type == alg_region->type) { in cs_dsp_create_control()
980 if ((!subname && !ctl->subname) || in cs_dsp_create_control()
981 (subname && (ctl->subname_len == subname_len) && in cs_dsp_create_control()
982 !strncmp(ctl->subname, subname, ctl->subname_len))) { in cs_dsp_create_control()
983 if (!ctl->enabled) in cs_dsp_create_control()
984 ctl->enabled = 1; in cs_dsp_create_control()
990 ctl = kzalloc(sizeof(*ctl), GFP_KERNEL); in cs_dsp_create_control()
991 if (!ctl) in cs_dsp_create_control()
994 ctl->fw_name = dsp->fw_name; in cs_dsp_create_control()
995 ctl->alg_region = *alg_region; in cs_dsp_create_control()
997 ctl->subname_len = subname_len; in cs_dsp_create_control()
998 ctl->subname = kasprintf(GFP_KERNEL, "%.*s", subname_len, subname); in cs_dsp_create_control()
999 if (!ctl->subname) { in cs_dsp_create_control()
1004 ctl->enabled = 1; in cs_dsp_create_control()
1005 ctl->set = 0; in cs_dsp_create_control()
1006 ctl->dsp = dsp; in cs_dsp_create_control()
1008 ctl->flags = flags; in cs_dsp_create_control()
1009 ctl->type = type; in cs_dsp_create_control()
1010 ctl->offset = offset; in cs_dsp_create_control()
1011 ctl->len = len; in cs_dsp_create_control()
1012 ctl->cache = kzalloc(ctl->len, GFP_KERNEL); in cs_dsp_create_control()
1013 if (!ctl->cache) { in cs_dsp_create_control()
1018 list_add(&ctl->list, &dsp->ctl_list); in cs_dsp_create_control()
1021 ret = dsp->client_ops->control_add(ctl); in cs_dsp_create_control()
1029 list_del(&ctl->list); in cs_dsp_create_control()
1030 kfree(ctl->cache); in cs_dsp_create_control()
1032 kfree(ctl->subname); in cs_dsp_create_control()
1034 kfree(ctl); in cs_dsp_create_control()
1544 struct cs_dsp_coeff_ctl *ctl; in cs_dsp_ctl_fixup_base() local
1546 list_for_each_entry(ctl, &dsp->ctl_list, list) { in cs_dsp_ctl_fixup_base()
1547 if (ctl->fw_name == dsp->fw_name && in cs_dsp_ctl_fixup_base()
1548 alg_region->alg == ctl->alg_region.alg && in cs_dsp_ctl_fixup_base()
1549 alg_region->type == ctl->alg_region.type) { in cs_dsp_ctl_fixup_base()
1550 ctl->alg_region.base = alg_region->base; in cs_dsp_ctl_fixup_base()
2364 struct cs_dsp_coeff_ctl *ctl; in cs_dsp_adsp1_power_down() local
2381 list_for_each_entry(ctl, &dsp->ctl_list, list) in cs_dsp_adsp1_power_down()
2382 ctl->enabled = 0; in cs_dsp_adsp1_power_down()
2641 struct cs_dsp_coeff_ctl *ctl; in cs_dsp_power_down() local
2655 list_for_each_entry(ctl, &dsp->ctl_list, list) in cs_dsp_power_down()
2656 ctl->enabled = 0; in cs_dsp_power_down()
2876 struct cs_dsp_coeff_ctl *ctl; in cs_dsp_remove() local
2879 ctl = list_first_entry(&dsp->ctl_list, struct cs_dsp_coeff_ctl, list); in cs_dsp_remove()
2882 dsp->client_ops->control_remove(ctl); in cs_dsp_remove()
2884 list_del(&ctl->list); in cs_dsp_remove()
2885 cs_dsp_free_ctl_blk(ctl); in cs_dsp_remove()