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 18*9e3d83c5SSrinivasa Rao Mandadapu #include "lpass-macro-common.h" 19*9e3d83c5SSrinivasa 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) 161af3d54b9SSrinivas Kandagatla #define CDC_RX_RXn_RX_PATH_CTL(n) (0x0400 + 0x80 * 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) 169af3d54b9SSrinivas Kandagatla #define CDC_RX_RXn_RX_PATH_CFG0(n) (0x0404 + 0x80 * 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) 176af3d54b9SSrinivas Kandagatla #define CDC_RX_RXn_RX_PATH_CFG1(n) (0x0408 + 0x80 * 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) 180af3d54b9SSrinivas Kandagatla #define CDC_RX_RXn_RX_PATH_CFG2(n) (0x040C + 0x80 * n) 181af3d54b9SSrinivas Kandagatla #define CDC_RX_RXn_HPF_CUT_FREQ_MASK GENMASK(1, 0) 182af3d54b9SSrinivas Kandagatla #define CDC_RX_RX0_RX_PATH_CFG2 (0x040C) 183af3d54b9SSrinivas Kandagatla #define CDC_RX_RXn_RX_PATH_CFG3(n) (0x0410 + 0x80 * 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 187af3d54b9SSrinivas Kandagatla #define CDC_RX_RXn_RX_VOL_CTL(n) (0x0414 + 0x80 * n) 188af3d54b9SSrinivas Kandagatla #define CDC_RX_RX0_RX_VOL_CTL (0x0414) 189af3d54b9SSrinivas Kandagatla #define CDC_RX_RXn_RX_PATH_MIX_CTL(n) (0x0418 + 0x80 * 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) 196af3d54b9SSrinivas Kandagatla #define CDC_RX_RXn_RX_VOL_MIX_CTL(n) (0x0420 + 0x80 * 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) 201af3d54b9SSrinivas Kandagatla #define CDC_RX_RX0_RX_PATH_SEC4 (0x0430) 202af3d54b9SSrinivas Kandagatla #define CDC_RX_RX0_RX_PATH_SEC7 (0x0434) 203af3d54b9SSrinivas Kandagatla #define CDC_RX_DSM_OUT_DELAY_SEL_MASK GENMASK(2, 0) 204af3d54b9SSrinivas Kandagatla #define CDC_RX_DSM_OUT_DELAY_TWO_SAMPLE 0x2 205af3d54b9SSrinivas Kandagatla #define CDC_RX_RX0_RX_PATH_MIX_SEC0 (0x0438) 206af3d54b9SSrinivas Kandagatla #define CDC_RX_RX0_RX_PATH_MIX_SEC1 (0x043C) 207af3d54b9SSrinivas Kandagatla #define CDC_RX_RXn_RX_PATH_DSM_CTL(n) (0x0440 + 0x80 * n) 208af3d54b9SSrinivas Kandagatla #define CDC_RX_RXn_DSM_CLK_EN_MASK BIT(0) 209af3d54b9SSrinivas Kandagatla #define CDC_RX_RX0_RX_PATH_DSM_CTL (0x0440) 210af3d54b9SSrinivas Kandagatla #define CDC_RX_RX0_RX_PATH_DSM_DATA1 (0x0444) 211af3d54b9SSrinivas Kandagatla #define CDC_RX_RX0_RX_PATH_DSM_DATA2 (0x0448) 212af3d54b9SSrinivas Kandagatla #define CDC_RX_RX0_RX_PATH_DSM_DATA3 (0x044C) 213af3d54b9SSrinivas Kandagatla #define CDC_RX_RX0_RX_PATH_DSM_DATA4 (0x0450) 214af3d54b9SSrinivas Kandagatla #define CDC_RX_RX0_RX_PATH_DSM_DATA5 (0x0454) 215af3d54b9SSrinivas Kandagatla #define CDC_RX_RX0_RX_PATH_DSM_DATA6 (0x0458) 216af3d54b9SSrinivas Kandagatla #define CDC_RX_RX1_RX_PATH_CTL (0x0480) 217af3d54b9SSrinivas Kandagatla #define CDC_RX_RX1_RX_PATH_CFG0 (0x0484) 218af3d54b9SSrinivas Kandagatla #define CDC_RX_RX1_RX_PATH_CFG1 (0x0488) 219af3d54b9SSrinivas Kandagatla #define CDC_RX_RX1_RX_PATH_CFG2 (0x048C) 220af3d54b9SSrinivas Kandagatla #define CDC_RX_RX1_RX_PATH_CFG3 (0x0490) 221af3d54b9SSrinivas Kandagatla #define CDC_RX_RX1_RX_VOL_CTL (0x0494) 222af3d54b9SSrinivas Kandagatla #define CDC_RX_RX1_RX_PATH_MIX_CTL (0x0498) 223af3d54b9SSrinivas Kandagatla #define CDC_RX_RX1_RX_PATH_MIX_CFG (0x049C) 224af3d54b9SSrinivas Kandagatla #define CDC_RX_RX1_RX_VOL_MIX_CTL (0x04A0) 225af3d54b9SSrinivas Kandagatla #define CDC_RX_RX1_RX_PATH_SEC1 (0x04A4) 226af3d54b9SSrinivas Kandagatla #define CDC_RX_RX1_RX_PATH_SEC2 (0x04A8) 227af3d54b9SSrinivas Kandagatla #define CDC_RX_RX1_RX_PATH_SEC3 (0x04AC) 228af3d54b9SSrinivas Kandagatla #define CDC_RX_RXn_HD2_ALPHA_MASK GENMASK(5, 2) 229af3d54b9SSrinivas Kandagatla #define CDC_RX_RX1_RX_PATH_SEC4 (0x04B0) 230af3d54b9SSrinivas Kandagatla #define CDC_RX_RX1_RX_PATH_SEC7 (0x04B4) 231af3d54b9SSrinivas Kandagatla #define CDC_RX_RX1_RX_PATH_MIX_SEC0 (0x04B8) 232af3d54b9SSrinivas Kandagatla #define CDC_RX_RX1_RX_PATH_MIX_SEC1 (0x04BC) 233af3d54b9SSrinivas Kandagatla #define CDC_RX_RX1_RX_PATH_DSM_CTL (0x04C0) 234af3d54b9SSrinivas Kandagatla #define CDC_RX_RX1_RX_PATH_DSM_DATA1 (0x04C4) 235af3d54b9SSrinivas Kandagatla #define CDC_RX_RX1_RX_PATH_DSM_DATA2 (0x04C8) 236af3d54b9SSrinivas Kandagatla #define CDC_RX_RX1_RX_PATH_DSM_DATA3 (0x04CC) 237af3d54b9SSrinivas Kandagatla #define CDC_RX_RX1_RX_PATH_DSM_DATA4 (0x04D0) 238af3d54b9SSrinivas Kandagatla #define CDC_RX_RX1_RX_PATH_DSM_DATA5 (0x04D4) 239af3d54b9SSrinivas Kandagatla #define CDC_RX_RX1_RX_PATH_DSM_DATA6 (0x04D8) 240af3d54b9SSrinivas Kandagatla #define CDC_RX_RX2_RX_PATH_CTL (0x0500) 241af3d54b9SSrinivas Kandagatla #define CDC_RX_RX2_RX_PATH_CFG0 (0x0504) 242af3d54b9SSrinivas Kandagatla #define CDC_RX_RX2_CLSH_EN_MASK BIT(4) 243af3d54b9SSrinivas Kandagatla #define CDC_RX_RX2_DLY_Z_EN_MASK BIT(3) 244af3d54b9SSrinivas Kandagatla #define CDC_RX_RX2_RX_PATH_CFG1 (0x0508) 245af3d54b9SSrinivas Kandagatla #define CDC_RX_RX2_RX_PATH_CFG2 (0x050C) 246af3d54b9SSrinivas Kandagatla #define CDC_RX_RX2_RX_PATH_CFG3 (0x0510) 247af3d54b9SSrinivas Kandagatla #define CDC_RX_RX2_RX_VOL_CTL (0x0514) 248af3d54b9SSrinivas Kandagatla #define CDC_RX_RX2_RX_PATH_MIX_CTL (0x0518) 249af3d54b9SSrinivas Kandagatla #define CDC_RX_RX2_RX_PATH_MIX_CFG (0x051C) 250af3d54b9SSrinivas Kandagatla #define CDC_RX_RX2_RX_VOL_MIX_CTL (0x0520) 251af3d54b9SSrinivas Kandagatla #define CDC_RX_RX2_RX_PATH_SEC0 (0x0524) 252af3d54b9SSrinivas Kandagatla #define CDC_RX_RX2_RX_PATH_SEC1 (0x0528) 253af3d54b9SSrinivas Kandagatla #define CDC_RX_RX2_RX_PATH_SEC2 (0x052C) 254af3d54b9SSrinivas Kandagatla #define CDC_RX_RX2_RX_PATH_SEC3 (0x0530) 255af3d54b9SSrinivas Kandagatla #define CDC_RX_RX2_RX_PATH_SEC4 (0x0534) 256af3d54b9SSrinivas Kandagatla #define CDC_RX_RX2_RX_PATH_SEC5 (0x0538) 257af3d54b9SSrinivas Kandagatla #define CDC_RX_RX2_RX_PATH_SEC6 (0x053C) 258af3d54b9SSrinivas Kandagatla #define CDC_RX_RX2_RX_PATH_SEC7 (0x0540) 259af3d54b9SSrinivas Kandagatla #define CDC_RX_RX2_RX_PATH_MIX_SEC0 (0x0544) 260af3d54b9SSrinivas Kandagatla #define CDC_RX_RX2_RX_PATH_MIX_SEC1 (0x0548) 261af3d54b9SSrinivas Kandagatla #define CDC_RX_RX2_RX_PATH_DSM_CTL (0x054C) 262af3d54b9SSrinivas Kandagatla #define CDC_RX_IDLE_DETECT_PATH_CTL (0x0780) 263af3d54b9SSrinivas Kandagatla #define CDC_RX_IDLE_DETECT_CFG0 (0x0784) 264af3d54b9SSrinivas Kandagatla #define CDC_RX_IDLE_DETECT_CFG1 (0x0788) 265af3d54b9SSrinivas Kandagatla #define CDC_RX_IDLE_DETECT_CFG2 (0x078C) 266af3d54b9SSrinivas Kandagatla #define CDC_RX_IDLE_DETECT_CFG3 (0x0790) 267af3d54b9SSrinivas Kandagatla #define CDC_RX_COMPANDERn_CTL0(n) (0x0800 + 0x40 * n) 268af3d54b9SSrinivas Kandagatla #define CDC_RX_COMPANDERn_CLK_EN_MASK BIT(0) 269af3d54b9SSrinivas Kandagatla #define CDC_RX_COMPANDERn_SOFT_RST_MASK BIT(1) 270af3d54b9SSrinivas Kandagatla #define CDC_RX_COMPANDERn_HALT_MASK BIT(2) 271af3d54b9SSrinivas Kandagatla #define CDC_RX_COMPANDER0_CTL0 (0x0800) 272af3d54b9SSrinivas Kandagatla #define CDC_RX_COMPANDER0_CTL1 (0x0804) 273af3d54b9SSrinivas Kandagatla #define CDC_RX_COMPANDER0_CTL2 (0x0808) 274af3d54b9SSrinivas Kandagatla #define CDC_RX_COMPANDER0_CTL3 (0x080C) 275af3d54b9SSrinivas Kandagatla #define CDC_RX_COMPANDER0_CTL4 (0x0810) 276af3d54b9SSrinivas Kandagatla #define CDC_RX_COMPANDER0_CTL5 (0x0814) 277af3d54b9SSrinivas Kandagatla #define CDC_RX_COMPANDER0_CTL6 (0x0818) 278af3d54b9SSrinivas Kandagatla #define CDC_RX_COMPANDER0_CTL7 (0x081C) 279af3d54b9SSrinivas Kandagatla #define CDC_RX_COMPANDER1_CTL0 (0x0840) 280af3d54b9SSrinivas Kandagatla #define CDC_RX_COMPANDER1_CTL1 (0x0844) 281af3d54b9SSrinivas Kandagatla #define CDC_RX_COMPANDER1_CTL2 (0x0848) 282af3d54b9SSrinivas Kandagatla #define CDC_RX_COMPANDER1_CTL3 (0x084C) 283af3d54b9SSrinivas Kandagatla #define CDC_RX_COMPANDER1_CTL4 (0x0850) 284af3d54b9SSrinivas Kandagatla #define CDC_RX_COMPANDER1_CTL5 (0x0854) 285af3d54b9SSrinivas Kandagatla #define CDC_RX_COMPANDER1_CTL6 (0x0858) 286af3d54b9SSrinivas Kandagatla #define CDC_RX_COMPANDER1_CTL7 (0x085C) 287af3d54b9SSrinivas Kandagatla #define CDC_RX_COMPANDER1_HPH_LOW_PWR_MODE_MASK BIT(5) 288af3d54b9SSrinivas Kandagatla #define CDC_RX_SIDETONE_IIR0_IIR_PATH_CTL (0x0A00) 289af3d54b9SSrinivas Kandagatla #define CDC_RX_SIDETONE_IIR0_IIR_GAIN_B1_CTL (0x0A04) 290af3d54b9SSrinivas Kandagatla #define CDC_RX_SIDETONE_IIR0_IIR_GAIN_B2_CTL (0x0A08) 291af3d54b9SSrinivas Kandagatla #define CDC_RX_SIDETONE_IIR0_IIR_GAIN_B3_CTL (0x0A0C) 292af3d54b9SSrinivas Kandagatla #define CDC_RX_SIDETONE_IIR0_IIR_GAIN_B4_CTL (0x0A10) 293af3d54b9SSrinivas Kandagatla #define CDC_RX_SIDETONE_IIR0_IIR_GAIN_B5_CTL (0x0A14) 294af3d54b9SSrinivas Kandagatla #define CDC_RX_SIDETONE_IIR0_IIR_GAIN_B6_CTL (0x0A18) 295af3d54b9SSrinivas Kandagatla #define CDC_RX_SIDETONE_IIR0_IIR_GAIN_B7_CTL (0x0A1C) 296af3d54b9SSrinivas Kandagatla #define CDC_RX_SIDETONE_IIR0_IIR_GAIN_B8_CTL (0x0A20) 297af3d54b9SSrinivas Kandagatla #define CDC_RX_SIDETONE_IIR0_IIR_CTL (0x0A24) 298af3d54b9SSrinivas Kandagatla #define CDC_RX_SIDETONE_IIR0_IIR_GAIN_TIMER_CTL (0x0A28) 299af3d54b9SSrinivas Kandagatla #define CDC_RX_SIDETONE_IIR0_IIR_COEF_B1_CTL (0x0A2C) 300af3d54b9SSrinivas Kandagatla #define CDC_RX_SIDETONE_IIR0_IIR_COEF_B2_CTL (0x0A30) 301af3d54b9SSrinivas Kandagatla #define CDC_RX_SIDETONE_IIR1_IIR_PATH_CTL (0x0A80) 302af3d54b9SSrinivas Kandagatla #define CDC_RX_SIDETONE_IIR1_IIR_GAIN_B1_CTL (0x0A84) 303af3d54b9SSrinivas Kandagatla #define CDC_RX_SIDETONE_IIR1_IIR_GAIN_B2_CTL (0x0A88) 304af3d54b9SSrinivas Kandagatla #define CDC_RX_SIDETONE_IIR1_IIR_GAIN_B3_CTL (0x0A8C) 305af3d54b9SSrinivas Kandagatla #define CDC_RX_SIDETONE_IIR1_IIR_GAIN_B4_CTL (0x0A90) 306af3d54b9SSrinivas Kandagatla #define CDC_RX_SIDETONE_IIR1_IIR_GAIN_B5_CTL (0x0A94) 307af3d54b9SSrinivas Kandagatla #define CDC_RX_SIDETONE_IIR1_IIR_GAIN_B6_CTL (0x0A98) 308af3d54b9SSrinivas Kandagatla #define CDC_RX_SIDETONE_IIR1_IIR_GAIN_B7_CTL (0x0A9C) 309af3d54b9SSrinivas Kandagatla #define CDC_RX_SIDETONE_IIR1_IIR_GAIN_B8_CTL (0x0AA0) 310af3d54b9SSrinivas Kandagatla #define CDC_RX_SIDETONE_IIR1_IIR_CTL (0x0AA4) 311af3d54b9SSrinivas Kandagatla #define CDC_RX_SIDETONE_IIR1_IIR_GAIN_TIMER_CTL (0x0AA8) 312af3d54b9SSrinivas Kandagatla #define CDC_RX_SIDETONE_IIR1_IIR_COEF_B1_CTL (0x0AAC) 313af3d54b9SSrinivas Kandagatla #define CDC_RX_SIDETONE_IIR1_IIR_COEF_B2_CTL (0x0AB0) 314af3d54b9SSrinivas Kandagatla #define CDC_RX_IIR_INP_MUX_IIR0_MIX_CFG0 (0x0B00) 315af3d54b9SSrinivas Kandagatla #define CDC_RX_IIR_INP_MUX_IIR0_MIX_CFG1 (0x0B04) 316af3d54b9SSrinivas Kandagatla #define CDC_RX_IIR_INP_MUX_IIR0_MIX_CFG2 (0x0B08) 317af3d54b9SSrinivas Kandagatla #define CDC_RX_IIR_INP_MUX_IIR0_MIX_CFG3 (0x0B0C) 318af3d54b9SSrinivas Kandagatla #define CDC_RX_IIR_INP_MUX_IIR1_MIX_CFG0 (0x0B10) 319af3d54b9SSrinivas Kandagatla #define CDC_RX_IIR_INP_MUX_IIR1_MIX_CFG1 (0x0B14) 320af3d54b9SSrinivas Kandagatla #define CDC_RX_IIR_INP_MUX_IIR1_MIX_CFG2 (0x0B18) 321af3d54b9SSrinivas Kandagatla #define CDC_RX_IIR_INP_MUX_IIR1_MIX_CFG3 (0x0B1C) 322af3d54b9SSrinivas Kandagatla #define CDC_RX_SIDETONE_SRC0_ST_SRC_PATH_CTL (0x0B40) 323af3d54b9SSrinivas Kandagatla #define CDC_RX_SIDETONE_SRC0_ST_SRC_PATH_CFG1 (0x0B44) 324af3d54b9SSrinivas Kandagatla #define CDC_RX_SIDETONE_SRC1_ST_SRC_PATH_CTL (0x0B50) 325af3d54b9SSrinivas Kandagatla #define CDC_RX_SIDETONE_SRC1_ST_SRC_PATH_CFG1 (0x0B54) 326af3d54b9SSrinivas Kandagatla #define CDC_RX_EC_REF_HQ0_EC_REF_HQ_PATH_CTL (0x0C00) 327af3d54b9SSrinivas Kandagatla #define CDC_RX_EC_REF_HQ0_EC_REF_HQ_CFG0 (0x0C04) 328af3d54b9SSrinivas Kandagatla #define CDC_RX_EC_REF_HQ1_EC_REF_HQ_PATH_CTL (0x0C40) 329af3d54b9SSrinivas Kandagatla #define CDC_RX_EC_REF_HQ1_EC_REF_HQ_CFG0 (0x0C44) 330af3d54b9SSrinivas Kandagatla #define CDC_RX_EC_REF_HQ2_EC_REF_HQ_PATH_CTL (0x0C80) 331af3d54b9SSrinivas Kandagatla #define CDC_RX_EC_REF_HQ2_EC_REF_HQ_CFG0 (0x0C84) 332af3d54b9SSrinivas Kandagatla #define CDC_RX_EC_ASRC0_CLK_RST_CTL (0x0D00) 333af3d54b9SSrinivas Kandagatla #define CDC_RX_EC_ASRC0_CTL0 (0x0D04) 334af3d54b9SSrinivas Kandagatla #define CDC_RX_EC_ASRC0_CTL1 (0x0D08) 335af3d54b9SSrinivas Kandagatla #define CDC_RX_EC_ASRC0_FIFO_CTL (0x0D0C) 336af3d54b9SSrinivas Kandagatla #define CDC_RX_EC_ASRC0_STATUS_FMIN_CNTR_LSB (0x0D10) 337af3d54b9SSrinivas Kandagatla #define CDC_RX_EC_ASRC0_STATUS_FMIN_CNTR_MSB (0x0D14) 338af3d54b9SSrinivas Kandagatla #define CDC_RX_EC_ASRC0_STATUS_FMAX_CNTR_LSB (0x0D18) 339af3d54b9SSrinivas Kandagatla #define CDC_RX_EC_ASRC0_STATUS_FMAX_CNTR_MSB (0x0D1C) 340af3d54b9SSrinivas Kandagatla #define CDC_RX_EC_ASRC0_STATUS_FIFO (0x0D20) 341af3d54b9SSrinivas Kandagatla #define CDC_RX_EC_ASRC1_CLK_RST_CTL (0x0D40) 342af3d54b9SSrinivas Kandagatla #define CDC_RX_EC_ASRC1_CTL0 (0x0D44) 343af3d54b9SSrinivas Kandagatla #define CDC_RX_EC_ASRC1_CTL1 (0x0D48) 344af3d54b9SSrinivas Kandagatla #define CDC_RX_EC_ASRC1_FIFO_CTL (0x0D4C) 345af3d54b9SSrinivas Kandagatla #define CDC_RX_EC_ASRC1_STATUS_FMIN_CNTR_LSB (0x0D50) 346af3d54b9SSrinivas Kandagatla #define CDC_RX_EC_ASRC1_STATUS_FMIN_CNTR_MSB (0x0D54) 347af3d54b9SSrinivas Kandagatla #define CDC_RX_EC_ASRC1_STATUS_FMAX_CNTR_LSB (0x0D58) 348af3d54b9SSrinivas Kandagatla #define CDC_RX_EC_ASRC1_STATUS_FMAX_CNTR_MSB (0x0D5C) 349af3d54b9SSrinivas Kandagatla #define CDC_RX_EC_ASRC1_STATUS_FIFO (0x0D60) 350af3d54b9SSrinivas Kandagatla #define CDC_RX_EC_ASRC2_CLK_RST_CTL (0x0D80) 351af3d54b9SSrinivas Kandagatla #define CDC_RX_EC_ASRC2_CTL0 (0x0D84) 352af3d54b9SSrinivas Kandagatla #define CDC_RX_EC_ASRC2_CTL1 (0x0D88) 353af3d54b9SSrinivas Kandagatla #define CDC_RX_EC_ASRC2_FIFO_CTL (0x0D8C) 354af3d54b9SSrinivas Kandagatla #define CDC_RX_EC_ASRC2_STATUS_FMIN_CNTR_LSB (0x0D90) 355af3d54b9SSrinivas Kandagatla #define CDC_RX_EC_ASRC2_STATUS_FMIN_CNTR_MSB (0x0D94) 356af3d54b9SSrinivas Kandagatla #define CDC_RX_EC_ASRC2_STATUS_FMAX_CNTR_LSB (0x0D98) 357af3d54b9SSrinivas Kandagatla #define CDC_RX_EC_ASRC2_STATUS_FMAX_CNTR_MSB (0x0D9C) 358af3d54b9SSrinivas Kandagatla #define CDC_RX_EC_ASRC2_STATUS_FIFO (0x0DA0) 359af3d54b9SSrinivas Kandagatla #define CDC_RX_DSD0_PATH_CTL (0x0F00) 360af3d54b9SSrinivas Kandagatla #define CDC_RX_DSD0_CFG0 (0x0F04) 361af3d54b9SSrinivas Kandagatla #define CDC_RX_DSD0_CFG1 (0x0F08) 362af3d54b9SSrinivas Kandagatla #define CDC_RX_DSD0_CFG2 (0x0F0C) 363af3d54b9SSrinivas Kandagatla #define CDC_RX_DSD1_PATH_CTL (0x0F80) 364af3d54b9SSrinivas Kandagatla #define CDC_RX_DSD1_CFG0 (0x0F84) 365af3d54b9SSrinivas Kandagatla #define CDC_RX_DSD1_CFG1 (0x0F88) 366af3d54b9SSrinivas Kandagatla #define CDC_RX_DSD1_CFG2 (0x0F8C) 367af3d54b9SSrinivas Kandagatla #define RX_MAX_OFFSET (0x0F8C) 368af3d54b9SSrinivas Kandagatla 369af3d54b9SSrinivas Kandagatla #define MCLK_FREQ 9600000 370af3d54b9SSrinivas Kandagatla 371af3d54b9SSrinivas Kandagatla #define RX_MACRO_RATES (SNDRV_PCM_RATE_8000 | SNDRV_PCM_RATE_16000 |\ 372af3d54b9SSrinivas Kandagatla SNDRV_PCM_RATE_32000 | SNDRV_PCM_RATE_48000 |\ 373af3d54b9SSrinivas Kandagatla SNDRV_PCM_RATE_96000 | SNDRV_PCM_RATE_192000 |\ 374af3d54b9SSrinivas Kandagatla SNDRV_PCM_RATE_384000) 375af3d54b9SSrinivas Kandagatla /* Fractional Rates */ 376af3d54b9SSrinivas Kandagatla #define RX_MACRO_FRAC_RATES (SNDRV_PCM_RATE_44100 | SNDRV_PCM_RATE_88200 |\ 377af3d54b9SSrinivas Kandagatla SNDRV_PCM_RATE_176400 | SNDRV_PCM_RATE_352800) 378af3d54b9SSrinivas Kandagatla 379af3d54b9SSrinivas Kandagatla #define RX_MACRO_FORMATS (SNDRV_PCM_FMTBIT_S16_LE |\ 380af3d54b9SSrinivas Kandagatla SNDRV_PCM_FMTBIT_S24_LE |\ 381af3d54b9SSrinivas Kandagatla SNDRV_PCM_FMTBIT_S24_3LE | SNDRV_PCM_FMTBIT_S32_LE) 382af3d54b9SSrinivas Kandagatla 383af3d54b9SSrinivas Kandagatla #define RX_MACRO_ECHO_RATES (SNDRV_PCM_RATE_8000 | SNDRV_PCM_RATE_16000 |\ 384af3d54b9SSrinivas Kandagatla SNDRV_PCM_RATE_48000) 385af3d54b9SSrinivas Kandagatla #define RX_MACRO_ECHO_FORMATS (SNDRV_PCM_FMTBIT_S16_LE |\ 386af3d54b9SSrinivas Kandagatla SNDRV_PCM_FMTBIT_S24_LE |\ 387af3d54b9SSrinivas Kandagatla SNDRV_PCM_FMTBIT_S24_3LE) 388af3d54b9SSrinivas Kandagatla 389af3d54b9SSrinivas Kandagatla #define RX_MACRO_MAX_DMA_CH_PER_PORT 2 390af3d54b9SSrinivas Kandagatla 391af3d54b9SSrinivas Kandagatla #define RX_MACRO_EC_MIX_TX0_MASK 0xf0 392af3d54b9SSrinivas Kandagatla #define RX_MACRO_EC_MIX_TX1_MASK 0x0f 393af3d54b9SSrinivas Kandagatla #define RX_MACRO_EC_MIX_TX2_MASK 0x0f 394af3d54b9SSrinivas Kandagatla 395af3d54b9SSrinivas Kandagatla #define COMP_MAX_COEFF 25 396af3d54b9SSrinivas Kandagatla #define RX_NUM_CLKS_MAX 5 397af3d54b9SSrinivas Kandagatla 398af3d54b9SSrinivas Kandagatla struct comp_coeff_val { 399af3d54b9SSrinivas Kandagatla u8 lsb; 400af3d54b9SSrinivas Kandagatla u8 msb; 401af3d54b9SSrinivas Kandagatla }; 402af3d54b9SSrinivas Kandagatla 403af3d54b9SSrinivas Kandagatla enum { 404af3d54b9SSrinivas Kandagatla HPH_ULP, 405af3d54b9SSrinivas Kandagatla HPH_LOHIFI, 406af3d54b9SSrinivas Kandagatla HPH_MODE_MAX, 407af3d54b9SSrinivas Kandagatla }; 408af3d54b9SSrinivas Kandagatla 409af3d54b9SSrinivas Kandagatla static const struct comp_coeff_val comp_coeff_table[HPH_MODE_MAX][COMP_MAX_COEFF] = { 410af3d54b9SSrinivas Kandagatla { 411af3d54b9SSrinivas Kandagatla {0x40, 0x00}, 412af3d54b9SSrinivas Kandagatla {0x4C, 0x00}, 413af3d54b9SSrinivas Kandagatla {0x5A, 0x00}, 414af3d54b9SSrinivas Kandagatla {0x6B, 0x00}, 415af3d54b9SSrinivas Kandagatla {0x7F, 0x00}, 416af3d54b9SSrinivas Kandagatla {0x97, 0x00}, 417af3d54b9SSrinivas Kandagatla {0xB3, 0x00}, 418af3d54b9SSrinivas Kandagatla {0xD5, 0x00}, 419af3d54b9SSrinivas Kandagatla {0xFD, 0x00}, 420af3d54b9SSrinivas Kandagatla {0x2D, 0x01}, 421af3d54b9SSrinivas Kandagatla {0x66, 0x01}, 422af3d54b9SSrinivas Kandagatla {0xA7, 0x01}, 423af3d54b9SSrinivas Kandagatla {0xF8, 0x01}, 424af3d54b9SSrinivas Kandagatla {0x57, 0x02}, 425af3d54b9SSrinivas Kandagatla {0xC7, 0x02}, 426af3d54b9SSrinivas Kandagatla {0x4B, 0x03}, 427af3d54b9SSrinivas Kandagatla {0xE9, 0x03}, 428af3d54b9SSrinivas Kandagatla {0xA3, 0x04}, 429af3d54b9SSrinivas Kandagatla {0x7D, 0x05}, 430af3d54b9SSrinivas Kandagatla {0x90, 0x06}, 431af3d54b9SSrinivas Kandagatla {0xD1, 0x07}, 432af3d54b9SSrinivas Kandagatla {0x49, 0x09}, 433af3d54b9SSrinivas Kandagatla {0x00, 0x0B}, 434af3d54b9SSrinivas Kandagatla {0x01, 0x0D}, 435af3d54b9SSrinivas Kandagatla {0x59, 0x0F}, 436af3d54b9SSrinivas Kandagatla }, 437af3d54b9SSrinivas Kandagatla { 438af3d54b9SSrinivas Kandagatla {0x40, 0x00}, 439af3d54b9SSrinivas Kandagatla {0x4C, 0x00}, 440af3d54b9SSrinivas Kandagatla {0x5A, 0x00}, 441af3d54b9SSrinivas Kandagatla {0x6B, 0x00}, 442af3d54b9SSrinivas Kandagatla {0x80, 0x00}, 443af3d54b9SSrinivas Kandagatla {0x98, 0x00}, 444af3d54b9SSrinivas Kandagatla {0xB4, 0x00}, 445af3d54b9SSrinivas Kandagatla {0xD5, 0x00}, 446af3d54b9SSrinivas Kandagatla {0xFE, 0x00}, 447af3d54b9SSrinivas Kandagatla {0x2E, 0x01}, 448af3d54b9SSrinivas Kandagatla {0x66, 0x01}, 449af3d54b9SSrinivas Kandagatla {0xA9, 0x01}, 450af3d54b9SSrinivas Kandagatla {0xF8, 0x01}, 451af3d54b9SSrinivas Kandagatla {0x56, 0x02}, 452af3d54b9SSrinivas Kandagatla {0xC4, 0x02}, 453af3d54b9SSrinivas Kandagatla {0x4F, 0x03}, 454af3d54b9SSrinivas Kandagatla {0xF0, 0x03}, 455af3d54b9SSrinivas Kandagatla {0xAE, 0x04}, 456af3d54b9SSrinivas Kandagatla {0x8B, 0x05}, 457af3d54b9SSrinivas Kandagatla {0x8E, 0x06}, 458af3d54b9SSrinivas Kandagatla {0xBC, 0x07}, 459af3d54b9SSrinivas Kandagatla {0x56, 0x09}, 460af3d54b9SSrinivas Kandagatla {0x0F, 0x0B}, 461af3d54b9SSrinivas Kandagatla {0x13, 0x0D}, 462af3d54b9SSrinivas Kandagatla {0x6F, 0x0F}, 463af3d54b9SSrinivas Kandagatla }, 464af3d54b9SSrinivas Kandagatla }; 465af3d54b9SSrinivas Kandagatla 466af3d54b9SSrinivas Kandagatla struct rx_macro_reg_mask_val { 467af3d54b9SSrinivas Kandagatla u16 reg; 468af3d54b9SSrinivas Kandagatla u8 mask; 469af3d54b9SSrinivas Kandagatla u8 val; 470af3d54b9SSrinivas Kandagatla }; 471af3d54b9SSrinivas Kandagatla 472af3d54b9SSrinivas Kandagatla enum { 473af3d54b9SSrinivas Kandagatla INTERP_HPHL, 474af3d54b9SSrinivas Kandagatla INTERP_HPHR, 475af3d54b9SSrinivas Kandagatla INTERP_AUX, 476af3d54b9SSrinivas Kandagatla INTERP_MAX 477af3d54b9SSrinivas Kandagatla }; 478af3d54b9SSrinivas Kandagatla 479af3d54b9SSrinivas Kandagatla enum { 480af3d54b9SSrinivas Kandagatla RX_MACRO_RX0, 481af3d54b9SSrinivas Kandagatla RX_MACRO_RX1, 482af3d54b9SSrinivas Kandagatla RX_MACRO_RX2, 483af3d54b9SSrinivas Kandagatla RX_MACRO_RX3, 484af3d54b9SSrinivas Kandagatla RX_MACRO_RX4, 485af3d54b9SSrinivas Kandagatla RX_MACRO_RX5, 486af3d54b9SSrinivas Kandagatla RX_MACRO_PORTS_MAX 487af3d54b9SSrinivas Kandagatla }; 488af3d54b9SSrinivas Kandagatla 489af3d54b9SSrinivas Kandagatla enum { 490af3d54b9SSrinivas Kandagatla RX_MACRO_COMP1, /* HPH_L */ 491af3d54b9SSrinivas Kandagatla RX_MACRO_COMP2, /* HPH_R */ 492af3d54b9SSrinivas Kandagatla RX_MACRO_COMP_MAX 493af3d54b9SSrinivas Kandagatla }; 494af3d54b9SSrinivas Kandagatla 495af3d54b9SSrinivas Kandagatla enum { 496af3d54b9SSrinivas Kandagatla RX_MACRO_EC0_MUX = 0, 497af3d54b9SSrinivas Kandagatla RX_MACRO_EC1_MUX, 498af3d54b9SSrinivas Kandagatla RX_MACRO_EC2_MUX, 499af3d54b9SSrinivas Kandagatla RX_MACRO_EC_MUX_MAX, 500af3d54b9SSrinivas Kandagatla }; 501af3d54b9SSrinivas Kandagatla 502af3d54b9SSrinivas Kandagatla enum { 503af3d54b9SSrinivas Kandagatla INTn_1_INP_SEL_ZERO = 0, 504af3d54b9SSrinivas Kandagatla INTn_1_INP_SEL_DEC0, 505af3d54b9SSrinivas Kandagatla INTn_1_INP_SEL_DEC1, 506af3d54b9SSrinivas Kandagatla INTn_1_INP_SEL_IIR0, 507af3d54b9SSrinivas Kandagatla INTn_1_INP_SEL_IIR1, 508af3d54b9SSrinivas Kandagatla INTn_1_INP_SEL_RX0, 509af3d54b9SSrinivas Kandagatla INTn_1_INP_SEL_RX1, 510af3d54b9SSrinivas Kandagatla INTn_1_INP_SEL_RX2, 511af3d54b9SSrinivas Kandagatla INTn_1_INP_SEL_RX3, 512af3d54b9SSrinivas Kandagatla INTn_1_INP_SEL_RX4, 513af3d54b9SSrinivas Kandagatla INTn_1_INP_SEL_RX5, 514af3d54b9SSrinivas Kandagatla }; 515af3d54b9SSrinivas Kandagatla 516af3d54b9SSrinivas Kandagatla enum { 517af3d54b9SSrinivas Kandagatla INTn_2_INP_SEL_ZERO = 0, 518af3d54b9SSrinivas Kandagatla INTn_2_INP_SEL_RX0, 519af3d54b9SSrinivas Kandagatla INTn_2_INP_SEL_RX1, 520af3d54b9SSrinivas Kandagatla INTn_2_INP_SEL_RX2, 521af3d54b9SSrinivas Kandagatla INTn_2_INP_SEL_RX3, 522af3d54b9SSrinivas Kandagatla INTn_2_INP_SEL_RX4, 523af3d54b9SSrinivas Kandagatla INTn_2_INP_SEL_RX5, 524af3d54b9SSrinivas Kandagatla }; 525af3d54b9SSrinivas Kandagatla 526af3d54b9SSrinivas Kandagatla enum { 527af3d54b9SSrinivas Kandagatla INTERP_MAIN_PATH, 528af3d54b9SSrinivas Kandagatla INTERP_MIX_PATH, 529af3d54b9SSrinivas Kandagatla }; 530af3d54b9SSrinivas Kandagatla 531f3ce6f3cSSrinivas Kandagatla /* Codec supports 2 IIR filters */ 532f3ce6f3cSSrinivas Kandagatla enum { 533f3ce6f3cSSrinivas Kandagatla IIR0 = 0, 534f3ce6f3cSSrinivas Kandagatla IIR1, 535f3ce6f3cSSrinivas Kandagatla IIR_MAX, 536f3ce6f3cSSrinivas Kandagatla }; 537f3ce6f3cSSrinivas Kandagatla 538f3ce6f3cSSrinivas Kandagatla /* Each IIR has 5 Filter Stages */ 539f3ce6f3cSSrinivas Kandagatla enum { 540f3ce6f3cSSrinivas Kandagatla BAND1 = 0, 541f3ce6f3cSSrinivas Kandagatla BAND2, 542f3ce6f3cSSrinivas Kandagatla BAND3, 543f3ce6f3cSSrinivas Kandagatla BAND4, 544f3ce6f3cSSrinivas Kandagatla BAND5, 545f3ce6f3cSSrinivas Kandagatla BAND_MAX, 546f3ce6f3cSSrinivas Kandagatla }; 547f3ce6f3cSSrinivas Kandagatla 548f3ce6f3cSSrinivas Kandagatla #define RX_MACRO_IIR_FILTER_SIZE (sizeof(u32) * BAND_MAX) 549f3ce6f3cSSrinivas Kandagatla 550f3ce6f3cSSrinivas Kandagatla #define RX_MACRO_IIR_FILTER_CTL(xname, iidx, bidx) \ 551f3ce6f3cSSrinivas Kandagatla { \ 552f3ce6f3cSSrinivas Kandagatla .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, \ 553f3ce6f3cSSrinivas Kandagatla .info = rx_macro_iir_filter_info, \ 554f3ce6f3cSSrinivas Kandagatla .get = rx_macro_get_iir_band_audio_mixer, \ 555f3ce6f3cSSrinivas Kandagatla .put = rx_macro_put_iir_band_audio_mixer, \ 556f3ce6f3cSSrinivas Kandagatla .private_value = (unsigned long)&(struct wcd_iir_filter_ctl) { \ 557f3ce6f3cSSrinivas Kandagatla .iir_idx = iidx, \ 558f3ce6f3cSSrinivas Kandagatla .band_idx = bidx, \ 559f3ce6f3cSSrinivas Kandagatla .bytes_ext = {.max = RX_MACRO_IIR_FILTER_SIZE, }, \ 560f3ce6f3cSSrinivas Kandagatla } \ 561f3ce6f3cSSrinivas Kandagatla } 562f3ce6f3cSSrinivas Kandagatla 563af3d54b9SSrinivas Kandagatla struct interp_sample_rate { 564af3d54b9SSrinivas Kandagatla int sample_rate; 565af3d54b9SSrinivas Kandagatla int rate_val; 566af3d54b9SSrinivas Kandagatla }; 567af3d54b9SSrinivas Kandagatla 568af3d54b9SSrinivas Kandagatla static struct interp_sample_rate sr_val_tbl[] = { 569af3d54b9SSrinivas Kandagatla {8000, 0x0}, {16000, 0x1}, {32000, 0x3}, {48000, 0x4}, {96000, 0x5}, 570af3d54b9SSrinivas Kandagatla {192000, 0x6}, {384000, 0x7}, {44100, 0x9}, {88200, 0xA}, 571af3d54b9SSrinivas Kandagatla {176400, 0xB}, {352800, 0xC}, 572af3d54b9SSrinivas Kandagatla }; 573af3d54b9SSrinivas Kandagatla 574af3d54b9SSrinivas Kandagatla enum { 575af3d54b9SSrinivas Kandagatla RX_MACRO_AIF_INVALID = 0, 576af3d54b9SSrinivas Kandagatla RX_MACRO_AIF1_PB, 577af3d54b9SSrinivas Kandagatla RX_MACRO_AIF2_PB, 578af3d54b9SSrinivas Kandagatla RX_MACRO_AIF3_PB, 579af3d54b9SSrinivas Kandagatla RX_MACRO_AIF4_PB, 580af3d54b9SSrinivas Kandagatla RX_MACRO_AIF_ECHO, 581af3d54b9SSrinivas Kandagatla RX_MACRO_MAX_DAIS, 582af3d54b9SSrinivas Kandagatla }; 583af3d54b9SSrinivas Kandagatla 584af3d54b9SSrinivas Kandagatla enum { 585af3d54b9SSrinivas Kandagatla RX_MACRO_AIF1_CAP = 0, 586af3d54b9SSrinivas Kandagatla RX_MACRO_AIF2_CAP, 587af3d54b9SSrinivas Kandagatla RX_MACRO_AIF3_CAP, 588af3d54b9SSrinivas Kandagatla RX_MACRO_MAX_AIF_CAP_DAIS 589af3d54b9SSrinivas Kandagatla }; 590af3d54b9SSrinivas Kandagatla 591af3d54b9SSrinivas Kandagatla struct rx_macro { 592af3d54b9SSrinivas Kandagatla struct device *dev; 593af3d54b9SSrinivas Kandagatla int comp_enabled[RX_MACRO_COMP_MAX]; 594af3d54b9SSrinivas Kandagatla /* Main path clock users count */ 595af3d54b9SSrinivas Kandagatla int main_clk_users[INTERP_MAX]; 596af3d54b9SSrinivas Kandagatla int rx_port_value[RX_MACRO_PORTS_MAX]; 597af3d54b9SSrinivas Kandagatla u16 prim_int_users[INTERP_MAX]; 598af3d54b9SSrinivas Kandagatla int rx_mclk_users; 599af3d54b9SSrinivas Kandagatla bool reset_swr; 600af3d54b9SSrinivas Kandagatla int clsh_users; 601af3d54b9SSrinivas Kandagatla int rx_mclk_cnt; 602af3d54b9SSrinivas Kandagatla bool is_ear_mode_on; 603af3d54b9SSrinivas Kandagatla bool hph_pwr_mode; 604af3d54b9SSrinivas Kandagatla bool hph_hd2_mode; 605af3d54b9SSrinivas Kandagatla struct snd_soc_component *component; 606af3d54b9SSrinivas Kandagatla unsigned long active_ch_mask[RX_MACRO_MAX_DAIS]; 607af3d54b9SSrinivas Kandagatla unsigned long active_ch_cnt[RX_MACRO_MAX_DAIS]; 608af3d54b9SSrinivas Kandagatla u16 bit_width[RX_MACRO_MAX_DAIS]; 609af3d54b9SSrinivas Kandagatla int is_softclip_on; 610af3d54b9SSrinivas Kandagatla int is_aux_hpf_on; 611af3d54b9SSrinivas Kandagatla int softclip_clk_users; 612*9e3d83c5SSrinivasa Rao Mandadapu struct lpass_macro *pds; 613af3d54b9SSrinivas Kandagatla struct regmap *regmap; 61443b647d9SSrinivas Kandagatla struct clk *mclk; 61543b647d9SSrinivas Kandagatla struct clk *npl; 61643b647d9SSrinivas Kandagatla struct clk *macro; 61743b647d9SSrinivas Kandagatla struct clk *dcodec; 61843b647d9SSrinivas Kandagatla struct clk *fsgen; 619af3d54b9SSrinivas Kandagatla struct clk_hw hw; 620af3d54b9SSrinivas Kandagatla }; 621af3d54b9SSrinivas Kandagatla #define to_rx_macro(_hw) container_of(_hw, struct rx_macro, hw) 622af3d54b9SSrinivas Kandagatla 623f3ce6f3cSSrinivas Kandagatla struct wcd_iir_filter_ctl { 624f3ce6f3cSSrinivas Kandagatla unsigned int iir_idx; 625f3ce6f3cSSrinivas Kandagatla unsigned int band_idx; 626f3ce6f3cSSrinivas Kandagatla struct soc_bytes_ext bytes_ext; 627f3ce6f3cSSrinivas Kandagatla }; 628f3ce6f3cSSrinivas Kandagatla 629af3d54b9SSrinivas Kandagatla static const DECLARE_TLV_DB_SCALE(digital_gain, -8400, 100, -8400); 630af3d54b9SSrinivas Kandagatla 6314f692926SSrinivas Kandagatla static const char * const rx_int_mix_mux_text[] = { 6324f692926SSrinivas Kandagatla "ZERO", "RX0", "RX1", "RX2", "RX3", "RX4", "RX5" 6334f692926SSrinivas Kandagatla }; 6344f692926SSrinivas Kandagatla 6354f692926SSrinivas Kandagatla static const char * const rx_prim_mix_text[] = { 6364f692926SSrinivas Kandagatla "ZERO", "DEC0", "DEC1", "IIR0", "IIR1", "RX0", "RX1", "RX2", 6374f692926SSrinivas Kandagatla "RX3", "RX4", "RX5" 6384f692926SSrinivas Kandagatla }; 6394f692926SSrinivas Kandagatla 6404f692926SSrinivas Kandagatla static const char * const rx_sidetone_mix_text[] = { 6414f692926SSrinivas Kandagatla "ZERO", "SRC0", "SRC1", "SRC_SUM" 6424f692926SSrinivas Kandagatla }; 6434f692926SSrinivas Kandagatla 6444f692926SSrinivas Kandagatla static const char * const iir_inp_mux_text[] = { 6454f692926SSrinivas Kandagatla "ZERO", "DEC0", "DEC1", "DEC2", "DEC3", 6464f692926SSrinivas Kandagatla "RX0", "RX1", "RX2", "RX3", "RX4", "RX5" 6474f692926SSrinivas Kandagatla }; 6484f692926SSrinivas Kandagatla 6494f692926SSrinivas Kandagatla static const char * const rx_int_dem_inp_mux_text[] = { 6504f692926SSrinivas Kandagatla "NORMAL_DSM_OUT", "CLSH_DSM_OUT", 6514f692926SSrinivas Kandagatla }; 6524f692926SSrinivas Kandagatla 6534f692926SSrinivas Kandagatla static const char * const rx_int0_1_interp_mux_text[] = { 6544f692926SSrinivas Kandagatla "ZERO", "RX INT0_1 MIX1", 6554f692926SSrinivas Kandagatla }; 6564f692926SSrinivas Kandagatla 6574f692926SSrinivas Kandagatla static const char * const rx_int1_1_interp_mux_text[] = { 6584f692926SSrinivas Kandagatla "ZERO", "RX INT1_1 MIX1", 6594f692926SSrinivas Kandagatla }; 6604f692926SSrinivas Kandagatla 6614f692926SSrinivas Kandagatla static const char * const rx_int2_1_interp_mux_text[] = { 6624f692926SSrinivas Kandagatla "ZERO", "RX INT2_1 MIX1", 6634f692926SSrinivas Kandagatla }; 6644f692926SSrinivas Kandagatla 6654f692926SSrinivas Kandagatla static const char * const rx_int0_2_interp_mux_text[] = { 6664f692926SSrinivas Kandagatla "ZERO", "RX INT0_2 MUX", 6674f692926SSrinivas Kandagatla }; 6684f692926SSrinivas Kandagatla 6694f692926SSrinivas Kandagatla static const char * const rx_int1_2_interp_mux_text[] = { 6704f692926SSrinivas Kandagatla "ZERO", "RX INT1_2 MUX", 6714f692926SSrinivas Kandagatla }; 6724f692926SSrinivas Kandagatla 6734f692926SSrinivas Kandagatla static const char * const rx_int2_2_interp_mux_text[] = { 6744f692926SSrinivas Kandagatla "ZERO", "RX INT2_2 MUX", 6754f692926SSrinivas Kandagatla }; 6764f692926SSrinivas Kandagatla 6774f692926SSrinivas Kandagatla static const char *const rx_macro_mux_text[] = { 6784f692926SSrinivas Kandagatla "ZERO", "AIF1_PB", "AIF2_PB", "AIF3_PB", "AIF4_PB" 6794f692926SSrinivas Kandagatla }; 6804f692926SSrinivas Kandagatla 681af3d54b9SSrinivas Kandagatla static const char *const rx_macro_hph_pwr_mode_text[] = { 682af3d54b9SSrinivas Kandagatla "ULP", "LOHIFI" 683af3d54b9SSrinivas Kandagatla }; 684af3d54b9SSrinivas Kandagatla 6854f692926SSrinivas Kandagatla static const char * const rx_echo_mux_text[] = { 6864f692926SSrinivas Kandagatla "ZERO", "RX_MIX0", "RX_MIX1", "RX_MIX2" 6874f692926SSrinivas Kandagatla }; 6884f692926SSrinivas Kandagatla 689af3d54b9SSrinivas Kandagatla static const struct soc_enum rx_macro_hph_pwr_mode_enum = 690af3d54b9SSrinivas Kandagatla SOC_ENUM_SINGLE_EXT(2, rx_macro_hph_pwr_mode_text); 6914f692926SSrinivas Kandagatla static const struct soc_enum rx_mix_tx2_mux_enum = 6924f692926SSrinivas Kandagatla SOC_ENUM_SINGLE(CDC_RX_INP_MUX_RX_MIX_CFG5, 0, 4, rx_echo_mux_text); 6934f692926SSrinivas Kandagatla static const struct soc_enum rx_mix_tx1_mux_enum = 6944f692926SSrinivas Kandagatla SOC_ENUM_SINGLE(CDC_RX_INP_MUX_RX_MIX_CFG4, 0, 4, rx_echo_mux_text); 6954f692926SSrinivas Kandagatla static const struct soc_enum rx_mix_tx0_mux_enum = 6964f692926SSrinivas Kandagatla SOC_ENUM_SINGLE(CDC_RX_INP_MUX_RX_MIX_CFG4, 4, 4, rx_echo_mux_text); 6974f692926SSrinivas Kandagatla 6984f692926SSrinivas Kandagatla static SOC_ENUM_SINGLE_DECL(rx_int0_2_enum, CDC_RX_INP_MUX_RX_INT0_CFG1, 0, 6994f692926SSrinivas Kandagatla rx_int_mix_mux_text); 7004f692926SSrinivas Kandagatla static SOC_ENUM_SINGLE_DECL(rx_int1_2_enum, CDC_RX_INP_MUX_RX_INT1_CFG1, 0, 7014f692926SSrinivas Kandagatla rx_int_mix_mux_text); 7024f692926SSrinivas Kandagatla static SOC_ENUM_SINGLE_DECL(rx_int2_2_enum, CDC_RX_INP_MUX_RX_INT2_CFG1, 0, 7034f692926SSrinivas Kandagatla rx_int_mix_mux_text); 7044f692926SSrinivas Kandagatla 7054f692926SSrinivas Kandagatla static SOC_ENUM_SINGLE_DECL(rx_int0_1_mix_inp0_enum, CDC_RX_INP_MUX_RX_INT0_CFG0, 0, 7064f692926SSrinivas Kandagatla rx_prim_mix_text); 7074f692926SSrinivas Kandagatla static SOC_ENUM_SINGLE_DECL(rx_int0_1_mix_inp1_enum, CDC_RX_INP_MUX_RX_INT0_CFG0, 4, 7084f692926SSrinivas Kandagatla rx_prim_mix_text); 7094f692926SSrinivas Kandagatla static SOC_ENUM_SINGLE_DECL(rx_int0_1_mix_inp2_enum, CDC_RX_INP_MUX_RX_INT0_CFG1, 4, 7104f692926SSrinivas Kandagatla rx_prim_mix_text); 7114f692926SSrinivas Kandagatla static SOC_ENUM_SINGLE_DECL(rx_int1_1_mix_inp0_enum, CDC_RX_INP_MUX_RX_INT1_CFG0, 0, 7124f692926SSrinivas Kandagatla rx_prim_mix_text); 7134f692926SSrinivas Kandagatla static SOC_ENUM_SINGLE_DECL(rx_int1_1_mix_inp1_enum, CDC_RX_INP_MUX_RX_INT1_CFG0, 4, 7144f692926SSrinivas Kandagatla rx_prim_mix_text); 7154f692926SSrinivas Kandagatla static SOC_ENUM_SINGLE_DECL(rx_int1_1_mix_inp2_enum, CDC_RX_INP_MUX_RX_INT1_CFG1, 4, 7164f692926SSrinivas Kandagatla rx_prim_mix_text); 7174f692926SSrinivas Kandagatla static SOC_ENUM_SINGLE_DECL(rx_int2_1_mix_inp0_enum, CDC_RX_INP_MUX_RX_INT2_CFG0, 0, 7184f692926SSrinivas Kandagatla rx_prim_mix_text); 7194f692926SSrinivas Kandagatla static SOC_ENUM_SINGLE_DECL(rx_int2_1_mix_inp1_enum, CDC_RX_INP_MUX_RX_INT2_CFG0, 4, 7204f692926SSrinivas Kandagatla rx_prim_mix_text); 7214f692926SSrinivas Kandagatla static SOC_ENUM_SINGLE_DECL(rx_int2_1_mix_inp2_enum, CDC_RX_INP_MUX_RX_INT2_CFG1, 4, 7224f692926SSrinivas Kandagatla rx_prim_mix_text); 7234f692926SSrinivas Kandagatla 7244f692926SSrinivas Kandagatla static SOC_ENUM_SINGLE_DECL(rx_int0_mix2_inp_enum, CDC_RX_INP_MUX_SIDETONE_SRC_CFG0, 2, 7254f692926SSrinivas Kandagatla rx_sidetone_mix_text); 7264f692926SSrinivas Kandagatla static SOC_ENUM_SINGLE_DECL(rx_int1_mix2_inp_enum, CDC_RX_INP_MUX_SIDETONE_SRC_CFG0, 4, 7274f692926SSrinivas Kandagatla rx_sidetone_mix_text); 7284f692926SSrinivas Kandagatla static SOC_ENUM_SINGLE_DECL(rx_int2_mix2_inp_enum, CDC_RX_INP_MUX_SIDETONE_SRC_CFG0, 6, 7294f692926SSrinivas Kandagatla rx_sidetone_mix_text); 7304f692926SSrinivas Kandagatla static SOC_ENUM_SINGLE_DECL(iir0_inp0_enum, CDC_RX_IIR_INP_MUX_IIR0_MIX_CFG0, 0, 7314f692926SSrinivas Kandagatla iir_inp_mux_text); 7324f692926SSrinivas Kandagatla static SOC_ENUM_SINGLE_DECL(iir0_inp1_enum, CDC_RX_IIR_INP_MUX_IIR0_MIX_CFG1, 0, 7334f692926SSrinivas Kandagatla iir_inp_mux_text); 7344f692926SSrinivas Kandagatla static SOC_ENUM_SINGLE_DECL(iir0_inp2_enum, CDC_RX_IIR_INP_MUX_IIR0_MIX_CFG2, 0, 7354f692926SSrinivas Kandagatla iir_inp_mux_text); 7364f692926SSrinivas Kandagatla static SOC_ENUM_SINGLE_DECL(iir0_inp3_enum, CDC_RX_IIR_INP_MUX_IIR0_MIX_CFG3, 0, 7374f692926SSrinivas Kandagatla iir_inp_mux_text); 7384f692926SSrinivas Kandagatla static SOC_ENUM_SINGLE_DECL(iir1_inp0_enum, CDC_RX_IIR_INP_MUX_IIR1_MIX_CFG0, 0, 7394f692926SSrinivas Kandagatla iir_inp_mux_text); 7404f692926SSrinivas Kandagatla static SOC_ENUM_SINGLE_DECL(iir1_inp1_enum, CDC_RX_IIR_INP_MUX_IIR1_MIX_CFG1, 0, 7414f692926SSrinivas Kandagatla iir_inp_mux_text); 7424f692926SSrinivas Kandagatla static SOC_ENUM_SINGLE_DECL(iir1_inp2_enum, CDC_RX_IIR_INP_MUX_IIR1_MIX_CFG2, 0, 7434f692926SSrinivas Kandagatla iir_inp_mux_text); 7444f692926SSrinivas Kandagatla static SOC_ENUM_SINGLE_DECL(iir1_inp3_enum, CDC_RX_IIR_INP_MUX_IIR1_MIX_CFG3, 0, 7454f692926SSrinivas Kandagatla iir_inp_mux_text); 7464f692926SSrinivas Kandagatla 7474f692926SSrinivas Kandagatla static SOC_ENUM_SINGLE_DECL(rx_int0_1_interp_enum, SND_SOC_NOPM, 0, 7484f692926SSrinivas Kandagatla rx_int0_1_interp_mux_text); 7494f692926SSrinivas Kandagatla static SOC_ENUM_SINGLE_DECL(rx_int1_1_interp_enum, SND_SOC_NOPM, 0, 7504f692926SSrinivas Kandagatla rx_int1_1_interp_mux_text); 7514f692926SSrinivas Kandagatla static SOC_ENUM_SINGLE_DECL(rx_int2_1_interp_enum, SND_SOC_NOPM, 0, 7524f692926SSrinivas Kandagatla rx_int2_1_interp_mux_text); 7534f692926SSrinivas Kandagatla static SOC_ENUM_SINGLE_DECL(rx_int0_2_interp_enum, SND_SOC_NOPM, 0, 7544f692926SSrinivas Kandagatla rx_int0_2_interp_mux_text); 7554f692926SSrinivas Kandagatla static SOC_ENUM_SINGLE_DECL(rx_int1_2_interp_enum, SND_SOC_NOPM, 0, 7564f692926SSrinivas Kandagatla rx_int1_2_interp_mux_text); 7574f692926SSrinivas Kandagatla static SOC_ENUM_SINGLE_DECL(rx_int2_2_interp_enum, SND_SOC_NOPM, 0, 7584f692926SSrinivas Kandagatla rx_int2_2_interp_mux_text); 7594f692926SSrinivas Kandagatla static SOC_ENUM_SINGLE_DECL(rx_int0_dem_inp_enum, CDC_RX_RX0_RX_PATH_CFG1, 0, 7604f692926SSrinivas Kandagatla rx_int_dem_inp_mux_text); 7614f692926SSrinivas Kandagatla static SOC_ENUM_SINGLE_DECL(rx_int1_dem_inp_enum, CDC_RX_RX1_RX_PATH_CFG1, 0, 7624f692926SSrinivas Kandagatla rx_int_dem_inp_mux_text); 7634f692926SSrinivas Kandagatla 7644f692926SSrinivas Kandagatla static SOC_ENUM_SINGLE_DECL(rx_macro_rx0_enum, SND_SOC_NOPM, 0, rx_macro_mux_text); 7654f692926SSrinivas Kandagatla static SOC_ENUM_SINGLE_DECL(rx_macro_rx1_enum, SND_SOC_NOPM, 0, rx_macro_mux_text); 7664f692926SSrinivas Kandagatla static SOC_ENUM_SINGLE_DECL(rx_macro_rx2_enum, SND_SOC_NOPM, 0, rx_macro_mux_text); 7674f692926SSrinivas Kandagatla static SOC_ENUM_SINGLE_DECL(rx_macro_rx3_enum, SND_SOC_NOPM, 0, rx_macro_mux_text); 7684f692926SSrinivas Kandagatla static SOC_ENUM_SINGLE_DECL(rx_macro_rx4_enum, SND_SOC_NOPM, 0, rx_macro_mux_text); 7694f692926SSrinivas Kandagatla static SOC_ENUM_SINGLE_DECL(rx_macro_rx5_enum, SND_SOC_NOPM, 0, rx_macro_mux_text); 7704f692926SSrinivas Kandagatla 7714f692926SSrinivas Kandagatla static const struct snd_kcontrol_new rx_mix_tx1_mux = 7724f692926SSrinivas Kandagatla SOC_DAPM_ENUM("RX MIX TX1_MUX Mux", rx_mix_tx1_mux_enum); 7734f692926SSrinivas Kandagatla static const struct snd_kcontrol_new rx_mix_tx2_mux = 7744f692926SSrinivas Kandagatla SOC_DAPM_ENUM("RX MIX TX2_MUX Mux", rx_mix_tx2_mux_enum); 7754f692926SSrinivas Kandagatla static const struct snd_kcontrol_new rx_int0_2_mux = 7764f692926SSrinivas Kandagatla SOC_DAPM_ENUM("rx_int0_2", rx_int0_2_enum); 7774f692926SSrinivas Kandagatla static const struct snd_kcontrol_new rx_int1_2_mux = 7784f692926SSrinivas Kandagatla SOC_DAPM_ENUM("rx_int1_2", rx_int1_2_enum); 7794f692926SSrinivas Kandagatla static const struct snd_kcontrol_new rx_int2_2_mux = 7804f692926SSrinivas Kandagatla SOC_DAPM_ENUM("rx_int2_2", rx_int2_2_enum); 7814f692926SSrinivas Kandagatla static const struct snd_kcontrol_new rx_int0_1_mix_inp0_mux = 7824f692926SSrinivas Kandagatla SOC_DAPM_ENUM("rx_int0_1_mix_inp0", rx_int0_1_mix_inp0_enum); 7834f692926SSrinivas Kandagatla static const struct snd_kcontrol_new rx_int0_1_mix_inp1_mux = 7844f692926SSrinivas Kandagatla SOC_DAPM_ENUM("rx_int0_1_mix_inp1", rx_int0_1_mix_inp1_enum); 7854f692926SSrinivas Kandagatla static const struct snd_kcontrol_new rx_int0_1_mix_inp2_mux = 7864f692926SSrinivas Kandagatla SOC_DAPM_ENUM("rx_int0_1_mix_inp2", rx_int0_1_mix_inp2_enum); 7874f692926SSrinivas Kandagatla static const struct snd_kcontrol_new rx_int1_1_mix_inp0_mux = 7884f692926SSrinivas Kandagatla SOC_DAPM_ENUM("rx_int1_1_mix_inp0", rx_int1_1_mix_inp0_enum); 7894f692926SSrinivas Kandagatla static const struct snd_kcontrol_new rx_int1_1_mix_inp1_mux = 7904f692926SSrinivas Kandagatla SOC_DAPM_ENUM("rx_int1_1_mix_inp1", rx_int1_1_mix_inp1_enum); 7914f692926SSrinivas Kandagatla static const struct snd_kcontrol_new rx_int1_1_mix_inp2_mux = 7924f692926SSrinivas Kandagatla SOC_DAPM_ENUM("rx_int1_1_mix_inp2", rx_int1_1_mix_inp2_enum); 7934f692926SSrinivas Kandagatla static const struct snd_kcontrol_new rx_int2_1_mix_inp0_mux = 7944f692926SSrinivas Kandagatla SOC_DAPM_ENUM("rx_int2_1_mix_inp0", rx_int2_1_mix_inp0_enum); 7954f692926SSrinivas Kandagatla static const struct snd_kcontrol_new rx_int2_1_mix_inp1_mux = 7964f692926SSrinivas Kandagatla SOC_DAPM_ENUM("rx_int2_1_mix_inp1", rx_int2_1_mix_inp1_enum); 7974f692926SSrinivas Kandagatla static const struct snd_kcontrol_new rx_int2_1_mix_inp2_mux = 7984f692926SSrinivas Kandagatla SOC_DAPM_ENUM("rx_int2_1_mix_inp2", rx_int2_1_mix_inp2_enum); 7994f692926SSrinivas Kandagatla static const struct snd_kcontrol_new rx_int0_mix2_inp_mux = 8004f692926SSrinivas Kandagatla SOC_DAPM_ENUM("rx_int0_mix2_inp", rx_int0_mix2_inp_enum); 8014f692926SSrinivas Kandagatla static const struct snd_kcontrol_new rx_int1_mix2_inp_mux = 8024f692926SSrinivas Kandagatla SOC_DAPM_ENUM("rx_int1_mix2_inp", rx_int1_mix2_inp_enum); 8034f692926SSrinivas Kandagatla static const struct snd_kcontrol_new rx_int2_mix2_inp_mux = 8044f692926SSrinivas Kandagatla SOC_DAPM_ENUM("rx_int2_mix2_inp", rx_int2_mix2_inp_enum); 8054f692926SSrinivas Kandagatla static const struct snd_kcontrol_new iir0_inp0_mux = 8064f692926SSrinivas Kandagatla SOC_DAPM_ENUM("iir0_inp0", iir0_inp0_enum); 8074f692926SSrinivas Kandagatla static const struct snd_kcontrol_new iir0_inp1_mux = 8084f692926SSrinivas Kandagatla SOC_DAPM_ENUM("iir0_inp1", iir0_inp1_enum); 8094f692926SSrinivas Kandagatla static const struct snd_kcontrol_new iir0_inp2_mux = 8104f692926SSrinivas Kandagatla SOC_DAPM_ENUM("iir0_inp2", iir0_inp2_enum); 8114f692926SSrinivas Kandagatla static const struct snd_kcontrol_new iir0_inp3_mux = 8124f692926SSrinivas Kandagatla SOC_DAPM_ENUM("iir0_inp3", iir0_inp3_enum); 8134f692926SSrinivas Kandagatla static const struct snd_kcontrol_new iir1_inp0_mux = 8144f692926SSrinivas Kandagatla SOC_DAPM_ENUM("iir1_inp0", iir1_inp0_enum); 8154f692926SSrinivas Kandagatla static const struct snd_kcontrol_new iir1_inp1_mux = 8164f692926SSrinivas Kandagatla SOC_DAPM_ENUM("iir1_inp1", iir1_inp1_enum); 8174f692926SSrinivas Kandagatla static const struct snd_kcontrol_new iir1_inp2_mux = 8184f692926SSrinivas Kandagatla SOC_DAPM_ENUM("iir1_inp2", iir1_inp2_enum); 8194f692926SSrinivas Kandagatla static const struct snd_kcontrol_new iir1_inp3_mux = 8204f692926SSrinivas Kandagatla SOC_DAPM_ENUM("iir1_inp3", iir1_inp3_enum); 8214f692926SSrinivas Kandagatla static const struct snd_kcontrol_new rx_int0_1_interp_mux = 8224f692926SSrinivas Kandagatla SOC_DAPM_ENUM("rx_int0_1_interp", rx_int0_1_interp_enum); 8234f692926SSrinivas Kandagatla static const struct snd_kcontrol_new rx_int1_1_interp_mux = 8244f692926SSrinivas Kandagatla SOC_DAPM_ENUM("rx_int1_1_interp", rx_int1_1_interp_enum); 8254f692926SSrinivas Kandagatla static const struct snd_kcontrol_new rx_int2_1_interp_mux = 8264f692926SSrinivas Kandagatla SOC_DAPM_ENUM("rx_int2_1_interp", rx_int2_1_interp_enum); 8274f692926SSrinivas Kandagatla static const struct snd_kcontrol_new rx_int0_2_interp_mux = 8284f692926SSrinivas Kandagatla SOC_DAPM_ENUM("rx_int0_2_interp", rx_int0_2_interp_enum); 8294f692926SSrinivas Kandagatla static const struct snd_kcontrol_new rx_int1_2_interp_mux = 8304f692926SSrinivas Kandagatla SOC_DAPM_ENUM("rx_int1_2_interp", rx_int1_2_interp_enum); 8314f692926SSrinivas Kandagatla static const struct snd_kcontrol_new rx_int2_2_interp_mux = 8324f692926SSrinivas Kandagatla SOC_DAPM_ENUM("rx_int2_2_interp", rx_int2_2_interp_enum); 8334f692926SSrinivas Kandagatla static const struct snd_kcontrol_new rx_mix_tx0_mux = 8344f692926SSrinivas Kandagatla SOC_DAPM_ENUM("RX MIX TX0_MUX Mux", rx_mix_tx0_mux_enum); 835af3d54b9SSrinivas Kandagatla 836af3d54b9SSrinivas Kandagatla static const struct reg_default rx_defaults[] = { 837af3d54b9SSrinivas Kandagatla /* RX Macro */ 838af3d54b9SSrinivas Kandagatla { CDC_RX_TOP_TOP_CFG0, 0x00 }, 839af3d54b9SSrinivas Kandagatla { CDC_RX_TOP_SWR_CTRL, 0x00 }, 840af3d54b9SSrinivas Kandagatla { CDC_RX_TOP_DEBUG, 0x00 }, 841af3d54b9SSrinivas Kandagatla { CDC_RX_TOP_DEBUG_BUS, 0x00 }, 842af3d54b9SSrinivas Kandagatla { CDC_RX_TOP_DEBUG_EN0, 0x00 }, 843af3d54b9SSrinivas Kandagatla { CDC_RX_TOP_DEBUG_EN1, 0x00 }, 844af3d54b9SSrinivas Kandagatla { CDC_RX_TOP_DEBUG_EN2, 0x00 }, 845af3d54b9SSrinivas Kandagatla { CDC_RX_TOP_HPHL_COMP_WR_LSB, 0x00 }, 846af3d54b9SSrinivas Kandagatla { CDC_RX_TOP_HPHL_COMP_WR_MSB, 0x00 }, 847af3d54b9SSrinivas Kandagatla { CDC_RX_TOP_HPHL_COMP_LUT, 0x00 }, 848af3d54b9SSrinivas Kandagatla { CDC_RX_TOP_HPHL_COMP_RD_LSB, 0x00 }, 849af3d54b9SSrinivas Kandagatla { CDC_RX_TOP_HPHL_COMP_RD_MSB, 0x00 }, 850af3d54b9SSrinivas Kandagatla { CDC_RX_TOP_HPHR_COMP_WR_LSB, 0x00 }, 851af3d54b9SSrinivas Kandagatla { CDC_RX_TOP_HPHR_COMP_WR_MSB, 0x00 }, 852af3d54b9SSrinivas Kandagatla { CDC_RX_TOP_HPHR_COMP_LUT, 0x00 }, 853af3d54b9SSrinivas Kandagatla { CDC_RX_TOP_HPHR_COMP_RD_LSB, 0x00 }, 854af3d54b9SSrinivas Kandagatla { CDC_RX_TOP_HPHR_COMP_RD_MSB, 0x00 }, 855af3d54b9SSrinivas Kandagatla { CDC_RX_TOP_DSD0_DEBUG_CFG0, 0x11 }, 856af3d54b9SSrinivas Kandagatla { CDC_RX_TOP_DSD0_DEBUG_CFG1, 0x20 }, 857af3d54b9SSrinivas Kandagatla { CDC_RX_TOP_DSD0_DEBUG_CFG2, 0x00 }, 858af3d54b9SSrinivas Kandagatla { CDC_RX_TOP_DSD0_DEBUG_CFG3, 0x00 }, 859af3d54b9SSrinivas Kandagatla { CDC_RX_TOP_DSD1_DEBUG_CFG0, 0x11 }, 860af3d54b9SSrinivas Kandagatla { CDC_RX_TOP_DSD1_DEBUG_CFG1, 0x20 }, 861af3d54b9SSrinivas Kandagatla { CDC_RX_TOP_DSD1_DEBUG_CFG2, 0x00 }, 862af3d54b9SSrinivas Kandagatla { CDC_RX_TOP_DSD1_DEBUG_CFG3, 0x00 }, 863af3d54b9SSrinivas Kandagatla { CDC_RX_TOP_RX_I2S_CTL, 0x0C }, 864af3d54b9SSrinivas Kandagatla { CDC_RX_TOP_TX_I2S2_CTL, 0x0C }, 865af3d54b9SSrinivas Kandagatla { CDC_RX_TOP_I2S_CLK, 0x0C }, 866af3d54b9SSrinivas Kandagatla { CDC_RX_TOP_I2S_RESET, 0x00 }, 867af3d54b9SSrinivas Kandagatla { CDC_RX_TOP_I2S_MUX, 0x00 }, 868af3d54b9SSrinivas Kandagatla { CDC_RX_CLK_RST_CTRL_MCLK_CONTROL, 0x00 }, 869af3d54b9SSrinivas Kandagatla { CDC_RX_CLK_RST_CTRL_FS_CNT_CONTROL, 0x00 }, 870af3d54b9SSrinivas Kandagatla { CDC_RX_CLK_RST_CTRL_SWR_CONTROL, 0x00 }, 871af3d54b9SSrinivas Kandagatla { CDC_RX_CLK_RST_CTRL_DSD_CONTROL, 0x00 }, 872af3d54b9SSrinivas Kandagatla { CDC_RX_CLK_RST_CTRL_ASRC_SHARE_CONTROL, 0x08 }, 873af3d54b9SSrinivas Kandagatla { CDC_RX_SOFTCLIP_CRC, 0x00 }, 874af3d54b9SSrinivas Kandagatla { CDC_RX_SOFTCLIP_SOFTCLIP_CTRL, 0x38 }, 875af3d54b9SSrinivas Kandagatla { CDC_RX_INP_MUX_RX_INT0_CFG0, 0x00 }, 876af3d54b9SSrinivas Kandagatla { CDC_RX_INP_MUX_RX_INT0_CFG1, 0x00 }, 877af3d54b9SSrinivas Kandagatla { CDC_RX_INP_MUX_RX_INT1_CFG0, 0x00 }, 878af3d54b9SSrinivas Kandagatla { CDC_RX_INP_MUX_RX_INT1_CFG1, 0x00 }, 879af3d54b9SSrinivas Kandagatla { CDC_RX_INP_MUX_RX_INT2_CFG0, 0x00 }, 880af3d54b9SSrinivas Kandagatla { CDC_RX_INP_MUX_RX_INT2_CFG1, 0x00 }, 881af3d54b9SSrinivas Kandagatla { CDC_RX_INP_MUX_RX_MIX_CFG4, 0x00 }, 882af3d54b9SSrinivas Kandagatla { CDC_RX_INP_MUX_RX_MIX_CFG5, 0x00 }, 883af3d54b9SSrinivas Kandagatla { CDC_RX_INP_MUX_SIDETONE_SRC_CFG0, 0x00 }, 884af3d54b9SSrinivas Kandagatla { CDC_RX_CLSH_CRC, 0x00 }, 885af3d54b9SSrinivas Kandagatla { CDC_RX_CLSH_DLY_CTRL, 0x03 }, 886af3d54b9SSrinivas Kandagatla { CDC_RX_CLSH_DECAY_CTRL, 0x02 }, 887af3d54b9SSrinivas Kandagatla { CDC_RX_CLSH_HPH_V_PA, 0x1C }, 888af3d54b9SSrinivas Kandagatla { CDC_RX_CLSH_EAR_V_PA, 0x39 }, 889af3d54b9SSrinivas Kandagatla { CDC_RX_CLSH_HPH_V_HD, 0x0C }, 890af3d54b9SSrinivas Kandagatla { CDC_RX_CLSH_EAR_V_HD, 0x0C }, 891af3d54b9SSrinivas Kandagatla { CDC_RX_CLSH_K1_MSB, 0x01 }, 892af3d54b9SSrinivas Kandagatla { CDC_RX_CLSH_K1_LSB, 0x00 }, 893af3d54b9SSrinivas Kandagatla { CDC_RX_CLSH_K2_MSB, 0x00 }, 894af3d54b9SSrinivas Kandagatla { CDC_RX_CLSH_K2_LSB, 0x80 }, 895af3d54b9SSrinivas Kandagatla { CDC_RX_CLSH_IDLE_CTRL, 0x00 }, 896af3d54b9SSrinivas Kandagatla { CDC_RX_CLSH_IDLE_HPH, 0x00 }, 897af3d54b9SSrinivas Kandagatla { CDC_RX_CLSH_IDLE_EAR, 0x00 }, 898af3d54b9SSrinivas Kandagatla { CDC_RX_CLSH_TEST0, 0x07 }, 899af3d54b9SSrinivas Kandagatla { CDC_RX_CLSH_TEST1, 0x00 }, 900af3d54b9SSrinivas Kandagatla { CDC_RX_CLSH_OVR_VREF, 0x00 }, 901af3d54b9SSrinivas Kandagatla { CDC_RX_CLSH_CLSG_CTL, 0x02 }, 902af3d54b9SSrinivas Kandagatla { CDC_RX_CLSH_CLSG_CFG1, 0x9A }, 903af3d54b9SSrinivas Kandagatla { CDC_RX_CLSH_CLSG_CFG2, 0x10 }, 904af3d54b9SSrinivas Kandagatla { CDC_RX_BCL_VBAT_PATH_CTL, 0x00 }, 905af3d54b9SSrinivas Kandagatla { CDC_RX_BCL_VBAT_CFG, 0x10 }, 906af3d54b9SSrinivas Kandagatla { CDC_RX_BCL_VBAT_ADC_CAL1, 0x00 }, 907af3d54b9SSrinivas Kandagatla { CDC_RX_BCL_VBAT_ADC_CAL2, 0x00 }, 908af3d54b9SSrinivas Kandagatla { CDC_RX_BCL_VBAT_ADC_CAL3, 0x04 }, 909af3d54b9SSrinivas Kandagatla { CDC_RX_BCL_VBAT_PK_EST1, 0xE0 }, 910af3d54b9SSrinivas Kandagatla { CDC_RX_BCL_VBAT_PK_EST2, 0x01 }, 911af3d54b9SSrinivas Kandagatla { CDC_RX_BCL_VBAT_PK_EST3, 0x40 }, 912af3d54b9SSrinivas Kandagatla { CDC_RX_BCL_VBAT_RF_PROC1, 0x2A }, 913af3d54b9SSrinivas Kandagatla { CDC_RX_BCL_VBAT_RF_PROC1, 0x00 }, 914af3d54b9SSrinivas Kandagatla { CDC_RX_BCL_VBAT_TAC1, 0x00 }, 915af3d54b9SSrinivas Kandagatla { CDC_RX_BCL_VBAT_TAC2, 0x18 }, 916af3d54b9SSrinivas Kandagatla { CDC_RX_BCL_VBAT_TAC3, 0x18 }, 917af3d54b9SSrinivas Kandagatla { CDC_RX_BCL_VBAT_TAC4, 0x03 }, 918af3d54b9SSrinivas Kandagatla { CDC_RX_BCL_VBAT_GAIN_UPD1, 0x01 }, 919af3d54b9SSrinivas Kandagatla { CDC_RX_BCL_VBAT_GAIN_UPD2, 0x00 }, 920af3d54b9SSrinivas Kandagatla { CDC_RX_BCL_VBAT_GAIN_UPD3, 0x00 }, 921af3d54b9SSrinivas Kandagatla { CDC_RX_BCL_VBAT_GAIN_UPD4, 0x64 }, 922af3d54b9SSrinivas Kandagatla { CDC_RX_BCL_VBAT_GAIN_UPD5, 0x01 }, 923af3d54b9SSrinivas Kandagatla { CDC_RX_BCL_VBAT_DEBUG1, 0x00 }, 924af3d54b9SSrinivas Kandagatla { CDC_RX_BCL_VBAT_GAIN_UPD_MON, 0x00 }, 925af3d54b9SSrinivas Kandagatla { CDC_RX_BCL_VBAT_GAIN_MON_VAL, 0x00 }, 926af3d54b9SSrinivas Kandagatla { CDC_RX_BCL_VBAT_BAN, 0x0C }, 927af3d54b9SSrinivas Kandagatla { CDC_RX_BCL_VBAT_BCL_GAIN_UPD1, 0x00 }, 928af3d54b9SSrinivas Kandagatla { CDC_RX_BCL_VBAT_BCL_GAIN_UPD2, 0x77 }, 929af3d54b9SSrinivas Kandagatla { CDC_RX_BCL_VBAT_BCL_GAIN_UPD3, 0x01 }, 930af3d54b9SSrinivas Kandagatla { CDC_RX_BCL_VBAT_BCL_GAIN_UPD4, 0x00 }, 931af3d54b9SSrinivas Kandagatla { CDC_RX_BCL_VBAT_BCL_GAIN_UPD5, 0x4B }, 932af3d54b9SSrinivas Kandagatla { CDC_RX_BCL_VBAT_BCL_GAIN_UPD6, 0x00 }, 933af3d54b9SSrinivas Kandagatla { CDC_RX_BCL_VBAT_BCL_GAIN_UPD7, 0x01 }, 934af3d54b9SSrinivas Kandagatla { CDC_RX_BCL_VBAT_BCL_GAIN_UPD8, 0x00 }, 935af3d54b9SSrinivas Kandagatla { CDC_RX_BCL_VBAT_BCL_GAIN_UPD9, 0x00 }, 936af3d54b9SSrinivas Kandagatla { CDC_RX_BCL_VBAT_ATTN1, 0x04 }, 937af3d54b9SSrinivas Kandagatla { CDC_RX_BCL_VBAT_ATTN2, 0x08 }, 938af3d54b9SSrinivas Kandagatla { CDC_RX_BCL_VBAT_ATTN3, 0x0C }, 939af3d54b9SSrinivas Kandagatla { CDC_RX_BCL_VBAT_DECODE_CTL1, 0xE0 }, 940af3d54b9SSrinivas Kandagatla { CDC_RX_BCL_VBAT_DECODE_CTL2, 0x00 }, 941af3d54b9SSrinivas Kandagatla { CDC_RX_BCL_VBAT_DECODE_CFG1, 0x00 }, 942af3d54b9SSrinivas Kandagatla { CDC_RX_BCL_VBAT_DECODE_CFG2, 0x00 }, 943af3d54b9SSrinivas Kandagatla { CDC_RX_BCL_VBAT_DECODE_CFG3, 0x00 }, 944af3d54b9SSrinivas Kandagatla { CDC_RX_BCL_VBAT_DECODE_CFG4, 0x00 }, 945af3d54b9SSrinivas Kandagatla { CDC_RX_BCL_VBAT_DECODE_ST, 0x00 }, 946af3d54b9SSrinivas Kandagatla { CDC_RX_INTR_CTRL_CFG, 0x00 }, 947af3d54b9SSrinivas Kandagatla { CDC_RX_INTR_CTRL_CLR_COMMIT, 0x00 }, 948af3d54b9SSrinivas Kandagatla { CDC_RX_INTR_CTRL_PIN1_MASK0, 0xFF }, 949af3d54b9SSrinivas Kandagatla { CDC_RX_INTR_CTRL_PIN1_STATUS0, 0x00 }, 950af3d54b9SSrinivas Kandagatla { CDC_RX_INTR_CTRL_PIN1_CLEAR0, 0x00 }, 951af3d54b9SSrinivas Kandagatla { CDC_RX_INTR_CTRL_PIN2_MASK0, 0xFF }, 952af3d54b9SSrinivas Kandagatla { CDC_RX_INTR_CTRL_PIN2_STATUS0, 0x00 }, 953af3d54b9SSrinivas Kandagatla { CDC_RX_INTR_CTRL_PIN2_CLEAR0, 0x00 }, 954af3d54b9SSrinivas Kandagatla { CDC_RX_INTR_CTRL_LEVEL0, 0x00 }, 955af3d54b9SSrinivas Kandagatla { CDC_RX_INTR_CTRL_BYPASS0, 0x00 }, 956af3d54b9SSrinivas Kandagatla { CDC_RX_INTR_CTRL_SET0, 0x00 }, 957af3d54b9SSrinivas Kandagatla { CDC_RX_RX0_RX_PATH_CTL, 0x04 }, 958af3d54b9SSrinivas Kandagatla { CDC_RX_RX0_RX_PATH_CFG0, 0x00 }, 959af3d54b9SSrinivas Kandagatla { CDC_RX_RX0_RX_PATH_CFG1, 0x64 }, 960af3d54b9SSrinivas Kandagatla { CDC_RX_RX0_RX_PATH_CFG2, 0x8F }, 961af3d54b9SSrinivas Kandagatla { CDC_RX_RX0_RX_PATH_CFG3, 0x00 }, 962af3d54b9SSrinivas Kandagatla { CDC_RX_RX0_RX_VOL_CTL, 0x00 }, 963af3d54b9SSrinivas Kandagatla { CDC_RX_RX0_RX_PATH_MIX_CTL, 0x04 }, 964af3d54b9SSrinivas Kandagatla { CDC_RX_RX0_RX_PATH_MIX_CFG, 0x7E }, 965af3d54b9SSrinivas Kandagatla { CDC_RX_RX0_RX_VOL_MIX_CTL, 0x00 }, 966af3d54b9SSrinivas Kandagatla { CDC_RX_RX0_RX_PATH_SEC1, 0x08 }, 967af3d54b9SSrinivas Kandagatla { CDC_RX_RX0_RX_PATH_SEC2, 0x00 }, 968af3d54b9SSrinivas Kandagatla { CDC_RX_RX0_RX_PATH_SEC3, 0x00 }, 969af3d54b9SSrinivas Kandagatla { CDC_RX_RX0_RX_PATH_SEC4, 0x00 }, 970af3d54b9SSrinivas Kandagatla { CDC_RX_RX0_RX_PATH_SEC7, 0x00 }, 971af3d54b9SSrinivas Kandagatla { CDC_RX_RX0_RX_PATH_MIX_SEC0, 0x08 }, 972af3d54b9SSrinivas Kandagatla { CDC_RX_RX0_RX_PATH_MIX_SEC1, 0x00 }, 973af3d54b9SSrinivas Kandagatla { CDC_RX_RX0_RX_PATH_DSM_CTL, 0x08 }, 974af3d54b9SSrinivas Kandagatla { CDC_RX_RX0_RX_PATH_DSM_DATA1, 0x00 }, 975af3d54b9SSrinivas Kandagatla { CDC_RX_RX0_RX_PATH_DSM_DATA2, 0x00 }, 976af3d54b9SSrinivas Kandagatla { CDC_RX_RX0_RX_PATH_DSM_DATA3, 0x00 }, 977af3d54b9SSrinivas Kandagatla { CDC_RX_RX0_RX_PATH_DSM_DATA4, 0x55 }, 978af3d54b9SSrinivas Kandagatla { CDC_RX_RX0_RX_PATH_DSM_DATA5, 0x55 }, 979af3d54b9SSrinivas Kandagatla { CDC_RX_RX0_RX_PATH_DSM_DATA6, 0x55 }, 980af3d54b9SSrinivas Kandagatla { CDC_RX_RX1_RX_PATH_CTL, 0x04 }, 981af3d54b9SSrinivas Kandagatla { CDC_RX_RX1_RX_PATH_CFG0, 0x00 }, 982af3d54b9SSrinivas Kandagatla { CDC_RX_RX1_RX_PATH_CFG1, 0x64 }, 983af3d54b9SSrinivas Kandagatla { CDC_RX_RX1_RX_PATH_CFG2, 0x8F }, 984af3d54b9SSrinivas Kandagatla { CDC_RX_RX1_RX_PATH_CFG3, 0x00 }, 985af3d54b9SSrinivas Kandagatla { CDC_RX_RX1_RX_VOL_CTL, 0x00 }, 986af3d54b9SSrinivas Kandagatla { CDC_RX_RX1_RX_PATH_MIX_CTL, 0x04 }, 987af3d54b9SSrinivas Kandagatla { CDC_RX_RX1_RX_PATH_MIX_CFG, 0x7E }, 988af3d54b9SSrinivas Kandagatla { CDC_RX_RX1_RX_VOL_MIX_CTL, 0x00 }, 989af3d54b9SSrinivas Kandagatla { CDC_RX_RX1_RX_PATH_SEC1, 0x08 }, 990af3d54b9SSrinivas Kandagatla { CDC_RX_RX1_RX_PATH_SEC2, 0x00 }, 991af3d54b9SSrinivas Kandagatla { CDC_RX_RX1_RX_PATH_SEC3, 0x00 }, 992af3d54b9SSrinivas Kandagatla { CDC_RX_RX1_RX_PATH_SEC4, 0x00 }, 993af3d54b9SSrinivas Kandagatla { CDC_RX_RX1_RX_PATH_SEC7, 0x00 }, 994af3d54b9SSrinivas Kandagatla { CDC_RX_RX1_RX_PATH_MIX_SEC0, 0x08 }, 995af3d54b9SSrinivas Kandagatla { CDC_RX_RX1_RX_PATH_MIX_SEC1, 0x00 }, 996af3d54b9SSrinivas Kandagatla { CDC_RX_RX1_RX_PATH_DSM_CTL, 0x08 }, 997af3d54b9SSrinivas Kandagatla { CDC_RX_RX1_RX_PATH_DSM_DATA1, 0x00 }, 998af3d54b9SSrinivas Kandagatla { CDC_RX_RX1_RX_PATH_DSM_DATA2, 0x00 }, 999af3d54b9SSrinivas Kandagatla { CDC_RX_RX1_RX_PATH_DSM_DATA3, 0x00 }, 1000af3d54b9SSrinivas Kandagatla { CDC_RX_RX1_RX_PATH_DSM_DATA4, 0x55 }, 1001af3d54b9SSrinivas Kandagatla { CDC_RX_RX1_RX_PATH_DSM_DATA5, 0x55 }, 1002af3d54b9SSrinivas Kandagatla { CDC_RX_RX1_RX_PATH_DSM_DATA6, 0x55 }, 1003af3d54b9SSrinivas Kandagatla { CDC_RX_RX2_RX_PATH_CTL, 0x04 }, 1004af3d54b9SSrinivas Kandagatla { CDC_RX_RX2_RX_PATH_CFG0, 0x00 }, 1005af3d54b9SSrinivas Kandagatla { CDC_RX_RX2_RX_PATH_CFG1, 0x64 }, 1006af3d54b9SSrinivas Kandagatla { CDC_RX_RX2_RX_PATH_CFG2, 0x8F }, 1007af3d54b9SSrinivas Kandagatla { CDC_RX_RX2_RX_PATH_CFG3, 0x00 }, 1008af3d54b9SSrinivas Kandagatla { CDC_RX_RX2_RX_VOL_CTL, 0x00 }, 1009af3d54b9SSrinivas Kandagatla { CDC_RX_RX2_RX_PATH_MIX_CTL, 0x04 }, 1010af3d54b9SSrinivas Kandagatla { CDC_RX_RX2_RX_PATH_MIX_CFG, 0x7E }, 1011af3d54b9SSrinivas Kandagatla { CDC_RX_RX2_RX_VOL_MIX_CTL, 0x00 }, 1012af3d54b9SSrinivas Kandagatla { CDC_RX_RX2_RX_PATH_SEC0, 0x04 }, 1013af3d54b9SSrinivas Kandagatla { CDC_RX_RX2_RX_PATH_SEC1, 0x08 }, 1014af3d54b9SSrinivas Kandagatla { CDC_RX_RX2_RX_PATH_SEC2, 0x00 }, 1015af3d54b9SSrinivas Kandagatla { CDC_RX_RX2_RX_PATH_SEC3, 0x00 }, 1016af3d54b9SSrinivas Kandagatla { CDC_RX_RX2_RX_PATH_SEC4, 0x00 }, 1017af3d54b9SSrinivas Kandagatla { CDC_RX_RX2_RX_PATH_SEC5, 0x00 }, 1018af3d54b9SSrinivas Kandagatla { CDC_RX_RX2_RX_PATH_SEC6, 0x00 }, 1019af3d54b9SSrinivas Kandagatla { CDC_RX_RX2_RX_PATH_SEC7, 0x00 }, 1020af3d54b9SSrinivas Kandagatla { CDC_RX_RX2_RX_PATH_MIX_SEC0, 0x08 }, 1021af3d54b9SSrinivas Kandagatla { CDC_RX_RX2_RX_PATH_MIX_SEC1, 0x00 }, 1022af3d54b9SSrinivas Kandagatla { CDC_RX_RX2_RX_PATH_DSM_CTL, 0x00 }, 1023af3d54b9SSrinivas Kandagatla { CDC_RX_IDLE_DETECT_PATH_CTL, 0x00 }, 1024af3d54b9SSrinivas Kandagatla { CDC_RX_IDLE_DETECT_CFG0, 0x07 }, 1025af3d54b9SSrinivas Kandagatla { CDC_RX_IDLE_DETECT_CFG1, 0x3C }, 1026af3d54b9SSrinivas Kandagatla { CDC_RX_IDLE_DETECT_CFG2, 0x00 }, 1027af3d54b9SSrinivas Kandagatla { CDC_RX_IDLE_DETECT_CFG3, 0x00 }, 1028af3d54b9SSrinivas Kandagatla { CDC_RX_COMPANDER0_CTL0, 0x60 }, 1029af3d54b9SSrinivas Kandagatla { CDC_RX_COMPANDER0_CTL1, 0xDB }, 1030af3d54b9SSrinivas Kandagatla { CDC_RX_COMPANDER0_CTL2, 0xFF }, 1031af3d54b9SSrinivas Kandagatla { CDC_RX_COMPANDER0_CTL3, 0x35 }, 1032af3d54b9SSrinivas Kandagatla { CDC_RX_COMPANDER0_CTL4, 0xFF }, 1033af3d54b9SSrinivas Kandagatla { CDC_RX_COMPANDER0_CTL5, 0x00 }, 1034af3d54b9SSrinivas Kandagatla { CDC_RX_COMPANDER0_CTL6, 0x01 }, 1035af3d54b9SSrinivas Kandagatla { CDC_RX_COMPANDER0_CTL7, 0x28 }, 1036af3d54b9SSrinivas Kandagatla { CDC_RX_COMPANDER1_CTL0, 0x60 }, 1037af3d54b9SSrinivas Kandagatla { CDC_RX_COMPANDER1_CTL1, 0xDB }, 1038af3d54b9SSrinivas Kandagatla { CDC_RX_COMPANDER1_CTL2, 0xFF }, 1039af3d54b9SSrinivas Kandagatla { CDC_RX_COMPANDER1_CTL3, 0x35 }, 1040af3d54b9SSrinivas Kandagatla { CDC_RX_COMPANDER1_CTL4, 0xFF }, 1041af3d54b9SSrinivas Kandagatla { CDC_RX_COMPANDER1_CTL5, 0x00 }, 1042af3d54b9SSrinivas Kandagatla { CDC_RX_COMPANDER1_CTL6, 0x01 }, 1043af3d54b9SSrinivas Kandagatla { CDC_RX_COMPANDER1_CTL7, 0x28 }, 1044af3d54b9SSrinivas Kandagatla { CDC_RX_SIDETONE_IIR0_IIR_PATH_CTL, 0x00 }, 1045af3d54b9SSrinivas Kandagatla { CDC_RX_SIDETONE_IIR0_IIR_GAIN_B1_CTL, 0x00 }, 1046af3d54b9SSrinivas Kandagatla { CDC_RX_SIDETONE_IIR0_IIR_GAIN_B2_CTL, 0x00 }, 1047af3d54b9SSrinivas Kandagatla { CDC_RX_SIDETONE_IIR0_IIR_GAIN_B3_CTL, 0x00 }, 1048af3d54b9SSrinivas Kandagatla { CDC_RX_SIDETONE_IIR0_IIR_GAIN_B4_CTL, 0x00 }, 1049af3d54b9SSrinivas Kandagatla { CDC_RX_SIDETONE_IIR0_IIR_GAIN_B5_CTL, 0x00 }, 1050af3d54b9SSrinivas Kandagatla { CDC_RX_SIDETONE_IIR0_IIR_GAIN_B6_CTL, 0x00 }, 1051af3d54b9SSrinivas Kandagatla { CDC_RX_SIDETONE_IIR0_IIR_GAIN_B7_CTL, 0x00 }, 1052af3d54b9SSrinivas Kandagatla { CDC_RX_SIDETONE_IIR0_IIR_GAIN_B8_CTL, 0x00 }, 1053af3d54b9SSrinivas Kandagatla { CDC_RX_SIDETONE_IIR0_IIR_CTL, 0x40 }, 1054af3d54b9SSrinivas Kandagatla { CDC_RX_SIDETONE_IIR0_IIR_GAIN_TIMER_CTL, 0x00 }, 1055af3d54b9SSrinivas Kandagatla { CDC_RX_SIDETONE_IIR0_IIR_COEF_B1_CTL, 0x00 }, 1056af3d54b9SSrinivas Kandagatla { CDC_RX_SIDETONE_IIR0_IIR_COEF_B2_CTL, 0x00 }, 1057af3d54b9SSrinivas Kandagatla { CDC_RX_SIDETONE_IIR1_IIR_PATH_CTL, 0x00 }, 1058af3d54b9SSrinivas Kandagatla { CDC_RX_SIDETONE_IIR1_IIR_GAIN_B1_CTL, 0x00 }, 1059af3d54b9SSrinivas Kandagatla { CDC_RX_SIDETONE_IIR1_IIR_GAIN_B2_CTL, 0x00 }, 1060af3d54b9SSrinivas Kandagatla { CDC_RX_SIDETONE_IIR1_IIR_GAIN_B3_CTL, 0x00 }, 1061af3d54b9SSrinivas Kandagatla { CDC_RX_SIDETONE_IIR1_IIR_GAIN_B4_CTL, 0x00 }, 1062af3d54b9SSrinivas Kandagatla { CDC_RX_SIDETONE_IIR1_IIR_GAIN_B5_CTL, 0x00 }, 1063af3d54b9SSrinivas Kandagatla { CDC_RX_SIDETONE_IIR1_IIR_GAIN_B6_CTL, 0x00 }, 1064af3d54b9SSrinivas Kandagatla { CDC_RX_SIDETONE_IIR1_IIR_GAIN_B7_CTL, 0x00 }, 1065af3d54b9SSrinivas Kandagatla { CDC_RX_SIDETONE_IIR1_IIR_GAIN_B8_CTL, 0x00 }, 1066af3d54b9SSrinivas Kandagatla { CDC_RX_SIDETONE_IIR1_IIR_CTL, 0x40 }, 1067af3d54b9SSrinivas Kandagatla { CDC_RX_SIDETONE_IIR1_IIR_GAIN_TIMER_CTL, 0x00 }, 1068af3d54b9SSrinivas Kandagatla { CDC_RX_SIDETONE_IIR1_IIR_COEF_B1_CTL, 0x00 }, 1069af3d54b9SSrinivas Kandagatla { CDC_RX_SIDETONE_IIR1_IIR_COEF_B2_CTL, 0x00 }, 1070af3d54b9SSrinivas Kandagatla { CDC_RX_IIR_INP_MUX_IIR0_MIX_CFG0, 0x00 }, 1071af3d54b9SSrinivas Kandagatla { CDC_RX_IIR_INP_MUX_IIR0_MIX_CFG1, 0x00 }, 1072af3d54b9SSrinivas Kandagatla { CDC_RX_IIR_INP_MUX_IIR0_MIX_CFG2, 0x00 }, 1073af3d54b9SSrinivas Kandagatla { CDC_RX_IIR_INP_MUX_IIR0_MIX_CFG3, 0x00 }, 1074af3d54b9SSrinivas Kandagatla { CDC_RX_IIR_INP_MUX_IIR1_MIX_CFG0, 0x00 }, 1075af3d54b9SSrinivas Kandagatla { CDC_RX_IIR_INP_MUX_IIR1_MIX_CFG1, 0x00 }, 1076af3d54b9SSrinivas Kandagatla { CDC_RX_IIR_INP_MUX_IIR1_MIX_CFG2, 0x00 }, 1077af3d54b9SSrinivas Kandagatla { CDC_RX_IIR_INP_MUX_IIR1_MIX_CFG3, 0x00 }, 1078af3d54b9SSrinivas Kandagatla { CDC_RX_SIDETONE_SRC0_ST_SRC_PATH_CTL, 0x04 }, 1079af3d54b9SSrinivas Kandagatla { CDC_RX_SIDETONE_SRC0_ST_SRC_PATH_CFG1, 0x00 }, 1080af3d54b9SSrinivas Kandagatla { CDC_RX_SIDETONE_SRC1_ST_SRC_PATH_CTL, 0x04 }, 1081af3d54b9SSrinivas Kandagatla { CDC_RX_SIDETONE_SRC1_ST_SRC_PATH_CFG1, 0x00 }, 1082af3d54b9SSrinivas Kandagatla { CDC_RX_EC_REF_HQ0_EC_REF_HQ_PATH_CTL, 0x00 }, 1083af3d54b9SSrinivas Kandagatla { CDC_RX_EC_REF_HQ0_EC_REF_HQ_CFG0, 0x01 }, 1084af3d54b9SSrinivas Kandagatla { CDC_RX_EC_REF_HQ1_EC_REF_HQ_PATH_CTL, 0x00 }, 1085af3d54b9SSrinivas Kandagatla { CDC_RX_EC_REF_HQ1_EC_REF_HQ_CFG0, 0x01 }, 1086af3d54b9SSrinivas Kandagatla { CDC_RX_EC_REF_HQ2_EC_REF_HQ_PATH_CTL, 0x00 }, 1087af3d54b9SSrinivas Kandagatla { CDC_RX_EC_REF_HQ2_EC_REF_HQ_CFG0, 0x01 }, 1088af3d54b9SSrinivas Kandagatla { CDC_RX_EC_ASRC0_CLK_RST_CTL, 0x00 }, 1089af3d54b9SSrinivas Kandagatla { CDC_RX_EC_ASRC0_CTL0, 0x00 }, 1090af3d54b9SSrinivas Kandagatla { CDC_RX_EC_ASRC0_CTL1, 0x00 }, 1091af3d54b9SSrinivas Kandagatla { CDC_RX_EC_ASRC0_FIFO_CTL, 0xA8 }, 1092af3d54b9SSrinivas Kandagatla { CDC_RX_EC_ASRC0_STATUS_FMIN_CNTR_LSB, 0x00 }, 1093af3d54b9SSrinivas Kandagatla { CDC_RX_EC_ASRC0_STATUS_FMIN_CNTR_MSB, 0x00 }, 1094af3d54b9SSrinivas Kandagatla { CDC_RX_EC_ASRC0_STATUS_FMAX_CNTR_LSB, 0x00 }, 1095af3d54b9SSrinivas Kandagatla { CDC_RX_EC_ASRC0_STATUS_FMAX_CNTR_MSB, 0x00 }, 1096af3d54b9SSrinivas Kandagatla { CDC_RX_EC_ASRC0_STATUS_FIFO, 0x00 }, 1097af3d54b9SSrinivas Kandagatla { CDC_RX_EC_ASRC1_CLK_RST_CTL, 0x00 }, 1098af3d54b9SSrinivas Kandagatla { CDC_RX_EC_ASRC1_CTL0, 0x00 }, 1099af3d54b9SSrinivas Kandagatla { CDC_RX_EC_ASRC1_CTL1, 0x00 }, 1100af3d54b9SSrinivas Kandagatla { CDC_RX_EC_ASRC1_FIFO_CTL, 0xA8 }, 1101af3d54b9SSrinivas Kandagatla { CDC_RX_EC_ASRC1_STATUS_FMIN_CNTR_LSB, 0x00 }, 1102af3d54b9SSrinivas Kandagatla { CDC_RX_EC_ASRC1_STATUS_FMIN_CNTR_MSB, 0x00 }, 1103af3d54b9SSrinivas Kandagatla { CDC_RX_EC_ASRC1_STATUS_FMAX_CNTR_LSB, 0x00 }, 1104af3d54b9SSrinivas Kandagatla { CDC_RX_EC_ASRC1_STATUS_FMAX_CNTR_MSB, 0x00 }, 1105af3d54b9SSrinivas Kandagatla { CDC_RX_EC_ASRC1_STATUS_FIFO, 0x00 }, 1106af3d54b9SSrinivas Kandagatla { CDC_RX_EC_ASRC2_CLK_RST_CTL, 0x00 }, 1107af3d54b9SSrinivas Kandagatla { CDC_RX_EC_ASRC2_CTL0, 0x00 }, 1108af3d54b9SSrinivas Kandagatla { CDC_RX_EC_ASRC2_CTL1, 0x00 }, 1109af3d54b9SSrinivas Kandagatla { CDC_RX_EC_ASRC2_FIFO_CTL, 0xA8 }, 1110af3d54b9SSrinivas Kandagatla { CDC_RX_EC_ASRC2_STATUS_FMIN_CNTR_LSB, 0x00 }, 1111af3d54b9SSrinivas Kandagatla { CDC_RX_EC_ASRC2_STATUS_FMIN_CNTR_MSB, 0x00 }, 1112af3d54b9SSrinivas Kandagatla { CDC_RX_EC_ASRC2_STATUS_FMAX_CNTR_LSB, 0x00 }, 1113af3d54b9SSrinivas Kandagatla { CDC_RX_EC_ASRC2_STATUS_FMAX_CNTR_MSB, 0x00 }, 1114af3d54b9SSrinivas Kandagatla { CDC_RX_EC_ASRC2_STATUS_FIFO, 0x00 }, 1115af3d54b9SSrinivas Kandagatla { CDC_RX_DSD0_PATH_CTL, 0x00 }, 1116af3d54b9SSrinivas Kandagatla { CDC_RX_DSD0_CFG0, 0x00 }, 1117af3d54b9SSrinivas Kandagatla { CDC_RX_DSD0_CFG1, 0x62 }, 1118af3d54b9SSrinivas Kandagatla { CDC_RX_DSD0_CFG2, 0x96 }, 1119af3d54b9SSrinivas Kandagatla { CDC_RX_DSD1_PATH_CTL, 0x00 }, 1120af3d54b9SSrinivas Kandagatla { CDC_RX_DSD1_CFG0, 0x00 }, 1121af3d54b9SSrinivas Kandagatla { CDC_RX_DSD1_CFG1, 0x62 }, 1122af3d54b9SSrinivas Kandagatla { CDC_RX_DSD1_CFG2, 0x96 }, 1123af3d54b9SSrinivas Kandagatla }; 1124af3d54b9SSrinivas Kandagatla 1125af3d54b9SSrinivas Kandagatla static bool rx_is_wronly_register(struct device *dev, 1126af3d54b9SSrinivas Kandagatla unsigned int reg) 1127af3d54b9SSrinivas Kandagatla { 1128af3d54b9SSrinivas Kandagatla switch (reg) { 1129af3d54b9SSrinivas Kandagatla case CDC_RX_BCL_VBAT_GAIN_UPD_MON: 1130af3d54b9SSrinivas Kandagatla case CDC_RX_INTR_CTRL_CLR_COMMIT: 1131af3d54b9SSrinivas Kandagatla case CDC_RX_INTR_CTRL_PIN1_CLEAR0: 1132af3d54b9SSrinivas Kandagatla case CDC_RX_INTR_CTRL_PIN2_CLEAR0: 1133af3d54b9SSrinivas Kandagatla return true; 1134af3d54b9SSrinivas Kandagatla } 1135af3d54b9SSrinivas Kandagatla 1136af3d54b9SSrinivas Kandagatla return false; 1137af3d54b9SSrinivas Kandagatla } 1138af3d54b9SSrinivas Kandagatla 1139af3d54b9SSrinivas Kandagatla static bool rx_is_volatile_register(struct device *dev, unsigned int reg) 1140af3d54b9SSrinivas Kandagatla { 1141af3d54b9SSrinivas Kandagatla /* Update volatile list for rx/tx macros */ 1142af3d54b9SSrinivas Kandagatla switch (reg) { 1143af3d54b9SSrinivas Kandagatla case CDC_RX_TOP_HPHL_COMP_RD_LSB: 1144af3d54b9SSrinivas Kandagatla case CDC_RX_TOP_HPHL_COMP_WR_LSB: 1145af3d54b9SSrinivas Kandagatla case CDC_RX_TOP_HPHL_COMP_RD_MSB: 1146af3d54b9SSrinivas Kandagatla case CDC_RX_TOP_HPHL_COMP_WR_MSB: 1147af3d54b9SSrinivas Kandagatla case CDC_RX_TOP_HPHR_COMP_RD_LSB: 1148af3d54b9SSrinivas Kandagatla case CDC_RX_TOP_HPHR_COMP_WR_LSB: 1149af3d54b9SSrinivas Kandagatla case CDC_RX_TOP_HPHR_COMP_RD_MSB: 1150af3d54b9SSrinivas Kandagatla case CDC_RX_TOP_HPHR_COMP_WR_MSB: 1151af3d54b9SSrinivas Kandagatla case CDC_RX_TOP_DSD0_DEBUG_CFG2: 1152af3d54b9SSrinivas Kandagatla case CDC_RX_TOP_DSD1_DEBUG_CFG2: 1153af3d54b9SSrinivas Kandagatla case CDC_RX_BCL_VBAT_GAIN_MON_VAL: 1154af3d54b9SSrinivas Kandagatla case CDC_RX_BCL_VBAT_DECODE_ST: 1155af3d54b9SSrinivas Kandagatla case CDC_RX_INTR_CTRL_PIN1_STATUS0: 1156af3d54b9SSrinivas Kandagatla case CDC_RX_INTR_CTRL_PIN2_STATUS0: 1157af3d54b9SSrinivas Kandagatla case CDC_RX_COMPANDER0_CTL6: 1158af3d54b9SSrinivas Kandagatla case CDC_RX_COMPANDER1_CTL6: 1159af3d54b9SSrinivas Kandagatla case CDC_RX_EC_ASRC0_STATUS_FMIN_CNTR_LSB: 1160af3d54b9SSrinivas Kandagatla case CDC_RX_EC_ASRC0_STATUS_FMIN_CNTR_MSB: 1161af3d54b9SSrinivas Kandagatla case CDC_RX_EC_ASRC0_STATUS_FMAX_CNTR_LSB: 1162af3d54b9SSrinivas Kandagatla case CDC_RX_EC_ASRC0_STATUS_FMAX_CNTR_MSB: 1163af3d54b9SSrinivas Kandagatla case CDC_RX_EC_ASRC0_STATUS_FIFO: 1164af3d54b9SSrinivas Kandagatla case CDC_RX_EC_ASRC1_STATUS_FMIN_CNTR_LSB: 1165af3d54b9SSrinivas Kandagatla case CDC_RX_EC_ASRC1_STATUS_FMIN_CNTR_MSB: 1166af3d54b9SSrinivas Kandagatla case CDC_RX_EC_ASRC1_STATUS_FMAX_CNTR_LSB: 1167af3d54b9SSrinivas Kandagatla case CDC_RX_EC_ASRC1_STATUS_FMAX_CNTR_MSB: 1168af3d54b9SSrinivas Kandagatla case CDC_RX_EC_ASRC1_STATUS_FIFO: 1169af3d54b9SSrinivas Kandagatla case CDC_RX_EC_ASRC2_STATUS_FMIN_CNTR_LSB: 1170af3d54b9SSrinivas Kandagatla case CDC_RX_EC_ASRC2_STATUS_FMIN_CNTR_MSB: 1171af3d54b9SSrinivas Kandagatla case CDC_RX_EC_ASRC2_STATUS_FMAX_CNTR_LSB: 1172af3d54b9SSrinivas Kandagatla case CDC_RX_EC_ASRC2_STATUS_FMAX_CNTR_MSB: 1173af3d54b9SSrinivas Kandagatla case CDC_RX_EC_ASRC2_STATUS_FIFO: 1174af3d54b9SSrinivas Kandagatla return true; 1175af3d54b9SSrinivas Kandagatla } 1176af3d54b9SSrinivas Kandagatla return false; 1177af3d54b9SSrinivas Kandagatla } 1178af3d54b9SSrinivas Kandagatla 1179af3d54b9SSrinivas Kandagatla static bool rx_is_rw_register(struct device *dev, unsigned int reg) 1180af3d54b9SSrinivas Kandagatla { 1181af3d54b9SSrinivas Kandagatla switch (reg) { 1182af3d54b9SSrinivas Kandagatla case CDC_RX_TOP_TOP_CFG0: 1183af3d54b9SSrinivas Kandagatla case CDC_RX_TOP_SWR_CTRL: 1184af3d54b9SSrinivas Kandagatla case CDC_RX_TOP_DEBUG: 1185af3d54b9SSrinivas Kandagatla case CDC_RX_TOP_DEBUG_BUS: 1186af3d54b9SSrinivas Kandagatla case CDC_RX_TOP_DEBUG_EN0: 1187af3d54b9SSrinivas Kandagatla case CDC_RX_TOP_DEBUG_EN1: 1188af3d54b9SSrinivas Kandagatla case CDC_RX_TOP_DEBUG_EN2: 1189af3d54b9SSrinivas Kandagatla case CDC_RX_TOP_HPHL_COMP_WR_LSB: 1190af3d54b9SSrinivas Kandagatla case CDC_RX_TOP_HPHL_COMP_WR_MSB: 1191af3d54b9SSrinivas Kandagatla case CDC_RX_TOP_HPHL_COMP_LUT: 1192af3d54b9SSrinivas Kandagatla case CDC_RX_TOP_HPHR_COMP_WR_LSB: 1193af3d54b9SSrinivas Kandagatla case CDC_RX_TOP_HPHR_COMP_WR_MSB: 1194af3d54b9SSrinivas Kandagatla case CDC_RX_TOP_HPHR_COMP_LUT: 1195af3d54b9SSrinivas Kandagatla case CDC_RX_TOP_DSD0_DEBUG_CFG0: 1196af3d54b9SSrinivas Kandagatla case CDC_RX_TOP_DSD0_DEBUG_CFG1: 1197af3d54b9SSrinivas Kandagatla case CDC_RX_TOP_DSD0_DEBUG_CFG3: 1198af3d54b9SSrinivas Kandagatla case CDC_RX_TOP_DSD1_DEBUG_CFG0: 1199af3d54b9SSrinivas Kandagatla case CDC_RX_TOP_DSD1_DEBUG_CFG1: 1200af3d54b9SSrinivas Kandagatla case CDC_RX_TOP_DSD1_DEBUG_CFG3: 1201af3d54b9SSrinivas Kandagatla case CDC_RX_TOP_RX_I2S_CTL: 1202af3d54b9SSrinivas Kandagatla case CDC_RX_TOP_TX_I2S2_CTL: 1203af3d54b9SSrinivas Kandagatla case CDC_RX_TOP_I2S_CLK: 1204af3d54b9SSrinivas Kandagatla case CDC_RX_TOP_I2S_RESET: 1205af3d54b9SSrinivas Kandagatla case CDC_RX_TOP_I2S_MUX: 1206af3d54b9SSrinivas Kandagatla case CDC_RX_CLK_RST_CTRL_MCLK_CONTROL: 1207af3d54b9SSrinivas Kandagatla case CDC_RX_CLK_RST_CTRL_FS_CNT_CONTROL: 1208af3d54b9SSrinivas Kandagatla case CDC_RX_CLK_RST_CTRL_SWR_CONTROL: 1209af3d54b9SSrinivas Kandagatla case CDC_RX_CLK_RST_CTRL_DSD_CONTROL: 1210af3d54b9SSrinivas Kandagatla case CDC_RX_CLK_RST_CTRL_ASRC_SHARE_CONTROL: 1211af3d54b9SSrinivas Kandagatla case CDC_RX_SOFTCLIP_CRC: 1212af3d54b9SSrinivas Kandagatla case CDC_RX_SOFTCLIP_SOFTCLIP_CTRL: 1213af3d54b9SSrinivas Kandagatla case CDC_RX_INP_MUX_RX_INT0_CFG0: 1214af3d54b9SSrinivas Kandagatla case CDC_RX_INP_MUX_RX_INT0_CFG1: 1215af3d54b9SSrinivas Kandagatla case CDC_RX_INP_MUX_RX_INT1_CFG0: 1216af3d54b9SSrinivas Kandagatla case CDC_RX_INP_MUX_RX_INT1_CFG1: 1217af3d54b9SSrinivas Kandagatla case CDC_RX_INP_MUX_RX_INT2_CFG0: 1218af3d54b9SSrinivas Kandagatla case CDC_RX_INP_MUX_RX_INT2_CFG1: 1219af3d54b9SSrinivas Kandagatla case CDC_RX_INP_MUX_RX_MIX_CFG4: 1220af3d54b9SSrinivas Kandagatla case CDC_RX_INP_MUX_RX_MIX_CFG5: 1221af3d54b9SSrinivas Kandagatla case CDC_RX_INP_MUX_SIDETONE_SRC_CFG0: 1222af3d54b9SSrinivas Kandagatla case CDC_RX_CLSH_CRC: 1223af3d54b9SSrinivas Kandagatla case CDC_RX_CLSH_DLY_CTRL: 1224af3d54b9SSrinivas Kandagatla case CDC_RX_CLSH_DECAY_CTRL: 1225af3d54b9SSrinivas Kandagatla case CDC_RX_CLSH_HPH_V_PA: 1226af3d54b9SSrinivas Kandagatla case CDC_RX_CLSH_EAR_V_PA: 1227af3d54b9SSrinivas Kandagatla case CDC_RX_CLSH_HPH_V_HD: 1228af3d54b9SSrinivas Kandagatla case CDC_RX_CLSH_EAR_V_HD: 1229af3d54b9SSrinivas Kandagatla case CDC_RX_CLSH_K1_MSB: 1230af3d54b9SSrinivas Kandagatla case CDC_RX_CLSH_K1_LSB: 1231af3d54b9SSrinivas Kandagatla case CDC_RX_CLSH_K2_MSB: 1232af3d54b9SSrinivas Kandagatla case CDC_RX_CLSH_K2_LSB: 1233af3d54b9SSrinivas Kandagatla case CDC_RX_CLSH_IDLE_CTRL: 1234af3d54b9SSrinivas Kandagatla case CDC_RX_CLSH_IDLE_HPH: 1235af3d54b9SSrinivas Kandagatla case CDC_RX_CLSH_IDLE_EAR: 1236af3d54b9SSrinivas Kandagatla case CDC_RX_CLSH_TEST0: 1237af3d54b9SSrinivas Kandagatla case CDC_RX_CLSH_TEST1: 1238af3d54b9SSrinivas Kandagatla case CDC_RX_CLSH_OVR_VREF: 1239af3d54b9SSrinivas Kandagatla case CDC_RX_CLSH_CLSG_CTL: 1240af3d54b9SSrinivas Kandagatla case CDC_RX_CLSH_CLSG_CFG1: 1241af3d54b9SSrinivas Kandagatla case CDC_RX_CLSH_CLSG_CFG2: 1242af3d54b9SSrinivas Kandagatla case CDC_RX_BCL_VBAT_PATH_CTL: 1243af3d54b9SSrinivas Kandagatla case CDC_RX_BCL_VBAT_CFG: 1244af3d54b9SSrinivas Kandagatla case CDC_RX_BCL_VBAT_ADC_CAL1: 1245af3d54b9SSrinivas Kandagatla case CDC_RX_BCL_VBAT_ADC_CAL2: 1246af3d54b9SSrinivas Kandagatla case CDC_RX_BCL_VBAT_ADC_CAL3: 1247af3d54b9SSrinivas Kandagatla case CDC_RX_BCL_VBAT_PK_EST1: 1248af3d54b9SSrinivas Kandagatla case CDC_RX_BCL_VBAT_PK_EST2: 1249af3d54b9SSrinivas Kandagatla case CDC_RX_BCL_VBAT_PK_EST3: 1250af3d54b9SSrinivas Kandagatla case CDC_RX_BCL_VBAT_RF_PROC1: 1251af3d54b9SSrinivas Kandagatla case CDC_RX_BCL_VBAT_RF_PROC2: 1252af3d54b9SSrinivas Kandagatla case CDC_RX_BCL_VBAT_TAC1: 1253af3d54b9SSrinivas Kandagatla case CDC_RX_BCL_VBAT_TAC2: 1254af3d54b9SSrinivas Kandagatla case CDC_RX_BCL_VBAT_TAC3: 1255af3d54b9SSrinivas Kandagatla case CDC_RX_BCL_VBAT_TAC4: 1256af3d54b9SSrinivas Kandagatla case CDC_RX_BCL_VBAT_GAIN_UPD1: 1257af3d54b9SSrinivas Kandagatla case CDC_RX_BCL_VBAT_GAIN_UPD2: 1258af3d54b9SSrinivas Kandagatla case CDC_RX_BCL_VBAT_GAIN_UPD3: 1259af3d54b9SSrinivas Kandagatla case CDC_RX_BCL_VBAT_GAIN_UPD4: 1260af3d54b9SSrinivas Kandagatla case CDC_RX_BCL_VBAT_GAIN_UPD5: 1261af3d54b9SSrinivas Kandagatla case CDC_RX_BCL_VBAT_DEBUG1: 1262af3d54b9SSrinivas Kandagatla case CDC_RX_BCL_VBAT_BAN: 1263af3d54b9SSrinivas Kandagatla case CDC_RX_BCL_VBAT_BCL_GAIN_UPD1: 1264af3d54b9SSrinivas Kandagatla case CDC_RX_BCL_VBAT_BCL_GAIN_UPD2: 1265af3d54b9SSrinivas Kandagatla case CDC_RX_BCL_VBAT_BCL_GAIN_UPD3: 1266af3d54b9SSrinivas Kandagatla case CDC_RX_BCL_VBAT_BCL_GAIN_UPD4: 1267af3d54b9SSrinivas Kandagatla case CDC_RX_BCL_VBAT_BCL_GAIN_UPD5: 1268af3d54b9SSrinivas Kandagatla case CDC_RX_BCL_VBAT_BCL_GAIN_UPD6: 1269af3d54b9SSrinivas Kandagatla case CDC_RX_BCL_VBAT_BCL_GAIN_UPD7: 1270af3d54b9SSrinivas Kandagatla case CDC_RX_BCL_VBAT_BCL_GAIN_UPD8: 1271af3d54b9SSrinivas Kandagatla case CDC_RX_BCL_VBAT_BCL_GAIN_UPD9: 1272af3d54b9SSrinivas Kandagatla case CDC_RX_BCL_VBAT_ATTN1: 1273af3d54b9SSrinivas Kandagatla case CDC_RX_BCL_VBAT_ATTN2: 1274af3d54b9SSrinivas Kandagatla case CDC_RX_BCL_VBAT_ATTN3: 1275af3d54b9SSrinivas Kandagatla case CDC_RX_BCL_VBAT_DECODE_CTL1: 1276af3d54b9SSrinivas Kandagatla case CDC_RX_BCL_VBAT_DECODE_CTL2: 1277af3d54b9SSrinivas Kandagatla case CDC_RX_BCL_VBAT_DECODE_CFG1: 1278af3d54b9SSrinivas Kandagatla case CDC_RX_BCL_VBAT_DECODE_CFG2: 1279af3d54b9SSrinivas Kandagatla case CDC_RX_BCL_VBAT_DECODE_CFG3: 1280af3d54b9SSrinivas Kandagatla case CDC_RX_BCL_VBAT_DECODE_CFG4: 1281af3d54b9SSrinivas Kandagatla case CDC_RX_INTR_CTRL_CFG: 1282af3d54b9SSrinivas Kandagatla case CDC_RX_INTR_CTRL_PIN1_MASK0: 1283af3d54b9SSrinivas Kandagatla case CDC_RX_INTR_CTRL_PIN2_MASK0: 1284af3d54b9SSrinivas Kandagatla case CDC_RX_INTR_CTRL_LEVEL0: 1285af3d54b9SSrinivas Kandagatla case CDC_RX_INTR_CTRL_BYPASS0: 1286af3d54b9SSrinivas Kandagatla case CDC_RX_INTR_CTRL_SET0: 1287af3d54b9SSrinivas Kandagatla case CDC_RX_RX0_RX_PATH_CTL: 1288af3d54b9SSrinivas Kandagatla case CDC_RX_RX0_RX_PATH_CFG0: 1289af3d54b9SSrinivas Kandagatla case CDC_RX_RX0_RX_PATH_CFG1: 1290af3d54b9SSrinivas Kandagatla case CDC_RX_RX0_RX_PATH_CFG2: 1291af3d54b9SSrinivas Kandagatla case CDC_RX_RX0_RX_PATH_CFG3: 1292af3d54b9SSrinivas Kandagatla case CDC_RX_RX0_RX_VOL_CTL: 1293af3d54b9SSrinivas Kandagatla case CDC_RX_RX0_RX_PATH_MIX_CTL: 1294af3d54b9SSrinivas Kandagatla case CDC_RX_RX0_RX_PATH_MIX_CFG: 1295af3d54b9SSrinivas Kandagatla case CDC_RX_RX0_RX_VOL_MIX_CTL: 1296af3d54b9SSrinivas Kandagatla case CDC_RX_RX0_RX_PATH_SEC1: 1297af3d54b9SSrinivas Kandagatla case CDC_RX_RX0_RX_PATH_SEC2: 1298af3d54b9SSrinivas Kandagatla case CDC_RX_RX0_RX_PATH_SEC3: 1299af3d54b9SSrinivas Kandagatla case CDC_RX_RX0_RX_PATH_SEC4: 1300af3d54b9SSrinivas Kandagatla case CDC_RX_RX0_RX_PATH_SEC7: 1301af3d54b9SSrinivas Kandagatla case CDC_RX_RX0_RX_PATH_MIX_SEC0: 1302af3d54b9SSrinivas Kandagatla case CDC_RX_RX0_RX_PATH_MIX_SEC1: 1303af3d54b9SSrinivas Kandagatla case CDC_RX_RX0_RX_PATH_DSM_CTL: 1304af3d54b9SSrinivas Kandagatla case CDC_RX_RX0_RX_PATH_DSM_DATA1: 1305af3d54b9SSrinivas Kandagatla case CDC_RX_RX0_RX_PATH_DSM_DATA2: 1306af3d54b9SSrinivas Kandagatla case CDC_RX_RX0_RX_PATH_DSM_DATA3: 1307af3d54b9SSrinivas Kandagatla case CDC_RX_RX0_RX_PATH_DSM_DATA4: 1308af3d54b9SSrinivas Kandagatla case CDC_RX_RX0_RX_PATH_DSM_DATA5: 1309af3d54b9SSrinivas Kandagatla case CDC_RX_RX0_RX_PATH_DSM_DATA6: 1310af3d54b9SSrinivas Kandagatla case CDC_RX_RX1_RX_PATH_CTL: 1311af3d54b9SSrinivas Kandagatla case CDC_RX_RX1_RX_PATH_CFG0: 1312af3d54b9SSrinivas Kandagatla case CDC_RX_RX1_RX_PATH_CFG1: 1313af3d54b9SSrinivas Kandagatla case CDC_RX_RX1_RX_PATH_CFG2: 1314af3d54b9SSrinivas Kandagatla case CDC_RX_RX1_RX_PATH_CFG3: 1315af3d54b9SSrinivas Kandagatla case CDC_RX_RX1_RX_VOL_CTL: 1316af3d54b9SSrinivas Kandagatla case CDC_RX_RX1_RX_PATH_MIX_CTL: 1317af3d54b9SSrinivas Kandagatla case CDC_RX_RX1_RX_PATH_MIX_CFG: 1318af3d54b9SSrinivas Kandagatla case CDC_RX_RX1_RX_VOL_MIX_CTL: 1319af3d54b9SSrinivas Kandagatla case CDC_RX_RX1_RX_PATH_SEC1: 1320af3d54b9SSrinivas Kandagatla case CDC_RX_RX1_RX_PATH_SEC2: 1321af3d54b9SSrinivas Kandagatla case CDC_RX_RX1_RX_PATH_SEC3: 1322af3d54b9SSrinivas Kandagatla case CDC_RX_RX1_RX_PATH_SEC4: 1323af3d54b9SSrinivas Kandagatla case CDC_RX_RX1_RX_PATH_SEC7: 1324af3d54b9SSrinivas Kandagatla case CDC_RX_RX1_RX_PATH_MIX_SEC0: 1325af3d54b9SSrinivas Kandagatla case CDC_RX_RX1_RX_PATH_MIX_SEC1: 1326af3d54b9SSrinivas Kandagatla case CDC_RX_RX1_RX_PATH_DSM_CTL: 1327af3d54b9SSrinivas Kandagatla case CDC_RX_RX1_RX_PATH_DSM_DATA1: 1328af3d54b9SSrinivas Kandagatla case CDC_RX_RX1_RX_PATH_DSM_DATA2: 1329af3d54b9SSrinivas Kandagatla case CDC_RX_RX1_RX_PATH_DSM_DATA3: 1330af3d54b9SSrinivas Kandagatla case CDC_RX_RX1_RX_PATH_DSM_DATA4: 1331af3d54b9SSrinivas Kandagatla case CDC_RX_RX1_RX_PATH_DSM_DATA5: 1332af3d54b9SSrinivas Kandagatla case CDC_RX_RX1_RX_PATH_DSM_DATA6: 1333af3d54b9SSrinivas Kandagatla case CDC_RX_RX2_RX_PATH_CTL: 1334af3d54b9SSrinivas Kandagatla case CDC_RX_RX2_RX_PATH_CFG0: 1335af3d54b9SSrinivas Kandagatla case CDC_RX_RX2_RX_PATH_CFG1: 1336af3d54b9SSrinivas Kandagatla case CDC_RX_RX2_RX_PATH_CFG2: 1337af3d54b9SSrinivas Kandagatla case CDC_RX_RX2_RX_PATH_CFG3: 1338af3d54b9SSrinivas Kandagatla case CDC_RX_RX2_RX_VOL_CTL: 1339af3d54b9SSrinivas Kandagatla case CDC_RX_RX2_RX_PATH_MIX_CTL: 1340af3d54b9SSrinivas Kandagatla case CDC_RX_RX2_RX_PATH_MIX_CFG: 1341af3d54b9SSrinivas Kandagatla case CDC_RX_RX2_RX_VOL_MIX_CTL: 1342af3d54b9SSrinivas Kandagatla case CDC_RX_RX2_RX_PATH_SEC0: 1343af3d54b9SSrinivas Kandagatla case CDC_RX_RX2_RX_PATH_SEC1: 1344af3d54b9SSrinivas Kandagatla case CDC_RX_RX2_RX_PATH_SEC2: 1345af3d54b9SSrinivas Kandagatla case CDC_RX_RX2_RX_PATH_SEC3: 1346af3d54b9SSrinivas Kandagatla case CDC_RX_RX2_RX_PATH_SEC4: 1347af3d54b9SSrinivas Kandagatla case CDC_RX_RX2_RX_PATH_SEC5: 1348af3d54b9SSrinivas Kandagatla case CDC_RX_RX2_RX_PATH_SEC6: 1349af3d54b9SSrinivas Kandagatla case CDC_RX_RX2_RX_PATH_SEC7: 1350af3d54b9SSrinivas Kandagatla case CDC_RX_RX2_RX_PATH_MIX_SEC0: 1351af3d54b9SSrinivas Kandagatla case CDC_RX_RX2_RX_PATH_MIX_SEC1: 1352af3d54b9SSrinivas Kandagatla case CDC_RX_RX2_RX_PATH_DSM_CTL: 1353af3d54b9SSrinivas Kandagatla case CDC_RX_IDLE_DETECT_PATH_CTL: 1354af3d54b9SSrinivas Kandagatla case CDC_RX_IDLE_DETECT_CFG0: 1355af3d54b9SSrinivas Kandagatla case CDC_RX_IDLE_DETECT_CFG1: 1356af3d54b9SSrinivas Kandagatla case CDC_RX_IDLE_DETECT_CFG2: 1357af3d54b9SSrinivas Kandagatla case CDC_RX_IDLE_DETECT_CFG3: 1358af3d54b9SSrinivas Kandagatla case CDC_RX_COMPANDER0_CTL0: 1359af3d54b9SSrinivas Kandagatla case CDC_RX_COMPANDER0_CTL1: 1360af3d54b9SSrinivas Kandagatla case CDC_RX_COMPANDER0_CTL2: 1361af3d54b9SSrinivas Kandagatla case CDC_RX_COMPANDER0_CTL3: 1362af3d54b9SSrinivas Kandagatla case CDC_RX_COMPANDER0_CTL4: 1363af3d54b9SSrinivas Kandagatla case CDC_RX_COMPANDER0_CTL5: 1364af3d54b9SSrinivas Kandagatla case CDC_RX_COMPANDER0_CTL7: 1365af3d54b9SSrinivas Kandagatla case CDC_RX_COMPANDER1_CTL0: 1366af3d54b9SSrinivas Kandagatla case CDC_RX_COMPANDER1_CTL1: 1367af3d54b9SSrinivas Kandagatla case CDC_RX_COMPANDER1_CTL2: 1368af3d54b9SSrinivas Kandagatla case CDC_RX_COMPANDER1_CTL3: 1369af3d54b9SSrinivas Kandagatla case CDC_RX_COMPANDER1_CTL4: 1370af3d54b9SSrinivas Kandagatla case CDC_RX_COMPANDER1_CTL5: 1371af3d54b9SSrinivas Kandagatla case CDC_RX_COMPANDER1_CTL7: 1372af3d54b9SSrinivas Kandagatla case CDC_RX_SIDETONE_IIR0_IIR_PATH_CTL: 1373af3d54b9SSrinivas Kandagatla case CDC_RX_SIDETONE_IIR0_IIR_GAIN_B1_CTL: 1374af3d54b9SSrinivas Kandagatla case CDC_RX_SIDETONE_IIR0_IIR_GAIN_B2_CTL: 1375af3d54b9SSrinivas Kandagatla case CDC_RX_SIDETONE_IIR0_IIR_GAIN_B3_CTL: 1376af3d54b9SSrinivas Kandagatla case CDC_RX_SIDETONE_IIR0_IIR_GAIN_B4_CTL: 1377af3d54b9SSrinivas Kandagatla case CDC_RX_SIDETONE_IIR0_IIR_GAIN_B5_CTL: 1378af3d54b9SSrinivas Kandagatla case CDC_RX_SIDETONE_IIR0_IIR_GAIN_B6_CTL: 1379af3d54b9SSrinivas Kandagatla case CDC_RX_SIDETONE_IIR0_IIR_GAIN_B7_CTL: 1380af3d54b9SSrinivas Kandagatla case CDC_RX_SIDETONE_IIR0_IIR_GAIN_B8_CTL: 1381af3d54b9SSrinivas Kandagatla case CDC_RX_SIDETONE_IIR0_IIR_CTL: 1382af3d54b9SSrinivas Kandagatla case CDC_RX_SIDETONE_IIR0_IIR_GAIN_TIMER_CTL: 1383af3d54b9SSrinivas Kandagatla case CDC_RX_SIDETONE_IIR0_IIR_COEF_B1_CTL: 1384af3d54b9SSrinivas Kandagatla case CDC_RX_SIDETONE_IIR0_IIR_COEF_B2_CTL: 1385af3d54b9SSrinivas Kandagatla case CDC_RX_SIDETONE_IIR1_IIR_PATH_CTL: 1386af3d54b9SSrinivas Kandagatla case CDC_RX_SIDETONE_IIR1_IIR_GAIN_B1_CTL: 1387af3d54b9SSrinivas Kandagatla case CDC_RX_SIDETONE_IIR1_IIR_GAIN_B2_CTL: 1388af3d54b9SSrinivas Kandagatla case CDC_RX_SIDETONE_IIR1_IIR_GAIN_B3_CTL: 1389af3d54b9SSrinivas Kandagatla case CDC_RX_SIDETONE_IIR1_IIR_GAIN_B4_CTL: 1390af3d54b9SSrinivas Kandagatla case CDC_RX_SIDETONE_IIR1_IIR_GAIN_B5_CTL: 1391af3d54b9SSrinivas Kandagatla case CDC_RX_SIDETONE_IIR1_IIR_GAIN_B6_CTL: 1392af3d54b9SSrinivas Kandagatla case CDC_RX_SIDETONE_IIR1_IIR_GAIN_B7_CTL: 1393af3d54b9SSrinivas Kandagatla case CDC_RX_SIDETONE_IIR1_IIR_GAIN_B8_CTL: 1394af3d54b9SSrinivas Kandagatla case CDC_RX_SIDETONE_IIR1_IIR_CTL: 1395af3d54b9SSrinivas Kandagatla case CDC_RX_SIDETONE_IIR1_IIR_GAIN_TIMER_CTL: 1396af3d54b9SSrinivas Kandagatla case CDC_RX_SIDETONE_IIR1_IIR_COEF_B1_CTL: 1397af3d54b9SSrinivas Kandagatla case CDC_RX_SIDETONE_IIR1_IIR_COEF_B2_CTL: 1398af3d54b9SSrinivas Kandagatla case CDC_RX_IIR_INP_MUX_IIR0_MIX_CFG0: 1399af3d54b9SSrinivas Kandagatla case CDC_RX_IIR_INP_MUX_IIR0_MIX_CFG1: 1400af3d54b9SSrinivas Kandagatla case CDC_RX_IIR_INP_MUX_IIR0_MIX_CFG2: 1401af3d54b9SSrinivas Kandagatla case CDC_RX_IIR_INP_MUX_IIR0_MIX_CFG3: 1402af3d54b9SSrinivas Kandagatla case CDC_RX_IIR_INP_MUX_IIR1_MIX_CFG0: 1403af3d54b9SSrinivas Kandagatla case CDC_RX_IIR_INP_MUX_IIR1_MIX_CFG1: 1404af3d54b9SSrinivas Kandagatla case CDC_RX_IIR_INP_MUX_IIR1_MIX_CFG2: 1405af3d54b9SSrinivas Kandagatla case CDC_RX_IIR_INP_MUX_IIR1_MIX_CFG3: 1406af3d54b9SSrinivas Kandagatla case CDC_RX_SIDETONE_SRC0_ST_SRC_PATH_CTL: 1407af3d54b9SSrinivas Kandagatla case CDC_RX_SIDETONE_SRC0_ST_SRC_PATH_CFG1: 1408af3d54b9SSrinivas Kandagatla case CDC_RX_SIDETONE_SRC1_ST_SRC_PATH_CTL: 1409af3d54b9SSrinivas Kandagatla case CDC_RX_SIDETONE_SRC1_ST_SRC_PATH_CFG1: 1410af3d54b9SSrinivas Kandagatla case CDC_RX_EC_REF_HQ0_EC_REF_HQ_PATH_CTL: 1411af3d54b9SSrinivas Kandagatla case CDC_RX_EC_REF_HQ0_EC_REF_HQ_CFG0: 1412af3d54b9SSrinivas Kandagatla case CDC_RX_EC_REF_HQ1_EC_REF_HQ_PATH_CTL: 1413af3d54b9SSrinivas Kandagatla case CDC_RX_EC_REF_HQ1_EC_REF_HQ_CFG0: 1414af3d54b9SSrinivas Kandagatla case CDC_RX_EC_REF_HQ2_EC_REF_HQ_PATH_CTL: 1415af3d54b9SSrinivas Kandagatla case CDC_RX_EC_REF_HQ2_EC_REF_HQ_CFG0: 1416af3d54b9SSrinivas Kandagatla case CDC_RX_EC_ASRC0_CLK_RST_CTL: 1417af3d54b9SSrinivas Kandagatla case CDC_RX_EC_ASRC0_CTL0: 1418af3d54b9SSrinivas Kandagatla case CDC_RX_EC_ASRC0_CTL1: 1419af3d54b9SSrinivas Kandagatla case CDC_RX_EC_ASRC0_FIFO_CTL: 1420af3d54b9SSrinivas Kandagatla case CDC_RX_EC_ASRC1_CLK_RST_CTL: 1421af3d54b9SSrinivas Kandagatla case CDC_RX_EC_ASRC1_CTL0: 1422af3d54b9SSrinivas Kandagatla case CDC_RX_EC_ASRC1_CTL1: 1423af3d54b9SSrinivas Kandagatla case CDC_RX_EC_ASRC1_FIFO_CTL: 1424af3d54b9SSrinivas Kandagatla case CDC_RX_EC_ASRC2_CLK_RST_CTL: 1425af3d54b9SSrinivas Kandagatla case CDC_RX_EC_ASRC2_CTL0: 1426af3d54b9SSrinivas Kandagatla case CDC_RX_EC_ASRC2_CTL1: 1427af3d54b9SSrinivas Kandagatla case CDC_RX_EC_ASRC2_FIFO_CTL: 1428af3d54b9SSrinivas Kandagatla case CDC_RX_DSD0_PATH_CTL: 1429af3d54b9SSrinivas Kandagatla case CDC_RX_DSD0_CFG0: 1430af3d54b9SSrinivas Kandagatla case CDC_RX_DSD0_CFG1: 1431af3d54b9SSrinivas Kandagatla case CDC_RX_DSD0_CFG2: 1432af3d54b9SSrinivas Kandagatla case CDC_RX_DSD1_PATH_CTL: 1433af3d54b9SSrinivas Kandagatla case CDC_RX_DSD1_CFG0: 1434af3d54b9SSrinivas Kandagatla case CDC_RX_DSD1_CFG1: 1435af3d54b9SSrinivas Kandagatla case CDC_RX_DSD1_CFG2: 1436af3d54b9SSrinivas Kandagatla return true; 1437af3d54b9SSrinivas Kandagatla } 1438af3d54b9SSrinivas Kandagatla 1439af3d54b9SSrinivas Kandagatla return false; 1440af3d54b9SSrinivas Kandagatla } 1441af3d54b9SSrinivas Kandagatla 1442af3d54b9SSrinivas Kandagatla static bool rx_is_writeable_register(struct device *dev, unsigned int reg) 1443af3d54b9SSrinivas Kandagatla { 1444af3d54b9SSrinivas Kandagatla bool ret; 1445af3d54b9SSrinivas Kandagatla 1446af3d54b9SSrinivas Kandagatla ret = rx_is_rw_register(dev, reg); 1447af3d54b9SSrinivas Kandagatla if (!ret) 1448af3d54b9SSrinivas Kandagatla return rx_is_wronly_register(dev, reg); 1449af3d54b9SSrinivas Kandagatla 1450af3d54b9SSrinivas Kandagatla return ret; 1451af3d54b9SSrinivas Kandagatla } 1452af3d54b9SSrinivas Kandagatla 1453af3d54b9SSrinivas Kandagatla static bool rx_is_readable_register(struct device *dev, unsigned int reg) 1454af3d54b9SSrinivas Kandagatla { 1455af3d54b9SSrinivas Kandagatla switch (reg) { 1456af3d54b9SSrinivas Kandagatla case CDC_RX_TOP_HPHL_COMP_RD_LSB: 1457af3d54b9SSrinivas Kandagatla case CDC_RX_TOP_HPHL_COMP_RD_MSB: 1458af3d54b9SSrinivas Kandagatla case CDC_RX_TOP_HPHR_COMP_RD_LSB: 1459af3d54b9SSrinivas Kandagatla case CDC_RX_TOP_HPHR_COMP_RD_MSB: 1460af3d54b9SSrinivas Kandagatla case CDC_RX_TOP_DSD0_DEBUG_CFG2: 1461af3d54b9SSrinivas Kandagatla case CDC_RX_TOP_DSD1_DEBUG_CFG2: 1462af3d54b9SSrinivas Kandagatla case CDC_RX_BCL_VBAT_GAIN_MON_VAL: 1463af3d54b9SSrinivas Kandagatla case CDC_RX_BCL_VBAT_DECODE_ST: 1464af3d54b9SSrinivas Kandagatla case CDC_RX_INTR_CTRL_PIN1_STATUS0: 1465af3d54b9SSrinivas Kandagatla case CDC_RX_INTR_CTRL_PIN2_STATUS0: 1466af3d54b9SSrinivas Kandagatla case CDC_RX_COMPANDER0_CTL6: 1467af3d54b9SSrinivas Kandagatla case CDC_RX_COMPANDER1_CTL6: 1468af3d54b9SSrinivas Kandagatla case CDC_RX_EC_ASRC0_STATUS_FMIN_CNTR_LSB: 1469af3d54b9SSrinivas Kandagatla case CDC_RX_EC_ASRC0_STATUS_FMIN_CNTR_MSB: 1470af3d54b9SSrinivas Kandagatla case CDC_RX_EC_ASRC0_STATUS_FMAX_CNTR_LSB: 1471af3d54b9SSrinivas Kandagatla case CDC_RX_EC_ASRC0_STATUS_FMAX_CNTR_MSB: 1472af3d54b9SSrinivas Kandagatla case CDC_RX_EC_ASRC0_STATUS_FIFO: 1473af3d54b9SSrinivas Kandagatla case CDC_RX_EC_ASRC1_STATUS_FMIN_CNTR_LSB: 1474af3d54b9SSrinivas Kandagatla case CDC_RX_EC_ASRC1_STATUS_FMIN_CNTR_MSB: 1475af3d54b9SSrinivas Kandagatla case CDC_RX_EC_ASRC1_STATUS_FMAX_CNTR_LSB: 1476af3d54b9SSrinivas Kandagatla case CDC_RX_EC_ASRC1_STATUS_FMAX_CNTR_MSB: 1477af3d54b9SSrinivas Kandagatla case CDC_RX_EC_ASRC1_STATUS_FIFO: 1478af3d54b9SSrinivas Kandagatla case CDC_RX_EC_ASRC2_STATUS_FMIN_CNTR_LSB: 1479af3d54b9SSrinivas Kandagatla case CDC_RX_EC_ASRC2_STATUS_FMIN_CNTR_MSB: 1480af3d54b9SSrinivas Kandagatla case CDC_RX_EC_ASRC2_STATUS_FMAX_CNTR_LSB: 1481af3d54b9SSrinivas Kandagatla case CDC_RX_EC_ASRC2_STATUS_FMAX_CNTR_MSB: 1482af3d54b9SSrinivas Kandagatla case CDC_RX_EC_ASRC2_STATUS_FIFO: 1483af3d54b9SSrinivas Kandagatla return true; 1484af3d54b9SSrinivas Kandagatla } 1485af3d54b9SSrinivas Kandagatla 1486af3d54b9SSrinivas Kandagatla return rx_is_rw_register(dev, reg); 1487af3d54b9SSrinivas Kandagatla } 1488af3d54b9SSrinivas Kandagatla 1489af3d54b9SSrinivas Kandagatla static const struct regmap_config rx_regmap_config = { 1490af3d54b9SSrinivas Kandagatla .name = "rx_macro", 1491af3d54b9SSrinivas Kandagatla .reg_bits = 16, 1492af3d54b9SSrinivas Kandagatla .val_bits = 32, /* 8 but with 32 bit read/write */ 1493af3d54b9SSrinivas Kandagatla .reg_stride = 4, 1494af3d54b9SSrinivas Kandagatla .cache_type = REGCACHE_FLAT, 1495af3d54b9SSrinivas Kandagatla .reg_defaults = rx_defaults, 1496af3d54b9SSrinivas Kandagatla .num_reg_defaults = ARRAY_SIZE(rx_defaults), 1497af3d54b9SSrinivas Kandagatla .max_register = RX_MAX_OFFSET, 1498af3d54b9SSrinivas Kandagatla .writeable_reg = rx_is_writeable_register, 1499af3d54b9SSrinivas Kandagatla .volatile_reg = rx_is_volatile_register, 1500af3d54b9SSrinivas Kandagatla .readable_reg = rx_is_readable_register, 1501af3d54b9SSrinivas Kandagatla }; 1502af3d54b9SSrinivas Kandagatla 15034f692926SSrinivas Kandagatla static int rx_macro_int_dem_inp_mux_put(struct snd_kcontrol *kcontrol, 15044f692926SSrinivas Kandagatla struct snd_ctl_elem_value *ucontrol) 15054f692926SSrinivas Kandagatla { 15064f692926SSrinivas Kandagatla struct snd_soc_dapm_widget *widget = snd_soc_dapm_kcontrol_widget(kcontrol); 15074f692926SSrinivas Kandagatla struct snd_soc_component *component = snd_soc_dapm_to_component(widget->dapm); 15084f692926SSrinivas Kandagatla struct soc_enum *e = (struct soc_enum *)kcontrol->private_value; 15094f692926SSrinivas Kandagatla unsigned short look_ahead_dly_reg; 15104f692926SSrinivas Kandagatla unsigned int val; 15114f692926SSrinivas Kandagatla 15124f692926SSrinivas Kandagatla val = ucontrol->value.enumerated.item[0]; 15134f692926SSrinivas Kandagatla 15144f692926SSrinivas Kandagatla if (e->reg == CDC_RX_RX0_RX_PATH_CFG1) 15154f692926SSrinivas Kandagatla look_ahead_dly_reg = CDC_RX_RX0_RX_PATH_CFG0; 15164f692926SSrinivas Kandagatla else if (e->reg == CDC_RX_RX1_RX_PATH_CFG1) 15174f692926SSrinivas Kandagatla look_ahead_dly_reg = CDC_RX_RX1_RX_PATH_CFG0; 15184f692926SSrinivas Kandagatla 15194f692926SSrinivas Kandagatla /* Set Look Ahead Delay */ 15204f692926SSrinivas Kandagatla if (val) 15214f692926SSrinivas Kandagatla snd_soc_component_update_bits(component, look_ahead_dly_reg, 15224f692926SSrinivas Kandagatla CDC_RX_DLY_ZN_EN_MASK, 15234f692926SSrinivas Kandagatla CDC_RX_DLY_ZN_ENABLE); 15244f692926SSrinivas Kandagatla else 15254f692926SSrinivas Kandagatla snd_soc_component_update_bits(component, look_ahead_dly_reg, 15264f692926SSrinivas Kandagatla CDC_RX_DLY_ZN_EN_MASK, 0); 15274f692926SSrinivas Kandagatla /* Set DEM INP Select */ 15284f692926SSrinivas Kandagatla return snd_soc_dapm_put_enum_double(kcontrol, ucontrol); 15294f692926SSrinivas Kandagatla } 15304f692926SSrinivas Kandagatla 15314f692926SSrinivas Kandagatla static const struct snd_kcontrol_new rx_int0_dem_inp_mux = 15324f692926SSrinivas Kandagatla SOC_DAPM_ENUM_EXT("rx_int0_dem_inp", rx_int0_dem_inp_enum, 15334f692926SSrinivas Kandagatla snd_soc_dapm_get_enum_double, rx_macro_int_dem_inp_mux_put); 15344f692926SSrinivas Kandagatla static const struct snd_kcontrol_new rx_int1_dem_inp_mux = 15354f692926SSrinivas Kandagatla SOC_DAPM_ENUM_EXT("rx_int1_dem_inp", rx_int1_dem_inp_enum, 15364f692926SSrinivas Kandagatla snd_soc_dapm_get_enum_double, rx_macro_int_dem_inp_mux_put); 15374f692926SSrinivas Kandagatla 1538af3d54b9SSrinivas Kandagatla static int rx_macro_set_prim_interpolator_rate(struct snd_soc_dai *dai, 1539af3d54b9SSrinivas Kandagatla int rate_reg_val, u32 sample_rate) 1540af3d54b9SSrinivas Kandagatla { 1541af3d54b9SSrinivas Kandagatla 1542af3d54b9SSrinivas Kandagatla u8 int_1_mix1_inp; 1543af3d54b9SSrinivas Kandagatla u32 j, port; 1544af3d54b9SSrinivas Kandagatla u16 int_mux_cfg0, int_mux_cfg1; 1545af3d54b9SSrinivas Kandagatla u16 int_fs_reg; 1546af3d54b9SSrinivas Kandagatla u8 inp0_sel, inp1_sel, inp2_sel; 1547af3d54b9SSrinivas Kandagatla struct snd_soc_component *component = dai->component; 1548af3d54b9SSrinivas Kandagatla struct rx_macro *rx = snd_soc_component_get_drvdata(component); 1549af3d54b9SSrinivas Kandagatla 1550af3d54b9SSrinivas Kandagatla for_each_set_bit(port, &rx->active_ch_mask[dai->id], RX_MACRO_PORTS_MAX) { 1551af3d54b9SSrinivas Kandagatla int_1_mix1_inp = port; 1552af3d54b9SSrinivas Kandagatla int_mux_cfg0 = CDC_RX_INP_MUX_RX_INT0_CFG0; 1553af3d54b9SSrinivas Kandagatla /* 1554af3d54b9SSrinivas Kandagatla * Loop through all interpolator MUX inputs and find out 1555af3d54b9SSrinivas Kandagatla * to which interpolator input, the rx port 1556af3d54b9SSrinivas Kandagatla * is connected 1557af3d54b9SSrinivas Kandagatla */ 1558af3d54b9SSrinivas Kandagatla for (j = 0; j < INTERP_MAX; j++) { 1559af3d54b9SSrinivas Kandagatla int_mux_cfg1 = int_mux_cfg0 + 4; 1560af3d54b9SSrinivas Kandagatla 1561af3d54b9SSrinivas Kandagatla inp0_sel = snd_soc_component_read_field(component, int_mux_cfg0, 1562af3d54b9SSrinivas Kandagatla CDC_RX_INTX_1_MIX_INP0_SEL_MASK); 1563af3d54b9SSrinivas Kandagatla inp1_sel = snd_soc_component_read_field(component, int_mux_cfg0, 1564af3d54b9SSrinivas Kandagatla CDC_RX_INTX_1_MIX_INP1_SEL_MASK); 1565af3d54b9SSrinivas Kandagatla inp2_sel = snd_soc_component_read_field(component, int_mux_cfg1, 1566af3d54b9SSrinivas Kandagatla CDC_RX_INTX_1_MIX_INP2_SEL_MASK); 1567af3d54b9SSrinivas Kandagatla 1568af3d54b9SSrinivas Kandagatla if ((inp0_sel == int_1_mix1_inp + INTn_1_INP_SEL_RX0) || 1569af3d54b9SSrinivas Kandagatla (inp1_sel == int_1_mix1_inp + INTn_1_INP_SEL_RX0) || 1570af3d54b9SSrinivas Kandagatla (inp2_sel == int_1_mix1_inp + INTn_1_INP_SEL_RX0)) { 1571af3d54b9SSrinivas Kandagatla int_fs_reg = CDC_RX_RXn_RX_PATH_CTL(j); 1572af3d54b9SSrinivas Kandagatla /* sample_rate is in Hz */ 1573af3d54b9SSrinivas Kandagatla snd_soc_component_update_bits(component, int_fs_reg, 1574af3d54b9SSrinivas Kandagatla CDC_RX_PATH_PCM_RATE_MASK, 1575af3d54b9SSrinivas Kandagatla rate_reg_val); 1576af3d54b9SSrinivas Kandagatla } 1577af3d54b9SSrinivas Kandagatla int_mux_cfg0 += 8; 1578af3d54b9SSrinivas Kandagatla } 1579af3d54b9SSrinivas Kandagatla } 1580af3d54b9SSrinivas Kandagatla 1581af3d54b9SSrinivas Kandagatla return 0; 1582af3d54b9SSrinivas Kandagatla } 1583af3d54b9SSrinivas Kandagatla 1584af3d54b9SSrinivas Kandagatla static int rx_macro_set_mix_interpolator_rate(struct snd_soc_dai *dai, 1585af3d54b9SSrinivas Kandagatla int rate_reg_val, u32 sample_rate) 1586af3d54b9SSrinivas Kandagatla { 1587af3d54b9SSrinivas Kandagatla 1588af3d54b9SSrinivas Kandagatla u8 int_2_inp; 1589af3d54b9SSrinivas Kandagatla u32 j, port; 1590af3d54b9SSrinivas Kandagatla u16 int_mux_cfg1, int_fs_reg; 1591af3d54b9SSrinivas Kandagatla u8 int_mux_cfg1_val; 1592af3d54b9SSrinivas Kandagatla struct snd_soc_component *component = dai->component; 1593af3d54b9SSrinivas Kandagatla struct rx_macro *rx = snd_soc_component_get_drvdata(component); 1594af3d54b9SSrinivas Kandagatla 1595af3d54b9SSrinivas Kandagatla for_each_set_bit(port, &rx->active_ch_mask[dai->id], RX_MACRO_PORTS_MAX) { 1596af3d54b9SSrinivas Kandagatla int_2_inp = port; 1597af3d54b9SSrinivas Kandagatla 1598af3d54b9SSrinivas Kandagatla int_mux_cfg1 = CDC_RX_INP_MUX_RX_INT0_CFG1; 1599af3d54b9SSrinivas Kandagatla for (j = 0; j < INTERP_MAX; j++) { 1600af3d54b9SSrinivas Kandagatla int_mux_cfg1_val = snd_soc_component_read_field(component, int_mux_cfg1, 1601af3d54b9SSrinivas Kandagatla CDC_RX_INTX_2_SEL_MASK); 1602af3d54b9SSrinivas Kandagatla 1603af3d54b9SSrinivas Kandagatla if (int_mux_cfg1_val == int_2_inp + INTn_2_INP_SEL_RX0) { 1604af3d54b9SSrinivas Kandagatla int_fs_reg = CDC_RX_RXn_RX_PATH_MIX_CTL(j); 1605af3d54b9SSrinivas Kandagatla snd_soc_component_update_bits(component, int_fs_reg, 1606af3d54b9SSrinivas Kandagatla CDC_RX_RXn_MIX_PCM_RATE_MASK, 1607af3d54b9SSrinivas Kandagatla rate_reg_val); 1608af3d54b9SSrinivas Kandagatla } 1609af3d54b9SSrinivas Kandagatla int_mux_cfg1 += 8; 1610af3d54b9SSrinivas Kandagatla } 1611af3d54b9SSrinivas Kandagatla } 1612af3d54b9SSrinivas Kandagatla return 0; 1613af3d54b9SSrinivas Kandagatla } 1614af3d54b9SSrinivas Kandagatla 1615af3d54b9SSrinivas Kandagatla static int rx_macro_set_interpolator_rate(struct snd_soc_dai *dai, 1616af3d54b9SSrinivas Kandagatla u32 sample_rate) 1617af3d54b9SSrinivas Kandagatla { 1618af3d54b9SSrinivas Kandagatla int rate_val = 0; 1619af3d54b9SSrinivas Kandagatla int i, ret; 1620af3d54b9SSrinivas Kandagatla 1621af3d54b9SSrinivas Kandagatla for (i = 0; i < ARRAY_SIZE(sr_val_tbl); i++) 1622af3d54b9SSrinivas Kandagatla if (sample_rate == sr_val_tbl[i].sample_rate) 1623af3d54b9SSrinivas Kandagatla rate_val = sr_val_tbl[i].rate_val; 1624af3d54b9SSrinivas Kandagatla 1625af3d54b9SSrinivas Kandagatla ret = rx_macro_set_prim_interpolator_rate(dai, rate_val, sample_rate); 1626af3d54b9SSrinivas Kandagatla if (ret) 1627af3d54b9SSrinivas Kandagatla return ret; 1628af3d54b9SSrinivas Kandagatla 1629af3d54b9SSrinivas Kandagatla ret = rx_macro_set_mix_interpolator_rate(dai, rate_val, sample_rate); 1630af3d54b9SSrinivas Kandagatla 1631af3d54b9SSrinivas Kandagatla return ret; 1632af3d54b9SSrinivas Kandagatla } 1633af3d54b9SSrinivas Kandagatla 1634af3d54b9SSrinivas Kandagatla static int rx_macro_hw_params(struct snd_pcm_substream *substream, 1635af3d54b9SSrinivas Kandagatla struct snd_pcm_hw_params *params, 1636af3d54b9SSrinivas Kandagatla struct snd_soc_dai *dai) 1637af3d54b9SSrinivas Kandagatla { 1638af3d54b9SSrinivas Kandagatla struct snd_soc_component *component = dai->component; 1639af3d54b9SSrinivas Kandagatla struct rx_macro *rx = snd_soc_component_get_drvdata(component); 1640af3d54b9SSrinivas Kandagatla int ret; 1641af3d54b9SSrinivas Kandagatla 1642af3d54b9SSrinivas Kandagatla switch (substream->stream) { 1643af3d54b9SSrinivas Kandagatla case SNDRV_PCM_STREAM_PLAYBACK: 1644af3d54b9SSrinivas Kandagatla ret = rx_macro_set_interpolator_rate(dai, params_rate(params)); 1645af3d54b9SSrinivas Kandagatla if (ret) { 1646af3d54b9SSrinivas Kandagatla dev_err(component->dev, "%s: cannot set sample rate: %u\n", 1647af3d54b9SSrinivas Kandagatla __func__, params_rate(params)); 1648af3d54b9SSrinivas Kandagatla return ret; 1649af3d54b9SSrinivas Kandagatla } 1650af3d54b9SSrinivas Kandagatla rx->bit_width[dai->id] = params_width(params); 1651af3d54b9SSrinivas Kandagatla break; 1652af3d54b9SSrinivas Kandagatla default: 1653af3d54b9SSrinivas Kandagatla break; 1654af3d54b9SSrinivas Kandagatla } 1655af3d54b9SSrinivas Kandagatla return 0; 1656af3d54b9SSrinivas Kandagatla } 1657af3d54b9SSrinivas Kandagatla 1658af3d54b9SSrinivas Kandagatla static int rx_macro_get_channel_map(struct snd_soc_dai *dai, 1659af3d54b9SSrinivas Kandagatla unsigned int *tx_num, unsigned int *tx_slot, 1660af3d54b9SSrinivas Kandagatla unsigned int *rx_num, unsigned int *rx_slot) 1661af3d54b9SSrinivas Kandagatla { 1662af3d54b9SSrinivas Kandagatla struct snd_soc_component *component = dai->component; 1663af3d54b9SSrinivas Kandagatla struct rx_macro *rx = snd_soc_component_get_drvdata(component); 1664af3d54b9SSrinivas Kandagatla u16 val, mask = 0, cnt = 0, temp; 1665af3d54b9SSrinivas Kandagatla 1666af3d54b9SSrinivas Kandagatla switch (dai->id) { 1667af3d54b9SSrinivas Kandagatla case RX_MACRO_AIF1_PB: 1668af3d54b9SSrinivas Kandagatla case RX_MACRO_AIF2_PB: 1669af3d54b9SSrinivas Kandagatla case RX_MACRO_AIF3_PB: 1670af3d54b9SSrinivas Kandagatla case RX_MACRO_AIF4_PB: 1671af3d54b9SSrinivas Kandagatla for_each_set_bit(temp, &rx->active_ch_mask[dai->id], 1672af3d54b9SSrinivas Kandagatla RX_MACRO_PORTS_MAX) { 1673af3d54b9SSrinivas Kandagatla mask |= (1 << temp); 1674af3d54b9SSrinivas Kandagatla if (++cnt == RX_MACRO_MAX_DMA_CH_PER_PORT) 1675af3d54b9SSrinivas Kandagatla break; 1676af3d54b9SSrinivas Kandagatla } 1677af3d54b9SSrinivas Kandagatla /* 1678af3d54b9SSrinivas Kandagatla * CDC_DMA_RX_0 port drives RX0/RX1 -- ch_mask 0x1/0x2/0x3 1679af3d54b9SSrinivas Kandagatla * CDC_DMA_RX_1 port drives RX2/RX3 -- ch_mask 0x1/0x2/0x3 1680af3d54b9SSrinivas Kandagatla * CDC_DMA_RX_2 port drives RX4 -- ch_mask 0x1 1681af3d54b9SSrinivas Kandagatla * CDC_DMA_RX_3 port drives RX5 -- ch_mask 0x1 1682af3d54b9SSrinivas Kandagatla * AIFn can pair to any CDC_DMA_RX_n port. 1683af3d54b9SSrinivas Kandagatla * In general, below convention is used:: 1684af3d54b9SSrinivas Kandagatla * CDC_DMA_RX_0(AIF1)/CDC_DMA_RX_1(AIF2)/ 1685af3d54b9SSrinivas Kandagatla * CDC_DMA_RX_2(AIF3)/CDC_DMA_RX_3(AIF4) 1686af3d54b9SSrinivas Kandagatla */ 1687af3d54b9SSrinivas Kandagatla if (mask & 0x0C) 1688af3d54b9SSrinivas Kandagatla mask = mask >> 2; 1689af3d54b9SSrinivas Kandagatla if ((mask & 0x10) || (mask & 0x20)) 1690af3d54b9SSrinivas Kandagatla mask = 0x1; 1691af3d54b9SSrinivas Kandagatla *rx_slot = mask; 1692af3d54b9SSrinivas Kandagatla *rx_num = rx->active_ch_cnt[dai->id]; 1693af3d54b9SSrinivas Kandagatla break; 1694af3d54b9SSrinivas Kandagatla case RX_MACRO_AIF_ECHO: 1695af3d54b9SSrinivas Kandagatla val = snd_soc_component_read(component, CDC_RX_INP_MUX_RX_MIX_CFG4); 1696af3d54b9SSrinivas Kandagatla if (val & RX_MACRO_EC_MIX_TX0_MASK) { 1697af3d54b9SSrinivas Kandagatla mask |= 0x1; 1698af3d54b9SSrinivas Kandagatla cnt++; 1699af3d54b9SSrinivas Kandagatla } 1700af3d54b9SSrinivas Kandagatla if (val & RX_MACRO_EC_MIX_TX1_MASK) { 1701af3d54b9SSrinivas Kandagatla mask |= 0x2; 1702af3d54b9SSrinivas Kandagatla cnt++; 1703af3d54b9SSrinivas Kandagatla } 1704af3d54b9SSrinivas Kandagatla val = snd_soc_component_read(component, 1705af3d54b9SSrinivas Kandagatla CDC_RX_INP_MUX_RX_MIX_CFG5); 1706af3d54b9SSrinivas Kandagatla if (val & RX_MACRO_EC_MIX_TX2_MASK) { 1707af3d54b9SSrinivas Kandagatla mask |= 0x4; 1708af3d54b9SSrinivas Kandagatla cnt++; 1709af3d54b9SSrinivas Kandagatla } 1710af3d54b9SSrinivas Kandagatla *tx_slot = mask; 1711af3d54b9SSrinivas Kandagatla *tx_num = cnt; 1712af3d54b9SSrinivas Kandagatla break; 1713af3d54b9SSrinivas Kandagatla default: 1714af3d54b9SSrinivas Kandagatla dev_err(component->dev, "%s: Invalid AIF\n", __func__); 1715af3d54b9SSrinivas Kandagatla break; 1716af3d54b9SSrinivas Kandagatla } 1717af3d54b9SSrinivas Kandagatla return 0; 1718af3d54b9SSrinivas Kandagatla } 1719af3d54b9SSrinivas Kandagatla 1720af3d54b9SSrinivas Kandagatla static int rx_macro_digital_mute(struct snd_soc_dai *dai, int mute, int stream) 1721af3d54b9SSrinivas Kandagatla { 1722af3d54b9SSrinivas Kandagatla struct snd_soc_component *component = dai->component; 1723af3d54b9SSrinivas Kandagatla uint16_t j, reg, mix_reg, dsm_reg; 1724af3d54b9SSrinivas Kandagatla u16 int_mux_cfg0, int_mux_cfg1; 1725af3d54b9SSrinivas Kandagatla u8 int_mux_cfg0_val, int_mux_cfg1_val; 1726af3d54b9SSrinivas Kandagatla 1727af3d54b9SSrinivas Kandagatla switch (dai->id) { 1728af3d54b9SSrinivas Kandagatla case RX_MACRO_AIF1_PB: 1729af3d54b9SSrinivas Kandagatla case RX_MACRO_AIF2_PB: 1730af3d54b9SSrinivas Kandagatla case RX_MACRO_AIF3_PB: 1731af3d54b9SSrinivas Kandagatla case RX_MACRO_AIF4_PB: 1732af3d54b9SSrinivas Kandagatla for (j = 0; j < INTERP_MAX; j++) { 1733af3d54b9SSrinivas Kandagatla reg = CDC_RX_RXn_RX_PATH_CTL(j); 1734af3d54b9SSrinivas Kandagatla mix_reg = CDC_RX_RXn_RX_PATH_MIX_CTL(j); 1735af3d54b9SSrinivas Kandagatla dsm_reg = CDC_RX_RXn_RX_PATH_DSM_CTL(j); 1736af3d54b9SSrinivas Kandagatla 1737af3d54b9SSrinivas Kandagatla if (mute) { 1738af3d54b9SSrinivas Kandagatla snd_soc_component_update_bits(component, reg, 1739af3d54b9SSrinivas Kandagatla CDC_RX_PATH_PGA_MUTE_MASK, 1740af3d54b9SSrinivas Kandagatla CDC_RX_PATH_PGA_MUTE_ENABLE); 1741af3d54b9SSrinivas Kandagatla snd_soc_component_update_bits(component, mix_reg, 1742af3d54b9SSrinivas Kandagatla CDC_RX_PATH_PGA_MUTE_MASK, 1743af3d54b9SSrinivas Kandagatla CDC_RX_PATH_PGA_MUTE_ENABLE); 1744af3d54b9SSrinivas Kandagatla } else { 1745af3d54b9SSrinivas Kandagatla snd_soc_component_update_bits(component, reg, 1746af3d54b9SSrinivas Kandagatla CDC_RX_PATH_PGA_MUTE_MASK, 0x0); 1747af3d54b9SSrinivas Kandagatla snd_soc_component_update_bits(component, mix_reg, 1748af3d54b9SSrinivas Kandagatla CDC_RX_PATH_PGA_MUTE_MASK, 0x0); 1749af3d54b9SSrinivas Kandagatla } 1750af3d54b9SSrinivas Kandagatla 1751af3d54b9SSrinivas Kandagatla if (j == INTERP_AUX) 1752af3d54b9SSrinivas Kandagatla dsm_reg = CDC_RX_RX2_RX_PATH_DSM_CTL; 1753af3d54b9SSrinivas Kandagatla 1754af3d54b9SSrinivas Kandagatla int_mux_cfg0 = CDC_RX_INP_MUX_RX_INT0_CFG0 + j * 8; 1755af3d54b9SSrinivas Kandagatla int_mux_cfg1 = int_mux_cfg0 + 4; 1756af3d54b9SSrinivas Kandagatla int_mux_cfg0_val = snd_soc_component_read(component, int_mux_cfg0); 1757af3d54b9SSrinivas Kandagatla int_mux_cfg1_val = snd_soc_component_read(component, int_mux_cfg1); 1758af3d54b9SSrinivas Kandagatla 1759af3d54b9SSrinivas Kandagatla if (snd_soc_component_read(component, dsm_reg) & 0x01) { 1760af3d54b9SSrinivas Kandagatla if (int_mux_cfg0_val || (int_mux_cfg1_val & 0xF0)) 1761af3d54b9SSrinivas Kandagatla snd_soc_component_update_bits(component, reg, 0x20, 0x20); 1762af3d54b9SSrinivas Kandagatla if (int_mux_cfg1_val & 0x0F) { 1763af3d54b9SSrinivas Kandagatla snd_soc_component_update_bits(component, reg, 0x20, 0x20); 1764622d9ac3SColin Ian King snd_soc_component_update_bits(component, mix_reg, 0x20, 1765622d9ac3SColin Ian King 0x20); 1766af3d54b9SSrinivas Kandagatla } 1767af3d54b9SSrinivas Kandagatla } 1768af3d54b9SSrinivas Kandagatla } 1769af3d54b9SSrinivas Kandagatla break; 1770af3d54b9SSrinivas Kandagatla default: 1771af3d54b9SSrinivas Kandagatla break; 1772af3d54b9SSrinivas Kandagatla } 1773af3d54b9SSrinivas Kandagatla return 0; 1774af3d54b9SSrinivas Kandagatla } 1775af3d54b9SSrinivas Kandagatla 1776857b602aSYe Bin static const struct snd_soc_dai_ops rx_macro_dai_ops = { 1777af3d54b9SSrinivas Kandagatla .hw_params = rx_macro_hw_params, 1778af3d54b9SSrinivas Kandagatla .get_channel_map = rx_macro_get_channel_map, 1779af3d54b9SSrinivas Kandagatla .mute_stream = rx_macro_digital_mute, 1780af3d54b9SSrinivas Kandagatla }; 1781af3d54b9SSrinivas Kandagatla 1782af3d54b9SSrinivas Kandagatla static struct snd_soc_dai_driver rx_macro_dai[] = { 1783af3d54b9SSrinivas Kandagatla { 1784af3d54b9SSrinivas Kandagatla .name = "rx_macro_rx1", 1785af3d54b9SSrinivas Kandagatla .id = RX_MACRO_AIF1_PB, 1786af3d54b9SSrinivas Kandagatla .playback = { 1787af3d54b9SSrinivas Kandagatla .stream_name = "RX_MACRO_AIF1 Playback", 1788af3d54b9SSrinivas Kandagatla .rates = RX_MACRO_RATES | RX_MACRO_FRAC_RATES, 1789af3d54b9SSrinivas Kandagatla .formats = RX_MACRO_FORMATS, 1790af3d54b9SSrinivas Kandagatla .rate_max = 384000, 1791af3d54b9SSrinivas Kandagatla .rate_min = 8000, 1792af3d54b9SSrinivas Kandagatla .channels_min = 1, 1793af3d54b9SSrinivas Kandagatla .channels_max = 2, 1794af3d54b9SSrinivas Kandagatla }, 1795af3d54b9SSrinivas Kandagatla .ops = &rx_macro_dai_ops, 1796af3d54b9SSrinivas Kandagatla }, 1797af3d54b9SSrinivas Kandagatla { 1798af3d54b9SSrinivas Kandagatla .name = "rx_macro_rx2", 1799af3d54b9SSrinivas Kandagatla .id = RX_MACRO_AIF2_PB, 1800af3d54b9SSrinivas Kandagatla .playback = { 1801af3d54b9SSrinivas Kandagatla .stream_name = "RX_MACRO_AIF2 Playback", 1802af3d54b9SSrinivas Kandagatla .rates = RX_MACRO_RATES | RX_MACRO_FRAC_RATES, 1803af3d54b9SSrinivas Kandagatla .formats = RX_MACRO_FORMATS, 1804af3d54b9SSrinivas Kandagatla .rate_max = 384000, 1805af3d54b9SSrinivas Kandagatla .rate_min = 8000, 1806af3d54b9SSrinivas Kandagatla .channels_min = 1, 1807af3d54b9SSrinivas Kandagatla .channels_max = 2, 1808af3d54b9SSrinivas Kandagatla }, 1809af3d54b9SSrinivas Kandagatla .ops = &rx_macro_dai_ops, 1810af3d54b9SSrinivas Kandagatla }, 1811af3d54b9SSrinivas Kandagatla { 1812af3d54b9SSrinivas Kandagatla .name = "rx_macro_rx3", 1813af3d54b9SSrinivas Kandagatla .id = RX_MACRO_AIF3_PB, 1814af3d54b9SSrinivas Kandagatla .playback = { 1815af3d54b9SSrinivas Kandagatla .stream_name = "RX_MACRO_AIF3 Playback", 1816af3d54b9SSrinivas Kandagatla .rates = RX_MACRO_RATES | RX_MACRO_FRAC_RATES, 1817af3d54b9SSrinivas Kandagatla .formats = RX_MACRO_FORMATS, 1818af3d54b9SSrinivas Kandagatla .rate_max = 384000, 1819af3d54b9SSrinivas Kandagatla .rate_min = 8000, 1820af3d54b9SSrinivas Kandagatla .channels_min = 1, 1821af3d54b9SSrinivas Kandagatla .channels_max = 2, 1822af3d54b9SSrinivas Kandagatla }, 1823af3d54b9SSrinivas Kandagatla .ops = &rx_macro_dai_ops, 1824af3d54b9SSrinivas Kandagatla }, 1825af3d54b9SSrinivas Kandagatla { 1826af3d54b9SSrinivas Kandagatla .name = "rx_macro_rx4", 1827af3d54b9SSrinivas Kandagatla .id = RX_MACRO_AIF4_PB, 1828af3d54b9SSrinivas Kandagatla .playback = { 1829af3d54b9SSrinivas Kandagatla .stream_name = "RX_MACRO_AIF4 Playback", 1830af3d54b9SSrinivas Kandagatla .rates = RX_MACRO_RATES | RX_MACRO_FRAC_RATES, 1831af3d54b9SSrinivas Kandagatla .formats = RX_MACRO_FORMATS, 1832af3d54b9SSrinivas Kandagatla .rate_max = 384000, 1833af3d54b9SSrinivas Kandagatla .rate_min = 8000, 1834af3d54b9SSrinivas Kandagatla .channels_min = 1, 1835af3d54b9SSrinivas Kandagatla .channels_max = 2, 1836af3d54b9SSrinivas Kandagatla }, 1837af3d54b9SSrinivas Kandagatla .ops = &rx_macro_dai_ops, 1838af3d54b9SSrinivas Kandagatla }, 1839af3d54b9SSrinivas Kandagatla { 1840af3d54b9SSrinivas Kandagatla .name = "rx_macro_echo", 1841af3d54b9SSrinivas Kandagatla .id = RX_MACRO_AIF_ECHO, 1842af3d54b9SSrinivas Kandagatla .capture = { 1843af3d54b9SSrinivas Kandagatla .stream_name = "RX_AIF_ECHO Capture", 1844af3d54b9SSrinivas Kandagatla .rates = RX_MACRO_ECHO_RATES, 1845af3d54b9SSrinivas Kandagatla .formats = RX_MACRO_ECHO_FORMATS, 1846af3d54b9SSrinivas Kandagatla .rate_max = 48000, 1847af3d54b9SSrinivas Kandagatla .rate_min = 8000, 1848af3d54b9SSrinivas Kandagatla .channels_min = 1, 1849af3d54b9SSrinivas Kandagatla .channels_max = 3, 1850af3d54b9SSrinivas Kandagatla }, 1851af3d54b9SSrinivas Kandagatla .ops = &rx_macro_dai_ops, 1852af3d54b9SSrinivas Kandagatla }, 1853af3d54b9SSrinivas Kandagatla }; 1854af3d54b9SSrinivas Kandagatla 1855af3d54b9SSrinivas Kandagatla static void rx_macro_mclk_enable(struct rx_macro *rx, bool mclk_enable) 1856af3d54b9SSrinivas Kandagatla { 1857af3d54b9SSrinivas Kandagatla struct regmap *regmap = rx->regmap; 1858af3d54b9SSrinivas Kandagatla 1859af3d54b9SSrinivas Kandagatla if (mclk_enable) { 1860af3d54b9SSrinivas Kandagatla if (rx->rx_mclk_users == 0) { 1861af3d54b9SSrinivas Kandagatla regmap_update_bits(regmap, CDC_RX_CLK_RST_CTRL_MCLK_CONTROL, 1862af3d54b9SSrinivas Kandagatla CDC_RX_CLK_MCLK_EN_MASK | 1863af3d54b9SSrinivas Kandagatla CDC_RX_CLK_MCLK2_EN_MASK, 1864af3d54b9SSrinivas Kandagatla CDC_RX_CLK_MCLK_ENABLE | 1865af3d54b9SSrinivas Kandagatla CDC_RX_CLK_MCLK2_ENABLE); 1866af3d54b9SSrinivas Kandagatla regmap_update_bits(regmap, CDC_RX_CLK_RST_CTRL_FS_CNT_CONTROL, 1867af3d54b9SSrinivas Kandagatla CDC_RX_FS_MCLK_CNT_CLR_MASK, 0x00); 1868af3d54b9SSrinivas Kandagatla regmap_update_bits(regmap, CDC_RX_CLK_RST_CTRL_FS_CNT_CONTROL, 1869af3d54b9SSrinivas Kandagatla CDC_RX_FS_MCLK_CNT_EN_MASK, 1870af3d54b9SSrinivas Kandagatla CDC_RX_FS_MCLK_CNT_ENABLE); 1871af3d54b9SSrinivas Kandagatla regcache_mark_dirty(regmap); 1872af3d54b9SSrinivas Kandagatla regcache_sync(regmap); 1873af3d54b9SSrinivas Kandagatla } 1874af3d54b9SSrinivas Kandagatla rx->rx_mclk_users++; 1875af3d54b9SSrinivas Kandagatla } else { 1876af3d54b9SSrinivas Kandagatla if (rx->rx_mclk_users <= 0) { 1877af3d54b9SSrinivas Kandagatla dev_err(rx->dev, "%s: clock already disabled\n", __func__); 1878af3d54b9SSrinivas Kandagatla rx->rx_mclk_users = 0; 1879af3d54b9SSrinivas Kandagatla return; 1880af3d54b9SSrinivas Kandagatla } 1881af3d54b9SSrinivas Kandagatla rx->rx_mclk_users--; 1882af3d54b9SSrinivas Kandagatla if (rx->rx_mclk_users == 0) { 1883af3d54b9SSrinivas Kandagatla regmap_update_bits(regmap, CDC_RX_CLK_RST_CTRL_FS_CNT_CONTROL, 1884af3d54b9SSrinivas Kandagatla CDC_RX_FS_MCLK_CNT_EN_MASK, 0x0); 1885af3d54b9SSrinivas Kandagatla regmap_update_bits(regmap, CDC_RX_CLK_RST_CTRL_FS_CNT_CONTROL, 1886af3d54b9SSrinivas Kandagatla CDC_RX_FS_MCLK_CNT_CLR_MASK, 1887af3d54b9SSrinivas Kandagatla CDC_RX_FS_MCLK_CNT_CLR); 1888af3d54b9SSrinivas Kandagatla regmap_update_bits(regmap, CDC_RX_CLK_RST_CTRL_MCLK_CONTROL, 1889af3d54b9SSrinivas Kandagatla CDC_RX_CLK_MCLK_EN_MASK | 1890af3d54b9SSrinivas Kandagatla CDC_RX_CLK_MCLK2_EN_MASK, 0x0); 1891af3d54b9SSrinivas Kandagatla } 1892af3d54b9SSrinivas Kandagatla } 1893af3d54b9SSrinivas Kandagatla } 1894af3d54b9SSrinivas Kandagatla 18954f692926SSrinivas Kandagatla static int rx_macro_mclk_event(struct snd_soc_dapm_widget *w, 18964f692926SSrinivas Kandagatla struct snd_kcontrol *kcontrol, int event) 18974f692926SSrinivas Kandagatla { 18984f692926SSrinivas Kandagatla struct snd_soc_component *component = snd_soc_dapm_to_component(w->dapm); 18994f692926SSrinivas Kandagatla struct rx_macro *rx = snd_soc_component_get_drvdata(component); 19004f692926SSrinivas Kandagatla int ret = 0; 19014f692926SSrinivas Kandagatla 19024f692926SSrinivas Kandagatla switch (event) { 19034f692926SSrinivas Kandagatla case SND_SOC_DAPM_PRE_PMU: 19044f692926SSrinivas Kandagatla rx_macro_mclk_enable(rx, true); 19054f692926SSrinivas Kandagatla break; 19064f692926SSrinivas Kandagatla case SND_SOC_DAPM_POST_PMD: 19074f692926SSrinivas Kandagatla rx_macro_mclk_enable(rx, false); 19084f692926SSrinivas Kandagatla break; 19094f692926SSrinivas Kandagatla default: 19104f692926SSrinivas Kandagatla dev_err(component->dev, "%s: invalid DAPM event %d\n", __func__, event); 19114f692926SSrinivas Kandagatla ret = -EINVAL; 19124f692926SSrinivas Kandagatla } 19134f692926SSrinivas Kandagatla return ret; 19144f692926SSrinivas Kandagatla } 19154f692926SSrinivas Kandagatla 19164f692926SSrinivas Kandagatla static bool rx_macro_adie_lb(struct snd_soc_component *component, 19174f692926SSrinivas Kandagatla int interp_idx) 19184f692926SSrinivas Kandagatla { 19194f692926SSrinivas Kandagatla u16 int_mux_cfg0, int_mux_cfg1; 19204f692926SSrinivas Kandagatla u8 int_n_inp0, int_n_inp1, int_n_inp2; 19214f692926SSrinivas Kandagatla 19224f692926SSrinivas Kandagatla int_mux_cfg0 = CDC_RX_INP_MUX_RX_INT0_CFG0 + interp_idx * 8; 19234f692926SSrinivas Kandagatla int_mux_cfg1 = int_mux_cfg0 + 4; 19244f692926SSrinivas Kandagatla 19254f692926SSrinivas Kandagatla int_n_inp0 = snd_soc_component_read_field(component, int_mux_cfg0, 19264f692926SSrinivas Kandagatla CDC_RX_INTX_1_MIX_INP0_SEL_MASK); 19274f692926SSrinivas Kandagatla int_n_inp1 = snd_soc_component_read_field(component, int_mux_cfg0, 19284f692926SSrinivas Kandagatla CDC_RX_INTX_1_MIX_INP1_SEL_MASK); 19294f692926SSrinivas Kandagatla int_n_inp2 = snd_soc_component_read_field(component, int_mux_cfg1, 19304f692926SSrinivas Kandagatla CDC_RX_INTX_1_MIX_INP2_SEL_MASK); 19314f692926SSrinivas Kandagatla 19324f692926SSrinivas Kandagatla if (int_n_inp0 == INTn_1_INP_SEL_DEC0 || 19334f692926SSrinivas Kandagatla int_n_inp0 == INTn_1_INP_SEL_DEC1 || 19344f692926SSrinivas Kandagatla int_n_inp0 == INTn_1_INP_SEL_IIR0 || 19354f692926SSrinivas Kandagatla int_n_inp0 == INTn_1_INP_SEL_IIR1) 19364f692926SSrinivas Kandagatla return true; 19374f692926SSrinivas Kandagatla 19384f692926SSrinivas Kandagatla if (int_n_inp1 == INTn_1_INP_SEL_DEC0 || 19394f692926SSrinivas Kandagatla int_n_inp1 == INTn_1_INP_SEL_DEC1 || 19404f692926SSrinivas Kandagatla int_n_inp1 == INTn_1_INP_SEL_IIR0 || 19414f692926SSrinivas Kandagatla int_n_inp1 == INTn_1_INP_SEL_IIR1) 19424f692926SSrinivas Kandagatla return true; 19434f692926SSrinivas Kandagatla 19444f692926SSrinivas Kandagatla if (int_n_inp2 == INTn_1_INP_SEL_DEC0 || 19454f692926SSrinivas Kandagatla int_n_inp2 == INTn_1_INP_SEL_DEC1 || 19464f692926SSrinivas Kandagatla int_n_inp2 == INTn_1_INP_SEL_IIR0 || 19474f692926SSrinivas Kandagatla int_n_inp2 == INTn_1_INP_SEL_IIR1) 19484f692926SSrinivas Kandagatla return true; 19494f692926SSrinivas Kandagatla 19504f692926SSrinivas Kandagatla return false; 19514f692926SSrinivas Kandagatla } 19524f692926SSrinivas Kandagatla 19534f692926SSrinivas Kandagatla static int rx_macro_enable_interp_clk(struct snd_soc_component *component, 19544f692926SSrinivas Kandagatla int event, int interp_idx); 19554f692926SSrinivas Kandagatla static int rx_macro_enable_main_path(struct snd_soc_dapm_widget *w, 19564f692926SSrinivas Kandagatla struct snd_kcontrol *kcontrol, 19574f692926SSrinivas Kandagatla int event) 19584f692926SSrinivas Kandagatla { 19594f692926SSrinivas Kandagatla struct snd_soc_component *component = snd_soc_dapm_to_component(w->dapm); 19604f692926SSrinivas Kandagatla u16 gain_reg, reg; 19614f692926SSrinivas Kandagatla 19624f692926SSrinivas Kandagatla reg = CDC_RX_RXn_RX_PATH_CTL(w->shift); 19634f692926SSrinivas Kandagatla gain_reg = CDC_RX_RXn_RX_VOL_CTL(w->shift); 19644f692926SSrinivas Kandagatla 19654f692926SSrinivas Kandagatla switch (event) { 19664f692926SSrinivas Kandagatla case SND_SOC_DAPM_PRE_PMU: 19674f692926SSrinivas Kandagatla rx_macro_enable_interp_clk(component, event, w->shift); 19684f692926SSrinivas Kandagatla if (rx_macro_adie_lb(component, w->shift)) 19694f692926SSrinivas Kandagatla snd_soc_component_update_bits(component, reg, 19704f692926SSrinivas Kandagatla CDC_RX_PATH_CLK_EN_MASK, 19714f692926SSrinivas Kandagatla CDC_RX_PATH_CLK_ENABLE); 19724f692926SSrinivas Kandagatla break; 19734f692926SSrinivas Kandagatla case SND_SOC_DAPM_POST_PMU: 19744f692926SSrinivas Kandagatla snd_soc_component_write(component, gain_reg, 19754f692926SSrinivas Kandagatla snd_soc_component_read(component, gain_reg)); 19764f692926SSrinivas Kandagatla break; 19774f692926SSrinivas Kandagatla case SND_SOC_DAPM_POST_PMD: 19784f692926SSrinivas Kandagatla rx_macro_enable_interp_clk(component, event, w->shift); 19794f692926SSrinivas Kandagatla break; 19804f692926SSrinivas Kandagatla } 19814f692926SSrinivas Kandagatla 19824f692926SSrinivas Kandagatla return 0; 19834f692926SSrinivas Kandagatla } 19844f692926SSrinivas Kandagatla 19854f692926SSrinivas Kandagatla static int rx_macro_config_compander(struct snd_soc_component *component, 19864f692926SSrinivas Kandagatla struct rx_macro *rx, 19874f692926SSrinivas Kandagatla int comp, int event) 19884f692926SSrinivas Kandagatla { 19894f692926SSrinivas Kandagatla u8 pcm_rate, val; 19904f692926SSrinivas Kandagatla 19914f692926SSrinivas Kandagatla /* AUX does not have compander */ 19924f692926SSrinivas Kandagatla if (comp == INTERP_AUX) 19934f692926SSrinivas Kandagatla return 0; 19944f692926SSrinivas Kandagatla 19954f692926SSrinivas Kandagatla pcm_rate = snd_soc_component_read(component, CDC_RX_RXn_RX_PATH_CTL(comp)) & 0x0F; 19964f692926SSrinivas Kandagatla if (pcm_rate < 0x06) 19974f692926SSrinivas Kandagatla val = 0x03; 19984f692926SSrinivas Kandagatla else if (pcm_rate < 0x08) 19994f692926SSrinivas Kandagatla val = 0x01; 20004f692926SSrinivas Kandagatla else if (pcm_rate < 0x0B) 20014f692926SSrinivas Kandagatla val = 0x02; 20024f692926SSrinivas Kandagatla else 20034f692926SSrinivas Kandagatla val = 0x00; 20044f692926SSrinivas Kandagatla 20054f692926SSrinivas Kandagatla if (SND_SOC_DAPM_EVENT_ON(event)) 20064f692926SSrinivas Kandagatla snd_soc_component_update_bits(component, CDC_RX_RXn_RX_PATH_CFG3(comp), 20074f692926SSrinivas Kandagatla CDC_RX_DC_COEFF_SEL_MASK, val); 20084f692926SSrinivas Kandagatla 20094f692926SSrinivas Kandagatla if (SND_SOC_DAPM_EVENT_OFF(event)) 20104f692926SSrinivas Kandagatla snd_soc_component_update_bits(component, CDC_RX_RXn_RX_PATH_CFG3(comp), 20114f692926SSrinivas Kandagatla CDC_RX_DC_COEFF_SEL_MASK, 0x3); 20124f692926SSrinivas Kandagatla if (!rx->comp_enabled[comp]) 20134f692926SSrinivas Kandagatla return 0; 20144f692926SSrinivas Kandagatla 20154f692926SSrinivas Kandagatla if (SND_SOC_DAPM_EVENT_ON(event)) { 20164f692926SSrinivas Kandagatla /* Enable Compander Clock */ 20174f692926SSrinivas Kandagatla snd_soc_component_write_field(component, CDC_RX_COMPANDERn_CTL0(comp), 20184f692926SSrinivas Kandagatla CDC_RX_COMPANDERn_CLK_EN_MASK, 0x1); 20194f692926SSrinivas Kandagatla snd_soc_component_write_field(component, CDC_RX_COMPANDERn_CTL0(comp), 20204f692926SSrinivas Kandagatla CDC_RX_COMPANDERn_SOFT_RST_MASK, 0x1); 20214f692926SSrinivas Kandagatla snd_soc_component_write_field(component, CDC_RX_COMPANDERn_CTL0(comp), 20224f692926SSrinivas Kandagatla CDC_RX_COMPANDERn_SOFT_RST_MASK, 0x0); 20234f692926SSrinivas Kandagatla snd_soc_component_write_field(component, CDC_RX_RXn_RX_PATH_CFG0(comp), 20244f692926SSrinivas Kandagatla CDC_RX_RXn_COMP_EN_MASK, 0x1); 20254f692926SSrinivas Kandagatla } 20264f692926SSrinivas Kandagatla 20274f692926SSrinivas Kandagatla if (SND_SOC_DAPM_EVENT_OFF(event)) { 20284f692926SSrinivas Kandagatla snd_soc_component_write_field(component, CDC_RX_COMPANDERn_CTL0(comp), 20294f692926SSrinivas Kandagatla CDC_RX_COMPANDERn_HALT_MASK, 0x1); 20304f692926SSrinivas Kandagatla snd_soc_component_write_field(component, CDC_RX_RXn_RX_PATH_CFG0(comp), 20314f692926SSrinivas Kandagatla CDC_RX_RXn_COMP_EN_MASK, 0x0); 20324f692926SSrinivas Kandagatla snd_soc_component_write_field(component, CDC_RX_COMPANDERn_CTL0(comp), 20334f692926SSrinivas Kandagatla CDC_RX_COMPANDERn_CLK_EN_MASK, 0x0); 20344f692926SSrinivas Kandagatla snd_soc_component_write_field(component, CDC_RX_COMPANDERn_CTL0(comp), 20354f692926SSrinivas Kandagatla CDC_RX_COMPANDERn_HALT_MASK, 0x0); 20364f692926SSrinivas Kandagatla } 20374f692926SSrinivas Kandagatla 20384f692926SSrinivas Kandagatla return 0; 20394f692926SSrinivas Kandagatla } 20404f692926SSrinivas Kandagatla 20414f692926SSrinivas Kandagatla static int rx_macro_load_compander_coeff(struct snd_soc_component *component, 20424f692926SSrinivas Kandagatla struct rx_macro *rx, 20434f692926SSrinivas Kandagatla int comp, int event) 20444f692926SSrinivas Kandagatla { 20454f692926SSrinivas Kandagatla u16 comp_coeff_lsb_reg, comp_coeff_msb_reg; 20464f692926SSrinivas Kandagatla int i; 2047ff568785SColin Ian King int hph_pwr_mode; 20484f692926SSrinivas Kandagatla 20494f692926SSrinivas Kandagatla if (!rx->comp_enabled[comp]) 20504f692926SSrinivas Kandagatla return 0; 20514f692926SSrinivas Kandagatla 20524f692926SSrinivas Kandagatla if (comp == INTERP_HPHL) { 20534f692926SSrinivas Kandagatla comp_coeff_lsb_reg = CDC_RX_TOP_HPHL_COMP_WR_LSB; 20544f692926SSrinivas Kandagatla comp_coeff_msb_reg = CDC_RX_TOP_HPHL_COMP_WR_MSB; 20554f692926SSrinivas Kandagatla } else if (comp == INTERP_HPHR) { 20564f692926SSrinivas Kandagatla comp_coeff_lsb_reg = CDC_RX_TOP_HPHR_COMP_WR_LSB; 20574f692926SSrinivas Kandagatla comp_coeff_msb_reg = CDC_RX_TOP_HPHR_COMP_WR_MSB; 20584f692926SSrinivas Kandagatla } else { 20594f692926SSrinivas Kandagatla /* compander coefficients are loaded only for hph path */ 20604f692926SSrinivas Kandagatla return 0; 20614f692926SSrinivas Kandagatla } 20624f692926SSrinivas Kandagatla 20634f692926SSrinivas Kandagatla hph_pwr_mode = rx->hph_pwr_mode; 20644f692926SSrinivas Kandagatla 20654f692926SSrinivas Kandagatla if (SND_SOC_DAPM_EVENT_ON(event)) { 20664f692926SSrinivas Kandagatla /* Load Compander Coeff */ 20674f692926SSrinivas Kandagatla for (i = 0; i < COMP_MAX_COEFF; i++) { 20684f692926SSrinivas Kandagatla snd_soc_component_write(component, comp_coeff_lsb_reg, 20694f692926SSrinivas Kandagatla comp_coeff_table[hph_pwr_mode][i].lsb); 20704f692926SSrinivas Kandagatla snd_soc_component_write(component, comp_coeff_msb_reg, 20714f692926SSrinivas Kandagatla comp_coeff_table[hph_pwr_mode][i].msb); 20724f692926SSrinivas Kandagatla } 20734f692926SSrinivas Kandagatla } 20744f692926SSrinivas Kandagatla 20754f692926SSrinivas Kandagatla return 0; 20764f692926SSrinivas Kandagatla } 20774f692926SSrinivas Kandagatla 20784f692926SSrinivas Kandagatla static void rx_macro_enable_softclip_clk(struct snd_soc_component *component, 20794f692926SSrinivas Kandagatla struct rx_macro *rx, bool enable) 20804f692926SSrinivas Kandagatla { 20814f692926SSrinivas Kandagatla if (enable) { 20824f692926SSrinivas Kandagatla if (rx->softclip_clk_users == 0) 20834f692926SSrinivas Kandagatla snd_soc_component_write_field(component, CDC_RX_SOFTCLIP_CRC, 20844f692926SSrinivas Kandagatla CDC_RX_SOFTCLIP_CLK_EN_MASK, 1); 20854f692926SSrinivas Kandagatla rx->softclip_clk_users++; 20864f692926SSrinivas Kandagatla } else { 20874f692926SSrinivas Kandagatla rx->softclip_clk_users--; 20884f692926SSrinivas Kandagatla if (rx->softclip_clk_users == 0) 20894f692926SSrinivas Kandagatla snd_soc_component_write_field(component, CDC_RX_SOFTCLIP_CRC, 20904f692926SSrinivas Kandagatla CDC_RX_SOFTCLIP_CLK_EN_MASK, 0); 20914f692926SSrinivas Kandagatla } 20924f692926SSrinivas Kandagatla } 20934f692926SSrinivas Kandagatla 20944f692926SSrinivas Kandagatla static int rx_macro_config_softclip(struct snd_soc_component *component, 20954f692926SSrinivas Kandagatla struct rx_macro *rx, int event) 20964f692926SSrinivas Kandagatla { 20974f692926SSrinivas Kandagatla 20984f692926SSrinivas Kandagatla if (!rx->is_softclip_on) 20994f692926SSrinivas Kandagatla return 0; 21004f692926SSrinivas Kandagatla 21014f692926SSrinivas Kandagatla if (SND_SOC_DAPM_EVENT_ON(event)) { 21024f692926SSrinivas Kandagatla /* Enable Softclip clock */ 21034f692926SSrinivas Kandagatla rx_macro_enable_softclip_clk(component, rx, true); 21044f692926SSrinivas Kandagatla /* Enable Softclip control */ 21054f692926SSrinivas Kandagatla snd_soc_component_write_field(component, CDC_RX_SOFTCLIP_SOFTCLIP_CTRL, 21064f692926SSrinivas Kandagatla CDC_RX_SOFTCLIP_EN_MASK, 0x01); 21074f692926SSrinivas Kandagatla } 21084f692926SSrinivas Kandagatla 21094f692926SSrinivas Kandagatla if (SND_SOC_DAPM_EVENT_OFF(event)) { 21104f692926SSrinivas Kandagatla snd_soc_component_write_field(component, CDC_RX_SOFTCLIP_SOFTCLIP_CTRL, 21114f692926SSrinivas Kandagatla CDC_RX_SOFTCLIP_EN_MASK, 0x0); 21124f692926SSrinivas Kandagatla rx_macro_enable_softclip_clk(component, rx, false); 21134f692926SSrinivas Kandagatla } 21144f692926SSrinivas Kandagatla 21154f692926SSrinivas Kandagatla return 0; 21164f692926SSrinivas Kandagatla } 21174f692926SSrinivas Kandagatla 21184f692926SSrinivas Kandagatla static int rx_macro_config_aux_hpf(struct snd_soc_component *component, 21194f692926SSrinivas Kandagatla struct rx_macro *rx, int event) 21204f692926SSrinivas Kandagatla { 21214f692926SSrinivas Kandagatla if (SND_SOC_DAPM_EVENT_ON(event)) { 21224f692926SSrinivas Kandagatla /* Update Aux HPF control */ 21234f692926SSrinivas Kandagatla if (!rx->is_aux_hpf_on) 21244f692926SSrinivas Kandagatla snd_soc_component_update_bits(component, 21254f692926SSrinivas Kandagatla CDC_RX_RX2_RX_PATH_CFG1, 0x04, 0x00); 21264f692926SSrinivas Kandagatla } 21274f692926SSrinivas Kandagatla 21284f692926SSrinivas Kandagatla if (SND_SOC_DAPM_EVENT_OFF(event)) { 21294f692926SSrinivas Kandagatla /* Reset to default (HPF=ON) */ 21304f692926SSrinivas Kandagatla snd_soc_component_update_bits(component, 21314f692926SSrinivas Kandagatla CDC_RX_RX2_RX_PATH_CFG1, 0x04, 0x04); 21324f692926SSrinivas Kandagatla } 21334f692926SSrinivas Kandagatla 21344f692926SSrinivas Kandagatla return 0; 21354f692926SSrinivas Kandagatla } 21364f692926SSrinivas Kandagatla 2137af3d54b9SSrinivas Kandagatla static inline void rx_macro_enable_clsh_block(struct rx_macro *rx, bool enable) 2138af3d54b9SSrinivas Kandagatla { 2139af3d54b9SSrinivas Kandagatla if ((enable && ++rx->clsh_users == 1) || (!enable && --rx->clsh_users == 0)) 2140af3d54b9SSrinivas Kandagatla snd_soc_component_update_bits(rx->component, CDC_RX_CLSH_CRC, 2141af3d54b9SSrinivas Kandagatla CDC_RX_CLSH_CLK_EN_MASK, enable); 2142af3d54b9SSrinivas Kandagatla if (rx->clsh_users < 0) 2143af3d54b9SSrinivas Kandagatla rx->clsh_users = 0; 2144af3d54b9SSrinivas Kandagatla } 2145af3d54b9SSrinivas Kandagatla 21464f692926SSrinivas Kandagatla static int rx_macro_config_classh(struct snd_soc_component *component, 21474f692926SSrinivas Kandagatla struct rx_macro *rx, 21484f692926SSrinivas Kandagatla int interp_n, int event) 21494f692926SSrinivas Kandagatla { 21504f692926SSrinivas Kandagatla if (SND_SOC_DAPM_EVENT_OFF(event)) { 21514f692926SSrinivas Kandagatla rx_macro_enable_clsh_block(rx, false); 21524f692926SSrinivas Kandagatla return 0; 21534f692926SSrinivas Kandagatla } 21544f692926SSrinivas Kandagatla 21554f692926SSrinivas Kandagatla if (!SND_SOC_DAPM_EVENT_ON(event)) 21564f692926SSrinivas Kandagatla return 0; 21574f692926SSrinivas Kandagatla 21584f692926SSrinivas Kandagatla rx_macro_enable_clsh_block(rx, true); 21594f692926SSrinivas Kandagatla if (interp_n == INTERP_HPHL || 21604f692926SSrinivas Kandagatla interp_n == INTERP_HPHR) { 21614f692926SSrinivas Kandagatla /* 21624f692926SSrinivas Kandagatla * These K1 values depend on the Headphone Impedance 21634f692926SSrinivas Kandagatla * For now it is assumed to be 16 ohm 21644f692926SSrinivas Kandagatla */ 21654f692926SSrinivas Kandagatla snd_soc_component_write(component, CDC_RX_CLSH_K1_LSB, 0xc0); 21664f692926SSrinivas Kandagatla snd_soc_component_write_field(component, CDC_RX_CLSH_K1_MSB, 21674f692926SSrinivas Kandagatla CDC_RX_CLSH_K1_MSB_COEFF_MASK, 0); 21684f692926SSrinivas Kandagatla } 21694f692926SSrinivas Kandagatla switch (interp_n) { 21704f692926SSrinivas Kandagatla case INTERP_HPHL: 21714f692926SSrinivas Kandagatla if (rx->is_ear_mode_on) 21724f692926SSrinivas Kandagatla snd_soc_component_update_bits(component, 21734f692926SSrinivas Kandagatla CDC_RX_CLSH_HPH_V_PA, 21744f692926SSrinivas Kandagatla CDC_RX_CLSH_HPH_V_PA_MIN_MASK, 0x39); 21754f692926SSrinivas Kandagatla else 21764f692926SSrinivas Kandagatla snd_soc_component_update_bits(component, 21774f692926SSrinivas Kandagatla CDC_RX_CLSH_HPH_V_PA, 21784f692926SSrinivas Kandagatla CDC_RX_CLSH_HPH_V_PA_MIN_MASK, 0x1c); 21794f692926SSrinivas Kandagatla snd_soc_component_update_bits(component, 21804f692926SSrinivas Kandagatla CDC_RX_CLSH_DECAY_CTRL, 21814f692926SSrinivas Kandagatla CDC_RX_CLSH_DECAY_RATE_MASK, 0x0); 21824f692926SSrinivas Kandagatla snd_soc_component_write_field(component, 21834f692926SSrinivas Kandagatla CDC_RX_RX0_RX_PATH_CFG0, 21844f692926SSrinivas Kandagatla CDC_RX_RXn_CLSH_EN_MASK, 0x1); 21854f692926SSrinivas Kandagatla break; 21864f692926SSrinivas Kandagatla case INTERP_HPHR: 21874f692926SSrinivas Kandagatla if (rx->is_ear_mode_on) 21884f692926SSrinivas Kandagatla snd_soc_component_update_bits(component, 21894f692926SSrinivas Kandagatla CDC_RX_CLSH_HPH_V_PA, 21904f692926SSrinivas Kandagatla CDC_RX_CLSH_HPH_V_PA_MIN_MASK, 0x39); 21914f692926SSrinivas Kandagatla else 21924f692926SSrinivas Kandagatla snd_soc_component_update_bits(component, 21934f692926SSrinivas Kandagatla CDC_RX_CLSH_HPH_V_PA, 21944f692926SSrinivas Kandagatla CDC_RX_CLSH_HPH_V_PA_MIN_MASK, 0x1c); 21954f692926SSrinivas Kandagatla snd_soc_component_update_bits(component, 21964f692926SSrinivas Kandagatla CDC_RX_CLSH_DECAY_CTRL, 21974f692926SSrinivas Kandagatla CDC_RX_CLSH_DECAY_RATE_MASK, 0x0); 2198cb04d8cdSSrinivas Kandagatla snd_soc_component_write_field(component, 21994f692926SSrinivas Kandagatla CDC_RX_RX1_RX_PATH_CFG0, 22004f692926SSrinivas Kandagatla CDC_RX_RXn_CLSH_EN_MASK, 0x1); 22014f692926SSrinivas Kandagatla break; 22024f692926SSrinivas Kandagatla case INTERP_AUX: 22034f692926SSrinivas Kandagatla snd_soc_component_update_bits(component, 22044f692926SSrinivas Kandagatla CDC_RX_RX2_RX_PATH_CFG0, 22054f692926SSrinivas Kandagatla CDC_RX_RX2_DLY_Z_EN_MASK, 1); 22064f692926SSrinivas Kandagatla snd_soc_component_write_field(component, 22074f692926SSrinivas Kandagatla CDC_RX_RX2_RX_PATH_CFG0, 22084f692926SSrinivas Kandagatla CDC_RX_RX2_CLSH_EN_MASK, 1); 22094f692926SSrinivas Kandagatla break; 22104f692926SSrinivas Kandagatla } 22114f692926SSrinivas Kandagatla 22124f692926SSrinivas Kandagatla return 0; 22134f692926SSrinivas Kandagatla } 22144f692926SSrinivas Kandagatla 22154f692926SSrinivas Kandagatla static void rx_macro_hd2_control(struct snd_soc_component *component, 22164f692926SSrinivas Kandagatla u16 interp_idx, int event) 22174f692926SSrinivas Kandagatla { 22184f692926SSrinivas Kandagatla u16 hd2_scale_reg, hd2_enable_reg; 22194f692926SSrinivas Kandagatla 22204f692926SSrinivas Kandagatla switch (interp_idx) { 22214f692926SSrinivas Kandagatla case INTERP_HPHL: 22224f692926SSrinivas Kandagatla hd2_scale_reg = CDC_RX_RX0_RX_PATH_SEC3; 22234f692926SSrinivas Kandagatla hd2_enable_reg = CDC_RX_RX0_RX_PATH_CFG0; 22244f692926SSrinivas Kandagatla break; 22254f692926SSrinivas Kandagatla case INTERP_HPHR: 22264f692926SSrinivas Kandagatla hd2_scale_reg = CDC_RX_RX1_RX_PATH_SEC3; 22274f692926SSrinivas Kandagatla hd2_enable_reg = CDC_RX_RX1_RX_PATH_CFG0; 22284f692926SSrinivas Kandagatla break; 22294f692926SSrinivas Kandagatla } 22304f692926SSrinivas Kandagatla 22314f692926SSrinivas Kandagatla if (hd2_enable_reg && SND_SOC_DAPM_EVENT_ON(event)) { 22324f692926SSrinivas Kandagatla snd_soc_component_update_bits(component, hd2_scale_reg, 22334f692926SSrinivas Kandagatla CDC_RX_RXn_HD2_ALPHA_MASK, 0x14); 22344f692926SSrinivas Kandagatla snd_soc_component_write_field(component, hd2_enable_reg, 22354f692926SSrinivas Kandagatla CDC_RX_RXn_HD2_EN_MASK, 1); 22364f692926SSrinivas Kandagatla } 22374f692926SSrinivas Kandagatla 22384f692926SSrinivas Kandagatla if (hd2_enable_reg && SND_SOC_DAPM_EVENT_OFF(event)) { 22394f692926SSrinivas Kandagatla snd_soc_component_write_field(component, hd2_enable_reg, 22404f692926SSrinivas Kandagatla CDC_RX_RXn_HD2_EN_MASK, 0); 22414f692926SSrinivas Kandagatla snd_soc_component_update_bits(component, hd2_scale_reg, 22424f692926SSrinivas Kandagatla CDC_RX_RXn_HD2_ALPHA_MASK, 0x0); 22434f692926SSrinivas Kandagatla } 22444f692926SSrinivas Kandagatla } 22454f692926SSrinivas Kandagatla 2246af3d54b9SSrinivas Kandagatla static int rx_macro_get_compander(struct snd_kcontrol *kcontrol, 2247af3d54b9SSrinivas Kandagatla struct snd_ctl_elem_value *ucontrol) 2248af3d54b9SSrinivas Kandagatla { 2249af3d54b9SSrinivas Kandagatla struct snd_soc_component *component = 2250af3d54b9SSrinivas Kandagatla snd_soc_kcontrol_component(kcontrol); 2251af3d54b9SSrinivas Kandagatla int comp = ((struct soc_mixer_control *) kcontrol->private_value)->shift; 2252af3d54b9SSrinivas Kandagatla struct rx_macro *rx = snd_soc_component_get_drvdata(component); 2253af3d54b9SSrinivas Kandagatla 2254af3d54b9SSrinivas Kandagatla ucontrol->value.integer.value[0] = rx->comp_enabled[comp]; 2255af3d54b9SSrinivas Kandagatla return 0; 2256af3d54b9SSrinivas Kandagatla } 2257af3d54b9SSrinivas Kandagatla 2258af3d54b9SSrinivas Kandagatla static int rx_macro_set_compander(struct snd_kcontrol *kcontrol, 2259af3d54b9SSrinivas Kandagatla struct snd_ctl_elem_value *ucontrol) 2260af3d54b9SSrinivas Kandagatla { 2261af3d54b9SSrinivas Kandagatla struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol); 2262af3d54b9SSrinivas Kandagatla int comp = ((struct soc_mixer_control *) kcontrol->private_value)->shift; 2263af3d54b9SSrinivas Kandagatla int value = ucontrol->value.integer.value[0]; 2264af3d54b9SSrinivas Kandagatla struct rx_macro *rx = snd_soc_component_get_drvdata(component); 2265af3d54b9SSrinivas Kandagatla 2266af3d54b9SSrinivas Kandagatla rx->comp_enabled[comp] = value; 2267af3d54b9SSrinivas Kandagatla 2268af3d54b9SSrinivas Kandagatla return 0; 2269af3d54b9SSrinivas Kandagatla } 2270af3d54b9SSrinivas Kandagatla 22714f692926SSrinivas Kandagatla static int rx_macro_mux_get(struct snd_kcontrol *kcontrol, 22724f692926SSrinivas Kandagatla struct snd_ctl_elem_value *ucontrol) 22734f692926SSrinivas Kandagatla { 22744f692926SSrinivas Kandagatla struct snd_soc_dapm_widget *widget = snd_soc_dapm_kcontrol_widget(kcontrol); 22754f692926SSrinivas Kandagatla struct snd_soc_component *component = snd_soc_dapm_to_component(widget->dapm); 22764f692926SSrinivas Kandagatla struct rx_macro *rx = snd_soc_component_get_drvdata(component); 22774f692926SSrinivas Kandagatla 22784f692926SSrinivas Kandagatla ucontrol->value.integer.value[0] = 22794f692926SSrinivas Kandagatla rx->rx_port_value[widget->shift]; 22804f692926SSrinivas Kandagatla return 0; 22814f692926SSrinivas Kandagatla } 22824f692926SSrinivas Kandagatla 22834f692926SSrinivas Kandagatla static int rx_macro_mux_put(struct snd_kcontrol *kcontrol, 22844f692926SSrinivas Kandagatla struct snd_ctl_elem_value *ucontrol) 22854f692926SSrinivas Kandagatla { 22864f692926SSrinivas Kandagatla struct snd_soc_dapm_widget *widget = snd_soc_dapm_kcontrol_widget(kcontrol); 22874f692926SSrinivas Kandagatla struct snd_soc_component *component = snd_soc_dapm_to_component(widget->dapm); 22884f692926SSrinivas Kandagatla struct soc_enum *e = (struct soc_enum *)kcontrol->private_value; 22894f692926SSrinivas Kandagatla struct snd_soc_dapm_update *update = NULL; 22904f692926SSrinivas Kandagatla u32 rx_port_value = ucontrol->value.integer.value[0]; 22914f692926SSrinivas Kandagatla u32 aif_rst; 22924f692926SSrinivas Kandagatla struct rx_macro *rx = snd_soc_component_get_drvdata(component); 22934f692926SSrinivas Kandagatla 22944f692926SSrinivas Kandagatla aif_rst = rx->rx_port_value[widget->shift]; 22954f692926SSrinivas Kandagatla if (!rx_port_value) { 22964f692926SSrinivas Kandagatla if (aif_rst == 0) { 22974f692926SSrinivas Kandagatla dev_err(component->dev, "%s:AIF reset already\n", __func__); 22984f692926SSrinivas Kandagatla return 0; 22994f692926SSrinivas Kandagatla } 23004f692926SSrinivas Kandagatla if (aif_rst > RX_MACRO_AIF4_PB) { 23014f692926SSrinivas Kandagatla dev_err(component->dev, "%s: Invalid AIF reset\n", __func__); 23024f692926SSrinivas Kandagatla return 0; 23034f692926SSrinivas Kandagatla } 23044f692926SSrinivas Kandagatla } 23054f692926SSrinivas Kandagatla rx->rx_port_value[widget->shift] = rx_port_value; 23064f692926SSrinivas Kandagatla 23074f692926SSrinivas Kandagatla switch (rx_port_value) { 23084f692926SSrinivas Kandagatla case 0: 23094f692926SSrinivas Kandagatla if (rx->active_ch_cnt[aif_rst]) { 23104f692926SSrinivas Kandagatla clear_bit(widget->shift, 23114f692926SSrinivas Kandagatla &rx->active_ch_mask[aif_rst]); 23124f692926SSrinivas Kandagatla rx->active_ch_cnt[aif_rst]--; 23134f692926SSrinivas Kandagatla } 23144f692926SSrinivas Kandagatla break; 23154f692926SSrinivas Kandagatla case 1: 23164f692926SSrinivas Kandagatla case 2: 23174f692926SSrinivas Kandagatla case 3: 23184f692926SSrinivas Kandagatla case 4: 23194f692926SSrinivas Kandagatla set_bit(widget->shift, 23204f692926SSrinivas Kandagatla &rx->active_ch_mask[rx_port_value]); 23214f692926SSrinivas Kandagatla rx->active_ch_cnt[rx_port_value]++; 23224f692926SSrinivas Kandagatla break; 23234f692926SSrinivas Kandagatla default: 23244f692926SSrinivas Kandagatla dev_err(component->dev, 23254f692926SSrinivas Kandagatla "%s:Invalid AIF_ID for RX_MACRO MUX %d\n", 23264f692926SSrinivas Kandagatla __func__, rx_port_value); 23274f692926SSrinivas Kandagatla goto err; 23284f692926SSrinivas Kandagatla } 23294f692926SSrinivas Kandagatla 23304f692926SSrinivas Kandagatla snd_soc_dapm_mux_update_power(widget->dapm, kcontrol, 23314f692926SSrinivas Kandagatla rx_port_value, e, update); 23324f692926SSrinivas Kandagatla return 0; 23334f692926SSrinivas Kandagatla err: 23344f692926SSrinivas Kandagatla return -EINVAL; 23354f692926SSrinivas Kandagatla } 23364f692926SSrinivas Kandagatla 23374f692926SSrinivas Kandagatla static const struct snd_kcontrol_new rx_macro_rx0_mux = 23384f692926SSrinivas Kandagatla SOC_DAPM_ENUM_EXT("rx_macro_rx0", rx_macro_rx0_enum, 23394f692926SSrinivas Kandagatla rx_macro_mux_get, rx_macro_mux_put); 23404f692926SSrinivas Kandagatla static const struct snd_kcontrol_new rx_macro_rx1_mux = 23414f692926SSrinivas Kandagatla SOC_DAPM_ENUM_EXT("rx_macro_rx1", rx_macro_rx1_enum, 23424f692926SSrinivas Kandagatla rx_macro_mux_get, rx_macro_mux_put); 23434f692926SSrinivas Kandagatla static const struct snd_kcontrol_new rx_macro_rx2_mux = 23444f692926SSrinivas Kandagatla SOC_DAPM_ENUM_EXT("rx_macro_rx2", rx_macro_rx2_enum, 23454f692926SSrinivas Kandagatla rx_macro_mux_get, rx_macro_mux_put); 23464f692926SSrinivas Kandagatla static const struct snd_kcontrol_new rx_macro_rx3_mux = 23474f692926SSrinivas Kandagatla SOC_DAPM_ENUM_EXT("rx_macro_rx3", rx_macro_rx3_enum, 23484f692926SSrinivas Kandagatla rx_macro_mux_get, rx_macro_mux_put); 23494f692926SSrinivas Kandagatla static const struct snd_kcontrol_new rx_macro_rx4_mux = 23504f692926SSrinivas Kandagatla SOC_DAPM_ENUM_EXT("rx_macro_rx4", rx_macro_rx4_enum, 23514f692926SSrinivas Kandagatla rx_macro_mux_get, rx_macro_mux_put); 23524f692926SSrinivas Kandagatla static const struct snd_kcontrol_new rx_macro_rx5_mux = 23534f692926SSrinivas Kandagatla SOC_DAPM_ENUM_EXT("rx_macro_rx5", rx_macro_rx5_enum, 23544f692926SSrinivas Kandagatla rx_macro_mux_get, rx_macro_mux_put); 23554f692926SSrinivas Kandagatla 2356af3d54b9SSrinivas Kandagatla static int rx_macro_get_ear_mode(struct snd_kcontrol *kcontrol, 2357af3d54b9SSrinivas Kandagatla struct snd_ctl_elem_value *ucontrol) 2358af3d54b9SSrinivas Kandagatla { 2359af3d54b9SSrinivas Kandagatla struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol); 2360af3d54b9SSrinivas Kandagatla struct rx_macro *rx = snd_soc_component_get_drvdata(component); 2361af3d54b9SSrinivas Kandagatla 2362af3d54b9SSrinivas Kandagatla ucontrol->value.integer.value[0] = rx->is_ear_mode_on; 2363af3d54b9SSrinivas Kandagatla return 0; 2364af3d54b9SSrinivas Kandagatla } 2365af3d54b9SSrinivas Kandagatla 2366af3d54b9SSrinivas Kandagatla static int rx_macro_put_ear_mode(struct snd_kcontrol *kcontrol, 2367af3d54b9SSrinivas Kandagatla struct snd_ctl_elem_value *ucontrol) 2368af3d54b9SSrinivas Kandagatla { 2369af3d54b9SSrinivas Kandagatla struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol); 2370af3d54b9SSrinivas Kandagatla struct rx_macro *rx = snd_soc_component_get_drvdata(component); 2371af3d54b9SSrinivas Kandagatla 2372af3d54b9SSrinivas Kandagatla rx->is_ear_mode_on = (!ucontrol->value.integer.value[0] ? false : true); 2373af3d54b9SSrinivas Kandagatla return 0; 2374af3d54b9SSrinivas Kandagatla } 2375af3d54b9SSrinivas Kandagatla 2376af3d54b9SSrinivas Kandagatla static int rx_macro_get_hph_hd2_mode(struct snd_kcontrol *kcontrol, 2377af3d54b9SSrinivas Kandagatla struct snd_ctl_elem_value *ucontrol) 2378af3d54b9SSrinivas Kandagatla { 2379af3d54b9SSrinivas Kandagatla struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol); 2380af3d54b9SSrinivas Kandagatla struct rx_macro *rx = snd_soc_component_get_drvdata(component); 2381af3d54b9SSrinivas Kandagatla 2382af3d54b9SSrinivas Kandagatla ucontrol->value.integer.value[0] = rx->hph_hd2_mode; 2383af3d54b9SSrinivas Kandagatla return 0; 2384af3d54b9SSrinivas Kandagatla } 2385af3d54b9SSrinivas Kandagatla 2386af3d54b9SSrinivas Kandagatla static int rx_macro_put_hph_hd2_mode(struct snd_kcontrol *kcontrol, 2387af3d54b9SSrinivas Kandagatla struct snd_ctl_elem_value *ucontrol) 2388af3d54b9SSrinivas Kandagatla { 2389af3d54b9SSrinivas Kandagatla struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol); 2390af3d54b9SSrinivas Kandagatla struct rx_macro *rx = snd_soc_component_get_drvdata(component); 2391af3d54b9SSrinivas Kandagatla 2392af3d54b9SSrinivas Kandagatla rx->hph_hd2_mode = ucontrol->value.integer.value[0]; 2393af3d54b9SSrinivas Kandagatla return 0; 2394af3d54b9SSrinivas Kandagatla } 2395af3d54b9SSrinivas Kandagatla 2396af3d54b9SSrinivas Kandagatla static int rx_macro_get_hph_pwr_mode(struct snd_kcontrol *kcontrol, 2397af3d54b9SSrinivas Kandagatla struct snd_ctl_elem_value *ucontrol) 2398af3d54b9SSrinivas Kandagatla { 2399af3d54b9SSrinivas Kandagatla struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol); 2400af3d54b9SSrinivas Kandagatla struct rx_macro *rx = snd_soc_component_get_drvdata(component); 2401af3d54b9SSrinivas Kandagatla 2402af3d54b9SSrinivas Kandagatla ucontrol->value.integer.value[0] = rx->hph_pwr_mode; 2403af3d54b9SSrinivas Kandagatla return 0; 2404af3d54b9SSrinivas Kandagatla } 2405af3d54b9SSrinivas Kandagatla 2406af3d54b9SSrinivas Kandagatla static int rx_macro_put_hph_pwr_mode(struct snd_kcontrol *kcontrol, 2407af3d54b9SSrinivas Kandagatla struct snd_ctl_elem_value *ucontrol) 2408af3d54b9SSrinivas Kandagatla { 2409af3d54b9SSrinivas Kandagatla struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol); 2410af3d54b9SSrinivas Kandagatla struct rx_macro *rx = snd_soc_component_get_drvdata(component); 2411af3d54b9SSrinivas Kandagatla 2412af3d54b9SSrinivas Kandagatla rx->hph_pwr_mode = ucontrol->value.integer.value[0]; 2413af3d54b9SSrinivas Kandagatla return 0; 2414af3d54b9SSrinivas Kandagatla } 2415af3d54b9SSrinivas Kandagatla 2416af3d54b9SSrinivas Kandagatla static int rx_macro_soft_clip_enable_get(struct snd_kcontrol *kcontrol, 2417af3d54b9SSrinivas Kandagatla struct snd_ctl_elem_value *ucontrol) 2418af3d54b9SSrinivas Kandagatla { 2419af3d54b9SSrinivas Kandagatla struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol); 2420af3d54b9SSrinivas Kandagatla struct rx_macro *rx = snd_soc_component_get_drvdata(component); 2421af3d54b9SSrinivas Kandagatla 2422af3d54b9SSrinivas Kandagatla ucontrol->value.integer.value[0] = rx->is_softclip_on; 2423af3d54b9SSrinivas Kandagatla 2424af3d54b9SSrinivas Kandagatla return 0; 2425af3d54b9SSrinivas Kandagatla } 2426af3d54b9SSrinivas Kandagatla 2427af3d54b9SSrinivas Kandagatla static int rx_macro_soft_clip_enable_put(struct snd_kcontrol *kcontrol, 2428af3d54b9SSrinivas Kandagatla struct snd_ctl_elem_value *ucontrol) 2429af3d54b9SSrinivas Kandagatla { 2430af3d54b9SSrinivas Kandagatla struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol); 2431af3d54b9SSrinivas Kandagatla struct rx_macro *rx = snd_soc_component_get_drvdata(component); 2432af3d54b9SSrinivas Kandagatla 2433af3d54b9SSrinivas Kandagatla rx->is_softclip_on = ucontrol->value.integer.value[0]; 2434af3d54b9SSrinivas Kandagatla 2435af3d54b9SSrinivas Kandagatla return 0; 2436af3d54b9SSrinivas Kandagatla } 2437af3d54b9SSrinivas Kandagatla 2438af3d54b9SSrinivas Kandagatla static int rx_macro_aux_hpf_mode_get(struct snd_kcontrol *kcontrol, 2439af3d54b9SSrinivas Kandagatla struct snd_ctl_elem_value *ucontrol) 2440af3d54b9SSrinivas Kandagatla { 2441af3d54b9SSrinivas Kandagatla struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol); 2442af3d54b9SSrinivas Kandagatla struct rx_macro *rx = snd_soc_component_get_drvdata(component); 2443af3d54b9SSrinivas Kandagatla 2444af3d54b9SSrinivas Kandagatla ucontrol->value.integer.value[0] = rx->is_aux_hpf_on; 2445af3d54b9SSrinivas Kandagatla 2446af3d54b9SSrinivas Kandagatla return 0; 2447af3d54b9SSrinivas Kandagatla } 2448af3d54b9SSrinivas Kandagatla 2449af3d54b9SSrinivas Kandagatla static int rx_macro_aux_hpf_mode_put(struct snd_kcontrol *kcontrol, 2450af3d54b9SSrinivas Kandagatla struct snd_ctl_elem_value *ucontrol) 2451af3d54b9SSrinivas Kandagatla { 2452af3d54b9SSrinivas Kandagatla struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol); 2453af3d54b9SSrinivas Kandagatla struct rx_macro *rx = snd_soc_component_get_drvdata(component); 2454af3d54b9SSrinivas Kandagatla 2455af3d54b9SSrinivas Kandagatla rx->is_aux_hpf_on = ucontrol->value.integer.value[0]; 2456af3d54b9SSrinivas Kandagatla 2457af3d54b9SSrinivas Kandagatla return 0; 2458af3d54b9SSrinivas Kandagatla } 2459af3d54b9SSrinivas Kandagatla 24604f692926SSrinivas Kandagatla static int rx_macro_hphdelay_lutbypass(struct snd_soc_component *component, 24614f692926SSrinivas Kandagatla struct rx_macro *rx, 24624f692926SSrinivas Kandagatla u16 interp_idx, int event) 24634f692926SSrinivas Kandagatla { 24644f692926SSrinivas Kandagatla u16 hph_lut_bypass_reg; 24654f692926SSrinivas Kandagatla u16 hph_comp_ctrl7; 24664f692926SSrinivas Kandagatla 24674f692926SSrinivas Kandagatla switch (interp_idx) { 24684f692926SSrinivas Kandagatla case INTERP_HPHL: 24694f692926SSrinivas Kandagatla hph_lut_bypass_reg = CDC_RX_TOP_HPHL_COMP_LUT; 24704f692926SSrinivas Kandagatla hph_comp_ctrl7 = CDC_RX_COMPANDER0_CTL7; 24714f692926SSrinivas Kandagatla break; 24724f692926SSrinivas Kandagatla case INTERP_HPHR: 24734f692926SSrinivas Kandagatla hph_lut_bypass_reg = CDC_RX_TOP_HPHR_COMP_LUT; 24744f692926SSrinivas Kandagatla hph_comp_ctrl7 = CDC_RX_COMPANDER1_CTL7; 24754f692926SSrinivas Kandagatla break; 24764f692926SSrinivas Kandagatla default: 24774f692926SSrinivas Kandagatla return -EINVAL; 24784f692926SSrinivas Kandagatla } 24794f692926SSrinivas Kandagatla 24804f692926SSrinivas Kandagatla if (hph_lut_bypass_reg && SND_SOC_DAPM_EVENT_ON(event)) { 24814f692926SSrinivas Kandagatla if (interp_idx == INTERP_HPHL) { 24824f692926SSrinivas Kandagatla if (rx->is_ear_mode_on) 24834f692926SSrinivas Kandagatla snd_soc_component_write_field(component, 24844f692926SSrinivas Kandagatla CDC_RX_RX0_RX_PATH_CFG1, 24854f692926SSrinivas Kandagatla CDC_RX_RX0_HPH_L_EAR_SEL_MASK, 0x1); 24864f692926SSrinivas Kandagatla else 24874f692926SSrinivas Kandagatla snd_soc_component_write_field(component, 24884f692926SSrinivas Kandagatla hph_lut_bypass_reg, 24894f692926SSrinivas Kandagatla CDC_RX_TOP_HPH_LUT_BYPASS_MASK, 1); 24904f692926SSrinivas Kandagatla } else { 24914f692926SSrinivas Kandagatla snd_soc_component_write_field(component, hph_lut_bypass_reg, 24924f692926SSrinivas Kandagatla CDC_RX_TOP_HPH_LUT_BYPASS_MASK, 1); 24934f692926SSrinivas Kandagatla } 24944f692926SSrinivas Kandagatla if (rx->hph_pwr_mode) 24954f692926SSrinivas Kandagatla snd_soc_component_write_field(component, hph_comp_ctrl7, 24964f692926SSrinivas Kandagatla CDC_RX_COMPANDER1_HPH_LOW_PWR_MODE_MASK, 0x0); 24974f692926SSrinivas Kandagatla } 24984f692926SSrinivas Kandagatla 24994f692926SSrinivas Kandagatla if (hph_lut_bypass_reg && SND_SOC_DAPM_EVENT_OFF(event)) { 25004f692926SSrinivas Kandagatla snd_soc_component_write_field(component, 25014f692926SSrinivas Kandagatla CDC_RX_RX0_RX_PATH_CFG1, 25024f692926SSrinivas Kandagatla CDC_RX_RX0_HPH_L_EAR_SEL_MASK, 0x0); 25034f692926SSrinivas Kandagatla snd_soc_component_update_bits(component, hph_lut_bypass_reg, 25044f692926SSrinivas Kandagatla CDC_RX_TOP_HPH_LUT_BYPASS_MASK, 0); 25054f692926SSrinivas Kandagatla snd_soc_component_write_field(component, hph_comp_ctrl7, 25064f692926SSrinivas Kandagatla CDC_RX_COMPANDER1_HPH_LOW_PWR_MODE_MASK, 0x1); 25074f692926SSrinivas Kandagatla } 25084f692926SSrinivas Kandagatla 25094f692926SSrinivas Kandagatla return 0; 25104f692926SSrinivas Kandagatla } 25114f692926SSrinivas Kandagatla 25124f692926SSrinivas Kandagatla static int rx_macro_enable_interp_clk(struct snd_soc_component *component, 25134f692926SSrinivas Kandagatla int event, int interp_idx) 25144f692926SSrinivas Kandagatla { 25154f692926SSrinivas Kandagatla u16 main_reg, dsm_reg, rx_cfg2_reg; 25164f692926SSrinivas Kandagatla struct rx_macro *rx = snd_soc_component_get_drvdata(component); 25174f692926SSrinivas Kandagatla 25184f692926SSrinivas Kandagatla main_reg = CDC_RX_RXn_RX_PATH_CTL(interp_idx); 25194f692926SSrinivas Kandagatla dsm_reg = CDC_RX_RXn_RX_PATH_DSM_CTL(interp_idx); 25204f692926SSrinivas Kandagatla if (interp_idx == INTERP_AUX) 25214f692926SSrinivas Kandagatla dsm_reg = CDC_RX_RX2_RX_PATH_DSM_CTL; 25224f692926SSrinivas Kandagatla rx_cfg2_reg = CDC_RX_RXn_RX_PATH_CFG2(interp_idx); 25234f692926SSrinivas Kandagatla 25244f692926SSrinivas Kandagatla if (SND_SOC_DAPM_EVENT_ON(event)) { 25254f692926SSrinivas Kandagatla if (rx->main_clk_users[interp_idx] == 0) { 25264f692926SSrinivas Kandagatla /* Main path PGA mute enable */ 25274f692926SSrinivas Kandagatla snd_soc_component_write_field(component, main_reg, 25284f692926SSrinivas Kandagatla CDC_RX_PATH_PGA_MUTE_MASK, 0x1); 25294f692926SSrinivas Kandagatla snd_soc_component_write_field(component, dsm_reg, 25304f692926SSrinivas Kandagatla CDC_RX_RXn_DSM_CLK_EN_MASK, 0x1); 25314f692926SSrinivas Kandagatla snd_soc_component_update_bits(component, rx_cfg2_reg, 25324f692926SSrinivas Kandagatla CDC_RX_RXn_HPF_CUT_FREQ_MASK, 0x03); 25334f692926SSrinivas Kandagatla rx_macro_load_compander_coeff(component, rx, interp_idx, event); 25344f692926SSrinivas Kandagatla if (rx->hph_hd2_mode) 25354f692926SSrinivas Kandagatla rx_macro_hd2_control(component, interp_idx, event); 25364f692926SSrinivas Kandagatla rx_macro_hphdelay_lutbypass(component, rx, interp_idx, event); 25374f692926SSrinivas Kandagatla rx_macro_config_compander(component, rx, interp_idx, event); 25384f692926SSrinivas Kandagatla if (interp_idx == INTERP_AUX) { 25394f692926SSrinivas Kandagatla rx_macro_config_softclip(component, rx, event); 25404f692926SSrinivas Kandagatla rx_macro_config_aux_hpf(component, rx, event); 25414f692926SSrinivas Kandagatla } 25424f692926SSrinivas Kandagatla rx_macro_config_classh(component, rx, interp_idx, event); 25434f692926SSrinivas Kandagatla } 25444f692926SSrinivas Kandagatla rx->main_clk_users[interp_idx]++; 25454f692926SSrinivas Kandagatla } 25464f692926SSrinivas Kandagatla 25474f692926SSrinivas Kandagatla if (SND_SOC_DAPM_EVENT_OFF(event)) { 25484f692926SSrinivas Kandagatla rx->main_clk_users[interp_idx]--; 25494f692926SSrinivas Kandagatla if (rx->main_clk_users[interp_idx] <= 0) { 25504f692926SSrinivas Kandagatla rx->main_clk_users[interp_idx] = 0; 25514f692926SSrinivas Kandagatla /* Main path PGA mute enable */ 25524f692926SSrinivas Kandagatla snd_soc_component_write_field(component, main_reg, 25534f692926SSrinivas Kandagatla CDC_RX_PATH_PGA_MUTE_MASK, 0x1); 25544f692926SSrinivas Kandagatla /* Clk Disable */ 25554f692926SSrinivas Kandagatla snd_soc_component_write_field(component, dsm_reg, 25564f692926SSrinivas Kandagatla CDC_RX_RXn_DSM_CLK_EN_MASK, 0); 25574f692926SSrinivas Kandagatla snd_soc_component_write_field(component, main_reg, 25584f692926SSrinivas Kandagatla CDC_RX_PATH_CLK_EN_MASK, 0); 25594f692926SSrinivas Kandagatla /* Reset enable and disable */ 25604f692926SSrinivas Kandagatla snd_soc_component_write_field(component, main_reg, 25614f692926SSrinivas Kandagatla CDC_RX_PATH_RESET_EN_MASK, 1); 25624f692926SSrinivas Kandagatla snd_soc_component_write_field(component, main_reg, 25634f692926SSrinivas Kandagatla CDC_RX_PATH_RESET_EN_MASK, 0); 25644f692926SSrinivas Kandagatla /* Reset rate to 48K*/ 25654f692926SSrinivas Kandagatla snd_soc_component_update_bits(component, main_reg, 25664f692926SSrinivas Kandagatla CDC_RX_PATH_PCM_RATE_MASK, 25674f692926SSrinivas Kandagatla 0x04); 25684f692926SSrinivas Kandagatla snd_soc_component_update_bits(component, rx_cfg2_reg, 25694f692926SSrinivas Kandagatla CDC_RX_RXn_HPF_CUT_FREQ_MASK, 0x00); 25704f692926SSrinivas Kandagatla rx_macro_config_classh(component, rx, interp_idx, event); 25714f692926SSrinivas Kandagatla rx_macro_config_compander(component, rx, interp_idx, event); 25724f692926SSrinivas Kandagatla if (interp_idx == INTERP_AUX) { 25734f692926SSrinivas Kandagatla rx_macro_config_softclip(component, rx, event); 25744f692926SSrinivas Kandagatla rx_macro_config_aux_hpf(component, rx, event); 25754f692926SSrinivas Kandagatla } 25764f692926SSrinivas Kandagatla rx_macro_hphdelay_lutbypass(component, rx, interp_idx, event); 25774f692926SSrinivas Kandagatla if (rx->hph_hd2_mode) 25784f692926SSrinivas Kandagatla rx_macro_hd2_control(component, interp_idx, event); 25794f692926SSrinivas Kandagatla } 25804f692926SSrinivas Kandagatla } 25814f692926SSrinivas Kandagatla 25824f692926SSrinivas Kandagatla return rx->main_clk_users[interp_idx]; 25834f692926SSrinivas Kandagatla } 25844f692926SSrinivas Kandagatla 25854f692926SSrinivas Kandagatla static int rx_macro_enable_mix_path(struct snd_soc_dapm_widget *w, 25864f692926SSrinivas Kandagatla struct snd_kcontrol *kcontrol, int event) 25874f692926SSrinivas Kandagatla { 25884f692926SSrinivas Kandagatla struct snd_soc_component *component = snd_soc_dapm_to_component(w->dapm); 25894f692926SSrinivas Kandagatla u16 gain_reg, mix_reg; 25904f692926SSrinivas Kandagatla 25914f692926SSrinivas Kandagatla gain_reg = CDC_RX_RXn_RX_VOL_MIX_CTL(w->shift); 25924f692926SSrinivas Kandagatla mix_reg = CDC_RX_RXn_RX_PATH_MIX_CTL(w->shift); 25934f692926SSrinivas Kandagatla 25944f692926SSrinivas Kandagatla switch (event) { 25954f692926SSrinivas Kandagatla case SND_SOC_DAPM_PRE_PMU: 25964f692926SSrinivas Kandagatla rx_macro_enable_interp_clk(component, event, w->shift); 25974f692926SSrinivas Kandagatla break; 25984f692926SSrinivas Kandagatla case SND_SOC_DAPM_POST_PMU: 25994f692926SSrinivas Kandagatla snd_soc_component_write(component, gain_reg, 26004f692926SSrinivas Kandagatla snd_soc_component_read(component, gain_reg)); 26014f692926SSrinivas Kandagatla break; 26024f692926SSrinivas Kandagatla case SND_SOC_DAPM_POST_PMD: 26034f692926SSrinivas Kandagatla /* Clk Disable */ 26044f692926SSrinivas Kandagatla snd_soc_component_update_bits(component, mix_reg, 26054f692926SSrinivas Kandagatla CDC_RX_RXn_MIX_CLK_EN_MASK, 0x00); 26064f692926SSrinivas Kandagatla rx_macro_enable_interp_clk(component, event, w->shift); 26074f692926SSrinivas Kandagatla /* Reset enable and disable */ 26084f692926SSrinivas Kandagatla snd_soc_component_update_bits(component, mix_reg, 26094f692926SSrinivas Kandagatla CDC_RX_RXn_MIX_RESET_MASK, 26104f692926SSrinivas Kandagatla CDC_RX_RXn_MIX_RESET); 26114f692926SSrinivas Kandagatla snd_soc_component_update_bits(component, mix_reg, 26124f692926SSrinivas Kandagatla CDC_RX_RXn_MIX_RESET_MASK, 0x00); 26134f692926SSrinivas Kandagatla break; 26144f692926SSrinivas Kandagatla } 26154f692926SSrinivas Kandagatla 26164f692926SSrinivas Kandagatla return 0; 26174f692926SSrinivas Kandagatla } 26184f692926SSrinivas Kandagatla 26194f692926SSrinivas Kandagatla static int rx_macro_enable_rx_path_clk(struct snd_soc_dapm_widget *w, 26204f692926SSrinivas Kandagatla struct snd_kcontrol *kcontrol, int event) 26214f692926SSrinivas Kandagatla { 26224f692926SSrinivas Kandagatla struct snd_soc_component *component = snd_soc_dapm_to_component(w->dapm); 26234f692926SSrinivas Kandagatla 26244f692926SSrinivas Kandagatla switch (event) { 26254f692926SSrinivas Kandagatla case SND_SOC_DAPM_PRE_PMU: 26264f692926SSrinivas Kandagatla rx_macro_enable_interp_clk(component, event, w->shift); 26274f692926SSrinivas Kandagatla snd_soc_component_write_field(component, CDC_RX_RXn_RX_PATH_CFG1(w->shift), 26284f692926SSrinivas Kandagatla CDC_RX_RXn_SIDETONE_EN_MASK, 1); 26294f692926SSrinivas Kandagatla snd_soc_component_write_field(component, CDC_RX_RXn_RX_PATH_CTL(w->shift), 26304f692926SSrinivas Kandagatla CDC_RX_PATH_CLK_EN_MASK, 1); 26314f692926SSrinivas Kandagatla break; 26324f692926SSrinivas Kandagatla case SND_SOC_DAPM_POST_PMD: 26334f692926SSrinivas Kandagatla snd_soc_component_write_field(component, CDC_RX_RXn_RX_PATH_CFG1(w->shift), 26344f692926SSrinivas Kandagatla CDC_RX_RXn_SIDETONE_EN_MASK, 0); 26354f692926SSrinivas Kandagatla rx_macro_enable_interp_clk(component, event, w->shift); 26364f692926SSrinivas Kandagatla break; 26374f692926SSrinivas Kandagatla default: 26384f692926SSrinivas Kandagatla break; 2639f758b9efSWan Jiabing } 26404f692926SSrinivas Kandagatla return 0; 26414f692926SSrinivas Kandagatla } 26424f692926SSrinivas Kandagatla 2643f3ce6f3cSSrinivas Kandagatla static int rx_macro_set_iir_gain(struct snd_soc_dapm_widget *w, 2644f3ce6f3cSSrinivas Kandagatla struct snd_kcontrol *kcontrol, int event) 2645f3ce6f3cSSrinivas Kandagatla { 2646f3ce6f3cSSrinivas Kandagatla struct snd_soc_component *component = snd_soc_dapm_to_component(w->dapm); 2647f3ce6f3cSSrinivas Kandagatla 2648f3ce6f3cSSrinivas Kandagatla switch (event) { 2649f3ce6f3cSSrinivas Kandagatla case SND_SOC_DAPM_POST_PMU: /* fall through */ 2650f3ce6f3cSSrinivas Kandagatla case SND_SOC_DAPM_PRE_PMD: 2651f3ce6f3cSSrinivas Kandagatla if (strnstr(w->name, "IIR0", sizeof("IIR0"))) { 2652f3ce6f3cSSrinivas Kandagatla snd_soc_component_write(component, 2653f3ce6f3cSSrinivas Kandagatla CDC_RX_SIDETONE_IIR0_IIR_GAIN_B1_CTL, 2654f3ce6f3cSSrinivas Kandagatla snd_soc_component_read(component, 2655f3ce6f3cSSrinivas Kandagatla CDC_RX_SIDETONE_IIR0_IIR_GAIN_B1_CTL)); 2656f3ce6f3cSSrinivas Kandagatla snd_soc_component_write(component, 2657f3ce6f3cSSrinivas Kandagatla CDC_RX_SIDETONE_IIR0_IIR_GAIN_B2_CTL, 2658f3ce6f3cSSrinivas Kandagatla snd_soc_component_read(component, 2659f3ce6f3cSSrinivas Kandagatla CDC_RX_SIDETONE_IIR0_IIR_GAIN_B2_CTL)); 2660f3ce6f3cSSrinivas Kandagatla snd_soc_component_write(component, 2661f3ce6f3cSSrinivas Kandagatla CDC_RX_SIDETONE_IIR0_IIR_GAIN_B3_CTL, 2662f3ce6f3cSSrinivas Kandagatla snd_soc_component_read(component, 2663f3ce6f3cSSrinivas Kandagatla CDC_RX_SIDETONE_IIR0_IIR_GAIN_B3_CTL)); 2664f3ce6f3cSSrinivas Kandagatla snd_soc_component_write(component, 2665f3ce6f3cSSrinivas Kandagatla CDC_RX_SIDETONE_IIR0_IIR_GAIN_B4_CTL, 2666f3ce6f3cSSrinivas Kandagatla snd_soc_component_read(component, 2667f3ce6f3cSSrinivas Kandagatla CDC_RX_SIDETONE_IIR0_IIR_GAIN_B4_CTL)); 2668f3ce6f3cSSrinivas Kandagatla } else { 2669f3ce6f3cSSrinivas Kandagatla snd_soc_component_write(component, 2670f3ce6f3cSSrinivas Kandagatla CDC_RX_SIDETONE_IIR1_IIR_GAIN_B1_CTL, 2671f3ce6f3cSSrinivas Kandagatla snd_soc_component_read(component, 2672f3ce6f3cSSrinivas Kandagatla CDC_RX_SIDETONE_IIR1_IIR_GAIN_B1_CTL)); 2673f3ce6f3cSSrinivas Kandagatla snd_soc_component_write(component, 2674f3ce6f3cSSrinivas Kandagatla CDC_RX_SIDETONE_IIR1_IIR_GAIN_B2_CTL, 2675f3ce6f3cSSrinivas Kandagatla snd_soc_component_read(component, 2676f3ce6f3cSSrinivas Kandagatla CDC_RX_SIDETONE_IIR1_IIR_GAIN_B2_CTL)); 2677f3ce6f3cSSrinivas Kandagatla snd_soc_component_write(component, 2678f3ce6f3cSSrinivas Kandagatla CDC_RX_SIDETONE_IIR1_IIR_GAIN_B3_CTL, 2679f3ce6f3cSSrinivas Kandagatla snd_soc_component_read(component, 2680f3ce6f3cSSrinivas Kandagatla CDC_RX_SIDETONE_IIR1_IIR_GAIN_B3_CTL)); 2681f3ce6f3cSSrinivas Kandagatla snd_soc_component_write(component, 2682f3ce6f3cSSrinivas Kandagatla CDC_RX_SIDETONE_IIR1_IIR_GAIN_B4_CTL, 2683f3ce6f3cSSrinivas Kandagatla snd_soc_component_read(component, 2684f3ce6f3cSSrinivas Kandagatla CDC_RX_SIDETONE_IIR1_IIR_GAIN_B4_CTL)); 2685f3ce6f3cSSrinivas Kandagatla } 2686f3ce6f3cSSrinivas Kandagatla break; 2687f3ce6f3cSSrinivas Kandagatla } 2688f3ce6f3cSSrinivas Kandagatla return 0; 2689f3ce6f3cSSrinivas Kandagatla } 2690f3ce6f3cSSrinivas Kandagatla 2691f3ce6f3cSSrinivas Kandagatla static uint32_t get_iir_band_coeff(struct snd_soc_component *component, 2692f3ce6f3cSSrinivas Kandagatla int iir_idx, int band_idx, int coeff_idx) 2693f3ce6f3cSSrinivas Kandagatla { 2694f3ce6f3cSSrinivas Kandagatla u32 value; 2695f3ce6f3cSSrinivas Kandagatla int reg, b2_reg; 2696f3ce6f3cSSrinivas Kandagatla 2697f3ce6f3cSSrinivas Kandagatla /* Address does not automatically update if reading */ 2698f3ce6f3cSSrinivas Kandagatla reg = CDC_RX_SIDETONE_IIR0_IIR_COEF_B1_CTL + 16 * iir_idx; 2699f3ce6f3cSSrinivas Kandagatla b2_reg = CDC_RX_SIDETONE_IIR0_IIR_COEF_B2_CTL + 16 * iir_idx; 2700f3ce6f3cSSrinivas Kandagatla 2701f3ce6f3cSSrinivas Kandagatla snd_soc_component_write(component, reg, 2702f3ce6f3cSSrinivas Kandagatla ((band_idx * BAND_MAX + coeff_idx) * 2703f3ce6f3cSSrinivas Kandagatla sizeof(uint32_t)) & 0x7F); 2704f3ce6f3cSSrinivas Kandagatla 2705f3ce6f3cSSrinivas Kandagatla value = snd_soc_component_read(component, b2_reg); 2706f3ce6f3cSSrinivas Kandagatla snd_soc_component_write(component, reg, 2707f3ce6f3cSSrinivas Kandagatla ((band_idx * BAND_MAX + coeff_idx) 2708f3ce6f3cSSrinivas Kandagatla * sizeof(uint32_t) + 1) & 0x7F); 2709f3ce6f3cSSrinivas Kandagatla 2710f3ce6f3cSSrinivas Kandagatla value |= (snd_soc_component_read(component, b2_reg) << 8); 2711f3ce6f3cSSrinivas Kandagatla snd_soc_component_write(component, reg, 2712f3ce6f3cSSrinivas Kandagatla ((band_idx * BAND_MAX + coeff_idx) 2713f3ce6f3cSSrinivas Kandagatla * sizeof(uint32_t) + 2) & 0x7F); 2714f3ce6f3cSSrinivas Kandagatla 2715f3ce6f3cSSrinivas Kandagatla value |= (snd_soc_component_read(component, b2_reg) << 16); 2716f3ce6f3cSSrinivas Kandagatla snd_soc_component_write(component, reg, 2717f3ce6f3cSSrinivas Kandagatla ((band_idx * BAND_MAX + coeff_idx) 2718f3ce6f3cSSrinivas Kandagatla * sizeof(uint32_t) + 3) & 0x7F); 2719f3ce6f3cSSrinivas Kandagatla 2720f3ce6f3cSSrinivas Kandagatla /* Mask bits top 2 bits since they are reserved */ 2721f3ce6f3cSSrinivas Kandagatla value |= (snd_soc_component_read(component, b2_reg) << 24); 2722f3ce6f3cSSrinivas Kandagatla return value; 2723f3ce6f3cSSrinivas Kandagatla } 2724f3ce6f3cSSrinivas Kandagatla 2725f3ce6f3cSSrinivas Kandagatla static void set_iir_band_coeff(struct snd_soc_component *component, 2726f3ce6f3cSSrinivas Kandagatla int iir_idx, int band_idx, uint32_t value) 2727f3ce6f3cSSrinivas Kandagatla { 2728f3ce6f3cSSrinivas Kandagatla int reg = CDC_RX_SIDETONE_IIR0_IIR_COEF_B2_CTL + 16 * iir_idx; 2729f3ce6f3cSSrinivas Kandagatla 2730f3ce6f3cSSrinivas Kandagatla snd_soc_component_write(component, reg, (value & 0xFF)); 2731f3ce6f3cSSrinivas Kandagatla snd_soc_component_write(component, reg, (value >> 8) & 0xFF); 2732f3ce6f3cSSrinivas Kandagatla snd_soc_component_write(component, reg, (value >> 16) & 0xFF); 2733f3ce6f3cSSrinivas Kandagatla /* Mask top 2 bits, 7-8 are reserved */ 2734f3ce6f3cSSrinivas Kandagatla snd_soc_component_write(component, reg, (value >> 24) & 0x3F); 2735f3ce6f3cSSrinivas Kandagatla } 2736f3ce6f3cSSrinivas Kandagatla 2737f3ce6f3cSSrinivas Kandagatla static int rx_macro_put_iir_band_audio_mixer( 2738f3ce6f3cSSrinivas Kandagatla struct snd_kcontrol *kcontrol, 2739f3ce6f3cSSrinivas Kandagatla struct snd_ctl_elem_value *ucontrol) 2740f3ce6f3cSSrinivas Kandagatla { 2741f3ce6f3cSSrinivas Kandagatla struct snd_soc_component *component = 2742f3ce6f3cSSrinivas Kandagatla snd_soc_kcontrol_component(kcontrol); 2743f3ce6f3cSSrinivas Kandagatla struct wcd_iir_filter_ctl *ctl = 2744f3ce6f3cSSrinivas Kandagatla (struct wcd_iir_filter_ctl *)kcontrol->private_value; 2745f3ce6f3cSSrinivas Kandagatla struct soc_bytes_ext *params = &ctl->bytes_ext; 2746f3ce6f3cSSrinivas Kandagatla int iir_idx = ctl->iir_idx; 2747f3ce6f3cSSrinivas Kandagatla int band_idx = ctl->band_idx; 2748f3ce6f3cSSrinivas Kandagatla u32 coeff[BAND_MAX]; 2749f3ce6f3cSSrinivas Kandagatla int reg = CDC_RX_SIDETONE_IIR0_IIR_COEF_B1_CTL + 16 * iir_idx; 2750f3ce6f3cSSrinivas Kandagatla 2751f3ce6f3cSSrinivas Kandagatla memcpy(&coeff[0], ucontrol->value.bytes.data, params->max); 2752f3ce6f3cSSrinivas Kandagatla 2753f3ce6f3cSSrinivas Kandagatla /* Mask top bit it is reserved */ 2754f3ce6f3cSSrinivas Kandagatla /* Updates addr automatically for each B2 write */ 2755f3ce6f3cSSrinivas Kandagatla snd_soc_component_write(component, reg, (band_idx * BAND_MAX * 2756f3ce6f3cSSrinivas Kandagatla sizeof(uint32_t)) & 0x7F); 2757f3ce6f3cSSrinivas Kandagatla 2758f3ce6f3cSSrinivas Kandagatla set_iir_band_coeff(component, iir_idx, band_idx, coeff[0]); 2759f3ce6f3cSSrinivas Kandagatla set_iir_band_coeff(component, iir_idx, band_idx, coeff[1]); 2760f3ce6f3cSSrinivas Kandagatla set_iir_band_coeff(component, iir_idx, band_idx, coeff[2]); 2761f3ce6f3cSSrinivas Kandagatla set_iir_band_coeff(component, iir_idx, band_idx, coeff[3]); 2762f3ce6f3cSSrinivas Kandagatla set_iir_band_coeff(component, iir_idx, band_idx, coeff[4]); 2763f3ce6f3cSSrinivas Kandagatla 2764f3ce6f3cSSrinivas Kandagatla return 0; 2765f3ce6f3cSSrinivas Kandagatla } 2766f3ce6f3cSSrinivas Kandagatla 2767f3ce6f3cSSrinivas Kandagatla static int rx_macro_get_iir_band_audio_mixer(struct snd_kcontrol *kcontrol, 2768f3ce6f3cSSrinivas Kandagatla struct snd_ctl_elem_value *ucontrol) 2769f3ce6f3cSSrinivas Kandagatla { 2770f3ce6f3cSSrinivas Kandagatla struct snd_soc_component *component = 2771f3ce6f3cSSrinivas Kandagatla snd_soc_kcontrol_component(kcontrol); 2772f3ce6f3cSSrinivas Kandagatla struct wcd_iir_filter_ctl *ctl = 2773f3ce6f3cSSrinivas Kandagatla (struct wcd_iir_filter_ctl *)kcontrol->private_value; 2774f3ce6f3cSSrinivas Kandagatla struct soc_bytes_ext *params = &ctl->bytes_ext; 2775f3ce6f3cSSrinivas Kandagatla int iir_idx = ctl->iir_idx; 2776f3ce6f3cSSrinivas Kandagatla int band_idx = ctl->band_idx; 2777f3ce6f3cSSrinivas Kandagatla u32 coeff[BAND_MAX]; 2778f3ce6f3cSSrinivas Kandagatla 2779f3ce6f3cSSrinivas Kandagatla coeff[0] = get_iir_band_coeff(component, iir_idx, band_idx, 0); 2780f3ce6f3cSSrinivas Kandagatla coeff[1] = get_iir_band_coeff(component, iir_idx, band_idx, 1); 2781f3ce6f3cSSrinivas Kandagatla coeff[2] = get_iir_band_coeff(component, iir_idx, band_idx, 2); 2782f3ce6f3cSSrinivas Kandagatla coeff[3] = get_iir_band_coeff(component, iir_idx, band_idx, 3); 2783f3ce6f3cSSrinivas Kandagatla coeff[4] = get_iir_band_coeff(component, iir_idx, band_idx, 4); 2784f3ce6f3cSSrinivas Kandagatla 2785f3ce6f3cSSrinivas Kandagatla memcpy(ucontrol->value.bytes.data, &coeff[0], params->max); 2786f3ce6f3cSSrinivas Kandagatla 2787f3ce6f3cSSrinivas Kandagatla return 0; 2788f3ce6f3cSSrinivas Kandagatla } 2789f3ce6f3cSSrinivas Kandagatla 2790f3ce6f3cSSrinivas Kandagatla static int rx_macro_iir_filter_info(struct snd_kcontrol *kcontrol, 2791f3ce6f3cSSrinivas Kandagatla struct snd_ctl_elem_info *ucontrol) 2792f3ce6f3cSSrinivas Kandagatla { 2793f3ce6f3cSSrinivas Kandagatla struct wcd_iir_filter_ctl *ctl = 2794f3ce6f3cSSrinivas Kandagatla (struct wcd_iir_filter_ctl *)kcontrol->private_value; 2795f3ce6f3cSSrinivas Kandagatla struct soc_bytes_ext *params = &ctl->bytes_ext; 2796f3ce6f3cSSrinivas Kandagatla 2797f3ce6f3cSSrinivas Kandagatla ucontrol->type = SNDRV_CTL_ELEM_TYPE_BYTES; 2798f3ce6f3cSSrinivas Kandagatla ucontrol->count = params->max; 2799f3ce6f3cSSrinivas Kandagatla 2800f3ce6f3cSSrinivas Kandagatla return 0; 2801f3ce6f3cSSrinivas Kandagatla } 2802f3ce6f3cSSrinivas Kandagatla 2803af3d54b9SSrinivas Kandagatla static const struct snd_kcontrol_new rx_macro_snd_controls[] = { 2804af3d54b9SSrinivas Kandagatla SOC_SINGLE_S8_TLV("RX_RX0 Digital Volume", CDC_RX_RX0_RX_VOL_CTL, 2805af3d54b9SSrinivas Kandagatla -84, 40, digital_gain), 2806af3d54b9SSrinivas Kandagatla SOC_SINGLE_S8_TLV("RX_RX1 Digital Volume", CDC_RX_RX1_RX_VOL_CTL, 2807af3d54b9SSrinivas Kandagatla -84, 40, digital_gain), 2808af3d54b9SSrinivas Kandagatla SOC_SINGLE_S8_TLV("RX_RX2 Digital Volume", CDC_RX_RX2_RX_VOL_CTL, 2809af3d54b9SSrinivas Kandagatla -84, 40, digital_gain), 2810af3d54b9SSrinivas Kandagatla SOC_SINGLE_S8_TLV("RX_RX0 Mix Digital Volume", CDC_RX_RX0_RX_VOL_MIX_CTL, 2811af3d54b9SSrinivas Kandagatla -84, 40, digital_gain), 2812af3d54b9SSrinivas Kandagatla SOC_SINGLE_S8_TLV("RX_RX1 Mix Digital Volume", CDC_RX_RX1_RX_VOL_MIX_CTL, 2813af3d54b9SSrinivas Kandagatla -84, 40, digital_gain), 2814af3d54b9SSrinivas Kandagatla SOC_SINGLE_S8_TLV("RX_RX2 Mix Digital Volume", CDC_RX_RX2_RX_VOL_MIX_CTL, 2815af3d54b9SSrinivas Kandagatla -84, 40, digital_gain), 2816af3d54b9SSrinivas Kandagatla 2817af3d54b9SSrinivas Kandagatla SOC_SINGLE_EXT("RX_COMP1 Switch", SND_SOC_NOPM, RX_MACRO_COMP1, 1, 0, 2818af3d54b9SSrinivas Kandagatla rx_macro_get_compander, rx_macro_set_compander), 2819af3d54b9SSrinivas Kandagatla SOC_SINGLE_EXT("RX_COMP2 Switch", SND_SOC_NOPM, RX_MACRO_COMP2, 1, 0, 2820af3d54b9SSrinivas Kandagatla rx_macro_get_compander, rx_macro_set_compander), 2821af3d54b9SSrinivas Kandagatla 2822af3d54b9SSrinivas Kandagatla SOC_SINGLE_EXT("RX_EAR Mode Switch", SND_SOC_NOPM, 0, 1, 0, 2823af3d54b9SSrinivas Kandagatla rx_macro_get_ear_mode, rx_macro_put_ear_mode), 2824af3d54b9SSrinivas Kandagatla 2825af3d54b9SSrinivas Kandagatla SOC_SINGLE_EXT("RX_HPH HD2 Mode Switch", SND_SOC_NOPM, 0, 1, 0, 2826af3d54b9SSrinivas Kandagatla rx_macro_get_hph_hd2_mode, rx_macro_put_hph_hd2_mode), 2827af3d54b9SSrinivas Kandagatla 2828af3d54b9SSrinivas Kandagatla SOC_ENUM_EXT("RX_HPH PWR Mode", rx_macro_hph_pwr_mode_enum, 2829af3d54b9SSrinivas Kandagatla rx_macro_get_hph_pwr_mode, rx_macro_put_hph_pwr_mode), 2830af3d54b9SSrinivas Kandagatla 2831af3d54b9SSrinivas Kandagatla SOC_SINGLE_EXT("RX_Softclip Switch", SND_SOC_NOPM, 0, 1, 0, 2832af3d54b9SSrinivas Kandagatla rx_macro_soft_clip_enable_get, 2833af3d54b9SSrinivas Kandagatla rx_macro_soft_clip_enable_put), 2834af3d54b9SSrinivas Kandagatla SOC_SINGLE_EXT("AUX_HPF Switch", SND_SOC_NOPM, 0, 1, 0, 2835af3d54b9SSrinivas Kandagatla rx_macro_aux_hpf_mode_get, 2836af3d54b9SSrinivas Kandagatla rx_macro_aux_hpf_mode_put), 2837f3ce6f3cSSrinivas Kandagatla 2838f3ce6f3cSSrinivas Kandagatla SOC_SINGLE_S8_TLV("IIR0 INP0 Volume", 2839f3ce6f3cSSrinivas Kandagatla CDC_RX_SIDETONE_IIR0_IIR_GAIN_B1_CTL, -84, 40, 2840f3ce6f3cSSrinivas Kandagatla digital_gain), 2841f3ce6f3cSSrinivas Kandagatla SOC_SINGLE_S8_TLV("IIR0 INP1 Volume", 2842f3ce6f3cSSrinivas Kandagatla CDC_RX_SIDETONE_IIR0_IIR_GAIN_B2_CTL, -84, 40, 2843f3ce6f3cSSrinivas Kandagatla digital_gain), 2844f3ce6f3cSSrinivas Kandagatla SOC_SINGLE_S8_TLV("IIR0 INP2 Volume", 2845f3ce6f3cSSrinivas Kandagatla CDC_RX_SIDETONE_IIR0_IIR_GAIN_B3_CTL, -84, 40, 2846f3ce6f3cSSrinivas Kandagatla digital_gain), 2847f3ce6f3cSSrinivas Kandagatla SOC_SINGLE_S8_TLV("IIR0 INP3 Volume", 2848f3ce6f3cSSrinivas Kandagatla CDC_RX_SIDETONE_IIR0_IIR_GAIN_B4_CTL, -84, 40, 2849f3ce6f3cSSrinivas Kandagatla digital_gain), 2850f3ce6f3cSSrinivas Kandagatla SOC_SINGLE_S8_TLV("IIR1 INP0 Volume", 2851f3ce6f3cSSrinivas Kandagatla CDC_RX_SIDETONE_IIR1_IIR_GAIN_B1_CTL, -84, 40, 2852f3ce6f3cSSrinivas Kandagatla digital_gain), 2853f3ce6f3cSSrinivas Kandagatla SOC_SINGLE_S8_TLV("IIR1 INP1 Volume", 2854f3ce6f3cSSrinivas Kandagatla CDC_RX_SIDETONE_IIR1_IIR_GAIN_B2_CTL, -84, 40, 2855f3ce6f3cSSrinivas Kandagatla digital_gain), 2856f3ce6f3cSSrinivas Kandagatla SOC_SINGLE_S8_TLV("IIR1 INP2 Volume", 2857f3ce6f3cSSrinivas Kandagatla CDC_RX_SIDETONE_IIR1_IIR_GAIN_B3_CTL, -84, 40, 2858f3ce6f3cSSrinivas Kandagatla digital_gain), 2859f3ce6f3cSSrinivas Kandagatla SOC_SINGLE_S8_TLV("IIR1 INP3 Volume", 2860f3ce6f3cSSrinivas Kandagatla CDC_RX_SIDETONE_IIR1_IIR_GAIN_B4_CTL, -84, 40, 2861f3ce6f3cSSrinivas Kandagatla digital_gain), 2862f3ce6f3cSSrinivas Kandagatla 2863f3ce6f3cSSrinivas Kandagatla SOC_SINGLE("IIR1 Band1 Switch", CDC_RX_SIDETONE_IIR0_IIR_CTL, 2864f3ce6f3cSSrinivas Kandagatla 0, 1, 0), 2865f3ce6f3cSSrinivas Kandagatla SOC_SINGLE("IIR1 Band2 Switch", CDC_RX_SIDETONE_IIR0_IIR_CTL, 2866f3ce6f3cSSrinivas Kandagatla 1, 1, 0), 2867f3ce6f3cSSrinivas Kandagatla SOC_SINGLE("IIR1 Band3 Switch", CDC_RX_SIDETONE_IIR0_IIR_CTL, 2868f3ce6f3cSSrinivas Kandagatla 2, 1, 0), 2869f3ce6f3cSSrinivas Kandagatla SOC_SINGLE("IIR1 Band4 Switch", CDC_RX_SIDETONE_IIR0_IIR_CTL, 2870f3ce6f3cSSrinivas Kandagatla 3, 1, 0), 2871f3ce6f3cSSrinivas Kandagatla SOC_SINGLE("IIR1 Band5 Switch", CDC_RX_SIDETONE_IIR0_IIR_CTL, 2872f3ce6f3cSSrinivas Kandagatla 4, 1, 0), 2873f3ce6f3cSSrinivas Kandagatla SOC_SINGLE("IIR2 Band1 Switch", CDC_RX_SIDETONE_IIR1_IIR_CTL, 2874f3ce6f3cSSrinivas Kandagatla 0, 1, 0), 2875f3ce6f3cSSrinivas Kandagatla SOC_SINGLE("IIR2 Band2 Switch", CDC_RX_SIDETONE_IIR1_IIR_CTL, 2876f3ce6f3cSSrinivas Kandagatla 1, 1, 0), 2877f3ce6f3cSSrinivas Kandagatla SOC_SINGLE("IIR2 Band3 Switch", CDC_RX_SIDETONE_IIR1_IIR_CTL, 2878f3ce6f3cSSrinivas Kandagatla 2, 1, 0), 2879f3ce6f3cSSrinivas Kandagatla SOC_SINGLE("IIR2 Band4 Switch", CDC_RX_SIDETONE_IIR1_IIR_CTL, 2880f3ce6f3cSSrinivas Kandagatla 3, 1, 0), 2881f3ce6f3cSSrinivas Kandagatla SOC_SINGLE("IIR2 Band5 Switch", CDC_RX_SIDETONE_IIR1_IIR_CTL, 2882f3ce6f3cSSrinivas Kandagatla 4, 1, 0), 2883f3ce6f3cSSrinivas Kandagatla 2884f3ce6f3cSSrinivas Kandagatla RX_MACRO_IIR_FILTER_CTL("IIR0 Band1", IIR0, BAND1), 2885f3ce6f3cSSrinivas Kandagatla RX_MACRO_IIR_FILTER_CTL("IIR0 Band2", IIR0, BAND2), 2886f3ce6f3cSSrinivas Kandagatla RX_MACRO_IIR_FILTER_CTL("IIR0 Band3", IIR0, BAND3), 2887f3ce6f3cSSrinivas Kandagatla RX_MACRO_IIR_FILTER_CTL("IIR0 Band4", IIR0, BAND4), 2888f3ce6f3cSSrinivas Kandagatla RX_MACRO_IIR_FILTER_CTL("IIR0 Band5", IIR0, BAND5), 2889f3ce6f3cSSrinivas Kandagatla 2890f3ce6f3cSSrinivas Kandagatla RX_MACRO_IIR_FILTER_CTL("IIR1 Band1", IIR1, BAND1), 2891f3ce6f3cSSrinivas Kandagatla RX_MACRO_IIR_FILTER_CTL("IIR1 Band2", IIR1, BAND2), 2892f3ce6f3cSSrinivas Kandagatla RX_MACRO_IIR_FILTER_CTL("IIR1 Band3", IIR1, BAND3), 2893f3ce6f3cSSrinivas Kandagatla RX_MACRO_IIR_FILTER_CTL("IIR1 Band4", IIR1, BAND4), 2894f3ce6f3cSSrinivas Kandagatla RX_MACRO_IIR_FILTER_CTL("IIR1 Band5", IIR1, BAND5), 2895f3ce6f3cSSrinivas Kandagatla 2896af3d54b9SSrinivas Kandagatla }; 2897af3d54b9SSrinivas Kandagatla 28984f692926SSrinivas Kandagatla static int rx_macro_enable_echo(struct snd_soc_dapm_widget *w, 28994f692926SSrinivas Kandagatla struct snd_kcontrol *kcontrol, 29004f692926SSrinivas Kandagatla int event) 29014f692926SSrinivas Kandagatla { 29024f692926SSrinivas Kandagatla struct snd_soc_component *component = snd_soc_dapm_to_component(w->dapm); 29034f692926SSrinivas Kandagatla u16 val, ec_hq_reg; 29040c0a5883SColin Ian King int ec_tx = -1; 29054f692926SSrinivas Kandagatla 29064f692926SSrinivas Kandagatla val = snd_soc_component_read(component, 29074f692926SSrinivas Kandagatla CDC_RX_INP_MUX_RX_MIX_CFG4); 29084f692926SSrinivas Kandagatla if (!(strcmp(w->name, "RX MIX TX0 MUX"))) 29094f692926SSrinivas Kandagatla ec_tx = ((val & 0xf0) >> 0x4) - 1; 29104f692926SSrinivas Kandagatla else if (!(strcmp(w->name, "RX MIX TX1 MUX"))) 29114f692926SSrinivas Kandagatla ec_tx = (val & 0x0f) - 1; 29124f692926SSrinivas Kandagatla 29134f692926SSrinivas Kandagatla val = snd_soc_component_read(component, 29144f692926SSrinivas Kandagatla CDC_RX_INP_MUX_RX_MIX_CFG5); 29154f692926SSrinivas Kandagatla if (!(strcmp(w->name, "RX MIX TX2 MUX"))) 29164f692926SSrinivas Kandagatla ec_tx = (val & 0x0f) - 1; 29174f692926SSrinivas Kandagatla 29184f692926SSrinivas Kandagatla if (ec_tx < 0 || (ec_tx >= RX_MACRO_EC_MUX_MAX)) { 29194f692926SSrinivas Kandagatla dev_err(component->dev, "%s: EC mix control not set correctly\n", 29204f692926SSrinivas Kandagatla __func__); 29214f692926SSrinivas Kandagatla return -EINVAL; 29224f692926SSrinivas Kandagatla } 29234f692926SSrinivas Kandagatla ec_hq_reg = CDC_RX_EC_REF_HQ0_EC_REF_HQ_PATH_CTL + 29244f692926SSrinivas Kandagatla 0x40 * ec_tx; 29254f692926SSrinivas Kandagatla snd_soc_component_update_bits(component, ec_hq_reg, 0x01, 0x01); 29264f692926SSrinivas Kandagatla ec_hq_reg = CDC_RX_EC_REF_HQ0_EC_REF_HQ_CFG0 + 29274f692926SSrinivas Kandagatla 0x40 * ec_tx; 29284f692926SSrinivas Kandagatla /* default set to 48k */ 29294f692926SSrinivas Kandagatla snd_soc_component_update_bits(component, ec_hq_reg, 0x1E, 0x08); 29304f692926SSrinivas Kandagatla 29314f692926SSrinivas Kandagatla return 0; 29324f692926SSrinivas Kandagatla } 29334f692926SSrinivas Kandagatla 29344f692926SSrinivas Kandagatla static const struct snd_soc_dapm_widget rx_macro_dapm_widgets[] = { 29354f692926SSrinivas Kandagatla SND_SOC_DAPM_AIF_IN("RX AIF1 PB", "RX_MACRO_AIF1 Playback", 0, 29364f692926SSrinivas Kandagatla SND_SOC_NOPM, 0, 0), 29374f692926SSrinivas Kandagatla 29384f692926SSrinivas Kandagatla SND_SOC_DAPM_AIF_IN("RX AIF2 PB", "RX_MACRO_AIF2 Playback", 0, 29394f692926SSrinivas Kandagatla SND_SOC_NOPM, 0, 0), 29404f692926SSrinivas Kandagatla 29414f692926SSrinivas Kandagatla SND_SOC_DAPM_AIF_IN("RX AIF3 PB", "RX_MACRO_AIF3 Playback", 0, 29424f692926SSrinivas Kandagatla SND_SOC_NOPM, 0, 0), 29434f692926SSrinivas Kandagatla 29444f692926SSrinivas Kandagatla SND_SOC_DAPM_AIF_IN("RX AIF4 PB", "RX_MACRO_AIF4 Playback", 0, 29454f692926SSrinivas Kandagatla SND_SOC_NOPM, 0, 0), 29464f692926SSrinivas Kandagatla 29474f692926SSrinivas Kandagatla SND_SOC_DAPM_AIF_OUT("RX AIF_ECHO", "RX_AIF_ECHO Capture", 0, 29484f692926SSrinivas Kandagatla SND_SOC_NOPM, 0, 0), 29494f692926SSrinivas Kandagatla 29504f692926SSrinivas Kandagatla SND_SOC_DAPM_MUX("RX_MACRO RX0 MUX", SND_SOC_NOPM, RX_MACRO_RX0, 0, 29514f692926SSrinivas Kandagatla &rx_macro_rx0_mux), 29524f692926SSrinivas Kandagatla SND_SOC_DAPM_MUX("RX_MACRO RX1 MUX", SND_SOC_NOPM, RX_MACRO_RX1, 0, 29534f692926SSrinivas Kandagatla &rx_macro_rx1_mux), 29544f692926SSrinivas Kandagatla SND_SOC_DAPM_MUX("RX_MACRO RX2 MUX", SND_SOC_NOPM, RX_MACRO_RX2, 0, 29554f692926SSrinivas Kandagatla &rx_macro_rx2_mux), 29564f692926SSrinivas Kandagatla SND_SOC_DAPM_MUX("RX_MACRO RX3 MUX", SND_SOC_NOPM, RX_MACRO_RX3, 0, 29574f692926SSrinivas Kandagatla &rx_macro_rx3_mux), 29584f692926SSrinivas Kandagatla SND_SOC_DAPM_MUX("RX_MACRO RX4 MUX", SND_SOC_NOPM, RX_MACRO_RX4, 0, 29594f692926SSrinivas Kandagatla &rx_macro_rx4_mux), 29604f692926SSrinivas Kandagatla SND_SOC_DAPM_MUX("RX_MACRO RX5 MUX", SND_SOC_NOPM, RX_MACRO_RX5, 0, 29614f692926SSrinivas Kandagatla &rx_macro_rx5_mux), 29624f692926SSrinivas Kandagatla 29634f692926SSrinivas Kandagatla SND_SOC_DAPM_MIXER("RX_RX0", SND_SOC_NOPM, 0, 0, NULL, 0), 29644f692926SSrinivas Kandagatla SND_SOC_DAPM_MIXER("RX_RX1", SND_SOC_NOPM, 0, 0, NULL, 0), 29654f692926SSrinivas Kandagatla SND_SOC_DAPM_MIXER("RX_RX2", SND_SOC_NOPM, 0, 0, NULL, 0), 29664f692926SSrinivas Kandagatla SND_SOC_DAPM_MIXER("RX_RX3", SND_SOC_NOPM, 0, 0, NULL, 0), 29674f692926SSrinivas Kandagatla SND_SOC_DAPM_MIXER("RX_RX4", SND_SOC_NOPM, 0, 0, NULL, 0), 29684f692926SSrinivas Kandagatla SND_SOC_DAPM_MIXER("RX_RX5", SND_SOC_NOPM, 0, 0, NULL, 0), 29694f692926SSrinivas Kandagatla 29704f692926SSrinivas Kandagatla SND_SOC_DAPM_MUX("IIR0 INP0 MUX", SND_SOC_NOPM, 0, 0, &iir0_inp0_mux), 29714f692926SSrinivas Kandagatla SND_SOC_DAPM_MUX("IIR0 INP1 MUX", SND_SOC_NOPM, 0, 0, &iir0_inp1_mux), 29724f692926SSrinivas Kandagatla SND_SOC_DAPM_MUX("IIR0 INP2 MUX", SND_SOC_NOPM, 0, 0, &iir0_inp2_mux), 29734f692926SSrinivas Kandagatla SND_SOC_DAPM_MUX("IIR0 INP3 MUX", SND_SOC_NOPM, 0, 0, &iir0_inp3_mux), 29744f692926SSrinivas Kandagatla SND_SOC_DAPM_MUX("IIR1 INP0 MUX", SND_SOC_NOPM, 0, 0, &iir1_inp0_mux), 29754f692926SSrinivas Kandagatla SND_SOC_DAPM_MUX("IIR1 INP1 MUX", SND_SOC_NOPM, 0, 0, &iir1_inp1_mux), 29764f692926SSrinivas Kandagatla SND_SOC_DAPM_MUX("IIR1 INP2 MUX", SND_SOC_NOPM, 0, 0, &iir1_inp2_mux), 29774f692926SSrinivas Kandagatla SND_SOC_DAPM_MUX("IIR1 INP3 MUX", SND_SOC_NOPM, 0, 0, &iir1_inp3_mux), 29784f692926SSrinivas Kandagatla 29794f692926SSrinivas Kandagatla SND_SOC_DAPM_MUX_E("RX MIX TX0 MUX", SND_SOC_NOPM, 29804f692926SSrinivas Kandagatla RX_MACRO_EC0_MUX, 0, 29814f692926SSrinivas Kandagatla &rx_mix_tx0_mux, rx_macro_enable_echo, 29824f692926SSrinivas Kandagatla SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMD), 29834f692926SSrinivas Kandagatla SND_SOC_DAPM_MUX_E("RX MIX TX1 MUX", SND_SOC_NOPM, 29844f692926SSrinivas Kandagatla RX_MACRO_EC1_MUX, 0, 29854f692926SSrinivas Kandagatla &rx_mix_tx1_mux, rx_macro_enable_echo, 29864f692926SSrinivas Kandagatla SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMD), 29874f692926SSrinivas Kandagatla SND_SOC_DAPM_MUX_E("RX MIX TX2 MUX", SND_SOC_NOPM, 29884f692926SSrinivas Kandagatla RX_MACRO_EC2_MUX, 0, 29894f692926SSrinivas Kandagatla &rx_mix_tx2_mux, rx_macro_enable_echo, 29904f692926SSrinivas Kandagatla SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMD), 2991f3ce6f3cSSrinivas Kandagatla 2992f3ce6f3cSSrinivas Kandagatla SND_SOC_DAPM_MIXER_E("IIR0", CDC_RX_SIDETONE_IIR0_IIR_PATH_CTL, 2993f3ce6f3cSSrinivas Kandagatla 4, 0, NULL, 0, rx_macro_set_iir_gain, 2994f3ce6f3cSSrinivas Kandagatla SND_SOC_DAPM_POST_PMU | SND_SOC_DAPM_PRE_PMD), 2995f3ce6f3cSSrinivas Kandagatla SND_SOC_DAPM_MIXER_E("IIR1", CDC_RX_SIDETONE_IIR1_IIR_PATH_CTL, 2996f3ce6f3cSSrinivas Kandagatla 4, 0, NULL, 0, rx_macro_set_iir_gain, 2997f3ce6f3cSSrinivas Kandagatla SND_SOC_DAPM_POST_PMU | SND_SOC_DAPM_PRE_PMD), 29984f692926SSrinivas Kandagatla SND_SOC_DAPM_MIXER("SRC0", CDC_RX_SIDETONE_SRC0_ST_SRC_PATH_CTL, 29994f692926SSrinivas Kandagatla 4, 0, NULL, 0), 30004f692926SSrinivas Kandagatla SND_SOC_DAPM_MIXER("SRC1", CDC_RX_SIDETONE_SRC1_ST_SRC_PATH_CTL, 30014f692926SSrinivas Kandagatla 4, 0, NULL, 0), 30024f692926SSrinivas Kandagatla 30034f692926SSrinivas Kandagatla SND_SOC_DAPM_MUX("RX INT0 DEM MUX", SND_SOC_NOPM, 0, 0, 30044f692926SSrinivas Kandagatla &rx_int0_dem_inp_mux), 30054f692926SSrinivas Kandagatla SND_SOC_DAPM_MUX("RX INT1 DEM MUX", SND_SOC_NOPM, 0, 0, 30064f692926SSrinivas Kandagatla &rx_int1_dem_inp_mux), 30074f692926SSrinivas Kandagatla 30084f692926SSrinivas Kandagatla SND_SOC_DAPM_MUX_E("RX INT0_2 MUX", SND_SOC_NOPM, INTERP_HPHL, 0, 30094f692926SSrinivas Kandagatla &rx_int0_2_mux, rx_macro_enable_mix_path, 30104f692926SSrinivas Kandagatla SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMU | 30114f692926SSrinivas Kandagatla SND_SOC_DAPM_POST_PMD), 30124f692926SSrinivas Kandagatla SND_SOC_DAPM_MUX_E("RX INT1_2 MUX", SND_SOC_NOPM, INTERP_HPHR, 0, 30134f692926SSrinivas Kandagatla &rx_int1_2_mux, rx_macro_enable_mix_path, 30144f692926SSrinivas Kandagatla SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMU | 30154f692926SSrinivas Kandagatla SND_SOC_DAPM_POST_PMD), 30164f692926SSrinivas Kandagatla SND_SOC_DAPM_MUX_E("RX INT2_2 MUX", SND_SOC_NOPM, INTERP_AUX, 0, 30174f692926SSrinivas Kandagatla &rx_int2_2_mux, rx_macro_enable_mix_path, 30184f692926SSrinivas Kandagatla SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMU | 30194f692926SSrinivas Kandagatla SND_SOC_DAPM_POST_PMD), 30204f692926SSrinivas Kandagatla 30214f692926SSrinivas Kandagatla SND_SOC_DAPM_MUX("RX INT0_1 MIX1 INP0", SND_SOC_NOPM, 0, 0, &rx_int0_1_mix_inp0_mux), 30224f692926SSrinivas Kandagatla SND_SOC_DAPM_MUX("RX INT0_1 MIX1 INP1", SND_SOC_NOPM, 0, 0, &rx_int0_1_mix_inp1_mux), 30234f692926SSrinivas Kandagatla SND_SOC_DAPM_MUX("RX INT0_1 MIX1 INP2", SND_SOC_NOPM, 0, 0, &rx_int0_1_mix_inp2_mux), 30244f692926SSrinivas Kandagatla SND_SOC_DAPM_MUX("RX INT1_1 MIX1 INP0", SND_SOC_NOPM, 0, 0, &rx_int1_1_mix_inp0_mux), 30254f692926SSrinivas Kandagatla SND_SOC_DAPM_MUX("RX INT1_1 MIX1 INP1", SND_SOC_NOPM, 0, 0, &rx_int1_1_mix_inp1_mux), 30264f692926SSrinivas Kandagatla SND_SOC_DAPM_MUX("RX INT1_1 MIX1 INP2", SND_SOC_NOPM, 0, 0, &rx_int1_1_mix_inp2_mux), 30274f692926SSrinivas Kandagatla SND_SOC_DAPM_MUX("RX INT2_1 MIX1 INP0", SND_SOC_NOPM, 0, 0, &rx_int2_1_mix_inp0_mux), 30284f692926SSrinivas Kandagatla SND_SOC_DAPM_MUX("RX INT2_1 MIX1 INP1", SND_SOC_NOPM, 0, 0, &rx_int2_1_mix_inp1_mux), 30294f692926SSrinivas Kandagatla SND_SOC_DAPM_MUX("RX INT2_1 MIX1 INP2", SND_SOC_NOPM, 0, 0, &rx_int2_1_mix_inp2_mux), 30304f692926SSrinivas Kandagatla 30314f692926SSrinivas Kandagatla SND_SOC_DAPM_MUX_E("RX INT0_1 INTERP", SND_SOC_NOPM, INTERP_HPHL, 0, 30324f692926SSrinivas Kandagatla &rx_int0_1_interp_mux, rx_macro_enable_main_path, 30334f692926SSrinivas Kandagatla SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMU | 30344f692926SSrinivas Kandagatla SND_SOC_DAPM_POST_PMD), 30354f692926SSrinivas Kandagatla SND_SOC_DAPM_MUX_E("RX INT1_1 INTERP", SND_SOC_NOPM, INTERP_HPHR, 0, 30364f692926SSrinivas Kandagatla &rx_int1_1_interp_mux, rx_macro_enable_main_path, 30374f692926SSrinivas Kandagatla SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMU | 30384f692926SSrinivas Kandagatla SND_SOC_DAPM_POST_PMD), 30394f692926SSrinivas Kandagatla SND_SOC_DAPM_MUX_E("RX INT2_1 INTERP", SND_SOC_NOPM, INTERP_AUX, 0, 30404f692926SSrinivas Kandagatla &rx_int2_1_interp_mux, rx_macro_enable_main_path, 30414f692926SSrinivas Kandagatla SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMU | 30424f692926SSrinivas Kandagatla SND_SOC_DAPM_POST_PMD), 30434f692926SSrinivas Kandagatla 30444f692926SSrinivas Kandagatla SND_SOC_DAPM_MUX("RX INT0_2 INTERP", SND_SOC_NOPM, 0, 0, 30454f692926SSrinivas Kandagatla &rx_int0_2_interp_mux), 30464f692926SSrinivas Kandagatla SND_SOC_DAPM_MUX("RX INT1_2 INTERP", SND_SOC_NOPM, 0, 0, 30474f692926SSrinivas Kandagatla &rx_int1_2_interp_mux), 30484f692926SSrinivas Kandagatla SND_SOC_DAPM_MUX("RX INT2_2 INTERP", SND_SOC_NOPM, 0, 0, 30494f692926SSrinivas Kandagatla &rx_int2_2_interp_mux), 30504f692926SSrinivas Kandagatla 30514f692926SSrinivas Kandagatla SND_SOC_DAPM_MIXER("RX INT0_1 MIX1", SND_SOC_NOPM, 0, 0, NULL, 0), 30524f692926SSrinivas Kandagatla SND_SOC_DAPM_MIXER("RX INT0 SEC MIX", SND_SOC_NOPM, 0, 0, NULL, 0), 30534f692926SSrinivas Kandagatla SND_SOC_DAPM_MIXER("RX INT1_1 MIX1", SND_SOC_NOPM, 0, 0, NULL, 0), 30544f692926SSrinivas Kandagatla SND_SOC_DAPM_MIXER("RX INT1 SEC MIX", SND_SOC_NOPM, 0, 0, NULL, 0), 30554f692926SSrinivas Kandagatla SND_SOC_DAPM_MIXER("RX INT2_1 MIX1", SND_SOC_NOPM, 0, 0, NULL, 0), 30564f692926SSrinivas Kandagatla SND_SOC_DAPM_MIXER("RX INT2 SEC MIX", SND_SOC_NOPM, 0, 0, NULL, 0), 30574f692926SSrinivas Kandagatla 30584f692926SSrinivas Kandagatla SND_SOC_DAPM_MUX_E("RX INT0 MIX2 INP", SND_SOC_NOPM, INTERP_HPHL, 30594f692926SSrinivas Kandagatla 0, &rx_int0_mix2_inp_mux, rx_macro_enable_rx_path_clk, 30604f692926SSrinivas Kandagatla SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMD), 30614f692926SSrinivas Kandagatla SND_SOC_DAPM_MUX_E("RX INT1 MIX2 INP", SND_SOC_NOPM, INTERP_HPHR, 30624f692926SSrinivas Kandagatla 0, &rx_int1_mix2_inp_mux, rx_macro_enable_rx_path_clk, 30634f692926SSrinivas Kandagatla SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMD), 30644f692926SSrinivas Kandagatla SND_SOC_DAPM_MUX_E("RX INT2 MIX2 INP", SND_SOC_NOPM, INTERP_AUX, 30654f692926SSrinivas Kandagatla 0, &rx_int2_mix2_inp_mux, rx_macro_enable_rx_path_clk, 30664f692926SSrinivas Kandagatla SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMD), 30674f692926SSrinivas Kandagatla 30684f692926SSrinivas Kandagatla SND_SOC_DAPM_MIXER("RX INT0 MIX2", SND_SOC_NOPM, 0, 0, NULL, 0), 30694f692926SSrinivas Kandagatla SND_SOC_DAPM_MIXER("RX INT1 MIX2", SND_SOC_NOPM, 0, 0, NULL, 0), 30704f692926SSrinivas Kandagatla SND_SOC_DAPM_MIXER("RX INT2 MIX2", SND_SOC_NOPM, 0, 0, NULL, 0), 30714f692926SSrinivas Kandagatla 30724f692926SSrinivas Kandagatla SND_SOC_DAPM_OUTPUT("HPHL_OUT"), 30734f692926SSrinivas Kandagatla SND_SOC_DAPM_OUTPUT("HPHR_OUT"), 30744f692926SSrinivas Kandagatla SND_SOC_DAPM_OUTPUT("AUX_OUT"), 30754f692926SSrinivas Kandagatla 30764f692926SSrinivas Kandagatla SND_SOC_DAPM_INPUT("RX_TX DEC0_INP"), 30774f692926SSrinivas Kandagatla SND_SOC_DAPM_INPUT("RX_TX DEC1_INP"), 30784f692926SSrinivas Kandagatla SND_SOC_DAPM_INPUT("RX_TX DEC2_INP"), 30794f692926SSrinivas Kandagatla SND_SOC_DAPM_INPUT("RX_TX DEC3_INP"), 30804f692926SSrinivas Kandagatla 30814f692926SSrinivas Kandagatla SND_SOC_DAPM_SUPPLY_S("RX_MCLK", 0, SND_SOC_NOPM, 0, 0, 30824f692926SSrinivas Kandagatla rx_macro_mclk_event, SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMD), 30834f692926SSrinivas Kandagatla }; 30844f692926SSrinivas Kandagatla 30854f692926SSrinivas Kandagatla static const struct snd_soc_dapm_route rx_audio_map[] = { 30864f692926SSrinivas Kandagatla {"RX AIF1 PB", NULL, "RX_MCLK"}, 30874f692926SSrinivas Kandagatla {"RX AIF2 PB", NULL, "RX_MCLK"}, 30884f692926SSrinivas Kandagatla {"RX AIF3 PB", NULL, "RX_MCLK"}, 30894f692926SSrinivas Kandagatla {"RX AIF4 PB", NULL, "RX_MCLK"}, 30904f692926SSrinivas Kandagatla 30914f692926SSrinivas Kandagatla {"RX_MACRO RX0 MUX", "AIF1_PB", "RX AIF1 PB"}, 30924f692926SSrinivas Kandagatla {"RX_MACRO RX1 MUX", "AIF1_PB", "RX AIF1 PB"}, 30934f692926SSrinivas Kandagatla {"RX_MACRO RX2 MUX", "AIF1_PB", "RX AIF1 PB"}, 30944f692926SSrinivas Kandagatla {"RX_MACRO RX3 MUX", "AIF1_PB", "RX AIF1 PB"}, 30954f692926SSrinivas Kandagatla {"RX_MACRO RX4 MUX", "AIF1_PB", "RX AIF1 PB"}, 30964f692926SSrinivas Kandagatla {"RX_MACRO RX5 MUX", "AIF1_PB", "RX AIF1 PB"}, 30974f692926SSrinivas Kandagatla 30984f692926SSrinivas Kandagatla {"RX_MACRO RX0 MUX", "AIF2_PB", "RX AIF2 PB"}, 30994f692926SSrinivas Kandagatla {"RX_MACRO RX1 MUX", "AIF2_PB", "RX AIF2 PB"}, 31004f692926SSrinivas Kandagatla {"RX_MACRO RX2 MUX", "AIF2_PB", "RX AIF2 PB"}, 31014f692926SSrinivas Kandagatla {"RX_MACRO RX3 MUX", "AIF2_PB", "RX AIF2 PB"}, 31024f692926SSrinivas Kandagatla {"RX_MACRO RX4 MUX", "AIF2_PB", "RX AIF2 PB"}, 31034f692926SSrinivas Kandagatla {"RX_MACRO RX5 MUX", "AIF2_PB", "RX AIF2 PB"}, 31044f692926SSrinivas Kandagatla 31054f692926SSrinivas Kandagatla {"RX_MACRO RX0 MUX", "AIF3_PB", "RX AIF3 PB"}, 31064f692926SSrinivas Kandagatla {"RX_MACRO RX1 MUX", "AIF3_PB", "RX AIF3 PB"}, 31074f692926SSrinivas Kandagatla {"RX_MACRO RX2 MUX", "AIF3_PB", "RX AIF3 PB"}, 31084f692926SSrinivas Kandagatla {"RX_MACRO RX3 MUX", "AIF3_PB", "RX AIF3 PB"}, 31094f692926SSrinivas Kandagatla {"RX_MACRO RX4 MUX", "AIF3_PB", "RX AIF3 PB"}, 31104f692926SSrinivas Kandagatla {"RX_MACRO RX5 MUX", "AIF3_PB", "RX AIF3 PB"}, 31114f692926SSrinivas Kandagatla 31124f692926SSrinivas Kandagatla {"RX_MACRO RX0 MUX", "AIF4_PB", "RX AIF4 PB"}, 31134f692926SSrinivas Kandagatla {"RX_MACRO RX1 MUX", "AIF4_PB", "RX AIF4 PB"}, 31144f692926SSrinivas Kandagatla {"RX_MACRO RX2 MUX", "AIF4_PB", "RX AIF4 PB"}, 31154f692926SSrinivas Kandagatla {"RX_MACRO RX3 MUX", "AIF4_PB", "RX AIF4 PB"}, 31164f692926SSrinivas Kandagatla {"RX_MACRO RX4 MUX", "AIF4_PB", "RX AIF4 PB"}, 31174f692926SSrinivas Kandagatla {"RX_MACRO RX5 MUX", "AIF4_PB", "RX AIF4 PB"}, 31184f692926SSrinivas Kandagatla 31194f692926SSrinivas Kandagatla {"RX_RX0", NULL, "RX_MACRO RX0 MUX"}, 31204f692926SSrinivas Kandagatla {"RX_RX1", NULL, "RX_MACRO RX1 MUX"}, 31214f692926SSrinivas Kandagatla {"RX_RX2", NULL, "RX_MACRO RX2 MUX"}, 31224f692926SSrinivas Kandagatla {"RX_RX3", NULL, "RX_MACRO RX3 MUX"}, 31234f692926SSrinivas Kandagatla {"RX_RX4", NULL, "RX_MACRO RX4 MUX"}, 31244f692926SSrinivas Kandagatla {"RX_RX5", NULL, "RX_MACRO RX5 MUX"}, 31254f692926SSrinivas Kandagatla 31264f692926SSrinivas Kandagatla {"RX INT0_1 MIX1 INP0", "RX0", "RX_RX0"}, 31274f692926SSrinivas Kandagatla {"RX INT0_1 MIX1 INP0", "RX1", "RX_RX1"}, 31284f692926SSrinivas Kandagatla {"RX INT0_1 MIX1 INP0", "RX2", "RX_RX2"}, 31294f692926SSrinivas Kandagatla {"RX INT0_1 MIX1 INP0", "RX3", "RX_RX3"}, 31304f692926SSrinivas Kandagatla {"RX INT0_1 MIX1 INP0", "RX4", "RX_RX4"}, 31314f692926SSrinivas Kandagatla {"RX INT0_1 MIX1 INP0", "RX5", "RX_RX5"}, 31324f692926SSrinivas Kandagatla {"RX INT0_1 MIX1 INP0", "IIR0", "IIR0"}, 31334f692926SSrinivas Kandagatla {"RX INT0_1 MIX1 INP0", "IIR1", "IIR1"}, 31344f692926SSrinivas Kandagatla {"RX INT0_1 MIX1 INP0", "DEC0", "RX_TX DEC0_INP"}, 31354f692926SSrinivas Kandagatla {"RX INT0_1 MIX1 INP0", "DEC1", "RX_TX DEC1_INP"}, 31364f692926SSrinivas Kandagatla {"RX INT0_1 MIX1 INP1", "RX0", "RX_RX0"}, 31374f692926SSrinivas Kandagatla {"RX INT0_1 MIX1 INP1", "RX1", "RX_RX1"}, 31384f692926SSrinivas Kandagatla {"RX INT0_1 MIX1 INP1", "RX2", "RX_RX2"}, 31394f692926SSrinivas Kandagatla {"RX INT0_1 MIX1 INP1", "RX3", "RX_RX3"}, 31404f692926SSrinivas Kandagatla {"RX INT0_1 MIX1 INP1", "RX4", "RX_RX4"}, 31414f692926SSrinivas Kandagatla {"RX INT0_1 MIX1 INP1", "RX5", "RX_RX5"}, 31424f692926SSrinivas Kandagatla {"RX INT0_1 MIX1 INP1", "IIR0", "IIR0"}, 31434f692926SSrinivas Kandagatla {"RX INT0_1 MIX1 INP1", "IIR1", "IIR1"}, 31444f692926SSrinivas Kandagatla {"RX INT0_1 MIX1 INP1", "DEC0", "RX_TX DEC0_INP"}, 31454f692926SSrinivas Kandagatla {"RX INT0_1 MIX1 INP1", "DEC1", "RX_TX DEC1_INP"}, 31464f692926SSrinivas Kandagatla {"RX INT0_1 MIX1 INP2", "RX0", "RX_RX0"}, 31474f692926SSrinivas Kandagatla {"RX INT0_1 MIX1 INP2", "RX1", "RX_RX1"}, 31484f692926SSrinivas Kandagatla {"RX INT0_1 MIX1 INP2", "RX2", "RX_RX2"}, 31494f692926SSrinivas Kandagatla {"RX INT0_1 MIX1 INP2", "RX3", "RX_RX3"}, 31504f692926SSrinivas Kandagatla {"RX INT0_1 MIX1 INP2", "RX4", "RX_RX4"}, 31514f692926SSrinivas Kandagatla {"RX INT0_1 MIX1 INP2", "RX5", "RX_RX5"}, 31524f692926SSrinivas Kandagatla {"RX INT0_1 MIX1 INP2", "IIR0", "IIR0"}, 31534f692926SSrinivas Kandagatla {"RX INT0_1 MIX1 INP2", "IIR1", "IIR1"}, 31544f692926SSrinivas Kandagatla {"RX INT0_1 MIX1 INP2", "DEC0", "RX_TX DEC0_INP"}, 31554f692926SSrinivas Kandagatla {"RX INT0_1 MIX1 INP2", "DEC1", "RX_TX DEC1_INP"}, 31564f692926SSrinivas Kandagatla 31574f692926SSrinivas Kandagatla {"RX INT1_1 MIX1 INP0", "RX0", "RX_RX0"}, 31584f692926SSrinivas Kandagatla {"RX INT1_1 MIX1 INP0", "RX1", "RX_RX1"}, 31594f692926SSrinivas Kandagatla {"RX INT1_1 MIX1 INP0", "RX2", "RX_RX2"}, 31604f692926SSrinivas Kandagatla {"RX INT1_1 MIX1 INP0", "RX3", "RX_RX3"}, 31614f692926SSrinivas Kandagatla {"RX INT1_1 MIX1 INP0", "RX4", "RX_RX4"}, 31624f692926SSrinivas Kandagatla {"RX INT1_1 MIX1 INP0", "RX5", "RX_RX5"}, 31634f692926SSrinivas Kandagatla {"RX INT1_1 MIX1 INP0", "IIR0", "IIR0"}, 31644f692926SSrinivas Kandagatla {"RX INT1_1 MIX1 INP0", "IIR1", "IIR1"}, 31654f692926SSrinivas Kandagatla {"RX INT1_1 MIX1 INP0", "DEC0", "RX_TX DEC0_INP"}, 31664f692926SSrinivas Kandagatla {"RX INT1_1 MIX1 INP0", "DEC1", "RX_TX DEC1_INP"}, 31674f692926SSrinivas Kandagatla {"RX INT1_1 MIX1 INP1", "RX0", "RX_RX0"}, 31684f692926SSrinivas Kandagatla {"RX INT1_1 MIX1 INP1", "RX1", "RX_RX1"}, 31694f692926SSrinivas Kandagatla {"RX INT1_1 MIX1 INP1", "RX2", "RX_RX2"}, 31704f692926SSrinivas Kandagatla {"RX INT1_1 MIX1 INP1", "RX3", "RX_RX3"}, 31714f692926SSrinivas Kandagatla {"RX INT1_1 MIX1 INP1", "RX4", "RX_RX4"}, 31724f692926SSrinivas Kandagatla {"RX INT1_1 MIX1 INP1", "RX5", "RX_RX5"}, 31734f692926SSrinivas Kandagatla {"RX INT1_1 MIX1 INP1", "IIR0", "IIR0"}, 31744f692926SSrinivas Kandagatla {"RX INT1_1 MIX1 INP1", "IIR1", "IIR1"}, 31754f692926SSrinivas Kandagatla {"RX INT1_1 MIX1 INP1", "DEC0", "RX_TX DEC0_INP"}, 31764f692926SSrinivas Kandagatla {"RX INT1_1 MIX1 INP1", "DEC1", "RX_TX DEC1_INP"}, 31774f692926SSrinivas Kandagatla {"RX INT1_1 MIX1 INP2", "RX0", "RX_RX0"}, 31784f692926SSrinivas Kandagatla {"RX INT1_1 MIX1 INP2", "RX1", "RX_RX1"}, 31794f692926SSrinivas Kandagatla {"RX INT1_1 MIX1 INP2", "RX2", "RX_RX2"}, 31804f692926SSrinivas Kandagatla {"RX INT1_1 MIX1 INP2", "RX3", "RX_RX3"}, 31814f692926SSrinivas Kandagatla {"RX INT1_1 MIX1 INP2", "RX4", "RX_RX4"}, 31824f692926SSrinivas Kandagatla {"RX INT1_1 MIX1 INP2", "RX5", "RX_RX5"}, 31834f692926SSrinivas Kandagatla {"RX INT1_1 MIX1 INP2", "IIR0", "IIR0"}, 31844f692926SSrinivas Kandagatla {"RX INT1_1 MIX1 INP2", "IIR1", "IIR1"}, 31854f692926SSrinivas Kandagatla {"RX INT1_1 MIX1 INP2", "DEC0", "RX_TX DEC0_INP"}, 31864f692926SSrinivas Kandagatla {"RX INT1_1 MIX1 INP2", "DEC1", "RX_TX DEC1_INP"}, 31874f692926SSrinivas Kandagatla 31884f692926SSrinivas Kandagatla {"RX INT2_1 MIX1 INP0", "RX0", "RX_RX0"}, 31894f692926SSrinivas Kandagatla {"RX INT2_1 MIX1 INP0", "RX1", "RX_RX1"}, 31904f692926SSrinivas Kandagatla {"RX INT2_1 MIX1 INP0", "RX2", "RX_RX2"}, 31914f692926SSrinivas Kandagatla {"RX INT2_1 MIX1 INP0", "RX3", "RX_RX3"}, 31924f692926SSrinivas Kandagatla {"RX INT2_1 MIX1 INP0", "RX4", "RX_RX4"}, 31934f692926SSrinivas Kandagatla {"RX INT2_1 MIX1 INP0", "RX5", "RX_RX5"}, 31944f692926SSrinivas Kandagatla {"RX INT2_1 MIX1 INP0", "IIR0", "IIR0"}, 31954f692926SSrinivas Kandagatla {"RX INT2_1 MIX1 INP0", "IIR1", "IIR1"}, 31964f692926SSrinivas Kandagatla {"RX INT2_1 MIX1 INP0", "DEC0", "RX_TX DEC0_INP"}, 31974f692926SSrinivas Kandagatla {"RX INT2_1 MIX1 INP0", "DEC1", "RX_TX DEC1_INP"}, 31984f692926SSrinivas Kandagatla {"RX INT2_1 MIX1 INP1", "RX0", "RX_RX0"}, 31994f692926SSrinivas Kandagatla {"RX INT2_1 MIX1 INP1", "RX1", "RX_RX1"}, 32004f692926SSrinivas Kandagatla {"RX INT2_1 MIX1 INP1", "RX2", "RX_RX2"}, 32014f692926SSrinivas Kandagatla {"RX INT2_1 MIX1 INP1", "RX3", "RX_RX3"}, 32024f692926SSrinivas Kandagatla {"RX INT2_1 MIX1 INP1", "RX4", "RX_RX4"}, 32034f692926SSrinivas Kandagatla {"RX INT2_1 MIX1 INP1", "RX5", "RX_RX5"}, 32044f692926SSrinivas Kandagatla {"RX INT2_1 MIX1 INP1", "IIR0", "IIR0"}, 32054f692926SSrinivas Kandagatla {"RX INT2_1 MIX1 INP1", "IIR1", "IIR1"}, 32064f692926SSrinivas Kandagatla {"RX INT2_1 MIX1 INP1", "DEC0", "RX_TX DEC0_INP"}, 32074f692926SSrinivas Kandagatla {"RX INT2_1 MIX1 INP1", "DEC1", "RX_TX DEC1_INP"}, 32084f692926SSrinivas Kandagatla {"RX INT2_1 MIX1 INP2", "RX0", "RX_RX0"}, 32094f692926SSrinivas Kandagatla {"RX INT2_1 MIX1 INP2", "RX1", "RX_RX1"}, 32104f692926SSrinivas Kandagatla {"RX INT2_1 MIX1 INP2", "RX2", "RX_RX2"}, 32114f692926SSrinivas Kandagatla {"RX INT2_1 MIX1 INP2", "RX3", "RX_RX3"}, 32124f692926SSrinivas Kandagatla {"RX INT2_1 MIX1 INP2", "RX4", "RX_RX4"}, 32134f692926SSrinivas Kandagatla {"RX INT2_1 MIX1 INP2", "RX5", "RX_RX5"}, 32144f692926SSrinivas Kandagatla {"RX INT2_1 MIX1 INP2", "IIR0", "IIR0"}, 32154f692926SSrinivas Kandagatla {"RX INT2_1 MIX1 INP2", "IIR1", "IIR1"}, 32164f692926SSrinivas Kandagatla {"RX INT2_1 MIX1 INP2", "DEC0", "RX_TX DEC0_INP"}, 32174f692926SSrinivas Kandagatla {"RX INT2_1 MIX1 INP2", "DEC1", "RX_TX DEC1_INP"}, 32184f692926SSrinivas Kandagatla 32194f692926SSrinivas Kandagatla {"RX INT0_1 MIX1", NULL, "RX INT0_1 MIX1 INP0"}, 32204f692926SSrinivas Kandagatla {"RX INT0_1 MIX1", NULL, "RX INT0_1 MIX1 INP1"}, 32214f692926SSrinivas Kandagatla {"RX INT0_1 MIX1", NULL, "RX INT0_1 MIX1 INP2"}, 32224f692926SSrinivas Kandagatla {"RX INT1_1 MIX1", NULL, "RX INT1_1 MIX1 INP0"}, 32234f692926SSrinivas Kandagatla {"RX INT1_1 MIX1", NULL, "RX INT1_1 MIX1 INP1"}, 32244f692926SSrinivas Kandagatla {"RX INT1_1 MIX1", NULL, "RX INT1_1 MIX1 INP2"}, 32254f692926SSrinivas Kandagatla {"RX INT2_1 MIX1", NULL, "RX INT2_1 MIX1 INP0"}, 32264f692926SSrinivas Kandagatla {"RX INT2_1 MIX1", NULL, "RX INT2_1 MIX1 INP1"}, 32274f692926SSrinivas Kandagatla {"RX INT2_1 MIX1", NULL, "RX INT2_1 MIX1 INP2"}, 32284f692926SSrinivas Kandagatla 32294f692926SSrinivas Kandagatla {"RX MIX TX0 MUX", "RX_MIX0", "RX INT0 SEC MIX"}, 32304f692926SSrinivas Kandagatla {"RX MIX TX0 MUX", "RX_MIX1", "RX INT1 SEC MIX"}, 32314f692926SSrinivas Kandagatla {"RX MIX TX0 MUX", "RX_MIX2", "RX INT2 SEC MIX"}, 32324f692926SSrinivas Kandagatla {"RX MIX TX1 MUX", "RX_MIX0", "RX INT0 SEC MIX"}, 32334f692926SSrinivas Kandagatla {"RX MIX TX1 MUX", "RX_MIX1", "RX INT1 SEC MIX"}, 32344f692926SSrinivas Kandagatla {"RX MIX TX1 MUX", "RX_MIX2", "RX INT2 SEC MIX"}, 32354f692926SSrinivas Kandagatla {"RX MIX TX2 MUX", "RX_MIX0", "RX INT0 SEC MIX"}, 32364f692926SSrinivas Kandagatla {"RX MIX TX2 MUX", "RX_MIX1", "RX INT1 SEC MIX"}, 32374f692926SSrinivas Kandagatla {"RX MIX TX2 MUX", "RX_MIX2", "RX INT2 SEC MIX"}, 32384f692926SSrinivas Kandagatla {"RX AIF_ECHO", NULL, "RX MIX TX0 MUX"}, 32394f692926SSrinivas Kandagatla {"RX AIF_ECHO", NULL, "RX MIX TX1 MUX"}, 32404f692926SSrinivas Kandagatla {"RX AIF_ECHO", NULL, "RX MIX TX2 MUX"}, 32414f692926SSrinivas Kandagatla {"RX AIF_ECHO", NULL, "RX_MCLK"}, 32424f692926SSrinivas Kandagatla 32434f692926SSrinivas Kandagatla /* Mixing path INT0 */ 32444f692926SSrinivas Kandagatla {"RX INT0_2 MUX", "RX0", "RX_RX0"}, 32454f692926SSrinivas Kandagatla {"RX INT0_2 MUX", "RX1", "RX_RX1"}, 32464f692926SSrinivas Kandagatla {"RX INT0_2 MUX", "RX2", "RX_RX2"}, 32474f692926SSrinivas Kandagatla {"RX INT0_2 MUX", "RX3", "RX_RX3"}, 32484f692926SSrinivas Kandagatla {"RX INT0_2 MUX", "RX4", "RX_RX4"}, 32494f692926SSrinivas Kandagatla {"RX INT0_2 MUX", "RX5", "RX_RX5"}, 32504f692926SSrinivas Kandagatla {"RX INT0_2 INTERP", NULL, "RX INT0_2 MUX"}, 32514f692926SSrinivas Kandagatla {"RX INT0 SEC MIX", NULL, "RX INT0_2 INTERP"}, 32524f692926SSrinivas Kandagatla 32534f692926SSrinivas Kandagatla /* Mixing path INT1 */ 32544f692926SSrinivas Kandagatla {"RX INT1_2 MUX", "RX0", "RX_RX0"}, 32554f692926SSrinivas Kandagatla {"RX INT1_2 MUX", "RX1", "RX_RX1"}, 32564f692926SSrinivas Kandagatla {"RX INT1_2 MUX", "RX2", "RX_RX2"}, 32574f692926SSrinivas Kandagatla {"RX INT1_2 MUX", "RX3", "RX_RX3"}, 32584f692926SSrinivas Kandagatla {"RX INT1_2 MUX", "RX4", "RX_RX4"}, 32594f692926SSrinivas Kandagatla {"RX INT1_2 MUX", "RX5", "RX_RX5"}, 32604f692926SSrinivas Kandagatla {"RX INT1_2 INTERP", NULL, "RX INT1_2 MUX"}, 32614f692926SSrinivas Kandagatla {"RX INT1 SEC MIX", NULL, "RX INT1_2 INTERP"}, 32624f692926SSrinivas Kandagatla 32634f692926SSrinivas Kandagatla /* Mixing path INT2 */ 32644f692926SSrinivas Kandagatla {"RX INT2_2 MUX", "RX0", "RX_RX0"}, 32654f692926SSrinivas Kandagatla {"RX INT2_2 MUX", "RX1", "RX_RX1"}, 32664f692926SSrinivas Kandagatla {"RX INT2_2 MUX", "RX2", "RX_RX2"}, 32674f692926SSrinivas Kandagatla {"RX INT2_2 MUX", "RX3", "RX_RX3"}, 32684f692926SSrinivas Kandagatla {"RX INT2_2 MUX", "RX4", "RX_RX4"}, 32694f692926SSrinivas Kandagatla {"RX INT2_2 MUX", "RX5", "RX_RX5"}, 32704f692926SSrinivas Kandagatla {"RX INT2_2 INTERP", NULL, "RX INT2_2 MUX"}, 32714f692926SSrinivas Kandagatla {"RX INT2 SEC MIX", NULL, "RX INT2_2 INTERP"}, 32724f692926SSrinivas Kandagatla 32734f692926SSrinivas Kandagatla {"RX INT0_1 INTERP", NULL, "RX INT0_1 MIX1"}, 32744f692926SSrinivas Kandagatla {"RX INT0 SEC MIX", NULL, "RX INT0_1 INTERP"}, 32754f692926SSrinivas Kandagatla {"RX INT0 MIX2", NULL, "RX INT0 SEC MIX"}, 32764f692926SSrinivas Kandagatla {"RX INT0 MIX2", NULL, "RX INT0 MIX2 INP"}, 32774f692926SSrinivas Kandagatla {"RX INT0 DEM MUX", "CLSH_DSM_OUT", "RX INT0 MIX2"}, 32784f692926SSrinivas Kandagatla {"HPHL_OUT", NULL, "RX INT0 DEM MUX"}, 32794f692926SSrinivas Kandagatla {"HPHL_OUT", NULL, "RX_MCLK"}, 32804f692926SSrinivas Kandagatla 32814f692926SSrinivas Kandagatla {"RX INT1_1 INTERP", NULL, "RX INT1_1 MIX1"}, 32824f692926SSrinivas Kandagatla {"RX INT1 SEC MIX", NULL, "RX INT1_1 INTERP"}, 32834f692926SSrinivas Kandagatla {"RX INT1 MIX2", NULL, "RX INT1 SEC MIX"}, 32844f692926SSrinivas Kandagatla {"RX INT1 MIX2", NULL, "RX INT1 MIX2 INP"}, 32854f692926SSrinivas Kandagatla {"RX INT1 DEM MUX", "CLSH_DSM_OUT", "RX INT1 MIX2"}, 32864f692926SSrinivas Kandagatla {"HPHR_OUT", NULL, "RX INT1 DEM MUX"}, 32874f692926SSrinivas Kandagatla {"HPHR_OUT", NULL, "RX_MCLK"}, 32884f692926SSrinivas Kandagatla 32894f692926SSrinivas Kandagatla {"RX INT2_1 INTERP", NULL, "RX INT2_1 MIX1"}, 32904f692926SSrinivas Kandagatla 32914f692926SSrinivas Kandagatla {"RX INT2 SEC MIX", NULL, "RX INT2_1 INTERP"}, 32924f692926SSrinivas Kandagatla {"RX INT2 MIX2", NULL, "RX INT2 SEC MIX"}, 32934f692926SSrinivas Kandagatla {"RX INT2 MIX2", NULL, "RX INT2 MIX2 INP"}, 32944f692926SSrinivas Kandagatla {"AUX_OUT", NULL, "RX INT2 MIX2"}, 32954f692926SSrinivas Kandagatla {"AUX_OUT", NULL, "RX_MCLK"}, 32964f692926SSrinivas Kandagatla 32974f692926SSrinivas Kandagatla {"IIR0", NULL, "RX_MCLK"}, 32984f692926SSrinivas Kandagatla {"IIR0", NULL, "IIR0 INP0 MUX"}, 32994f692926SSrinivas Kandagatla {"IIR0 INP0 MUX", "DEC0", "RX_TX DEC0_INP"}, 33004f692926SSrinivas Kandagatla {"IIR0 INP0 MUX", "DEC1", "RX_TX DEC1_INP"}, 33014f692926SSrinivas Kandagatla {"IIR0 INP0 MUX", "DEC2", "RX_TX DEC2_INP"}, 33024f692926SSrinivas Kandagatla {"IIR0 INP0 MUX", "DEC3", "RX_TX DEC3_INP"}, 33034f692926SSrinivas Kandagatla {"IIR0 INP0 MUX", "RX0", "RX_RX0"}, 33044f692926SSrinivas Kandagatla {"IIR0 INP0 MUX", "RX1", "RX_RX1"}, 33054f692926SSrinivas Kandagatla {"IIR0 INP0 MUX", "RX2", "RX_RX2"}, 33064f692926SSrinivas Kandagatla {"IIR0 INP0 MUX", "RX3", "RX_RX3"}, 33074f692926SSrinivas Kandagatla {"IIR0 INP0 MUX", "RX4", "RX_RX4"}, 33084f692926SSrinivas Kandagatla {"IIR0 INP0 MUX", "RX5", "RX_RX5"}, 33094f692926SSrinivas Kandagatla {"IIR0", NULL, "IIR0 INP1 MUX"}, 33104f692926SSrinivas Kandagatla {"IIR0 INP1 MUX", "DEC0", "RX_TX DEC0_INP"}, 33114f692926SSrinivas Kandagatla {"IIR0 INP1 MUX", "DEC1", "RX_TX DEC1_INP"}, 33124f692926SSrinivas Kandagatla {"IIR0 INP1 MUX", "DEC2", "RX_TX DEC2_INP"}, 33134f692926SSrinivas Kandagatla {"IIR0 INP1 MUX", "DEC3", "RX_TX DEC3_INP"}, 33144f692926SSrinivas Kandagatla {"IIR0 INP1 MUX", "RX0", "RX_RX0"}, 33154f692926SSrinivas Kandagatla {"IIR0 INP1 MUX", "RX1", "RX_RX1"}, 33164f692926SSrinivas Kandagatla {"IIR0 INP1 MUX", "RX2", "RX_RX2"}, 33174f692926SSrinivas Kandagatla {"IIR0 INP1 MUX", "RX3", "RX_RX3"}, 33184f692926SSrinivas Kandagatla {"IIR0 INP1 MUX", "RX4", "RX_RX4"}, 33194f692926SSrinivas Kandagatla {"IIR0 INP1 MUX", "RX5", "RX_RX5"}, 33204f692926SSrinivas Kandagatla {"IIR0", NULL, "IIR0 INP2 MUX"}, 33214f692926SSrinivas Kandagatla {"IIR0 INP2 MUX", "DEC0", "RX_TX DEC0_INP"}, 33224f692926SSrinivas Kandagatla {"IIR0 INP2 MUX", "DEC1", "RX_TX DEC1_INP"}, 33234f692926SSrinivas Kandagatla {"IIR0 INP2 MUX", "DEC2", "RX_TX DEC2_INP"}, 33244f692926SSrinivas Kandagatla {"IIR0 INP2 MUX", "DEC3", "RX_TX DEC3_INP"}, 33254f692926SSrinivas Kandagatla {"IIR0 INP2 MUX", "RX0", "RX_RX0"}, 33264f692926SSrinivas Kandagatla {"IIR0 INP2 MUX", "RX1", "RX_RX1"}, 33274f692926SSrinivas Kandagatla {"IIR0 INP2 MUX", "RX2", "RX_RX2"}, 33284f692926SSrinivas Kandagatla {"IIR0 INP2 MUX", "RX3", "RX_RX3"}, 33294f692926SSrinivas Kandagatla {"IIR0 INP2 MUX", "RX4", "RX_RX4"}, 33304f692926SSrinivas Kandagatla {"IIR0 INP2 MUX", "RX5", "RX_RX5"}, 33314f692926SSrinivas Kandagatla {"IIR0", NULL, "IIR0 INP3 MUX"}, 33324f692926SSrinivas Kandagatla {"IIR0 INP3 MUX", "DEC0", "RX_TX DEC0_INP"}, 33334f692926SSrinivas Kandagatla {"IIR0 INP3 MUX", "DEC1", "RX_TX DEC1_INP"}, 33344f692926SSrinivas Kandagatla {"IIR0 INP3 MUX", "DEC2", "RX_TX DEC2_INP"}, 33354f692926SSrinivas Kandagatla {"IIR0 INP3 MUX", "DEC3", "RX_TX DEC3_INP"}, 33364f692926SSrinivas Kandagatla {"IIR0 INP3 MUX", "RX0", "RX_RX0"}, 33374f692926SSrinivas Kandagatla {"IIR0 INP3 MUX", "RX1", "RX_RX1"}, 33384f692926SSrinivas Kandagatla {"IIR0 INP3 MUX", "RX2", "RX_RX2"}, 33394f692926SSrinivas Kandagatla {"IIR0 INP3 MUX", "RX3", "RX_RX3"}, 33404f692926SSrinivas Kandagatla {"IIR0 INP3 MUX", "RX4", "RX_RX4"}, 33414f692926SSrinivas Kandagatla {"IIR0 INP3 MUX", "RX5", "RX_RX5"}, 33424f692926SSrinivas Kandagatla 33434f692926SSrinivas Kandagatla {"IIR1", NULL, "RX_MCLK"}, 33444f692926SSrinivas Kandagatla {"IIR1", NULL, "IIR1 INP0 MUX"}, 33454f692926SSrinivas Kandagatla {"IIR1 INP0 MUX", "DEC0", "RX_TX DEC0_INP"}, 33464f692926SSrinivas Kandagatla {"IIR1 INP0 MUX", "DEC1", "RX_TX DEC1_INP"}, 33474f692926SSrinivas Kandagatla {"IIR1 INP0 MUX", "DEC2", "RX_TX DEC2_INP"}, 33484f692926SSrinivas Kandagatla {"IIR1 INP0 MUX", "DEC3", "RX_TX DEC3_INP"}, 33494f692926SSrinivas Kandagatla {"IIR1 INP0 MUX", "RX0", "RX_RX0"}, 33504f692926SSrinivas Kandagatla {"IIR1 INP0 MUX", "RX1", "RX_RX1"}, 33514f692926SSrinivas Kandagatla {"IIR1 INP0 MUX", "RX2", "RX_RX2"}, 33524f692926SSrinivas Kandagatla {"IIR1 INP0 MUX", "RX3", "RX_RX3"}, 33534f692926SSrinivas Kandagatla {"IIR1 INP0 MUX", "RX4", "RX_RX4"}, 33544f692926SSrinivas Kandagatla {"IIR1 INP0 MUX", "RX5", "RX_RX5"}, 33554f692926SSrinivas Kandagatla {"IIR1", NULL, "IIR1 INP1 MUX"}, 33564f692926SSrinivas Kandagatla {"IIR1 INP1 MUX", "DEC0", "RX_TX DEC0_INP"}, 33574f692926SSrinivas Kandagatla {"IIR1 INP1 MUX", "DEC1", "RX_TX DEC1_INP"}, 33584f692926SSrinivas Kandagatla {"IIR1 INP1 MUX", "DEC2", "RX_TX DEC2_INP"}, 33594f692926SSrinivas Kandagatla {"IIR1 INP1 MUX", "DEC3", "RX_TX DEC3_INP"}, 33604f692926SSrinivas Kandagatla {"IIR1 INP1 MUX", "RX0", "RX_RX0"}, 33614f692926SSrinivas Kandagatla {"IIR1 INP1 MUX", "RX1", "RX_RX1"}, 33624f692926SSrinivas Kandagatla {"IIR1 INP1 MUX", "RX2", "RX_RX2"}, 33634f692926SSrinivas Kandagatla {"IIR1 INP1 MUX", "RX3", "RX_RX3"}, 33644f692926SSrinivas Kandagatla {"IIR1 INP1 MUX", "RX4", "RX_RX4"}, 33654f692926SSrinivas Kandagatla {"IIR1 INP1 MUX", "RX5", "RX_RX5"}, 33664f692926SSrinivas Kandagatla {"IIR1", NULL, "IIR1 INP2 MUX"}, 33674f692926SSrinivas Kandagatla {"IIR1 INP2 MUX", "DEC0", "RX_TX DEC0_INP"}, 33684f692926SSrinivas Kandagatla {"IIR1 INP2 MUX", "DEC1", "RX_TX DEC1_INP"}, 33694f692926SSrinivas Kandagatla {"IIR1 INP2 MUX", "DEC2", "RX_TX DEC2_INP"}, 33704f692926SSrinivas Kandagatla {"IIR1 INP2 MUX", "DEC3", "RX_TX DEC3_INP"}, 33714f692926SSrinivas Kandagatla {"IIR1 INP2 MUX", "RX0", "RX_RX0"}, 33724f692926SSrinivas Kandagatla {"IIR1 INP2 MUX", "RX1", "RX_RX1"}, 33734f692926SSrinivas Kandagatla {"IIR1 INP2 MUX", "RX2", "RX_RX2"}, 33744f692926SSrinivas Kandagatla {"IIR1 INP2 MUX", "RX3", "RX_RX3"}, 33754f692926SSrinivas Kandagatla {"IIR1 INP2 MUX", "RX4", "RX_RX4"}, 33764f692926SSrinivas Kandagatla {"IIR1 INP2 MUX", "RX5", "RX_RX5"}, 33774f692926SSrinivas Kandagatla {"IIR1", NULL, "IIR1 INP3 MUX"}, 33784f692926SSrinivas Kandagatla {"IIR1 INP3 MUX", "DEC0", "RX_TX DEC0_INP"}, 33794f692926SSrinivas Kandagatla {"IIR1 INP3 MUX", "DEC1", "RX_TX DEC1_INP"}, 33804f692926SSrinivas Kandagatla {"IIR1 INP3 MUX", "DEC2", "RX_TX DEC2_INP"}, 33814f692926SSrinivas Kandagatla {"IIR1 INP3 MUX", "DEC3", "RX_TX DEC3_INP"}, 33824f692926SSrinivas Kandagatla {"IIR1 INP3 MUX", "RX0", "RX_RX0"}, 33834f692926SSrinivas Kandagatla {"IIR1 INP3 MUX", "RX1", "RX_RX1"}, 33844f692926SSrinivas Kandagatla {"IIR1 INP3 MUX", "RX2", "RX_RX2"}, 33854f692926SSrinivas Kandagatla {"IIR1 INP3 MUX", "RX3", "RX_RX3"}, 33864f692926SSrinivas Kandagatla {"IIR1 INP3 MUX", "RX4", "RX_RX4"}, 33874f692926SSrinivas Kandagatla {"IIR1 INP3 MUX", "RX5", "RX_RX5"}, 33884f692926SSrinivas Kandagatla 33894f692926SSrinivas Kandagatla {"SRC0", NULL, "IIR0"}, 33904f692926SSrinivas Kandagatla {"SRC1", NULL, "IIR1"}, 33914f692926SSrinivas Kandagatla {"RX INT0 MIX2 INP", "SRC0", "SRC0"}, 33924f692926SSrinivas Kandagatla {"RX INT0 MIX2 INP", "SRC1", "SRC1"}, 33934f692926SSrinivas Kandagatla {"RX INT1 MIX2 INP", "SRC0", "SRC0"}, 33944f692926SSrinivas Kandagatla {"RX INT1 MIX2 INP", "SRC1", "SRC1"}, 33954f692926SSrinivas Kandagatla {"RX INT2 MIX2 INP", "SRC0", "SRC0"}, 33964f692926SSrinivas Kandagatla {"RX INT2 MIX2 INP", "SRC1", "SRC1"}, 33974f692926SSrinivas Kandagatla }; 33984f692926SSrinivas Kandagatla 3399af3d54b9SSrinivas Kandagatla static int rx_macro_component_probe(struct snd_soc_component *component) 3400af3d54b9SSrinivas Kandagatla { 3401af3d54b9SSrinivas Kandagatla struct rx_macro *rx = snd_soc_component_get_drvdata(component); 3402af3d54b9SSrinivas Kandagatla 3403af3d54b9SSrinivas Kandagatla snd_soc_component_init_regmap(component, rx->regmap); 3404af3d54b9SSrinivas Kandagatla 3405af3d54b9SSrinivas Kandagatla snd_soc_component_update_bits(component, CDC_RX_RX0_RX_PATH_SEC7, 3406af3d54b9SSrinivas Kandagatla CDC_RX_DSM_OUT_DELAY_SEL_MASK, 3407af3d54b9SSrinivas Kandagatla CDC_RX_DSM_OUT_DELAY_TWO_SAMPLE); 3408af3d54b9SSrinivas Kandagatla snd_soc_component_update_bits(component, CDC_RX_RX1_RX_PATH_SEC7, 3409af3d54b9SSrinivas Kandagatla CDC_RX_DSM_OUT_DELAY_SEL_MASK, 3410af3d54b9SSrinivas Kandagatla CDC_RX_DSM_OUT_DELAY_TWO_SAMPLE); 3411af3d54b9SSrinivas Kandagatla snd_soc_component_update_bits(component, CDC_RX_RX2_RX_PATH_SEC7, 3412af3d54b9SSrinivas Kandagatla CDC_RX_DSM_OUT_DELAY_SEL_MASK, 3413af3d54b9SSrinivas Kandagatla CDC_RX_DSM_OUT_DELAY_TWO_SAMPLE); 3414af3d54b9SSrinivas Kandagatla snd_soc_component_update_bits(component, CDC_RX_RX0_RX_PATH_CFG3, 3415af3d54b9SSrinivas Kandagatla CDC_RX_DC_COEFF_SEL_MASK, 3416af3d54b9SSrinivas Kandagatla CDC_RX_DC_COEFF_SEL_TWO); 3417af3d54b9SSrinivas Kandagatla snd_soc_component_update_bits(component, CDC_RX_RX1_RX_PATH_CFG3, 3418af3d54b9SSrinivas Kandagatla CDC_RX_DC_COEFF_SEL_MASK, 3419af3d54b9SSrinivas Kandagatla CDC_RX_DC_COEFF_SEL_TWO); 3420af3d54b9SSrinivas Kandagatla snd_soc_component_update_bits(component, CDC_RX_RX2_RX_PATH_CFG3, 3421af3d54b9SSrinivas Kandagatla CDC_RX_DC_COEFF_SEL_MASK, 3422af3d54b9SSrinivas Kandagatla CDC_RX_DC_COEFF_SEL_TWO); 3423af3d54b9SSrinivas Kandagatla 3424af3d54b9SSrinivas Kandagatla rx->component = component; 3425af3d54b9SSrinivas Kandagatla 3426af3d54b9SSrinivas Kandagatla return 0; 3427af3d54b9SSrinivas Kandagatla } 3428af3d54b9SSrinivas Kandagatla 3429af3d54b9SSrinivas Kandagatla static int swclk_gate_enable(struct clk_hw *hw) 3430af3d54b9SSrinivas Kandagatla { 3431af3d54b9SSrinivas Kandagatla struct rx_macro *rx = to_rx_macro(hw); 3432eaba1134SSrinivas Kandagatla int ret; 3433eaba1134SSrinivas Kandagatla 3434eaba1134SSrinivas Kandagatla ret = clk_prepare_enable(rx->mclk); 3435eaba1134SSrinivas Kandagatla if (ret) { 3436eaba1134SSrinivas Kandagatla dev_err(rx->dev, "unable to prepare mclk\n"); 3437eaba1134SSrinivas Kandagatla return ret; 3438eaba1134SSrinivas Kandagatla } 3439af3d54b9SSrinivas Kandagatla 3440af3d54b9SSrinivas Kandagatla rx_macro_mclk_enable(rx, true); 3441af3d54b9SSrinivas Kandagatla if (rx->reset_swr) 3442af3d54b9SSrinivas Kandagatla regmap_update_bits(rx->regmap, CDC_RX_CLK_RST_CTRL_SWR_CONTROL, 3443af3d54b9SSrinivas Kandagatla CDC_RX_SWR_RESET_MASK, 3444af3d54b9SSrinivas Kandagatla CDC_RX_SWR_RESET); 3445af3d54b9SSrinivas Kandagatla 3446af3d54b9SSrinivas Kandagatla regmap_update_bits(rx->regmap, CDC_RX_CLK_RST_CTRL_SWR_CONTROL, 3447af3d54b9SSrinivas Kandagatla CDC_RX_SWR_CLK_EN_MASK, 1); 3448af3d54b9SSrinivas Kandagatla 3449af3d54b9SSrinivas Kandagatla if (rx->reset_swr) 3450af3d54b9SSrinivas Kandagatla regmap_update_bits(rx->regmap, CDC_RX_CLK_RST_CTRL_SWR_CONTROL, 3451af3d54b9SSrinivas Kandagatla CDC_RX_SWR_RESET_MASK, 0); 3452af3d54b9SSrinivas Kandagatla rx->reset_swr = false; 3453af3d54b9SSrinivas Kandagatla 3454af3d54b9SSrinivas Kandagatla return 0; 3455af3d54b9SSrinivas Kandagatla } 3456af3d54b9SSrinivas Kandagatla 3457af3d54b9SSrinivas Kandagatla static void swclk_gate_disable(struct clk_hw *hw) 3458af3d54b9SSrinivas Kandagatla { 3459af3d54b9SSrinivas Kandagatla struct rx_macro *rx = to_rx_macro(hw); 3460af3d54b9SSrinivas Kandagatla 3461af3d54b9SSrinivas Kandagatla regmap_update_bits(rx->regmap, CDC_RX_CLK_RST_CTRL_SWR_CONTROL, 3462af3d54b9SSrinivas Kandagatla CDC_RX_SWR_CLK_EN_MASK, 0); 3463af3d54b9SSrinivas Kandagatla 3464af3d54b9SSrinivas Kandagatla rx_macro_mclk_enable(rx, false); 3465eaba1134SSrinivas Kandagatla clk_disable_unprepare(rx->mclk); 3466af3d54b9SSrinivas Kandagatla } 3467af3d54b9SSrinivas Kandagatla 3468af3d54b9SSrinivas Kandagatla static int swclk_gate_is_enabled(struct clk_hw *hw) 3469af3d54b9SSrinivas Kandagatla { 3470af3d54b9SSrinivas Kandagatla struct rx_macro *rx = to_rx_macro(hw); 3471af3d54b9SSrinivas Kandagatla int ret, val; 3472af3d54b9SSrinivas Kandagatla 3473af3d54b9SSrinivas Kandagatla regmap_read(rx->regmap, CDC_RX_CLK_RST_CTRL_SWR_CONTROL, &val); 3474af3d54b9SSrinivas Kandagatla ret = val & BIT(0); 3475af3d54b9SSrinivas Kandagatla 3476af3d54b9SSrinivas Kandagatla return ret; 3477af3d54b9SSrinivas Kandagatla } 3478af3d54b9SSrinivas Kandagatla 3479af3d54b9SSrinivas Kandagatla static unsigned long swclk_recalc_rate(struct clk_hw *hw, 3480af3d54b9SSrinivas Kandagatla unsigned long parent_rate) 3481af3d54b9SSrinivas Kandagatla { 3482af3d54b9SSrinivas Kandagatla return parent_rate / 2; 3483af3d54b9SSrinivas Kandagatla } 3484af3d54b9SSrinivas Kandagatla 3485af3d54b9SSrinivas Kandagatla static const struct clk_ops swclk_gate_ops = { 3486af3d54b9SSrinivas Kandagatla .prepare = swclk_gate_enable, 3487af3d54b9SSrinivas Kandagatla .unprepare = swclk_gate_disable, 3488af3d54b9SSrinivas Kandagatla .is_enabled = swclk_gate_is_enabled, 3489af3d54b9SSrinivas Kandagatla .recalc_rate = swclk_recalc_rate, 3490af3d54b9SSrinivas Kandagatla 3491af3d54b9SSrinivas Kandagatla }; 3492af3d54b9SSrinivas Kandagatla 349370a5e96bSSrinivas Kandagatla static int rx_macro_register_mclk_output(struct rx_macro *rx) 3494af3d54b9SSrinivas Kandagatla { 3495af3d54b9SSrinivas Kandagatla struct device *dev = rx->dev; 3496af3d54b9SSrinivas Kandagatla const char *parent_clk_name = NULL; 3497af3d54b9SSrinivas Kandagatla const char *clk_name = "lpass-rx-mclk"; 3498af3d54b9SSrinivas Kandagatla struct clk_hw *hw; 3499af3d54b9SSrinivas Kandagatla struct clk_init_data init; 3500af3d54b9SSrinivas Kandagatla int ret; 3501af3d54b9SSrinivas Kandagatla 3502eaba1134SSrinivas Kandagatla parent_clk_name = __clk_get_name(rx->npl); 3503af3d54b9SSrinivas Kandagatla 3504af3d54b9SSrinivas Kandagatla init.name = clk_name; 3505af3d54b9SSrinivas Kandagatla init.ops = &swclk_gate_ops; 3506af3d54b9SSrinivas Kandagatla init.flags = 0; 3507af3d54b9SSrinivas Kandagatla init.parent_names = &parent_clk_name; 3508af3d54b9SSrinivas Kandagatla init.num_parents = 1; 3509af3d54b9SSrinivas Kandagatla rx->hw.init = &init; 3510af3d54b9SSrinivas Kandagatla hw = &rx->hw; 351170a5e96bSSrinivas Kandagatla ret = devm_clk_hw_register(rx->dev, hw); 3512af3d54b9SSrinivas Kandagatla if (ret) 351370a5e96bSSrinivas Kandagatla return ret; 3514af3d54b9SSrinivas Kandagatla 351570a5e96bSSrinivas Kandagatla return devm_of_clk_add_hw_provider(dev, of_clk_hw_simple_get, hw); 3516af3d54b9SSrinivas Kandagatla } 3517af3d54b9SSrinivas Kandagatla 3518af3d54b9SSrinivas Kandagatla static const struct snd_soc_component_driver rx_macro_component_drv = { 3519af3d54b9SSrinivas Kandagatla .name = "RX-MACRO", 3520af3d54b9SSrinivas Kandagatla .probe = rx_macro_component_probe, 3521af3d54b9SSrinivas Kandagatla .controls = rx_macro_snd_controls, 3522af3d54b9SSrinivas Kandagatla .num_controls = ARRAY_SIZE(rx_macro_snd_controls), 35234f692926SSrinivas Kandagatla .dapm_widgets = rx_macro_dapm_widgets, 35244f692926SSrinivas Kandagatla .num_dapm_widgets = ARRAY_SIZE(rx_macro_dapm_widgets), 35254f692926SSrinivas Kandagatla .dapm_routes = rx_audio_map, 35264f692926SSrinivas Kandagatla .num_dapm_routes = ARRAY_SIZE(rx_audio_map), 3527af3d54b9SSrinivas Kandagatla }; 3528af3d54b9SSrinivas Kandagatla 3529af3d54b9SSrinivas Kandagatla static int rx_macro_probe(struct platform_device *pdev) 3530af3d54b9SSrinivas Kandagatla { 3531af3d54b9SSrinivas Kandagatla struct device *dev = &pdev->dev; 3532af3d54b9SSrinivas Kandagatla struct rx_macro *rx; 3533af3d54b9SSrinivas Kandagatla void __iomem *base; 3534af3d54b9SSrinivas Kandagatla int ret; 3535af3d54b9SSrinivas Kandagatla 3536af3d54b9SSrinivas Kandagatla rx = devm_kzalloc(dev, sizeof(*rx), GFP_KERNEL); 3537af3d54b9SSrinivas Kandagatla if (!rx) 3538af3d54b9SSrinivas Kandagatla return -ENOMEM; 3539af3d54b9SSrinivas Kandagatla 354043b647d9SSrinivas Kandagatla rx->macro = devm_clk_get_optional(dev, "macro"); 354143b647d9SSrinivas Kandagatla if (IS_ERR(rx->macro)) 354243b647d9SSrinivas Kandagatla return PTR_ERR(rx->macro); 3543af3d54b9SSrinivas Kandagatla 354443b647d9SSrinivas Kandagatla rx->dcodec = devm_clk_get_optional(dev, "dcodec"); 354543b647d9SSrinivas Kandagatla if (IS_ERR(rx->dcodec)) 354643b647d9SSrinivas Kandagatla return PTR_ERR(rx->dcodec); 354743b647d9SSrinivas Kandagatla 354843b647d9SSrinivas Kandagatla rx->mclk = devm_clk_get(dev, "mclk"); 354943b647d9SSrinivas Kandagatla if (IS_ERR(rx->mclk)) 355043b647d9SSrinivas Kandagatla return PTR_ERR(rx->mclk); 355143b647d9SSrinivas Kandagatla 355243b647d9SSrinivas Kandagatla rx->npl = devm_clk_get(dev, "npl"); 355343b647d9SSrinivas Kandagatla if (IS_ERR(rx->npl)) 355443b647d9SSrinivas Kandagatla return PTR_ERR(rx->npl); 355543b647d9SSrinivas Kandagatla 355643b647d9SSrinivas Kandagatla rx->fsgen = devm_clk_get(dev, "fsgen"); 355743b647d9SSrinivas Kandagatla if (IS_ERR(rx->fsgen)) 355843b647d9SSrinivas Kandagatla return PTR_ERR(rx->fsgen); 3559af3d54b9SSrinivas Kandagatla 3560*9e3d83c5SSrinivasa Rao Mandadapu rx->pds = lpass_macro_pds_init(dev); 3561*9e3d83c5SSrinivasa Rao Mandadapu if (IS_ERR(rx->pds)) 3562*9e3d83c5SSrinivasa Rao Mandadapu return PTR_ERR(rx->pds); 3563*9e3d83c5SSrinivasa Rao Mandadapu 3564af3d54b9SSrinivas Kandagatla base = devm_platform_ioremap_resource(pdev, 0); 3565af3d54b9SSrinivas Kandagatla if (IS_ERR(base)) 3566af3d54b9SSrinivas Kandagatla return PTR_ERR(base); 3567af3d54b9SSrinivas Kandagatla 3568af3d54b9SSrinivas Kandagatla rx->regmap = devm_regmap_init_mmio(dev, base, &rx_regmap_config); 3569aa505eccSJiasheng Jiang if (IS_ERR(rx->regmap)) 3570aa505eccSJiasheng Jiang return PTR_ERR(rx->regmap); 3571af3d54b9SSrinivas Kandagatla 3572af3d54b9SSrinivas Kandagatla dev_set_drvdata(dev, rx); 3573af3d54b9SSrinivas Kandagatla 3574af3d54b9SSrinivas Kandagatla rx->reset_swr = true; 3575af3d54b9SSrinivas Kandagatla rx->dev = dev; 3576af3d54b9SSrinivas Kandagatla 3577af3d54b9SSrinivas Kandagatla /* set MCLK and NPL rates */ 357843b647d9SSrinivas Kandagatla clk_set_rate(rx->mclk, MCLK_FREQ); 357943b647d9SSrinivas Kandagatla clk_set_rate(rx->npl, 2 * MCLK_FREQ); 3580af3d54b9SSrinivas Kandagatla 358143b647d9SSrinivas Kandagatla ret = clk_prepare_enable(rx->macro); 3582af3d54b9SSrinivas Kandagatla if (ret) 358343b647d9SSrinivas Kandagatla goto err; 358443b647d9SSrinivas Kandagatla 358543b647d9SSrinivas Kandagatla ret = clk_prepare_enable(rx->dcodec); 358643b647d9SSrinivas Kandagatla if (ret) 358743b647d9SSrinivas Kandagatla goto err_dcodec; 358843b647d9SSrinivas Kandagatla 358943b647d9SSrinivas Kandagatla ret = clk_prepare_enable(rx->mclk); 359043b647d9SSrinivas Kandagatla if (ret) 359143b647d9SSrinivas Kandagatla goto err_mclk; 359243b647d9SSrinivas Kandagatla 359343b647d9SSrinivas Kandagatla ret = clk_prepare_enable(rx->npl); 359443b647d9SSrinivas Kandagatla if (ret) 359543b647d9SSrinivas Kandagatla goto err_npl; 359643b647d9SSrinivas Kandagatla 359743b647d9SSrinivas Kandagatla ret = clk_prepare_enable(rx->fsgen); 359843b647d9SSrinivas Kandagatla if (ret) 359943b647d9SSrinivas Kandagatla goto err_fsgen; 3600af3d54b9SSrinivas Kandagatla 360170a5e96bSSrinivas Kandagatla ret = rx_macro_register_mclk_output(rx); 360270a5e96bSSrinivas Kandagatla if (ret) 360343b647d9SSrinivas Kandagatla goto err_clkout; 3604af3d54b9SSrinivas Kandagatla 3605af3d54b9SSrinivas Kandagatla ret = devm_snd_soc_register_component(dev, &rx_macro_component_drv, 3606af3d54b9SSrinivas Kandagatla rx_macro_dai, 3607af3d54b9SSrinivas Kandagatla ARRAY_SIZE(rx_macro_dai)); 3608af3d54b9SSrinivas Kandagatla if (ret) 360943b647d9SSrinivas Kandagatla goto err_clkout; 3610af3d54b9SSrinivas Kandagatla 3611366ff79eSSrinivas Kandagatla 3612366ff79eSSrinivas Kandagatla pm_runtime_set_autosuspend_delay(dev, 3000); 3613366ff79eSSrinivas Kandagatla pm_runtime_use_autosuspend(dev); 3614366ff79eSSrinivas Kandagatla pm_runtime_mark_last_busy(dev); 3615366ff79eSSrinivas Kandagatla pm_runtime_set_active(dev); 3616366ff79eSSrinivas Kandagatla pm_runtime_enable(dev); 3617366ff79eSSrinivas Kandagatla 361843b647d9SSrinivas Kandagatla return 0; 361943b647d9SSrinivas Kandagatla 362043b647d9SSrinivas Kandagatla err_clkout: 362143b647d9SSrinivas Kandagatla clk_disable_unprepare(rx->fsgen); 362243b647d9SSrinivas Kandagatla err_fsgen: 362343b647d9SSrinivas Kandagatla clk_disable_unprepare(rx->npl); 362443b647d9SSrinivas Kandagatla err_npl: 362543b647d9SSrinivas Kandagatla clk_disable_unprepare(rx->mclk); 362643b647d9SSrinivas Kandagatla err_mclk: 362743b647d9SSrinivas Kandagatla clk_disable_unprepare(rx->dcodec); 362843b647d9SSrinivas Kandagatla err_dcodec: 362943b647d9SSrinivas Kandagatla clk_disable_unprepare(rx->macro); 363070a5e96bSSrinivas Kandagatla err: 363170a5e96bSSrinivas Kandagatla return ret; 3632af3d54b9SSrinivas Kandagatla } 3633af3d54b9SSrinivas Kandagatla 3634af3d54b9SSrinivas Kandagatla static int rx_macro_remove(struct platform_device *pdev) 3635af3d54b9SSrinivas Kandagatla { 3636af3d54b9SSrinivas Kandagatla struct rx_macro *rx = dev_get_drvdata(&pdev->dev); 3637af3d54b9SSrinivas Kandagatla 363843b647d9SSrinivas Kandagatla clk_disable_unprepare(rx->mclk); 363943b647d9SSrinivas Kandagatla clk_disable_unprepare(rx->npl); 364043b647d9SSrinivas Kandagatla clk_disable_unprepare(rx->fsgen); 364143b647d9SSrinivas Kandagatla clk_disable_unprepare(rx->macro); 364243b647d9SSrinivas Kandagatla clk_disable_unprepare(rx->dcodec); 364343b647d9SSrinivas Kandagatla 3644*9e3d83c5SSrinivasa Rao Mandadapu lpass_macro_pds_exit(rx->pds); 3645*9e3d83c5SSrinivasa Rao Mandadapu 3646af3d54b9SSrinivas Kandagatla return 0; 3647af3d54b9SSrinivas Kandagatla } 3648af3d54b9SSrinivas Kandagatla 3649af3d54b9SSrinivas Kandagatla static const struct of_device_id rx_macro_dt_match[] = { 36509d8c6981SSrinivasa Rao Mandadapu { .compatible = "qcom,sc7280-lpass-rx-macro" }, 3651af3d54b9SSrinivas Kandagatla { .compatible = "qcom,sm8250-lpass-rx-macro" }, 3652af3d54b9SSrinivas Kandagatla { } 3653af3d54b9SSrinivas Kandagatla }; 3654d4335d05SSrinivas Kandagatla MODULE_DEVICE_TABLE(of, rx_macro_dt_match); 3655af3d54b9SSrinivas Kandagatla 3656366ff79eSSrinivas Kandagatla static int __maybe_unused rx_macro_runtime_suspend(struct device *dev) 3657366ff79eSSrinivas Kandagatla { 3658366ff79eSSrinivas Kandagatla struct rx_macro *rx = dev_get_drvdata(dev); 3659366ff79eSSrinivas Kandagatla 3660366ff79eSSrinivas Kandagatla regcache_cache_only(rx->regmap, true); 3661366ff79eSSrinivas Kandagatla regcache_mark_dirty(rx->regmap); 3662366ff79eSSrinivas Kandagatla 3663366ff79eSSrinivas Kandagatla clk_disable_unprepare(rx->mclk); 3664366ff79eSSrinivas Kandagatla clk_disable_unprepare(rx->npl); 3665366ff79eSSrinivas Kandagatla clk_disable_unprepare(rx->fsgen); 3666366ff79eSSrinivas Kandagatla 3667366ff79eSSrinivas Kandagatla return 0; 3668366ff79eSSrinivas Kandagatla } 3669366ff79eSSrinivas Kandagatla 3670366ff79eSSrinivas Kandagatla static int __maybe_unused rx_macro_runtime_resume(struct device *dev) 3671366ff79eSSrinivas Kandagatla { 3672366ff79eSSrinivas Kandagatla struct rx_macro *rx = dev_get_drvdata(dev); 3673366ff79eSSrinivas Kandagatla int ret; 3674366ff79eSSrinivas Kandagatla 3675366ff79eSSrinivas Kandagatla ret = clk_prepare_enable(rx->mclk); 3676366ff79eSSrinivas Kandagatla if (ret) { 3677366ff79eSSrinivas Kandagatla dev_err(dev, "unable to prepare mclk\n"); 3678366ff79eSSrinivas Kandagatla return ret; 3679366ff79eSSrinivas Kandagatla } 3680366ff79eSSrinivas Kandagatla 3681366ff79eSSrinivas Kandagatla ret = clk_prepare_enable(rx->npl); 3682366ff79eSSrinivas Kandagatla if (ret) { 3683366ff79eSSrinivas Kandagatla dev_err(dev, "unable to prepare mclkx2\n"); 3684366ff79eSSrinivas Kandagatla goto err_npl; 3685366ff79eSSrinivas Kandagatla } 3686366ff79eSSrinivas Kandagatla 3687366ff79eSSrinivas Kandagatla ret = clk_prepare_enable(rx->fsgen); 3688366ff79eSSrinivas Kandagatla if (ret) { 3689366ff79eSSrinivas Kandagatla dev_err(dev, "unable to prepare fsgen\n"); 3690366ff79eSSrinivas Kandagatla goto err_fsgen; 3691366ff79eSSrinivas Kandagatla } 3692366ff79eSSrinivas Kandagatla regcache_cache_only(rx->regmap, false); 3693366ff79eSSrinivas Kandagatla regcache_sync(rx->regmap); 3694366ff79eSSrinivas Kandagatla rx->reset_swr = true; 3695366ff79eSSrinivas Kandagatla 3696366ff79eSSrinivas Kandagatla return 0; 3697366ff79eSSrinivas Kandagatla err_fsgen: 3698366ff79eSSrinivas Kandagatla clk_disable_unprepare(rx->npl); 3699366ff79eSSrinivas Kandagatla err_npl: 3700366ff79eSSrinivas Kandagatla clk_disable_unprepare(rx->mclk); 3701366ff79eSSrinivas Kandagatla 3702366ff79eSSrinivas Kandagatla return ret; 3703366ff79eSSrinivas Kandagatla } 3704366ff79eSSrinivas Kandagatla 3705366ff79eSSrinivas Kandagatla static const struct dev_pm_ops rx_macro_pm_ops = { 3706366ff79eSSrinivas Kandagatla SET_RUNTIME_PM_OPS(rx_macro_runtime_suspend, rx_macro_runtime_resume, NULL) 3707366ff79eSSrinivas Kandagatla }; 3708366ff79eSSrinivas Kandagatla 3709af3d54b9SSrinivas Kandagatla static struct platform_driver rx_macro_driver = { 3710af3d54b9SSrinivas Kandagatla .driver = { 3711af3d54b9SSrinivas Kandagatla .name = "rx_macro", 3712af3d54b9SSrinivas Kandagatla .of_match_table = rx_macro_dt_match, 3713af3d54b9SSrinivas Kandagatla .suppress_bind_attrs = true, 3714366ff79eSSrinivas Kandagatla .pm = &rx_macro_pm_ops, 3715af3d54b9SSrinivas Kandagatla }, 3716af3d54b9SSrinivas Kandagatla .probe = rx_macro_probe, 3717af3d54b9SSrinivas Kandagatla .remove = rx_macro_remove, 3718af3d54b9SSrinivas Kandagatla }; 3719af3d54b9SSrinivas Kandagatla 3720af3d54b9SSrinivas Kandagatla module_platform_driver(rx_macro_driver); 3721af3d54b9SSrinivas Kandagatla 3722af3d54b9SSrinivas Kandagatla MODULE_DESCRIPTION("RX macro driver"); 3723af3d54b9SSrinivas Kandagatla MODULE_LICENSE("GPL"); 3724