0001
0002
0003
0004
0005
0006
0007
0008 #ifndef __SND_SOC_INTEL_CATPT_MSG_H
0009 #define __SND_SOC_INTEL_CATPT_MSG_H
0010
0011 struct catpt_dev;
0012
0013
0014
0015 enum catpt_reply_status {
0016 CATPT_REPLY_SUCCESS = 0,
0017 CATPT_REPLY_ERROR_INVALID_PARAM = 1,
0018 CATPT_REPLY_UNKNOWN_MESSAGE_TYPE = 2,
0019 CATPT_REPLY_OUT_OF_RESOURCES = 3,
0020 CATPT_REPLY_BUSY = 4,
0021 CATPT_REPLY_PENDING = 5,
0022 CATPT_REPLY_FAILURE = 6,
0023 CATPT_REPLY_INVALID_REQUEST = 7,
0024 CATPT_REPLY_UNINITIALIZED = 8,
0025 CATPT_REPLY_NOT_FOUND = 9,
0026 CATPT_REPLY_SOURCE_NOT_STARTED = 10,
0027 };
0028
0029
0030
0031 enum catpt_global_msg_type {
0032 CATPT_GLB_GET_FW_VERSION = 0,
0033 CATPT_GLB_ALLOCATE_STREAM = 3,
0034 CATPT_GLB_FREE_STREAM = 4,
0035 CATPT_GLB_STREAM_MESSAGE = 6,
0036 CATPT_GLB_REQUEST_CORE_DUMP = 7,
0037 CATPT_GLB_SET_DEVICE_FORMATS = 10,
0038 CATPT_GLB_ENTER_DX_STATE = 12,
0039 CATPT_GLB_GET_MIXER_STREAM_INFO = 13,
0040 };
0041
0042 union catpt_global_msg {
0043 u32 val;
0044 struct {
0045 u32 status:5;
0046 u32 context:19;
0047 u32 global_msg_type:5;
0048 u32 fw_ready:1;
0049 u32 done:1;
0050 u32 busy:1;
0051 };
0052 } __packed;
0053
0054 #define CATPT_MSG(hdr) { .val = hdr }
0055 #define CATPT_GLOBAL_MSG(msg_type) \
0056 { .global_msg_type = CATPT_GLB_##msg_type }
0057
0058 #define BUILD_HASH_SIZE 40
0059
0060 struct catpt_fw_version {
0061 u8 build;
0062 u8 minor;
0063 u8 major;
0064 u8 type;
0065 u8 build_hash[BUILD_HASH_SIZE];
0066 u32 log_providers_hash;
0067 } __packed;
0068
0069 int catpt_ipc_get_fw_version(struct catpt_dev *cdev,
0070 struct catpt_fw_version *version);
0071
0072 enum catpt_pin_id {
0073 CATPT_PIN_ID_SYSTEM = 0,
0074 CATPT_PIN_ID_REFERENCE = 1,
0075 CATPT_PIN_ID_CAPTURE1 = 2,
0076 CATPT_PIN_ID_CAPTURE2 = 3,
0077 CATPT_PIN_ID_OFFLOAD1 = 4,
0078 CATPT_PIN_ID_OFFLOAD2 = 5,
0079 CATPT_PIN_ID_MIXER = 7,
0080 CATPT_PIN_ID_BLUETOOTH_CAPTURE = 8,
0081 CATPT_PIN_ID_BLUETOOTH_RENDER = 9,
0082 };
0083
0084 enum catpt_path_id {
0085 CATPT_PATH_SSP0_OUT = 0,
0086 CATPT_PATH_SSP0_IN = 1,
0087 CATPT_PATH_SSP1_OUT = 2,
0088 CATPT_PATH_SSP1_IN = 3,
0089
0090 CATPT_PATH_SSP0_IN_DUP = 4,
0091 };
0092
0093 enum catpt_stream_type {
0094 CATPT_STRM_TYPE_RENDER = 0,
0095 CATPT_STRM_TYPE_SYSTEM = 1,
0096 CATPT_STRM_TYPE_CAPTURE = 2,
0097 CATPT_STRM_TYPE_LOOPBACK = 3,
0098 CATPT_STRM_TYPE_BLUETOOTH_RENDER = 4,
0099 CATPT_STRM_TYPE_BLUETOOTH_CAPTURE = 5,
0100 };
0101
0102 enum catpt_format_id {
0103 CATPT_FORMAT_PCM = 0,
0104 CATPT_FORMAT_MP3 = 1,
0105 CATPT_FORMAT_AAC = 2,
0106 CATPT_FORMAT_WMA = 3,
0107 };
0108
0109 enum catpt_channel_index {
0110 CATPT_CHANNEL_LEFT = 0x0,
0111 CATPT_CHANNEL_CENTER = 0x1,
0112 CATPT_CHANNEL_RIGHT = 0x2,
0113 CATPT_CHANNEL_LEFT_SURROUND = 0x3,
0114 CATPT_CHANNEL_CENTER_SURROUND = 0x3,
0115 CATPT_CHANNEL_RIGHT_SURROUND = 0x4,
0116 CATPT_CHANNEL_LFE = 0x7,
0117 CATPT_CHANNEL_INVALID = 0xF,
0118 };
0119
0120 enum catpt_channel_config {
0121 CATPT_CHANNEL_CONFIG_MONO = 0,
0122 CATPT_CHANNEL_CONFIG_STEREO = 1,
0123 CATPT_CHANNEL_CONFIG_2_POINT_1 = 2,
0124 CATPT_CHANNEL_CONFIG_3_POINT_0 = 3,
0125 CATPT_CHANNEL_CONFIG_3_POINT_1 = 4,
0126 CATPT_CHANNEL_CONFIG_QUATRO = 5,
0127 CATPT_CHANNEL_CONFIG_4_POINT_0 = 6,
0128 CATPT_CHANNEL_CONFIG_5_POINT_0 = 7,
0129 CATPT_CHANNEL_CONFIG_5_POINT_1 = 8,
0130 CATPT_CHANNEL_CONFIG_DUAL_MONO = 9,
0131 CATPT_CHANNEL_CONFIG_INVALID = 10,
0132 };
0133
0134 enum catpt_interleaving_style {
0135 CATPT_INTERLEAVING_PER_CHANNEL = 0,
0136 CATPT_INTERLEAVING_PER_SAMPLE = 1,
0137 };
0138
0139 struct catpt_audio_format {
0140 u32 sample_rate;
0141 u32 bit_depth;
0142 u32 channel_map;
0143 u32 channel_config;
0144 u32 interleaving;
0145 u8 num_channels;
0146 u8 valid_bit_depth;
0147 u8 reserved[2];
0148 } __packed;
0149
0150 struct catpt_ring_info {
0151 u32 page_table_addr;
0152 u32 num_pages;
0153 u32 size;
0154 u32 offset;
0155 u32 ring_first_page_pfn;
0156 } __packed;
0157
0158 #define CATPT_MODULE_COUNT (CATPT_MODID_LAST + 1)
0159
0160 enum catpt_module_id {
0161 CATPT_MODID_BASE_FW = 0x0,
0162 CATPT_MODID_MP3 = 0x1,
0163 CATPT_MODID_AAC_5_1 = 0x2,
0164 CATPT_MODID_AAC_2_0 = 0x3,
0165 CATPT_MODID_SRC = 0x4,
0166 CATPT_MODID_WAVES = 0x5,
0167 CATPT_MODID_DOLBY = 0x6,
0168 CATPT_MODID_BOOST = 0x7,
0169 CATPT_MODID_LPAL = 0x8,
0170 CATPT_MODID_DTS = 0x9,
0171 CATPT_MODID_PCM_CAPTURE = 0xA,
0172 CATPT_MODID_PCM_SYSTEM = 0xB,
0173 CATPT_MODID_PCM_REFERENCE = 0xC,
0174 CATPT_MODID_PCM = 0xD,
0175 CATPT_MODID_BLUETOOTH_RENDER = 0xE,
0176 CATPT_MODID_BLUETOOTH_CAPTURE = 0xF,
0177 CATPT_MODID_LAST = CATPT_MODID_BLUETOOTH_CAPTURE,
0178 };
0179
0180 struct catpt_module_entry {
0181 u32 module_id;
0182 u32 entry_point;
0183 } __packed;
0184
0185 struct catpt_module_map {
0186 u8 num_entries;
0187 struct catpt_module_entry entries[];
0188 } __packed;
0189
0190 struct catpt_memory_info {
0191 u32 offset;
0192 u32 size;
0193 } __packed;
0194
0195 #define CATPT_CHANNELS_MAX 4
0196 #define CATPT_ALL_CHANNELS_MASK UINT_MAX
0197
0198 struct catpt_stream_info {
0199 u32 stream_hw_id;
0200 u32 reserved;
0201 u32 read_pos_regaddr;
0202 u32 pres_pos_regaddr;
0203 u32 peak_meter_regaddr[CATPT_CHANNELS_MAX];
0204 u32 volume_regaddr[CATPT_CHANNELS_MAX];
0205 } __packed;
0206
0207 int catpt_ipc_alloc_stream(struct catpt_dev *cdev,
0208 enum catpt_path_id path_id,
0209 enum catpt_stream_type type,
0210 struct catpt_audio_format *afmt,
0211 struct catpt_ring_info *rinfo,
0212 u8 num_modules,
0213 struct catpt_module_entry *modules,
0214 struct resource *persistent,
0215 struct resource *scratch,
0216 struct catpt_stream_info *sinfo);
0217 int catpt_ipc_free_stream(struct catpt_dev *cdev, u8 stream_hw_id);
0218
0219 enum catpt_ssp_iface {
0220 CATPT_SSP_IFACE_0 = 0,
0221 CATPT_SSP_IFACE_1 = 1,
0222 CATPT_SSP_COUNT,
0223 };
0224
0225 enum catpt_mclk_frequency {
0226 CATPT_MCLK_OFF = 0,
0227 CATPT_MCLK_FREQ_6_MHZ = 1,
0228 CATPT_MCLK_FREQ_21_MHZ = 2,
0229 CATPT_MCLK_FREQ_24_MHZ = 3,
0230 };
0231
0232 enum catpt_ssp_mode {
0233 CATPT_SSP_MODE_I2S_CONSUMER = 0,
0234 CATPT_SSP_MODE_I2S_PROVIDER = 1,
0235 CATPT_SSP_MODE_TDM_PROVIDER = 2,
0236 };
0237
0238 struct catpt_ssp_device_format {
0239 u32 iface;
0240 u32 mclk;
0241 u32 mode;
0242 u16 clock_divider;
0243 u8 channels;
0244 } __packed;
0245
0246 int catpt_ipc_set_device_format(struct catpt_dev *cdev,
0247 struct catpt_ssp_device_format *devfmt);
0248
0249 enum catpt_dx_state {
0250 CATPT_DX_STATE_D3 = 3,
0251 };
0252
0253 enum catpt_dx_type {
0254 CATPT_DX_TYPE_FW_IMAGE = 0,
0255 CATPT_DX_TYPE_MEMORY_DUMP = 1,
0256 };
0257
0258 struct catpt_save_meminfo {
0259 u32 offset;
0260 u32 size;
0261 u32 source;
0262 } __packed;
0263
0264 #define SAVE_MEMINFO_MAX 14
0265
0266 struct catpt_dx_context {
0267 u32 num_meminfo;
0268 struct catpt_save_meminfo meminfo[SAVE_MEMINFO_MAX];
0269 } __packed;
0270
0271 int catpt_ipc_enter_dxstate(struct catpt_dev *cdev, enum catpt_dx_state state,
0272 struct catpt_dx_context *context);
0273
0274 struct catpt_mixer_stream_info {
0275 u32 mixer_hw_id;
0276 u32 peak_meter_regaddr[CATPT_CHANNELS_MAX];
0277 u32 volume_regaddr[CATPT_CHANNELS_MAX];
0278 } __packed;
0279
0280 int catpt_ipc_get_mixer_stream_info(struct catpt_dev *cdev,
0281 struct catpt_mixer_stream_info *info);
0282
0283
0284
0285 enum catpt_stream_msg_type {
0286 CATPT_STRM_RESET_STREAM = 0,
0287 CATPT_STRM_PAUSE_STREAM = 1,
0288 CATPT_STRM_RESUME_STREAM = 2,
0289 CATPT_STRM_STAGE_MESSAGE = 3,
0290 CATPT_STRM_NOTIFICATION = 4,
0291 };
0292
0293 enum catpt_stage_action {
0294 CATPT_STG_SET_VOLUME = 1,
0295 CATPT_STG_SET_WRITE_POSITION = 2,
0296 CATPT_STG_MUTE_LOOPBACK = 3,
0297 };
0298
0299 union catpt_stream_msg {
0300 u32 val;
0301 struct {
0302 u32 status:5;
0303 u32 reserved:7;
0304 u32 stage_action:4;
0305 u32 stream_hw_id:4;
0306 u32 stream_msg_type:4;
0307 u32 global_msg_type:5;
0308 u32 fw_ready:1;
0309 u32 done:1;
0310 u32 busy:1;
0311 };
0312 } __packed;
0313
0314 #define CATPT_STREAM_MSG(msg_type) \
0315 { \
0316 .stream_msg_type = CATPT_STRM_##msg_type, \
0317 .global_msg_type = CATPT_GLB_STREAM_MESSAGE }
0318 #define CATPT_STAGE_MSG(msg_type) \
0319 { \
0320 .stage_action = CATPT_STG_##msg_type, \
0321 .stream_msg_type = CATPT_STRM_STAGE_MESSAGE, \
0322 .global_msg_type = CATPT_GLB_STREAM_MESSAGE }
0323
0324 int catpt_ipc_reset_stream(struct catpt_dev *cdev, u8 stream_hw_id);
0325 int catpt_ipc_pause_stream(struct catpt_dev *cdev, u8 stream_hw_id);
0326 int catpt_ipc_resume_stream(struct catpt_dev *cdev, u8 stream_hw_id);
0327
0328
0329
0330 enum catpt_audio_curve_type {
0331 CATPT_AUDIO_CURVE_NONE = 0,
0332 CATPT_AUDIO_CURVE_WINDOWS_FADE = 1,
0333 };
0334
0335 int catpt_ipc_set_volume(struct catpt_dev *cdev, u8 stream_hw_id,
0336 u32 channel, u32 volume,
0337 u32 curve_duration,
0338 enum catpt_audio_curve_type curve_type);
0339
0340 int catpt_ipc_set_write_pos(struct catpt_dev *cdev, u8 stream_hw_id,
0341 u32 pos, bool eob, bool ll);
0342
0343 int catpt_ipc_mute_loopback(struct catpt_dev *cdev, u8 stream_hw_id, bool mute);
0344
0345
0346
0347 enum catpt_notify_reason {
0348 CATPT_NOTIFY_POSITION_CHANGED = 0,
0349 CATPT_NOTIFY_GLITCH_OCCURRED = 1,
0350 };
0351
0352 union catpt_notify_msg {
0353 u32 val;
0354 struct {
0355 u32 mailbox_address:29;
0356 u32 fw_ready:1;
0357 u32 done:1;
0358 u32 busy:1;
0359 };
0360 struct {
0361 u32 status:5;
0362 u32 reserved:7;
0363 u32 notify_reason:4;
0364 u32 stream_hw_id:4;
0365 u32 stream_msg_type:4;
0366 u32 global_msg_type:5;
0367 u32 hdr:3;
0368 };
0369 } __packed;
0370
0371 #define FW_INFO_SIZE_MAX 100
0372
0373 struct catpt_fw_ready {
0374 u32 inbox_offset;
0375 u32 outbox_offset;
0376 u32 inbox_size;
0377 u32 outbox_size;
0378 u32 fw_info_size;
0379 char fw_info[FW_INFO_SIZE_MAX];
0380 } __packed;
0381
0382 struct catpt_notify_position {
0383 u32 stream_position;
0384 u32 fw_cycle_count;
0385 } __packed;
0386
0387 enum catpt_glitch_type {
0388 CATPT_GLITCH_UNDERRUN = 1,
0389 CATPT_GLITCH_DECODER_ERROR = 2,
0390 CATPT_GLITCH_DOUBLED_WRITE_POS = 3,
0391 };
0392
0393 struct catpt_notify_glitch {
0394 u32 type;
0395 u64 presentation_pos;
0396 u32 write_pos;
0397 } __packed;
0398
0399 #endif