1af3d54b9SSrinivas Kandagatla // SPDX-License-Identifier: GPL-2.0-only 2af3d54b9SSrinivas Kandagatla // Copyright (c) 2018-2020, The Linux Foundation. All rights reserved. 3af3d54b9SSrinivas Kandagatla 4af3d54b9SSrinivas Kandagatla #include <linux/module.h> 5af3d54b9SSrinivas Kandagatla #include <linux/init.h> 6af3d54b9SSrinivas Kandagatla #include <linux/io.h> 7af3d54b9SSrinivas Kandagatla #include <linux/platform_device.h> 8366ff79eSSrinivas Kandagatla #include <linux/pm_runtime.h> 9af3d54b9SSrinivas Kandagatla #include <linux/clk.h> 10af3d54b9SSrinivas Kandagatla #include <sound/soc.h> 11af3d54b9SSrinivas Kandagatla #include <sound/pcm.h> 12af3d54b9SSrinivas Kandagatla #include <sound/pcm_params.h> 13af3d54b9SSrinivas Kandagatla #include <sound/soc-dapm.h> 14af3d54b9SSrinivas Kandagatla #include <sound/tlv.h> 15af3d54b9SSrinivas Kandagatla #include <linux/of_clk.h> 16af3d54b9SSrinivas Kandagatla #include <linux/clk-provider.h> 17af3d54b9SSrinivas Kandagatla 189e3d83c5SSrinivasa Rao Mandadapu #include "lpass-macro-common.h" 199e3d83c5SSrinivasa Rao Mandadapu 20af3d54b9SSrinivas Kandagatla #define CDC_RX_TOP_TOP_CFG0 (0x0000) 21af3d54b9SSrinivas Kandagatla #define CDC_RX_TOP_SWR_CTRL (0x0008) 22af3d54b9SSrinivas Kandagatla #define CDC_RX_TOP_DEBUG (0x000C) 23af3d54b9SSrinivas Kandagatla #define CDC_RX_TOP_DEBUG_BUS (0x0010) 24af3d54b9SSrinivas Kandagatla #define CDC_RX_TOP_DEBUG_EN0 (0x0014) 25af3d54b9SSrinivas Kandagatla #define CDC_RX_TOP_DEBUG_EN1 (0x0018) 26af3d54b9SSrinivas Kandagatla #define CDC_RX_TOP_DEBUG_EN2 (0x001C) 27af3d54b9SSrinivas Kandagatla #define CDC_RX_TOP_HPHL_COMP_WR_LSB (0x0020) 28af3d54b9SSrinivas Kandagatla #define CDC_RX_TOP_HPHL_COMP_WR_MSB (0x0024) 29af3d54b9SSrinivas Kandagatla #define CDC_RX_TOP_HPHL_COMP_LUT (0x0028) 30af3d54b9SSrinivas Kandagatla #define CDC_RX_TOP_HPH_LUT_BYPASS_MASK BIT(7) 31af3d54b9SSrinivas Kandagatla #define CDC_RX_TOP_HPHL_COMP_RD_LSB (0x002C) 32af3d54b9SSrinivas Kandagatla #define CDC_RX_TOP_HPHL_COMP_RD_MSB (0x0030) 33af3d54b9SSrinivas Kandagatla #define CDC_RX_TOP_HPHR_COMP_WR_LSB (0x0034) 34af3d54b9SSrinivas Kandagatla #define CDC_RX_TOP_HPHR_COMP_WR_MSB (0x0038) 35af3d54b9SSrinivas Kandagatla #define CDC_RX_TOP_HPHR_COMP_LUT (0x003C) 36af3d54b9SSrinivas Kandagatla #define CDC_RX_TOP_HPHR_COMP_RD_LSB (0x0040) 37af3d54b9SSrinivas Kandagatla #define CDC_RX_TOP_HPHR_COMP_RD_MSB (0x0044) 38af3d54b9SSrinivas Kandagatla #define CDC_RX_TOP_DSD0_DEBUG_CFG0 (0x0070) 39af3d54b9SSrinivas Kandagatla #define CDC_RX_TOP_DSD0_DEBUG_CFG1 (0x0074) 40af3d54b9SSrinivas Kandagatla #define CDC_RX_TOP_DSD0_DEBUG_CFG2 (0x0078) 41af3d54b9SSrinivas Kandagatla #define CDC_RX_TOP_DSD0_DEBUG_CFG3 (0x007C) 42af3d54b9SSrinivas Kandagatla #define CDC_RX_TOP_DSD1_DEBUG_CFG0 (0x0080) 43af3d54b9SSrinivas Kandagatla #define CDC_RX_TOP_DSD1_DEBUG_CFG1 (0x0084) 44af3d54b9SSrinivas Kandagatla #define CDC_RX_TOP_DSD1_DEBUG_CFG2 (0x0088) 45af3d54b9SSrinivas Kandagatla #define CDC_RX_TOP_DSD1_DEBUG_CFG3 (0x008C) 46af3d54b9SSrinivas Kandagatla #define CDC_RX_TOP_RX_I2S_CTL (0x0090) 47af3d54b9SSrinivas Kandagatla #define CDC_RX_TOP_TX_I2S2_CTL (0x0094) 48af3d54b9SSrinivas Kandagatla #define CDC_RX_TOP_I2S_CLK (0x0098) 49af3d54b9SSrinivas Kandagatla #define CDC_RX_TOP_I2S_RESET (0x009C) 50af3d54b9SSrinivas Kandagatla #define CDC_RX_TOP_I2S_MUX (0x00A0) 51af3d54b9SSrinivas Kandagatla #define CDC_RX_CLK_RST_CTRL_MCLK_CONTROL (0x0100) 52af3d54b9SSrinivas Kandagatla #define CDC_RX_CLK_MCLK_EN_MASK BIT(0) 53af3d54b9SSrinivas Kandagatla #define CDC_RX_CLK_MCLK_ENABLE BIT(0) 54af3d54b9SSrinivas Kandagatla #define CDC_RX_CLK_MCLK2_EN_MASK BIT(1) 55af3d54b9SSrinivas Kandagatla #define CDC_RX_CLK_MCLK2_ENABLE BIT(1) 56af3d54b9SSrinivas Kandagatla #define CDC_RX_CLK_RST_CTRL_FS_CNT_CONTROL (0x0104) 57af3d54b9SSrinivas Kandagatla #define CDC_RX_FS_MCLK_CNT_EN_MASK BIT(0) 58af3d54b9SSrinivas Kandagatla #define CDC_RX_FS_MCLK_CNT_ENABLE BIT(0) 59af3d54b9SSrinivas Kandagatla #define CDC_RX_FS_MCLK_CNT_CLR_MASK BIT(1) 60af3d54b9SSrinivas Kandagatla #define CDC_RX_FS_MCLK_CNT_CLR BIT(1) 61af3d54b9SSrinivas Kandagatla #define CDC_RX_CLK_RST_CTRL_SWR_CONTROL (0x0108) 62af3d54b9SSrinivas Kandagatla #define CDC_RX_SWR_CLK_EN_MASK BIT(0) 63af3d54b9SSrinivas Kandagatla #define CDC_RX_SWR_RESET_MASK BIT(1) 64af3d54b9SSrinivas Kandagatla #define CDC_RX_SWR_RESET BIT(1) 65af3d54b9SSrinivas Kandagatla #define CDC_RX_CLK_RST_CTRL_DSD_CONTROL (0x010C) 66af3d54b9SSrinivas Kandagatla #define CDC_RX_CLK_RST_CTRL_ASRC_SHARE_CONTROL (0x0110) 67af3d54b9SSrinivas Kandagatla #define CDC_RX_SOFTCLIP_CRC (0x0140) 68af3d54b9SSrinivas Kandagatla #define CDC_RX_SOFTCLIP_CLK_EN_MASK BIT(0) 69af3d54b9SSrinivas Kandagatla #define CDC_RX_SOFTCLIP_SOFTCLIP_CTRL (0x0144) 70af3d54b9SSrinivas Kandagatla #define CDC_RX_SOFTCLIP_EN_MASK BIT(0) 71af3d54b9SSrinivas Kandagatla #define CDC_RX_INP_MUX_RX_INT0_CFG0 (0x0180) 72af3d54b9SSrinivas Kandagatla #define CDC_RX_INTX_1_MIX_INP0_SEL_MASK GENMASK(3, 0) 73af3d54b9SSrinivas Kandagatla #define CDC_RX_INTX_1_MIX_INP1_SEL_MASK GENMASK(7, 4) 74af3d54b9SSrinivas Kandagatla #define CDC_RX_INP_MUX_RX_INT0_CFG1 (0x0184) 75af3d54b9SSrinivas Kandagatla #define CDC_RX_INTX_2_SEL_MASK GENMASK(3, 0) 76af3d54b9SSrinivas Kandagatla #define CDC_RX_INTX_1_MIX_INP2_SEL_MASK GENMASK(7, 4) 77af3d54b9SSrinivas Kandagatla #define CDC_RX_INP_MUX_RX_INT1_CFG0 (0x0188) 78af3d54b9SSrinivas Kandagatla #define CDC_RX_INP_MUX_RX_INT1_CFG1 (0x018C) 79af3d54b9SSrinivas Kandagatla #define CDC_RX_INP_MUX_RX_INT2_CFG0 (0x0190) 80af3d54b9SSrinivas Kandagatla #define CDC_RX_INP_MUX_RX_INT2_CFG1 (0x0194) 81af3d54b9SSrinivas Kandagatla #define CDC_RX_INP_MUX_RX_MIX_CFG4 (0x0198) 82af3d54b9SSrinivas Kandagatla #define CDC_RX_INP_MUX_RX_MIX_CFG5 (0x019C) 83af3d54b9SSrinivas Kandagatla #define CDC_RX_INP_MUX_SIDETONE_SRC_CFG0 (0x01A0) 84af3d54b9SSrinivas Kandagatla #define CDC_RX_CLSH_CRC (0x0200) 85af3d54b9SSrinivas Kandagatla #define CDC_RX_CLSH_CLK_EN_MASK BIT(0) 86af3d54b9SSrinivas Kandagatla #define CDC_RX_CLSH_DLY_CTRL (0x0204) 87af3d54b9SSrinivas Kandagatla #define CDC_RX_CLSH_DECAY_CTRL (0x0208) 88af3d54b9SSrinivas Kandagatla #define CDC_RX_CLSH_DECAY_RATE_MASK GENMASK(2, 0) 89af3d54b9SSrinivas Kandagatla #define CDC_RX_CLSH_HPH_V_PA (0x020C) 90af3d54b9SSrinivas Kandagatla #define CDC_RX_CLSH_HPH_V_PA_MIN_MASK GENMASK(5, 0) 91af3d54b9SSrinivas Kandagatla #define CDC_RX_CLSH_EAR_V_PA (0x0210) 92af3d54b9SSrinivas Kandagatla #define CDC_RX_CLSH_HPH_V_HD (0x0214) 93af3d54b9SSrinivas Kandagatla #define CDC_RX_CLSH_EAR_V_HD (0x0218) 94af3d54b9SSrinivas Kandagatla #define CDC_RX_CLSH_K1_MSB (0x021C) 95af3d54b9SSrinivas Kandagatla #define CDC_RX_CLSH_K1_MSB_COEFF_MASK GENMASK(3, 0) 96af3d54b9SSrinivas Kandagatla #define CDC_RX_CLSH_K1_LSB (0x0220) 97af3d54b9SSrinivas Kandagatla #define CDC_RX_CLSH_K2_MSB (0x0224) 98af3d54b9SSrinivas Kandagatla #define CDC_RX_CLSH_K2_LSB (0x0228) 99af3d54b9SSrinivas Kandagatla #define CDC_RX_CLSH_IDLE_CTRL (0x022C) 100af3d54b9SSrinivas Kandagatla #define CDC_RX_CLSH_IDLE_HPH (0x0230) 101af3d54b9SSrinivas Kandagatla #define CDC_RX_CLSH_IDLE_EAR (0x0234) 102af3d54b9SSrinivas Kandagatla #define CDC_RX_CLSH_TEST0 (0x0238) 103af3d54b9SSrinivas Kandagatla #define CDC_RX_CLSH_TEST1 (0x023C) 104af3d54b9SSrinivas Kandagatla #define CDC_RX_CLSH_OVR_VREF (0x0240) 105af3d54b9SSrinivas Kandagatla #define CDC_RX_CLSH_CLSG_CTL (0x0244) 106af3d54b9SSrinivas Kandagatla #define CDC_RX_CLSH_CLSG_CFG1 (0x0248) 107af3d54b9SSrinivas Kandagatla #define CDC_RX_CLSH_CLSG_CFG2 (0x024C) 108af3d54b9SSrinivas Kandagatla #define CDC_RX_BCL_VBAT_PATH_CTL (0x0280) 109af3d54b9SSrinivas Kandagatla #define CDC_RX_BCL_VBAT_CFG (0x0284) 110af3d54b9SSrinivas Kandagatla #define CDC_RX_BCL_VBAT_ADC_CAL1 (0x0288) 111af3d54b9SSrinivas Kandagatla #define CDC_RX_BCL_VBAT_ADC_CAL2 (0x028C) 112af3d54b9SSrinivas Kandagatla #define CDC_RX_BCL_VBAT_ADC_CAL3 (0x0290) 113af3d54b9SSrinivas Kandagatla #define CDC_RX_BCL_VBAT_PK_EST1 (0x0294) 114af3d54b9SSrinivas Kandagatla #define CDC_RX_BCL_VBAT_PK_EST2 (0x0298) 115af3d54b9SSrinivas Kandagatla #define CDC_RX_BCL_VBAT_PK_EST3 (0x029C) 116af3d54b9SSrinivas Kandagatla #define CDC_RX_BCL_VBAT_RF_PROC1 (0x02A0) 117af3d54b9SSrinivas Kandagatla #define CDC_RX_BCL_VBAT_RF_PROC2 (0x02A4) 118af3d54b9SSrinivas Kandagatla #define CDC_RX_BCL_VBAT_TAC1 (0x02A8) 119af3d54b9SSrinivas Kandagatla #define CDC_RX_BCL_VBAT_TAC2 (0x02AC) 120af3d54b9SSrinivas Kandagatla #define CDC_RX_BCL_VBAT_TAC3 (0x02B0) 121af3d54b9SSrinivas Kandagatla #define CDC_RX_BCL_VBAT_TAC4 (0x02B4) 122af3d54b9SSrinivas Kandagatla #define CDC_RX_BCL_VBAT_GAIN_UPD1 (0x02B8) 123af3d54b9SSrinivas Kandagatla #define CDC_RX_BCL_VBAT_GAIN_UPD2 (0x02BC) 124af3d54b9SSrinivas Kandagatla #define CDC_RX_BCL_VBAT_GAIN_UPD3 (0x02C0) 125af3d54b9SSrinivas Kandagatla #define CDC_RX_BCL_VBAT_GAIN_UPD4 (0x02C4) 126af3d54b9SSrinivas Kandagatla #define CDC_RX_BCL_VBAT_GAIN_UPD5 (0x02C8) 127af3d54b9SSrinivas Kandagatla #define CDC_RX_BCL_VBAT_DEBUG1 (0x02CC) 128af3d54b9SSrinivas Kandagatla #define CDC_RX_BCL_VBAT_GAIN_UPD_MON (0x02D0) 129af3d54b9SSrinivas Kandagatla #define CDC_RX_BCL_VBAT_GAIN_MON_VAL (0x02D4) 130af3d54b9SSrinivas Kandagatla #define CDC_RX_BCL_VBAT_BAN (0x02D8) 131af3d54b9SSrinivas Kandagatla #define CDC_RX_BCL_VBAT_BCL_GAIN_UPD1 (0x02DC) 132af3d54b9SSrinivas Kandagatla #define CDC_RX_BCL_VBAT_BCL_GAIN_UPD2 (0x02E0) 133af3d54b9SSrinivas Kandagatla #define CDC_RX_BCL_VBAT_BCL_GAIN_UPD3 (0x02E4) 134af3d54b9SSrinivas Kandagatla #define CDC_RX_BCL_VBAT_BCL_GAIN_UPD4 (0x02E8) 135af3d54b9SSrinivas Kandagatla #define CDC_RX_BCL_VBAT_BCL_GAIN_UPD5 (0x02EC) 136af3d54b9SSrinivas Kandagatla #define CDC_RX_BCL_VBAT_BCL_GAIN_UPD6 (0x02F0) 137af3d54b9SSrinivas Kandagatla #define CDC_RX_BCL_VBAT_BCL_GAIN_UPD7 (0x02F4) 138af3d54b9SSrinivas Kandagatla #define CDC_RX_BCL_VBAT_BCL_GAIN_UPD8 (0x02F8) 139af3d54b9SSrinivas Kandagatla #define CDC_RX_BCL_VBAT_BCL_GAIN_UPD9 (0x02FC) 140af3d54b9SSrinivas Kandagatla #define CDC_RX_BCL_VBAT_ATTN1 (0x0300) 141af3d54b9SSrinivas Kandagatla #define CDC_RX_BCL_VBAT_ATTN2 (0x0304) 142af3d54b9SSrinivas Kandagatla #define CDC_RX_BCL_VBAT_ATTN3 (0x0308) 143af3d54b9SSrinivas Kandagatla #define CDC_RX_BCL_VBAT_DECODE_CTL1 (0x030C) 144af3d54b9SSrinivas Kandagatla #define CDC_RX_BCL_VBAT_DECODE_CTL2 (0x0310) 145af3d54b9SSrinivas Kandagatla #define CDC_RX_BCL_VBAT_DECODE_CFG1 (0x0314) 146af3d54b9SSrinivas Kandagatla #define CDC_RX_BCL_VBAT_DECODE_CFG2 (0x0318) 147af3d54b9SSrinivas Kandagatla #define CDC_RX_BCL_VBAT_DECODE_CFG3 (0x031C) 148af3d54b9SSrinivas Kandagatla #define CDC_RX_BCL_VBAT_DECODE_CFG4 (0x0320) 149af3d54b9SSrinivas Kandagatla #define CDC_RX_BCL_VBAT_DECODE_ST (0x0324) 150af3d54b9SSrinivas Kandagatla #define CDC_RX_INTR_CTRL_CFG (0x0340) 151af3d54b9SSrinivas Kandagatla #define CDC_RX_INTR_CTRL_CLR_COMMIT (0x0344) 152af3d54b9SSrinivas Kandagatla #define CDC_RX_INTR_CTRL_PIN1_MASK0 (0x0360) 153af3d54b9SSrinivas Kandagatla #define CDC_RX_INTR_CTRL_PIN1_STATUS0 (0x0368) 154af3d54b9SSrinivas Kandagatla #define CDC_RX_INTR_CTRL_PIN1_CLEAR0 (0x0370) 155af3d54b9SSrinivas Kandagatla #define CDC_RX_INTR_CTRL_PIN2_MASK0 (0x0380) 156af3d54b9SSrinivas Kandagatla #define CDC_RX_INTR_CTRL_PIN2_STATUS0 (0x0388) 157af3d54b9SSrinivas Kandagatla #define CDC_RX_INTR_CTRL_PIN2_CLEAR0 (0x0390) 158af3d54b9SSrinivas Kandagatla #define CDC_RX_INTR_CTRL_LEVEL0 (0x03C0) 159af3d54b9SSrinivas Kandagatla #define CDC_RX_INTR_CTRL_BYPASS0 (0x03C8) 160af3d54b9SSrinivas Kandagatla #define CDC_RX_INTR_CTRL_SET0 (0x03D0) 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 369e7621434SSrinivas Kandagatla #define MCLK_FREQ 19200000 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 int clsh_users; 600af3d54b9SSrinivas Kandagatla int rx_mclk_cnt; 601af3d54b9SSrinivas Kandagatla bool is_ear_mode_on; 602af3d54b9SSrinivas Kandagatla bool hph_pwr_mode; 603af3d54b9SSrinivas Kandagatla bool hph_hd2_mode; 604af3d54b9SSrinivas Kandagatla struct snd_soc_component *component; 605af3d54b9SSrinivas Kandagatla unsigned long active_ch_mask[RX_MACRO_MAX_DAIS]; 606af3d54b9SSrinivas Kandagatla unsigned long active_ch_cnt[RX_MACRO_MAX_DAIS]; 607af3d54b9SSrinivas Kandagatla u16 bit_width[RX_MACRO_MAX_DAIS]; 608af3d54b9SSrinivas Kandagatla int is_softclip_on; 609af3d54b9SSrinivas Kandagatla int is_aux_hpf_on; 610af3d54b9SSrinivas Kandagatla int softclip_clk_users; 6119e3d83c5SSrinivasa Rao Mandadapu struct lpass_macro *pds; 612af3d54b9SSrinivas Kandagatla struct regmap *regmap; 61343b647d9SSrinivas Kandagatla struct clk *mclk; 61443b647d9SSrinivas Kandagatla struct clk *npl; 61543b647d9SSrinivas Kandagatla struct clk *macro; 61643b647d9SSrinivas Kandagatla struct clk *dcodec; 61743b647d9SSrinivas Kandagatla struct clk *fsgen; 618af3d54b9SSrinivas Kandagatla struct clk_hw hw; 619af3d54b9SSrinivas Kandagatla }; 620af3d54b9SSrinivas Kandagatla #define to_rx_macro(_hw) container_of(_hw, struct rx_macro, hw) 621af3d54b9SSrinivas Kandagatla 622f3ce6f3cSSrinivas Kandagatla struct wcd_iir_filter_ctl { 623f3ce6f3cSSrinivas Kandagatla unsigned int iir_idx; 624f3ce6f3cSSrinivas Kandagatla unsigned int band_idx; 625f3ce6f3cSSrinivas Kandagatla struct soc_bytes_ext bytes_ext; 626f3ce6f3cSSrinivas Kandagatla }; 627f3ce6f3cSSrinivas Kandagatla 628af3d54b9SSrinivas Kandagatla static const DECLARE_TLV_DB_SCALE(digital_gain, -8400, 100, -8400); 629af3d54b9SSrinivas Kandagatla 6304f692926SSrinivas Kandagatla static const char * const rx_int_mix_mux_text[] = { 6314f692926SSrinivas Kandagatla "ZERO", "RX0", "RX1", "RX2", "RX3", "RX4", "RX5" 6324f692926SSrinivas Kandagatla }; 6334f692926SSrinivas Kandagatla 6344f692926SSrinivas Kandagatla static const char * const rx_prim_mix_text[] = { 6354f692926SSrinivas Kandagatla "ZERO", "DEC0", "DEC1", "IIR0", "IIR1", "RX0", "RX1", "RX2", 6364f692926SSrinivas Kandagatla "RX3", "RX4", "RX5" 6374f692926SSrinivas Kandagatla }; 6384f692926SSrinivas Kandagatla 6394f692926SSrinivas Kandagatla static const char * const rx_sidetone_mix_text[] = { 6404f692926SSrinivas Kandagatla "ZERO", "SRC0", "SRC1", "SRC_SUM" 6414f692926SSrinivas Kandagatla }; 6424f692926SSrinivas Kandagatla 6434f692926SSrinivas Kandagatla static const char * const iir_inp_mux_text[] = { 6444f692926SSrinivas Kandagatla "ZERO", "DEC0", "DEC1", "DEC2", "DEC3", 6454f692926SSrinivas Kandagatla "RX0", "RX1", "RX2", "RX3", "RX4", "RX5" 6464f692926SSrinivas Kandagatla }; 6474f692926SSrinivas Kandagatla 6484f692926SSrinivas Kandagatla static const char * const rx_int_dem_inp_mux_text[] = { 6494f692926SSrinivas Kandagatla "NORMAL_DSM_OUT", "CLSH_DSM_OUT", 6504f692926SSrinivas Kandagatla }; 6514f692926SSrinivas Kandagatla 6524f692926SSrinivas Kandagatla static const char * const rx_int0_1_interp_mux_text[] = { 6534f692926SSrinivas Kandagatla "ZERO", "RX INT0_1 MIX1", 6544f692926SSrinivas Kandagatla }; 6554f692926SSrinivas Kandagatla 6564f692926SSrinivas Kandagatla static const char * const rx_int1_1_interp_mux_text[] = { 6574f692926SSrinivas Kandagatla "ZERO", "RX INT1_1 MIX1", 6584f692926SSrinivas Kandagatla }; 6594f692926SSrinivas Kandagatla 6604f692926SSrinivas Kandagatla static const char * const rx_int2_1_interp_mux_text[] = { 6614f692926SSrinivas Kandagatla "ZERO", "RX INT2_1 MIX1", 6624f692926SSrinivas Kandagatla }; 6634f692926SSrinivas Kandagatla 6644f692926SSrinivas Kandagatla static const char * const rx_int0_2_interp_mux_text[] = { 6654f692926SSrinivas Kandagatla "ZERO", "RX INT0_2 MUX", 6664f692926SSrinivas Kandagatla }; 6674f692926SSrinivas Kandagatla 6684f692926SSrinivas Kandagatla static const char * const rx_int1_2_interp_mux_text[] = { 6694f692926SSrinivas Kandagatla "ZERO", "RX INT1_2 MUX", 6704f692926SSrinivas Kandagatla }; 6714f692926SSrinivas Kandagatla 6724f692926SSrinivas Kandagatla static const char * const rx_int2_2_interp_mux_text[] = { 6734f692926SSrinivas Kandagatla "ZERO", "RX INT2_2 MUX", 6744f692926SSrinivas Kandagatla }; 6754f692926SSrinivas Kandagatla 6764f692926SSrinivas Kandagatla static const char *const rx_macro_mux_text[] = { 6774f692926SSrinivas Kandagatla "ZERO", "AIF1_PB", "AIF2_PB", "AIF3_PB", "AIF4_PB" 6784f692926SSrinivas Kandagatla }; 6794f692926SSrinivas Kandagatla 680af3d54b9SSrinivas Kandagatla static const char *const rx_macro_hph_pwr_mode_text[] = { 681af3d54b9SSrinivas Kandagatla "ULP", "LOHIFI" 682af3d54b9SSrinivas Kandagatla }; 683af3d54b9SSrinivas Kandagatla 6844f692926SSrinivas Kandagatla static const char * const rx_echo_mux_text[] = { 6854f692926SSrinivas Kandagatla "ZERO", "RX_MIX0", "RX_MIX1", "RX_MIX2" 6864f692926SSrinivas Kandagatla }; 6874f692926SSrinivas Kandagatla 688af3d54b9SSrinivas Kandagatla static const struct soc_enum rx_macro_hph_pwr_mode_enum = 689af3d54b9SSrinivas Kandagatla SOC_ENUM_SINGLE_EXT(2, rx_macro_hph_pwr_mode_text); 6904f692926SSrinivas Kandagatla static const struct soc_enum rx_mix_tx2_mux_enum = 6914f692926SSrinivas Kandagatla SOC_ENUM_SINGLE(CDC_RX_INP_MUX_RX_MIX_CFG5, 0, 4, rx_echo_mux_text); 6924f692926SSrinivas Kandagatla static const struct soc_enum rx_mix_tx1_mux_enum = 6934f692926SSrinivas Kandagatla SOC_ENUM_SINGLE(CDC_RX_INP_MUX_RX_MIX_CFG4, 0, 4, rx_echo_mux_text); 6944f692926SSrinivas Kandagatla static const struct soc_enum rx_mix_tx0_mux_enum = 6954f692926SSrinivas Kandagatla SOC_ENUM_SINGLE(CDC_RX_INP_MUX_RX_MIX_CFG4, 4, 4, rx_echo_mux_text); 6964f692926SSrinivas Kandagatla 6974f692926SSrinivas Kandagatla static SOC_ENUM_SINGLE_DECL(rx_int0_2_enum, CDC_RX_INP_MUX_RX_INT0_CFG1, 0, 6984f692926SSrinivas Kandagatla rx_int_mix_mux_text); 6994f692926SSrinivas Kandagatla static SOC_ENUM_SINGLE_DECL(rx_int1_2_enum, CDC_RX_INP_MUX_RX_INT1_CFG1, 0, 7004f692926SSrinivas Kandagatla rx_int_mix_mux_text); 7014f692926SSrinivas Kandagatla static SOC_ENUM_SINGLE_DECL(rx_int2_2_enum, CDC_RX_INP_MUX_RX_INT2_CFG1, 0, 7024f692926SSrinivas Kandagatla rx_int_mix_mux_text); 7034f692926SSrinivas Kandagatla 7044f692926SSrinivas Kandagatla static SOC_ENUM_SINGLE_DECL(rx_int0_1_mix_inp0_enum, CDC_RX_INP_MUX_RX_INT0_CFG0, 0, 7054f692926SSrinivas Kandagatla rx_prim_mix_text); 7064f692926SSrinivas Kandagatla static SOC_ENUM_SINGLE_DECL(rx_int0_1_mix_inp1_enum, CDC_RX_INP_MUX_RX_INT0_CFG0, 4, 7074f692926SSrinivas Kandagatla rx_prim_mix_text); 7084f692926SSrinivas Kandagatla static SOC_ENUM_SINGLE_DECL(rx_int0_1_mix_inp2_enum, CDC_RX_INP_MUX_RX_INT0_CFG1, 4, 7094f692926SSrinivas Kandagatla rx_prim_mix_text); 7104f692926SSrinivas Kandagatla static SOC_ENUM_SINGLE_DECL(rx_int1_1_mix_inp0_enum, CDC_RX_INP_MUX_RX_INT1_CFG0, 0, 7114f692926SSrinivas Kandagatla rx_prim_mix_text); 7124f692926SSrinivas Kandagatla static SOC_ENUM_SINGLE_DECL(rx_int1_1_mix_inp1_enum, CDC_RX_INP_MUX_RX_INT1_CFG0, 4, 7134f692926SSrinivas Kandagatla rx_prim_mix_text); 7144f692926SSrinivas Kandagatla static SOC_ENUM_SINGLE_DECL(rx_int1_1_mix_inp2_enum, CDC_RX_INP_MUX_RX_INT1_CFG1, 4, 7154f692926SSrinivas Kandagatla rx_prim_mix_text); 7164f692926SSrinivas Kandagatla static SOC_ENUM_SINGLE_DECL(rx_int2_1_mix_inp0_enum, CDC_RX_INP_MUX_RX_INT2_CFG0, 0, 7174f692926SSrinivas Kandagatla rx_prim_mix_text); 7184f692926SSrinivas Kandagatla static SOC_ENUM_SINGLE_DECL(rx_int2_1_mix_inp1_enum, CDC_RX_INP_MUX_RX_INT2_CFG0, 4, 7194f692926SSrinivas Kandagatla rx_prim_mix_text); 7204f692926SSrinivas Kandagatla static SOC_ENUM_SINGLE_DECL(rx_int2_1_mix_inp2_enum, CDC_RX_INP_MUX_RX_INT2_CFG1, 4, 7214f692926SSrinivas Kandagatla rx_prim_mix_text); 7224f692926SSrinivas Kandagatla 7234f692926SSrinivas Kandagatla static SOC_ENUM_SINGLE_DECL(rx_int0_mix2_inp_enum, CDC_RX_INP_MUX_SIDETONE_SRC_CFG0, 2, 7244f692926SSrinivas Kandagatla rx_sidetone_mix_text); 7254f692926SSrinivas Kandagatla static SOC_ENUM_SINGLE_DECL(rx_int1_mix2_inp_enum, CDC_RX_INP_MUX_SIDETONE_SRC_CFG0, 4, 7264f692926SSrinivas Kandagatla rx_sidetone_mix_text); 7274f692926SSrinivas Kandagatla static SOC_ENUM_SINGLE_DECL(rx_int2_mix2_inp_enum, CDC_RX_INP_MUX_SIDETONE_SRC_CFG0, 6, 7284f692926SSrinivas Kandagatla rx_sidetone_mix_text); 7294f692926SSrinivas Kandagatla static SOC_ENUM_SINGLE_DECL(iir0_inp0_enum, CDC_RX_IIR_INP_MUX_IIR0_MIX_CFG0, 0, 7304f692926SSrinivas Kandagatla iir_inp_mux_text); 7314f692926SSrinivas Kandagatla static SOC_ENUM_SINGLE_DECL(iir0_inp1_enum, CDC_RX_IIR_INP_MUX_IIR0_MIX_CFG1, 0, 7324f692926SSrinivas Kandagatla iir_inp_mux_text); 7334f692926SSrinivas Kandagatla static SOC_ENUM_SINGLE_DECL(iir0_inp2_enum, CDC_RX_IIR_INP_MUX_IIR0_MIX_CFG2, 0, 7344f692926SSrinivas Kandagatla iir_inp_mux_text); 7354f692926SSrinivas Kandagatla static SOC_ENUM_SINGLE_DECL(iir0_inp3_enum, CDC_RX_IIR_INP_MUX_IIR0_MIX_CFG3, 0, 7364f692926SSrinivas Kandagatla iir_inp_mux_text); 7374f692926SSrinivas Kandagatla static SOC_ENUM_SINGLE_DECL(iir1_inp0_enum, CDC_RX_IIR_INP_MUX_IIR1_MIX_CFG0, 0, 7384f692926SSrinivas Kandagatla iir_inp_mux_text); 7394f692926SSrinivas Kandagatla static SOC_ENUM_SINGLE_DECL(iir1_inp1_enum, CDC_RX_IIR_INP_MUX_IIR1_MIX_CFG1, 0, 7404f692926SSrinivas Kandagatla iir_inp_mux_text); 7414f692926SSrinivas Kandagatla static SOC_ENUM_SINGLE_DECL(iir1_inp2_enum, CDC_RX_IIR_INP_MUX_IIR1_MIX_CFG2, 0, 7424f692926SSrinivas Kandagatla iir_inp_mux_text); 7434f692926SSrinivas Kandagatla static SOC_ENUM_SINGLE_DECL(iir1_inp3_enum, CDC_RX_IIR_INP_MUX_IIR1_MIX_CFG3, 0, 7444f692926SSrinivas Kandagatla iir_inp_mux_text); 7454f692926SSrinivas Kandagatla 7464f692926SSrinivas Kandagatla static SOC_ENUM_SINGLE_DECL(rx_int0_1_interp_enum, SND_SOC_NOPM, 0, 7474f692926SSrinivas Kandagatla rx_int0_1_interp_mux_text); 7484f692926SSrinivas Kandagatla static SOC_ENUM_SINGLE_DECL(rx_int1_1_interp_enum, SND_SOC_NOPM, 0, 7494f692926SSrinivas Kandagatla rx_int1_1_interp_mux_text); 7504f692926SSrinivas Kandagatla static SOC_ENUM_SINGLE_DECL(rx_int2_1_interp_enum, SND_SOC_NOPM, 0, 7514f692926SSrinivas Kandagatla rx_int2_1_interp_mux_text); 7524f692926SSrinivas Kandagatla static SOC_ENUM_SINGLE_DECL(rx_int0_2_interp_enum, SND_SOC_NOPM, 0, 7534f692926SSrinivas Kandagatla rx_int0_2_interp_mux_text); 7544f692926SSrinivas Kandagatla static SOC_ENUM_SINGLE_DECL(rx_int1_2_interp_enum, SND_SOC_NOPM, 0, 7554f692926SSrinivas Kandagatla rx_int1_2_interp_mux_text); 7564f692926SSrinivas Kandagatla static SOC_ENUM_SINGLE_DECL(rx_int2_2_interp_enum, SND_SOC_NOPM, 0, 7574f692926SSrinivas Kandagatla rx_int2_2_interp_mux_text); 7584f692926SSrinivas Kandagatla static SOC_ENUM_SINGLE_DECL(rx_int0_dem_inp_enum, CDC_RX_RX0_RX_PATH_CFG1, 0, 7594f692926SSrinivas Kandagatla rx_int_dem_inp_mux_text); 7604f692926SSrinivas Kandagatla static SOC_ENUM_SINGLE_DECL(rx_int1_dem_inp_enum, CDC_RX_RX1_RX_PATH_CFG1, 0, 7614f692926SSrinivas Kandagatla rx_int_dem_inp_mux_text); 7624f692926SSrinivas Kandagatla 7634f692926SSrinivas Kandagatla static SOC_ENUM_SINGLE_DECL(rx_macro_rx0_enum, SND_SOC_NOPM, 0, rx_macro_mux_text); 7644f692926SSrinivas Kandagatla static SOC_ENUM_SINGLE_DECL(rx_macro_rx1_enum, SND_SOC_NOPM, 0, rx_macro_mux_text); 7654f692926SSrinivas Kandagatla static SOC_ENUM_SINGLE_DECL(rx_macro_rx2_enum, SND_SOC_NOPM, 0, rx_macro_mux_text); 7664f692926SSrinivas Kandagatla static SOC_ENUM_SINGLE_DECL(rx_macro_rx3_enum, SND_SOC_NOPM, 0, rx_macro_mux_text); 7674f692926SSrinivas Kandagatla static SOC_ENUM_SINGLE_DECL(rx_macro_rx4_enum, SND_SOC_NOPM, 0, rx_macro_mux_text); 7684f692926SSrinivas Kandagatla static SOC_ENUM_SINGLE_DECL(rx_macro_rx5_enum, SND_SOC_NOPM, 0, rx_macro_mux_text); 7694f692926SSrinivas Kandagatla 7704f692926SSrinivas Kandagatla static const struct snd_kcontrol_new rx_mix_tx1_mux = 7714f692926SSrinivas Kandagatla SOC_DAPM_ENUM("RX MIX TX1_MUX Mux", rx_mix_tx1_mux_enum); 7724f692926SSrinivas Kandagatla static const struct snd_kcontrol_new rx_mix_tx2_mux = 7734f692926SSrinivas Kandagatla SOC_DAPM_ENUM("RX MIX TX2_MUX Mux", rx_mix_tx2_mux_enum); 7744f692926SSrinivas Kandagatla static const struct snd_kcontrol_new rx_int0_2_mux = 7754f692926SSrinivas Kandagatla SOC_DAPM_ENUM("rx_int0_2", rx_int0_2_enum); 7764f692926SSrinivas Kandagatla static const struct snd_kcontrol_new rx_int1_2_mux = 7774f692926SSrinivas Kandagatla SOC_DAPM_ENUM("rx_int1_2", rx_int1_2_enum); 7784f692926SSrinivas Kandagatla static const struct snd_kcontrol_new rx_int2_2_mux = 7794f692926SSrinivas Kandagatla SOC_DAPM_ENUM("rx_int2_2", rx_int2_2_enum); 7804f692926SSrinivas Kandagatla static const struct snd_kcontrol_new rx_int0_1_mix_inp0_mux = 7814f692926SSrinivas Kandagatla SOC_DAPM_ENUM("rx_int0_1_mix_inp0", rx_int0_1_mix_inp0_enum); 7824f692926SSrinivas Kandagatla static const struct snd_kcontrol_new rx_int0_1_mix_inp1_mux = 7834f692926SSrinivas Kandagatla SOC_DAPM_ENUM("rx_int0_1_mix_inp1", rx_int0_1_mix_inp1_enum); 7844f692926SSrinivas Kandagatla static const struct snd_kcontrol_new rx_int0_1_mix_inp2_mux = 7854f692926SSrinivas Kandagatla SOC_DAPM_ENUM("rx_int0_1_mix_inp2", rx_int0_1_mix_inp2_enum); 7864f692926SSrinivas Kandagatla static const struct snd_kcontrol_new rx_int1_1_mix_inp0_mux = 7874f692926SSrinivas Kandagatla SOC_DAPM_ENUM("rx_int1_1_mix_inp0", rx_int1_1_mix_inp0_enum); 7884f692926SSrinivas Kandagatla static const struct snd_kcontrol_new rx_int1_1_mix_inp1_mux = 7894f692926SSrinivas Kandagatla SOC_DAPM_ENUM("rx_int1_1_mix_inp1", rx_int1_1_mix_inp1_enum); 7904f692926SSrinivas Kandagatla static const struct snd_kcontrol_new rx_int1_1_mix_inp2_mux = 7914f692926SSrinivas Kandagatla SOC_DAPM_ENUM("rx_int1_1_mix_inp2", rx_int1_1_mix_inp2_enum); 7924f692926SSrinivas Kandagatla static const struct snd_kcontrol_new rx_int2_1_mix_inp0_mux = 7934f692926SSrinivas Kandagatla SOC_DAPM_ENUM("rx_int2_1_mix_inp0", rx_int2_1_mix_inp0_enum); 7944f692926SSrinivas Kandagatla static const struct snd_kcontrol_new rx_int2_1_mix_inp1_mux = 7954f692926SSrinivas Kandagatla SOC_DAPM_ENUM("rx_int2_1_mix_inp1", rx_int2_1_mix_inp1_enum); 7964f692926SSrinivas Kandagatla static const struct snd_kcontrol_new rx_int2_1_mix_inp2_mux = 7974f692926SSrinivas Kandagatla SOC_DAPM_ENUM("rx_int2_1_mix_inp2", rx_int2_1_mix_inp2_enum); 7984f692926SSrinivas Kandagatla static const struct snd_kcontrol_new rx_int0_mix2_inp_mux = 7994f692926SSrinivas Kandagatla SOC_DAPM_ENUM("rx_int0_mix2_inp", rx_int0_mix2_inp_enum); 8004f692926SSrinivas Kandagatla static const struct snd_kcontrol_new rx_int1_mix2_inp_mux = 8014f692926SSrinivas Kandagatla SOC_DAPM_ENUM("rx_int1_mix2_inp", rx_int1_mix2_inp_enum); 8024f692926SSrinivas Kandagatla static const struct snd_kcontrol_new rx_int2_mix2_inp_mux = 8034f692926SSrinivas Kandagatla SOC_DAPM_ENUM("rx_int2_mix2_inp", rx_int2_mix2_inp_enum); 8044f692926SSrinivas Kandagatla static const struct snd_kcontrol_new iir0_inp0_mux = 8054f692926SSrinivas Kandagatla SOC_DAPM_ENUM("iir0_inp0", iir0_inp0_enum); 8064f692926SSrinivas Kandagatla static const struct snd_kcontrol_new iir0_inp1_mux = 8074f692926SSrinivas Kandagatla SOC_DAPM_ENUM("iir0_inp1", iir0_inp1_enum); 8084f692926SSrinivas Kandagatla static const struct snd_kcontrol_new iir0_inp2_mux = 8094f692926SSrinivas Kandagatla SOC_DAPM_ENUM("iir0_inp2", iir0_inp2_enum); 8104f692926SSrinivas Kandagatla static const struct snd_kcontrol_new iir0_inp3_mux = 8114f692926SSrinivas Kandagatla SOC_DAPM_ENUM("iir0_inp3", iir0_inp3_enum); 8124f692926SSrinivas Kandagatla static const struct snd_kcontrol_new iir1_inp0_mux = 8134f692926SSrinivas Kandagatla SOC_DAPM_ENUM("iir1_inp0", iir1_inp0_enum); 8144f692926SSrinivas Kandagatla static const struct snd_kcontrol_new iir1_inp1_mux = 8154f692926SSrinivas Kandagatla SOC_DAPM_ENUM("iir1_inp1", iir1_inp1_enum); 8164f692926SSrinivas Kandagatla static const struct snd_kcontrol_new iir1_inp2_mux = 8174f692926SSrinivas Kandagatla SOC_DAPM_ENUM("iir1_inp2", iir1_inp2_enum); 8184f692926SSrinivas Kandagatla static const struct snd_kcontrol_new iir1_inp3_mux = 8194f692926SSrinivas Kandagatla SOC_DAPM_ENUM("iir1_inp3", iir1_inp3_enum); 8204f692926SSrinivas Kandagatla static const struct snd_kcontrol_new rx_int0_1_interp_mux = 8214f692926SSrinivas Kandagatla SOC_DAPM_ENUM("rx_int0_1_interp", rx_int0_1_interp_enum); 8224f692926SSrinivas Kandagatla static const struct snd_kcontrol_new rx_int1_1_interp_mux = 8234f692926SSrinivas Kandagatla SOC_DAPM_ENUM("rx_int1_1_interp", rx_int1_1_interp_enum); 8244f692926SSrinivas Kandagatla static const struct snd_kcontrol_new rx_int2_1_interp_mux = 8254f692926SSrinivas Kandagatla SOC_DAPM_ENUM("rx_int2_1_interp", rx_int2_1_interp_enum); 8264f692926SSrinivas Kandagatla static const struct snd_kcontrol_new rx_int0_2_interp_mux = 8274f692926SSrinivas Kandagatla SOC_DAPM_ENUM("rx_int0_2_interp", rx_int0_2_interp_enum); 8284f692926SSrinivas Kandagatla static const struct snd_kcontrol_new rx_int1_2_interp_mux = 8294f692926SSrinivas Kandagatla SOC_DAPM_ENUM("rx_int1_2_interp", rx_int1_2_interp_enum); 8304f692926SSrinivas Kandagatla static const struct snd_kcontrol_new rx_int2_2_interp_mux = 8314f692926SSrinivas Kandagatla SOC_DAPM_ENUM("rx_int2_2_interp", rx_int2_2_interp_enum); 8324f692926SSrinivas Kandagatla static const struct snd_kcontrol_new rx_mix_tx0_mux = 8334f692926SSrinivas Kandagatla SOC_DAPM_ENUM("RX MIX TX0_MUX Mux", rx_mix_tx0_mux_enum); 834af3d54b9SSrinivas Kandagatla 835af3d54b9SSrinivas Kandagatla static const struct reg_default rx_defaults[] = { 836af3d54b9SSrinivas Kandagatla /* RX Macro */ 837af3d54b9SSrinivas Kandagatla { CDC_RX_TOP_TOP_CFG0, 0x00 }, 838af3d54b9SSrinivas Kandagatla { CDC_RX_TOP_SWR_CTRL, 0x00 }, 839af3d54b9SSrinivas Kandagatla { CDC_RX_TOP_DEBUG, 0x00 }, 840af3d54b9SSrinivas Kandagatla { CDC_RX_TOP_DEBUG_BUS, 0x00 }, 841af3d54b9SSrinivas Kandagatla { CDC_RX_TOP_DEBUG_EN0, 0x00 }, 842af3d54b9SSrinivas Kandagatla { CDC_RX_TOP_DEBUG_EN1, 0x00 }, 843af3d54b9SSrinivas Kandagatla { CDC_RX_TOP_DEBUG_EN2, 0x00 }, 844af3d54b9SSrinivas Kandagatla { CDC_RX_TOP_HPHL_COMP_WR_LSB, 0x00 }, 845af3d54b9SSrinivas Kandagatla { CDC_RX_TOP_HPHL_COMP_WR_MSB, 0x00 }, 846af3d54b9SSrinivas Kandagatla { CDC_RX_TOP_HPHL_COMP_LUT, 0x00 }, 847af3d54b9SSrinivas Kandagatla { CDC_RX_TOP_HPHL_COMP_RD_LSB, 0x00 }, 848af3d54b9SSrinivas Kandagatla { CDC_RX_TOP_HPHL_COMP_RD_MSB, 0x00 }, 849af3d54b9SSrinivas Kandagatla { CDC_RX_TOP_HPHR_COMP_WR_LSB, 0x00 }, 850af3d54b9SSrinivas Kandagatla { CDC_RX_TOP_HPHR_COMP_WR_MSB, 0x00 }, 851af3d54b9SSrinivas Kandagatla { CDC_RX_TOP_HPHR_COMP_LUT, 0x00 }, 852af3d54b9SSrinivas Kandagatla { CDC_RX_TOP_HPHR_COMP_RD_LSB, 0x00 }, 853af3d54b9SSrinivas Kandagatla { CDC_RX_TOP_HPHR_COMP_RD_MSB, 0x00 }, 854af3d54b9SSrinivas Kandagatla { CDC_RX_TOP_DSD0_DEBUG_CFG0, 0x11 }, 855af3d54b9SSrinivas Kandagatla { CDC_RX_TOP_DSD0_DEBUG_CFG1, 0x20 }, 856af3d54b9SSrinivas Kandagatla { CDC_RX_TOP_DSD0_DEBUG_CFG2, 0x00 }, 857af3d54b9SSrinivas Kandagatla { CDC_RX_TOP_DSD0_DEBUG_CFG3, 0x00 }, 858af3d54b9SSrinivas Kandagatla { CDC_RX_TOP_DSD1_DEBUG_CFG0, 0x11 }, 859af3d54b9SSrinivas Kandagatla { CDC_RX_TOP_DSD1_DEBUG_CFG1, 0x20 }, 860af3d54b9SSrinivas Kandagatla { CDC_RX_TOP_DSD1_DEBUG_CFG2, 0x00 }, 861af3d54b9SSrinivas Kandagatla { CDC_RX_TOP_DSD1_DEBUG_CFG3, 0x00 }, 862af3d54b9SSrinivas Kandagatla { CDC_RX_TOP_RX_I2S_CTL, 0x0C }, 863af3d54b9SSrinivas Kandagatla { CDC_RX_TOP_TX_I2S2_CTL, 0x0C }, 864af3d54b9SSrinivas Kandagatla { CDC_RX_TOP_I2S_CLK, 0x0C }, 865af3d54b9SSrinivas Kandagatla { CDC_RX_TOP_I2S_RESET, 0x00 }, 866af3d54b9SSrinivas Kandagatla { CDC_RX_TOP_I2S_MUX, 0x00 }, 867af3d54b9SSrinivas Kandagatla { CDC_RX_CLK_RST_CTRL_MCLK_CONTROL, 0x00 }, 868af3d54b9SSrinivas Kandagatla { CDC_RX_CLK_RST_CTRL_FS_CNT_CONTROL, 0x00 }, 869af3d54b9SSrinivas Kandagatla { CDC_RX_CLK_RST_CTRL_SWR_CONTROL, 0x00 }, 870af3d54b9SSrinivas Kandagatla { CDC_RX_CLK_RST_CTRL_DSD_CONTROL, 0x00 }, 871af3d54b9SSrinivas Kandagatla { CDC_RX_CLK_RST_CTRL_ASRC_SHARE_CONTROL, 0x08 }, 872af3d54b9SSrinivas Kandagatla { CDC_RX_SOFTCLIP_CRC, 0x00 }, 873af3d54b9SSrinivas Kandagatla { CDC_RX_SOFTCLIP_SOFTCLIP_CTRL, 0x38 }, 874af3d54b9SSrinivas Kandagatla { CDC_RX_INP_MUX_RX_INT0_CFG0, 0x00 }, 875af3d54b9SSrinivas Kandagatla { CDC_RX_INP_MUX_RX_INT0_CFG1, 0x00 }, 876af3d54b9SSrinivas Kandagatla { CDC_RX_INP_MUX_RX_INT1_CFG0, 0x00 }, 877af3d54b9SSrinivas Kandagatla { CDC_RX_INP_MUX_RX_INT1_CFG1, 0x00 }, 878af3d54b9SSrinivas Kandagatla { CDC_RX_INP_MUX_RX_INT2_CFG0, 0x00 }, 879af3d54b9SSrinivas Kandagatla { CDC_RX_INP_MUX_RX_INT2_CFG1, 0x00 }, 880af3d54b9SSrinivas Kandagatla { CDC_RX_INP_MUX_RX_MIX_CFG4, 0x00 }, 881af3d54b9SSrinivas Kandagatla { CDC_RX_INP_MUX_RX_MIX_CFG5, 0x00 }, 882af3d54b9SSrinivas Kandagatla { CDC_RX_INP_MUX_SIDETONE_SRC_CFG0, 0x00 }, 883af3d54b9SSrinivas Kandagatla { CDC_RX_CLSH_CRC, 0x00 }, 884af3d54b9SSrinivas Kandagatla { CDC_RX_CLSH_DLY_CTRL, 0x03 }, 885af3d54b9SSrinivas Kandagatla { CDC_RX_CLSH_DECAY_CTRL, 0x02 }, 886af3d54b9SSrinivas Kandagatla { CDC_RX_CLSH_HPH_V_PA, 0x1C }, 887af3d54b9SSrinivas Kandagatla { CDC_RX_CLSH_EAR_V_PA, 0x39 }, 888af3d54b9SSrinivas Kandagatla { CDC_RX_CLSH_HPH_V_HD, 0x0C }, 889af3d54b9SSrinivas Kandagatla { CDC_RX_CLSH_EAR_V_HD, 0x0C }, 890af3d54b9SSrinivas Kandagatla { CDC_RX_CLSH_K1_MSB, 0x01 }, 891af3d54b9SSrinivas Kandagatla { CDC_RX_CLSH_K1_LSB, 0x00 }, 892af3d54b9SSrinivas Kandagatla { CDC_RX_CLSH_K2_MSB, 0x00 }, 893af3d54b9SSrinivas Kandagatla { CDC_RX_CLSH_K2_LSB, 0x80 }, 894af3d54b9SSrinivas Kandagatla { CDC_RX_CLSH_IDLE_CTRL, 0x00 }, 895af3d54b9SSrinivas Kandagatla { CDC_RX_CLSH_IDLE_HPH, 0x00 }, 896af3d54b9SSrinivas Kandagatla { CDC_RX_CLSH_IDLE_EAR, 0x00 }, 897af3d54b9SSrinivas Kandagatla { CDC_RX_CLSH_TEST0, 0x07 }, 898af3d54b9SSrinivas Kandagatla { CDC_RX_CLSH_TEST1, 0x00 }, 899af3d54b9SSrinivas Kandagatla { CDC_RX_CLSH_OVR_VREF, 0x00 }, 900af3d54b9SSrinivas Kandagatla { CDC_RX_CLSH_CLSG_CTL, 0x02 }, 901af3d54b9SSrinivas Kandagatla { CDC_RX_CLSH_CLSG_CFG1, 0x9A }, 902af3d54b9SSrinivas Kandagatla { CDC_RX_CLSH_CLSG_CFG2, 0x10 }, 903af3d54b9SSrinivas Kandagatla { CDC_RX_BCL_VBAT_PATH_CTL, 0x00 }, 904af3d54b9SSrinivas Kandagatla { CDC_RX_BCL_VBAT_CFG, 0x10 }, 905af3d54b9SSrinivas Kandagatla { CDC_RX_BCL_VBAT_ADC_CAL1, 0x00 }, 906af3d54b9SSrinivas Kandagatla { CDC_RX_BCL_VBAT_ADC_CAL2, 0x00 }, 907af3d54b9SSrinivas Kandagatla { CDC_RX_BCL_VBAT_ADC_CAL3, 0x04 }, 908af3d54b9SSrinivas Kandagatla { CDC_RX_BCL_VBAT_PK_EST1, 0xE0 }, 909af3d54b9SSrinivas Kandagatla { CDC_RX_BCL_VBAT_PK_EST2, 0x01 }, 910af3d54b9SSrinivas Kandagatla { CDC_RX_BCL_VBAT_PK_EST3, 0x40 }, 911af3d54b9SSrinivas Kandagatla { CDC_RX_BCL_VBAT_RF_PROC1, 0x2A }, 912af3d54b9SSrinivas Kandagatla { CDC_RX_BCL_VBAT_RF_PROC1, 0x00 }, 913af3d54b9SSrinivas Kandagatla { CDC_RX_BCL_VBAT_TAC1, 0x00 }, 914af3d54b9SSrinivas Kandagatla { CDC_RX_BCL_VBAT_TAC2, 0x18 }, 915af3d54b9SSrinivas Kandagatla { CDC_RX_BCL_VBAT_TAC3, 0x18 }, 916af3d54b9SSrinivas Kandagatla { CDC_RX_BCL_VBAT_TAC4, 0x03 }, 917af3d54b9SSrinivas Kandagatla { CDC_RX_BCL_VBAT_GAIN_UPD1, 0x01 }, 918af3d54b9SSrinivas Kandagatla { CDC_RX_BCL_VBAT_GAIN_UPD2, 0x00 }, 919af3d54b9SSrinivas Kandagatla { CDC_RX_BCL_VBAT_GAIN_UPD3, 0x00 }, 920af3d54b9SSrinivas Kandagatla { CDC_RX_BCL_VBAT_GAIN_UPD4, 0x64 }, 921af3d54b9SSrinivas Kandagatla { CDC_RX_BCL_VBAT_GAIN_UPD5, 0x01 }, 922af3d54b9SSrinivas Kandagatla { CDC_RX_BCL_VBAT_DEBUG1, 0x00 }, 923af3d54b9SSrinivas Kandagatla { CDC_RX_BCL_VBAT_GAIN_UPD_MON, 0x00 }, 924af3d54b9SSrinivas Kandagatla { CDC_RX_BCL_VBAT_GAIN_MON_VAL, 0x00 }, 925af3d54b9SSrinivas Kandagatla { CDC_RX_BCL_VBAT_BAN, 0x0C }, 926af3d54b9SSrinivas Kandagatla { CDC_RX_BCL_VBAT_BCL_GAIN_UPD1, 0x00 }, 927af3d54b9SSrinivas Kandagatla { CDC_RX_BCL_VBAT_BCL_GAIN_UPD2, 0x77 }, 928af3d54b9SSrinivas Kandagatla { CDC_RX_BCL_VBAT_BCL_GAIN_UPD3, 0x01 }, 929af3d54b9SSrinivas Kandagatla { CDC_RX_BCL_VBAT_BCL_GAIN_UPD4, 0x00 }, 930af3d54b9SSrinivas Kandagatla { CDC_RX_BCL_VBAT_BCL_GAIN_UPD5, 0x4B }, 931af3d54b9SSrinivas Kandagatla { CDC_RX_BCL_VBAT_BCL_GAIN_UPD6, 0x00 }, 932af3d54b9SSrinivas Kandagatla { CDC_RX_BCL_VBAT_BCL_GAIN_UPD7, 0x01 }, 933af3d54b9SSrinivas Kandagatla { CDC_RX_BCL_VBAT_BCL_GAIN_UPD8, 0x00 }, 934af3d54b9SSrinivas Kandagatla { CDC_RX_BCL_VBAT_BCL_GAIN_UPD9, 0x00 }, 935af3d54b9SSrinivas Kandagatla { CDC_RX_BCL_VBAT_ATTN1, 0x04 }, 936af3d54b9SSrinivas Kandagatla { CDC_RX_BCL_VBAT_ATTN2, 0x08 }, 937af3d54b9SSrinivas Kandagatla { CDC_RX_BCL_VBAT_ATTN3, 0x0C }, 938af3d54b9SSrinivas Kandagatla { CDC_RX_BCL_VBAT_DECODE_CTL1, 0xE0 }, 939af3d54b9SSrinivas Kandagatla { CDC_RX_BCL_VBAT_DECODE_CTL2, 0x00 }, 940af3d54b9SSrinivas Kandagatla { CDC_RX_BCL_VBAT_DECODE_CFG1, 0x00 }, 941af3d54b9SSrinivas Kandagatla { CDC_RX_BCL_VBAT_DECODE_CFG2, 0x00 }, 942af3d54b9SSrinivas Kandagatla { CDC_RX_BCL_VBAT_DECODE_CFG3, 0x00 }, 943af3d54b9SSrinivas Kandagatla { CDC_RX_BCL_VBAT_DECODE_CFG4, 0x00 }, 944af3d54b9SSrinivas Kandagatla { CDC_RX_BCL_VBAT_DECODE_ST, 0x00 }, 945af3d54b9SSrinivas Kandagatla { CDC_RX_INTR_CTRL_CFG, 0x00 }, 946af3d54b9SSrinivas Kandagatla { CDC_RX_INTR_CTRL_CLR_COMMIT, 0x00 }, 947af3d54b9SSrinivas Kandagatla { CDC_RX_INTR_CTRL_PIN1_MASK0, 0xFF }, 948af3d54b9SSrinivas Kandagatla { CDC_RX_INTR_CTRL_PIN1_STATUS0, 0x00 }, 949af3d54b9SSrinivas Kandagatla { CDC_RX_INTR_CTRL_PIN1_CLEAR0, 0x00 }, 950af3d54b9SSrinivas Kandagatla { CDC_RX_INTR_CTRL_PIN2_MASK0, 0xFF }, 951af3d54b9SSrinivas Kandagatla { CDC_RX_INTR_CTRL_PIN2_STATUS0, 0x00 }, 952af3d54b9SSrinivas Kandagatla { CDC_RX_INTR_CTRL_PIN2_CLEAR0, 0x00 }, 953af3d54b9SSrinivas Kandagatla { CDC_RX_INTR_CTRL_LEVEL0, 0x00 }, 954af3d54b9SSrinivas Kandagatla { CDC_RX_INTR_CTRL_BYPASS0, 0x00 }, 955af3d54b9SSrinivas Kandagatla { CDC_RX_INTR_CTRL_SET0, 0x00 }, 956af3d54b9SSrinivas Kandagatla { CDC_RX_RX0_RX_PATH_CTL, 0x04 }, 957af3d54b9SSrinivas Kandagatla { CDC_RX_RX0_RX_PATH_CFG0, 0x00 }, 958af3d54b9SSrinivas Kandagatla { CDC_RX_RX0_RX_PATH_CFG1, 0x64 }, 959af3d54b9SSrinivas Kandagatla { CDC_RX_RX0_RX_PATH_CFG2, 0x8F }, 960af3d54b9SSrinivas Kandagatla { CDC_RX_RX0_RX_PATH_CFG3, 0x00 }, 961af3d54b9SSrinivas Kandagatla { CDC_RX_RX0_RX_VOL_CTL, 0x00 }, 962af3d54b9SSrinivas Kandagatla { CDC_RX_RX0_RX_PATH_MIX_CTL, 0x04 }, 963af3d54b9SSrinivas Kandagatla { CDC_RX_RX0_RX_PATH_MIX_CFG, 0x7E }, 964af3d54b9SSrinivas Kandagatla { CDC_RX_RX0_RX_VOL_MIX_CTL, 0x00 }, 965af3d54b9SSrinivas Kandagatla { CDC_RX_RX0_RX_PATH_SEC1, 0x08 }, 966af3d54b9SSrinivas Kandagatla { CDC_RX_RX0_RX_PATH_SEC2, 0x00 }, 967af3d54b9SSrinivas Kandagatla { CDC_RX_RX0_RX_PATH_SEC3, 0x00 }, 968af3d54b9SSrinivas Kandagatla { CDC_RX_RX0_RX_PATH_SEC4, 0x00 }, 969af3d54b9SSrinivas Kandagatla { CDC_RX_RX0_RX_PATH_SEC7, 0x00 }, 970af3d54b9SSrinivas Kandagatla { CDC_RX_RX0_RX_PATH_MIX_SEC0, 0x08 }, 971af3d54b9SSrinivas Kandagatla { CDC_RX_RX0_RX_PATH_MIX_SEC1, 0x00 }, 972af3d54b9SSrinivas Kandagatla { CDC_RX_RX0_RX_PATH_DSM_CTL, 0x08 }, 973af3d54b9SSrinivas Kandagatla { CDC_RX_RX0_RX_PATH_DSM_DATA1, 0x00 }, 974af3d54b9SSrinivas Kandagatla { CDC_RX_RX0_RX_PATH_DSM_DATA2, 0x00 }, 975af3d54b9SSrinivas Kandagatla { CDC_RX_RX0_RX_PATH_DSM_DATA3, 0x00 }, 976af3d54b9SSrinivas Kandagatla { CDC_RX_RX0_RX_PATH_DSM_DATA4, 0x55 }, 977af3d54b9SSrinivas Kandagatla { CDC_RX_RX0_RX_PATH_DSM_DATA5, 0x55 }, 978af3d54b9SSrinivas Kandagatla { CDC_RX_RX0_RX_PATH_DSM_DATA6, 0x55 }, 979af3d54b9SSrinivas Kandagatla { CDC_RX_RX1_RX_PATH_CTL, 0x04 }, 980af3d54b9SSrinivas Kandagatla { CDC_RX_RX1_RX_PATH_CFG0, 0x00 }, 981af3d54b9SSrinivas Kandagatla { CDC_RX_RX1_RX_PATH_CFG1, 0x64 }, 982af3d54b9SSrinivas Kandagatla { CDC_RX_RX1_RX_PATH_CFG2, 0x8F }, 983af3d54b9SSrinivas Kandagatla { CDC_RX_RX1_RX_PATH_CFG3, 0x00 }, 984af3d54b9SSrinivas Kandagatla { CDC_RX_RX1_RX_VOL_CTL, 0x00 }, 985af3d54b9SSrinivas Kandagatla { CDC_RX_RX1_RX_PATH_MIX_CTL, 0x04 }, 986af3d54b9SSrinivas Kandagatla { CDC_RX_RX1_RX_PATH_MIX_CFG, 0x7E }, 987af3d54b9SSrinivas Kandagatla { CDC_RX_RX1_RX_VOL_MIX_CTL, 0x00 }, 988af3d54b9SSrinivas Kandagatla { CDC_RX_RX1_RX_PATH_SEC1, 0x08 }, 989af3d54b9SSrinivas Kandagatla { CDC_RX_RX1_RX_PATH_SEC2, 0x00 }, 990af3d54b9SSrinivas Kandagatla { CDC_RX_RX1_RX_PATH_SEC3, 0x00 }, 991af3d54b9SSrinivas Kandagatla { CDC_RX_RX1_RX_PATH_SEC4, 0x00 }, 992af3d54b9SSrinivas Kandagatla { CDC_RX_RX1_RX_PATH_SEC7, 0x00 }, 993af3d54b9SSrinivas Kandagatla { CDC_RX_RX1_RX_PATH_MIX_SEC0, 0x08 }, 994af3d54b9SSrinivas Kandagatla { CDC_RX_RX1_RX_PATH_MIX_SEC1, 0x00 }, 995af3d54b9SSrinivas Kandagatla { CDC_RX_RX1_RX_PATH_DSM_CTL, 0x08 }, 996af3d54b9SSrinivas Kandagatla { CDC_RX_RX1_RX_PATH_DSM_DATA1, 0x00 }, 997af3d54b9SSrinivas Kandagatla { CDC_RX_RX1_RX_PATH_DSM_DATA2, 0x00 }, 998af3d54b9SSrinivas Kandagatla { CDC_RX_RX1_RX_PATH_DSM_DATA3, 0x00 }, 999af3d54b9SSrinivas Kandagatla { CDC_RX_RX1_RX_PATH_DSM_DATA4, 0x55 }, 1000af3d54b9SSrinivas Kandagatla { CDC_RX_RX1_RX_PATH_DSM_DATA5, 0x55 }, 1001af3d54b9SSrinivas Kandagatla { CDC_RX_RX1_RX_PATH_DSM_DATA6, 0x55 }, 1002af3d54b9SSrinivas Kandagatla { CDC_RX_RX2_RX_PATH_CTL, 0x04 }, 1003af3d54b9SSrinivas Kandagatla { CDC_RX_RX2_RX_PATH_CFG0, 0x00 }, 1004af3d54b9SSrinivas Kandagatla { CDC_RX_RX2_RX_PATH_CFG1, 0x64 }, 1005af3d54b9SSrinivas Kandagatla { CDC_RX_RX2_RX_PATH_CFG2, 0x8F }, 1006af3d54b9SSrinivas Kandagatla { CDC_RX_RX2_RX_PATH_CFG3, 0x00 }, 1007af3d54b9SSrinivas Kandagatla { CDC_RX_RX2_RX_VOL_CTL, 0x00 }, 1008af3d54b9SSrinivas Kandagatla { CDC_RX_RX2_RX_PATH_MIX_CTL, 0x04 }, 1009af3d54b9SSrinivas Kandagatla { CDC_RX_RX2_RX_PATH_MIX_CFG, 0x7E }, 1010af3d54b9SSrinivas Kandagatla { CDC_RX_RX2_RX_VOL_MIX_CTL, 0x00 }, 1011af3d54b9SSrinivas Kandagatla { CDC_RX_RX2_RX_PATH_SEC0, 0x04 }, 1012af3d54b9SSrinivas Kandagatla { CDC_RX_RX2_RX_PATH_SEC1, 0x08 }, 1013af3d54b9SSrinivas Kandagatla { CDC_RX_RX2_RX_PATH_SEC2, 0x00 }, 1014af3d54b9SSrinivas Kandagatla { CDC_RX_RX2_RX_PATH_SEC3, 0x00 }, 1015af3d54b9SSrinivas Kandagatla { CDC_RX_RX2_RX_PATH_SEC4, 0x00 }, 1016af3d54b9SSrinivas Kandagatla { CDC_RX_RX2_RX_PATH_SEC5, 0x00 }, 1017af3d54b9SSrinivas Kandagatla { CDC_RX_RX2_RX_PATH_SEC6, 0x00 }, 1018af3d54b9SSrinivas Kandagatla { CDC_RX_RX2_RX_PATH_SEC7, 0x00 }, 1019af3d54b9SSrinivas Kandagatla { CDC_RX_RX2_RX_PATH_MIX_SEC0, 0x08 }, 1020af3d54b9SSrinivas Kandagatla { CDC_RX_RX2_RX_PATH_MIX_SEC1, 0x00 }, 1021af3d54b9SSrinivas Kandagatla { CDC_RX_RX2_RX_PATH_DSM_CTL, 0x00 }, 1022af3d54b9SSrinivas Kandagatla { CDC_RX_IDLE_DETECT_PATH_CTL, 0x00 }, 1023af3d54b9SSrinivas Kandagatla { CDC_RX_IDLE_DETECT_CFG0, 0x07 }, 1024af3d54b9SSrinivas Kandagatla { CDC_RX_IDLE_DETECT_CFG1, 0x3C }, 1025af3d54b9SSrinivas Kandagatla { CDC_RX_IDLE_DETECT_CFG2, 0x00 }, 1026af3d54b9SSrinivas Kandagatla { CDC_RX_IDLE_DETECT_CFG3, 0x00 }, 1027af3d54b9SSrinivas Kandagatla { CDC_RX_COMPANDER0_CTL0, 0x60 }, 1028af3d54b9SSrinivas Kandagatla { CDC_RX_COMPANDER0_CTL1, 0xDB }, 1029af3d54b9SSrinivas Kandagatla { CDC_RX_COMPANDER0_CTL2, 0xFF }, 1030af3d54b9SSrinivas Kandagatla { CDC_RX_COMPANDER0_CTL3, 0x35 }, 1031af3d54b9SSrinivas Kandagatla { CDC_RX_COMPANDER0_CTL4, 0xFF }, 1032af3d54b9SSrinivas Kandagatla { CDC_RX_COMPANDER0_CTL5, 0x00 }, 1033af3d54b9SSrinivas Kandagatla { CDC_RX_COMPANDER0_CTL6, 0x01 }, 1034af3d54b9SSrinivas Kandagatla { CDC_RX_COMPANDER0_CTL7, 0x28 }, 1035af3d54b9SSrinivas Kandagatla { CDC_RX_COMPANDER1_CTL0, 0x60 }, 1036af3d54b9SSrinivas Kandagatla { CDC_RX_COMPANDER1_CTL1, 0xDB }, 1037af3d54b9SSrinivas Kandagatla { CDC_RX_COMPANDER1_CTL2, 0xFF }, 1038af3d54b9SSrinivas Kandagatla { CDC_RX_COMPANDER1_CTL3, 0x35 }, 1039af3d54b9SSrinivas Kandagatla { CDC_RX_COMPANDER1_CTL4, 0xFF }, 1040af3d54b9SSrinivas Kandagatla { CDC_RX_COMPANDER1_CTL5, 0x00 }, 1041af3d54b9SSrinivas Kandagatla { CDC_RX_COMPANDER1_CTL6, 0x01 }, 1042af3d54b9SSrinivas Kandagatla { CDC_RX_COMPANDER1_CTL7, 0x28 }, 1043af3d54b9SSrinivas Kandagatla { CDC_RX_SIDETONE_IIR0_IIR_PATH_CTL, 0x00 }, 1044af3d54b9SSrinivas Kandagatla { CDC_RX_SIDETONE_IIR0_IIR_GAIN_B1_CTL, 0x00 }, 1045af3d54b9SSrinivas Kandagatla { CDC_RX_SIDETONE_IIR0_IIR_GAIN_B2_CTL, 0x00 }, 1046af3d54b9SSrinivas Kandagatla { CDC_RX_SIDETONE_IIR0_IIR_GAIN_B3_CTL, 0x00 }, 1047af3d54b9SSrinivas Kandagatla { CDC_RX_SIDETONE_IIR0_IIR_GAIN_B4_CTL, 0x00 }, 1048af3d54b9SSrinivas Kandagatla { CDC_RX_SIDETONE_IIR0_IIR_GAIN_B5_CTL, 0x00 }, 1049af3d54b9SSrinivas Kandagatla { CDC_RX_SIDETONE_IIR0_IIR_GAIN_B6_CTL, 0x00 }, 1050af3d54b9SSrinivas Kandagatla { CDC_RX_SIDETONE_IIR0_IIR_GAIN_B7_CTL, 0x00 }, 1051af3d54b9SSrinivas Kandagatla { CDC_RX_SIDETONE_IIR0_IIR_GAIN_B8_CTL, 0x00 }, 1052af3d54b9SSrinivas Kandagatla { CDC_RX_SIDETONE_IIR0_IIR_CTL, 0x40 }, 1053af3d54b9SSrinivas Kandagatla { CDC_RX_SIDETONE_IIR0_IIR_GAIN_TIMER_CTL, 0x00 }, 1054af3d54b9SSrinivas Kandagatla { CDC_RX_SIDETONE_IIR0_IIR_COEF_B1_CTL, 0x00 }, 1055af3d54b9SSrinivas Kandagatla { CDC_RX_SIDETONE_IIR0_IIR_COEF_B2_CTL, 0x00 }, 1056af3d54b9SSrinivas Kandagatla { CDC_RX_SIDETONE_IIR1_IIR_PATH_CTL, 0x00 }, 1057af3d54b9SSrinivas Kandagatla { CDC_RX_SIDETONE_IIR1_IIR_GAIN_B1_CTL, 0x00 }, 1058af3d54b9SSrinivas Kandagatla { CDC_RX_SIDETONE_IIR1_IIR_GAIN_B2_CTL, 0x00 }, 1059af3d54b9SSrinivas Kandagatla { CDC_RX_SIDETONE_IIR1_IIR_GAIN_B3_CTL, 0x00 }, 1060af3d54b9SSrinivas Kandagatla { CDC_RX_SIDETONE_IIR1_IIR_GAIN_B4_CTL, 0x00 }, 1061af3d54b9SSrinivas Kandagatla { CDC_RX_SIDETONE_IIR1_IIR_GAIN_B5_CTL, 0x00 }, 1062af3d54b9SSrinivas Kandagatla { CDC_RX_SIDETONE_IIR1_IIR_GAIN_B6_CTL, 0x00 }, 1063af3d54b9SSrinivas Kandagatla { CDC_RX_SIDETONE_IIR1_IIR_GAIN_B7_CTL, 0x00 }, 1064af3d54b9SSrinivas Kandagatla { CDC_RX_SIDETONE_IIR1_IIR_GAIN_B8_CTL, 0x00 }, 1065af3d54b9SSrinivas Kandagatla { CDC_RX_SIDETONE_IIR1_IIR_CTL, 0x40 }, 1066af3d54b9SSrinivas Kandagatla { CDC_RX_SIDETONE_IIR1_IIR_GAIN_TIMER_CTL, 0x00 }, 1067af3d54b9SSrinivas Kandagatla { CDC_RX_SIDETONE_IIR1_IIR_COEF_B1_CTL, 0x00 }, 1068af3d54b9SSrinivas Kandagatla { CDC_RX_SIDETONE_IIR1_IIR_COEF_B2_CTL, 0x00 }, 1069af3d54b9SSrinivas Kandagatla { CDC_RX_IIR_INP_MUX_IIR0_MIX_CFG0, 0x00 }, 1070af3d54b9SSrinivas Kandagatla { CDC_RX_IIR_INP_MUX_IIR0_MIX_CFG1, 0x00 }, 1071af3d54b9SSrinivas Kandagatla { CDC_RX_IIR_INP_MUX_IIR0_MIX_CFG2, 0x00 }, 1072af3d54b9SSrinivas Kandagatla { CDC_RX_IIR_INP_MUX_IIR0_MIX_CFG3, 0x00 }, 1073af3d54b9SSrinivas Kandagatla { CDC_RX_IIR_INP_MUX_IIR1_MIX_CFG0, 0x00 }, 1074af3d54b9SSrinivas Kandagatla { CDC_RX_IIR_INP_MUX_IIR1_MIX_CFG1, 0x00 }, 1075af3d54b9SSrinivas Kandagatla { CDC_RX_IIR_INP_MUX_IIR1_MIX_CFG2, 0x00 }, 1076af3d54b9SSrinivas Kandagatla { CDC_RX_IIR_INP_MUX_IIR1_MIX_CFG3, 0x00 }, 1077af3d54b9SSrinivas Kandagatla { CDC_RX_SIDETONE_SRC0_ST_SRC_PATH_CTL, 0x04 }, 1078af3d54b9SSrinivas Kandagatla { CDC_RX_SIDETONE_SRC0_ST_SRC_PATH_CFG1, 0x00 }, 1079af3d54b9SSrinivas Kandagatla { CDC_RX_SIDETONE_SRC1_ST_SRC_PATH_CTL, 0x04 }, 1080af3d54b9SSrinivas Kandagatla { CDC_RX_SIDETONE_SRC1_ST_SRC_PATH_CFG1, 0x00 }, 1081af3d54b9SSrinivas Kandagatla { CDC_RX_EC_REF_HQ0_EC_REF_HQ_PATH_CTL, 0x00 }, 1082af3d54b9SSrinivas Kandagatla { CDC_RX_EC_REF_HQ0_EC_REF_HQ_CFG0, 0x01 }, 1083af3d54b9SSrinivas Kandagatla { CDC_RX_EC_REF_HQ1_EC_REF_HQ_PATH_CTL, 0x00 }, 1084af3d54b9SSrinivas Kandagatla { CDC_RX_EC_REF_HQ1_EC_REF_HQ_CFG0, 0x01 }, 1085af3d54b9SSrinivas Kandagatla { CDC_RX_EC_REF_HQ2_EC_REF_HQ_PATH_CTL, 0x00 }, 1086af3d54b9SSrinivas Kandagatla { CDC_RX_EC_REF_HQ2_EC_REF_HQ_CFG0, 0x01 }, 1087af3d54b9SSrinivas Kandagatla { CDC_RX_EC_ASRC0_CLK_RST_CTL, 0x00 }, 1088af3d54b9SSrinivas Kandagatla { CDC_RX_EC_ASRC0_CTL0, 0x00 }, 1089af3d54b9SSrinivas Kandagatla { CDC_RX_EC_ASRC0_CTL1, 0x00 }, 1090af3d54b9SSrinivas Kandagatla { CDC_RX_EC_ASRC0_FIFO_CTL, 0xA8 }, 1091af3d54b9SSrinivas Kandagatla { CDC_RX_EC_ASRC0_STATUS_FMIN_CNTR_LSB, 0x00 }, 1092af3d54b9SSrinivas Kandagatla { CDC_RX_EC_ASRC0_STATUS_FMIN_CNTR_MSB, 0x00 }, 1093af3d54b9SSrinivas Kandagatla { CDC_RX_EC_ASRC0_STATUS_FMAX_CNTR_LSB, 0x00 }, 1094af3d54b9SSrinivas Kandagatla { CDC_RX_EC_ASRC0_STATUS_FMAX_CNTR_MSB, 0x00 }, 1095af3d54b9SSrinivas Kandagatla { CDC_RX_EC_ASRC0_STATUS_FIFO, 0x00 }, 1096af3d54b9SSrinivas Kandagatla { CDC_RX_EC_ASRC1_CLK_RST_CTL, 0x00 }, 1097af3d54b9SSrinivas Kandagatla { CDC_RX_EC_ASRC1_CTL0, 0x00 }, 1098af3d54b9SSrinivas Kandagatla { CDC_RX_EC_ASRC1_CTL1, 0x00 }, 1099af3d54b9SSrinivas Kandagatla { CDC_RX_EC_ASRC1_FIFO_CTL, 0xA8 }, 1100af3d54b9SSrinivas Kandagatla { CDC_RX_EC_ASRC1_STATUS_FMIN_CNTR_LSB, 0x00 }, 1101af3d54b9SSrinivas Kandagatla { CDC_RX_EC_ASRC1_STATUS_FMIN_CNTR_MSB, 0x00 }, 1102af3d54b9SSrinivas Kandagatla { CDC_RX_EC_ASRC1_STATUS_FMAX_CNTR_LSB, 0x00 }, 1103af3d54b9SSrinivas Kandagatla { CDC_RX_EC_ASRC1_STATUS_FMAX_CNTR_MSB, 0x00 }, 1104af3d54b9SSrinivas Kandagatla { CDC_RX_EC_ASRC1_STATUS_FIFO, 0x00 }, 1105af3d54b9SSrinivas Kandagatla { CDC_RX_EC_ASRC2_CLK_RST_CTL, 0x00 }, 1106af3d54b9SSrinivas Kandagatla { CDC_RX_EC_ASRC2_CTL0, 0x00 }, 1107af3d54b9SSrinivas Kandagatla { CDC_RX_EC_ASRC2_CTL1, 0x00 }, 1108af3d54b9SSrinivas Kandagatla { CDC_RX_EC_ASRC2_FIFO_CTL, 0xA8 }, 1109af3d54b9SSrinivas Kandagatla { CDC_RX_EC_ASRC2_STATUS_FMIN_CNTR_LSB, 0x00 }, 1110af3d54b9SSrinivas Kandagatla { CDC_RX_EC_ASRC2_STATUS_FMIN_CNTR_MSB, 0x00 }, 1111af3d54b9SSrinivas Kandagatla { CDC_RX_EC_ASRC2_STATUS_FMAX_CNTR_LSB, 0x00 }, 1112af3d54b9SSrinivas Kandagatla { CDC_RX_EC_ASRC2_STATUS_FMAX_CNTR_MSB, 0x00 }, 1113af3d54b9SSrinivas Kandagatla { CDC_RX_EC_ASRC2_STATUS_FIFO, 0x00 }, 1114af3d54b9SSrinivas Kandagatla { CDC_RX_DSD0_PATH_CTL, 0x00 }, 1115af3d54b9SSrinivas Kandagatla { CDC_RX_DSD0_CFG0, 0x00 }, 1116af3d54b9SSrinivas Kandagatla { CDC_RX_DSD0_CFG1, 0x62 }, 1117af3d54b9SSrinivas Kandagatla { CDC_RX_DSD0_CFG2, 0x96 }, 1118af3d54b9SSrinivas Kandagatla { CDC_RX_DSD1_PATH_CTL, 0x00 }, 1119af3d54b9SSrinivas Kandagatla { CDC_RX_DSD1_CFG0, 0x00 }, 1120af3d54b9SSrinivas Kandagatla { CDC_RX_DSD1_CFG1, 0x62 }, 1121af3d54b9SSrinivas Kandagatla { CDC_RX_DSD1_CFG2, 0x96 }, 1122af3d54b9SSrinivas Kandagatla }; 1123af3d54b9SSrinivas Kandagatla 1124af3d54b9SSrinivas Kandagatla static bool rx_is_wronly_register(struct device *dev, 1125af3d54b9SSrinivas Kandagatla unsigned int reg) 1126af3d54b9SSrinivas Kandagatla { 1127af3d54b9SSrinivas Kandagatla switch (reg) { 1128af3d54b9SSrinivas Kandagatla case CDC_RX_BCL_VBAT_GAIN_UPD_MON: 1129af3d54b9SSrinivas Kandagatla case CDC_RX_INTR_CTRL_CLR_COMMIT: 1130af3d54b9SSrinivas Kandagatla case CDC_RX_INTR_CTRL_PIN1_CLEAR0: 1131af3d54b9SSrinivas Kandagatla case CDC_RX_INTR_CTRL_PIN2_CLEAR0: 1132af3d54b9SSrinivas Kandagatla return true; 1133af3d54b9SSrinivas Kandagatla } 1134af3d54b9SSrinivas Kandagatla 1135af3d54b9SSrinivas Kandagatla return false; 1136af3d54b9SSrinivas Kandagatla } 1137af3d54b9SSrinivas Kandagatla 1138af3d54b9SSrinivas Kandagatla static bool rx_is_volatile_register(struct device *dev, unsigned int reg) 1139af3d54b9SSrinivas Kandagatla { 1140af3d54b9SSrinivas Kandagatla /* Update volatile list for rx/tx macros */ 1141af3d54b9SSrinivas Kandagatla switch (reg) { 1142af3d54b9SSrinivas Kandagatla case CDC_RX_TOP_HPHL_COMP_RD_LSB: 1143af3d54b9SSrinivas Kandagatla case CDC_RX_TOP_HPHL_COMP_WR_LSB: 1144af3d54b9SSrinivas Kandagatla case CDC_RX_TOP_HPHL_COMP_RD_MSB: 1145af3d54b9SSrinivas Kandagatla case CDC_RX_TOP_HPHL_COMP_WR_MSB: 1146af3d54b9SSrinivas Kandagatla case CDC_RX_TOP_HPHR_COMP_RD_LSB: 1147af3d54b9SSrinivas Kandagatla case CDC_RX_TOP_HPHR_COMP_WR_LSB: 1148af3d54b9SSrinivas Kandagatla case CDC_RX_TOP_HPHR_COMP_RD_MSB: 1149af3d54b9SSrinivas Kandagatla case CDC_RX_TOP_HPHR_COMP_WR_MSB: 1150af3d54b9SSrinivas Kandagatla case CDC_RX_TOP_DSD0_DEBUG_CFG2: 1151af3d54b9SSrinivas Kandagatla case CDC_RX_TOP_DSD1_DEBUG_CFG2: 1152af3d54b9SSrinivas Kandagatla case CDC_RX_BCL_VBAT_GAIN_MON_VAL: 1153af3d54b9SSrinivas Kandagatla case CDC_RX_BCL_VBAT_DECODE_ST: 1154af3d54b9SSrinivas Kandagatla case CDC_RX_INTR_CTRL_PIN1_STATUS0: 1155af3d54b9SSrinivas Kandagatla case CDC_RX_INTR_CTRL_PIN2_STATUS0: 1156af3d54b9SSrinivas Kandagatla case CDC_RX_COMPANDER0_CTL6: 1157af3d54b9SSrinivas Kandagatla case CDC_RX_COMPANDER1_CTL6: 1158af3d54b9SSrinivas Kandagatla case CDC_RX_EC_ASRC0_STATUS_FMIN_CNTR_LSB: 1159af3d54b9SSrinivas Kandagatla case CDC_RX_EC_ASRC0_STATUS_FMIN_CNTR_MSB: 1160af3d54b9SSrinivas Kandagatla case CDC_RX_EC_ASRC0_STATUS_FMAX_CNTR_LSB: 1161af3d54b9SSrinivas Kandagatla case CDC_RX_EC_ASRC0_STATUS_FMAX_CNTR_MSB: 1162af3d54b9SSrinivas Kandagatla case CDC_RX_EC_ASRC0_STATUS_FIFO: 1163af3d54b9SSrinivas Kandagatla case CDC_RX_EC_ASRC1_STATUS_FMIN_CNTR_LSB: 1164af3d54b9SSrinivas Kandagatla case CDC_RX_EC_ASRC1_STATUS_FMIN_CNTR_MSB: 1165af3d54b9SSrinivas Kandagatla case CDC_RX_EC_ASRC1_STATUS_FMAX_CNTR_LSB: 1166af3d54b9SSrinivas Kandagatla case CDC_RX_EC_ASRC1_STATUS_FMAX_CNTR_MSB: 1167af3d54b9SSrinivas Kandagatla case CDC_RX_EC_ASRC1_STATUS_FIFO: 1168af3d54b9SSrinivas Kandagatla case CDC_RX_EC_ASRC2_STATUS_FMIN_CNTR_LSB: 1169af3d54b9SSrinivas Kandagatla case CDC_RX_EC_ASRC2_STATUS_FMIN_CNTR_MSB: 1170af3d54b9SSrinivas Kandagatla case CDC_RX_EC_ASRC2_STATUS_FMAX_CNTR_LSB: 1171af3d54b9SSrinivas Kandagatla case CDC_RX_EC_ASRC2_STATUS_FMAX_CNTR_MSB: 1172af3d54b9SSrinivas Kandagatla case CDC_RX_EC_ASRC2_STATUS_FIFO: 1173af3d54b9SSrinivas Kandagatla return true; 1174af3d54b9SSrinivas Kandagatla } 1175af3d54b9SSrinivas Kandagatla return false; 1176af3d54b9SSrinivas Kandagatla } 1177af3d54b9SSrinivas Kandagatla 1178af3d54b9SSrinivas Kandagatla static bool rx_is_rw_register(struct device *dev, unsigned int reg) 1179af3d54b9SSrinivas Kandagatla { 1180af3d54b9SSrinivas Kandagatla switch (reg) { 1181af3d54b9SSrinivas Kandagatla case CDC_RX_TOP_TOP_CFG0: 1182af3d54b9SSrinivas Kandagatla case CDC_RX_TOP_SWR_CTRL: 1183af3d54b9SSrinivas Kandagatla case CDC_RX_TOP_DEBUG: 1184af3d54b9SSrinivas Kandagatla case CDC_RX_TOP_DEBUG_BUS: 1185af3d54b9SSrinivas Kandagatla case CDC_RX_TOP_DEBUG_EN0: 1186af3d54b9SSrinivas Kandagatla case CDC_RX_TOP_DEBUG_EN1: 1187af3d54b9SSrinivas Kandagatla case CDC_RX_TOP_DEBUG_EN2: 1188af3d54b9SSrinivas Kandagatla case CDC_RX_TOP_HPHL_COMP_WR_LSB: 1189af3d54b9SSrinivas Kandagatla case CDC_RX_TOP_HPHL_COMP_WR_MSB: 1190af3d54b9SSrinivas Kandagatla case CDC_RX_TOP_HPHL_COMP_LUT: 1191af3d54b9SSrinivas Kandagatla case CDC_RX_TOP_HPHR_COMP_WR_LSB: 1192af3d54b9SSrinivas Kandagatla case CDC_RX_TOP_HPHR_COMP_WR_MSB: 1193af3d54b9SSrinivas Kandagatla case CDC_RX_TOP_HPHR_COMP_LUT: 1194af3d54b9SSrinivas Kandagatla case CDC_RX_TOP_DSD0_DEBUG_CFG0: 1195af3d54b9SSrinivas Kandagatla case CDC_RX_TOP_DSD0_DEBUG_CFG1: 1196af3d54b9SSrinivas Kandagatla case CDC_RX_TOP_DSD0_DEBUG_CFG3: 1197af3d54b9SSrinivas Kandagatla case CDC_RX_TOP_DSD1_DEBUG_CFG0: 1198af3d54b9SSrinivas Kandagatla case CDC_RX_TOP_DSD1_DEBUG_CFG1: 1199af3d54b9SSrinivas Kandagatla case CDC_RX_TOP_DSD1_DEBUG_CFG3: 1200af3d54b9SSrinivas Kandagatla case CDC_RX_TOP_RX_I2S_CTL: 1201af3d54b9SSrinivas Kandagatla case CDC_RX_TOP_TX_I2S2_CTL: 1202af3d54b9SSrinivas Kandagatla case CDC_RX_TOP_I2S_CLK: 1203af3d54b9SSrinivas Kandagatla case CDC_RX_TOP_I2S_RESET: 1204af3d54b9SSrinivas Kandagatla case CDC_RX_TOP_I2S_MUX: 1205af3d54b9SSrinivas Kandagatla case CDC_RX_CLK_RST_CTRL_MCLK_CONTROL: 1206af3d54b9SSrinivas Kandagatla case CDC_RX_CLK_RST_CTRL_FS_CNT_CONTROL: 1207af3d54b9SSrinivas Kandagatla case CDC_RX_CLK_RST_CTRL_SWR_CONTROL: 1208af3d54b9SSrinivas Kandagatla case CDC_RX_CLK_RST_CTRL_DSD_CONTROL: 1209af3d54b9SSrinivas Kandagatla case CDC_RX_CLK_RST_CTRL_ASRC_SHARE_CONTROL: 1210af3d54b9SSrinivas Kandagatla case CDC_RX_SOFTCLIP_CRC: 1211af3d54b9SSrinivas Kandagatla case CDC_RX_SOFTCLIP_SOFTCLIP_CTRL: 1212af3d54b9SSrinivas Kandagatla case CDC_RX_INP_MUX_RX_INT0_CFG0: 1213af3d54b9SSrinivas Kandagatla case CDC_RX_INP_MUX_RX_INT0_CFG1: 1214af3d54b9SSrinivas Kandagatla case CDC_RX_INP_MUX_RX_INT1_CFG0: 1215af3d54b9SSrinivas Kandagatla case CDC_RX_INP_MUX_RX_INT1_CFG1: 1216af3d54b9SSrinivas Kandagatla case CDC_RX_INP_MUX_RX_INT2_CFG0: 1217af3d54b9SSrinivas Kandagatla case CDC_RX_INP_MUX_RX_INT2_CFG1: 1218af3d54b9SSrinivas Kandagatla case CDC_RX_INP_MUX_RX_MIX_CFG4: 1219af3d54b9SSrinivas Kandagatla case CDC_RX_INP_MUX_RX_MIX_CFG5: 1220af3d54b9SSrinivas Kandagatla case CDC_RX_INP_MUX_SIDETONE_SRC_CFG0: 1221af3d54b9SSrinivas Kandagatla case CDC_RX_CLSH_CRC: 1222af3d54b9SSrinivas Kandagatla case CDC_RX_CLSH_DLY_CTRL: 1223af3d54b9SSrinivas Kandagatla case CDC_RX_CLSH_DECAY_CTRL: 1224af3d54b9SSrinivas Kandagatla case CDC_RX_CLSH_HPH_V_PA: 1225af3d54b9SSrinivas Kandagatla case CDC_RX_CLSH_EAR_V_PA: 1226af3d54b9SSrinivas Kandagatla case CDC_RX_CLSH_HPH_V_HD: 1227af3d54b9SSrinivas Kandagatla case CDC_RX_CLSH_EAR_V_HD: 1228af3d54b9SSrinivas Kandagatla case CDC_RX_CLSH_K1_MSB: 1229af3d54b9SSrinivas Kandagatla case CDC_RX_CLSH_K1_LSB: 1230af3d54b9SSrinivas Kandagatla case CDC_RX_CLSH_K2_MSB: 1231af3d54b9SSrinivas Kandagatla case CDC_RX_CLSH_K2_LSB: 1232af3d54b9SSrinivas Kandagatla case CDC_RX_CLSH_IDLE_CTRL: 1233af3d54b9SSrinivas Kandagatla case CDC_RX_CLSH_IDLE_HPH: 1234af3d54b9SSrinivas Kandagatla case CDC_RX_CLSH_IDLE_EAR: 1235af3d54b9SSrinivas Kandagatla case CDC_RX_CLSH_TEST0: 1236af3d54b9SSrinivas Kandagatla case CDC_RX_CLSH_TEST1: 1237af3d54b9SSrinivas Kandagatla case CDC_RX_CLSH_OVR_VREF: 1238af3d54b9SSrinivas Kandagatla case CDC_RX_CLSH_CLSG_CTL: 1239af3d54b9SSrinivas Kandagatla case CDC_RX_CLSH_CLSG_CFG1: 1240af3d54b9SSrinivas Kandagatla case CDC_RX_CLSH_CLSG_CFG2: 1241af3d54b9SSrinivas Kandagatla case CDC_RX_BCL_VBAT_PATH_CTL: 1242af3d54b9SSrinivas Kandagatla case CDC_RX_BCL_VBAT_CFG: 1243af3d54b9SSrinivas Kandagatla case CDC_RX_BCL_VBAT_ADC_CAL1: 1244af3d54b9SSrinivas Kandagatla case CDC_RX_BCL_VBAT_ADC_CAL2: 1245af3d54b9SSrinivas Kandagatla case CDC_RX_BCL_VBAT_ADC_CAL3: 1246af3d54b9SSrinivas Kandagatla case CDC_RX_BCL_VBAT_PK_EST1: 1247af3d54b9SSrinivas Kandagatla case CDC_RX_BCL_VBAT_PK_EST2: 1248af3d54b9SSrinivas Kandagatla case CDC_RX_BCL_VBAT_PK_EST3: 1249af3d54b9SSrinivas Kandagatla case CDC_RX_BCL_VBAT_RF_PROC1: 1250af3d54b9SSrinivas Kandagatla case CDC_RX_BCL_VBAT_RF_PROC2: 1251af3d54b9SSrinivas Kandagatla case CDC_RX_BCL_VBAT_TAC1: 1252af3d54b9SSrinivas Kandagatla case CDC_RX_BCL_VBAT_TAC2: 1253af3d54b9SSrinivas Kandagatla case CDC_RX_BCL_VBAT_TAC3: 1254af3d54b9SSrinivas Kandagatla case CDC_RX_BCL_VBAT_TAC4: 1255af3d54b9SSrinivas Kandagatla case CDC_RX_BCL_VBAT_GAIN_UPD1: 1256af3d54b9SSrinivas Kandagatla case CDC_RX_BCL_VBAT_GAIN_UPD2: 1257af3d54b9SSrinivas Kandagatla case CDC_RX_BCL_VBAT_GAIN_UPD3: 1258af3d54b9SSrinivas Kandagatla case CDC_RX_BCL_VBAT_GAIN_UPD4: 1259af3d54b9SSrinivas Kandagatla case CDC_RX_BCL_VBAT_GAIN_UPD5: 1260af3d54b9SSrinivas Kandagatla case CDC_RX_BCL_VBAT_DEBUG1: 1261af3d54b9SSrinivas Kandagatla case CDC_RX_BCL_VBAT_BAN: 1262af3d54b9SSrinivas Kandagatla case CDC_RX_BCL_VBAT_BCL_GAIN_UPD1: 1263af3d54b9SSrinivas Kandagatla case CDC_RX_BCL_VBAT_BCL_GAIN_UPD2: 1264af3d54b9SSrinivas Kandagatla case CDC_RX_BCL_VBAT_BCL_GAIN_UPD3: 1265af3d54b9SSrinivas Kandagatla case CDC_RX_BCL_VBAT_BCL_GAIN_UPD4: 1266af3d54b9SSrinivas Kandagatla case CDC_RX_BCL_VBAT_BCL_GAIN_UPD5: 1267af3d54b9SSrinivas Kandagatla case CDC_RX_BCL_VBAT_BCL_GAIN_UPD6: 1268af3d54b9SSrinivas Kandagatla case CDC_RX_BCL_VBAT_BCL_GAIN_UPD7: 1269af3d54b9SSrinivas Kandagatla case CDC_RX_BCL_VBAT_BCL_GAIN_UPD8: 1270af3d54b9SSrinivas Kandagatla case CDC_RX_BCL_VBAT_BCL_GAIN_UPD9: 1271af3d54b9SSrinivas Kandagatla case CDC_RX_BCL_VBAT_ATTN1: 1272af3d54b9SSrinivas Kandagatla case CDC_RX_BCL_VBAT_ATTN2: 1273af3d54b9SSrinivas Kandagatla case CDC_RX_BCL_VBAT_ATTN3: 1274af3d54b9SSrinivas Kandagatla case CDC_RX_BCL_VBAT_DECODE_CTL1: 1275af3d54b9SSrinivas Kandagatla case CDC_RX_BCL_VBAT_DECODE_CTL2: 1276af3d54b9SSrinivas Kandagatla case CDC_RX_BCL_VBAT_DECODE_CFG1: 1277af3d54b9SSrinivas Kandagatla case CDC_RX_BCL_VBAT_DECODE_CFG2: 1278af3d54b9SSrinivas Kandagatla case CDC_RX_BCL_VBAT_DECODE_CFG3: 1279af3d54b9SSrinivas Kandagatla case CDC_RX_BCL_VBAT_DECODE_CFG4: 1280af3d54b9SSrinivas Kandagatla case CDC_RX_INTR_CTRL_CFG: 1281af3d54b9SSrinivas Kandagatla case CDC_RX_INTR_CTRL_PIN1_MASK0: 1282af3d54b9SSrinivas Kandagatla case CDC_RX_INTR_CTRL_PIN2_MASK0: 1283af3d54b9SSrinivas Kandagatla case CDC_RX_INTR_CTRL_LEVEL0: 1284af3d54b9SSrinivas Kandagatla case CDC_RX_INTR_CTRL_BYPASS0: 1285af3d54b9SSrinivas Kandagatla case CDC_RX_INTR_CTRL_SET0: 1286af3d54b9SSrinivas Kandagatla case CDC_RX_RX0_RX_PATH_CTL: 1287af3d54b9SSrinivas Kandagatla case CDC_RX_RX0_RX_PATH_CFG0: 1288af3d54b9SSrinivas Kandagatla case CDC_RX_RX0_RX_PATH_CFG1: 1289af3d54b9SSrinivas Kandagatla case CDC_RX_RX0_RX_PATH_CFG2: 1290af3d54b9SSrinivas Kandagatla case CDC_RX_RX0_RX_PATH_CFG3: 1291af3d54b9SSrinivas Kandagatla case CDC_RX_RX0_RX_VOL_CTL: 1292af3d54b9SSrinivas Kandagatla case CDC_RX_RX0_RX_PATH_MIX_CTL: 1293af3d54b9SSrinivas Kandagatla case CDC_RX_RX0_RX_PATH_MIX_CFG: 1294af3d54b9SSrinivas Kandagatla case CDC_RX_RX0_RX_VOL_MIX_CTL: 1295af3d54b9SSrinivas Kandagatla case CDC_RX_RX0_RX_PATH_SEC1: 1296af3d54b9SSrinivas Kandagatla case CDC_RX_RX0_RX_PATH_SEC2: 1297af3d54b9SSrinivas Kandagatla case CDC_RX_RX0_RX_PATH_SEC3: 1298af3d54b9SSrinivas Kandagatla case CDC_RX_RX0_RX_PATH_SEC4: 1299af3d54b9SSrinivas Kandagatla case CDC_RX_RX0_RX_PATH_SEC7: 1300af3d54b9SSrinivas Kandagatla case CDC_RX_RX0_RX_PATH_MIX_SEC0: 1301af3d54b9SSrinivas Kandagatla case CDC_RX_RX0_RX_PATH_MIX_SEC1: 1302af3d54b9SSrinivas Kandagatla case CDC_RX_RX0_RX_PATH_DSM_CTL: 1303af3d54b9SSrinivas Kandagatla case CDC_RX_RX0_RX_PATH_DSM_DATA1: 1304af3d54b9SSrinivas Kandagatla case CDC_RX_RX0_RX_PATH_DSM_DATA2: 1305af3d54b9SSrinivas Kandagatla case CDC_RX_RX0_RX_PATH_DSM_DATA3: 1306af3d54b9SSrinivas Kandagatla case CDC_RX_RX0_RX_PATH_DSM_DATA4: 1307af3d54b9SSrinivas Kandagatla case CDC_RX_RX0_RX_PATH_DSM_DATA5: 1308af3d54b9SSrinivas Kandagatla case CDC_RX_RX0_RX_PATH_DSM_DATA6: 1309af3d54b9SSrinivas Kandagatla case CDC_RX_RX1_RX_PATH_CTL: 1310af3d54b9SSrinivas Kandagatla case CDC_RX_RX1_RX_PATH_CFG0: 1311af3d54b9SSrinivas Kandagatla case CDC_RX_RX1_RX_PATH_CFG1: 1312af3d54b9SSrinivas Kandagatla case CDC_RX_RX1_RX_PATH_CFG2: 1313af3d54b9SSrinivas Kandagatla case CDC_RX_RX1_RX_PATH_CFG3: 1314af3d54b9SSrinivas Kandagatla case CDC_RX_RX1_RX_VOL_CTL: 1315af3d54b9SSrinivas Kandagatla case CDC_RX_RX1_RX_PATH_MIX_CTL: 1316af3d54b9SSrinivas Kandagatla case CDC_RX_RX1_RX_PATH_MIX_CFG: 1317af3d54b9SSrinivas Kandagatla case CDC_RX_RX1_RX_VOL_MIX_CTL: 1318af3d54b9SSrinivas Kandagatla case CDC_RX_RX1_RX_PATH_SEC1: 1319af3d54b9SSrinivas Kandagatla case CDC_RX_RX1_RX_PATH_SEC2: 1320af3d54b9SSrinivas Kandagatla case CDC_RX_RX1_RX_PATH_SEC3: 1321af3d54b9SSrinivas Kandagatla case CDC_RX_RX1_RX_PATH_SEC4: 1322af3d54b9SSrinivas Kandagatla case CDC_RX_RX1_RX_PATH_SEC7: 1323af3d54b9SSrinivas Kandagatla case CDC_RX_RX1_RX_PATH_MIX_SEC0: 1324af3d54b9SSrinivas Kandagatla case CDC_RX_RX1_RX_PATH_MIX_SEC1: 1325af3d54b9SSrinivas Kandagatla case CDC_RX_RX1_RX_PATH_DSM_CTL: 1326af3d54b9SSrinivas Kandagatla case CDC_RX_RX1_RX_PATH_DSM_DATA1: 1327af3d54b9SSrinivas Kandagatla case CDC_RX_RX1_RX_PATH_DSM_DATA2: 1328af3d54b9SSrinivas Kandagatla case CDC_RX_RX1_RX_PATH_DSM_DATA3: 1329af3d54b9SSrinivas Kandagatla case CDC_RX_RX1_RX_PATH_DSM_DATA4: 1330af3d54b9SSrinivas Kandagatla case CDC_RX_RX1_RX_PATH_DSM_DATA5: 1331af3d54b9SSrinivas Kandagatla case CDC_RX_RX1_RX_PATH_DSM_DATA6: 1332af3d54b9SSrinivas Kandagatla case CDC_RX_RX2_RX_PATH_CTL: 1333af3d54b9SSrinivas Kandagatla case CDC_RX_RX2_RX_PATH_CFG0: 1334af3d54b9SSrinivas Kandagatla case CDC_RX_RX2_RX_PATH_CFG1: 1335af3d54b9SSrinivas Kandagatla case CDC_RX_RX2_RX_PATH_CFG2: 1336af3d54b9SSrinivas Kandagatla case CDC_RX_RX2_RX_PATH_CFG3: 1337af3d54b9SSrinivas Kandagatla case CDC_RX_RX2_RX_VOL_CTL: 1338af3d54b9SSrinivas Kandagatla case CDC_RX_RX2_RX_PATH_MIX_CTL: 1339af3d54b9SSrinivas Kandagatla case CDC_RX_RX2_RX_PATH_MIX_CFG: 1340af3d54b9SSrinivas Kandagatla case CDC_RX_RX2_RX_VOL_MIX_CTL: 1341af3d54b9SSrinivas Kandagatla case CDC_RX_RX2_RX_PATH_SEC0: 1342af3d54b9SSrinivas Kandagatla case CDC_RX_RX2_RX_PATH_SEC1: 1343af3d54b9SSrinivas Kandagatla case CDC_RX_RX2_RX_PATH_SEC2: 1344af3d54b9SSrinivas Kandagatla case CDC_RX_RX2_RX_PATH_SEC3: 1345af3d54b9SSrinivas Kandagatla case CDC_RX_RX2_RX_PATH_SEC4: 1346af3d54b9SSrinivas Kandagatla case CDC_RX_RX2_RX_PATH_SEC5: 1347af3d54b9SSrinivas Kandagatla case CDC_RX_RX2_RX_PATH_SEC6: 1348af3d54b9SSrinivas Kandagatla case CDC_RX_RX2_RX_PATH_SEC7: 1349af3d54b9SSrinivas Kandagatla case CDC_RX_RX2_RX_PATH_MIX_SEC0: 1350af3d54b9SSrinivas Kandagatla case CDC_RX_RX2_RX_PATH_MIX_SEC1: 1351af3d54b9SSrinivas Kandagatla case CDC_RX_RX2_RX_PATH_DSM_CTL: 1352af3d54b9SSrinivas Kandagatla case CDC_RX_IDLE_DETECT_PATH_CTL: 1353af3d54b9SSrinivas Kandagatla case CDC_RX_IDLE_DETECT_CFG0: 1354af3d54b9SSrinivas Kandagatla case CDC_RX_IDLE_DETECT_CFG1: 1355af3d54b9SSrinivas Kandagatla case CDC_RX_IDLE_DETECT_CFG2: 1356af3d54b9SSrinivas Kandagatla case CDC_RX_IDLE_DETECT_CFG3: 1357af3d54b9SSrinivas Kandagatla case CDC_RX_COMPANDER0_CTL0: 1358af3d54b9SSrinivas Kandagatla case CDC_RX_COMPANDER0_CTL1: 1359af3d54b9SSrinivas Kandagatla case CDC_RX_COMPANDER0_CTL2: 1360af3d54b9SSrinivas Kandagatla case CDC_RX_COMPANDER0_CTL3: 1361af3d54b9SSrinivas Kandagatla case CDC_RX_COMPANDER0_CTL4: 1362af3d54b9SSrinivas Kandagatla case CDC_RX_COMPANDER0_CTL5: 1363af3d54b9SSrinivas Kandagatla case CDC_RX_COMPANDER0_CTL7: 1364af3d54b9SSrinivas Kandagatla case CDC_RX_COMPANDER1_CTL0: 1365af3d54b9SSrinivas Kandagatla case CDC_RX_COMPANDER1_CTL1: 1366af3d54b9SSrinivas Kandagatla case CDC_RX_COMPANDER1_CTL2: 1367af3d54b9SSrinivas Kandagatla case CDC_RX_COMPANDER1_CTL3: 1368af3d54b9SSrinivas Kandagatla case CDC_RX_COMPANDER1_CTL4: 1369af3d54b9SSrinivas Kandagatla case CDC_RX_COMPANDER1_CTL5: 1370af3d54b9SSrinivas Kandagatla case CDC_RX_COMPANDER1_CTL7: 1371af3d54b9SSrinivas Kandagatla case CDC_RX_SIDETONE_IIR0_IIR_PATH_CTL: 1372af3d54b9SSrinivas Kandagatla case CDC_RX_SIDETONE_IIR0_IIR_GAIN_B1_CTL: 1373af3d54b9SSrinivas Kandagatla case CDC_RX_SIDETONE_IIR0_IIR_GAIN_B2_CTL: 1374af3d54b9SSrinivas Kandagatla case CDC_RX_SIDETONE_IIR0_IIR_GAIN_B3_CTL: 1375af3d54b9SSrinivas Kandagatla case CDC_RX_SIDETONE_IIR0_IIR_GAIN_B4_CTL: 1376af3d54b9SSrinivas Kandagatla case CDC_RX_SIDETONE_IIR0_IIR_GAIN_B5_CTL: 1377af3d54b9SSrinivas Kandagatla case CDC_RX_SIDETONE_IIR0_IIR_GAIN_B6_CTL: 1378af3d54b9SSrinivas Kandagatla case CDC_RX_SIDETONE_IIR0_IIR_GAIN_B7_CTL: 1379af3d54b9SSrinivas Kandagatla case CDC_RX_SIDETONE_IIR0_IIR_GAIN_B8_CTL: 1380af3d54b9SSrinivas Kandagatla case CDC_RX_SIDETONE_IIR0_IIR_CTL: 1381af3d54b9SSrinivas Kandagatla case CDC_RX_SIDETONE_IIR0_IIR_GAIN_TIMER_CTL: 1382af3d54b9SSrinivas Kandagatla case CDC_RX_SIDETONE_IIR0_IIR_COEF_B1_CTL: 1383af3d54b9SSrinivas Kandagatla case CDC_RX_SIDETONE_IIR0_IIR_COEF_B2_CTL: 1384af3d54b9SSrinivas Kandagatla case CDC_RX_SIDETONE_IIR1_IIR_PATH_CTL: 1385af3d54b9SSrinivas Kandagatla case CDC_RX_SIDETONE_IIR1_IIR_GAIN_B1_CTL: 1386af3d54b9SSrinivas Kandagatla case CDC_RX_SIDETONE_IIR1_IIR_GAIN_B2_CTL: 1387af3d54b9SSrinivas Kandagatla case CDC_RX_SIDETONE_IIR1_IIR_GAIN_B3_CTL: 1388af3d54b9SSrinivas Kandagatla case CDC_RX_SIDETONE_IIR1_IIR_GAIN_B4_CTL: 1389af3d54b9SSrinivas Kandagatla case CDC_RX_SIDETONE_IIR1_IIR_GAIN_B5_CTL: 1390af3d54b9SSrinivas Kandagatla case CDC_RX_SIDETONE_IIR1_IIR_GAIN_B6_CTL: 1391af3d54b9SSrinivas Kandagatla case CDC_RX_SIDETONE_IIR1_IIR_GAIN_B7_CTL: 1392af3d54b9SSrinivas Kandagatla case CDC_RX_SIDETONE_IIR1_IIR_GAIN_B8_CTL: 1393af3d54b9SSrinivas Kandagatla case CDC_RX_SIDETONE_IIR1_IIR_CTL: 1394af3d54b9SSrinivas Kandagatla case CDC_RX_SIDETONE_IIR1_IIR_GAIN_TIMER_CTL: 1395af3d54b9SSrinivas Kandagatla case CDC_RX_SIDETONE_IIR1_IIR_COEF_B1_CTL: 1396af3d54b9SSrinivas Kandagatla case CDC_RX_SIDETONE_IIR1_IIR_COEF_B2_CTL: 1397af3d54b9SSrinivas Kandagatla case CDC_RX_IIR_INP_MUX_IIR0_MIX_CFG0: 1398af3d54b9SSrinivas Kandagatla case CDC_RX_IIR_INP_MUX_IIR0_MIX_CFG1: 1399af3d54b9SSrinivas Kandagatla case CDC_RX_IIR_INP_MUX_IIR0_MIX_CFG2: 1400af3d54b9SSrinivas Kandagatla case CDC_RX_IIR_INP_MUX_IIR0_MIX_CFG3: 1401af3d54b9SSrinivas Kandagatla case CDC_RX_IIR_INP_MUX_IIR1_MIX_CFG0: 1402af3d54b9SSrinivas Kandagatla case CDC_RX_IIR_INP_MUX_IIR1_MIX_CFG1: 1403af3d54b9SSrinivas Kandagatla case CDC_RX_IIR_INP_MUX_IIR1_MIX_CFG2: 1404af3d54b9SSrinivas Kandagatla case CDC_RX_IIR_INP_MUX_IIR1_MIX_CFG3: 1405af3d54b9SSrinivas Kandagatla case CDC_RX_SIDETONE_SRC0_ST_SRC_PATH_CTL: 1406af3d54b9SSrinivas Kandagatla case CDC_RX_SIDETONE_SRC0_ST_SRC_PATH_CFG1: 1407af3d54b9SSrinivas Kandagatla case CDC_RX_SIDETONE_SRC1_ST_SRC_PATH_CTL: 1408af3d54b9SSrinivas Kandagatla case CDC_RX_SIDETONE_SRC1_ST_SRC_PATH_CFG1: 1409af3d54b9SSrinivas Kandagatla case CDC_RX_EC_REF_HQ0_EC_REF_HQ_PATH_CTL: 1410af3d54b9SSrinivas Kandagatla case CDC_RX_EC_REF_HQ0_EC_REF_HQ_CFG0: 1411af3d54b9SSrinivas Kandagatla case CDC_RX_EC_REF_HQ1_EC_REF_HQ_PATH_CTL: 1412af3d54b9SSrinivas Kandagatla case CDC_RX_EC_REF_HQ1_EC_REF_HQ_CFG0: 1413af3d54b9SSrinivas Kandagatla case CDC_RX_EC_REF_HQ2_EC_REF_HQ_PATH_CTL: 1414af3d54b9SSrinivas Kandagatla case CDC_RX_EC_REF_HQ2_EC_REF_HQ_CFG0: 1415af3d54b9SSrinivas Kandagatla case CDC_RX_EC_ASRC0_CLK_RST_CTL: 1416af3d54b9SSrinivas Kandagatla case CDC_RX_EC_ASRC0_CTL0: 1417af3d54b9SSrinivas Kandagatla case CDC_RX_EC_ASRC0_CTL1: 1418af3d54b9SSrinivas Kandagatla case CDC_RX_EC_ASRC0_FIFO_CTL: 1419af3d54b9SSrinivas Kandagatla case CDC_RX_EC_ASRC1_CLK_RST_CTL: 1420af3d54b9SSrinivas Kandagatla case CDC_RX_EC_ASRC1_CTL0: 1421af3d54b9SSrinivas Kandagatla case CDC_RX_EC_ASRC1_CTL1: 1422af3d54b9SSrinivas Kandagatla case CDC_RX_EC_ASRC1_FIFO_CTL: 1423af3d54b9SSrinivas Kandagatla case CDC_RX_EC_ASRC2_CLK_RST_CTL: 1424af3d54b9SSrinivas Kandagatla case CDC_RX_EC_ASRC2_CTL0: 1425af3d54b9SSrinivas Kandagatla case CDC_RX_EC_ASRC2_CTL1: 1426af3d54b9SSrinivas Kandagatla case CDC_RX_EC_ASRC2_FIFO_CTL: 1427af3d54b9SSrinivas Kandagatla case CDC_RX_DSD0_PATH_CTL: 1428af3d54b9SSrinivas Kandagatla case CDC_RX_DSD0_CFG0: 1429af3d54b9SSrinivas Kandagatla case CDC_RX_DSD0_CFG1: 1430af3d54b9SSrinivas Kandagatla case CDC_RX_DSD0_CFG2: 1431af3d54b9SSrinivas Kandagatla case CDC_RX_DSD1_PATH_CTL: 1432af3d54b9SSrinivas Kandagatla case CDC_RX_DSD1_CFG0: 1433af3d54b9SSrinivas Kandagatla case CDC_RX_DSD1_CFG1: 1434af3d54b9SSrinivas Kandagatla case CDC_RX_DSD1_CFG2: 1435af3d54b9SSrinivas Kandagatla return true; 1436af3d54b9SSrinivas Kandagatla } 1437af3d54b9SSrinivas Kandagatla 1438af3d54b9SSrinivas Kandagatla return false; 1439af3d54b9SSrinivas Kandagatla } 1440af3d54b9SSrinivas Kandagatla 1441af3d54b9SSrinivas Kandagatla static bool rx_is_writeable_register(struct device *dev, unsigned int reg) 1442af3d54b9SSrinivas Kandagatla { 1443af3d54b9SSrinivas Kandagatla bool ret; 1444af3d54b9SSrinivas Kandagatla 1445af3d54b9SSrinivas Kandagatla ret = rx_is_rw_register(dev, reg); 1446af3d54b9SSrinivas Kandagatla if (!ret) 1447af3d54b9SSrinivas Kandagatla return rx_is_wronly_register(dev, reg); 1448af3d54b9SSrinivas Kandagatla 1449af3d54b9SSrinivas Kandagatla return ret; 1450af3d54b9SSrinivas Kandagatla } 1451af3d54b9SSrinivas Kandagatla 1452af3d54b9SSrinivas Kandagatla static bool rx_is_readable_register(struct device *dev, unsigned int reg) 1453af3d54b9SSrinivas Kandagatla { 1454af3d54b9SSrinivas Kandagatla switch (reg) { 1455af3d54b9SSrinivas Kandagatla case CDC_RX_TOP_HPHL_COMP_RD_LSB: 1456af3d54b9SSrinivas Kandagatla case CDC_RX_TOP_HPHL_COMP_RD_MSB: 1457af3d54b9SSrinivas Kandagatla case CDC_RX_TOP_HPHR_COMP_RD_LSB: 1458af3d54b9SSrinivas Kandagatla case CDC_RX_TOP_HPHR_COMP_RD_MSB: 1459af3d54b9SSrinivas Kandagatla case CDC_RX_TOP_DSD0_DEBUG_CFG2: 1460af3d54b9SSrinivas Kandagatla case CDC_RX_TOP_DSD1_DEBUG_CFG2: 1461af3d54b9SSrinivas Kandagatla case CDC_RX_BCL_VBAT_GAIN_MON_VAL: 1462af3d54b9SSrinivas Kandagatla case CDC_RX_BCL_VBAT_DECODE_ST: 1463af3d54b9SSrinivas Kandagatla case CDC_RX_INTR_CTRL_PIN1_STATUS0: 1464af3d54b9SSrinivas Kandagatla case CDC_RX_INTR_CTRL_PIN2_STATUS0: 1465af3d54b9SSrinivas Kandagatla case CDC_RX_COMPANDER0_CTL6: 1466af3d54b9SSrinivas Kandagatla case CDC_RX_COMPANDER1_CTL6: 1467af3d54b9SSrinivas Kandagatla case CDC_RX_EC_ASRC0_STATUS_FMIN_CNTR_LSB: 1468af3d54b9SSrinivas Kandagatla case CDC_RX_EC_ASRC0_STATUS_FMIN_CNTR_MSB: 1469af3d54b9SSrinivas Kandagatla case CDC_RX_EC_ASRC0_STATUS_FMAX_CNTR_LSB: 1470af3d54b9SSrinivas Kandagatla case CDC_RX_EC_ASRC0_STATUS_FMAX_CNTR_MSB: 1471af3d54b9SSrinivas Kandagatla case CDC_RX_EC_ASRC0_STATUS_FIFO: 1472af3d54b9SSrinivas Kandagatla case CDC_RX_EC_ASRC1_STATUS_FMIN_CNTR_LSB: 1473af3d54b9SSrinivas Kandagatla case CDC_RX_EC_ASRC1_STATUS_FMIN_CNTR_MSB: 1474af3d54b9SSrinivas Kandagatla case CDC_RX_EC_ASRC1_STATUS_FMAX_CNTR_LSB: 1475af3d54b9SSrinivas Kandagatla case CDC_RX_EC_ASRC1_STATUS_FMAX_CNTR_MSB: 1476af3d54b9SSrinivas Kandagatla case CDC_RX_EC_ASRC1_STATUS_FIFO: 1477af3d54b9SSrinivas Kandagatla case CDC_RX_EC_ASRC2_STATUS_FMIN_CNTR_LSB: 1478af3d54b9SSrinivas Kandagatla case CDC_RX_EC_ASRC2_STATUS_FMIN_CNTR_MSB: 1479af3d54b9SSrinivas Kandagatla case CDC_RX_EC_ASRC2_STATUS_FMAX_CNTR_LSB: 1480af3d54b9SSrinivas Kandagatla case CDC_RX_EC_ASRC2_STATUS_FMAX_CNTR_MSB: 1481af3d54b9SSrinivas Kandagatla case CDC_RX_EC_ASRC2_STATUS_FIFO: 1482af3d54b9SSrinivas Kandagatla return true; 1483af3d54b9SSrinivas Kandagatla } 1484af3d54b9SSrinivas Kandagatla 1485af3d54b9SSrinivas Kandagatla return rx_is_rw_register(dev, reg); 1486af3d54b9SSrinivas Kandagatla } 1487af3d54b9SSrinivas Kandagatla 1488af3d54b9SSrinivas Kandagatla static const struct regmap_config rx_regmap_config = { 1489af3d54b9SSrinivas Kandagatla .name = "rx_macro", 1490af3d54b9SSrinivas Kandagatla .reg_bits = 16, 1491af3d54b9SSrinivas Kandagatla .val_bits = 32, /* 8 but with 32 bit read/write */ 1492af3d54b9SSrinivas Kandagatla .reg_stride = 4, 1493af3d54b9SSrinivas Kandagatla .cache_type = REGCACHE_FLAT, 1494af3d54b9SSrinivas Kandagatla .reg_defaults = rx_defaults, 1495af3d54b9SSrinivas Kandagatla .num_reg_defaults = ARRAY_SIZE(rx_defaults), 1496af3d54b9SSrinivas Kandagatla .max_register = RX_MAX_OFFSET, 1497af3d54b9SSrinivas Kandagatla .writeable_reg = rx_is_writeable_register, 1498af3d54b9SSrinivas Kandagatla .volatile_reg = rx_is_volatile_register, 1499af3d54b9SSrinivas Kandagatla .readable_reg = rx_is_readable_register, 1500af3d54b9SSrinivas Kandagatla }; 1501af3d54b9SSrinivas Kandagatla 15024f692926SSrinivas Kandagatla static int rx_macro_int_dem_inp_mux_put(struct snd_kcontrol *kcontrol, 15034f692926SSrinivas Kandagatla struct snd_ctl_elem_value *ucontrol) 15044f692926SSrinivas Kandagatla { 15054f692926SSrinivas Kandagatla struct snd_soc_dapm_widget *widget = snd_soc_dapm_kcontrol_widget(kcontrol); 15064f692926SSrinivas Kandagatla struct snd_soc_component *component = snd_soc_dapm_to_component(widget->dapm); 15074f692926SSrinivas Kandagatla struct soc_enum *e = (struct soc_enum *)kcontrol->private_value; 15084f692926SSrinivas Kandagatla unsigned short look_ahead_dly_reg; 15094f692926SSrinivas Kandagatla unsigned int val; 15104f692926SSrinivas Kandagatla 15114f692926SSrinivas Kandagatla val = ucontrol->value.enumerated.item[0]; 15124f692926SSrinivas Kandagatla 15134f692926SSrinivas Kandagatla if (e->reg == CDC_RX_RX0_RX_PATH_CFG1) 15144f692926SSrinivas Kandagatla look_ahead_dly_reg = CDC_RX_RX0_RX_PATH_CFG0; 15154f692926SSrinivas Kandagatla else if (e->reg == CDC_RX_RX1_RX_PATH_CFG1) 15164f692926SSrinivas Kandagatla look_ahead_dly_reg = CDC_RX_RX1_RX_PATH_CFG0; 15174f692926SSrinivas Kandagatla 15184f692926SSrinivas Kandagatla /* Set Look Ahead Delay */ 15194f692926SSrinivas Kandagatla if (val) 15204f692926SSrinivas Kandagatla snd_soc_component_update_bits(component, look_ahead_dly_reg, 15214f692926SSrinivas Kandagatla CDC_RX_DLY_ZN_EN_MASK, 15224f692926SSrinivas Kandagatla CDC_RX_DLY_ZN_ENABLE); 15234f692926SSrinivas Kandagatla else 15244f692926SSrinivas Kandagatla snd_soc_component_update_bits(component, look_ahead_dly_reg, 15254f692926SSrinivas Kandagatla CDC_RX_DLY_ZN_EN_MASK, 0); 15264f692926SSrinivas Kandagatla /* Set DEM INP Select */ 15274f692926SSrinivas Kandagatla return snd_soc_dapm_put_enum_double(kcontrol, ucontrol); 15284f692926SSrinivas Kandagatla } 15294f692926SSrinivas Kandagatla 15304f692926SSrinivas Kandagatla static const struct snd_kcontrol_new rx_int0_dem_inp_mux = 15314f692926SSrinivas Kandagatla SOC_DAPM_ENUM_EXT("rx_int0_dem_inp", rx_int0_dem_inp_enum, 15324f692926SSrinivas Kandagatla snd_soc_dapm_get_enum_double, rx_macro_int_dem_inp_mux_put); 15334f692926SSrinivas Kandagatla static const struct snd_kcontrol_new rx_int1_dem_inp_mux = 15344f692926SSrinivas Kandagatla SOC_DAPM_ENUM_EXT("rx_int1_dem_inp", rx_int1_dem_inp_enum, 15354f692926SSrinivas Kandagatla snd_soc_dapm_get_enum_double, rx_macro_int_dem_inp_mux_put); 15364f692926SSrinivas Kandagatla 1537af3d54b9SSrinivas Kandagatla static int rx_macro_set_prim_interpolator_rate(struct snd_soc_dai *dai, 1538af3d54b9SSrinivas Kandagatla int rate_reg_val, u32 sample_rate) 1539af3d54b9SSrinivas Kandagatla { 1540af3d54b9SSrinivas Kandagatla 1541af3d54b9SSrinivas Kandagatla u8 int_1_mix1_inp; 1542af3d54b9SSrinivas Kandagatla u32 j, port; 1543af3d54b9SSrinivas Kandagatla u16 int_mux_cfg0, int_mux_cfg1; 1544af3d54b9SSrinivas Kandagatla u16 int_fs_reg; 1545af3d54b9SSrinivas Kandagatla u8 inp0_sel, inp1_sel, inp2_sel; 1546af3d54b9SSrinivas Kandagatla struct snd_soc_component *component = dai->component; 1547af3d54b9SSrinivas Kandagatla struct rx_macro *rx = snd_soc_component_get_drvdata(component); 1548af3d54b9SSrinivas Kandagatla 1549af3d54b9SSrinivas Kandagatla for_each_set_bit(port, &rx->active_ch_mask[dai->id], RX_MACRO_PORTS_MAX) { 1550af3d54b9SSrinivas Kandagatla int_1_mix1_inp = port; 1551af3d54b9SSrinivas Kandagatla int_mux_cfg0 = CDC_RX_INP_MUX_RX_INT0_CFG0; 1552af3d54b9SSrinivas Kandagatla /* 1553af3d54b9SSrinivas Kandagatla * Loop through all interpolator MUX inputs and find out 1554af3d54b9SSrinivas Kandagatla * to which interpolator input, the rx port 1555af3d54b9SSrinivas Kandagatla * is connected 1556af3d54b9SSrinivas Kandagatla */ 1557af3d54b9SSrinivas Kandagatla for (j = 0; j < INTERP_MAX; j++) { 1558af3d54b9SSrinivas Kandagatla int_mux_cfg1 = int_mux_cfg0 + 4; 1559af3d54b9SSrinivas Kandagatla 1560af3d54b9SSrinivas Kandagatla inp0_sel = snd_soc_component_read_field(component, int_mux_cfg0, 1561af3d54b9SSrinivas Kandagatla CDC_RX_INTX_1_MIX_INP0_SEL_MASK); 1562af3d54b9SSrinivas Kandagatla inp1_sel = snd_soc_component_read_field(component, int_mux_cfg0, 1563af3d54b9SSrinivas Kandagatla CDC_RX_INTX_1_MIX_INP1_SEL_MASK); 1564af3d54b9SSrinivas Kandagatla inp2_sel = snd_soc_component_read_field(component, int_mux_cfg1, 1565af3d54b9SSrinivas Kandagatla CDC_RX_INTX_1_MIX_INP2_SEL_MASK); 1566af3d54b9SSrinivas Kandagatla 1567af3d54b9SSrinivas Kandagatla if ((inp0_sel == int_1_mix1_inp + INTn_1_INP_SEL_RX0) || 1568af3d54b9SSrinivas Kandagatla (inp1_sel == int_1_mix1_inp + INTn_1_INP_SEL_RX0) || 1569af3d54b9SSrinivas Kandagatla (inp2_sel == int_1_mix1_inp + INTn_1_INP_SEL_RX0)) { 1570af3d54b9SSrinivas Kandagatla int_fs_reg = CDC_RX_RXn_RX_PATH_CTL(j); 1571af3d54b9SSrinivas Kandagatla /* sample_rate is in Hz */ 1572af3d54b9SSrinivas Kandagatla snd_soc_component_update_bits(component, int_fs_reg, 1573af3d54b9SSrinivas Kandagatla CDC_RX_PATH_PCM_RATE_MASK, 1574af3d54b9SSrinivas Kandagatla rate_reg_val); 1575af3d54b9SSrinivas Kandagatla } 1576af3d54b9SSrinivas Kandagatla int_mux_cfg0 += 8; 1577af3d54b9SSrinivas Kandagatla } 1578af3d54b9SSrinivas Kandagatla } 1579af3d54b9SSrinivas Kandagatla 1580af3d54b9SSrinivas Kandagatla return 0; 1581af3d54b9SSrinivas Kandagatla } 1582af3d54b9SSrinivas Kandagatla 1583af3d54b9SSrinivas Kandagatla static int rx_macro_set_mix_interpolator_rate(struct snd_soc_dai *dai, 1584af3d54b9SSrinivas Kandagatla int rate_reg_val, u32 sample_rate) 1585af3d54b9SSrinivas Kandagatla { 1586af3d54b9SSrinivas Kandagatla 1587af3d54b9SSrinivas Kandagatla u8 int_2_inp; 1588af3d54b9SSrinivas Kandagatla u32 j, port; 1589af3d54b9SSrinivas Kandagatla u16 int_mux_cfg1, int_fs_reg; 1590af3d54b9SSrinivas Kandagatla u8 int_mux_cfg1_val; 1591af3d54b9SSrinivas Kandagatla struct snd_soc_component *component = dai->component; 1592af3d54b9SSrinivas Kandagatla struct rx_macro *rx = snd_soc_component_get_drvdata(component); 1593af3d54b9SSrinivas Kandagatla 1594af3d54b9SSrinivas Kandagatla for_each_set_bit(port, &rx->active_ch_mask[dai->id], RX_MACRO_PORTS_MAX) { 1595af3d54b9SSrinivas Kandagatla int_2_inp = port; 1596af3d54b9SSrinivas Kandagatla 1597af3d54b9SSrinivas Kandagatla int_mux_cfg1 = CDC_RX_INP_MUX_RX_INT0_CFG1; 1598af3d54b9SSrinivas Kandagatla for (j = 0; j < INTERP_MAX; j++) { 1599af3d54b9SSrinivas Kandagatla int_mux_cfg1_val = snd_soc_component_read_field(component, int_mux_cfg1, 1600af3d54b9SSrinivas Kandagatla CDC_RX_INTX_2_SEL_MASK); 1601af3d54b9SSrinivas Kandagatla 1602af3d54b9SSrinivas Kandagatla if (int_mux_cfg1_val == int_2_inp + INTn_2_INP_SEL_RX0) { 1603af3d54b9SSrinivas Kandagatla int_fs_reg = CDC_RX_RXn_RX_PATH_MIX_CTL(j); 1604af3d54b9SSrinivas Kandagatla snd_soc_component_update_bits(component, int_fs_reg, 1605af3d54b9SSrinivas Kandagatla CDC_RX_RXn_MIX_PCM_RATE_MASK, 1606af3d54b9SSrinivas Kandagatla rate_reg_val); 1607af3d54b9SSrinivas Kandagatla } 1608af3d54b9SSrinivas Kandagatla int_mux_cfg1 += 8; 1609af3d54b9SSrinivas Kandagatla } 1610af3d54b9SSrinivas Kandagatla } 1611af3d54b9SSrinivas Kandagatla return 0; 1612af3d54b9SSrinivas Kandagatla } 1613af3d54b9SSrinivas Kandagatla 1614af3d54b9SSrinivas Kandagatla static int rx_macro_set_interpolator_rate(struct snd_soc_dai *dai, 1615af3d54b9SSrinivas Kandagatla u32 sample_rate) 1616af3d54b9SSrinivas Kandagatla { 1617af3d54b9SSrinivas Kandagatla int rate_val = 0; 1618af3d54b9SSrinivas Kandagatla int i, ret; 1619af3d54b9SSrinivas Kandagatla 1620af3d54b9SSrinivas Kandagatla for (i = 0; i < ARRAY_SIZE(sr_val_tbl); i++) 1621af3d54b9SSrinivas Kandagatla if (sample_rate == sr_val_tbl[i].sample_rate) 1622af3d54b9SSrinivas Kandagatla rate_val = sr_val_tbl[i].rate_val; 1623af3d54b9SSrinivas Kandagatla 1624af3d54b9SSrinivas Kandagatla ret = rx_macro_set_prim_interpolator_rate(dai, rate_val, sample_rate); 1625af3d54b9SSrinivas Kandagatla if (ret) 1626af3d54b9SSrinivas Kandagatla return ret; 1627af3d54b9SSrinivas Kandagatla 1628af3d54b9SSrinivas Kandagatla ret = rx_macro_set_mix_interpolator_rate(dai, rate_val, sample_rate); 1629af3d54b9SSrinivas Kandagatla 1630af3d54b9SSrinivas Kandagatla return ret; 1631af3d54b9SSrinivas Kandagatla } 1632af3d54b9SSrinivas Kandagatla 1633af3d54b9SSrinivas Kandagatla static int rx_macro_hw_params(struct snd_pcm_substream *substream, 1634af3d54b9SSrinivas Kandagatla struct snd_pcm_hw_params *params, 1635af3d54b9SSrinivas Kandagatla struct snd_soc_dai *dai) 1636af3d54b9SSrinivas Kandagatla { 1637af3d54b9SSrinivas Kandagatla struct snd_soc_component *component = dai->component; 1638af3d54b9SSrinivas Kandagatla struct rx_macro *rx = snd_soc_component_get_drvdata(component); 1639af3d54b9SSrinivas Kandagatla int ret; 1640af3d54b9SSrinivas Kandagatla 1641af3d54b9SSrinivas Kandagatla switch (substream->stream) { 1642af3d54b9SSrinivas Kandagatla case SNDRV_PCM_STREAM_PLAYBACK: 1643af3d54b9SSrinivas Kandagatla ret = rx_macro_set_interpolator_rate(dai, params_rate(params)); 1644af3d54b9SSrinivas Kandagatla if (ret) { 1645af3d54b9SSrinivas Kandagatla dev_err(component->dev, "%s: cannot set sample rate: %u\n", 1646af3d54b9SSrinivas Kandagatla __func__, params_rate(params)); 1647af3d54b9SSrinivas Kandagatla return ret; 1648af3d54b9SSrinivas Kandagatla } 1649af3d54b9SSrinivas Kandagatla rx->bit_width[dai->id] = params_width(params); 1650af3d54b9SSrinivas Kandagatla break; 1651af3d54b9SSrinivas Kandagatla default: 1652af3d54b9SSrinivas Kandagatla break; 1653af3d54b9SSrinivas Kandagatla } 1654af3d54b9SSrinivas Kandagatla return 0; 1655af3d54b9SSrinivas Kandagatla } 1656af3d54b9SSrinivas Kandagatla 1657af3d54b9SSrinivas Kandagatla static int rx_macro_get_channel_map(struct snd_soc_dai *dai, 1658af3d54b9SSrinivas Kandagatla unsigned int *tx_num, unsigned int *tx_slot, 1659af3d54b9SSrinivas Kandagatla unsigned int *rx_num, unsigned int *rx_slot) 1660af3d54b9SSrinivas Kandagatla { 1661af3d54b9SSrinivas Kandagatla struct snd_soc_component *component = dai->component; 1662af3d54b9SSrinivas Kandagatla struct rx_macro *rx = snd_soc_component_get_drvdata(component); 1663af3d54b9SSrinivas Kandagatla u16 val, mask = 0, cnt = 0, temp; 1664af3d54b9SSrinivas Kandagatla 1665af3d54b9SSrinivas Kandagatla switch (dai->id) { 1666af3d54b9SSrinivas Kandagatla case RX_MACRO_AIF1_PB: 1667af3d54b9SSrinivas Kandagatla case RX_MACRO_AIF2_PB: 1668af3d54b9SSrinivas Kandagatla case RX_MACRO_AIF3_PB: 1669af3d54b9SSrinivas Kandagatla case RX_MACRO_AIF4_PB: 1670af3d54b9SSrinivas Kandagatla for_each_set_bit(temp, &rx->active_ch_mask[dai->id], 1671af3d54b9SSrinivas Kandagatla RX_MACRO_PORTS_MAX) { 1672af3d54b9SSrinivas Kandagatla mask |= (1 << temp); 1673af3d54b9SSrinivas Kandagatla if (++cnt == RX_MACRO_MAX_DMA_CH_PER_PORT) 1674af3d54b9SSrinivas Kandagatla break; 1675af3d54b9SSrinivas Kandagatla } 1676af3d54b9SSrinivas Kandagatla /* 1677af3d54b9SSrinivas Kandagatla * CDC_DMA_RX_0 port drives RX0/RX1 -- ch_mask 0x1/0x2/0x3 1678af3d54b9SSrinivas Kandagatla * CDC_DMA_RX_1 port drives RX2/RX3 -- ch_mask 0x1/0x2/0x3 1679af3d54b9SSrinivas Kandagatla * CDC_DMA_RX_2 port drives RX4 -- ch_mask 0x1 1680af3d54b9SSrinivas Kandagatla * CDC_DMA_RX_3 port drives RX5 -- ch_mask 0x1 1681af3d54b9SSrinivas Kandagatla * AIFn can pair to any CDC_DMA_RX_n port. 1682af3d54b9SSrinivas Kandagatla * In general, below convention is used:: 1683af3d54b9SSrinivas Kandagatla * CDC_DMA_RX_0(AIF1)/CDC_DMA_RX_1(AIF2)/ 1684af3d54b9SSrinivas Kandagatla * CDC_DMA_RX_2(AIF3)/CDC_DMA_RX_3(AIF4) 1685af3d54b9SSrinivas Kandagatla */ 1686af3d54b9SSrinivas Kandagatla if (mask & 0x0C) 1687af3d54b9SSrinivas Kandagatla mask = mask >> 2; 1688af3d54b9SSrinivas Kandagatla if ((mask & 0x10) || (mask & 0x20)) 1689af3d54b9SSrinivas Kandagatla mask = 0x1; 1690af3d54b9SSrinivas Kandagatla *rx_slot = mask; 1691af3d54b9SSrinivas Kandagatla *rx_num = rx->active_ch_cnt[dai->id]; 1692af3d54b9SSrinivas Kandagatla break; 1693af3d54b9SSrinivas Kandagatla case RX_MACRO_AIF_ECHO: 1694af3d54b9SSrinivas Kandagatla val = snd_soc_component_read(component, CDC_RX_INP_MUX_RX_MIX_CFG4); 1695af3d54b9SSrinivas Kandagatla if (val & RX_MACRO_EC_MIX_TX0_MASK) { 1696af3d54b9SSrinivas Kandagatla mask |= 0x1; 1697af3d54b9SSrinivas Kandagatla cnt++; 1698af3d54b9SSrinivas Kandagatla } 1699af3d54b9SSrinivas Kandagatla if (val & RX_MACRO_EC_MIX_TX1_MASK) { 1700af3d54b9SSrinivas Kandagatla mask |= 0x2; 1701af3d54b9SSrinivas Kandagatla cnt++; 1702af3d54b9SSrinivas Kandagatla } 1703af3d54b9SSrinivas Kandagatla val = snd_soc_component_read(component, 1704af3d54b9SSrinivas Kandagatla CDC_RX_INP_MUX_RX_MIX_CFG5); 1705af3d54b9SSrinivas Kandagatla if (val & RX_MACRO_EC_MIX_TX2_MASK) { 1706af3d54b9SSrinivas Kandagatla mask |= 0x4; 1707af3d54b9SSrinivas Kandagatla cnt++; 1708af3d54b9SSrinivas Kandagatla } 1709af3d54b9SSrinivas Kandagatla *tx_slot = mask; 1710af3d54b9SSrinivas Kandagatla *tx_num = cnt; 1711af3d54b9SSrinivas Kandagatla break; 1712af3d54b9SSrinivas Kandagatla default: 1713af3d54b9SSrinivas Kandagatla dev_err(component->dev, "%s: Invalid AIF\n", __func__); 1714af3d54b9SSrinivas Kandagatla break; 1715af3d54b9SSrinivas Kandagatla } 1716af3d54b9SSrinivas Kandagatla return 0; 1717af3d54b9SSrinivas Kandagatla } 1718af3d54b9SSrinivas Kandagatla 1719af3d54b9SSrinivas Kandagatla static int rx_macro_digital_mute(struct snd_soc_dai *dai, int mute, int stream) 1720af3d54b9SSrinivas Kandagatla { 1721af3d54b9SSrinivas Kandagatla struct snd_soc_component *component = dai->component; 1722af3d54b9SSrinivas Kandagatla uint16_t j, reg, mix_reg, dsm_reg; 1723af3d54b9SSrinivas Kandagatla u16 int_mux_cfg0, int_mux_cfg1; 1724af3d54b9SSrinivas Kandagatla u8 int_mux_cfg0_val, int_mux_cfg1_val; 1725af3d54b9SSrinivas Kandagatla 1726af3d54b9SSrinivas Kandagatla switch (dai->id) { 1727af3d54b9SSrinivas Kandagatla case RX_MACRO_AIF1_PB: 1728af3d54b9SSrinivas Kandagatla case RX_MACRO_AIF2_PB: 1729af3d54b9SSrinivas Kandagatla case RX_MACRO_AIF3_PB: 1730af3d54b9SSrinivas Kandagatla case RX_MACRO_AIF4_PB: 1731af3d54b9SSrinivas Kandagatla for (j = 0; j < INTERP_MAX; j++) { 1732af3d54b9SSrinivas Kandagatla reg = CDC_RX_RXn_RX_PATH_CTL(j); 1733af3d54b9SSrinivas Kandagatla mix_reg = CDC_RX_RXn_RX_PATH_MIX_CTL(j); 1734af3d54b9SSrinivas Kandagatla dsm_reg = CDC_RX_RXn_RX_PATH_DSM_CTL(j); 1735af3d54b9SSrinivas Kandagatla 1736af3d54b9SSrinivas Kandagatla if (mute) { 1737af3d54b9SSrinivas Kandagatla snd_soc_component_update_bits(component, reg, 1738af3d54b9SSrinivas Kandagatla CDC_RX_PATH_PGA_MUTE_MASK, 1739af3d54b9SSrinivas Kandagatla CDC_RX_PATH_PGA_MUTE_ENABLE); 1740af3d54b9SSrinivas Kandagatla snd_soc_component_update_bits(component, mix_reg, 1741af3d54b9SSrinivas Kandagatla CDC_RX_PATH_PGA_MUTE_MASK, 1742af3d54b9SSrinivas Kandagatla CDC_RX_PATH_PGA_MUTE_ENABLE); 1743af3d54b9SSrinivas Kandagatla } else { 1744af3d54b9SSrinivas Kandagatla snd_soc_component_update_bits(component, reg, 1745af3d54b9SSrinivas Kandagatla CDC_RX_PATH_PGA_MUTE_MASK, 0x0); 1746af3d54b9SSrinivas Kandagatla snd_soc_component_update_bits(component, mix_reg, 1747af3d54b9SSrinivas Kandagatla CDC_RX_PATH_PGA_MUTE_MASK, 0x0); 1748af3d54b9SSrinivas Kandagatla } 1749af3d54b9SSrinivas Kandagatla 1750af3d54b9SSrinivas Kandagatla if (j == INTERP_AUX) 1751af3d54b9SSrinivas Kandagatla dsm_reg = CDC_RX_RX2_RX_PATH_DSM_CTL; 1752af3d54b9SSrinivas Kandagatla 1753af3d54b9SSrinivas Kandagatla int_mux_cfg0 = CDC_RX_INP_MUX_RX_INT0_CFG0 + j * 8; 1754af3d54b9SSrinivas Kandagatla int_mux_cfg1 = int_mux_cfg0 + 4; 1755af3d54b9SSrinivas Kandagatla int_mux_cfg0_val = snd_soc_component_read(component, int_mux_cfg0); 1756af3d54b9SSrinivas Kandagatla int_mux_cfg1_val = snd_soc_component_read(component, int_mux_cfg1); 1757af3d54b9SSrinivas Kandagatla 1758af3d54b9SSrinivas Kandagatla if (snd_soc_component_read(component, dsm_reg) & 0x01) { 1759af3d54b9SSrinivas Kandagatla if (int_mux_cfg0_val || (int_mux_cfg1_val & 0xF0)) 1760af3d54b9SSrinivas Kandagatla snd_soc_component_update_bits(component, reg, 0x20, 0x20); 1761af3d54b9SSrinivas Kandagatla if (int_mux_cfg1_val & 0x0F) { 1762af3d54b9SSrinivas Kandagatla snd_soc_component_update_bits(component, reg, 0x20, 0x20); 1763622d9ac3SColin Ian King snd_soc_component_update_bits(component, mix_reg, 0x20, 1764622d9ac3SColin Ian King 0x20); 1765af3d54b9SSrinivas Kandagatla } 1766af3d54b9SSrinivas Kandagatla } 1767af3d54b9SSrinivas Kandagatla } 1768af3d54b9SSrinivas Kandagatla break; 1769af3d54b9SSrinivas Kandagatla default: 1770af3d54b9SSrinivas Kandagatla break; 1771af3d54b9SSrinivas Kandagatla } 1772af3d54b9SSrinivas Kandagatla return 0; 1773af3d54b9SSrinivas Kandagatla } 1774af3d54b9SSrinivas Kandagatla 1775857b602aSYe Bin static const struct snd_soc_dai_ops rx_macro_dai_ops = { 1776af3d54b9SSrinivas Kandagatla .hw_params = rx_macro_hw_params, 1777af3d54b9SSrinivas Kandagatla .get_channel_map = rx_macro_get_channel_map, 1778af3d54b9SSrinivas Kandagatla .mute_stream = rx_macro_digital_mute, 1779af3d54b9SSrinivas Kandagatla }; 1780af3d54b9SSrinivas Kandagatla 1781af3d54b9SSrinivas Kandagatla static struct snd_soc_dai_driver rx_macro_dai[] = { 1782af3d54b9SSrinivas Kandagatla { 1783af3d54b9SSrinivas Kandagatla .name = "rx_macro_rx1", 1784af3d54b9SSrinivas Kandagatla .id = RX_MACRO_AIF1_PB, 1785af3d54b9SSrinivas Kandagatla .playback = { 1786af3d54b9SSrinivas Kandagatla .stream_name = "RX_MACRO_AIF1 Playback", 1787af3d54b9SSrinivas Kandagatla .rates = RX_MACRO_RATES | RX_MACRO_FRAC_RATES, 1788af3d54b9SSrinivas Kandagatla .formats = RX_MACRO_FORMATS, 1789af3d54b9SSrinivas Kandagatla .rate_max = 384000, 1790af3d54b9SSrinivas Kandagatla .rate_min = 8000, 1791af3d54b9SSrinivas Kandagatla .channels_min = 1, 1792af3d54b9SSrinivas Kandagatla .channels_max = 2, 1793af3d54b9SSrinivas Kandagatla }, 1794af3d54b9SSrinivas Kandagatla .ops = &rx_macro_dai_ops, 1795af3d54b9SSrinivas Kandagatla }, 1796af3d54b9SSrinivas Kandagatla { 1797af3d54b9SSrinivas Kandagatla .name = "rx_macro_rx2", 1798af3d54b9SSrinivas Kandagatla .id = RX_MACRO_AIF2_PB, 1799af3d54b9SSrinivas Kandagatla .playback = { 1800af3d54b9SSrinivas Kandagatla .stream_name = "RX_MACRO_AIF2 Playback", 1801af3d54b9SSrinivas Kandagatla .rates = RX_MACRO_RATES | RX_MACRO_FRAC_RATES, 1802af3d54b9SSrinivas Kandagatla .formats = RX_MACRO_FORMATS, 1803af3d54b9SSrinivas Kandagatla .rate_max = 384000, 1804af3d54b9SSrinivas Kandagatla .rate_min = 8000, 1805af3d54b9SSrinivas Kandagatla .channels_min = 1, 1806af3d54b9SSrinivas Kandagatla .channels_max = 2, 1807af3d54b9SSrinivas Kandagatla }, 1808af3d54b9SSrinivas Kandagatla .ops = &rx_macro_dai_ops, 1809af3d54b9SSrinivas Kandagatla }, 1810af3d54b9SSrinivas Kandagatla { 1811af3d54b9SSrinivas Kandagatla .name = "rx_macro_rx3", 1812af3d54b9SSrinivas Kandagatla .id = RX_MACRO_AIF3_PB, 1813af3d54b9SSrinivas Kandagatla .playback = { 1814af3d54b9SSrinivas Kandagatla .stream_name = "RX_MACRO_AIF3 Playback", 1815af3d54b9SSrinivas Kandagatla .rates = RX_MACRO_RATES | RX_MACRO_FRAC_RATES, 1816af3d54b9SSrinivas Kandagatla .formats = RX_MACRO_FORMATS, 1817af3d54b9SSrinivas Kandagatla .rate_max = 384000, 1818af3d54b9SSrinivas Kandagatla .rate_min = 8000, 1819af3d54b9SSrinivas Kandagatla .channels_min = 1, 1820af3d54b9SSrinivas Kandagatla .channels_max = 2, 1821af3d54b9SSrinivas Kandagatla }, 1822af3d54b9SSrinivas Kandagatla .ops = &rx_macro_dai_ops, 1823af3d54b9SSrinivas Kandagatla }, 1824af3d54b9SSrinivas Kandagatla { 1825af3d54b9SSrinivas Kandagatla .name = "rx_macro_rx4", 1826af3d54b9SSrinivas Kandagatla .id = RX_MACRO_AIF4_PB, 1827af3d54b9SSrinivas Kandagatla .playback = { 1828af3d54b9SSrinivas Kandagatla .stream_name = "RX_MACRO_AIF4 Playback", 1829af3d54b9SSrinivas Kandagatla .rates = RX_MACRO_RATES | RX_MACRO_FRAC_RATES, 1830af3d54b9SSrinivas Kandagatla .formats = RX_MACRO_FORMATS, 1831af3d54b9SSrinivas Kandagatla .rate_max = 384000, 1832af3d54b9SSrinivas Kandagatla .rate_min = 8000, 1833af3d54b9SSrinivas Kandagatla .channels_min = 1, 1834af3d54b9SSrinivas Kandagatla .channels_max = 2, 1835af3d54b9SSrinivas Kandagatla }, 1836af3d54b9SSrinivas Kandagatla .ops = &rx_macro_dai_ops, 1837af3d54b9SSrinivas Kandagatla }, 1838af3d54b9SSrinivas Kandagatla { 1839af3d54b9SSrinivas Kandagatla .name = "rx_macro_echo", 1840af3d54b9SSrinivas Kandagatla .id = RX_MACRO_AIF_ECHO, 1841af3d54b9SSrinivas Kandagatla .capture = { 1842af3d54b9SSrinivas Kandagatla .stream_name = "RX_AIF_ECHO Capture", 1843af3d54b9SSrinivas Kandagatla .rates = RX_MACRO_ECHO_RATES, 1844af3d54b9SSrinivas Kandagatla .formats = RX_MACRO_ECHO_FORMATS, 1845af3d54b9SSrinivas Kandagatla .rate_max = 48000, 1846af3d54b9SSrinivas Kandagatla .rate_min = 8000, 1847af3d54b9SSrinivas Kandagatla .channels_min = 1, 1848af3d54b9SSrinivas Kandagatla .channels_max = 3, 1849af3d54b9SSrinivas Kandagatla }, 1850af3d54b9SSrinivas Kandagatla .ops = &rx_macro_dai_ops, 1851af3d54b9SSrinivas Kandagatla }, 1852af3d54b9SSrinivas Kandagatla }; 1853af3d54b9SSrinivas Kandagatla 1854af3d54b9SSrinivas Kandagatla static void rx_macro_mclk_enable(struct rx_macro *rx, bool mclk_enable) 1855af3d54b9SSrinivas Kandagatla { 1856af3d54b9SSrinivas Kandagatla struct regmap *regmap = rx->regmap; 1857af3d54b9SSrinivas Kandagatla 1858af3d54b9SSrinivas Kandagatla if (mclk_enable) { 1859af3d54b9SSrinivas Kandagatla if (rx->rx_mclk_users == 0) { 1860af3d54b9SSrinivas Kandagatla regmap_update_bits(regmap, CDC_RX_CLK_RST_CTRL_MCLK_CONTROL, 1861af3d54b9SSrinivas Kandagatla CDC_RX_CLK_MCLK_EN_MASK | 1862af3d54b9SSrinivas Kandagatla CDC_RX_CLK_MCLK2_EN_MASK, 1863af3d54b9SSrinivas Kandagatla CDC_RX_CLK_MCLK_ENABLE | 1864af3d54b9SSrinivas Kandagatla CDC_RX_CLK_MCLK2_ENABLE); 1865af3d54b9SSrinivas Kandagatla regmap_update_bits(regmap, CDC_RX_CLK_RST_CTRL_FS_CNT_CONTROL, 1866af3d54b9SSrinivas Kandagatla CDC_RX_FS_MCLK_CNT_CLR_MASK, 0x00); 1867af3d54b9SSrinivas Kandagatla regmap_update_bits(regmap, CDC_RX_CLK_RST_CTRL_FS_CNT_CONTROL, 1868af3d54b9SSrinivas Kandagatla CDC_RX_FS_MCLK_CNT_EN_MASK, 1869af3d54b9SSrinivas Kandagatla CDC_RX_FS_MCLK_CNT_ENABLE); 1870af3d54b9SSrinivas Kandagatla regcache_mark_dirty(regmap); 1871af3d54b9SSrinivas Kandagatla regcache_sync(regmap); 1872af3d54b9SSrinivas Kandagatla } 1873af3d54b9SSrinivas Kandagatla rx->rx_mclk_users++; 1874af3d54b9SSrinivas Kandagatla } else { 1875af3d54b9SSrinivas Kandagatla if (rx->rx_mclk_users <= 0) { 1876af3d54b9SSrinivas Kandagatla dev_err(rx->dev, "%s: clock already disabled\n", __func__); 1877af3d54b9SSrinivas Kandagatla rx->rx_mclk_users = 0; 1878af3d54b9SSrinivas Kandagatla return; 1879af3d54b9SSrinivas Kandagatla } 1880af3d54b9SSrinivas Kandagatla rx->rx_mclk_users--; 1881af3d54b9SSrinivas Kandagatla if (rx->rx_mclk_users == 0) { 1882af3d54b9SSrinivas Kandagatla regmap_update_bits(regmap, CDC_RX_CLK_RST_CTRL_FS_CNT_CONTROL, 1883af3d54b9SSrinivas Kandagatla CDC_RX_FS_MCLK_CNT_EN_MASK, 0x0); 1884af3d54b9SSrinivas Kandagatla regmap_update_bits(regmap, CDC_RX_CLK_RST_CTRL_FS_CNT_CONTROL, 1885af3d54b9SSrinivas Kandagatla CDC_RX_FS_MCLK_CNT_CLR_MASK, 1886af3d54b9SSrinivas Kandagatla CDC_RX_FS_MCLK_CNT_CLR); 1887af3d54b9SSrinivas Kandagatla regmap_update_bits(regmap, CDC_RX_CLK_RST_CTRL_MCLK_CONTROL, 1888af3d54b9SSrinivas Kandagatla CDC_RX_CLK_MCLK_EN_MASK | 1889af3d54b9SSrinivas Kandagatla CDC_RX_CLK_MCLK2_EN_MASK, 0x0); 1890af3d54b9SSrinivas Kandagatla } 1891af3d54b9SSrinivas Kandagatla } 1892af3d54b9SSrinivas Kandagatla } 1893af3d54b9SSrinivas Kandagatla 18944f692926SSrinivas Kandagatla static int rx_macro_mclk_event(struct snd_soc_dapm_widget *w, 18954f692926SSrinivas Kandagatla struct snd_kcontrol *kcontrol, int event) 18964f692926SSrinivas Kandagatla { 18974f692926SSrinivas Kandagatla struct snd_soc_component *component = snd_soc_dapm_to_component(w->dapm); 18984f692926SSrinivas Kandagatla struct rx_macro *rx = snd_soc_component_get_drvdata(component); 18994f692926SSrinivas Kandagatla int ret = 0; 19004f692926SSrinivas Kandagatla 19014f692926SSrinivas Kandagatla switch (event) { 19024f692926SSrinivas Kandagatla case SND_SOC_DAPM_PRE_PMU: 19034f692926SSrinivas Kandagatla rx_macro_mclk_enable(rx, true); 19044f692926SSrinivas Kandagatla break; 19054f692926SSrinivas Kandagatla case SND_SOC_DAPM_POST_PMD: 19064f692926SSrinivas Kandagatla rx_macro_mclk_enable(rx, false); 19074f692926SSrinivas Kandagatla break; 19084f692926SSrinivas Kandagatla default: 19094f692926SSrinivas Kandagatla dev_err(component->dev, "%s: invalid DAPM event %d\n", __func__, event); 19104f692926SSrinivas Kandagatla ret = -EINVAL; 19114f692926SSrinivas Kandagatla } 19124f692926SSrinivas Kandagatla return ret; 19134f692926SSrinivas Kandagatla } 19144f692926SSrinivas Kandagatla 19154f692926SSrinivas Kandagatla static bool rx_macro_adie_lb(struct snd_soc_component *component, 19164f692926SSrinivas Kandagatla int interp_idx) 19174f692926SSrinivas Kandagatla { 19184f692926SSrinivas Kandagatla u16 int_mux_cfg0, int_mux_cfg1; 19194f692926SSrinivas Kandagatla u8 int_n_inp0, int_n_inp1, int_n_inp2; 19204f692926SSrinivas Kandagatla 19214f692926SSrinivas Kandagatla int_mux_cfg0 = CDC_RX_INP_MUX_RX_INT0_CFG0 + interp_idx * 8; 19224f692926SSrinivas Kandagatla int_mux_cfg1 = int_mux_cfg0 + 4; 19234f692926SSrinivas Kandagatla 19244f692926SSrinivas Kandagatla int_n_inp0 = snd_soc_component_read_field(component, int_mux_cfg0, 19254f692926SSrinivas Kandagatla CDC_RX_INTX_1_MIX_INP0_SEL_MASK); 19264f692926SSrinivas Kandagatla int_n_inp1 = snd_soc_component_read_field(component, int_mux_cfg0, 19274f692926SSrinivas Kandagatla CDC_RX_INTX_1_MIX_INP1_SEL_MASK); 19284f692926SSrinivas Kandagatla int_n_inp2 = snd_soc_component_read_field(component, int_mux_cfg1, 19294f692926SSrinivas Kandagatla CDC_RX_INTX_1_MIX_INP2_SEL_MASK); 19304f692926SSrinivas Kandagatla 19314f692926SSrinivas Kandagatla if (int_n_inp0 == INTn_1_INP_SEL_DEC0 || 19324f692926SSrinivas Kandagatla int_n_inp0 == INTn_1_INP_SEL_DEC1 || 19334f692926SSrinivas Kandagatla int_n_inp0 == INTn_1_INP_SEL_IIR0 || 19344f692926SSrinivas Kandagatla int_n_inp0 == INTn_1_INP_SEL_IIR1) 19354f692926SSrinivas Kandagatla return true; 19364f692926SSrinivas Kandagatla 19374f692926SSrinivas Kandagatla if (int_n_inp1 == INTn_1_INP_SEL_DEC0 || 19384f692926SSrinivas Kandagatla int_n_inp1 == INTn_1_INP_SEL_DEC1 || 19394f692926SSrinivas Kandagatla int_n_inp1 == INTn_1_INP_SEL_IIR0 || 19404f692926SSrinivas Kandagatla int_n_inp1 == INTn_1_INP_SEL_IIR1) 19414f692926SSrinivas Kandagatla return true; 19424f692926SSrinivas Kandagatla 19434f692926SSrinivas Kandagatla if (int_n_inp2 == INTn_1_INP_SEL_DEC0 || 19444f692926SSrinivas Kandagatla int_n_inp2 == INTn_1_INP_SEL_DEC1 || 19454f692926SSrinivas Kandagatla int_n_inp2 == INTn_1_INP_SEL_IIR0 || 19464f692926SSrinivas Kandagatla int_n_inp2 == INTn_1_INP_SEL_IIR1) 19474f692926SSrinivas Kandagatla return true; 19484f692926SSrinivas Kandagatla 19494f692926SSrinivas Kandagatla return false; 19504f692926SSrinivas Kandagatla } 19514f692926SSrinivas Kandagatla 19524f692926SSrinivas Kandagatla static int rx_macro_enable_interp_clk(struct snd_soc_component *component, 19534f692926SSrinivas Kandagatla int event, int interp_idx); 19544f692926SSrinivas Kandagatla static int rx_macro_enable_main_path(struct snd_soc_dapm_widget *w, 19554f692926SSrinivas Kandagatla struct snd_kcontrol *kcontrol, 19564f692926SSrinivas Kandagatla int event) 19574f692926SSrinivas Kandagatla { 19584f692926SSrinivas Kandagatla struct snd_soc_component *component = snd_soc_dapm_to_component(w->dapm); 19594f692926SSrinivas Kandagatla u16 gain_reg, reg; 19604f692926SSrinivas Kandagatla 19614f692926SSrinivas Kandagatla reg = CDC_RX_RXn_RX_PATH_CTL(w->shift); 19624f692926SSrinivas Kandagatla gain_reg = CDC_RX_RXn_RX_VOL_CTL(w->shift); 19634f692926SSrinivas Kandagatla 19644f692926SSrinivas Kandagatla switch (event) { 19654f692926SSrinivas Kandagatla case SND_SOC_DAPM_PRE_PMU: 19664f692926SSrinivas Kandagatla rx_macro_enable_interp_clk(component, event, w->shift); 19674f692926SSrinivas Kandagatla if (rx_macro_adie_lb(component, w->shift)) 19684f692926SSrinivas Kandagatla snd_soc_component_update_bits(component, reg, 19694f692926SSrinivas Kandagatla CDC_RX_PATH_CLK_EN_MASK, 19704f692926SSrinivas Kandagatla CDC_RX_PATH_CLK_ENABLE); 19714f692926SSrinivas Kandagatla break; 19724f692926SSrinivas Kandagatla case SND_SOC_DAPM_POST_PMU: 19734f692926SSrinivas Kandagatla snd_soc_component_write(component, gain_reg, 19744f692926SSrinivas Kandagatla snd_soc_component_read(component, gain_reg)); 19754f692926SSrinivas Kandagatla break; 19764f692926SSrinivas Kandagatla case SND_SOC_DAPM_POST_PMD: 19774f692926SSrinivas Kandagatla rx_macro_enable_interp_clk(component, event, w->shift); 19784f692926SSrinivas Kandagatla break; 19794f692926SSrinivas Kandagatla } 19804f692926SSrinivas Kandagatla 19814f692926SSrinivas Kandagatla return 0; 19824f692926SSrinivas Kandagatla } 19834f692926SSrinivas Kandagatla 19844f692926SSrinivas Kandagatla static int rx_macro_config_compander(struct snd_soc_component *component, 19854f692926SSrinivas Kandagatla struct rx_macro *rx, 19864f692926SSrinivas Kandagatla int comp, int event) 19874f692926SSrinivas Kandagatla { 19884f692926SSrinivas Kandagatla u8 pcm_rate, val; 19894f692926SSrinivas Kandagatla 19904f692926SSrinivas Kandagatla /* AUX does not have compander */ 19914f692926SSrinivas Kandagatla if (comp == INTERP_AUX) 19924f692926SSrinivas Kandagatla return 0; 19934f692926SSrinivas Kandagatla 19944f692926SSrinivas Kandagatla pcm_rate = snd_soc_component_read(component, CDC_RX_RXn_RX_PATH_CTL(comp)) & 0x0F; 19954f692926SSrinivas Kandagatla if (pcm_rate < 0x06) 19964f692926SSrinivas Kandagatla val = 0x03; 19974f692926SSrinivas Kandagatla else if (pcm_rate < 0x08) 19984f692926SSrinivas Kandagatla val = 0x01; 19994f692926SSrinivas Kandagatla else if (pcm_rate < 0x0B) 20004f692926SSrinivas Kandagatla val = 0x02; 20014f692926SSrinivas Kandagatla else 20024f692926SSrinivas Kandagatla val = 0x00; 20034f692926SSrinivas Kandagatla 20044f692926SSrinivas Kandagatla if (SND_SOC_DAPM_EVENT_ON(event)) 20054f692926SSrinivas Kandagatla snd_soc_component_update_bits(component, CDC_RX_RXn_RX_PATH_CFG3(comp), 20064f692926SSrinivas Kandagatla CDC_RX_DC_COEFF_SEL_MASK, val); 20074f692926SSrinivas Kandagatla 20084f692926SSrinivas Kandagatla if (SND_SOC_DAPM_EVENT_OFF(event)) 20094f692926SSrinivas Kandagatla snd_soc_component_update_bits(component, CDC_RX_RXn_RX_PATH_CFG3(comp), 20104f692926SSrinivas Kandagatla CDC_RX_DC_COEFF_SEL_MASK, 0x3); 20114f692926SSrinivas Kandagatla if (!rx->comp_enabled[comp]) 20124f692926SSrinivas Kandagatla return 0; 20134f692926SSrinivas Kandagatla 20144f692926SSrinivas Kandagatla if (SND_SOC_DAPM_EVENT_ON(event)) { 20154f692926SSrinivas Kandagatla /* Enable Compander Clock */ 20164f692926SSrinivas Kandagatla snd_soc_component_write_field(component, CDC_RX_COMPANDERn_CTL0(comp), 20174f692926SSrinivas Kandagatla CDC_RX_COMPANDERn_CLK_EN_MASK, 0x1); 20184f692926SSrinivas Kandagatla snd_soc_component_write_field(component, CDC_RX_COMPANDERn_CTL0(comp), 20194f692926SSrinivas Kandagatla CDC_RX_COMPANDERn_SOFT_RST_MASK, 0x1); 20204f692926SSrinivas Kandagatla snd_soc_component_write_field(component, CDC_RX_COMPANDERn_CTL0(comp), 20214f692926SSrinivas Kandagatla CDC_RX_COMPANDERn_SOFT_RST_MASK, 0x0); 20224f692926SSrinivas Kandagatla snd_soc_component_write_field(component, CDC_RX_RXn_RX_PATH_CFG0(comp), 20234f692926SSrinivas Kandagatla CDC_RX_RXn_COMP_EN_MASK, 0x1); 20244f692926SSrinivas Kandagatla } 20254f692926SSrinivas Kandagatla 20264f692926SSrinivas Kandagatla if (SND_SOC_DAPM_EVENT_OFF(event)) { 20274f692926SSrinivas Kandagatla snd_soc_component_write_field(component, CDC_RX_COMPANDERn_CTL0(comp), 20284f692926SSrinivas Kandagatla CDC_RX_COMPANDERn_HALT_MASK, 0x1); 20294f692926SSrinivas Kandagatla snd_soc_component_write_field(component, CDC_RX_RXn_RX_PATH_CFG0(comp), 20304f692926SSrinivas Kandagatla CDC_RX_RXn_COMP_EN_MASK, 0x0); 20314f692926SSrinivas Kandagatla snd_soc_component_write_field(component, CDC_RX_COMPANDERn_CTL0(comp), 20324f692926SSrinivas Kandagatla CDC_RX_COMPANDERn_CLK_EN_MASK, 0x0); 20334f692926SSrinivas Kandagatla snd_soc_component_write_field(component, CDC_RX_COMPANDERn_CTL0(comp), 20344f692926SSrinivas Kandagatla CDC_RX_COMPANDERn_HALT_MASK, 0x0); 20354f692926SSrinivas Kandagatla } 20364f692926SSrinivas Kandagatla 20374f692926SSrinivas Kandagatla return 0; 20384f692926SSrinivas Kandagatla } 20394f692926SSrinivas Kandagatla 20404f692926SSrinivas Kandagatla static int rx_macro_load_compander_coeff(struct snd_soc_component *component, 20414f692926SSrinivas Kandagatla struct rx_macro *rx, 20424f692926SSrinivas Kandagatla int comp, int event) 20434f692926SSrinivas Kandagatla { 20444f692926SSrinivas Kandagatla u16 comp_coeff_lsb_reg, comp_coeff_msb_reg; 20454f692926SSrinivas Kandagatla int i; 2046ff568785SColin Ian King int hph_pwr_mode; 20474f692926SSrinivas Kandagatla 204842c709c4SSrinivas Kandagatla /* AUX does not have compander */ 204942c709c4SSrinivas Kandagatla if (comp == INTERP_AUX) 205042c709c4SSrinivas Kandagatla return 0; 205142c709c4SSrinivas Kandagatla 20524f692926SSrinivas Kandagatla if (!rx->comp_enabled[comp]) 20534f692926SSrinivas Kandagatla return 0; 20544f692926SSrinivas Kandagatla 20554f692926SSrinivas Kandagatla if (comp == INTERP_HPHL) { 20564f692926SSrinivas Kandagatla comp_coeff_lsb_reg = CDC_RX_TOP_HPHL_COMP_WR_LSB; 20574f692926SSrinivas Kandagatla comp_coeff_msb_reg = CDC_RX_TOP_HPHL_COMP_WR_MSB; 20584f692926SSrinivas Kandagatla } else if (comp == INTERP_HPHR) { 20594f692926SSrinivas Kandagatla comp_coeff_lsb_reg = CDC_RX_TOP_HPHR_COMP_WR_LSB; 20604f692926SSrinivas Kandagatla comp_coeff_msb_reg = CDC_RX_TOP_HPHR_COMP_WR_MSB; 20614f692926SSrinivas Kandagatla } else { 20624f692926SSrinivas Kandagatla /* compander coefficients are loaded only for hph path */ 20634f692926SSrinivas Kandagatla return 0; 20644f692926SSrinivas Kandagatla } 20654f692926SSrinivas Kandagatla 20664f692926SSrinivas Kandagatla hph_pwr_mode = rx->hph_pwr_mode; 20674f692926SSrinivas Kandagatla 20684f692926SSrinivas Kandagatla if (SND_SOC_DAPM_EVENT_ON(event)) { 20694f692926SSrinivas Kandagatla /* Load Compander Coeff */ 20704f692926SSrinivas Kandagatla for (i = 0; i < COMP_MAX_COEFF; i++) { 20714f692926SSrinivas Kandagatla snd_soc_component_write(component, comp_coeff_lsb_reg, 20724f692926SSrinivas Kandagatla comp_coeff_table[hph_pwr_mode][i].lsb); 20734f692926SSrinivas Kandagatla snd_soc_component_write(component, comp_coeff_msb_reg, 20744f692926SSrinivas Kandagatla comp_coeff_table[hph_pwr_mode][i].msb); 20754f692926SSrinivas Kandagatla } 20764f692926SSrinivas Kandagatla } 20774f692926SSrinivas Kandagatla 20784f692926SSrinivas Kandagatla return 0; 20794f692926SSrinivas Kandagatla } 20804f692926SSrinivas Kandagatla 20814f692926SSrinivas Kandagatla static void rx_macro_enable_softclip_clk(struct snd_soc_component *component, 20824f692926SSrinivas Kandagatla struct rx_macro *rx, bool enable) 20834f692926SSrinivas Kandagatla { 20844f692926SSrinivas Kandagatla if (enable) { 20854f692926SSrinivas Kandagatla if (rx->softclip_clk_users == 0) 20864f692926SSrinivas Kandagatla snd_soc_component_write_field(component, CDC_RX_SOFTCLIP_CRC, 20874f692926SSrinivas Kandagatla CDC_RX_SOFTCLIP_CLK_EN_MASK, 1); 20884f692926SSrinivas Kandagatla rx->softclip_clk_users++; 20894f692926SSrinivas Kandagatla } else { 20904f692926SSrinivas Kandagatla rx->softclip_clk_users--; 20914f692926SSrinivas Kandagatla if (rx->softclip_clk_users == 0) 20924f692926SSrinivas Kandagatla snd_soc_component_write_field(component, CDC_RX_SOFTCLIP_CRC, 20934f692926SSrinivas Kandagatla CDC_RX_SOFTCLIP_CLK_EN_MASK, 0); 20944f692926SSrinivas Kandagatla } 20954f692926SSrinivas Kandagatla } 20964f692926SSrinivas Kandagatla 20974f692926SSrinivas Kandagatla static int rx_macro_config_softclip(struct snd_soc_component *component, 20984f692926SSrinivas Kandagatla struct rx_macro *rx, int event) 20994f692926SSrinivas Kandagatla { 21004f692926SSrinivas Kandagatla 21014f692926SSrinivas Kandagatla if (!rx->is_softclip_on) 21024f692926SSrinivas Kandagatla return 0; 21034f692926SSrinivas Kandagatla 21044f692926SSrinivas Kandagatla if (SND_SOC_DAPM_EVENT_ON(event)) { 21054f692926SSrinivas Kandagatla /* Enable Softclip clock */ 21064f692926SSrinivas Kandagatla rx_macro_enable_softclip_clk(component, rx, true); 21074f692926SSrinivas Kandagatla /* Enable Softclip control */ 21084f692926SSrinivas Kandagatla snd_soc_component_write_field(component, CDC_RX_SOFTCLIP_SOFTCLIP_CTRL, 21094f692926SSrinivas Kandagatla CDC_RX_SOFTCLIP_EN_MASK, 0x01); 21104f692926SSrinivas Kandagatla } 21114f692926SSrinivas Kandagatla 21124f692926SSrinivas Kandagatla if (SND_SOC_DAPM_EVENT_OFF(event)) { 21134f692926SSrinivas Kandagatla snd_soc_component_write_field(component, CDC_RX_SOFTCLIP_SOFTCLIP_CTRL, 21144f692926SSrinivas Kandagatla CDC_RX_SOFTCLIP_EN_MASK, 0x0); 21154f692926SSrinivas Kandagatla rx_macro_enable_softclip_clk(component, rx, false); 21164f692926SSrinivas Kandagatla } 21174f692926SSrinivas Kandagatla 21184f692926SSrinivas Kandagatla return 0; 21194f692926SSrinivas Kandagatla } 21204f692926SSrinivas Kandagatla 21214f692926SSrinivas Kandagatla static int rx_macro_config_aux_hpf(struct snd_soc_component *component, 21224f692926SSrinivas Kandagatla struct rx_macro *rx, int event) 21234f692926SSrinivas Kandagatla { 21244f692926SSrinivas Kandagatla if (SND_SOC_DAPM_EVENT_ON(event)) { 21254f692926SSrinivas Kandagatla /* Update Aux HPF control */ 21264f692926SSrinivas Kandagatla if (!rx->is_aux_hpf_on) 21274f692926SSrinivas Kandagatla snd_soc_component_update_bits(component, 21284f692926SSrinivas Kandagatla CDC_RX_RX2_RX_PATH_CFG1, 0x04, 0x00); 21294f692926SSrinivas Kandagatla } 21304f692926SSrinivas Kandagatla 21314f692926SSrinivas Kandagatla if (SND_SOC_DAPM_EVENT_OFF(event)) { 21324f692926SSrinivas Kandagatla /* Reset to default (HPF=ON) */ 21334f692926SSrinivas Kandagatla snd_soc_component_update_bits(component, 21344f692926SSrinivas Kandagatla CDC_RX_RX2_RX_PATH_CFG1, 0x04, 0x04); 21354f692926SSrinivas Kandagatla } 21364f692926SSrinivas Kandagatla 21374f692926SSrinivas Kandagatla return 0; 21384f692926SSrinivas Kandagatla } 21394f692926SSrinivas Kandagatla 2140af3d54b9SSrinivas Kandagatla static inline void rx_macro_enable_clsh_block(struct rx_macro *rx, bool enable) 2141af3d54b9SSrinivas Kandagatla { 2142af3d54b9SSrinivas Kandagatla if ((enable && ++rx->clsh_users == 1) || (!enable && --rx->clsh_users == 0)) 2143af3d54b9SSrinivas Kandagatla snd_soc_component_update_bits(rx->component, CDC_RX_CLSH_CRC, 2144af3d54b9SSrinivas Kandagatla CDC_RX_CLSH_CLK_EN_MASK, enable); 2145af3d54b9SSrinivas Kandagatla if (rx->clsh_users < 0) 2146af3d54b9SSrinivas Kandagatla rx->clsh_users = 0; 2147af3d54b9SSrinivas Kandagatla } 2148af3d54b9SSrinivas Kandagatla 21494f692926SSrinivas Kandagatla static int rx_macro_config_classh(struct snd_soc_component *component, 21504f692926SSrinivas Kandagatla struct rx_macro *rx, 21514f692926SSrinivas Kandagatla int interp_n, int event) 21524f692926SSrinivas Kandagatla { 21534f692926SSrinivas Kandagatla if (SND_SOC_DAPM_EVENT_OFF(event)) { 21544f692926SSrinivas Kandagatla rx_macro_enable_clsh_block(rx, false); 21554f692926SSrinivas Kandagatla return 0; 21564f692926SSrinivas Kandagatla } 21574f692926SSrinivas Kandagatla 21584f692926SSrinivas Kandagatla if (!SND_SOC_DAPM_EVENT_ON(event)) 21594f692926SSrinivas Kandagatla return 0; 21604f692926SSrinivas Kandagatla 21614f692926SSrinivas Kandagatla rx_macro_enable_clsh_block(rx, true); 21624f692926SSrinivas Kandagatla if (interp_n == INTERP_HPHL || 21634f692926SSrinivas Kandagatla interp_n == INTERP_HPHR) { 21644f692926SSrinivas Kandagatla /* 21654f692926SSrinivas Kandagatla * These K1 values depend on the Headphone Impedance 21664f692926SSrinivas Kandagatla * For now it is assumed to be 16 ohm 21674f692926SSrinivas Kandagatla */ 21684f692926SSrinivas Kandagatla snd_soc_component_write(component, CDC_RX_CLSH_K1_LSB, 0xc0); 21694f692926SSrinivas Kandagatla snd_soc_component_write_field(component, CDC_RX_CLSH_K1_MSB, 21704f692926SSrinivas Kandagatla CDC_RX_CLSH_K1_MSB_COEFF_MASK, 0); 21714f692926SSrinivas Kandagatla } 21724f692926SSrinivas Kandagatla switch (interp_n) { 21734f692926SSrinivas Kandagatla case INTERP_HPHL: 21744f692926SSrinivas Kandagatla if (rx->is_ear_mode_on) 21754f692926SSrinivas Kandagatla snd_soc_component_update_bits(component, 21764f692926SSrinivas Kandagatla CDC_RX_CLSH_HPH_V_PA, 21774f692926SSrinivas Kandagatla CDC_RX_CLSH_HPH_V_PA_MIN_MASK, 0x39); 21784f692926SSrinivas Kandagatla else 21794f692926SSrinivas Kandagatla snd_soc_component_update_bits(component, 21804f692926SSrinivas Kandagatla CDC_RX_CLSH_HPH_V_PA, 21814f692926SSrinivas Kandagatla CDC_RX_CLSH_HPH_V_PA_MIN_MASK, 0x1c); 21824f692926SSrinivas Kandagatla snd_soc_component_update_bits(component, 21834f692926SSrinivas Kandagatla CDC_RX_CLSH_DECAY_CTRL, 21844f692926SSrinivas Kandagatla CDC_RX_CLSH_DECAY_RATE_MASK, 0x0); 21854f692926SSrinivas Kandagatla snd_soc_component_write_field(component, 21864f692926SSrinivas Kandagatla CDC_RX_RX0_RX_PATH_CFG0, 21874f692926SSrinivas Kandagatla CDC_RX_RXn_CLSH_EN_MASK, 0x1); 21884f692926SSrinivas Kandagatla break; 21894f692926SSrinivas Kandagatla case INTERP_HPHR: 21904f692926SSrinivas Kandagatla if (rx->is_ear_mode_on) 21914f692926SSrinivas Kandagatla snd_soc_component_update_bits(component, 21924f692926SSrinivas Kandagatla CDC_RX_CLSH_HPH_V_PA, 21934f692926SSrinivas Kandagatla CDC_RX_CLSH_HPH_V_PA_MIN_MASK, 0x39); 21944f692926SSrinivas Kandagatla else 21954f692926SSrinivas Kandagatla snd_soc_component_update_bits(component, 21964f692926SSrinivas Kandagatla CDC_RX_CLSH_HPH_V_PA, 21974f692926SSrinivas Kandagatla CDC_RX_CLSH_HPH_V_PA_MIN_MASK, 0x1c); 21984f692926SSrinivas Kandagatla snd_soc_component_update_bits(component, 21994f692926SSrinivas Kandagatla CDC_RX_CLSH_DECAY_CTRL, 22004f692926SSrinivas Kandagatla CDC_RX_CLSH_DECAY_RATE_MASK, 0x0); 2201cb04d8cdSSrinivas Kandagatla snd_soc_component_write_field(component, 22024f692926SSrinivas Kandagatla CDC_RX_RX1_RX_PATH_CFG0, 22034f692926SSrinivas Kandagatla CDC_RX_RXn_CLSH_EN_MASK, 0x1); 22044f692926SSrinivas Kandagatla break; 22054f692926SSrinivas Kandagatla case INTERP_AUX: 22064f692926SSrinivas Kandagatla snd_soc_component_update_bits(component, 22074f692926SSrinivas Kandagatla CDC_RX_RX2_RX_PATH_CFG0, 22084f692926SSrinivas Kandagatla CDC_RX_RX2_DLY_Z_EN_MASK, 1); 22094f692926SSrinivas Kandagatla snd_soc_component_write_field(component, 22104f692926SSrinivas Kandagatla CDC_RX_RX2_RX_PATH_CFG0, 22114f692926SSrinivas Kandagatla CDC_RX_RX2_CLSH_EN_MASK, 1); 22124f692926SSrinivas Kandagatla break; 22134f692926SSrinivas Kandagatla } 22144f692926SSrinivas Kandagatla 22154f692926SSrinivas Kandagatla return 0; 22164f692926SSrinivas Kandagatla } 22174f692926SSrinivas Kandagatla 22184f692926SSrinivas Kandagatla static void rx_macro_hd2_control(struct snd_soc_component *component, 22194f692926SSrinivas Kandagatla u16 interp_idx, int event) 22204f692926SSrinivas Kandagatla { 22214f692926SSrinivas Kandagatla u16 hd2_scale_reg, hd2_enable_reg; 22224f692926SSrinivas Kandagatla 22234f692926SSrinivas Kandagatla switch (interp_idx) { 22244f692926SSrinivas Kandagatla case INTERP_HPHL: 22254f692926SSrinivas Kandagatla hd2_scale_reg = CDC_RX_RX0_RX_PATH_SEC3; 22264f692926SSrinivas Kandagatla hd2_enable_reg = CDC_RX_RX0_RX_PATH_CFG0; 22274f692926SSrinivas Kandagatla break; 22284f692926SSrinivas Kandagatla case INTERP_HPHR: 22294f692926SSrinivas Kandagatla hd2_scale_reg = CDC_RX_RX1_RX_PATH_SEC3; 22304f692926SSrinivas Kandagatla hd2_enable_reg = CDC_RX_RX1_RX_PATH_CFG0; 22314f692926SSrinivas Kandagatla break; 22324f692926SSrinivas Kandagatla } 22334f692926SSrinivas Kandagatla 22344f692926SSrinivas Kandagatla if (hd2_enable_reg && SND_SOC_DAPM_EVENT_ON(event)) { 22354f692926SSrinivas Kandagatla snd_soc_component_update_bits(component, hd2_scale_reg, 22364f692926SSrinivas Kandagatla CDC_RX_RXn_HD2_ALPHA_MASK, 0x14); 22374f692926SSrinivas Kandagatla snd_soc_component_write_field(component, hd2_enable_reg, 22384f692926SSrinivas Kandagatla CDC_RX_RXn_HD2_EN_MASK, 1); 22394f692926SSrinivas Kandagatla } 22404f692926SSrinivas Kandagatla 22414f692926SSrinivas Kandagatla if (hd2_enable_reg && SND_SOC_DAPM_EVENT_OFF(event)) { 22424f692926SSrinivas Kandagatla snd_soc_component_write_field(component, hd2_enable_reg, 22434f692926SSrinivas Kandagatla CDC_RX_RXn_HD2_EN_MASK, 0); 22444f692926SSrinivas Kandagatla snd_soc_component_update_bits(component, hd2_scale_reg, 22454f692926SSrinivas Kandagatla CDC_RX_RXn_HD2_ALPHA_MASK, 0x0); 22464f692926SSrinivas Kandagatla } 22474f692926SSrinivas Kandagatla } 22484f692926SSrinivas Kandagatla 2249af3d54b9SSrinivas Kandagatla static int rx_macro_get_compander(struct snd_kcontrol *kcontrol, 2250af3d54b9SSrinivas Kandagatla struct snd_ctl_elem_value *ucontrol) 2251af3d54b9SSrinivas Kandagatla { 2252af3d54b9SSrinivas Kandagatla struct snd_soc_component *component = 2253af3d54b9SSrinivas Kandagatla snd_soc_kcontrol_component(kcontrol); 2254af3d54b9SSrinivas Kandagatla int comp = ((struct soc_mixer_control *) kcontrol->private_value)->shift; 2255af3d54b9SSrinivas Kandagatla struct rx_macro *rx = snd_soc_component_get_drvdata(component); 2256af3d54b9SSrinivas Kandagatla 2257af3d54b9SSrinivas Kandagatla ucontrol->value.integer.value[0] = rx->comp_enabled[comp]; 2258af3d54b9SSrinivas Kandagatla return 0; 2259af3d54b9SSrinivas Kandagatla } 2260af3d54b9SSrinivas Kandagatla 2261af3d54b9SSrinivas Kandagatla static int rx_macro_set_compander(struct snd_kcontrol *kcontrol, 2262af3d54b9SSrinivas Kandagatla struct snd_ctl_elem_value *ucontrol) 2263af3d54b9SSrinivas Kandagatla { 2264af3d54b9SSrinivas Kandagatla struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol); 2265af3d54b9SSrinivas Kandagatla int comp = ((struct soc_mixer_control *) kcontrol->private_value)->shift; 2266af3d54b9SSrinivas Kandagatla int value = ucontrol->value.integer.value[0]; 2267af3d54b9SSrinivas Kandagatla struct rx_macro *rx = snd_soc_component_get_drvdata(component); 2268af3d54b9SSrinivas Kandagatla 2269af3d54b9SSrinivas Kandagatla rx->comp_enabled[comp] = value; 2270af3d54b9SSrinivas Kandagatla 2271af3d54b9SSrinivas Kandagatla return 0; 2272af3d54b9SSrinivas Kandagatla } 2273af3d54b9SSrinivas Kandagatla 22744f692926SSrinivas Kandagatla static int rx_macro_mux_get(struct snd_kcontrol *kcontrol, 22754f692926SSrinivas Kandagatla struct snd_ctl_elem_value *ucontrol) 22764f692926SSrinivas Kandagatla { 22774f692926SSrinivas Kandagatla struct snd_soc_dapm_widget *widget = snd_soc_dapm_kcontrol_widget(kcontrol); 22784f692926SSrinivas Kandagatla struct snd_soc_component *component = snd_soc_dapm_to_component(widget->dapm); 22794f692926SSrinivas Kandagatla struct rx_macro *rx = snd_soc_component_get_drvdata(component); 22804f692926SSrinivas Kandagatla 2281bcfe5f76SSrinivas Kandagatla ucontrol->value.enumerated.item[0] = 22824f692926SSrinivas Kandagatla rx->rx_port_value[widget->shift]; 22834f692926SSrinivas Kandagatla return 0; 22844f692926SSrinivas Kandagatla } 22854f692926SSrinivas Kandagatla 22864f692926SSrinivas Kandagatla static int rx_macro_mux_put(struct snd_kcontrol *kcontrol, 22874f692926SSrinivas Kandagatla struct snd_ctl_elem_value *ucontrol) 22884f692926SSrinivas Kandagatla { 22894f692926SSrinivas Kandagatla struct snd_soc_dapm_widget *widget = snd_soc_dapm_kcontrol_widget(kcontrol); 22904f692926SSrinivas Kandagatla struct snd_soc_component *component = snd_soc_dapm_to_component(widget->dapm); 22914f692926SSrinivas Kandagatla struct soc_enum *e = (struct soc_enum *)kcontrol->private_value; 22924f692926SSrinivas Kandagatla struct snd_soc_dapm_update *update = NULL; 2293bcfe5f76SSrinivas Kandagatla u32 rx_port_value = ucontrol->value.enumerated.item[0]; 22944f692926SSrinivas Kandagatla u32 aif_rst; 22954f692926SSrinivas Kandagatla struct rx_macro *rx = snd_soc_component_get_drvdata(component); 22964f692926SSrinivas Kandagatla 22974f692926SSrinivas Kandagatla aif_rst = rx->rx_port_value[widget->shift]; 22984f692926SSrinivas Kandagatla if (!rx_port_value) { 2299777af241SSrinivas Kandagatla if (aif_rst == 0) 23004f692926SSrinivas Kandagatla return 0; 23014f692926SSrinivas Kandagatla if (aif_rst > RX_MACRO_AIF4_PB) { 23024f692926SSrinivas Kandagatla dev_err(component->dev, "%s: Invalid AIF reset\n", __func__); 23034f692926SSrinivas Kandagatla return 0; 23044f692926SSrinivas Kandagatla } 23054f692926SSrinivas Kandagatla } 23064f692926SSrinivas Kandagatla rx->rx_port_value[widget->shift] = rx_port_value; 23074f692926SSrinivas Kandagatla 23084f692926SSrinivas Kandagatla switch (rx_port_value) { 23094f692926SSrinivas Kandagatla case 0: 23104f692926SSrinivas Kandagatla if (rx->active_ch_cnt[aif_rst]) { 23114f692926SSrinivas Kandagatla clear_bit(widget->shift, 23124f692926SSrinivas Kandagatla &rx->active_ch_mask[aif_rst]); 23134f692926SSrinivas Kandagatla rx->active_ch_cnt[aif_rst]--; 23144f692926SSrinivas Kandagatla } 23154f692926SSrinivas Kandagatla break; 23164f692926SSrinivas Kandagatla case 1: 23174f692926SSrinivas Kandagatla case 2: 23184f692926SSrinivas Kandagatla case 3: 23194f692926SSrinivas Kandagatla case 4: 23204f692926SSrinivas Kandagatla set_bit(widget->shift, 23214f692926SSrinivas Kandagatla &rx->active_ch_mask[rx_port_value]); 23224f692926SSrinivas Kandagatla rx->active_ch_cnt[rx_port_value]++; 23234f692926SSrinivas Kandagatla break; 23244f692926SSrinivas Kandagatla default: 23254f692926SSrinivas Kandagatla dev_err(component->dev, 23264f692926SSrinivas Kandagatla "%s:Invalid AIF_ID for RX_MACRO MUX %d\n", 23274f692926SSrinivas Kandagatla __func__, rx_port_value); 23284f692926SSrinivas Kandagatla goto err; 23294f692926SSrinivas Kandagatla } 23304f692926SSrinivas Kandagatla 23314f692926SSrinivas Kandagatla snd_soc_dapm_mux_update_power(widget->dapm, kcontrol, 23324f692926SSrinivas Kandagatla rx_port_value, e, update); 23334f692926SSrinivas Kandagatla return 0; 23344f692926SSrinivas Kandagatla err: 23354f692926SSrinivas Kandagatla return -EINVAL; 23364f692926SSrinivas Kandagatla } 23374f692926SSrinivas Kandagatla 23384f692926SSrinivas Kandagatla static const struct snd_kcontrol_new rx_macro_rx0_mux = 23394f692926SSrinivas Kandagatla SOC_DAPM_ENUM_EXT("rx_macro_rx0", rx_macro_rx0_enum, 23404f692926SSrinivas Kandagatla rx_macro_mux_get, rx_macro_mux_put); 23414f692926SSrinivas Kandagatla static const struct snd_kcontrol_new rx_macro_rx1_mux = 23424f692926SSrinivas Kandagatla SOC_DAPM_ENUM_EXT("rx_macro_rx1", rx_macro_rx1_enum, 23434f692926SSrinivas Kandagatla rx_macro_mux_get, rx_macro_mux_put); 23444f692926SSrinivas Kandagatla static const struct snd_kcontrol_new rx_macro_rx2_mux = 23454f692926SSrinivas Kandagatla SOC_DAPM_ENUM_EXT("rx_macro_rx2", rx_macro_rx2_enum, 23464f692926SSrinivas Kandagatla rx_macro_mux_get, rx_macro_mux_put); 23474f692926SSrinivas Kandagatla static const struct snd_kcontrol_new rx_macro_rx3_mux = 23484f692926SSrinivas Kandagatla SOC_DAPM_ENUM_EXT("rx_macro_rx3", rx_macro_rx3_enum, 23494f692926SSrinivas Kandagatla rx_macro_mux_get, rx_macro_mux_put); 23504f692926SSrinivas Kandagatla static const struct snd_kcontrol_new rx_macro_rx4_mux = 23514f692926SSrinivas Kandagatla SOC_DAPM_ENUM_EXT("rx_macro_rx4", rx_macro_rx4_enum, 23524f692926SSrinivas Kandagatla rx_macro_mux_get, rx_macro_mux_put); 23534f692926SSrinivas Kandagatla static const struct snd_kcontrol_new rx_macro_rx5_mux = 23544f692926SSrinivas Kandagatla SOC_DAPM_ENUM_EXT("rx_macro_rx5", rx_macro_rx5_enum, 23554f692926SSrinivas Kandagatla rx_macro_mux_get, rx_macro_mux_put); 23564f692926SSrinivas Kandagatla 2357af3d54b9SSrinivas Kandagatla static int rx_macro_get_ear_mode(struct snd_kcontrol *kcontrol, 2358af3d54b9SSrinivas Kandagatla struct snd_ctl_elem_value *ucontrol) 2359af3d54b9SSrinivas Kandagatla { 2360af3d54b9SSrinivas Kandagatla struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol); 2361af3d54b9SSrinivas Kandagatla struct rx_macro *rx = snd_soc_component_get_drvdata(component); 2362af3d54b9SSrinivas Kandagatla 2363af3d54b9SSrinivas Kandagatla ucontrol->value.integer.value[0] = rx->is_ear_mode_on; 2364af3d54b9SSrinivas Kandagatla return 0; 2365af3d54b9SSrinivas Kandagatla } 2366af3d54b9SSrinivas Kandagatla 2367af3d54b9SSrinivas Kandagatla static int rx_macro_put_ear_mode(struct snd_kcontrol *kcontrol, 2368af3d54b9SSrinivas Kandagatla struct snd_ctl_elem_value *ucontrol) 2369af3d54b9SSrinivas Kandagatla { 2370af3d54b9SSrinivas Kandagatla struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol); 2371af3d54b9SSrinivas Kandagatla struct rx_macro *rx = snd_soc_component_get_drvdata(component); 2372af3d54b9SSrinivas Kandagatla 2373af3d54b9SSrinivas Kandagatla rx->is_ear_mode_on = (!ucontrol->value.integer.value[0] ? false : true); 2374af3d54b9SSrinivas Kandagatla return 0; 2375af3d54b9SSrinivas Kandagatla } 2376af3d54b9SSrinivas Kandagatla 2377af3d54b9SSrinivas Kandagatla static int rx_macro_get_hph_hd2_mode(struct snd_kcontrol *kcontrol, 2378af3d54b9SSrinivas Kandagatla struct snd_ctl_elem_value *ucontrol) 2379af3d54b9SSrinivas Kandagatla { 2380af3d54b9SSrinivas Kandagatla struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol); 2381af3d54b9SSrinivas Kandagatla struct rx_macro *rx = snd_soc_component_get_drvdata(component); 2382af3d54b9SSrinivas Kandagatla 2383af3d54b9SSrinivas Kandagatla ucontrol->value.integer.value[0] = rx->hph_hd2_mode; 2384af3d54b9SSrinivas Kandagatla return 0; 2385af3d54b9SSrinivas Kandagatla } 2386af3d54b9SSrinivas Kandagatla 2387af3d54b9SSrinivas Kandagatla static int rx_macro_put_hph_hd2_mode(struct snd_kcontrol *kcontrol, 2388af3d54b9SSrinivas Kandagatla struct snd_ctl_elem_value *ucontrol) 2389af3d54b9SSrinivas Kandagatla { 2390af3d54b9SSrinivas Kandagatla struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol); 2391af3d54b9SSrinivas Kandagatla struct rx_macro *rx = snd_soc_component_get_drvdata(component); 2392af3d54b9SSrinivas Kandagatla 2393af3d54b9SSrinivas Kandagatla rx->hph_hd2_mode = ucontrol->value.integer.value[0]; 2394af3d54b9SSrinivas Kandagatla return 0; 2395af3d54b9SSrinivas Kandagatla } 2396af3d54b9SSrinivas Kandagatla 2397af3d54b9SSrinivas Kandagatla static int rx_macro_get_hph_pwr_mode(struct snd_kcontrol *kcontrol, 2398af3d54b9SSrinivas Kandagatla struct snd_ctl_elem_value *ucontrol) 2399af3d54b9SSrinivas Kandagatla { 2400af3d54b9SSrinivas Kandagatla struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol); 2401af3d54b9SSrinivas Kandagatla struct rx_macro *rx = snd_soc_component_get_drvdata(component); 2402af3d54b9SSrinivas Kandagatla 2403bcfe5f76SSrinivas Kandagatla ucontrol->value.enumerated.item[0] = rx->hph_pwr_mode; 2404af3d54b9SSrinivas Kandagatla return 0; 2405af3d54b9SSrinivas Kandagatla } 2406af3d54b9SSrinivas Kandagatla 2407af3d54b9SSrinivas Kandagatla static int rx_macro_put_hph_pwr_mode(struct snd_kcontrol *kcontrol, 2408af3d54b9SSrinivas Kandagatla struct snd_ctl_elem_value *ucontrol) 2409af3d54b9SSrinivas Kandagatla { 2410af3d54b9SSrinivas Kandagatla struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol); 2411af3d54b9SSrinivas Kandagatla struct rx_macro *rx = snd_soc_component_get_drvdata(component); 2412af3d54b9SSrinivas Kandagatla 2413bcfe5f76SSrinivas Kandagatla rx->hph_pwr_mode = ucontrol->value.enumerated.item[0]; 2414af3d54b9SSrinivas Kandagatla return 0; 2415af3d54b9SSrinivas Kandagatla } 2416af3d54b9SSrinivas Kandagatla 2417af3d54b9SSrinivas Kandagatla static int rx_macro_soft_clip_enable_get(struct snd_kcontrol *kcontrol, 2418af3d54b9SSrinivas Kandagatla struct snd_ctl_elem_value *ucontrol) 2419af3d54b9SSrinivas Kandagatla { 2420af3d54b9SSrinivas Kandagatla struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol); 2421af3d54b9SSrinivas Kandagatla struct rx_macro *rx = snd_soc_component_get_drvdata(component); 2422af3d54b9SSrinivas Kandagatla 2423af3d54b9SSrinivas Kandagatla ucontrol->value.integer.value[0] = rx->is_softclip_on; 2424af3d54b9SSrinivas Kandagatla 2425af3d54b9SSrinivas Kandagatla return 0; 2426af3d54b9SSrinivas Kandagatla } 2427af3d54b9SSrinivas Kandagatla 2428af3d54b9SSrinivas Kandagatla static int rx_macro_soft_clip_enable_put(struct snd_kcontrol *kcontrol, 2429af3d54b9SSrinivas Kandagatla struct snd_ctl_elem_value *ucontrol) 2430af3d54b9SSrinivas Kandagatla { 2431af3d54b9SSrinivas Kandagatla struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol); 2432af3d54b9SSrinivas Kandagatla struct rx_macro *rx = snd_soc_component_get_drvdata(component); 2433af3d54b9SSrinivas Kandagatla 2434af3d54b9SSrinivas Kandagatla rx->is_softclip_on = ucontrol->value.integer.value[0]; 2435af3d54b9SSrinivas Kandagatla 2436af3d54b9SSrinivas Kandagatla return 0; 2437af3d54b9SSrinivas Kandagatla } 2438af3d54b9SSrinivas Kandagatla 2439af3d54b9SSrinivas Kandagatla static int rx_macro_aux_hpf_mode_get(struct snd_kcontrol *kcontrol, 2440af3d54b9SSrinivas Kandagatla struct snd_ctl_elem_value *ucontrol) 2441af3d54b9SSrinivas Kandagatla { 2442af3d54b9SSrinivas Kandagatla struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol); 2443af3d54b9SSrinivas Kandagatla struct rx_macro *rx = snd_soc_component_get_drvdata(component); 2444af3d54b9SSrinivas Kandagatla 2445af3d54b9SSrinivas Kandagatla ucontrol->value.integer.value[0] = rx->is_aux_hpf_on; 2446af3d54b9SSrinivas Kandagatla 2447af3d54b9SSrinivas Kandagatla return 0; 2448af3d54b9SSrinivas Kandagatla } 2449af3d54b9SSrinivas Kandagatla 2450af3d54b9SSrinivas Kandagatla static int rx_macro_aux_hpf_mode_put(struct snd_kcontrol *kcontrol, 2451af3d54b9SSrinivas Kandagatla struct snd_ctl_elem_value *ucontrol) 2452af3d54b9SSrinivas Kandagatla { 2453af3d54b9SSrinivas Kandagatla struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol); 2454af3d54b9SSrinivas Kandagatla struct rx_macro *rx = snd_soc_component_get_drvdata(component); 2455af3d54b9SSrinivas Kandagatla 2456af3d54b9SSrinivas Kandagatla rx->is_aux_hpf_on = ucontrol->value.integer.value[0]; 2457af3d54b9SSrinivas Kandagatla 2458af3d54b9SSrinivas Kandagatla return 0; 2459af3d54b9SSrinivas Kandagatla } 2460af3d54b9SSrinivas Kandagatla 24614f692926SSrinivas Kandagatla static int rx_macro_hphdelay_lutbypass(struct snd_soc_component *component, 24624f692926SSrinivas Kandagatla struct rx_macro *rx, 24634f692926SSrinivas Kandagatla u16 interp_idx, int event) 24644f692926SSrinivas Kandagatla { 24654f692926SSrinivas Kandagatla u16 hph_lut_bypass_reg; 24664f692926SSrinivas Kandagatla u16 hph_comp_ctrl7; 24674f692926SSrinivas Kandagatla 24684f692926SSrinivas Kandagatla switch (interp_idx) { 24694f692926SSrinivas Kandagatla case INTERP_HPHL: 24704f692926SSrinivas Kandagatla hph_lut_bypass_reg = CDC_RX_TOP_HPHL_COMP_LUT; 24714f692926SSrinivas Kandagatla hph_comp_ctrl7 = CDC_RX_COMPANDER0_CTL7; 24724f692926SSrinivas Kandagatla break; 24734f692926SSrinivas Kandagatla case INTERP_HPHR: 24744f692926SSrinivas Kandagatla hph_lut_bypass_reg = CDC_RX_TOP_HPHR_COMP_LUT; 24754f692926SSrinivas Kandagatla hph_comp_ctrl7 = CDC_RX_COMPANDER1_CTL7; 24764f692926SSrinivas Kandagatla break; 24774f692926SSrinivas Kandagatla default: 24784f692926SSrinivas Kandagatla return -EINVAL; 24794f692926SSrinivas Kandagatla } 24804f692926SSrinivas Kandagatla 24814f692926SSrinivas Kandagatla if (hph_lut_bypass_reg && SND_SOC_DAPM_EVENT_ON(event)) { 24824f692926SSrinivas Kandagatla if (interp_idx == INTERP_HPHL) { 24834f692926SSrinivas Kandagatla if (rx->is_ear_mode_on) 24844f692926SSrinivas Kandagatla snd_soc_component_write_field(component, 24854f692926SSrinivas Kandagatla CDC_RX_RX0_RX_PATH_CFG1, 24864f692926SSrinivas Kandagatla CDC_RX_RX0_HPH_L_EAR_SEL_MASK, 0x1); 24874f692926SSrinivas Kandagatla else 24884f692926SSrinivas Kandagatla snd_soc_component_write_field(component, 24894f692926SSrinivas Kandagatla hph_lut_bypass_reg, 24904f692926SSrinivas Kandagatla CDC_RX_TOP_HPH_LUT_BYPASS_MASK, 1); 24914f692926SSrinivas Kandagatla } else { 24924f692926SSrinivas Kandagatla snd_soc_component_write_field(component, hph_lut_bypass_reg, 24934f692926SSrinivas Kandagatla CDC_RX_TOP_HPH_LUT_BYPASS_MASK, 1); 24944f692926SSrinivas Kandagatla } 24954f692926SSrinivas Kandagatla if (rx->hph_pwr_mode) 24964f692926SSrinivas Kandagatla snd_soc_component_write_field(component, hph_comp_ctrl7, 24974f692926SSrinivas Kandagatla CDC_RX_COMPANDER1_HPH_LOW_PWR_MODE_MASK, 0x0); 24984f692926SSrinivas Kandagatla } 24994f692926SSrinivas Kandagatla 25004f692926SSrinivas Kandagatla if (hph_lut_bypass_reg && SND_SOC_DAPM_EVENT_OFF(event)) { 25014f692926SSrinivas Kandagatla snd_soc_component_write_field(component, 25024f692926SSrinivas Kandagatla CDC_RX_RX0_RX_PATH_CFG1, 25034f692926SSrinivas Kandagatla CDC_RX_RX0_HPH_L_EAR_SEL_MASK, 0x0); 25044f692926SSrinivas Kandagatla snd_soc_component_update_bits(component, hph_lut_bypass_reg, 25054f692926SSrinivas Kandagatla CDC_RX_TOP_HPH_LUT_BYPASS_MASK, 0); 25064f692926SSrinivas Kandagatla snd_soc_component_write_field(component, hph_comp_ctrl7, 25074f692926SSrinivas Kandagatla CDC_RX_COMPANDER1_HPH_LOW_PWR_MODE_MASK, 0x1); 25084f692926SSrinivas Kandagatla } 25094f692926SSrinivas Kandagatla 25104f692926SSrinivas Kandagatla return 0; 25114f692926SSrinivas Kandagatla } 25124f692926SSrinivas Kandagatla 25134f692926SSrinivas Kandagatla static int rx_macro_enable_interp_clk(struct snd_soc_component *component, 25144f692926SSrinivas Kandagatla int event, int interp_idx) 25154f692926SSrinivas Kandagatla { 25164f692926SSrinivas Kandagatla u16 main_reg, dsm_reg, rx_cfg2_reg; 25174f692926SSrinivas Kandagatla struct rx_macro *rx = snd_soc_component_get_drvdata(component); 25184f692926SSrinivas Kandagatla 25194f692926SSrinivas Kandagatla main_reg = CDC_RX_RXn_RX_PATH_CTL(interp_idx); 25204f692926SSrinivas Kandagatla dsm_reg = CDC_RX_RXn_RX_PATH_DSM_CTL(interp_idx); 25214f692926SSrinivas Kandagatla if (interp_idx == INTERP_AUX) 25224f692926SSrinivas Kandagatla dsm_reg = CDC_RX_RX2_RX_PATH_DSM_CTL; 25234f692926SSrinivas Kandagatla rx_cfg2_reg = CDC_RX_RXn_RX_PATH_CFG2(interp_idx); 25244f692926SSrinivas Kandagatla 25254f692926SSrinivas Kandagatla if (SND_SOC_DAPM_EVENT_ON(event)) { 25264f692926SSrinivas Kandagatla if (rx->main_clk_users[interp_idx] == 0) { 25274f692926SSrinivas Kandagatla /* Main path PGA mute enable */ 25284f692926SSrinivas Kandagatla snd_soc_component_write_field(component, main_reg, 25294f692926SSrinivas Kandagatla CDC_RX_PATH_PGA_MUTE_MASK, 0x1); 25304f692926SSrinivas Kandagatla snd_soc_component_write_field(component, dsm_reg, 25314f692926SSrinivas Kandagatla CDC_RX_RXn_DSM_CLK_EN_MASK, 0x1); 25324f692926SSrinivas Kandagatla snd_soc_component_update_bits(component, rx_cfg2_reg, 25334f692926SSrinivas Kandagatla CDC_RX_RXn_HPF_CUT_FREQ_MASK, 0x03); 25344f692926SSrinivas Kandagatla rx_macro_load_compander_coeff(component, rx, interp_idx, event); 25354f692926SSrinivas Kandagatla if (rx->hph_hd2_mode) 25364f692926SSrinivas Kandagatla rx_macro_hd2_control(component, interp_idx, event); 25374f692926SSrinivas Kandagatla rx_macro_hphdelay_lutbypass(component, rx, interp_idx, event); 25384f692926SSrinivas Kandagatla rx_macro_config_compander(component, rx, interp_idx, event); 25394f692926SSrinivas Kandagatla if (interp_idx == INTERP_AUX) { 25404f692926SSrinivas Kandagatla rx_macro_config_softclip(component, rx, event); 25414f692926SSrinivas Kandagatla rx_macro_config_aux_hpf(component, rx, event); 25424f692926SSrinivas Kandagatla } 25434f692926SSrinivas Kandagatla rx_macro_config_classh(component, rx, interp_idx, event); 25444f692926SSrinivas Kandagatla } 25454f692926SSrinivas Kandagatla rx->main_clk_users[interp_idx]++; 25464f692926SSrinivas Kandagatla } 25474f692926SSrinivas Kandagatla 25484f692926SSrinivas Kandagatla if (SND_SOC_DAPM_EVENT_OFF(event)) { 25494f692926SSrinivas Kandagatla rx->main_clk_users[interp_idx]--; 25504f692926SSrinivas Kandagatla if (rx->main_clk_users[interp_idx] <= 0) { 25514f692926SSrinivas Kandagatla rx->main_clk_users[interp_idx] = 0; 25524f692926SSrinivas Kandagatla /* Main path PGA mute enable */ 25534f692926SSrinivas Kandagatla snd_soc_component_write_field(component, main_reg, 25544f692926SSrinivas Kandagatla CDC_RX_PATH_PGA_MUTE_MASK, 0x1); 25554f692926SSrinivas Kandagatla /* Clk Disable */ 25564f692926SSrinivas Kandagatla snd_soc_component_write_field(component, dsm_reg, 25574f692926SSrinivas Kandagatla CDC_RX_RXn_DSM_CLK_EN_MASK, 0); 25584f692926SSrinivas Kandagatla snd_soc_component_write_field(component, main_reg, 25594f692926SSrinivas Kandagatla CDC_RX_PATH_CLK_EN_MASK, 0); 25604f692926SSrinivas Kandagatla /* Reset enable and disable */ 25614f692926SSrinivas Kandagatla snd_soc_component_write_field(component, main_reg, 25624f692926SSrinivas Kandagatla CDC_RX_PATH_RESET_EN_MASK, 1); 25634f692926SSrinivas Kandagatla snd_soc_component_write_field(component, main_reg, 25644f692926SSrinivas Kandagatla CDC_RX_PATH_RESET_EN_MASK, 0); 25654f692926SSrinivas Kandagatla /* Reset rate to 48K*/ 25664f692926SSrinivas Kandagatla snd_soc_component_update_bits(component, main_reg, 25674f692926SSrinivas Kandagatla CDC_RX_PATH_PCM_RATE_MASK, 25684f692926SSrinivas Kandagatla 0x04); 25694f692926SSrinivas Kandagatla snd_soc_component_update_bits(component, rx_cfg2_reg, 25704f692926SSrinivas Kandagatla CDC_RX_RXn_HPF_CUT_FREQ_MASK, 0x00); 25714f692926SSrinivas Kandagatla rx_macro_config_classh(component, rx, interp_idx, event); 25724f692926SSrinivas Kandagatla rx_macro_config_compander(component, rx, interp_idx, event); 25734f692926SSrinivas Kandagatla if (interp_idx == INTERP_AUX) { 25744f692926SSrinivas Kandagatla rx_macro_config_softclip(component, rx, event); 25754f692926SSrinivas Kandagatla rx_macro_config_aux_hpf(component, rx, event); 25764f692926SSrinivas Kandagatla } 25774f692926SSrinivas Kandagatla rx_macro_hphdelay_lutbypass(component, rx, interp_idx, event); 25784f692926SSrinivas Kandagatla if (rx->hph_hd2_mode) 25794f692926SSrinivas Kandagatla rx_macro_hd2_control(component, interp_idx, event); 25804f692926SSrinivas Kandagatla } 25814f692926SSrinivas Kandagatla } 25824f692926SSrinivas Kandagatla 25834f692926SSrinivas Kandagatla return rx->main_clk_users[interp_idx]; 25844f692926SSrinivas Kandagatla } 25854f692926SSrinivas Kandagatla 25864f692926SSrinivas Kandagatla static int rx_macro_enable_mix_path(struct snd_soc_dapm_widget *w, 25874f692926SSrinivas Kandagatla struct snd_kcontrol *kcontrol, int event) 25884f692926SSrinivas Kandagatla { 25894f692926SSrinivas Kandagatla struct snd_soc_component *component = snd_soc_dapm_to_component(w->dapm); 25904f692926SSrinivas Kandagatla u16 gain_reg, mix_reg; 25914f692926SSrinivas Kandagatla 25924f692926SSrinivas Kandagatla gain_reg = CDC_RX_RXn_RX_VOL_MIX_CTL(w->shift); 25934f692926SSrinivas Kandagatla mix_reg = CDC_RX_RXn_RX_PATH_MIX_CTL(w->shift); 25944f692926SSrinivas Kandagatla 25954f692926SSrinivas Kandagatla switch (event) { 25964f692926SSrinivas Kandagatla case SND_SOC_DAPM_PRE_PMU: 25974f692926SSrinivas Kandagatla rx_macro_enable_interp_clk(component, event, w->shift); 25984f692926SSrinivas Kandagatla break; 25994f692926SSrinivas Kandagatla case SND_SOC_DAPM_POST_PMU: 26004f692926SSrinivas Kandagatla snd_soc_component_write(component, gain_reg, 26014f692926SSrinivas Kandagatla snd_soc_component_read(component, gain_reg)); 26024f692926SSrinivas Kandagatla break; 26034f692926SSrinivas Kandagatla case SND_SOC_DAPM_POST_PMD: 26044f692926SSrinivas Kandagatla /* Clk Disable */ 26054f692926SSrinivas Kandagatla snd_soc_component_update_bits(component, mix_reg, 26064f692926SSrinivas Kandagatla CDC_RX_RXn_MIX_CLK_EN_MASK, 0x00); 26074f692926SSrinivas Kandagatla rx_macro_enable_interp_clk(component, event, w->shift); 26084f692926SSrinivas Kandagatla /* Reset enable and disable */ 26094f692926SSrinivas Kandagatla snd_soc_component_update_bits(component, mix_reg, 26104f692926SSrinivas Kandagatla CDC_RX_RXn_MIX_RESET_MASK, 26114f692926SSrinivas Kandagatla CDC_RX_RXn_MIX_RESET); 26124f692926SSrinivas Kandagatla snd_soc_component_update_bits(component, mix_reg, 26134f692926SSrinivas Kandagatla CDC_RX_RXn_MIX_RESET_MASK, 0x00); 26144f692926SSrinivas Kandagatla break; 26154f692926SSrinivas Kandagatla } 26164f692926SSrinivas Kandagatla 26174f692926SSrinivas Kandagatla return 0; 26184f692926SSrinivas Kandagatla } 26194f692926SSrinivas Kandagatla 26204f692926SSrinivas Kandagatla static int rx_macro_enable_rx_path_clk(struct snd_soc_dapm_widget *w, 26214f692926SSrinivas Kandagatla struct snd_kcontrol *kcontrol, int event) 26224f692926SSrinivas Kandagatla { 26234f692926SSrinivas Kandagatla struct snd_soc_component *component = snd_soc_dapm_to_component(w->dapm); 26244f692926SSrinivas Kandagatla 26254f692926SSrinivas Kandagatla switch (event) { 26264f692926SSrinivas Kandagatla case SND_SOC_DAPM_PRE_PMU: 26274f692926SSrinivas Kandagatla rx_macro_enable_interp_clk(component, event, w->shift); 26284f692926SSrinivas Kandagatla snd_soc_component_write_field(component, CDC_RX_RXn_RX_PATH_CFG1(w->shift), 26294f692926SSrinivas Kandagatla CDC_RX_RXn_SIDETONE_EN_MASK, 1); 26304f692926SSrinivas Kandagatla snd_soc_component_write_field(component, CDC_RX_RXn_RX_PATH_CTL(w->shift), 26314f692926SSrinivas Kandagatla CDC_RX_PATH_CLK_EN_MASK, 1); 26324f692926SSrinivas Kandagatla break; 26334f692926SSrinivas Kandagatla case SND_SOC_DAPM_POST_PMD: 26344f692926SSrinivas Kandagatla snd_soc_component_write_field(component, CDC_RX_RXn_RX_PATH_CFG1(w->shift), 26354f692926SSrinivas Kandagatla CDC_RX_RXn_SIDETONE_EN_MASK, 0); 26364f692926SSrinivas Kandagatla rx_macro_enable_interp_clk(component, event, w->shift); 26374f692926SSrinivas Kandagatla break; 26384f692926SSrinivas Kandagatla default: 26394f692926SSrinivas Kandagatla break; 2640f758b9efSWan Jiabing } 26414f692926SSrinivas Kandagatla return 0; 26424f692926SSrinivas Kandagatla } 26434f692926SSrinivas Kandagatla 2644f3ce6f3cSSrinivas Kandagatla static int rx_macro_set_iir_gain(struct snd_soc_dapm_widget *w, 2645f3ce6f3cSSrinivas Kandagatla struct snd_kcontrol *kcontrol, int event) 2646f3ce6f3cSSrinivas Kandagatla { 2647f3ce6f3cSSrinivas Kandagatla struct snd_soc_component *component = snd_soc_dapm_to_component(w->dapm); 2648f3ce6f3cSSrinivas Kandagatla 2649f3ce6f3cSSrinivas Kandagatla switch (event) { 2650f3ce6f3cSSrinivas Kandagatla case SND_SOC_DAPM_POST_PMU: /* fall through */ 2651f3ce6f3cSSrinivas Kandagatla case SND_SOC_DAPM_PRE_PMD: 2652f3ce6f3cSSrinivas Kandagatla if (strnstr(w->name, "IIR0", sizeof("IIR0"))) { 2653f3ce6f3cSSrinivas Kandagatla snd_soc_component_write(component, 2654f3ce6f3cSSrinivas Kandagatla CDC_RX_SIDETONE_IIR0_IIR_GAIN_B1_CTL, 2655f3ce6f3cSSrinivas Kandagatla snd_soc_component_read(component, 2656f3ce6f3cSSrinivas Kandagatla CDC_RX_SIDETONE_IIR0_IIR_GAIN_B1_CTL)); 2657f3ce6f3cSSrinivas Kandagatla snd_soc_component_write(component, 2658f3ce6f3cSSrinivas Kandagatla CDC_RX_SIDETONE_IIR0_IIR_GAIN_B2_CTL, 2659f3ce6f3cSSrinivas Kandagatla snd_soc_component_read(component, 2660f3ce6f3cSSrinivas Kandagatla CDC_RX_SIDETONE_IIR0_IIR_GAIN_B2_CTL)); 2661f3ce6f3cSSrinivas Kandagatla snd_soc_component_write(component, 2662f3ce6f3cSSrinivas Kandagatla CDC_RX_SIDETONE_IIR0_IIR_GAIN_B3_CTL, 2663f3ce6f3cSSrinivas Kandagatla snd_soc_component_read(component, 2664f3ce6f3cSSrinivas Kandagatla CDC_RX_SIDETONE_IIR0_IIR_GAIN_B3_CTL)); 2665f3ce6f3cSSrinivas Kandagatla snd_soc_component_write(component, 2666f3ce6f3cSSrinivas Kandagatla CDC_RX_SIDETONE_IIR0_IIR_GAIN_B4_CTL, 2667f3ce6f3cSSrinivas Kandagatla snd_soc_component_read(component, 2668f3ce6f3cSSrinivas Kandagatla CDC_RX_SIDETONE_IIR0_IIR_GAIN_B4_CTL)); 2669f3ce6f3cSSrinivas Kandagatla } else { 2670f3ce6f3cSSrinivas Kandagatla snd_soc_component_write(component, 2671f3ce6f3cSSrinivas Kandagatla CDC_RX_SIDETONE_IIR1_IIR_GAIN_B1_CTL, 2672f3ce6f3cSSrinivas Kandagatla snd_soc_component_read(component, 2673f3ce6f3cSSrinivas Kandagatla CDC_RX_SIDETONE_IIR1_IIR_GAIN_B1_CTL)); 2674f3ce6f3cSSrinivas Kandagatla snd_soc_component_write(component, 2675f3ce6f3cSSrinivas Kandagatla CDC_RX_SIDETONE_IIR1_IIR_GAIN_B2_CTL, 2676f3ce6f3cSSrinivas Kandagatla snd_soc_component_read(component, 2677f3ce6f3cSSrinivas Kandagatla CDC_RX_SIDETONE_IIR1_IIR_GAIN_B2_CTL)); 2678f3ce6f3cSSrinivas Kandagatla snd_soc_component_write(component, 2679f3ce6f3cSSrinivas Kandagatla CDC_RX_SIDETONE_IIR1_IIR_GAIN_B3_CTL, 2680f3ce6f3cSSrinivas Kandagatla snd_soc_component_read(component, 2681f3ce6f3cSSrinivas Kandagatla CDC_RX_SIDETONE_IIR1_IIR_GAIN_B3_CTL)); 2682f3ce6f3cSSrinivas Kandagatla snd_soc_component_write(component, 2683f3ce6f3cSSrinivas Kandagatla CDC_RX_SIDETONE_IIR1_IIR_GAIN_B4_CTL, 2684f3ce6f3cSSrinivas Kandagatla snd_soc_component_read(component, 2685f3ce6f3cSSrinivas Kandagatla CDC_RX_SIDETONE_IIR1_IIR_GAIN_B4_CTL)); 2686f3ce6f3cSSrinivas Kandagatla } 2687f3ce6f3cSSrinivas Kandagatla break; 2688f3ce6f3cSSrinivas Kandagatla } 2689f3ce6f3cSSrinivas Kandagatla return 0; 2690f3ce6f3cSSrinivas Kandagatla } 2691f3ce6f3cSSrinivas Kandagatla 2692f3ce6f3cSSrinivas Kandagatla static uint32_t get_iir_band_coeff(struct snd_soc_component *component, 2693f3ce6f3cSSrinivas Kandagatla int iir_idx, int band_idx, int coeff_idx) 2694f3ce6f3cSSrinivas Kandagatla { 2695f3ce6f3cSSrinivas Kandagatla u32 value; 2696f3ce6f3cSSrinivas Kandagatla int reg, b2_reg; 2697f3ce6f3cSSrinivas Kandagatla 2698f3ce6f3cSSrinivas Kandagatla /* Address does not automatically update if reading */ 2699fca041a3SSrinivas Kandagatla reg = CDC_RX_SIDETONE_IIR0_IIR_COEF_B1_CTL + 0x80 * iir_idx; 2700fca041a3SSrinivas Kandagatla b2_reg = CDC_RX_SIDETONE_IIR0_IIR_COEF_B2_CTL + 0x80 * iir_idx; 2701f3ce6f3cSSrinivas Kandagatla 2702f3ce6f3cSSrinivas Kandagatla snd_soc_component_write(component, reg, 2703f3ce6f3cSSrinivas Kandagatla ((band_idx * BAND_MAX + coeff_idx) * 2704f3ce6f3cSSrinivas Kandagatla sizeof(uint32_t)) & 0x7F); 2705f3ce6f3cSSrinivas Kandagatla 2706f3ce6f3cSSrinivas Kandagatla value = snd_soc_component_read(component, b2_reg); 2707f3ce6f3cSSrinivas Kandagatla snd_soc_component_write(component, reg, 2708f3ce6f3cSSrinivas Kandagatla ((band_idx * BAND_MAX + coeff_idx) 2709f3ce6f3cSSrinivas Kandagatla * sizeof(uint32_t) + 1) & 0x7F); 2710f3ce6f3cSSrinivas Kandagatla 2711f3ce6f3cSSrinivas Kandagatla value |= (snd_soc_component_read(component, b2_reg) << 8); 2712f3ce6f3cSSrinivas Kandagatla snd_soc_component_write(component, reg, 2713f3ce6f3cSSrinivas Kandagatla ((band_idx * BAND_MAX + coeff_idx) 2714f3ce6f3cSSrinivas Kandagatla * sizeof(uint32_t) + 2) & 0x7F); 2715f3ce6f3cSSrinivas Kandagatla 2716f3ce6f3cSSrinivas Kandagatla value |= (snd_soc_component_read(component, b2_reg) << 16); 2717f3ce6f3cSSrinivas Kandagatla snd_soc_component_write(component, reg, 2718f3ce6f3cSSrinivas Kandagatla ((band_idx * BAND_MAX + coeff_idx) 2719f3ce6f3cSSrinivas Kandagatla * sizeof(uint32_t) + 3) & 0x7F); 2720f3ce6f3cSSrinivas Kandagatla 2721f3ce6f3cSSrinivas Kandagatla /* Mask bits top 2 bits since they are reserved */ 2722f3ce6f3cSSrinivas Kandagatla value |= (snd_soc_component_read(component, b2_reg) << 24); 2723f3ce6f3cSSrinivas Kandagatla return value; 2724f3ce6f3cSSrinivas Kandagatla } 2725f3ce6f3cSSrinivas Kandagatla 2726f3ce6f3cSSrinivas Kandagatla static void set_iir_band_coeff(struct snd_soc_component *component, 2727f3ce6f3cSSrinivas Kandagatla int iir_idx, int band_idx, uint32_t value) 2728f3ce6f3cSSrinivas Kandagatla { 2729fca041a3SSrinivas Kandagatla int reg = CDC_RX_SIDETONE_IIR0_IIR_COEF_B2_CTL + 0x80 * iir_idx; 2730f3ce6f3cSSrinivas Kandagatla 2731f3ce6f3cSSrinivas Kandagatla snd_soc_component_write(component, reg, (value & 0xFF)); 2732f3ce6f3cSSrinivas Kandagatla snd_soc_component_write(component, reg, (value >> 8) & 0xFF); 2733f3ce6f3cSSrinivas Kandagatla snd_soc_component_write(component, reg, (value >> 16) & 0xFF); 2734f3ce6f3cSSrinivas Kandagatla /* Mask top 2 bits, 7-8 are reserved */ 2735f3ce6f3cSSrinivas Kandagatla snd_soc_component_write(component, reg, (value >> 24) & 0x3F); 2736f3ce6f3cSSrinivas Kandagatla } 2737f3ce6f3cSSrinivas Kandagatla 2738f3ce6f3cSSrinivas Kandagatla static int rx_macro_put_iir_band_audio_mixer( 2739f3ce6f3cSSrinivas Kandagatla struct snd_kcontrol *kcontrol, 2740f3ce6f3cSSrinivas Kandagatla struct snd_ctl_elem_value *ucontrol) 2741f3ce6f3cSSrinivas Kandagatla { 2742f3ce6f3cSSrinivas Kandagatla struct snd_soc_component *component = 2743f3ce6f3cSSrinivas Kandagatla snd_soc_kcontrol_component(kcontrol); 2744f3ce6f3cSSrinivas Kandagatla struct wcd_iir_filter_ctl *ctl = 2745f3ce6f3cSSrinivas Kandagatla (struct wcd_iir_filter_ctl *)kcontrol->private_value; 2746f3ce6f3cSSrinivas Kandagatla struct soc_bytes_ext *params = &ctl->bytes_ext; 2747f3ce6f3cSSrinivas Kandagatla int iir_idx = ctl->iir_idx; 2748f3ce6f3cSSrinivas Kandagatla int band_idx = ctl->band_idx; 2749f3ce6f3cSSrinivas Kandagatla u32 coeff[BAND_MAX]; 2750fca041a3SSrinivas Kandagatla int reg = CDC_RX_SIDETONE_IIR0_IIR_COEF_B1_CTL + 0x80 * iir_idx; 2751f3ce6f3cSSrinivas Kandagatla 2752f3ce6f3cSSrinivas Kandagatla memcpy(&coeff[0], ucontrol->value.bytes.data, params->max); 2753f3ce6f3cSSrinivas Kandagatla 2754f3ce6f3cSSrinivas Kandagatla /* Mask top bit it is reserved */ 2755f3ce6f3cSSrinivas Kandagatla /* Updates addr automatically for each B2 write */ 2756f3ce6f3cSSrinivas Kandagatla snd_soc_component_write(component, reg, (band_idx * BAND_MAX * 2757f3ce6f3cSSrinivas Kandagatla sizeof(uint32_t)) & 0x7F); 2758f3ce6f3cSSrinivas Kandagatla 2759f3ce6f3cSSrinivas Kandagatla set_iir_band_coeff(component, iir_idx, band_idx, coeff[0]); 2760f3ce6f3cSSrinivas Kandagatla set_iir_band_coeff(component, iir_idx, band_idx, coeff[1]); 2761f3ce6f3cSSrinivas Kandagatla set_iir_band_coeff(component, iir_idx, band_idx, coeff[2]); 2762f3ce6f3cSSrinivas Kandagatla set_iir_band_coeff(component, iir_idx, band_idx, coeff[3]); 2763f3ce6f3cSSrinivas Kandagatla set_iir_band_coeff(component, iir_idx, band_idx, coeff[4]); 2764f3ce6f3cSSrinivas Kandagatla 2765f3ce6f3cSSrinivas Kandagatla return 0; 2766f3ce6f3cSSrinivas Kandagatla } 2767f3ce6f3cSSrinivas Kandagatla 2768f3ce6f3cSSrinivas Kandagatla static int rx_macro_get_iir_band_audio_mixer(struct snd_kcontrol *kcontrol, 2769f3ce6f3cSSrinivas Kandagatla struct snd_ctl_elem_value *ucontrol) 2770f3ce6f3cSSrinivas Kandagatla { 2771f3ce6f3cSSrinivas Kandagatla struct snd_soc_component *component = 2772f3ce6f3cSSrinivas Kandagatla snd_soc_kcontrol_component(kcontrol); 2773f3ce6f3cSSrinivas Kandagatla struct wcd_iir_filter_ctl *ctl = 2774f3ce6f3cSSrinivas Kandagatla (struct wcd_iir_filter_ctl *)kcontrol->private_value; 2775f3ce6f3cSSrinivas Kandagatla struct soc_bytes_ext *params = &ctl->bytes_ext; 2776f3ce6f3cSSrinivas Kandagatla int iir_idx = ctl->iir_idx; 2777f3ce6f3cSSrinivas Kandagatla int band_idx = ctl->band_idx; 2778f3ce6f3cSSrinivas Kandagatla u32 coeff[BAND_MAX]; 2779f3ce6f3cSSrinivas Kandagatla 2780f3ce6f3cSSrinivas Kandagatla coeff[0] = get_iir_band_coeff(component, iir_idx, band_idx, 0); 2781f3ce6f3cSSrinivas Kandagatla coeff[1] = get_iir_band_coeff(component, iir_idx, band_idx, 1); 2782f3ce6f3cSSrinivas Kandagatla coeff[2] = get_iir_band_coeff(component, iir_idx, band_idx, 2); 2783f3ce6f3cSSrinivas Kandagatla coeff[3] = get_iir_band_coeff(component, iir_idx, band_idx, 3); 2784f3ce6f3cSSrinivas Kandagatla coeff[4] = get_iir_band_coeff(component, iir_idx, band_idx, 4); 2785f3ce6f3cSSrinivas Kandagatla 2786f3ce6f3cSSrinivas Kandagatla memcpy(ucontrol->value.bytes.data, &coeff[0], params->max); 2787f3ce6f3cSSrinivas Kandagatla 2788f3ce6f3cSSrinivas Kandagatla return 0; 2789f3ce6f3cSSrinivas Kandagatla } 2790f3ce6f3cSSrinivas Kandagatla 2791f3ce6f3cSSrinivas Kandagatla static int rx_macro_iir_filter_info(struct snd_kcontrol *kcontrol, 2792f3ce6f3cSSrinivas Kandagatla struct snd_ctl_elem_info *ucontrol) 2793f3ce6f3cSSrinivas Kandagatla { 2794f3ce6f3cSSrinivas Kandagatla struct wcd_iir_filter_ctl *ctl = 2795f3ce6f3cSSrinivas Kandagatla (struct wcd_iir_filter_ctl *)kcontrol->private_value; 2796f3ce6f3cSSrinivas Kandagatla struct soc_bytes_ext *params = &ctl->bytes_ext; 2797f3ce6f3cSSrinivas Kandagatla 2798f3ce6f3cSSrinivas Kandagatla ucontrol->type = SNDRV_CTL_ELEM_TYPE_BYTES; 2799f3ce6f3cSSrinivas Kandagatla ucontrol->count = params->max; 2800f3ce6f3cSSrinivas Kandagatla 2801f3ce6f3cSSrinivas Kandagatla return 0; 2802f3ce6f3cSSrinivas Kandagatla } 2803f3ce6f3cSSrinivas Kandagatla 2804af3d54b9SSrinivas Kandagatla static const struct snd_kcontrol_new rx_macro_snd_controls[] = { 2805af3d54b9SSrinivas Kandagatla SOC_SINGLE_S8_TLV("RX_RX0 Digital Volume", CDC_RX_RX0_RX_VOL_CTL, 2806af3d54b9SSrinivas Kandagatla -84, 40, digital_gain), 2807af3d54b9SSrinivas Kandagatla SOC_SINGLE_S8_TLV("RX_RX1 Digital Volume", CDC_RX_RX1_RX_VOL_CTL, 2808af3d54b9SSrinivas Kandagatla -84, 40, digital_gain), 2809af3d54b9SSrinivas Kandagatla SOC_SINGLE_S8_TLV("RX_RX2 Digital Volume", CDC_RX_RX2_RX_VOL_CTL, 2810af3d54b9SSrinivas Kandagatla -84, 40, digital_gain), 2811af3d54b9SSrinivas Kandagatla SOC_SINGLE_S8_TLV("RX_RX0 Mix Digital Volume", CDC_RX_RX0_RX_VOL_MIX_CTL, 2812af3d54b9SSrinivas Kandagatla -84, 40, digital_gain), 2813af3d54b9SSrinivas Kandagatla SOC_SINGLE_S8_TLV("RX_RX1 Mix Digital Volume", CDC_RX_RX1_RX_VOL_MIX_CTL, 2814af3d54b9SSrinivas Kandagatla -84, 40, digital_gain), 2815af3d54b9SSrinivas Kandagatla SOC_SINGLE_S8_TLV("RX_RX2 Mix Digital Volume", CDC_RX_RX2_RX_VOL_MIX_CTL, 2816af3d54b9SSrinivas Kandagatla -84, 40, digital_gain), 2817af3d54b9SSrinivas Kandagatla 2818af3d54b9SSrinivas Kandagatla SOC_SINGLE_EXT("RX_COMP1 Switch", SND_SOC_NOPM, RX_MACRO_COMP1, 1, 0, 2819af3d54b9SSrinivas Kandagatla rx_macro_get_compander, rx_macro_set_compander), 2820af3d54b9SSrinivas Kandagatla SOC_SINGLE_EXT("RX_COMP2 Switch", SND_SOC_NOPM, RX_MACRO_COMP2, 1, 0, 2821af3d54b9SSrinivas Kandagatla rx_macro_get_compander, rx_macro_set_compander), 2822af3d54b9SSrinivas Kandagatla 2823af3d54b9SSrinivas Kandagatla SOC_SINGLE_EXT("RX_EAR Mode Switch", SND_SOC_NOPM, 0, 1, 0, 2824af3d54b9SSrinivas Kandagatla rx_macro_get_ear_mode, rx_macro_put_ear_mode), 2825af3d54b9SSrinivas Kandagatla 2826af3d54b9SSrinivas Kandagatla SOC_SINGLE_EXT("RX_HPH HD2 Mode Switch", SND_SOC_NOPM, 0, 1, 0, 2827af3d54b9SSrinivas Kandagatla rx_macro_get_hph_hd2_mode, rx_macro_put_hph_hd2_mode), 2828af3d54b9SSrinivas Kandagatla 2829af3d54b9SSrinivas Kandagatla SOC_ENUM_EXT("RX_HPH PWR Mode", rx_macro_hph_pwr_mode_enum, 2830af3d54b9SSrinivas Kandagatla rx_macro_get_hph_pwr_mode, rx_macro_put_hph_pwr_mode), 2831af3d54b9SSrinivas Kandagatla 2832af3d54b9SSrinivas Kandagatla SOC_SINGLE_EXT("RX_Softclip Switch", SND_SOC_NOPM, 0, 1, 0, 2833af3d54b9SSrinivas Kandagatla rx_macro_soft_clip_enable_get, 2834af3d54b9SSrinivas Kandagatla rx_macro_soft_clip_enable_put), 2835af3d54b9SSrinivas Kandagatla SOC_SINGLE_EXT("AUX_HPF Switch", SND_SOC_NOPM, 0, 1, 0, 2836af3d54b9SSrinivas Kandagatla rx_macro_aux_hpf_mode_get, 2837af3d54b9SSrinivas Kandagatla rx_macro_aux_hpf_mode_put), 2838f3ce6f3cSSrinivas Kandagatla 2839f3ce6f3cSSrinivas Kandagatla SOC_SINGLE_S8_TLV("IIR0 INP0 Volume", 2840f3ce6f3cSSrinivas Kandagatla CDC_RX_SIDETONE_IIR0_IIR_GAIN_B1_CTL, -84, 40, 2841f3ce6f3cSSrinivas Kandagatla digital_gain), 2842f3ce6f3cSSrinivas Kandagatla SOC_SINGLE_S8_TLV("IIR0 INP1 Volume", 2843f3ce6f3cSSrinivas Kandagatla CDC_RX_SIDETONE_IIR0_IIR_GAIN_B2_CTL, -84, 40, 2844f3ce6f3cSSrinivas Kandagatla digital_gain), 2845f3ce6f3cSSrinivas Kandagatla SOC_SINGLE_S8_TLV("IIR0 INP2 Volume", 2846f3ce6f3cSSrinivas Kandagatla CDC_RX_SIDETONE_IIR0_IIR_GAIN_B3_CTL, -84, 40, 2847f3ce6f3cSSrinivas Kandagatla digital_gain), 2848f3ce6f3cSSrinivas Kandagatla SOC_SINGLE_S8_TLV("IIR0 INP3 Volume", 2849f3ce6f3cSSrinivas Kandagatla CDC_RX_SIDETONE_IIR0_IIR_GAIN_B4_CTL, -84, 40, 2850f3ce6f3cSSrinivas Kandagatla digital_gain), 2851f3ce6f3cSSrinivas Kandagatla SOC_SINGLE_S8_TLV("IIR1 INP0 Volume", 2852f3ce6f3cSSrinivas Kandagatla CDC_RX_SIDETONE_IIR1_IIR_GAIN_B1_CTL, -84, 40, 2853f3ce6f3cSSrinivas Kandagatla digital_gain), 2854f3ce6f3cSSrinivas Kandagatla SOC_SINGLE_S8_TLV("IIR1 INP1 Volume", 2855f3ce6f3cSSrinivas Kandagatla CDC_RX_SIDETONE_IIR1_IIR_GAIN_B2_CTL, -84, 40, 2856f3ce6f3cSSrinivas Kandagatla digital_gain), 2857f3ce6f3cSSrinivas Kandagatla SOC_SINGLE_S8_TLV("IIR1 INP2 Volume", 2858f3ce6f3cSSrinivas Kandagatla CDC_RX_SIDETONE_IIR1_IIR_GAIN_B3_CTL, -84, 40, 2859f3ce6f3cSSrinivas Kandagatla digital_gain), 2860f3ce6f3cSSrinivas Kandagatla SOC_SINGLE_S8_TLV("IIR1 INP3 Volume", 2861f3ce6f3cSSrinivas Kandagatla CDC_RX_SIDETONE_IIR1_IIR_GAIN_B4_CTL, -84, 40, 2862f3ce6f3cSSrinivas Kandagatla digital_gain), 2863f3ce6f3cSSrinivas Kandagatla 2864f3ce6f3cSSrinivas Kandagatla SOC_SINGLE("IIR1 Band1 Switch", CDC_RX_SIDETONE_IIR0_IIR_CTL, 2865f3ce6f3cSSrinivas Kandagatla 0, 1, 0), 2866f3ce6f3cSSrinivas Kandagatla SOC_SINGLE("IIR1 Band2 Switch", CDC_RX_SIDETONE_IIR0_IIR_CTL, 2867f3ce6f3cSSrinivas Kandagatla 1, 1, 0), 2868f3ce6f3cSSrinivas Kandagatla SOC_SINGLE("IIR1 Band3 Switch", CDC_RX_SIDETONE_IIR0_IIR_CTL, 2869f3ce6f3cSSrinivas Kandagatla 2, 1, 0), 2870f3ce6f3cSSrinivas Kandagatla SOC_SINGLE("IIR1 Band4 Switch", CDC_RX_SIDETONE_IIR0_IIR_CTL, 2871f3ce6f3cSSrinivas Kandagatla 3, 1, 0), 2872f3ce6f3cSSrinivas Kandagatla SOC_SINGLE("IIR1 Band5 Switch", CDC_RX_SIDETONE_IIR0_IIR_CTL, 2873f3ce6f3cSSrinivas Kandagatla 4, 1, 0), 2874f3ce6f3cSSrinivas Kandagatla SOC_SINGLE("IIR2 Band1 Switch", CDC_RX_SIDETONE_IIR1_IIR_CTL, 2875f3ce6f3cSSrinivas Kandagatla 0, 1, 0), 2876f3ce6f3cSSrinivas Kandagatla SOC_SINGLE("IIR2 Band2 Switch", CDC_RX_SIDETONE_IIR1_IIR_CTL, 2877f3ce6f3cSSrinivas Kandagatla 1, 1, 0), 2878f3ce6f3cSSrinivas Kandagatla SOC_SINGLE("IIR2 Band3 Switch", CDC_RX_SIDETONE_IIR1_IIR_CTL, 2879f3ce6f3cSSrinivas Kandagatla 2, 1, 0), 2880f3ce6f3cSSrinivas Kandagatla SOC_SINGLE("IIR2 Band4 Switch", CDC_RX_SIDETONE_IIR1_IIR_CTL, 2881f3ce6f3cSSrinivas Kandagatla 3, 1, 0), 2882f3ce6f3cSSrinivas Kandagatla SOC_SINGLE("IIR2 Band5 Switch", CDC_RX_SIDETONE_IIR1_IIR_CTL, 2883f3ce6f3cSSrinivas Kandagatla 4, 1, 0), 2884f3ce6f3cSSrinivas Kandagatla 2885f3ce6f3cSSrinivas Kandagatla RX_MACRO_IIR_FILTER_CTL("IIR0 Band1", IIR0, BAND1), 2886f3ce6f3cSSrinivas Kandagatla RX_MACRO_IIR_FILTER_CTL("IIR0 Band2", IIR0, BAND2), 2887f3ce6f3cSSrinivas Kandagatla RX_MACRO_IIR_FILTER_CTL("IIR0 Band3", IIR0, BAND3), 2888f3ce6f3cSSrinivas Kandagatla RX_MACRO_IIR_FILTER_CTL("IIR0 Band4", IIR0, BAND4), 2889f3ce6f3cSSrinivas Kandagatla RX_MACRO_IIR_FILTER_CTL("IIR0 Band5", IIR0, BAND5), 2890f3ce6f3cSSrinivas Kandagatla 2891f3ce6f3cSSrinivas Kandagatla RX_MACRO_IIR_FILTER_CTL("IIR1 Band1", IIR1, BAND1), 2892f3ce6f3cSSrinivas Kandagatla RX_MACRO_IIR_FILTER_CTL("IIR1 Band2", IIR1, BAND2), 2893f3ce6f3cSSrinivas Kandagatla RX_MACRO_IIR_FILTER_CTL("IIR1 Band3", IIR1, BAND3), 2894f3ce6f3cSSrinivas Kandagatla RX_MACRO_IIR_FILTER_CTL("IIR1 Band4", IIR1, BAND4), 2895f3ce6f3cSSrinivas Kandagatla RX_MACRO_IIR_FILTER_CTL("IIR1 Band5", IIR1, BAND5), 2896f3ce6f3cSSrinivas Kandagatla 2897af3d54b9SSrinivas Kandagatla }; 2898af3d54b9SSrinivas Kandagatla 28994f692926SSrinivas Kandagatla static int rx_macro_enable_echo(struct snd_soc_dapm_widget *w, 29004f692926SSrinivas Kandagatla struct snd_kcontrol *kcontrol, 29014f692926SSrinivas Kandagatla int event) 29024f692926SSrinivas Kandagatla { 29034f692926SSrinivas Kandagatla struct snd_soc_component *component = snd_soc_dapm_to_component(w->dapm); 29044f692926SSrinivas Kandagatla u16 val, ec_hq_reg; 29050c0a5883SColin Ian King int ec_tx = -1; 29064f692926SSrinivas Kandagatla 29074f692926SSrinivas Kandagatla val = snd_soc_component_read(component, 29084f692926SSrinivas Kandagatla CDC_RX_INP_MUX_RX_MIX_CFG4); 2909*5efc1c90SKrzysztof Kozlowski if (!(snd_soc_dapm_widget_name_cmp(w, "RX MIX TX0 MUX"))) 29104f692926SSrinivas Kandagatla ec_tx = ((val & 0xf0) >> 0x4) - 1; 2911*5efc1c90SKrzysztof Kozlowski else if (!(snd_soc_dapm_widget_name_cmp(w, "RX MIX TX1 MUX"))) 29124f692926SSrinivas Kandagatla ec_tx = (val & 0x0f) - 1; 29134f692926SSrinivas Kandagatla 29144f692926SSrinivas Kandagatla val = snd_soc_component_read(component, 29154f692926SSrinivas Kandagatla CDC_RX_INP_MUX_RX_MIX_CFG5); 2916*5efc1c90SKrzysztof Kozlowski if (!(snd_soc_dapm_widget_name_cmp(w, "RX MIX TX2 MUX"))) 29174f692926SSrinivas Kandagatla ec_tx = (val & 0x0f) - 1; 29184f692926SSrinivas Kandagatla 29194f692926SSrinivas Kandagatla if (ec_tx < 0 || (ec_tx >= RX_MACRO_EC_MUX_MAX)) { 29204f692926SSrinivas Kandagatla dev_err(component->dev, "%s: EC mix control not set correctly\n", 29214f692926SSrinivas Kandagatla __func__); 29224f692926SSrinivas Kandagatla return -EINVAL; 29234f692926SSrinivas Kandagatla } 29244f692926SSrinivas Kandagatla ec_hq_reg = CDC_RX_EC_REF_HQ0_EC_REF_HQ_PATH_CTL + 29254f692926SSrinivas Kandagatla 0x40 * ec_tx; 29264f692926SSrinivas Kandagatla snd_soc_component_update_bits(component, ec_hq_reg, 0x01, 0x01); 29274f692926SSrinivas Kandagatla ec_hq_reg = CDC_RX_EC_REF_HQ0_EC_REF_HQ_CFG0 + 29284f692926SSrinivas Kandagatla 0x40 * ec_tx; 29294f692926SSrinivas Kandagatla /* default set to 48k */ 29304f692926SSrinivas Kandagatla snd_soc_component_update_bits(component, ec_hq_reg, 0x1E, 0x08); 29314f692926SSrinivas Kandagatla 29324f692926SSrinivas Kandagatla return 0; 29334f692926SSrinivas Kandagatla } 29344f692926SSrinivas Kandagatla 29354f692926SSrinivas Kandagatla static const struct snd_soc_dapm_widget rx_macro_dapm_widgets[] = { 29364f692926SSrinivas Kandagatla SND_SOC_DAPM_AIF_IN("RX AIF1 PB", "RX_MACRO_AIF1 Playback", 0, 29374f692926SSrinivas Kandagatla SND_SOC_NOPM, 0, 0), 29384f692926SSrinivas Kandagatla 29394f692926SSrinivas Kandagatla SND_SOC_DAPM_AIF_IN("RX AIF2 PB", "RX_MACRO_AIF2 Playback", 0, 29404f692926SSrinivas Kandagatla SND_SOC_NOPM, 0, 0), 29414f692926SSrinivas Kandagatla 29424f692926SSrinivas Kandagatla SND_SOC_DAPM_AIF_IN("RX AIF3 PB", "RX_MACRO_AIF3 Playback", 0, 29434f692926SSrinivas Kandagatla SND_SOC_NOPM, 0, 0), 29444f692926SSrinivas Kandagatla 29454f692926SSrinivas Kandagatla SND_SOC_DAPM_AIF_IN("RX AIF4 PB", "RX_MACRO_AIF4 Playback", 0, 29464f692926SSrinivas Kandagatla SND_SOC_NOPM, 0, 0), 29474f692926SSrinivas Kandagatla 29484f692926SSrinivas Kandagatla SND_SOC_DAPM_AIF_OUT("RX AIF_ECHO", "RX_AIF_ECHO Capture", 0, 29494f692926SSrinivas Kandagatla SND_SOC_NOPM, 0, 0), 29504f692926SSrinivas Kandagatla 29514f692926SSrinivas Kandagatla SND_SOC_DAPM_MUX("RX_MACRO RX0 MUX", SND_SOC_NOPM, RX_MACRO_RX0, 0, 29524f692926SSrinivas Kandagatla &rx_macro_rx0_mux), 29534f692926SSrinivas Kandagatla SND_SOC_DAPM_MUX("RX_MACRO RX1 MUX", SND_SOC_NOPM, RX_MACRO_RX1, 0, 29544f692926SSrinivas Kandagatla &rx_macro_rx1_mux), 29554f692926SSrinivas Kandagatla SND_SOC_DAPM_MUX("RX_MACRO RX2 MUX", SND_SOC_NOPM, RX_MACRO_RX2, 0, 29564f692926SSrinivas Kandagatla &rx_macro_rx2_mux), 29574f692926SSrinivas Kandagatla SND_SOC_DAPM_MUX("RX_MACRO RX3 MUX", SND_SOC_NOPM, RX_MACRO_RX3, 0, 29584f692926SSrinivas Kandagatla &rx_macro_rx3_mux), 29594f692926SSrinivas Kandagatla SND_SOC_DAPM_MUX("RX_MACRO RX4 MUX", SND_SOC_NOPM, RX_MACRO_RX4, 0, 29604f692926SSrinivas Kandagatla &rx_macro_rx4_mux), 29614f692926SSrinivas Kandagatla SND_SOC_DAPM_MUX("RX_MACRO RX5 MUX", SND_SOC_NOPM, RX_MACRO_RX5, 0, 29624f692926SSrinivas Kandagatla &rx_macro_rx5_mux), 29634f692926SSrinivas Kandagatla 29644f692926SSrinivas Kandagatla SND_SOC_DAPM_MIXER("RX_RX0", SND_SOC_NOPM, 0, 0, NULL, 0), 29654f692926SSrinivas Kandagatla SND_SOC_DAPM_MIXER("RX_RX1", SND_SOC_NOPM, 0, 0, NULL, 0), 29664f692926SSrinivas Kandagatla SND_SOC_DAPM_MIXER("RX_RX2", SND_SOC_NOPM, 0, 0, NULL, 0), 29674f692926SSrinivas Kandagatla SND_SOC_DAPM_MIXER("RX_RX3", SND_SOC_NOPM, 0, 0, NULL, 0), 29684f692926SSrinivas Kandagatla SND_SOC_DAPM_MIXER("RX_RX4", SND_SOC_NOPM, 0, 0, NULL, 0), 29694f692926SSrinivas Kandagatla SND_SOC_DAPM_MIXER("RX_RX5", SND_SOC_NOPM, 0, 0, NULL, 0), 29704f692926SSrinivas Kandagatla 29714f692926SSrinivas Kandagatla SND_SOC_DAPM_MUX("IIR0 INP0 MUX", SND_SOC_NOPM, 0, 0, &iir0_inp0_mux), 29724f692926SSrinivas Kandagatla SND_SOC_DAPM_MUX("IIR0 INP1 MUX", SND_SOC_NOPM, 0, 0, &iir0_inp1_mux), 29734f692926SSrinivas Kandagatla SND_SOC_DAPM_MUX("IIR0 INP2 MUX", SND_SOC_NOPM, 0, 0, &iir0_inp2_mux), 29744f692926SSrinivas Kandagatla SND_SOC_DAPM_MUX("IIR0 INP3 MUX", SND_SOC_NOPM, 0, 0, &iir0_inp3_mux), 29754f692926SSrinivas Kandagatla SND_SOC_DAPM_MUX("IIR1 INP0 MUX", SND_SOC_NOPM, 0, 0, &iir1_inp0_mux), 29764f692926SSrinivas Kandagatla SND_SOC_DAPM_MUX("IIR1 INP1 MUX", SND_SOC_NOPM, 0, 0, &iir1_inp1_mux), 29774f692926SSrinivas Kandagatla SND_SOC_DAPM_MUX("IIR1 INP2 MUX", SND_SOC_NOPM, 0, 0, &iir1_inp2_mux), 29784f692926SSrinivas Kandagatla SND_SOC_DAPM_MUX("IIR1 INP3 MUX", SND_SOC_NOPM, 0, 0, &iir1_inp3_mux), 29794f692926SSrinivas Kandagatla 29804f692926SSrinivas Kandagatla SND_SOC_DAPM_MUX_E("RX MIX TX0 MUX", SND_SOC_NOPM, 29814f692926SSrinivas Kandagatla RX_MACRO_EC0_MUX, 0, 29824f692926SSrinivas Kandagatla &rx_mix_tx0_mux, rx_macro_enable_echo, 29834f692926SSrinivas Kandagatla SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMD), 29844f692926SSrinivas Kandagatla SND_SOC_DAPM_MUX_E("RX MIX TX1 MUX", SND_SOC_NOPM, 29854f692926SSrinivas Kandagatla RX_MACRO_EC1_MUX, 0, 29864f692926SSrinivas Kandagatla &rx_mix_tx1_mux, rx_macro_enable_echo, 29874f692926SSrinivas Kandagatla SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMD), 29884f692926SSrinivas Kandagatla SND_SOC_DAPM_MUX_E("RX MIX TX2 MUX", SND_SOC_NOPM, 29894f692926SSrinivas Kandagatla RX_MACRO_EC2_MUX, 0, 29904f692926SSrinivas Kandagatla &rx_mix_tx2_mux, rx_macro_enable_echo, 29914f692926SSrinivas Kandagatla SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMD), 2992f3ce6f3cSSrinivas Kandagatla 2993f3ce6f3cSSrinivas Kandagatla SND_SOC_DAPM_MIXER_E("IIR0", CDC_RX_SIDETONE_IIR0_IIR_PATH_CTL, 2994f3ce6f3cSSrinivas Kandagatla 4, 0, NULL, 0, rx_macro_set_iir_gain, 2995f3ce6f3cSSrinivas Kandagatla SND_SOC_DAPM_POST_PMU | SND_SOC_DAPM_PRE_PMD), 2996f3ce6f3cSSrinivas Kandagatla SND_SOC_DAPM_MIXER_E("IIR1", CDC_RX_SIDETONE_IIR1_IIR_PATH_CTL, 2997f3ce6f3cSSrinivas Kandagatla 4, 0, NULL, 0, rx_macro_set_iir_gain, 2998f3ce6f3cSSrinivas Kandagatla SND_SOC_DAPM_POST_PMU | SND_SOC_DAPM_PRE_PMD), 29994f692926SSrinivas Kandagatla SND_SOC_DAPM_MIXER("SRC0", CDC_RX_SIDETONE_SRC0_ST_SRC_PATH_CTL, 30004f692926SSrinivas Kandagatla 4, 0, NULL, 0), 30014f692926SSrinivas Kandagatla SND_SOC_DAPM_MIXER("SRC1", CDC_RX_SIDETONE_SRC1_ST_SRC_PATH_CTL, 30024f692926SSrinivas Kandagatla 4, 0, NULL, 0), 30034f692926SSrinivas Kandagatla 30044f692926SSrinivas Kandagatla SND_SOC_DAPM_MUX("RX INT0 DEM MUX", SND_SOC_NOPM, 0, 0, 30054f692926SSrinivas Kandagatla &rx_int0_dem_inp_mux), 30064f692926SSrinivas Kandagatla SND_SOC_DAPM_MUX("RX INT1 DEM MUX", SND_SOC_NOPM, 0, 0, 30074f692926SSrinivas Kandagatla &rx_int1_dem_inp_mux), 30084f692926SSrinivas Kandagatla 30094f692926SSrinivas Kandagatla SND_SOC_DAPM_MUX_E("RX INT0_2 MUX", SND_SOC_NOPM, INTERP_HPHL, 0, 30104f692926SSrinivas Kandagatla &rx_int0_2_mux, rx_macro_enable_mix_path, 30114f692926SSrinivas Kandagatla SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMU | 30124f692926SSrinivas Kandagatla SND_SOC_DAPM_POST_PMD), 30134f692926SSrinivas Kandagatla SND_SOC_DAPM_MUX_E("RX INT1_2 MUX", SND_SOC_NOPM, INTERP_HPHR, 0, 30144f692926SSrinivas Kandagatla &rx_int1_2_mux, rx_macro_enable_mix_path, 30154f692926SSrinivas Kandagatla SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMU | 30164f692926SSrinivas Kandagatla SND_SOC_DAPM_POST_PMD), 30174f692926SSrinivas Kandagatla SND_SOC_DAPM_MUX_E("RX INT2_2 MUX", SND_SOC_NOPM, INTERP_AUX, 0, 30184f692926SSrinivas Kandagatla &rx_int2_2_mux, rx_macro_enable_mix_path, 30194f692926SSrinivas Kandagatla SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMU | 30204f692926SSrinivas Kandagatla SND_SOC_DAPM_POST_PMD), 30214f692926SSrinivas Kandagatla 30224f692926SSrinivas Kandagatla SND_SOC_DAPM_MUX("RX INT0_1 MIX1 INP0", SND_SOC_NOPM, 0, 0, &rx_int0_1_mix_inp0_mux), 30234f692926SSrinivas Kandagatla SND_SOC_DAPM_MUX("RX INT0_1 MIX1 INP1", SND_SOC_NOPM, 0, 0, &rx_int0_1_mix_inp1_mux), 30244f692926SSrinivas Kandagatla SND_SOC_DAPM_MUX("RX INT0_1 MIX1 INP2", SND_SOC_NOPM, 0, 0, &rx_int0_1_mix_inp2_mux), 30254f692926SSrinivas Kandagatla SND_SOC_DAPM_MUX("RX INT1_1 MIX1 INP0", SND_SOC_NOPM, 0, 0, &rx_int1_1_mix_inp0_mux), 30264f692926SSrinivas Kandagatla SND_SOC_DAPM_MUX("RX INT1_1 MIX1 INP1", SND_SOC_NOPM, 0, 0, &rx_int1_1_mix_inp1_mux), 30274f692926SSrinivas Kandagatla SND_SOC_DAPM_MUX("RX INT1_1 MIX1 INP2", SND_SOC_NOPM, 0, 0, &rx_int1_1_mix_inp2_mux), 30284f692926SSrinivas Kandagatla SND_SOC_DAPM_MUX("RX INT2_1 MIX1 INP0", SND_SOC_NOPM, 0, 0, &rx_int2_1_mix_inp0_mux), 30294f692926SSrinivas Kandagatla SND_SOC_DAPM_MUX("RX INT2_1 MIX1 INP1", SND_SOC_NOPM, 0, 0, &rx_int2_1_mix_inp1_mux), 30304f692926SSrinivas Kandagatla SND_SOC_DAPM_MUX("RX INT2_1 MIX1 INP2", SND_SOC_NOPM, 0, 0, &rx_int2_1_mix_inp2_mux), 30314f692926SSrinivas Kandagatla 30324f692926SSrinivas Kandagatla SND_SOC_DAPM_MUX_E("RX INT0_1 INTERP", SND_SOC_NOPM, INTERP_HPHL, 0, 30334f692926SSrinivas Kandagatla &rx_int0_1_interp_mux, rx_macro_enable_main_path, 30344f692926SSrinivas Kandagatla SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMU | 30354f692926SSrinivas Kandagatla SND_SOC_DAPM_POST_PMD), 30364f692926SSrinivas Kandagatla SND_SOC_DAPM_MUX_E("RX INT1_1 INTERP", SND_SOC_NOPM, INTERP_HPHR, 0, 30374f692926SSrinivas Kandagatla &rx_int1_1_interp_mux, rx_macro_enable_main_path, 30384f692926SSrinivas Kandagatla SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMU | 30394f692926SSrinivas Kandagatla SND_SOC_DAPM_POST_PMD), 30404f692926SSrinivas Kandagatla SND_SOC_DAPM_MUX_E("RX INT2_1 INTERP", SND_SOC_NOPM, INTERP_AUX, 0, 30414f692926SSrinivas Kandagatla &rx_int2_1_interp_mux, rx_macro_enable_main_path, 30424f692926SSrinivas Kandagatla SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMU | 30434f692926SSrinivas Kandagatla SND_SOC_DAPM_POST_PMD), 30444f692926SSrinivas Kandagatla 30454f692926SSrinivas Kandagatla SND_SOC_DAPM_MUX("RX INT0_2 INTERP", SND_SOC_NOPM, 0, 0, 30464f692926SSrinivas Kandagatla &rx_int0_2_interp_mux), 30474f692926SSrinivas Kandagatla SND_SOC_DAPM_MUX("RX INT1_2 INTERP", SND_SOC_NOPM, 0, 0, 30484f692926SSrinivas Kandagatla &rx_int1_2_interp_mux), 30494f692926SSrinivas Kandagatla SND_SOC_DAPM_MUX("RX INT2_2 INTERP", SND_SOC_NOPM, 0, 0, 30504f692926SSrinivas Kandagatla &rx_int2_2_interp_mux), 30514f692926SSrinivas Kandagatla 30524f692926SSrinivas Kandagatla SND_SOC_DAPM_MIXER("RX INT0_1 MIX1", SND_SOC_NOPM, 0, 0, NULL, 0), 30534f692926SSrinivas Kandagatla SND_SOC_DAPM_MIXER("RX INT0 SEC MIX", SND_SOC_NOPM, 0, 0, NULL, 0), 30544f692926SSrinivas Kandagatla SND_SOC_DAPM_MIXER("RX INT1_1 MIX1", SND_SOC_NOPM, 0, 0, NULL, 0), 30554f692926SSrinivas Kandagatla SND_SOC_DAPM_MIXER("RX INT1 SEC MIX", SND_SOC_NOPM, 0, 0, NULL, 0), 30564f692926SSrinivas Kandagatla SND_SOC_DAPM_MIXER("RX INT2_1 MIX1", SND_SOC_NOPM, 0, 0, NULL, 0), 30574f692926SSrinivas Kandagatla SND_SOC_DAPM_MIXER("RX INT2 SEC MIX", SND_SOC_NOPM, 0, 0, NULL, 0), 30584f692926SSrinivas Kandagatla 30594f692926SSrinivas Kandagatla SND_SOC_DAPM_MUX_E("RX INT0 MIX2 INP", SND_SOC_NOPM, INTERP_HPHL, 30604f692926SSrinivas Kandagatla 0, &rx_int0_mix2_inp_mux, rx_macro_enable_rx_path_clk, 30614f692926SSrinivas Kandagatla SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMD), 30624f692926SSrinivas Kandagatla SND_SOC_DAPM_MUX_E("RX INT1 MIX2 INP", SND_SOC_NOPM, INTERP_HPHR, 30634f692926SSrinivas Kandagatla 0, &rx_int1_mix2_inp_mux, rx_macro_enable_rx_path_clk, 30644f692926SSrinivas Kandagatla SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMD), 30654f692926SSrinivas Kandagatla SND_SOC_DAPM_MUX_E("RX INT2 MIX2 INP", SND_SOC_NOPM, INTERP_AUX, 30664f692926SSrinivas Kandagatla 0, &rx_int2_mix2_inp_mux, rx_macro_enable_rx_path_clk, 30674f692926SSrinivas Kandagatla SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMD), 30684f692926SSrinivas Kandagatla 30694f692926SSrinivas Kandagatla SND_SOC_DAPM_MIXER("RX INT0 MIX2", SND_SOC_NOPM, 0, 0, NULL, 0), 30704f692926SSrinivas Kandagatla SND_SOC_DAPM_MIXER("RX INT1 MIX2", SND_SOC_NOPM, 0, 0, NULL, 0), 30714f692926SSrinivas Kandagatla SND_SOC_DAPM_MIXER("RX INT2 MIX2", SND_SOC_NOPM, 0, 0, NULL, 0), 30724f692926SSrinivas Kandagatla 30734f692926SSrinivas Kandagatla SND_SOC_DAPM_OUTPUT("HPHL_OUT"), 30744f692926SSrinivas Kandagatla SND_SOC_DAPM_OUTPUT("HPHR_OUT"), 30754f692926SSrinivas Kandagatla SND_SOC_DAPM_OUTPUT("AUX_OUT"), 30764f692926SSrinivas Kandagatla 30774f692926SSrinivas Kandagatla SND_SOC_DAPM_INPUT("RX_TX DEC0_INP"), 30784f692926SSrinivas Kandagatla SND_SOC_DAPM_INPUT("RX_TX DEC1_INP"), 30794f692926SSrinivas Kandagatla SND_SOC_DAPM_INPUT("RX_TX DEC2_INP"), 30804f692926SSrinivas Kandagatla SND_SOC_DAPM_INPUT("RX_TX DEC3_INP"), 30814f692926SSrinivas Kandagatla 30824f692926SSrinivas Kandagatla SND_SOC_DAPM_SUPPLY_S("RX_MCLK", 0, SND_SOC_NOPM, 0, 0, 30834f692926SSrinivas Kandagatla rx_macro_mclk_event, SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMD), 30844f692926SSrinivas Kandagatla }; 30854f692926SSrinivas Kandagatla 30864f692926SSrinivas Kandagatla static const struct snd_soc_dapm_route rx_audio_map[] = { 30874f692926SSrinivas Kandagatla {"RX AIF1 PB", NULL, "RX_MCLK"}, 30884f692926SSrinivas Kandagatla {"RX AIF2 PB", NULL, "RX_MCLK"}, 30894f692926SSrinivas Kandagatla {"RX AIF3 PB", NULL, "RX_MCLK"}, 30904f692926SSrinivas Kandagatla {"RX AIF4 PB", NULL, "RX_MCLK"}, 30914f692926SSrinivas Kandagatla 30924f692926SSrinivas Kandagatla {"RX_MACRO RX0 MUX", "AIF1_PB", "RX AIF1 PB"}, 30934f692926SSrinivas Kandagatla {"RX_MACRO RX1 MUX", "AIF1_PB", "RX AIF1 PB"}, 30944f692926SSrinivas Kandagatla {"RX_MACRO RX2 MUX", "AIF1_PB", "RX AIF1 PB"}, 30954f692926SSrinivas Kandagatla {"RX_MACRO RX3 MUX", "AIF1_PB", "RX AIF1 PB"}, 30964f692926SSrinivas Kandagatla {"RX_MACRO RX4 MUX", "AIF1_PB", "RX AIF1 PB"}, 30974f692926SSrinivas Kandagatla {"RX_MACRO RX5 MUX", "AIF1_PB", "RX AIF1 PB"}, 30984f692926SSrinivas Kandagatla 30994f692926SSrinivas Kandagatla {"RX_MACRO RX0 MUX", "AIF2_PB", "RX AIF2 PB"}, 31004f692926SSrinivas Kandagatla {"RX_MACRO RX1 MUX", "AIF2_PB", "RX AIF2 PB"}, 31014f692926SSrinivas Kandagatla {"RX_MACRO RX2 MUX", "AIF2_PB", "RX AIF2 PB"}, 31024f692926SSrinivas Kandagatla {"RX_MACRO RX3 MUX", "AIF2_PB", "RX AIF2 PB"}, 31034f692926SSrinivas Kandagatla {"RX_MACRO RX4 MUX", "AIF2_PB", "RX AIF2 PB"}, 31044f692926SSrinivas Kandagatla {"RX_MACRO RX5 MUX", "AIF2_PB", "RX AIF2 PB"}, 31054f692926SSrinivas Kandagatla 31064f692926SSrinivas Kandagatla {"RX_MACRO RX0 MUX", "AIF3_PB", "RX AIF3 PB"}, 31074f692926SSrinivas Kandagatla {"RX_MACRO RX1 MUX", "AIF3_PB", "RX AIF3 PB"}, 31084f692926SSrinivas Kandagatla {"RX_MACRO RX2 MUX", "AIF3_PB", "RX AIF3 PB"}, 31094f692926SSrinivas Kandagatla {"RX_MACRO RX3 MUX", "AIF3_PB", "RX AIF3 PB"}, 31104f692926SSrinivas Kandagatla {"RX_MACRO RX4 MUX", "AIF3_PB", "RX AIF3 PB"}, 31114f692926SSrinivas Kandagatla {"RX_MACRO RX5 MUX", "AIF3_PB", "RX AIF3 PB"}, 31124f692926SSrinivas Kandagatla 31134f692926SSrinivas Kandagatla {"RX_MACRO RX0 MUX", "AIF4_PB", "RX AIF4 PB"}, 31144f692926SSrinivas Kandagatla {"RX_MACRO RX1 MUX", "AIF4_PB", "RX AIF4 PB"}, 31154f692926SSrinivas Kandagatla {"RX_MACRO RX2 MUX", "AIF4_PB", "RX AIF4 PB"}, 31164f692926SSrinivas Kandagatla {"RX_MACRO RX3 MUX", "AIF4_PB", "RX AIF4 PB"}, 31174f692926SSrinivas Kandagatla {"RX_MACRO RX4 MUX", "AIF4_PB", "RX AIF4 PB"}, 31184f692926SSrinivas Kandagatla {"RX_MACRO RX5 MUX", "AIF4_PB", "RX AIF4 PB"}, 31194f692926SSrinivas Kandagatla 31204f692926SSrinivas Kandagatla {"RX_RX0", NULL, "RX_MACRO RX0 MUX"}, 31214f692926SSrinivas Kandagatla {"RX_RX1", NULL, "RX_MACRO RX1 MUX"}, 31224f692926SSrinivas Kandagatla {"RX_RX2", NULL, "RX_MACRO RX2 MUX"}, 31234f692926SSrinivas Kandagatla {"RX_RX3", NULL, "RX_MACRO RX3 MUX"}, 31244f692926SSrinivas Kandagatla {"RX_RX4", NULL, "RX_MACRO RX4 MUX"}, 31254f692926SSrinivas Kandagatla {"RX_RX5", NULL, "RX_MACRO RX5 MUX"}, 31264f692926SSrinivas Kandagatla 31274f692926SSrinivas Kandagatla {"RX INT0_1 MIX1 INP0", "RX0", "RX_RX0"}, 31284f692926SSrinivas Kandagatla {"RX INT0_1 MIX1 INP0", "RX1", "RX_RX1"}, 31294f692926SSrinivas Kandagatla {"RX INT0_1 MIX1 INP0", "RX2", "RX_RX2"}, 31304f692926SSrinivas Kandagatla {"RX INT0_1 MIX1 INP0", "RX3", "RX_RX3"}, 31314f692926SSrinivas Kandagatla {"RX INT0_1 MIX1 INP0", "RX4", "RX_RX4"}, 31324f692926SSrinivas Kandagatla {"RX INT0_1 MIX1 INP0", "RX5", "RX_RX5"}, 31334f692926SSrinivas Kandagatla {"RX INT0_1 MIX1 INP0", "IIR0", "IIR0"}, 31344f692926SSrinivas Kandagatla {"RX INT0_1 MIX1 INP0", "IIR1", "IIR1"}, 31354f692926SSrinivas Kandagatla {"RX INT0_1 MIX1 INP0", "DEC0", "RX_TX DEC0_INP"}, 31364f692926SSrinivas Kandagatla {"RX INT0_1 MIX1 INP0", "DEC1", "RX_TX DEC1_INP"}, 31374f692926SSrinivas Kandagatla {"RX INT0_1 MIX1 INP1", "RX0", "RX_RX0"}, 31384f692926SSrinivas Kandagatla {"RX INT0_1 MIX1 INP1", "RX1", "RX_RX1"}, 31394f692926SSrinivas Kandagatla {"RX INT0_1 MIX1 INP1", "RX2", "RX_RX2"}, 31404f692926SSrinivas Kandagatla {"RX INT0_1 MIX1 INP1", "RX3", "RX_RX3"}, 31414f692926SSrinivas Kandagatla {"RX INT0_1 MIX1 INP1", "RX4", "RX_RX4"}, 31424f692926SSrinivas Kandagatla {"RX INT0_1 MIX1 INP1", "RX5", "RX_RX5"}, 31434f692926SSrinivas Kandagatla {"RX INT0_1 MIX1 INP1", "IIR0", "IIR0"}, 31444f692926SSrinivas Kandagatla {"RX INT0_1 MIX1 INP1", "IIR1", "IIR1"}, 31454f692926SSrinivas Kandagatla {"RX INT0_1 MIX1 INP1", "DEC0", "RX_TX DEC0_INP"}, 31464f692926SSrinivas Kandagatla {"RX INT0_1 MIX1 INP1", "DEC1", "RX_TX DEC1_INP"}, 31474f692926SSrinivas Kandagatla {"RX INT0_1 MIX1 INP2", "RX0", "RX_RX0"}, 31484f692926SSrinivas Kandagatla {"RX INT0_1 MIX1 INP2", "RX1", "RX_RX1"}, 31494f692926SSrinivas Kandagatla {"RX INT0_1 MIX1 INP2", "RX2", "RX_RX2"}, 31504f692926SSrinivas Kandagatla {"RX INT0_1 MIX1 INP2", "RX3", "RX_RX3"}, 31514f692926SSrinivas Kandagatla {"RX INT0_1 MIX1 INP2", "RX4", "RX_RX4"}, 31524f692926SSrinivas Kandagatla {"RX INT0_1 MIX1 INP2", "RX5", "RX_RX5"}, 31534f692926SSrinivas Kandagatla {"RX INT0_1 MIX1 INP2", "IIR0", "IIR0"}, 31544f692926SSrinivas Kandagatla {"RX INT0_1 MIX1 INP2", "IIR1", "IIR1"}, 31554f692926SSrinivas Kandagatla {"RX INT0_1 MIX1 INP2", "DEC0", "RX_TX DEC0_INP"}, 31564f692926SSrinivas Kandagatla {"RX INT0_1 MIX1 INP2", "DEC1", "RX_TX DEC1_INP"}, 31574f692926SSrinivas Kandagatla 31584f692926SSrinivas Kandagatla {"RX INT1_1 MIX1 INP0", "RX0", "RX_RX0"}, 31594f692926SSrinivas Kandagatla {"RX INT1_1 MIX1 INP0", "RX1", "RX_RX1"}, 31604f692926SSrinivas Kandagatla {"RX INT1_1 MIX1 INP0", "RX2", "RX_RX2"}, 31614f692926SSrinivas Kandagatla {"RX INT1_1 MIX1 INP0", "RX3", "RX_RX3"}, 31624f692926SSrinivas Kandagatla {"RX INT1_1 MIX1 INP0", "RX4", "RX_RX4"}, 31634f692926SSrinivas Kandagatla {"RX INT1_1 MIX1 INP0", "RX5", "RX_RX5"}, 31644f692926SSrinivas Kandagatla {"RX INT1_1 MIX1 INP0", "IIR0", "IIR0"}, 31654f692926SSrinivas Kandagatla {"RX INT1_1 MIX1 INP0", "IIR1", "IIR1"}, 31664f692926SSrinivas Kandagatla {"RX INT1_1 MIX1 INP0", "DEC0", "RX_TX DEC0_INP"}, 31674f692926SSrinivas Kandagatla {"RX INT1_1 MIX1 INP0", "DEC1", "RX_TX DEC1_INP"}, 31684f692926SSrinivas Kandagatla {"RX INT1_1 MIX1 INP1", "RX0", "RX_RX0"}, 31694f692926SSrinivas Kandagatla {"RX INT1_1 MIX1 INP1", "RX1", "RX_RX1"}, 31704f692926SSrinivas Kandagatla {"RX INT1_1 MIX1 INP1", "RX2", "RX_RX2"}, 31714f692926SSrinivas Kandagatla {"RX INT1_1 MIX1 INP1", "RX3", "RX_RX3"}, 31724f692926SSrinivas Kandagatla {"RX INT1_1 MIX1 INP1", "RX4", "RX_RX4"}, 31734f692926SSrinivas Kandagatla {"RX INT1_1 MIX1 INP1", "RX5", "RX_RX5"}, 31744f692926SSrinivas Kandagatla {"RX INT1_1 MIX1 INP1", "IIR0", "IIR0"}, 31754f692926SSrinivas Kandagatla {"RX INT1_1 MIX1 INP1", "IIR1", "IIR1"}, 31764f692926SSrinivas Kandagatla {"RX INT1_1 MIX1 INP1", "DEC0", "RX_TX DEC0_INP"}, 31774f692926SSrinivas Kandagatla {"RX INT1_1 MIX1 INP1", "DEC1", "RX_TX DEC1_INP"}, 31784f692926SSrinivas Kandagatla {"RX INT1_1 MIX1 INP2", "RX0", "RX_RX0"}, 31794f692926SSrinivas Kandagatla {"RX INT1_1 MIX1 INP2", "RX1", "RX_RX1"}, 31804f692926SSrinivas Kandagatla {"RX INT1_1 MIX1 INP2", "RX2", "RX_RX2"}, 31814f692926SSrinivas Kandagatla {"RX INT1_1 MIX1 INP2", "RX3", "RX_RX3"}, 31824f692926SSrinivas Kandagatla {"RX INT1_1 MIX1 INP2", "RX4", "RX_RX4"}, 31834f692926SSrinivas Kandagatla {"RX INT1_1 MIX1 INP2", "RX5", "RX_RX5"}, 31844f692926SSrinivas Kandagatla {"RX INT1_1 MIX1 INP2", "IIR0", "IIR0"}, 31854f692926SSrinivas Kandagatla {"RX INT1_1 MIX1 INP2", "IIR1", "IIR1"}, 31864f692926SSrinivas Kandagatla {"RX INT1_1 MIX1 INP2", "DEC0", "RX_TX DEC0_INP"}, 31874f692926SSrinivas Kandagatla {"RX INT1_1 MIX1 INP2", "DEC1", "RX_TX DEC1_INP"}, 31884f692926SSrinivas Kandagatla 31894f692926SSrinivas Kandagatla {"RX INT2_1 MIX1 INP0", "RX0", "RX_RX0"}, 31904f692926SSrinivas Kandagatla {"RX INT2_1 MIX1 INP0", "RX1", "RX_RX1"}, 31914f692926SSrinivas Kandagatla {"RX INT2_1 MIX1 INP0", "RX2", "RX_RX2"}, 31924f692926SSrinivas Kandagatla {"RX INT2_1 MIX1 INP0", "RX3", "RX_RX3"}, 31934f692926SSrinivas Kandagatla {"RX INT2_1 MIX1 INP0", "RX4", "RX_RX4"}, 31944f692926SSrinivas Kandagatla {"RX INT2_1 MIX1 INP0", "RX5", "RX_RX5"}, 31954f692926SSrinivas Kandagatla {"RX INT2_1 MIX1 INP0", "IIR0", "IIR0"}, 31964f692926SSrinivas Kandagatla {"RX INT2_1 MIX1 INP0", "IIR1", "IIR1"}, 31974f692926SSrinivas Kandagatla {"RX INT2_1 MIX1 INP0", "DEC0", "RX_TX DEC0_INP"}, 31984f692926SSrinivas Kandagatla {"RX INT2_1 MIX1 INP0", "DEC1", "RX_TX DEC1_INP"}, 31994f692926SSrinivas Kandagatla {"RX INT2_1 MIX1 INP1", "RX0", "RX_RX0"}, 32004f692926SSrinivas Kandagatla {"RX INT2_1 MIX1 INP1", "RX1", "RX_RX1"}, 32014f692926SSrinivas Kandagatla {"RX INT2_1 MIX1 INP1", "RX2", "RX_RX2"}, 32024f692926SSrinivas Kandagatla {"RX INT2_1 MIX1 INP1", "RX3", "RX_RX3"}, 32034f692926SSrinivas Kandagatla {"RX INT2_1 MIX1 INP1", "RX4", "RX_RX4"}, 32044f692926SSrinivas Kandagatla {"RX INT2_1 MIX1 INP1", "RX5", "RX_RX5"}, 32054f692926SSrinivas Kandagatla {"RX INT2_1 MIX1 INP1", "IIR0", "IIR0"}, 32064f692926SSrinivas Kandagatla {"RX INT2_1 MIX1 INP1", "IIR1", "IIR1"}, 32074f692926SSrinivas Kandagatla {"RX INT2_1 MIX1 INP1", "DEC0", "RX_TX DEC0_INP"}, 32084f692926SSrinivas Kandagatla {"RX INT2_1 MIX1 INP1", "DEC1", "RX_TX DEC1_INP"}, 32094f692926SSrinivas Kandagatla {"RX INT2_1 MIX1 INP2", "RX0", "RX_RX0"}, 32104f692926SSrinivas Kandagatla {"RX INT2_1 MIX1 INP2", "RX1", "RX_RX1"}, 32114f692926SSrinivas Kandagatla {"RX INT2_1 MIX1 INP2", "RX2", "RX_RX2"}, 32124f692926SSrinivas Kandagatla {"RX INT2_1 MIX1 INP2", "RX3", "RX_RX3"}, 32134f692926SSrinivas Kandagatla {"RX INT2_1 MIX1 INP2", "RX4", "RX_RX4"}, 32144f692926SSrinivas Kandagatla {"RX INT2_1 MIX1 INP2", "RX5", "RX_RX5"}, 32154f692926SSrinivas Kandagatla {"RX INT2_1 MIX1 INP2", "IIR0", "IIR0"}, 32164f692926SSrinivas Kandagatla {"RX INT2_1 MIX1 INP2", "IIR1", "IIR1"}, 32174f692926SSrinivas Kandagatla {"RX INT2_1 MIX1 INP2", "DEC0", "RX_TX DEC0_INP"}, 32184f692926SSrinivas Kandagatla {"RX INT2_1 MIX1 INP2", "DEC1", "RX_TX DEC1_INP"}, 32194f692926SSrinivas Kandagatla 32204f692926SSrinivas Kandagatla {"RX INT0_1 MIX1", NULL, "RX INT0_1 MIX1 INP0"}, 32214f692926SSrinivas Kandagatla {"RX INT0_1 MIX1", NULL, "RX INT0_1 MIX1 INP1"}, 32224f692926SSrinivas Kandagatla {"RX INT0_1 MIX1", NULL, "RX INT0_1 MIX1 INP2"}, 32234f692926SSrinivas Kandagatla {"RX INT1_1 MIX1", NULL, "RX INT1_1 MIX1 INP0"}, 32244f692926SSrinivas Kandagatla {"RX INT1_1 MIX1", NULL, "RX INT1_1 MIX1 INP1"}, 32254f692926SSrinivas Kandagatla {"RX INT1_1 MIX1", NULL, "RX INT1_1 MIX1 INP2"}, 32264f692926SSrinivas Kandagatla {"RX INT2_1 MIX1", NULL, "RX INT2_1 MIX1 INP0"}, 32274f692926SSrinivas Kandagatla {"RX INT2_1 MIX1", NULL, "RX INT2_1 MIX1 INP1"}, 32284f692926SSrinivas Kandagatla {"RX INT2_1 MIX1", NULL, "RX INT2_1 MIX1 INP2"}, 32294f692926SSrinivas Kandagatla 32304f692926SSrinivas Kandagatla {"RX MIX TX0 MUX", "RX_MIX0", "RX INT0 SEC MIX"}, 32314f692926SSrinivas Kandagatla {"RX MIX TX0 MUX", "RX_MIX1", "RX INT1 SEC MIX"}, 32324f692926SSrinivas Kandagatla {"RX MIX TX0 MUX", "RX_MIX2", "RX INT2 SEC MIX"}, 32334f692926SSrinivas Kandagatla {"RX MIX TX1 MUX", "RX_MIX0", "RX INT0 SEC MIX"}, 32344f692926SSrinivas Kandagatla {"RX MIX TX1 MUX", "RX_MIX1", "RX INT1 SEC MIX"}, 32354f692926SSrinivas Kandagatla {"RX MIX TX1 MUX", "RX_MIX2", "RX INT2 SEC MIX"}, 32364f692926SSrinivas Kandagatla {"RX MIX TX2 MUX", "RX_MIX0", "RX INT0 SEC MIX"}, 32374f692926SSrinivas Kandagatla {"RX MIX TX2 MUX", "RX_MIX1", "RX INT1 SEC MIX"}, 32384f692926SSrinivas Kandagatla {"RX MIX TX2 MUX", "RX_MIX2", "RX INT2 SEC MIX"}, 32394f692926SSrinivas Kandagatla {"RX AIF_ECHO", NULL, "RX MIX TX0 MUX"}, 32404f692926SSrinivas Kandagatla {"RX AIF_ECHO", NULL, "RX MIX TX1 MUX"}, 32414f692926SSrinivas Kandagatla {"RX AIF_ECHO", NULL, "RX MIX TX2 MUX"}, 32424f692926SSrinivas Kandagatla {"RX AIF_ECHO", NULL, "RX_MCLK"}, 32434f692926SSrinivas Kandagatla 32444f692926SSrinivas Kandagatla /* Mixing path INT0 */ 32454f692926SSrinivas Kandagatla {"RX INT0_2 MUX", "RX0", "RX_RX0"}, 32464f692926SSrinivas Kandagatla {"RX INT0_2 MUX", "RX1", "RX_RX1"}, 32474f692926SSrinivas Kandagatla {"RX INT0_2 MUX", "RX2", "RX_RX2"}, 32484f692926SSrinivas Kandagatla {"RX INT0_2 MUX", "RX3", "RX_RX3"}, 32494f692926SSrinivas Kandagatla {"RX INT0_2 MUX", "RX4", "RX_RX4"}, 32504f692926SSrinivas Kandagatla {"RX INT0_2 MUX", "RX5", "RX_RX5"}, 32514f692926SSrinivas Kandagatla {"RX INT0_2 INTERP", NULL, "RX INT0_2 MUX"}, 32524f692926SSrinivas Kandagatla {"RX INT0 SEC MIX", NULL, "RX INT0_2 INTERP"}, 32534f692926SSrinivas Kandagatla 32544f692926SSrinivas Kandagatla /* Mixing path INT1 */ 32554f692926SSrinivas Kandagatla {"RX INT1_2 MUX", "RX0", "RX_RX0"}, 32564f692926SSrinivas Kandagatla {"RX INT1_2 MUX", "RX1", "RX_RX1"}, 32574f692926SSrinivas Kandagatla {"RX INT1_2 MUX", "RX2", "RX_RX2"}, 32584f692926SSrinivas Kandagatla {"RX INT1_2 MUX", "RX3", "RX_RX3"}, 32594f692926SSrinivas Kandagatla {"RX INT1_2 MUX", "RX4", "RX_RX4"}, 32604f692926SSrinivas Kandagatla {"RX INT1_2 MUX", "RX5", "RX_RX5"}, 32614f692926SSrinivas Kandagatla {"RX INT1_2 INTERP", NULL, "RX INT1_2 MUX"}, 32624f692926SSrinivas Kandagatla {"RX INT1 SEC MIX", NULL, "RX INT1_2 INTERP"}, 32634f692926SSrinivas Kandagatla 32644f692926SSrinivas Kandagatla /* Mixing path INT2 */ 32654f692926SSrinivas Kandagatla {"RX INT2_2 MUX", "RX0", "RX_RX0"}, 32664f692926SSrinivas Kandagatla {"RX INT2_2 MUX", "RX1", "RX_RX1"}, 32674f692926SSrinivas Kandagatla {"RX INT2_2 MUX", "RX2", "RX_RX2"}, 32684f692926SSrinivas Kandagatla {"RX INT2_2 MUX", "RX3", "RX_RX3"}, 32694f692926SSrinivas Kandagatla {"RX INT2_2 MUX", "RX4", "RX_RX4"}, 32704f692926SSrinivas Kandagatla {"RX INT2_2 MUX", "RX5", "RX_RX5"}, 32714f692926SSrinivas Kandagatla {"RX INT2_2 INTERP", NULL, "RX INT2_2 MUX"}, 32724f692926SSrinivas Kandagatla {"RX INT2 SEC MIX", NULL, "RX INT2_2 INTERP"}, 32734f692926SSrinivas Kandagatla 32744f692926SSrinivas Kandagatla {"RX INT0_1 INTERP", NULL, "RX INT0_1 MIX1"}, 32754f692926SSrinivas Kandagatla {"RX INT0 SEC MIX", NULL, "RX INT0_1 INTERP"}, 32764f692926SSrinivas Kandagatla {"RX INT0 MIX2", NULL, "RX INT0 SEC MIX"}, 32774f692926SSrinivas Kandagatla {"RX INT0 MIX2", NULL, "RX INT0 MIX2 INP"}, 32784f692926SSrinivas Kandagatla {"RX INT0 DEM MUX", "CLSH_DSM_OUT", "RX INT0 MIX2"}, 32794f692926SSrinivas Kandagatla {"HPHL_OUT", NULL, "RX INT0 DEM MUX"}, 32804f692926SSrinivas Kandagatla {"HPHL_OUT", NULL, "RX_MCLK"}, 32814f692926SSrinivas Kandagatla 32824f692926SSrinivas Kandagatla {"RX INT1_1 INTERP", NULL, "RX INT1_1 MIX1"}, 32834f692926SSrinivas Kandagatla {"RX INT1 SEC MIX", NULL, "RX INT1_1 INTERP"}, 32844f692926SSrinivas Kandagatla {"RX INT1 MIX2", NULL, "RX INT1 SEC MIX"}, 32854f692926SSrinivas Kandagatla {"RX INT1 MIX2", NULL, "RX INT1 MIX2 INP"}, 32864f692926SSrinivas Kandagatla {"RX INT1 DEM MUX", "CLSH_DSM_OUT", "RX INT1 MIX2"}, 32874f692926SSrinivas Kandagatla {"HPHR_OUT", NULL, "RX INT1 DEM MUX"}, 32884f692926SSrinivas Kandagatla {"HPHR_OUT", NULL, "RX_MCLK"}, 32894f692926SSrinivas Kandagatla 32904f692926SSrinivas Kandagatla {"RX INT2_1 INTERP", NULL, "RX INT2_1 MIX1"}, 32914f692926SSrinivas Kandagatla 32924f692926SSrinivas Kandagatla {"RX INT2 SEC MIX", NULL, "RX INT2_1 INTERP"}, 32934f692926SSrinivas Kandagatla {"RX INT2 MIX2", NULL, "RX INT2 SEC MIX"}, 32944f692926SSrinivas Kandagatla {"RX INT2 MIX2", NULL, "RX INT2 MIX2 INP"}, 32954f692926SSrinivas Kandagatla {"AUX_OUT", NULL, "RX INT2 MIX2"}, 32964f692926SSrinivas Kandagatla {"AUX_OUT", NULL, "RX_MCLK"}, 32974f692926SSrinivas Kandagatla 32984f692926SSrinivas Kandagatla {"IIR0", NULL, "RX_MCLK"}, 32994f692926SSrinivas Kandagatla {"IIR0", NULL, "IIR0 INP0 MUX"}, 33004f692926SSrinivas Kandagatla {"IIR0 INP0 MUX", "DEC0", "RX_TX DEC0_INP"}, 33014f692926SSrinivas Kandagatla {"IIR0 INP0 MUX", "DEC1", "RX_TX DEC1_INP"}, 33024f692926SSrinivas Kandagatla {"IIR0 INP0 MUX", "DEC2", "RX_TX DEC2_INP"}, 33034f692926SSrinivas Kandagatla {"IIR0 INP0 MUX", "DEC3", "RX_TX DEC3_INP"}, 33044f692926SSrinivas Kandagatla {"IIR0 INP0 MUX", "RX0", "RX_RX0"}, 33054f692926SSrinivas Kandagatla {"IIR0 INP0 MUX", "RX1", "RX_RX1"}, 33064f692926SSrinivas Kandagatla {"IIR0 INP0 MUX", "RX2", "RX_RX2"}, 33074f692926SSrinivas Kandagatla {"IIR0 INP0 MUX", "RX3", "RX_RX3"}, 33084f692926SSrinivas Kandagatla {"IIR0 INP0 MUX", "RX4", "RX_RX4"}, 33094f692926SSrinivas Kandagatla {"IIR0 INP0 MUX", "RX5", "RX_RX5"}, 33104f692926SSrinivas Kandagatla {"IIR0", NULL, "IIR0 INP1 MUX"}, 33114f692926SSrinivas Kandagatla {"IIR0 INP1 MUX", "DEC0", "RX_TX DEC0_INP"}, 33124f692926SSrinivas Kandagatla {"IIR0 INP1 MUX", "DEC1", "RX_TX DEC1_INP"}, 33134f692926SSrinivas Kandagatla {"IIR0 INP1 MUX", "DEC2", "RX_TX DEC2_INP"}, 33144f692926SSrinivas Kandagatla {"IIR0 INP1 MUX", "DEC3", "RX_TX DEC3_INP"}, 33154f692926SSrinivas Kandagatla {"IIR0 INP1 MUX", "RX0", "RX_RX0"}, 33164f692926SSrinivas Kandagatla {"IIR0 INP1 MUX", "RX1", "RX_RX1"}, 33174f692926SSrinivas Kandagatla {"IIR0 INP1 MUX", "RX2", "RX_RX2"}, 33184f692926SSrinivas Kandagatla {"IIR0 INP1 MUX", "RX3", "RX_RX3"}, 33194f692926SSrinivas Kandagatla {"IIR0 INP1 MUX", "RX4", "RX_RX4"}, 33204f692926SSrinivas Kandagatla {"IIR0 INP1 MUX", "RX5", "RX_RX5"}, 33214f692926SSrinivas Kandagatla {"IIR0", NULL, "IIR0 INP2 MUX"}, 33224f692926SSrinivas Kandagatla {"IIR0 INP2 MUX", "DEC0", "RX_TX DEC0_INP"}, 33234f692926SSrinivas Kandagatla {"IIR0 INP2 MUX", "DEC1", "RX_TX DEC1_INP"}, 33244f692926SSrinivas Kandagatla {"IIR0 INP2 MUX", "DEC2", "RX_TX DEC2_INP"}, 33254f692926SSrinivas Kandagatla {"IIR0 INP2 MUX", "DEC3", "RX_TX DEC3_INP"}, 33264f692926SSrinivas Kandagatla {"IIR0 INP2 MUX", "RX0", "RX_RX0"}, 33274f692926SSrinivas Kandagatla {"IIR0 INP2 MUX", "RX1", "RX_RX1"}, 33284f692926SSrinivas Kandagatla {"IIR0 INP2 MUX", "RX2", "RX_RX2"}, 33294f692926SSrinivas Kandagatla {"IIR0 INP2 MUX", "RX3", "RX_RX3"}, 33304f692926SSrinivas Kandagatla {"IIR0 INP2 MUX", "RX4", "RX_RX4"}, 33314f692926SSrinivas Kandagatla {"IIR0 INP2 MUX", "RX5", "RX_RX5"}, 33324f692926SSrinivas Kandagatla {"IIR0", NULL, "IIR0 INP3 MUX"}, 33334f692926SSrinivas Kandagatla {"IIR0 INP3 MUX", "DEC0", "RX_TX DEC0_INP"}, 33344f692926SSrinivas Kandagatla {"IIR0 INP3 MUX", "DEC1", "RX_TX DEC1_INP"}, 33354f692926SSrinivas Kandagatla {"IIR0 INP3 MUX", "DEC2", "RX_TX DEC2_INP"}, 33364f692926SSrinivas Kandagatla {"IIR0 INP3 MUX", "DEC3", "RX_TX DEC3_INP"}, 33374f692926SSrinivas Kandagatla {"IIR0 INP3 MUX", "RX0", "RX_RX0"}, 33384f692926SSrinivas Kandagatla {"IIR0 INP3 MUX", "RX1", "RX_RX1"}, 33394f692926SSrinivas Kandagatla {"IIR0 INP3 MUX", "RX2", "RX_RX2"}, 33404f692926SSrinivas Kandagatla {"IIR0 INP3 MUX", "RX3", "RX_RX3"}, 33414f692926SSrinivas Kandagatla {"IIR0 INP3 MUX", "RX4", "RX_RX4"}, 33424f692926SSrinivas Kandagatla {"IIR0 INP3 MUX", "RX5", "RX_RX5"}, 33434f692926SSrinivas Kandagatla 33444f692926SSrinivas Kandagatla {"IIR1", NULL, "RX_MCLK"}, 33454f692926SSrinivas Kandagatla {"IIR1", NULL, "IIR1 INP0 MUX"}, 33464f692926SSrinivas Kandagatla {"IIR1 INP0 MUX", "DEC0", "RX_TX DEC0_INP"}, 33474f692926SSrinivas Kandagatla {"IIR1 INP0 MUX", "DEC1", "RX_TX DEC1_INP"}, 33484f692926SSrinivas Kandagatla {"IIR1 INP0 MUX", "DEC2", "RX_TX DEC2_INP"}, 33494f692926SSrinivas Kandagatla {"IIR1 INP0 MUX", "DEC3", "RX_TX DEC3_INP"}, 33504f692926SSrinivas Kandagatla {"IIR1 INP0 MUX", "RX0", "RX_RX0"}, 33514f692926SSrinivas Kandagatla {"IIR1 INP0 MUX", "RX1", "RX_RX1"}, 33524f692926SSrinivas Kandagatla {"IIR1 INP0 MUX", "RX2", "RX_RX2"}, 33534f692926SSrinivas Kandagatla {"IIR1 INP0 MUX", "RX3", "RX_RX3"}, 33544f692926SSrinivas Kandagatla {"IIR1 INP0 MUX", "RX4", "RX_RX4"}, 33554f692926SSrinivas Kandagatla {"IIR1 INP0 MUX", "RX5", "RX_RX5"}, 33564f692926SSrinivas Kandagatla {"IIR1", NULL, "IIR1 INP1 MUX"}, 33574f692926SSrinivas Kandagatla {"IIR1 INP1 MUX", "DEC0", "RX_TX DEC0_INP"}, 33584f692926SSrinivas Kandagatla {"IIR1 INP1 MUX", "DEC1", "RX_TX DEC1_INP"}, 33594f692926SSrinivas Kandagatla {"IIR1 INP1 MUX", "DEC2", "RX_TX DEC2_INP"}, 33604f692926SSrinivas Kandagatla {"IIR1 INP1 MUX", "DEC3", "RX_TX DEC3_INP"}, 33614f692926SSrinivas Kandagatla {"IIR1 INP1 MUX", "RX0", "RX_RX0"}, 33624f692926SSrinivas Kandagatla {"IIR1 INP1 MUX", "RX1", "RX_RX1"}, 33634f692926SSrinivas Kandagatla {"IIR1 INP1 MUX", "RX2", "RX_RX2"}, 33644f692926SSrinivas Kandagatla {"IIR1 INP1 MUX", "RX3", "RX_RX3"}, 33654f692926SSrinivas Kandagatla {"IIR1 INP1 MUX", "RX4", "RX_RX4"}, 33664f692926SSrinivas Kandagatla {"IIR1 INP1 MUX", "RX5", "RX_RX5"}, 33674f692926SSrinivas Kandagatla {"IIR1", NULL, "IIR1 INP2 MUX"}, 33684f692926SSrinivas Kandagatla {"IIR1 INP2 MUX", "DEC0", "RX_TX DEC0_INP"}, 33694f692926SSrinivas Kandagatla {"IIR1 INP2 MUX", "DEC1", "RX_TX DEC1_INP"}, 33704f692926SSrinivas Kandagatla {"IIR1 INP2 MUX", "DEC2", "RX_TX DEC2_INP"}, 33714f692926SSrinivas Kandagatla {"IIR1 INP2 MUX", "DEC3", "RX_TX DEC3_INP"}, 33724f692926SSrinivas Kandagatla {"IIR1 INP2 MUX", "RX0", "RX_RX0"}, 33734f692926SSrinivas Kandagatla {"IIR1 INP2 MUX", "RX1", "RX_RX1"}, 33744f692926SSrinivas Kandagatla {"IIR1 INP2 MUX", "RX2", "RX_RX2"}, 33754f692926SSrinivas Kandagatla {"IIR1 INP2 MUX", "RX3", "RX_RX3"}, 33764f692926SSrinivas Kandagatla {"IIR1 INP2 MUX", "RX4", "RX_RX4"}, 33774f692926SSrinivas Kandagatla {"IIR1 INP2 MUX", "RX5", "RX_RX5"}, 33784f692926SSrinivas Kandagatla {"IIR1", NULL, "IIR1 INP3 MUX"}, 33794f692926SSrinivas Kandagatla {"IIR1 INP3 MUX", "DEC0", "RX_TX DEC0_INP"}, 33804f692926SSrinivas Kandagatla {"IIR1 INP3 MUX", "DEC1", "RX_TX DEC1_INP"}, 33814f692926SSrinivas Kandagatla {"IIR1 INP3 MUX", "DEC2", "RX_TX DEC2_INP"}, 33824f692926SSrinivas Kandagatla {"IIR1 INP3 MUX", "DEC3", "RX_TX DEC3_INP"}, 33834f692926SSrinivas Kandagatla {"IIR1 INP3 MUX", "RX0", "RX_RX0"}, 33844f692926SSrinivas Kandagatla {"IIR1 INP3 MUX", "RX1", "RX_RX1"}, 33854f692926SSrinivas Kandagatla {"IIR1 INP3 MUX", "RX2", "RX_RX2"}, 33864f692926SSrinivas Kandagatla {"IIR1 INP3 MUX", "RX3", "RX_RX3"}, 33874f692926SSrinivas Kandagatla {"IIR1 INP3 MUX", "RX4", "RX_RX4"}, 33884f692926SSrinivas Kandagatla {"IIR1 INP3 MUX", "RX5", "RX_RX5"}, 33894f692926SSrinivas Kandagatla 33904f692926SSrinivas Kandagatla {"SRC0", NULL, "IIR0"}, 33914f692926SSrinivas Kandagatla {"SRC1", NULL, "IIR1"}, 33924f692926SSrinivas Kandagatla {"RX INT0 MIX2 INP", "SRC0", "SRC0"}, 33934f692926SSrinivas Kandagatla {"RX INT0 MIX2 INP", "SRC1", "SRC1"}, 33944f692926SSrinivas Kandagatla {"RX INT1 MIX2 INP", "SRC0", "SRC0"}, 33954f692926SSrinivas Kandagatla {"RX INT1 MIX2 INP", "SRC1", "SRC1"}, 33964f692926SSrinivas Kandagatla {"RX INT2 MIX2 INP", "SRC0", "SRC0"}, 33974f692926SSrinivas Kandagatla {"RX INT2 MIX2 INP", "SRC1", "SRC1"}, 33984f692926SSrinivas Kandagatla }; 33994f692926SSrinivas Kandagatla 3400af3d54b9SSrinivas Kandagatla static int rx_macro_component_probe(struct snd_soc_component *component) 3401af3d54b9SSrinivas Kandagatla { 3402af3d54b9SSrinivas Kandagatla struct rx_macro *rx = snd_soc_component_get_drvdata(component); 3403af3d54b9SSrinivas Kandagatla 3404af3d54b9SSrinivas Kandagatla snd_soc_component_init_regmap(component, rx->regmap); 3405af3d54b9SSrinivas Kandagatla 3406af3d54b9SSrinivas Kandagatla snd_soc_component_update_bits(component, CDC_RX_RX0_RX_PATH_SEC7, 3407af3d54b9SSrinivas Kandagatla CDC_RX_DSM_OUT_DELAY_SEL_MASK, 3408af3d54b9SSrinivas Kandagatla CDC_RX_DSM_OUT_DELAY_TWO_SAMPLE); 3409af3d54b9SSrinivas Kandagatla snd_soc_component_update_bits(component, CDC_RX_RX1_RX_PATH_SEC7, 3410af3d54b9SSrinivas Kandagatla CDC_RX_DSM_OUT_DELAY_SEL_MASK, 3411af3d54b9SSrinivas Kandagatla CDC_RX_DSM_OUT_DELAY_TWO_SAMPLE); 3412af3d54b9SSrinivas Kandagatla snd_soc_component_update_bits(component, CDC_RX_RX2_RX_PATH_SEC7, 3413af3d54b9SSrinivas Kandagatla CDC_RX_DSM_OUT_DELAY_SEL_MASK, 3414af3d54b9SSrinivas Kandagatla CDC_RX_DSM_OUT_DELAY_TWO_SAMPLE); 3415af3d54b9SSrinivas Kandagatla snd_soc_component_update_bits(component, CDC_RX_RX0_RX_PATH_CFG3, 3416af3d54b9SSrinivas Kandagatla CDC_RX_DC_COEFF_SEL_MASK, 3417af3d54b9SSrinivas Kandagatla CDC_RX_DC_COEFF_SEL_TWO); 3418af3d54b9SSrinivas Kandagatla snd_soc_component_update_bits(component, CDC_RX_RX1_RX_PATH_CFG3, 3419af3d54b9SSrinivas Kandagatla CDC_RX_DC_COEFF_SEL_MASK, 3420af3d54b9SSrinivas Kandagatla CDC_RX_DC_COEFF_SEL_TWO); 3421af3d54b9SSrinivas Kandagatla snd_soc_component_update_bits(component, CDC_RX_RX2_RX_PATH_CFG3, 3422af3d54b9SSrinivas Kandagatla CDC_RX_DC_COEFF_SEL_MASK, 3423af3d54b9SSrinivas Kandagatla CDC_RX_DC_COEFF_SEL_TWO); 3424af3d54b9SSrinivas Kandagatla 3425af3d54b9SSrinivas Kandagatla rx->component = component; 3426af3d54b9SSrinivas Kandagatla 3427af3d54b9SSrinivas Kandagatla return 0; 3428af3d54b9SSrinivas Kandagatla } 3429af3d54b9SSrinivas Kandagatla 3430af3d54b9SSrinivas Kandagatla static int swclk_gate_enable(struct clk_hw *hw) 3431af3d54b9SSrinivas Kandagatla { 3432af3d54b9SSrinivas Kandagatla struct rx_macro *rx = to_rx_macro(hw); 3433eaba1134SSrinivas Kandagatla int ret; 3434eaba1134SSrinivas Kandagatla 3435eaba1134SSrinivas Kandagatla ret = clk_prepare_enable(rx->mclk); 3436eaba1134SSrinivas Kandagatla if (ret) { 3437eaba1134SSrinivas Kandagatla dev_err(rx->dev, "unable to prepare mclk\n"); 3438eaba1134SSrinivas Kandagatla return ret; 3439eaba1134SSrinivas Kandagatla } 3440af3d54b9SSrinivas Kandagatla 3441af3d54b9SSrinivas Kandagatla rx_macro_mclk_enable(rx, true); 3442af3d54b9SSrinivas Kandagatla 3443af3d54b9SSrinivas Kandagatla regmap_update_bits(rx->regmap, CDC_RX_CLK_RST_CTRL_SWR_CONTROL, 3444af3d54b9SSrinivas Kandagatla CDC_RX_SWR_CLK_EN_MASK, 1); 3445af3d54b9SSrinivas Kandagatla 3446af3d54b9SSrinivas Kandagatla return 0; 3447af3d54b9SSrinivas Kandagatla } 3448af3d54b9SSrinivas Kandagatla 3449af3d54b9SSrinivas Kandagatla static void swclk_gate_disable(struct clk_hw *hw) 3450af3d54b9SSrinivas Kandagatla { 3451af3d54b9SSrinivas Kandagatla struct rx_macro *rx = to_rx_macro(hw); 3452af3d54b9SSrinivas Kandagatla 3453af3d54b9SSrinivas Kandagatla regmap_update_bits(rx->regmap, CDC_RX_CLK_RST_CTRL_SWR_CONTROL, 3454af3d54b9SSrinivas Kandagatla CDC_RX_SWR_CLK_EN_MASK, 0); 3455af3d54b9SSrinivas Kandagatla 3456af3d54b9SSrinivas Kandagatla rx_macro_mclk_enable(rx, false); 3457eaba1134SSrinivas Kandagatla clk_disable_unprepare(rx->mclk); 3458af3d54b9SSrinivas Kandagatla } 3459af3d54b9SSrinivas Kandagatla 3460af3d54b9SSrinivas Kandagatla static int swclk_gate_is_enabled(struct clk_hw *hw) 3461af3d54b9SSrinivas Kandagatla { 3462af3d54b9SSrinivas Kandagatla struct rx_macro *rx = to_rx_macro(hw); 3463af3d54b9SSrinivas Kandagatla int ret, val; 3464af3d54b9SSrinivas Kandagatla 3465af3d54b9SSrinivas Kandagatla regmap_read(rx->regmap, CDC_RX_CLK_RST_CTRL_SWR_CONTROL, &val); 3466af3d54b9SSrinivas Kandagatla ret = val & BIT(0); 3467af3d54b9SSrinivas Kandagatla 3468af3d54b9SSrinivas Kandagatla return ret; 3469af3d54b9SSrinivas Kandagatla } 3470af3d54b9SSrinivas Kandagatla 3471af3d54b9SSrinivas Kandagatla static unsigned long swclk_recalc_rate(struct clk_hw *hw, 3472af3d54b9SSrinivas Kandagatla unsigned long parent_rate) 3473af3d54b9SSrinivas Kandagatla { 3474af3d54b9SSrinivas Kandagatla return parent_rate / 2; 3475af3d54b9SSrinivas Kandagatla } 3476af3d54b9SSrinivas Kandagatla 3477af3d54b9SSrinivas Kandagatla static const struct clk_ops swclk_gate_ops = { 3478af3d54b9SSrinivas Kandagatla .prepare = swclk_gate_enable, 3479af3d54b9SSrinivas Kandagatla .unprepare = swclk_gate_disable, 3480af3d54b9SSrinivas Kandagatla .is_enabled = swclk_gate_is_enabled, 3481af3d54b9SSrinivas Kandagatla .recalc_rate = swclk_recalc_rate, 3482af3d54b9SSrinivas Kandagatla 3483af3d54b9SSrinivas Kandagatla }; 3484af3d54b9SSrinivas Kandagatla 348570a5e96bSSrinivas Kandagatla static int rx_macro_register_mclk_output(struct rx_macro *rx) 3486af3d54b9SSrinivas Kandagatla { 3487af3d54b9SSrinivas Kandagatla struct device *dev = rx->dev; 3488af3d54b9SSrinivas Kandagatla const char *parent_clk_name = NULL; 3489af3d54b9SSrinivas Kandagatla const char *clk_name = "lpass-rx-mclk"; 3490af3d54b9SSrinivas Kandagatla struct clk_hw *hw; 3491af3d54b9SSrinivas Kandagatla struct clk_init_data init; 3492af3d54b9SSrinivas Kandagatla int ret; 3493af3d54b9SSrinivas Kandagatla 3494492fe974SKrzysztof Kozlowski if (rx->npl) 3495eaba1134SSrinivas Kandagatla parent_clk_name = __clk_get_name(rx->npl); 3496492fe974SKrzysztof Kozlowski else 3497492fe974SKrzysztof Kozlowski parent_clk_name = __clk_get_name(rx->mclk); 3498af3d54b9SSrinivas Kandagatla 3499af3d54b9SSrinivas Kandagatla init.name = clk_name; 3500af3d54b9SSrinivas Kandagatla init.ops = &swclk_gate_ops; 3501af3d54b9SSrinivas Kandagatla init.flags = 0; 3502af3d54b9SSrinivas Kandagatla init.parent_names = &parent_clk_name; 3503af3d54b9SSrinivas Kandagatla init.num_parents = 1; 3504af3d54b9SSrinivas Kandagatla rx->hw.init = &init; 3505af3d54b9SSrinivas Kandagatla hw = &rx->hw; 350670a5e96bSSrinivas Kandagatla ret = devm_clk_hw_register(rx->dev, hw); 3507af3d54b9SSrinivas Kandagatla if (ret) 350870a5e96bSSrinivas Kandagatla return ret; 3509af3d54b9SSrinivas Kandagatla 351070a5e96bSSrinivas Kandagatla return devm_of_clk_add_hw_provider(dev, of_clk_hw_simple_get, hw); 3511af3d54b9SSrinivas Kandagatla } 3512af3d54b9SSrinivas Kandagatla 3513af3d54b9SSrinivas Kandagatla static const struct snd_soc_component_driver rx_macro_component_drv = { 3514af3d54b9SSrinivas Kandagatla .name = "RX-MACRO", 3515af3d54b9SSrinivas Kandagatla .probe = rx_macro_component_probe, 3516af3d54b9SSrinivas Kandagatla .controls = rx_macro_snd_controls, 3517af3d54b9SSrinivas Kandagatla .num_controls = ARRAY_SIZE(rx_macro_snd_controls), 35184f692926SSrinivas Kandagatla .dapm_widgets = rx_macro_dapm_widgets, 35194f692926SSrinivas Kandagatla .num_dapm_widgets = ARRAY_SIZE(rx_macro_dapm_widgets), 35204f692926SSrinivas Kandagatla .dapm_routes = rx_audio_map, 35214f692926SSrinivas Kandagatla .num_dapm_routes = ARRAY_SIZE(rx_audio_map), 3522af3d54b9SSrinivas Kandagatla }; 3523af3d54b9SSrinivas Kandagatla 3524af3d54b9SSrinivas Kandagatla static int rx_macro_probe(struct platform_device *pdev) 3525af3d54b9SSrinivas Kandagatla { 3526af3d54b9SSrinivas Kandagatla struct device *dev = &pdev->dev; 3527492fe974SKrzysztof Kozlowski kernel_ulong_t flags; 3528af3d54b9SSrinivas Kandagatla struct rx_macro *rx; 3529af3d54b9SSrinivas Kandagatla void __iomem *base; 3530af3d54b9SSrinivas Kandagatla int ret; 3531af3d54b9SSrinivas Kandagatla 3532492fe974SKrzysztof Kozlowski flags = (kernel_ulong_t)device_get_match_data(dev); 3533492fe974SKrzysztof Kozlowski 3534af3d54b9SSrinivas Kandagatla rx = devm_kzalloc(dev, sizeof(*rx), GFP_KERNEL); 3535af3d54b9SSrinivas Kandagatla if (!rx) 3536af3d54b9SSrinivas Kandagatla return -ENOMEM; 3537af3d54b9SSrinivas Kandagatla 353843b647d9SSrinivas Kandagatla rx->macro = devm_clk_get_optional(dev, "macro"); 353943b647d9SSrinivas Kandagatla if (IS_ERR(rx->macro)) 3540f54e3474SBjorn Andersson return dev_err_probe(dev, PTR_ERR(rx->macro), "unable to get macro clock\n"); 3541af3d54b9SSrinivas Kandagatla 354243b647d9SSrinivas Kandagatla rx->dcodec = devm_clk_get_optional(dev, "dcodec"); 354343b647d9SSrinivas Kandagatla if (IS_ERR(rx->dcodec)) 3544f54e3474SBjorn Andersson return dev_err_probe(dev, PTR_ERR(rx->dcodec), "unable to get dcodec clock\n"); 354543b647d9SSrinivas Kandagatla 354643b647d9SSrinivas Kandagatla rx->mclk = devm_clk_get(dev, "mclk"); 354743b647d9SSrinivas Kandagatla if (IS_ERR(rx->mclk)) 3548f54e3474SBjorn Andersson return dev_err_probe(dev, PTR_ERR(rx->mclk), "unable to get mclk clock\n"); 354943b647d9SSrinivas Kandagatla 3550492fe974SKrzysztof Kozlowski if (flags & LPASS_MACRO_FLAG_HAS_NPL_CLOCK) { 355143b647d9SSrinivas Kandagatla rx->npl = devm_clk_get(dev, "npl"); 355243b647d9SSrinivas Kandagatla if (IS_ERR(rx->npl)) 3553f54e3474SBjorn Andersson return dev_err_probe(dev, PTR_ERR(rx->npl), "unable to get npl clock\n"); 3554492fe974SKrzysztof Kozlowski } 355543b647d9SSrinivas Kandagatla 355643b647d9SSrinivas Kandagatla rx->fsgen = devm_clk_get(dev, "fsgen"); 355743b647d9SSrinivas Kandagatla if (IS_ERR(rx->fsgen)) 3558f54e3474SBjorn Andersson return dev_err_probe(dev, PTR_ERR(rx->fsgen), "unable to get fsgen clock\n"); 3559af3d54b9SSrinivas Kandagatla 35609e3d83c5SSrinivasa Rao Mandadapu rx->pds = lpass_macro_pds_init(dev); 35619e3d83c5SSrinivasa Rao Mandadapu if (IS_ERR(rx->pds)) 35629e3d83c5SSrinivasa Rao Mandadapu return PTR_ERR(rx->pds); 3563af3d54b9SSrinivas Kandagatla 3564af3d54b9SSrinivas Kandagatla base = devm_platform_ioremap_resource(pdev, 0); 3565ddfd5345SChristophe JAILLET if (IS_ERR(base)) { 3566ddfd5345SChristophe JAILLET ret = PTR_ERR(base); 3567ddfd5345SChristophe JAILLET goto err; 3568ddfd5345SChristophe JAILLET } 3569af3d54b9SSrinivas Kandagatla 3570af3d54b9SSrinivas Kandagatla rx->regmap = devm_regmap_init_mmio(dev, base, &rx_regmap_config); 3571ddfd5345SChristophe JAILLET if (IS_ERR(rx->regmap)) { 3572ddfd5345SChristophe JAILLET ret = PTR_ERR(rx->regmap); 3573ddfd5345SChristophe JAILLET goto err; 3574ddfd5345SChristophe JAILLET } 3575af3d54b9SSrinivas Kandagatla 3576af3d54b9SSrinivas Kandagatla dev_set_drvdata(dev, rx); 3577af3d54b9SSrinivas Kandagatla 3578af3d54b9SSrinivas Kandagatla rx->dev = dev; 3579af3d54b9SSrinivas Kandagatla 3580af3d54b9SSrinivas Kandagatla /* set MCLK and NPL rates */ 358143b647d9SSrinivas Kandagatla clk_set_rate(rx->mclk, MCLK_FREQ); 3582e7621434SSrinivas Kandagatla clk_set_rate(rx->npl, MCLK_FREQ); 3583af3d54b9SSrinivas Kandagatla 358443b647d9SSrinivas Kandagatla ret = clk_prepare_enable(rx->macro); 3585af3d54b9SSrinivas Kandagatla if (ret) 358643b647d9SSrinivas Kandagatla goto err; 3587af3d54b9SSrinivas Kandagatla 358843b647d9SSrinivas Kandagatla ret = clk_prepare_enable(rx->dcodec); 358943b647d9SSrinivas Kandagatla if (ret) 359043b647d9SSrinivas Kandagatla goto err_dcodec; 359143b647d9SSrinivas Kandagatla 359243b647d9SSrinivas Kandagatla ret = clk_prepare_enable(rx->mclk); 359343b647d9SSrinivas Kandagatla if (ret) 359443b647d9SSrinivas Kandagatla goto err_mclk; 359543b647d9SSrinivas Kandagatla 359643b647d9SSrinivas Kandagatla ret = clk_prepare_enable(rx->npl); 359743b647d9SSrinivas Kandagatla if (ret) 359843b647d9SSrinivas Kandagatla goto err_npl; 359943b647d9SSrinivas Kandagatla 360043b647d9SSrinivas Kandagatla ret = clk_prepare_enable(rx->fsgen); 360143b647d9SSrinivas Kandagatla if (ret) 360243b647d9SSrinivas Kandagatla goto err_fsgen; 3603af3d54b9SSrinivas Kandagatla 3604ddffe3b8SSrinivas Kandagatla /* reset swr block */ 3605ddffe3b8SSrinivas Kandagatla regmap_update_bits(rx->regmap, CDC_RX_CLK_RST_CTRL_SWR_CONTROL, 3606ddffe3b8SSrinivas Kandagatla CDC_RX_SWR_RESET_MASK, 3607ddffe3b8SSrinivas Kandagatla CDC_RX_SWR_RESET); 3608ddffe3b8SSrinivas Kandagatla 3609ddffe3b8SSrinivas Kandagatla regmap_update_bits(rx->regmap, CDC_RX_CLK_RST_CTRL_SWR_CONTROL, 3610ddffe3b8SSrinivas Kandagatla CDC_RX_SWR_CLK_EN_MASK, 1); 3611ddffe3b8SSrinivas Kandagatla 3612ddffe3b8SSrinivas Kandagatla regmap_update_bits(rx->regmap, CDC_RX_CLK_RST_CTRL_SWR_CONTROL, 3613ddffe3b8SSrinivas Kandagatla CDC_RX_SWR_RESET_MASK, 0); 3614ddffe3b8SSrinivas Kandagatla 3615af3d54b9SSrinivas Kandagatla ret = devm_snd_soc_register_component(dev, &rx_macro_component_drv, 3616af3d54b9SSrinivas Kandagatla rx_macro_dai, 3617af3d54b9SSrinivas Kandagatla ARRAY_SIZE(rx_macro_dai)); 3618af3d54b9SSrinivas Kandagatla if (ret) 361943b647d9SSrinivas Kandagatla goto err_clkout; 3620af3d54b9SSrinivas Kandagatla 3621366ff79eSSrinivas Kandagatla 3622366ff79eSSrinivas Kandagatla pm_runtime_set_autosuspend_delay(dev, 3000); 3623366ff79eSSrinivas Kandagatla pm_runtime_use_autosuspend(dev); 3624366ff79eSSrinivas Kandagatla pm_runtime_mark_last_busy(dev); 3625366ff79eSSrinivas Kandagatla pm_runtime_set_active(dev); 3626366ff79eSSrinivas Kandagatla pm_runtime_enable(dev); 3627366ff79eSSrinivas Kandagatla 36281dc34590SSrinivas Kandagatla ret = rx_macro_register_mclk_output(rx); 36291dc34590SSrinivas Kandagatla if (ret) 36301dc34590SSrinivas Kandagatla goto err_clkout; 36311dc34590SSrinivas Kandagatla 363243b647d9SSrinivas Kandagatla return 0; 363343b647d9SSrinivas Kandagatla 363443b647d9SSrinivas Kandagatla err_clkout: 363543b647d9SSrinivas Kandagatla clk_disable_unprepare(rx->fsgen); 363643b647d9SSrinivas Kandagatla err_fsgen: 363743b647d9SSrinivas Kandagatla clk_disable_unprepare(rx->npl); 363843b647d9SSrinivas Kandagatla err_npl: 363943b647d9SSrinivas Kandagatla clk_disable_unprepare(rx->mclk); 364043b647d9SSrinivas Kandagatla err_mclk: 364143b647d9SSrinivas Kandagatla clk_disable_unprepare(rx->dcodec); 364243b647d9SSrinivas Kandagatla err_dcodec: 364343b647d9SSrinivas Kandagatla clk_disable_unprepare(rx->macro); 364470a5e96bSSrinivas Kandagatla err: 3645ddfd5345SChristophe JAILLET lpass_macro_pds_exit(rx->pds); 3646ddfd5345SChristophe JAILLET 3647af3d54b9SSrinivas Kandagatla return ret; 3648af3d54b9SSrinivas Kandagatla } 3649af3d54b9SSrinivas Kandagatla 36505b068772SUwe Kleine-König static void rx_macro_remove(struct platform_device *pdev) 3651af3d54b9SSrinivas Kandagatla { 3652af3d54b9SSrinivas Kandagatla struct rx_macro *rx = dev_get_drvdata(&pdev->dev); 3653af3d54b9SSrinivas Kandagatla 365443b647d9SSrinivas Kandagatla clk_disable_unprepare(rx->mclk); 365543b647d9SSrinivas Kandagatla clk_disable_unprepare(rx->npl); 365643b647d9SSrinivas Kandagatla clk_disable_unprepare(rx->fsgen); 365743b647d9SSrinivas Kandagatla clk_disable_unprepare(rx->macro); 365843b647d9SSrinivas Kandagatla clk_disable_unprepare(rx->dcodec); 365943b647d9SSrinivas Kandagatla 36609e3d83c5SSrinivasa Rao Mandadapu lpass_macro_pds_exit(rx->pds); 3661af3d54b9SSrinivas Kandagatla } 3662af3d54b9SSrinivas Kandagatla 3663af3d54b9SSrinivas Kandagatla static const struct of_device_id rx_macro_dt_match[] = { 3664492fe974SKrzysztof Kozlowski { 3665492fe974SKrzysztof Kozlowski .compatible = "qcom,sc7280-lpass-rx-macro", 3666492fe974SKrzysztof Kozlowski .data = (void *)LPASS_MACRO_FLAG_HAS_NPL_CLOCK, 3667492fe974SKrzysztof Kozlowski 3668492fe974SKrzysztof Kozlowski }, { 3669492fe974SKrzysztof Kozlowski .compatible = "qcom,sm8250-lpass-rx-macro", 3670492fe974SKrzysztof Kozlowski .data = (void *)LPASS_MACRO_FLAG_HAS_NPL_CLOCK, 3671492fe974SKrzysztof Kozlowski }, { 3672492fe974SKrzysztof Kozlowski .compatible = "qcom,sm8450-lpass-rx-macro", 3673492fe974SKrzysztof Kozlowski .data = (void *)LPASS_MACRO_FLAG_HAS_NPL_CLOCK, 3674492fe974SKrzysztof Kozlowski }, { 3675492fe974SKrzysztof Kozlowski .compatible = "qcom,sm8550-lpass-rx-macro", 3676492fe974SKrzysztof Kozlowski }, { 3677492fe974SKrzysztof Kozlowski .compatible = "qcom,sc8280xp-lpass-rx-macro", 3678492fe974SKrzysztof Kozlowski .data = (void *)LPASS_MACRO_FLAG_HAS_NPL_CLOCK, 3679492fe974SKrzysztof Kozlowski }, 3680af3d54b9SSrinivas Kandagatla { } 3681af3d54b9SSrinivas Kandagatla }; 3682d4335d05SSrinivas Kandagatla MODULE_DEVICE_TABLE(of, rx_macro_dt_match); 3683af3d54b9SSrinivas Kandagatla 3684366ff79eSSrinivas Kandagatla static int __maybe_unused rx_macro_runtime_suspend(struct device *dev) 3685366ff79eSSrinivas Kandagatla { 3686366ff79eSSrinivas Kandagatla struct rx_macro *rx = dev_get_drvdata(dev); 3687366ff79eSSrinivas Kandagatla 3688366ff79eSSrinivas Kandagatla regcache_cache_only(rx->regmap, true); 3689366ff79eSSrinivas Kandagatla regcache_mark_dirty(rx->regmap); 3690366ff79eSSrinivas Kandagatla 3691366ff79eSSrinivas Kandagatla clk_disable_unprepare(rx->fsgen); 3692a4a32034SSrinivas Kandagatla clk_disable_unprepare(rx->npl); 3693a4a32034SSrinivas Kandagatla clk_disable_unprepare(rx->mclk); 3694366ff79eSSrinivas Kandagatla 3695366ff79eSSrinivas Kandagatla return 0; 3696366ff79eSSrinivas Kandagatla } 3697366ff79eSSrinivas Kandagatla 3698366ff79eSSrinivas Kandagatla static int __maybe_unused rx_macro_runtime_resume(struct device *dev) 3699366ff79eSSrinivas Kandagatla { 3700366ff79eSSrinivas Kandagatla struct rx_macro *rx = dev_get_drvdata(dev); 3701366ff79eSSrinivas Kandagatla int ret; 3702366ff79eSSrinivas Kandagatla 3703366ff79eSSrinivas Kandagatla ret = clk_prepare_enable(rx->mclk); 3704366ff79eSSrinivas Kandagatla if (ret) { 3705366ff79eSSrinivas Kandagatla dev_err(dev, "unable to prepare mclk\n"); 3706366ff79eSSrinivas Kandagatla return ret; 3707366ff79eSSrinivas Kandagatla } 3708366ff79eSSrinivas Kandagatla 3709366ff79eSSrinivas Kandagatla ret = clk_prepare_enable(rx->npl); 3710366ff79eSSrinivas Kandagatla if (ret) { 3711366ff79eSSrinivas Kandagatla dev_err(dev, "unable to prepare mclkx2\n"); 3712366ff79eSSrinivas Kandagatla goto err_npl; 3713366ff79eSSrinivas Kandagatla } 3714366ff79eSSrinivas Kandagatla 3715366ff79eSSrinivas Kandagatla ret = clk_prepare_enable(rx->fsgen); 3716366ff79eSSrinivas Kandagatla if (ret) { 3717366ff79eSSrinivas Kandagatla dev_err(dev, "unable to prepare fsgen\n"); 3718366ff79eSSrinivas Kandagatla goto err_fsgen; 3719366ff79eSSrinivas Kandagatla } 3720366ff79eSSrinivas Kandagatla regcache_cache_only(rx->regmap, false); 3721366ff79eSSrinivas Kandagatla regcache_sync(rx->regmap); 3722366ff79eSSrinivas Kandagatla 3723366ff79eSSrinivas Kandagatla return 0; 3724366ff79eSSrinivas Kandagatla err_fsgen: 3725366ff79eSSrinivas Kandagatla clk_disable_unprepare(rx->npl); 3726366ff79eSSrinivas Kandagatla err_npl: 3727366ff79eSSrinivas Kandagatla clk_disable_unprepare(rx->mclk); 3728366ff79eSSrinivas Kandagatla 3729366ff79eSSrinivas Kandagatla return ret; 3730366ff79eSSrinivas Kandagatla } 3731366ff79eSSrinivas Kandagatla 3732366ff79eSSrinivas Kandagatla static const struct dev_pm_ops rx_macro_pm_ops = { 3733366ff79eSSrinivas Kandagatla SET_RUNTIME_PM_OPS(rx_macro_runtime_suspend, rx_macro_runtime_resume, NULL) 3734366ff79eSSrinivas Kandagatla }; 3735366ff79eSSrinivas Kandagatla 3736af3d54b9SSrinivas Kandagatla static struct platform_driver rx_macro_driver = { 3737af3d54b9SSrinivas Kandagatla .driver = { 3738af3d54b9SSrinivas Kandagatla .name = "rx_macro", 3739af3d54b9SSrinivas Kandagatla .of_match_table = rx_macro_dt_match, 3740af3d54b9SSrinivas Kandagatla .suppress_bind_attrs = true, 3741366ff79eSSrinivas Kandagatla .pm = &rx_macro_pm_ops, 3742af3d54b9SSrinivas Kandagatla }, 3743af3d54b9SSrinivas Kandagatla .probe = rx_macro_probe, 37445b068772SUwe Kleine-König .remove_new = rx_macro_remove, 3745af3d54b9SSrinivas Kandagatla }; 3746af3d54b9SSrinivas Kandagatla 3747af3d54b9SSrinivas Kandagatla module_platform_driver(rx_macro_driver); 3748af3d54b9SSrinivas Kandagatla 3749af3d54b9SSrinivas Kandagatla MODULE_DESCRIPTION("RX macro driver"); 3750af3d54b9SSrinivas Kandagatla MODULE_LICENSE("GPL"); 3751