Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

firmware: cs_dsp: mock_bin: Add function to create long-offset patches

Add cs_dsp_mock_bin_add_patch_off32(). This is the same as
cs_dsp_mock_bin_add_patch() except that it puts the offset in the
new 32-bit offset field and modifies the block type to indicate
that it uses the long offset.

Signed-off-by: Richard Fitzgerald <rf@opensource.cirrus.com>
Link: https://patch.msgid.link/20251231172711.450024-6-rf@opensource.cirrus.com
Signed-off-by: Mark Brown <broonie@kernel.org>

authored by

Richard Fitzgerald and committed by
Mark Brown
880f1eb5 9e6f4c5b

+32
+28
drivers/firmware/cirrus/test/cs_dsp_mock_bin.c
··· 164 164 EXPORT_SYMBOL_NS_GPL(cs_dsp_mock_bin_add_patch, "FW_CS_DSP_KUNIT_TEST_UTILS"); 165 165 166 166 /** 167 + * cs_dsp_mock_bin_add_patch_off32() - Add a patch data block with 32-bit offset. 168 + * 169 + * @builder: Pointer to struct cs_dsp_mock_bin_builder. 170 + * @alg_id: Algorithm ID for the patch. 171 + * @alg_ver: Algorithm version for the patch. 172 + * @mem_region: Memory region for the patch. 173 + * @reg_addr_offset: Offset to start of data in register addresses. 174 + * @payload_data: Pointer to buffer containing the payload data. 175 + * @payload_len_bytes: Length of payload data in bytes. 176 + */ 177 + void cs_dsp_mock_bin_add_patch_off32(struct cs_dsp_mock_bin_builder *builder, 178 + unsigned int alg_id, unsigned int alg_ver, 179 + int mem_region, unsigned int reg_addr_offset, 180 + const void *payload_data, size_t payload_len_bytes) 181 + { 182 + /* Payload length must be a multiple of 4 */ 183 + KUNIT_ASSERT_EQ(builder->test_priv->test, payload_len_bytes % 4, 0); 184 + 185 + /* Mark the block as using the 32-bit offset */ 186 + mem_region |= 0xf400; 187 + 188 + cs_dsp_mock_bin_add_raw_block(builder, alg_id, alg_ver, 189 + mem_region, 0, reg_addr_offset, 190 + payload_data, payload_len_bytes); 191 + } 192 + EXPORT_SYMBOL_NS_GPL(cs_dsp_mock_bin_add_patch_off32, "FW_CS_DSP_KUNIT_TEST_UTILS"); 193 + 194 + /** 167 195 * cs_dsp_mock_bin_init() - Initialize a struct cs_dsp_mock_bin_builder. 168 196 * 169 197 * @priv: Pointer to struct cs_dsp_test.
+4
include/linux/firmware/cirrus/cs_dsp_test_utils.h
··· 136 136 unsigned int alg_id, unsigned int alg_ver, 137 137 int mem_region, unsigned int reg_addr_offset, 138 138 const void *payload_data, size_t payload_len_bytes); 139 + void cs_dsp_mock_bin_add_patch_off32(struct cs_dsp_mock_bin_builder *builder, 140 + unsigned int alg_id, unsigned int alg_ver, 141 + int mem_region, unsigned int reg_addr_offset, 142 + const void *payload_data, size_t payload_len_bytes); 139 143 struct firmware *cs_dsp_mock_bin_get_firmware(struct cs_dsp_mock_bin_builder *builder); 140 144 141 145 struct cs_dsp_mock_wmfw_builder *cs_dsp_mock_wmfw_init(struct cs_dsp_test *priv,