linux/sound/soc/rockchip/rockchip_i2s_tdm.h

/* SPDX-License-Identifier: GPL-2.0-only */
/*
 * ALSA SoC Audio Layer - Rockchip I2S/TDM Controller driver
 *
 * Copyright (c) 2018 Rockchip Electronics Co. Ltd.
 * Author: Sugar Zhang <[email protected]>
 *
 */

#ifndef _ROCKCHIP_I2S_TDM_H
#define _ROCKCHIP_I2S_TDM_H

/*
 * TXCR
 * transmit operation control register
 */
#define I2S_TXCR_PATH_SHIFT(x)
#define I2S_TXCR_PATH_MASK(x)
#define I2S_TXCR_PATH(x, v)
#define I2S_TXCR_RCNT_SHIFT
#define I2S_TXCR_RCNT_MASK
#define I2S_TXCR_CSR_SHIFT
#define I2S_TXCR_CSR(x)
#define I2S_TXCR_CSR_MASK
#define I2S_TXCR_HWT
#define I2S_TXCR_SJM_SHIFT
#define I2S_TXCR_SJM_R
#define I2S_TXCR_SJM_L
#define I2S_TXCR_FBM_SHIFT
#define I2S_TXCR_FBM_MSB
#define I2S_TXCR_FBM_LSB
#define I2S_TXCR_IBM_SHIFT
#define I2S_TXCR_IBM_NORMAL
#define I2S_TXCR_IBM_LSJM
#define I2S_TXCR_IBM_RSJM
#define I2S_TXCR_IBM_MASK
#define I2S_TXCR_PBM_SHIFT
#define I2S_TXCR_PBM_MODE(x)
#define I2S_TXCR_PBM_MASK
#define I2S_TXCR_TFS_SHIFT
#define I2S_TXCR_TFS_I2S
#define I2S_TXCR_TFS_PCM
#define I2S_TXCR_TFS_TDM_PCM
#define I2S_TXCR_TFS_TDM_I2S
#define I2S_TXCR_TFS_MASK
#define I2S_TXCR_VDW_SHIFT
#define I2S_TXCR_VDW(x)
#define I2S_TXCR_VDW_MASK

/*
 * RXCR
 * receive operation control register
 */
#define I2S_RXCR_PATH_SHIFT(x)
#define I2S_RXCR_PATH_MASK(x)
#define I2S_RXCR_PATH(x, v)
#define I2S_RXCR_CSR_SHIFT
#define I2S_RXCR_CSR(x)
#define I2S_RXCR_CSR_MASK
#define I2S_RXCR_HWT
#define I2S_RXCR_SJM_SHIFT
#define I2S_RXCR_SJM_R
#define I2S_RXCR_SJM_L
#define I2S_RXCR_FBM_SHIFT
#define I2S_RXCR_FBM_MSB
#define I2S_RXCR_FBM_LSB
#define I2S_RXCR_IBM_SHIFT
#define I2S_RXCR_IBM_NORMAL
#define I2S_RXCR_IBM_LSJM
#define I2S_RXCR_IBM_RSJM
#define I2S_RXCR_IBM_MASK
#define I2S_RXCR_PBM_SHIFT
#define I2S_RXCR_PBM_MODE(x)
#define I2S_RXCR_PBM_MASK
#define I2S_RXCR_TFS_SHIFT
#define I2S_RXCR_TFS_I2S
#define I2S_RXCR_TFS_PCM
#define I2S_RXCR_TFS_TDM_PCM
#define I2S_RXCR_TFS_TDM_I2S
#define I2S_RXCR_TFS_MASK
#define I2S_RXCR_VDW_SHIFT
#define I2S_RXCR_VDW(x)
#define I2S_RXCR_VDW_MASK

/*
 * CKR
 * clock generation register
 */
#define I2S_CKR_TRCM_SHIFT
#define I2S_CKR_TRCM(x)
#define I2S_CKR_TRCM_TXRX
#define I2S_CKR_TRCM_TXONLY
#define I2S_CKR_TRCM_RXONLY
#define I2S_CKR_TRCM_MASK
#define I2S_CKR_MSS_SHIFT
#define I2S_CKR_MSS_MASTER
#define I2S_CKR_MSS_SLAVE
#define I2S_CKR_MSS_MASK
#define I2S_CKR_CKP_SHIFT
#define I2S_CKR_CKP_NORMAL
#define I2S_CKR_CKP_INVERTED
#define I2S_CKR_CKP_MASK
#define I2S_CKR_RLP_SHIFT
#define I2S_CKR_RLP_NORMAL
#define I2S_CKR_RLP_INVERTED
#define I2S_CKR_RLP_MASK
#define I2S_CKR_TLP_SHIFT
#define I2S_CKR_TLP_NORMAL
#define I2S_CKR_TLP_INVERTED
#define I2S_CKR_TLP_MASK
#define I2S_CKR_MDIV_SHIFT
#define I2S_CKR_MDIV(x)
#define I2S_CKR_MDIV_MASK
#define I2S_CKR_RSD_SHIFT
#define I2S_CKR_RSD(x)
#define I2S_CKR_RSD_MASK
#define I2S_CKR_TSD_SHIFT
#define I2S_CKR_TSD(x)
#define I2S_CKR_TSD_MASK

/*
 * FIFOLR
 * FIFO level register
 */
#define I2S_FIFOLR_RFL_SHIFT
#define I2S_FIFOLR_RFL_MASK
#define I2S_FIFOLR_TFL3_SHIFT
#define I2S_FIFOLR_TFL3_MASK
#define I2S_FIFOLR_TFL2_SHIFT
#define I2S_FIFOLR_TFL2_MASK
#define I2S_FIFOLR_TFL1_SHIFT
#define I2S_FIFOLR_TFL1_MASK
#define I2S_FIFOLR_TFL0_SHIFT
#define I2S_FIFOLR_TFL0_MASK

/*
 * DMACR
 * DMA control register
 */
#define I2S_DMACR_RDE_SHIFT
#define I2S_DMACR_RDE_DISABLE
#define I2S_DMACR_RDE_ENABLE
#define I2S_DMACR_RDL_SHIFT
#define I2S_DMACR_RDL(x)
#define I2S_DMACR_RDL_MASK
#define I2S_DMACR_TDE_SHIFT
#define I2S_DMACR_TDE_DISABLE
#define I2S_DMACR_TDE_ENABLE
#define I2S_DMACR_TDL_SHIFT
#define I2S_DMACR_TDL(x)
#define I2S_DMACR_TDL_MASK

/*
 * INTCR
 * interrupt control register
 */
#define I2S_INTCR_RFT_SHIFT
#define I2S_INTCR_RFT(x)
#define I2S_INTCR_RXOIC
#define I2S_INTCR_RXOIE_SHIFT
#define I2S_INTCR_RXOIE_DISABLE
#define I2S_INTCR_RXOIE_ENABLE
#define I2S_INTCR_RXFIE_SHIFT
#define I2S_INTCR_RXFIE_DISABLE
#define I2S_INTCR_RXFIE_ENABLE
#define I2S_INTCR_TFT_SHIFT
#define I2S_INTCR_TFT(x)
#define I2S_INTCR_TFT_MASK
#define I2S_INTCR_TXUIC
#define I2S_INTCR_TXUIE_SHIFT
#define I2S_INTCR_TXUIE_DISABLE
#define I2S_INTCR_TXUIE_ENABLE

/*
 * INTSR
 * interrupt status register
 */
#define I2S_INTSR_TXEIE_SHIFT
#define I2S_INTSR_TXEIE_DISABLE
#define I2S_INTSR_TXEIE_ENABLE
#define I2S_INTSR_RXOI_SHIFT
#define I2S_INTSR_RXOI_INA
#define I2S_INTSR_RXOI_ACT
#define I2S_INTSR_RXFI_SHIFT
#define I2S_INTSR_RXFI_INA
#define I2S_INTSR_RXFI_ACT
#define I2S_INTSR_TXUI_SHIFT
#define I2S_INTSR_TXUI_INA
#define I2S_INTSR_TXUI_ACT
#define I2S_INTSR_TXEI_SHIFT
#define I2S_INTSR_TXEI_INA
#define I2S_INTSR_TXEI_ACT

/*
 * XFER
 * Transfer start register
 */
#define I2S_XFER_RXS_SHIFT
#define I2S_XFER_RXS_STOP
#define I2S_XFER_RXS_START
#define I2S_XFER_TXS_SHIFT
#define I2S_XFER_TXS_STOP
#define I2S_XFER_TXS_START

/*
 * CLR
 * clear SCLK domain logic register
 */
#define I2S_CLR_RXC
#define I2S_CLR_TXC

/*
 * TXDR
 * Transimt FIFO data register, write only.
 */
#define I2S_TXDR_MASK

/*
 * RXDR
 * Receive FIFO data register, write only.
 */
#define I2S_RXDR_MASK

/*
 * TDM_CTRL
 * TDM ctrl register
 */
#define TDM_FSYNC_WIDTH_SEL1_MSK
#define TDM_FSYNC_WIDTH_SEL1(x)
#define TDM_FSYNC_WIDTH_SEL0_MSK
#define TDM_FSYNC_WIDTH_HALF_FRAME
#define TDM_FSYNC_WIDTH_ONE_FRAME
#define TDM_SHIFT_CTRL_MSK
#define TDM_SHIFT_CTRL(x)
#define TDM_SLOT_BIT_WIDTH_MSK
#define TDM_SLOT_BIT_WIDTH(x)
#define TDM_FRAME_WIDTH_MSK
#define TDM_FRAME_WIDTH(x)

/*
 * CLKDIV
 * Mclk div register
 */
#define I2S_CLKDIV_TXM_SHIFT
#define I2S_CLKDIV_TXM(x)
#define I2S_CLKDIV_TXM_MASK
#define I2S_CLKDIV_RXM_SHIFT
#define I2S_CLKDIV_RXM(x)
#define I2S_CLKDIV_RXM_MASK

/* Clock divider id */
enum {};

/* channel select */
#define I2S_CSR_SHIFT
#define I2S_CHN_2
#define I2S_CHN_4
#define I2S_CHN_6
#define I2S_CHN_8

/* io direction cfg register */
#define I2S_IO_DIRECTION_MASK
#define I2S_IO_8CH_OUT_2CH_IN
#define I2S_IO_6CH_OUT_4CH_IN
#define I2S_IO_4CH_OUT_6CH_IN
#define I2S_IO_2CH_OUT_8CH_IN

/* I2S REGS */
#define I2S_TXCR
#define I2S_RXCR
#define I2S_CKR
#define I2S_TXFIFOLR
#define I2S_DMACR
#define I2S_INTCR
#define I2S_INTSR
#define I2S_XFER
#define I2S_CLR
#define I2S_TXDR
#define I2S_RXDR
#define I2S_RXFIFOLR
#define I2S_TDM_TXCR
#define I2S_TDM_RXCR
#define I2S_CLKDIV

#define HIWORD_UPDATE(v, h, l)

/* PX30 GRF CONFIGS */
#define PX30_I2S0_CLK_IN_SRC_FROM_TX
#define PX30_I2S0_CLK_IN_SRC_FROM_RX
#define PX30_I2S0_MCLK_OUT_SRC_FROM_TX
#define PX30_I2S0_MCLK_OUT_SRC_FROM_RX

#define PX30_I2S0_CLK_TXONLY

#define PX30_I2S0_CLK_RXONLY

/* RK1808 GRF CONFIGS */
#define RK1808_I2S0_MCLK_OUT_SRC_FROM_RX
#define RK1808_I2S0_MCLK_OUT_SRC_FROM_TX
#define RK1808_I2S0_CLK_IN_SRC_FROM_TX
#define RK1808_I2S0_CLK_IN_SRC_FROM_RX

#define RK1808_I2S0_CLK_TXONLY

#define RK1808_I2S0_CLK_RXONLY

/* RK3308 GRF CONFIGS */
#define RK3308_I2S0_8CH_MCLK_OUT_SRC_FROM_RX
#define RK3308_I2S0_8CH_MCLK_OUT_SRC_FROM_TX
#define RK3308_I2S0_8CH_CLK_IN_RX_SRC_FROM_TX
#define RK3308_I2S0_8CH_CLK_IN_RX_SRC_FROM_RX
#define RK3308_I2S0_8CH_CLK_IN_TX_SRC_FROM_RX
#define RK3308_I2S0_8CH_CLK_IN_TX_SRC_FROM_TX
#define RK3308_I2S1_8CH_MCLK_OUT_SRC_FROM_RX
#define RK3308_I2S1_8CH_MCLK_OUT_SRC_FROM_TX
#define RK3308_I2S1_8CH_CLK_IN_RX_SRC_FROM_TX
#define RK3308_I2S1_8CH_CLK_IN_RX_SRC_FROM_RX
#define RK3308_I2S1_8CH_CLK_IN_TX_SRC_FROM_RX
#define RK3308_I2S1_8CH_CLK_IN_TX_SRC_FROM_TX

#define RK3308_I2S0_CLK_TXONLY

#define RK3308_I2S0_CLK_RXONLY

#define RK3308_I2S1_CLK_TXONLY

#define RK3308_I2S1_CLK_RXONLY

/* RK3568 GRF CONFIGS */
#define RK3568_I2S1_MCLK_OUT_SRC_FROM_TX
#define RK3568_I2S1_MCLK_OUT_SRC_FROM_RX

#define RK3568_I2S1_CLK_TXONLY

#define RK3568_I2S1_CLK_RXONLY

#define RK3568_I2S3_MCLK_OUT_SRC_FROM_TX
#define RK3568_I2S3_MCLK_OUT_SRC_FROM_RX
#define RK3568_I2S3_SCLK_SRC_FROM_TX
#define RK3568_I2S3_SCLK_SRC_FROM_RX
#define RK3568_I2S3_LRCK_SRC_FROM_TX
#define RK3568_I2S3_LRCK_SRC_FROM_RX

#define RK3568_I2S3_MCLK_TXONLY

#define RK3568_I2S3_CLK_TXONLY

#define RK3568_I2S3_MCLK_RXONLY

#define RK3568_I2S3_CLK_RXONLY

#define RK3568_I2S3_MCLK_IE
#define RK3568_I2S3_MCLK_OE
#define RK3568_I2S2_MCLK_IE
#define RK3568_I2S2_MCLK_OE
#define RK3568_I2S1_MCLK_TX_IE
#define RK3568_I2S1_MCLK_TX_OE
#define RK3568_I2S1_MCLK_RX_IE
#define RK3568_I2S1_MCLK_RX_OE

/* RV1126 GRF CONFIGS */
#define RV1126_I2S0_MCLK_OUT_SRC_FROM_TX
#define RV1126_I2S0_MCLK_OUT_SRC_FROM_RX

#define RV1126_I2S0_CLK_TXONLY

#define RV1126_I2S0_CLK_RXONLY

#endif /* _ROCKCHIP_I2S_TDM_H */