Skip to content

Commit

Permalink
dma: Add max block count attribute
Browse files Browse the repository at this point in the history
Adds an attribute that describes the maximum number of scatter gather
blocks that the DMA will accept. Useful in cases where DMA is used as
the abstraction for moving data around (e.g. SoF audio streams) and
variances of the hardware need to inform decisions about how to use
the DMA API.

Co-authored-by: Adrian Bonislawski <adrian.bonislawski@intel.com>
Co-authored-by: Jaska Uimonen <jaska.uimonen@intel.com>
Signed-off-by: Tom Burdick <thomas.burdick@intel.com>
  • Loading branch information
3 people authored and carlescufi committed Dec 14, 2022
1 parent 17d3f3a commit 603cc27
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 0 deletions.
3 changes: 3 additions & 0 deletions drivers/dma/dma_intel_adsp_gpdma.c
Original file line number Diff line number Diff line change
Expand Up @@ -292,6 +292,9 @@ int intel_adsp_gpdma_get_attribute(const struct device *dev, uint32_t type, uint
case DMA_ATTR_COPY_ALIGNMENT:
*value = DMA_COPY_ALIGNMENT(DT_COMPAT_GET_ANY_STATUS_OKAY(intel_adsp_gpdma));
break;
case DMA_ATTR_MAX_BLOCK_COUNT:
*value = CONFIG_DMA_DW_LLI_POOL_SIZE;
break;
default:
return -EINVAL;
}
Expand Down
3 changes: 3 additions & 0 deletions drivers/dma/dma_intel_adsp_hda.c
Original file line number Diff line number Diff line change
Expand Up @@ -280,6 +280,9 @@ int intel_adsp_hda_dma_get_attribute(const struct device *dev, uint32_t type, ui
case DMA_ATTR_COPY_ALIGNMENT:
*value = DMA_COPY_ALIGNMENT(DT_COMPAT_GET_ANY_STATUS_OKAY(intel_adsp_hda_link_out));
break;
case DMA_ATTR_MAX_BLOCK_COUNT:
*value = 1;
break;
default:
return -EINVAL;
}
Expand Down
1 change: 1 addition & 0 deletions include/zephyr/drivers/dma.h
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ enum dma_attribute_type {
DMA_ATTR_BUFFER_ADDRESS_ALIGNMENT,
DMA_ATTR_BUFFER_SIZE_ALIGNMENT,
DMA_ATTR_COPY_ALIGNMENT,
DMA_ATTR_MAX_BLOCK_COUNT,
};

/**
Expand Down

0 comments on commit 603cc27

Please sign in to comment.