18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0-or-later */ 28c2ecf20Sopenharmony_ci/* 38c2ecf20Sopenharmony_ci * SiRF inner codec controllers define 48c2ecf20Sopenharmony_ci * 58c2ecf20Sopenharmony_ci * Copyright (c) 2011 Cambridge Silicon Radio Limited, a CSR plc group company. 68c2ecf20Sopenharmony_ci */ 78c2ecf20Sopenharmony_ci 88c2ecf20Sopenharmony_ci#ifndef _SIRF_AUDIO_CODEC_H 98c2ecf20Sopenharmony_ci#define _SIRF_AUDIO_CODEC_H 108c2ecf20Sopenharmony_ci 118c2ecf20Sopenharmony_ci 128c2ecf20Sopenharmony_ci#define AUDIO_IC_CODEC_PWR (0x00E0) 138c2ecf20Sopenharmony_ci#define AUDIO_IC_CODEC_CTRL0 (0x00E4) 148c2ecf20Sopenharmony_ci#define AUDIO_IC_CODEC_CTRL1 (0x00E8) 158c2ecf20Sopenharmony_ci#define AUDIO_IC_CODEC_CTRL2 (0x00EC) 168c2ecf20Sopenharmony_ci#define AUDIO_IC_CODEC_CTRL3 (0x00F0) 178c2ecf20Sopenharmony_ci 188c2ecf20Sopenharmony_ci#define MICBIASEN (1 << 3) 198c2ecf20Sopenharmony_ci 208c2ecf20Sopenharmony_ci#define IC_RDACEN (1 << 0) 218c2ecf20Sopenharmony_ci#define IC_LDACEN (1 << 1) 228c2ecf20Sopenharmony_ci#define IC_HSREN (1 << 2) 238c2ecf20Sopenharmony_ci#define IC_HSLEN (1 << 3) 248c2ecf20Sopenharmony_ci#define IC_SPEN (1 << 4) 258c2ecf20Sopenharmony_ci#define IC_CPEN (1 << 5) 268c2ecf20Sopenharmony_ci 278c2ecf20Sopenharmony_ci#define IC_HPRSELR (1 << 6) 288c2ecf20Sopenharmony_ci#define IC_HPLSELR (1 << 7) 298c2ecf20Sopenharmony_ci#define IC_HPRSELL (1 << 8) 308c2ecf20Sopenharmony_ci#define IC_HPLSELL (1 << 9) 318c2ecf20Sopenharmony_ci#define IC_SPSELR (1 << 10) 328c2ecf20Sopenharmony_ci#define IC_SPSELL (1 << 11) 338c2ecf20Sopenharmony_ci 348c2ecf20Sopenharmony_ci#define IC_MONOR (1 << 12) 358c2ecf20Sopenharmony_ci#define IC_MONOL (1 << 13) 368c2ecf20Sopenharmony_ci 378c2ecf20Sopenharmony_ci#define IC_RXOSRSEL (1 << 28) 388c2ecf20Sopenharmony_ci#define IC_CPFREQ (1 << 29) 398c2ecf20Sopenharmony_ci#define IC_HSINVEN (1 << 30) 408c2ecf20Sopenharmony_ci 418c2ecf20Sopenharmony_ci#define IC_MICINREN (1 << 0) 428c2ecf20Sopenharmony_ci#define IC_MICINLEN (1 << 1) 438c2ecf20Sopenharmony_ci#define IC_MICIN1SEL (1 << 2) 448c2ecf20Sopenharmony_ci#define IC_MICIN2SEL (1 << 3) 458c2ecf20Sopenharmony_ci#define IC_MICDIFSEL (1 << 4) 468c2ecf20Sopenharmony_ci#define IC_LINEIN1SEL (1 << 5) 478c2ecf20Sopenharmony_ci#define IC_LINEIN2SEL (1 << 6) 488c2ecf20Sopenharmony_ci#define IC_RADCEN (1 << 7) 498c2ecf20Sopenharmony_ci#define IC_LADCEN (1 << 8) 508c2ecf20Sopenharmony_ci#define IC_ALM (1 << 9) 518c2ecf20Sopenharmony_ci 528c2ecf20Sopenharmony_ci#define IC_DIGMICEN (1 << 22) 538c2ecf20Sopenharmony_ci#define IC_DIGMICFREQ (1 << 23) 548c2ecf20Sopenharmony_ci#define IC_ADC14B_12 (1 << 24) 558c2ecf20Sopenharmony_ci#define IC_FIRDAC_HSL_EN (1 << 25) 568c2ecf20Sopenharmony_ci#define IC_FIRDAC_HSR_EN (1 << 26) 578c2ecf20Sopenharmony_ci#define IC_FIRDAC_LOUT_EN (1 << 27) 588c2ecf20Sopenharmony_ci#define IC_POR (1 << 28) 598c2ecf20Sopenharmony_ci#define IC_CODEC_CLK_EN (1 << 29) 608c2ecf20Sopenharmony_ci#define IC_HP_3DB_BOOST (1 << 30) 618c2ecf20Sopenharmony_ci 628c2ecf20Sopenharmony_ci#define IC_ADC_LEFT_GAIN_SHIFT 16 638c2ecf20Sopenharmony_ci#define IC_ADC_RIGHT_GAIN_SHIFT 10 648c2ecf20Sopenharmony_ci#define IC_ADC_GAIN_MASK 0x3F 658c2ecf20Sopenharmony_ci#define IC_MIC_MAX_GAIN 0x39 668c2ecf20Sopenharmony_ci 678c2ecf20Sopenharmony_ci#define IC_RXPGAR_MASK 0x3F 688c2ecf20Sopenharmony_ci#define IC_RXPGAR_SHIFT 14 698c2ecf20Sopenharmony_ci#define IC_RXPGAL_MASK 0x3F 708c2ecf20Sopenharmony_ci#define IC_RXPGAL_SHIFT 21 718c2ecf20Sopenharmony_ci#define IC_RXPGAR 0x7B 728c2ecf20Sopenharmony_ci#define IC_RXPGAL 0x7B 738c2ecf20Sopenharmony_ci 748c2ecf20Sopenharmony_ci#define AUDIO_PORT_TX_FIFO_LEVEL_CHECK_MASK 0x3F 758c2ecf20Sopenharmony_ci#define AUDIO_PORT_TX_FIFO_SC_OFFSET 0 768c2ecf20Sopenharmony_ci#define AUDIO_PORT_TX_FIFO_LC_OFFSET 10 778c2ecf20Sopenharmony_ci#define AUDIO_PORT_TX_FIFO_HC_OFFSET 20 788c2ecf20Sopenharmony_ci 798c2ecf20Sopenharmony_ci#define TX_FIFO_SC(x) (((x) & AUDIO_PORT_TX_FIFO_LEVEL_CHECK_MASK) \ 808c2ecf20Sopenharmony_ci << AUDIO_PORT_TX_FIFO_SC_OFFSET) 818c2ecf20Sopenharmony_ci#define TX_FIFO_LC(x) (((x) & AUDIO_PORT_TX_FIFO_LEVEL_CHECK_MASK) \ 828c2ecf20Sopenharmony_ci << AUDIO_PORT_TX_FIFO_LC_OFFSET) 838c2ecf20Sopenharmony_ci#define TX_FIFO_HC(x) (((x) & AUDIO_PORT_TX_FIFO_LEVEL_CHECK_MASK) \ 848c2ecf20Sopenharmony_ci << AUDIO_PORT_TX_FIFO_HC_OFFSET) 858c2ecf20Sopenharmony_ci 868c2ecf20Sopenharmony_ci#define AUDIO_PORT_RX_FIFO_LEVEL_CHECK_MASK 0x0F 878c2ecf20Sopenharmony_ci#define AUDIO_PORT_RX_FIFO_SC_OFFSET 0 888c2ecf20Sopenharmony_ci#define AUDIO_PORT_RX_FIFO_LC_OFFSET 10 898c2ecf20Sopenharmony_ci#define AUDIO_PORT_RX_FIFO_HC_OFFSET 20 908c2ecf20Sopenharmony_ci 918c2ecf20Sopenharmony_ci#define RX_FIFO_SC(x) (((x) & AUDIO_PORT_RX_FIFO_LEVEL_CHECK_MASK) \ 928c2ecf20Sopenharmony_ci << AUDIO_PORT_RX_FIFO_SC_OFFSET) 938c2ecf20Sopenharmony_ci#define RX_FIFO_LC(x) (((x) & AUDIO_PORT_RX_FIFO_LEVEL_CHECK_MASK) \ 948c2ecf20Sopenharmony_ci << AUDIO_PORT_RX_FIFO_LC_OFFSET) 958c2ecf20Sopenharmony_ci#define RX_FIFO_HC(x) (((x) & AUDIO_PORT_RX_FIFO_LEVEL_CHECK_MASK) \ 968c2ecf20Sopenharmony_ci << AUDIO_PORT_RX_FIFO_HC_OFFSET) 978c2ecf20Sopenharmony_ci#define AUDIO_PORT_IC_CODEC_TX_CTRL (0x00F4) 988c2ecf20Sopenharmony_ci#define AUDIO_PORT_IC_CODEC_RX_CTRL (0x00F8) 998c2ecf20Sopenharmony_ci 1008c2ecf20Sopenharmony_ci#define AUDIO_PORT_IC_TXFIFO_OP (0x00FC) 1018c2ecf20Sopenharmony_ci#define AUDIO_PORT_IC_TXFIFO_LEV_CHK (0x0100) 1028c2ecf20Sopenharmony_ci#define AUDIO_PORT_IC_TXFIFO_STS (0x0104) 1038c2ecf20Sopenharmony_ci#define AUDIO_PORT_IC_TXFIFO_INT (0x0108) 1048c2ecf20Sopenharmony_ci#define AUDIO_PORT_IC_TXFIFO_INT_MSK (0x010C) 1058c2ecf20Sopenharmony_ci 1068c2ecf20Sopenharmony_ci#define AUDIO_PORT_IC_RXFIFO_OP (0x0110) 1078c2ecf20Sopenharmony_ci#define AUDIO_PORT_IC_RXFIFO_LEV_CHK (0x0114) 1088c2ecf20Sopenharmony_ci#define AUDIO_PORT_IC_RXFIFO_STS (0x0118) 1098c2ecf20Sopenharmony_ci#define AUDIO_PORT_IC_RXFIFO_INT (0x011C) 1108c2ecf20Sopenharmony_ci#define AUDIO_PORT_IC_RXFIFO_INT_MSK (0x0120) 1118c2ecf20Sopenharmony_ci 1128c2ecf20Sopenharmony_ci#define AUDIO_FIFO_START (1 << 0) 1138c2ecf20Sopenharmony_ci#define AUDIO_FIFO_RESET (1 << 1) 1148c2ecf20Sopenharmony_ci 1158c2ecf20Sopenharmony_ci#define AUDIO_FIFO_FULL (1 << 0) 1168c2ecf20Sopenharmony_ci#define AUDIO_FIFO_EMPTY (1 << 1) 1178c2ecf20Sopenharmony_ci#define AUDIO_FIFO_OFLOW (1 << 2) 1188c2ecf20Sopenharmony_ci#define AUDIO_FIFO_UFLOW (1 << 3) 1198c2ecf20Sopenharmony_ci 1208c2ecf20Sopenharmony_ci#define IC_TX_ENABLE (0x03) 1218c2ecf20Sopenharmony_ci#define IC_RX_ENABLE_MONO (0x01) 1228c2ecf20Sopenharmony_ci#define IC_RX_ENABLE_STEREO (0x03) 1238c2ecf20Sopenharmony_ci 1248c2ecf20Sopenharmony_ci#endif /*__SIRF_AUDIO_CODEC_H*/ 125