1 /* SPDX-License-Identifier: GPL-2.0 */ 2 /* 3 * ALSA SoC Audio Layer - Rockchip SPDIF_RX Controller driver 4 * 5 * Copyright (C) 2018 Fuzhou Rockchip Electronics Co., Ltd 6 * 7 */ 8 9 #ifndef _ROCKCHIP_SPDIFRX_H 10 #define _ROCKCHIP_SPDIFRX_H 11 12 /* CFGR */ 13 #define SPDIFRX_CFGR_TWAD_SHIFT 1 14 #define SPDIFRX_CFGR_TWAD_DATA_ONLY (0 << 1) 15 #define SPDIFRX_CFGR_TWAD_STREAM BIT(1) 16 #define SPDIFRX_EN_MASK BIT(0) 17 #define SPDIFRX_EN BIT(0) 18 #define SPDIFRX_DIS 0 19 20 /* CLR */ 21 #define SPDIFRX_CLR_RXSC BIT(0) 22 23 /* CDR */ 24 #define SPDIFRX_CDR_CS_MASK GENMASK(10, 9) 25 #define SPDIFRX_CDR_AVGSEL_MASK BIT(1) 26 #define SPDIFRX_CDR_AVGSEL_MIN (0 << 1) 27 #define SPDIFRX_CDR_AVGSEL_AVG BIT(1) 28 #define SPDIFRX_CDR_BYPASS_MASK BIT(0) 29 #define SPDIFRX_CDR_BYPASS_EN BIT(0) 30 #define SPDIFRX_CDR_BYPASS_DIS 0 31 32 /* CDRST */ 33 #define SPDIFRX_CDRST_NOSTRTHR_MASK GENMASK(31, 16) 34 #define SPDIFRX_CDRST_MAXCNT_MASK GENMASK(15, 8) 35 #define SPDIFRX_CDRST_MINCNT_MASK GENMASK(7, 0) 36 37 /* DMACR */ 38 #define SPDIFRX_DMACR_RDE_MASK BIT(5) 39 #define SPDIFRX_DMACR_RDE_DISABLE (0 << 5) 40 #define SPDIFRX_DMACR_RDE_ENABLE BIT(5) 41 #define SPDIFRX_DMACR_RDL_MASK GENMASK(4, 0) 42 #define SPDIFRX_DMACR_RDL(x) (((x) - 1) << 0) 43 44 /* FIFOCTRL */ 45 #define SPDIFRX_FIFOCTRL_RFL_MASK GENMASK(13, 8) 46 #define SPDIFRX_FIFOCTRL_RFT_MASK GENMASK(4, 0) 47 48 /* INTEN */ 49 #define SPDIFRX_INTEN_UBCIE_MASK BIT(10) 50 #define SPDIFRX_INTEN_UBCIE_EN BIT(10) 51 #define SPDIFRX_INTEN_UBCIE_DIS (0 << 10) 52 #define SPDIFRX_INTEN_SYNCIE_MASK BIT(9) 53 #define SPDIFRX_INTEN_SYNCIE_EN BIT(9) 54 #define SPDIFRX_INTEN_SYNCIE_DIS (0 << 9) 55 #define SPDIFRX_INTEN_BTEIE_MASK BIT(8) 56 #define SPDIFRX_INTEN_BTEIE_EN BIT(8) 57 #define SPDIFRX_INTEN_BTEIE_DIS (0 << 8) 58 #define SPDIFRX_INTEN_NSYNCIE_MASK BIT(7) 59 #define SPDIFRX_INTEN_NSYNCIE_EN BIT(7) 60 #define SPDIFRX_INTEN_NSYNCIE_DIS (0 << 7) 61 62 /* INTMASK */ 63 #define SPDIFRX_INTMASK_UBCIMSK BIT(10) 64 #define SPDIFRX_INTMASK_UBCIUMSK (0 << 10) 65 #define SPDIFRX_INTMASK_SYNCIMSK BIT(9) 66 #define SPDIFRX_INTMASK_SYNCIUMSK (0 << 9) 67 #define SPDIFRX_INTMASK_BTEIMSK BIT(8) 68 #define SPDIFRX_INTMASK_BTEIUMSK (0 << 8) 69 #define SPDIFRX_INTMASK_NSYNCIMSK BIT(7) 70 #define SPDIFRX_INTMASK_NSYNCIUMSK (0 << 7) 71 72 /* INTSR */ 73 #define SPDIFRX_INTSR_UBCISR_ACTIVE BIT(10) 74 #define SPDIFRX_INTSR_SYNCISR_ACTIVE BIT(9) 75 #define SPDIFRX_INTSR_BTEISR_ACTIVE BIT(8) 76 #define SPDIFRX_INTSR_NSYNCISR_ACTIVE BIT(7) 77 78 /* INTCLR */ 79 #define SPDIFRX_INTCLR_UBCICLR_MASK BIT(10) 80 #define SPDIFRX_INTCLR_UBCICLR BIT(10) 81 #define SPDIFRX_INTCLR_SYNCICLR_MASK BIT(9) 82 #define SPDIFRX_INTCLR_SYNCICLR BIT(9) 83 #define SPDIFRX_INTCLR_BTECLR_MASK BIT(8) 84 #define SPDIFRX_INTCLR_BIECLR BIT(8) 85 #define SPDIFRX_INTCLR_NSYNCICLR_MASK BIT(7) 86 #define SPDIFRX_INTCLR_NSYNCICLR BIT(7) 87 88 /* BURSTINFO */ 89 #define SPDIFRX_BURSTINFO_PD_MASK GENMASK(31, 16) 90 #define SPDIFRX_BURSTINFO_BSNUM_MASK GENMASK(15, 13) 91 #define SPDIFRX_BURSTINFO_DATAINFO_MASK GENMASK(12, 8) 92 #define SPDIFRX_BURSTINFO_ERRFLAG_MASK BIT(7) 93 #define SPDIFRX_BURSTINFO_ERR BIT(7) 94 #define SPDIFRX_BURSTINFO_VALID (0 << 7) 95 #define SPDIFRX_BURSTINFO_DATATYPE_MASK GENMASK(6, 0) 96 97 #define SPDIFRX_VERSION (0x0000) 98 #define SPDIFRX_CFGR (0x0004) 99 #define SPDIFRX_CLR (0x0008) 100 #define SPDIFRX_CDR (0x000c) 101 #define SPDIFRX_CDRST (0x0010) 102 #define SPDIFRX_DMACR (0x0014) 103 #define SPDIFRX_FIFOCTRL (0x0018) 104 #define SPDIFRX_INTEN (0x001C) 105 #define SPDIFRX_INTMASK (0x0020) 106 #define SPDIFRX_INTSR (0x0024) 107 #define SPDIFRX_INTCLR (0x0028) 108 #define SPDIFRX_SMPDR (0x002C) 109 #define SPDIFRX_USRDRN (0x0030) 110 #define SPDIFRX_CHNSRN (0x0060) 111 #define SPDIFRX_BURSTINFO (0x0100) 112 113 #endif /* _ROCKCHIP_SPDIFRX_H */ 114