Skip to content

Commit 9fd2e11

Browse files
ujfalusicarlescufi
authored andcommitted
drivers: dma: intel-adsp-hda: Report total_copied bytes on ACE2/3
With ACE2/3 the HDA DMA includes registers to read the Linear Link Position. Previous platforms (CAVS, ACE1) was able to report the LLP for GPDMA. Since ACE2 all links are handled with HD-DMA, hence the new register has been added for the firmware to report the LLP to the host. Set the total_copied to 0 for older ACE1/CAVS platforms and in case of host DMA on ACE2/3 since the informatiojn is not available. Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
1 parent fda97de commit 9fd2e11

File tree

2 files changed

+25
-0
lines changed

2 files changed

+25
-0
lines changed

drivers/dma/dma_intel_adsp_hda.c

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -219,6 +219,8 @@ int intel_adsp_hda_dma_status(const struct device *dev, uint32_t channel,
219219
struct dma_status *stat)
220220
{
221221
const struct intel_adsp_hda_dma_cfg *const cfg = dev->config;
222+
uint32_t llp_l = 0;
223+
uint32_t llp_u = 0;
222224
bool xrun_det;
223225

224226
__ASSERT(channel < cfg->dma_channels, "Channel does not exist");
@@ -233,6 +235,22 @@ int intel_adsp_hda_dma_status(const struct device *dev, uint32_t channel,
233235
stat->pending_length = used;
234236
stat->free = unused;
235237

238+
#if CONFIG_SOC_INTEL_ACE20_LNL || CONFIG_SOC_INTEL_ACE30_PTL
239+
/* Linear Link Position via HDA-DMA is only supported on ACE2 or newer */
240+
if (cfg->direction == MEMORY_TO_PERIPHERAL || cfg->direction == PERIPHERAL_TO_MEMORY) {
241+
uint32_t tmp;
242+
243+
tmp = *DGLLLPL(cfg->base, cfg->regblock_size, channel);
244+
llp_u = *DGLLLPU(cfg->base, cfg->regblock_size, channel);
245+
llp_l = *DGLLLPL(cfg->base, cfg->regblock_size, channel);
246+
if (tmp > llp_l) {
247+
/* re-read the LLPU value, as LLPL just wrapped */
248+
llp_u = *DGLLLPU(cfg->base, cfg->regblock_size, channel);
249+
}
250+
}
251+
#endif
252+
stat->total_copied = ((uint64_t)llp_u << 32) | llp_l;
253+
236254
switch (cfg->direction) {
237255
case MEMORY_TO_PERIPHERAL:
238256
xrun_det = intel_adsp_hda_is_buffer_underrun(cfg->base, cfg->regblock_size,

soc/intel/intel_adsp/common/include/intel_adsp_hda.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,13 @@
8989
#define DGLPIBI(base, regblock_size, stream) \
9090
((volatile uint32_t *)(HDA_ADDR(base, regblock_size, stream) + 0x28))
9191

92+
/* Gateway Linear Link Position registers (ACE2 and onwards */
93+
#define DGLLLPL(base, regblock_size, stream) \
94+
((volatile uint32_t *)(HDA_ADDR(base, regblock_size, stream) + 0x20))
95+
96+
#define DGLLLPU(base, regblock_size, stream) \
97+
((volatile uint32_t *)(HDA_ADDR(base, regblock_size, stream) + 0x24))
98+
9299
/**
93100
* @brief Dump all the useful registers of an HDA stream to printk
94101
*

0 commit comments

Comments
 (0)