[PATCH 16/17] ASoC: Intel: avs: Code loading over CLDMA

Cezary Rojewski cezary.rojewski at intel.com
Fri Feb 25 20:38:43 CET 2022


On 2022-02-25 3:21 AM, Pierre-Louis Bossart wrote:
> 
>> +int avs_cldma_load_library(struct avs_dev *adev, struct firmware *lib, u32 id)
>> +{
>> +	struct hda_cldma *cl = &code_loader;
>> +	int ret;
>> +
>> +	hda_cldma_set_data(cl, (void *)lib->data, lib->size);
>> +	/* transfer modules manifest */
>> +	hda_cldma_transfer(cl, msecs_to_jiffies(AVS_CLDMA_START_DELAY_MS));
>> +	/* DMA id ignored as there is only ever one code-loader DMA */
> 
> consider adding new lines to make comments more readable. this is a bit
> of an eyesore.


Ack.

>> +	ret = avs_ipc_load_library(adev, 0, id);
>> +	hda_cldma_stop(cl);
>> +
>> +	if (ret) {
>> +		ret = AVS_IPC_RET(ret);
>> +		dev_err(adev->dev, "transfer lib %d failed: %d\n", id, ret);
>> +	}
>> +
>> +	return ret;
>> +}
>> +
>> +static int avs_cldma_load_module(struct avs_dev *adev, struct avs_module_entry *mentry)
>> +{
>> +	struct hda_cldma *cl = &code_loader;
>> +	const struct firmware *mod;
>> +	char mod_name[128];
> 
> use kasprintf?


Good idea, ack!

>> +	int ret;
>> +
>> +	snprintf(mod_name, sizeof(mod_name), "%s/%s/dsp_mod_%pUL.bin",
>> +		 AVS_ROOT_DIR, adev->spec->name, mentry->uuid.b);
>> +
>> +	ret = avs_request_firmware(adev, &mod, mod_name);
>> +	if (ret < 0)
>> +		return ret;
>> +
>> +	hda_cldma_set_data(cl, (void *)mod->data, mod->size);
>> +	hda_cldma_transfer(cl, msecs_to_jiffies(AVS_CLDMA_START_DELAY_MS));
>> +	ret = avs_ipc_load_modules(adev, &mentry->module_id, 1);
>> +	hda_cldma_stop(cl);
>> +
>> +	if (ret) {
>> +		dev_err(adev->dev, "load module %d failed: %d\n", mentry->module_id,
>> +			ret);
>> +		return AVS_IPC_RET(ret);
>> +	}
>> +
>> +	return 0;
>> +}
> 


More information about the Alsa-devel mailing list