1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
|
/* SPDX-License-Identifier: (GPL-2.0-only OR BSD-3-Clause) */
/*
* This file is provided under a dual BSD/GPLv2 license. When using or
* redistributing this file, you may do so under either license.
*
* Copyright(c) 2022 Intel Corporation
*/
#ifndef __SOUND_SOC_SOF_IPC4_PRIV_H
#define __SOUND_SOC_SOF_IPC4_PRIV_H
#include <linux/idr.h>
#include <sound/sof/ext_manifest4.h>
#include <sound/sof/ipc4/header.h>
#include "sof-priv.h"
/* The DSP window indices are fixed */
#define SOF_IPC4_INBOX_WINDOW_IDX 0
#define SOF_IPC4_OUTBOX_WINDOW_IDX 1
#define SOF_IPC4_DEBUG_WINDOW_IDX 2
enum sof_ipc4_mtrace_type {
SOF_IPC4_MTRACE_NOT_AVAILABLE = 0,
SOF_IPC4_MTRACE_INTEL_CAVS_1_5,
SOF_IPC4_MTRACE_INTEL_CAVS_1_8,
SOF_IPC4_MTRACE_INTEL_CAVS_2,
};
/**
* struct sof_ipc4_fw_module - IPC4 module info
* @sof_man4_module: Module info
* @fw_mod_cfg: Pointer to the module config start of the module
* @m_ida: Module instance identifier
* @private: Module private data
*/
struct sof_ipc4_fw_module {
struct sof_man4_module man4_module_entry;
const struct sof_man4_module_config *fw_mod_cfg;
struct ida m_ida;
void *private;
};
/**
* struct sof_ipc4_fw_library - IPC4 library information
* @sof_fw: SOF Firmware of the library
* @id: Library ID. 0 is reserved for basefw, external libraries must have unique
* ID number between 1 and (sof_ipc4_fw_data.max_libs_count - 1)
* Note: sof_ipc4_fw_data.max_libs_count == 1 implies that external libraries
* are not supported
* @num_modules : Number of FW modules in the library
* @modules: Array of FW modules
*/
struct sof_ipc4_fw_library {
struct sof_firmware sof_fw;
const char *name;
u32 id;
int num_modules;
struct sof_ipc4_fw_module *modules;
};
struct snd_ipc4_nhlt {
struct list_head list;
void *nhlt;
bool from_acpi;
};
/**
* struct sof_ipc4_fw_data - IPC4-specific data
* @manifest_fw_hdr_offset: FW header offset in the manifest
* @fw_lib_xa: XArray for firmware libraries, including basefw (ID = 0)
* Used to store the FW libraries and to manage the unique IDs of the
* libraries.
* @mtrace_type: mtrace type supported on the booted platform
* @mtrace_log_bytes: log bytes as reported by the firmware via fw_config reply
* @num_playback_streams: max number of playback DMAs, needed for CHAIN_DMA offset
* @num_capture_streams: max number of capture DMAs
* @max_num_pipelines: max number of pipelines
* @max_libs_count: Maximum number of libraries support by the FW including the
* base firmware
* @fw_context_save: Firmware supports full context save and restore
* @libraries_restored: The libraries have been retained during firmware boot
* @nhlt_list: The NHLT tables from the BIOS and the topology manifest
*
* @codec_info: Information about the available codecs in booted firmware. The
* data is to be used by the code for compressed support.
* @load_library: Callback function for platform dependent library loading
* @pipeline_state_mutex: Mutex to protect pipeline triggers, ref counts, states and deletion
*/
struct sof_ipc4_fw_data {
u32 manifest_fw_hdr_offset;
struct xarray fw_lib_xa;
enum sof_ipc4_mtrace_type mtrace_type;
u32 mtrace_log_bytes;
int num_playback_streams;
int num_capture_streams;
int max_num_pipelines;
u32 max_libs_count;
bool fw_context_save;
bool libraries_restored;
struct list_head nhlt_list;
void *codec_info;
int (*load_library)(struct snd_sof_dev *sdev,
struct sof_ipc4_fw_library *fw_lib, bool reload);
void (*intel_configure_mic_privacy)(struct snd_sof_dev *sdev,
struct sof_ipc4_intel_mic_privacy_cap *caps);
struct mutex pipeline_state_mutex; /* protect pipeline triggers, ref counts and states */
};
/**
* struct sof_ipc4_timestamp_info - IPC4 timestamp info
* @host_copier: the host copier of the pcm stream
* @dai_copier: the dai copier of the pcm stream
* @stream_start_offset: reported by fw in memory window (converted to
* frames at host_copier sampling rate)
* @stream_end_offset: reported by fw in memory window (converted to
* frames at host_copier sampling rate)
* @llp_offset: llp offset in memory window
* @delay: Calculated and stored in pointer callback. The stored value is
* returned in the delay callback. Expressed in frames at host copier
* sampling rate.
*/
struct sof_ipc4_timestamp_info {
struct sof_ipc4_copier *host_copier;
struct sof_ipc4_copier *dai_copier;
u64 stream_start_offset;
u64 stream_end_offset;
u32 llp_offset;
snd_pcm_sframes_t delay;
};
extern const struct sof_ipc_fw_loader_ops ipc4_loader_ops;
extern const struct sof_ipc_tplg_ops ipc4_tplg_ops;
extern const struct sof_ipc_tplg_control_ops tplg_ipc4_control_ops;
extern const struct sof_ipc_pcm_ops ipc4_pcm_ops;
extern const struct sof_ipc_fw_tracing_ops ipc4_mtrace_ops;
#if IS_ENABLED(CONFIG_SND_SOC_SOF_COMPRESS)
extern const struct snd_compress_ops sof_ipc4_compressed_ops;
#endif
int sof_ipc4_set_pipeline_state(struct snd_sof_dev *sdev, u32 instance_id, u32 state);
int sof_ipc4_mtrace_update_pos(struct snd_sof_dev *sdev, int core);
int sof_ipc4_complete_split_release(struct snd_sof_dev *sdev);
int sof_ipc4_query_fw_configuration(struct snd_sof_dev *sdev);
int sof_ipc4_reload_fw_libraries(struct snd_sof_dev *sdev);
struct sof_ipc4_fw_module *sof_ipc4_find_module_by_uuid(struct snd_sof_dev *sdev,
const guid_t *uuid);
struct snd_sof_widget *sof_ipc4_find_swidget_by_ids(struct snd_sof_dev *sdev,
u32 module_id, int instance_id);
struct sof_ipc4_base_module_cfg;
void sof_ipc4_update_cpc_from_manifest(struct snd_sof_dev *sdev,
struct sof_ipc4_fw_module *fw_module,
struct sof_ipc4_base_module_cfg *basecfg);
size_t sof_ipc4_find_debug_slot_offset_by_type(struct snd_sof_dev *sdev,
u32 slot_type);
void sof_ipc4_mic_privacy_state_change(struct snd_sof_dev *sdev, bool state);
enum sof_ipc4_pipeline_state;
const char *sof_ipc4_pipeline_state_str(enum sof_ipc4_pipeline_state state);
struct sof_ipc4_timestamp_info *sof_ipc4_sps_to_time_info(struct snd_sof_pcm_stream *sps);
void sof_ipc4_build_time_info(struct snd_sof_dev *sdev, struct snd_sof_pcm_stream *sps);
int sof_ipc4_get_stream_start_offset(struct snd_sof_dev *sdev,
struct snd_pcm_substream *substream,
struct snd_sof_pcm_stream *sps,
struct sof_ipc4_timestamp_info *time_info);
u64 sof_ipc4_frames_dai_to_host(struct sof_ipc4_timestamp_info *time_info, u64 value);
#if IS_ENABLED(CONFIG_SND_SOC_SOF_COMPRESS)
void sof_ipc4_compr_drain_done(struct snd_sof_dev *sdev, void *ipc_message);
#else
static inline void sof_ipc4_compr_drain_done(struct snd_sof_dev *sdev,
void *ipc_message) { }
#endif
#endif
|