1*34d1324eSAndrey Utkin /* 2*34d1324eSAndrey Utkin * TW5864 driver - registers description 3*34d1324eSAndrey Utkin * 4*34d1324eSAndrey Utkin * Copyright (C) 2016 Bluecherry, LLC <maintainers@bluecherrydvr.com> 5*34d1324eSAndrey Utkin * 6*34d1324eSAndrey Utkin * This program is free software; you can redistribute it and/or modify 7*34d1324eSAndrey Utkin * it under the terms of the GNU General Public License as published by 8*34d1324eSAndrey Utkin * the Free Software Foundation; either version 2 of the License, or 9*34d1324eSAndrey Utkin * (at your option) any later version. 10*34d1324eSAndrey Utkin * 11*34d1324eSAndrey Utkin * This program is distributed in the hope that it will be useful, 12*34d1324eSAndrey Utkin * but WITHOUT ANY WARRANTY; without even the implied warranty of 13*34d1324eSAndrey Utkin * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14*34d1324eSAndrey Utkin * GNU General Public License for more details. 15*34d1324eSAndrey Utkin */ 16*34d1324eSAndrey Utkin 17*34d1324eSAndrey Utkin /* According to TW5864_datasheet_0.6d.pdf, tw5864b1-ds.pdf */ 18*34d1324eSAndrey Utkin 19*34d1324eSAndrey Utkin /* Register Description - Direct Map Space */ 20*34d1324eSAndrey Utkin /* 0x0000 ~ 0x1ffc - H264 Register Map */ 21*34d1324eSAndrey Utkin /* [15:0] The Version register for H264 core (Read Only) */ 22*34d1324eSAndrey Utkin #define TW5864_H264REV 0x0000 23*34d1324eSAndrey Utkin 24*34d1324eSAndrey Utkin #define TW5864_EMU 0x0004 25*34d1324eSAndrey Utkin /* Define controls in register TW5864_EMU */ 26*34d1324eSAndrey Utkin /* DDR controller enabled */ 27*34d1324eSAndrey Utkin #define TW5864_EMU_EN_DDR BIT(0) 28*34d1324eSAndrey Utkin /* Enable bit for Inter module */ 29*34d1324eSAndrey Utkin #define TW5864_EMU_EN_ME BIT(1) 30*34d1324eSAndrey Utkin /* Enable bit for Sensor Interface module */ 31*34d1324eSAndrey Utkin #define TW5864_EMU_EN_SEN BIT(2) 32*34d1324eSAndrey Utkin /* Enable bit for Host Burst Access */ 33*34d1324eSAndrey Utkin #define TW5864_EMU_EN_BHOST BIT(3) 34*34d1324eSAndrey Utkin /* Enable bit for Loop Filter module */ 35*34d1324eSAndrey Utkin #define TW5864_EMU_EN_LPF BIT(4) 36*34d1324eSAndrey Utkin /* Enable bit for PLBK module */ 37*34d1324eSAndrey Utkin #define TW5864_EMU_EN_PLBK BIT(5) 38*34d1324eSAndrey Utkin /* 39*34d1324eSAndrey Utkin * Video Frame mapping in DDR 40*34d1324eSAndrey Utkin * 00 CIF 41*34d1324eSAndrey Utkin * 01 D1 42*34d1324eSAndrey Utkin * 10 Reserved 43*34d1324eSAndrey Utkin * 11 Reserved 44*34d1324eSAndrey Utkin * 45*34d1324eSAndrey Utkin */ 46*34d1324eSAndrey Utkin #define TW5864_DSP_FRAME_TYPE (3 << 6) 47*34d1324eSAndrey Utkin #define TW5864_DSP_FRAME_TYPE_D1 BIT(6) 48*34d1324eSAndrey Utkin 49*34d1324eSAndrey Utkin #define TW5864_UNDECLARED_H264REV_PART2 0x0008 50*34d1324eSAndrey Utkin 51*34d1324eSAndrey Utkin #define TW5864_SLICE 0x000c 52*34d1324eSAndrey Utkin /* Define controls in register TW5864_SLICE */ 53*34d1324eSAndrey Utkin /* VLC Slice end flag */ 54*34d1324eSAndrey Utkin #define TW5864_VLC_SLICE_END BIT(0) 55*34d1324eSAndrey Utkin /* Master Slice End Flag */ 56*34d1324eSAndrey Utkin #define TW5864_MAS_SLICE_END BIT(4) 57*34d1324eSAndrey Utkin /* Host to start a new slice Address */ 58*34d1324eSAndrey Utkin #define TW5864_START_NSLICE BIT(15) 59*34d1324eSAndrey Utkin 60*34d1324eSAndrey Utkin /* 61*34d1324eSAndrey Utkin * [15:0] Two bit for each channel (channel 0 ~ 7). Each two bits are the buffer 62*34d1324eSAndrey Utkin * pointer for the last encoded frame of the corresponding channel. 63*34d1324eSAndrey Utkin */ 64*34d1324eSAndrey Utkin #define TW5864_ENC_BUF_PTR_REC1 0x0010 65*34d1324eSAndrey Utkin 66*34d1324eSAndrey Utkin /* [5:0] DSP_MB_QP and [15:10] DSP_LPF_OFFSET */ 67*34d1324eSAndrey Utkin #define TW5864_DSP_QP 0x0018 68*34d1324eSAndrey Utkin /* Define controls in register TW5864_DSP_QP */ 69*34d1324eSAndrey Utkin /* [5:0] H264 QP Value for codec */ 70*34d1324eSAndrey Utkin #define TW5864_DSP_MB_QP 0x003f 71*34d1324eSAndrey Utkin /* 72*34d1324eSAndrey Utkin * [15:10] H264 LPF_OFFSET Address 73*34d1324eSAndrey Utkin * (Default 0) 74*34d1324eSAndrey Utkin */ 75*34d1324eSAndrey Utkin #define TW5864_DSP_LPF_OFFSET 0xfc00 76*34d1324eSAndrey Utkin 77*34d1324eSAndrey Utkin #define TW5864_DSP_CODEC 0x001c 78*34d1324eSAndrey Utkin /* Define controls in register TW5864_DSP_CODEC */ 79*34d1324eSAndrey Utkin /* 80*34d1324eSAndrey Utkin * 0: Encode (TW5864 Default) 81*34d1324eSAndrey Utkin * 1: Decode 82*34d1324eSAndrey Utkin */ 83*34d1324eSAndrey Utkin #define TW5864_DSP_CODEC_MODE BIT(0) 84*34d1324eSAndrey Utkin /* 85*34d1324eSAndrey Utkin * 0->3 4 VLC data buffer in DDR (1M each) 86*34d1324eSAndrey Utkin * 0->7 8 VLC data buffer in DDR (512k each) 87*34d1324eSAndrey Utkin */ 88*34d1324eSAndrey Utkin #define TW5864_VLC_BUF_ID (7 << 2) 89*34d1324eSAndrey Utkin /* 90*34d1324eSAndrey Utkin * 0 4CIF in 1 MB 91*34d1324eSAndrey Utkin * 1 1CIF in 1 MB 92*34d1324eSAndrey Utkin */ 93*34d1324eSAndrey Utkin #define TW5864_CIF_MAP_MD BIT(6) 94*34d1324eSAndrey Utkin /* 95*34d1324eSAndrey Utkin * 0 2 falf D1 in 1 MB 96*34d1324eSAndrey Utkin * 1 1 half D1 in 1 MB 97*34d1324eSAndrey Utkin */ 98*34d1324eSAndrey Utkin #define TW5864_HD1_MAP_MD BIT(7) 99*34d1324eSAndrey Utkin /* VLC Stream valid */ 100*34d1324eSAndrey Utkin #define TW5864_VLC_VLD BIT(8) 101*34d1324eSAndrey Utkin /* MV Vector Valid */ 102*34d1324eSAndrey Utkin #define TW5864_MV_VECT_VLD BIT(9) 103*34d1324eSAndrey Utkin /* MV Flag Valid */ 104*34d1324eSAndrey Utkin #define TW5864_MV_FLAG_VLD BIT(10) 105*34d1324eSAndrey Utkin 106*34d1324eSAndrey Utkin #define TW5864_DSP_SEN 0x0020 107*34d1324eSAndrey Utkin /* Define controls in register TW5864_DSP_SEN */ 108*34d1324eSAndrey Utkin /* Org Buffer Base for Luma (default 0) */ 109*34d1324eSAndrey Utkin #define TW5864_DSP_SEN_PIC_LU 0x000f 110*34d1324eSAndrey Utkin /* Org Buffer Base for Chroma (default 4) */ 111*34d1324eSAndrey Utkin #define TW5864_DSP_SEN_PIC_CHM 0x00f0 112*34d1324eSAndrey Utkin /* Maximum Number of Buffers (default 4) */ 113*34d1324eSAndrey Utkin #define TW5864_DSP_SEN_PIC_MAX 0x0700 114*34d1324eSAndrey Utkin /* 115*34d1324eSAndrey Utkin * Original Frame D1 or HD1 switch 116*34d1324eSAndrey Utkin * (Default 0) 117*34d1324eSAndrey Utkin */ 118*34d1324eSAndrey Utkin #define TW5864_DSP_SEN_HFULL 0x1000 119*34d1324eSAndrey Utkin 120*34d1324eSAndrey Utkin #define TW5864_DSP_REF_PIC 0x0024 121*34d1324eSAndrey Utkin /* Define controls in register TW5864_DSP_REF_PIC */ 122*34d1324eSAndrey Utkin /* Ref Buffer Base for Luma (default 0) */ 123*34d1324eSAndrey Utkin #define TW5864_DSP_REF_PIC_LU 0x000f 124*34d1324eSAndrey Utkin /* Ref Buffer Base for Chroma (default 4) */ 125*34d1324eSAndrey Utkin #define TW5864_DSP_REF_PIC_CHM 0x00f0 126*34d1324eSAndrey Utkin /* Maximum Number of Buffers (default 4) */ 127*34d1324eSAndrey Utkin #define TW5864_DSP_REF_PIC_MAX 0x0700 128*34d1324eSAndrey Utkin 129*34d1324eSAndrey Utkin /* [15:0] SEN_EN_CH[n] SENIF original frame capture enable for each channel */ 130*34d1324eSAndrey Utkin #define TW5864_SEN_EN_CH 0x0028 131*34d1324eSAndrey Utkin 132*34d1324eSAndrey Utkin #define TW5864_DSP 0x002c 133*34d1324eSAndrey Utkin /* Define controls in register TW5864_DSP */ 134*34d1324eSAndrey Utkin /* The ID for channel selected for encoding operation */ 135*34d1324eSAndrey Utkin #define TW5864_DSP_ENC_CHN 0x000f 136*34d1324eSAndrey Utkin /* See DSP_MB_DELAY below */ 137*34d1324eSAndrey Utkin #define TW5864_DSP_MB_WAIT 0x0010 138*34d1324eSAndrey Utkin /* 139*34d1324eSAndrey Utkin * DSP Chroma Switch 140*34d1324eSAndrey Utkin * 0 DDRB 141*34d1324eSAndrey Utkin * 1 DDRA 142*34d1324eSAndrey Utkin */ 143*34d1324eSAndrey Utkin #define TW5864_DSP_CHROM_SW 0x0020 144*34d1324eSAndrey Utkin /* VLC Flow Control: 1 for enable */ 145*34d1324eSAndrey Utkin #define TW5864_DSP_FLW_CNTL 0x0040 146*34d1324eSAndrey Utkin /* 147*34d1324eSAndrey Utkin * If DSP_MB_WAIT == 0, MB delay is DSP_MB_DELAY * 16 148*34d1324eSAndrey Utkin * If DSP_MB_DELAY == 1, MB delay is DSP_MB_DELAY * 128 149*34d1324eSAndrey Utkin */ 150*34d1324eSAndrey Utkin #define TW5864_DSP_MB_DELAY 0x0f00 151*34d1324eSAndrey Utkin 152*34d1324eSAndrey Utkin #define TW5864_DDR 0x0030 153*34d1324eSAndrey Utkin /* Define controls in register TW5864_DDR */ 154*34d1324eSAndrey Utkin /* DDR Single Access Page Number */ 155*34d1324eSAndrey Utkin #define TW5864_DDR_PAGE_CNTL 0x00ff 156*34d1324eSAndrey Utkin /* DDR-DPR Burst Read Enable */ 157*34d1324eSAndrey Utkin #define TW5864_DDR_BRST_EN BIT(13) 158*34d1324eSAndrey Utkin /* 159*34d1324eSAndrey Utkin * DDR A/B Select as HOST access 160*34d1324eSAndrey Utkin * 0 Select DDRA 161*34d1324eSAndrey Utkin * 1 Select DDRB 162*34d1324eSAndrey Utkin */ 163*34d1324eSAndrey Utkin #define TW5864_DDR_AB_SEL BIT(14) 164*34d1324eSAndrey Utkin /* 165*34d1324eSAndrey Utkin * DDR Access Mode Select 166*34d1324eSAndrey Utkin * 0 Single R/W Access (Host <-> DDR) 167*34d1324eSAndrey Utkin * 1 Burst R/W Access (Host <-> DPR) 168*34d1324eSAndrey Utkin */ 169*34d1324eSAndrey Utkin #define TW5864_DDR_MODE BIT(15) 170*34d1324eSAndrey Utkin 171*34d1324eSAndrey Utkin /* The original frame capture pointer. Two bits for each channel */ 172*34d1324eSAndrey Utkin /* SENIF_ORG_FRM_PTR [15:0] */ 173*34d1324eSAndrey Utkin #define TW5864_SENIF_ORG_FRM_PTR1 0x0038 174*34d1324eSAndrey Utkin /* SENIF_ORG_FRM_PTR [31:16] */ 175*34d1324eSAndrey Utkin #define TW5864_SENIF_ORG_FRM_PTR2 0x003c 176*34d1324eSAndrey Utkin 177*34d1324eSAndrey Utkin #define TW5864_DSP_SEN_MODE 0x0040 178*34d1324eSAndrey Utkin /* Define controls in register TW5864_DSP_SEN_MODE */ 179*34d1324eSAndrey Utkin #define TW5864_DSP_SEN_MODE_CH0 0x000f 180*34d1324eSAndrey Utkin #define TW5864_DSP_SEN_MODE_CH1 0x00f0 181*34d1324eSAndrey Utkin 182*34d1324eSAndrey Utkin /* 183*34d1324eSAndrey Utkin * [15:0]: ENC_BUF_PTR_REC[31:16] Two bit for each channel (channel 8 ~ 15). 184*34d1324eSAndrey Utkin * Each two bits are the buffer pointer for the last encoded frame of a channel 185*34d1324eSAndrey Utkin */ 186*34d1324eSAndrey Utkin #define TW5864_ENC_BUF_PTR_REC2 0x004c 187*34d1324eSAndrey Utkin 188*34d1324eSAndrey Utkin /* Current MV Flag Status Pointer for Channel n. (Read only) */ 189*34d1324eSAndrey Utkin /* 190*34d1324eSAndrey Utkin * [1:0] CH0_MV_PTR, ..., [15:14] CH7_MV_PTR 191*34d1324eSAndrey Utkin */ 192*34d1324eSAndrey Utkin #define TW5864_CH_MV_PTR1 0x0060 193*34d1324eSAndrey Utkin /* 194*34d1324eSAndrey Utkin * [1:0] CH8_MV_PTR, ..., [15:14] CH15_MV_PTR 195*34d1324eSAndrey Utkin */ 196*34d1324eSAndrey Utkin #define TW5864_CH_MV_PTR2 0x0064 197*34d1324eSAndrey Utkin 198*34d1324eSAndrey Utkin /* 199*34d1324eSAndrey Utkin * [15:0] Reset Current MV Flag Status Pointer for Channel n (one bit each) 200*34d1324eSAndrey Utkin */ 201*34d1324eSAndrey Utkin #define TW5864_RST_MV_PTR 0x0068 202*34d1324eSAndrey Utkin #define TW5864_INTERLACING 0x0200 203*34d1324eSAndrey Utkin /* Define controls in register TW5864_INTERLACING */ 204*34d1324eSAndrey Utkin /* 205*34d1324eSAndrey Utkin * Inter_Mode Start. 2-nd bit? A guess. Missing in datasheet. Without this bit 206*34d1324eSAndrey Utkin * set, the output video is interlaced (stripy). 207*34d1324eSAndrey Utkin */ 208*34d1324eSAndrey Utkin #define TW5864_DSP_INTER_ST BIT(1) 209*34d1324eSAndrey Utkin /* Deinterlacer Enable */ 210*34d1324eSAndrey Utkin #define TW5864_DI_EN BIT(2) 211*34d1324eSAndrey Utkin /* 212*34d1324eSAndrey Utkin * De-interlacer Mode 213*34d1324eSAndrey Utkin * 1 Shuffled frame 214*34d1324eSAndrey Utkin * 0 Normal Un-Shuffled Frame 215*34d1324eSAndrey Utkin */ 216*34d1324eSAndrey Utkin #define TW5864_DI_MD BIT(3) 217*34d1324eSAndrey Utkin /* 218*34d1324eSAndrey Utkin * Down scale original frame in X direction 219*34d1324eSAndrey Utkin * 11: Un-used 220*34d1324eSAndrey Utkin * 10: down-sample to 1/4 221*34d1324eSAndrey Utkin * 01: down-sample to 1/2 222*34d1324eSAndrey Utkin * 00: down-sample disabled 223*34d1324eSAndrey Utkin */ 224*34d1324eSAndrey Utkin #define TW5864_DSP_DWN_X (3 << 4) 225*34d1324eSAndrey Utkin /* 226*34d1324eSAndrey Utkin * Down scale original frame in Y direction 227*34d1324eSAndrey Utkin * 11: Un-used 228*34d1324eSAndrey Utkin * 10: down-sample to 1/4 229*34d1324eSAndrey Utkin * 01: down-sample to 1/2 230*34d1324eSAndrey Utkin * 00: down-sample disabled 231*34d1324eSAndrey Utkin */ 232*34d1324eSAndrey Utkin #define TW5864_DSP_DWN_Y (3 << 6) 233*34d1324eSAndrey Utkin /* 234*34d1324eSAndrey Utkin * 1 Dual Stream 235*34d1324eSAndrey Utkin * 0 Single Stream 236*34d1324eSAndrey Utkin */ 237*34d1324eSAndrey Utkin #define TW5864_DUAL_STR BIT(8) 238*34d1324eSAndrey Utkin 239*34d1324eSAndrey Utkin #define TW5864_DSP_REF 0x0204 240*34d1324eSAndrey Utkin /* Define controls in register TW5864_DSP_REF */ 241*34d1324eSAndrey Utkin /* Number of reference frame (Default 1 for TW5864B) */ 242*34d1324eSAndrey Utkin #define TW5864_DSP_REF_FRM 0x000f 243*34d1324eSAndrey Utkin /* Window size */ 244*34d1324eSAndrey Utkin #define TW5864_DSP_WIN_SIZE 0x02f0 245*34d1324eSAndrey Utkin 246*34d1324eSAndrey Utkin #define TW5864_DSP_SKIP 0x0208 247*34d1324eSAndrey Utkin /* Define controls in register TW5864_DSP_SKIP */ 248*34d1324eSAndrey Utkin /* 249*34d1324eSAndrey Utkin * Skip Offset Enable bit 250*34d1324eSAndrey Utkin * 0 DSP_SKIP_OFFSET value is not used (default 8) 251*34d1324eSAndrey Utkin * 1 DSP_SKIP_OFFSET value is used in HW 252*34d1324eSAndrey Utkin */ 253*34d1324eSAndrey Utkin #define TW5864_DSP_SKIP_OFEN 0x0080 254*34d1324eSAndrey Utkin /* Skip mode cost offset (default 8) */ 255*34d1324eSAndrey Utkin #define TW5864_DSP_SKIP_OFFSET 0x007f 256*34d1324eSAndrey Utkin 257*34d1324eSAndrey Utkin #define TW5864_MOTION_SEARCH_ETC 0x020c 258*34d1324eSAndrey Utkin /* Define controls in register TW5864_MOTION_SEARCH_ETC */ 259*34d1324eSAndrey Utkin /* Enable quarter pel search mode */ 260*34d1324eSAndrey Utkin #define TW5864_QPEL_EN BIT(0) 261*34d1324eSAndrey Utkin /* Enable half pel search mode */ 262*34d1324eSAndrey Utkin #define TW5864_HPEL_EN BIT(1) 263*34d1324eSAndrey Utkin /* Enable motion search mode */ 264*34d1324eSAndrey Utkin #define TW5864_ME_EN BIT(2) 265*34d1324eSAndrey Utkin /* Enable Intra mode */ 266*34d1324eSAndrey Utkin #define TW5864_INTRA_EN BIT(3) 267*34d1324eSAndrey Utkin /* Enable Skip Mode */ 268*34d1324eSAndrey Utkin #define TW5864_SKIP_EN BIT(4) 269*34d1324eSAndrey Utkin /* Search Option (Default 2"b01) */ 270*34d1324eSAndrey Utkin #define TW5864_SRCH_OPT (3 << 5) 271*34d1324eSAndrey Utkin 272*34d1324eSAndrey Utkin #define TW5864_DSP_ENC_REC 0x0210 273*34d1324eSAndrey Utkin /* Define controls in register TW5864_DSP_ENC_REC */ 274*34d1324eSAndrey Utkin /* Reference Buffer Pointer for encoding */ 275*34d1324eSAndrey Utkin #define TW5864_DSP_ENC_REF_PTR 0x0007 276*34d1324eSAndrey Utkin /* Reconstruct Buffer pointer */ 277*34d1324eSAndrey Utkin #define TW5864_DSP_REC_BUF_PTR 0x7000 278*34d1324eSAndrey Utkin 279*34d1324eSAndrey Utkin /* [15:0] Lambda Value for H264 */ 280*34d1324eSAndrey Utkin #define TW5864_DSP_REF_MVP_LAMBDA 0x0214 281*34d1324eSAndrey Utkin 282*34d1324eSAndrey Utkin #define TW5864_DSP_PIC_MAX_MB 0x0218 283*34d1324eSAndrey Utkin /* Define controls in register TW5864_DSP_PIC_MAX_MB */ 284*34d1324eSAndrey Utkin /* The MB number in Y direction for a frame */ 285*34d1324eSAndrey Utkin #define TW5864_DSP_PIC_MAX_MB_Y 0x007f 286*34d1324eSAndrey Utkin /* The MB number in X direction for a frame */ 287*34d1324eSAndrey Utkin #define TW5864_DSP_PIC_MAX_MB_X 0x7f00 288*34d1324eSAndrey Utkin 289*34d1324eSAndrey Utkin /* The original frame pointer for encoding */ 290*34d1324eSAndrey Utkin #define TW5864_DSP_ENC_ORG_PTR_REG 0x021c 291*34d1324eSAndrey Utkin /* Mask to use with TW5864_DSP_ENC_ORG_PTR */ 292*34d1324eSAndrey Utkin #define TW5864_DSP_ENC_ORG_PTR_MASK 0x7000 293*34d1324eSAndrey Utkin /* Number of bits to shift with TW5864_DSP_ENC_ORG_PTR */ 294*34d1324eSAndrey Utkin #define TW5864_DSP_ENC_ORG_PTR_SHIFT 12 295*34d1324eSAndrey Utkin 296*34d1324eSAndrey Utkin /* DDR base address of OSD rectangle attribute data */ 297*34d1324eSAndrey Utkin #define TW5864_DSP_OSD_ATTRI_BASE 0x0220 298*34d1324eSAndrey Utkin /* OSD enable bit for each channel */ 299*34d1324eSAndrey Utkin #define TW5864_DSP_OSD_ENABLE 0x0228 300*34d1324eSAndrey Utkin 301*34d1324eSAndrey Utkin /* 0x0280 ~ 0x029c – Motion Vector for 1st 4x4 Block, e.g., 80 (X), 84 (Y) */ 302*34d1324eSAndrey Utkin #define TW5864_ME_MV_VEC1 0x0280 303*34d1324eSAndrey Utkin /* 0x02a0 ~ 0x02bc – Motion Vector for 2nd 4x4 Block, e.g., A0 (X), A4 (Y) */ 304*34d1324eSAndrey Utkin #define TW5864_ME_MV_VEC2 0x02a0 305*34d1324eSAndrey Utkin /* 0x02c0 ~ 0x02dc – Motion Vector for 3rd 4x4 Block, e.g., C0 (X), C4 (Y) */ 306*34d1324eSAndrey Utkin #define TW5864_ME_MV_VEC3 0x02c0 307*34d1324eSAndrey Utkin /* 0x02e0 ~ 0x02fc – Motion Vector for 4th 4x4 Block, e.g., E0 (X), E4 (Y) */ 308*34d1324eSAndrey Utkin #define TW5864_ME_MV_VEC4 0x02e0 309*34d1324eSAndrey Utkin 310*34d1324eSAndrey Utkin /* 311*34d1324eSAndrey Utkin * [5:0] 312*34d1324eSAndrey Utkin * if (intra16x16_cost < (intra4x4_cost+dsp_i4x4_offset)) 313*34d1324eSAndrey Utkin * Intra_mode = intra16x16_mode 314*34d1324eSAndrey Utkin * Else 315*34d1324eSAndrey Utkin * Intra_mode = intra4x4_mode 316*34d1324eSAndrey Utkin */ 317*34d1324eSAndrey Utkin #define TW5864_DSP_I4x4_OFFSET 0x040c 318*34d1324eSAndrey Utkin 319*34d1324eSAndrey Utkin /* 320*34d1324eSAndrey Utkin * [6:4] 321*34d1324eSAndrey Utkin * 0x5 Only 4x4 322*34d1324eSAndrey Utkin * 0x6 Only 16x16 323*34d1324eSAndrey Utkin * 0x7 16x16 & 4x4 324*34d1324eSAndrey Utkin */ 325*34d1324eSAndrey Utkin #define TW5864_DSP_INTRA_MODE 0x0410 326*34d1324eSAndrey Utkin #define TW5864_DSP_INTRA_MODE_SHIFT 4 327*34d1324eSAndrey Utkin #define TW5864_DSP_INTRA_MODE_MASK (7 << 4) 328*34d1324eSAndrey Utkin #define TW5864_DSP_INTRA_MODE_4x4 0x5 329*34d1324eSAndrey Utkin #define TW5864_DSP_INTRA_MODE_16x16 0x6 330*34d1324eSAndrey Utkin #define TW5864_DSP_INTRA_MODE_4x4_AND_16x16 0x7 331*34d1324eSAndrey Utkin /* 332*34d1324eSAndrey Utkin * [5:0] WEIGHT Factor for I4x4 cost calculation (QP dependent) 333*34d1324eSAndrey Utkin */ 334*34d1324eSAndrey Utkin #define TW5864_DSP_I4x4_WEIGHT 0x0414 335*34d1324eSAndrey Utkin 336*34d1324eSAndrey Utkin /* 337*34d1324eSAndrey Utkin * [7:0] Offset used to affect Intra/ME model decision 338*34d1324eSAndrey Utkin * If (me_cost < intra_cost + dsp_resid_mode_offset) 339*34d1324eSAndrey Utkin * Pred_Mode = me_mode 340*34d1324eSAndrey Utkin * Else 341*34d1324eSAndrey Utkin * Pred_mode = intra_mode 342*34d1324eSAndrey Utkin */ 343*34d1324eSAndrey Utkin #define TW5864_DSP_RESID_MODE_OFFSET 0x0604 344*34d1324eSAndrey Utkin 345*34d1324eSAndrey Utkin /* 0x0800 ~ 0x09ff - Quantization TABLE Values */ 346*34d1324eSAndrey Utkin #define TW5864_QUAN_TAB 0x0800 347*34d1324eSAndrey Utkin 348*34d1324eSAndrey Utkin /* Valid channel value [0; f], frame value [0; 3] */ 349*34d1324eSAndrey Utkin #define TW5864_RT_CNTR_CH_FRM(channel, frame) \ 350*34d1324eSAndrey Utkin (0x0c00 | (channel << 4) | (frame << 2)) 351*34d1324eSAndrey Utkin 352*34d1324eSAndrey Utkin #define TW5864_FRAME_BUS1 0x0d00 353*34d1324eSAndrey Utkin /* 354*34d1324eSAndrey Utkin * 1 Progressive in part A in bus n 355*34d1324eSAndrey Utkin * 0 Interlaced in part A in bus n 356*34d1324eSAndrey Utkin */ 357*34d1324eSAndrey Utkin #define TW5864_PROG_A BIT(0) 358*34d1324eSAndrey Utkin /* 359*34d1324eSAndrey Utkin * 1 Progressive in part B in bus n 360*34d1324eSAndrey Utkin * 0 Interlaced in part B in bus n 361*34d1324eSAndrey Utkin */ 362*34d1324eSAndrey Utkin #define TW5864_PROG_B BIT(1) 363*34d1324eSAndrey Utkin /* 364*34d1324eSAndrey Utkin * 1 Frame Mode in bus n 365*34d1324eSAndrey Utkin * 0 Field Mode in bus n 366*34d1324eSAndrey Utkin */ 367*34d1324eSAndrey Utkin #define TW5864_FRAME BIT(2) 368*34d1324eSAndrey Utkin /* 369*34d1324eSAndrey Utkin * 0 4CIF in bus n 370*34d1324eSAndrey Utkin * 1 1D1 + 4 CIF in bus n 371*34d1324eSAndrey Utkin * 2 2D1 in bus n 372*34d1324eSAndrey Utkin */ 373*34d1324eSAndrey Utkin #define TW5864_BUS_D1 (3 << 3) 374*34d1324eSAndrey Utkin /* Bus 1 goes in TW5864_FRAME_BUS1 in [4:0] */ 375*34d1324eSAndrey Utkin /* Bus 2 goes in TW5864_FRAME_BUS1 in [12:8] */ 376*34d1324eSAndrey Utkin #define TW5864_FRAME_BUS2 0x0d04 377*34d1324eSAndrey Utkin /* Bus 3 goes in TW5864_FRAME_BUS2 in [4:0] */ 378*34d1324eSAndrey Utkin /* Bus 4 goes in TW5864_FRAME_BUS2 in [12:8] */ 379*34d1324eSAndrey Utkin 380*34d1324eSAndrey Utkin /* [15:0] Horizontal Mirror for channel n */ 381*34d1324eSAndrey Utkin #define TW5864_SENIF_HOR_MIR 0x0d08 382*34d1324eSAndrey Utkin /* [15:0] Vertical Mirror for channel n */ 383*34d1324eSAndrey Utkin #define TW5864_SENIF_VER_MIR 0x0d0c 384*34d1324eSAndrey Utkin 385*34d1324eSAndrey Utkin /* 386*34d1324eSAndrey Utkin * FRAME_WIDTH_BUSn_A 387*34d1324eSAndrey Utkin * 0x15f: 4 CIF 388*34d1324eSAndrey Utkin * 0x2cf: 1 D1 + 3 CIF 389*34d1324eSAndrey Utkin * 0x2cf: 2 D1 390*34d1324eSAndrey Utkin * FRAME_WIDTH_BUSn_B 391*34d1324eSAndrey Utkin * 0x15f: 4 CIF 392*34d1324eSAndrey Utkin * 0x2cf: 1 D1 + 3 CIF 393*34d1324eSAndrey Utkin * 0x2cf: 2 D1 394*34d1324eSAndrey Utkin * FRAME_HEIGHT_BUSn_A 395*34d1324eSAndrey Utkin * 0x11f: 4CIF (PAL) 396*34d1324eSAndrey Utkin * 0x23f: 1D1 + 3CIF (PAL) 397*34d1324eSAndrey Utkin * 0x23f: 2 D1 (PAL) 398*34d1324eSAndrey Utkin * 0x0ef: 4CIF (NTSC) 399*34d1324eSAndrey Utkin * 0x1df: 1D1 + 3CIF (NTSC) 400*34d1324eSAndrey Utkin * 0x1df: 2 D1 (NTSC) 401*34d1324eSAndrey Utkin * FRAME_HEIGHT_BUSn_B 402*34d1324eSAndrey Utkin * 0x11f: 4CIF (PAL) 403*34d1324eSAndrey Utkin * 0x23f: 1D1 + 3CIF (PAL) 404*34d1324eSAndrey Utkin * 0x23f: 2 D1 (PAL) 405*34d1324eSAndrey Utkin * 0x0ef: 4CIF (NTSC) 406*34d1324eSAndrey Utkin * 0x1df: 1D1 + 3CIF (NTSC) 407*34d1324eSAndrey Utkin * 0x1df: 2 D1 (NTSC) 408*34d1324eSAndrey Utkin */ 409*34d1324eSAndrey Utkin #define TW5864_FRAME_WIDTH_BUS_A(bus) (0x0d10 + 0x0010 * bus) 410*34d1324eSAndrey Utkin #define TW5864_FRAME_WIDTH_BUS_B(bus) (0x0d14 + 0x0010 * bus) 411*34d1324eSAndrey Utkin #define TW5864_FRAME_HEIGHT_BUS_A(bus) (0x0d18 + 0x0010 * bus) 412*34d1324eSAndrey Utkin #define TW5864_FRAME_HEIGHT_BUS_B(bus) (0x0d1c + 0x0010 * bus) 413*34d1324eSAndrey Utkin 414*34d1324eSAndrey Utkin /* 415*34d1324eSAndrey Utkin * 1: the bus mapped Channel n Full D1 416*34d1324eSAndrey Utkin * 0: the bus mapped Channel n Half D1 417*34d1324eSAndrey Utkin */ 418*34d1324eSAndrey Utkin #define TW5864_FULL_HALF_FLAG 0x0d50 419*34d1324eSAndrey Utkin 420*34d1324eSAndrey Utkin /* 421*34d1324eSAndrey Utkin * 0 The bus mapped Channel select partA Mode 422*34d1324eSAndrey Utkin * 1 The bus mapped Channel select partB Mode 423*34d1324eSAndrey Utkin */ 424*34d1324eSAndrey Utkin #define TW5864_FULL_HALF_MODE_SEL 0x0d54 425*34d1324eSAndrey Utkin 426*34d1324eSAndrey Utkin #define TW5864_VLC 0x1000 427*34d1324eSAndrey Utkin /* Define controls in register TW5864_VLC */ 428*34d1324eSAndrey Utkin /* QP Value used by H264 CAVLC */ 429*34d1324eSAndrey Utkin #define TW5864_VLC_SLICE_QP 0x003f 430*34d1324eSAndrey Utkin /* 431*34d1324eSAndrey Utkin * Swap byte order of VLC stream in d-word. 432*34d1324eSAndrey Utkin * 1 Normal (VLC output= [31:0]) 433*34d1324eSAndrey Utkin * 0 Swap (VLC output={[23:16],[31:24],[7:0], [15:8]}) 434*34d1324eSAndrey Utkin */ 435*34d1324eSAndrey Utkin #define TW5864_VLC_BYTE_SWP BIT(6) 436*34d1324eSAndrey Utkin /* Enable Adding 03 circuit for VLC stream */ 437*34d1324eSAndrey Utkin #define TW5864_VLC_ADD03_EN BIT(7) 438*34d1324eSAndrey Utkin /* Number of bit for VLC bit Align */ 439*34d1324eSAndrey Utkin #define TW5864_VLC_BIT_ALIGN_SHIFT 8 440*34d1324eSAndrey Utkin #define TW5864_VLC_BIT_ALIGN_MASK (0x1f << 8) 441*34d1324eSAndrey Utkin /* 442*34d1324eSAndrey Utkin * Synchronous Interface select for VLC Stream 443*34d1324eSAndrey Utkin * 1 CDC_VLCS_MAS read VLC stream 444*34d1324eSAndrey Utkin * 0 CPU read VLC stream 445*34d1324eSAndrey Utkin */ 446*34d1324eSAndrey Utkin #define TW5864_VLC_INF_SEL BIT(13) 447*34d1324eSAndrey Utkin /* Enable VLC overflow control */ 448*34d1324eSAndrey Utkin #define TW5864_VLC_OVFL_CNTL BIT(14) 449*34d1324eSAndrey Utkin /* 450*34d1324eSAndrey Utkin * 1 PCI Master Mode 451*34d1324eSAndrey Utkin * 0 Non PCI Master Mode 452*34d1324eSAndrey Utkin */ 453*34d1324eSAndrey Utkin #define TW5864_VLC_PCI_SEL BIT(15) 454*34d1324eSAndrey Utkin /* 455*34d1324eSAndrey Utkin * 0 Enable Adding 03 to VLC header and stream 456*34d1324eSAndrey Utkin * 1 Disable Adding 03 to VLC header of "00000001" 457*34d1324eSAndrey Utkin */ 458*34d1324eSAndrey Utkin #define TW5864_VLC_A03_DISAB BIT(16) 459*34d1324eSAndrey Utkin /* 460*34d1324eSAndrey Utkin * Status of VLC stream in DDR (one bit for each buffer) 461*34d1324eSAndrey Utkin * 1 VLC is ready in buffer n (HW set) 462*34d1324eSAndrey Utkin * 0 VLC is not ready in buffer n (SW clear) 463*34d1324eSAndrey Utkin */ 464*34d1324eSAndrey Utkin #define TW5864_VLC_BUF_RDY_SHIFT 24 465*34d1324eSAndrey Utkin #define TW5864_VLC_BUF_RDY_MASK (0xff << 24) 466*34d1324eSAndrey Utkin 467*34d1324eSAndrey Utkin /* Total number of bit in the slice */ 468*34d1324eSAndrey Utkin #define TW5864_SLICE_TOTAL_BIT 0x1004 469*34d1324eSAndrey Utkin /* Total number of bit in the residue */ 470*34d1324eSAndrey Utkin #define TW5864_RES_TOTAL_BIT 0x1008 471*34d1324eSAndrey Utkin 472*34d1324eSAndrey Utkin #define TW5864_VLC_BUF 0x100c 473*34d1324eSAndrey Utkin /* Define controls in register TW5864_VLC_BUF */ 474*34d1324eSAndrey Utkin /* VLC BK0 full status, write ‘1’ to clear */ 475*34d1324eSAndrey Utkin #define TW5864_VLC_BK0_FULL BIT(0) 476*34d1324eSAndrey Utkin /* VLC BK1 full status, write ‘1’ to clear */ 477*34d1324eSAndrey Utkin #define TW5864_VLC_BK1_FULL BIT(1) 478*34d1324eSAndrey Utkin /* VLC end slice status, write ‘1’ to clear */ 479*34d1324eSAndrey Utkin #define TW5864_VLC_END_SLICE BIT(2) 480*34d1324eSAndrey Utkin /* VLC Buffer overflow status, write ‘1’ to clear */ 481*34d1324eSAndrey Utkin #define TW5864_DSP_RD_OF BIT(3) 482*34d1324eSAndrey Utkin /* VLC string length in either buffer 0 or 1 at end of frame */ 483*34d1324eSAndrey Utkin #define TW5864_VLC_STREAM_LEN_SHIFT 4 484*34d1324eSAndrey Utkin #define TW5864_VLC_STREAM_LEN_MASK (0x1ff << 4) 485*34d1324eSAndrey Utkin 486*34d1324eSAndrey Utkin /* [15:0] Total coefficient number in a frame */ 487*34d1324eSAndrey Utkin #define TW5864_TOTAL_COEF_NO 0x1010 488*34d1324eSAndrey Utkin /* [0] VLC Encoder Interrupt. Write ‘1’ to clear */ 489*34d1324eSAndrey Utkin #define TW5864_VLC_DSP_INTR 0x1014 490*34d1324eSAndrey Utkin /* [31:0] VLC stream CRC checksum */ 491*34d1324eSAndrey Utkin #define TW5864_VLC_STREAM_CRC 0x1018 492*34d1324eSAndrey Utkin 493*34d1324eSAndrey Utkin #define TW5864_VLC_RD 0x101c 494*34d1324eSAndrey Utkin /* Define controls in register TW5864_VLC_RD */ 495*34d1324eSAndrey Utkin /* 496*34d1324eSAndrey Utkin * 1 Read VLC lookup Memory 497*34d1324eSAndrey Utkin * 0 Read VLC Stream Memory 498*34d1324eSAndrey Utkin */ 499*34d1324eSAndrey Utkin #define TW5864_VLC_RD_MEM BIT(0) 500*34d1324eSAndrey Utkin /* 501*34d1324eSAndrey Utkin * 1 Read VLC Stream Memory in burst mode 502*34d1324eSAndrey Utkin * 0 Read VLC Stream Memory in single mode 503*34d1324eSAndrey Utkin */ 504*34d1324eSAndrey Utkin #define TW5864_VLC_RD_BRST BIT(1) 505*34d1324eSAndrey Utkin 506*34d1324eSAndrey Utkin /* 0x2000 ~ 0x2ffc -- H264 Stream Memory Map */ 507*34d1324eSAndrey Utkin /* 508*34d1324eSAndrey Utkin * A word is 4 bytes. I.e., 509*34d1324eSAndrey Utkin * VLC_STREAM_MEM[0] address: 0x2000 510*34d1324eSAndrey Utkin * VLC_STREAM_MEM[1] address: 0x2004 511*34d1324eSAndrey Utkin * ... 512*34d1324eSAndrey Utkin * VLC_STREAM_MEM[3FF] address: 0x2ffc 513*34d1324eSAndrey Utkin */ 514*34d1324eSAndrey Utkin #define TW5864_VLC_STREAM_MEM_START 0x2000 515*34d1324eSAndrey Utkin #define TW5864_VLC_STREAM_MEM_MAX_OFFSET 0x3ff 516*34d1324eSAndrey Utkin #define TW5864_VLC_STREAM_MEM(offset) (TW5864_VLC_STREAM_MEM_START + 4 * offset) 517*34d1324eSAndrey Utkin 518*34d1324eSAndrey Utkin /* 0x4000 ~ 0x4ffc -- Audio Register Map */ 519*34d1324eSAndrey Utkin /* [31:0] config 1ms cnt = Realtime clk/1000 */ 520*34d1324eSAndrey Utkin #define TW5864_CFG_1MS_CNT 0x4000 521*34d1324eSAndrey Utkin 522*34d1324eSAndrey Utkin #define TW5864_ADPCM 0x4004 523*34d1324eSAndrey Utkin /* Define controls in register TW5864_ADPCM */ 524*34d1324eSAndrey Utkin /* ADPCM decoder enable */ 525*34d1324eSAndrey Utkin #define TW5864_ADPCM_DEC BIT(0) 526*34d1324eSAndrey Utkin /* ADPCM input data enable */ 527*34d1324eSAndrey Utkin #define TW5864_ADPCM_IN_DATA BIT(1) 528*34d1324eSAndrey Utkin /* ADPCM encoder enable */ 529*34d1324eSAndrey Utkin #define TW5864_ADPCM_ENC BIT(2) 530*34d1324eSAndrey Utkin 531*34d1324eSAndrey Utkin #define TW5864_AUD 0x4008 532*34d1324eSAndrey Utkin /* Define controls in register TW5864_AUD */ 533*34d1324eSAndrey Utkin /* Record path PCM Audio enable bit for each channel */ 534*34d1324eSAndrey Utkin #define TW5864_AUD_ORG_CH_EN 0x00ff 535*34d1324eSAndrey Utkin /* Speaker path PCM Audio Enable */ 536*34d1324eSAndrey Utkin #define TW5864_SPK_ORG_EN BIT(16) 537*34d1324eSAndrey Utkin /* 538*34d1324eSAndrey Utkin * 0 16bit 539*34d1324eSAndrey Utkin * 1 8bit 540*34d1324eSAndrey Utkin */ 541*34d1324eSAndrey Utkin #define TW5864_AD_BIT_MODE BIT(17) 542*34d1324eSAndrey Utkin #define TW5864_AUD_TYPE_SHIFT 18 543*34d1324eSAndrey Utkin /* 544*34d1324eSAndrey Utkin * 0 PCM 545*34d1324eSAndrey Utkin * 3 ADPCM 546*34d1324eSAndrey Utkin */ 547*34d1324eSAndrey Utkin #define TW5864_AUD_TYPE (0xf << 18) 548*34d1324eSAndrey Utkin #define TW5864_AUD_SAMPLE_RATE_SHIFT 22 549*34d1324eSAndrey Utkin /* 550*34d1324eSAndrey Utkin * 0 8K 551*34d1324eSAndrey Utkin * 1 16K 552*34d1324eSAndrey Utkin */ 553*34d1324eSAndrey Utkin #define TW5864_AUD_SAMPLE_RATE (3 << 22) 554*34d1324eSAndrey Utkin /* Channel ID used to select audio channel (0 to 16) for loopback */ 555*34d1324eSAndrey Utkin #define TW5864_TESTLOOP_CHID_SHIFT 24 556*34d1324eSAndrey Utkin #define TW5864_TESTLOOP_CHID (0x1f << 24) 557*34d1324eSAndrey Utkin /* Enable AD Loopback Test */ 558*34d1324eSAndrey Utkin #define TW5864_TEST_ADLOOP_EN BIT(30) 559*34d1324eSAndrey Utkin /* 560*34d1324eSAndrey Utkin * 0 Asynchronous Mode or PCI target mode 561*34d1324eSAndrey Utkin * 1 PCI Initiator Mode 562*34d1324eSAndrey Utkin */ 563*34d1324eSAndrey Utkin #define TW5864_AUD_MODE BIT(31) 564*34d1324eSAndrey Utkin 565*34d1324eSAndrey Utkin #define TW5864_AUD_ADPCM 0x400c 566*34d1324eSAndrey Utkin /* Define controls in register TW5864_AUD_ADPCM */ 567*34d1324eSAndrey Utkin /* Record path ADPCM audio channel enable, one bit for each */ 568*34d1324eSAndrey Utkin #define TW5864_AUD_ADPCM_CH_EN 0x00ff 569*34d1324eSAndrey Utkin /* Speaker path ADPCM audio channel enable */ 570*34d1324eSAndrey Utkin #define TW5864_SPK_ADPCM_EN BIT(16) 571*34d1324eSAndrey Utkin 572*34d1324eSAndrey Utkin #define TW5864_PC_BLOCK_ADPCM_RD_NO 0x4018 573*34d1324eSAndrey Utkin #define TW5864_PC_BLOCK_ADPCM_RD_NO_MASK 0x1f 574*34d1324eSAndrey Utkin 575*34d1324eSAndrey Utkin /* 576*34d1324eSAndrey Utkin * For ADPCM_ENC_WR_PTR, ADPCM_ENC_RD_PTR (see below): 577*34d1324eSAndrey Utkin * Bit[2:0] ch0 578*34d1324eSAndrey Utkin * Bit[5:3] ch1 579*34d1324eSAndrey Utkin * Bit[8:6] ch2 580*34d1324eSAndrey Utkin * Bit[11:9] ch3 581*34d1324eSAndrey Utkin * Bit[14:12] ch4 582*34d1324eSAndrey Utkin * Bit[17:15] ch5 583*34d1324eSAndrey Utkin * Bit[20:18] ch6 584*34d1324eSAndrey Utkin * Bit[23:21] ch7 585*34d1324eSAndrey Utkin * Bit[26:24] ch8 586*34d1324eSAndrey Utkin * Bit[29:27] ch9 587*34d1324eSAndrey Utkin * Bit[32:30] ch10 588*34d1324eSAndrey Utkin * Bit[35:33] ch11 589*34d1324eSAndrey Utkin * Bit[38:36] ch12 590*34d1324eSAndrey Utkin * Bit[41:39] ch13 591*34d1324eSAndrey Utkin * Bit[44:42] ch14 592*34d1324eSAndrey Utkin * Bit[47:45] ch15 593*34d1324eSAndrey Utkin * Bit[50:48] ch16 594*34d1324eSAndrey Utkin */ 595*34d1324eSAndrey Utkin #define TW5864_ADPCM_ENC_XX_MASK 0x3fff 596*34d1324eSAndrey Utkin #define TW5864_ADPCM_ENC_XX_PTR2_SHIFT 30 597*34d1324eSAndrey Utkin /* ADPCM_ENC_WR_PTR[29:0] */ 598*34d1324eSAndrey Utkin #define TW5864_ADPCM_ENC_WR_PTR1 0x401c 599*34d1324eSAndrey Utkin /* ADPCM_ENC_WR_PTR[50:30] */ 600*34d1324eSAndrey Utkin #define TW5864_ADPCM_ENC_WR_PTR2 0x4020 601*34d1324eSAndrey Utkin 602*34d1324eSAndrey Utkin /* ADPCM_ENC_RD_PTR[29:0] */ 603*34d1324eSAndrey Utkin #define TW5864_ADPCM_ENC_RD_PTR1 0x4024 604*34d1324eSAndrey Utkin /* ADPCM_ENC_RD_PTR[50:30] */ 605*34d1324eSAndrey Utkin #define TW5864_ADPCM_ENC_RD_PTR2 0x4028 606*34d1324eSAndrey Utkin 607*34d1324eSAndrey Utkin /* [3:0] rd ch0, [7:4] rd ch1, [11:8] wr ch0, [15:12] wr ch1 */ 608*34d1324eSAndrey Utkin #define TW5864_ADPCM_DEC_RD_WR_PTR 0x402c 609*34d1324eSAndrey Utkin 610*34d1324eSAndrey Utkin /* 611*34d1324eSAndrey Utkin * For TW5864_AD_ORIG_WR_PTR, TW5864_AD_ORIG_RD_PTR: 612*34d1324eSAndrey Utkin * Bit[3:0] ch0 613*34d1324eSAndrey Utkin * Bit[7:4] ch1 614*34d1324eSAndrey Utkin * Bit[11:8] ch2 615*34d1324eSAndrey Utkin * Bit[15:12] ch3 616*34d1324eSAndrey Utkin * Bit[19:16] ch4 617*34d1324eSAndrey Utkin * Bit[23:20] ch5 618*34d1324eSAndrey Utkin * Bit[27:24] ch6 619*34d1324eSAndrey Utkin * Bit[31:28] ch7 620*34d1324eSAndrey Utkin * Bit[35:32] ch8 621*34d1324eSAndrey Utkin * Bit[39:36] ch9 622*34d1324eSAndrey Utkin * Bit[43:40] ch10 623*34d1324eSAndrey Utkin * Bit[47:44] ch11 624*34d1324eSAndrey Utkin * Bit[51:48] ch12 625*34d1324eSAndrey Utkin * Bit[55:52] ch13 626*34d1324eSAndrey Utkin * Bit[59:56] ch14 627*34d1324eSAndrey Utkin * Bit[63:60] ch15 628*34d1324eSAndrey Utkin * Bit[67:64] ch16 629*34d1324eSAndrey Utkin */ 630*34d1324eSAndrey Utkin /* AD_ORIG_WR_PTR[31:0] */ 631*34d1324eSAndrey Utkin #define TW5864_AD_ORIG_WR_PTR1 0x4030 632*34d1324eSAndrey Utkin /* AD_ORIG_WR_PTR[63:32] */ 633*34d1324eSAndrey Utkin #define TW5864_AD_ORIG_WR_PTR2 0x4034 634*34d1324eSAndrey Utkin /* AD_ORIG_WR_PTR[67:64] */ 635*34d1324eSAndrey Utkin #define TW5864_AD_ORIG_WR_PTR3 0x4038 636*34d1324eSAndrey Utkin 637*34d1324eSAndrey Utkin /* AD_ORIG_RD_PTR[31:0] */ 638*34d1324eSAndrey Utkin #define TW5864_AD_ORIG_RD_PTR1 0x403c 639*34d1324eSAndrey Utkin /* AD_ORIG_RD_PTR[63:32] */ 640*34d1324eSAndrey Utkin #define TW5864_AD_ORIG_RD_PTR2 0x4040 641*34d1324eSAndrey Utkin /* AD_ORIG_RD_PTR[67:64] */ 642*34d1324eSAndrey Utkin #define TW5864_AD_ORIG_RD_PTR3 0x4044 643*34d1324eSAndrey Utkin 644*34d1324eSAndrey Utkin #define TW5864_PC_BLOCK_ORIG_RD_NO 0x4048 645*34d1324eSAndrey Utkin #define TW5864_PC_BLOCK_ORIG_RD_NO_MASK 0x1f 646*34d1324eSAndrey Utkin 647*34d1324eSAndrey Utkin #define TW5864_PCI_AUD 0x404c 648*34d1324eSAndrey Utkin /* Define controls in register TW5864_PCI_AUD */ 649*34d1324eSAndrey Utkin /* 650*34d1324eSAndrey Utkin * The register is applicable to PCI initiator mode only. Used to select PCM(0) 651*34d1324eSAndrey Utkin * or ADPCM(1) audio data sent to PC. One bit for each channel 652*34d1324eSAndrey Utkin */ 653*34d1324eSAndrey Utkin #define TW5864_PCI_DATA_SEL 0xffff 654*34d1324eSAndrey Utkin /* 655*34d1324eSAndrey Utkin * Audio flow control mode selection bit. 656*34d1324eSAndrey Utkin * 0 Flow control disabled. TW5864 continuously sends audio frame to PC 657*34d1324eSAndrey Utkin * (initiator mode) 658*34d1324eSAndrey Utkin * 1 Flow control enabled 659*34d1324eSAndrey Utkin */ 660*34d1324eSAndrey Utkin #define TW5864_PCI_FLOW_EN BIT(16) 661*34d1324eSAndrey Utkin /* 662*34d1324eSAndrey Utkin * When PCI_FLOW_EN is set, PCI need to toggle this bit to send an audio frame 663*34d1324eSAndrey Utkin * to PC. One toggle to send one frame. 664*34d1324eSAndrey Utkin */ 665*34d1324eSAndrey Utkin #define TW5864_PCI_AUD_FRM_EN BIT(17) 666*34d1324eSAndrey Utkin 667*34d1324eSAndrey Utkin /* [1:0] CS valid to data valid CLK cycles when writing operation */ 668*34d1324eSAndrey Utkin #define TW5864_CS2DAT_CNT 0x8000 669*34d1324eSAndrey Utkin /* [2:0] Data valid signal width by system clock cycles */ 670*34d1324eSAndrey Utkin #define TW5864_DATA_VLD_WIDTH 0x8004 671*34d1324eSAndrey Utkin 672*34d1324eSAndrey Utkin #define TW5864_SYNC 0x8008 673*34d1324eSAndrey Utkin /* Define controls in register TW5864_SYNC */ 674*34d1324eSAndrey Utkin /* 675*34d1324eSAndrey Utkin * 0 vlc stream to syncrous port 676*34d1324eSAndrey Utkin * 1 vlc stream to ddr buffers 677*34d1324eSAndrey Utkin */ 678*34d1324eSAndrey Utkin #define TW5864_SYNC_CFG BIT(7) 679*34d1324eSAndrey Utkin /* 680*34d1324eSAndrey Utkin * 0 SYNC Address sampled on Rising edge 681*34d1324eSAndrey Utkin * 1 SYNC Address sampled on Falling edge 682*34d1324eSAndrey Utkin */ 683*34d1324eSAndrey Utkin #define TW5864_SYNC_ADR_EDGE BIT(0) 684*34d1324eSAndrey Utkin #define TW5864_VLC_STR_DELAY_SHIFT 1 685*34d1324eSAndrey Utkin /* 686*34d1324eSAndrey Utkin * 0 No system delay 687*34d1324eSAndrey Utkin * 1 One system clock delay 688*34d1324eSAndrey Utkin * 2 Two system clock delay 689*34d1324eSAndrey Utkin * 3 Three system clock delay 690*34d1324eSAndrey Utkin */ 691*34d1324eSAndrey Utkin #define TW5864_VLC_STR_DELAY (3 << 1) 692*34d1324eSAndrey Utkin /* 693*34d1324eSAndrey Utkin * 0 Rising edge output 694*34d1324eSAndrey Utkin * 1 Falling edge output 695*34d1324eSAndrey Utkin */ 696*34d1324eSAndrey Utkin #define TW5864_VLC_OUT_EDGE BIT(3) 697*34d1324eSAndrey Utkin 698*34d1324eSAndrey Utkin /* 699*34d1324eSAndrey Utkin * [1:0] 700*34d1324eSAndrey Utkin * 2’b00 phase set to 180 degree 701*34d1324eSAndrey Utkin * 2’b01 phase set to 270 degree 702*34d1324eSAndrey Utkin * 2’b10 phase set to 0 degree 703*34d1324eSAndrey Utkin * 2’b11 phase set to 90 degree 704*34d1324eSAndrey Utkin */ 705*34d1324eSAndrey Utkin #define TW5864_I2C_PHASE_CFG 0x800c 706*34d1324eSAndrey Utkin 707*34d1324eSAndrey Utkin /* 708*34d1324eSAndrey Utkin * The system / DDR clock (166 MHz) is generated with an on-chip system clock 709*34d1324eSAndrey Utkin * PLL (SYSPLL) using input crystal clock of 27 MHz. The system clock PLL 710*34d1324eSAndrey Utkin * frequency is controlled with the following equation. 711*34d1324eSAndrey Utkin * CLK_OUT = CLK_IN * (M+1) / ((N+1) * P) 712*34d1324eSAndrey Utkin * SYSPLL_M M parameter 713*34d1324eSAndrey Utkin * SYSPLL_N N parameter 714*34d1324eSAndrey Utkin * SYSPLL_P P parameter 715*34d1324eSAndrey Utkin */ 716*34d1324eSAndrey Utkin /* SYSPLL_M[7:0] */ 717*34d1324eSAndrey Utkin #define TW5864_SYSPLL1 0x8018 718*34d1324eSAndrey Utkin /* Define controls in register TW5864_SYSPLL1 */ 719*34d1324eSAndrey Utkin #define TW5864_SYSPLL_M_LOW 0x00ff 720*34d1324eSAndrey Utkin 721*34d1324eSAndrey Utkin /* [2:0]: SYSPLL_M[10:8], [7:3]: SYSPLL_N[4:0] */ 722*34d1324eSAndrey Utkin #define TW5864_SYSPLL2 0x8019 723*34d1324eSAndrey Utkin /* Define controls in register TW5864_SYSPLL2 */ 724*34d1324eSAndrey Utkin #define TW5864_SYSPLL_M_HI 0x07 725*34d1324eSAndrey Utkin #define TW5864_SYSPLL_N_LOW_SHIFT 3 726*34d1324eSAndrey Utkin #define TW5864_SYSPLL_N_LOW (0x1f << 3) 727*34d1324eSAndrey Utkin 728*34d1324eSAndrey Utkin /* 729*34d1324eSAndrey Utkin * [1:0]: SYSPLL_N[6:5], [3:2]: SYSPLL_P, [4]: SYSPLL_IREF, [7:5]: SYSPLL_CP_SEL 730*34d1324eSAndrey Utkin */ 731*34d1324eSAndrey Utkin #define TW5864_SYSPLL3 0x8020 732*34d1324eSAndrey Utkin /* Define controls in register TW5864_SYSPLL3 */ 733*34d1324eSAndrey Utkin #define TW5864_SYSPLL_N_HI 0x03 734*34d1324eSAndrey Utkin #define TW5864_SYSPLL_P_SHIFT 2 735*34d1324eSAndrey Utkin #define TW5864_SYSPLL_P (0x03 << 2) 736*34d1324eSAndrey Utkin /* 737*34d1324eSAndrey Utkin * SYSPLL bias current control 738*34d1324eSAndrey Utkin * 0 Lower current (default) 739*34d1324eSAndrey Utkin * 1 30% higher current 740*34d1324eSAndrey Utkin */ 741*34d1324eSAndrey Utkin #define TW5864_SYSPLL_IREF BIT(4) 742*34d1324eSAndrey Utkin /* 743*34d1324eSAndrey Utkin * SYSPLL charge pump current selection 744*34d1324eSAndrey Utkin * 0 1,5 uA 745*34d1324eSAndrey Utkin * 1 4 uA 746*34d1324eSAndrey Utkin * 2 9 uA 747*34d1324eSAndrey Utkin * 3 19 uA 748*34d1324eSAndrey Utkin * 4 39 uA 749*34d1324eSAndrey Utkin * 5 79 uA 750*34d1324eSAndrey Utkin * 6 159 uA 751*34d1324eSAndrey Utkin * 7 319 uA 752*34d1324eSAndrey Utkin */ 753*34d1324eSAndrey Utkin #define TW5864_SYSPLL_CP_SEL_SHIFT 5 754*34d1324eSAndrey Utkin #define TW5864_SYSPLL_CP_SEL (0x07 << 5) 755*34d1324eSAndrey Utkin 756*34d1324eSAndrey Utkin /* 757*34d1324eSAndrey Utkin * [1:0]: SYSPLL_VCO, [3:2]: SYSPLL_LP_X8, [5:4]: SYSPLL_ICP_SEL, 758*34d1324eSAndrey Utkin * [6]: SYSPLL_LPF_5PF, [7]: SYSPLL_ED_SEL 759*34d1324eSAndrey Utkin */ 760*34d1324eSAndrey Utkin #define TW5864_SYSPLL4 0x8021 761*34d1324eSAndrey Utkin /* Define controls in register TW5864_SYSPLL4 */ 762*34d1324eSAndrey Utkin /* 763*34d1324eSAndrey Utkin * SYSPLL_VCO VCO Range selection 764*34d1324eSAndrey Utkin * 00 5 ~ 75 MHz 765*34d1324eSAndrey Utkin * 01 50 ~ 140 MHz 766*34d1324eSAndrey Utkin * 10 110 ~ 320 MHz 767*34d1324eSAndrey Utkin * 11 270 ~ 700 MHz 768*34d1324eSAndrey Utkin */ 769*34d1324eSAndrey Utkin #define TW5864_SYSPLL_VCO 0x03 770*34d1324eSAndrey Utkin #define TW5864_SYSPLL_LP_X8_SHIFT 2 771*34d1324eSAndrey Utkin /* 772*34d1324eSAndrey Utkin * Loop resister 773*34d1324eSAndrey Utkin * 0 38.5K ohms 774*34d1324eSAndrey Utkin * 1 6.6K ohms (default) 775*34d1324eSAndrey Utkin * 2 2.2K ohms 776*34d1324eSAndrey Utkin * 3 1.1K ohms 777*34d1324eSAndrey Utkin */ 778*34d1324eSAndrey Utkin #define TW5864_SYSPLL_LP_X8 (0x03 << 2) 779*34d1324eSAndrey Utkin #define TW5864_SYSPLL_ICP_SEL_SHIFT 4 780*34d1324eSAndrey Utkin /* 781*34d1324eSAndrey Utkin * PLL charge pump fine tune 782*34d1324eSAndrey Utkin * 00 x1 (default) 783*34d1324eSAndrey Utkin * 01 x1/2 784*34d1324eSAndrey Utkin * 10 x1/7 785*34d1324eSAndrey Utkin * 11 x1/8 786*34d1324eSAndrey Utkin */ 787*34d1324eSAndrey Utkin #define TW5864_SYSPLL_ICP_SEL (0x03 << 4) 788*34d1324eSAndrey Utkin /* 789*34d1324eSAndrey Utkin * PLL low pass filter phase margin adjustment 790*34d1324eSAndrey Utkin * 0 no 5pF (default) 791*34d1324eSAndrey Utkin * 1 5pF added 792*34d1324eSAndrey Utkin */ 793*34d1324eSAndrey Utkin #define TW5864_SYSPLL_LPF_5PF BIT(6) 794*34d1324eSAndrey Utkin /* 795*34d1324eSAndrey Utkin * PFD select edge for detection 796*34d1324eSAndrey Utkin * 0 Falling edge (default) 797*34d1324eSAndrey Utkin * 1 Rising edge 798*34d1324eSAndrey Utkin */ 799*34d1324eSAndrey Utkin #define TW5864_SYSPLL_ED_SEL BIT(7) 800*34d1324eSAndrey Utkin 801*34d1324eSAndrey Utkin /* [0]: SYSPLL_RST, [4]: SYSPLL_PD */ 802*34d1324eSAndrey Utkin #define TW5864_SYSPLL5 0x8024 803*34d1324eSAndrey Utkin /* Define controls in register TW5864_SYSPLL5 */ 804*34d1324eSAndrey Utkin /* Reset SYSPLL */ 805*34d1324eSAndrey Utkin #define TW5864_SYSPLL_RST BIT(0) 806*34d1324eSAndrey Utkin /* Power down SYSPLL */ 807*34d1324eSAndrey Utkin #define TW5864_SYSPLL_PD BIT(4) 808*34d1324eSAndrey Utkin 809*34d1324eSAndrey Utkin #define TW5864_PLL_CFG 0x801c 810*34d1324eSAndrey Utkin /* Define controls in register TW5864_PLL_CFG */ 811*34d1324eSAndrey Utkin /* 812*34d1324eSAndrey Utkin * Issue Soft Reset from Async Host Interface / PCI Interface clock domain. 813*34d1324eSAndrey Utkin * Become valid after sync to the xtal clock domain. This bit is set only if 814*34d1324eSAndrey Utkin * LOAD register bit is also set to 1. 815*34d1324eSAndrey Utkin */ 816*34d1324eSAndrey Utkin #define TW5864_SRST BIT(0) 817*34d1324eSAndrey Utkin /* 818*34d1324eSAndrey Utkin * Issue SYSPLL (166 MHz) configuration latch from Async host interface / PCI 819*34d1324eSAndrey Utkin * Interface clock domain. The configuration setting becomes effective only if 820*34d1324eSAndrey Utkin * LOAD register bit is also set to 1. 821*34d1324eSAndrey Utkin */ 822*34d1324eSAndrey Utkin #define TW5864_SYSPLL_CFG BIT(2) 823*34d1324eSAndrey Utkin /* 824*34d1324eSAndrey Utkin * Issue SPLL (108 MHz) configuration load from Async host interface / PCI 825*34d1324eSAndrey Utkin * Interface clock domain. The configuration setting becomes effective only if 826*34d1324eSAndrey Utkin * the LOAD register bit is also set to 1. 827*34d1324eSAndrey Utkin */ 828*34d1324eSAndrey Utkin #define TW5864_SPLL_CFG BIT(4) 829*34d1324eSAndrey Utkin /* 830*34d1324eSAndrey Utkin * Set this bit to latch the SRST, SYSPLL_CFG, SPLL_CFG setting into the xtal 831*34d1324eSAndrey Utkin * clock domain to restart the PLL. This bit is self cleared. 832*34d1324eSAndrey Utkin */ 833*34d1324eSAndrey Utkin #define TW5864_LOAD BIT(3) 834*34d1324eSAndrey Utkin 835*34d1324eSAndrey Utkin /* SPLL_IREF, SPLL_LPX4, SPLL_CPX4, SPLL_PD, SPLL_DBG */ 836*34d1324eSAndrey Utkin #define TW5864_SPLL 0x8028 837*34d1324eSAndrey Utkin 838*34d1324eSAndrey Utkin /* 0x8800 ~ 0x88fc -- Interrupt Register Map */ 839*34d1324eSAndrey Utkin /* 840*34d1324eSAndrey Utkin * Trigger mode of interrupt source 0 ~ 15 841*34d1324eSAndrey Utkin * 1 Edge trigger mode 842*34d1324eSAndrey Utkin * 0 Level trigger mode 843*34d1324eSAndrey Utkin */ 844*34d1324eSAndrey Utkin #define TW5864_TRIGGER_MODE_L 0x8800 845*34d1324eSAndrey Utkin /* Trigger mode of interrupt source 16 ~ 31 */ 846*34d1324eSAndrey Utkin #define TW5864_TRIGGER_MODE_H 0x8804 847*34d1324eSAndrey Utkin /* Enable of interrupt source 0 ~ 15 */ 848*34d1324eSAndrey Utkin #define TW5864_INTR_ENABLE_L 0x8808 849*34d1324eSAndrey Utkin /* Enable of interrupt source 16 ~ 31 */ 850*34d1324eSAndrey Utkin #define TW5864_INTR_ENABLE_H 0x880c 851*34d1324eSAndrey Utkin /* Clear interrupt command of interrupt source 0 ~ 15 */ 852*34d1324eSAndrey Utkin #define TW5864_INTR_CLR_L 0x8810 853*34d1324eSAndrey Utkin /* Clear interrupt command of interrupt source 16 ~ 31 */ 854*34d1324eSAndrey Utkin #define TW5864_INTR_CLR_H 0x8814 855*34d1324eSAndrey Utkin /* 856*34d1324eSAndrey Utkin * Assertion of interrupt source 0 ~ 15 857*34d1324eSAndrey Utkin * 1 High level or pos-edge is assertion 858*34d1324eSAndrey Utkin * 0 Low level or neg-edge is assertion 859*34d1324eSAndrey Utkin */ 860*34d1324eSAndrey Utkin #define TW5864_INTR_ASSERT_L 0x8818 861*34d1324eSAndrey Utkin /* Assertion of interrupt source 16 ~ 31 */ 862*34d1324eSAndrey Utkin #define TW5864_INTR_ASSERT_H 0x881c 863*34d1324eSAndrey Utkin /* 864*34d1324eSAndrey Utkin * Output level of interrupt 865*34d1324eSAndrey Utkin * 1 Interrupt output is high assertion 866*34d1324eSAndrey Utkin * 0 Interrupt output is low assertion 867*34d1324eSAndrey Utkin */ 868*34d1324eSAndrey Utkin #define TW5864_INTR_OUT_LEVEL 0x8820 869*34d1324eSAndrey Utkin /* 870*34d1324eSAndrey Utkin * Status of interrupt source 0 ~ 15 871*34d1324eSAndrey Utkin * Bit[0]: VLC 4k RAM interrupt 872*34d1324eSAndrey Utkin * Bit[1]: BURST DDR RAM interrupt 873*34d1324eSAndrey Utkin * Bit[2]: MV DSP interrupt 874*34d1324eSAndrey Utkin * Bit[3]: video lost interrupt 875*34d1324eSAndrey Utkin * Bit[4]: gpio 0 interrupt 876*34d1324eSAndrey Utkin * Bit[5]: gpio 1 interrupt 877*34d1324eSAndrey Utkin * Bit[6]: gpio 2 interrupt 878*34d1324eSAndrey Utkin * Bit[7]: gpio 3 interrupt 879*34d1324eSAndrey Utkin * Bit[8]: gpio 4 interrupt 880*34d1324eSAndrey Utkin * Bit[9]: gpio 5 interrupt 881*34d1324eSAndrey Utkin * Bit[10]: gpio 6 interrupt 882*34d1324eSAndrey Utkin * Bit[11]: gpio 7 interrupt 883*34d1324eSAndrey Utkin * Bit[12]: JPEG interrupt 884*34d1324eSAndrey Utkin * Bit[13:15]: Reserved 885*34d1324eSAndrey Utkin */ 886*34d1324eSAndrey Utkin #define TW5864_INTR_STATUS_L 0x8838 887*34d1324eSAndrey Utkin /* 888*34d1324eSAndrey Utkin * Status of interrupt source 16 ~ 31 889*34d1324eSAndrey Utkin * Bit[0]: Reserved 890*34d1324eSAndrey Utkin * Bit[1]: VLC done interrupt 891*34d1324eSAndrey Utkin * Bit[2]: Reserved 892*34d1324eSAndrey Utkin * Bit[3]: AD Vsync interrupt 893*34d1324eSAndrey Utkin * Bit[4]: Preview eof interrupt 894*34d1324eSAndrey Utkin * Bit[5]: Preview overflow interrupt 895*34d1324eSAndrey Utkin * Bit[6]: Timer interrupt 896*34d1324eSAndrey Utkin * Bit[7]: Reserved 897*34d1324eSAndrey Utkin * Bit[8]: Audio eof interrupt 898*34d1324eSAndrey Utkin * Bit[9]: I2C done interrupt 899*34d1324eSAndrey Utkin * Bit[10]: AD interrupt 900*34d1324eSAndrey Utkin * Bit[11:15]: Reserved 901*34d1324eSAndrey Utkin */ 902*34d1324eSAndrey Utkin #define TW5864_INTR_STATUS_H 0x883c 903*34d1324eSAndrey Utkin 904*34d1324eSAndrey Utkin /* Defines of interrupt bits, united for both low and high word registers */ 905*34d1324eSAndrey Utkin #define TW5864_INTR_VLC_RAM BIT(0) 906*34d1324eSAndrey Utkin #define TW5864_INTR_BURST BIT(1) 907*34d1324eSAndrey Utkin #define TW5864_INTR_MV_DSP BIT(2) 908*34d1324eSAndrey Utkin #define TW5864_INTR_VIN_LOST BIT(3) 909*34d1324eSAndrey Utkin /* n belongs to [0; 7] */ 910*34d1324eSAndrey Utkin #define TW5864_INTR_GPIO(n) (1 << (4 + n)) 911*34d1324eSAndrey Utkin #define TW5864_INTR_JPEG BIT(12) 912*34d1324eSAndrey Utkin #define TW5864_INTR_VLC_DONE BIT(17) 913*34d1324eSAndrey Utkin #define TW5864_INTR_AD_VSYNC BIT(19) 914*34d1324eSAndrey Utkin #define TW5864_INTR_PV_EOF BIT(20) 915*34d1324eSAndrey Utkin #define TW5864_INTR_PV_OVERFLOW BIT(21) 916*34d1324eSAndrey Utkin #define TW5864_INTR_TIMER BIT(22) 917*34d1324eSAndrey Utkin #define TW5864_INTR_AUD_EOF BIT(24) 918*34d1324eSAndrey Utkin #define TW5864_INTR_I2C_DONE BIT(25) 919*34d1324eSAndrey Utkin #define TW5864_INTR_AD BIT(26) 920*34d1324eSAndrey Utkin 921*34d1324eSAndrey Utkin /* 0x9000 ~ 0x920c -- Video Capture (VIF) Register Map */ 922*34d1324eSAndrey Utkin /* 923*34d1324eSAndrey Utkin * H264EN_CH_STATUS[n] Status of Vsync synchronized H264EN_CH_EN (Read Only) 924*34d1324eSAndrey Utkin * 1 Channel Enabled 925*34d1324eSAndrey Utkin * 0 Channel Disabled 926*34d1324eSAndrey Utkin */ 927*34d1324eSAndrey Utkin #define TW5864_H264EN_CH_STATUS 0x9000 928*34d1324eSAndrey Utkin /* 929*34d1324eSAndrey Utkin * [15:0] H264EN_CH_EN[n] H264 Encoding Path Enable for channel 930*34d1324eSAndrey Utkin * 1 Channel Enabled 931*34d1324eSAndrey Utkin * 0 Channel Disabled 932*34d1324eSAndrey Utkin */ 933*34d1324eSAndrey Utkin #define TW5864_H264EN_CH_EN 0x9004 934*34d1324eSAndrey Utkin /* 935*34d1324eSAndrey Utkin * H264EN_CH_DNS[n] H264 Encoding Path Downscale Video Decoder Input for 936*34d1324eSAndrey Utkin * channel n 937*34d1324eSAndrey Utkin * 1 Downscale Y to 1/2 938*34d1324eSAndrey Utkin * 0 Does not downscale 939*34d1324eSAndrey Utkin */ 940*34d1324eSAndrey Utkin #define TW5864_H264EN_CH_DNS 0x9008 941*34d1324eSAndrey Utkin /* 942*34d1324eSAndrey Utkin * H264EN_CH_PROG[n] H264 Encoding Path channel n is progressive 943*34d1324eSAndrey Utkin * 1 Progressive (Not valid for TW5864) 944*34d1324eSAndrey Utkin * 0 Interlaced (TW5864 default) 945*34d1324eSAndrey Utkin */ 946*34d1324eSAndrey Utkin #define TW5864_H264EN_CH_PROG 0x900c 947*34d1324eSAndrey Utkin /* 948*34d1324eSAndrey Utkin * [3:0] H264EN_BUS_MAX_CH[n] 949*34d1324eSAndrey Utkin * H264 Encoding Path maximum number of channel on BUS n 950*34d1324eSAndrey Utkin * 0 Max 4 channels 951*34d1324eSAndrey Utkin * 1 Max 2 channels 952*34d1324eSAndrey Utkin */ 953*34d1324eSAndrey Utkin #define TW5864_H264EN_BUS_MAX_CH 0x9010 954*34d1324eSAndrey Utkin 955*34d1324eSAndrey Utkin /* 956*34d1324eSAndrey Utkin * H264EN_RATE_MAX_LINE_n H264 Encoding path Rate Mapping Maximum Line Number 957*34d1324eSAndrey Utkin * on Bus n 958*34d1324eSAndrey Utkin */ 959*34d1324eSAndrey Utkin #define TW5864_H264EN_RATE_MAX_LINE_EVEN 0x1f 960*34d1324eSAndrey Utkin #define TW5864_H264EN_RATE_MAX_LINE_ODD_SHIFT 5 961*34d1324eSAndrey Utkin #define TW5864_H264EN_RATE_MAX_LINE_ODD (0x1f << 5) 962*34d1324eSAndrey Utkin /* 963*34d1324eSAndrey Utkin * [4:0] H264EN_RATE_MAX_LINE_0 964*34d1324eSAndrey Utkin * [9:5] H264EN_RATE_MAX_LINE_1 965*34d1324eSAndrey Utkin */ 966*34d1324eSAndrey Utkin #define TW5864_H264EN_RATE_MAX_LINE_REG1 0x9014 967*34d1324eSAndrey Utkin /* 968*34d1324eSAndrey Utkin * [4:0] H264EN_RATE_MAX_LINE_2 969*34d1324eSAndrey Utkin * [9:5] H264EN_RATE_MAX_LINE_3 970*34d1324eSAndrey Utkin */ 971*34d1324eSAndrey Utkin #define TW5864_H264EN_RATE_MAX_LINE_REG2 0x9018 972*34d1324eSAndrey Utkin 973*34d1324eSAndrey Utkin /* 974*34d1324eSAndrey Utkin * H264EN_CHn_FMT H264 Encoding Path Format configuration of Channel n 975*34d1324eSAndrey Utkin * 00 D1 (For D1 and hD1 frame) 976*34d1324eSAndrey Utkin * 01 (Reserved) 977*34d1324eSAndrey Utkin * 10 (Reserved) 978*34d1324eSAndrey Utkin * 11 D1 with 1/2 size in X (for CIF frame) 979*34d1324eSAndrey Utkin * Note: To be used with 0x9008 register to configure the frame size 980*34d1324eSAndrey Utkin */ 981*34d1324eSAndrey Utkin /* 982*34d1324eSAndrey Utkin * [1:0]: H264EN_CH0_FMT, 983*34d1324eSAndrey Utkin * ..., [15:14]: H264EN_CH7_FMT 984*34d1324eSAndrey Utkin */ 985*34d1324eSAndrey Utkin #define TW5864_H264EN_CH_FMT_REG1 0x9020 986*34d1324eSAndrey Utkin /* 987*34d1324eSAndrey Utkin * [1:0]: H264EN_CH8_FMT (?), 988*34d1324eSAndrey Utkin * ..., [15:14]: H264EN_CH15_FMT (?) 989*34d1324eSAndrey Utkin */ 990*34d1324eSAndrey Utkin #define TW5864_H264EN_CH_FMT_REG2 0x9024 991*34d1324eSAndrey Utkin 992*34d1324eSAndrey Utkin /* 993*34d1324eSAndrey Utkin * H264EN_RATE_CNTL_BUSm_CHn H264 Encoding Path BUS m Rate Control for Channel n 994*34d1324eSAndrey Utkin */ 995*34d1324eSAndrey Utkin #define TW5864_H264EN_RATE_CNTL_LO_WORD(bus, channel) \ 996*34d1324eSAndrey Utkin (0x9100 + bus * 0x20 + channel * 0x08) 997*34d1324eSAndrey Utkin #define TW5864_H264EN_RATE_CNTL_HI_WORD(bus, channel) \ 998*34d1324eSAndrey Utkin (0x9104 + bus * 0x20 + channel * 0x08) 999*34d1324eSAndrey Utkin 1000*34d1324eSAndrey Utkin /* 1001*34d1324eSAndrey Utkin * H264EN_BUSm_MAP_CHn The 16-to-1 MUX configuration register for each encoding 1002*34d1324eSAndrey Utkin * channel (total of 16 channels). Four bits for each channel. 1003*34d1324eSAndrey Utkin */ 1004*34d1324eSAndrey Utkin #define TW5864_H264EN_BUS0_MAP 0x9200 1005*34d1324eSAndrey Utkin #define TW5864_H264EN_BUS1_MAP 0x9204 1006*34d1324eSAndrey Utkin #define TW5864_H264EN_BUS2_MAP 0x9208 1007*34d1324eSAndrey Utkin #define TW5864_H264EN_BUS3_MAP 0x920c 1008*34d1324eSAndrey Utkin 1009*34d1324eSAndrey Utkin /* This register is not defined in datasheet, but used in reference driver */ 1010*34d1324eSAndrey Utkin #define TW5864_UNDECLARED_ERROR_FLAGS_0x9218 0x9218 1011*34d1324eSAndrey Utkin 1012*34d1324eSAndrey Utkin #define TW5864_GPIO1 0x9800 1013*34d1324eSAndrey Utkin #define TW5864_GPIO2 0x9804 1014*34d1324eSAndrey Utkin /* Define controls in registers TW5864_GPIO1, TW5864_GPIO2 */ 1015*34d1324eSAndrey Utkin /* GPIO DATA of Group n */ 1016*34d1324eSAndrey Utkin #define TW5864_GPIO_DATA 0x00ff 1017*34d1324eSAndrey Utkin #define TW5864_GPIO_OEN_SHIFT 8 1018*34d1324eSAndrey Utkin /* GPIO Output Enable of Group n */ 1019*34d1324eSAndrey Utkin #define TW5864_GPIO_OEN (0xff << 8) 1020*34d1324eSAndrey Utkin 1021*34d1324eSAndrey Utkin /* 0xa000 ~ 0xa8ff – DDR Controller Register Map */ 1022*34d1324eSAndrey Utkin /* DDR Controller A */ 1023*34d1324eSAndrey Utkin /* 1024*34d1324eSAndrey Utkin * [2:0] Data valid counter after read command to DDR. This is the delay value 1025*34d1324eSAndrey Utkin * to show how many cycles the data will be back from DDR after we issue a read 1026*34d1324eSAndrey Utkin * command. 1027*34d1324eSAndrey Utkin */ 1028*34d1324eSAndrey Utkin #define TW5864_RD_ACK_VLD_MUX 0xa000 1029*34d1324eSAndrey Utkin 1030*34d1324eSAndrey Utkin #define TW5864_DDR_PERIODS 0xa004 1031*34d1324eSAndrey Utkin /* Define controls in register TW5864_DDR_PERIODS */ 1032*34d1324eSAndrey Utkin /* 1033*34d1324eSAndrey Utkin * Tras value, the minimum cycle of active to precharge command period, 1034*34d1324eSAndrey Utkin * default is 7 1035*34d1324eSAndrey Utkin */ 1036*34d1324eSAndrey Utkin #define TW5864_TRAS_CNT_MAX 0x000f 1037*34d1324eSAndrey Utkin /* 1038*34d1324eSAndrey Utkin * Trfc value, the minimum cycle of refresh to active or refresh command period, 1039*34d1324eSAndrey Utkin * default is 4"hf 1040*34d1324eSAndrey Utkin */ 1041*34d1324eSAndrey Utkin #define TW5864_RFC_CNT_MAX_SHIFT 8 1042*34d1324eSAndrey Utkin #define TW5864_RFC_CNT_MAX (0x0f << 8) 1043*34d1324eSAndrey Utkin /* 1044*34d1324eSAndrey Utkin * Trcd value, the minimum cycle of active to internal read/write command 1045*34d1324eSAndrey Utkin * period, default is 4"h2 1046*34d1324eSAndrey Utkin */ 1047*34d1324eSAndrey Utkin #define TW5864_TCD_CNT_MAX_SHIFT 4 1048*34d1324eSAndrey Utkin #define TW5864_TCD_CNT_MAX (0x0f << 4) 1049*34d1324eSAndrey Utkin /* Twr value, write recovery time, default is 4"h3 */ 1050*34d1324eSAndrey Utkin #define TW5864_TWR_CNT_MAX_SHIFT 12 1051*34d1324eSAndrey Utkin #define TW5864_TWR_CNT_MAX (0x0f << 12) 1052*34d1324eSAndrey Utkin 1053*34d1324eSAndrey Utkin /* 1054*34d1324eSAndrey Utkin * [2:0] CAS latency, the delay cycle between internal read command and the 1055*34d1324eSAndrey Utkin * availability of the first bit of output data, default is 3 1056*34d1324eSAndrey Utkin */ 1057*34d1324eSAndrey Utkin #define TW5864_CAS_LATENCY 0xa008 1058*34d1324eSAndrey Utkin /* 1059*34d1324eSAndrey Utkin * [15:0] Maximum average periodic refresh, the value is based on the current 1060*34d1324eSAndrey Utkin * frequency to match 7.8mcs 1061*34d1324eSAndrey Utkin */ 1062*34d1324eSAndrey Utkin #define TW5864_DDR_REF_CNTR_MAX 0xa00c 1063*34d1324eSAndrey Utkin /* 1064*34d1324eSAndrey Utkin * DDR_ON_CHIP_MAP [1:0] 1065*34d1324eSAndrey Utkin * 0 256M DDR on board 1066*34d1324eSAndrey Utkin * 1 512M DDR on board 1067*34d1324eSAndrey Utkin * 2 1G DDR on board 1068*34d1324eSAndrey Utkin * DDR_ON_CHIP_MAP [2] 1069*34d1324eSAndrey Utkin * 0 Only one DDR chip 1070*34d1324eSAndrey Utkin * 1 Two DDR chips 1071*34d1324eSAndrey Utkin */ 1072*34d1324eSAndrey Utkin #define TW5864_DDR_ON_CHIP_MAP 0xa01c 1073*34d1324eSAndrey Utkin #define TW5864_DDR_SELFTEST_MODE 0xa020 1074*34d1324eSAndrey Utkin /* Define controls in register TW5864_DDR_SELFTEST_MODE */ 1075*34d1324eSAndrey Utkin /* 1076*34d1324eSAndrey Utkin * 0 Common read/write mode 1077*34d1324eSAndrey Utkin * 1 DDR self-test mode 1078*34d1324eSAndrey Utkin */ 1079*34d1324eSAndrey Utkin #define TW5864_MASTER_MODE BIT(0) 1080*34d1324eSAndrey Utkin /* 1081*34d1324eSAndrey Utkin * 0 DDR self-test single read/write 1082*34d1324eSAndrey Utkin * 1 DDR self-test burst read/write 1083*34d1324eSAndrey Utkin */ 1084*34d1324eSAndrey Utkin #define TW5864_SINGLE_PROC BIT(1) 1085*34d1324eSAndrey Utkin /* 1086*34d1324eSAndrey Utkin * 0 DDR self-test write command 1087*34d1324eSAndrey Utkin * 1 DDR self-test read command 1088*34d1324eSAndrey Utkin */ 1089*34d1324eSAndrey Utkin #define TW5864_WRITE_FLAG BIT(2) 1090*34d1324eSAndrey Utkin #define TW5864_DATA_MODE_SHIFT 4 1091*34d1324eSAndrey Utkin /* 1092*34d1324eSAndrey Utkin * 0 write 32'haaaa5555 to DDR 1093*34d1324eSAndrey Utkin * 1 write 32'hffffffff to DDR 1094*34d1324eSAndrey Utkin * 2 write 32'hha5a55a5a to DDR 1095*34d1324eSAndrey Utkin * 3 write increasing data to DDR 1096*34d1324eSAndrey Utkin */ 1097*34d1324eSAndrey Utkin #define TW5864_DATA_MODE (0x3 << 4) 1098*34d1324eSAndrey Utkin 1099*34d1324eSAndrey Utkin /* [7:0] The maximum data of one burst in DDR self-test mode */ 1100*34d1324eSAndrey Utkin #define TW5864_BURST_CNTR_MAX 0xa024 1101*34d1324eSAndrey Utkin /* [15:0] The maximum burst counter (bit 15~0) in DDR self-test mode */ 1102*34d1324eSAndrey Utkin #define TW5864_DDR_PROC_CNTR_MAX_L 0xa028 1103*34d1324eSAndrey Utkin /* The maximum burst counter (bit 31~16) in DDR self-test mode */ 1104*34d1324eSAndrey Utkin #define TW5864_DDR_PROC_CNTR_MAX_H 0xa02c 1105*34d1324eSAndrey Utkin /* [0]: Start one DDR self-test */ 1106*34d1324eSAndrey Utkin #define TW5864_DDR_SELF_TEST_CMD 0xa030 1107*34d1324eSAndrey Utkin /* The maximum error counter (bit 15 ~ 0) in DDR self-test */ 1108*34d1324eSAndrey Utkin #define TW5864_ERR_CNTR_L 0xa034 1109*34d1324eSAndrey Utkin 1110*34d1324eSAndrey Utkin #define TW5864_ERR_CNTR_H_AND_FLAG 0xa038 1111*34d1324eSAndrey Utkin /* Define controls in register TW5864_ERR_CNTR_H_AND_FLAG */ 1112*34d1324eSAndrey Utkin /* The maximum error counter (bit 30 ~ 16) in DDR self-test */ 1113*34d1324eSAndrey Utkin #define TW5864_ERR_CNTR_H_MASK 0x3fff 1114*34d1324eSAndrey Utkin /* DDR self-test end flag */ 1115*34d1324eSAndrey Utkin #define TW5864_END_FLAG 0x8000 1116*34d1324eSAndrey Utkin 1117*34d1324eSAndrey Utkin /* 1118*34d1324eSAndrey Utkin * DDR Controller B: same as 0xa000 ~ 0xa038, but add TW5864_DDR_B_OFFSET to all 1119*34d1324eSAndrey Utkin * addresses 1120*34d1324eSAndrey Utkin */ 1121*34d1324eSAndrey Utkin #define TW5864_DDR_B_OFFSET 0x0800 1122*34d1324eSAndrey Utkin 1123*34d1324eSAndrey Utkin /* 0xb004 ~ 0xb018 – HW version/ARB12 Register Map */ 1124*34d1324eSAndrey Utkin /* [15:0] Default is C013 */ 1125*34d1324eSAndrey Utkin #define TW5864_HW_VERSION 0xb004 1126*34d1324eSAndrey Utkin 1127*34d1324eSAndrey Utkin #define TW5864_REQS_ENABLE 0xb010 1128*34d1324eSAndrey Utkin /* Define controls in register TW5864_REQS_ENABLE */ 1129*34d1324eSAndrey Utkin /* Audio data in to DDR enable (default 1) */ 1130*34d1324eSAndrey Utkin #define TW5864_AUD_DATA_IN_ENB BIT(0) 1131*34d1324eSAndrey Utkin /* Audio encode request to DDR enable (default 1) */ 1132*34d1324eSAndrey Utkin #define TW5864_AUD_ENC_REQ_ENB BIT(1) 1133*34d1324eSAndrey Utkin /* Audio decode request0 to DDR enable (default 1) */ 1134*34d1324eSAndrey Utkin #define TW5864_AUD_DEC_REQ0_ENB BIT(2) 1135*34d1324eSAndrey Utkin /* Audio decode request1 to DDR enable (default 1) */ 1136*34d1324eSAndrey Utkin #define TW5864_AUD_DEC_REQ1_ENB BIT(3) 1137*34d1324eSAndrey Utkin /* VLC stream request to DDR enable (default 1) */ 1138*34d1324eSAndrey Utkin #define TW5864_VLC_STRM_REQ_ENB BIT(4) 1139*34d1324eSAndrey Utkin /* H264 MV request to DDR enable (default 1) */ 1140*34d1324eSAndrey Utkin #define TW5864_DVM_MV_REQ_ENB BIT(5) 1141*34d1324eSAndrey Utkin /* mux_core MVD request to DDR enable (default 1) */ 1142*34d1324eSAndrey Utkin #define TW5864_MVD_REQ_ENB BIT(6) 1143*34d1324eSAndrey Utkin /* mux_core MVD temp data request to DDR enable (default 1) */ 1144*34d1324eSAndrey Utkin #define TW5864_MVD_TMP_REQ_ENB BIT(7) 1145*34d1324eSAndrey Utkin /* JPEG request to DDR enable (default 1) */ 1146*34d1324eSAndrey Utkin #define TW5864_JPEG_REQ_ENB BIT(8) 1147*34d1324eSAndrey Utkin /* mv_flag request to DDR enable (default 1) */ 1148*34d1324eSAndrey Utkin #define TW5864_MV_FLAG_REQ_ENB BIT(9) 1149*34d1324eSAndrey Utkin 1150*34d1324eSAndrey Utkin #define TW5864_ARB12 0xb018 1151*34d1324eSAndrey Utkin /* Define controls in register TW5864_ARB12 */ 1152*34d1324eSAndrey Utkin /* ARB12 Enable (default 1) */ 1153*34d1324eSAndrey Utkin #define TW5864_ARB12_ENB BIT(15) 1154*34d1324eSAndrey Utkin /* ARB12 maximum value of time out counter (default 15"h1FF) */ 1155*34d1324eSAndrey Utkin #define TW5864_ARB12_TIME_OUT_CNT 0x7fff 1156*34d1324eSAndrey Utkin 1157*34d1324eSAndrey Utkin /* 0xb800 ~ 0xb80c -- Indirect Access Register Map */ 1158*34d1324eSAndrey Utkin /* 1159*34d1324eSAndrey Utkin * Spec says: 1160*34d1324eSAndrey Utkin * In order to access the indirect register space, the following procedure is 1161*34d1324eSAndrey Utkin * followed. 1162*34d1324eSAndrey Utkin * But reference driver implementation, and current driver, too, does it 1163*34d1324eSAndrey Utkin * differently. 1164*34d1324eSAndrey Utkin * 1165*34d1324eSAndrey Utkin * Write Registers: 1166*34d1324eSAndrey Utkin * (1) Write IND_DATA at 0xb804 ~ 0xb807 1167*34d1324eSAndrey Utkin * (2) Read BUSY flag from 0xb803. Wait until BUSY signal is 0. 1168*34d1324eSAndrey Utkin * (3) Write IND_ADDR at 0xb800 ~ 0xb801. Set R/W to "1", ENABLE to "1" 1169*34d1324eSAndrey Utkin * Read Registers: 1170*34d1324eSAndrey Utkin * (1) Read BUSY flag from 0xb803. Wait until BUSY signal is 0. 1171*34d1324eSAndrey Utkin * (2) Write IND_ADDR at 0xb800 ~ 0xb801. Set R/W to "0", ENABLE to "1" 1172*34d1324eSAndrey Utkin * (3) Read BUSY flag from 0xb803. Wait until BUSY signal is 0. 1173*34d1324eSAndrey Utkin * (4) Read IND_DATA from 0xb804 ~ 0xb807 1174*34d1324eSAndrey Utkin */ 1175*34d1324eSAndrey Utkin #define TW5864_IND_CTL 0xb800 1176*34d1324eSAndrey Utkin /* Define controls in register TW5864_IND_CTL */ 1177*34d1324eSAndrey Utkin /* Address used to access indirect register space */ 1178*34d1324eSAndrey Utkin #define TW5864_IND_ADDR 0x0000ffff 1179*34d1324eSAndrey Utkin /* Wait until this bit is "0" before using indirect access */ 1180*34d1324eSAndrey Utkin #define TW5864_BUSY BIT(31) 1181*34d1324eSAndrey Utkin /* Activate the indirect access. This bit is self cleared */ 1182*34d1324eSAndrey Utkin #define TW5864_ENABLE BIT(25) 1183*34d1324eSAndrey Utkin /* Read/Write command */ 1184*34d1324eSAndrey Utkin #define TW5864_RW BIT(24) 1185*34d1324eSAndrey Utkin 1186*34d1324eSAndrey Utkin /* [31:0] Data used to read/write indirect register space */ 1187*34d1324eSAndrey Utkin #define TW5864_IND_DATA 0xb804 1188*34d1324eSAndrey Utkin 1189*34d1324eSAndrey Utkin /* 0xc000 ~ 0xc7fc -- Preview Register Map */ 1190*34d1324eSAndrey Utkin /* Mostly skipped this section. */ 1191*34d1324eSAndrey Utkin /* 1192*34d1324eSAndrey Utkin * [15:0] Status of Vsync Synchronized PCI_PV_CH_EN (Read Only) 1193*34d1324eSAndrey Utkin * 1 Channel Enabled 1194*34d1324eSAndrey Utkin * 0 Channel Disabled 1195*34d1324eSAndrey Utkin */ 1196*34d1324eSAndrey Utkin #define TW5864_PCI_PV_CH_STATUS 0xc000 1197*34d1324eSAndrey Utkin /* 1198*34d1324eSAndrey Utkin * [15:0] PCI Preview Path Enable for channel n 1199*34d1324eSAndrey Utkin * 1 Channel Enable 1200*34d1324eSAndrey Utkin * 0 Channel Disable 1201*34d1324eSAndrey Utkin */ 1202*34d1324eSAndrey Utkin #define TW5864_PCI_PV_CH_EN 0xc004 1203*34d1324eSAndrey Utkin 1204*34d1324eSAndrey Utkin /* 0xc800 ~ 0xc804 -- JPEG Capture Register Map */ 1205*34d1324eSAndrey Utkin /* Skipped. */ 1206*34d1324eSAndrey Utkin /* 0xd000 ~ 0xd0fc -- JPEG Control Register Map */ 1207*34d1324eSAndrey Utkin /* Skipped. */ 1208*34d1324eSAndrey Utkin 1209*34d1324eSAndrey Utkin /* 0xe000 ~ 0xfc04 – Motion Vector Register Map */ 1210*34d1324eSAndrey Utkin 1211*34d1324eSAndrey Utkin /* ME Motion Vector data (Four Byte Each) 0xe000 ~ 0xe7fc */ 1212*34d1324eSAndrey Utkin #define TW5864_ME_MV_VEC_START 0xe000 1213*34d1324eSAndrey Utkin #define TW5864_ME_MV_VEC_MAX_OFFSET 0x1ff 1214*34d1324eSAndrey Utkin #define TW5864_ME_MV_VEC(offset) (TW5864_ME_MV_VEC_START + 4 * offset) 1215*34d1324eSAndrey Utkin 1216*34d1324eSAndrey Utkin #define TW5864_MV 0xfc00 1217*34d1324eSAndrey Utkin /* Define controls in register TW5864_MV */ 1218*34d1324eSAndrey Utkin /* mv bank0 full status , write "1" to clear */ 1219*34d1324eSAndrey Utkin #define TW5864_MV_BK0_FULL BIT(0) 1220*34d1324eSAndrey Utkin /* mv bank1 full status , write "1" to clear */ 1221*34d1324eSAndrey Utkin #define TW5864_MV_BK1_FULL BIT(1) 1222*34d1324eSAndrey Utkin /* slice end status; write "1" to clear */ 1223*34d1324eSAndrey Utkin #define TW5864_MV_EOF BIT(2) 1224*34d1324eSAndrey Utkin /* mv encode interrupt status; write "1" to clear */ 1225*34d1324eSAndrey Utkin #define TW5864_MV_DSP_INTR BIT(3) 1226*34d1324eSAndrey Utkin /* mv write memory overflow, write "1" to clear */ 1227*34d1324eSAndrey Utkin #define TW5864_DSP_WR_OF BIT(4) 1228*34d1324eSAndrey Utkin #define TW5864_MV_LEN_SHIFT 5 1229*34d1324eSAndrey Utkin /* mv stream length */ 1230*34d1324eSAndrey Utkin #define TW5864_MV_LEN (0xff << 5) 1231*34d1324eSAndrey Utkin /* The configured status bit written into bit 15 of 0xfc04 */ 1232*34d1324eSAndrey Utkin #define TW5864_MPI_DDR_SEL BIT(13) 1233*34d1324eSAndrey Utkin 1234*34d1324eSAndrey Utkin #define TW5864_MPI_DDR_SEL_REG 0xfc04 1235*34d1324eSAndrey Utkin /* Define controls in register TW5864_MPI_DDR_SEL_REG */ 1236*34d1324eSAndrey Utkin /* 1237*34d1324eSAndrey Utkin * SW configure register 1238*34d1324eSAndrey Utkin * 0 MV is saved in internal DPR 1239*34d1324eSAndrey Utkin * 1 MV is saved in DDR 1240*34d1324eSAndrey Utkin */ 1241*34d1324eSAndrey Utkin #define TW5864_MPI_DDR_SEL2 BIT(15) 1242*34d1324eSAndrey Utkin 1243*34d1324eSAndrey Utkin /* 0x18000 ~ 0x181fc – PCI Master/Slave Control Map */ 1244*34d1324eSAndrey Utkin #define TW5864_PCI_INTR_STATUS 0x18000 1245*34d1324eSAndrey Utkin /* Define controls in register TW5864_PCI_INTR_STATUS */ 1246*34d1324eSAndrey Utkin /* vlc done */ 1247*34d1324eSAndrey Utkin #define TW5864_VLC_DONE_INTR BIT(1) 1248*34d1324eSAndrey Utkin /* ad vsync */ 1249*34d1324eSAndrey Utkin #define TW5864_AD_VSYNC_INTR BIT(3) 1250*34d1324eSAndrey Utkin /* preview eof */ 1251*34d1324eSAndrey Utkin #define TW5864_PREV_EOF_INTR BIT(4) 1252*34d1324eSAndrey Utkin /* preview overflow interrupt */ 1253*34d1324eSAndrey Utkin #define TW5864_PREV_OVERFLOW_INTR BIT(5) 1254*34d1324eSAndrey Utkin /* timer interrupt */ 1255*34d1324eSAndrey Utkin #define TW5864_TIMER_INTR BIT(6) 1256*34d1324eSAndrey Utkin /* audio eof */ 1257*34d1324eSAndrey Utkin #define TW5864_AUDIO_EOF_INTR BIT(8) 1258*34d1324eSAndrey Utkin /* IIC done */ 1259*34d1324eSAndrey Utkin #define TW5864_IIC_DONE_INTR BIT(24) 1260*34d1324eSAndrey Utkin /* ad interrupt (e.g.: video lost, video format changed) */ 1261*34d1324eSAndrey Utkin #define TW5864_AD_INTR_REG BIT(25) 1262*34d1324eSAndrey Utkin 1263*34d1324eSAndrey Utkin #define TW5864_PCI_INTR_CTL 0x18004 1264*34d1324eSAndrey Utkin /* Define controls in register TW5864_PCI_INTR_CTL */ 1265*34d1324eSAndrey Utkin /* master enable */ 1266*34d1324eSAndrey Utkin #define TW5864_PCI_MAST_ENB BIT(0) 1267*34d1324eSAndrey Utkin /* mvd&vlc master enable */ 1268*34d1324eSAndrey Utkin #define TW5864_MVD_VLC_MAST_ENB 0x06 1269*34d1324eSAndrey Utkin /* (Need to set 0 in TW5864A) */ 1270*34d1324eSAndrey Utkin #define TW5864_AD_MAST_ENB BIT(3) 1271*34d1324eSAndrey Utkin /* preview master enable */ 1272*34d1324eSAndrey Utkin #define TW5864_PREV_MAST_ENB BIT(4) 1273*34d1324eSAndrey Utkin /* preview overflow enable */ 1274*34d1324eSAndrey Utkin #define TW5864_PREV_OVERFLOW_ENB BIT(5) 1275*34d1324eSAndrey Utkin /* timer interrupt enable */ 1276*34d1324eSAndrey Utkin #define TW5864_TIMER_INTR_ENB BIT(6) 1277*34d1324eSAndrey Utkin /* JPEG master (push mode) enable */ 1278*34d1324eSAndrey Utkin #define TW5864_JPEG_MAST_ENB BIT(7) 1279*34d1324eSAndrey Utkin #define TW5864_AU_MAST_ENB_CHN_SHIFT 8 1280*34d1324eSAndrey Utkin /* audio master channel enable */ 1281*34d1324eSAndrey Utkin #define TW5864_AU_MAST_ENB_CHN (0xffff << 8) 1282*34d1324eSAndrey Utkin /* IIC interrupt enable */ 1283*34d1324eSAndrey Utkin #define TW5864_IIC_INTR_ENB BIT(24) 1284*34d1324eSAndrey Utkin /* ad interrupt enable */ 1285*34d1324eSAndrey Utkin #define TW5864_AD_INTR_ENB BIT(25) 1286*34d1324eSAndrey Utkin /* target burst enable */ 1287*34d1324eSAndrey Utkin #define TW5864_PCI_TAR_BURST_ENB BIT(26) 1288*34d1324eSAndrey Utkin /* vlc stream burst enable */ 1289*34d1324eSAndrey Utkin #define TW5864_PCI_VLC_BURST_ENB BIT(27) 1290*34d1324eSAndrey Utkin /* ddr burst enable (1 enable, and must set DDR_BRST_EN) */ 1291*34d1324eSAndrey Utkin #define TW5864_PCI_DDR_BURST_ENB BIT(28) 1292*34d1324eSAndrey Utkin 1293*34d1324eSAndrey Utkin /* 1294*34d1324eSAndrey Utkin * Because preview and audio have 16 channels separately, so using this 1295*34d1324eSAndrey Utkin * registers to indicate interrupt status for every channels. This is secondary 1296*34d1324eSAndrey Utkin * interrupt status register. OR operating of the PREV_INTR_REG is 1297*34d1324eSAndrey Utkin * PREV_EOF_INTR, OR operating of the AU_INTR_REG bits is AUDIO_EOF_INTR 1298*34d1324eSAndrey Utkin */ 1299*34d1324eSAndrey Utkin #define TW5864_PREV_AND_AU_INTR 0x18008 1300*34d1324eSAndrey Utkin /* Define controls in register TW5864_PREV_AND_AU_INTR */ 1301*34d1324eSAndrey Utkin /* preview eof interrupt flag */ 1302*34d1324eSAndrey Utkin #define TW5864_PREV_INTR_REG 0x0000ffff 1303*34d1324eSAndrey Utkin #define TW5864_AU_INTR_REG_SHIFT 16 1304*34d1324eSAndrey Utkin /* audio eof interrupt flag */ 1305*34d1324eSAndrey Utkin #define TW5864_AU_INTR_REG (0xffff << 16) 1306*34d1324eSAndrey Utkin 1307*34d1324eSAndrey Utkin #define TW5864_MASTER_ENB_REG 0x1800c 1308*34d1324eSAndrey Utkin /* Define controls in register TW5864_MASTER_ENB_REG */ 1309*34d1324eSAndrey Utkin /* master enable */ 1310*34d1324eSAndrey Utkin #define TW5864_PCI_VLC_INTR_ENB BIT(1) 1311*34d1324eSAndrey Utkin /* mvd and vlc master enable */ 1312*34d1324eSAndrey Utkin #define TW5864_PCI_PREV_INTR_ENB BIT(4) 1313*34d1324eSAndrey Utkin /* ad vsync master enable */ 1314*34d1324eSAndrey Utkin #define TW5864_PCI_PREV_OF_INTR_ENB BIT(5) 1315*34d1324eSAndrey Utkin /* jpeg master enable */ 1316*34d1324eSAndrey Utkin #define TW5864_PCI_JPEG_INTR_ENB BIT(7) 1317*34d1324eSAndrey Utkin /* preview master enable */ 1318*34d1324eSAndrey Utkin #define TW5864_PCI_AUD_INTR_ENB BIT(8) 1319*34d1324eSAndrey Utkin 1320*34d1324eSAndrey Utkin /* 1321*34d1324eSAndrey Utkin * Every channel of preview and audio have ping-pong buffers in system memory, 1322*34d1324eSAndrey Utkin * this register is the buffer flag to notify software which buffer is been 1323*34d1324eSAndrey Utkin * operated. 1324*34d1324eSAndrey Utkin */ 1325*34d1324eSAndrey Utkin #define TW5864_PREV_AND_AU_BUF_FLAG 0x18010 1326*34d1324eSAndrey Utkin /* Define controls in register TW5864_PREV_AND_AU_BUF_FLAG */ 1327*34d1324eSAndrey Utkin /* preview buffer A/B flag */ 1328*34d1324eSAndrey Utkin #define TW5864_PREV_BUF_FLAG 0xffff 1329*34d1324eSAndrey Utkin #define TW5864_AUDIO_BUF_FLAG_SHIFT 16 1330*34d1324eSAndrey Utkin /* audio buffer A/B flag */ 1331*34d1324eSAndrey Utkin #define TW5864_AUDIO_BUF_FLAG (0xffff << 16) 1332*34d1324eSAndrey Utkin 1333*34d1324eSAndrey Utkin #define TW5864_IIC 0x18014 1334*34d1324eSAndrey Utkin /* Define controls in register TW5864_IIC */ 1335*34d1324eSAndrey Utkin /* register data */ 1336*34d1324eSAndrey Utkin #define TW5864_IIC_DATA 0x00ff 1337*34d1324eSAndrey Utkin #define TW5864_IIC_REG_ADDR_SHIFT 8 1338*34d1324eSAndrey Utkin /* register addr */ 1339*34d1324eSAndrey Utkin #define TW5864_IIC_REG_ADDR (0xff << 8) 1340*34d1324eSAndrey Utkin /* rd/wr flag rd=1,wr=0 */ 1341*34d1324eSAndrey Utkin #define TW5864_IIC_RW BIT(16) 1342*34d1324eSAndrey Utkin #define TW5864_IIC_DEV_ADDR_SHIFT 17 1343*34d1324eSAndrey Utkin /* device addr */ 1344*34d1324eSAndrey Utkin #define TW5864_IIC_DEV_ADDR (0x7f << 17) 1345*34d1324eSAndrey Utkin /* 1346*34d1324eSAndrey Utkin * iic done, software kick off one time iic transaction through setting this 1347*34d1324eSAndrey Utkin * bit to 1. Then poll this bit, value 1 indicate iic transaction have 1348*34d1324eSAndrey Utkin * completed, if read, valid data have been stored in iic_data 1349*34d1324eSAndrey Utkin */ 1350*34d1324eSAndrey Utkin #define TW5864_IIC_DONE BIT(24) 1351*34d1324eSAndrey Utkin 1352*34d1324eSAndrey Utkin #define TW5864_RST_AND_IF_INFO 0x18018 1353*34d1324eSAndrey Utkin /* Define controls in register TW5864_RST_AND_IF_INFO */ 1354*34d1324eSAndrey Utkin /* application software soft reset */ 1355*34d1324eSAndrey Utkin #define TW5864_APP_SOFT_RST BIT(0) 1356*34d1324eSAndrey Utkin #define TW5864_PCI_INF_VERSION_SHIFT 16 1357*34d1324eSAndrey Utkin /* PCI interface version, read only */ 1358*34d1324eSAndrey Utkin #define TW5864_PCI_INF_VERSION (0xffff << 16) 1359*34d1324eSAndrey Utkin 1360*34d1324eSAndrey Utkin /* vlc stream crc value, it is calculated in pci module */ 1361*34d1324eSAndrey Utkin #define TW5864_VLC_CRC_REG 0x1801c 1362*34d1324eSAndrey Utkin /* 1363*34d1324eSAndrey Utkin * vlc max length, it is defined by software based on software assign memory 1364*34d1324eSAndrey Utkin * space for vlc 1365*34d1324eSAndrey Utkin */ 1366*34d1324eSAndrey Utkin #define TW5864_VLC_MAX_LENGTH 0x18020 1367*34d1324eSAndrey Utkin /* vlc length of one frame */ 1368*34d1324eSAndrey Utkin #define TW5864_VLC_LENGTH 0x18024 1369*34d1324eSAndrey Utkin /* vlc original crc value */ 1370*34d1324eSAndrey Utkin #define TW5864_VLC_INTRA_CRC_I_REG 0x18028 1371*34d1324eSAndrey Utkin /* vlc original crc value */ 1372*34d1324eSAndrey Utkin #define TW5864_VLC_INTRA_CRC_O_REG 0x1802c 1373*34d1324eSAndrey Utkin /* mv stream crc value, it is calculated in pci module */ 1374*34d1324eSAndrey Utkin #define TW5864_VLC_PAR_CRC_REG 0x18030 1375*34d1324eSAndrey Utkin /* mv length */ 1376*34d1324eSAndrey Utkin #define TW5864_VLC_PAR_LENGTH_REG 0x18034 1377*34d1324eSAndrey Utkin /* mv original crc value */ 1378*34d1324eSAndrey Utkin #define TW5864_VLC_PAR_I_REG 0x18038 1379*34d1324eSAndrey Utkin /* mv original crc value */ 1380*34d1324eSAndrey Utkin #define TW5864_VLC_PAR_O_REG 0x1803c 1381*34d1324eSAndrey Utkin 1382*34d1324eSAndrey Utkin /* 1383*34d1324eSAndrey Utkin * Configuration register for 9[or 10] CIFs or 1D1+15QCIF Preview mode. 1384*34d1324eSAndrey Utkin * PREV_PCI_ENB_CHN[0] Enable 9th preview channel (9CIF prev) or 1D1 channel in 1385*34d1324eSAndrey Utkin * (1D1+15QCIF prev) 1386*34d1324eSAndrey Utkin * PREV_PCI_ENB_CHN[1] Enable 10th preview channel 1387*34d1324eSAndrey Utkin */ 1388*34d1324eSAndrey Utkin #define TW5864_PREV_PCI_ENB_CHN 0x18040 1389*34d1324eSAndrey Utkin /* Description skipped. */ 1390*34d1324eSAndrey Utkin #define TW5864_PREV_FRAME_FORMAT_IN 0x18044 1391*34d1324eSAndrey Utkin /* IIC enable */ 1392*34d1324eSAndrey Utkin #define TW5864_IIC_ENB 0x18048 1393*34d1324eSAndrey Utkin /* 1394*34d1324eSAndrey Utkin * Timer interrupt interval 1395*34d1324eSAndrey Utkin * 0 1ms 1396*34d1324eSAndrey Utkin * 1 2ms 1397*34d1324eSAndrey Utkin * 2 4ms 1398*34d1324eSAndrey Utkin * 3 8ms 1399*34d1324eSAndrey Utkin */ 1400*34d1324eSAndrey Utkin #define TW5864_PCI_INTTM_SCALE 0x1804c 1401*34d1324eSAndrey Utkin 1402*34d1324eSAndrey Utkin /* 1403*34d1324eSAndrey Utkin * The above register is pci base address registers. Application software will 1404*34d1324eSAndrey Utkin * initialize them to tell chip where the corresponding stream will be dumped 1405*34d1324eSAndrey Utkin * to. Application software will select appropriate base address interval based 1406*34d1324eSAndrey Utkin * on the stream length. 1407*34d1324eSAndrey Utkin */ 1408*34d1324eSAndrey Utkin /* VLC stream base address */ 1409*34d1324eSAndrey Utkin #define TW5864_VLC_STREAM_BASE_ADDR 0x18080 1410*34d1324eSAndrey Utkin /* MV stream base address */ 1411*34d1324eSAndrey Utkin #define TW5864_MV_STREAM_BASE_ADDR 0x18084 1412*34d1324eSAndrey Utkin /* 0x180a0 – 0x180bc: audio burst base address. Skipped. */ 1413*34d1324eSAndrey Utkin /* 0x180c0 ~ 0x180dc – JPEG Push Mode Buffer Base Address. Skipped. */ 1414*34d1324eSAndrey Utkin /* 0x18100 – 0x1817c: preview burst base address. Skipped. */ 1415*34d1324eSAndrey Utkin 1416*34d1324eSAndrey Utkin /* 0x80000 ~ 0x87fff -- DDR Burst RW Register Map */ 1417*34d1324eSAndrey Utkin #define TW5864_DDR_CTL 0x80000 1418*34d1324eSAndrey Utkin /* Define controls in register TW5864_DDR_CTL */ 1419*34d1324eSAndrey Utkin #define TW5864_BRST_LENGTH_SHIFT 2 1420*34d1324eSAndrey Utkin /* Length of 32-bit data burst */ 1421*34d1324eSAndrey Utkin #define TW5864_BRST_LENGTH (0x3fff << 2) 1422*34d1324eSAndrey Utkin /* 1423*34d1324eSAndrey Utkin * Burst Read/Write 1424*34d1324eSAndrey Utkin * 0 Read Burst from DDR 1425*34d1324eSAndrey Utkin * 1 Write Burst to DDR 1426*34d1324eSAndrey Utkin */ 1427*34d1324eSAndrey Utkin #define TW5864_BRST_RW BIT(16) 1428*34d1324eSAndrey Utkin /* Begin a new DDR Burst. This bit is self cleared */ 1429*34d1324eSAndrey Utkin #define TW5864_NEW_BRST_CMD BIT(17) 1430*34d1324eSAndrey Utkin /* DDR Burst End Flag */ 1431*34d1324eSAndrey Utkin #define TW5864_BRST_END BIT(24) 1432*34d1324eSAndrey Utkin /* Enable Error Interrupt for Single DDR Access */ 1433*34d1324eSAndrey Utkin #define TW5864_SING_ERR_INTR BIT(25) 1434*34d1324eSAndrey Utkin /* Enable Error Interrupt for Burst DDR Access */ 1435*34d1324eSAndrey Utkin #define TW5864_BRST_ERR_INTR BIT(26) 1436*34d1324eSAndrey Utkin /* Enable Interrupt for End of DDR Burst Access */ 1437*34d1324eSAndrey Utkin #define TW5864_BRST_END_INTR BIT(27) 1438*34d1324eSAndrey Utkin /* DDR Single Access Error Flag */ 1439*34d1324eSAndrey Utkin #define TW5864_SINGLE_ERR BIT(28) 1440*34d1324eSAndrey Utkin /* DDR Single Access Busy Flag */ 1441*34d1324eSAndrey Utkin #define TW5864_SINGLE_BUSY BIT(29) 1442*34d1324eSAndrey Utkin /* DDR Burst Access Error Flag */ 1443*34d1324eSAndrey Utkin #define TW5864_BRST_ERR BIT(30) 1444*34d1324eSAndrey Utkin /* DDR Burst Access Busy Flag */ 1445*34d1324eSAndrey Utkin #define TW5864_BRST_BUSY BIT(31) 1446*34d1324eSAndrey Utkin 1447*34d1324eSAndrey Utkin /* [27:0] DDR Access Address. Bit [1:0] has to be 0 */ 1448*34d1324eSAndrey Utkin #define TW5864_DDR_ADDR 0x80004 1449*34d1324eSAndrey Utkin /* DDR Access Internal Buffer Address. Bit [1:0] has to be 0 */ 1450*34d1324eSAndrey Utkin #define TW5864_DPR_BUF_ADDR 0x80008 1451*34d1324eSAndrey Utkin /* SRAM Buffer MPI Access Space. Totally 16 KB */ 1452*34d1324eSAndrey Utkin #define TW5864_DPR_BUF_START 0x84000 1453*34d1324eSAndrey Utkin /* 0x84000 - 0x87ffc */ 1454*34d1324eSAndrey Utkin #define TW5864_DPR_BUF_SIZE 0x4000 1455*34d1324eSAndrey Utkin 1456*34d1324eSAndrey Utkin /* Indirect Map Space */ 1457*34d1324eSAndrey Utkin /* 1458*34d1324eSAndrey Utkin * The indirect space is accessed through 0xb800 ~ 0xb807 registers in direct 1459*34d1324eSAndrey Utkin * access space 1460*34d1324eSAndrey Utkin */ 1461*34d1324eSAndrey Utkin /* Analog Video / Audio Decoder / Encoder */ 1462*34d1324eSAndrey Utkin /* Allowed channel values: [0; 3] */ 1463*34d1324eSAndrey Utkin /* Read-only register */ 1464*34d1324eSAndrey Utkin #define TW5864_INDIR_VIN_0(channel) (0x000 + channel * 0x010) 1465*34d1324eSAndrey Utkin /* Define controls in register TW5864_INDIR_VIN_0 */ 1466*34d1324eSAndrey Utkin /* 1467*34d1324eSAndrey Utkin * 1 Video not present. (sync is not detected in number of consecutive line 1468*34d1324eSAndrey Utkin * periods specified by MISSCNT register) 1469*34d1324eSAndrey Utkin * 0 Video detected. 1470*34d1324eSAndrey Utkin */ 1471*34d1324eSAndrey Utkin #define TW5864_INDIR_VIN_0_VDLOSS BIT(7) 1472*34d1324eSAndrey Utkin /* 1473*34d1324eSAndrey Utkin * 1 Horizontal sync PLL is locked to the incoming video source. 1474*34d1324eSAndrey Utkin * 0 Horizontal sync PLL is not locked. 1475*34d1324eSAndrey Utkin */ 1476*34d1324eSAndrey Utkin #define TW5864_INDIR_VIN_0_HLOCK BIT(6) 1477*34d1324eSAndrey Utkin /* 1478*34d1324eSAndrey Utkin * 1 Sub-carrier PLL is locked to the incoming video source. 1479*34d1324eSAndrey Utkin * 0 Sub-carrier PLL is not locked. 1480*34d1324eSAndrey Utkin */ 1481*34d1324eSAndrey Utkin #define TW5864_INDIR_VIN_0_SLOCK BIT(5) 1482*34d1324eSAndrey Utkin /* 1483*34d1324eSAndrey Utkin * 1 Even field is being decoded. 1484*34d1324eSAndrey Utkin * 0 Odd field is being decoded. 1485*34d1324eSAndrey Utkin */ 1486*34d1324eSAndrey Utkin #define TW5864_INDIR_VIN_0_FLD BIT(4) 1487*34d1324eSAndrey Utkin /* 1488*34d1324eSAndrey Utkin * 1 Vertical logic is locked to the incoming video source. 1489*34d1324eSAndrey Utkin * 0 Vertical logic is not locked. 1490*34d1324eSAndrey Utkin */ 1491*34d1324eSAndrey Utkin #define TW5864_INDIR_VIN_0_VLOCK BIT(3) 1492*34d1324eSAndrey Utkin /* 1493*34d1324eSAndrey Utkin * 1 No color burst signal detected. 1494*34d1324eSAndrey Utkin * 0 Color burst signal detected. 1495*34d1324eSAndrey Utkin */ 1496*34d1324eSAndrey Utkin #define TW5864_INDIR_VIN_0_MONO BIT(1) 1497*34d1324eSAndrey Utkin /* 1498*34d1324eSAndrey Utkin * 0 60Hz source detected 1499*34d1324eSAndrey Utkin * 1 50Hz source detected 1500*34d1324eSAndrey Utkin * The actual vertical scanning frequency depends on the current standard 1501*34d1324eSAndrey Utkin * invoked. 1502*34d1324eSAndrey Utkin */ 1503*34d1324eSAndrey Utkin #define TW5864_INDIR_VIN_0_DET50 BIT(0) 1504*34d1324eSAndrey Utkin 1505*34d1324eSAndrey Utkin #define TW5864_INDIR_VIN_1(channel) (0x001 + channel * 0x010) 1506*34d1324eSAndrey Utkin /* VCR signal indicator. Read-only. */ 1507*34d1324eSAndrey Utkin #define TW5864_INDIR_VIN_1_VCR BIT(7) 1508*34d1324eSAndrey Utkin /* Weak signal indicator 2. Read-only. */ 1509*34d1324eSAndrey Utkin #define TW5864_INDIR_VIN_1_WKAIR BIT(6) 1510*34d1324eSAndrey Utkin /* Weak signal indicator controlled by WKTH. Read-only. */ 1511*34d1324eSAndrey Utkin #define TW5864_INDIR_VIN_1_WKAIR1 BIT(5) 1512*34d1324eSAndrey Utkin /* 1513*34d1324eSAndrey Utkin * 1 = Standard signal 1514*34d1324eSAndrey Utkin * 0 = Non-standard signal 1515*34d1324eSAndrey Utkin * Read-only 1516*34d1324eSAndrey Utkin */ 1517*34d1324eSAndrey Utkin #define TW5864_INDIR_VIN_1_VSTD BIT(4) 1518*34d1324eSAndrey Utkin /* 1519*34d1324eSAndrey Utkin * 1 = Non-interlaced signal 1520*34d1324eSAndrey Utkin * 0 = interlaced signal 1521*34d1324eSAndrey Utkin * Read-only 1522*34d1324eSAndrey Utkin */ 1523*34d1324eSAndrey Utkin #define TW5864_INDIR_VIN_1_NINTL BIT(3) 1524*34d1324eSAndrey Utkin /* 1525*34d1324eSAndrey Utkin * Vertical Sharpness Control. Writable. 1526*34d1324eSAndrey Utkin * 0 = None (default) 1527*34d1324eSAndrey Utkin * 7 = Highest 1528*34d1324eSAndrey Utkin * **Note: VSHP must be set to ‘0’ if COMB = 0 1529*34d1324eSAndrey Utkin */ 1530*34d1324eSAndrey Utkin #define TW5864_INDIR_VIN_1_VSHP 0x07 1531*34d1324eSAndrey Utkin 1532*34d1324eSAndrey Utkin /* HDELAY_XY[7:0] */ 1533*34d1324eSAndrey Utkin #define TW5864_INDIR_VIN_2_HDELAY_XY_LO(channel) (0x002 + channel * 0x010) 1534*34d1324eSAndrey Utkin /* HACTIVE_XY[7:0] */ 1535*34d1324eSAndrey Utkin #define TW5864_INDIR_VIN_3_HACTIVE_XY_LO(channel) (0x003 + channel * 0x010) 1536*34d1324eSAndrey Utkin /* VDELAY_XY[7:0] */ 1537*34d1324eSAndrey Utkin #define TW5864_INDIR_VIN_4_VDELAY_XY_LO(channel) (0x004 + channel * 0x010) 1538*34d1324eSAndrey Utkin /* VACTIVE_XY[7:0] */ 1539*34d1324eSAndrey Utkin #define TW5864_INDIR_VIN_5_VACTIVE_XY_LO(channel) (0x005 + channel * 0x010) 1540*34d1324eSAndrey Utkin 1541*34d1324eSAndrey Utkin #define TW5864_INDIR_VIN_6(channel) (0x006 + channel * 0x010) 1542*34d1324eSAndrey Utkin /* Define controls in register TW5864_INDIR_VIN_6 */ 1543*34d1324eSAndrey Utkin #define TW5864_INDIR_VIN_6_HDELAY_XY_HI 0x03 1544*34d1324eSAndrey Utkin #define TW5864_INDIR_VIN_6_HACTIVE_XY_HI_SHIFT 2 1545*34d1324eSAndrey Utkin #define TW5864_INDIR_VIN_6_HACTIVE_XY_HI (0x03 << 2) 1546*34d1324eSAndrey Utkin #define TW5864_INDIR_VIN_6_VDELAY_XY_HI BIT(4) 1547*34d1324eSAndrey Utkin #define TW5864_INDIR_VIN_6_VACTIVE_XY_HI BIT(5) 1548*34d1324eSAndrey Utkin 1549*34d1324eSAndrey Utkin /* 1550*34d1324eSAndrey Utkin * HDELAY_XY This 10bit register defines the starting location of horizontal 1551*34d1324eSAndrey Utkin * active pixel for display / record path. A unit is 1 pixel. The default value 1552*34d1324eSAndrey Utkin * is 0x00f for NTSC and 0x00a for PAL. 1553*34d1324eSAndrey Utkin * 1554*34d1324eSAndrey Utkin * HACTIVE_XY This 10bit register defines the number of horizontal active pixel 1555*34d1324eSAndrey Utkin * for display / record path. A unit is 1 pixel. The default value is decimal 1556*34d1324eSAndrey Utkin * 720. 1557*34d1324eSAndrey Utkin * 1558*34d1324eSAndrey Utkin * VDELAY_XY This 9bit register defines the starting location of vertical 1559*34d1324eSAndrey Utkin * active for display / record path. A unit is 1 line. The default value is 1560*34d1324eSAndrey Utkin * decimal 6. 1561*34d1324eSAndrey Utkin * 1562*34d1324eSAndrey Utkin * VACTIVE_XY This 9bit register defines the number of vertical active lines 1563*34d1324eSAndrey Utkin * for display / record path. A unit is 1 line. The default value is decimal 1564*34d1324eSAndrey Utkin * 240. 1565*34d1324eSAndrey Utkin */ 1566*34d1324eSAndrey Utkin 1567*34d1324eSAndrey Utkin /* HUE These bits control the color hue as 2's complement number. They have 1568*34d1324eSAndrey Utkin * value from +36o (7Fh) to -36o (80h) with an increment of 2.8o. The 2 LSB has 1569*34d1324eSAndrey Utkin * no effect. The positive value gives greenish tone and negative value gives 1570*34d1324eSAndrey Utkin * purplish tone. The default value is 0o (00h). This is effective only on NTSC 1571*34d1324eSAndrey Utkin * system. The default is 00h. 1572*34d1324eSAndrey Utkin */ 1573*34d1324eSAndrey Utkin #define TW5864_INDIR_VIN_7_HUE(channel) (0x007 + channel * 0x010) 1574*34d1324eSAndrey Utkin 1575*34d1324eSAndrey Utkin #define TW5864_INDIR_VIN_8(channel) (0x008 + channel * 0x010) 1576*34d1324eSAndrey Utkin /* Define controls in register TW5864_INDIR_VIN_8 */ 1577*34d1324eSAndrey Utkin /* 1578*34d1324eSAndrey Utkin * This bit controls the center frequency of the peaking filter. 1579*34d1324eSAndrey Utkin * The corresponding gain adjustment is HFLT. 1580*34d1324eSAndrey Utkin * 0 Low 1581*34d1324eSAndrey Utkin * 1 center 1582*34d1324eSAndrey Utkin */ 1583*34d1324eSAndrey Utkin #define TW5864_INDIR_VIN_8_SCURVE BIT(7) 1584*34d1324eSAndrey Utkin /* CTI level selection. The default is 1. 1585*34d1324eSAndrey Utkin * 0 None 1586*34d1324eSAndrey Utkin * 3 Highest 1587*34d1324eSAndrey Utkin */ 1588*34d1324eSAndrey Utkin #define TW5864_INDIR_VIN_8_CTI_SHIFT 4 1589*34d1324eSAndrey Utkin #define TW5864_INDIR_VIN_8_CTI (0x03 << 4) 1590*34d1324eSAndrey Utkin 1591*34d1324eSAndrey Utkin /* 1592*34d1324eSAndrey Utkin * These bits control the amount of sharpness enhancement on the luminance 1593*34d1324eSAndrey Utkin * signals. There are 16 levels of control with "0" having no effect on the 1594*34d1324eSAndrey Utkin * output image. 1 through 15 provides sharpness enhancement with "F" being the 1595*34d1324eSAndrey Utkin * strongest. The default is 1. 1596*34d1324eSAndrey Utkin */ 1597*34d1324eSAndrey Utkin #define TW5864_INDIR_VIN_8_SHARPNESS 0x0f 1598*34d1324eSAndrey Utkin 1599*34d1324eSAndrey Utkin /* 1600*34d1324eSAndrey Utkin * These bits control the luminance contrast gain. A value of 100 (64h) has a 1601*34d1324eSAndrey Utkin * gain of 1. The range adjustment is from 0% to 255% at 1% per step. The 1602*34d1324eSAndrey Utkin * default is 64h. 1603*34d1324eSAndrey Utkin */ 1604*34d1324eSAndrey Utkin #define TW5864_INDIR_VIN_9_CNTRST(channel) (0x009 + channel * 0x010) 1605*34d1324eSAndrey Utkin 1606*34d1324eSAndrey Utkin /* 1607*34d1324eSAndrey Utkin * These bits control the brightness. They have value of –128 to 127 in 2's 1608*34d1324eSAndrey Utkin * complement form. Positive value increases brightness. A value 0 has no 1609*34d1324eSAndrey Utkin * effect on the data. The default is 00h. 1610*34d1324eSAndrey Utkin */ 1611*34d1324eSAndrey Utkin #define TW5864_INDIR_VIN_A_BRIGHT(channel) (0x00a + channel * 0x010) 1612*34d1324eSAndrey Utkin 1613*34d1324eSAndrey Utkin /* 1614*34d1324eSAndrey Utkin * These bits control the digital gain adjustment to the U (or Cb) component of 1615*34d1324eSAndrey Utkin * the digital video signal. The color saturation can be adjusted by adjusting 1616*34d1324eSAndrey Utkin * the U and V color gain components by the same amount in the normal 1617*34d1324eSAndrey Utkin * situation. The U and V can also be adjusted independently to provide greater 1618*34d1324eSAndrey Utkin * flexibility. The range of adjustment is 0 to 200%. A value of 128 (80h) has 1619*34d1324eSAndrey Utkin * gain of 100%. The default is 80h. 1620*34d1324eSAndrey Utkin */ 1621*34d1324eSAndrey Utkin #define TW5864_INDIR_VIN_B_SAT_U(channel) (0x00b + channel * 0x010) 1622*34d1324eSAndrey Utkin 1623*34d1324eSAndrey Utkin /* 1624*34d1324eSAndrey Utkin * These bits control the digital gain adjustment to the V (or Cr) component of 1625*34d1324eSAndrey Utkin * the digital video signal. The color saturation can be adjusted by adjusting 1626*34d1324eSAndrey Utkin * the U and V color gain components by the same amount in the normal 1627*34d1324eSAndrey Utkin * situation. The U and V can also be adjusted independently to provide greater 1628*34d1324eSAndrey Utkin * flexibility. The range of adjustment is 0 to 200%. A value of 128 (80h) has 1629*34d1324eSAndrey Utkin * gain of 100%. The default is 80h. 1630*34d1324eSAndrey Utkin */ 1631*34d1324eSAndrey Utkin #define TW5864_INDIR_VIN_C_SAT_V(channel) (0x00c + channel * 0x010) 1632*34d1324eSAndrey Utkin 1633*34d1324eSAndrey Utkin /* Read-only */ 1634*34d1324eSAndrey Utkin #define TW5864_INDIR_VIN_D(channel) (0x00d + channel * 0x010) 1635*34d1324eSAndrey Utkin /* Define controls in register TW5864_INDIR_VIN_D */ 1636*34d1324eSAndrey Utkin /* Macrovision color stripe detection may be un-reliable */ 1637*34d1324eSAndrey Utkin #define TW5864_INDIR_VIN_D_CSBAD BIT(3) 1638*34d1324eSAndrey Utkin /* Macrovision AGC pulse detected */ 1639*34d1324eSAndrey Utkin #define TW5864_INDIR_VIN_D_MCVSN BIT(2) 1640*34d1324eSAndrey Utkin /* Macrovision color stripe protection burst detected */ 1641*34d1324eSAndrey Utkin #define TW5864_INDIR_VIN_D_CSTRIPE BIT(1) 1642*34d1324eSAndrey Utkin /* 1643*34d1324eSAndrey Utkin * This bit is valid only when color stripe protection is detected, i.e. if 1644*34d1324eSAndrey Utkin * CSTRIPE=1, 1645*34d1324eSAndrey Utkin * 1 Type 2 color stripe protection 1646*34d1324eSAndrey Utkin * 0 Type 3 color stripe protection 1647*34d1324eSAndrey Utkin */ 1648*34d1324eSAndrey Utkin #define TW5864_INDIR_VIN_D_CTYPE2 BIT(0) 1649*34d1324eSAndrey Utkin 1650*34d1324eSAndrey Utkin /* Read-only */ 1651*34d1324eSAndrey Utkin #define TW5864_INDIR_VIN_E(channel) (0x00e + channel * 0x010) 1652*34d1324eSAndrey Utkin /* Define controls in register TW5864_INDIR_VIN_E */ 1653*34d1324eSAndrey Utkin /* 1654*34d1324eSAndrey Utkin * Read-only. 1655*34d1324eSAndrey Utkin * 0 Idle 1656*34d1324eSAndrey Utkin * 1 Detection in progress 1657*34d1324eSAndrey Utkin */ 1658*34d1324eSAndrey Utkin #define TW5864_INDIR_VIN_E_DETSTUS BIT(7) 1659*34d1324eSAndrey Utkin /* 1660*34d1324eSAndrey Utkin * STDNOW Current standard invoked 1661*34d1324eSAndrey Utkin * 0 NTSC (M) 1662*34d1324eSAndrey Utkin * 1 PAL (B, D, G, H, I) 1663*34d1324eSAndrey Utkin * 2 SECAM 1664*34d1324eSAndrey Utkin * 3 NTSC4.43 1665*34d1324eSAndrey Utkin * 4 PAL (M) 1666*34d1324eSAndrey Utkin * 5 PAL (CN) 1667*34d1324eSAndrey Utkin * 6 PAL 60 1668*34d1324eSAndrey Utkin * 7 Not valid 1669*34d1324eSAndrey Utkin */ 1670*34d1324eSAndrey Utkin #define TW5864_INDIR_VIN_E_STDNOW_SHIFT 4 1671*34d1324eSAndrey Utkin #define TW5864_INDIR_VIN_E_STDNOW (0x07 << 4) 1672*34d1324eSAndrey Utkin 1673*34d1324eSAndrey Utkin /* 1674*34d1324eSAndrey Utkin * 1 Disable the shadow registers 1675*34d1324eSAndrey Utkin * 0 Enable VACTIVE and HDELAY shadow registers value depending on STANDARD. 1676*34d1324eSAndrey Utkin * (Default) 1677*34d1324eSAndrey Utkin */ 1678*34d1324eSAndrey Utkin #define TW5864_INDIR_VIN_E_ATREG BIT(3) 1679*34d1324eSAndrey Utkin /* 1680*34d1324eSAndrey Utkin * STANDARD Standard selection 1681*34d1324eSAndrey Utkin * 0 NTSC (M) 1682*34d1324eSAndrey Utkin * 1 PAL (B, D, G, H, I) 1683*34d1324eSAndrey Utkin * 2 SECAM 1684*34d1324eSAndrey Utkin * 3 NTSC4.43 1685*34d1324eSAndrey Utkin * 4 PAL (M) 1686*34d1324eSAndrey Utkin * 5 PAL (CN) 1687*34d1324eSAndrey Utkin * 6 PAL 60 1688*34d1324eSAndrey Utkin * 7 Auto detection (Default) 1689*34d1324eSAndrey Utkin */ 1690*34d1324eSAndrey Utkin #define TW5864_INDIR_VIN_E_STANDARD 0x07 1691*34d1324eSAndrey Utkin 1692*34d1324eSAndrey Utkin #define TW5864_INDIR_VIN_F(channel) (0x00f + channel * 0x010) 1693*34d1324eSAndrey Utkin /* Define controls in register TW5864_INDIR_VIN_F */ 1694*34d1324eSAndrey Utkin /* 1695*34d1324eSAndrey Utkin * 1 Writing 1 to this bit will manually initiate the auto format detection 1696*34d1324eSAndrey Utkin * process. This bit is a self-clearing bit 1697*34d1324eSAndrey Utkin * 0 Manual initiation of auto format detection is done. (Default) 1698*34d1324eSAndrey Utkin */ 1699*34d1324eSAndrey Utkin #define TW5864_INDIR_VIN_F_ATSTART BIT(7) 1700*34d1324eSAndrey Utkin /* Enable recognition of PAL60 (Default) */ 1701*34d1324eSAndrey Utkin #define TW5864_INDIR_VIN_F_PAL60EN BIT(6) 1702*34d1324eSAndrey Utkin /* Enable recognition of PAL (CN). (Default) */ 1703*34d1324eSAndrey Utkin #define TW5864_INDIR_VIN_F_PALCNEN BIT(5) 1704*34d1324eSAndrey Utkin /* Enable recognition of PAL (M). (Default) */ 1705*34d1324eSAndrey Utkin #define TW5864_INDIR_VIN_F_PALMEN BIT(4) 1706*34d1324eSAndrey Utkin /* Enable recognition of NTSC 4.43. (Default) */ 1707*34d1324eSAndrey Utkin #define TW5864_INDIR_VIN_F_NTSC44EN BIT(3) 1708*34d1324eSAndrey Utkin /* Enable recognition of SECAM. (Default) */ 1709*34d1324eSAndrey Utkin #define TW5864_INDIR_VIN_F_SECAMEN BIT(2) 1710*34d1324eSAndrey Utkin /* Enable recognition of PAL (B, D, G, H, I). (Default) */ 1711*34d1324eSAndrey Utkin #define TW5864_INDIR_VIN_F_PALBEN BIT(1) 1712*34d1324eSAndrey Utkin /* Enable recognition of NTSC (M). (Default) */ 1713*34d1324eSAndrey Utkin #define TW5864_INDIR_VIN_F_NTSCEN BIT(0) 1714*34d1324eSAndrey Utkin 1715*34d1324eSAndrey Utkin /* Some registers skipped. */ 1716*34d1324eSAndrey Utkin 1717*34d1324eSAndrey Utkin /* Use falling edge to sample VD1-VD4 from 54 MHz to 108 MHz */ 1718*34d1324eSAndrey Utkin #define TW5864_INDIR_VD_108_POL 0x041 1719*34d1324eSAndrey Utkin #define TW5864_INDIR_VD_108_POL_VD12 BIT(0) 1720*34d1324eSAndrey Utkin #define TW5864_INDIR_VD_108_POL_VD34 BIT(1) 1721*34d1324eSAndrey Utkin #define TW5864_INDIR_VD_108_POL_BOTH \ 1722*34d1324eSAndrey Utkin (TW5864_INDIR_VD_108_POL_VD12 | TW5864_INDIR_VD_108_POL_VD34) 1723*34d1324eSAndrey Utkin 1724*34d1324eSAndrey Utkin /* Some registers skipped. */ 1725*34d1324eSAndrey Utkin 1726*34d1324eSAndrey Utkin /* 1727*34d1324eSAndrey Utkin * Audio Input ADC gain control 1728*34d1324eSAndrey Utkin * 0 0.25 1729*34d1324eSAndrey Utkin * 1 0.31 1730*34d1324eSAndrey Utkin * 2 0.38 1731*34d1324eSAndrey Utkin * 3 0.44 1732*34d1324eSAndrey Utkin * 4 0.50 1733*34d1324eSAndrey Utkin * 5 0.63 1734*34d1324eSAndrey Utkin * 6 0.75 1735*34d1324eSAndrey Utkin * 7 0.88 1736*34d1324eSAndrey Utkin * 8 1.00 (default) 1737*34d1324eSAndrey Utkin * 9 1.25 1738*34d1324eSAndrey Utkin * 10 1.50 1739*34d1324eSAndrey Utkin * 11 1.75 1740*34d1324eSAndrey Utkin * 12 2.00 1741*34d1324eSAndrey Utkin * 13 2.25 1742*34d1324eSAndrey Utkin * 14 2.50 1743*34d1324eSAndrey Utkin * 15 2.75 1744*34d1324eSAndrey Utkin */ 1745*34d1324eSAndrey Utkin /* [3:0] channel 0, [7:4] channel 1 */ 1746*34d1324eSAndrey Utkin #define TW5864_INDIR_AIGAIN1 0x060 1747*34d1324eSAndrey Utkin /* [3:0] channel 2, [7:4] channel 3 */ 1748*34d1324eSAndrey Utkin #define TW5864_INDIR_AIGAIN2 0x061 1749*34d1324eSAndrey Utkin 1750*34d1324eSAndrey Utkin /* Some registers skipped */ 1751*34d1324eSAndrey Utkin 1752*34d1324eSAndrey Utkin #define TW5864_INDIR_AIN_0x06D 0x06d 1753*34d1324eSAndrey Utkin /* Define controls in register TW5864_INDIR_AIN_0x06D */ 1754*34d1324eSAndrey Utkin /* 1755*34d1324eSAndrey Utkin * LAWMD Select u-Law/A-Law/PCM/SB data output format on ADATR and ADATM pin. 1756*34d1324eSAndrey Utkin * 0 PCM output (default) 1757*34d1324eSAndrey Utkin * 1 SB (Signed MSB bit in PCM data is inverted) output 1758*34d1324eSAndrey Utkin * 2 u-Law output 1759*34d1324eSAndrey Utkin * 3 A-Law output 1760*34d1324eSAndrey Utkin */ 1761*34d1324eSAndrey Utkin #define TW5864_INDIR_AIN_LAWMD_SHIFT 6 1762*34d1324eSAndrey Utkin #define TW5864_INDIR_AIN_LAWMD (0x03 << 6) 1763*34d1324eSAndrey Utkin /* 1764*34d1324eSAndrey Utkin * Disable the mixing ratio value for all audio. 1765*34d1324eSAndrey Utkin * 0 Apply individual mixing ratio value for each audio (default) 1766*34d1324eSAndrey Utkin * 1 Apply nominal value for all audio commonly 1767*34d1324eSAndrey Utkin */ 1768*34d1324eSAndrey Utkin #define TW5864_INDIR_AIN_MIX_DERATIO BIT(5) 1769*34d1324eSAndrey Utkin /* 1770*34d1324eSAndrey Utkin * Enable the mute function for audio channel AINn when n is 0 to 3. It effects 1771*34d1324eSAndrey Utkin * only for mixing. When n = 4, it enable the mute function of the playback 1772*34d1324eSAndrey Utkin * audio input. It effects only for single chip or the last stage chip 1773*34d1324eSAndrey Utkin * 0 Normal 1774*34d1324eSAndrey Utkin * 1 Muted (default) 1775*34d1324eSAndrey Utkin */ 1776*34d1324eSAndrey Utkin #define TW5864_INDIR_AIN_MIX_MUTE 0x1f 1777*34d1324eSAndrey Utkin 1778*34d1324eSAndrey Utkin /* Some registers skipped */ 1779*34d1324eSAndrey Utkin 1780*34d1324eSAndrey Utkin #define TW5864_INDIR_AIN_0x0E3 0x0e3 1781*34d1324eSAndrey Utkin /* Define controls in register TW5864_INDIR_AIN_0x0E3 */ 1782*34d1324eSAndrey Utkin /* 1783*34d1324eSAndrey Utkin * ADATP signal is coming from external ADPCM decoder, instead of on-chip ADPCM 1784*34d1324eSAndrey Utkin * decoder 1785*34d1324eSAndrey Utkin */ 1786*34d1324eSAndrey Utkin #define TW5864_INDIR_AIN_0x0E3_EXT_ADATP BIT(7) 1787*34d1324eSAndrey Utkin /* ACLKP output signal polarity inverse */ 1788*34d1324eSAndrey Utkin #define TW5864_INDIR_AIN_0x0E3_ACLKPPOLO BIT(6) 1789*34d1324eSAndrey Utkin /* 1790*34d1324eSAndrey Utkin * ACLKR input signal polarity inverse. 1791*34d1324eSAndrey Utkin * 0 Not inversed (Default) 1792*34d1324eSAndrey Utkin * 1 Inversed 1793*34d1324eSAndrey Utkin */ 1794*34d1324eSAndrey Utkin #define TW5864_INDIR_AIN_0x0E3_ACLKRPOL BIT(5) 1795*34d1324eSAndrey Utkin /* 1796*34d1324eSAndrey Utkin * ACLKP input signal polarity inverse. 1797*34d1324eSAndrey Utkin * 0 Not inversed (Default) 1798*34d1324eSAndrey Utkin * 1 Inversed 1799*34d1324eSAndrey Utkin */ 1800*34d1324eSAndrey Utkin #define TW5864_INDIR_AIN_0x0E3_ACLKPPOLI BIT(4) 1801*34d1324eSAndrey Utkin /* 1802*34d1324eSAndrey Utkin * ACKI [21:0] control automatic set up with AFMD registers 1803*34d1324eSAndrey Utkin * This mode is only effective when ACLKRMASTER=1 1804*34d1324eSAndrey Utkin * 0 ACKI [21:0] registers set up ACKI control 1805*34d1324eSAndrey Utkin * 1 ACKI control is automatically set up by AFMD register values 1806*34d1324eSAndrey Utkin */ 1807*34d1324eSAndrey Utkin #define TW5864_INDIR_AIN_0x0E3_AFAUTO BIT(3) 1808*34d1324eSAndrey Utkin /* 1809*34d1324eSAndrey Utkin * AFAUTO control mode 1810*34d1324eSAndrey Utkin * 0 8kHz setting (Default) 1811*34d1324eSAndrey Utkin * 1 16kHz setting 1812*34d1324eSAndrey Utkin * 2 32kHz setting 1813*34d1324eSAndrey Utkin * 3 44.1kHz setting 1814*34d1324eSAndrey Utkin * 4 48kHz setting 1815*34d1324eSAndrey Utkin */ 1816*34d1324eSAndrey Utkin #define TW5864_INDIR_AIN_0x0E3_AFMD 0x07 1817*34d1324eSAndrey Utkin 1818*34d1324eSAndrey Utkin #define TW5864_INDIR_AIN_0x0E4 0x0e4 1819*34d1324eSAndrey Utkin /* Define controls in register TW5864_INDIR_AIN_0x0ED */ 1820*34d1324eSAndrey Utkin /* 1821*34d1324eSAndrey Utkin * 8bit I2S Record output mode. 1822*34d1324eSAndrey Utkin * 0 L/R half length separated output (Default). 1823*34d1324eSAndrey Utkin * 1 One continuous packed output equal to DSP output format. 1824*34d1324eSAndrey Utkin */ 1825*34d1324eSAndrey Utkin #define TW5864_INDIR_AIN_0x0E4_I2S8MODE BIT(7) 1826*34d1324eSAndrey Utkin /* 1827*34d1324eSAndrey Utkin * Audio Clock Master ACLKR output wave format. 1828*34d1324eSAndrey Utkin * 0 High periods is one 27MHz clock period (default). 1829*34d1324eSAndrey Utkin * 1 Almost duty 50-50% clock output on ACLKR pin. If this mode is selected, two 1830*34d1324eSAndrey Utkin * times bigger number value need to be set up on the ACKI register. If 1831*34d1324eSAndrey Utkin * AFAUTO=1, ACKI control is automatically set up even if MASCKMD=1. 1832*34d1324eSAndrey Utkin */ 1833*34d1324eSAndrey Utkin #define TW5864_INDIR_AIN_0x0E4_MASCKMD BIT(6) 1834*34d1324eSAndrey Utkin /* Playback ACLKP/ASYNP/ADATP input data MSB-LSB swapping */ 1835*34d1324eSAndrey Utkin #define TW5864_INDIR_AIN_0x0E4_PBINSWAP BIT(5) 1836*34d1324eSAndrey Utkin /* 1837*34d1324eSAndrey Utkin * ASYNR input signal delay. 1838*34d1324eSAndrey Utkin * 0 No delay 1839*34d1324eSAndrey Utkin * 1 Add one 27MHz period delay in ASYNR signal input 1840*34d1324eSAndrey Utkin */ 1841*34d1324eSAndrey Utkin #define TW5864_INDIR_AIN_0x0E4_ASYNRDLY BIT(4) 1842*34d1324eSAndrey Utkin /* 1843*34d1324eSAndrey Utkin * ASYNP input signal delay. 1844*34d1324eSAndrey Utkin * 0 no delay 1845*34d1324eSAndrey Utkin * 1 add one 27MHz period delay in ASYNP signal input 1846*34d1324eSAndrey Utkin */ 1847*34d1324eSAndrey Utkin #define TW5864_INDIR_AIN_0x0E4_ASYNPDLY BIT(3) 1848*34d1324eSAndrey Utkin /* 1849*34d1324eSAndrey Utkin * ADATP input data delay by one ACLKP clock. 1850*34d1324eSAndrey Utkin * 0 No delay (Default). This is for I2S type 1T delay input interface. 1851*34d1324eSAndrey Utkin * 1 Add 1 ACLKP clock delay in ADATP input data. This is for left-justified 1852*34d1324eSAndrey Utkin * type 0T delay input interface. 1853*34d1324eSAndrey Utkin */ 1854*34d1324eSAndrey Utkin #define TW5864_INDIR_AIN_0x0E4_ADATPDLY BIT(2) 1855*34d1324eSAndrey Utkin /* 1856*34d1324eSAndrey Utkin * Select u-Law/A-Law/PCM/SB data input format on ADATP pin. 1857*34d1324eSAndrey Utkin * 0 PCM input (Default) 1858*34d1324eSAndrey Utkin * 1 SB (Signed MSB bit in PCM data is inverted) input 1859*34d1324eSAndrey Utkin * 2 u-Law input 1860*34d1324eSAndrey Utkin * 3 A-Law input 1861*34d1324eSAndrey Utkin */ 1862*34d1324eSAndrey Utkin #define TW5864_INDIR_AIN_0x0E4_INLAWMD 0x03 1863*34d1324eSAndrey Utkin 1864*34d1324eSAndrey Utkin /* 1865*34d1324eSAndrey Utkin * Enable state register updating and interrupt request of audio AIN5 detection 1866*34d1324eSAndrey Utkin * for each input 1867*34d1324eSAndrey Utkin */ 1868*34d1324eSAndrey Utkin #define TW5864_INDIR_AIN_A5DETENA 0x0e5 1869*34d1324eSAndrey Utkin 1870*34d1324eSAndrey Utkin /* Some registers skipped */ 1871*34d1324eSAndrey Utkin 1872*34d1324eSAndrey Utkin /* 1873*34d1324eSAndrey Utkin * [7:3]: DEV_ID The TW5864 product ID code is 01000 1874*34d1324eSAndrey Utkin * [2:0]: REV_ID The revision number is 0h 1875*34d1324eSAndrey Utkin */ 1876*34d1324eSAndrey Utkin #define TW5864_INDIR_ID 0x0fe 1877*34d1324eSAndrey Utkin 1878*34d1324eSAndrey Utkin #define TW5864_INDIR_IN_PIC_WIDTH(channel) (0x200 + 4 * channel) 1879*34d1324eSAndrey Utkin #define TW5864_INDIR_IN_PIC_HEIGHT(channel) (0x201 + 4 * channel) 1880*34d1324eSAndrey Utkin #define TW5864_INDIR_OUT_PIC_WIDTH(channel) (0x202 + 4 * channel) 1881*34d1324eSAndrey Utkin #define TW5864_INDIR_OUT_PIC_HEIGHT(channel) (0x203 + 4 * channel) 1882*34d1324eSAndrey Utkin /* 1883*34d1324eSAndrey Utkin * Interrupt status register from the front-end. Write "1" to each bit to clear 1884*34d1324eSAndrey Utkin * the interrupt 1885*34d1324eSAndrey Utkin * 15:0 Motion detection interrupt for channel 0 ~ 15 1886*34d1324eSAndrey Utkin * 31:16 Night detection interrupt for channel 0 ~ 15 1887*34d1324eSAndrey Utkin * 47:32 Blind detection interrupt for channel 0 ~ 15 1888*34d1324eSAndrey Utkin * 63:48 No video interrupt for channel 0 ~ 15 1889*34d1324eSAndrey Utkin * 79:64 Line mode underflow interrupt for channel 0 ~ 15 1890*34d1324eSAndrey Utkin * 95:80 Line mode overflow interrupt for channel 0 ~ 15 1891*34d1324eSAndrey Utkin */ 1892*34d1324eSAndrey Utkin /* 0x2d0~0x2d7: [63:0] bits */ 1893*34d1324eSAndrey Utkin #define TW5864_INDIR_INTERRUPT1 0x2d0 1894*34d1324eSAndrey Utkin /* 0x2e0~0x2e3: [95:64] bits */ 1895*34d1324eSAndrey Utkin #define TW5864_INDIR_INTERRUPT2 0x2e0 1896*34d1324eSAndrey Utkin 1897*34d1324eSAndrey Utkin /* 1898*34d1324eSAndrey Utkin * Interrupt mask register for interrupts in 0x2d0 ~ 0x2d7 1899*34d1324eSAndrey Utkin * 15:0 Motion detection interrupt for channel 0 ~ 15 1900*34d1324eSAndrey Utkin * 31:16 Night detection interrupt for channel 0 ~ 15 1901*34d1324eSAndrey Utkin * 47:32 Blind detection interrupt for channel 0 ~ 15 1902*34d1324eSAndrey Utkin * 63:48 No video interrupt for channel 0 ~ 15 1903*34d1324eSAndrey Utkin * 79:64 Line mode underflow interrupt for channel 0 ~ 15 1904*34d1324eSAndrey Utkin * 95:80 Line mode overflow interrupt for channel 0 ~ 15 1905*34d1324eSAndrey Utkin */ 1906*34d1324eSAndrey Utkin /* 0x2d8~0x2df: [63:0] bits */ 1907*34d1324eSAndrey Utkin #define TW5864_INDIR_INTERRUPT_MASK1 0x2d8 1908*34d1324eSAndrey Utkin /* 0x2e8~0x2eb: [95:64] bits */ 1909*34d1324eSAndrey Utkin #define TW5864_INDIR_INTERRUPT_MASK2 0x2e8 1910*34d1324eSAndrey Utkin 1911*34d1324eSAndrey Utkin /* [11:0]: Interrupt summary register for interrupts & interrupt mask from in 1912*34d1324eSAndrey Utkin * 0x2d0 ~ 0x2d7 and 0x2d8 ~ 0x2df 1913*34d1324eSAndrey Utkin * bit 0: interrupt occurs in 0x2d0 & 0x2d8 1914*34d1324eSAndrey Utkin * bit 1: interrupt occurs in 0x2d1 & 0x2d9 1915*34d1324eSAndrey Utkin * bit 2: interrupt occurs in 0x2d2 & 0x2da 1916*34d1324eSAndrey Utkin * bit 3: interrupt occurs in 0x2d3 & 0x2db 1917*34d1324eSAndrey Utkin * bit 4: interrupt occurs in 0x2d4 & 0x2dc 1918*34d1324eSAndrey Utkin * bit 5: interrupt occurs in 0x2d5 & 0x2dd 1919*34d1324eSAndrey Utkin * bit 6: interrupt occurs in 0x2d6 & 0x2de 1920*34d1324eSAndrey Utkin * bit 7: interrupt occurs in 0x2d7 & 0x2df 1921*34d1324eSAndrey Utkin * bit 8: interrupt occurs in 0x2e0 & 0x2e8 1922*34d1324eSAndrey Utkin * bit 9: interrupt occurs in 0x2e1 & 0x2e9 1923*34d1324eSAndrey Utkin * bit 10: interrupt occurs in 0x2e2 & 0x2ea 1924*34d1324eSAndrey Utkin * bit 11: interrupt occurs in 0x2e3 & 0x2eb 1925*34d1324eSAndrey Utkin */ 1926*34d1324eSAndrey Utkin #define TW5864_INDIR_INTERRUPT_SUMMARY 0x2f0 1927*34d1324eSAndrey Utkin 1928*34d1324eSAndrey Utkin /* Motion / Blind / Night Detection */ 1929*34d1324eSAndrey Utkin /* valid value for channel is [0:15] */ 1930*34d1324eSAndrey Utkin #define TW5864_INDIR_DETECTION_CTL0(channel) (0x300 + channel * 0x08) 1931*34d1324eSAndrey Utkin /* Define controls in register TW5864_INDIR_DETECTION_CTL0 */ 1932*34d1324eSAndrey Utkin /* 1933*34d1324eSAndrey Utkin * Disable the motion and blind detection. 1934*34d1324eSAndrey Utkin * 0 Enable motion and blind detection (default) 1935*34d1324eSAndrey Utkin * 1 Disable motion and blind detection 1936*34d1324eSAndrey Utkin */ 1937*34d1324eSAndrey Utkin #define TW5864_INDIR_DETECTION_CTL0_MD_DIS BIT(5) 1938*34d1324eSAndrey Utkin /* 1939*34d1324eSAndrey Utkin * Request to start motion detection on manual trigger mode 1940*34d1324eSAndrey Utkin * 0 None Operation (default) 1941*34d1324eSAndrey Utkin * 1 Request to start motion detection 1942*34d1324eSAndrey Utkin */ 1943*34d1324eSAndrey Utkin #define TW5864_INDIR_DETECTION_CTL0_MD_STRB BIT(3) 1944*34d1324eSAndrey Utkin /* 1945*34d1324eSAndrey Utkin * Select the trigger mode of motion detection 1946*34d1324eSAndrey Utkin * 0 Automatic trigger mode of motion detection (default) 1947*34d1324eSAndrey Utkin * 1 Manual trigger mode for motion detection 1948*34d1324eSAndrey Utkin */ 1949*34d1324eSAndrey Utkin #define TW5864_INDIR_DETECTION_CTL0_MD_STRB_EN BIT(2) 1950*34d1324eSAndrey Utkin /* 1951*34d1324eSAndrey Utkin * Define the threshold of cell for blind detection. 1952*34d1324eSAndrey Utkin * 0 Low threshold (More sensitive) (default) 1953*34d1324eSAndrey Utkin * : : 1954*34d1324eSAndrey Utkin * 3 High threshold (Less sensitive) 1955*34d1324eSAndrey Utkin */ 1956*34d1324eSAndrey Utkin #define TW5864_INDIR_DETECTION_CTL0_BD_CELSENS 0x03 1957*34d1324eSAndrey Utkin 1958*34d1324eSAndrey Utkin #define TW5864_INDIR_DETECTION_CTL1(channel) (0x301 + channel * 0x08) 1959*34d1324eSAndrey Utkin /* Define controls in register TW5864_INDIR_DETECTION_CTL1 */ 1960*34d1324eSAndrey Utkin /* 1961*34d1324eSAndrey Utkin * Control the temporal sensitivity of motion detector. 1962*34d1324eSAndrey Utkin * 0 More Sensitive (default) 1963*34d1324eSAndrey Utkin * : : 1964*34d1324eSAndrey Utkin * 15 Less Sensitive 1965*34d1324eSAndrey Utkin */ 1966*34d1324eSAndrey Utkin #define TW5864_INDIR_DETECTION_CTL1_MD_TMPSENS_SHIFT 4 1967*34d1324eSAndrey Utkin #define TW5864_INDIR_DETECTION_CTL1_MD_TMPSENS (0x0f << 4) 1968*34d1324eSAndrey Utkin /* 1969*34d1324eSAndrey Utkin * Adjust the horizontal starting position for motion detection 1970*34d1324eSAndrey Utkin * 0 0 pixel (default) 1971*34d1324eSAndrey Utkin * : : 1972*34d1324eSAndrey Utkin * 15 15 pixels 1973*34d1324eSAndrey Utkin */ 1974*34d1324eSAndrey Utkin #define TW5864_INDIR_DETECTION_CTL1_MD_PIXEL_OS 0x0f 1975*34d1324eSAndrey Utkin 1976*34d1324eSAndrey Utkin #define TW5864_INDIR_DETECTION_CTL2(channel) (0x302 + channel * 0x08) 1977*34d1324eSAndrey Utkin /* Define controls in register TW5864_INDIR_DETECTION_CTL2 */ 1978*34d1324eSAndrey Utkin /* 1979*34d1324eSAndrey Utkin * Control the updating time of reference field for motion detection. 1980*34d1324eSAndrey Utkin * 0 Update reference field every field (default) 1981*34d1324eSAndrey Utkin * 1 Update reference field according to MD_SPEED 1982*34d1324eSAndrey Utkin */ 1983*34d1324eSAndrey Utkin #define TW5864_INDIR_DETECTION_CTL2_MD_REFFLD BIT(7) 1984*34d1324eSAndrey Utkin /* 1985*34d1324eSAndrey Utkin * Select the field for motion detection. 1986*34d1324eSAndrey Utkin * 0 Detecting motion for only odd field (default) 1987*34d1324eSAndrey Utkin * 1 Detecting motion for only even field 1988*34d1324eSAndrey Utkin * 2 Detecting motion for any field 1989*34d1324eSAndrey Utkin * 3 Detecting motion for both odd and even field 1990*34d1324eSAndrey Utkin */ 1991*34d1324eSAndrey Utkin #define TW5864_INDIR_DETECTION_CTL2_MD_FIELD_SHIFT 5 1992*34d1324eSAndrey Utkin #define TW5864_INDIR_DETECTION_CTL2_MD_FIELD (0x03 << 5) 1993*34d1324eSAndrey Utkin /* 1994*34d1324eSAndrey Utkin * Control the level sensitivity of motion detector. 1995*34d1324eSAndrey Utkin * 0 More sensitive (default) 1996*34d1324eSAndrey Utkin * : : 1997*34d1324eSAndrey Utkin * 15 Less sensitive 1998*34d1324eSAndrey Utkin */ 1999*34d1324eSAndrey Utkin #define TW5864_INDIR_DETECTION_CTL2_MD_LVSENS 0x1f 2000*34d1324eSAndrey Utkin 2001*34d1324eSAndrey Utkin #define TW5864_INDIR_DETECTION_CTL3(channel) (0x303 + channel * 0x08) 2002*34d1324eSAndrey Utkin /* Define controls in register TW5864_INDIR_DETECTION_CTL3 */ 2003*34d1324eSAndrey Utkin /* 2004*34d1324eSAndrey Utkin * Define the threshold of sub-cell number for motion detection. 2005*34d1324eSAndrey Utkin * 0 Motion is detected if 1 sub-cell has motion (More sensitive) (default) 2006*34d1324eSAndrey Utkin * 1 Motion is detected if 2 sub-cells have motion 2007*34d1324eSAndrey Utkin * 2 Motion is detected if 3 sub-cells have motion 2008*34d1324eSAndrey Utkin * 3 Motion is detected if 4 sub-cells have motion (Less sensitive) 2009*34d1324eSAndrey Utkin */ 2010*34d1324eSAndrey Utkin #define TW5864_INDIR_DETECTION_CTL3_MD_CELSENS_SHIFT 6 2011*34d1324eSAndrey Utkin #define TW5864_INDIR_DETECTION_CTL3_MD_CELSENS (0x03 << 6) 2012*34d1324eSAndrey Utkin /* 2013*34d1324eSAndrey Utkin * Control the velocity of motion detector. 2014*34d1324eSAndrey Utkin * Large value is suitable for slow motion detection. 2015*34d1324eSAndrey Utkin * In MD_DUAL_EN = 1, MD_SPEED should be limited to 0 ~ 31. 2016*34d1324eSAndrey Utkin * 0 1 field intervals (default) 2017*34d1324eSAndrey Utkin * 1 2 field intervals 2018*34d1324eSAndrey Utkin * : : 2019*34d1324eSAndrey Utkin * 61 62 field intervals 2020*34d1324eSAndrey Utkin * 62 63 field intervals 2021*34d1324eSAndrey Utkin * 63 Not supported 2022*34d1324eSAndrey Utkin */ 2023*34d1324eSAndrey Utkin #define TW5864_INDIR_DETECTION_CTL3_MD_SPEED 0x3f 2024*34d1324eSAndrey Utkin 2025*34d1324eSAndrey Utkin #define TW5864_INDIR_DETECTION_CTL4(channel) (0x304 + channel * 0x08) 2026*34d1324eSAndrey Utkin /* Define controls in register TW5864_INDIR_DETECTION_CTL4 */ 2027*34d1324eSAndrey Utkin /* 2028*34d1324eSAndrey Utkin * Control the spatial sensitivity of motion detector. 2029*34d1324eSAndrey Utkin * 0 More Sensitive (default) 2030*34d1324eSAndrey Utkin * : : 2031*34d1324eSAndrey Utkin * 15 Less Sensitive 2032*34d1324eSAndrey Utkin */ 2033*34d1324eSAndrey Utkin #define TW5864_INDIR_DETECTION_CTL4_MD_SPSENS_SHIFT 4 2034*34d1324eSAndrey Utkin #define TW5864_INDIR_DETECTION_CTL4_MD_SPSENS (0x0f << 4) 2035*34d1324eSAndrey Utkin /* 2036*34d1324eSAndrey Utkin * Define the threshold of level for blind detection. 2037*34d1324eSAndrey Utkin * 0 Low threshold (More sensitive) (default) 2038*34d1324eSAndrey Utkin * : : 2039*34d1324eSAndrey Utkin * 15 High threshold (Less sensitive) 2040*34d1324eSAndrey Utkin */ 2041*34d1324eSAndrey Utkin #define TW5864_INDIR_DETECTION_CTL4_BD_LVSENS 0x0f 2042*34d1324eSAndrey Utkin 2043*34d1324eSAndrey Utkin #define TW5864_INDIR_DETECTION_CTL5(channel) (0x305 + channel * 0x08) 2044*34d1324eSAndrey Utkin /* 2045*34d1324eSAndrey Utkin * Define the threshold of temporal sensitivity for night detection. 2046*34d1324eSAndrey Utkin * 0 Low threshold (More sensitive) (default) 2047*34d1324eSAndrey Utkin * : : 2048*34d1324eSAndrey Utkin * 15 High threshold (Less sensitive) 2049*34d1324eSAndrey Utkin */ 2050*34d1324eSAndrey Utkin #define TW5864_INDIR_DETECTION_CTL5_ND_TMPSENS_SHIFT 4 2051*34d1324eSAndrey Utkin #define TW5864_INDIR_DETECTION_CTL5_ND_TMPSENS (0x0f << 4) 2052*34d1324eSAndrey Utkin /* 2053*34d1324eSAndrey Utkin * Define the threshold of level for night detection. 2054*34d1324eSAndrey Utkin * 0 Low threshold (More sensitive) (default) 2055*34d1324eSAndrey Utkin * : : 2056*34d1324eSAndrey Utkin * 3 High threshold (Less sensitive) 2057*34d1324eSAndrey Utkin */ 2058*34d1324eSAndrey Utkin #define TW5864_INDIR_DETECTION_CTL5_ND_LVSENS 0x0f 2059*34d1324eSAndrey Utkin 2060*34d1324eSAndrey Utkin /* 2061*34d1324eSAndrey Utkin * [11:0] The base address of the motion detection buffer. This address is in 2062*34d1324eSAndrey Utkin * unit of 64K bytes. The generated DDR address will be {MD_BASE_ADDR, 2063*34d1324eSAndrey Utkin * 16"h0000}. The default value should be 12"h000 2064*34d1324eSAndrey Utkin */ 2065*34d1324eSAndrey Utkin #define TW5864_INDIR_MD_BASE_ADDR 0x380 2066*34d1324eSAndrey Utkin 2067*34d1324eSAndrey Utkin /* 2068*34d1324eSAndrey Utkin * This controls the channel of the motion detection result shown in register 2069*34d1324eSAndrey Utkin * 0x3a0 ~ 0x3b7. Before reading back motion result, always set this first. 2070*34d1324eSAndrey Utkin */ 2071*34d1324eSAndrey Utkin #define TW5864_INDIR_RGR_MOTION_SEL 0x382 2072*34d1324eSAndrey Utkin 2073*34d1324eSAndrey Utkin /* [15:0] MD strobe has been performed at channel n (read only) */ 2074*34d1324eSAndrey Utkin #define TW5864_INDIR_MD_STRB 0x386 2075*34d1324eSAndrey Utkin /* NO_VIDEO Detected from channel n (read only) */ 2076*34d1324eSAndrey Utkin #define TW5864_INDIR_NOVID_DET 0x388 2077*34d1324eSAndrey Utkin /* Motion Detected from channel n (read only) */ 2078*34d1324eSAndrey Utkin #define TW5864_INDIR_MD_DET 0x38a 2079*34d1324eSAndrey Utkin /* Blind Detected from channel n (read only) */ 2080*34d1324eSAndrey Utkin #define TW5864_INDIR_BD_DET 0x38c 2081*34d1324eSAndrey Utkin /* Night Detected from channel n (read only) */ 2082*34d1324eSAndrey Utkin #define TW5864_INDIR_ND_DET 0x38e 2083*34d1324eSAndrey Utkin 2084*34d1324eSAndrey Utkin /* 192 bit motion flag of the channel specified by RGR_MOTION_SEL in 0x382 */ 2085*34d1324eSAndrey Utkin #define TW5864_INDIR_MOTION_FLAG 0x3a0 2086*34d1324eSAndrey Utkin #define TW5864_INDIR_MOTION_FLAG_BYTE_COUNT 24 2087*34d1324eSAndrey Utkin 2088*34d1324eSAndrey Utkin /* 2089*34d1324eSAndrey Utkin * [9:0] The motion cell count of a specific channel selected by 0x382. This is 2090*34d1324eSAndrey Utkin * for DI purpose 2091*34d1324eSAndrey Utkin */ 2092*34d1324eSAndrey Utkin #define TW5864_INDIR_MD_DI_CNT 0x3b8 2093*34d1324eSAndrey Utkin /* The motion detection cell sensitivity for DI purpose */ 2094*34d1324eSAndrey Utkin #define TW5864_INDIR_MD_DI_CELLSENS 0x3ba 2095*34d1324eSAndrey Utkin /* The motion detection threshold level for DI purpose */ 2096*34d1324eSAndrey Utkin #define TW5864_INDIR_MD_DI_LVSENS 0x3bb 2097*34d1324eSAndrey Utkin 2098*34d1324eSAndrey Utkin /* 192 bit motion mask of the channel specified by MASK_CH_SEL in 0x3fe */ 2099*34d1324eSAndrey Utkin #define TW5864_INDIR_MOTION_MASK 0x3e0 2100*34d1324eSAndrey Utkin #define TW5864_INDIR_MOTION_MASK_BYTE_COUNT 24 2101*34d1324eSAndrey Utkin 2102*34d1324eSAndrey Utkin /* [4:0] The channel selection to access masks in 0x3e0 ~ 0x3f7 */ 2103*34d1324eSAndrey Utkin #define TW5864_INDIR_MASK_CH_SEL 0x3fe 2104*34d1324eSAndrey Utkin 2105*34d1324eSAndrey Utkin /* Clock PLL / Analog IP Control */ 2106*34d1324eSAndrey Utkin /* Some registers skipped */ 2107*34d1324eSAndrey Utkin 2108*34d1324eSAndrey Utkin #define TW5864_INDIR_DDRA_DLL_DQS_SEL0 0xee6 2109*34d1324eSAndrey Utkin #define TW5864_INDIR_DDRA_DLL_DQS_SEL1 0xee7 2110*34d1324eSAndrey Utkin #define TW5864_INDIR_DDRA_DLL_CLK90_SEL 0xee8 2111*34d1324eSAndrey Utkin #define TW5864_INDIR_DDRA_DLL_TEST_SEL_AND_TAP_S 0xee9 2112*34d1324eSAndrey Utkin 2113*34d1324eSAndrey Utkin #define TW5864_INDIR_DDRB_DLL_DQS_SEL0 0xeeb 2114*34d1324eSAndrey Utkin #define TW5864_INDIR_DDRB_DLL_DQS_SEL1 0xeec 2115*34d1324eSAndrey Utkin #define TW5864_INDIR_DDRB_DLL_CLK90_SEL 0xeed 2116*34d1324eSAndrey Utkin #define TW5864_INDIR_DDRB_DLL_TEST_SEL_AND_TAP_S 0xeee 2117*34d1324eSAndrey Utkin 2118*34d1324eSAndrey Utkin #define TW5864_INDIR_RESET 0xef0 2119*34d1324eSAndrey Utkin #define TW5864_INDIR_RESET_VD BIT(7) 2120*34d1324eSAndrey Utkin #define TW5864_INDIR_RESET_DLL BIT(6) 2121*34d1324eSAndrey Utkin #define TW5864_INDIR_RESET_MUX_CORE BIT(5) 2122*34d1324eSAndrey Utkin 2123*34d1324eSAndrey Utkin #define TW5864_INDIR_PV_VD_CK_POL 0xefd 2124*34d1324eSAndrey Utkin #define TW5864_INDIR_PV_VD_CK_POL_PV(channel) BIT(channel) 2125*34d1324eSAndrey Utkin #define TW5864_INDIR_PV_VD_CK_POL_VD(channel) BIT(channel + 4) 2126*34d1324eSAndrey Utkin 2127*34d1324eSAndrey Utkin #define TW5864_INDIR_CLK0_SEL 0xefe 2128*34d1324eSAndrey Utkin #define TW5864_INDIR_CLK0_SEL_VD_SHIFT 0 2129*34d1324eSAndrey Utkin #define TW5864_INDIR_CLK0_SEL_VD_MASK 0x3 2130*34d1324eSAndrey Utkin #define TW5864_INDIR_CLK0_SEL_PV_SHIFT 2 2131*34d1324eSAndrey Utkin #define TW5864_INDIR_CLK0_SEL_PV_MASK (0x3 << 2) 2132*34d1324eSAndrey Utkin #define TW5864_INDIR_CLK0_SEL_PV2_SHIFT 4 2133*34d1324eSAndrey Utkin #define TW5864_INDIR_CLK0_SEL_PV2_MASK (0x3 << 4) 2134