1af3d54b9SSrinivas Kandagatla // SPDX-License-Identifier: GPL-2.0-only 2af3d54b9SSrinivas Kandagatla // Copyright (c) 2018-2020, The Linux Foundation. All rights reserved. 3af3d54b9SSrinivas Kandagatla 4af3d54b9SSrinivas Kandagatla #include <linux/module.h> 5af3d54b9SSrinivas Kandagatla #include <linux/init.h> 6af3d54b9SSrinivas Kandagatla #include <linux/io.h> 7af3d54b9SSrinivas Kandagatla #include <linux/platform_device.h> 8366ff79eSSrinivas Kandagatla #include <linux/pm_runtime.h> 9af3d54b9SSrinivas Kandagatla #include <linux/clk.h> 10af3d54b9SSrinivas Kandagatla #include <sound/soc.h> 11af3d54b9SSrinivas Kandagatla #include <sound/pcm.h> 12af3d54b9SSrinivas Kandagatla #include <sound/pcm_params.h> 13af3d54b9SSrinivas Kandagatla #include <sound/soc-dapm.h> 14af3d54b9SSrinivas Kandagatla #include <sound/tlv.h> 15af3d54b9SSrinivas Kandagatla #include <linux/of_clk.h> 16af3d54b9SSrinivas Kandagatla #include <linux/clk-provider.h> 17af3d54b9SSrinivas Kandagatla 189e3d83c5SSrinivasa Rao Mandadapu #include "lpass-macro-common.h" 199e3d83c5SSrinivasa Rao Mandadapu 20af3d54b9SSrinivas Kandagatla #define CDC_RX_TOP_TOP_CFG0 (0x0000) 21af3d54b9SSrinivas Kandagatla #define CDC_RX_TOP_SWR_CTRL (0x0008) 22af3d54b9SSrinivas Kandagatla #define CDC_RX_TOP_DEBUG (0x000C) 23af3d54b9SSrinivas Kandagatla #define CDC_RX_TOP_DEBUG_BUS (0x0010) 24af3d54b9SSrinivas Kandagatla #define CDC_RX_TOP_DEBUG_EN0 (0x0014) 25af3d54b9SSrinivas Kandagatla #define CDC_RX_TOP_DEBUG_EN1 (0x0018) 26af3d54b9SSrinivas Kandagatla #define CDC_RX_TOP_DEBUG_EN2 (0x001C) 27af3d54b9SSrinivas Kandagatla #define CDC_RX_TOP_HPHL_COMP_WR_LSB (0x0020) 28af3d54b9SSrinivas Kandagatla #define CDC_RX_TOP_HPHL_COMP_WR_MSB (0x0024) 29af3d54b9SSrinivas Kandagatla #define CDC_RX_TOP_HPHL_COMP_LUT (0x0028) 30af3d54b9SSrinivas Kandagatla #define CDC_RX_TOP_HPH_LUT_BYPASS_MASK BIT(7) 31af3d54b9SSrinivas Kandagatla #define CDC_RX_TOP_HPHL_COMP_RD_LSB (0x002C) 32af3d54b9SSrinivas Kandagatla #define CDC_RX_TOP_HPHL_COMP_RD_MSB (0x0030) 33af3d54b9SSrinivas Kandagatla #define CDC_RX_TOP_HPHR_COMP_WR_LSB (0x0034) 34af3d54b9SSrinivas Kandagatla #define CDC_RX_TOP_HPHR_COMP_WR_MSB (0x0038) 35af3d54b9SSrinivas Kandagatla #define CDC_RX_TOP_HPHR_COMP_LUT (0x003C) 36af3d54b9SSrinivas Kandagatla #define CDC_RX_TOP_HPHR_COMP_RD_LSB (0x0040) 37af3d54b9SSrinivas Kandagatla #define CDC_RX_TOP_HPHR_COMP_RD_MSB (0x0044) 38af3d54b9SSrinivas Kandagatla #define CDC_RX_TOP_DSD0_DEBUG_CFG0 (0x0070) 39af3d54b9SSrinivas Kandagatla #define CDC_RX_TOP_DSD0_DEBUG_CFG1 (0x0074) 40af3d54b9SSrinivas Kandagatla #define CDC_RX_TOP_DSD0_DEBUG_CFG2 (0x0078) 41af3d54b9SSrinivas Kandagatla #define CDC_RX_TOP_DSD0_DEBUG_CFG3 (0x007C) 42af3d54b9SSrinivas Kandagatla #define CDC_RX_TOP_DSD1_DEBUG_CFG0 (0x0080) 43af3d54b9SSrinivas Kandagatla #define CDC_RX_TOP_DSD1_DEBUG_CFG1 (0x0084) 44af3d54b9SSrinivas Kandagatla #define CDC_RX_TOP_DSD1_DEBUG_CFG2 (0x0088) 45af3d54b9SSrinivas Kandagatla #define CDC_RX_TOP_DSD1_DEBUG_CFG3 (0x008C) 46af3d54b9SSrinivas Kandagatla #define CDC_RX_TOP_RX_I2S_CTL (0x0090) 47af3d54b9SSrinivas Kandagatla #define CDC_RX_TOP_TX_I2S2_CTL (0x0094) 48af3d54b9SSrinivas Kandagatla #define CDC_RX_TOP_I2S_CLK (0x0098) 49af3d54b9SSrinivas Kandagatla #define CDC_RX_TOP_I2S_RESET (0x009C) 50af3d54b9SSrinivas Kandagatla #define CDC_RX_TOP_I2S_MUX (0x00A0) 51af3d54b9SSrinivas Kandagatla #define CDC_RX_CLK_RST_CTRL_MCLK_CONTROL (0x0100) 52af3d54b9SSrinivas Kandagatla #define CDC_RX_CLK_MCLK_EN_MASK BIT(0) 53af3d54b9SSrinivas Kandagatla #define CDC_RX_CLK_MCLK_ENABLE BIT(0) 54af3d54b9SSrinivas Kandagatla #define CDC_RX_CLK_MCLK2_EN_MASK BIT(1) 55af3d54b9SSrinivas Kandagatla #define CDC_RX_CLK_MCLK2_ENABLE BIT(1) 56af3d54b9SSrinivas Kandagatla #define CDC_RX_CLK_RST_CTRL_FS_CNT_CONTROL (0x0104) 57af3d54b9SSrinivas Kandagatla #define CDC_RX_FS_MCLK_CNT_EN_MASK BIT(0) 58af3d54b9SSrinivas Kandagatla #define CDC_RX_FS_MCLK_CNT_ENABLE BIT(0) 59af3d54b9SSrinivas Kandagatla #define CDC_RX_FS_MCLK_CNT_CLR_MASK BIT(1) 60af3d54b9SSrinivas Kandagatla #define CDC_RX_FS_MCLK_CNT_CLR BIT(1) 61af3d54b9SSrinivas Kandagatla #define CDC_RX_CLK_RST_CTRL_SWR_CONTROL (0x0108) 62af3d54b9SSrinivas Kandagatla #define CDC_RX_SWR_CLK_EN_MASK BIT(0) 63af3d54b9SSrinivas Kandagatla #define CDC_RX_SWR_RESET_MASK BIT(1) 64af3d54b9SSrinivas Kandagatla #define CDC_RX_SWR_RESET BIT(1) 65af3d54b9SSrinivas Kandagatla #define CDC_RX_CLK_RST_CTRL_DSD_CONTROL (0x010C) 66af3d54b9SSrinivas Kandagatla #define CDC_RX_CLK_RST_CTRL_ASRC_SHARE_CONTROL (0x0110) 67af3d54b9SSrinivas Kandagatla #define CDC_RX_SOFTCLIP_CRC (0x0140) 68af3d54b9SSrinivas Kandagatla #define CDC_RX_SOFTCLIP_CLK_EN_MASK BIT(0) 69af3d54b9SSrinivas Kandagatla #define CDC_RX_SOFTCLIP_SOFTCLIP_CTRL (0x0144) 70af3d54b9SSrinivas Kandagatla #define CDC_RX_SOFTCLIP_EN_MASK BIT(0) 71af3d54b9SSrinivas Kandagatla #define CDC_RX_INP_MUX_RX_INT0_CFG0 (0x0180) 72af3d54b9SSrinivas Kandagatla #define CDC_RX_INTX_1_MIX_INP0_SEL_MASK GENMASK(3, 0) 73af3d54b9SSrinivas Kandagatla #define CDC_RX_INTX_1_MIX_INP1_SEL_MASK GENMASK(7, 4) 74af3d54b9SSrinivas Kandagatla #define CDC_RX_INP_MUX_RX_INT0_CFG1 (0x0184) 75af3d54b9SSrinivas Kandagatla #define CDC_RX_INTX_2_SEL_MASK GENMASK(3, 0) 76af3d54b9SSrinivas Kandagatla #define CDC_RX_INTX_1_MIX_INP2_SEL_MASK GENMASK(7, 4) 77af3d54b9SSrinivas Kandagatla #define CDC_RX_INP_MUX_RX_INT1_CFG0 (0x0188) 78af3d54b9SSrinivas Kandagatla #define CDC_RX_INP_MUX_RX_INT1_CFG1 (0x018C) 79af3d54b9SSrinivas Kandagatla #define CDC_RX_INP_MUX_RX_INT2_CFG0 (0x0190) 80af3d54b9SSrinivas Kandagatla #define CDC_RX_INP_MUX_RX_INT2_CFG1 (0x0194) 81af3d54b9SSrinivas Kandagatla #define CDC_RX_INP_MUX_RX_MIX_CFG4 (0x0198) 82af3d54b9SSrinivas Kandagatla #define CDC_RX_INP_MUX_RX_MIX_CFG5 (0x019C) 83af3d54b9SSrinivas Kandagatla #define CDC_RX_INP_MUX_SIDETONE_SRC_CFG0 (0x01A0) 84af3d54b9SSrinivas Kandagatla #define CDC_RX_CLSH_CRC (0x0200) 85af3d54b9SSrinivas Kandagatla #define CDC_RX_CLSH_CLK_EN_MASK BIT(0) 86af3d54b9SSrinivas Kandagatla #define CDC_RX_CLSH_DLY_CTRL (0x0204) 87af3d54b9SSrinivas Kandagatla #define CDC_RX_CLSH_DECAY_CTRL (0x0208) 88af3d54b9SSrinivas Kandagatla #define CDC_RX_CLSH_DECAY_RATE_MASK GENMASK(2, 0) 89af3d54b9SSrinivas Kandagatla #define CDC_RX_CLSH_HPH_V_PA (0x020C) 90af3d54b9SSrinivas Kandagatla #define CDC_RX_CLSH_HPH_V_PA_MIN_MASK GENMASK(5, 0) 91af3d54b9SSrinivas Kandagatla #define CDC_RX_CLSH_EAR_V_PA (0x0210) 92af3d54b9SSrinivas Kandagatla #define CDC_RX_CLSH_HPH_V_HD (0x0214) 93af3d54b9SSrinivas Kandagatla #define CDC_RX_CLSH_EAR_V_HD (0x0218) 94af3d54b9SSrinivas Kandagatla #define CDC_RX_CLSH_K1_MSB (0x021C) 95af3d54b9SSrinivas Kandagatla #define CDC_RX_CLSH_K1_MSB_COEFF_MASK GENMASK(3, 0) 96af3d54b9SSrinivas Kandagatla #define CDC_RX_CLSH_K1_LSB (0x0220) 97af3d54b9SSrinivas Kandagatla #define CDC_RX_CLSH_K2_MSB (0x0224) 98af3d54b9SSrinivas Kandagatla #define CDC_RX_CLSH_K2_LSB (0x0228) 99af3d54b9SSrinivas Kandagatla #define CDC_RX_CLSH_IDLE_CTRL (0x022C) 100af3d54b9SSrinivas Kandagatla #define CDC_RX_CLSH_IDLE_HPH (0x0230) 101af3d54b9SSrinivas Kandagatla #define CDC_RX_CLSH_IDLE_EAR (0x0234) 102af3d54b9SSrinivas Kandagatla #define CDC_RX_CLSH_TEST0 (0x0238) 103af3d54b9SSrinivas Kandagatla #define CDC_RX_CLSH_TEST1 (0x023C) 104af3d54b9SSrinivas Kandagatla #define CDC_RX_CLSH_OVR_VREF (0x0240) 105af3d54b9SSrinivas Kandagatla #define CDC_RX_CLSH_CLSG_CTL (0x0244) 106af3d54b9SSrinivas Kandagatla #define CDC_RX_CLSH_CLSG_CFG1 (0x0248) 107af3d54b9SSrinivas Kandagatla #define CDC_RX_CLSH_CLSG_CFG2 (0x024C) 108af3d54b9SSrinivas Kandagatla #define CDC_RX_BCL_VBAT_PATH_CTL (0x0280) 109af3d54b9SSrinivas Kandagatla #define CDC_RX_BCL_VBAT_CFG (0x0284) 110af3d54b9SSrinivas Kandagatla #define CDC_RX_BCL_VBAT_ADC_CAL1 (0x0288) 111af3d54b9SSrinivas Kandagatla #define CDC_RX_BCL_VBAT_ADC_CAL2 (0x028C) 112af3d54b9SSrinivas Kandagatla #define CDC_RX_BCL_VBAT_ADC_CAL3 (0x0290) 113af3d54b9SSrinivas Kandagatla #define CDC_RX_BCL_VBAT_PK_EST1 (0x0294) 114af3d54b9SSrinivas Kandagatla #define CDC_RX_BCL_VBAT_PK_EST2 (0x0298) 115af3d54b9SSrinivas Kandagatla #define CDC_RX_BCL_VBAT_PK_EST3 (0x029C) 116af3d54b9SSrinivas Kandagatla #define CDC_RX_BCL_VBAT_RF_PROC1 (0x02A0) 117af3d54b9SSrinivas Kandagatla #define CDC_RX_BCL_VBAT_RF_PROC2 (0x02A4) 118af3d54b9SSrinivas Kandagatla #define CDC_RX_BCL_VBAT_TAC1 (0x02A8) 119af3d54b9SSrinivas Kandagatla #define CDC_RX_BCL_VBAT_TAC2 (0x02AC) 120af3d54b9SSrinivas Kandagatla #define CDC_RX_BCL_VBAT_TAC3 (0x02B0) 121af3d54b9SSrinivas Kandagatla #define CDC_RX_BCL_VBAT_TAC4 (0x02B4) 122af3d54b9SSrinivas Kandagatla #define CDC_RX_BCL_VBAT_GAIN_UPD1 (0x02B8) 123af3d54b9SSrinivas Kandagatla #define CDC_RX_BCL_VBAT_GAIN_UPD2 (0x02BC) 124af3d54b9SSrinivas Kandagatla #define CDC_RX_BCL_VBAT_GAIN_UPD3 (0x02C0) 125af3d54b9SSrinivas Kandagatla #define CDC_RX_BCL_VBAT_GAIN_UPD4 (0x02C4) 126af3d54b9SSrinivas Kandagatla #define CDC_RX_BCL_VBAT_GAIN_UPD5 (0x02C8) 127af3d54b9SSrinivas Kandagatla #define CDC_RX_BCL_VBAT_DEBUG1 (0x02CC) 128af3d54b9SSrinivas Kandagatla #define CDC_RX_BCL_VBAT_GAIN_UPD_MON (0x02D0) 129af3d54b9SSrinivas Kandagatla #define CDC_RX_BCL_VBAT_GAIN_MON_VAL (0x02D4) 130af3d54b9SSrinivas Kandagatla #define CDC_RX_BCL_VBAT_BAN (0x02D8) 131af3d54b9SSrinivas Kandagatla #define CDC_RX_BCL_VBAT_BCL_GAIN_UPD1 (0x02DC) 132af3d54b9SSrinivas Kandagatla #define CDC_RX_BCL_VBAT_BCL_GAIN_UPD2 (0x02E0) 133af3d54b9SSrinivas Kandagatla #define CDC_RX_BCL_VBAT_BCL_GAIN_UPD3 (0x02E4) 134af3d54b9SSrinivas Kandagatla #define CDC_RX_BCL_VBAT_BCL_GAIN_UPD4 (0x02E8) 135af3d54b9SSrinivas Kandagatla #define CDC_RX_BCL_VBAT_BCL_GAIN_UPD5 (0x02EC) 136af3d54b9SSrinivas Kandagatla #define CDC_RX_BCL_VBAT_BCL_GAIN_UPD6 (0x02F0) 137af3d54b9SSrinivas Kandagatla #define CDC_RX_BCL_VBAT_BCL_GAIN_UPD7 (0x02F4) 138af3d54b9SSrinivas Kandagatla #define CDC_RX_BCL_VBAT_BCL_GAIN_UPD8 (0x02F8) 139af3d54b9SSrinivas Kandagatla #define CDC_RX_BCL_VBAT_BCL_GAIN_UPD9 (0x02FC) 140af3d54b9SSrinivas Kandagatla #define CDC_RX_BCL_VBAT_ATTN1 (0x0300) 141af3d54b9SSrinivas Kandagatla #define CDC_RX_BCL_VBAT_ATTN2 (0x0304) 142af3d54b9SSrinivas Kandagatla #define CDC_RX_BCL_VBAT_ATTN3 (0x0308) 143af3d54b9SSrinivas Kandagatla #define CDC_RX_BCL_VBAT_DECODE_CTL1 (0x030C) 144af3d54b9SSrinivas Kandagatla #define CDC_RX_BCL_VBAT_DECODE_CTL2 (0x0310) 145af3d54b9SSrinivas Kandagatla #define CDC_RX_BCL_VBAT_DECODE_CFG1 (0x0314) 146af3d54b9SSrinivas Kandagatla #define CDC_RX_BCL_VBAT_DECODE_CFG2 (0x0318) 147af3d54b9SSrinivas Kandagatla #define CDC_RX_BCL_VBAT_DECODE_CFG3 (0x031C) 148af3d54b9SSrinivas Kandagatla #define CDC_RX_BCL_VBAT_DECODE_CFG4 (0x0320) 149af3d54b9SSrinivas Kandagatla #define CDC_RX_BCL_VBAT_DECODE_ST (0x0324) 150af3d54b9SSrinivas Kandagatla #define CDC_RX_INTR_CTRL_CFG (0x0340) 151af3d54b9SSrinivas Kandagatla #define CDC_RX_INTR_CTRL_CLR_COMMIT (0x0344) 152af3d54b9SSrinivas Kandagatla #define CDC_RX_INTR_CTRL_PIN1_MASK0 (0x0360) 153af3d54b9SSrinivas Kandagatla #define CDC_RX_INTR_CTRL_PIN1_STATUS0 (0x0368) 154af3d54b9SSrinivas Kandagatla #define CDC_RX_INTR_CTRL_PIN1_CLEAR0 (0x0370) 155af3d54b9SSrinivas Kandagatla #define CDC_RX_INTR_CTRL_PIN2_MASK0 (0x0380) 156af3d54b9SSrinivas Kandagatla #define CDC_RX_INTR_CTRL_PIN2_STATUS0 (0x0388) 157af3d54b9SSrinivas Kandagatla #define CDC_RX_INTR_CTRL_PIN2_CLEAR0 (0x0390) 158af3d54b9SSrinivas Kandagatla #define CDC_RX_INTR_CTRL_LEVEL0 (0x03C0) 159af3d54b9SSrinivas Kandagatla #define CDC_RX_INTR_CTRL_BYPASS0 (0x03C8) 160af3d54b9SSrinivas Kandagatla #define CDC_RX_INTR_CTRL_SET0 (0x03D0) 161dbacef05SSrinivas Kandagatla #define CDC_RX_RXn_RX_PATH_CTL(rx, n) (0x0400 + rx->rxn_reg_stride * n) 162af3d54b9SSrinivas Kandagatla #define CDC_RX_RX0_RX_PATH_CTL (0x0400) 163af3d54b9SSrinivas Kandagatla #define CDC_RX_PATH_RESET_EN_MASK BIT(6) 164af3d54b9SSrinivas Kandagatla #define CDC_RX_PATH_CLK_EN_MASK BIT(5) 165af3d54b9SSrinivas Kandagatla #define CDC_RX_PATH_CLK_ENABLE BIT(5) 166af3d54b9SSrinivas Kandagatla #define CDC_RX_PATH_PGA_MUTE_MASK BIT(4) 167af3d54b9SSrinivas Kandagatla #define CDC_RX_PATH_PGA_MUTE_ENABLE BIT(4) 168af3d54b9SSrinivas Kandagatla #define CDC_RX_PATH_PCM_RATE_MASK GENMASK(3, 0) 169dbacef05SSrinivas Kandagatla #define CDC_RX_RXn_RX_PATH_CFG0(rx, n) (0x0404 + rx->rxn_reg_stride * n) 170af3d54b9SSrinivas Kandagatla #define CDC_RX_RXn_COMP_EN_MASK BIT(1) 171af3d54b9SSrinivas Kandagatla #define CDC_RX_RX0_RX_PATH_CFG0 (0x0404) 172af3d54b9SSrinivas Kandagatla #define CDC_RX_RXn_CLSH_EN_MASK BIT(6) 173af3d54b9SSrinivas Kandagatla #define CDC_RX_DLY_ZN_EN_MASK BIT(3) 174af3d54b9SSrinivas Kandagatla #define CDC_RX_DLY_ZN_ENABLE BIT(3) 175af3d54b9SSrinivas Kandagatla #define CDC_RX_RXn_HD2_EN_MASK BIT(2) 176dbacef05SSrinivas Kandagatla #define CDC_RX_RXn_RX_PATH_CFG1(rx, n) (0x0408 + rx->rxn_reg_stride * n) 177af3d54b9SSrinivas Kandagatla #define CDC_RX_RXn_SIDETONE_EN_MASK BIT(4) 178af3d54b9SSrinivas Kandagatla #define CDC_RX_RX0_RX_PATH_CFG1 (0x0408) 179af3d54b9SSrinivas Kandagatla #define CDC_RX_RX0_HPH_L_EAR_SEL_MASK BIT(1) 180dbacef05SSrinivas Kandagatla #define CDC_RX_RXn_RX_PATH_CFG2(rx, n) (0x040C + rx->rxn_reg_stride * n) 181af3d54b9SSrinivas Kandagatla #define CDC_RX_RXn_HPF_CUT_FREQ_MASK GENMASK(1, 0) 182af3d54b9SSrinivas Kandagatla #define CDC_RX_RX0_RX_PATH_CFG2 (0x040C) 183dbacef05SSrinivas Kandagatla #define CDC_RX_RXn_RX_PATH_CFG3(rx, n) (0x0410 + rx->rxn_reg_stride * n) 184af3d54b9SSrinivas Kandagatla #define CDC_RX_RX0_RX_PATH_CFG3 (0x0410) 185af3d54b9SSrinivas Kandagatla #define CDC_RX_DC_COEFF_SEL_MASK GENMASK(1, 0) 186af3d54b9SSrinivas Kandagatla #define CDC_RX_DC_COEFF_SEL_TWO 0x2 187dbacef05SSrinivas Kandagatla #define CDC_RX_RXn_RX_VOL_CTL(rx, n) (0x0414 + rx->rxn_reg_stride * n) 188af3d54b9SSrinivas Kandagatla #define CDC_RX_RX0_RX_VOL_CTL (0x0414) 189dbacef05SSrinivas Kandagatla #define CDC_RX_RXn_RX_PATH_MIX_CTL(rx, n) (0x0418 + rx->rxn_reg_stride * n) 190af3d54b9SSrinivas Kandagatla #define CDC_RX_RXn_MIX_PCM_RATE_MASK GENMASK(3, 0) 191af3d54b9SSrinivas Kandagatla #define CDC_RX_RXn_MIX_RESET_MASK BIT(6) 192af3d54b9SSrinivas Kandagatla #define CDC_RX_RXn_MIX_RESET BIT(6) 193af3d54b9SSrinivas Kandagatla #define CDC_RX_RXn_MIX_CLK_EN_MASK BIT(5) 194af3d54b9SSrinivas Kandagatla #define CDC_RX_RX0_RX_PATH_MIX_CTL (0x0418) 195af3d54b9SSrinivas Kandagatla #define CDC_RX_RX0_RX_PATH_MIX_CFG (0x041C) 196dbacef05SSrinivas Kandagatla #define CDC_RX_RXn_RX_VOL_MIX_CTL(rx, n) (0x0420 + rx->rxn_reg_stride * n) 197af3d54b9SSrinivas Kandagatla #define CDC_RX_RX0_RX_VOL_MIX_CTL (0x0420) 198af3d54b9SSrinivas Kandagatla #define CDC_RX_RX0_RX_PATH_SEC1 (0x0424) 199af3d54b9SSrinivas Kandagatla #define CDC_RX_RX0_RX_PATH_SEC2 (0x0428) 200af3d54b9SSrinivas Kandagatla #define CDC_RX_RX0_RX_PATH_SEC3 (0x042C) 201dbacef05SSrinivas Kandagatla #define CDC_RX_RXn_RX_PATH_SEC3(rx, n) (0x042c + rx->rxn_reg_stride * n) 202af3d54b9SSrinivas Kandagatla #define CDC_RX_RX0_RX_PATH_SEC4 (0x0430) 203af3d54b9SSrinivas Kandagatla #define CDC_RX_RX0_RX_PATH_SEC7 (0x0434) 204dbacef05SSrinivas Kandagatla #define CDC_RX_RXn_RX_PATH_SEC7(rx, n) (0x0434 + rx->rxn_reg_stride * n) 205af3d54b9SSrinivas Kandagatla #define CDC_RX_DSM_OUT_DELAY_SEL_MASK GENMASK(2, 0) 206af3d54b9SSrinivas Kandagatla #define CDC_RX_DSM_OUT_DELAY_TWO_SAMPLE 0x2 207af3d54b9SSrinivas Kandagatla #define CDC_RX_RX0_RX_PATH_MIX_SEC0 (0x0438) 208af3d54b9SSrinivas Kandagatla #define CDC_RX_RX0_RX_PATH_MIX_SEC1 (0x043C) 209dbacef05SSrinivas Kandagatla #define CDC_RX_RXn_RX_PATH_DSM_CTL(rx, n) (0x0440 + rx->rxn_reg_stride * n) 210af3d54b9SSrinivas Kandagatla #define CDC_RX_RXn_DSM_CLK_EN_MASK BIT(0) 211af3d54b9SSrinivas Kandagatla #define CDC_RX_RX0_RX_PATH_DSM_CTL (0x0440) 212af3d54b9SSrinivas Kandagatla #define CDC_RX_RX0_RX_PATH_DSM_DATA1 (0x0444) 213af3d54b9SSrinivas Kandagatla #define CDC_RX_RX0_RX_PATH_DSM_DATA2 (0x0448) 214af3d54b9SSrinivas Kandagatla #define CDC_RX_RX0_RX_PATH_DSM_DATA3 (0x044C) 215af3d54b9SSrinivas Kandagatla #define CDC_RX_RX0_RX_PATH_DSM_DATA4 (0x0450) 216af3d54b9SSrinivas Kandagatla #define CDC_RX_RX0_RX_PATH_DSM_DATA5 (0x0454) 217af3d54b9SSrinivas Kandagatla #define CDC_RX_RX0_RX_PATH_DSM_DATA6 (0x0458) 218dbacef05SSrinivas Kandagatla /* RX offsets prior to 2.5 codec version */ 219af3d54b9SSrinivas Kandagatla #define CDC_RX_RX1_RX_PATH_CTL (0x0480) 220af3d54b9SSrinivas Kandagatla #define CDC_RX_RX1_RX_PATH_CFG0 (0x0484) 221af3d54b9SSrinivas Kandagatla #define CDC_RX_RX1_RX_PATH_CFG1 (0x0488) 222af3d54b9SSrinivas Kandagatla #define CDC_RX_RX1_RX_PATH_CFG2 (0x048C) 223af3d54b9SSrinivas Kandagatla #define CDC_RX_RX1_RX_PATH_CFG3 (0x0490) 224af3d54b9SSrinivas Kandagatla #define CDC_RX_RX1_RX_VOL_CTL (0x0494) 225af3d54b9SSrinivas Kandagatla #define CDC_RX_RX1_RX_PATH_MIX_CTL (0x0498) 226af3d54b9SSrinivas Kandagatla #define CDC_RX_RX1_RX_PATH_MIX_CFG (0x049C) 227af3d54b9SSrinivas Kandagatla #define CDC_RX_RX1_RX_VOL_MIX_CTL (0x04A0) 228af3d54b9SSrinivas Kandagatla #define CDC_RX_RX1_RX_PATH_SEC1 (0x04A4) 229af3d54b9SSrinivas Kandagatla #define CDC_RX_RX1_RX_PATH_SEC2 (0x04A8) 230af3d54b9SSrinivas Kandagatla #define CDC_RX_RX1_RX_PATH_SEC3 (0x04AC) 231af3d54b9SSrinivas Kandagatla #define CDC_RX_RXn_HD2_ALPHA_MASK GENMASK(5, 2) 232af3d54b9SSrinivas Kandagatla #define CDC_RX_RX1_RX_PATH_SEC4 (0x04B0) 233af3d54b9SSrinivas Kandagatla #define CDC_RX_RX1_RX_PATH_SEC7 (0x04B4) 234af3d54b9SSrinivas Kandagatla #define CDC_RX_RX1_RX_PATH_MIX_SEC0 (0x04B8) 235af3d54b9SSrinivas Kandagatla #define CDC_RX_RX1_RX_PATH_MIX_SEC1 (0x04BC) 236af3d54b9SSrinivas Kandagatla #define CDC_RX_RX1_RX_PATH_DSM_CTL (0x04C0) 237af3d54b9SSrinivas Kandagatla #define CDC_RX_RX1_RX_PATH_DSM_DATA1 (0x04C4) 238af3d54b9SSrinivas Kandagatla #define CDC_RX_RX1_RX_PATH_DSM_DATA2 (0x04C8) 239af3d54b9SSrinivas Kandagatla #define CDC_RX_RX1_RX_PATH_DSM_DATA3 (0x04CC) 240af3d54b9SSrinivas Kandagatla #define CDC_RX_RX1_RX_PATH_DSM_DATA4 (0x04D0) 241af3d54b9SSrinivas Kandagatla #define CDC_RX_RX1_RX_PATH_DSM_DATA5 (0x04D4) 242af3d54b9SSrinivas Kandagatla #define CDC_RX_RX1_RX_PATH_DSM_DATA6 (0x04D8) 243af3d54b9SSrinivas Kandagatla #define CDC_RX_RX2_RX_PATH_CTL (0x0500) 244af3d54b9SSrinivas Kandagatla #define CDC_RX_RX2_RX_PATH_CFG0 (0x0504) 245af3d54b9SSrinivas Kandagatla #define CDC_RX_RX2_CLSH_EN_MASK BIT(4) 246af3d54b9SSrinivas Kandagatla #define CDC_RX_RX2_DLY_Z_EN_MASK BIT(3) 247af3d54b9SSrinivas Kandagatla #define CDC_RX_RX2_RX_PATH_CFG1 (0x0508) 248af3d54b9SSrinivas Kandagatla #define CDC_RX_RX2_RX_PATH_CFG2 (0x050C) 249af3d54b9SSrinivas Kandagatla #define CDC_RX_RX2_RX_PATH_CFG3 (0x0510) 250af3d54b9SSrinivas Kandagatla #define CDC_RX_RX2_RX_VOL_CTL (0x0514) 251af3d54b9SSrinivas Kandagatla #define CDC_RX_RX2_RX_PATH_MIX_CTL (0x0518) 252af3d54b9SSrinivas Kandagatla #define CDC_RX_RX2_RX_PATH_MIX_CFG (0x051C) 253af3d54b9SSrinivas Kandagatla #define CDC_RX_RX2_RX_VOL_MIX_CTL (0x0520) 254af3d54b9SSrinivas Kandagatla #define CDC_RX_RX2_RX_PATH_SEC0 (0x0524) 255af3d54b9SSrinivas Kandagatla #define CDC_RX_RX2_RX_PATH_SEC1 (0x0528) 256af3d54b9SSrinivas Kandagatla #define CDC_RX_RX2_RX_PATH_SEC2 (0x052C) 257af3d54b9SSrinivas Kandagatla #define CDC_RX_RX2_RX_PATH_SEC3 (0x0530) 258af3d54b9SSrinivas Kandagatla #define CDC_RX_RX2_RX_PATH_SEC4 (0x0534) 259af3d54b9SSrinivas Kandagatla #define CDC_RX_RX2_RX_PATH_SEC5 (0x0538) 260af3d54b9SSrinivas Kandagatla #define CDC_RX_RX2_RX_PATH_SEC6 (0x053C) 261af3d54b9SSrinivas Kandagatla #define CDC_RX_RX2_RX_PATH_SEC7 (0x0540) 262af3d54b9SSrinivas Kandagatla #define CDC_RX_RX2_RX_PATH_MIX_SEC0 (0x0544) 263af3d54b9SSrinivas Kandagatla #define CDC_RX_RX2_RX_PATH_MIX_SEC1 (0x0548) 264af3d54b9SSrinivas Kandagatla #define CDC_RX_RX2_RX_PATH_DSM_CTL (0x054C) 265432e5074SSrinivas Kandagatla 266432e5074SSrinivas Kandagatla /* LPASS CODEC version 2.5 rx reg offsets */ 267432e5074SSrinivas Kandagatla #define CDC_2_5_RX_RX1_RX_PATH_CTL (0x04c0) 268432e5074SSrinivas Kandagatla #define CDC_2_5_RX_RX1_RX_PATH_CFG0 (0x04c4) 269432e5074SSrinivas Kandagatla #define CDC_2_5_RX_RX1_RX_PATH_CFG1 (0x04c8) 270432e5074SSrinivas Kandagatla #define CDC_2_5_RX_RX1_RX_PATH_CFG2 (0x04cC) 271432e5074SSrinivas Kandagatla #define CDC_2_5_RX_RX1_RX_PATH_CFG3 (0x04d0) 272432e5074SSrinivas Kandagatla #define CDC_2_5_RX_RX1_RX_VOL_CTL (0x04d4) 273432e5074SSrinivas Kandagatla #define CDC_2_5_RX_RX1_RX_PATH_MIX_CTL (0x04d8) 274432e5074SSrinivas Kandagatla #define CDC_2_5_RX_RX1_RX_PATH_MIX_CFG (0x04dC) 275432e5074SSrinivas Kandagatla #define CDC_2_5_RX_RX1_RX_VOL_MIX_CTL (0x04e0) 276432e5074SSrinivas Kandagatla #define CDC_2_5_RX_RX1_RX_PATH_SEC1 (0x04e4) 277432e5074SSrinivas Kandagatla #define CDC_2_5_RX_RX1_RX_PATH_SEC2 (0x04e8) 278432e5074SSrinivas Kandagatla #define CDC_2_5_RX_RX1_RX_PATH_SEC3 (0x04eC) 279432e5074SSrinivas Kandagatla #define CDC_2_5_RX_RX1_RX_PATH_SEC4 (0x04f0) 280432e5074SSrinivas Kandagatla #define CDC_2_5_RX_RX1_RX_PATH_SEC7 (0x04f4) 281432e5074SSrinivas Kandagatla #define CDC_2_5_RX_RX1_RX_PATH_MIX_SEC0 (0x04f8) 282432e5074SSrinivas Kandagatla #define CDC_2_5_RX_RX1_RX_PATH_MIX_SEC1 (0x04fC) 283432e5074SSrinivas Kandagatla #define CDC_2_5_RX_RX1_RX_PATH_DSM_CTL (0x0500) 284432e5074SSrinivas Kandagatla #define CDC_2_5_RX_RX1_RX_PATH_DSM_DATA1 (0x0504) 285432e5074SSrinivas Kandagatla #define CDC_2_5_RX_RX1_RX_PATH_DSM_DATA2 (0x0508) 286432e5074SSrinivas Kandagatla #define CDC_2_5_RX_RX1_RX_PATH_DSM_DATA3 (0x050C) 287432e5074SSrinivas Kandagatla #define CDC_2_5_RX_RX1_RX_PATH_DSM_DATA4 (0x0510) 288432e5074SSrinivas Kandagatla #define CDC_2_5_RX_RX1_RX_PATH_DSM_DATA5 (0x0514) 289432e5074SSrinivas Kandagatla #define CDC_2_5_RX_RX1_RX_PATH_DSM_DATA6 (0x0518) 290432e5074SSrinivas Kandagatla 291432e5074SSrinivas Kandagatla #define CDC_2_5_RX_RX2_RX_PATH_CTL (0x0580) 292432e5074SSrinivas Kandagatla #define CDC_2_5_RX_RX2_RX_PATH_CFG0 (0x0584) 293432e5074SSrinivas Kandagatla #define CDC_2_5_RX_RX2_RX_PATH_CFG1 (0x0588) 294432e5074SSrinivas Kandagatla #define CDC_2_5_RX_RX2_RX_PATH_CFG2 (0x058C) 295432e5074SSrinivas Kandagatla #define CDC_2_5_RX_RX2_RX_PATH_CFG3 (0x0590) 296432e5074SSrinivas Kandagatla #define CDC_2_5_RX_RX2_RX_VOL_CTL (0x0594) 297432e5074SSrinivas Kandagatla #define CDC_2_5_RX_RX2_RX_PATH_MIX_CTL (0x0598) 298432e5074SSrinivas Kandagatla #define CDC_2_5_RX_RX2_RX_PATH_MIX_CFG (0x059C) 299432e5074SSrinivas Kandagatla #define CDC_2_5_RX_RX2_RX_VOL_MIX_CTL (0x05a0) 300432e5074SSrinivas Kandagatla #define CDC_2_5_RX_RX2_RX_PATH_SEC0 (0x05a4) 301432e5074SSrinivas Kandagatla #define CDC_2_5_RX_RX2_RX_PATH_SEC1 (0x05a8) 302432e5074SSrinivas Kandagatla #define CDC_2_5_RX_RX2_RX_PATH_SEC2 (0x05aC) 303432e5074SSrinivas Kandagatla #define CDC_2_5_RX_RX2_RX_PATH_SEC3 (0x05b0) 304432e5074SSrinivas Kandagatla #define CDC_2_5_RX_RX2_RX_PATH_SEC4 (0x05b4) 305432e5074SSrinivas Kandagatla #define CDC_2_5_RX_RX2_RX_PATH_SEC5 (0x05b8) 306432e5074SSrinivas Kandagatla #define CDC_2_5_RX_RX2_RX_PATH_SEC6 (0x05bC) 307432e5074SSrinivas Kandagatla #define CDC_2_5_RX_RX2_RX_PATH_SEC7 (0x05c0) 308432e5074SSrinivas Kandagatla #define CDC_2_5_RX_RX2_RX_PATH_MIX_SEC0 (0x05c4) 309432e5074SSrinivas Kandagatla #define CDC_2_5_RX_RX2_RX_PATH_MIX_SEC1 (0x05c8) 310432e5074SSrinivas Kandagatla #define CDC_2_5_RX_RX2_RX_PATH_DSM_CTL (0x05cC) 311432e5074SSrinivas Kandagatla 312af3d54b9SSrinivas Kandagatla #define CDC_RX_IDLE_DETECT_PATH_CTL (0x0780) 313af3d54b9SSrinivas Kandagatla #define CDC_RX_IDLE_DETECT_CFG0 (0x0784) 314af3d54b9SSrinivas Kandagatla #define CDC_RX_IDLE_DETECT_CFG1 (0x0788) 315af3d54b9SSrinivas Kandagatla #define CDC_RX_IDLE_DETECT_CFG2 (0x078C) 316af3d54b9SSrinivas Kandagatla #define CDC_RX_IDLE_DETECT_CFG3 (0x0790) 317af3d54b9SSrinivas Kandagatla #define CDC_RX_COMPANDERn_CTL0(n) (0x0800 + 0x40 * n) 318af3d54b9SSrinivas Kandagatla #define CDC_RX_COMPANDERn_CLK_EN_MASK BIT(0) 319af3d54b9SSrinivas Kandagatla #define CDC_RX_COMPANDERn_SOFT_RST_MASK BIT(1) 320af3d54b9SSrinivas Kandagatla #define CDC_RX_COMPANDERn_HALT_MASK BIT(2) 321af3d54b9SSrinivas Kandagatla #define CDC_RX_COMPANDER0_CTL0 (0x0800) 322af3d54b9SSrinivas Kandagatla #define CDC_RX_COMPANDER0_CTL1 (0x0804) 323af3d54b9SSrinivas Kandagatla #define CDC_RX_COMPANDER0_CTL2 (0x0808) 324af3d54b9SSrinivas Kandagatla #define CDC_RX_COMPANDER0_CTL3 (0x080C) 325af3d54b9SSrinivas Kandagatla #define CDC_RX_COMPANDER0_CTL4 (0x0810) 326af3d54b9SSrinivas Kandagatla #define CDC_RX_COMPANDER0_CTL5 (0x0814) 327af3d54b9SSrinivas Kandagatla #define CDC_RX_COMPANDER0_CTL6 (0x0818) 328af3d54b9SSrinivas Kandagatla #define CDC_RX_COMPANDER0_CTL7 (0x081C) 329af3d54b9SSrinivas Kandagatla #define CDC_RX_COMPANDER1_CTL0 (0x0840) 330af3d54b9SSrinivas Kandagatla #define CDC_RX_COMPANDER1_CTL1 (0x0844) 331af3d54b9SSrinivas Kandagatla #define CDC_RX_COMPANDER1_CTL2 (0x0848) 332af3d54b9SSrinivas Kandagatla #define CDC_RX_COMPANDER1_CTL3 (0x084C) 333af3d54b9SSrinivas Kandagatla #define CDC_RX_COMPANDER1_CTL4 (0x0850) 334af3d54b9SSrinivas Kandagatla #define CDC_RX_COMPANDER1_CTL5 (0x0854) 335af3d54b9SSrinivas Kandagatla #define CDC_RX_COMPANDER1_CTL6 (0x0858) 336af3d54b9SSrinivas Kandagatla #define CDC_RX_COMPANDER1_CTL7 (0x085C) 337af3d54b9SSrinivas Kandagatla #define CDC_RX_COMPANDER1_HPH_LOW_PWR_MODE_MASK BIT(5) 338af3d54b9SSrinivas Kandagatla #define CDC_RX_SIDETONE_IIR0_IIR_PATH_CTL (0x0A00) 339af3d54b9SSrinivas Kandagatla #define CDC_RX_SIDETONE_IIR0_IIR_GAIN_B1_CTL (0x0A04) 340af3d54b9SSrinivas Kandagatla #define CDC_RX_SIDETONE_IIR0_IIR_GAIN_B2_CTL (0x0A08) 341af3d54b9SSrinivas Kandagatla #define CDC_RX_SIDETONE_IIR0_IIR_GAIN_B3_CTL (0x0A0C) 342af3d54b9SSrinivas Kandagatla #define CDC_RX_SIDETONE_IIR0_IIR_GAIN_B4_CTL (0x0A10) 343af3d54b9SSrinivas Kandagatla #define CDC_RX_SIDETONE_IIR0_IIR_GAIN_B5_CTL (0x0A14) 344af3d54b9SSrinivas Kandagatla #define CDC_RX_SIDETONE_IIR0_IIR_GAIN_B6_CTL (0x0A18) 345af3d54b9SSrinivas Kandagatla #define CDC_RX_SIDETONE_IIR0_IIR_GAIN_B7_CTL (0x0A1C) 346af3d54b9SSrinivas Kandagatla #define CDC_RX_SIDETONE_IIR0_IIR_GAIN_B8_CTL (0x0A20) 347af3d54b9SSrinivas Kandagatla #define CDC_RX_SIDETONE_IIR0_IIR_CTL (0x0A24) 348af3d54b9SSrinivas Kandagatla #define CDC_RX_SIDETONE_IIR0_IIR_GAIN_TIMER_CTL (0x0A28) 349af3d54b9SSrinivas Kandagatla #define CDC_RX_SIDETONE_IIR0_IIR_COEF_B1_CTL (0x0A2C) 350af3d54b9SSrinivas Kandagatla #define CDC_RX_SIDETONE_IIR0_IIR_COEF_B2_CTL (0x0A30) 351af3d54b9SSrinivas Kandagatla #define CDC_RX_SIDETONE_IIR1_IIR_PATH_CTL (0x0A80) 352af3d54b9SSrinivas Kandagatla #define CDC_RX_SIDETONE_IIR1_IIR_GAIN_B1_CTL (0x0A84) 353af3d54b9SSrinivas Kandagatla #define CDC_RX_SIDETONE_IIR1_IIR_GAIN_B2_CTL (0x0A88) 354af3d54b9SSrinivas Kandagatla #define CDC_RX_SIDETONE_IIR1_IIR_GAIN_B3_CTL (0x0A8C) 355af3d54b9SSrinivas Kandagatla #define CDC_RX_SIDETONE_IIR1_IIR_GAIN_B4_CTL (0x0A90) 356af3d54b9SSrinivas Kandagatla #define CDC_RX_SIDETONE_IIR1_IIR_GAIN_B5_CTL (0x0A94) 357af3d54b9SSrinivas Kandagatla #define CDC_RX_SIDETONE_IIR1_IIR_GAIN_B6_CTL (0x0A98) 358af3d54b9SSrinivas Kandagatla #define CDC_RX_SIDETONE_IIR1_IIR_GAIN_B7_CTL (0x0A9C) 359af3d54b9SSrinivas Kandagatla #define CDC_RX_SIDETONE_IIR1_IIR_GAIN_B8_CTL (0x0AA0) 360af3d54b9SSrinivas Kandagatla #define CDC_RX_SIDETONE_IIR1_IIR_CTL (0x0AA4) 361af3d54b9SSrinivas Kandagatla #define CDC_RX_SIDETONE_IIR1_IIR_GAIN_TIMER_CTL (0x0AA8) 362af3d54b9SSrinivas Kandagatla #define CDC_RX_SIDETONE_IIR1_IIR_COEF_B1_CTL (0x0AAC) 363af3d54b9SSrinivas Kandagatla #define CDC_RX_SIDETONE_IIR1_IIR_COEF_B2_CTL (0x0AB0) 364af3d54b9SSrinivas Kandagatla #define CDC_RX_IIR_INP_MUX_IIR0_MIX_CFG0 (0x0B00) 365af3d54b9SSrinivas Kandagatla #define CDC_RX_IIR_INP_MUX_IIR0_MIX_CFG1 (0x0B04) 366af3d54b9SSrinivas Kandagatla #define CDC_RX_IIR_INP_MUX_IIR0_MIX_CFG2 (0x0B08) 367af3d54b9SSrinivas Kandagatla #define CDC_RX_IIR_INP_MUX_IIR0_MIX_CFG3 (0x0B0C) 368af3d54b9SSrinivas Kandagatla #define CDC_RX_IIR_INP_MUX_IIR1_MIX_CFG0 (0x0B10) 369af3d54b9SSrinivas Kandagatla #define CDC_RX_IIR_INP_MUX_IIR1_MIX_CFG1 (0x0B14) 370af3d54b9SSrinivas Kandagatla #define CDC_RX_IIR_INP_MUX_IIR1_MIX_CFG2 (0x0B18) 371af3d54b9SSrinivas Kandagatla #define CDC_RX_IIR_INP_MUX_IIR1_MIX_CFG3 (0x0B1C) 372af3d54b9SSrinivas Kandagatla #define CDC_RX_SIDETONE_SRC0_ST_SRC_PATH_CTL (0x0B40) 373af3d54b9SSrinivas Kandagatla #define CDC_RX_SIDETONE_SRC0_ST_SRC_PATH_CFG1 (0x0B44) 374af3d54b9SSrinivas Kandagatla #define CDC_RX_SIDETONE_SRC1_ST_SRC_PATH_CTL (0x0B50) 375af3d54b9SSrinivas Kandagatla #define CDC_RX_SIDETONE_SRC1_ST_SRC_PATH_CFG1 (0x0B54) 376af3d54b9SSrinivas Kandagatla #define CDC_RX_EC_REF_HQ0_EC_REF_HQ_PATH_CTL (0x0C00) 377af3d54b9SSrinivas Kandagatla #define CDC_RX_EC_REF_HQ0_EC_REF_HQ_CFG0 (0x0C04) 378af3d54b9SSrinivas Kandagatla #define CDC_RX_EC_REF_HQ1_EC_REF_HQ_PATH_CTL (0x0C40) 379af3d54b9SSrinivas Kandagatla #define CDC_RX_EC_REF_HQ1_EC_REF_HQ_CFG0 (0x0C44) 380af3d54b9SSrinivas Kandagatla #define CDC_RX_EC_REF_HQ2_EC_REF_HQ_PATH_CTL (0x0C80) 381af3d54b9SSrinivas Kandagatla #define CDC_RX_EC_REF_HQ2_EC_REF_HQ_CFG0 (0x0C84) 382af3d54b9SSrinivas Kandagatla #define CDC_RX_EC_ASRC0_CLK_RST_CTL (0x0D00) 383af3d54b9SSrinivas Kandagatla #define CDC_RX_EC_ASRC0_CTL0 (0x0D04) 384af3d54b9SSrinivas Kandagatla #define CDC_RX_EC_ASRC0_CTL1 (0x0D08) 385af3d54b9SSrinivas Kandagatla #define CDC_RX_EC_ASRC0_FIFO_CTL (0x0D0C) 386af3d54b9SSrinivas Kandagatla #define CDC_RX_EC_ASRC0_STATUS_FMIN_CNTR_LSB (0x0D10) 387af3d54b9SSrinivas Kandagatla #define CDC_RX_EC_ASRC0_STATUS_FMIN_CNTR_MSB (0x0D14) 388af3d54b9SSrinivas Kandagatla #define CDC_RX_EC_ASRC0_STATUS_FMAX_CNTR_LSB (0x0D18) 389af3d54b9SSrinivas Kandagatla #define CDC_RX_EC_ASRC0_STATUS_FMAX_CNTR_MSB (0x0D1C) 390af3d54b9SSrinivas Kandagatla #define CDC_RX_EC_ASRC0_STATUS_FIFO (0x0D20) 391af3d54b9SSrinivas Kandagatla #define CDC_RX_EC_ASRC1_CLK_RST_CTL (0x0D40) 392af3d54b9SSrinivas Kandagatla #define CDC_RX_EC_ASRC1_CTL0 (0x0D44) 393af3d54b9SSrinivas Kandagatla #define CDC_RX_EC_ASRC1_CTL1 (0x0D48) 394af3d54b9SSrinivas Kandagatla #define CDC_RX_EC_ASRC1_FIFO_CTL (0x0D4C) 395af3d54b9SSrinivas Kandagatla #define CDC_RX_EC_ASRC1_STATUS_FMIN_CNTR_LSB (0x0D50) 396af3d54b9SSrinivas Kandagatla #define CDC_RX_EC_ASRC1_STATUS_FMIN_CNTR_MSB (0x0D54) 397af3d54b9SSrinivas Kandagatla #define CDC_RX_EC_ASRC1_STATUS_FMAX_CNTR_LSB (0x0D58) 398af3d54b9SSrinivas Kandagatla #define CDC_RX_EC_ASRC1_STATUS_FMAX_CNTR_MSB (0x0D5C) 399af3d54b9SSrinivas Kandagatla #define CDC_RX_EC_ASRC1_STATUS_FIFO (0x0D60) 400af3d54b9SSrinivas Kandagatla #define CDC_RX_EC_ASRC2_CLK_RST_CTL (0x0D80) 401af3d54b9SSrinivas Kandagatla #define CDC_RX_EC_ASRC2_CTL0 (0x0D84) 402af3d54b9SSrinivas Kandagatla #define CDC_RX_EC_ASRC2_CTL1 (0x0D88) 403af3d54b9SSrinivas Kandagatla #define CDC_RX_EC_ASRC2_FIFO_CTL (0x0D8C) 404af3d54b9SSrinivas Kandagatla #define CDC_RX_EC_ASRC2_STATUS_FMIN_CNTR_LSB (0x0D90) 405af3d54b9SSrinivas Kandagatla #define CDC_RX_EC_ASRC2_STATUS_FMIN_CNTR_MSB (0x0D94) 406af3d54b9SSrinivas Kandagatla #define CDC_RX_EC_ASRC2_STATUS_FMAX_CNTR_LSB (0x0D98) 407af3d54b9SSrinivas Kandagatla #define CDC_RX_EC_ASRC2_STATUS_FMAX_CNTR_MSB (0x0D9C) 408af3d54b9SSrinivas Kandagatla #define CDC_RX_EC_ASRC2_STATUS_FIFO (0x0DA0) 409af3d54b9SSrinivas Kandagatla #define CDC_RX_DSD0_PATH_CTL (0x0F00) 410af3d54b9SSrinivas Kandagatla #define CDC_RX_DSD0_CFG0 (0x0F04) 411af3d54b9SSrinivas Kandagatla #define CDC_RX_DSD0_CFG1 (0x0F08) 412af3d54b9SSrinivas Kandagatla #define CDC_RX_DSD0_CFG2 (0x0F0C) 413af3d54b9SSrinivas Kandagatla #define CDC_RX_DSD1_PATH_CTL (0x0F80) 414af3d54b9SSrinivas Kandagatla #define CDC_RX_DSD1_CFG0 (0x0F84) 415af3d54b9SSrinivas Kandagatla #define CDC_RX_DSD1_CFG1 (0x0F88) 416af3d54b9SSrinivas Kandagatla #define CDC_RX_DSD1_CFG2 (0x0F8C) 417af3d54b9SSrinivas Kandagatla #define RX_MAX_OFFSET (0x0F8C) 418af3d54b9SSrinivas Kandagatla 419e7621434SSrinivas Kandagatla #define MCLK_FREQ 19200000 420af3d54b9SSrinivas Kandagatla 421af3d54b9SSrinivas Kandagatla #define RX_MACRO_RATES (SNDRV_PCM_RATE_8000 | SNDRV_PCM_RATE_16000 |\ 422af3d54b9SSrinivas Kandagatla SNDRV_PCM_RATE_32000 | SNDRV_PCM_RATE_48000 |\ 423af3d54b9SSrinivas Kandagatla SNDRV_PCM_RATE_96000 | SNDRV_PCM_RATE_192000 |\ 424af3d54b9SSrinivas Kandagatla SNDRV_PCM_RATE_384000) 425af3d54b9SSrinivas Kandagatla /* Fractional Rates */ 426af3d54b9SSrinivas Kandagatla #define RX_MACRO_FRAC_RATES (SNDRV_PCM_RATE_44100 | SNDRV_PCM_RATE_88200 |\ 427af3d54b9SSrinivas Kandagatla SNDRV_PCM_RATE_176400 | SNDRV_PCM_RATE_352800) 428af3d54b9SSrinivas Kandagatla 429af3d54b9SSrinivas Kandagatla #define RX_MACRO_FORMATS (SNDRV_PCM_FMTBIT_S16_LE |\ 430af3d54b9SSrinivas Kandagatla SNDRV_PCM_FMTBIT_S24_LE |\ 431af3d54b9SSrinivas Kandagatla SNDRV_PCM_FMTBIT_S24_3LE | SNDRV_PCM_FMTBIT_S32_LE) 432af3d54b9SSrinivas Kandagatla 433af3d54b9SSrinivas Kandagatla #define RX_MACRO_ECHO_RATES (SNDRV_PCM_RATE_8000 | SNDRV_PCM_RATE_16000 |\ 434af3d54b9SSrinivas Kandagatla SNDRV_PCM_RATE_48000) 435af3d54b9SSrinivas Kandagatla #define RX_MACRO_ECHO_FORMATS (SNDRV_PCM_FMTBIT_S16_LE |\ 436af3d54b9SSrinivas Kandagatla SNDRV_PCM_FMTBIT_S24_LE |\ 437af3d54b9SSrinivas Kandagatla SNDRV_PCM_FMTBIT_S24_3LE) 438af3d54b9SSrinivas Kandagatla 439af3d54b9SSrinivas Kandagatla #define RX_MACRO_MAX_DMA_CH_PER_PORT 2 440af3d54b9SSrinivas Kandagatla 441af3d54b9SSrinivas Kandagatla #define RX_MACRO_EC_MIX_TX0_MASK 0xf0 442af3d54b9SSrinivas Kandagatla #define RX_MACRO_EC_MIX_TX1_MASK 0x0f 443af3d54b9SSrinivas Kandagatla #define RX_MACRO_EC_MIX_TX2_MASK 0x0f 444af3d54b9SSrinivas Kandagatla 445af3d54b9SSrinivas Kandagatla #define COMP_MAX_COEFF 25 446af3d54b9SSrinivas Kandagatla #define RX_NUM_CLKS_MAX 5 447af3d54b9SSrinivas Kandagatla 448af3d54b9SSrinivas Kandagatla struct comp_coeff_val { 449af3d54b9SSrinivas Kandagatla u8 lsb; 450af3d54b9SSrinivas Kandagatla u8 msb; 451af3d54b9SSrinivas Kandagatla }; 452af3d54b9SSrinivas Kandagatla 453af3d54b9SSrinivas Kandagatla enum { 454af3d54b9SSrinivas Kandagatla HPH_ULP, 455af3d54b9SSrinivas Kandagatla HPH_LOHIFI, 456af3d54b9SSrinivas Kandagatla HPH_MODE_MAX, 457af3d54b9SSrinivas Kandagatla }; 458af3d54b9SSrinivas Kandagatla 459af3d54b9SSrinivas Kandagatla static const struct comp_coeff_val comp_coeff_table[HPH_MODE_MAX][COMP_MAX_COEFF] = { 460af3d54b9SSrinivas Kandagatla { 461af3d54b9SSrinivas Kandagatla {0x40, 0x00}, 462af3d54b9SSrinivas Kandagatla {0x4C, 0x00}, 463af3d54b9SSrinivas Kandagatla {0x5A, 0x00}, 464af3d54b9SSrinivas Kandagatla {0x6B, 0x00}, 465af3d54b9SSrinivas Kandagatla {0x7F, 0x00}, 466af3d54b9SSrinivas Kandagatla {0x97, 0x00}, 467af3d54b9SSrinivas Kandagatla {0xB3, 0x00}, 468af3d54b9SSrinivas Kandagatla {0xD5, 0x00}, 469af3d54b9SSrinivas Kandagatla {0xFD, 0x00}, 470af3d54b9SSrinivas Kandagatla {0x2D, 0x01}, 471af3d54b9SSrinivas Kandagatla {0x66, 0x01}, 472af3d54b9SSrinivas Kandagatla {0xA7, 0x01}, 473af3d54b9SSrinivas Kandagatla {0xF8, 0x01}, 474af3d54b9SSrinivas Kandagatla {0x57, 0x02}, 475af3d54b9SSrinivas Kandagatla {0xC7, 0x02}, 476af3d54b9SSrinivas Kandagatla {0x4B, 0x03}, 477af3d54b9SSrinivas Kandagatla {0xE9, 0x03}, 478af3d54b9SSrinivas Kandagatla {0xA3, 0x04}, 479af3d54b9SSrinivas Kandagatla {0x7D, 0x05}, 480af3d54b9SSrinivas Kandagatla {0x90, 0x06}, 481af3d54b9SSrinivas Kandagatla {0xD1, 0x07}, 482af3d54b9SSrinivas Kandagatla {0x49, 0x09}, 483af3d54b9SSrinivas Kandagatla {0x00, 0x0B}, 484af3d54b9SSrinivas Kandagatla {0x01, 0x0D}, 485af3d54b9SSrinivas Kandagatla {0x59, 0x0F}, 486af3d54b9SSrinivas Kandagatla }, 487af3d54b9SSrinivas Kandagatla { 488af3d54b9SSrinivas Kandagatla {0x40, 0x00}, 489af3d54b9SSrinivas Kandagatla {0x4C, 0x00}, 490af3d54b9SSrinivas Kandagatla {0x5A, 0x00}, 491af3d54b9SSrinivas Kandagatla {0x6B, 0x00}, 492af3d54b9SSrinivas Kandagatla {0x80, 0x00}, 493af3d54b9SSrinivas Kandagatla {0x98, 0x00}, 494af3d54b9SSrinivas Kandagatla {0xB4, 0x00}, 495af3d54b9SSrinivas Kandagatla {0xD5, 0x00}, 496af3d54b9SSrinivas Kandagatla {0xFE, 0x00}, 497af3d54b9SSrinivas Kandagatla {0x2E, 0x01}, 498af3d54b9SSrinivas Kandagatla {0x66, 0x01}, 499af3d54b9SSrinivas Kandagatla {0xA9, 0x01}, 500af3d54b9SSrinivas Kandagatla {0xF8, 0x01}, 501af3d54b9SSrinivas Kandagatla {0x56, 0x02}, 502af3d54b9SSrinivas Kandagatla {0xC4, 0x02}, 503af3d54b9SSrinivas Kandagatla {0x4F, 0x03}, 504af3d54b9SSrinivas Kandagatla {0xF0, 0x03}, 505af3d54b9SSrinivas Kandagatla {0xAE, 0x04}, 506af3d54b9SSrinivas Kandagatla {0x8B, 0x05}, 507af3d54b9SSrinivas Kandagatla {0x8E, 0x06}, 508af3d54b9SSrinivas Kandagatla {0xBC, 0x07}, 509af3d54b9SSrinivas Kandagatla {0x56, 0x09}, 510af3d54b9SSrinivas Kandagatla {0x0F, 0x0B}, 511af3d54b9SSrinivas Kandagatla {0x13, 0x0D}, 512af3d54b9SSrinivas Kandagatla {0x6F, 0x0F}, 513af3d54b9SSrinivas Kandagatla }, 514af3d54b9SSrinivas Kandagatla }; 515af3d54b9SSrinivas Kandagatla 516af3d54b9SSrinivas Kandagatla enum { 517af3d54b9SSrinivas Kandagatla INTERP_HPHL, 518af3d54b9SSrinivas Kandagatla INTERP_HPHR, 519af3d54b9SSrinivas Kandagatla INTERP_AUX, 520af3d54b9SSrinivas Kandagatla INTERP_MAX 521af3d54b9SSrinivas Kandagatla }; 522af3d54b9SSrinivas Kandagatla 523af3d54b9SSrinivas Kandagatla enum { 524af3d54b9SSrinivas Kandagatla RX_MACRO_RX0, 525af3d54b9SSrinivas Kandagatla RX_MACRO_RX1, 526af3d54b9SSrinivas Kandagatla RX_MACRO_RX2, 527af3d54b9SSrinivas Kandagatla RX_MACRO_RX3, 528af3d54b9SSrinivas Kandagatla RX_MACRO_RX4, 529af3d54b9SSrinivas Kandagatla RX_MACRO_RX5, 530af3d54b9SSrinivas Kandagatla RX_MACRO_PORTS_MAX 531af3d54b9SSrinivas Kandagatla }; 532af3d54b9SSrinivas Kandagatla 533af3d54b9SSrinivas Kandagatla enum { 534af3d54b9SSrinivas Kandagatla RX_MACRO_COMP1, /* HPH_L */ 535af3d54b9SSrinivas Kandagatla RX_MACRO_COMP2, /* HPH_R */ 536af3d54b9SSrinivas Kandagatla RX_MACRO_COMP_MAX 537af3d54b9SSrinivas Kandagatla }; 538af3d54b9SSrinivas Kandagatla 539af3d54b9SSrinivas Kandagatla enum { 540af3d54b9SSrinivas Kandagatla RX_MACRO_EC0_MUX = 0, 541af3d54b9SSrinivas Kandagatla RX_MACRO_EC1_MUX, 542af3d54b9SSrinivas Kandagatla RX_MACRO_EC2_MUX, 543af3d54b9SSrinivas Kandagatla RX_MACRO_EC_MUX_MAX, 544af3d54b9SSrinivas Kandagatla }; 545af3d54b9SSrinivas Kandagatla 546af3d54b9SSrinivas Kandagatla enum { 547af3d54b9SSrinivas Kandagatla INTn_1_INP_SEL_ZERO = 0, 548af3d54b9SSrinivas Kandagatla INTn_1_INP_SEL_DEC0, 549af3d54b9SSrinivas Kandagatla INTn_1_INP_SEL_DEC1, 550af3d54b9SSrinivas Kandagatla INTn_1_INP_SEL_IIR0, 551af3d54b9SSrinivas Kandagatla INTn_1_INP_SEL_IIR1, 552af3d54b9SSrinivas Kandagatla INTn_1_INP_SEL_RX0, 553af3d54b9SSrinivas Kandagatla INTn_1_INP_SEL_RX1, 554af3d54b9SSrinivas Kandagatla INTn_1_INP_SEL_RX2, 555af3d54b9SSrinivas Kandagatla INTn_1_INP_SEL_RX3, 556af3d54b9SSrinivas Kandagatla INTn_1_INP_SEL_RX4, 557af3d54b9SSrinivas Kandagatla INTn_1_INP_SEL_RX5, 558af3d54b9SSrinivas Kandagatla }; 559af3d54b9SSrinivas Kandagatla 560af3d54b9SSrinivas Kandagatla enum { 561af3d54b9SSrinivas Kandagatla INTn_2_INP_SEL_ZERO = 0, 562af3d54b9SSrinivas Kandagatla INTn_2_INP_SEL_RX0, 563af3d54b9SSrinivas Kandagatla INTn_2_INP_SEL_RX1, 564af3d54b9SSrinivas Kandagatla INTn_2_INP_SEL_RX2, 565af3d54b9SSrinivas Kandagatla INTn_2_INP_SEL_RX3, 566af3d54b9SSrinivas Kandagatla INTn_2_INP_SEL_RX4, 567af3d54b9SSrinivas Kandagatla INTn_2_INP_SEL_RX5, 568af3d54b9SSrinivas Kandagatla }; 569af3d54b9SSrinivas Kandagatla 570af3d54b9SSrinivas Kandagatla enum { 571af3d54b9SSrinivas Kandagatla INTERP_MAIN_PATH, 572af3d54b9SSrinivas Kandagatla INTERP_MIX_PATH, 573af3d54b9SSrinivas Kandagatla }; 574af3d54b9SSrinivas Kandagatla 575f3ce6f3cSSrinivas Kandagatla /* Codec supports 2 IIR filters */ 576f3ce6f3cSSrinivas Kandagatla enum { 577f3ce6f3cSSrinivas Kandagatla IIR0 = 0, 578f3ce6f3cSSrinivas Kandagatla IIR1, 579f3ce6f3cSSrinivas Kandagatla IIR_MAX, 580f3ce6f3cSSrinivas Kandagatla }; 581f3ce6f3cSSrinivas Kandagatla 582f3ce6f3cSSrinivas Kandagatla /* Each IIR has 5 Filter Stages */ 583f3ce6f3cSSrinivas Kandagatla enum { 584f3ce6f3cSSrinivas Kandagatla BAND1 = 0, 585f3ce6f3cSSrinivas Kandagatla BAND2, 586f3ce6f3cSSrinivas Kandagatla BAND3, 587f3ce6f3cSSrinivas Kandagatla BAND4, 588f3ce6f3cSSrinivas Kandagatla BAND5, 589f3ce6f3cSSrinivas Kandagatla BAND_MAX, 590f3ce6f3cSSrinivas Kandagatla }; 591f3ce6f3cSSrinivas Kandagatla 592f3ce6f3cSSrinivas Kandagatla #define RX_MACRO_IIR_FILTER_SIZE (sizeof(u32) * BAND_MAX) 593f3ce6f3cSSrinivas Kandagatla 594f3ce6f3cSSrinivas Kandagatla #define RX_MACRO_IIR_FILTER_CTL(xname, iidx, bidx) \ 595f3ce6f3cSSrinivas Kandagatla { \ 596f3ce6f3cSSrinivas Kandagatla .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, \ 597f3ce6f3cSSrinivas Kandagatla .info = rx_macro_iir_filter_info, \ 598f3ce6f3cSSrinivas Kandagatla .get = rx_macro_get_iir_band_audio_mixer, \ 599f3ce6f3cSSrinivas Kandagatla .put = rx_macro_put_iir_band_audio_mixer, \ 600f3ce6f3cSSrinivas Kandagatla .private_value = (unsigned long)&(struct wcd_iir_filter_ctl) { \ 601f3ce6f3cSSrinivas Kandagatla .iir_idx = iidx, \ 602f3ce6f3cSSrinivas Kandagatla .band_idx = bidx, \ 603f3ce6f3cSSrinivas Kandagatla .bytes_ext = {.max = RX_MACRO_IIR_FILTER_SIZE, }, \ 604f3ce6f3cSSrinivas Kandagatla } \ 605f3ce6f3cSSrinivas Kandagatla } 606f3ce6f3cSSrinivas Kandagatla 607af3d54b9SSrinivas Kandagatla struct interp_sample_rate { 608af3d54b9SSrinivas Kandagatla int sample_rate; 609af3d54b9SSrinivas Kandagatla int rate_val; 610af3d54b9SSrinivas Kandagatla }; 611af3d54b9SSrinivas Kandagatla 612af3d54b9SSrinivas Kandagatla static struct interp_sample_rate sr_val_tbl[] = { 613af3d54b9SSrinivas Kandagatla {8000, 0x0}, {16000, 0x1}, {32000, 0x3}, {48000, 0x4}, {96000, 0x5}, 614af3d54b9SSrinivas Kandagatla {192000, 0x6}, {384000, 0x7}, {44100, 0x9}, {88200, 0xA}, 615af3d54b9SSrinivas Kandagatla {176400, 0xB}, {352800, 0xC}, 616af3d54b9SSrinivas Kandagatla }; 617af3d54b9SSrinivas Kandagatla 618af3d54b9SSrinivas Kandagatla enum { 619af3d54b9SSrinivas Kandagatla RX_MACRO_AIF_INVALID = 0, 620af3d54b9SSrinivas Kandagatla RX_MACRO_AIF1_PB, 621af3d54b9SSrinivas Kandagatla RX_MACRO_AIF2_PB, 622af3d54b9SSrinivas Kandagatla RX_MACRO_AIF3_PB, 623af3d54b9SSrinivas Kandagatla RX_MACRO_AIF4_PB, 624af3d54b9SSrinivas Kandagatla RX_MACRO_AIF_ECHO, 625af3d54b9SSrinivas Kandagatla RX_MACRO_MAX_DAIS, 626af3d54b9SSrinivas Kandagatla }; 627af3d54b9SSrinivas Kandagatla 628af3d54b9SSrinivas Kandagatla enum { 629af3d54b9SSrinivas Kandagatla RX_MACRO_AIF1_CAP = 0, 630af3d54b9SSrinivas Kandagatla RX_MACRO_AIF2_CAP, 631af3d54b9SSrinivas Kandagatla RX_MACRO_AIF3_CAP, 632af3d54b9SSrinivas Kandagatla RX_MACRO_MAX_AIF_CAP_DAIS 633af3d54b9SSrinivas Kandagatla }; 634af3d54b9SSrinivas Kandagatla 635af3d54b9SSrinivas Kandagatla struct rx_macro { 636af3d54b9SSrinivas Kandagatla struct device *dev; 637af3d54b9SSrinivas Kandagatla int comp_enabled[RX_MACRO_COMP_MAX]; 638af3d54b9SSrinivas Kandagatla /* Main path clock users count */ 639af3d54b9SSrinivas Kandagatla int main_clk_users[INTERP_MAX]; 640af3d54b9SSrinivas Kandagatla int rx_port_value[RX_MACRO_PORTS_MAX]; 641af3d54b9SSrinivas Kandagatla u16 prim_int_users[INTERP_MAX]; 642af3d54b9SSrinivas Kandagatla int rx_mclk_users; 643af3d54b9SSrinivas Kandagatla int clsh_users; 644af3d54b9SSrinivas Kandagatla int rx_mclk_cnt; 645*06462d6fSKrzysztof Kozlowski enum lpass_codec_version codec_version; 646dbacef05SSrinivas Kandagatla int rxn_reg_stride; 647af3d54b9SSrinivas Kandagatla bool is_ear_mode_on; 648af3d54b9SSrinivas Kandagatla bool hph_pwr_mode; 649af3d54b9SSrinivas Kandagatla bool hph_hd2_mode; 650af3d54b9SSrinivas Kandagatla struct snd_soc_component *component; 651af3d54b9SSrinivas Kandagatla unsigned long active_ch_mask[RX_MACRO_MAX_DAIS]; 652af3d54b9SSrinivas Kandagatla unsigned long active_ch_cnt[RX_MACRO_MAX_DAIS]; 653af3d54b9SSrinivas Kandagatla u16 bit_width[RX_MACRO_MAX_DAIS]; 654af3d54b9SSrinivas Kandagatla int is_softclip_on; 655af3d54b9SSrinivas Kandagatla int is_aux_hpf_on; 656af3d54b9SSrinivas Kandagatla int softclip_clk_users; 6579e3d83c5SSrinivasa Rao Mandadapu struct lpass_macro *pds; 658af3d54b9SSrinivas Kandagatla struct regmap *regmap; 65943b647d9SSrinivas Kandagatla struct clk *mclk; 66043b647d9SSrinivas Kandagatla struct clk *npl; 66143b647d9SSrinivas Kandagatla struct clk *macro; 66243b647d9SSrinivas Kandagatla struct clk *dcodec; 66343b647d9SSrinivas Kandagatla struct clk *fsgen; 664af3d54b9SSrinivas Kandagatla struct clk_hw hw; 665af3d54b9SSrinivas Kandagatla }; 666af3d54b9SSrinivas Kandagatla #define to_rx_macro(_hw) container_of(_hw, struct rx_macro, hw) 667af3d54b9SSrinivas Kandagatla 668f3ce6f3cSSrinivas Kandagatla struct wcd_iir_filter_ctl { 669f3ce6f3cSSrinivas Kandagatla unsigned int iir_idx; 670f3ce6f3cSSrinivas Kandagatla unsigned int band_idx; 671f3ce6f3cSSrinivas Kandagatla struct soc_bytes_ext bytes_ext; 672f3ce6f3cSSrinivas Kandagatla }; 673f3ce6f3cSSrinivas Kandagatla 674af3d54b9SSrinivas Kandagatla static const DECLARE_TLV_DB_SCALE(digital_gain, -8400, 100, -8400); 675af3d54b9SSrinivas Kandagatla 6764f692926SSrinivas Kandagatla static const char * const rx_int_mix_mux_text[] = { 6774f692926SSrinivas Kandagatla "ZERO", "RX0", "RX1", "RX2", "RX3", "RX4", "RX5" 6784f692926SSrinivas Kandagatla }; 6794f692926SSrinivas Kandagatla 6804f692926SSrinivas Kandagatla static const char * const rx_prim_mix_text[] = { 6814f692926SSrinivas Kandagatla "ZERO", "DEC0", "DEC1", "IIR0", "IIR1", "RX0", "RX1", "RX2", 6824f692926SSrinivas Kandagatla "RX3", "RX4", "RX5" 6834f692926SSrinivas Kandagatla }; 6844f692926SSrinivas Kandagatla 6854f692926SSrinivas Kandagatla static const char * const rx_sidetone_mix_text[] = { 6864f692926SSrinivas Kandagatla "ZERO", "SRC0", "SRC1", "SRC_SUM" 6874f692926SSrinivas Kandagatla }; 6884f692926SSrinivas Kandagatla 6894f692926SSrinivas Kandagatla static const char * const iir_inp_mux_text[] = { 6904f692926SSrinivas Kandagatla "ZERO", "DEC0", "DEC1", "DEC2", "DEC3", 6914f692926SSrinivas Kandagatla "RX0", "RX1", "RX2", "RX3", "RX4", "RX5" 6924f692926SSrinivas Kandagatla }; 6934f692926SSrinivas Kandagatla 6944f692926SSrinivas Kandagatla static const char * const rx_int_dem_inp_mux_text[] = { 6954f692926SSrinivas Kandagatla "NORMAL_DSM_OUT", "CLSH_DSM_OUT", 6964f692926SSrinivas Kandagatla }; 6974f692926SSrinivas Kandagatla 6984f692926SSrinivas Kandagatla static const char * const rx_int0_1_interp_mux_text[] = { 6994f692926SSrinivas Kandagatla "ZERO", "RX INT0_1 MIX1", 7004f692926SSrinivas Kandagatla }; 7014f692926SSrinivas Kandagatla 7024f692926SSrinivas Kandagatla static const char * const rx_int1_1_interp_mux_text[] = { 7034f692926SSrinivas Kandagatla "ZERO", "RX INT1_1 MIX1", 7044f692926SSrinivas Kandagatla }; 7054f692926SSrinivas Kandagatla 7064f692926SSrinivas Kandagatla static const char * const rx_int2_1_interp_mux_text[] = { 7074f692926SSrinivas Kandagatla "ZERO", "RX INT2_1 MIX1", 7084f692926SSrinivas Kandagatla }; 7094f692926SSrinivas Kandagatla 7104f692926SSrinivas Kandagatla static const char * const rx_int0_2_interp_mux_text[] = { 7114f692926SSrinivas Kandagatla "ZERO", "RX INT0_2 MUX", 7124f692926SSrinivas Kandagatla }; 7134f692926SSrinivas Kandagatla 7144f692926SSrinivas Kandagatla static const char * const rx_int1_2_interp_mux_text[] = { 7154f692926SSrinivas Kandagatla "ZERO", "RX INT1_2 MUX", 7164f692926SSrinivas Kandagatla }; 7174f692926SSrinivas Kandagatla 7184f692926SSrinivas Kandagatla static const char * const rx_int2_2_interp_mux_text[] = { 7194f692926SSrinivas Kandagatla "ZERO", "RX INT2_2 MUX", 7204f692926SSrinivas Kandagatla }; 7214f692926SSrinivas Kandagatla 7224f692926SSrinivas Kandagatla static const char *const rx_macro_mux_text[] = { 7234f692926SSrinivas Kandagatla "ZERO", "AIF1_PB", "AIF2_PB", "AIF3_PB", "AIF4_PB" 7244f692926SSrinivas Kandagatla }; 7254f692926SSrinivas Kandagatla 726af3d54b9SSrinivas Kandagatla static const char *const rx_macro_hph_pwr_mode_text[] = { 727af3d54b9SSrinivas Kandagatla "ULP", "LOHIFI" 728af3d54b9SSrinivas Kandagatla }; 729af3d54b9SSrinivas Kandagatla 7304f692926SSrinivas Kandagatla static const char * const rx_echo_mux_text[] = { 7314f692926SSrinivas Kandagatla "ZERO", "RX_MIX0", "RX_MIX1", "RX_MIX2" 7324f692926SSrinivas Kandagatla }; 7334f692926SSrinivas Kandagatla 734af3d54b9SSrinivas Kandagatla static const struct soc_enum rx_macro_hph_pwr_mode_enum = 735af3d54b9SSrinivas Kandagatla SOC_ENUM_SINGLE_EXT(2, rx_macro_hph_pwr_mode_text); 7364f692926SSrinivas Kandagatla static const struct soc_enum rx_mix_tx2_mux_enum = 7374f692926SSrinivas Kandagatla SOC_ENUM_SINGLE(CDC_RX_INP_MUX_RX_MIX_CFG5, 0, 4, rx_echo_mux_text); 7384f692926SSrinivas Kandagatla static const struct soc_enum rx_mix_tx1_mux_enum = 7394f692926SSrinivas Kandagatla SOC_ENUM_SINGLE(CDC_RX_INP_MUX_RX_MIX_CFG4, 0, 4, rx_echo_mux_text); 7404f692926SSrinivas Kandagatla static const struct soc_enum rx_mix_tx0_mux_enum = 7414f692926SSrinivas Kandagatla SOC_ENUM_SINGLE(CDC_RX_INP_MUX_RX_MIX_CFG4, 4, 4, rx_echo_mux_text); 7424f692926SSrinivas Kandagatla 7434f692926SSrinivas Kandagatla static SOC_ENUM_SINGLE_DECL(rx_int0_2_enum, CDC_RX_INP_MUX_RX_INT0_CFG1, 0, 7444f692926SSrinivas Kandagatla rx_int_mix_mux_text); 7454f692926SSrinivas Kandagatla static SOC_ENUM_SINGLE_DECL(rx_int1_2_enum, CDC_RX_INP_MUX_RX_INT1_CFG1, 0, 7464f692926SSrinivas Kandagatla rx_int_mix_mux_text); 7474f692926SSrinivas Kandagatla static SOC_ENUM_SINGLE_DECL(rx_int2_2_enum, CDC_RX_INP_MUX_RX_INT2_CFG1, 0, 7484f692926SSrinivas Kandagatla rx_int_mix_mux_text); 7494f692926SSrinivas Kandagatla 7504f692926SSrinivas Kandagatla static SOC_ENUM_SINGLE_DECL(rx_int0_1_mix_inp0_enum, CDC_RX_INP_MUX_RX_INT0_CFG0, 0, 7514f692926SSrinivas Kandagatla rx_prim_mix_text); 7524f692926SSrinivas Kandagatla static SOC_ENUM_SINGLE_DECL(rx_int0_1_mix_inp1_enum, CDC_RX_INP_MUX_RX_INT0_CFG0, 4, 7534f692926SSrinivas Kandagatla rx_prim_mix_text); 7544f692926SSrinivas Kandagatla static SOC_ENUM_SINGLE_DECL(rx_int0_1_mix_inp2_enum, CDC_RX_INP_MUX_RX_INT0_CFG1, 4, 7554f692926SSrinivas Kandagatla rx_prim_mix_text); 7564f692926SSrinivas Kandagatla static SOC_ENUM_SINGLE_DECL(rx_int1_1_mix_inp0_enum, CDC_RX_INP_MUX_RX_INT1_CFG0, 0, 7574f692926SSrinivas Kandagatla rx_prim_mix_text); 7584f692926SSrinivas Kandagatla static SOC_ENUM_SINGLE_DECL(rx_int1_1_mix_inp1_enum, CDC_RX_INP_MUX_RX_INT1_CFG0, 4, 7594f692926SSrinivas Kandagatla rx_prim_mix_text); 7604f692926SSrinivas Kandagatla static SOC_ENUM_SINGLE_DECL(rx_int1_1_mix_inp2_enum, CDC_RX_INP_MUX_RX_INT1_CFG1, 4, 7614f692926SSrinivas Kandagatla rx_prim_mix_text); 7624f692926SSrinivas Kandagatla static SOC_ENUM_SINGLE_DECL(rx_int2_1_mix_inp0_enum, CDC_RX_INP_MUX_RX_INT2_CFG0, 0, 7634f692926SSrinivas Kandagatla rx_prim_mix_text); 7644f692926SSrinivas Kandagatla static SOC_ENUM_SINGLE_DECL(rx_int2_1_mix_inp1_enum, CDC_RX_INP_MUX_RX_INT2_CFG0, 4, 7654f692926SSrinivas Kandagatla rx_prim_mix_text); 7664f692926SSrinivas Kandagatla static SOC_ENUM_SINGLE_DECL(rx_int2_1_mix_inp2_enum, CDC_RX_INP_MUX_RX_INT2_CFG1, 4, 7674f692926SSrinivas Kandagatla rx_prim_mix_text); 7684f692926SSrinivas Kandagatla 7694f692926SSrinivas Kandagatla static SOC_ENUM_SINGLE_DECL(rx_int0_mix2_inp_enum, CDC_RX_INP_MUX_SIDETONE_SRC_CFG0, 2, 7704f692926SSrinivas Kandagatla rx_sidetone_mix_text); 7714f692926SSrinivas Kandagatla static SOC_ENUM_SINGLE_DECL(rx_int1_mix2_inp_enum, CDC_RX_INP_MUX_SIDETONE_SRC_CFG0, 4, 7724f692926SSrinivas Kandagatla rx_sidetone_mix_text); 7734f692926SSrinivas Kandagatla static SOC_ENUM_SINGLE_DECL(rx_int2_mix2_inp_enum, CDC_RX_INP_MUX_SIDETONE_SRC_CFG0, 6, 7744f692926SSrinivas Kandagatla rx_sidetone_mix_text); 7754f692926SSrinivas Kandagatla static SOC_ENUM_SINGLE_DECL(iir0_inp0_enum, CDC_RX_IIR_INP_MUX_IIR0_MIX_CFG0, 0, 7764f692926SSrinivas Kandagatla iir_inp_mux_text); 7774f692926SSrinivas Kandagatla static SOC_ENUM_SINGLE_DECL(iir0_inp1_enum, CDC_RX_IIR_INP_MUX_IIR0_MIX_CFG1, 0, 7784f692926SSrinivas Kandagatla iir_inp_mux_text); 7794f692926SSrinivas Kandagatla static SOC_ENUM_SINGLE_DECL(iir0_inp2_enum, CDC_RX_IIR_INP_MUX_IIR0_MIX_CFG2, 0, 7804f692926SSrinivas Kandagatla iir_inp_mux_text); 7814f692926SSrinivas Kandagatla static SOC_ENUM_SINGLE_DECL(iir0_inp3_enum, CDC_RX_IIR_INP_MUX_IIR0_MIX_CFG3, 0, 7824f692926SSrinivas Kandagatla iir_inp_mux_text); 7834f692926SSrinivas Kandagatla static SOC_ENUM_SINGLE_DECL(iir1_inp0_enum, CDC_RX_IIR_INP_MUX_IIR1_MIX_CFG0, 0, 7844f692926SSrinivas Kandagatla iir_inp_mux_text); 7854f692926SSrinivas Kandagatla static SOC_ENUM_SINGLE_DECL(iir1_inp1_enum, CDC_RX_IIR_INP_MUX_IIR1_MIX_CFG1, 0, 7864f692926SSrinivas Kandagatla iir_inp_mux_text); 7874f692926SSrinivas Kandagatla static SOC_ENUM_SINGLE_DECL(iir1_inp2_enum, CDC_RX_IIR_INP_MUX_IIR1_MIX_CFG2, 0, 7884f692926SSrinivas Kandagatla iir_inp_mux_text); 7894f692926SSrinivas Kandagatla static SOC_ENUM_SINGLE_DECL(iir1_inp3_enum, CDC_RX_IIR_INP_MUX_IIR1_MIX_CFG3, 0, 7904f692926SSrinivas Kandagatla iir_inp_mux_text); 7914f692926SSrinivas Kandagatla 7924f692926SSrinivas Kandagatla static SOC_ENUM_SINGLE_DECL(rx_int0_1_interp_enum, SND_SOC_NOPM, 0, 7934f692926SSrinivas Kandagatla rx_int0_1_interp_mux_text); 7944f692926SSrinivas Kandagatla static SOC_ENUM_SINGLE_DECL(rx_int1_1_interp_enum, SND_SOC_NOPM, 0, 7954f692926SSrinivas Kandagatla rx_int1_1_interp_mux_text); 7964f692926SSrinivas Kandagatla static SOC_ENUM_SINGLE_DECL(rx_int2_1_interp_enum, SND_SOC_NOPM, 0, 7974f692926SSrinivas Kandagatla rx_int2_1_interp_mux_text); 7984f692926SSrinivas Kandagatla static SOC_ENUM_SINGLE_DECL(rx_int0_2_interp_enum, SND_SOC_NOPM, 0, 7994f692926SSrinivas Kandagatla rx_int0_2_interp_mux_text); 8004f692926SSrinivas Kandagatla static SOC_ENUM_SINGLE_DECL(rx_int1_2_interp_enum, SND_SOC_NOPM, 0, 8014f692926SSrinivas Kandagatla rx_int1_2_interp_mux_text); 8024f692926SSrinivas Kandagatla static SOC_ENUM_SINGLE_DECL(rx_int2_2_interp_enum, SND_SOC_NOPM, 0, 8034f692926SSrinivas Kandagatla rx_int2_2_interp_mux_text); 8044f692926SSrinivas Kandagatla static SOC_ENUM_SINGLE_DECL(rx_int0_dem_inp_enum, CDC_RX_RX0_RX_PATH_CFG1, 0, 8054f692926SSrinivas Kandagatla rx_int_dem_inp_mux_text); 8064f692926SSrinivas Kandagatla static SOC_ENUM_SINGLE_DECL(rx_int1_dem_inp_enum, CDC_RX_RX1_RX_PATH_CFG1, 0, 8074f692926SSrinivas Kandagatla rx_int_dem_inp_mux_text); 808432e5074SSrinivas Kandagatla static SOC_ENUM_SINGLE_DECL(rx_2_5_int1_dem_inp_enum, CDC_2_5_RX_RX1_RX_PATH_CFG1, 0, 809432e5074SSrinivas Kandagatla rx_int_dem_inp_mux_text); 8104f692926SSrinivas Kandagatla 8114f692926SSrinivas Kandagatla static SOC_ENUM_SINGLE_DECL(rx_macro_rx0_enum, SND_SOC_NOPM, 0, rx_macro_mux_text); 8124f692926SSrinivas Kandagatla static SOC_ENUM_SINGLE_DECL(rx_macro_rx1_enum, SND_SOC_NOPM, 0, rx_macro_mux_text); 8134f692926SSrinivas Kandagatla static SOC_ENUM_SINGLE_DECL(rx_macro_rx2_enum, SND_SOC_NOPM, 0, rx_macro_mux_text); 8144f692926SSrinivas Kandagatla static SOC_ENUM_SINGLE_DECL(rx_macro_rx3_enum, SND_SOC_NOPM, 0, rx_macro_mux_text); 8154f692926SSrinivas Kandagatla static SOC_ENUM_SINGLE_DECL(rx_macro_rx4_enum, SND_SOC_NOPM, 0, rx_macro_mux_text); 8164f692926SSrinivas Kandagatla static SOC_ENUM_SINGLE_DECL(rx_macro_rx5_enum, SND_SOC_NOPM, 0, rx_macro_mux_text); 8174f692926SSrinivas Kandagatla 8184f692926SSrinivas Kandagatla static const struct snd_kcontrol_new rx_mix_tx1_mux = 8194f692926SSrinivas Kandagatla SOC_DAPM_ENUM("RX MIX TX1_MUX Mux", rx_mix_tx1_mux_enum); 8204f692926SSrinivas Kandagatla static const struct snd_kcontrol_new rx_mix_tx2_mux = 8214f692926SSrinivas Kandagatla SOC_DAPM_ENUM("RX MIX TX2_MUX Mux", rx_mix_tx2_mux_enum); 8224f692926SSrinivas Kandagatla static const struct snd_kcontrol_new rx_int0_2_mux = 8234f692926SSrinivas Kandagatla SOC_DAPM_ENUM("rx_int0_2", rx_int0_2_enum); 8244f692926SSrinivas Kandagatla static const struct snd_kcontrol_new rx_int1_2_mux = 8254f692926SSrinivas Kandagatla SOC_DAPM_ENUM("rx_int1_2", rx_int1_2_enum); 8264f692926SSrinivas Kandagatla static const struct snd_kcontrol_new rx_int2_2_mux = 8274f692926SSrinivas Kandagatla SOC_DAPM_ENUM("rx_int2_2", rx_int2_2_enum); 8284f692926SSrinivas Kandagatla static const struct snd_kcontrol_new rx_int0_1_mix_inp0_mux = 8294f692926SSrinivas Kandagatla SOC_DAPM_ENUM("rx_int0_1_mix_inp0", rx_int0_1_mix_inp0_enum); 8304f692926SSrinivas Kandagatla static const struct snd_kcontrol_new rx_int0_1_mix_inp1_mux = 8314f692926SSrinivas Kandagatla SOC_DAPM_ENUM("rx_int0_1_mix_inp1", rx_int0_1_mix_inp1_enum); 8324f692926SSrinivas Kandagatla static const struct snd_kcontrol_new rx_int0_1_mix_inp2_mux = 8334f692926SSrinivas Kandagatla SOC_DAPM_ENUM("rx_int0_1_mix_inp2", rx_int0_1_mix_inp2_enum); 8344f692926SSrinivas Kandagatla static const struct snd_kcontrol_new rx_int1_1_mix_inp0_mux = 8354f692926SSrinivas Kandagatla SOC_DAPM_ENUM("rx_int1_1_mix_inp0", rx_int1_1_mix_inp0_enum); 8364f692926SSrinivas Kandagatla static const struct snd_kcontrol_new rx_int1_1_mix_inp1_mux = 8374f692926SSrinivas Kandagatla SOC_DAPM_ENUM("rx_int1_1_mix_inp1", rx_int1_1_mix_inp1_enum); 8384f692926SSrinivas Kandagatla static const struct snd_kcontrol_new rx_int1_1_mix_inp2_mux = 8394f692926SSrinivas Kandagatla SOC_DAPM_ENUM("rx_int1_1_mix_inp2", rx_int1_1_mix_inp2_enum); 8404f692926SSrinivas Kandagatla static const struct snd_kcontrol_new rx_int2_1_mix_inp0_mux = 8414f692926SSrinivas Kandagatla SOC_DAPM_ENUM("rx_int2_1_mix_inp0", rx_int2_1_mix_inp0_enum); 8424f692926SSrinivas Kandagatla static const struct snd_kcontrol_new rx_int2_1_mix_inp1_mux = 8434f692926SSrinivas Kandagatla SOC_DAPM_ENUM("rx_int2_1_mix_inp1", rx_int2_1_mix_inp1_enum); 8444f692926SSrinivas Kandagatla static const struct snd_kcontrol_new rx_int2_1_mix_inp2_mux = 8454f692926SSrinivas Kandagatla SOC_DAPM_ENUM("rx_int2_1_mix_inp2", rx_int2_1_mix_inp2_enum); 8464f692926SSrinivas Kandagatla static const struct snd_kcontrol_new rx_int0_mix2_inp_mux = 8474f692926SSrinivas Kandagatla SOC_DAPM_ENUM("rx_int0_mix2_inp", rx_int0_mix2_inp_enum); 8484f692926SSrinivas Kandagatla static const struct snd_kcontrol_new rx_int1_mix2_inp_mux = 8494f692926SSrinivas Kandagatla SOC_DAPM_ENUM("rx_int1_mix2_inp", rx_int1_mix2_inp_enum); 8504f692926SSrinivas Kandagatla static const struct snd_kcontrol_new rx_int2_mix2_inp_mux = 8514f692926SSrinivas Kandagatla SOC_DAPM_ENUM("rx_int2_mix2_inp", rx_int2_mix2_inp_enum); 8524f692926SSrinivas Kandagatla static const struct snd_kcontrol_new iir0_inp0_mux = 8534f692926SSrinivas Kandagatla SOC_DAPM_ENUM("iir0_inp0", iir0_inp0_enum); 8544f692926SSrinivas Kandagatla static const struct snd_kcontrol_new iir0_inp1_mux = 8554f692926SSrinivas Kandagatla SOC_DAPM_ENUM("iir0_inp1", iir0_inp1_enum); 8564f692926SSrinivas Kandagatla static const struct snd_kcontrol_new iir0_inp2_mux = 8574f692926SSrinivas Kandagatla SOC_DAPM_ENUM("iir0_inp2", iir0_inp2_enum); 8584f692926SSrinivas Kandagatla static const struct snd_kcontrol_new iir0_inp3_mux = 8594f692926SSrinivas Kandagatla SOC_DAPM_ENUM("iir0_inp3", iir0_inp3_enum); 8604f692926SSrinivas Kandagatla static const struct snd_kcontrol_new iir1_inp0_mux = 8614f692926SSrinivas Kandagatla SOC_DAPM_ENUM("iir1_inp0", iir1_inp0_enum); 8624f692926SSrinivas Kandagatla static const struct snd_kcontrol_new iir1_inp1_mux = 8634f692926SSrinivas Kandagatla SOC_DAPM_ENUM("iir1_inp1", iir1_inp1_enum); 8644f692926SSrinivas Kandagatla static const struct snd_kcontrol_new iir1_inp2_mux = 8654f692926SSrinivas Kandagatla SOC_DAPM_ENUM("iir1_inp2", iir1_inp2_enum); 8664f692926SSrinivas Kandagatla static const struct snd_kcontrol_new iir1_inp3_mux = 8674f692926SSrinivas Kandagatla SOC_DAPM_ENUM("iir1_inp3", iir1_inp3_enum); 8684f692926SSrinivas Kandagatla static const struct snd_kcontrol_new rx_int0_1_interp_mux = 8694f692926SSrinivas Kandagatla SOC_DAPM_ENUM("rx_int0_1_interp", rx_int0_1_interp_enum); 8704f692926SSrinivas Kandagatla static const struct snd_kcontrol_new rx_int1_1_interp_mux = 8714f692926SSrinivas Kandagatla SOC_DAPM_ENUM("rx_int1_1_interp", rx_int1_1_interp_enum); 8724f692926SSrinivas Kandagatla static const struct snd_kcontrol_new rx_int2_1_interp_mux = 8734f692926SSrinivas Kandagatla SOC_DAPM_ENUM("rx_int2_1_interp", rx_int2_1_interp_enum); 8744f692926SSrinivas Kandagatla static const struct snd_kcontrol_new rx_int0_2_interp_mux = 8754f692926SSrinivas Kandagatla SOC_DAPM_ENUM("rx_int0_2_interp", rx_int0_2_interp_enum); 8764f692926SSrinivas Kandagatla static const struct snd_kcontrol_new rx_int1_2_interp_mux = 8774f692926SSrinivas Kandagatla SOC_DAPM_ENUM("rx_int1_2_interp", rx_int1_2_interp_enum); 8784f692926SSrinivas Kandagatla static const struct snd_kcontrol_new rx_int2_2_interp_mux = 8794f692926SSrinivas Kandagatla SOC_DAPM_ENUM("rx_int2_2_interp", rx_int2_2_interp_enum); 8804f692926SSrinivas Kandagatla static const struct snd_kcontrol_new rx_mix_tx0_mux = 8814f692926SSrinivas Kandagatla SOC_DAPM_ENUM("RX MIX TX0_MUX Mux", rx_mix_tx0_mux_enum); 882af3d54b9SSrinivas Kandagatla 883af3d54b9SSrinivas Kandagatla static const struct reg_default rx_defaults[] = { 884af3d54b9SSrinivas Kandagatla /* RX Macro */ 885af3d54b9SSrinivas Kandagatla { CDC_RX_TOP_TOP_CFG0, 0x00 }, 886af3d54b9SSrinivas Kandagatla { CDC_RX_TOP_SWR_CTRL, 0x00 }, 887af3d54b9SSrinivas Kandagatla { CDC_RX_TOP_DEBUG, 0x00 }, 888af3d54b9SSrinivas Kandagatla { CDC_RX_TOP_DEBUG_BUS, 0x00 }, 889af3d54b9SSrinivas Kandagatla { CDC_RX_TOP_DEBUG_EN0, 0x00 }, 890af3d54b9SSrinivas Kandagatla { CDC_RX_TOP_DEBUG_EN1, 0x00 }, 891af3d54b9SSrinivas Kandagatla { CDC_RX_TOP_DEBUG_EN2, 0x00 }, 892af3d54b9SSrinivas Kandagatla { CDC_RX_TOP_HPHL_COMP_WR_LSB, 0x00 }, 893af3d54b9SSrinivas Kandagatla { CDC_RX_TOP_HPHL_COMP_WR_MSB, 0x00 }, 894af3d54b9SSrinivas Kandagatla { CDC_RX_TOP_HPHL_COMP_LUT, 0x00 }, 895af3d54b9SSrinivas Kandagatla { CDC_RX_TOP_HPHL_COMP_RD_LSB, 0x00 }, 896af3d54b9SSrinivas Kandagatla { CDC_RX_TOP_HPHL_COMP_RD_MSB, 0x00 }, 897af3d54b9SSrinivas Kandagatla { CDC_RX_TOP_HPHR_COMP_WR_LSB, 0x00 }, 898af3d54b9SSrinivas Kandagatla { CDC_RX_TOP_HPHR_COMP_WR_MSB, 0x00 }, 899af3d54b9SSrinivas Kandagatla { CDC_RX_TOP_HPHR_COMP_LUT, 0x00 }, 900af3d54b9SSrinivas Kandagatla { CDC_RX_TOP_HPHR_COMP_RD_LSB, 0x00 }, 901af3d54b9SSrinivas Kandagatla { CDC_RX_TOP_HPHR_COMP_RD_MSB, 0x00 }, 902af3d54b9SSrinivas Kandagatla { CDC_RX_TOP_DSD0_DEBUG_CFG0, 0x11 }, 903af3d54b9SSrinivas Kandagatla { CDC_RX_TOP_DSD0_DEBUG_CFG1, 0x20 }, 904af3d54b9SSrinivas Kandagatla { CDC_RX_TOP_DSD0_DEBUG_CFG2, 0x00 }, 905af3d54b9SSrinivas Kandagatla { CDC_RX_TOP_DSD0_DEBUG_CFG3, 0x00 }, 906af3d54b9SSrinivas Kandagatla { CDC_RX_TOP_DSD1_DEBUG_CFG0, 0x11 }, 907af3d54b9SSrinivas Kandagatla { CDC_RX_TOP_DSD1_DEBUG_CFG1, 0x20 }, 908af3d54b9SSrinivas Kandagatla { CDC_RX_TOP_DSD1_DEBUG_CFG2, 0x00 }, 909af3d54b9SSrinivas Kandagatla { CDC_RX_TOP_DSD1_DEBUG_CFG3, 0x00 }, 910af3d54b9SSrinivas Kandagatla { CDC_RX_TOP_RX_I2S_CTL, 0x0C }, 911af3d54b9SSrinivas Kandagatla { CDC_RX_TOP_TX_I2S2_CTL, 0x0C }, 912af3d54b9SSrinivas Kandagatla { CDC_RX_TOP_I2S_CLK, 0x0C }, 913af3d54b9SSrinivas Kandagatla { CDC_RX_TOP_I2S_RESET, 0x00 }, 914af3d54b9SSrinivas Kandagatla { CDC_RX_TOP_I2S_MUX, 0x00 }, 915af3d54b9SSrinivas Kandagatla { CDC_RX_CLK_RST_CTRL_MCLK_CONTROL, 0x00 }, 916af3d54b9SSrinivas Kandagatla { CDC_RX_CLK_RST_CTRL_FS_CNT_CONTROL, 0x00 }, 917af3d54b9SSrinivas Kandagatla { CDC_RX_CLK_RST_CTRL_SWR_CONTROL, 0x00 }, 918af3d54b9SSrinivas Kandagatla { CDC_RX_CLK_RST_CTRL_DSD_CONTROL, 0x00 }, 919af3d54b9SSrinivas Kandagatla { CDC_RX_CLK_RST_CTRL_ASRC_SHARE_CONTROL, 0x08 }, 920af3d54b9SSrinivas Kandagatla { CDC_RX_SOFTCLIP_CRC, 0x00 }, 921af3d54b9SSrinivas Kandagatla { CDC_RX_SOFTCLIP_SOFTCLIP_CTRL, 0x38 }, 922af3d54b9SSrinivas Kandagatla { CDC_RX_INP_MUX_RX_INT0_CFG0, 0x00 }, 923af3d54b9SSrinivas Kandagatla { CDC_RX_INP_MUX_RX_INT0_CFG1, 0x00 }, 924af3d54b9SSrinivas Kandagatla { CDC_RX_INP_MUX_RX_INT1_CFG0, 0x00 }, 925af3d54b9SSrinivas Kandagatla { CDC_RX_INP_MUX_RX_INT1_CFG1, 0x00 }, 926af3d54b9SSrinivas Kandagatla { CDC_RX_INP_MUX_RX_INT2_CFG0, 0x00 }, 927af3d54b9SSrinivas Kandagatla { CDC_RX_INP_MUX_RX_INT2_CFG1, 0x00 }, 928af3d54b9SSrinivas Kandagatla { CDC_RX_INP_MUX_RX_MIX_CFG4, 0x00 }, 929af3d54b9SSrinivas Kandagatla { CDC_RX_INP_MUX_RX_MIX_CFG5, 0x00 }, 930af3d54b9SSrinivas Kandagatla { CDC_RX_INP_MUX_SIDETONE_SRC_CFG0, 0x00 }, 931af3d54b9SSrinivas Kandagatla { CDC_RX_CLSH_CRC, 0x00 }, 932af3d54b9SSrinivas Kandagatla { CDC_RX_CLSH_DLY_CTRL, 0x03 }, 933af3d54b9SSrinivas Kandagatla { CDC_RX_CLSH_DECAY_CTRL, 0x02 }, 934af3d54b9SSrinivas Kandagatla { CDC_RX_CLSH_HPH_V_PA, 0x1C }, 935af3d54b9SSrinivas Kandagatla { CDC_RX_CLSH_EAR_V_PA, 0x39 }, 936af3d54b9SSrinivas Kandagatla { CDC_RX_CLSH_HPH_V_HD, 0x0C }, 937af3d54b9SSrinivas Kandagatla { CDC_RX_CLSH_EAR_V_HD, 0x0C }, 938af3d54b9SSrinivas Kandagatla { CDC_RX_CLSH_K1_MSB, 0x01 }, 939af3d54b9SSrinivas Kandagatla { CDC_RX_CLSH_K1_LSB, 0x00 }, 940af3d54b9SSrinivas Kandagatla { CDC_RX_CLSH_K2_MSB, 0x00 }, 941af3d54b9SSrinivas Kandagatla { CDC_RX_CLSH_K2_LSB, 0x80 }, 942af3d54b9SSrinivas Kandagatla { CDC_RX_CLSH_IDLE_CTRL, 0x00 }, 943af3d54b9SSrinivas Kandagatla { CDC_RX_CLSH_IDLE_HPH, 0x00 }, 944af3d54b9SSrinivas Kandagatla { CDC_RX_CLSH_IDLE_EAR, 0x00 }, 945af3d54b9SSrinivas Kandagatla { CDC_RX_CLSH_TEST0, 0x07 }, 946af3d54b9SSrinivas Kandagatla { CDC_RX_CLSH_TEST1, 0x00 }, 947af3d54b9SSrinivas Kandagatla { CDC_RX_CLSH_OVR_VREF, 0x00 }, 948af3d54b9SSrinivas Kandagatla { CDC_RX_CLSH_CLSG_CTL, 0x02 }, 949af3d54b9SSrinivas Kandagatla { CDC_RX_CLSH_CLSG_CFG1, 0x9A }, 950af3d54b9SSrinivas Kandagatla { CDC_RX_CLSH_CLSG_CFG2, 0x10 }, 951af3d54b9SSrinivas Kandagatla { CDC_RX_BCL_VBAT_PATH_CTL, 0x00 }, 952af3d54b9SSrinivas Kandagatla { CDC_RX_BCL_VBAT_CFG, 0x10 }, 953af3d54b9SSrinivas Kandagatla { CDC_RX_BCL_VBAT_ADC_CAL1, 0x00 }, 954af3d54b9SSrinivas Kandagatla { CDC_RX_BCL_VBAT_ADC_CAL2, 0x00 }, 955af3d54b9SSrinivas Kandagatla { CDC_RX_BCL_VBAT_ADC_CAL3, 0x04 }, 956af3d54b9SSrinivas Kandagatla { CDC_RX_BCL_VBAT_PK_EST1, 0xE0 }, 957af3d54b9SSrinivas Kandagatla { CDC_RX_BCL_VBAT_PK_EST2, 0x01 }, 958af3d54b9SSrinivas Kandagatla { CDC_RX_BCL_VBAT_PK_EST3, 0x40 }, 959af3d54b9SSrinivas Kandagatla { CDC_RX_BCL_VBAT_RF_PROC1, 0x2A }, 960af3d54b9SSrinivas Kandagatla { CDC_RX_BCL_VBAT_RF_PROC1, 0x00 }, 961af3d54b9SSrinivas Kandagatla { CDC_RX_BCL_VBAT_TAC1, 0x00 }, 962af3d54b9SSrinivas Kandagatla { CDC_RX_BCL_VBAT_TAC2, 0x18 }, 963af3d54b9SSrinivas Kandagatla { CDC_RX_BCL_VBAT_TAC3, 0x18 }, 964af3d54b9SSrinivas Kandagatla { CDC_RX_BCL_VBAT_TAC4, 0x03 }, 965af3d54b9SSrinivas Kandagatla { CDC_RX_BCL_VBAT_GAIN_UPD1, 0x01 }, 966af3d54b9SSrinivas Kandagatla { CDC_RX_BCL_VBAT_GAIN_UPD2, 0x00 }, 967af3d54b9SSrinivas Kandagatla { CDC_RX_BCL_VBAT_GAIN_UPD3, 0x00 }, 968af3d54b9SSrinivas Kandagatla { CDC_RX_BCL_VBAT_GAIN_UPD4, 0x64 }, 969af3d54b9SSrinivas Kandagatla { CDC_RX_BCL_VBAT_GAIN_UPD5, 0x01 }, 970af3d54b9SSrinivas Kandagatla { CDC_RX_BCL_VBAT_DEBUG1, 0x00 }, 971af3d54b9SSrinivas Kandagatla { CDC_RX_BCL_VBAT_GAIN_UPD_MON, 0x00 }, 972af3d54b9SSrinivas Kandagatla { CDC_RX_BCL_VBAT_GAIN_MON_VAL, 0x00 }, 973af3d54b9SSrinivas Kandagatla { CDC_RX_BCL_VBAT_BAN, 0x0C }, 974af3d54b9SSrinivas Kandagatla { CDC_RX_BCL_VBAT_BCL_GAIN_UPD1, 0x00 }, 975af3d54b9SSrinivas Kandagatla { CDC_RX_BCL_VBAT_BCL_GAIN_UPD2, 0x77 }, 976af3d54b9SSrinivas Kandagatla { CDC_RX_BCL_VBAT_BCL_GAIN_UPD3, 0x01 }, 977af3d54b9SSrinivas Kandagatla { CDC_RX_BCL_VBAT_BCL_GAIN_UPD4, 0x00 }, 978af3d54b9SSrinivas Kandagatla { CDC_RX_BCL_VBAT_BCL_GAIN_UPD5, 0x4B }, 979af3d54b9SSrinivas Kandagatla { CDC_RX_BCL_VBAT_BCL_GAIN_UPD6, 0x00 }, 980af3d54b9SSrinivas Kandagatla { CDC_RX_BCL_VBAT_BCL_GAIN_UPD7, 0x01 }, 981af3d54b9SSrinivas Kandagatla { CDC_RX_BCL_VBAT_BCL_GAIN_UPD8, 0x00 }, 982af3d54b9SSrinivas Kandagatla { CDC_RX_BCL_VBAT_BCL_GAIN_UPD9, 0x00 }, 983af3d54b9SSrinivas Kandagatla { CDC_RX_BCL_VBAT_ATTN1, 0x04 }, 984af3d54b9SSrinivas Kandagatla { CDC_RX_BCL_VBAT_ATTN2, 0x08 }, 985af3d54b9SSrinivas Kandagatla { CDC_RX_BCL_VBAT_ATTN3, 0x0C }, 986af3d54b9SSrinivas Kandagatla { CDC_RX_BCL_VBAT_DECODE_CTL1, 0xE0 }, 987af3d54b9SSrinivas Kandagatla { CDC_RX_BCL_VBAT_DECODE_CTL2, 0x00 }, 988af3d54b9SSrinivas Kandagatla { CDC_RX_BCL_VBAT_DECODE_CFG1, 0x00 }, 989af3d54b9SSrinivas Kandagatla { CDC_RX_BCL_VBAT_DECODE_CFG2, 0x00 }, 990af3d54b9SSrinivas Kandagatla { CDC_RX_BCL_VBAT_DECODE_CFG3, 0x00 }, 991af3d54b9SSrinivas Kandagatla { CDC_RX_BCL_VBAT_DECODE_CFG4, 0x00 }, 992af3d54b9SSrinivas Kandagatla { CDC_RX_BCL_VBAT_DECODE_ST, 0x00 }, 993af3d54b9SSrinivas Kandagatla { CDC_RX_INTR_CTRL_CFG, 0x00 }, 994af3d54b9SSrinivas Kandagatla { CDC_RX_INTR_CTRL_CLR_COMMIT, 0x00 }, 995af3d54b9SSrinivas Kandagatla { CDC_RX_INTR_CTRL_PIN1_MASK0, 0xFF }, 996af3d54b9SSrinivas Kandagatla { CDC_RX_INTR_CTRL_PIN1_STATUS0, 0x00 }, 997af3d54b9SSrinivas Kandagatla { CDC_RX_INTR_CTRL_PIN1_CLEAR0, 0x00 }, 998af3d54b9SSrinivas Kandagatla { CDC_RX_INTR_CTRL_PIN2_MASK0, 0xFF }, 999af3d54b9SSrinivas Kandagatla { CDC_RX_INTR_CTRL_PIN2_STATUS0, 0x00 }, 1000af3d54b9SSrinivas Kandagatla { CDC_RX_INTR_CTRL_PIN2_CLEAR0, 0x00 }, 1001af3d54b9SSrinivas Kandagatla { CDC_RX_INTR_CTRL_LEVEL0, 0x00 }, 1002af3d54b9SSrinivas Kandagatla { CDC_RX_INTR_CTRL_BYPASS0, 0x00 }, 1003af3d54b9SSrinivas Kandagatla { CDC_RX_INTR_CTRL_SET0, 0x00 }, 1004af3d54b9SSrinivas Kandagatla { CDC_RX_RX0_RX_PATH_CTL, 0x04 }, 1005af3d54b9SSrinivas Kandagatla { CDC_RX_RX0_RX_PATH_CFG0, 0x00 }, 1006af3d54b9SSrinivas Kandagatla { CDC_RX_RX0_RX_PATH_CFG1, 0x64 }, 1007af3d54b9SSrinivas Kandagatla { CDC_RX_RX0_RX_PATH_CFG2, 0x8F }, 1008af3d54b9SSrinivas Kandagatla { CDC_RX_RX0_RX_PATH_CFG3, 0x00 }, 1009af3d54b9SSrinivas Kandagatla { CDC_RX_RX0_RX_VOL_CTL, 0x00 }, 1010af3d54b9SSrinivas Kandagatla { CDC_RX_RX0_RX_PATH_MIX_CTL, 0x04 }, 1011af3d54b9SSrinivas Kandagatla { CDC_RX_RX0_RX_PATH_MIX_CFG, 0x7E }, 1012af3d54b9SSrinivas Kandagatla { CDC_RX_RX0_RX_VOL_MIX_CTL, 0x00 }, 1013af3d54b9SSrinivas Kandagatla { CDC_RX_RX0_RX_PATH_SEC1, 0x08 }, 1014af3d54b9SSrinivas Kandagatla { CDC_RX_RX0_RX_PATH_SEC2, 0x00 }, 1015af3d54b9SSrinivas Kandagatla { CDC_RX_RX0_RX_PATH_SEC3, 0x00 }, 1016af3d54b9SSrinivas Kandagatla { CDC_RX_RX0_RX_PATH_SEC4, 0x00 }, 1017af3d54b9SSrinivas Kandagatla { CDC_RX_RX0_RX_PATH_SEC7, 0x00 }, 1018af3d54b9SSrinivas Kandagatla { CDC_RX_RX0_RX_PATH_MIX_SEC0, 0x08 }, 1019af3d54b9SSrinivas Kandagatla { CDC_RX_RX0_RX_PATH_MIX_SEC1, 0x00 }, 1020af3d54b9SSrinivas Kandagatla { CDC_RX_RX0_RX_PATH_DSM_CTL, 0x08 }, 1021af3d54b9SSrinivas Kandagatla { CDC_RX_RX0_RX_PATH_DSM_DATA1, 0x00 }, 1022af3d54b9SSrinivas Kandagatla { CDC_RX_RX0_RX_PATH_DSM_DATA2, 0x00 }, 1023af3d54b9SSrinivas Kandagatla { CDC_RX_RX0_RX_PATH_DSM_DATA3, 0x00 }, 1024af3d54b9SSrinivas Kandagatla { CDC_RX_RX0_RX_PATH_DSM_DATA4, 0x55 }, 1025af3d54b9SSrinivas Kandagatla { CDC_RX_RX0_RX_PATH_DSM_DATA5, 0x55 }, 1026af3d54b9SSrinivas Kandagatla { CDC_RX_RX0_RX_PATH_DSM_DATA6, 0x55 }, 1027af3d54b9SSrinivas Kandagatla { CDC_RX_IDLE_DETECT_PATH_CTL, 0x00 }, 1028af3d54b9SSrinivas Kandagatla { CDC_RX_IDLE_DETECT_CFG0, 0x07 }, 1029af3d54b9SSrinivas Kandagatla { CDC_RX_IDLE_DETECT_CFG1, 0x3C }, 1030af3d54b9SSrinivas Kandagatla { CDC_RX_IDLE_DETECT_CFG2, 0x00 }, 1031af3d54b9SSrinivas Kandagatla { CDC_RX_IDLE_DETECT_CFG3, 0x00 }, 1032af3d54b9SSrinivas Kandagatla { CDC_RX_COMPANDER0_CTL0, 0x60 }, 1033af3d54b9SSrinivas Kandagatla { CDC_RX_COMPANDER0_CTL1, 0xDB }, 1034af3d54b9SSrinivas Kandagatla { CDC_RX_COMPANDER0_CTL2, 0xFF }, 1035af3d54b9SSrinivas Kandagatla { CDC_RX_COMPANDER0_CTL3, 0x35 }, 1036af3d54b9SSrinivas Kandagatla { CDC_RX_COMPANDER0_CTL4, 0xFF }, 1037af3d54b9SSrinivas Kandagatla { CDC_RX_COMPANDER0_CTL5, 0x00 }, 1038af3d54b9SSrinivas Kandagatla { CDC_RX_COMPANDER0_CTL6, 0x01 }, 1039af3d54b9SSrinivas Kandagatla { CDC_RX_COMPANDER0_CTL7, 0x28 }, 1040af3d54b9SSrinivas Kandagatla { CDC_RX_COMPANDER1_CTL0, 0x60 }, 1041af3d54b9SSrinivas Kandagatla { CDC_RX_COMPANDER1_CTL1, 0xDB }, 1042af3d54b9SSrinivas Kandagatla { CDC_RX_COMPANDER1_CTL2, 0xFF }, 1043af3d54b9SSrinivas Kandagatla { CDC_RX_COMPANDER1_CTL3, 0x35 }, 1044af3d54b9SSrinivas Kandagatla { CDC_RX_COMPANDER1_CTL4, 0xFF }, 1045af3d54b9SSrinivas Kandagatla { CDC_RX_COMPANDER1_CTL5, 0x00 }, 1046af3d54b9SSrinivas Kandagatla { CDC_RX_COMPANDER1_CTL6, 0x01 }, 1047af3d54b9SSrinivas Kandagatla { CDC_RX_COMPANDER1_CTL7, 0x28 }, 1048af3d54b9SSrinivas Kandagatla { CDC_RX_SIDETONE_IIR0_IIR_PATH_CTL, 0x00 }, 1049af3d54b9SSrinivas Kandagatla { CDC_RX_SIDETONE_IIR0_IIR_GAIN_B1_CTL, 0x00 }, 1050af3d54b9SSrinivas Kandagatla { CDC_RX_SIDETONE_IIR0_IIR_GAIN_B2_CTL, 0x00 }, 1051af3d54b9SSrinivas Kandagatla { CDC_RX_SIDETONE_IIR0_IIR_GAIN_B3_CTL, 0x00 }, 1052af3d54b9SSrinivas Kandagatla { CDC_RX_SIDETONE_IIR0_IIR_GAIN_B4_CTL, 0x00 }, 1053af3d54b9SSrinivas Kandagatla { CDC_RX_SIDETONE_IIR0_IIR_GAIN_B5_CTL, 0x00 }, 1054af3d54b9SSrinivas Kandagatla { CDC_RX_SIDETONE_IIR0_IIR_GAIN_B6_CTL, 0x00 }, 1055af3d54b9SSrinivas Kandagatla { CDC_RX_SIDETONE_IIR0_IIR_GAIN_B7_CTL, 0x00 }, 1056af3d54b9SSrinivas Kandagatla { CDC_RX_SIDETONE_IIR0_IIR_GAIN_B8_CTL, 0x00 }, 1057af3d54b9SSrinivas Kandagatla { CDC_RX_SIDETONE_IIR0_IIR_CTL, 0x40 }, 1058af3d54b9SSrinivas Kandagatla { CDC_RX_SIDETONE_IIR0_IIR_GAIN_TIMER_CTL, 0x00 }, 1059af3d54b9SSrinivas Kandagatla { CDC_RX_SIDETONE_IIR0_IIR_COEF_B1_CTL, 0x00 }, 1060af3d54b9SSrinivas Kandagatla { CDC_RX_SIDETONE_IIR0_IIR_COEF_B2_CTL, 0x00 }, 1061af3d54b9SSrinivas Kandagatla { CDC_RX_SIDETONE_IIR1_IIR_PATH_CTL, 0x00 }, 1062af3d54b9SSrinivas Kandagatla { CDC_RX_SIDETONE_IIR1_IIR_GAIN_B1_CTL, 0x00 }, 1063af3d54b9SSrinivas Kandagatla { CDC_RX_SIDETONE_IIR1_IIR_GAIN_B2_CTL, 0x00 }, 1064af3d54b9SSrinivas Kandagatla { CDC_RX_SIDETONE_IIR1_IIR_GAIN_B3_CTL, 0x00 }, 1065af3d54b9SSrinivas Kandagatla { CDC_RX_SIDETONE_IIR1_IIR_GAIN_B4_CTL, 0x00 }, 1066af3d54b9SSrinivas Kandagatla { CDC_RX_SIDETONE_IIR1_IIR_GAIN_B5_CTL, 0x00 }, 1067af3d54b9SSrinivas Kandagatla { CDC_RX_SIDETONE_IIR1_IIR_GAIN_B6_CTL, 0x00 }, 1068af3d54b9SSrinivas Kandagatla { CDC_RX_SIDETONE_IIR1_IIR_GAIN_B7_CTL, 0x00 }, 1069af3d54b9SSrinivas Kandagatla { CDC_RX_SIDETONE_IIR1_IIR_GAIN_B8_CTL, 0x00 }, 1070af3d54b9SSrinivas Kandagatla { CDC_RX_SIDETONE_IIR1_IIR_CTL, 0x40 }, 1071af3d54b9SSrinivas Kandagatla { CDC_RX_SIDETONE_IIR1_IIR_GAIN_TIMER_CTL, 0x00 }, 1072af3d54b9SSrinivas Kandagatla { CDC_RX_SIDETONE_IIR1_IIR_COEF_B1_CTL, 0x00 }, 1073af3d54b9SSrinivas Kandagatla { CDC_RX_SIDETONE_IIR1_IIR_COEF_B2_CTL, 0x00 }, 1074af3d54b9SSrinivas Kandagatla { CDC_RX_IIR_INP_MUX_IIR0_MIX_CFG0, 0x00 }, 1075af3d54b9SSrinivas Kandagatla { CDC_RX_IIR_INP_MUX_IIR0_MIX_CFG1, 0x00 }, 1076af3d54b9SSrinivas Kandagatla { CDC_RX_IIR_INP_MUX_IIR0_MIX_CFG2, 0x00 }, 1077af3d54b9SSrinivas Kandagatla { CDC_RX_IIR_INP_MUX_IIR0_MIX_CFG3, 0x00 }, 1078af3d54b9SSrinivas Kandagatla { CDC_RX_IIR_INP_MUX_IIR1_MIX_CFG0, 0x00 }, 1079af3d54b9SSrinivas Kandagatla { CDC_RX_IIR_INP_MUX_IIR1_MIX_CFG1, 0x00 }, 1080af3d54b9SSrinivas Kandagatla { CDC_RX_IIR_INP_MUX_IIR1_MIX_CFG2, 0x00 }, 1081af3d54b9SSrinivas Kandagatla { CDC_RX_IIR_INP_MUX_IIR1_MIX_CFG3, 0x00 }, 1082af3d54b9SSrinivas Kandagatla { CDC_RX_SIDETONE_SRC0_ST_SRC_PATH_CTL, 0x04 }, 1083af3d54b9SSrinivas Kandagatla { CDC_RX_SIDETONE_SRC0_ST_SRC_PATH_CFG1, 0x00 }, 1084af3d54b9SSrinivas Kandagatla { CDC_RX_SIDETONE_SRC1_ST_SRC_PATH_CTL, 0x04 }, 1085af3d54b9SSrinivas Kandagatla { CDC_RX_SIDETONE_SRC1_ST_SRC_PATH_CFG1, 0x00 }, 1086af3d54b9SSrinivas Kandagatla { CDC_RX_EC_REF_HQ0_EC_REF_HQ_PATH_CTL, 0x00 }, 1087af3d54b9SSrinivas Kandagatla { CDC_RX_EC_REF_HQ0_EC_REF_HQ_CFG0, 0x01 }, 1088af3d54b9SSrinivas Kandagatla { CDC_RX_EC_REF_HQ1_EC_REF_HQ_PATH_CTL, 0x00 }, 1089af3d54b9SSrinivas Kandagatla { CDC_RX_EC_REF_HQ1_EC_REF_HQ_CFG0, 0x01 }, 1090af3d54b9SSrinivas Kandagatla { CDC_RX_EC_REF_HQ2_EC_REF_HQ_PATH_CTL, 0x00 }, 1091af3d54b9SSrinivas Kandagatla { CDC_RX_EC_REF_HQ2_EC_REF_HQ_CFG0, 0x01 }, 1092af3d54b9SSrinivas Kandagatla { CDC_RX_EC_ASRC0_CLK_RST_CTL, 0x00 }, 1093af3d54b9SSrinivas Kandagatla { CDC_RX_EC_ASRC0_CTL0, 0x00 }, 1094af3d54b9SSrinivas Kandagatla { CDC_RX_EC_ASRC0_CTL1, 0x00 }, 1095af3d54b9SSrinivas Kandagatla { CDC_RX_EC_ASRC0_FIFO_CTL, 0xA8 }, 1096af3d54b9SSrinivas Kandagatla { CDC_RX_EC_ASRC0_STATUS_FMIN_CNTR_LSB, 0x00 }, 1097af3d54b9SSrinivas Kandagatla { CDC_RX_EC_ASRC0_STATUS_FMIN_CNTR_MSB, 0x00 }, 1098af3d54b9SSrinivas Kandagatla { CDC_RX_EC_ASRC0_STATUS_FMAX_CNTR_LSB, 0x00 }, 1099af3d54b9SSrinivas Kandagatla { CDC_RX_EC_ASRC0_STATUS_FMAX_CNTR_MSB, 0x00 }, 1100af3d54b9SSrinivas Kandagatla { CDC_RX_EC_ASRC0_STATUS_FIFO, 0x00 }, 1101af3d54b9SSrinivas Kandagatla { CDC_RX_EC_ASRC1_CLK_RST_CTL, 0x00 }, 1102af3d54b9SSrinivas Kandagatla { CDC_RX_EC_ASRC1_CTL0, 0x00 }, 1103af3d54b9SSrinivas Kandagatla { CDC_RX_EC_ASRC1_CTL1, 0x00 }, 1104af3d54b9SSrinivas Kandagatla { CDC_RX_EC_ASRC1_FIFO_CTL, 0xA8 }, 1105af3d54b9SSrinivas Kandagatla { CDC_RX_EC_ASRC1_STATUS_FMIN_CNTR_LSB, 0x00 }, 1106af3d54b9SSrinivas Kandagatla { CDC_RX_EC_ASRC1_STATUS_FMIN_CNTR_MSB, 0x00 }, 1107af3d54b9SSrinivas Kandagatla { CDC_RX_EC_ASRC1_STATUS_FMAX_CNTR_LSB, 0x00 }, 1108af3d54b9SSrinivas Kandagatla { CDC_RX_EC_ASRC1_STATUS_FMAX_CNTR_MSB, 0x00 }, 1109af3d54b9SSrinivas Kandagatla { CDC_RX_EC_ASRC1_STATUS_FIFO, 0x00 }, 1110af3d54b9SSrinivas Kandagatla { CDC_RX_EC_ASRC2_CLK_RST_CTL, 0x00 }, 1111af3d54b9SSrinivas Kandagatla { CDC_RX_EC_ASRC2_CTL0, 0x00 }, 1112af3d54b9SSrinivas Kandagatla { CDC_RX_EC_ASRC2_CTL1, 0x00 }, 1113af3d54b9SSrinivas Kandagatla { CDC_RX_EC_ASRC2_FIFO_CTL, 0xA8 }, 1114af3d54b9SSrinivas Kandagatla { CDC_RX_EC_ASRC2_STATUS_FMIN_CNTR_LSB, 0x00 }, 1115af3d54b9SSrinivas Kandagatla { CDC_RX_EC_ASRC2_STATUS_FMIN_CNTR_MSB, 0x00 }, 1116af3d54b9SSrinivas Kandagatla { CDC_RX_EC_ASRC2_STATUS_FMAX_CNTR_LSB, 0x00 }, 1117af3d54b9SSrinivas Kandagatla { CDC_RX_EC_ASRC2_STATUS_FMAX_CNTR_MSB, 0x00 }, 1118af3d54b9SSrinivas Kandagatla { CDC_RX_EC_ASRC2_STATUS_FIFO, 0x00 }, 1119af3d54b9SSrinivas Kandagatla { CDC_RX_DSD0_PATH_CTL, 0x00 }, 1120af3d54b9SSrinivas Kandagatla { CDC_RX_DSD0_CFG0, 0x00 }, 1121af3d54b9SSrinivas Kandagatla { CDC_RX_DSD0_CFG1, 0x62 }, 1122af3d54b9SSrinivas Kandagatla { CDC_RX_DSD0_CFG2, 0x96 }, 1123af3d54b9SSrinivas Kandagatla { CDC_RX_DSD1_PATH_CTL, 0x00 }, 1124af3d54b9SSrinivas Kandagatla { CDC_RX_DSD1_CFG0, 0x00 }, 1125af3d54b9SSrinivas Kandagatla { CDC_RX_DSD1_CFG1, 0x62 }, 1126af3d54b9SSrinivas Kandagatla { CDC_RX_DSD1_CFG2, 0x96 }, 1127af3d54b9SSrinivas Kandagatla }; 1128af3d54b9SSrinivas Kandagatla 1129432e5074SSrinivas Kandagatla static const struct reg_default rx_2_5_defaults[] = { 1130432e5074SSrinivas Kandagatla { CDC_2_5_RX_RX1_RX_PATH_CTL, 0x04 }, 1131432e5074SSrinivas Kandagatla { CDC_2_5_RX_RX1_RX_PATH_CFG0, 0x00 }, 1132432e5074SSrinivas Kandagatla { CDC_2_5_RX_RX1_RX_PATH_CFG1, 0x64 }, 1133432e5074SSrinivas Kandagatla { CDC_2_5_RX_RX1_RX_PATH_CFG2, 0x8F }, 1134432e5074SSrinivas Kandagatla { CDC_2_5_RX_RX1_RX_PATH_CFG3, 0x00 }, 1135432e5074SSrinivas Kandagatla { CDC_2_5_RX_RX1_RX_VOL_CTL, 0x00 }, 1136432e5074SSrinivas Kandagatla { CDC_2_5_RX_RX1_RX_PATH_MIX_CTL, 0x04 }, 1137432e5074SSrinivas Kandagatla { CDC_2_5_RX_RX1_RX_PATH_MIX_CFG, 0x7E }, 1138432e5074SSrinivas Kandagatla { CDC_2_5_RX_RX1_RX_VOL_MIX_CTL, 0x00 }, 1139432e5074SSrinivas Kandagatla { CDC_2_5_RX_RX1_RX_PATH_SEC1, 0x08 }, 1140432e5074SSrinivas Kandagatla { CDC_2_5_RX_RX1_RX_PATH_SEC2, 0x00 }, 1141432e5074SSrinivas Kandagatla { CDC_2_5_RX_RX1_RX_PATH_SEC3, 0x00 }, 1142432e5074SSrinivas Kandagatla { CDC_2_5_RX_RX1_RX_PATH_SEC4, 0x00 }, 1143432e5074SSrinivas Kandagatla { CDC_2_5_RX_RX1_RX_PATH_SEC7, 0x00 }, 1144432e5074SSrinivas Kandagatla { CDC_2_5_RX_RX1_RX_PATH_MIX_SEC0, 0x08 }, 1145432e5074SSrinivas Kandagatla { CDC_2_5_RX_RX1_RX_PATH_MIX_SEC1, 0x00 }, 1146432e5074SSrinivas Kandagatla { CDC_2_5_RX_RX1_RX_PATH_DSM_CTL, 0x08 }, 1147432e5074SSrinivas Kandagatla { CDC_2_5_RX_RX1_RX_PATH_DSM_DATA1, 0x00 }, 1148432e5074SSrinivas Kandagatla { CDC_2_5_RX_RX1_RX_PATH_DSM_DATA2, 0x00 }, 1149432e5074SSrinivas Kandagatla { CDC_2_5_RX_RX1_RX_PATH_DSM_DATA3, 0x00 }, 1150432e5074SSrinivas Kandagatla { CDC_2_5_RX_RX1_RX_PATH_DSM_DATA4, 0x55 }, 1151432e5074SSrinivas Kandagatla { CDC_2_5_RX_RX1_RX_PATH_DSM_DATA5, 0x55 }, 1152432e5074SSrinivas Kandagatla { CDC_2_5_RX_RX1_RX_PATH_DSM_DATA6, 0x55 }, 1153432e5074SSrinivas Kandagatla { CDC_2_5_RX_RX2_RX_PATH_CTL, 0x04 }, 1154432e5074SSrinivas Kandagatla { CDC_2_5_RX_RX2_RX_PATH_CFG0, 0x00 }, 1155432e5074SSrinivas Kandagatla { CDC_2_5_RX_RX2_RX_PATH_CFG1, 0x64 }, 1156432e5074SSrinivas Kandagatla { CDC_2_5_RX_RX2_RX_PATH_CFG2, 0x8F }, 1157432e5074SSrinivas Kandagatla { CDC_2_5_RX_RX2_RX_PATH_CFG3, 0x00 }, 1158432e5074SSrinivas Kandagatla { CDC_2_5_RX_RX2_RX_VOL_CTL, 0x00 }, 1159432e5074SSrinivas Kandagatla { CDC_2_5_RX_RX2_RX_PATH_MIX_CTL, 0x04 }, 1160432e5074SSrinivas Kandagatla { CDC_2_5_RX_RX2_RX_PATH_MIX_CFG, 0x7E }, 1161432e5074SSrinivas Kandagatla { CDC_2_5_RX_RX2_RX_VOL_MIX_CTL, 0x00 }, 1162432e5074SSrinivas Kandagatla { CDC_2_5_RX_RX2_RX_PATH_SEC0, 0x04 }, 1163432e5074SSrinivas Kandagatla { CDC_2_5_RX_RX2_RX_PATH_SEC1, 0x08 }, 1164432e5074SSrinivas Kandagatla { CDC_2_5_RX_RX2_RX_PATH_SEC2, 0x00 }, 1165432e5074SSrinivas Kandagatla { CDC_2_5_RX_RX2_RX_PATH_SEC3, 0x00 }, 1166432e5074SSrinivas Kandagatla { CDC_2_5_RX_RX2_RX_PATH_SEC4, 0x00 }, 1167432e5074SSrinivas Kandagatla { CDC_2_5_RX_RX2_RX_PATH_SEC5, 0x00 }, 1168432e5074SSrinivas Kandagatla { CDC_2_5_RX_RX2_RX_PATH_SEC6, 0x00 }, 1169432e5074SSrinivas Kandagatla { CDC_2_5_RX_RX2_RX_PATH_SEC7, 0x00 }, 1170432e5074SSrinivas Kandagatla { CDC_2_5_RX_RX2_RX_PATH_MIX_SEC0, 0x08 }, 1171432e5074SSrinivas Kandagatla { CDC_2_5_RX_RX2_RX_PATH_MIX_SEC1, 0x00 }, 1172432e5074SSrinivas Kandagatla { CDC_2_5_RX_RX2_RX_PATH_DSM_CTL, 0x00 }, 1173432e5074SSrinivas Kandagatla }; 1174432e5074SSrinivas Kandagatla 1175dbacef05SSrinivas Kandagatla static const struct reg_default rx_pre_2_5_defaults[] = { 1176dbacef05SSrinivas Kandagatla { CDC_RX_RX1_RX_PATH_CTL, 0x04 }, 1177dbacef05SSrinivas Kandagatla { CDC_RX_RX1_RX_PATH_CFG0, 0x00 }, 1178dbacef05SSrinivas Kandagatla { CDC_RX_RX1_RX_PATH_CFG1, 0x64 }, 1179dbacef05SSrinivas Kandagatla { CDC_RX_RX1_RX_PATH_CFG2, 0x8F }, 1180dbacef05SSrinivas Kandagatla { CDC_RX_RX1_RX_PATH_CFG3, 0x00 }, 1181dbacef05SSrinivas Kandagatla { CDC_RX_RX1_RX_VOL_CTL, 0x00 }, 1182dbacef05SSrinivas Kandagatla { CDC_RX_RX1_RX_PATH_MIX_CTL, 0x04 }, 1183dbacef05SSrinivas Kandagatla { CDC_RX_RX1_RX_PATH_MIX_CFG, 0x7E }, 1184dbacef05SSrinivas Kandagatla { CDC_RX_RX1_RX_VOL_MIX_CTL, 0x00 }, 1185dbacef05SSrinivas Kandagatla { CDC_RX_RX1_RX_PATH_SEC1, 0x08 }, 1186dbacef05SSrinivas Kandagatla { CDC_RX_RX1_RX_PATH_SEC2, 0x00 }, 1187dbacef05SSrinivas Kandagatla { CDC_RX_RX1_RX_PATH_SEC3, 0x00 }, 1188dbacef05SSrinivas Kandagatla { CDC_RX_RX1_RX_PATH_SEC4, 0x00 }, 1189dbacef05SSrinivas Kandagatla { CDC_RX_RX1_RX_PATH_SEC7, 0x00 }, 1190dbacef05SSrinivas Kandagatla { CDC_RX_RX1_RX_PATH_MIX_SEC0, 0x08 }, 1191dbacef05SSrinivas Kandagatla { CDC_RX_RX1_RX_PATH_MIX_SEC1, 0x00 }, 1192dbacef05SSrinivas Kandagatla { CDC_RX_RX1_RX_PATH_DSM_CTL, 0x08 }, 1193dbacef05SSrinivas Kandagatla { CDC_RX_RX1_RX_PATH_DSM_DATA1, 0x00 }, 1194dbacef05SSrinivas Kandagatla { CDC_RX_RX1_RX_PATH_DSM_DATA2, 0x00 }, 1195dbacef05SSrinivas Kandagatla { CDC_RX_RX1_RX_PATH_DSM_DATA3, 0x00 }, 1196dbacef05SSrinivas Kandagatla { CDC_RX_RX1_RX_PATH_DSM_DATA4, 0x55 }, 1197dbacef05SSrinivas Kandagatla { CDC_RX_RX1_RX_PATH_DSM_DATA5, 0x55 }, 1198dbacef05SSrinivas Kandagatla { CDC_RX_RX1_RX_PATH_DSM_DATA6, 0x55 }, 1199dbacef05SSrinivas Kandagatla { CDC_RX_RX2_RX_PATH_CTL, 0x04 }, 1200dbacef05SSrinivas Kandagatla { CDC_RX_RX2_RX_PATH_CFG0, 0x00 }, 1201dbacef05SSrinivas Kandagatla { CDC_RX_RX2_RX_PATH_CFG1, 0x64 }, 1202dbacef05SSrinivas Kandagatla { CDC_RX_RX2_RX_PATH_CFG2, 0x8F }, 1203dbacef05SSrinivas Kandagatla { CDC_RX_RX2_RX_PATH_CFG3, 0x00 }, 1204dbacef05SSrinivas Kandagatla { CDC_RX_RX2_RX_VOL_CTL, 0x00 }, 1205dbacef05SSrinivas Kandagatla { CDC_RX_RX2_RX_PATH_MIX_CTL, 0x04 }, 1206dbacef05SSrinivas Kandagatla { CDC_RX_RX2_RX_PATH_MIX_CFG, 0x7E }, 1207dbacef05SSrinivas Kandagatla { CDC_RX_RX2_RX_VOL_MIX_CTL, 0x00 }, 1208dbacef05SSrinivas Kandagatla { CDC_RX_RX2_RX_PATH_SEC0, 0x04 }, 1209dbacef05SSrinivas Kandagatla { CDC_RX_RX2_RX_PATH_SEC1, 0x08 }, 1210dbacef05SSrinivas Kandagatla { CDC_RX_RX2_RX_PATH_SEC2, 0x00 }, 1211dbacef05SSrinivas Kandagatla { CDC_RX_RX2_RX_PATH_SEC3, 0x00 }, 1212dbacef05SSrinivas Kandagatla { CDC_RX_RX2_RX_PATH_SEC4, 0x00 }, 1213dbacef05SSrinivas Kandagatla { CDC_RX_RX2_RX_PATH_SEC5, 0x00 }, 1214dbacef05SSrinivas Kandagatla { CDC_RX_RX2_RX_PATH_SEC6, 0x00 }, 1215dbacef05SSrinivas Kandagatla { CDC_RX_RX2_RX_PATH_SEC7, 0x00 }, 1216dbacef05SSrinivas Kandagatla { CDC_RX_RX2_RX_PATH_MIX_SEC0, 0x08 }, 1217dbacef05SSrinivas Kandagatla { CDC_RX_RX2_RX_PATH_MIX_SEC1, 0x00 }, 1218dbacef05SSrinivas Kandagatla { CDC_RX_RX2_RX_PATH_DSM_CTL, 0x00 }, 1219dbacef05SSrinivas Kandagatla 1220dbacef05SSrinivas Kandagatla }; 1221dbacef05SSrinivas Kandagatla 1222af3d54b9SSrinivas Kandagatla static bool rx_is_wronly_register(struct device *dev, 1223af3d54b9SSrinivas Kandagatla unsigned int reg) 1224af3d54b9SSrinivas Kandagatla { 1225af3d54b9SSrinivas Kandagatla switch (reg) { 1226af3d54b9SSrinivas Kandagatla case CDC_RX_BCL_VBAT_GAIN_UPD_MON: 1227af3d54b9SSrinivas Kandagatla case CDC_RX_INTR_CTRL_CLR_COMMIT: 1228af3d54b9SSrinivas Kandagatla case CDC_RX_INTR_CTRL_PIN1_CLEAR0: 1229af3d54b9SSrinivas Kandagatla case CDC_RX_INTR_CTRL_PIN2_CLEAR0: 1230af3d54b9SSrinivas Kandagatla return true; 1231af3d54b9SSrinivas Kandagatla } 1232af3d54b9SSrinivas Kandagatla 1233af3d54b9SSrinivas Kandagatla return false; 1234af3d54b9SSrinivas Kandagatla } 1235af3d54b9SSrinivas Kandagatla 1236af3d54b9SSrinivas Kandagatla static bool rx_is_volatile_register(struct device *dev, unsigned int reg) 1237af3d54b9SSrinivas Kandagatla { 1238af3d54b9SSrinivas Kandagatla /* Update volatile list for rx/tx macros */ 1239af3d54b9SSrinivas Kandagatla switch (reg) { 1240af3d54b9SSrinivas Kandagatla case CDC_RX_TOP_HPHL_COMP_RD_LSB: 1241af3d54b9SSrinivas Kandagatla case CDC_RX_TOP_HPHL_COMP_WR_LSB: 1242af3d54b9SSrinivas Kandagatla case CDC_RX_TOP_HPHL_COMP_RD_MSB: 1243af3d54b9SSrinivas Kandagatla case CDC_RX_TOP_HPHL_COMP_WR_MSB: 1244af3d54b9SSrinivas Kandagatla case CDC_RX_TOP_HPHR_COMP_RD_LSB: 1245af3d54b9SSrinivas Kandagatla case CDC_RX_TOP_HPHR_COMP_WR_LSB: 1246af3d54b9SSrinivas Kandagatla case CDC_RX_TOP_HPHR_COMP_RD_MSB: 1247af3d54b9SSrinivas Kandagatla case CDC_RX_TOP_HPHR_COMP_WR_MSB: 1248af3d54b9SSrinivas Kandagatla case CDC_RX_TOP_DSD0_DEBUG_CFG2: 1249af3d54b9SSrinivas Kandagatla case CDC_RX_TOP_DSD1_DEBUG_CFG2: 1250af3d54b9SSrinivas Kandagatla case CDC_RX_BCL_VBAT_GAIN_MON_VAL: 1251af3d54b9SSrinivas Kandagatla case CDC_RX_BCL_VBAT_DECODE_ST: 1252af3d54b9SSrinivas Kandagatla case CDC_RX_INTR_CTRL_PIN1_STATUS0: 1253af3d54b9SSrinivas Kandagatla case CDC_RX_INTR_CTRL_PIN2_STATUS0: 1254af3d54b9SSrinivas Kandagatla case CDC_RX_COMPANDER0_CTL6: 1255af3d54b9SSrinivas Kandagatla case CDC_RX_COMPANDER1_CTL6: 1256af3d54b9SSrinivas Kandagatla case CDC_RX_EC_ASRC0_STATUS_FMIN_CNTR_LSB: 1257af3d54b9SSrinivas Kandagatla case CDC_RX_EC_ASRC0_STATUS_FMIN_CNTR_MSB: 1258af3d54b9SSrinivas Kandagatla case CDC_RX_EC_ASRC0_STATUS_FMAX_CNTR_LSB: 1259af3d54b9SSrinivas Kandagatla case CDC_RX_EC_ASRC0_STATUS_FMAX_CNTR_MSB: 1260af3d54b9SSrinivas Kandagatla case CDC_RX_EC_ASRC0_STATUS_FIFO: 1261af3d54b9SSrinivas Kandagatla case CDC_RX_EC_ASRC1_STATUS_FMIN_CNTR_LSB: 1262af3d54b9SSrinivas Kandagatla case CDC_RX_EC_ASRC1_STATUS_FMIN_CNTR_MSB: 1263af3d54b9SSrinivas Kandagatla case CDC_RX_EC_ASRC1_STATUS_FMAX_CNTR_LSB: 1264af3d54b9SSrinivas Kandagatla case CDC_RX_EC_ASRC1_STATUS_FMAX_CNTR_MSB: 1265af3d54b9SSrinivas Kandagatla case CDC_RX_EC_ASRC1_STATUS_FIFO: 1266af3d54b9SSrinivas Kandagatla case CDC_RX_EC_ASRC2_STATUS_FMIN_CNTR_LSB: 1267af3d54b9SSrinivas Kandagatla case CDC_RX_EC_ASRC2_STATUS_FMIN_CNTR_MSB: 1268af3d54b9SSrinivas Kandagatla case CDC_RX_EC_ASRC2_STATUS_FMAX_CNTR_LSB: 1269af3d54b9SSrinivas Kandagatla case CDC_RX_EC_ASRC2_STATUS_FMAX_CNTR_MSB: 1270af3d54b9SSrinivas Kandagatla case CDC_RX_EC_ASRC2_STATUS_FIFO: 1271af3d54b9SSrinivas Kandagatla return true; 1272af3d54b9SSrinivas Kandagatla } 1273af3d54b9SSrinivas Kandagatla return false; 1274af3d54b9SSrinivas Kandagatla } 1275af3d54b9SSrinivas Kandagatla 1276dbacef05SSrinivas Kandagatla static bool rx_pre_2_5_is_rw_register(struct device *dev, unsigned int reg) 1277dbacef05SSrinivas Kandagatla { 1278dbacef05SSrinivas Kandagatla switch (reg) { 1279dbacef05SSrinivas Kandagatla case CDC_RX_RX1_RX_PATH_CTL: 1280dbacef05SSrinivas Kandagatla case CDC_RX_RX1_RX_PATH_CFG0: 1281dbacef05SSrinivas Kandagatla case CDC_RX_RX1_RX_PATH_CFG1: 1282dbacef05SSrinivas Kandagatla case CDC_RX_RX1_RX_PATH_CFG2: 1283dbacef05SSrinivas Kandagatla case CDC_RX_RX1_RX_PATH_CFG3: 1284dbacef05SSrinivas Kandagatla case CDC_RX_RX1_RX_VOL_CTL: 1285dbacef05SSrinivas Kandagatla case CDC_RX_RX1_RX_PATH_MIX_CTL: 1286dbacef05SSrinivas Kandagatla case CDC_RX_RX1_RX_PATH_MIX_CFG: 1287dbacef05SSrinivas Kandagatla case CDC_RX_RX1_RX_VOL_MIX_CTL: 1288dbacef05SSrinivas Kandagatla case CDC_RX_RX1_RX_PATH_SEC1: 1289dbacef05SSrinivas Kandagatla case CDC_RX_RX1_RX_PATH_SEC2: 1290dbacef05SSrinivas Kandagatla case CDC_RX_RX1_RX_PATH_SEC3: 1291dbacef05SSrinivas Kandagatla case CDC_RX_RX1_RX_PATH_SEC4: 1292dbacef05SSrinivas Kandagatla case CDC_RX_RX1_RX_PATH_SEC7: 1293dbacef05SSrinivas Kandagatla case CDC_RX_RX1_RX_PATH_MIX_SEC0: 1294dbacef05SSrinivas Kandagatla case CDC_RX_RX1_RX_PATH_MIX_SEC1: 1295dbacef05SSrinivas Kandagatla case CDC_RX_RX1_RX_PATH_DSM_CTL: 1296dbacef05SSrinivas Kandagatla case CDC_RX_RX1_RX_PATH_DSM_DATA1: 1297dbacef05SSrinivas Kandagatla case CDC_RX_RX1_RX_PATH_DSM_DATA2: 1298dbacef05SSrinivas Kandagatla case CDC_RX_RX1_RX_PATH_DSM_DATA3: 1299dbacef05SSrinivas Kandagatla case CDC_RX_RX1_RX_PATH_DSM_DATA4: 1300dbacef05SSrinivas Kandagatla case CDC_RX_RX1_RX_PATH_DSM_DATA5: 1301dbacef05SSrinivas Kandagatla case CDC_RX_RX1_RX_PATH_DSM_DATA6: 1302dbacef05SSrinivas Kandagatla case CDC_RX_RX2_RX_PATH_CTL: 1303dbacef05SSrinivas Kandagatla case CDC_RX_RX2_RX_PATH_CFG0: 1304dbacef05SSrinivas Kandagatla case CDC_RX_RX2_RX_PATH_CFG1: 1305dbacef05SSrinivas Kandagatla case CDC_RX_RX2_RX_PATH_CFG2: 1306dbacef05SSrinivas Kandagatla case CDC_RX_RX2_RX_PATH_CFG3: 1307dbacef05SSrinivas Kandagatla case CDC_RX_RX2_RX_VOL_CTL: 1308dbacef05SSrinivas Kandagatla case CDC_RX_RX2_RX_PATH_MIX_CTL: 1309dbacef05SSrinivas Kandagatla case CDC_RX_RX2_RX_PATH_MIX_CFG: 1310dbacef05SSrinivas Kandagatla case CDC_RX_RX2_RX_VOL_MIX_CTL: 1311dbacef05SSrinivas Kandagatla case CDC_RX_RX2_RX_PATH_SEC0: 1312dbacef05SSrinivas Kandagatla case CDC_RX_RX2_RX_PATH_SEC1: 1313dbacef05SSrinivas Kandagatla case CDC_RX_RX2_RX_PATH_SEC2: 1314dbacef05SSrinivas Kandagatla case CDC_RX_RX2_RX_PATH_SEC3: 1315dbacef05SSrinivas Kandagatla case CDC_RX_RX2_RX_PATH_SEC4: 1316dbacef05SSrinivas Kandagatla case CDC_RX_RX2_RX_PATH_SEC5: 1317dbacef05SSrinivas Kandagatla case CDC_RX_RX2_RX_PATH_SEC6: 1318dbacef05SSrinivas Kandagatla case CDC_RX_RX2_RX_PATH_SEC7: 1319dbacef05SSrinivas Kandagatla case CDC_RX_RX2_RX_PATH_MIX_SEC0: 1320dbacef05SSrinivas Kandagatla case CDC_RX_RX2_RX_PATH_MIX_SEC1: 1321dbacef05SSrinivas Kandagatla case CDC_RX_RX2_RX_PATH_DSM_CTL: 1322dbacef05SSrinivas Kandagatla return true; 1323dbacef05SSrinivas Kandagatla } 1324dbacef05SSrinivas Kandagatla 1325dbacef05SSrinivas Kandagatla return false; 1326dbacef05SSrinivas Kandagatla } 1327dbacef05SSrinivas Kandagatla 1328432e5074SSrinivas Kandagatla static bool rx_2_5_is_rw_register(struct device *dev, unsigned int reg) 1329432e5074SSrinivas Kandagatla { 1330432e5074SSrinivas Kandagatla switch (reg) { 1331432e5074SSrinivas Kandagatla case CDC_2_5_RX_RX1_RX_PATH_CTL: 1332432e5074SSrinivas Kandagatla case CDC_2_5_RX_RX1_RX_PATH_CFG0: 1333432e5074SSrinivas Kandagatla case CDC_2_5_RX_RX1_RX_PATH_CFG1: 1334432e5074SSrinivas Kandagatla case CDC_2_5_RX_RX1_RX_PATH_CFG2: 1335432e5074SSrinivas Kandagatla case CDC_2_5_RX_RX1_RX_PATH_CFG3: 1336432e5074SSrinivas Kandagatla case CDC_2_5_RX_RX1_RX_VOL_CTL: 1337432e5074SSrinivas Kandagatla case CDC_2_5_RX_RX1_RX_PATH_MIX_CTL: 1338432e5074SSrinivas Kandagatla case CDC_2_5_RX_RX1_RX_PATH_MIX_CFG: 1339432e5074SSrinivas Kandagatla case CDC_2_5_RX_RX1_RX_VOL_MIX_CTL: 1340432e5074SSrinivas Kandagatla case CDC_2_5_RX_RX1_RX_PATH_SEC1: 1341432e5074SSrinivas Kandagatla case CDC_2_5_RX_RX1_RX_PATH_SEC2: 1342432e5074SSrinivas Kandagatla case CDC_2_5_RX_RX1_RX_PATH_SEC3: 1343432e5074SSrinivas Kandagatla case CDC_2_5_RX_RX1_RX_PATH_SEC4: 1344432e5074SSrinivas Kandagatla case CDC_2_5_RX_RX1_RX_PATH_SEC7: 1345432e5074SSrinivas Kandagatla case CDC_2_5_RX_RX1_RX_PATH_MIX_SEC0: 1346432e5074SSrinivas Kandagatla case CDC_2_5_RX_RX1_RX_PATH_MIX_SEC1: 1347432e5074SSrinivas Kandagatla case CDC_2_5_RX_RX1_RX_PATH_DSM_CTL: 1348432e5074SSrinivas Kandagatla case CDC_2_5_RX_RX1_RX_PATH_DSM_DATA1: 1349432e5074SSrinivas Kandagatla case CDC_2_5_RX_RX1_RX_PATH_DSM_DATA2: 1350432e5074SSrinivas Kandagatla case CDC_2_5_RX_RX1_RX_PATH_DSM_DATA3: 1351432e5074SSrinivas Kandagatla case CDC_2_5_RX_RX1_RX_PATH_DSM_DATA4: 1352432e5074SSrinivas Kandagatla case CDC_2_5_RX_RX1_RX_PATH_DSM_DATA5: 1353432e5074SSrinivas Kandagatla case CDC_2_5_RX_RX1_RX_PATH_DSM_DATA6: 1354432e5074SSrinivas Kandagatla case CDC_2_5_RX_RX2_RX_PATH_CTL: 1355432e5074SSrinivas Kandagatla case CDC_2_5_RX_RX2_RX_PATH_CFG0: 1356432e5074SSrinivas Kandagatla case CDC_2_5_RX_RX2_RX_PATH_CFG1: 1357432e5074SSrinivas Kandagatla case CDC_2_5_RX_RX2_RX_PATH_CFG2: 1358432e5074SSrinivas Kandagatla case CDC_2_5_RX_RX2_RX_PATH_CFG3: 1359432e5074SSrinivas Kandagatla case CDC_2_5_RX_RX2_RX_VOL_CTL: 1360432e5074SSrinivas Kandagatla case CDC_2_5_RX_RX2_RX_PATH_MIX_CTL: 1361432e5074SSrinivas Kandagatla case CDC_2_5_RX_RX2_RX_PATH_MIX_CFG: 1362432e5074SSrinivas Kandagatla case CDC_2_5_RX_RX2_RX_VOL_MIX_CTL: 1363432e5074SSrinivas Kandagatla case CDC_2_5_RX_RX2_RX_PATH_SEC0: 1364432e5074SSrinivas Kandagatla case CDC_2_5_RX_RX2_RX_PATH_SEC1: 1365432e5074SSrinivas Kandagatla case CDC_2_5_RX_RX2_RX_PATH_SEC2: 1366432e5074SSrinivas Kandagatla case CDC_2_5_RX_RX2_RX_PATH_SEC3: 1367432e5074SSrinivas Kandagatla case CDC_2_5_RX_RX2_RX_PATH_SEC4: 1368432e5074SSrinivas Kandagatla case CDC_2_5_RX_RX2_RX_PATH_SEC5: 1369432e5074SSrinivas Kandagatla case CDC_2_5_RX_RX2_RX_PATH_SEC6: 1370432e5074SSrinivas Kandagatla case CDC_2_5_RX_RX2_RX_PATH_SEC7: 1371432e5074SSrinivas Kandagatla case CDC_2_5_RX_RX2_RX_PATH_MIX_SEC0: 1372432e5074SSrinivas Kandagatla case CDC_2_5_RX_RX2_RX_PATH_MIX_SEC1: 1373432e5074SSrinivas Kandagatla case CDC_2_5_RX_RX2_RX_PATH_DSM_CTL: 1374432e5074SSrinivas Kandagatla return true; 1375432e5074SSrinivas Kandagatla } 1376432e5074SSrinivas Kandagatla 1377432e5074SSrinivas Kandagatla return false; 1378432e5074SSrinivas Kandagatla } 1379432e5074SSrinivas Kandagatla 1380af3d54b9SSrinivas Kandagatla static bool rx_is_rw_register(struct device *dev, unsigned int reg) 1381af3d54b9SSrinivas Kandagatla { 1382dbacef05SSrinivas Kandagatla struct rx_macro *rx = dev_get_drvdata(dev); 1383dbacef05SSrinivas Kandagatla 1384af3d54b9SSrinivas Kandagatla switch (reg) { 1385af3d54b9SSrinivas Kandagatla case CDC_RX_TOP_TOP_CFG0: 1386af3d54b9SSrinivas Kandagatla case CDC_RX_TOP_SWR_CTRL: 1387af3d54b9SSrinivas Kandagatla case CDC_RX_TOP_DEBUG: 1388af3d54b9SSrinivas Kandagatla case CDC_RX_TOP_DEBUG_BUS: 1389af3d54b9SSrinivas Kandagatla case CDC_RX_TOP_DEBUG_EN0: 1390af3d54b9SSrinivas Kandagatla case CDC_RX_TOP_DEBUG_EN1: 1391af3d54b9SSrinivas Kandagatla case CDC_RX_TOP_DEBUG_EN2: 1392af3d54b9SSrinivas Kandagatla case CDC_RX_TOP_HPHL_COMP_WR_LSB: 1393af3d54b9SSrinivas Kandagatla case CDC_RX_TOP_HPHL_COMP_WR_MSB: 1394af3d54b9SSrinivas Kandagatla case CDC_RX_TOP_HPHL_COMP_LUT: 1395af3d54b9SSrinivas Kandagatla case CDC_RX_TOP_HPHR_COMP_WR_LSB: 1396af3d54b9SSrinivas Kandagatla case CDC_RX_TOP_HPHR_COMP_WR_MSB: 1397af3d54b9SSrinivas Kandagatla case CDC_RX_TOP_HPHR_COMP_LUT: 1398af3d54b9SSrinivas Kandagatla case CDC_RX_TOP_DSD0_DEBUG_CFG0: 1399af3d54b9SSrinivas Kandagatla case CDC_RX_TOP_DSD0_DEBUG_CFG1: 1400af3d54b9SSrinivas Kandagatla case CDC_RX_TOP_DSD0_DEBUG_CFG3: 1401af3d54b9SSrinivas Kandagatla case CDC_RX_TOP_DSD1_DEBUG_CFG0: 1402af3d54b9SSrinivas Kandagatla case CDC_RX_TOP_DSD1_DEBUG_CFG1: 1403af3d54b9SSrinivas Kandagatla case CDC_RX_TOP_DSD1_DEBUG_CFG3: 1404af3d54b9SSrinivas Kandagatla case CDC_RX_TOP_RX_I2S_CTL: 1405af3d54b9SSrinivas Kandagatla case CDC_RX_TOP_TX_I2S2_CTL: 1406af3d54b9SSrinivas Kandagatla case CDC_RX_TOP_I2S_CLK: 1407af3d54b9SSrinivas Kandagatla case CDC_RX_TOP_I2S_RESET: 1408af3d54b9SSrinivas Kandagatla case CDC_RX_TOP_I2S_MUX: 1409af3d54b9SSrinivas Kandagatla case CDC_RX_CLK_RST_CTRL_MCLK_CONTROL: 1410af3d54b9SSrinivas Kandagatla case CDC_RX_CLK_RST_CTRL_FS_CNT_CONTROL: 1411af3d54b9SSrinivas Kandagatla case CDC_RX_CLK_RST_CTRL_SWR_CONTROL: 1412af3d54b9SSrinivas Kandagatla case CDC_RX_CLK_RST_CTRL_DSD_CONTROL: 1413af3d54b9SSrinivas Kandagatla case CDC_RX_CLK_RST_CTRL_ASRC_SHARE_CONTROL: 1414af3d54b9SSrinivas Kandagatla case CDC_RX_SOFTCLIP_CRC: 1415af3d54b9SSrinivas Kandagatla case CDC_RX_SOFTCLIP_SOFTCLIP_CTRL: 1416af3d54b9SSrinivas Kandagatla case CDC_RX_INP_MUX_RX_INT0_CFG0: 1417af3d54b9SSrinivas Kandagatla case CDC_RX_INP_MUX_RX_INT0_CFG1: 1418af3d54b9SSrinivas Kandagatla case CDC_RX_INP_MUX_RX_INT1_CFG0: 1419af3d54b9SSrinivas Kandagatla case CDC_RX_INP_MUX_RX_INT1_CFG1: 1420af3d54b9SSrinivas Kandagatla case CDC_RX_INP_MUX_RX_INT2_CFG0: 1421af3d54b9SSrinivas Kandagatla case CDC_RX_INP_MUX_RX_INT2_CFG1: 1422af3d54b9SSrinivas Kandagatla case CDC_RX_INP_MUX_RX_MIX_CFG4: 1423af3d54b9SSrinivas Kandagatla case CDC_RX_INP_MUX_RX_MIX_CFG5: 1424af3d54b9SSrinivas Kandagatla case CDC_RX_INP_MUX_SIDETONE_SRC_CFG0: 1425af3d54b9SSrinivas Kandagatla case CDC_RX_CLSH_CRC: 1426af3d54b9SSrinivas Kandagatla case CDC_RX_CLSH_DLY_CTRL: 1427af3d54b9SSrinivas Kandagatla case CDC_RX_CLSH_DECAY_CTRL: 1428af3d54b9SSrinivas Kandagatla case CDC_RX_CLSH_HPH_V_PA: 1429af3d54b9SSrinivas Kandagatla case CDC_RX_CLSH_EAR_V_PA: 1430af3d54b9SSrinivas Kandagatla case CDC_RX_CLSH_HPH_V_HD: 1431af3d54b9SSrinivas Kandagatla case CDC_RX_CLSH_EAR_V_HD: 1432af3d54b9SSrinivas Kandagatla case CDC_RX_CLSH_K1_MSB: 1433af3d54b9SSrinivas Kandagatla case CDC_RX_CLSH_K1_LSB: 1434af3d54b9SSrinivas Kandagatla case CDC_RX_CLSH_K2_MSB: 1435af3d54b9SSrinivas Kandagatla case CDC_RX_CLSH_K2_LSB: 1436af3d54b9SSrinivas Kandagatla case CDC_RX_CLSH_IDLE_CTRL: 1437af3d54b9SSrinivas Kandagatla case CDC_RX_CLSH_IDLE_HPH: 1438af3d54b9SSrinivas Kandagatla case CDC_RX_CLSH_IDLE_EAR: 1439af3d54b9SSrinivas Kandagatla case CDC_RX_CLSH_TEST0: 1440af3d54b9SSrinivas Kandagatla case CDC_RX_CLSH_TEST1: 1441af3d54b9SSrinivas Kandagatla case CDC_RX_CLSH_OVR_VREF: 1442af3d54b9SSrinivas Kandagatla case CDC_RX_CLSH_CLSG_CTL: 1443af3d54b9SSrinivas Kandagatla case CDC_RX_CLSH_CLSG_CFG1: 1444af3d54b9SSrinivas Kandagatla case CDC_RX_CLSH_CLSG_CFG2: 1445af3d54b9SSrinivas Kandagatla case CDC_RX_BCL_VBAT_PATH_CTL: 1446af3d54b9SSrinivas Kandagatla case CDC_RX_BCL_VBAT_CFG: 1447af3d54b9SSrinivas Kandagatla case CDC_RX_BCL_VBAT_ADC_CAL1: 1448af3d54b9SSrinivas Kandagatla case CDC_RX_BCL_VBAT_ADC_CAL2: 1449af3d54b9SSrinivas Kandagatla case CDC_RX_BCL_VBAT_ADC_CAL3: 1450af3d54b9SSrinivas Kandagatla case CDC_RX_BCL_VBAT_PK_EST1: 1451af3d54b9SSrinivas Kandagatla case CDC_RX_BCL_VBAT_PK_EST2: 1452af3d54b9SSrinivas Kandagatla case CDC_RX_BCL_VBAT_PK_EST3: 1453af3d54b9SSrinivas Kandagatla case CDC_RX_BCL_VBAT_RF_PROC1: 1454af3d54b9SSrinivas Kandagatla case CDC_RX_BCL_VBAT_RF_PROC2: 1455af3d54b9SSrinivas Kandagatla case CDC_RX_BCL_VBAT_TAC1: 1456af3d54b9SSrinivas Kandagatla case CDC_RX_BCL_VBAT_TAC2: 1457af3d54b9SSrinivas Kandagatla case CDC_RX_BCL_VBAT_TAC3: 1458af3d54b9SSrinivas Kandagatla case CDC_RX_BCL_VBAT_TAC4: 1459af3d54b9SSrinivas Kandagatla case CDC_RX_BCL_VBAT_GAIN_UPD1: 1460af3d54b9SSrinivas Kandagatla case CDC_RX_BCL_VBAT_GAIN_UPD2: 1461af3d54b9SSrinivas Kandagatla case CDC_RX_BCL_VBAT_GAIN_UPD3: 1462af3d54b9SSrinivas Kandagatla case CDC_RX_BCL_VBAT_GAIN_UPD4: 1463af3d54b9SSrinivas Kandagatla case CDC_RX_BCL_VBAT_GAIN_UPD5: 1464af3d54b9SSrinivas Kandagatla case CDC_RX_BCL_VBAT_DEBUG1: 1465af3d54b9SSrinivas Kandagatla case CDC_RX_BCL_VBAT_BAN: 1466af3d54b9SSrinivas Kandagatla case CDC_RX_BCL_VBAT_BCL_GAIN_UPD1: 1467af3d54b9SSrinivas Kandagatla case CDC_RX_BCL_VBAT_BCL_GAIN_UPD2: 1468af3d54b9SSrinivas Kandagatla case CDC_RX_BCL_VBAT_BCL_GAIN_UPD3: 1469af3d54b9SSrinivas Kandagatla case CDC_RX_BCL_VBAT_BCL_GAIN_UPD4: 1470af3d54b9SSrinivas Kandagatla case CDC_RX_BCL_VBAT_BCL_GAIN_UPD5: 1471af3d54b9SSrinivas Kandagatla case CDC_RX_BCL_VBAT_BCL_GAIN_UPD6: 1472af3d54b9SSrinivas Kandagatla case CDC_RX_BCL_VBAT_BCL_GAIN_UPD7: 1473af3d54b9SSrinivas Kandagatla case CDC_RX_BCL_VBAT_BCL_GAIN_UPD8: 1474af3d54b9SSrinivas Kandagatla case CDC_RX_BCL_VBAT_BCL_GAIN_UPD9: 1475af3d54b9SSrinivas Kandagatla case CDC_RX_BCL_VBAT_ATTN1: 1476af3d54b9SSrinivas Kandagatla case CDC_RX_BCL_VBAT_ATTN2: 1477af3d54b9SSrinivas Kandagatla case CDC_RX_BCL_VBAT_ATTN3: 1478af3d54b9SSrinivas Kandagatla case CDC_RX_BCL_VBAT_DECODE_CTL1: 1479af3d54b9SSrinivas Kandagatla case CDC_RX_BCL_VBAT_DECODE_CTL2: 1480af3d54b9SSrinivas Kandagatla case CDC_RX_BCL_VBAT_DECODE_CFG1: 1481af3d54b9SSrinivas Kandagatla case CDC_RX_BCL_VBAT_DECODE_CFG2: 1482af3d54b9SSrinivas Kandagatla case CDC_RX_BCL_VBAT_DECODE_CFG3: 1483af3d54b9SSrinivas Kandagatla case CDC_RX_BCL_VBAT_DECODE_CFG4: 1484af3d54b9SSrinivas Kandagatla case CDC_RX_INTR_CTRL_CFG: 1485af3d54b9SSrinivas Kandagatla case CDC_RX_INTR_CTRL_PIN1_MASK0: 1486af3d54b9SSrinivas Kandagatla case CDC_RX_INTR_CTRL_PIN2_MASK0: 1487af3d54b9SSrinivas Kandagatla case CDC_RX_INTR_CTRL_LEVEL0: 1488af3d54b9SSrinivas Kandagatla case CDC_RX_INTR_CTRL_BYPASS0: 1489af3d54b9SSrinivas Kandagatla case CDC_RX_INTR_CTRL_SET0: 1490af3d54b9SSrinivas Kandagatla case CDC_RX_RX0_RX_PATH_CTL: 1491af3d54b9SSrinivas Kandagatla case CDC_RX_RX0_RX_PATH_CFG0: 1492af3d54b9SSrinivas Kandagatla case CDC_RX_RX0_RX_PATH_CFG1: 1493af3d54b9SSrinivas Kandagatla case CDC_RX_RX0_RX_PATH_CFG2: 1494af3d54b9SSrinivas Kandagatla case CDC_RX_RX0_RX_PATH_CFG3: 1495af3d54b9SSrinivas Kandagatla case CDC_RX_RX0_RX_VOL_CTL: 1496af3d54b9SSrinivas Kandagatla case CDC_RX_RX0_RX_PATH_MIX_CTL: 1497af3d54b9SSrinivas Kandagatla case CDC_RX_RX0_RX_PATH_MIX_CFG: 1498af3d54b9SSrinivas Kandagatla case CDC_RX_RX0_RX_VOL_MIX_CTL: 1499af3d54b9SSrinivas Kandagatla case CDC_RX_RX0_RX_PATH_SEC1: 1500af3d54b9SSrinivas Kandagatla case CDC_RX_RX0_RX_PATH_SEC2: 1501af3d54b9SSrinivas Kandagatla case CDC_RX_RX0_RX_PATH_SEC3: 1502af3d54b9SSrinivas Kandagatla case CDC_RX_RX0_RX_PATH_SEC4: 1503af3d54b9SSrinivas Kandagatla case CDC_RX_RX0_RX_PATH_SEC7: 1504af3d54b9SSrinivas Kandagatla case CDC_RX_RX0_RX_PATH_MIX_SEC0: 1505af3d54b9SSrinivas Kandagatla case CDC_RX_RX0_RX_PATH_MIX_SEC1: 1506af3d54b9SSrinivas Kandagatla case CDC_RX_RX0_RX_PATH_DSM_CTL: 1507af3d54b9SSrinivas Kandagatla case CDC_RX_RX0_RX_PATH_DSM_DATA1: 1508af3d54b9SSrinivas Kandagatla case CDC_RX_RX0_RX_PATH_DSM_DATA2: 1509af3d54b9SSrinivas Kandagatla case CDC_RX_RX0_RX_PATH_DSM_DATA3: 1510af3d54b9SSrinivas Kandagatla case CDC_RX_RX0_RX_PATH_DSM_DATA4: 1511af3d54b9SSrinivas Kandagatla case CDC_RX_RX0_RX_PATH_DSM_DATA5: 1512af3d54b9SSrinivas Kandagatla case CDC_RX_RX0_RX_PATH_DSM_DATA6: 1513af3d54b9SSrinivas Kandagatla case CDC_RX_IDLE_DETECT_PATH_CTL: 1514af3d54b9SSrinivas Kandagatla case CDC_RX_IDLE_DETECT_CFG0: 1515af3d54b9SSrinivas Kandagatla case CDC_RX_IDLE_DETECT_CFG1: 1516af3d54b9SSrinivas Kandagatla case CDC_RX_IDLE_DETECT_CFG2: 1517af3d54b9SSrinivas Kandagatla case CDC_RX_IDLE_DETECT_CFG3: 1518af3d54b9SSrinivas Kandagatla case CDC_RX_COMPANDER0_CTL0: 1519af3d54b9SSrinivas Kandagatla case CDC_RX_COMPANDER0_CTL1: 1520af3d54b9SSrinivas Kandagatla case CDC_RX_COMPANDER0_CTL2: 1521af3d54b9SSrinivas Kandagatla case CDC_RX_COMPANDER0_CTL3: 1522af3d54b9SSrinivas Kandagatla case CDC_RX_COMPANDER0_CTL4: 1523af3d54b9SSrinivas Kandagatla case CDC_RX_COMPANDER0_CTL5: 1524af3d54b9SSrinivas Kandagatla case CDC_RX_COMPANDER0_CTL7: 1525af3d54b9SSrinivas Kandagatla case CDC_RX_COMPANDER1_CTL0: 1526af3d54b9SSrinivas Kandagatla case CDC_RX_COMPANDER1_CTL1: 1527af3d54b9SSrinivas Kandagatla case CDC_RX_COMPANDER1_CTL2: 1528af3d54b9SSrinivas Kandagatla case CDC_RX_COMPANDER1_CTL3: 1529af3d54b9SSrinivas Kandagatla case CDC_RX_COMPANDER1_CTL4: 1530af3d54b9SSrinivas Kandagatla case CDC_RX_COMPANDER1_CTL5: 1531af3d54b9SSrinivas Kandagatla case CDC_RX_COMPANDER1_CTL7: 1532af3d54b9SSrinivas Kandagatla case CDC_RX_SIDETONE_IIR0_IIR_PATH_CTL: 1533af3d54b9SSrinivas Kandagatla case CDC_RX_SIDETONE_IIR0_IIR_GAIN_B1_CTL: 1534af3d54b9SSrinivas Kandagatla case CDC_RX_SIDETONE_IIR0_IIR_GAIN_B2_CTL: 1535af3d54b9SSrinivas Kandagatla case CDC_RX_SIDETONE_IIR0_IIR_GAIN_B3_CTL: 1536af3d54b9SSrinivas Kandagatla case CDC_RX_SIDETONE_IIR0_IIR_GAIN_B4_CTL: 1537af3d54b9SSrinivas Kandagatla case CDC_RX_SIDETONE_IIR0_IIR_GAIN_B5_CTL: 1538af3d54b9SSrinivas Kandagatla case CDC_RX_SIDETONE_IIR0_IIR_GAIN_B6_CTL: 1539af3d54b9SSrinivas Kandagatla case CDC_RX_SIDETONE_IIR0_IIR_GAIN_B7_CTL: 1540af3d54b9SSrinivas Kandagatla case CDC_RX_SIDETONE_IIR0_IIR_GAIN_B8_CTL: 1541af3d54b9SSrinivas Kandagatla case CDC_RX_SIDETONE_IIR0_IIR_CTL: 1542af3d54b9SSrinivas Kandagatla case CDC_RX_SIDETONE_IIR0_IIR_GAIN_TIMER_CTL: 1543af3d54b9SSrinivas Kandagatla case CDC_RX_SIDETONE_IIR0_IIR_COEF_B1_CTL: 1544af3d54b9SSrinivas Kandagatla case CDC_RX_SIDETONE_IIR0_IIR_COEF_B2_CTL: 1545af3d54b9SSrinivas Kandagatla case CDC_RX_SIDETONE_IIR1_IIR_PATH_CTL: 1546af3d54b9SSrinivas Kandagatla case CDC_RX_SIDETONE_IIR1_IIR_GAIN_B1_CTL: 1547af3d54b9SSrinivas Kandagatla case CDC_RX_SIDETONE_IIR1_IIR_GAIN_B2_CTL: 1548af3d54b9SSrinivas Kandagatla case CDC_RX_SIDETONE_IIR1_IIR_GAIN_B3_CTL: 1549af3d54b9SSrinivas Kandagatla case CDC_RX_SIDETONE_IIR1_IIR_GAIN_B4_CTL: 1550af3d54b9SSrinivas Kandagatla case CDC_RX_SIDETONE_IIR1_IIR_GAIN_B5_CTL: 1551af3d54b9SSrinivas Kandagatla case CDC_RX_SIDETONE_IIR1_IIR_GAIN_B6_CTL: 1552af3d54b9SSrinivas Kandagatla case CDC_RX_SIDETONE_IIR1_IIR_GAIN_B7_CTL: 1553af3d54b9SSrinivas Kandagatla case CDC_RX_SIDETONE_IIR1_IIR_GAIN_B8_CTL: 1554af3d54b9SSrinivas Kandagatla case CDC_RX_SIDETONE_IIR1_IIR_CTL: 1555af3d54b9SSrinivas Kandagatla case CDC_RX_SIDETONE_IIR1_IIR_GAIN_TIMER_CTL: 1556af3d54b9SSrinivas Kandagatla case CDC_RX_SIDETONE_IIR1_IIR_COEF_B1_CTL: 1557af3d54b9SSrinivas Kandagatla case CDC_RX_SIDETONE_IIR1_IIR_COEF_B2_CTL: 1558af3d54b9SSrinivas Kandagatla case CDC_RX_IIR_INP_MUX_IIR0_MIX_CFG0: 1559af3d54b9SSrinivas Kandagatla case CDC_RX_IIR_INP_MUX_IIR0_MIX_CFG1: 1560af3d54b9SSrinivas Kandagatla case CDC_RX_IIR_INP_MUX_IIR0_MIX_CFG2: 1561af3d54b9SSrinivas Kandagatla case CDC_RX_IIR_INP_MUX_IIR0_MIX_CFG3: 1562af3d54b9SSrinivas Kandagatla case CDC_RX_IIR_INP_MUX_IIR1_MIX_CFG0: 1563af3d54b9SSrinivas Kandagatla case CDC_RX_IIR_INP_MUX_IIR1_MIX_CFG1: 1564af3d54b9SSrinivas Kandagatla case CDC_RX_IIR_INP_MUX_IIR1_MIX_CFG2: 1565af3d54b9SSrinivas Kandagatla case CDC_RX_IIR_INP_MUX_IIR1_MIX_CFG3: 1566af3d54b9SSrinivas Kandagatla case CDC_RX_SIDETONE_SRC0_ST_SRC_PATH_CTL: 1567af3d54b9SSrinivas Kandagatla case CDC_RX_SIDETONE_SRC0_ST_SRC_PATH_CFG1: 1568af3d54b9SSrinivas Kandagatla case CDC_RX_SIDETONE_SRC1_ST_SRC_PATH_CTL: 1569af3d54b9SSrinivas Kandagatla case CDC_RX_SIDETONE_SRC1_ST_SRC_PATH_CFG1: 1570af3d54b9SSrinivas Kandagatla case CDC_RX_EC_REF_HQ0_EC_REF_HQ_PATH_CTL: 1571af3d54b9SSrinivas Kandagatla case CDC_RX_EC_REF_HQ0_EC_REF_HQ_CFG0: 1572af3d54b9SSrinivas Kandagatla case CDC_RX_EC_REF_HQ1_EC_REF_HQ_PATH_CTL: 1573af3d54b9SSrinivas Kandagatla case CDC_RX_EC_REF_HQ1_EC_REF_HQ_CFG0: 1574af3d54b9SSrinivas Kandagatla case CDC_RX_EC_REF_HQ2_EC_REF_HQ_PATH_CTL: 1575af3d54b9SSrinivas Kandagatla case CDC_RX_EC_REF_HQ2_EC_REF_HQ_CFG0: 1576af3d54b9SSrinivas Kandagatla case CDC_RX_EC_ASRC0_CLK_RST_CTL: 1577af3d54b9SSrinivas Kandagatla case CDC_RX_EC_ASRC0_CTL0: 1578af3d54b9SSrinivas Kandagatla case CDC_RX_EC_ASRC0_CTL1: 1579af3d54b9SSrinivas Kandagatla case CDC_RX_EC_ASRC0_FIFO_CTL: 1580af3d54b9SSrinivas Kandagatla case CDC_RX_EC_ASRC1_CLK_RST_CTL: 1581af3d54b9SSrinivas Kandagatla case CDC_RX_EC_ASRC1_CTL0: 1582af3d54b9SSrinivas Kandagatla case CDC_RX_EC_ASRC1_CTL1: 1583af3d54b9SSrinivas Kandagatla case CDC_RX_EC_ASRC1_FIFO_CTL: 1584af3d54b9SSrinivas Kandagatla case CDC_RX_EC_ASRC2_CLK_RST_CTL: 1585af3d54b9SSrinivas Kandagatla case CDC_RX_EC_ASRC2_CTL0: 1586af3d54b9SSrinivas Kandagatla case CDC_RX_EC_ASRC2_CTL1: 1587af3d54b9SSrinivas Kandagatla case CDC_RX_EC_ASRC2_FIFO_CTL: 1588af3d54b9SSrinivas Kandagatla case CDC_RX_DSD0_PATH_CTL: 1589af3d54b9SSrinivas Kandagatla case CDC_RX_DSD0_CFG0: 1590af3d54b9SSrinivas Kandagatla case CDC_RX_DSD0_CFG1: 1591af3d54b9SSrinivas Kandagatla case CDC_RX_DSD0_CFG2: 1592af3d54b9SSrinivas Kandagatla case CDC_RX_DSD1_PATH_CTL: 1593af3d54b9SSrinivas Kandagatla case CDC_RX_DSD1_CFG0: 1594af3d54b9SSrinivas Kandagatla case CDC_RX_DSD1_CFG1: 1595af3d54b9SSrinivas Kandagatla case CDC_RX_DSD1_CFG2: 1596af3d54b9SSrinivas Kandagatla return true; 1597af3d54b9SSrinivas Kandagatla } 1598af3d54b9SSrinivas Kandagatla 1599dbacef05SSrinivas Kandagatla switch (rx->codec_version) { 1600dbacef05SSrinivas Kandagatla case LPASS_CODEC_VERSION_1_0: 1601dbacef05SSrinivas Kandagatla case LPASS_CODEC_VERSION_1_1: 1602dbacef05SSrinivas Kandagatla case LPASS_CODEC_VERSION_1_2: 1603dbacef05SSrinivas Kandagatla case LPASS_CODEC_VERSION_2_0: 1604903e8509SKrzysztof Kozlowski case LPASS_CODEC_VERSION_2_1: 1605dbacef05SSrinivas Kandagatla return rx_pre_2_5_is_rw_register(dev, reg); 1606432e5074SSrinivas Kandagatla case LPASS_CODEC_VERSION_2_5: 1607432e5074SSrinivas Kandagatla case LPASS_CODEC_VERSION_2_6: 1608432e5074SSrinivas Kandagatla case LPASS_CODEC_VERSION_2_7: 1609432e5074SSrinivas Kandagatla case LPASS_CODEC_VERSION_2_8: 1610432e5074SSrinivas Kandagatla return rx_2_5_is_rw_register(dev, reg); 1611dbacef05SSrinivas Kandagatla default: 1612dbacef05SSrinivas Kandagatla break; 1613dbacef05SSrinivas Kandagatla } 1614dbacef05SSrinivas Kandagatla 1615af3d54b9SSrinivas Kandagatla return false; 1616af3d54b9SSrinivas Kandagatla } 1617af3d54b9SSrinivas Kandagatla 1618af3d54b9SSrinivas Kandagatla static bool rx_is_writeable_register(struct device *dev, unsigned int reg) 1619af3d54b9SSrinivas Kandagatla { 1620af3d54b9SSrinivas Kandagatla bool ret; 1621af3d54b9SSrinivas Kandagatla 1622af3d54b9SSrinivas Kandagatla ret = rx_is_rw_register(dev, reg); 1623af3d54b9SSrinivas Kandagatla if (!ret) 1624af3d54b9SSrinivas Kandagatla return rx_is_wronly_register(dev, reg); 1625af3d54b9SSrinivas Kandagatla 1626af3d54b9SSrinivas Kandagatla return ret; 1627af3d54b9SSrinivas Kandagatla } 1628af3d54b9SSrinivas Kandagatla 1629af3d54b9SSrinivas Kandagatla static bool rx_is_readable_register(struct device *dev, unsigned int reg) 1630af3d54b9SSrinivas Kandagatla { 1631af3d54b9SSrinivas Kandagatla switch (reg) { 1632af3d54b9SSrinivas Kandagatla case CDC_RX_TOP_HPHL_COMP_RD_LSB: 1633af3d54b9SSrinivas Kandagatla case CDC_RX_TOP_HPHL_COMP_RD_MSB: 1634af3d54b9SSrinivas Kandagatla case CDC_RX_TOP_HPHR_COMP_RD_LSB: 1635af3d54b9SSrinivas Kandagatla case CDC_RX_TOP_HPHR_COMP_RD_MSB: 1636af3d54b9SSrinivas Kandagatla case CDC_RX_TOP_DSD0_DEBUG_CFG2: 1637af3d54b9SSrinivas Kandagatla case CDC_RX_TOP_DSD1_DEBUG_CFG2: 1638af3d54b9SSrinivas Kandagatla case CDC_RX_BCL_VBAT_GAIN_MON_VAL: 1639af3d54b9SSrinivas Kandagatla case CDC_RX_BCL_VBAT_DECODE_ST: 1640af3d54b9SSrinivas Kandagatla case CDC_RX_INTR_CTRL_PIN1_STATUS0: 1641af3d54b9SSrinivas Kandagatla case CDC_RX_INTR_CTRL_PIN2_STATUS0: 1642af3d54b9SSrinivas Kandagatla case CDC_RX_COMPANDER0_CTL6: 1643af3d54b9SSrinivas Kandagatla case CDC_RX_COMPANDER1_CTL6: 1644af3d54b9SSrinivas Kandagatla case CDC_RX_EC_ASRC0_STATUS_FMIN_CNTR_LSB: 1645af3d54b9SSrinivas Kandagatla case CDC_RX_EC_ASRC0_STATUS_FMIN_CNTR_MSB: 1646af3d54b9SSrinivas Kandagatla case CDC_RX_EC_ASRC0_STATUS_FMAX_CNTR_LSB: 1647af3d54b9SSrinivas Kandagatla case CDC_RX_EC_ASRC0_STATUS_FMAX_CNTR_MSB: 1648af3d54b9SSrinivas Kandagatla case CDC_RX_EC_ASRC0_STATUS_FIFO: 1649af3d54b9SSrinivas Kandagatla case CDC_RX_EC_ASRC1_STATUS_FMIN_CNTR_LSB: 1650af3d54b9SSrinivas Kandagatla case CDC_RX_EC_ASRC1_STATUS_FMIN_CNTR_MSB: 1651af3d54b9SSrinivas Kandagatla case CDC_RX_EC_ASRC1_STATUS_FMAX_CNTR_LSB: 1652af3d54b9SSrinivas Kandagatla case CDC_RX_EC_ASRC1_STATUS_FMAX_CNTR_MSB: 1653af3d54b9SSrinivas Kandagatla case CDC_RX_EC_ASRC1_STATUS_FIFO: 1654af3d54b9SSrinivas Kandagatla case CDC_RX_EC_ASRC2_STATUS_FMIN_CNTR_LSB: 1655af3d54b9SSrinivas Kandagatla case CDC_RX_EC_ASRC2_STATUS_FMIN_CNTR_MSB: 1656af3d54b9SSrinivas Kandagatla case CDC_RX_EC_ASRC2_STATUS_FMAX_CNTR_LSB: 1657af3d54b9SSrinivas Kandagatla case CDC_RX_EC_ASRC2_STATUS_FMAX_CNTR_MSB: 1658af3d54b9SSrinivas Kandagatla case CDC_RX_EC_ASRC2_STATUS_FIFO: 1659af3d54b9SSrinivas Kandagatla return true; 1660af3d54b9SSrinivas Kandagatla } 1661af3d54b9SSrinivas Kandagatla 1662af3d54b9SSrinivas Kandagatla return rx_is_rw_register(dev, reg); 1663af3d54b9SSrinivas Kandagatla } 1664af3d54b9SSrinivas Kandagatla 1665dbacef05SSrinivas Kandagatla static struct regmap_config rx_regmap_config = { 1666af3d54b9SSrinivas Kandagatla .name = "rx_macro", 1667af3d54b9SSrinivas Kandagatla .reg_bits = 16, 1668af3d54b9SSrinivas Kandagatla .val_bits = 32, /* 8 but with 32 bit read/write */ 1669af3d54b9SSrinivas Kandagatla .reg_stride = 4, 1670af3d54b9SSrinivas Kandagatla .cache_type = REGCACHE_FLAT, 1671af3d54b9SSrinivas Kandagatla .max_register = RX_MAX_OFFSET, 1672af3d54b9SSrinivas Kandagatla .writeable_reg = rx_is_writeable_register, 1673af3d54b9SSrinivas Kandagatla .volatile_reg = rx_is_volatile_register, 1674af3d54b9SSrinivas Kandagatla .readable_reg = rx_is_readable_register, 1675af3d54b9SSrinivas Kandagatla }; 1676af3d54b9SSrinivas Kandagatla 16774f692926SSrinivas Kandagatla static int rx_macro_int_dem_inp_mux_put(struct snd_kcontrol *kcontrol, 16784f692926SSrinivas Kandagatla struct snd_ctl_elem_value *ucontrol) 16794f692926SSrinivas Kandagatla { 16804f692926SSrinivas Kandagatla struct snd_soc_dapm_widget *widget = snd_soc_dapm_kcontrol_widget(kcontrol); 16814f692926SSrinivas Kandagatla struct snd_soc_component *component = snd_soc_dapm_to_component(widget->dapm); 1682dbacef05SSrinivas Kandagatla struct rx_macro *rx = snd_soc_component_get_drvdata(component); 16834f692926SSrinivas Kandagatla struct soc_enum *e = (struct soc_enum *)kcontrol->private_value; 16844f692926SSrinivas Kandagatla unsigned short look_ahead_dly_reg; 16854f692926SSrinivas Kandagatla unsigned int val; 16864f692926SSrinivas Kandagatla 16874f692926SSrinivas Kandagatla val = ucontrol->value.enumerated.item[0]; 16884f692926SSrinivas Kandagatla 1689dbacef05SSrinivas Kandagatla if (e->reg == CDC_RX_RXn_RX_PATH_CFG1(rx, 0)) 1690dbacef05SSrinivas Kandagatla look_ahead_dly_reg = CDC_RX_RXn_RX_PATH_CFG0(rx, 0); 1691dbacef05SSrinivas Kandagatla else if (e->reg == CDC_RX_RXn_RX_PATH_CFG1(rx, 1)) 1692dbacef05SSrinivas Kandagatla look_ahead_dly_reg = CDC_RX_RXn_RX_PATH_CFG0(rx, 1); 16934f692926SSrinivas Kandagatla 16944f692926SSrinivas Kandagatla /* Set Look Ahead Delay */ 16954f692926SSrinivas Kandagatla if (val) 16964f692926SSrinivas Kandagatla snd_soc_component_update_bits(component, look_ahead_dly_reg, 16974f692926SSrinivas Kandagatla CDC_RX_DLY_ZN_EN_MASK, 16984f692926SSrinivas Kandagatla CDC_RX_DLY_ZN_ENABLE); 16994f692926SSrinivas Kandagatla else 17004f692926SSrinivas Kandagatla snd_soc_component_update_bits(component, look_ahead_dly_reg, 17014f692926SSrinivas Kandagatla CDC_RX_DLY_ZN_EN_MASK, 0); 17024f692926SSrinivas Kandagatla /* Set DEM INP Select */ 17034f692926SSrinivas Kandagatla return snd_soc_dapm_put_enum_double(kcontrol, ucontrol); 17044f692926SSrinivas Kandagatla } 17054f692926SSrinivas Kandagatla 17064f692926SSrinivas Kandagatla static const struct snd_kcontrol_new rx_int0_dem_inp_mux = 17074f692926SSrinivas Kandagatla SOC_DAPM_ENUM_EXT("rx_int0_dem_inp", rx_int0_dem_inp_enum, 17084f692926SSrinivas Kandagatla snd_soc_dapm_get_enum_double, rx_macro_int_dem_inp_mux_put); 17094f692926SSrinivas Kandagatla static const struct snd_kcontrol_new rx_int1_dem_inp_mux = 17104f692926SSrinivas Kandagatla SOC_DAPM_ENUM_EXT("rx_int1_dem_inp", rx_int1_dem_inp_enum, 17114f692926SSrinivas Kandagatla snd_soc_dapm_get_enum_double, rx_macro_int_dem_inp_mux_put); 17124f692926SSrinivas Kandagatla 1713432e5074SSrinivas Kandagatla static const struct snd_kcontrol_new rx_2_5_int1_dem_inp_mux = 1714432e5074SSrinivas Kandagatla SOC_DAPM_ENUM_EXT("rx_int1_dem_inp", rx_2_5_int1_dem_inp_enum, 1715432e5074SSrinivas Kandagatla snd_soc_dapm_get_enum_double, rx_macro_int_dem_inp_mux_put); 1716432e5074SSrinivas Kandagatla 1717af3d54b9SSrinivas Kandagatla static int rx_macro_set_prim_interpolator_rate(struct snd_soc_dai *dai, 1718af3d54b9SSrinivas Kandagatla int rate_reg_val, u32 sample_rate) 1719af3d54b9SSrinivas Kandagatla { 1720af3d54b9SSrinivas Kandagatla 1721af3d54b9SSrinivas Kandagatla u8 int_1_mix1_inp; 1722af3d54b9SSrinivas Kandagatla u32 j, port; 1723af3d54b9SSrinivas Kandagatla u16 int_mux_cfg0, int_mux_cfg1; 1724af3d54b9SSrinivas Kandagatla u16 int_fs_reg; 1725af3d54b9SSrinivas Kandagatla u8 inp0_sel, inp1_sel, inp2_sel; 1726af3d54b9SSrinivas Kandagatla struct snd_soc_component *component = dai->component; 1727af3d54b9SSrinivas Kandagatla struct rx_macro *rx = snd_soc_component_get_drvdata(component); 1728af3d54b9SSrinivas Kandagatla 1729af3d54b9SSrinivas Kandagatla for_each_set_bit(port, &rx->active_ch_mask[dai->id], RX_MACRO_PORTS_MAX) { 1730af3d54b9SSrinivas Kandagatla int_1_mix1_inp = port; 1731af3d54b9SSrinivas Kandagatla int_mux_cfg0 = CDC_RX_INP_MUX_RX_INT0_CFG0; 1732af3d54b9SSrinivas Kandagatla /* 1733af3d54b9SSrinivas Kandagatla * Loop through all interpolator MUX inputs and find out 1734af3d54b9SSrinivas Kandagatla * to which interpolator input, the rx port 1735af3d54b9SSrinivas Kandagatla * is connected 1736af3d54b9SSrinivas Kandagatla */ 1737af3d54b9SSrinivas Kandagatla for (j = 0; j < INTERP_MAX; j++) { 1738af3d54b9SSrinivas Kandagatla int_mux_cfg1 = int_mux_cfg0 + 4; 1739af3d54b9SSrinivas Kandagatla 1740af3d54b9SSrinivas Kandagatla inp0_sel = snd_soc_component_read_field(component, int_mux_cfg0, 1741af3d54b9SSrinivas Kandagatla CDC_RX_INTX_1_MIX_INP0_SEL_MASK); 1742af3d54b9SSrinivas Kandagatla inp1_sel = snd_soc_component_read_field(component, int_mux_cfg0, 1743af3d54b9SSrinivas Kandagatla CDC_RX_INTX_1_MIX_INP1_SEL_MASK); 1744af3d54b9SSrinivas Kandagatla inp2_sel = snd_soc_component_read_field(component, int_mux_cfg1, 1745af3d54b9SSrinivas Kandagatla CDC_RX_INTX_1_MIX_INP2_SEL_MASK); 1746af3d54b9SSrinivas Kandagatla 1747af3d54b9SSrinivas Kandagatla if ((inp0_sel == int_1_mix1_inp + INTn_1_INP_SEL_RX0) || 1748af3d54b9SSrinivas Kandagatla (inp1_sel == int_1_mix1_inp + INTn_1_INP_SEL_RX0) || 1749af3d54b9SSrinivas Kandagatla (inp2_sel == int_1_mix1_inp + INTn_1_INP_SEL_RX0)) { 1750dbacef05SSrinivas Kandagatla int_fs_reg = CDC_RX_RXn_RX_PATH_CTL(rx, j); 1751af3d54b9SSrinivas Kandagatla /* sample_rate is in Hz */ 1752af3d54b9SSrinivas Kandagatla snd_soc_component_update_bits(component, int_fs_reg, 1753af3d54b9SSrinivas Kandagatla CDC_RX_PATH_PCM_RATE_MASK, 1754af3d54b9SSrinivas Kandagatla rate_reg_val); 1755af3d54b9SSrinivas Kandagatla } 1756af3d54b9SSrinivas Kandagatla int_mux_cfg0 += 8; 1757af3d54b9SSrinivas Kandagatla } 1758af3d54b9SSrinivas Kandagatla } 1759af3d54b9SSrinivas Kandagatla 1760af3d54b9SSrinivas Kandagatla return 0; 1761af3d54b9SSrinivas Kandagatla } 1762af3d54b9SSrinivas Kandagatla 1763af3d54b9SSrinivas Kandagatla static int rx_macro_set_mix_interpolator_rate(struct snd_soc_dai *dai, 1764af3d54b9SSrinivas Kandagatla int rate_reg_val, u32 sample_rate) 1765af3d54b9SSrinivas Kandagatla { 1766af3d54b9SSrinivas Kandagatla 1767af3d54b9SSrinivas Kandagatla u8 int_2_inp; 1768af3d54b9SSrinivas Kandagatla u32 j, port; 1769af3d54b9SSrinivas Kandagatla u16 int_mux_cfg1, int_fs_reg; 1770af3d54b9SSrinivas Kandagatla u8 int_mux_cfg1_val; 1771af3d54b9SSrinivas Kandagatla struct snd_soc_component *component = dai->component; 1772af3d54b9SSrinivas Kandagatla struct rx_macro *rx = snd_soc_component_get_drvdata(component); 1773af3d54b9SSrinivas Kandagatla 1774af3d54b9SSrinivas Kandagatla for_each_set_bit(port, &rx->active_ch_mask[dai->id], RX_MACRO_PORTS_MAX) { 1775af3d54b9SSrinivas Kandagatla int_2_inp = port; 1776af3d54b9SSrinivas Kandagatla 1777af3d54b9SSrinivas Kandagatla int_mux_cfg1 = CDC_RX_INP_MUX_RX_INT0_CFG1; 1778af3d54b9SSrinivas Kandagatla for (j = 0; j < INTERP_MAX; j++) { 1779af3d54b9SSrinivas Kandagatla int_mux_cfg1_val = snd_soc_component_read_field(component, int_mux_cfg1, 1780af3d54b9SSrinivas Kandagatla CDC_RX_INTX_2_SEL_MASK); 1781af3d54b9SSrinivas Kandagatla 1782af3d54b9SSrinivas Kandagatla if (int_mux_cfg1_val == int_2_inp + INTn_2_INP_SEL_RX0) { 1783dbacef05SSrinivas Kandagatla int_fs_reg = CDC_RX_RXn_RX_PATH_MIX_CTL(rx, j); 1784af3d54b9SSrinivas Kandagatla snd_soc_component_update_bits(component, int_fs_reg, 1785af3d54b9SSrinivas Kandagatla CDC_RX_RXn_MIX_PCM_RATE_MASK, 1786af3d54b9SSrinivas Kandagatla rate_reg_val); 1787af3d54b9SSrinivas Kandagatla } 1788af3d54b9SSrinivas Kandagatla int_mux_cfg1 += 8; 1789af3d54b9SSrinivas Kandagatla } 1790af3d54b9SSrinivas Kandagatla } 1791af3d54b9SSrinivas Kandagatla return 0; 1792af3d54b9SSrinivas Kandagatla } 1793af3d54b9SSrinivas Kandagatla 1794af3d54b9SSrinivas Kandagatla static int rx_macro_set_interpolator_rate(struct snd_soc_dai *dai, 1795af3d54b9SSrinivas Kandagatla u32 sample_rate) 1796af3d54b9SSrinivas Kandagatla { 1797af3d54b9SSrinivas Kandagatla int rate_val = 0; 1798af3d54b9SSrinivas Kandagatla int i, ret; 1799af3d54b9SSrinivas Kandagatla 1800af3d54b9SSrinivas Kandagatla for (i = 0; i < ARRAY_SIZE(sr_val_tbl); i++) 1801af3d54b9SSrinivas Kandagatla if (sample_rate == sr_val_tbl[i].sample_rate) 1802af3d54b9SSrinivas Kandagatla rate_val = sr_val_tbl[i].rate_val; 1803af3d54b9SSrinivas Kandagatla 1804af3d54b9SSrinivas Kandagatla ret = rx_macro_set_prim_interpolator_rate(dai, rate_val, sample_rate); 1805af3d54b9SSrinivas Kandagatla if (ret) 1806af3d54b9SSrinivas Kandagatla return ret; 1807af3d54b9SSrinivas Kandagatla 1808af3d54b9SSrinivas Kandagatla ret = rx_macro_set_mix_interpolator_rate(dai, rate_val, sample_rate); 1809af3d54b9SSrinivas Kandagatla 1810af3d54b9SSrinivas Kandagatla return ret; 1811af3d54b9SSrinivas Kandagatla } 1812af3d54b9SSrinivas Kandagatla 1813af3d54b9SSrinivas Kandagatla static int rx_macro_hw_params(struct snd_pcm_substream *substream, 1814af3d54b9SSrinivas Kandagatla struct snd_pcm_hw_params *params, 1815af3d54b9SSrinivas Kandagatla struct snd_soc_dai *dai) 1816af3d54b9SSrinivas Kandagatla { 1817af3d54b9SSrinivas Kandagatla struct snd_soc_component *component = dai->component; 1818af3d54b9SSrinivas Kandagatla struct rx_macro *rx = snd_soc_component_get_drvdata(component); 1819af3d54b9SSrinivas Kandagatla int ret; 1820af3d54b9SSrinivas Kandagatla 1821af3d54b9SSrinivas Kandagatla switch (substream->stream) { 1822af3d54b9SSrinivas Kandagatla case SNDRV_PCM_STREAM_PLAYBACK: 1823af3d54b9SSrinivas Kandagatla ret = rx_macro_set_interpolator_rate(dai, params_rate(params)); 1824af3d54b9SSrinivas Kandagatla if (ret) { 1825af3d54b9SSrinivas Kandagatla dev_err(component->dev, "%s: cannot set sample rate: %u\n", 1826af3d54b9SSrinivas Kandagatla __func__, params_rate(params)); 1827af3d54b9SSrinivas Kandagatla return ret; 1828af3d54b9SSrinivas Kandagatla } 1829af3d54b9SSrinivas Kandagatla rx->bit_width[dai->id] = params_width(params); 1830af3d54b9SSrinivas Kandagatla break; 1831af3d54b9SSrinivas Kandagatla default: 1832af3d54b9SSrinivas Kandagatla break; 1833af3d54b9SSrinivas Kandagatla } 1834af3d54b9SSrinivas Kandagatla return 0; 1835af3d54b9SSrinivas Kandagatla } 1836af3d54b9SSrinivas Kandagatla 1837785d64c4SKrzysztof Kozlowski static int rx_macro_get_channel_map(const struct snd_soc_dai *dai, 1838af3d54b9SSrinivas Kandagatla unsigned int *tx_num, unsigned int *tx_slot, 1839af3d54b9SSrinivas Kandagatla unsigned int *rx_num, unsigned int *rx_slot) 1840af3d54b9SSrinivas Kandagatla { 1841af3d54b9SSrinivas Kandagatla struct snd_soc_component *component = dai->component; 1842af3d54b9SSrinivas Kandagatla struct rx_macro *rx = snd_soc_component_get_drvdata(component); 1843af3d54b9SSrinivas Kandagatla u16 val, mask = 0, cnt = 0, temp; 1844af3d54b9SSrinivas Kandagatla 1845af3d54b9SSrinivas Kandagatla switch (dai->id) { 1846af3d54b9SSrinivas Kandagatla case RX_MACRO_AIF1_PB: 1847af3d54b9SSrinivas Kandagatla case RX_MACRO_AIF2_PB: 1848af3d54b9SSrinivas Kandagatla case RX_MACRO_AIF3_PB: 1849af3d54b9SSrinivas Kandagatla case RX_MACRO_AIF4_PB: 1850af3d54b9SSrinivas Kandagatla for_each_set_bit(temp, &rx->active_ch_mask[dai->id], 1851af3d54b9SSrinivas Kandagatla RX_MACRO_PORTS_MAX) { 1852af3d54b9SSrinivas Kandagatla mask |= (1 << temp); 1853af3d54b9SSrinivas Kandagatla if (++cnt == RX_MACRO_MAX_DMA_CH_PER_PORT) 1854af3d54b9SSrinivas Kandagatla break; 1855af3d54b9SSrinivas Kandagatla } 1856af3d54b9SSrinivas Kandagatla /* 1857af3d54b9SSrinivas Kandagatla * CDC_DMA_RX_0 port drives RX0/RX1 -- ch_mask 0x1/0x2/0x3 1858af3d54b9SSrinivas Kandagatla * CDC_DMA_RX_1 port drives RX2/RX3 -- ch_mask 0x1/0x2/0x3 1859af3d54b9SSrinivas Kandagatla * CDC_DMA_RX_2 port drives RX4 -- ch_mask 0x1 1860af3d54b9SSrinivas Kandagatla * CDC_DMA_RX_3 port drives RX5 -- ch_mask 0x1 1861af3d54b9SSrinivas Kandagatla * AIFn can pair to any CDC_DMA_RX_n port. 1862af3d54b9SSrinivas Kandagatla * In general, below convention is used:: 1863af3d54b9SSrinivas Kandagatla * CDC_DMA_RX_0(AIF1)/CDC_DMA_RX_1(AIF2)/ 1864af3d54b9SSrinivas Kandagatla * CDC_DMA_RX_2(AIF3)/CDC_DMA_RX_3(AIF4) 1865af3d54b9SSrinivas Kandagatla */ 1866af3d54b9SSrinivas Kandagatla if (mask & 0x0C) 1867af3d54b9SSrinivas Kandagatla mask = mask >> 2; 1868af3d54b9SSrinivas Kandagatla if ((mask & 0x10) || (mask & 0x20)) 1869af3d54b9SSrinivas Kandagatla mask = 0x1; 1870af3d54b9SSrinivas Kandagatla *rx_slot = mask; 1871af3d54b9SSrinivas Kandagatla *rx_num = rx->active_ch_cnt[dai->id]; 1872af3d54b9SSrinivas Kandagatla break; 1873af3d54b9SSrinivas Kandagatla case RX_MACRO_AIF_ECHO: 1874af3d54b9SSrinivas Kandagatla val = snd_soc_component_read(component, CDC_RX_INP_MUX_RX_MIX_CFG4); 1875af3d54b9SSrinivas Kandagatla if (val & RX_MACRO_EC_MIX_TX0_MASK) { 1876af3d54b9SSrinivas Kandagatla mask |= 0x1; 1877af3d54b9SSrinivas Kandagatla cnt++; 1878af3d54b9SSrinivas Kandagatla } 1879af3d54b9SSrinivas Kandagatla if (val & RX_MACRO_EC_MIX_TX1_MASK) { 1880af3d54b9SSrinivas Kandagatla mask |= 0x2; 1881af3d54b9SSrinivas Kandagatla cnt++; 1882af3d54b9SSrinivas Kandagatla } 1883af3d54b9SSrinivas Kandagatla val = snd_soc_component_read(component, 1884af3d54b9SSrinivas Kandagatla CDC_RX_INP_MUX_RX_MIX_CFG5); 1885af3d54b9SSrinivas Kandagatla if (val & RX_MACRO_EC_MIX_TX2_MASK) { 1886af3d54b9SSrinivas Kandagatla mask |= 0x4; 1887af3d54b9SSrinivas Kandagatla cnt++; 1888af3d54b9SSrinivas Kandagatla } 1889af3d54b9SSrinivas Kandagatla *tx_slot = mask; 1890af3d54b9SSrinivas Kandagatla *tx_num = cnt; 1891af3d54b9SSrinivas Kandagatla break; 1892af3d54b9SSrinivas Kandagatla default: 1893af3d54b9SSrinivas Kandagatla dev_err(component->dev, "%s: Invalid AIF\n", __func__); 1894af3d54b9SSrinivas Kandagatla break; 1895af3d54b9SSrinivas Kandagatla } 1896af3d54b9SSrinivas Kandagatla return 0; 1897af3d54b9SSrinivas Kandagatla } 1898af3d54b9SSrinivas Kandagatla 1899af3d54b9SSrinivas Kandagatla static int rx_macro_digital_mute(struct snd_soc_dai *dai, int mute, int stream) 1900af3d54b9SSrinivas Kandagatla { 1901af3d54b9SSrinivas Kandagatla struct snd_soc_component *component = dai->component; 1902dbacef05SSrinivas Kandagatla struct rx_macro *rx = snd_soc_component_get_drvdata(component); 1903af3d54b9SSrinivas Kandagatla uint16_t j, reg, mix_reg, dsm_reg; 1904af3d54b9SSrinivas Kandagatla u16 int_mux_cfg0, int_mux_cfg1; 1905af3d54b9SSrinivas Kandagatla u8 int_mux_cfg0_val, int_mux_cfg1_val; 1906af3d54b9SSrinivas Kandagatla 1907af3d54b9SSrinivas Kandagatla switch (dai->id) { 1908af3d54b9SSrinivas Kandagatla case RX_MACRO_AIF1_PB: 1909af3d54b9SSrinivas Kandagatla case RX_MACRO_AIF2_PB: 1910af3d54b9SSrinivas Kandagatla case RX_MACRO_AIF3_PB: 1911af3d54b9SSrinivas Kandagatla case RX_MACRO_AIF4_PB: 1912af3d54b9SSrinivas Kandagatla for (j = 0; j < INTERP_MAX; j++) { 1913dbacef05SSrinivas Kandagatla reg = CDC_RX_RXn_RX_PATH_CTL(rx, j); 1914dbacef05SSrinivas Kandagatla mix_reg = CDC_RX_RXn_RX_PATH_MIX_CTL(rx, j); 1915dbacef05SSrinivas Kandagatla dsm_reg = CDC_RX_RXn_RX_PATH_DSM_CTL(rx, j); 1916af3d54b9SSrinivas Kandagatla 1917af3d54b9SSrinivas Kandagatla if (mute) { 1918af3d54b9SSrinivas Kandagatla snd_soc_component_update_bits(component, reg, 1919af3d54b9SSrinivas Kandagatla CDC_RX_PATH_PGA_MUTE_MASK, 1920af3d54b9SSrinivas Kandagatla CDC_RX_PATH_PGA_MUTE_ENABLE); 1921af3d54b9SSrinivas Kandagatla snd_soc_component_update_bits(component, mix_reg, 1922af3d54b9SSrinivas Kandagatla CDC_RX_PATH_PGA_MUTE_MASK, 1923af3d54b9SSrinivas Kandagatla CDC_RX_PATH_PGA_MUTE_ENABLE); 1924af3d54b9SSrinivas Kandagatla } else { 1925af3d54b9SSrinivas Kandagatla snd_soc_component_update_bits(component, reg, 1926af3d54b9SSrinivas Kandagatla CDC_RX_PATH_PGA_MUTE_MASK, 0x0); 1927af3d54b9SSrinivas Kandagatla snd_soc_component_update_bits(component, mix_reg, 1928af3d54b9SSrinivas Kandagatla CDC_RX_PATH_PGA_MUTE_MASK, 0x0); 1929af3d54b9SSrinivas Kandagatla } 1930af3d54b9SSrinivas Kandagatla 1931af3d54b9SSrinivas Kandagatla if (j == INTERP_AUX) 1932dbacef05SSrinivas Kandagatla dsm_reg = CDC_RX_RXn_RX_PATH_DSM_CTL(rx, 2); 1933af3d54b9SSrinivas Kandagatla 1934af3d54b9SSrinivas Kandagatla int_mux_cfg0 = CDC_RX_INP_MUX_RX_INT0_CFG0 + j * 8; 1935af3d54b9SSrinivas Kandagatla int_mux_cfg1 = int_mux_cfg0 + 4; 1936af3d54b9SSrinivas Kandagatla int_mux_cfg0_val = snd_soc_component_read(component, int_mux_cfg0); 1937af3d54b9SSrinivas Kandagatla int_mux_cfg1_val = snd_soc_component_read(component, int_mux_cfg1); 1938af3d54b9SSrinivas Kandagatla 1939af3d54b9SSrinivas Kandagatla if (snd_soc_component_read(component, dsm_reg) & 0x01) { 1940af3d54b9SSrinivas Kandagatla if (int_mux_cfg0_val || (int_mux_cfg1_val & 0xF0)) 1941af3d54b9SSrinivas Kandagatla snd_soc_component_update_bits(component, reg, 0x20, 0x20); 1942af3d54b9SSrinivas Kandagatla if (int_mux_cfg1_val & 0x0F) { 1943af3d54b9SSrinivas Kandagatla snd_soc_component_update_bits(component, reg, 0x20, 0x20); 1944622d9ac3SColin Ian King snd_soc_component_update_bits(component, mix_reg, 0x20, 1945622d9ac3SColin Ian King 0x20); 1946af3d54b9SSrinivas Kandagatla } 1947af3d54b9SSrinivas Kandagatla } 1948af3d54b9SSrinivas Kandagatla } 1949af3d54b9SSrinivas Kandagatla break; 1950af3d54b9SSrinivas Kandagatla default: 1951af3d54b9SSrinivas Kandagatla break; 1952af3d54b9SSrinivas Kandagatla } 1953af3d54b9SSrinivas Kandagatla return 0; 1954af3d54b9SSrinivas Kandagatla } 1955af3d54b9SSrinivas Kandagatla 1956857b602aSYe Bin static const struct snd_soc_dai_ops rx_macro_dai_ops = { 1957af3d54b9SSrinivas Kandagatla .hw_params = rx_macro_hw_params, 1958af3d54b9SSrinivas Kandagatla .get_channel_map = rx_macro_get_channel_map, 1959af3d54b9SSrinivas Kandagatla .mute_stream = rx_macro_digital_mute, 1960af3d54b9SSrinivas Kandagatla }; 1961af3d54b9SSrinivas Kandagatla 1962af3d54b9SSrinivas Kandagatla static struct snd_soc_dai_driver rx_macro_dai[] = { 1963af3d54b9SSrinivas Kandagatla { 1964af3d54b9SSrinivas Kandagatla .name = "rx_macro_rx1", 1965af3d54b9SSrinivas Kandagatla .id = RX_MACRO_AIF1_PB, 1966af3d54b9SSrinivas Kandagatla .playback = { 1967af3d54b9SSrinivas Kandagatla .stream_name = "RX_MACRO_AIF1 Playback", 1968af3d54b9SSrinivas Kandagatla .rates = RX_MACRO_RATES | RX_MACRO_FRAC_RATES, 1969af3d54b9SSrinivas Kandagatla .formats = RX_MACRO_FORMATS, 1970af3d54b9SSrinivas Kandagatla .rate_max = 384000, 1971af3d54b9SSrinivas Kandagatla .rate_min = 8000, 1972af3d54b9SSrinivas Kandagatla .channels_min = 1, 1973af3d54b9SSrinivas Kandagatla .channels_max = 2, 1974af3d54b9SSrinivas Kandagatla }, 1975af3d54b9SSrinivas Kandagatla .ops = &rx_macro_dai_ops, 1976af3d54b9SSrinivas Kandagatla }, 1977af3d54b9SSrinivas Kandagatla { 1978af3d54b9SSrinivas Kandagatla .name = "rx_macro_rx2", 1979af3d54b9SSrinivas Kandagatla .id = RX_MACRO_AIF2_PB, 1980af3d54b9SSrinivas Kandagatla .playback = { 1981af3d54b9SSrinivas Kandagatla .stream_name = "RX_MACRO_AIF2 Playback", 1982af3d54b9SSrinivas Kandagatla .rates = RX_MACRO_RATES | RX_MACRO_FRAC_RATES, 1983af3d54b9SSrinivas Kandagatla .formats = RX_MACRO_FORMATS, 1984af3d54b9SSrinivas Kandagatla .rate_max = 384000, 1985af3d54b9SSrinivas Kandagatla .rate_min = 8000, 1986af3d54b9SSrinivas Kandagatla .channels_min = 1, 1987af3d54b9SSrinivas Kandagatla .channels_max = 2, 1988af3d54b9SSrinivas Kandagatla }, 1989af3d54b9SSrinivas Kandagatla .ops = &rx_macro_dai_ops, 1990af3d54b9SSrinivas Kandagatla }, 1991af3d54b9SSrinivas Kandagatla { 1992af3d54b9SSrinivas Kandagatla .name = "rx_macro_rx3", 1993af3d54b9SSrinivas Kandagatla .id = RX_MACRO_AIF3_PB, 1994af3d54b9SSrinivas Kandagatla .playback = { 1995af3d54b9SSrinivas Kandagatla .stream_name = "RX_MACRO_AIF3 Playback", 1996af3d54b9SSrinivas Kandagatla .rates = RX_MACRO_RATES | RX_MACRO_FRAC_RATES, 1997af3d54b9SSrinivas Kandagatla .formats = RX_MACRO_FORMATS, 1998af3d54b9SSrinivas Kandagatla .rate_max = 384000, 1999af3d54b9SSrinivas Kandagatla .rate_min = 8000, 2000af3d54b9SSrinivas Kandagatla .channels_min = 1, 2001af3d54b9SSrinivas Kandagatla .channels_max = 2, 2002af3d54b9SSrinivas Kandagatla }, 2003af3d54b9SSrinivas Kandagatla .ops = &rx_macro_dai_ops, 2004af3d54b9SSrinivas Kandagatla }, 2005af3d54b9SSrinivas Kandagatla { 2006af3d54b9SSrinivas Kandagatla .name = "rx_macro_rx4", 2007af3d54b9SSrinivas Kandagatla .id = RX_MACRO_AIF4_PB, 2008af3d54b9SSrinivas Kandagatla .playback = { 2009af3d54b9SSrinivas Kandagatla .stream_name = "RX_MACRO_AIF4 Playback", 2010af3d54b9SSrinivas Kandagatla .rates = RX_MACRO_RATES | RX_MACRO_FRAC_RATES, 2011af3d54b9SSrinivas Kandagatla .formats = RX_MACRO_FORMATS, 2012af3d54b9SSrinivas Kandagatla .rate_max = 384000, 2013af3d54b9SSrinivas Kandagatla .rate_min = 8000, 2014af3d54b9SSrinivas Kandagatla .channels_min = 1, 2015af3d54b9SSrinivas Kandagatla .channels_max = 2, 2016af3d54b9SSrinivas Kandagatla }, 2017af3d54b9SSrinivas Kandagatla .ops = &rx_macro_dai_ops, 2018af3d54b9SSrinivas Kandagatla }, 2019af3d54b9SSrinivas Kandagatla { 2020af3d54b9SSrinivas Kandagatla .name = "rx_macro_echo", 2021af3d54b9SSrinivas Kandagatla .id = RX_MACRO_AIF_ECHO, 2022af3d54b9SSrinivas Kandagatla .capture = { 2023af3d54b9SSrinivas Kandagatla .stream_name = "RX_AIF_ECHO Capture", 2024af3d54b9SSrinivas Kandagatla .rates = RX_MACRO_ECHO_RATES, 2025af3d54b9SSrinivas Kandagatla .formats = RX_MACRO_ECHO_FORMATS, 2026af3d54b9SSrinivas Kandagatla .rate_max = 48000, 2027af3d54b9SSrinivas Kandagatla .rate_min = 8000, 2028af3d54b9SSrinivas Kandagatla .channels_min = 1, 2029af3d54b9SSrinivas Kandagatla .channels_max = 3, 2030af3d54b9SSrinivas Kandagatla }, 2031af3d54b9SSrinivas Kandagatla .ops = &rx_macro_dai_ops, 2032af3d54b9SSrinivas Kandagatla }, 2033af3d54b9SSrinivas Kandagatla }; 2034af3d54b9SSrinivas Kandagatla 2035af3d54b9SSrinivas Kandagatla static void rx_macro_mclk_enable(struct rx_macro *rx, bool mclk_enable) 2036af3d54b9SSrinivas Kandagatla { 2037af3d54b9SSrinivas Kandagatla struct regmap *regmap = rx->regmap; 2038af3d54b9SSrinivas Kandagatla 2039af3d54b9SSrinivas Kandagatla if (mclk_enable) { 2040af3d54b9SSrinivas Kandagatla if (rx->rx_mclk_users == 0) { 2041af3d54b9SSrinivas Kandagatla regmap_update_bits(regmap, CDC_RX_CLK_RST_CTRL_MCLK_CONTROL, 2042af3d54b9SSrinivas Kandagatla CDC_RX_CLK_MCLK_EN_MASK | 2043af3d54b9SSrinivas Kandagatla CDC_RX_CLK_MCLK2_EN_MASK, 2044af3d54b9SSrinivas Kandagatla CDC_RX_CLK_MCLK_ENABLE | 2045af3d54b9SSrinivas Kandagatla CDC_RX_CLK_MCLK2_ENABLE); 2046af3d54b9SSrinivas Kandagatla regmap_update_bits(regmap, CDC_RX_CLK_RST_CTRL_FS_CNT_CONTROL, 2047af3d54b9SSrinivas Kandagatla CDC_RX_FS_MCLK_CNT_CLR_MASK, 0x00); 2048af3d54b9SSrinivas Kandagatla regmap_update_bits(regmap, CDC_RX_CLK_RST_CTRL_FS_CNT_CONTROL, 2049af3d54b9SSrinivas Kandagatla CDC_RX_FS_MCLK_CNT_EN_MASK, 2050af3d54b9SSrinivas Kandagatla CDC_RX_FS_MCLK_CNT_ENABLE); 2051af3d54b9SSrinivas Kandagatla regcache_mark_dirty(regmap); 2052af3d54b9SSrinivas Kandagatla regcache_sync(regmap); 2053af3d54b9SSrinivas Kandagatla } 2054af3d54b9SSrinivas Kandagatla rx->rx_mclk_users++; 2055af3d54b9SSrinivas Kandagatla } else { 2056af3d54b9SSrinivas Kandagatla if (rx->rx_mclk_users <= 0) { 2057af3d54b9SSrinivas Kandagatla dev_err(rx->dev, "%s: clock already disabled\n", __func__); 2058af3d54b9SSrinivas Kandagatla rx->rx_mclk_users = 0; 2059af3d54b9SSrinivas Kandagatla return; 2060af3d54b9SSrinivas Kandagatla } 2061af3d54b9SSrinivas Kandagatla rx->rx_mclk_users--; 2062af3d54b9SSrinivas Kandagatla if (rx->rx_mclk_users == 0) { 2063af3d54b9SSrinivas Kandagatla regmap_update_bits(regmap, CDC_RX_CLK_RST_CTRL_FS_CNT_CONTROL, 2064af3d54b9SSrinivas Kandagatla CDC_RX_FS_MCLK_CNT_EN_MASK, 0x0); 2065af3d54b9SSrinivas Kandagatla regmap_update_bits(regmap, CDC_RX_CLK_RST_CTRL_FS_CNT_CONTROL, 2066af3d54b9SSrinivas Kandagatla CDC_RX_FS_MCLK_CNT_CLR_MASK, 2067af3d54b9SSrinivas Kandagatla CDC_RX_FS_MCLK_CNT_CLR); 2068af3d54b9SSrinivas Kandagatla regmap_update_bits(regmap, CDC_RX_CLK_RST_CTRL_MCLK_CONTROL, 2069af3d54b9SSrinivas Kandagatla CDC_RX_CLK_MCLK_EN_MASK | 2070af3d54b9SSrinivas Kandagatla CDC_RX_CLK_MCLK2_EN_MASK, 0x0); 2071af3d54b9SSrinivas Kandagatla } 2072af3d54b9SSrinivas Kandagatla } 2073af3d54b9SSrinivas Kandagatla } 2074af3d54b9SSrinivas Kandagatla 20754f692926SSrinivas Kandagatla static int rx_macro_mclk_event(struct snd_soc_dapm_widget *w, 20764f692926SSrinivas Kandagatla struct snd_kcontrol *kcontrol, int event) 20774f692926SSrinivas Kandagatla { 20784f692926SSrinivas Kandagatla struct snd_soc_component *component = snd_soc_dapm_to_component(w->dapm); 20794f692926SSrinivas Kandagatla struct rx_macro *rx = snd_soc_component_get_drvdata(component); 20804f692926SSrinivas Kandagatla int ret = 0; 20814f692926SSrinivas Kandagatla 20824f692926SSrinivas Kandagatla switch (event) { 20834f692926SSrinivas Kandagatla case SND_SOC_DAPM_PRE_PMU: 20844f692926SSrinivas Kandagatla rx_macro_mclk_enable(rx, true); 20854f692926SSrinivas Kandagatla break; 20864f692926SSrinivas Kandagatla case SND_SOC_DAPM_POST_PMD: 20874f692926SSrinivas Kandagatla rx_macro_mclk_enable(rx, false); 20884f692926SSrinivas Kandagatla break; 20894f692926SSrinivas Kandagatla default: 20904f692926SSrinivas Kandagatla dev_err(component->dev, "%s: invalid DAPM event %d\n", __func__, event); 20914f692926SSrinivas Kandagatla ret = -EINVAL; 20924f692926SSrinivas Kandagatla } 20934f692926SSrinivas Kandagatla return ret; 20944f692926SSrinivas Kandagatla } 20954f692926SSrinivas Kandagatla 20964f692926SSrinivas Kandagatla static bool rx_macro_adie_lb(struct snd_soc_component *component, 20974f692926SSrinivas Kandagatla int interp_idx) 20984f692926SSrinivas Kandagatla { 20994f692926SSrinivas Kandagatla u16 int_mux_cfg0, int_mux_cfg1; 21004f692926SSrinivas Kandagatla u8 int_n_inp0, int_n_inp1, int_n_inp2; 21014f692926SSrinivas Kandagatla 21024f692926SSrinivas Kandagatla int_mux_cfg0 = CDC_RX_INP_MUX_RX_INT0_CFG0 + interp_idx * 8; 21034f692926SSrinivas Kandagatla int_mux_cfg1 = int_mux_cfg0 + 4; 21044f692926SSrinivas Kandagatla 21054f692926SSrinivas Kandagatla int_n_inp0 = snd_soc_component_read_field(component, int_mux_cfg0, 21064f692926SSrinivas Kandagatla CDC_RX_INTX_1_MIX_INP0_SEL_MASK); 21074f692926SSrinivas Kandagatla int_n_inp1 = snd_soc_component_read_field(component, int_mux_cfg0, 21084f692926SSrinivas Kandagatla CDC_RX_INTX_1_MIX_INP1_SEL_MASK); 21094f692926SSrinivas Kandagatla int_n_inp2 = snd_soc_component_read_field(component, int_mux_cfg1, 21104f692926SSrinivas Kandagatla CDC_RX_INTX_1_MIX_INP2_SEL_MASK); 21114f692926SSrinivas Kandagatla 21124f692926SSrinivas Kandagatla if (int_n_inp0 == INTn_1_INP_SEL_DEC0 || 21134f692926SSrinivas Kandagatla int_n_inp0 == INTn_1_INP_SEL_DEC1 || 21144f692926SSrinivas Kandagatla int_n_inp0 == INTn_1_INP_SEL_IIR0 || 21154f692926SSrinivas Kandagatla int_n_inp0 == INTn_1_INP_SEL_IIR1) 21164f692926SSrinivas Kandagatla return true; 21174f692926SSrinivas Kandagatla 21184f692926SSrinivas Kandagatla if (int_n_inp1 == INTn_1_INP_SEL_DEC0 || 21194f692926SSrinivas Kandagatla int_n_inp1 == INTn_1_INP_SEL_DEC1 || 21204f692926SSrinivas Kandagatla int_n_inp1 == INTn_1_INP_SEL_IIR0 || 21214f692926SSrinivas Kandagatla int_n_inp1 == INTn_1_INP_SEL_IIR1) 21224f692926SSrinivas Kandagatla return true; 21234f692926SSrinivas Kandagatla 21244f692926SSrinivas Kandagatla if (int_n_inp2 == INTn_1_INP_SEL_DEC0 || 21254f692926SSrinivas Kandagatla int_n_inp2 == INTn_1_INP_SEL_DEC1 || 21264f692926SSrinivas Kandagatla int_n_inp2 == INTn_1_INP_SEL_IIR0 || 21274f692926SSrinivas Kandagatla int_n_inp2 == INTn_1_INP_SEL_IIR1) 21284f692926SSrinivas Kandagatla return true; 21294f692926SSrinivas Kandagatla 21304f692926SSrinivas Kandagatla return false; 21314f692926SSrinivas Kandagatla } 21324f692926SSrinivas Kandagatla 21334f692926SSrinivas Kandagatla static int rx_macro_enable_interp_clk(struct snd_soc_component *component, 21344f692926SSrinivas Kandagatla int event, int interp_idx); 21354f692926SSrinivas Kandagatla static int rx_macro_enable_main_path(struct snd_soc_dapm_widget *w, 21364f692926SSrinivas Kandagatla struct snd_kcontrol *kcontrol, 21374f692926SSrinivas Kandagatla int event) 21384f692926SSrinivas Kandagatla { 21394f692926SSrinivas Kandagatla struct snd_soc_component *component = snd_soc_dapm_to_component(w->dapm); 2140dbacef05SSrinivas Kandagatla struct rx_macro *rx = snd_soc_component_get_drvdata(component); 21414f692926SSrinivas Kandagatla u16 gain_reg, reg; 21424f692926SSrinivas Kandagatla 2143dbacef05SSrinivas Kandagatla reg = CDC_RX_RXn_RX_PATH_CTL(rx, w->shift); 2144dbacef05SSrinivas Kandagatla gain_reg = CDC_RX_RXn_RX_VOL_CTL(rx, w->shift); 21454f692926SSrinivas Kandagatla 21464f692926SSrinivas Kandagatla switch (event) { 21474f692926SSrinivas Kandagatla case SND_SOC_DAPM_PRE_PMU: 21484f692926SSrinivas Kandagatla rx_macro_enable_interp_clk(component, event, w->shift); 21494f692926SSrinivas Kandagatla if (rx_macro_adie_lb(component, w->shift)) 21504f692926SSrinivas Kandagatla snd_soc_component_update_bits(component, reg, 21514f692926SSrinivas Kandagatla CDC_RX_PATH_CLK_EN_MASK, 21524f692926SSrinivas Kandagatla CDC_RX_PATH_CLK_ENABLE); 21534f692926SSrinivas Kandagatla break; 21544f692926SSrinivas Kandagatla case SND_SOC_DAPM_POST_PMU: 21554f692926SSrinivas Kandagatla snd_soc_component_write(component, gain_reg, 21564f692926SSrinivas Kandagatla snd_soc_component_read(component, gain_reg)); 21574f692926SSrinivas Kandagatla break; 21584f692926SSrinivas Kandagatla case SND_SOC_DAPM_POST_PMD: 21594f692926SSrinivas Kandagatla rx_macro_enable_interp_clk(component, event, w->shift); 21604f692926SSrinivas Kandagatla break; 21614f692926SSrinivas Kandagatla } 21624f692926SSrinivas Kandagatla 21634f692926SSrinivas Kandagatla return 0; 21644f692926SSrinivas Kandagatla } 21654f692926SSrinivas Kandagatla 21664f692926SSrinivas Kandagatla static int rx_macro_config_compander(struct snd_soc_component *component, 21674f692926SSrinivas Kandagatla struct rx_macro *rx, 21684f692926SSrinivas Kandagatla int comp, int event) 21694f692926SSrinivas Kandagatla { 21704f692926SSrinivas Kandagatla u8 pcm_rate, val; 21714f692926SSrinivas Kandagatla 21724f692926SSrinivas Kandagatla /* AUX does not have compander */ 21734f692926SSrinivas Kandagatla if (comp == INTERP_AUX) 21744f692926SSrinivas Kandagatla return 0; 21754f692926SSrinivas Kandagatla 2176dbacef05SSrinivas Kandagatla pcm_rate = snd_soc_component_read(component, CDC_RX_RXn_RX_PATH_CTL(rx, comp)) & 0x0F; 21774f692926SSrinivas Kandagatla if (pcm_rate < 0x06) 21784f692926SSrinivas Kandagatla val = 0x03; 21794f692926SSrinivas Kandagatla else if (pcm_rate < 0x08) 21804f692926SSrinivas Kandagatla val = 0x01; 21814f692926SSrinivas Kandagatla else if (pcm_rate < 0x0B) 21824f692926SSrinivas Kandagatla val = 0x02; 21834f692926SSrinivas Kandagatla else 21844f692926SSrinivas Kandagatla val = 0x00; 21854f692926SSrinivas Kandagatla 21864f692926SSrinivas Kandagatla if (SND_SOC_DAPM_EVENT_ON(event)) 2187dbacef05SSrinivas Kandagatla snd_soc_component_update_bits(component, CDC_RX_RXn_RX_PATH_CFG3(rx, comp), 21884f692926SSrinivas Kandagatla CDC_RX_DC_COEFF_SEL_MASK, val); 21894f692926SSrinivas Kandagatla 21904f692926SSrinivas Kandagatla if (SND_SOC_DAPM_EVENT_OFF(event)) 2191dbacef05SSrinivas Kandagatla snd_soc_component_update_bits(component, CDC_RX_RXn_RX_PATH_CFG3(rx, comp), 21924f692926SSrinivas Kandagatla CDC_RX_DC_COEFF_SEL_MASK, 0x3); 21934f692926SSrinivas Kandagatla if (!rx->comp_enabled[comp]) 21944f692926SSrinivas Kandagatla return 0; 21954f692926SSrinivas Kandagatla 21964f692926SSrinivas Kandagatla if (SND_SOC_DAPM_EVENT_ON(event)) { 21974f692926SSrinivas Kandagatla /* Enable Compander Clock */ 21984f692926SSrinivas Kandagatla snd_soc_component_write_field(component, CDC_RX_COMPANDERn_CTL0(comp), 21994f692926SSrinivas Kandagatla CDC_RX_COMPANDERn_CLK_EN_MASK, 0x1); 22004f692926SSrinivas Kandagatla snd_soc_component_write_field(component, CDC_RX_COMPANDERn_CTL0(comp), 22014f692926SSrinivas Kandagatla CDC_RX_COMPANDERn_SOFT_RST_MASK, 0x1); 22024f692926SSrinivas Kandagatla snd_soc_component_write_field(component, CDC_RX_COMPANDERn_CTL0(comp), 22034f692926SSrinivas Kandagatla CDC_RX_COMPANDERn_SOFT_RST_MASK, 0x0); 2204dbacef05SSrinivas Kandagatla snd_soc_component_write_field(component, CDC_RX_RXn_RX_PATH_CFG0(rx, comp), 22054f692926SSrinivas Kandagatla CDC_RX_RXn_COMP_EN_MASK, 0x1); 22064f692926SSrinivas Kandagatla } 22074f692926SSrinivas Kandagatla 22084f692926SSrinivas Kandagatla if (SND_SOC_DAPM_EVENT_OFF(event)) { 22094f692926SSrinivas Kandagatla snd_soc_component_write_field(component, CDC_RX_COMPANDERn_CTL0(comp), 22104f692926SSrinivas Kandagatla CDC_RX_COMPANDERn_HALT_MASK, 0x1); 2211dbacef05SSrinivas Kandagatla snd_soc_component_write_field(component, CDC_RX_RXn_RX_PATH_CFG0(rx, comp), 22124f692926SSrinivas Kandagatla CDC_RX_RXn_COMP_EN_MASK, 0x0); 22134f692926SSrinivas Kandagatla snd_soc_component_write_field(component, CDC_RX_COMPANDERn_CTL0(comp), 22144f692926SSrinivas Kandagatla CDC_RX_COMPANDERn_CLK_EN_MASK, 0x0); 22154f692926SSrinivas Kandagatla snd_soc_component_write_field(component, CDC_RX_COMPANDERn_CTL0(comp), 22164f692926SSrinivas Kandagatla CDC_RX_COMPANDERn_HALT_MASK, 0x0); 22174f692926SSrinivas Kandagatla } 22184f692926SSrinivas Kandagatla 22194f692926SSrinivas Kandagatla return 0; 22204f692926SSrinivas Kandagatla } 22214f692926SSrinivas Kandagatla 22224f692926SSrinivas Kandagatla static int rx_macro_load_compander_coeff(struct snd_soc_component *component, 22234f692926SSrinivas Kandagatla struct rx_macro *rx, 22244f692926SSrinivas Kandagatla int comp, int event) 22254f692926SSrinivas Kandagatla { 22264f692926SSrinivas Kandagatla u16 comp_coeff_lsb_reg, comp_coeff_msb_reg; 22274f692926SSrinivas Kandagatla int i; 2228ff568785SColin Ian King int hph_pwr_mode; 22294f692926SSrinivas Kandagatla 223042c709c4SSrinivas Kandagatla /* AUX does not have compander */ 223142c709c4SSrinivas Kandagatla if (comp == INTERP_AUX) 223242c709c4SSrinivas Kandagatla return 0; 223342c709c4SSrinivas Kandagatla 22344f692926SSrinivas Kandagatla if (!rx->comp_enabled[comp]) 22354f692926SSrinivas Kandagatla return 0; 22364f692926SSrinivas Kandagatla 22374f692926SSrinivas Kandagatla if (comp == INTERP_HPHL) { 22384f692926SSrinivas Kandagatla comp_coeff_lsb_reg = CDC_RX_TOP_HPHL_COMP_WR_LSB; 22394f692926SSrinivas Kandagatla comp_coeff_msb_reg = CDC_RX_TOP_HPHL_COMP_WR_MSB; 22404f692926SSrinivas Kandagatla } else if (comp == INTERP_HPHR) { 22414f692926SSrinivas Kandagatla comp_coeff_lsb_reg = CDC_RX_TOP_HPHR_COMP_WR_LSB; 22424f692926SSrinivas Kandagatla comp_coeff_msb_reg = CDC_RX_TOP_HPHR_COMP_WR_MSB; 22434f692926SSrinivas Kandagatla } else { 22444f692926SSrinivas Kandagatla /* compander coefficients are loaded only for hph path */ 22454f692926SSrinivas Kandagatla return 0; 22464f692926SSrinivas Kandagatla } 22474f692926SSrinivas Kandagatla 22484f692926SSrinivas Kandagatla hph_pwr_mode = rx->hph_pwr_mode; 22494f692926SSrinivas Kandagatla 22504f692926SSrinivas Kandagatla if (SND_SOC_DAPM_EVENT_ON(event)) { 22514f692926SSrinivas Kandagatla /* Load Compander Coeff */ 22524f692926SSrinivas Kandagatla for (i = 0; i < COMP_MAX_COEFF; i++) { 22534f692926SSrinivas Kandagatla snd_soc_component_write(component, comp_coeff_lsb_reg, 22544f692926SSrinivas Kandagatla comp_coeff_table[hph_pwr_mode][i].lsb); 22554f692926SSrinivas Kandagatla snd_soc_component_write(component, comp_coeff_msb_reg, 22564f692926SSrinivas Kandagatla comp_coeff_table[hph_pwr_mode][i].msb); 22574f692926SSrinivas Kandagatla } 22584f692926SSrinivas Kandagatla } 22594f692926SSrinivas Kandagatla 22604f692926SSrinivas Kandagatla return 0; 22614f692926SSrinivas Kandagatla } 22624f692926SSrinivas Kandagatla 22634f692926SSrinivas Kandagatla static void rx_macro_enable_softclip_clk(struct snd_soc_component *component, 22644f692926SSrinivas Kandagatla struct rx_macro *rx, bool enable) 22654f692926SSrinivas Kandagatla { 22664f692926SSrinivas Kandagatla if (enable) { 22674f692926SSrinivas Kandagatla if (rx->softclip_clk_users == 0) 22684f692926SSrinivas Kandagatla snd_soc_component_write_field(component, CDC_RX_SOFTCLIP_CRC, 22694f692926SSrinivas Kandagatla CDC_RX_SOFTCLIP_CLK_EN_MASK, 1); 22704f692926SSrinivas Kandagatla rx->softclip_clk_users++; 22714f692926SSrinivas Kandagatla } else { 22724f692926SSrinivas Kandagatla rx->softclip_clk_users--; 22734f692926SSrinivas Kandagatla if (rx->softclip_clk_users == 0) 22744f692926SSrinivas Kandagatla snd_soc_component_write_field(component, CDC_RX_SOFTCLIP_CRC, 22754f692926SSrinivas Kandagatla CDC_RX_SOFTCLIP_CLK_EN_MASK, 0); 22764f692926SSrinivas Kandagatla } 22774f692926SSrinivas Kandagatla } 22784f692926SSrinivas Kandagatla 22794f692926SSrinivas Kandagatla static int rx_macro_config_softclip(struct snd_soc_component *component, 22804f692926SSrinivas Kandagatla struct rx_macro *rx, int event) 22814f692926SSrinivas Kandagatla { 22824f692926SSrinivas Kandagatla 22834f692926SSrinivas Kandagatla if (!rx->is_softclip_on) 22844f692926SSrinivas Kandagatla return 0; 22854f692926SSrinivas Kandagatla 22864f692926SSrinivas Kandagatla if (SND_SOC_DAPM_EVENT_ON(event)) { 22874f692926SSrinivas Kandagatla /* Enable Softclip clock */ 22884f692926SSrinivas Kandagatla rx_macro_enable_softclip_clk(component, rx, true); 22894f692926SSrinivas Kandagatla /* Enable Softclip control */ 22904f692926SSrinivas Kandagatla snd_soc_component_write_field(component, CDC_RX_SOFTCLIP_SOFTCLIP_CTRL, 22914f692926SSrinivas Kandagatla CDC_RX_SOFTCLIP_EN_MASK, 0x01); 22924f692926SSrinivas Kandagatla } 22934f692926SSrinivas Kandagatla 22944f692926SSrinivas Kandagatla if (SND_SOC_DAPM_EVENT_OFF(event)) { 22954f692926SSrinivas Kandagatla snd_soc_component_write_field(component, CDC_RX_SOFTCLIP_SOFTCLIP_CTRL, 22964f692926SSrinivas Kandagatla CDC_RX_SOFTCLIP_EN_MASK, 0x0); 22974f692926SSrinivas Kandagatla rx_macro_enable_softclip_clk(component, rx, false); 22984f692926SSrinivas Kandagatla } 22994f692926SSrinivas Kandagatla 23004f692926SSrinivas Kandagatla return 0; 23014f692926SSrinivas Kandagatla } 23024f692926SSrinivas Kandagatla 23034f692926SSrinivas Kandagatla static int rx_macro_config_aux_hpf(struct snd_soc_component *component, 23044f692926SSrinivas Kandagatla struct rx_macro *rx, int event) 23054f692926SSrinivas Kandagatla { 23064f692926SSrinivas Kandagatla if (SND_SOC_DAPM_EVENT_ON(event)) { 23074f692926SSrinivas Kandagatla /* Update Aux HPF control */ 23084f692926SSrinivas Kandagatla if (!rx->is_aux_hpf_on) 23094f692926SSrinivas Kandagatla snd_soc_component_update_bits(component, 2310dbacef05SSrinivas Kandagatla CDC_RX_RXn_RX_PATH_CFG1(rx, 2), 0x04, 0x00); 23114f692926SSrinivas Kandagatla } 23124f692926SSrinivas Kandagatla 23134f692926SSrinivas Kandagatla if (SND_SOC_DAPM_EVENT_OFF(event)) { 23144f692926SSrinivas Kandagatla /* Reset to default (HPF=ON) */ 23154f692926SSrinivas Kandagatla snd_soc_component_update_bits(component, 2316dbacef05SSrinivas Kandagatla CDC_RX_RXn_RX_PATH_CFG1(rx, 2), 0x04, 0x04); 23174f692926SSrinivas Kandagatla } 23184f692926SSrinivas Kandagatla 23194f692926SSrinivas Kandagatla return 0; 23204f692926SSrinivas Kandagatla } 23214f692926SSrinivas Kandagatla 2322af3d54b9SSrinivas Kandagatla static inline void rx_macro_enable_clsh_block(struct rx_macro *rx, bool enable) 2323af3d54b9SSrinivas Kandagatla { 2324af3d54b9SSrinivas Kandagatla if ((enable && ++rx->clsh_users == 1) || (!enable && --rx->clsh_users == 0)) 2325af3d54b9SSrinivas Kandagatla snd_soc_component_update_bits(rx->component, CDC_RX_CLSH_CRC, 2326af3d54b9SSrinivas Kandagatla CDC_RX_CLSH_CLK_EN_MASK, enable); 2327af3d54b9SSrinivas Kandagatla if (rx->clsh_users < 0) 2328af3d54b9SSrinivas Kandagatla rx->clsh_users = 0; 2329af3d54b9SSrinivas Kandagatla } 2330af3d54b9SSrinivas Kandagatla 23314f692926SSrinivas Kandagatla static int rx_macro_config_classh(struct snd_soc_component *component, 23324f692926SSrinivas Kandagatla struct rx_macro *rx, 23334f692926SSrinivas Kandagatla int interp_n, int event) 23344f692926SSrinivas Kandagatla { 23354f692926SSrinivas Kandagatla if (SND_SOC_DAPM_EVENT_OFF(event)) { 23364f692926SSrinivas Kandagatla rx_macro_enable_clsh_block(rx, false); 23374f692926SSrinivas Kandagatla return 0; 23384f692926SSrinivas Kandagatla } 23394f692926SSrinivas Kandagatla 23404f692926SSrinivas Kandagatla if (!SND_SOC_DAPM_EVENT_ON(event)) 23414f692926SSrinivas Kandagatla return 0; 23424f692926SSrinivas Kandagatla 23434f692926SSrinivas Kandagatla rx_macro_enable_clsh_block(rx, true); 23444f692926SSrinivas Kandagatla if (interp_n == INTERP_HPHL || 23454f692926SSrinivas Kandagatla interp_n == INTERP_HPHR) { 23464f692926SSrinivas Kandagatla /* 23474f692926SSrinivas Kandagatla * These K1 values depend on the Headphone Impedance 23484f692926SSrinivas Kandagatla * For now it is assumed to be 16 ohm 23494f692926SSrinivas Kandagatla */ 23504f692926SSrinivas Kandagatla snd_soc_component_write(component, CDC_RX_CLSH_K1_LSB, 0xc0); 23514f692926SSrinivas Kandagatla snd_soc_component_write_field(component, CDC_RX_CLSH_K1_MSB, 23524f692926SSrinivas Kandagatla CDC_RX_CLSH_K1_MSB_COEFF_MASK, 0); 23534f692926SSrinivas Kandagatla } 23544f692926SSrinivas Kandagatla switch (interp_n) { 23554f692926SSrinivas Kandagatla case INTERP_HPHL: 23564f692926SSrinivas Kandagatla if (rx->is_ear_mode_on) 23574f692926SSrinivas Kandagatla snd_soc_component_update_bits(component, 23584f692926SSrinivas Kandagatla CDC_RX_CLSH_HPH_V_PA, 23594f692926SSrinivas Kandagatla CDC_RX_CLSH_HPH_V_PA_MIN_MASK, 0x39); 23604f692926SSrinivas Kandagatla else 23614f692926SSrinivas Kandagatla snd_soc_component_update_bits(component, 23624f692926SSrinivas Kandagatla CDC_RX_CLSH_HPH_V_PA, 23634f692926SSrinivas Kandagatla CDC_RX_CLSH_HPH_V_PA_MIN_MASK, 0x1c); 23644f692926SSrinivas Kandagatla snd_soc_component_update_bits(component, 23654f692926SSrinivas Kandagatla CDC_RX_CLSH_DECAY_CTRL, 23664f692926SSrinivas Kandagatla CDC_RX_CLSH_DECAY_RATE_MASK, 0x0); 23674f692926SSrinivas Kandagatla snd_soc_component_write_field(component, 2368dbacef05SSrinivas Kandagatla CDC_RX_RXn_RX_PATH_CFG0(rx, 0), 23694f692926SSrinivas Kandagatla CDC_RX_RXn_CLSH_EN_MASK, 0x1); 23704f692926SSrinivas Kandagatla break; 23714f692926SSrinivas Kandagatla case INTERP_HPHR: 23724f692926SSrinivas Kandagatla if (rx->is_ear_mode_on) 23734f692926SSrinivas Kandagatla snd_soc_component_update_bits(component, 23744f692926SSrinivas Kandagatla CDC_RX_CLSH_HPH_V_PA, 23754f692926SSrinivas Kandagatla CDC_RX_CLSH_HPH_V_PA_MIN_MASK, 0x39); 23764f692926SSrinivas Kandagatla else 23774f692926SSrinivas Kandagatla snd_soc_component_update_bits(component, 23784f692926SSrinivas Kandagatla CDC_RX_CLSH_HPH_V_PA, 23794f692926SSrinivas Kandagatla CDC_RX_CLSH_HPH_V_PA_MIN_MASK, 0x1c); 23804f692926SSrinivas Kandagatla snd_soc_component_update_bits(component, 23814f692926SSrinivas Kandagatla CDC_RX_CLSH_DECAY_CTRL, 23824f692926SSrinivas Kandagatla CDC_RX_CLSH_DECAY_RATE_MASK, 0x0); 2383cb04d8cdSSrinivas Kandagatla snd_soc_component_write_field(component, 2384dbacef05SSrinivas Kandagatla CDC_RX_RXn_RX_PATH_CFG0(rx, 1), 23854f692926SSrinivas Kandagatla CDC_RX_RXn_CLSH_EN_MASK, 0x1); 23864f692926SSrinivas Kandagatla break; 23874f692926SSrinivas Kandagatla case INTERP_AUX: 23884f692926SSrinivas Kandagatla snd_soc_component_update_bits(component, 2389dbacef05SSrinivas Kandagatla CDC_RX_RXn_RX_PATH_CFG0(rx, 2), 23904f692926SSrinivas Kandagatla CDC_RX_RX2_DLY_Z_EN_MASK, 1); 23914f692926SSrinivas Kandagatla snd_soc_component_write_field(component, 2392dbacef05SSrinivas Kandagatla CDC_RX_RXn_RX_PATH_CFG0(rx, 2), 23934f692926SSrinivas Kandagatla CDC_RX_RX2_CLSH_EN_MASK, 1); 23944f692926SSrinivas Kandagatla break; 23954f692926SSrinivas Kandagatla } 23964f692926SSrinivas Kandagatla 23974f692926SSrinivas Kandagatla return 0; 23984f692926SSrinivas Kandagatla } 23994f692926SSrinivas Kandagatla 24004f692926SSrinivas Kandagatla static void rx_macro_hd2_control(struct snd_soc_component *component, 24014f692926SSrinivas Kandagatla u16 interp_idx, int event) 24024f692926SSrinivas Kandagatla { 2403dbacef05SSrinivas Kandagatla struct rx_macro *rx = snd_soc_component_get_drvdata(component); 24044f692926SSrinivas Kandagatla u16 hd2_scale_reg, hd2_enable_reg; 24054f692926SSrinivas Kandagatla 24064f692926SSrinivas Kandagatla switch (interp_idx) { 24074f692926SSrinivas Kandagatla case INTERP_HPHL: 2408dbacef05SSrinivas Kandagatla hd2_scale_reg = CDC_RX_RXn_RX_PATH_SEC3(rx, 0); 2409dbacef05SSrinivas Kandagatla hd2_enable_reg = CDC_RX_RXn_RX_PATH_CFG0(rx, 0); 24104f692926SSrinivas Kandagatla break; 24114f692926SSrinivas Kandagatla case INTERP_HPHR: 2412dbacef05SSrinivas Kandagatla hd2_scale_reg = CDC_RX_RXn_RX_PATH_SEC3(rx, 1); 2413dbacef05SSrinivas Kandagatla hd2_enable_reg = CDC_RX_RXn_RX_PATH_CFG0(rx, 1); 24144f692926SSrinivas Kandagatla break; 24154f692926SSrinivas Kandagatla } 24164f692926SSrinivas Kandagatla 24174f692926SSrinivas Kandagatla if (hd2_enable_reg && SND_SOC_DAPM_EVENT_ON(event)) { 24184f692926SSrinivas Kandagatla snd_soc_component_update_bits(component, hd2_scale_reg, 24194f692926SSrinivas Kandagatla CDC_RX_RXn_HD2_ALPHA_MASK, 0x14); 24204f692926SSrinivas Kandagatla snd_soc_component_write_field(component, hd2_enable_reg, 24214f692926SSrinivas Kandagatla CDC_RX_RXn_HD2_EN_MASK, 1); 24224f692926SSrinivas Kandagatla } 24234f692926SSrinivas Kandagatla 24244f692926SSrinivas Kandagatla if (hd2_enable_reg && SND_SOC_DAPM_EVENT_OFF(event)) { 24254f692926SSrinivas Kandagatla snd_soc_component_write_field(component, hd2_enable_reg, 24264f692926SSrinivas Kandagatla CDC_RX_RXn_HD2_EN_MASK, 0); 24274f692926SSrinivas Kandagatla snd_soc_component_update_bits(component, hd2_scale_reg, 24284f692926SSrinivas Kandagatla CDC_RX_RXn_HD2_ALPHA_MASK, 0x0); 24294f692926SSrinivas Kandagatla } 24304f692926SSrinivas Kandagatla } 24314f692926SSrinivas Kandagatla 2432af3d54b9SSrinivas Kandagatla static int rx_macro_get_compander(struct snd_kcontrol *kcontrol, 2433af3d54b9SSrinivas Kandagatla struct snd_ctl_elem_value *ucontrol) 2434af3d54b9SSrinivas Kandagatla { 2435af3d54b9SSrinivas Kandagatla struct snd_soc_component *component = 2436af3d54b9SSrinivas Kandagatla snd_soc_kcontrol_component(kcontrol); 2437af3d54b9SSrinivas Kandagatla int comp = ((struct soc_mixer_control *) kcontrol->private_value)->shift; 2438af3d54b9SSrinivas Kandagatla struct rx_macro *rx = snd_soc_component_get_drvdata(component); 2439af3d54b9SSrinivas Kandagatla 2440af3d54b9SSrinivas Kandagatla ucontrol->value.integer.value[0] = rx->comp_enabled[comp]; 2441af3d54b9SSrinivas Kandagatla return 0; 2442af3d54b9SSrinivas Kandagatla } 2443af3d54b9SSrinivas Kandagatla 2444af3d54b9SSrinivas Kandagatla static int rx_macro_set_compander(struct snd_kcontrol *kcontrol, 2445af3d54b9SSrinivas Kandagatla struct snd_ctl_elem_value *ucontrol) 2446af3d54b9SSrinivas Kandagatla { 2447af3d54b9SSrinivas Kandagatla struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol); 2448af3d54b9SSrinivas Kandagatla int comp = ((struct soc_mixer_control *) kcontrol->private_value)->shift; 2449af3d54b9SSrinivas Kandagatla int value = ucontrol->value.integer.value[0]; 2450af3d54b9SSrinivas Kandagatla struct rx_macro *rx = snd_soc_component_get_drvdata(component); 2451af3d54b9SSrinivas Kandagatla 2452af3d54b9SSrinivas Kandagatla rx->comp_enabled[comp] = value; 2453af3d54b9SSrinivas Kandagatla 2454af3d54b9SSrinivas Kandagatla return 0; 2455af3d54b9SSrinivas Kandagatla } 2456af3d54b9SSrinivas Kandagatla 24574f692926SSrinivas Kandagatla static int rx_macro_mux_get(struct snd_kcontrol *kcontrol, 24584f692926SSrinivas Kandagatla struct snd_ctl_elem_value *ucontrol) 24594f692926SSrinivas Kandagatla { 24604f692926SSrinivas Kandagatla struct snd_soc_dapm_widget *widget = snd_soc_dapm_kcontrol_widget(kcontrol); 24614f692926SSrinivas Kandagatla struct snd_soc_component *component = snd_soc_dapm_to_component(widget->dapm); 24624f692926SSrinivas Kandagatla struct rx_macro *rx = snd_soc_component_get_drvdata(component); 24634f692926SSrinivas Kandagatla 2464bcfe5f76SSrinivas Kandagatla ucontrol->value.enumerated.item[0] = 24654f692926SSrinivas Kandagatla rx->rx_port_value[widget->shift]; 24664f692926SSrinivas Kandagatla return 0; 24674f692926SSrinivas Kandagatla } 24684f692926SSrinivas Kandagatla 24694f692926SSrinivas Kandagatla static int rx_macro_mux_put(struct snd_kcontrol *kcontrol, 24704f692926SSrinivas Kandagatla struct snd_ctl_elem_value *ucontrol) 24714f692926SSrinivas Kandagatla { 24724f692926SSrinivas Kandagatla struct snd_soc_dapm_widget *widget = snd_soc_dapm_kcontrol_widget(kcontrol); 24734f692926SSrinivas Kandagatla struct snd_soc_component *component = snd_soc_dapm_to_component(widget->dapm); 24744f692926SSrinivas Kandagatla struct soc_enum *e = (struct soc_enum *)kcontrol->private_value; 24754f692926SSrinivas Kandagatla struct snd_soc_dapm_update *update = NULL; 2476bcfe5f76SSrinivas Kandagatla u32 rx_port_value = ucontrol->value.enumerated.item[0]; 24774f692926SSrinivas Kandagatla u32 aif_rst; 24784f692926SSrinivas Kandagatla struct rx_macro *rx = snd_soc_component_get_drvdata(component); 24794f692926SSrinivas Kandagatla 24804f692926SSrinivas Kandagatla aif_rst = rx->rx_port_value[widget->shift]; 24814f692926SSrinivas Kandagatla if (!rx_port_value) { 2482777af241SSrinivas Kandagatla if (aif_rst == 0) 24834f692926SSrinivas Kandagatla return 0; 24844f692926SSrinivas Kandagatla if (aif_rst > RX_MACRO_AIF4_PB) { 24854f692926SSrinivas Kandagatla dev_err(component->dev, "%s: Invalid AIF reset\n", __func__); 24864f692926SSrinivas Kandagatla return 0; 24874f692926SSrinivas Kandagatla } 24884f692926SSrinivas Kandagatla } 24894f692926SSrinivas Kandagatla rx->rx_port_value[widget->shift] = rx_port_value; 24904f692926SSrinivas Kandagatla 24914f692926SSrinivas Kandagatla switch (rx_port_value) { 24924f692926SSrinivas Kandagatla case 0: 24934f692926SSrinivas Kandagatla if (rx->active_ch_cnt[aif_rst]) { 24944f692926SSrinivas Kandagatla clear_bit(widget->shift, 24954f692926SSrinivas Kandagatla &rx->active_ch_mask[aif_rst]); 24964f692926SSrinivas Kandagatla rx->active_ch_cnt[aif_rst]--; 24974f692926SSrinivas Kandagatla } 24984f692926SSrinivas Kandagatla break; 24994f692926SSrinivas Kandagatla case 1: 25004f692926SSrinivas Kandagatla case 2: 25014f692926SSrinivas Kandagatla case 3: 25024f692926SSrinivas Kandagatla case 4: 25034f692926SSrinivas Kandagatla set_bit(widget->shift, 25044f692926SSrinivas Kandagatla &rx->active_ch_mask[rx_port_value]); 25054f692926SSrinivas Kandagatla rx->active_ch_cnt[rx_port_value]++; 25064f692926SSrinivas Kandagatla break; 25074f692926SSrinivas Kandagatla default: 25084f692926SSrinivas Kandagatla dev_err(component->dev, 25094f692926SSrinivas Kandagatla "%s:Invalid AIF_ID for RX_MACRO MUX %d\n", 25104f692926SSrinivas Kandagatla __func__, rx_port_value); 25114f692926SSrinivas Kandagatla goto err; 25124f692926SSrinivas Kandagatla } 25134f692926SSrinivas Kandagatla 25144f692926SSrinivas Kandagatla snd_soc_dapm_mux_update_power(widget->dapm, kcontrol, 25154f692926SSrinivas Kandagatla rx_port_value, e, update); 25164f692926SSrinivas Kandagatla return 0; 25174f692926SSrinivas Kandagatla err: 25184f692926SSrinivas Kandagatla return -EINVAL; 25194f692926SSrinivas Kandagatla } 25204f692926SSrinivas Kandagatla 25214f692926SSrinivas Kandagatla static const struct snd_kcontrol_new rx_macro_rx0_mux = 25224f692926SSrinivas Kandagatla SOC_DAPM_ENUM_EXT("rx_macro_rx0", rx_macro_rx0_enum, 25234f692926SSrinivas Kandagatla rx_macro_mux_get, rx_macro_mux_put); 25244f692926SSrinivas Kandagatla static const struct snd_kcontrol_new rx_macro_rx1_mux = 25254f692926SSrinivas Kandagatla SOC_DAPM_ENUM_EXT("rx_macro_rx1", rx_macro_rx1_enum, 25264f692926SSrinivas Kandagatla rx_macro_mux_get, rx_macro_mux_put); 25274f692926SSrinivas Kandagatla static const struct snd_kcontrol_new rx_macro_rx2_mux = 25284f692926SSrinivas Kandagatla SOC_DAPM_ENUM_EXT("rx_macro_rx2", rx_macro_rx2_enum, 25294f692926SSrinivas Kandagatla rx_macro_mux_get, rx_macro_mux_put); 25304f692926SSrinivas Kandagatla static const struct snd_kcontrol_new rx_macro_rx3_mux = 25314f692926SSrinivas Kandagatla SOC_DAPM_ENUM_EXT("rx_macro_rx3", rx_macro_rx3_enum, 25324f692926SSrinivas Kandagatla rx_macro_mux_get, rx_macro_mux_put); 25334f692926SSrinivas Kandagatla static const struct snd_kcontrol_new rx_macro_rx4_mux = 25344f692926SSrinivas Kandagatla SOC_DAPM_ENUM_EXT("rx_macro_rx4", rx_macro_rx4_enum, 25354f692926SSrinivas Kandagatla rx_macro_mux_get, rx_macro_mux_put); 25364f692926SSrinivas Kandagatla static const struct snd_kcontrol_new rx_macro_rx5_mux = 25374f692926SSrinivas Kandagatla SOC_DAPM_ENUM_EXT("rx_macro_rx5", rx_macro_rx5_enum, 25384f692926SSrinivas Kandagatla rx_macro_mux_get, rx_macro_mux_put); 25394f692926SSrinivas Kandagatla 2540af3d54b9SSrinivas Kandagatla static int rx_macro_get_ear_mode(struct snd_kcontrol *kcontrol, 2541af3d54b9SSrinivas Kandagatla struct snd_ctl_elem_value *ucontrol) 2542af3d54b9SSrinivas Kandagatla { 2543af3d54b9SSrinivas Kandagatla struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol); 2544af3d54b9SSrinivas Kandagatla struct rx_macro *rx = snd_soc_component_get_drvdata(component); 2545af3d54b9SSrinivas Kandagatla 2546af3d54b9SSrinivas Kandagatla ucontrol->value.integer.value[0] = rx->is_ear_mode_on; 2547af3d54b9SSrinivas Kandagatla return 0; 2548af3d54b9SSrinivas Kandagatla } 2549af3d54b9SSrinivas Kandagatla 2550af3d54b9SSrinivas Kandagatla static int rx_macro_put_ear_mode(struct snd_kcontrol *kcontrol, 2551af3d54b9SSrinivas Kandagatla struct snd_ctl_elem_value *ucontrol) 2552af3d54b9SSrinivas Kandagatla { 2553af3d54b9SSrinivas Kandagatla struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol); 2554af3d54b9SSrinivas Kandagatla struct rx_macro *rx = snd_soc_component_get_drvdata(component); 2555af3d54b9SSrinivas Kandagatla 2556af3d54b9SSrinivas Kandagatla rx->is_ear_mode_on = (!ucontrol->value.integer.value[0] ? false : true); 2557af3d54b9SSrinivas Kandagatla return 0; 2558af3d54b9SSrinivas Kandagatla } 2559af3d54b9SSrinivas Kandagatla 2560af3d54b9SSrinivas Kandagatla static int rx_macro_get_hph_hd2_mode(struct snd_kcontrol *kcontrol, 2561af3d54b9SSrinivas Kandagatla struct snd_ctl_elem_value *ucontrol) 2562af3d54b9SSrinivas Kandagatla { 2563af3d54b9SSrinivas Kandagatla struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol); 2564af3d54b9SSrinivas Kandagatla struct rx_macro *rx = snd_soc_component_get_drvdata(component); 2565af3d54b9SSrinivas Kandagatla 2566af3d54b9SSrinivas Kandagatla ucontrol->value.integer.value[0] = rx->hph_hd2_mode; 2567af3d54b9SSrinivas Kandagatla return 0; 2568af3d54b9SSrinivas Kandagatla } 2569af3d54b9SSrinivas Kandagatla 2570af3d54b9SSrinivas Kandagatla static int rx_macro_put_hph_hd2_mode(struct snd_kcontrol *kcontrol, 2571af3d54b9SSrinivas Kandagatla struct snd_ctl_elem_value *ucontrol) 2572af3d54b9SSrinivas Kandagatla { 2573af3d54b9SSrinivas Kandagatla struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol); 2574af3d54b9SSrinivas Kandagatla struct rx_macro *rx = snd_soc_component_get_drvdata(component); 2575af3d54b9SSrinivas Kandagatla 2576af3d54b9SSrinivas Kandagatla rx->hph_hd2_mode = ucontrol->value.integer.value[0]; 2577af3d54b9SSrinivas Kandagatla return 0; 2578af3d54b9SSrinivas Kandagatla } 2579af3d54b9SSrinivas Kandagatla 2580af3d54b9SSrinivas Kandagatla static int rx_macro_get_hph_pwr_mode(struct snd_kcontrol *kcontrol, 2581af3d54b9SSrinivas Kandagatla struct snd_ctl_elem_value *ucontrol) 2582af3d54b9SSrinivas Kandagatla { 2583af3d54b9SSrinivas Kandagatla struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol); 2584af3d54b9SSrinivas Kandagatla struct rx_macro *rx = snd_soc_component_get_drvdata(component); 2585af3d54b9SSrinivas Kandagatla 2586bcfe5f76SSrinivas Kandagatla ucontrol->value.enumerated.item[0] = rx->hph_pwr_mode; 2587af3d54b9SSrinivas Kandagatla return 0; 2588af3d54b9SSrinivas Kandagatla } 2589af3d54b9SSrinivas Kandagatla 2590af3d54b9SSrinivas Kandagatla static int rx_macro_put_hph_pwr_mode(struct snd_kcontrol *kcontrol, 2591af3d54b9SSrinivas Kandagatla struct snd_ctl_elem_value *ucontrol) 2592af3d54b9SSrinivas Kandagatla { 2593af3d54b9SSrinivas Kandagatla struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol); 2594af3d54b9SSrinivas Kandagatla struct rx_macro *rx = snd_soc_component_get_drvdata(component); 2595af3d54b9SSrinivas Kandagatla 2596bcfe5f76SSrinivas Kandagatla rx->hph_pwr_mode = ucontrol->value.enumerated.item[0]; 2597af3d54b9SSrinivas Kandagatla return 0; 2598af3d54b9SSrinivas Kandagatla } 2599af3d54b9SSrinivas Kandagatla 2600af3d54b9SSrinivas Kandagatla static int rx_macro_soft_clip_enable_get(struct snd_kcontrol *kcontrol, 2601af3d54b9SSrinivas Kandagatla struct snd_ctl_elem_value *ucontrol) 2602af3d54b9SSrinivas Kandagatla { 2603af3d54b9SSrinivas Kandagatla struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol); 2604af3d54b9SSrinivas Kandagatla struct rx_macro *rx = snd_soc_component_get_drvdata(component); 2605af3d54b9SSrinivas Kandagatla 2606af3d54b9SSrinivas Kandagatla ucontrol->value.integer.value[0] = rx->is_softclip_on; 2607af3d54b9SSrinivas Kandagatla 2608af3d54b9SSrinivas Kandagatla return 0; 2609af3d54b9SSrinivas Kandagatla } 2610af3d54b9SSrinivas Kandagatla 2611af3d54b9SSrinivas Kandagatla static int rx_macro_soft_clip_enable_put(struct snd_kcontrol *kcontrol, 2612af3d54b9SSrinivas Kandagatla struct snd_ctl_elem_value *ucontrol) 2613af3d54b9SSrinivas Kandagatla { 2614af3d54b9SSrinivas Kandagatla struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol); 2615af3d54b9SSrinivas Kandagatla struct rx_macro *rx = snd_soc_component_get_drvdata(component); 2616af3d54b9SSrinivas Kandagatla 2617af3d54b9SSrinivas Kandagatla rx->is_softclip_on = ucontrol->value.integer.value[0]; 2618af3d54b9SSrinivas Kandagatla 2619af3d54b9SSrinivas Kandagatla return 0; 2620af3d54b9SSrinivas Kandagatla } 2621af3d54b9SSrinivas Kandagatla 2622af3d54b9SSrinivas Kandagatla static int rx_macro_aux_hpf_mode_get(struct snd_kcontrol *kcontrol, 2623af3d54b9SSrinivas Kandagatla struct snd_ctl_elem_value *ucontrol) 2624af3d54b9SSrinivas Kandagatla { 2625af3d54b9SSrinivas Kandagatla struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol); 2626af3d54b9SSrinivas Kandagatla struct rx_macro *rx = snd_soc_component_get_drvdata(component); 2627af3d54b9SSrinivas Kandagatla 2628af3d54b9SSrinivas Kandagatla ucontrol->value.integer.value[0] = rx->is_aux_hpf_on; 2629af3d54b9SSrinivas Kandagatla 2630af3d54b9SSrinivas Kandagatla return 0; 2631af3d54b9SSrinivas Kandagatla } 2632af3d54b9SSrinivas Kandagatla 2633af3d54b9SSrinivas Kandagatla static int rx_macro_aux_hpf_mode_put(struct snd_kcontrol *kcontrol, 2634af3d54b9SSrinivas Kandagatla struct snd_ctl_elem_value *ucontrol) 2635af3d54b9SSrinivas Kandagatla { 2636af3d54b9SSrinivas Kandagatla struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol); 2637af3d54b9SSrinivas Kandagatla struct rx_macro *rx = snd_soc_component_get_drvdata(component); 2638af3d54b9SSrinivas Kandagatla 2639af3d54b9SSrinivas Kandagatla rx->is_aux_hpf_on = ucontrol->value.integer.value[0]; 2640af3d54b9SSrinivas Kandagatla 2641af3d54b9SSrinivas Kandagatla return 0; 2642af3d54b9SSrinivas Kandagatla } 2643af3d54b9SSrinivas Kandagatla 26444f692926SSrinivas Kandagatla static int rx_macro_hphdelay_lutbypass(struct snd_soc_component *component, 26454f692926SSrinivas Kandagatla struct rx_macro *rx, 26464f692926SSrinivas Kandagatla u16 interp_idx, int event) 26474f692926SSrinivas Kandagatla { 26484f692926SSrinivas Kandagatla u16 hph_lut_bypass_reg; 26494f692926SSrinivas Kandagatla u16 hph_comp_ctrl7; 26504f692926SSrinivas Kandagatla 26514f692926SSrinivas Kandagatla switch (interp_idx) { 26524f692926SSrinivas Kandagatla case INTERP_HPHL: 26534f692926SSrinivas Kandagatla hph_lut_bypass_reg = CDC_RX_TOP_HPHL_COMP_LUT; 26544f692926SSrinivas Kandagatla hph_comp_ctrl7 = CDC_RX_COMPANDER0_CTL7; 26554f692926SSrinivas Kandagatla break; 26564f692926SSrinivas Kandagatla case INTERP_HPHR: 26574f692926SSrinivas Kandagatla hph_lut_bypass_reg = CDC_RX_TOP_HPHR_COMP_LUT; 26584f692926SSrinivas Kandagatla hph_comp_ctrl7 = CDC_RX_COMPANDER1_CTL7; 26594f692926SSrinivas Kandagatla break; 26604f692926SSrinivas Kandagatla default: 26614f692926SSrinivas Kandagatla return -EINVAL; 26624f692926SSrinivas Kandagatla } 26634f692926SSrinivas Kandagatla 26644f692926SSrinivas Kandagatla if (hph_lut_bypass_reg && SND_SOC_DAPM_EVENT_ON(event)) { 26654f692926SSrinivas Kandagatla if (interp_idx == INTERP_HPHL) { 26664f692926SSrinivas Kandagatla if (rx->is_ear_mode_on) 26674f692926SSrinivas Kandagatla snd_soc_component_write_field(component, 2668dbacef05SSrinivas Kandagatla CDC_RX_RXn_RX_PATH_CFG1(rx, 0), 26694f692926SSrinivas Kandagatla CDC_RX_RX0_HPH_L_EAR_SEL_MASK, 0x1); 26704f692926SSrinivas Kandagatla else 26714f692926SSrinivas Kandagatla snd_soc_component_write_field(component, 26724f692926SSrinivas Kandagatla hph_lut_bypass_reg, 26734f692926SSrinivas Kandagatla CDC_RX_TOP_HPH_LUT_BYPASS_MASK, 1); 26744f692926SSrinivas Kandagatla } else { 26754f692926SSrinivas Kandagatla snd_soc_component_write_field(component, hph_lut_bypass_reg, 26764f692926SSrinivas Kandagatla CDC_RX_TOP_HPH_LUT_BYPASS_MASK, 1); 26774f692926SSrinivas Kandagatla } 26784f692926SSrinivas Kandagatla if (rx->hph_pwr_mode) 26794f692926SSrinivas Kandagatla snd_soc_component_write_field(component, hph_comp_ctrl7, 26804f692926SSrinivas Kandagatla CDC_RX_COMPANDER1_HPH_LOW_PWR_MODE_MASK, 0x0); 26814f692926SSrinivas Kandagatla } 26824f692926SSrinivas Kandagatla 26834f692926SSrinivas Kandagatla if (hph_lut_bypass_reg && SND_SOC_DAPM_EVENT_OFF(event)) { 26844f692926SSrinivas Kandagatla snd_soc_component_write_field(component, 2685dbacef05SSrinivas Kandagatla CDC_RX_RXn_RX_PATH_CFG1(rx, 0), 26864f692926SSrinivas Kandagatla CDC_RX_RX0_HPH_L_EAR_SEL_MASK, 0x0); 26874f692926SSrinivas Kandagatla snd_soc_component_update_bits(component, hph_lut_bypass_reg, 26884f692926SSrinivas Kandagatla CDC_RX_TOP_HPH_LUT_BYPASS_MASK, 0); 26894f692926SSrinivas Kandagatla snd_soc_component_write_field(component, hph_comp_ctrl7, 26904f692926SSrinivas Kandagatla CDC_RX_COMPANDER1_HPH_LOW_PWR_MODE_MASK, 0x1); 26914f692926SSrinivas Kandagatla } 26924f692926SSrinivas Kandagatla 26934f692926SSrinivas Kandagatla return 0; 26944f692926SSrinivas Kandagatla } 26954f692926SSrinivas Kandagatla 26964f692926SSrinivas Kandagatla static int rx_macro_enable_interp_clk(struct snd_soc_component *component, 26974f692926SSrinivas Kandagatla int event, int interp_idx) 26984f692926SSrinivas Kandagatla { 26994f692926SSrinivas Kandagatla u16 main_reg, dsm_reg, rx_cfg2_reg; 27004f692926SSrinivas Kandagatla struct rx_macro *rx = snd_soc_component_get_drvdata(component); 27014f692926SSrinivas Kandagatla 2702dbacef05SSrinivas Kandagatla main_reg = CDC_RX_RXn_RX_PATH_CTL(rx, interp_idx); 2703dbacef05SSrinivas Kandagatla dsm_reg = CDC_RX_RXn_RX_PATH_DSM_CTL(rx, interp_idx); 27044f692926SSrinivas Kandagatla if (interp_idx == INTERP_AUX) 2705dbacef05SSrinivas Kandagatla dsm_reg = CDC_RX_RXn_RX_PATH_DSM_CTL(rx, 2); 2706dbacef05SSrinivas Kandagatla 2707dbacef05SSrinivas Kandagatla rx_cfg2_reg = CDC_RX_RXn_RX_PATH_CFG2(rx, interp_idx); 27084f692926SSrinivas Kandagatla 27094f692926SSrinivas Kandagatla if (SND_SOC_DAPM_EVENT_ON(event)) { 27104f692926SSrinivas Kandagatla if (rx->main_clk_users[interp_idx] == 0) { 27114f692926SSrinivas Kandagatla /* Main path PGA mute enable */ 27124f692926SSrinivas Kandagatla snd_soc_component_write_field(component, main_reg, 27134f692926SSrinivas Kandagatla CDC_RX_PATH_PGA_MUTE_MASK, 0x1); 27144f692926SSrinivas Kandagatla snd_soc_component_write_field(component, dsm_reg, 27154f692926SSrinivas Kandagatla CDC_RX_RXn_DSM_CLK_EN_MASK, 0x1); 27164f692926SSrinivas Kandagatla snd_soc_component_update_bits(component, rx_cfg2_reg, 27174f692926SSrinivas Kandagatla CDC_RX_RXn_HPF_CUT_FREQ_MASK, 0x03); 27184f692926SSrinivas Kandagatla rx_macro_load_compander_coeff(component, rx, interp_idx, event); 27194f692926SSrinivas Kandagatla if (rx->hph_hd2_mode) 27204f692926SSrinivas Kandagatla rx_macro_hd2_control(component, interp_idx, event); 27214f692926SSrinivas Kandagatla rx_macro_hphdelay_lutbypass(component, rx, interp_idx, event); 27224f692926SSrinivas Kandagatla rx_macro_config_compander(component, rx, interp_idx, event); 27234f692926SSrinivas Kandagatla if (interp_idx == INTERP_AUX) { 27244f692926SSrinivas Kandagatla rx_macro_config_softclip(component, rx, event); 27254f692926SSrinivas Kandagatla rx_macro_config_aux_hpf(component, rx, event); 27264f692926SSrinivas Kandagatla } 27274f692926SSrinivas Kandagatla rx_macro_config_classh(component, rx, interp_idx, event); 27284f692926SSrinivas Kandagatla } 27294f692926SSrinivas Kandagatla rx->main_clk_users[interp_idx]++; 27304f692926SSrinivas Kandagatla } 27314f692926SSrinivas Kandagatla 27324f692926SSrinivas Kandagatla if (SND_SOC_DAPM_EVENT_OFF(event)) { 27334f692926SSrinivas Kandagatla rx->main_clk_users[interp_idx]--; 27344f692926SSrinivas Kandagatla if (rx->main_clk_users[interp_idx] <= 0) { 27354f692926SSrinivas Kandagatla rx->main_clk_users[interp_idx] = 0; 27364f692926SSrinivas Kandagatla /* Main path PGA mute enable */ 27374f692926SSrinivas Kandagatla snd_soc_component_write_field(component, main_reg, 27384f692926SSrinivas Kandagatla CDC_RX_PATH_PGA_MUTE_MASK, 0x1); 27394f692926SSrinivas Kandagatla /* Clk Disable */ 27404f692926SSrinivas Kandagatla snd_soc_component_write_field(component, dsm_reg, 27414f692926SSrinivas Kandagatla CDC_RX_RXn_DSM_CLK_EN_MASK, 0); 27424f692926SSrinivas Kandagatla snd_soc_component_write_field(component, main_reg, 27434f692926SSrinivas Kandagatla CDC_RX_PATH_CLK_EN_MASK, 0); 27444f692926SSrinivas Kandagatla /* Reset enable and disable */ 27454f692926SSrinivas Kandagatla snd_soc_component_write_field(component, main_reg, 27464f692926SSrinivas Kandagatla CDC_RX_PATH_RESET_EN_MASK, 1); 27474f692926SSrinivas Kandagatla snd_soc_component_write_field(component, main_reg, 27484f692926SSrinivas Kandagatla CDC_RX_PATH_RESET_EN_MASK, 0); 27494f692926SSrinivas Kandagatla /* Reset rate to 48K*/ 27504f692926SSrinivas Kandagatla snd_soc_component_update_bits(component, main_reg, 27514f692926SSrinivas Kandagatla CDC_RX_PATH_PCM_RATE_MASK, 27524f692926SSrinivas Kandagatla 0x04); 27534f692926SSrinivas Kandagatla snd_soc_component_update_bits(component, rx_cfg2_reg, 27544f692926SSrinivas Kandagatla CDC_RX_RXn_HPF_CUT_FREQ_MASK, 0x00); 27554f692926SSrinivas Kandagatla rx_macro_config_classh(component, rx, interp_idx, event); 27564f692926SSrinivas Kandagatla rx_macro_config_compander(component, rx, interp_idx, event); 27574f692926SSrinivas Kandagatla if (interp_idx == INTERP_AUX) { 27584f692926SSrinivas Kandagatla rx_macro_config_softclip(component, rx, event); 27594f692926SSrinivas Kandagatla rx_macro_config_aux_hpf(component, rx, event); 27604f692926SSrinivas Kandagatla } 27614f692926SSrinivas Kandagatla rx_macro_hphdelay_lutbypass(component, rx, interp_idx, event); 27624f692926SSrinivas Kandagatla if (rx->hph_hd2_mode) 27634f692926SSrinivas Kandagatla rx_macro_hd2_control(component, interp_idx, event); 27644f692926SSrinivas Kandagatla } 27654f692926SSrinivas Kandagatla } 27664f692926SSrinivas Kandagatla 27674f692926SSrinivas Kandagatla return rx->main_clk_users[interp_idx]; 27684f692926SSrinivas Kandagatla } 27694f692926SSrinivas Kandagatla 27704f692926SSrinivas Kandagatla static int rx_macro_enable_mix_path(struct snd_soc_dapm_widget *w, 27714f692926SSrinivas Kandagatla struct snd_kcontrol *kcontrol, int event) 27724f692926SSrinivas Kandagatla { 27734f692926SSrinivas Kandagatla struct snd_soc_component *component = snd_soc_dapm_to_component(w->dapm); 2774dbacef05SSrinivas Kandagatla struct rx_macro *rx = snd_soc_component_get_drvdata(component); 27754f692926SSrinivas Kandagatla u16 gain_reg, mix_reg; 27764f692926SSrinivas Kandagatla 2777dbacef05SSrinivas Kandagatla gain_reg = CDC_RX_RXn_RX_VOL_MIX_CTL(rx, w->shift); 2778dbacef05SSrinivas Kandagatla mix_reg = CDC_RX_RXn_RX_PATH_MIX_CTL(rx, w->shift); 27794f692926SSrinivas Kandagatla 27804f692926SSrinivas Kandagatla switch (event) { 27814f692926SSrinivas Kandagatla case SND_SOC_DAPM_PRE_PMU: 27824f692926SSrinivas Kandagatla rx_macro_enable_interp_clk(component, event, w->shift); 27834f692926SSrinivas Kandagatla break; 27844f692926SSrinivas Kandagatla case SND_SOC_DAPM_POST_PMU: 27854f692926SSrinivas Kandagatla snd_soc_component_write(component, gain_reg, 27864f692926SSrinivas Kandagatla snd_soc_component_read(component, gain_reg)); 27874f692926SSrinivas Kandagatla break; 27884f692926SSrinivas Kandagatla case SND_SOC_DAPM_POST_PMD: 27894f692926SSrinivas Kandagatla /* Clk Disable */ 27904f692926SSrinivas Kandagatla snd_soc_component_update_bits(component, mix_reg, 27914f692926SSrinivas Kandagatla CDC_RX_RXn_MIX_CLK_EN_MASK, 0x00); 27924f692926SSrinivas Kandagatla rx_macro_enable_interp_clk(component, event, w->shift); 27934f692926SSrinivas Kandagatla /* Reset enable and disable */ 27944f692926SSrinivas Kandagatla snd_soc_component_update_bits(component, mix_reg, 27954f692926SSrinivas Kandagatla CDC_RX_RXn_MIX_RESET_MASK, 27964f692926SSrinivas Kandagatla CDC_RX_RXn_MIX_RESET); 27974f692926SSrinivas Kandagatla snd_soc_component_update_bits(component, mix_reg, 27984f692926SSrinivas Kandagatla CDC_RX_RXn_MIX_RESET_MASK, 0x00); 27994f692926SSrinivas Kandagatla break; 28004f692926SSrinivas Kandagatla } 28014f692926SSrinivas Kandagatla 28024f692926SSrinivas Kandagatla return 0; 28034f692926SSrinivas Kandagatla } 28044f692926SSrinivas Kandagatla 28054f692926SSrinivas Kandagatla static int rx_macro_enable_rx_path_clk(struct snd_soc_dapm_widget *w, 28064f692926SSrinivas Kandagatla struct snd_kcontrol *kcontrol, int event) 28074f692926SSrinivas Kandagatla { 28084f692926SSrinivas Kandagatla struct snd_soc_component *component = snd_soc_dapm_to_component(w->dapm); 2809dbacef05SSrinivas Kandagatla struct rx_macro *rx = snd_soc_component_get_drvdata(component); 28104f692926SSrinivas Kandagatla 28114f692926SSrinivas Kandagatla switch (event) { 28124f692926SSrinivas Kandagatla case SND_SOC_DAPM_PRE_PMU: 28134f692926SSrinivas Kandagatla rx_macro_enable_interp_clk(component, event, w->shift); 2814dbacef05SSrinivas Kandagatla snd_soc_component_write_field(component, CDC_RX_RXn_RX_PATH_CFG1(rx, w->shift), 28154f692926SSrinivas Kandagatla CDC_RX_RXn_SIDETONE_EN_MASK, 1); 2816dbacef05SSrinivas Kandagatla snd_soc_component_write_field(component, CDC_RX_RXn_RX_PATH_CTL(rx, w->shift), 28174f692926SSrinivas Kandagatla CDC_RX_PATH_CLK_EN_MASK, 1); 28184f692926SSrinivas Kandagatla break; 28194f692926SSrinivas Kandagatla case SND_SOC_DAPM_POST_PMD: 2820dbacef05SSrinivas Kandagatla snd_soc_component_write_field(component, CDC_RX_RXn_RX_PATH_CFG1(rx, w->shift), 28214f692926SSrinivas Kandagatla CDC_RX_RXn_SIDETONE_EN_MASK, 0); 28224f692926SSrinivas Kandagatla rx_macro_enable_interp_clk(component, event, w->shift); 28234f692926SSrinivas Kandagatla break; 28244f692926SSrinivas Kandagatla default: 28254f692926SSrinivas Kandagatla break; 2826f758b9efSWan Jiabing } 28274f692926SSrinivas Kandagatla return 0; 28284f692926SSrinivas Kandagatla } 28294f692926SSrinivas Kandagatla 2830f3ce6f3cSSrinivas Kandagatla static int rx_macro_set_iir_gain(struct snd_soc_dapm_widget *w, 2831f3ce6f3cSSrinivas Kandagatla struct snd_kcontrol *kcontrol, int event) 2832f3ce6f3cSSrinivas Kandagatla { 2833f3ce6f3cSSrinivas Kandagatla struct snd_soc_component *component = snd_soc_dapm_to_component(w->dapm); 2834f3ce6f3cSSrinivas Kandagatla 2835f3ce6f3cSSrinivas Kandagatla switch (event) { 2836f3ce6f3cSSrinivas Kandagatla case SND_SOC_DAPM_POST_PMU: /* fall through */ 2837f3ce6f3cSSrinivas Kandagatla case SND_SOC_DAPM_PRE_PMD: 2838f3ce6f3cSSrinivas Kandagatla if (strnstr(w->name, "IIR0", sizeof("IIR0"))) { 2839f3ce6f3cSSrinivas Kandagatla snd_soc_component_write(component, 2840f3ce6f3cSSrinivas Kandagatla CDC_RX_SIDETONE_IIR0_IIR_GAIN_B1_CTL, 2841f3ce6f3cSSrinivas Kandagatla snd_soc_component_read(component, 2842f3ce6f3cSSrinivas Kandagatla CDC_RX_SIDETONE_IIR0_IIR_GAIN_B1_CTL)); 2843f3ce6f3cSSrinivas Kandagatla snd_soc_component_write(component, 2844f3ce6f3cSSrinivas Kandagatla CDC_RX_SIDETONE_IIR0_IIR_GAIN_B2_CTL, 2845f3ce6f3cSSrinivas Kandagatla snd_soc_component_read(component, 2846f3ce6f3cSSrinivas Kandagatla CDC_RX_SIDETONE_IIR0_IIR_GAIN_B2_CTL)); 2847f3ce6f3cSSrinivas Kandagatla snd_soc_component_write(component, 2848f3ce6f3cSSrinivas Kandagatla CDC_RX_SIDETONE_IIR0_IIR_GAIN_B3_CTL, 2849f3ce6f3cSSrinivas Kandagatla snd_soc_component_read(component, 2850f3ce6f3cSSrinivas Kandagatla CDC_RX_SIDETONE_IIR0_IIR_GAIN_B3_CTL)); 2851f3ce6f3cSSrinivas Kandagatla snd_soc_component_write(component, 2852f3ce6f3cSSrinivas Kandagatla CDC_RX_SIDETONE_IIR0_IIR_GAIN_B4_CTL, 2853f3ce6f3cSSrinivas Kandagatla snd_soc_component_read(component, 2854f3ce6f3cSSrinivas Kandagatla CDC_RX_SIDETONE_IIR0_IIR_GAIN_B4_CTL)); 2855f3ce6f3cSSrinivas Kandagatla } else { 2856f3ce6f3cSSrinivas Kandagatla snd_soc_component_write(component, 2857f3ce6f3cSSrinivas Kandagatla CDC_RX_SIDETONE_IIR1_IIR_GAIN_B1_CTL, 2858f3ce6f3cSSrinivas Kandagatla snd_soc_component_read(component, 2859f3ce6f3cSSrinivas Kandagatla CDC_RX_SIDETONE_IIR1_IIR_GAIN_B1_CTL)); 2860f3ce6f3cSSrinivas Kandagatla snd_soc_component_write(component, 2861f3ce6f3cSSrinivas Kandagatla CDC_RX_SIDETONE_IIR1_IIR_GAIN_B2_CTL, 2862f3ce6f3cSSrinivas Kandagatla snd_soc_component_read(component, 2863f3ce6f3cSSrinivas Kandagatla CDC_RX_SIDETONE_IIR1_IIR_GAIN_B2_CTL)); 2864f3ce6f3cSSrinivas Kandagatla snd_soc_component_write(component, 2865f3ce6f3cSSrinivas Kandagatla CDC_RX_SIDETONE_IIR1_IIR_GAIN_B3_CTL, 2866f3ce6f3cSSrinivas Kandagatla snd_soc_component_read(component, 2867f3ce6f3cSSrinivas Kandagatla CDC_RX_SIDETONE_IIR1_IIR_GAIN_B3_CTL)); 2868f3ce6f3cSSrinivas Kandagatla snd_soc_component_write(component, 2869f3ce6f3cSSrinivas Kandagatla CDC_RX_SIDETONE_IIR1_IIR_GAIN_B4_CTL, 2870f3ce6f3cSSrinivas Kandagatla snd_soc_component_read(component, 2871f3ce6f3cSSrinivas Kandagatla CDC_RX_SIDETONE_IIR1_IIR_GAIN_B4_CTL)); 2872f3ce6f3cSSrinivas Kandagatla } 2873f3ce6f3cSSrinivas Kandagatla break; 2874f3ce6f3cSSrinivas Kandagatla } 2875f3ce6f3cSSrinivas Kandagatla return 0; 2876f3ce6f3cSSrinivas Kandagatla } 2877f3ce6f3cSSrinivas Kandagatla 2878f3ce6f3cSSrinivas Kandagatla static uint32_t get_iir_band_coeff(struct snd_soc_component *component, 2879f3ce6f3cSSrinivas Kandagatla int iir_idx, int band_idx, int coeff_idx) 2880f3ce6f3cSSrinivas Kandagatla { 2881f3ce6f3cSSrinivas Kandagatla u32 value; 2882f3ce6f3cSSrinivas Kandagatla int reg, b2_reg; 2883f3ce6f3cSSrinivas Kandagatla 2884f3ce6f3cSSrinivas Kandagatla /* Address does not automatically update if reading */ 2885fca041a3SSrinivas Kandagatla reg = CDC_RX_SIDETONE_IIR0_IIR_COEF_B1_CTL + 0x80 * iir_idx; 2886fca041a3SSrinivas Kandagatla b2_reg = CDC_RX_SIDETONE_IIR0_IIR_COEF_B2_CTL + 0x80 * iir_idx; 2887f3ce6f3cSSrinivas Kandagatla 2888f3ce6f3cSSrinivas Kandagatla snd_soc_component_write(component, reg, 2889f3ce6f3cSSrinivas Kandagatla ((band_idx * BAND_MAX + coeff_idx) * 2890f3ce6f3cSSrinivas Kandagatla sizeof(uint32_t)) & 0x7F); 2891f3ce6f3cSSrinivas Kandagatla 2892f3ce6f3cSSrinivas Kandagatla value = snd_soc_component_read(component, b2_reg); 2893f3ce6f3cSSrinivas Kandagatla snd_soc_component_write(component, reg, 2894f3ce6f3cSSrinivas Kandagatla ((band_idx * BAND_MAX + coeff_idx) 2895f3ce6f3cSSrinivas Kandagatla * sizeof(uint32_t) + 1) & 0x7F); 2896f3ce6f3cSSrinivas Kandagatla 2897f3ce6f3cSSrinivas Kandagatla value |= (snd_soc_component_read(component, b2_reg) << 8); 2898f3ce6f3cSSrinivas Kandagatla snd_soc_component_write(component, reg, 2899f3ce6f3cSSrinivas Kandagatla ((band_idx * BAND_MAX + coeff_idx) 2900f3ce6f3cSSrinivas Kandagatla * sizeof(uint32_t) + 2) & 0x7F); 2901f3ce6f3cSSrinivas Kandagatla 2902f3ce6f3cSSrinivas Kandagatla value |= (snd_soc_component_read(component, b2_reg) << 16); 2903f3ce6f3cSSrinivas Kandagatla snd_soc_component_write(component, reg, 2904f3ce6f3cSSrinivas Kandagatla ((band_idx * BAND_MAX + coeff_idx) 2905f3ce6f3cSSrinivas Kandagatla * sizeof(uint32_t) + 3) & 0x7F); 2906f3ce6f3cSSrinivas Kandagatla 2907f3ce6f3cSSrinivas Kandagatla /* Mask bits top 2 bits since they are reserved */ 2908f3ce6f3cSSrinivas Kandagatla value |= (snd_soc_component_read(component, b2_reg) << 24); 2909f3ce6f3cSSrinivas Kandagatla return value; 2910f3ce6f3cSSrinivas Kandagatla } 2911f3ce6f3cSSrinivas Kandagatla 2912f3ce6f3cSSrinivas Kandagatla static void set_iir_band_coeff(struct snd_soc_component *component, 2913f3ce6f3cSSrinivas Kandagatla int iir_idx, int band_idx, uint32_t value) 2914f3ce6f3cSSrinivas Kandagatla { 2915fca041a3SSrinivas Kandagatla int reg = CDC_RX_SIDETONE_IIR0_IIR_COEF_B2_CTL + 0x80 * iir_idx; 2916f3ce6f3cSSrinivas Kandagatla 2917f3ce6f3cSSrinivas Kandagatla snd_soc_component_write(component, reg, (value & 0xFF)); 2918f3ce6f3cSSrinivas Kandagatla snd_soc_component_write(component, reg, (value >> 8) & 0xFF); 2919f3ce6f3cSSrinivas Kandagatla snd_soc_component_write(component, reg, (value >> 16) & 0xFF); 2920f3ce6f3cSSrinivas Kandagatla /* Mask top 2 bits, 7-8 are reserved */ 2921f3ce6f3cSSrinivas Kandagatla snd_soc_component_write(component, reg, (value >> 24) & 0x3F); 2922f3ce6f3cSSrinivas Kandagatla } 2923f3ce6f3cSSrinivas Kandagatla 2924f3ce6f3cSSrinivas Kandagatla static int rx_macro_put_iir_band_audio_mixer( 2925f3ce6f3cSSrinivas Kandagatla struct snd_kcontrol *kcontrol, 2926f3ce6f3cSSrinivas Kandagatla struct snd_ctl_elem_value *ucontrol) 2927f3ce6f3cSSrinivas Kandagatla { 2928f3ce6f3cSSrinivas Kandagatla struct snd_soc_component *component = 2929f3ce6f3cSSrinivas Kandagatla snd_soc_kcontrol_component(kcontrol); 2930f3ce6f3cSSrinivas Kandagatla struct wcd_iir_filter_ctl *ctl = 2931f3ce6f3cSSrinivas Kandagatla (struct wcd_iir_filter_ctl *)kcontrol->private_value; 2932f3ce6f3cSSrinivas Kandagatla struct soc_bytes_ext *params = &ctl->bytes_ext; 2933f3ce6f3cSSrinivas Kandagatla int iir_idx = ctl->iir_idx; 2934f3ce6f3cSSrinivas Kandagatla int band_idx = ctl->band_idx; 2935f3ce6f3cSSrinivas Kandagatla u32 coeff[BAND_MAX]; 2936fca041a3SSrinivas Kandagatla int reg = CDC_RX_SIDETONE_IIR0_IIR_COEF_B1_CTL + 0x80 * iir_idx; 2937f3ce6f3cSSrinivas Kandagatla 2938f3ce6f3cSSrinivas Kandagatla memcpy(&coeff[0], ucontrol->value.bytes.data, params->max); 2939f3ce6f3cSSrinivas Kandagatla 2940f3ce6f3cSSrinivas Kandagatla /* Mask top bit it is reserved */ 2941f3ce6f3cSSrinivas Kandagatla /* Updates addr automatically for each B2 write */ 2942f3ce6f3cSSrinivas Kandagatla snd_soc_component_write(component, reg, (band_idx * BAND_MAX * 2943f3ce6f3cSSrinivas Kandagatla sizeof(uint32_t)) & 0x7F); 2944f3ce6f3cSSrinivas Kandagatla 2945f3ce6f3cSSrinivas Kandagatla set_iir_band_coeff(component, iir_idx, band_idx, coeff[0]); 2946f3ce6f3cSSrinivas Kandagatla set_iir_band_coeff(component, iir_idx, band_idx, coeff[1]); 2947f3ce6f3cSSrinivas Kandagatla set_iir_band_coeff(component, iir_idx, band_idx, coeff[2]); 2948f3ce6f3cSSrinivas Kandagatla set_iir_band_coeff(component, iir_idx, band_idx, coeff[3]); 2949f3ce6f3cSSrinivas Kandagatla set_iir_band_coeff(component, iir_idx, band_idx, coeff[4]); 2950f3ce6f3cSSrinivas Kandagatla 2951f3ce6f3cSSrinivas Kandagatla return 0; 2952f3ce6f3cSSrinivas Kandagatla } 2953f3ce6f3cSSrinivas Kandagatla 2954f3ce6f3cSSrinivas Kandagatla static int rx_macro_get_iir_band_audio_mixer(struct snd_kcontrol *kcontrol, 2955f3ce6f3cSSrinivas Kandagatla struct snd_ctl_elem_value *ucontrol) 2956f3ce6f3cSSrinivas Kandagatla { 2957f3ce6f3cSSrinivas Kandagatla struct snd_soc_component *component = 2958f3ce6f3cSSrinivas Kandagatla snd_soc_kcontrol_component(kcontrol); 2959f3ce6f3cSSrinivas Kandagatla struct wcd_iir_filter_ctl *ctl = 2960f3ce6f3cSSrinivas Kandagatla (struct wcd_iir_filter_ctl *)kcontrol->private_value; 2961f3ce6f3cSSrinivas Kandagatla struct soc_bytes_ext *params = &ctl->bytes_ext; 2962f3ce6f3cSSrinivas Kandagatla int iir_idx = ctl->iir_idx; 2963f3ce6f3cSSrinivas Kandagatla int band_idx = ctl->band_idx; 2964f3ce6f3cSSrinivas Kandagatla u32 coeff[BAND_MAX]; 2965f3ce6f3cSSrinivas Kandagatla 2966f3ce6f3cSSrinivas Kandagatla coeff[0] = get_iir_band_coeff(component, iir_idx, band_idx, 0); 2967f3ce6f3cSSrinivas Kandagatla coeff[1] = get_iir_band_coeff(component, iir_idx, band_idx, 1); 2968f3ce6f3cSSrinivas Kandagatla coeff[2] = get_iir_band_coeff(component, iir_idx, band_idx, 2); 2969f3ce6f3cSSrinivas Kandagatla coeff[3] = get_iir_band_coeff(component, iir_idx, band_idx, 3); 2970f3ce6f3cSSrinivas Kandagatla coeff[4] = get_iir_band_coeff(component, iir_idx, band_idx, 4); 2971f3ce6f3cSSrinivas Kandagatla 2972f3ce6f3cSSrinivas Kandagatla memcpy(ucontrol->value.bytes.data, &coeff[0], params->max); 2973f3ce6f3cSSrinivas Kandagatla 2974f3ce6f3cSSrinivas Kandagatla return 0; 2975f3ce6f3cSSrinivas Kandagatla } 2976f3ce6f3cSSrinivas Kandagatla 2977f3ce6f3cSSrinivas Kandagatla static int rx_macro_iir_filter_info(struct snd_kcontrol *kcontrol, 2978f3ce6f3cSSrinivas Kandagatla struct snd_ctl_elem_info *ucontrol) 2979f3ce6f3cSSrinivas Kandagatla { 2980f3ce6f3cSSrinivas Kandagatla struct wcd_iir_filter_ctl *ctl = 2981f3ce6f3cSSrinivas Kandagatla (struct wcd_iir_filter_ctl *)kcontrol->private_value; 2982f3ce6f3cSSrinivas Kandagatla struct soc_bytes_ext *params = &ctl->bytes_ext; 2983f3ce6f3cSSrinivas Kandagatla 2984f3ce6f3cSSrinivas Kandagatla ucontrol->type = SNDRV_CTL_ELEM_TYPE_BYTES; 2985f3ce6f3cSSrinivas Kandagatla ucontrol->count = params->max; 2986f3ce6f3cSSrinivas Kandagatla 2987f3ce6f3cSSrinivas Kandagatla return 0; 2988f3ce6f3cSSrinivas Kandagatla } 2989f3ce6f3cSSrinivas Kandagatla 2990dbacef05SSrinivas Kandagatla static const struct snd_kcontrol_new rx_macro_def_snd_controls[] = { 2991af3d54b9SSrinivas Kandagatla SOC_SINGLE_S8_TLV("RX_RX1 Digital Volume", CDC_RX_RX1_RX_VOL_CTL, 2992af3d54b9SSrinivas Kandagatla -84, 40, digital_gain), 2993af3d54b9SSrinivas Kandagatla SOC_SINGLE_S8_TLV("RX_RX2 Digital Volume", CDC_RX_RX2_RX_VOL_CTL, 2994af3d54b9SSrinivas Kandagatla -84, 40, digital_gain), 2995af3d54b9SSrinivas Kandagatla SOC_SINGLE_S8_TLV("RX_RX1 Mix Digital Volume", CDC_RX_RX1_RX_VOL_MIX_CTL, 2996af3d54b9SSrinivas Kandagatla -84, 40, digital_gain), 2997af3d54b9SSrinivas Kandagatla SOC_SINGLE_S8_TLV("RX_RX2 Mix Digital Volume", CDC_RX_RX2_RX_VOL_MIX_CTL, 2998af3d54b9SSrinivas Kandagatla -84, 40, digital_gain), 2999dbacef05SSrinivas Kandagatla }; 3000af3d54b9SSrinivas Kandagatla 3001432e5074SSrinivas Kandagatla static const struct snd_kcontrol_new rx_macro_2_5_snd_controls[] = { 3002432e5074SSrinivas Kandagatla 3003432e5074SSrinivas Kandagatla SOC_SINGLE_S8_TLV("RX_RX1 Digital Volume", CDC_2_5_RX_RX1_RX_VOL_CTL, 3004432e5074SSrinivas Kandagatla -84, 40, digital_gain), 3005432e5074SSrinivas Kandagatla SOC_SINGLE_S8_TLV("RX_RX2 Digital Volume", CDC_2_5_RX_RX2_RX_VOL_CTL, 3006432e5074SSrinivas Kandagatla -84, 40, digital_gain), 3007432e5074SSrinivas Kandagatla SOC_SINGLE_S8_TLV("RX_RX1 Mix Digital Volume", CDC_2_5_RX_RX1_RX_VOL_MIX_CTL, 3008432e5074SSrinivas Kandagatla -84, 40, digital_gain), 3009432e5074SSrinivas Kandagatla SOC_SINGLE_S8_TLV("RX_RX2 Mix Digital Volume", CDC_2_5_RX_RX2_RX_VOL_MIX_CTL, 3010432e5074SSrinivas Kandagatla -84, 40, digital_gain), 3011432e5074SSrinivas Kandagatla }; 3012432e5074SSrinivas Kandagatla 3013dbacef05SSrinivas Kandagatla static const struct snd_kcontrol_new rx_macro_snd_controls[] = { 3014dbacef05SSrinivas Kandagatla SOC_SINGLE_S8_TLV("RX_RX0 Digital Volume", CDC_RX_RX0_RX_VOL_CTL, 3015dbacef05SSrinivas Kandagatla -84, 40, digital_gain), 3016dbacef05SSrinivas Kandagatla SOC_SINGLE_S8_TLV("RX_RX0 Mix Digital Volume", CDC_RX_RX0_RX_VOL_MIX_CTL, 3017dbacef05SSrinivas Kandagatla -84, 40, digital_gain), 3018af3d54b9SSrinivas Kandagatla SOC_SINGLE_EXT("RX_COMP1 Switch", SND_SOC_NOPM, RX_MACRO_COMP1, 1, 0, 3019af3d54b9SSrinivas Kandagatla rx_macro_get_compander, rx_macro_set_compander), 3020af3d54b9SSrinivas Kandagatla SOC_SINGLE_EXT("RX_COMP2 Switch", SND_SOC_NOPM, RX_MACRO_COMP2, 1, 0, 3021af3d54b9SSrinivas Kandagatla rx_macro_get_compander, rx_macro_set_compander), 3022af3d54b9SSrinivas Kandagatla 3023af3d54b9SSrinivas Kandagatla SOC_SINGLE_EXT("RX_EAR Mode Switch", SND_SOC_NOPM, 0, 1, 0, 3024af3d54b9SSrinivas Kandagatla rx_macro_get_ear_mode, rx_macro_put_ear_mode), 3025af3d54b9SSrinivas Kandagatla 3026af3d54b9SSrinivas Kandagatla SOC_SINGLE_EXT("RX_HPH HD2 Mode Switch", SND_SOC_NOPM, 0, 1, 0, 3027af3d54b9SSrinivas Kandagatla rx_macro_get_hph_hd2_mode, rx_macro_put_hph_hd2_mode), 3028af3d54b9SSrinivas Kandagatla 3029af3d54b9SSrinivas Kandagatla SOC_ENUM_EXT("RX_HPH PWR Mode", rx_macro_hph_pwr_mode_enum, 3030af3d54b9SSrinivas Kandagatla rx_macro_get_hph_pwr_mode, rx_macro_put_hph_pwr_mode), 3031af3d54b9SSrinivas Kandagatla 3032af3d54b9SSrinivas Kandagatla SOC_SINGLE_EXT("RX_Softclip Switch", SND_SOC_NOPM, 0, 1, 0, 3033af3d54b9SSrinivas Kandagatla rx_macro_soft_clip_enable_get, 3034af3d54b9SSrinivas Kandagatla rx_macro_soft_clip_enable_put), 3035af3d54b9SSrinivas Kandagatla SOC_SINGLE_EXT("AUX_HPF Switch", SND_SOC_NOPM, 0, 1, 0, 3036af3d54b9SSrinivas Kandagatla rx_macro_aux_hpf_mode_get, 3037af3d54b9SSrinivas Kandagatla rx_macro_aux_hpf_mode_put), 3038f3ce6f3cSSrinivas Kandagatla 3039f3ce6f3cSSrinivas Kandagatla SOC_SINGLE_S8_TLV("IIR0 INP0 Volume", 3040f3ce6f3cSSrinivas Kandagatla CDC_RX_SIDETONE_IIR0_IIR_GAIN_B1_CTL, -84, 40, 3041f3ce6f3cSSrinivas Kandagatla digital_gain), 3042f3ce6f3cSSrinivas Kandagatla SOC_SINGLE_S8_TLV("IIR0 INP1 Volume", 3043f3ce6f3cSSrinivas Kandagatla CDC_RX_SIDETONE_IIR0_IIR_GAIN_B2_CTL, -84, 40, 3044f3ce6f3cSSrinivas Kandagatla digital_gain), 3045f3ce6f3cSSrinivas Kandagatla SOC_SINGLE_S8_TLV("IIR0 INP2 Volume", 3046f3ce6f3cSSrinivas Kandagatla CDC_RX_SIDETONE_IIR0_IIR_GAIN_B3_CTL, -84, 40, 3047f3ce6f3cSSrinivas Kandagatla digital_gain), 3048f3ce6f3cSSrinivas Kandagatla SOC_SINGLE_S8_TLV("IIR0 INP3 Volume", 3049f3ce6f3cSSrinivas Kandagatla CDC_RX_SIDETONE_IIR0_IIR_GAIN_B4_CTL, -84, 40, 3050f3ce6f3cSSrinivas Kandagatla digital_gain), 3051f3ce6f3cSSrinivas Kandagatla SOC_SINGLE_S8_TLV("IIR1 INP0 Volume", 3052f3ce6f3cSSrinivas Kandagatla CDC_RX_SIDETONE_IIR1_IIR_GAIN_B1_CTL, -84, 40, 3053f3ce6f3cSSrinivas Kandagatla digital_gain), 3054f3ce6f3cSSrinivas Kandagatla SOC_SINGLE_S8_TLV("IIR1 INP1 Volume", 3055f3ce6f3cSSrinivas Kandagatla CDC_RX_SIDETONE_IIR1_IIR_GAIN_B2_CTL, -84, 40, 3056f3ce6f3cSSrinivas Kandagatla digital_gain), 3057f3ce6f3cSSrinivas Kandagatla SOC_SINGLE_S8_TLV("IIR1 INP2 Volume", 3058f3ce6f3cSSrinivas Kandagatla CDC_RX_SIDETONE_IIR1_IIR_GAIN_B3_CTL, -84, 40, 3059f3ce6f3cSSrinivas Kandagatla digital_gain), 3060f3ce6f3cSSrinivas Kandagatla SOC_SINGLE_S8_TLV("IIR1 INP3 Volume", 3061f3ce6f3cSSrinivas Kandagatla CDC_RX_SIDETONE_IIR1_IIR_GAIN_B4_CTL, -84, 40, 3062f3ce6f3cSSrinivas Kandagatla digital_gain), 3063f3ce6f3cSSrinivas Kandagatla 3064f3ce6f3cSSrinivas Kandagatla SOC_SINGLE("IIR1 Band1 Switch", CDC_RX_SIDETONE_IIR0_IIR_CTL, 3065f3ce6f3cSSrinivas Kandagatla 0, 1, 0), 3066f3ce6f3cSSrinivas Kandagatla SOC_SINGLE("IIR1 Band2 Switch", CDC_RX_SIDETONE_IIR0_IIR_CTL, 3067f3ce6f3cSSrinivas Kandagatla 1, 1, 0), 3068f3ce6f3cSSrinivas Kandagatla SOC_SINGLE("IIR1 Band3 Switch", CDC_RX_SIDETONE_IIR0_IIR_CTL, 3069f3ce6f3cSSrinivas Kandagatla 2, 1, 0), 3070f3ce6f3cSSrinivas Kandagatla SOC_SINGLE("IIR1 Band4 Switch", CDC_RX_SIDETONE_IIR0_IIR_CTL, 3071f3ce6f3cSSrinivas Kandagatla 3, 1, 0), 3072f3ce6f3cSSrinivas Kandagatla SOC_SINGLE("IIR1 Band5 Switch", CDC_RX_SIDETONE_IIR0_IIR_CTL, 3073f3ce6f3cSSrinivas Kandagatla 4, 1, 0), 3074f3ce6f3cSSrinivas Kandagatla SOC_SINGLE("IIR2 Band1 Switch", CDC_RX_SIDETONE_IIR1_IIR_CTL, 3075f3ce6f3cSSrinivas Kandagatla 0, 1, 0), 3076f3ce6f3cSSrinivas Kandagatla SOC_SINGLE("IIR2 Band2 Switch", CDC_RX_SIDETONE_IIR1_IIR_CTL, 3077f3ce6f3cSSrinivas Kandagatla 1, 1, 0), 3078f3ce6f3cSSrinivas Kandagatla SOC_SINGLE("IIR2 Band3 Switch", CDC_RX_SIDETONE_IIR1_IIR_CTL, 3079f3ce6f3cSSrinivas Kandagatla 2, 1, 0), 3080f3ce6f3cSSrinivas Kandagatla SOC_SINGLE("IIR2 Band4 Switch", CDC_RX_SIDETONE_IIR1_IIR_CTL, 3081f3ce6f3cSSrinivas Kandagatla 3, 1, 0), 3082f3ce6f3cSSrinivas Kandagatla SOC_SINGLE("IIR2 Band5 Switch", CDC_RX_SIDETONE_IIR1_IIR_CTL, 3083f3ce6f3cSSrinivas Kandagatla 4, 1, 0), 3084f3ce6f3cSSrinivas Kandagatla 3085f3ce6f3cSSrinivas Kandagatla RX_MACRO_IIR_FILTER_CTL("IIR0 Band1", IIR0, BAND1), 3086f3ce6f3cSSrinivas Kandagatla RX_MACRO_IIR_FILTER_CTL("IIR0 Band2", IIR0, BAND2), 3087f3ce6f3cSSrinivas Kandagatla RX_MACRO_IIR_FILTER_CTL("IIR0 Band3", IIR0, BAND3), 3088f3ce6f3cSSrinivas Kandagatla RX_MACRO_IIR_FILTER_CTL("IIR0 Band4", IIR0, BAND4), 3089f3ce6f3cSSrinivas Kandagatla RX_MACRO_IIR_FILTER_CTL("IIR0 Band5", IIR0, BAND5), 3090f3ce6f3cSSrinivas Kandagatla 3091f3ce6f3cSSrinivas Kandagatla RX_MACRO_IIR_FILTER_CTL("IIR1 Band1", IIR1, BAND1), 3092f3ce6f3cSSrinivas Kandagatla RX_MACRO_IIR_FILTER_CTL("IIR1 Band2", IIR1, BAND2), 3093f3ce6f3cSSrinivas Kandagatla RX_MACRO_IIR_FILTER_CTL("IIR1 Band3", IIR1, BAND3), 3094f3ce6f3cSSrinivas Kandagatla RX_MACRO_IIR_FILTER_CTL("IIR1 Band4", IIR1, BAND4), 3095f3ce6f3cSSrinivas Kandagatla RX_MACRO_IIR_FILTER_CTL("IIR1 Band5", IIR1, BAND5), 3096f3ce6f3cSSrinivas Kandagatla 3097af3d54b9SSrinivas Kandagatla }; 3098af3d54b9SSrinivas Kandagatla 30994f692926SSrinivas Kandagatla static int rx_macro_enable_echo(struct snd_soc_dapm_widget *w, 31004f692926SSrinivas Kandagatla struct snd_kcontrol *kcontrol, 31014f692926SSrinivas Kandagatla int event) 31024f692926SSrinivas Kandagatla { 31034f692926SSrinivas Kandagatla struct snd_soc_component *component = snd_soc_dapm_to_component(w->dapm); 31044f692926SSrinivas Kandagatla u16 val, ec_hq_reg; 31050c0a5883SColin Ian King int ec_tx = -1; 31064f692926SSrinivas Kandagatla 31074f692926SSrinivas Kandagatla val = snd_soc_component_read(component, 31084f692926SSrinivas Kandagatla CDC_RX_INP_MUX_RX_MIX_CFG4); 31095efc1c90SKrzysztof Kozlowski if (!(snd_soc_dapm_widget_name_cmp(w, "RX MIX TX0 MUX"))) 31104f692926SSrinivas Kandagatla ec_tx = ((val & 0xf0) >> 0x4) - 1; 31115efc1c90SKrzysztof Kozlowski else if (!(snd_soc_dapm_widget_name_cmp(w, "RX MIX TX1 MUX"))) 31124f692926SSrinivas Kandagatla ec_tx = (val & 0x0f) - 1; 31134f692926SSrinivas Kandagatla 31144f692926SSrinivas Kandagatla val = snd_soc_component_read(component, 31154f692926SSrinivas Kandagatla CDC_RX_INP_MUX_RX_MIX_CFG5); 31165efc1c90SKrzysztof Kozlowski if (!(snd_soc_dapm_widget_name_cmp(w, "RX MIX TX2 MUX"))) 31174f692926SSrinivas Kandagatla ec_tx = (val & 0x0f) - 1; 31184f692926SSrinivas Kandagatla 31194f692926SSrinivas Kandagatla if (ec_tx < 0 || (ec_tx >= RX_MACRO_EC_MUX_MAX)) { 31204f692926SSrinivas Kandagatla dev_err(component->dev, "%s: EC mix control not set correctly\n", 31214f692926SSrinivas Kandagatla __func__); 31224f692926SSrinivas Kandagatla return -EINVAL; 31234f692926SSrinivas Kandagatla } 31244f692926SSrinivas Kandagatla ec_hq_reg = CDC_RX_EC_REF_HQ0_EC_REF_HQ_PATH_CTL + 31254f692926SSrinivas Kandagatla 0x40 * ec_tx; 31264f692926SSrinivas Kandagatla snd_soc_component_update_bits(component, ec_hq_reg, 0x01, 0x01); 31274f692926SSrinivas Kandagatla ec_hq_reg = CDC_RX_EC_REF_HQ0_EC_REF_HQ_CFG0 + 31284f692926SSrinivas Kandagatla 0x40 * ec_tx; 31294f692926SSrinivas Kandagatla /* default set to 48k */ 31304f692926SSrinivas Kandagatla snd_soc_component_update_bits(component, ec_hq_reg, 0x1E, 0x08); 31314f692926SSrinivas Kandagatla 31324f692926SSrinivas Kandagatla return 0; 31334f692926SSrinivas Kandagatla } 31344f692926SSrinivas Kandagatla 3135432e5074SSrinivas Kandagatla static const struct snd_soc_dapm_widget rx_macro_2_5_dapm_widgets[] = { 3136432e5074SSrinivas Kandagatla SND_SOC_DAPM_MUX("RX INT1 DEM MUX", SND_SOC_NOPM, 0, 0, 3137432e5074SSrinivas Kandagatla &rx_2_5_int1_dem_inp_mux), 3138432e5074SSrinivas Kandagatla }; 3139432e5074SSrinivas Kandagatla 3140dbacef05SSrinivas Kandagatla static const struct snd_soc_dapm_widget rx_macro_def_dapm_widgets[] = { 3141dbacef05SSrinivas Kandagatla SND_SOC_DAPM_MUX("RX INT1 DEM MUX", SND_SOC_NOPM, 0, 0, 3142dbacef05SSrinivas Kandagatla &rx_int1_dem_inp_mux), 3143dbacef05SSrinivas Kandagatla }; 31444f692926SSrinivas Kandagatla 31454f692926SSrinivas Kandagatla static const struct snd_soc_dapm_widget rx_macro_dapm_widgets[] = { 31464f692926SSrinivas Kandagatla SND_SOC_DAPM_AIF_IN("RX AIF1 PB", "RX_MACRO_AIF1 Playback", 0, 31474f692926SSrinivas Kandagatla SND_SOC_NOPM, 0, 0), 31484f692926SSrinivas Kandagatla 31494f692926SSrinivas Kandagatla SND_SOC_DAPM_AIF_IN("RX AIF2 PB", "RX_MACRO_AIF2 Playback", 0, 31504f692926SSrinivas Kandagatla SND_SOC_NOPM, 0, 0), 31514f692926SSrinivas Kandagatla 31524f692926SSrinivas Kandagatla SND_SOC_DAPM_AIF_IN("RX AIF3 PB", "RX_MACRO_AIF3 Playback", 0, 31534f692926SSrinivas Kandagatla SND_SOC_NOPM, 0, 0), 31544f692926SSrinivas Kandagatla 31554f692926SSrinivas Kandagatla SND_SOC_DAPM_AIF_IN("RX AIF4 PB", "RX_MACRO_AIF4 Playback", 0, 31564f692926SSrinivas Kandagatla SND_SOC_NOPM, 0, 0), 31574f692926SSrinivas Kandagatla 31584f692926SSrinivas Kandagatla SND_SOC_DAPM_AIF_OUT("RX AIF_ECHO", "RX_AIF_ECHO Capture", 0, 31594f692926SSrinivas Kandagatla SND_SOC_NOPM, 0, 0), 31604f692926SSrinivas Kandagatla 31614f692926SSrinivas Kandagatla SND_SOC_DAPM_MUX("RX_MACRO RX0 MUX", SND_SOC_NOPM, RX_MACRO_RX0, 0, 31624f692926SSrinivas Kandagatla &rx_macro_rx0_mux), 31634f692926SSrinivas Kandagatla SND_SOC_DAPM_MUX("RX_MACRO RX1 MUX", SND_SOC_NOPM, RX_MACRO_RX1, 0, 31644f692926SSrinivas Kandagatla &rx_macro_rx1_mux), 31654f692926SSrinivas Kandagatla SND_SOC_DAPM_MUX("RX_MACRO RX2 MUX", SND_SOC_NOPM, RX_MACRO_RX2, 0, 31664f692926SSrinivas Kandagatla &rx_macro_rx2_mux), 31674f692926SSrinivas Kandagatla SND_SOC_DAPM_MUX("RX_MACRO RX3 MUX", SND_SOC_NOPM, RX_MACRO_RX3, 0, 31684f692926SSrinivas Kandagatla &rx_macro_rx3_mux), 31694f692926SSrinivas Kandagatla SND_SOC_DAPM_MUX("RX_MACRO RX4 MUX", SND_SOC_NOPM, RX_MACRO_RX4, 0, 31704f692926SSrinivas Kandagatla &rx_macro_rx4_mux), 31714f692926SSrinivas Kandagatla SND_SOC_DAPM_MUX("RX_MACRO RX5 MUX", SND_SOC_NOPM, RX_MACRO_RX5, 0, 31724f692926SSrinivas Kandagatla &rx_macro_rx5_mux), 31734f692926SSrinivas Kandagatla 31744f692926SSrinivas Kandagatla SND_SOC_DAPM_MIXER("RX_RX0", SND_SOC_NOPM, 0, 0, NULL, 0), 31754f692926SSrinivas Kandagatla SND_SOC_DAPM_MIXER("RX_RX1", SND_SOC_NOPM, 0, 0, NULL, 0), 31764f692926SSrinivas Kandagatla SND_SOC_DAPM_MIXER("RX_RX2", SND_SOC_NOPM, 0, 0, NULL, 0), 31774f692926SSrinivas Kandagatla SND_SOC_DAPM_MIXER("RX_RX3", SND_SOC_NOPM, 0, 0, NULL, 0), 31784f692926SSrinivas Kandagatla SND_SOC_DAPM_MIXER("RX_RX4", SND_SOC_NOPM, 0, 0, NULL, 0), 31794f692926SSrinivas Kandagatla SND_SOC_DAPM_MIXER("RX_RX5", SND_SOC_NOPM, 0, 0, NULL, 0), 31804f692926SSrinivas Kandagatla 31814f692926SSrinivas Kandagatla SND_SOC_DAPM_MUX("IIR0 INP0 MUX", SND_SOC_NOPM, 0, 0, &iir0_inp0_mux), 31824f692926SSrinivas Kandagatla SND_SOC_DAPM_MUX("IIR0 INP1 MUX", SND_SOC_NOPM, 0, 0, &iir0_inp1_mux), 31834f692926SSrinivas Kandagatla SND_SOC_DAPM_MUX("IIR0 INP2 MUX", SND_SOC_NOPM, 0, 0, &iir0_inp2_mux), 31844f692926SSrinivas Kandagatla SND_SOC_DAPM_MUX("IIR0 INP3 MUX", SND_SOC_NOPM, 0, 0, &iir0_inp3_mux), 31854f692926SSrinivas Kandagatla SND_SOC_DAPM_MUX("IIR1 INP0 MUX", SND_SOC_NOPM, 0, 0, &iir1_inp0_mux), 31864f692926SSrinivas Kandagatla SND_SOC_DAPM_MUX("IIR1 INP1 MUX", SND_SOC_NOPM, 0, 0, &iir1_inp1_mux), 31874f692926SSrinivas Kandagatla SND_SOC_DAPM_MUX("IIR1 INP2 MUX", SND_SOC_NOPM, 0, 0, &iir1_inp2_mux), 31884f692926SSrinivas Kandagatla SND_SOC_DAPM_MUX("IIR1 INP3 MUX", SND_SOC_NOPM, 0, 0, &iir1_inp3_mux), 31894f692926SSrinivas Kandagatla 31904f692926SSrinivas Kandagatla SND_SOC_DAPM_MUX_E("RX MIX TX0 MUX", SND_SOC_NOPM, 31914f692926SSrinivas Kandagatla RX_MACRO_EC0_MUX, 0, 31924f692926SSrinivas Kandagatla &rx_mix_tx0_mux, rx_macro_enable_echo, 31934f692926SSrinivas Kandagatla SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMD), 31944f692926SSrinivas Kandagatla SND_SOC_DAPM_MUX_E("RX MIX TX1 MUX", SND_SOC_NOPM, 31954f692926SSrinivas Kandagatla RX_MACRO_EC1_MUX, 0, 31964f692926SSrinivas Kandagatla &rx_mix_tx1_mux, rx_macro_enable_echo, 31974f692926SSrinivas Kandagatla SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMD), 31984f692926SSrinivas Kandagatla SND_SOC_DAPM_MUX_E("RX MIX TX2 MUX", SND_SOC_NOPM, 31994f692926SSrinivas Kandagatla RX_MACRO_EC2_MUX, 0, 32004f692926SSrinivas Kandagatla &rx_mix_tx2_mux, rx_macro_enable_echo, 32014f692926SSrinivas Kandagatla SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMD), 3202f3ce6f3cSSrinivas Kandagatla 3203f3ce6f3cSSrinivas Kandagatla SND_SOC_DAPM_MIXER_E("IIR0", CDC_RX_SIDETONE_IIR0_IIR_PATH_CTL, 3204f3ce6f3cSSrinivas Kandagatla 4, 0, NULL, 0, rx_macro_set_iir_gain, 3205f3ce6f3cSSrinivas Kandagatla SND_SOC_DAPM_POST_PMU | SND_SOC_DAPM_PRE_PMD), 3206f3ce6f3cSSrinivas Kandagatla SND_SOC_DAPM_MIXER_E("IIR1", CDC_RX_SIDETONE_IIR1_IIR_PATH_CTL, 3207f3ce6f3cSSrinivas Kandagatla 4, 0, NULL, 0, rx_macro_set_iir_gain, 3208f3ce6f3cSSrinivas Kandagatla SND_SOC_DAPM_POST_PMU | SND_SOC_DAPM_PRE_PMD), 32094f692926SSrinivas Kandagatla SND_SOC_DAPM_MIXER("SRC0", CDC_RX_SIDETONE_SRC0_ST_SRC_PATH_CTL, 32104f692926SSrinivas Kandagatla 4, 0, NULL, 0), 32114f692926SSrinivas Kandagatla SND_SOC_DAPM_MIXER("SRC1", CDC_RX_SIDETONE_SRC1_ST_SRC_PATH_CTL, 32124f692926SSrinivas Kandagatla 4, 0, NULL, 0), 32134f692926SSrinivas Kandagatla 32144f692926SSrinivas Kandagatla SND_SOC_DAPM_MUX("RX INT0 DEM MUX", SND_SOC_NOPM, 0, 0, 32154f692926SSrinivas Kandagatla &rx_int0_dem_inp_mux), 32164f692926SSrinivas Kandagatla 32174f692926SSrinivas Kandagatla SND_SOC_DAPM_MUX_E("RX INT0_2 MUX", SND_SOC_NOPM, INTERP_HPHL, 0, 32184f692926SSrinivas Kandagatla &rx_int0_2_mux, rx_macro_enable_mix_path, 32194f692926SSrinivas Kandagatla SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMU | 32204f692926SSrinivas Kandagatla SND_SOC_DAPM_POST_PMD), 32214f692926SSrinivas Kandagatla SND_SOC_DAPM_MUX_E("RX INT1_2 MUX", SND_SOC_NOPM, INTERP_HPHR, 0, 32224f692926SSrinivas Kandagatla &rx_int1_2_mux, rx_macro_enable_mix_path, 32234f692926SSrinivas Kandagatla SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMU | 32244f692926SSrinivas Kandagatla SND_SOC_DAPM_POST_PMD), 32254f692926SSrinivas Kandagatla SND_SOC_DAPM_MUX_E("RX INT2_2 MUX", SND_SOC_NOPM, INTERP_AUX, 0, 32264f692926SSrinivas Kandagatla &rx_int2_2_mux, rx_macro_enable_mix_path, 32274f692926SSrinivas Kandagatla SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMU | 32284f692926SSrinivas Kandagatla SND_SOC_DAPM_POST_PMD), 32294f692926SSrinivas Kandagatla 32304f692926SSrinivas Kandagatla SND_SOC_DAPM_MUX("RX INT0_1 MIX1 INP0", SND_SOC_NOPM, 0, 0, &rx_int0_1_mix_inp0_mux), 32314f692926SSrinivas Kandagatla SND_SOC_DAPM_MUX("RX INT0_1 MIX1 INP1", SND_SOC_NOPM, 0, 0, &rx_int0_1_mix_inp1_mux), 32324f692926SSrinivas Kandagatla SND_SOC_DAPM_MUX("RX INT0_1 MIX1 INP2", SND_SOC_NOPM, 0, 0, &rx_int0_1_mix_inp2_mux), 32334f692926SSrinivas Kandagatla SND_SOC_DAPM_MUX("RX INT1_1 MIX1 INP0", SND_SOC_NOPM, 0, 0, &rx_int1_1_mix_inp0_mux), 32344f692926SSrinivas Kandagatla SND_SOC_DAPM_MUX("RX INT1_1 MIX1 INP1", SND_SOC_NOPM, 0, 0, &rx_int1_1_mix_inp1_mux), 32354f692926SSrinivas Kandagatla SND_SOC_DAPM_MUX("RX INT1_1 MIX1 INP2", SND_SOC_NOPM, 0, 0, &rx_int1_1_mix_inp2_mux), 32364f692926SSrinivas Kandagatla SND_SOC_DAPM_MUX("RX INT2_1 MIX1 INP0", SND_SOC_NOPM, 0, 0, &rx_int2_1_mix_inp0_mux), 32374f692926SSrinivas Kandagatla SND_SOC_DAPM_MUX("RX INT2_1 MIX1 INP1", SND_SOC_NOPM, 0, 0, &rx_int2_1_mix_inp1_mux), 32384f692926SSrinivas Kandagatla SND_SOC_DAPM_MUX("RX INT2_1 MIX1 INP2", SND_SOC_NOPM, 0, 0, &rx_int2_1_mix_inp2_mux), 32394f692926SSrinivas Kandagatla 32404f692926SSrinivas Kandagatla SND_SOC_DAPM_MUX_E("RX INT0_1 INTERP", SND_SOC_NOPM, INTERP_HPHL, 0, 32414f692926SSrinivas Kandagatla &rx_int0_1_interp_mux, rx_macro_enable_main_path, 32424f692926SSrinivas Kandagatla SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMU | 32434f692926SSrinivas Kandagatla SND_SOC_DAPM_POST_PMD), 32444f692926SSrinivas Kandagatla SND_SOC_DAPM_MUX_E("RX INT1_1 INTERP", SND_SOC_NOPM, INTERP_HPHR, 0, 32454f692926SSrinivas Kandagatla &rx_int1_1_interp_mux, rx_macro_enable_main_path, 32464f692926SSrinivas Kandagatla SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMU | 32474f692926SSrinivas Kandagatla SND_SOC_DAPM_POST_PMD), 32484f692926SSrinivas Kandagatla SND_SOC_DAPM_MUX_E("RX INT2_1 INTERP", SND_SOC_NOPM, INTERP_AUX, 0, 32494f692926SSrinivas Kandagatla &rx_int2_1_interp_mux, rx_macro_enable_main_path, 32504f692926SSrinivas Kandagatla SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMU | 32514f692926SSrinivas Kandagatla SND_SOC_DAPM_POST_PMD), 32524f692926SSrinivas Kandagatla 32534f692926SSrinivas Kandagatla SND_SOC_DAPM_MUX("RX INT0_2 INTERP", SND_SOC_NOPM, 0, 0, 32544f692926SSrinivas Kandagatla &rx_int0_2_interp_mux), 32554f692926SSrinivas Kandagatla SND_SOC_DAPM_MUX("RX INT1_2 INTERP", SND_SOC_NOPM, 0, 0, 32564f692926SSrinivas Kandagatla &rx_int1_2_interp_mux), 32574f692926SSrinivas Kandagatla SND_SOC_DAPM_MUX("RX INT2_2 INTERP", SND_SOC_NOPM, 0, 0, 32584f692926SSrinivas Kandagatla &rx_int2_2_interp_mux), 32594f692926SSrinivas Kandagatla 32604f692926SSrinivas Kandagatla SND_SOC_DAPM_MIXER("RX INT0_1 MIX1", SND_SOC_NOPM, 0, 0, NULL, 0), 32614f692926SSrinivas Kandagatla SND_SOC_DAPM_MIXER("RX INT0 SEC MIX", SND_SOC_NOPM, 0, 0, NULL, 0), 32624f692926SSrinivas Kandagatla SND_SOC_DAPM_MIXER("RX INT1_1 MIX1", SND_SOC_NOPM, 0, 0, NULL, 0), 32634f692926SSrinivas Kandagatla SND_SOC_DAPM_MIXER("RX INT1 SEC MIX", SND_SOC_NOPM, 0, 0, NULL, 0), 32644f692926SSrinivas Kandagatla SND_SOC_DAPM_MIXER("RX INT2_1 MIX1", SND_SOC_NOPM, 0, 0, NULL, 0), 32654f692926SSrinivas Kandagatla SND_SOC_DAPM_MIXER("RX INT2 SEC MIX", SND_SOC_NOPM, 0, 0, NULL, 0), 32664f692926SSrinivas Kandagatla 32674f692926SSrinivas Kandagatla SND_SOC_DAPM_MUX_E("RX INT0 MIX2 INP", SND_SOC_NOPM, INTERP_HPHL, 32684f692926SSrinivas Kandagatla 0, &rx_int0_mix2_inp_mux, rx_macro_enable_rx_path_clk, 32694f692926SSrinivas Kandagatla SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMD), 32704f692926SSrinivas Kandagatla SND_SOC_DAPM_MUX_E("RX INT1 MIX2 INP", SND_SOC_NOPM, INTERP_HPHR, 32714f692926SSrinivas Kandagatla 0, &rx_int1_mix2_inp_mux, rx_macro_enable_rx_path_clk, 32724f692926SSrinivas Kandagatla SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMD), 32734f692926SSrinivas Kandagatla SND_SOC_DAPM_MUX_E("RX INT2 MIX2 INP", SND_SOC_NOPM, INTERP_AUX, 32744f692926SSrinivas Kandagatla 0, &rx_int2_mix2_inp_mux, rx_macro_enable_rx_path_clk, 32754f692926SSrinivas Kandagatla SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMD), 32764f692926SSrinivas Kandagatla 32774f692926SSrinivas Kandagatla SND_SOC_DAPM_MIXER("RX INT0 MIX2", SND_SOC_NOPM, 0, 0, NULL, 0), 32784f692926SSrinivas Kandagatla SND_SOC_DAPM_MIXER("RX INT1 MIX2", SND_SOC_NOPM, 0, 0, NULL, 0), 32794f692926SSrinivas Kandagatla SND_SOC_DAPM_MIXER("RX INT2 MIX2", SND_SOC_NOPM, 0, 0, NULL, 0), 32804f692926SSrinivas Kandagatla 32814f692926SSrinivas Kandagatla SND_SOC_DAPM_OUTPUT("HPHL_OUT"), 32824f692926SSrinivas Kandagatla SND_SOC_DAPM_OUTPUT("HPHR_OUT"), 32834f692926SSrinivas Kandagatla SND_SOC_DAPM_OUTPUT("AUX_OUT"), 32844f692926SSrinivas Kandagatla 32854f692926SSrinivas Kandagatla SND_SOC_DAPM_INPUT("RX_TX DEC0_INP"), 32864f692926SSrinivas Kandagatla SND_SOC_DAPM_INPUT("RX_TX DEC1_INP"), 32874f692926SSrinivas Kandagatla SND_SOC_DAPM_INPUT("RX_TX DEC2_INP"), 32884f692926SSrinivas Kandagatla SND_SOC_DAPM_INPUT("RX_TX DEC3_INP"), 32894f692926SSrinivas Kandagatla 32904f692926SSrinivas Kandagatla SND_SOC_DAPM_SUPPLY_S("RX_MCLK", 0, SND_SOC_NOPM, 0, 0, 32914f692926SSrinivas Kandagatla rx_macro_mclk_event, SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMD), 32924f692926SSrinivas Kandagatla }; 32934f692926SSrinivas Kandagatla 32944f692926SSrinivas Kandagatla static const struct snd_soc_dapm_route rx_audio_map[] = { 32954f692926SSrinivas Kandagatla {"RX AIF1 PB", NULL, "RX_MCLK"}, 32964f692926SSrinivas Kandagatla {"RX AIF2 PB", NULL, "RX_MCLK"}, 32974f692926SSrinivas Kandagatla {"RX AIF3 PB", NULL, "RX_MCLK"}, 32984f692926SSrinivas Kandagatla {"RX AIF4 PB", NULL, "RX_MCLK"}, 32994f692926SSrinivas Kandagatla 33004f692926SSrinivas Kandagatla {"RX_MACRO RX0 MUX", "AIF1_PB", "RX AIF1 PB"}, 33014f692926SSrinivas Kandagatla {"RX_MACRO RX1 MUX", "AIF1_PB", "RX AIF1 PB"}, 33024f692926SSrinivas Kandagatla {"RX_MACRO RX2 MUX", "AIF1_PB", "RX AIF1 PB"}, 33034f692926SSrinivas Kandagatla {"RX_MACRO RX3 MUX", "AIF1_PB", "RX AIF1 PB"}, 33044f692926SSrinivas Kandagatla {"RX_MACRO RX4 MUX", "AIF1_PB", "RX AIF1 PB"}, 33054f692926SSrinivas Kandagatla {"RX_MACRO RX5 MUX", "AIF1_PB", "RX AIF1 PB"}, 33064f692926SSrinivas Kandagatla 33074f692926SSrinivas Kandagatla {"RX_MACRO RX0 MUX", "AIF2_PB", "RX AIF2 PB"}, 33084f692926SSrinivas Kandagatla {"RX_MACRO RX1 MUX", "AIF2_PB", "RX AIF2 PB"}, 33094f692926SSrinivas Kandagatla {"RX_MACRO RX2 MUX", "AIF2_PB", "RX AIF2 PB"}, 33104f692926SSrinivas Kandagatla {"RX_MACRO RX3 MUX", "AIF2_PB", "RX AIF2 PB"}, 33114f692926SSrinivas Kandagatla {"RX_MACRO RX4 MUX", "AIF2_PB", "RX AIF2 PB"}, 33124f692926SSrinivas Kandagatla {"RX_MACRO RX5 MUX", "AIF2_PB", "RX AIF2 PB"}, 33134f692926SSrinivas Kandagatla 33144f692926SSrinivas Kandagatla {"RX_MACRO RX0 MUX", "AIF3_PB", "RX AIF3 PB"}, 33154f692926SSrinivas Kandagatla {"RX_MACRO RX1 MUX", "AIF3_PB", "RX AIF3 PB"}, 33164f692926SSrinivas Kandagatla {"RX_MACRO RX2 MUX", "AIF3_PB", "RX AIF3 PB"}, 33174f692926SSrinivas Kandagatla {"RX_MACRO RX3 MUX", "AIF3_PB", "RX AIF3 PB"}, 33184f692926SSrinivas Kandagatla {"RX_MACRO RX4 MUX", "AIF3_PB", "RX AIF3 PB"}, 33194f692926SSrinivas Kandagatla {"RX_MACRO RX5 MUX", "AIF3_PB", "RX AIF3 PB"}, 33204f692926SSrinivas Kandagatla 33214f692926SSrinivas Kandagatla {"RX_MACRO RX0 MUX", "AIF4_PB", "RX AIF4 PB"}, 33224f692926SSrinivas Kandagatla {"RX_MACRO RX1 MUX", "AIF4_PB", "RX AIF4 PB"}, 33234f692926SSrinivas Kandagatla {"RX_MACRO RX2 MUX", "AIF4_PB", "RX AIF4 PB"}, 33244f692926SSrinivas Kandagatla {"RX_MACRO RX3 MUX", "AIF4_PB", "RX AIF4 PB"}, 33254f692926SSrinivas Kandagatla {"RX_MACRO RX4 MUX", "AIF4_PB", "RX AIF4 PB"}, 33264f692926SSrinivas Kandagatla {"RX_MACRO RX5 MUX", "AIF4_PB", "RX AIF4 PB"}, 33274f692926SSrinivas Kandagatla 33284f692926SSrinivas Kandagatla {"RX_RX0", NULL, "RX_MACRO RX0 MUX"}, 33294f692926SSrinivas Kandagatla {"RX_RX1", NULL, "RX_MACRO RX1 MUX"}, 33304f692926SSrinivas Kandagatla {"RX_RX2", NULL, "RX_MACRO RX2 MUX"}, 33314f692926SSrinivas Kandagatla {"RX_RX3", NULL, "RX_MACRO RX3 MUX"}, 33324f692926SSrinivas Kandagatla {"RX_RX4", NULL, "RX_MACRO RX4 MUX"}, 33334f692926SSrinivas Kandagatla {"RX_RX5", NULL, "RX_MACRO RX5 MUX"}, 33344f692926SSrinivas Kandagatla 33354f692926SSrinivas Kandagatla {"RX INT0_1 MIX1 INP0", "RX0", "RX_RX0"}, 33364f692926SSrinivas Kandagatla {"RX INT0_1 MIX1 INP0", "RX1", "RX_RX1"}, 33374f692926SSrinivas Kandagatla {"RX INT0_1 MIX1 INP0", "RX2", "RX_RX2"}, 33384f692926SSrinivas Kandagatla {"RX INT0_1 MIX1 INP0", "RX3", "RX_RX3"}, 33394f692926SSrinivas Kandagatla {"RX INT0_1 MIX1 INP0", "RX4", "RX_RX4"}, 33404f692926SSrinivas Kandagatla {"RX INT0_1 MIX1 INP0", "RX5", "RX_RX5"}, 33414f692926SSrinivas Kandagatla {"RX INT0_1 MIX1 INP0", "IIR0", "IIR0"}, 33424f692926SSrinivas Kandagatla {"RX INT0_1 MIX1 INP0", "IIR1", "IIR1"}, 33434f692926SSrinivas Kandagatla {"RX INT0_1 MIX1 INP0", "DEC0", "RX_TX DEC0_INP"}, 33444f692926SSrinivas Kandagatla {"RX INT0_1 MIX1 INP0", "DEC1", "RX_TX DEC1_INP"}, 33454f692926SSrinivas Kandagatla {"RX INT0_1 MIX1 INP1", "RX0", "RX_RX0"}, 33464f692926SSrinivas Kandagatla {"RX INT0_1 MIX1 INP1", "RX1", "RX_RX1"}, 33474f692926SSrinivas Kandagatla {"RX INT0_1 MIX1 INP1", "RX2", "RX_RX2"}, 33484f692926SSrinivas Kandagatla {"RX INT0_1 MIX1 INP1", "RX3", "RX_RX3"}, 33494f692926SSrinivas Kandagatla {"RX INT0_1 MIX1 INP1", "RX4", "RX_RX4"}, 33504f692926SSrinivas Kandagatla {"RX INT0_1 MIX1 INP1", "RX5", "RX_RX5"}, 33514f692926SSrinivas Kandagatla {"RX INT0_1 MIX1 INP1", "IIR0", "IIR0"}, 33524f692926SSrinivas Kandagatla {"RX INT0_1 MIX1 INP1", "IIR1", "IIR1"}, 33534f692926SSrinivas Kandagatla {"RX INT0_1 MIX1 INP1", "DEC0", "RX_TX DEC0_INP"}, 33544f692926SSrinivas Kandagatla {"RX INT0_1 MIX1 INP1", "DEC1", "RX_TX DEC1_INP"}, 33554f692926SSrinivas Kandagatla {"RX INT0_1 MIX1 INP2", "RX0", "RX_RX0"}, 33564f692926SSrinivas Kandagatla {"RX INT0_1 MIX1 INP2", "RX1", "RX_RX1"}, 33574f692926SSrinivas Kandagatla {"RX INT0_1 MIX1 INP2", "RX2", "RX_RX2"}, 33584f692926SSrinivas Kandagatla {"RX INT0_1 MIX1 INP2", "RX3", "RX_RX3"}, 33594f692926SSrinivas Kandagatla {"RX INT0_1 MIX1 INP2", "RX4", "RX_RX4"}, 33604f692926SSrinivas Kandagatla {"RX INT0_1 MIX1 INP2", "RX5", "RX_RX5"}, 33614f692926SSrinivas Kandagatla {"RX INT0_1 MIX1 INP2", "IIR0", "IIR0"}, 33624f692926SSrinivas Kandagatla {"RX INT0_1 MIX1 INP2", "IIR1", "IIR1"}, 33634f692926SSrinivas Kandagatla {"RX INT0_1 MIX1 INP2", "DEC0", "RX_TX DEC0_INP"}, 33644f692926SSrinivas Kandagatla {"RX INT0_1 MIX1 INP2", "DEC1", "RX_TX DEC1_INP"}, 33654f692926SSrinivas Kandagatla 33664f692926SSrinivas Kandagatla {"RX INT1_1 MIX1 INP0", "RX0", "RX_RX0"}, 33674f692926SSrinivas Kandagatla {"RX INT1_1 MIX1 INP0", "RX1", "RX_RX1"}, 33684f692926SSrinivas Kandagatla {"RX INT1_1 MIX1 INP0", "RX2", "RX_RX2"}, 33694f692926SSrinivas Kandagatla {"RX INT1_1 MIX1 INP0", "RX3", "RX_RX3"}, 33704f692926SSrinivas Kandagatla {"RX INT1_1 MIX1 INP0", "RX4", "RX_RX4"}, 33714f692926SSrinivas Kandagatla {"RX INT1_1 MIX1 INP0", "RX5", "RX_RX5"}, 33724f692926SSrinivas Kandagatla {"RX INT1_1 MIX1 INP0", "IIR0", "IIR0"}, 33734f692926SSrinivas Kandagatla {"RX INT1_1 MIX1 INP0", "IIR1", "IIR1"}, 33744f692926SSrinivas Kandagatla {"RX INT1_1 MIX1 INP0", "DEC0", "RX_TX DEC0_INP"}, 33754f692926SSrinivas Kandagatla {"RX INT1_1 MIX1 INP0", "DEC1", "RX_TX DEC1_INP"}, 33764f692926SSrinivas Kandagatla {"RX INT1_1 MIX1 INP1", "RX0", "RX_RX0"}, 33774f692926SSrinivas Kandagatla {"RX INT1_1 MIX1 INP1", "RX1", "RX_RX1"}, 33784f692926SSrinivas Kandagatla {"RX INT1_1 MIX1 INP1", "RX2", "RX_RX2"}, 33794f692926SSrinivas Kandagatla {"RX INT1_1 MIX1 INP1", "RX3", "RX_RX3"}, 33804f692926SSrinivas Kandagatla {"RX INT1_1 MIX1 INP1", "RX4", "RX_RX4"}, 33814f692926SSrinivas Kandagatla {"RX INT1_1 MIX1 INP1", "RX5", "RX_RX5"}, 33824f692926SSrinivas Kandagatla {"RX INT1_1 MIX1 INP1", "IIR0", "IIR0"}, 33834f692926SSrinivas Kandagatla {"RX INT1_1 MIX1 INP1", "IIR1", "IIR1"}, 33844f692926SSrinivas Kandagatla {"RX INT1_1 MIX1 INP1", "DEC0", "RX_TX DEC0_INP"}, 33854f692926SSrinivas Kandagatla {"RX INT1_1 MIX1 INP1", "DEC1", "RX_TX DEC1_INP"}, 33864f692926SSrinivas Kandagatla {"RX INT1_1 MIX1 INP2", "RX0", "RX_RX0"}, 33874f692926SSrinivas Kandagatla {"RX INT1_1 MIX1 INP2", "RX1", "RX_RX1"}, 33884f692926SSrinivas Kandagatla {"RX INT1_1 MIX1 INP2", "RX2", "RX_RX2"}, 33894f692926SSrinivas Kandagatla {"RX INT1_1 MIX1 INP2", "RX3", "RX_RX3"}, 33904f692926SSrinivas Kandagatla {"RX INT1_1 MIX1 INP2", "RX4", "RX_RX4"}, 33914f692926SSrinivas Kandagatla {"RX INT1_1 MIX1 INP2", "RX5", "RX_RX5"}, 33924f692926SSrinivas Kandagatla {"RX INT1_1 MIX1 INP2", "IIR0", "IIR0"}, 33934f692926SSrinivas Kandagatla {"RX INT1_1 MIX1 INP2", "IIR1", "IIR1"}, 33944f692926SSrinivas Kandagatla {"RX INT1_1 MIX1 INP2", "DEC0", "RX_TX DEC0_INP"}, 33954f692926SSrinivas Kandagatla {"RX INT1_1 MIX1 INP2", "DEC1", "RX_TX DEC1_INP"}, 33964f692926SSrinivas Kandagatla 33974f692926SSrinivas Kandagatla {"RX INT2_1 MIX1 INP0", "RX0", "RX_RX0"}, 33984f692926SSrinivas Kandagatla {"RX INT2_1 MIX1 INP0", "RX1", "RX_RX1"}, 33994f692926SSrinivas Kandagatla {"RX INT2_1 MIX1 INP0", "RX2", "RX_RX2"}, 34004f692926SSrinivas Kandagatla {"RX INT2_1 MIX1 INP0", "RX3", "RX_RX3"}, 34014f692926SSrinivas Kandagatla {"RX INT2_1 MIX1 INP0", "RX4", "RX_RX4"}, 34024f692926SSrinivas Kandagatla {"RX INT2_1 MIX1 INP0", "RX5", "RX_RX5"}, 34034f692926SSrinivas Kandagatla {"RX INT2_1 MIX1 INP0", "IIR0", "IIR0"}, 34044f692926SSrinivas Kandagatla {"RX INT2_1 MIX1 INP0", "IIR1", "IIR1"}, 34054f692926SSrinivas Kandagatla {"RX INT2_1 MIX1 INP0", "DEC0", "RX_TX DEC0_INP"}, 34064f692926SSrinivas Kandagatla {"RX INT2_1 MIX1 INP0", "DEC1", "RX_TX DEC1_INP"}, 34074f692926SSrinivas Kandagatla {"RX INT2_1 MIX1 INP1", "RX0", "RX_RX0"}, 34084f692926SSrinivas Kandagatla {"RX INT2_1 MIX1 INP1", "RX1", "RX_RX1"}, 34094f692926SSrinivas Kandagatla {"RX INT2_1 MIX1 INP1", "RX2", "RX_RX2"}, 34104f692926SSrinivas Kandagatla {"RX INT2_1 MIX1 INP1", "RX3", "RX_RX3"}, 34114f692926SSrinivas Kandagatla {"RX INT2_1 MIX1 INP1", "RX4", "RX_RX4"}, 34124f692926SSrinivas Kandagatla {"RX INT2_1 MIX1 INP1", "RX5", "RX_RX5"}, 34134f692926SSrinivas Kandagatla {"RX INT2_1 MIX1 INP1", "IIR0", "IIR0"}, 34144f692926SSrinivas Kandagatla {"RX INT2_1 MIX1 INP1", "IIR1", "IIR1"}, 34154f692926SSrinivas Kandagatla {"RX INT2_1 MIX1 INP1", "DEC0", "RX_TX DEC0_INP"}, 34164f692926SSrinivas Kandagatla {"RX INT2_1 MIX1 INP1", "DEC1", "RX_TX DEC1_INP"}, 34174f692926SSrinivas Kandagatla {"RX INT2_1 MIX1 INP2", "RX0", "RX_RX0"}, 34184f692926SSrinivas Kandagatla {"RX INT2_1 MIX1 INP2", "RX1", "RX_RX1"}, 34194f692926SSrinivas Kandagatla {"RX INT2_1 MIX1 INP2", "RX2", "RX_RX2"}, 34204f692926SSrinivas Kandagatla {"RX INT2_1 MIX1 INP2", "RX3", "RX_RX3"}, 34214f692926SSrinivas Kandagatla {"RX INT2_1 MIX1 INP2", "RX4", "RX_RX4"}, 34224f692926SSrinivas Kandagatla {"RX INT2_1 MIX1 INP2", "RX5", "RX_RX5"}, 34234f692926SSrinivas Kandagatla {"RX INT2_1 MIX1 INP2", "IIR0", "IIR0"}, 34244f692926SSrinivas Kandagatla {"RX INT2_1 MIX1 INP2", "IIR1", "IIR1"}, 34254f692926SSrinivas Kandagatla {"RX INT2_1 MIX1 INP2", "DEC0", "RX_TX DEC0_INP"}, 34264f692926SSrinivas Kandagatla {"RX INT2_1 MIX1 INP2", "DEC1", "RX_TX DEC1_INP"}, 34274f692926SSrinivas Kandagatla 34284f692926SSrinivas Kandagatla {"RX INT0_1 MIX1", NULL, "RX INT0_1 MIX1 INP0"}, 34294f692926SSrinivas Kandagatla {"RX INT0_1 MIX1", NULL, "RX INT0_1 MIX1 INP1"}, 34304f692926SSrinivas Kandagatla {"RX INT0_1 MIX1", NULL, "RX INT0_1 MIX1 INP2"}, 34314f692926SSrinivas Kandagatla {"RX INT1_1 MIX1", NULL, "RX INT1_1 MIX1 INP0"}, 34324f692926SSrinivas Kandagatla {"RX INT1_1 MIX1", NULL, "RX INT1_1 MIX1 INP1"}, 34334f692926SSrinivas Kandagatla {"RX INT1_1 MIX1", NULL, "RX INT1_1 MIX1 INP2"}, 34344f692926SSrinivas Kandagatla {"RX INT2_1 MIX1", NULL, "RX INT2_1 MIX1 INP0"}, 34354f692926SSrinivas Kandagatla {"RX INT2_1 MIX1", NULL, "RX INT2_1 MIX1 INP1"}, 34364f692926SSrinivas Kandagatla {"RX INT2_1 MIX1", NULL, "RX INT2_1 MIX1 INP2"}, 34374f692926SSrinivas Kandagatla 34384f692926SSrinivas Kandagatla {"RX MIX TX0 MUX", "RX_MIX0", "RX INT0 SEC MIX"}, 34394f692926SSrinivas Kandagatla {"RX MIX TX0 MUX", "RX_MIX1", "RX INT1 SEC MIX"}, 34404f692926SSrinivas Kandagatla {"RX MIX TX0 MUX", "RX_MIX2", "RX INT2 SEC MIX"}, 34414f692926SSrinivas Kandagatla {"RX MIX TX1 MUX", "RX_MIX0", "RX INT0 SEC MIX"}, 34424f692926SSrinivas Kandagatla {"RX MIX TX1 MUX", "RX_MIX1", "RX INT1 SEC MIX"}, 34434f692926SSrinivas Kandagatla {"RX MIX TX1 MUX", "RX_MIX2", "RX INT2 SEC MIX"}, 34444f692926SSrinivas Kandagatla {"RX MIX TX2 MUX", "RX_MIX0", "RX INT0 SEC MIX"}, 34454f692926SSrinivas Kandagatla {"RX MIX TX2 MUX", "RX_MIX1", "RX INT1 SEC MIX"}, 34464f692926SSrinivas Kandagatla {"RX MIX TX2 MUX", "RX_MIX2", "RX INT2 SEC MIX"}, 34474f692926SSrinivas Kandagatla {"RX AIF_ECHO", NULL, "RX MIX TX0 MUX"}, 34484f692926SSrinivas Kandagatla {"RX AIF_ECHO", NULL, "RX MIX TX1 MUX"}, 34494f692926SSrinivas Kandagatla {"RX AIF_ECHO", NULL, "RX MIX TX2 MUX"}, 34504f692926SSrinivas Kandagatla {"RX AIF_ECHO", NULL, "RX_MCLK"}, 34514f692926SSrinivas Kandagatla 34524f692926SSrinivas Kandagatla /* Mixing path INT0 */ 34534f692926SSrinivas Kandagatla {"RX INT0_2 MUX", "RX0", "RX_RX0"}, 34544f692926SSrinivas Kandagatla {"RX INT0_2 MUX", "RX1", "RX_RX1"}, 34554f692926SSrinivas Kandagatla {"RX INT0_2 MUX", "RX2", "RX_RX2"}, 34564f692926SSrinivas Kandagatla {"RX INT0_2 MUX", "RX3", "RX_RX3"}, 34574f692926SSrinivas Kandagatla {"RX INT0_2 MUX", "RX4", "RX_RX4"}, 34584f692926SSrinivas Kandagatla {"RX INT0_2 MUX", "RX5", "RX_RX5"}, 34594f692926SSrinivas Kandagatla {"RX INT0_2 INTERP", NULL, "RX INT0_2 MUX"}, 34604f692926SSrinivas Kandagatla {"RX INT0 SEC MIX", NULL, "RX INT0_2 INTERP"}, 34614f692926SSrinivas Kandagatla 34624f692926SSrinivas Kandagatla /* Mixing path INT1 */ 34634f692926SSrinivas Kandagatla {"RX INT1_2 MUX", "RX0", "RX_RX0"}, 34644f692926SSrinivas Kandagatla {"RX INT1_2 MUX", "RX1", "RX_RX1"}, 34654f692926SSrinivas Kandagatla {"RX INT1_2 MUX", "RX2", "RX_RX2"}, 34664f692926SSrinivas Kandagatla {"RX INT1_2 MUX", "RX3", "RX_RX3"}, 34674f692926SSrinivas Kandagatla {"RX INT1_2 MUX", "RX4", "RX_RX4"}, 34684f692926SSrinivas Kandagatla {"RX INT1_2 MUX", "RX5", "RX_RX5"}, 34694f692926SSrinivas Kandagatla {"RX INT1_2 INTERP", NULL, "RX INT1_2 MUX"}, 34704f692926SSrinivas Kandagatla {"RX INT1 SEC MIX", NULL, "RX INT1_2 INTERP"}, 34714f692926SSrinivas Kandagatla 34724f692926SSrinivas Kandagatla /* Mixing path INT2 */ 34734f692926SSrinivas Kandagatla {"RX INT2_2 MUX", "RX0", "RX_RX0"}, 34744f692926SSrinivas Kandagatla {"RX INT2_2 MUX", "RX1", "RX_RX1"}, 34754f692926SSrinivas Kandagatla {"RX INT2_2 MUX", "RX2", "RX_RX2"}, 34764f692926SSrinivas Kandagatla {"RX INT2_2 MUX", "RX3", "RX_RX3"}, 34774f692926SSrinivas Kandagatla {"RX INT2_2 MUX", "RX4", "RX_RX4"}, 34784f692926SSrinivas Kandagatla {"RX INT2_2 MUX", "RX5", "RX_RX5"}, 34794f692926SSrinivas Kandagatla {"RX INT2_2 INTERP", NULL, "RX INT2_2 MUX"}, 34804f692926SSrinivas Kandagatla {"RX INT2 SEC MIX", NULL, "RX INT2_2 INTERP"}, 34814f692926SSrinivas Kandagatla 34824f692926SSrinivas Kandagatla {"RX INT0_1 INTERP", NULL, "RX INT0_1 MIX1"}, 34834f692926SSrinivas Kandagatla {"RX INT0 SEC MIX", NULL, "RX INT0_1 INTERP"}, 34844f692926SSrinivas Kandagatla {"RX INT0 MIX2", NULL, "RX INT0 SEC MIX"}, 34854f692926SSrinivas Kandagatla {"RX INT0 MIX2", NULL, "RX INT0 MIX2 INP"}, 34864f692926SSrinivas Kandagatla {"RX INT0 DEM MUX", "CLSH_DSM_OUT", "RX INT0 MIX2"}, 34874f692926SSrinivas Kandagatla {"HPHL_OUT", NULL, "RX INT0 DEM MUX"}, 34884f692926SSrinivas Kandagatla {"HPHL_OUT", NULL, "RX_MCLK"}, 34894f692926SSrinivas Kandagatla 34904f692926SSrinivas Kandagatla {"RX INT1_1 INTERP", NULL, "RX INT1_1 MIX1"}, 34914f692926SSrinivas Kandagatla {"RX INT1 SEC MIX", NULL, "RX INT1_1 INTERP"}, 34924f692926SSrinivas Kandagatla {"RX INT1 MIX2", NULL, "RX INT1 SEC MIX"}, 34934f692926SSrinivas Kandagatla {"RX INT1 MIX2", NULL, "RX INT1 MIX2 INP"}, 34944f692926SSrinivas Kandagatla {"RX INT1 DEM MUX", "CLSH_DSM_OUT", "RX INT1 MIX2"}, 34954f692926SSrinivas Kandagatla {"HPHR_OUT", NULL, "RX INT1 DEM MUX"}, 34964f692926SSrinivas Kandagatla {"HPHR_OUT", NULL, "RX_MCLK"}, 34974f692926SSrinivas Kandagatla 34984f692926SSrinivas Kandagatla {"RX INT2_1 INTERP", NULL, "RX INT2_1 MIX1"}, 34994f692926SSrinivas Kandagatla 35004f692926SSrinivas Kandagatla {"RX INT2 SEC MIX", NULL, "RX INT2_1 INTERP"}, 35014f692926SSrinivas Kandagatla {"RX INT2 MIX2", NULL, "RX INT2 SEC MIX"}, 35024f692926SSrinivas Kandagatla {"RX INT2 MIX2", NULL, "RX INT2 MIX2 INP"}, 35034f692926SSrinivas Kandagatla {"AUX_OUT", NULL, "RX INT2 MIX2"}, 35044f692926SSrinivas Kandagatla {"AUX_OUT", NULL, "RX_MCLK"}, 35054f692926SSrinivas Kandagatla 35064f692926SSrinivas Kandagatla {"IIR0", NULL, "RX_MCLK"}, 35074f692926SSrinivas Kandagatla {"IIR0", NULL, "IIR0 INP0 MUX"}, 35084f692926SSrinivas Kandagatla {"IIR0 INP0 MUX", "DEC0", "RX_TX DEC0_INP"}, 35094f692926SSrinivas Kandagatla {"IIR0 INP0 MUX", "DEC1", "RX_TX DEC1_INP"}, 35104f692926SSrinivas Kandagatla {"IIR0 INP0 MUX", "DEC2", "RX_TX DEC2_INP"}, 35114f692926SSrinivas Kandagatla {"IIR0 INP0 MUX", "DEC3", "RX_TX DEC3_INP"}, 35124f692926SSrinivas Kandagatla {"IIR0 INP0 MUX", "RX0", "RX_RX0"}, 35134f692926SSrinivas Kandagatla {"IIR0 INP0 MUX", "RX1", "RX_RX1"}, 35144f692926SSrinivas Kandagatla {"IIR0 INP0 MUX", "RX2", "RX_RX2"}, 35154f692926SSrinivas Kandagatla {"IIR0 INP0 MUX", "RX3", "RX_RX3"}, 35164f692926SSrinivas Kandagatla {"IIR0 INP0 MUX", "RX4", "RX_RX4"}, 35174f692926SSrinivas Kandagatla {"IIR0 INP0 MUX", "RX5", "RX_RX5"}, 35184f692926SSrinivas Kandagatla {"IIR0", NULL, "IIR0 INP1 MUX"}, 35194f692926SSrinivas Kandagatla {"IIR0 INP1 MUX", "DEC0", "RX_TX DEC0_INP"}, 35204f692926SSrinivas Kandagatla {"IIR0 INP1 MUX", "DEC1", "RX_TX DEC1_INP"}, 35214f692926SSrinivas Kandagatla {"IIR0 INP1 MUX", "DEC2", "RX_TX DEC2_INP"}, 35224f692926SSrinivas Kandagatla {"IIR0 INP1 MUX", "DEC3", "RX_TX DEC3_INP"}, 35234f692926SSrinivas Kandagatla {"IIR0 INP1 MUX", "RX0", "RX_RX0"}, 35244f692926SSrinivas Kandagatla {"IIR0 INP1 MUX", "RX1", "RX_RX1"}, 35254f692926SSrinivas Kandagatla {"IIR0 INP1 MUX", "RX2", "RX_RX2"}, 35264f692926SSrinivas Kandagatla {"IIR0 INP1 MUX", "RX3", "RX_RX3"}, 35274f692926SSrinivas Kandagatla {"IIR0 INP1 MUX", "RX4", "RX_RX4"}, 35284f692926SSrinivas Kandagatla {"IIR0 INP1 MUX", "RX5", "RX_RX5"}, 35294f692926SSrinivas Kandagatla {"IIR0", NULL, "IIR0 INP2 MUX"}, 35304f692926SSrinivas Kandagatla {"IIR0 INP2 MUX", "DEC0", "RX_TX DEC0_INP"}, 35314f692926SSrinivas Kandagatla {"IIR0 INP2 MUX", "DEC1", "RX_TX DEC1_INP"}, 35324f692926SSrinivas Kandagatla {"IIR0 INP2 MUX", "DEC2", "RX_TX DEC2_INP"}, 35334f692926SSrinivas Kandagatla {"IIR0 INP2 MUX", "DEC3", "RX_TX DEC3_INP"}, 35344f692926SSrinivas Kandagatla {"IIR0 INP2 MUX", "RX0", "RX_RX0"}, 35354f692926SSrinivas Kandagatla {"IIR0 INP2 MUX", "RX1", "RX_RX1"}, 35364f692926SSrinivas Kandagatla {"IIR0 INP2 MUX", "RX2", "RX_RX2"}, 35374f692926SSrinivas Kandagatla {"IIR0 INP2 MUX", "RX3", "RX_RX3"}, 35384f692926SSrinivas Kandagatla {"IIR0 INP2 MUX", "RX4", "RX_RX4"}, 35394f692926SSrinivas Kandagatla {"IIR0 INP2 MUX", "RX5", "RX_RX5"}, 35404f692926SSrinivas Kandagatla {"IIR0", NULL, "IIR0 INP3 MUX"}, 35414f692926SSrinivas Kandagatla {"IIR0 INP3 MUX", "DEC0", "RX_TX DEC0_INP"}, 35424f692926SSrinivas Kandagatla {"IIR0 INP3 MUX", "DEC1", "RX_TX DEC1_INP"}, 35434f692926SSrinivas Kandagatla {"IIR0 INP3 MUX", "DEC2", "RX_TX DEC2_INP"}, 35444f692926SSrinivas Kandagatla {"IIR0 INP3 MUX", "DEC3", "RX_TX DEC3_INP"}, 35454f692926SSrinivas Kandagatla {"IIR0 INP3 MUX", "RX0", "RX_RX0"}, 35464f692926SSrinivas Kandagatla {"IIR0 INP3 MUX", "RX1", "RX_RX1"}, 35474f692926SSrinivas Kandagatla {"IIR0 INP3 MUX", "RX2", "RX_RX2"}, 35484f692926SSrinivas Kandagatla {"IIR0 INP3 MUX", "RX3", "RX_RX3"}, 35494f692926SSrinivas Kandagatla {"IIR0 INP3 MUX", "RX4", "RX_RX4"}, 35504f692926SSrinivas Kandagatla {"IIR0 INP3 MUX", "RX5", "RX_RX5"}, 35514f692926SSrinivas Kandagatla 35524f692926SSrinivas Kandagatla {"IIR1", NULL, "RX_MCLK"}, 35534f692926SSrinivas Kandagatla {"IIR1", NULL, "IIR1 INP0 MUX"}, 35544f692926SSrinivas Kandagatla {"IIR1 INP0 MUX", "DEC0", "RX_TX DEC0_INP"}, 35554f692926SSrinivas Kandagatla {"IIR1 INP0 MUX", "DEC1", "RX_TX DEC1_INP"}, 35564f692926SSrinivas Kandagatla {"IIR1 INP0 MUX", "DEC2", "RX_TX DEC2_INP"}, 35574f692926SSrinivas Kandagatla {"IIR1 INP0 MUX", "DEC3", "RX_TX DEC3_INP"}, 35584f692926SSrinivas Kandagatla {"IIR1 INP0 MUX", "RX0", "RX_RX0"}, 35594f692926SSrinivas Kandagatla {"IIR1 INP0 MUX", "RX1", "RX_RX1"}, 35604f692926SSrinivas Kandagatla {"IIR1 INP0 MUX", "RX2", "RX_RX2"}, 35614f692926SSrinivas Kandagatla {"IIR1 INP0 MUX", "RX3", "RX_RX3"}, 35624f692926SSrinivas Kandagatla {"IIR1 INP0 MUX", "RX4", "RX_RX4"}, 35634f692926SSrinivas Kandagatla {"IIR1 INP0 MUX", "RX5", "RX_RX5"}, 35644f692926SSrinivas Kandagatla {"IIR1", NULL, "IIR1 INP1 MUX"}, 35654f692926SSrinivas Kandagatla {"IIR1 INP1 MUX", "DEC0", "RX_TX DEC0_INP"}, 35664f692926SSrinivas Kandagatla {"IIR1 INP1 MUX", "DEC1", "RX_TX DEC1_INP"}, 35674f692926SSrinivas Kandagatla {"IIR1 INP1 MUX", "DEC2", "RX_TX DEC2_INP"}, 35684f692926SSrinivas Kandagatla {"IIR1 INP1 MUX", "DEC3", "RX_TX DEC3_INP"}, 35694f692926SSrinivas Kandagatla {"IIR1 INP1 MUX", "RX0", "RX_RX0"}, 35704f692926SSrinivas Kandagatla {"IIR1 INP1 MUX", "RX1", "RX_RX1"}, 35714f692926SSrinivas Kandagatla {"IIR1 INP1 MUX", "RX2", "RX_RX2"}, 35724f692926SSrinivas Kandagatla {"IIR1 INP1 MUX", "RX3", "RX_RX3"}, 35734f692926SSrinivas Kandagatla {"IIR1 INP1 MUX", "RX4", "RX_RX4"}, 35744f692926SSrinivas Kandagatla {"IIR1 INP1 MUX", "RX5", "RX_RX5"}, 35754f692926SSrinivas Kandagatla {"IIR1", NULL, "IIR1 INP2 MUX"}, 35764f692926SSrinivas Kandagatla {"IIR1 INP2 MUX", "DEC0", "RX_TX DEC0_INP"}, 35774f692926SSrinivas Kandagatla {"IIR1 INP2 MUX", "DEC1", "RX_TX DEC1_INP"}, 35784f692926SSrinivas Kandagatla {"IIR1 INP2 MUX", "DEC2", "RX_TX DEC2_INP"}, 35794f692926SSrinivas Kandagatla {"IIR1 INP2 MUX", "DEC3", "RX_TX DEC3_INP"}, 35804f692926SSrinivas Kandagatla {"IIR1 INP2 MUX", "RX0", "RX_RX0"}, 35814f692926SSrinivas Kandagatla {"IIR1 INP2 MUX", "RX1", "RX_RX1"}, 35824f692926SSrinivas Kandagatla {"IIR1 INP2 MUX", "RX2", "RX_RX2"}, 35834f692926SSrinivas Kandagatla {"IIR1 INP2 MUX", "RX3", "RX_RX3"}, 35844f692926SSrinivas Kandagatla {"IIR1 INP2 MUX", "RX4", "RX_RX4"}, 35854f692926SSrinivas Kandagatla {"IIR1 INP2 MUX", "RX5", "RX_RX5"}, 35864f692926SSrinivas Kandagatla {"IIR1", NULL, "IIR1 INP3 MUX"}, 35874f692926SSrinivas Kandagatla {"IIR1 INP3 MUX", "DEC0", "RX_TX DEC0_INP"}, 35884f692926SSrinivas Kandagatla {"IIR1 INP3 MUX", "DEC1", "RX_TX DEC1_INP"}, 35894f692926SSrinivas Kandagatla {"IIR1 INP3 MUX", "DEC2", "RX_TX DEC2_INP"}, 35904f692926SSrinivas Kandagatla {"IIR1 INP3 MUX", "DEC3", "RX_TX DEC3_INP"}, 35914f692926SSrinivas Kandagatla {"IIR1 INP3 MUX", "RX0", "RX_RX0"}, 35924f692926SSrinivas Kandagatla {"IIR1 INP3 MUX", "RX1", "RX_RX1"}, 35934f692926SSrinivas Kandagatla {"IIR1 INP3 MUX", "RX2", "RX_RX2"}, 35944f692926SSrinivas Kandagatla {"IIR1 INP3 MUX", "RX3", "RX_RX3"}, 35954f692926SSrinivas Kandagatla {"IIR1 INP3 MUX", "RX4", "RX_RX4"}, 35964f692926SSrinivas Kandagatla {"IIR1 INP3 MUX", "RX5", "RX_RX5"}, 35974f692926SSrinivas Kandagatla 35984f692926SSrinivas Kandagatla {"SRC0", NULL, "IIR0"}, 35994f692926SSrinivas Kandagatla {"SRC1", NULL, "IIR1"}, 36004f692926SSrinivas Kandagatla {"RX INT0 MIX2 INP", "SRC0", "SRC0"}, 36014f692926SSrinivas Kandagatla {"RX INT0 MIX2 INP", "SRC1", "SRC1"}, 36024f692926SSrinivas Kandagatla {"RX INT1 MIX2 INP", "SRC0", "SRC0"}, 36034f692926SSrinivas Kandagatla {"RX INT1 MIX2 INP", "SRC1", "SRC1"}, 36044f692926SSrinivas Kandagatla {"RX INT2 MIX2 INP", "SRC0", "SRC0"}, 36054f692926SSrinivas Kandagatla {"RX INT2 MIX2 INP", "SRC1", "SRC1"}, 36064f692926SSrinivas Kandagatla }; 36074f692926SSrinivas Kandagatla 3608af3d54b9SSrinivas Kandagatla static int rx_macro_component_probe(struct snd_soc_component *component) 3609af3d54b9SSrinivas Kandagatla { 3610dbacef05SSrinivas Kandagatla struct snd_soc_dapm_context *dapm = snd_soc_component_get_dapm(component); 3611af3d54b9SSrinivas Kandagatla struct rx_macro *rx = snd_soc_component_get_drvdata(component); 3612dbacef05SSrinivas Kandagatla const struct snd_soc_dapm_widget *widgets; 3613dbacef05SSrinivas Kandagatla const struct snd_kcontrol_new *controls; 3614dbacef05SSrinivas Kandagatla unsigned int num_controls; 3615dbacef05SSrinivas Kandagatla int ret, num_widgets; 3616af3d54b9SSrinivas Kandagatla 3617af3d54b9SSrinivas Kandagatla snd_soc_component_init_regmap(component, rx->regmap); 3618af3d54b9SSrinivas Kandagatla 3619dbacef05SSrinivas Kandagatla snd_soc_component_update_bits(component, CDC_RX_RXn_RX_PATH_SEC7(rx, 0), 3620af3d54b9SSrinivas Kandagatla CDC_RX_DSM_OUT_DELAY_SEL_MASK, 3621af3d54b9SSrinivas Kandagatla CDC_RX_DSM_OUT_DELAY_TWO_SAMPLE); 3622dbacef05SSrinivas Kandagatla snd_soc_component_update_bits(component, CDC_RX_RXn_RX_PATH_SEC7(rx, 1), 3623af3d54b9SSrinivas Kandagatla CDC_RX_DSM_OUT_DELAY_SEL_MASK, 3624af3d54b9SSrinivas Kandagatla CDC_RX_DSM_OUT_DELAY_TWO_SAMPLE); 3625dbacef05SSrinivas Kandagatla snd_soc_component_update_bits(component, CDC_RX_RXn_RX_PATH_SEC7(rx, 2), 3626af3d54b9SSrinivas Kandagatla CDC_RX_DSM_OUT_DELAY_SEL_MASK, 3627af3d54b9SSrinivas Kandagatla CDC_RX_DSM_OUT_DELAY_TWO_SAMPLE); 3628dbacef05SSrinivas Kandagatla snd_soc_component_update_bits(component, CDC_RX_RXn_RX_PATH_CFG3(rx, 0), 3629af3d54b9SSrinivas Kandagatla CDC_RX_DC_COEFF_SEL_MASK, 3630af3d54b9SSrinivas Kandagatla CDC_RX_DC_COEFF_SEL_TWO); 3631dbacef05SSrinivas Kandagatla snd_soc_component_update_bits(component, CDC_RX_RXn_RX_PATH_CFG3(rx, 1), 3632af3d54b9SSrinivas Kandagatla CDC_RX_DC_COEFF_SEL_MASK, 3633af3d54b9SSrinivas Kandagatla CDC_RX_DC_COEFF_SEL_TWO); 3634dbacef05SSrinivas Kandagatla snd_soc_component_update_bits(component, CDC_RX_RXn_RX_PATH_CFG3(rx, 2), 3635af3d54b9SSrinivas Kandagatla CDC_RX_DC_COEFF_SEL_MASK, 3636af3d54b9SSrinivas Kandagatla CDC_RX_DC_COEFF_SEL_TWO); 3637af3d54b9SSrinivas Kandagatla 3638dbacef05SSrinivas Kandagatla switch (rx->codec_version) { 3639dbacef05SSrinivas Kandagatla case LPASS_CODEC_VERSION_1_0: 3640dbacef05SSrinivas Kandagatla case LPASS_CODEC_VERSION_1_1: 3641dbacef05SSrinivas Kandagatla case LPASS_CODEC_VERSION_1_2: 3642dbacef05SSrinivas Kandagatla case LPASS_CODEC_VERSION_2_0: 3643903e8509SKrzysztof Kozlowski case LPASS_CODEC_VERSION_2_1: 3644dbacef05SSrinivas Kandagatla controls = rx_macro_def_snd_controls; 3645dbacef05SSrinivas Kandagatla num_controls = ARRAY_SIZE(rx_macro_def_snd_controls); 3646dbacef05SSrinivas Kandagatla widgets = rx_macro_def_dapm_widgets; 3647dbacef05SSrinivas Kandagatla num_widgets = ARRAY_SIZE(rx_macro_def_dapm_widgets); 3648dbacef05SSrinivas Kandagatla break; 3649432e5074SSrinivas Kandagatla case LPASS_CODEC_VERSION_2_5: 3650432e5074SSrinivas Kandagatla case LPASS_CODEC_VERSION_2_6: 3651432e5074SSrinivas Kandagatla case LPASS_CODEC_VERSION_2_7: 3652432e5074SSrinivas Kandagatla case LPASS_CODEC_VERSION_2_8: 3653432e5074SSrinivas Kandagatla controls = rx_macro_2_5_snd_controls; 3654432e5074SSrinivas Kandagatla num_controls = ARRAY_SIZE(rx_macro_2_5_snd_controls); 3655432e5074SSrinivas Kandagatla widgets = rx_macro_2_5_dapm_widgets; 3656432e5074SSrinivas Kandagatla num_widgets = ARRAY_SIZE(rx_macro_2_5_dapm_widgets); 3657432e5074SSrinivas Kandagatla break; 3658dbacef05SSrinivas Kandagatla default: 3659dbacef05SSrinivas Kandagatla return -EINVAL; 3660dbacef05SSrinivas Kandagatla } 3661dbacef05SSrinivas Kandagatla 3662af3d54b9SSrinivas Kandagatla rx->component = component; 3663af3d54b9SSrinivas Kandagatla 3664dbacef05SSrinivas Kandagatla ret = snd_soc_add_component_controls(component, controls, num_controls); 3665dbacef05SSrinivas Kandagatla if (ret) 3666dbacef05SSrinivas Kandagatla return ret; 3667dbacef05SSrinivas Kandagatla 3668dbacef05SSrinivas Kandagatla return snd_soc_dapm_new_controls(dapm, widgets, num_widgets); 3669af3d54b9SSrinivas Kandagatla } 3670af3d54b9SSrinivas Kandagatla 3671af3d54b9SSrinivas Kandagatla static int swclk_gate_enable(struct clk_hw *hw) 3672af3d54b9SSrinivas Kandagatla { 3673af3d54b9SSrinivas Kandagatla struct rx_macro *rx = to_rx_macro(hw); 3674eaba1134SSrinivas Kandagatla int ret; 3675eaba1134SSrinivas Kandagatla 3676eaba1134SSrinivas Kandagatla ret = clk_prepare_enable(rx->mclk); 3677eaba1134SSrinivas Kandagatla if (ret) { 3678eaba1134SSrinivas Kandagatla dev_err(rx->dev, "unable to prepare mclk\n"); 3679eaba1134SSrinivas Kandagatla return ret; 3680eaba1134SSrinivas Kandagatla } 3681af3d54b9SSrinivas Kandagatla 3682af3d54b9SSrinivas Kandagatla rx_macro_mclk_enable(rx, true); 3683af3d54b9SSrinivas Kandagatla 3684af3d54b9SSrinivas Kandagatla regmap_update_bits(rx->regmap, CDC_RX_CLK_RST_CTRL_SWR_CONTROL, 3685af3d54b9SSrinivas Kandagatla CDC_RX_SWR_CLK_EN_MASK, 1); 3686af3d54b9SSrinivas Kandagatla 3687af3d54b9SSrinivas Kandagatla return 0; 3688af3d54b9SSrinivas Kandagatla } 3689af3d54b9SSrinivas Kandagatla 3690af3d54b9SSrinivas Kandagatla static void swclk_gate_disable(struct clk_hw *hw) 3691af3d54b9SSrinivas Kandagatla { 3692af3d54b9SSrinivas Kandagatla struct rx_macro *rx = to_rx_macro(hw); 3693af3d54b9SSrinivas Kandagatla 3694af3d54b9SSrinivas Kandagatla regmap_update_bits(rx->regmap, CDC_RX_CLK_RST_CTRL_SWR_CONTROL, 3695af3d54b9SSrinivas Kandagatla CDC_RX_SWR_CLK_EN_MASK, 0); 3696af3d54b9SSrinivas Kandagatla 3697af3d54b9SSrinivas Kandagatla rx_macro_mclk_enable(rx, false); 3698eaba1134SSrinivas Kandagatla clk_disable_unprepare(rx->mclk); 3699af3d54b9SSrinivas Kandagatla } 3700af3d54b9SSrinivas Kandagatla 3701af3d54b9SSrinivas Kandagatla static int swclk_gate_is_enabled(struct clk_hw *hw) 3702af3d54b9SSrinivas Kandagatla { 3703af3d54b9SSrinivas Kandagatla struct rx_macro *rx = to_rx_macro(hw); 3704af3d54b9SSrinivas Kandagatla int ret, val; 3705af3d54b9SSrinivas Kandagatla 3706af3d54b9SSrinivas Kandagatla regmap_read(rx->regmap, CDC_RX_CLK_RST_CTRL_SWR_CONTROL, &val); 3707af3d54b9SSrinivas Kandagatla ret = val & BIT(0); 3708af3d54b9SSrinivas Kandagatla 3709af3d54b9SSrinivas Kandagatla return ret; 3710af3d54b9SSrinivas Kandagatla } 3711af3d54b9SSrinivas Kandagatla 3712af3d54b9SSrinivas Kandagatla static unsigned long swclk_recalc_rate(struct clk_hw *hw, 3713af3d54b9SSrinivas Kandagatla unsigned long parent_rate) 3714af3d54b9SSrinivas Kandagatla { 3715af3d54b9SSrinivas Kandagatla return parent_rate / 2; 3716af3d54b9SSrinivas Kandagatla } 3717af3d54b9SSrinivas Kandagatla 3718af3d54b9SSrinivas Kandagatla static const struct clk_ops swclk_gate_ops = { 3719af3d54b9SSrinivas Kandagatla .prepare = swclk_gate_enable, 3720af3d54b9SSrinivas Kandagatla .unprepare = swclk_gate_disable, 3721af3d54b9SSrinivas Kandagatla .is_enabled = swclk_gate_is_enabled, 3722af3d54b9SSrinivas Kandagatla .recalc_rate = swclk_recalc_rate, 3723af3d54b9SSrinivas Kandagatla 3724af3d54b9SSrinivas Kandagatla }; 3725af3d54b9SSrinivas Kandagatla 372670a5e96bSSrinivas Kandagatla static int rx_macro_register_mclk_output(struct rx_macro *rx) 3727af3d54b9SSrinivas Kandagatla { 3728af3d54b9SSrinivas Kandagatla struct device *dev = rx->dev; 3729af3d54b9SSrinivas Kandagatla const char *parent_clk_name = NULL; 3730af3d54b9SSrinivas Kandagatla const char *clk_name = "lpass-rx-mclk"; 3731af3d54b9SSrinivas Kandagatla struct clk_hw *hw; 3732af3d54b9SSrinivas Kandagatla struct clk_init_data init; 3733af3d54b9SSrinivas Kandagatla int ret; 3734af3d54b9SSrinivas Kandagatla 3735492fe974SKrzysztof Kozlowski if (rx->npl) 3736eaba1134SSrinivas Kandagatla parent_clk_name = __clk_get_name(rx->npl); 3737492fe974SKrzysztof Kozlowski else 3738492fe974SKrzysztof Kozlowski parent_clk_name = __clk_get_name(rx->mclk); 3739af3d54b9SSrinivas Kandagatla 3740af3d54b9SSrinivas Kandagatla init.name = clk_name; 3741af3d54b9SSrinivas Kandagatla init.ops = &swclk_gate_ops; 3742af3d54b9SSrinivas Kandagatla init.flags = 0; 3743af3d54b9SSrinivas Kandagatla init.parent_names = &parent_clk_name; 3744af3d54b9SSrinivas Kandagatla init.num_parents = 1; 3745af3d54b9SSrinivas Kandagatla rx->hw.init = &init; 3746af3d54b9SSrinivas Kandagatla hw = &rx->hw; 374770a5e96bSSrinivas Kandagatla ret = devm_clk_hw_register(rx->dev, hw); 3748af3d54b9SSrinivas Kandagatla if (ret) 374970a5e96bSSrinivas Kandagatla return ret; 3750af3d54b9SSrinivas Kandagatla 375170a5e96bSSrinivas Kandagatla return devm_of_clk_add_hw_provider(dev, of_clk_hw_simple_get, hw); 3752af3d54b9SSrinivas Kandagatla } 3753af3d54b9SSrinivas Kandagatla 3754af3d54b9SSrinivas Kandagatla static const struct snd_soc_component_driver rx_macro_component_drv = { 3755af3d54b9SSrinivas Kandagatla .name = "RX-MACRO", 3756af3d54b9SSrinivas Kandagatla .probe = rx_macro_component_probe, 3757af3d54b9SSrinivas Kandagatla .controls = rx_macro_snd_controls, 3758af3d54b9SSrinivas Kandagatla .num_controls = ARRAY_SIZE(rx_macro_snd_controls), 37594f692926SSrinivas Kandagatla .dapm_widgets = rx_macro_dapm_widgets, 37604f692926SSrinivas Kandagatla .num_dapm_widgets = ARRAY_SIZE(rx_macro_dapm_widgets), 37614f692926SSrinivas Kandagatla .dapm_routes = rx_audio_map, 37624f692926SSrinivas Kandagatla .num_dapm_routes = ARRAY_SIZE(rx_audio_map), 3763af3d54b9SSrinivas Kandagatla }; 3764af3d54b9SSrinivas Kandagatla 3765af3d54b9SSrinivas Kandagatla static int rx_macro_probe(struct platform_device *pdev) 3766af3d54b9SSrinivas Kandagatla { 3767dbacef05SSrinivas Kandagatla struct reg_default *reg_defaults; 3768af3d54b9SSrinivas Kandagatla struct device *dev = &pdev->dev; 3769492fe974SKrzysztof Kozlowski kernel_ulong_t flags; 3770af3d54b9SSrinivas Kandagatla struct rx_macro *rx; 3771af3d54b9SSrinivas Kandagatla void __iomem *base; 3772dbacef05SSrinivas Kandagatla int ret, def_count; 3773af3d54b9SSrinivas Kandagatla 3774492fe974SKrzysztof Kozlowski flags = (kernel_ulong_t)device_get_match_data(dev); 3775492fe974SKrzysztof Kozlowski 3776af3d54b9SSrinivas Kandagatla rx = devm_kzalloc(dev, sizeof(*rx), GFP_KERNEL); 3777af3d54b9SSrinivas Kandagatla if (!rx) 3778af3d54b9SSrinivas Kandagatla return -ENOMEM; 3779af3d54b9SSrinivas Kandagatla 378043b647d9SSrinivas Kandagatla rx->macro = devm_clk_get_optional(dev, "macro"); 378143b647d9SSrinivas Kandagatla if (IS_ERR(rx->macro)) 3782f54e3474SBjorn Andersson return dev_err_probe(dev, PTR_ERR(rx->macro), "unable to get macro clock\n"); 3783af3d54b9SSrinivas Kandagatla 378443b647d9SSrinivas Kandagatla rx->dcodec = devm_clk_get_optional(dev, "dcodec"); 378543b647d9SSrinivas Kandagatla if (IS_ERR(rx->dcodec)) 3786f54e3474SBjorn Andersson return dev_err_probe(dev, PTR_ERR(rx->dcodec), "unable to get dcodec clock\n"); 378743b647d9SSrinivas Kandagatla 378843b647d9SSrinivas Kandagatla rx->mclk = devm_clk_get(dev, "mclk"); 378943b647d9SSrinivas Kandagatla if (IS_ERR(rx->mclk)) 3790f54e3474SBjorn Andersson return dev_err_probe(dev, PTR_ERR(rx->mclk), "unable to get mclk clock\n"); 379143b647d9SSrinivas Kandagatla 3792492fe974SKrzysztof Kozlowski if (flags & LPASS_MACRO_FLAG_HAS_NPL_CLOCK) { 379343b647d9SSrinivas Kandagatla rx->npl = devm_clk_get(dev, "npl"); 379443b647d9SSrinivas Kandagatla if (IS_ERR(rx->npl)) 3795f54e3474SBjorn Andersson return dev_err_probe(dev, PTR_ERR(rx->npl), "unable to get npl clock\n"); 3796492fe974SKrzysztof Kozlowski } 379743b647d9SSrinivas Kandagatla 379843b647d9SSrinivas Kandagatla rx->fsgen = devm_clk_get(dev, "fsgen"); 379943b647d9SSrinivas Kandagatla if (IS_ERR(rx->fsgen)) 3800f54e3474SBjorn Andersson return dev_err_probe(dev, PTR_ERR(rx->fsgen), "unable to get fsgen clock\n"); 3801af3d54b9SSrinivas Kandagatla 38029e3d83c5SSrinivasa Rao Mandadapu rx->pds = lpass_macro_pds_init(dev); 38039e3d83c5SSrinivasa Rao Mandadapu if (IS_ERR(rx->pds)) 38049e3d83c5SSrinivasa Rao Mandadapu return PTR_ERR(rx->pds); 3805af3d54b9SSrinivas Kandagatla 3806af3d54b9SSrinivas Kandagatla base = devm_platform_ioremap_resource(pdev, 0); 3807ddfd5345SChristophe JAILLET if (IS_ERR(base)) { 3808ddfd5345SChristophe JAILLET ret = PTR_ERR(base); 3809ddfd5345SChristophe JAILLET goto err; 3810ddfd5345SChristophe JAILLET } 3811dbacef05SSrinivas Kandagatla rx->codec_version = lpass_macro_get_codec_version(); 3812dbacef05SSrinivas Kandagatla switch (rx->codec_version) { 3813dbacef05SSrinivas Kandagatla case LPASS_CODEC_VERSION_1_0: 3814dbacef05SSrinivas Kandagatla case LPASS_CODEC_VERSION_1_1: 3815dbacef05SSrinivas Kandagatla case LPASS_CODEC_VERSION_1_2: 3816dbacef05SSrinivas Kandagatla case LPASS_CODEC_VERSION_2_0: 3817903e8509SKrzysztof Kozlowski case LPASS_CODEC_VERSION_2_1: 3818dbacef05SSrinivas Kandagatla rx->rxn_reg_stride = 0x80; 3819dbacef05SSrinivas Kandagatla def_count = ARRAY_SIZE(rx_defaults) + ARRAY_SIZE(rx_pre_2_5_defaults); 3820dbacef05SSrinivas Kandagatla reg_defaults = kmalloc_array(def_count, sizeof(struct reg_default), GFP_KERNEL); 3821dbacef05SSrinivas Kandagatla if (!reg_defaults) { 3822dbacef05SSrinivas Kandagatla ret = -ENOMEM; 3823dbacef05SSrinivas Kandagatla goto err; 3824dbacef05SSrinivas Kandagatla } 3825dbacef05SSrinivas Kandagatla memcpy(®_defaults[0], rx_defaults, sizeof(rx_defaults)); 3826dbacef05SSrinivas Kandagatla memcpy(®_defaults[ARRAY_SIZE(rx_defaults)], 3827dbacef05SSrinivas Kandagatla rx_pre_2_5_defaults, sizeof(rx_pre_2_5_defaults)); 3828dbacef05SSrinivas Kandagatla break; 3829432e5074SSrinivas Kandagatla case LPASS_CODEC_VERSION_2_5: 3830432e5074SSrinivas Kandagatla case LPASS_CODEC_VERSION_2_6: 3831432e5074SSrinivas Kandagatla case LPASS_CODEC_VERSION_2_7: 3832432e5074SSrinivas Kandagatla case LPASS_CODEC_VERSION_2_8: 3833432e5074SSrinivas Kandagatla rx->rxn_reg_stride = 0xc0; 3834432e5074SSrinivas Kandagatla def_count = ARRAY_SIZE(rx_defaults) + ARRAY_SIZE(rx_2_5_defaults); 3835432e5074SSrinivas Kandagatla reg_defaults = kmalloc_array(def_count, sizeof(struct reg_default), GFP_KERNEL); 3836432e5074SSrinivas Kandagatla if (!reg_defaults) { 3837432e5074SSrinivas Kandagatla ret = -ENOMEM; 3838432e5074SSrinivas Kandagatla goto err; 3839432e5074SSrinivas Kandagatla } 3840432e5074SSrinivas Kandagatla memcpy(®_defaults[0], rx_defaults, sizeof(rx_defaults)); 3841432e5074SSrinivas Kandagatla memcpy(®_defaults[ARRAY_SIZE(rx_defaults)], 3842432e5074SSrinivas Kandagatla rx_2_5_defaults, sizeof(rx_2_5_defaults)); 3843432e5074SSrinivas Kandagatla break; 3844dbacef05SSrinivas Kandagatla default: 3845dbacef05SSrinivas Kandagatla dev_err(rx->dev, "Unsupported Codec version (%d)\n", rx->codec_version); 3846dbacef05SSrinivas Kandagatla ret = -EINVAL; 3847dbacef05SSrinivas Kandagatla goto err; 3848dbacef05SSrinivas Kandagatla } 3849dbacef05SSrinivas Kandagatla 3850dbacef05SSrinivas Kandagatla rx_regmap_config.reg_defaults = reg_defaults; 3851dbacef05SSrinivas Kandagatla rx_regmap_config.num_reg_defaults = def_count; 3852af3d54b9SSrinivas Kandagatla 3853af3d54b9SSrinivas Kandagatla rx->regmap = devm_regmap_init_mmio(dev, base, &rx_regmap_config); 3854ddfd5345SChristophe JAILLET if (IS_ERR(rx->regmap)) { 3855ddfd5345SChristophe JAILLET ret = PTR_ERR(rx->regmap); 3856dbacef05SSrinivas Kandagatla goto err_ver; 3857ddfd5345SChristophe JAILLET } 3858af3d54b9SSrinivas Kandagatla 3859af3d54b9SSrinivas Kandagatla dev_set_drvdata(dev, rx); 3860af3d54b9SSrinivas Kandagatla 3861af3d54b9SSrinivas Kandagatla rx->dev = dev; 3862af3d54b9SSrinivas Kandagatla 3863af3d54b9SSrinivas Kandagatla /* set MCLK and NPL rates */ 386443b647d9SSrinivas Kandagatla clk_set_rate(rx->mclk, MCLK_FREQ); 3865e7621434SSrinivas Kandagatla clk_set_rate(rx->npl, MCLK_FREQ); 3866af3d54b9SSrinivas Kandagatla 386743b647d9SSrinivas Kandagatla ret = clk_prepare_enable(rx->macro); 3868af3d54b9SSrinivas Kandagatla if (ret) 3869dbacef05SSrinivas Kandagatla goto err_ver; 3870af3d54b9SSrinivas Kandagatla 387143b647d9SSrinivas Kandagatla ret = clk_prepare_enable(rx->dcodec); 387243b647d9SSrinivas Kandagatla if (ret) 387343b647d9SSrinivas Kandagatla goto err_dcodec; 387443b647d9SSrinivas Kandagatla 387543b647d9SSrinivas Kandagatla ret = clk_prepare_enable(rx->mclk); 387643b647d9SSrinivas Kandagatla if (ret) 387743b647d9SSrinivas Kandagatla goto err_mclk; 387843b647d9SSrinivas Kandagatla 387943b647d9SSrinivas Kandagatla ret = clk_prepare_enable(rx->npl); 388043b647d9SSrinivas Kandagatla if (ret) 388143b647d9SSrinivas Kandagatla goto err_npl; 388243b647d9SSrinivas Kandagatla 388343b647d9SSrinivas Kandagatla ret = clk_prepare_enable(rx->fsgen); 388443b647d9SSrinivas Kandagatla if (ret) 388543b647d9SSrinivas Kandagatla goto err_fsgen; 3886af3d54b9SSrinivas Kandagatla 3887ddffe3b8SSrinivas Kandagatla /* reset swr block */ 3888ddffe3b8SSrinivas Kandagatla regmap_update_bits(rx->regmap, CDC_RX_CLK_RST_CTRL_SWR_CONTROL, 3889ddffe3b8SSrinivas Kandagatla CDC_RX_SWR_RESET_MASK, 3890ddffe3b8SSrinivas Kandagatla CDC_RX_SWR_RESET); 3891ddffe3b8SSrinivas Kandagatla 3892ddffe3b8SSrinivas Kandagatla regmap_update_bits(rx->regmap, CDC_RX_CLK_RST_CTRL_SWR_CONTROL, 3893ddffe3b8SSrinivas Kandagatla CDC_RX_SWR_CLK_EN_MASK, 1); 3894ddffe3b8SSrinivas Kandagatla 3895ddffe3b8SSrinivas Kandagatla regmap_update_bits(rx->regmap, CDC_RX_CLK_RST_CTRL_SWR_CONTROL, 3896ddffe3b8SSrinivas Kandagatla CDC_RX_SWR_RESET_MASK, 0); 3897ddffe3b8SSrinivas Kandagatla 3898af3d54b9SSrinivas Kandagatla ret = devm_snd_soc_register_component(dev, &rx_macro_component_drv, 3899af3d54b9SSrinivas Kandagatla rx_macro_dai, 3900af3d54b9SSrinivas Kandagatla ARRAY_SIZE(rx_macro_dai)); 3901af3d54b9SSrinivas Kandagatla if (ret) 390243b647d9SSrinivas Kandagatla goto err_clkout; 3903af3d54b9SSrinivas Kandagatla 3904366ff79eSSrinivas Kandagatla 3905366ff79eSSrinivas Kandagatla pm_runtime_set_autosuspend_delay(dev, 3000); 3906366ff79eSSrinivas Kandagatla pm_runtime_use_autosuspend(dev); 3907366ff79eSSrinivas Kandagatla pm_runtime_mark_last_busy(dev); 3908366ff79eSSrinivas Kandagatla pm_runtime_set_active(dev); 3909366ff79eSSrinivas Kandagatla pm_runtime_enable(dev); 3910366ff79eSSrinivas Kandagatla 39111dc34590SSrinivas Kandagatla ret = rx_macro_register_mclk_output(rx); 39121dc34590SSrinivas Kandagatla if (ret) 39131dc34590SSrinivas Kandagatla goto err_clkout; 39141dc34590SSrinivas Kandagatla 3915dbacef05SSrinivas Kandagatla kfree(reg_defaults); 391643b647d9SSrinivas Kandagatla return 0; 391743b647d9SSrinivas Kandagatla 391843b647d9SSrinivas Kandagatla err_clkout: 391943b647d9SSrinivas Kandagatla clk_disable_unprepare(rx->fsgen); 392043b647d9SSrinivas Kandagatla err_fsgen: 392143b647d9SSrinivas Kandagatla clk_disable_unprepare(rx->npl); 392243b647d9SSrinivas Kandagatla err_npl: 392343b647d9SSrinivas Kandagatla clk_disable_unprepare(rx->mclk); 392443b647d9SSrinivas Kandagatla err_mclk: 392543b647d9SSrinivas Kandagatla clk_disable_unprepare(rx->dcodec); 392643b647d9SSrinivas Kandagatla err_dcodec: 392743b647d9SSrinivas Kandagatla clk_disable_unprepare(rx->macro); 3928dbacef05SSrinivas Kandagatla err_ver: 3929dbacef05SSrinivas Kandagatla kfree(reg_defaults); 393070a5e96bSSrinivas Kandagatla err: 3931ddfd5345SChristophe JAILLET lpass_macro_pds_exit(rx->pds); 3932ddfd5345SChristophe JAILLET 3933af3d54b9SSrinivas Kandagatla return ret; 3934af3d54b9SSrinivas Kandagatla } 3935af3d54b9SSrinivas Kandagatla 39365b068772SUwe Kleine-König static void rx_macro_remove(struct platform_device *pdev) 3937af3d54b9SSrinivas Kandagatla { 3938af3d54b9SSrinivas Kandagatla struct rx_macro *rx = dev_get_drvdata(&pdev->dev); 3939af3d54b9SSrinivas Kandagatla 394043b647d9SSrinivas Kandagatla clk_disable_unprepare(rx->mclk); 394143b647d9SSrinivas Kandagatla clk_disable_unprepare(rx->npl); 394243b647d9SSrinivas Kandagatla clk_disable_unprepare(rx->fsgen); 394343b647d9SSrinivas Kandagatla clk_disable_unprepare(rx->macro); 394443b647d9SSrinivas Kandagatla clk_disable_unprepare(rx->dcodec); 394543b647d9SSrinivas Kandagatla 39469e3d83c5SSrinivasa Rao Mandadapu lpass_macro_pds_exit(rx->pds); 3947af3d54b9SSrinivas Kandagatla } 3948af3d54b9SSrinivas Kandagatla 3949af3d54b9SSrinivas Kandagatla static const struct of_device_id rx_macro_dt_match[] = { 3950492fe974SKrzysztof Kozlowski { 3951492fe974SKrzysztof Kozlowski .compatible = "qcom,sc7280-lpass-rx-macro", 3952492fe974SKrzysztof Kozlowski .data = (void *)LPASS_MACRO_FLAG_HAS_NPL_CLOCK, 3953492fe974SKrzysztof Kozlowski 3954492fe974SKrzysztof Kozlowski }, { 3955492fe974SKrzysztof Kozlowski .compatible = "qcom,sm8250-lpass-rx-macro", 3956492fe974SKrzysztof Kozlowski .data = (void *)LPASS_MACRO_FLAG_HAS_NPL_CLOCK, 3957492fe974SKrzysztof Kozlowski }, { 3958492fe974SKrzysztof Kozlowski .compatible = "qcom,sm8450-lpass-rx-macro", 3959492fe974SKrzysztof Kozlowski .data = (void *)LPASS_MACRO_FLAG_HAS_NPL_CLOCK, 3960492fe974SKrzysztof Kozlowski }, { 3961492fe974SKrzysztof Kozlowski .compatible = "qcom,sm8550-lpass-rx-macro", 3962492fe974SKrzysztof Kozlowski }, { 3963492fe974SKrzysztof Kozlowski .compatible = "qcom,sc8280xp-lpass-rx-macro", 3964492fe974SKrzysztof Kozlowski .data = (void *)LPASS_MACRO_FLAG_HAS_NPL_CLOCK, 3965492fe974SKrzysztof Kozlowski }, 3966af3d54b9SSrinivas Kandagatla { } 3967af3d54b9SSrinivas Kandagatla }; 3968d4335d05SSrinivas Kandagatla MODULE_DEVICE_TABLE(of, rx_macro_dt_match); 3969af3d54b9SSrinivas Kandagatla 3970366ff79eSSrinivas Kandagatla static int __maybe_unused rx_macro_runtime_suspend(struct device *dev) 3971366ff79eSSrinivas Kandagatla { 3972366ff79eSSrinivas Kandagatla struct rx_macro *rx = dev_get_drvdata(dev); 3973366ff79eSSrinivas Kandagatla 3974366ff79eSSrinivas Kandagatla regcache_cache_only(rx->regmap, true); 3975366ff79eSSrinivas Kandagatla regcache_mark_dirty(rx->regmap); 3976366ff79eSSrinivas Kandagatla 3977366ff79eSSrinivas Kandagatla clk_disable_unprepare(rx->fsgen); 3978a4a32034SSrinivas Kandagatla clk_disable_unprepare(rx->npl); 3979a4a32034SSrinivas Kandagatla clk_disable_unprepare(rx->mclk); 3980366ff79eSSrinivas Kandagatla 3981366ff79eSSrinivas Kandagatla return 0; 3982366ff79eSSrinivas Kandagatla } 3983366ff79eSSrinivas Kandagatla 3984366ff79eSSrinivas Kandagatla static int __maybe_unused rx_macro_runtime_resume(struct device *dev) 3985366ff79eSSrinivas Kandagatla { 3986366ff79eSSrinivas Kandagatla struct rx_macro *rx = dev_get_drvdata(dev); 3987366ff79eSSrinivas Kandagatla int ret; 3988366ff79eSSrinivas Kandagatla 3989366ff79eSSrinivas Kandagatla ret = clk_prepare_enable(rx->mclk); 3990366ff79eSSrinivas Kandagatla if (ret) { 3991366ff79eSSrinivas Kandagatla dev_err(dev, "unable to prepare mclk\n"); 3992366ff79eSSrinivas Kandagatla return ret; 3993366ff79eSSrinivas Kandagatla } 3994366ff79eSSrinivas Kandagatla 3995366ff79eSSrinivas Kandagatla ret = clk_prepare_enable(rx->npl); 3996366ff79eSSrinivas Kandagatla if (ret) { 3997366ff79eSSrinivas Kandagatla dev_err(dev, "unable to prepare mclkx2\n"); 3998366ff79eSSrinivas Kandagatla goto err_npl; 3999366ff79eSSrinivas Kandagatla } 4000366ff79eSSrinivas Kandagatla 4001366ff79eSSrinivas Kandagatla ret = clk_prepare_enable(rx->fsgen); 4002366ff79eSSrinivas Kandagatla if (ret) { 4003366ff79eSSrinivas Kandagatla dev_err(dev, "unable to prepare fsgen\n"); 4004366ff79eSSrinivas Kandagatla goto err_fsgen; 4005366ff79eSSrinivas Kandagatla } 4006366ff79eSSrinivas Kandagatla regcache_cache_only(rx->regmap, false); 4007366ff79eSSrinivas Kandagatla regcache_sync(rx->regmap); 4008366ff79eSSrinivas Kandagatla 4009366ff79eSSrinivas Kandagatla return 0; 4010366ff79eSSrinivas Kandagatla err_fsgen: 4011366ff79eSSrinivas Kandagatla clk_disable_unprepare(rx->npl); 4012366ff79eSSrinivas Kandagatla err_npl: 4013366ff79eSSrinivas Kandagatla clk_disable_unprepare(rx->mclk); 4014366ff79eSSrinivas Kandagatla 4015366ff79eSSrinivas Kandagatla return ret; 4016366ff79eSSrinivas Kandagatla } 4017366ff79eSSrinivas Kandagatla 4018366ff79eSSrinivas Kandagatla static const struct dev_pm_ops rx_macro_pm_ops = { 4019366ff79eSSrinivas Kandagatla SET_RUNTIME_PM_OPS(rx_macro_runtime_suspend, rx_macro_runtime_resume, NULL) 4020366ff79eSSrinivas Kandagatla }; 4021366ff79eSSrinivas Kandagatla 4022af3d54b9SSrinivas Kandagatla static struct platform_driver rx_macro_driver = { 4023af3d54b9SSrinivas Kandagatla .driver = { 4024af3d54b9SSrinivas Kandagatla .name = "rx_macro", 4025af3d54b9SSrinivas Kandagatla .of_match_table = rx_macro_dt_match, 4026af3d54b9SSrinivas Kandagatla .suppress_bind_attrs = true, 4027366ff79eSSrinivas Kandagatla .pm = &rx_macro_pm_ops, 4028af3d54b9SSrinivas Kandagatla }, 4029af3d54b9SSrinivas Kandagatla .probe = rx_macro_probe, 40305b068772SUwe Kleine-König .remove_new = rx_macro_remove, 4031af3d54b9SSrinivas Kandagatla }; 4032af3d54b9SSrinivas Kandagatla 4033af3d54b9SSrinivas Kandagatla module_platform_driver(rx_macro_driver); 4034af3d54b9SSrinivas Kandagatla 4035af3d54b9SSrinivas Kandagatla MODULE_DESCRIPTION("RX macro driver"); 4036af3d54b9SSrinivas Kandagatla MODULE_LICENSE("GPL"); 4037