Re: [PATCH v2 14/14] ASoC: qcom: q6apm: Add support for early buffer mapping on DSP
From: Srinivas Kandagatla
Date: Wed Mar 04 2026 - 06:12:22 EST
On 2/24/26 10:16 AM, Konrad Dybcio wrote:
> On 2/23/26 7:07 PM, Srinivas Kandagatla wrote:
>> Buffers are allocated on pcm_new and mapped in the dsp on every prepare call,
>> which is inefficient and unnecessary.
>>
>> Add new functions q6apm_[un]map_memory_fixed_region to map it on
>> to dsp only once after allocation.
>>
>> Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@xxxxxxxxxxxxxxxx>
>> ---
>
> [...]
>
>> -int q6apm_map_memory_regions(struct q6apm_graph *graph, unsigned int dir, phys_addr_t phys,
>> - size_t period_sz, unsigned int periods)
>> +int q6apm_set_memory_map_handle(struct q6apm_graph *graph, unsigned int dir)
>> +{
>> + if (dir == SNDRV_PCM_STREAM_PLAYBACK)
>> + graph->rx_data.mem_map_handle = graph->info->mem_map_handle;
>> + else
>> + graph->tx_data.mem_map_handle = graph->info->mem_map_handle;
>> +
>> + return 0;
>> +}
>
> This doesn't return a useful value today, will it ever?
return type should be void.
>
> [...]
>
>
>> + case APM_CMD_SHARED_MEM_UNMAP_REGIONS:
>> + apm->result.opcode = hdr->opcode;
>> + apm->result.status = 0;
>> + rsp = data->payload;
>> +
>> + info = idr_find(&apm->graph_info_idr, hdr->token);
>> + if (info)
>> + info->mem_map_handle = 0;
>> + else
>> + dev_err(dev, "Error (%d) Processing 0x%08x cmd\n", result->status,
>> + result->opcode);
>> +
>> + dev_err(dev, "Memory Map region %x\n", rsp->mem_map_handle);
>
> Looks like a debug leftover (also in the below 'case')
Right, will fix that in next spin.
--srini
>
> Konrad