static const struct cs_dsp_ops cs_dsp_adsp2_ops[];
static const struct cs_dsp_ops cs_dsp_halo_ops;
+static const struct cs_dsp_client_ops wm_adsp1_client_ops;
+static const struct cs_dsp_client_ops wm_adsp2_client_ops;
+
struct cs_dsp_buf {
struct list_head list;
void *buf;
list_add(&ctl->list, &dsp->ctl_list);
- ret = wm_adsp_control_add(ctl);
- if (ret)
- goto err_list_del;
+ if (dsp->client_ops->control_add) {
+ ret = dsp->client_ops->control_add(ctl);
+ if (ret)
+ goto err_list_del;
+ }
return 0;
{
int ret;
+ dsp->cs_dsp.client_ops = &wm_adsp1_client_ops;
+
ret = cs_dsp_adsp1_init(&dsp->cs_dsp);
if (ret)
return ret;
dsp->running = true;
- ret = wm_adsp_event_post_run(dsp);
- if (ret < 0)
- goto err;
+ if (dsp->client_ops->post_run) {
+ ret = dsp->client_ops->post_run(dsp);
+ if (ret)
+ goto err;
+ }
mutex_unlock(&dsp->pwr_lock);
if (dsp->ops->disable_core)
dsp->ops->disable_core(dsp);
- wm_adsp_event_post_stop(dsp);
+ if (dsp->client_ops->post_stop)
+ dsp->client_ops->post_stop(dsp);
mutex_unlock(&dsp->pwr_lock);
INIT_WORK(&dsp->boot_work, wm_adsp_boot_work);
dsp->sys_config_size = sizeof(struct wm_adsp_system_config_xm_hdr);
+ dsp->cs_dsp.client_ops = &wm_adsp2_client_ops;
ret = cs_dsp_adsp2_init(&dsp->cs_dsp);
if (ret)
INIT_WORK(&dsp->boot_work, wm_adsp_boot_work);
dsp->sys_config_size = sizeof(struct wm_halo_system_config_xm_hdr);
+ dsp->cs_dsp.client_ops = &wm_adsp2_client_ops;
ret = cs_dsp_halo_init(&dsp->cs_dsp);
if (ret)
while (!list_empty(&dsp->ctl_list)) {
ctl = list_first_entry(&dsp->ctl_list, struct cs_dsp_coeff_ctl, list);
- wm_adsp_control_remove(ctl);
+ if (dsp->client_ops->control_remove)
+ dsp->client_ops->control_remove(ctl);
list_del(&ctl->list);
cs_dsp_free_ctl_blk(ctl);
if (val & ADSP2_WDT_TIMEOUT_STS_MASK) {
cs_dsp_err(dsp, "watchdog timeout error\n");
dsp->ops->stop_watchdog(dsp);
- wm_adsp_fatal_error(dsp);
+ if (dsp->client_ops->watchdog_expired)
+ dsp->client_ops->watchdog_expired(dsp);
}
if (val & (ADSP2_ADDR_ERR_MASK | ADSP2_REGION_LOCK_ERR_MASK)) {
cs_dsp_warn(dsp, "WDT Expiry Fault\n");
dsp->ops->stop_watchdog(dsp);
- wm_adsp_fatal_error(dsp);
+ if (dsp->client_ops->watchdog_expired)
+ dsp->client_ops->watchdog_expired(dsp);
mutex_unlock(&dsp->pwr_lock);
}
.region_to_reg = cs_dsp_region_to_reg,
};
+static const struct cs_dsp_client_ops wm_adsp1_client_ops = {
+ .control_add = wm_adsp_control_add,
+ .control_remove = wm_adsp_control_remove,
+};
+
static const struct cs_dsp_ops cs_dsp_adsp2_ops[] = {
{
.parse_sizes = cs_dsp_adsp2_parse_sizes,
.stop_core = cs_dsp_halo_stop_core,
};
+static const struct cs_dsp_client_ops wm_adsp2_client_ops = {
+ .control_add = wm_adsp_control_add,
+ .control_remove = wm_adsp_control_remove,
+ .post_run = wm_adsp_event_post_run,
+ .post_stop = wm_adsp_event_post_stop,
+ .watchdog_expired = wm_adsp_fatal_error,
+};
+
MODULE_LICENSE("GPL v2");
struct wm_adsp_compr;
struct wm_adsp_compr_buf;
struct cs_dsp_ops;
+struct cs_dsp_client_ops;
struct cs_dsp_coeff_ctl {
const char *fw_name;
struct regmap *regmap;
const struct cs_dsp_ops *ops;
+ const struct cs_dsp_client_ops *client_ops;
unsigned int base;
unsigned int base_sysinfo;
int wm_adsp_read_ctl(struct wm_adsp *dsp, const char *name, int type,
unsigned int alg, void *buf, size_t len);
+struct cs_dsp_client_ops {
+ int (*control_add)(struct cs_dsp_coeff_ctl *ctl);
+ void (*control_remove)(struct cs_dsp_coeff_ctl *ctl);
+ int (*post_run)(struct cs_dsp *dsp);
+ void (*post_stop)(struct cs_dsp *dsp);
+ void (*watchdog_expired)(struct cs_dsp *dsp);
+};
+
#endif