summaryrefslogtreecommitdiff
path: root/sound/soc/amd/raven/acp3x.h
diff options
context:
space:
mode:
authorRavulapati Vishnu vardhan rao <Vishnuvardhanrao.Ravulapati@amd.com>2019-12-28 16:40:55 +0300
committerMark Brown <broonie@kernel.org>2019-12-31 03:22:12 +0300
commitc9fe7db6e884d0ab8c55d4ed4660fb19400acf2e (patch)
tree0ba6c3b2000232fe9de3ddc03ec1a852fc71f1bb /sound/soc/amd/raven/acp3x.h
parent3863857dd5ca3e60685c6b49a7873fda727ff233 (diff)
downloadlinux-c9fe7db6e884d0ab8c55d4ed4660fb19400acf2e.tar.xz
ASoC: amd: Refactoring of DAI from DMA driver
ASoC: PCM DMA driver should only have dma ops. So Removed all DAI related functionality.Refactoring the PCM DMA diver code.Added new file containing only DAI ops Signed-off-by: Ravulapati Vishnu vardhan rao <Vishnuvardhanrao.Ravulapati@amd.com> Link: https://lore.kernel.org/r/1577540460-21438-2-git-send-email-Vishnuvardhanrao.Ravulapati@amd.com Signed-off-by: Mark Brown <broonie@kernel.org>
Diffstat (limited to 'sound/soc/amd/raven/acp3x.h')
-rw-r--r--sound/soc/amd/raven/acp3x.h44
1 files changed, 44 insertions, 0 deletions
diff --git a/sound/soc/amd/raven/acp3x.h b/sound/soc/amd/raven/acp3x.h
index 2f15fe10ead5..a1f03fce68fa 100644
--- a/sound/soc/amd/raven/acp3x.h
+++ b/sound/soc/amd/raven/acp3x.h
@@ -6,6 +6,7 @@
*/
#include "chip_offset_byte.h"
+#include <sound/pcm.h>
#define ACP3x_DEVS 3
#define ACP3x_PHY_BASE_ADDRESS 0x1240000
@@ -51,6 +52,30 @@
#define SLOT_WIDTH_24 0x18
#define SLOT_WIDTH_32 0x20
+struct acp3x_platform_info {
+ u16 play_i2s_instance;
+ u16 cap_i2s_instance;
+ u16 capture_channel;
+};
+
+struct i2s_dev_data {
+ bool tdm_mode;
+ unsigned int i2s_irq;
+ u32 tdm_fmt;
+ u32 substream_type;
+ void __iomem *acp3x_base;
+ struct snd_pcm_substream *play_stream;
+ struct snd_pcm_substream *capture_stream;
+};
+
+struct i2s_stream_instance {
+ u16 num_pages;
+ u16 channels;
+ u32 xfer_resolution;
+ u64 bytescount;
+ dma_addr_t dma_addr;
+ void __iomem *acp3x_base;
+};
static inline u32 rv_readl(void __iomem *base_addr)
{
@@ -61,3 +86,22 @@ static inline void rv_writel(u32 val, void __iomem *base_addr)
{
writel(val, base_addr - ACP3x_PHY_BASE_ADDRESS);
}
+
+static inline u64 acp_get_byte_count(struct i2s_stream_instance *rtd,
+ int direction)
+{
+ u64 byte_count;
+
+ if (direction == SNDRV_PCM_STREAM_PLAYBACK) {
+ byte_count = rv_readl(rtd->acp3x_base +
+ mmACP_BT_TX_LINEARPOSITIONCNTR_HIGH);
+ byte_count |= rv_readl(rtd->acp3x_base +
+ mmACP_BT_TX_LINEARPOSITIONCNTR_LOW);
+ } else {
+ byte_count = rv_readl(rtd->acp3x_base +
+ mmACP_BT_RX_LINEARPOSITIONCNTR_HIGH);
+ byte_count |= rv_readl(rtd->acp3x_base +
+ mmACP_BT_RX_LINEARPOSITIONCNTR_LOW);
+ }
+ return byte_count;
+}