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