2019-06-04 16:11:23 +08:00
|
|
|
/* SPDX-License-Identifier: GPL-2.0-only */
|
2015-07-10 00:08:54 +08:00
|
|
|
/*
|
|
|
|
* Intel SKL IPC Support
|
|
|
|
*
|
|
|
|
* Copyright (C) 2014-15, Intel Corporation.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef __SKL_IPC_H
|
|
|
|
#define __SKL_IPC_H
|
|
|
|
|
|
|
|
#include <linux/irqreturn.h>
|
|
|
|
#include "../common/sst-ipc.h"
|
2019-07-23 22:58:48 +08:00
|
|
|
#include "skl-sst-dsp.h"
|
2015-07-10 00:08:54 +08:00
|
|
|
|
|
|
|
struct sst_dsp;
|
|
|
|
struct sst_generic_ipc;
|
|
|
|
|
|
|
|
enum skl_ipc_pipeline_state {
|
|
|
|
PPL_INVALID_STATE = 0,
|
|
|
|
PPL_UNINITIALIZED = 1,
|
|
|
|
PPL_RESET = 2,
|
|
|
|
PPL_PAUSED = 3,
|
|
|
|
PPL_RUNNING = 4,
|
|
|
|
PPL_ERROR_STOP = 5,
|
|
|
|
PPL_SAVED = 6,
|
|
|
|
PPL_RESTORED = 7
|
|
|
|
};
|
|
|
|
|
|
|
|
struct skl_ipc_dxstate_info {
|
|
|
|
u32 core_mask;
|
|
|
|
u32 dx_mask;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct skl_ipc_header {
|
|
|
|
u32 primary;
|
|
|
|
u32 extension;
|
|
|
|
};
|
|
|
|
|
2016-06-21 12:47:41 +08:00
|
|
|
struct skl_dsp_cores {
|
|
|
|
unsigned int count;
|
2017-08-03 00:21:13 +08:00
|
|
|
enum skl_dsp_states *state;
|
|
|
|
int *usage_count;
|
2016-06-21 12:47:41 +08:00
|
|
|
};
|
|
|
|
|
2016-11-03 19:37:17 +08:00
|
|
|
/**
|
|
|
|
* skl_d0i3_data: skl D0i3 counters data struct
|
|
|
|
*
|
|
|
|
* @streaming: Count of usecases that can attempt streaming D0i3
|
|
|
|
* @non_streaming: Count of usecases that can attempt non-streaming D0i3
|
|
|
|
* @non_d0i3: Count of usecases that cannot attempt D0i3
|
|
|
|
* @state: current state
|
|
|
|
* @work: D0i3 worker thread
|
|
|
|
*/
|
|
|
|
struct skl_d0i3_data {
|
|
|
|
int streaming;
|
|
|
|
int non_streaming;
|
|
|
|
int non_d0i3;
|
|
|
|
enum skl_dsp_d0i3_states state;
|
|
|
|
struct delayed_work work;
|
|
|
|
};
|
|
|
|
|
2017-03-25 01:40:31 +08:00
|
|
|
#define SKL_LIB_NAME_LENGTH 128
|
|
|
|
#define SKL_MAX_LIB 16
|
|
|
|
|
|
|
|
struct skl_lib_info {
|
|
|
|
char name[SKL_LIB_NAME_LENGTH];
|
|
|
|
const struct firmware *fw;
|
|
|
|
};
|
|
|
|
|
2015-07-10 00:08:54 +08:00
|
|
|
struct skl_ipc_init_instance_msg {
|
|
|
|
u32 module_id;
|
|
|
|
u32 instance_id;
|
|
|
|
u16 param_data_size;
|
|
|
|
u8 ppl_instance_id;
|
|
|
|
u8 core_id;
|
2016-07-26 20:36:50 +08:00
|
|
|
u8 domain;
|
2015-07-10 00:08:54 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
struct skl_ipc_bind_unbind_msg {
|
|
|
|
u32 module_id;
|
|
|
|
u32 instance_id;
|
|
|
|
u32 dst_module_id;
|
|
|
|
u32 dst_instance_id;
|
|
|
|
u8 src_queue;
|
|
|
|
u8 dst_queue;
|
|
|
|
bool bind;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct skl_ipc_large_config_msg {
|
|
|
|
u32 module_id;
|
|
|
|
u32 instance_id;
|
|
|
|
u32 large_param_id;
|
|
|
|
u32 param_data_size;
|
|
|
|
};
|
|
|
|
|
2016-11-03 19:37:15 +08:00
|
|
|
struct skl_ipc_d0ix_msg {
|
|
|
|
u32 module_id;
|
|
|
|
u32 instance_id;
|
|
|
|
u8 streaming;
|
|
|
|
u8 wake;
|
|
|
|
};
|
|
|
|
|
2015-07-10 00:08:54 +08:00
|
|
|
#define SKL_IPC_BOOT_MSECS 3000
|
|
|
|
|
|
|
|
#define SKL_IPC_D3_MASK 0
|
|
|
|
#define SKL_IPC_D0_MASK 3
|
|
|
|
|
|
|
|
irqreturn_t skl_dsp_irq_thread_handler(int irq, void *context);
|
|
|
|
|
2020-08-14 04:01:47 +08:00
|
|
|
int skl_ipc_create_pipeline(struct sst_generic_ipc *ipc,
|
2016-11-03 19:37:18 +08:00
|
|
|
u16 ppl_mem_size, u8 ppl_type, u8 instance_id, u8 lp_mode);
|
2015-07-10 00:08:54 +08:00
|
|
|
|
2020-08-14 04:01:47 +08:00
|
|
|
int skl_ipc_delete_pipeline(struct sst_generic_ipc *ipc, u8 instance_id);
|
2015-07-10 00:08:54 +08:00
|
|
|
|
2020-08-14 04:01:47 +08:00
|
|
|
int skl_ipc_set_pipeline_state(struct sst_generic_ipc *ipc,
|
2015-07-10 00:08:54 +08:00
|
|
|
u8 instance_id, enum skl_ipc_pipeline_state state);
|
|
|
|
|
|
|
|
int skl_ipc_save_pipeline(struct sst_generic_ipc *ipc,
|
|
|
|
u8 instance_id, int dma_id);
|
|
|
|
|
|
|
|
int skl_ipc_restore_pipeline(struct sst_generic_ipc *ipc, u8 instance_id);
|
|
|
|
|
2020-08-14 04:01:47 +08:00
|
|
|
int skl_ipc_init_instance(struct sst_generic_ipc *ipc,
|
2015-07-10 00:08:54 +08:00
|
|
|
struct skl_ipc_init_instance_msg *msg, void *param_data);
|
|
|
|
|
2020-08-14 04:01:47 +08:00
|
|
|
int skl_ipc_bind_unbind(struct sst_generic_ipc *ipc,
|
2015-07-10 00:08:54 +08:00
|
|
|
struct skl_ipc_bind_unbind_msg *msg);
|
|
|
|
|
2015-12-04 01:59:50 +08:00
|
|
|
int skl_ipc_load_modules(struct sst_generic_ipc *ipc,
|
|
|
|
u8 module_cnt, void *data);
|
|
|
|
|
|
|
|
int skl_ipc_unload_modules(struct sst_generic_ipc *ipc,
|
|
|
|
u8 module_cnt, void *data);
|
|
|
|
|
2015-07-10 00:08:54 +08:00
|
|
|
int skl_ipc_set_dx(struct sst_generic_ipc *ipc,
|
|
|
|
u8 instance_id, u16 module_id, struct skl_ipc_dxstate_info *dx);
|
|
|
|
|
|
|
|
int skl_ipc_set_large_config(struct sst_generic_ipc *ipc,
|
|
|
|
struct skl_ipc_large_config_msg *msg, u32 *param);
|
|
|
|
|
2015-12-04 01:59:55 +08:00
|
|
|
int skl_ipc_get_large_config(struct sst_generic_ipc *ipc,
|
2019-08-09 02:15:49 +08:00
|
|
|
struct skl_ipc_large_config_msg *msg,
|
|
|
|
u32 **payload, size_t *bytes);
|
2015-12-04 01:59:55 +08:00
|
|
|
|
2016-07-26 20:36:47 +08:00
|
|
|
int skl_sst_ipc_load_library(struct sst_generic_ipc *ipc,
|
2017-04-25 14:48:23 +08:00
|
|
|
u8 dma_id, u8 table_id, bool wait);
|
2016-07-26 20:36:47 +08:00
|
|
|
|
2016-11-03 19:37:15 +08:00
|
|
|
int skl_ipc_set_d0ix(struct sst_generic_ipc *ipc,
|
|
|
|
struct skl_ipc_d0ix_msg *msg);
|
|
|
|
|
2016-11-03 19:37:20 +08:00
|
|
|
int skl_ipc_check_D0i0(struct sst_dsp *dsp, bool state);
|
|
|
|
|
2020-08-14 04:01:47 +08:00
|
|
|
void skl_ipc_int_enable(struct sst_dsp *ctx);
|
2015-07-10 00:08:54 +08:00
|
|
|
void skl_ipc_op_int_enable(struct sst_dsp *ctx);
|
2015-10-09 16:01:50 +08:00
|
|
|
void skl_ipc_op_int_disable(struct sst_dsp *ctx);
|
2020-08-14 04:01:47 +08:00
|
|
|
void skl_ipc_int_disable(struct sst_dsp *ctx);
|
2015-07-10 00:08:54 +08:00
|
|
|
|
2020-08-14 04:01:47 +08:00
|
|
|
bool skl_ipc_int_status(struct sst_dsp *ctx);
|
2015-07-10 00:08:54 +08:00
|
|
|
void skl_ipc_free(struct sst_generic_ipc *ipc);
|
2019-07-23 22:58:48 +08:00
|
|
|
int skl_ipc_init(struct device *dev, struct skl_dev *skl);
|
2016-06-03 20:59:39 +08:00
|
|
|
void skl_clear_module_cnt(struct sst_dsp *ctx);
|
2015-07-10 00:08:54 +08:00
|
|
|
|
2017-08-03 00:21:17 +08:00
|
|
|
void skl_ipc_process_reply(struct sst_generic_ipc *ipc,
|
|
|
|
struct skl_ipc_header header);
|
|
|
|
int skl_ipc_process_notification(struct sst_generic_ipc *ipc,
|
|
|
|
struct skl_ipc_header header);
|
|
|
|
void skl_ipc_tx_data_copy(struct ipc_message *msg, char *tx_data,
|
|
|
|
size_t tx_size);
|
2015-07-10 00:08:54 +08:00
|
|
|
#endif /* __SKL_IPC_H */
|