162306a36Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0-only */
262306a36Sopenharmony_ci/*
362306a36Sopenharmony_ci * Copyright (c) 2010-2011,2013-2015 The Linux Foundation. All rights reserved.
462306a36Sopenharmony_ci */
562306a36Sopenharmony_ci
662306a36Sopenharmony_ci#ifndef __LPASS_LPAIF_REG_H__
762306a36Sopenharmony_ci#define __LPASS_LPAIF_REG_H__
862306a36Sopenharmony_ci
962306a36Sopenharmony_ci/* LPAIF I2S */
1062306a36Sopenharmony_ci
1162306a36Sopenharmony_ci#define LPAIF_I2SCTL_REG_ADDR(v, addr, port) \
1262306a36Sopenharmony_ci	(v->i2sctrl_reg_base + (addr) + v->i2sctrl_reg_stride * (port))
1362306a36Sopenharmony_ci
1462306a36Sopenharmony_ci#define LPAIF_I2SCTL_REG(v, port)	LPAIF_I2SCTL_REG_ADDR(v, 0x0, (port))
1562306a36Sopenharmony_ci
1662306a36Sopenharmony_ci#define LPAIF_I2SCTL_LOOPBACK_DISABLE	0
1762306a36Sopenharmony_ci#define LPAIF_I2SCTL_LOOPBACK_ENABLE	1
1862306a36Sopenharmony_ci
1962306a36Sopenharmony_ci#define LPAIF_I2SCTL_SPKEN_DISABLE	0
2062306a36Sopenharmony_ci#define LPAIF_I2SCTL_SPKEN_ENABLE	1
2162306a36Sopenharmony_ci
2262306a36Sopenharmony_ci#define LPAIF_I2SCTL_MODE_NONE		0
2362306a36Sopenharmony_ci#define LPAIF_I2SCTL_MODE_SD0		1
2462306a36Sopenharmony_ci#define LPAIF_I2SCTL_MODE_SD1		2
2562306a36Sopenharmony_ci#define LPAIF_I2SCTL_MODE_SD2		3
2662306a36Sopenharmony_ci#define LPAIF_I2SCTL_MODE_SD3		4
2762306a36Sopenharmony_ci#define LPAIF_I2SCTL_MODE_QUAD01	5
2862306a36Sopenharmony_ci#define LPAIF_I2SCTL_MODE_QUAD23	6
2962306a36Sopenharmony_ci#define LPAIF_I2SCTL_MODE_6CH		7
3062306a36Sopenharmony_ci#define LPAIF_I2SCTL_MODE_8CH		8
3162306a36Sopenharmony_ci#define LPAIF_I2SCTL_MODE_10CH		9
3262306a36Sopenharmony_ci#define LPAIF_I2SCTL_MODE_12CH		10
3362306a36Sopenharmony_ci#define LPAIF_I2SCTL_MODE_14CH		11
3462306a36Sopenharmony_ci#define LPAIF_I2SCTL_MODE_16CH		12
3562306a36Sopenharmony_ci#define LPAIF_I2SCTL_MODE_SD4		13
3662306a36Sopenharmony_ci#define LPAIF_I2SCTL_MODE_SD5		14
3762306a36Sopenharmony_ci#define LPAIF_I2SCTL_MODE_SD6		15
3862306a36Sopenharmony_ci#define LPAIF_I2SCTL_MODE_SD7		16
3962306a36Sopenharmony_ci#define LPAIF_I2SCTL_MODE_QUAD45	17
4062306a36Sopenharmony_ci#define LPAIF_I2SCTL_MODE_QUAD47	18
4162306a36Sopenharmony_ci#define LPAIF_I2SCTL_MODE_8CH_2		19
4262306a36Sopenharmony_ci
4362306a36Sopenharmony_ci#define LPAIF_I2SCTL_SPKMODE(mode)	mode
4462306a36Sopenharmony_ci
4562306a36Sopenharmony_ci#define LPAIF_I2SCTL_SPKMONO_STEREO	0
4662306a36Sopenharmony_ci#define LPAIF_I2SCTL_SPKMONO_MONO	1
4762306a36Sopenharmony_ci
4862306a36Sopenharmony_ci#define LPAIF_I2SCTL_MICEN_DISABLE	0
4962306a36Sopenharmony_ci#define LPAIF_I2SCTL_MICEN_ENABLE	1
5062306a36Sopenharmony_ci
5162306a36Sopenharmony_ci#define LPAIF_I2SCTL_MICMODE(mode)	mode
5262306a36Sopenharmony_ci
5362306a36Sopenharmony_ci#define LPAIF_I2SCTL_MICMONO_STEREO	0
5462306a36Sopenharmony_ci#define LPAIF_I2SCTL_MICMONO_MONO	1
5562306a36Sopenharmony_ci
5662306a36Sopenharmony_ci#define LPAIF_I2SCTL_WSSRC_INTERNAL	0
5762306a36Sopenharmony_ci#define LPAIF_I2SCTL_WSSRC_EXTERNAL	1
5862306a36Sopenharmony_ci
5962306a36Sopenharmony_ci#define LPAIF_I2SCTL_BITWIDTH_16	0
6062306a36Sopenharmony_ci#define LPAIF_I2SCTL_BITWIDTH_24	1
6162306a36Sopenharmony_ci#define LPAIF_I2SCTL_BITWIDTH_32	2
6262306a36Sopenharmony_ci
6362306a36Sopenharmony_ci#define LPAIF_I2SCTL_RESET_STATE	0x003C0004
6462306a36Sopenharmony_ci#define LPAIF_DMACTL_RESET_STATE	0x00200000
6562306a36Sopenharmony_ci
6662306a36Sopenharmony_ci
6762306a36Sopenharmony_ci/* LPAIF IRQ */
6862306a36Sopenharmony_ci#define LPAIF_IRQ_REG_ADDR(v, addr, port) \
6962306a36Sopenharmony_ci	(v->irq_reg_base + (addr) + v->irq_reg_stride * (port))
7062306a36Sopenharmony_ci
7162306a36Sopenharmony_ci#define LPAIF_IRQ_PORT_HOST		0
7262306a36Sopenharmony_ci
7362306a36Sopenharmony_ci#define LPAIF_IRQEN_REG(v, port)	LPAIF_IRQ_REG_ADDR(v, 0x0, (port))
7462306a36Sopenharmony_ci#define LPAIF_IRQSTAT_REG(v, port)	LPAIF_IRQ_REG_ADDR(v, 0x4, (port))
7562306a36Sopenharmony_ci#define LPAIF_IRQCLEAR_REG(v, port)	LPAIF_IRQ_REG_ADDR(v, 0xC, (port))
7662306a36Sopenharmony_ci
7762306a36Sopenharmony_ci/* LPAIF RXTX IRQ */
7862306a36Sopenharmony_ci#define LPAIF_RXTX_IRQ_REG_ADDR(v, addr, port) \
7962306a36Sopenharmony_ci		(v->rxtx_irq_reg_base + (addr) + v->rxtx_irq_reg_stride * (port))
8062306a36Sopenharmony_ci
8162306a36Sopenharmony_ci#define LPAIF_RXTX_IRQEN_REG(v, port) LPAIF_RXTX_IRQ_REG_ADDR(v, 0x0, port)
8262306a36Sopenharmony_ci#define LPAIF_RXTX_IRQSTAT_REG(v, port) LPAIF_RXTX_IRQ_REG_ADDR(v, 0x4, port)
8362306a36Sopenharmony_ci#define LPAIF_RXTX_IRQCLEAR_REG(v, port) LPAIF_RXTX_IRQ_REG_ADDR(v, 0xC, port)
8462306a36Sopenharmony_ci
8562306a36Sopenharmony_ci/* LPAIF VA IRQ */
8662306a36Sopenharmony_ci#define LPAIF_VA_IRQ_REG_ADDR(v, addr, port) \
8762306a36Sopenharmony_ci		(v->va_irq_reg_base + (addr) + v->va_irq_reg_stride * (port))
8862306a36Sopenharmony_ci
8962306a36Sopenharmony_ci#define LPAIF_VA_IRQEN_REG(v, port) LPAIF_VA_IRQ_REG_ADDR(v, 0x0, port)
9062306a36Sopenharmony_ci#define LPAIF_VA_IRQSTAT_REG(v, port) LPAIF_VA_IRQ_REG_ADDR(v, 0x4, port)
9162306a36Sopenharmony_ci#define LPAIF_VA_IRQCLEAR_REG(v, port) LPAIF_VA_IRQ_REG_ADDR(v, 0xC, port)
9262306a36Sopenharmony_ci
9362306a36Sopenharmony_ci#define LPASS_HDMITX_APP_IRQ_REG_ADDR(v, addr)  \
9462306a36Sopenharmony_ci	((v->hdmi_irq_reg_base) + (addr))
9562306a36Sopenharmony_ci
9662306a36Sopenharmony_ci#define LPASS_HDMITX_APP_IRQEN_REG(v)			LPASS_HDMITX_APP_IRQ_REG_ADDR(v, 0x4)
9762306a36Sopenharmony_ci#define LPASS_HDMITX_APP_IRQSTAT_REG(v)			LPASS_HDMITX_APP_IRQ_REG_ADDR(v, 0x8)
9862306a36Sopenharmony_ci#define LPASS_HDMITX_APP_IRQCLEAR_REG(v)		LPASS_HDMITX_APP_IRQ_REG_ADDR(v, 0xC)
9962306a36Sopenharmony_ci
10062306a36Sopenharmony_ci#define LPAIF_IRQ_BITSTRIDE		3
10162306a36Sopenharmony_ci
10262306a36Sopenharmony_ci#define LPAIF_IRQ_PER(chan)		(1 << (LPAIF_IRQ_BITSTRIDE * (chan)))
10362306a36Sopenharmony_ci#define LPAIF_IRQ_XRUN(chan)		(2 << (LPAIF_IRQ_BITSTRIDE * (chan)))
10462306a36Sopenharmony_ci#define LPAIF_IRQ_ERR(chan)		(4 << (LPAIF_IRQ_BITSTRIDE * (chan)))
10562306a36Sopenharmony_ci
10662306a36Sopenharmony_ci#define LPAIF_IRQ_ALL(chan)		(7 << (LPAIF_IRQ_BITSTRIDE * (chan)))
10762306a36Sopenharmony_ci#define LPAIF_IRQ_HDMI_REQ_ON_PRELOAD(chan)	(1 << (14 + chan))
10862306a36Sopenharmony_ci#define LPAIF_IRQ_HDMI_SDEEP_AUD_DIS(chan)	(1 << (24 + chan))
10962306a36Sopenharmony_ci#define LPAIF_IRQ_HDMI_METADONE		BIT(23)
11062306a36Sopenharmony_ci
11162306a36Sopenharmony_ci/* LPAIF DMA */
11262306a36Sopenharmony_ci#define LPAIF_HDMI_RDMA_REG_ADDR(v, addr, chan) \
11362306a36Sopenharmony_ci	(v->hdmi_rdma_reg_base + (addr) + v->hdmi_rdma_reg_stride * (chan))
11462306a36Sopenharmony_ci
11562306a36Sopenharmony_ci#define LPAIF_HDMI_RDMACTL_AUDINTF(id)	(id << LPAIF_RDMACTL_AUDINTF_SHIFT)
11662306a36Sopenharmony_ci
11762306a36Sopenharmony_ci#define LPAIF_HDMI_RDMACTL_REG(v, chan)		LPAIF_HDMI_RDMA_REG_ADDR(v, 0x00, (chan))
11862306a36Sopenharmony_ci#define LPAIF_HDMI_RDMABASE_REG(v, chan)	LPAIF_HDMI_RDMA_REG_ADDR(v, 0x04, (chan))
11962306a36Sopenharmony_ci#define	LPAIF_HDMI_RDMABUFF_REG(v, chan)	LPAIF_HDMI_RDMA_REG_ADDR(v, 0x08, (chan))
12062306a36Sopenharmony_ci#define LPAIF_HDMI_RDMACURR_REG(v, chan)	LPAIF_HDMI_RDMA_REG_ADDR(v, 0x0C, (chan))
12162306a36Sopenharmony_ci#define	LPAIF_HDMI_RDMAPER_REG(v, chan)		LPAIF_HDMI_RDMA_REG_ADDR(v, 0x10, (chan))
12262306a36Sopenharmony_ci#define	LPAIF_HDMI_RDMAPERCNT_REG(v, chan)	LPAIF_HDMI_RDMA_REG_ADDR(v, 0x14, (chan))
12362306a36Sopenharmony_ci
12462306a36Sopenharmony_ci#define LPAIF_RDMA_REG_ADDR(v, addr, chan) \
12562306a36Sopenharmony_ci	(v->rdma_reg_base + (addr) + v->rdma_reg_stride * (chan))
12662306a36Sopenharmony_ci
12762306a36Sopenharmony_ci#define LPAIF_RDMACTL_AUDINTF(id)	(id << LPAIF_RDMACTL_AUDINTF_SHIFT)
12862306a36Sopenharmony_ci
12962306a36Sopenharmony_ci#define LPAIF_RDMACTL_REG(v, chan)	LPAIF_RDMA_REG_ADDR(v, 0x00, (chan))
13062306a36Sopenharmony_ci#define LPAIF_RDMABASE_REG(v, chan)	LPAIF_RDMA_REG_ADDR(v, 0x04, (chan))
13162306a36Sopenharmony_ci#define	LPAIF_RDMABUFF_REG(v, chan)	LPAIF_RDMA_REG_ADDR(v, 0x08, (chan))
13262306a36Sopenharmony_ci#define LPAIF_RDMACURR_REG(v, chan)	LPAIF_RDMA_REG_ADDR(v, 0x0C, (chan))
13362306a36Sopenharmony_ci#define	LPAIF_RDMAPER_REG(v, chan)	LPAIF_RDMA_REG_ADDR(v, 0x10, (chan))
13462306a36Sopenharmony_ci#define	LPAIF_RDMAPERCNT_REG(v, chan)	LPAIF_RDMA_REG_ADDR(v, 0x14, (chan))
13562306a36Sopenharmony_ci
13662306a36Sopenharmony_ci#define LPAIF_WRDMA_REG_ADDR(v, addr, chan) \
13762306a36Sopenharmony_ci	(v->wrdma_reg_base + (addr) + \
13862306a36Sopenharmony_ci	 v->wrdma_reg_stride * (chan - v->wrdma_channel_start))
13962306a36Sopenharmony_ci
14062306a36Sopenharmony_ci#define LPAIF_WRDMACTL_REG(v, chan)	LPAIF_WRDMA_REG_ADDR(v, 0x00, (chan))
14162306a36Sopenharmony_ci#define LPAIF_WRDMABASE_REG(v, chan)	LPAIF_WRDMA_REG_ADDR(v, 0x04, (chan))
14262306a36Sopenharmony_ci#define	LPAIF_WRDMABUFF_REG(v, chan)	LPAIF_WRDMA_REG_ADDR(v, 0x08, (chan))
14362306a36Sopenharmony_ci#define LPAIF_WRDMACURR_REG(v, chan)	LPAIF_WRDMA_REG_ADDR(v, 0x0C, (chan))
14462306a36Sopenharmony_ci#define	LPAIF_WRDMAPER_REG(v, chan)	LPAIF_WRDMA_REG_ADDR(v, 0x10, (chan))
14562306a36Sopenharmony_ci#define	LPAIF_WRDMAPERCNT_REG(v, chan)	LPAIF_WRDMA_REG_ADDR(v, 0x14, (chan))
14662306a36Sopenharmony_ci
14762306a36Sopenharmony_ci#define LPAIF_INTFDMA_REG(v, chan, reg, dai_id)  \
14862306a36Sopenharmony_ci	((dai_id ==  LPASS_DP_RX) ? \
14962306a36Sopenharmony_ci		LPAIF_HDMI_RDMA##reg##_REG(v, chan) : \
15062306a36Sopenharmony_ci		 LPAIF_RDMA##reg##_REG(v, chan))
15162306a36Sopenharmony_ci
15262306a36Sopenharmony_ci#define __LPAIF_DMA_REG(v, chan, dir, reg, dai_id)  \
15362306a36Sopenharmony_ci	((dir ==  SNDRV_PCM_STREAM_PLAYBACK) ? \
15462306a36Sopenharmony_ci		(LPAIF_INTFDMA_REG(v, chan, reg, dai_id)) : \
15562306a36Sopenharmony_ci		LPAIF_WRDMA##reg##_REG(v, chan))
15662306a36Sopenharmony_ci
15762306a36Sopenharmony_ci#define LPAIF_DMACTL_REG(v, chan, dir, dai_id) \
15862306a36Sopenharmony_ci	(is_cdc_dma_port(dai_id) ? \
15962306a36Sopenharmony_ci	__LPAIF_CDC_DMA_REG(v, chan, dir, CTL, dai_id) : \
16062306a36Sopenharmony_ci	__LPAIF_DMA_REG(v, chan, dir, CTL, dai_id))
16162306a36Sopenharmony_ci#define LPAIF_DMABASE_REG(v, chan, dir, dai_id) \
16262306a36Sopenharmony_ci	(is_cdc_dma_port(dai_id) ? \
16362306a36Sopenharmony_ci	__LPAIF_CDC_DMA_REG(v, chan, dir, BASE, dai_id) : \
16462306a36Sopenharmony_ci	__LPAIF_DMA_REG(v, chan, dir, BASE, dai_id))
16562306a36Sopenharmony_ci#define LPAIF_DMABUFF_REG(v, chan, dir, dai_id) \
16662306a36Sopenharmony_ci	(is_cdc_dma_port(dai_id) ? \
16762306a36Sopenharmony_ci	__LPAIF_CDC_DMA_REG(v, chan, dir, BUFF, dai_id) : \
16862306a36Sopenharmony_ci	__LPAIF_DMA_REG(v, chan, dir, BUFF, dai_id))
16962306a36Sopenharmony_ci#define LPAIF_DMACURR_REG(v, chan, dir, dai_id) \
17062306a36Sopenharmony_ci	(is_cdc_dma_port(dai_id) ? \
17162306a36Sopenharmony_ci	__LPAIF_CDC_DMA_REG(v, chan, dir, CURR, dai_id) : \
17262306a36Sopenharmony_ci	__LPAIF_DMA_REG(v, chan, dir, CURR, dai_id))
17362306a36Sopenharmony_ci#define LPAIF_DMAPER_REG(v, chan, dir, dai_id)  \
17462306a36Sopenharmony_ci	(is_cdc_dma_port(dai_id) ? \
17562306a36Sopenharmony_ci	__LPAIF_CDC_DMA_REG(v, chan, dir, PER, dai_id) : \
17662306a36Sopenharmony_ci	__LPAIF_DMA_REG(v, chan, dir, PER, dai_id))
17762306a36Sopenharmony_ci#define LPAIF_DMAPERCNT_REG(v, chan, dir, dai_id) \
17862306a36Sopenharmony_ci	(is_cdc_dma_port(dai_id) ? \
17962306a36Sopenharmony_ci	__LPAIF_CDC_DMA_REG(v, chan, dir, PERCNT, dai_id) : \
18062306a36Sopenharmony_ci	__LPAIF_DMA_REG(v, chan, dir, PERCNT, dai_id))
18162306a36Sopenharmony_ci
18262306a36Sopenharmony_ci#define LPAIF_CDC_RDMA_REG_ADDR(v, addr, chan, dai_id) \
18362306a36Sopenharmony_ci	(is_rxtx_cdc_dma_port(dai_id) ? \
18462306a36Sopenharmony_ci	(v->rxtx_rdma_reg_base + (addr) + v->rxtx_rdma_reg_stride * (chan)) : \
18562306a36Sopenharmony_ci	(v->va_rdma_reg_base + (addr) + v->va_rdma_reg_stride * (chan)))
18662306a36Sopenharmony_ci
18762306a36Sopenharmony_ci#define LPAIF_CDC_RXTX_RDMACTL_REG(v, chan, dai_id) \
18862306a36Sopenharmony_ci		LPAIF_CDC_RDMA_REG_ADDR(v, 0x00, (chan), dai_id)
18962306a36Sopenharmony_ci#define LPAIF_CDC_RXTX_RDMABASE_REG(v, chan, dai_id) \
19062306a36Sopenharmony_ci		LPAIF_CDC_RDMA_REG_ADDR(v, 0x04, (chan), dai_id)
19162306a36Sopenharmony_ci#define LPAIF_CDC_RXTX_RDMABUFF_REG(v, chan, dai_id) \
19262306a36Sopenharmony_ci		LPAIF_CDC_RDMA_REG_ADDR(v, 0x08, (chan), dai_id)
19362306a36Sopenharmony_ci#define LPAIF_CDC_RXTX_RDMACURR_REG(v, chan, dai_id) \
19462306a36Sopenharmony_ci		LPAIF_CDC_RDMA_REG_ADDR(v, 0x0C, (chan), dai_id)
19562306a36Sopenharmony_ci#define LPAIF_CDC_RXTX_RDMAPER_REG(v, chan, dai_id) \
19662306a36Sopenharmony_ci		LPAIF_CDC_RDMA_REG_ADDR(v, 0x10, (chan), dai_id)
19762306a36Sopenharmony_ci#define LPAIF_CDC_RXTX_RDMA_INTF_REG(v, chan, dai_id) \
19862306a36Sopenharmony_ci	LPAIF_CDC_RDMA_REG_ADDR(v, 0x50, (chan), dai_id)
19962306a36Sopenharmony_ci
20062306a36Sopenharmony_ci#define LPAIF_CDC_VA_RDMACTL_REG(v, chan, dai_id) LPAIF_CDC_RDMA_REG_ADDR(v, 0x00, (chan), dai_id)
20162306a36Sopenharmony_ci#define LPAIF_CDC_VA_RDMABASE_REG(v, chan, dai_id) LPAIF_CDC_RDMA_REG_ADDR(v, 0x04, (chan), dai_id)
20262306a36Sopenharmony_ci#define LPAIF_CDC_VA_RDMABUFF_REG(v, chan, dai_id) LPAIF_CDC_RDMA_REG_ADDR(v, 0x08, (chan), dai_id)
20362306a36Sopenharmony_ci#define LPAIF_CDC_VA_RDMACURR_REG(v, chan, dai_id) LPAIF_CDC_RDMA_REG_ADDR(v, 0x0C, (chan), dai_id)
20462306a36Sopenharmony_ci#define LPAIF_CDC_VA_RDMAPER_REG(v, chan, dai_id) LPAIF_CDC_RDMA_REG_ADDR(v, 0x10, (chan), dai_id)
20562306a36Sopenharmony_ci#define LPAIF_CDC_VA_RDMA_INTF_REG(v, chan, dai_id) \
20662306a36Sopenharmony_ci	LPAIF_CDC_RDMA_REG_ADDR(v, 0x50, (chan), dai_id)
20762306a36Sopenharmony_ci
20862306a36Sopenharmony_ci#define LPAIF_CDC_WRDMA_REG_ADDR(v, addr, chan, dai_id) \
20962306a36Sopenharmony_ci	(is_rxtx_cdc_dma_port(dai_id) ? \
21062306a36Sopenharmony_ci	(v->rxtx_wrdma_reg_base + (addr) + \
21162306a36Sopenharmony_ci		v->rxtx_wrdma_reg_stride * (chan - v->rxtx_wrdma_channel_start)) : \
21262306a36Sopenharmony_ci	(v->va_wrdma_reg_base + (addr) + \
21362306a36Sopenharmony_ci		v->va_wrdma_reg_stride * (chan - v->va_wrdma_channel_start)))
21462306a36Sopenharmony_ci
21562306a36Sopenharmony_ci#define LPAIF_CDC_RXTX_WRDMACTL_REG(v, chan, dai_id) \
21662306a36Sopenharmony_ci	LPAIF_CDC_WRDMA_REG_ADDR(v, 0x00, (chan), dai_id)
21762306a36Sopenharmony_ci#define LPAIF_CDC_RXTX_WRDMABASE_REG(v, chan, dai_id) \
21862306a36Sopenharmony_ci	LPAIF_CDC_WRDMA_REG_ADDR(v, 0x04, (chan), dai_id)
21962306a36Sopenharmony_ci#define LPAIF_CDC_RXTX_WRDMABUFF_REG(v, chan, dai_id) \
22062306a36Sopenharmony_ci	LPAIF_CDC_WRDMA_REG_ADDR(v, 0x08, (chan), dai_id)
22162306a36Sopenharmony_ci#define LPAIF_CDC_RXTX_WRDMACURR_REG(v, chan, dai_id) \
22262306a36Sopenharmony_ci	LPAIF_CDC_WRDMA_REG_ADDR(v, 0x0C, (chan), dai_id)
22362306a36Sopenharmony_ci#define LPAIF_CDC_RXTX_WRDMAPER_REG(v, chan, dai_id) \
22462306a36Sopenharmony_ci	LPAIF_CDC_WRDMA_REG_ADDR(v, 0x10, (chan), dai_id)
22562306a36Sopenharmony_ci#define LPAIF_CDC_RXTX_WRDMA_INTF_REG(v, chan, dai_id) \
22662306a36Sopenharmony_ci	LPAIF_CDC_WRDMA_REG_ADDR(v, 0x50, (chan), dai_id)
22762306a36Sopenharmony_ci
22862306a36Sopenharmony_ci#define LPAIF_CDC_VA_WRDMACTL_REG(v, chan, dai_id) \
22962306a36Sopenharmony_ci	LPAIF_CDC_WRDMA_REG_ADDR(v, 0x00, (chan), dai_id)
23062306a36Sopenharmony_ci#define LPAIF_CDC_VA_WRDMABASE_REG(v, chan, dai_id) \
23162306a36Sopenharmony_ci	LPAIF_CDC_WRDMA_REG_ADDR(v, 0x04, (chan), dai_id)
23262306a36Sopenharmony_ci#define LPAIF_CDC_VA_WRDMABUFF_REG(v, chan, dai_id) \
23362306a36Sopenharmony_ci	LPAIF_CDC_WRDMA_REG_ADDR(v, 0x08, (chan), dai_id)
23462306a36Sopenharmony_ci#define LPAIF_CDC_VA_WRDMACURR_REG(v, chan, dai_id) \
23562306a36Sopenharmony_ci	LPAIF_CDC_WRDMA_REG_ADDR(v, 0x0C, (chan), dai_id)
23662306a36Sopenharmony_ci#define LPAIF_CDC_VA_WRDMAPER_REG(v, chan, dai_id) \
23762306a36Sopenharmony_ci	LPAIF_CDC_WRDMA_REG_ADDR(v, 0x10, (chan), dai_id)
23862306a36Sopenharmony_ci#define LPAIF_CDC_VA_WRDMA_INTF_REG(v, chan, dai_id) \
23962306a36Sopenharmony_ci	LPAIF_CDC_WRDMA_REG_ADDR(v, 0x50, (chan), dai_id)
24062306a36Sopenharmony_ci
24162306a36Sopenharmony_ci#define __LPAIF_CDC_RDDMA_REG(v, chan, dir, reg, dai_id) \
24262306a36Sopenharmony_ci		(is_rxtx_cdc_dma_port(dai_id) ? LPAIF_CDC_RXTX_RDMA##reg##_REG(v, chan, dai_id) : \
24362306a36Sopenharmony_ci			LPAIF_CDC_VA_RDMA##reg##_REG(v, chan, dai_id))
24462306a36Sopenharmony_ci
24562306a36Sopenharmony_ci#define __LPAIF_CDC_WRDMA_REG(v, chan, dir, reg, dai_id) \
24662306a36Sopenharmony_ci		(is_rxtx_cdc_dma_port(dai_id) ? LPAIF_CDC_RXTX_WRDMA##reg##_REG(v, chan, dai_id) : \
24762306a36Sopenharmony_ci			LPAIF_CDC_VA_WRDMA##reg##_REG(v, chan, dai_id))
24862306a36Sopenharmony_ci
24962306a36Sopenharmony_ci#define __LPAIF_CDC_DMA_REG(v, chan, dir, reg, dai_id) \
25062306a36Sopenharmony_ci		((dir ==  SNDRV_PCM_STREAM_PLAYBACK) ? \
25162306a36Sopenharmony_ci			__LPAIF_CDC_RDDMA_REG(v, chan, dir, reg, dai_id) : \
25262306a36Sopenharmony_ci			__LPAIF_CDC_WRDMA_REG(v, chan, dir, reg, dai_id))
25362306a36Sopenharmony_ci
25462306a36Sopenharmony_ci#define LPAIF_CDC_INTF_REG(v, chan, dir, dai_id) \
25562306a36Sopenharmony_ci		((dir ==  SNDRV_PCM_STREAM_PLAYBACK) ? \
25662306a36Sopenharmony_ci		LPAIF_CDC_RDMA_INTF_REG(v, chan, dai_id) : \
25762306a36Sopenharmony_ci		LPAIF_CDC_WRDMA_INTF_REG(v, chan, dai_id))
25862306a36Sopenharmony_ci
25962306a36Sopenharmony_ci#define LPAIF_INTF_REG(v, chan, dir, dai_id) \
26062306a36Sopenharmony_ci		(is_cdc_dma_port(dai_id) ? \
26162306a36Sopenharmony_ci		LPAIF_CDC_INTF_REG(v, chan, dir, dai_id) : \
26262306a36Sopenharmony_ci		LPAIF_DMACTL_REG(v, chan, dir, dai_id))
26362306a36Sopenharmony_ci
26462306a36Sopenharmony_ci#define LPAIF_DMACTL_BURSTEN_SINGLE	0
26562306a36Sopenharmony_ci#define LPAIF_DMACTL_BURSTEN_INCR4	1
26662306a36Sopenharmony_ci
26762306a36Sopenharmony_ci#define LPAIF_DMACTL_WPSCNT_ONE		0
26862306a36Sopenharmony_ci#define LPAIF_DMACTL_WPSCNT_TWO		1
26962306a36Sopenharmony_ci#define LPAIF_DMACTL_WPSCNT_THREE	2
27062306a36Sopenharmony_ci#define LPAIF_DMACTL_WPSCNT_FOUR	3
27162306a36Sopenharmony_ci#define LPAIF_DMACTL_WPSCNT_SIX		5
27262306a36Sopenharmony_ci#define LPAIF_DMACTL_WPSCNT_EIGHT	7
27362306a36Sopenharmony_ci#define LPAIF_DMACTL_WPSCNT_TEN		9
27462306a36Sopenharmony_ci#define LPAIF_DMACTL_WPSCNT_TWELVE	11
27562306a36Sopenharmony_ci#define LPAIF_DMACTL_WPSCNT_FOURTEEN	13
27662306a36Sopenharmony_ci#define LPAIF_DMACTL_WPSCNT_SIXTEEN	15
27762306a36Sopenharmony_ci
27862306a36Sopenharmony_ci#define LPAIF_DMACTL_AUDINTF(id)	id
27962306a36Sopenharmony_ci
28062306a36Sopenharmony_ci#define LPAIF_DMACTL_FIFOWM_1		0
28162306a36Sopenharmony_ci#define LPAIF_DMACTL_FIFOWM_2		1
28262306a36Sopenharmony_ci#define LPAIF_DMACTL_FIFOWM_3		2
28362306a36Sopenharmony_ci#define LPAIF_DMACTL_FIFOWM_4		3
28462306a36Sopenharmony_ci#define LPAIF_DMACTL_FIFOWM_5		4
28562306a36Sopenharmony_ci#define LPAIF_DMACTL_FIFOWM_6		5
28662306a36Sopenharmony_ci#define LPAIF_DMACTL_FIFOWM_7		6
28762306a36Sopenharmony_ci#define LPAIF_DMACTL_FIFOWM_8		7
28862306a36Sopenharmony_ci#define LPAIF_DMACTL_FIFOWM_9		8
28962306a36Sopenharmony_ci#define LPAIF_DMACTL_FIFOWM_10		9
29062306a36Sopenharmony_ci#define LPAIF_DMACTL_FIFOWM_11		10
29162306a36Sopenharmony_ci#define LPAIF_DMACTL_FIFOWM_12		11
29262306a36Sopenharmony_ci#define LPAIF_DMACTL_FIFOWM_13		12
29362306a36Sopenharmony_ci#define LPAIF_DMACTL_FIFOWM_14		13
29462306a36Sopenharmony_ci#define LPAIF_DMACTL_FIFOWM_15		14
29562306a36Sopenharmony_ci#define LPAIF_DMACTL_FIFOWM_16		15
29662306a36Sopenharmony_ci#define LPAIF_DMACTL_FIFOWM_17		16
29762306a36Sopenharmony_ci#define LPAIF_DMACTL_FIFOWM_18		17
29862306a36Sopenharmony_ci#define LPAIF_DMACTL_FIFOWM_19		18
29962306a36Sopenharmony_ci#define LPAIF_DMACTL_FIFOWM_20		19
30062306a36Sopenharmony_ci#define LPAIF_DMACTL_FIFOWM_21		20
30162306a36Sopenharmony_ci#define LPAIF_DMACTL_FIFOWM_22		21
30262306a36Sopenharmony_ci#define LPAIF_DMACTL_FIFOWM_23		22
30362306a36Sopenharmony_ci#define LPAIF_DMACTL_FIFOWM_24		23
30462306a36Sopenharmony_ci#define LPAIF_DMACTL_FIFOWM_25		24
30562306a36Sopenharmony_ci#define LPAIF_DMACTL_FIFOWM_26		25
30662306a36Sopenharmony_ci#define LPAIF_DMACTL_FIFOWM_27		26
30762306a36Sopenharmony_ci#define LPAIF_DMACTL_FIFOWM_28		27
30862306a36Sopenharmony_ci#define LPAIF_DMACTL_FIFOWM_29		28
30962306a36Sopenharmony_ci#define LPAIF_DMACTL_FIFOWM_30		29
31062306a36Sopenharmony_ci#define LPAIF_DMACTL_FIFOWM_31		30
31162306a36Sopenharmony_ci#define LPAIF_DMACTL_FIFOWM_32		31
31262306a36Sopenharmony_ci
31362306a36Sopenharmony_ci#define LPAIF_DMACTL_ENABLE_OFF		0
31462306a36Sopenharmony_ci#define LPAIF_DMACTL_ENABLE_ON		1
31562306a36Sopenharmony_ci
31662306a36Sopenharmony_ci#define LPAIF_DMACTL_DYNCLK_OFF		0
31762306a36Sopenharmony_ci#define LPAIF_DMACTL_DYNCLK_ON		1
31862306a36Sopenharmony_ci
31962306a36Sopenharmony_ci#endif /* __LPASS_LPAIF_REG_H__ */
320