|
12 | 12 | #include <ipc4/pipeline.h> |
13 | 13 | #include <ipc4/logging.h> |
14 | 14 | #include <ipc/topology.h> |
| 15 | +#include <ipc/compress_params.h> |
15 | 16 | #include <sof_versions.h> |
16 | 17 | #include <sof/lib/cpu-clk-manager.h> |
17 | 18 | #include <sof/lib/cpu.h> |
@@ -65,6 +66,63 @@ __cold static uint32_t get_host_buffer_size(void) |
65 | 66 | return periods; |
66 | 67 | } |
67 | 68 |
|
| 69 | +struct sof_ipc4_codec_info_data { |
| 70 | + uint32_t count; |
| 71 | + uint32_t items[32]; |
| 72 | +} __packed __aligned(4); |
| 73 | + |
| 74 | +#define SET_CODEC_INFO_ITEM(codec, dir) (((codec) & 0xff) | (((dir) & 0xff) << 16)) |
| 75 | + |
| 76 | +static void get_codec_info(struct sof_tlv **tuple) |
| 77 | +{ |
| 78 | + struct sof_ipc4_codec_info_data codec_info = { 0 }; |
| 79 | + |
| 80 | +#ifdef CONFIG_CADENCE_CODEC_AAC_DEC |
| 81 | + codec_info.items[codec_info.count++] = |
| 82 | + SET_CODEC_INFO_ITEM(SND_AUDIOCODEC_AAC, SOF_IPC_STREAM_PLAYBACK); |
| 83 | +#endif |
| 84 | +#ifdef CONFIG_CADENCE_CODEC_MP3_DEC |
| 85 | + codec_info.items[codec_info.count++] = |
| 86 | + SET_CODEC_INFO_ITEM(SND_AUDIOCODEC_MP3, SOF_IPC_STREAM_PLAYBACK); |
| 87 | +#endif |
| 88 | +#ifdef CONFIG_CADENCE_CODEC_MP3_ENC |
| 89 | + codec_info.items[codec_info.count++] = |
| 90 | + SET_CODEC_INFO_ITEM(SND_AUDIOCODEC_MP3, SOF_IPC_STREAM_CAPTURE); |
| 91 | +#endif |
| 92 | +#ifdef CONFIG_CADENCE_CODEC_VORBIS_DEC |
| 93 | + codec_info.items[codec_info.count++] = |
| 94 | + SET_CODEC_INFO_ITEM(SND_AUDIOCODEC_VORBIS, SOF_IPC_STREAM_PLAYBACK); |
| 95 | +#endif |
| 96 | + |
| 97 | + if (!codec_info.count) |
| 98 | + return; |
| 99 | + |
| 100 | + tlv_value_set(*tuple, IPC4_SOF_CODEC_INFO, sizeof(codec_info.count) + |
| 101 | + sizeof(codec_info.items[0]) * codec_info.count, &codec_info); |
| 102 | + |
| 103 | + *tuple = tlv_next(*tuple); |
| 104 | +} |
| 105 | + |
| 106 | +#define SOF_CONFIG_MEMBER_SIZE(struct_name) (sizeof(struct sof_tlv) + \ |
| 107 | + sizeof(struct struct_name)) |
| 108 | +#define SOF_CONFIG_SIZE_MAX (SOF_CONFIG_MEMBER_SIZE(sof_ipc4_codec_info_data)) |
| 109 | + |
| 110 | +static void base_fw_sof_config(struct sof_tlv **tuple) |
| 111 | +{ |
| 112 | + char sof_config_data[SOF_CONFIG_SIZE_MAX] = { 0 }; |
| 113 | + struct sof_tlv *sof_config_tuple = (struct sof_tlv *)sof_config_data; |
| 114 | + uint32_t sof_config_size; |
| 115 | + |
| 116 | + get_codec_info(&sof_config_tuple); |
| 117 | + sof_config_size = (uint32_t)((char *)sof_config_tuple - sof_config_data); |
| 118 | + if (sof_config_size == 0) |
| 119 | + return; |
| 120 | + |
| 121 | + tlv_value_set(*tuple, IPC4_FW_SOF_INFO, sof_config_size, sof_config_data); |
| 122 | + |
| 123 | + *tuple = tlv_next(*tuple); |
| 124 | +} |
| 125 | + |
68 | 126 | __cold static int basefw_config(uint32_t *data_offset, char *data) |
69 | 127 | { |
70 | 128 | uint16_t version[4] = {SOF_MAJOR, SOF_MINOR, SOF_MICRO, SOF_BUILD}; |
@@ -150,6 +208,8 @@ __cold static int basefw_config(uint32_t *data_offset, char *data) |
150 | 208 |
|
151 | 209 | tuple = tlv_next(tuple); |
152 | 210 |
|
| 211 | + base_fw_sof_config(&tuple); |
| 212 | + |
153 | 213 | /* add platform specific tuples */ |
154 | 214 | basefw_vendor_fw_config(&plat_data_offset, (char *)tuple); |
155 | 215 |
|
|
0 commit comments