xref: /linux/sound/soc/codecs/lpass-rx-macro.c (revision af3d54b99764f0bdd83fcbd1895d23b83f8276be)
1*af3d54b9SSrinivas Kandagatla // SPDX-License-Identifier: GPL-2.0-only
2*af3d54b9SSrinivas Kandagatla // Copyright (c) 2018-2020, The Linux Foundation. All rights reserved.
3*af3d54b9SSrinivas Kandagatla 
4*af3d54b9SSrinivas Kandagatla #include <linux/module.h>
5*af3d54b9SSrinivas Kandagatla #include <linux/init.h>
6*af3d54b9SSrinivas Kandagatla #include <linux/io.h>
7*af3d54b9SSrinivas Kandagatla #include <linux/platform_device.h>
8*af3d54b9SSrinivas Kandagatla #include <linux/clk.h>
9*af3d54b9SSrinivas Kandagatla #include <sound/soc.h>
10*af3d54b9SSrinivas Kandagatla #include <sound/pcm.h>
11*af3d54b9SSrinivas Kandagatla #include <sound/pcm_params.h>
12*af3d54b9SSrinivas Kandagatla #include <sound/soc-dapm.h>
13*af3d54b9SSrinivas Kandagatla #include <sound/tlv.h>
14*af3d54b9SSrinivas Kandagatla #include <linux/of_clk.h>
15*af3d54b9SSrinivas Kandagatla #include <linux/clk-provider.h>
16*af3d54b9SSrinivas Kandagatla 
17*af3d54b9SSrinivas Kandagatla #define CDC_RX_TOP_TOP_CFG0		(0x0000)
18*af3d54b9SSrinivas Kandagatla #define CDC_RX_TOP_SWR_CTRL		(0x0008)
19*af3d54b9SSrinivas Kandagatla #define CDC_RX_TOP_DEBUG		(0x000C)
20*af3d54b9SSrinivas Kandagatla #define CDC_RX_TOP_DEBUG_BUS		(0x0010)
21*af3d54b9SSrinivas Kandagatla #define CDC_RX_TOP_DEBUG_EN0		(0x0014)
22*af3d54b9SSrinivas Kandagatla #define CDC_RX_TOP_DEBUG_EN1		(0x0018)
23*af3d54b9SSrinivas Kandagatla #define CDC_RX_TOP_DEBUG_EN2		(0x001C)
24*af3d54b9SSrinivas Kandagatla #define CDC_RX_TOP_HPHL_COMP_WR_LSB	(0x0020)
25*af3d54b9SSrinivas Kandagatla #define CDC_RX_TOP_HPHL_COMP_WR_MSB	(0x0024)
26*af3d54b9SSrinivas Kandagatla #define CDC_RX_TOP_HPHL_COMP_LUT	(0x0028)
27*af3d54b9SSrinivas Kandagatla #define CDC_RX_TOP_HPH_LUT_BYPASS_MASK	BIT(7)
28*af3d54b9SSrinivas Kandagatla #define CDC_RX_TOP_HPHL_COMP_RD_LSB	(0x002C)
29*af3d54b9SSrinivas Kandagatla #define CDC_RX_TOP_HPHL_COMP_RD_MSB	(0x0030)
30*af3d54b9SSrinivas Kandagatla #define CDC_RX_TOP_HPHR_COMP_WR_LSB	(0x0034)
31*af3d54b9SSrinivas Kandagatla #define CDC_RX_TOP_HPHR_COMP_WR_MSB	(0x0038)
32*af3d54b9SSrinivas Kandagatla #define CDC_RX_TOP_HPHR_COMP_LUT	(0x003C)
33*af3d54b9SSrinivas Kandagatla #define CDC_RX_TOP_HPHR_COMP_RD_LSB	(0x0040)
34*af3d54b9SSrinivas Kandagatla #define CDC_RX_TOP_HPHR_COMP_RD_MSB	(0x0044)
35*af3d54b9SSrinivas Kandagatla #define CDC_RX_TOP_DSD0_DEBUG_CFG0	(0x0070)
36*af3d54b9SSrinivas Kandagatla #define CDC_RX_TOP_DSD0_DEBUG_CFG1	(0x0074)
37*af3d54b9SSrinivas Kandagatla #define CDC_RX_TOP_DSD0_DEBUG_CFG2	(0x0078)
38*af3d54b9SSrinivas Kandagatla #define CDC_RX_TOP_DSD0_DEBUG_CFG3	(0x007C)
39*af3d54b9SSrinivas Kandagatla #define CDC_RX_TOP_DSD1_DEBUG_CFG0	(0x0080)
40*af3d54b9SSrinivas Kandagatla #define CDC_RX_TOP_DSD1_DEBUG_CFG1	(0x0084)
41*af3d54b9SSrinivas Kandagatla #define CDC_RX_TOP_DSD1_DEBUG_CFG2	(0x0088)
42*af3d54b9SSrinivas Kandagatla #define CDC_RX_TOP_DSD1_DEBUG_CFG3	(0x008C)
43*af3d54b9SSrinivas Kandagatla #define CDC_RX_TOP_RX_I2S_CTL		(0x0090)
44*af3d54b9SSrinivas Kandagatla #define CDC_RX_TOP_TX_I2S2_CTL		(0x0094)
45*af3d54b9SSrinivas Kandagatla #define CDC_RX_TOP_I2S_CLK		(0x0098)
46*af3d54b9SSrinivas Kandagatla #define CDC_RX_TOP_I2S_RESET		(0x009C)
47*af3d54b9SSrinivas Kandagatla #define CDC_RX_TOP_I2S_MUX		(0x00A0)
48*af3d54b9SSrinivas Kandagatla #define CDC_RX_CLK_RST_CTRL_MCLK_CONTROL	(0x0100)
49*af3d54b9SSrinivas Kandagatla #define CDC_RX_CLK_MCLK_EN_MASK		BIT(0)
50*af3d54b9SSrinivas Kandagatla #define CDC_RX_CLK_MCLK_ENABLE		BIT(0)
51*af3d54b9SSrinivas Kandagatla #define CDC_RX_CLK_MCLK2_EN_MASK	BIT(1)
52*af3d54b9SSrinivas Kandagatla #define CDC_RX_CLK_MCLK2_ENABLE		BIT(1)
53*af3d54b9SSrinivas Kandagatla #define CDC_RX_CLK_RST_CTRL_FS_CNT_CONTROL	(0x0104)
54*af3d54b9SSrinivas Kandagatla #define CDC_RX_FS_MCLK_CNT_EN_MASK	BIT(0)
55*af3d54b9SSrinivas Kandagatla #define CDC_RX_FS_MCLK_CNT_ENABLE	BIT(0)
56*af3d54b9SSrinivas Kandagatla #define CDC_RX_FS_MCLK_CNT_CLR_MASK	BIT(1)
57*af3d54b9SSrinivas Kandagatla #define CDC_RX_FS_MCLK_CNT_CLR		BIT(1)
58*af3d54b9SSrinivas Kandagatla #define CDC_RX_CLK_RST_CTRL_SWR_CONTROL	(0x0108)
59*af3d54b9SSrinivas Kandagatla #define CDC_RX_SWR_CLK_EN_MASK		BIT(0)
60*af3d54b9SSrinivas Kandagatla #define CDC_RX_SWR_RESET_MASK		BIT(1)
61*af3d54b9SSrinivas Kandagatla #define CDC_RX_SWR_RESET		BIT(1)
62*af3d54b9SSrinivas Kandagatla #define CDC_RX_CLK_RST_CTRL_DSD_CONTROL	(0x010C)
63*af3d54b9SSrinivas Kandagatla #define CDC_RX_CLK_RST_CTRL_ASRC_SHARE_CONTROL	(0x0110)
64*af3d54b9SSrinivas Kandagatla #define CDC_RX_SOFTCLIP_CRC		(0x0140)
65*af3d54b9SSrinivas Kandagatla #define CDC_RX_SOFTCLIP_CLK_EN_MASK	BIT(0)
66*af3d54b9SSrinivas Kandagatla #define CDC_RX_SOFTCLIP_SOFTCLIP_CTRL	(0x0144)
67*af3d54b9SSrinivas Kandagatla #define CDC_RX_SOFTCLIP_EN_MASK		BIT(0)
68*af3d54b9SSrinivas Kandagatla #define CDC_RX_INP_MUX_RX_INT0_CFG0	(0x0180)
69*af3d54b9SSrinivas Kandagatla #define CDC_RX_INTX_1_MIX_INP0_SEL_MASK	GENMASK(3, 0)
70*af3d54b9SSrinivas Kandagatla #define CDC_RX_INTX_1_MIX_INP1_SEL_MASK	GENMASK(7, 4)
71*af3d54b9SSrinivas Kandagatla #define CDC_RX_INP_MUX_RX_INT0_CFG1	(0x0184)
72*af3d54b9SSrinivas Kandagatla #define CDC_RX_INTX_2_SEL_MASK		GENMASK(3, 0)
73*af3d54b9SSrinivas Kandagatla #define CDC_RX_INTX_1_MIX_INP2_SEL_MASK	GENMASK(7, 4)
74*af3d54b9SSrinivas Kandagatla #define CDC_RX_INP_MUX_RX_INT1_CFG0	(0x0188)
75*af3d54b9SSrinivas Kandagatla #define CDC_RX_INP_MUX_RX_INT1_CFG1	(0x018C)
76*af3d54b9SSrinivas Kandagatla #define CDC_RX_INP_MUX_RX_INT2_CFG0	(0x0190)
77*af3d54b9SSrinivas Kandagatla #define CDC_RX_INP_MUX_RX_INT2_CFG1	(0x0194)
78*af3d54b9SSrinivas Kandagatla #define CDC_RX_INP_MUX_RX_MIX_CFG4	(0x0198)
79*af3d54b9SSrinivas Kandagatla #define CDC_RX_INP_MUX_RX_MIX_CFG5	(0x019C)
80*af3d54b9SSrinivas Kandagatla #define CDC_RX_INP_MUX_SIDETONE_SRC_CFG0	(0x01A0)
81*af3d54b9SSrinivas Kandagatla #define CDC_RX_CLSH_CRC			(0x0200)
82*af3d54b9SSrinivas Kandagatla #define CDC_RX_CLSH_CLK_EN_MASK		BIT(0)
83*af3d54b9SSrinivas Kandagatla #define CDC_RX_CLSH_DLY_CTRL		(0x0204)
84*af3d54b9SSrinivas Kandagatla #define CDC_RX_CLSH_DECAY_CTRL		(0x0208)
85*af3d54b9SSrinivas Kandagatla #define CDC_RX_CLSH_DECAY_RATE_MASK	GENMASK(2, 0)
86*af3d54b9SSrinivas Kandagatla #define CDC_RX_CLSH_HPH_V_PA		(0x020C)
87*af3d54b9SSrinivas Kandagatla #define CDC_RX_CLSH_HPH_V_PA_MIN_MASK	GENMASK(5, 0)
88*af3d54b9SSrinivas Kandagatla #define CDC_RX_CLSH_EAR_V_PA		(0x0210)
89*af3d54b9SSrinivas Kandagatla #define CDC_RX_CLSH_HPH_V_HD		(0x0214)
90*af3d54b9SSrinivas Kandagatla #define CDC_RX_CLSH_EAR_V_HD		(0x0218)
91*af3d54b9SSrinivas Kandagatla #define CDC_RX_CLSH_K1_MSB		(0x021C)
92*af3d54b9SSrinivas Kandagatla #define CDC_RX_CLSH_K1_MSB_COEFF_MASK	GENMASK(3, 0)
93*af3d54b9SSrinivas Kandagatla #define CDC_RX_CLSH_K1_LSB		(0x0220)
94*af3d54b9SSrinivas Kandagatla #define CDC_RX_CLSH_K2_MSB		(0x0224)
95*af3d54b9SSrinivas Kandagatla #define CDC_RX_CLSH_K2_LSB		(0x0228)
96*af3d54b9SSrinivas Kandagatla #define CDC_RX_CLSH_IDLE_CTRL		(0x022C)
97*af3d54b9SSrinivas Kandagatla #define CDC_RX_CLSH_IDLE_HPH		(0x0230)
98*af3d54b9SSrinivas Kandagatla #define CDC_RX_CLSH_IDLE_EAR		(0x0234)
99*af3d54b9SSrinivas Kandagatla #define CDC_RX_CLSH_TEST0		(0x0238)
100*af3d54b9SSrinivas Kandagatla #define CDC_RX_CLSH_TEST1		(0x023C)
101*af3d54b9SSrinivas Kandagatla #define CDC_RX_CLSH_OVR_VREF		(0x0240)
102*af3d54b9SSrinivas Kandagatla #define CDC_RX_CLSH_CLSG_CTL		(0x0244)
103*af3d54b9SSrinivas Kandagatla #define CDC_RX_CLSH_CLSG_CFG1		(0x0248)
104*af3d54b9SSrinivas Kandagatla #define CDC_RX_CLSH_CLSG_CFG2		(0x024C)
105*af3d54b9SSrinivas Kandagatla #define CDC_RX_BCL_VBAT_PATH_CTL	(0x0280)
106*af3d54b9SSrinivas Kandagatla #define CDC_RX_BCL_VBAT_CFG		(0x0284)
107*af3d54b9SSrinivas Kandagatla #define CDC_RX_BCL_VBAT_ADC_CAL1	(0x0288)
108*af3d54b9SSrinivas Kandagatla #define CDC_RX_BCL_VBAT_ADC_CAL2	(0x028C)
109*af3d54b9SSrinivas Kandagatla #define CDC_RX_BCL_VBAT_ADC_CAL3	(0x0290)
110*af3d54b9SSrinivas Kandagatla #define CDC_RX_BCL_VBAT_PK_EST1		(0x0294)
111*af3d54b9SSrinivas Kandagatla #define CDC_RX_BCL_VBAT_PK_EST2		(0x0298)
112*af3d54b9SSrinivas Kandagatla #define CDC_RX_BCL_VBAT_PK_EST3		(0x029C)
113*af3d54b9SSrinivas Kandagatla #define CDC_RX_BCL_VBAT_RF_PROC1	(0x02A0)
114*af3d54b9SSrinivas Kandagatla #define CDC_RX_BCL_VBAT_RF_PROC2	(0x02A4)
115*af3d54b9SSrinivas Kandagatla #define CDC_RX_BCL_VBAT_TAC1		(0x02A8)
116*af3d54b9SSrinivas Kandagatla #define CDC_RX_BCL_VBAT_TAC2		(0x02AC)
117*af3d54b9SSrinivas Kandagatla #define CDC_RX_BCL_VBAT_TAC3		(0x02B0)
118*af3d54b9SSrinivas Kandagatla #define CDC_RX_BCL_VBAT_TAC4		(0x02B4)
119*af3d54b9SSrinivas Kandagatla #define CDC_RX_BCL_VBAT_GAIN_UPD1	(0x02B8)
120*af3d54b9SSrinivas Kandagatla #define CDC_RX_BCL_VBAT_GAIN_UPD2	(0x02BC)
121*af3d54b9SSrinivas Kandagatla #define CDC_RX_BCL_VBAT_GAIN_UPD3	(0x02C0)
122*af3d54b9SSrinivas Kandagatla #define CDC_RX_BCL_VBAT_GAIN_UPD4	(0x02C4)
123*af3d54b9SSrinivas Kandagatla #define CDC_RX_BCL_VBAT_GAIN_UPD5	(0x02C8)
124*af3d54b9SSrinivas Kandagatla #define CDC_RX_BCL_VBAT_DEBUG1		(0x02CC)
125*af3d54b9SSrinivas Kandagatla #define CDC_RX_BCL_VBAT_GAIN_UPD_MON	(0x02D0)
126*af3d54b9SSrinivas Kandagatla #define CDC_RX_BCL_VBAT_GAIN_MON_VAL	(0x02D4)
127*af3d54b9SSrinivas Kandagatla #define CDC_RX_BCL_VBAT_BAN		(0x02D8)
128*af3d54b9SSrinivas Kandagatla #define CDC_RX_BCL_VBAT_BCL_GAIN_UPD1	(0x02DC)
129*af3d54b9SSrinivas Kandagatla #define CDC_RX_BCL_VBAT_BCL_GAIN_UPD2	(0x02E0)
130*af3d54b9SSrinivas Kandagatla #define CDC_RX_BCL_VBAT_BCL_GAIN_UPD3	(0x02E4)
131*af3d54b9SSrinivas Kandagatla #define CDC_RX_BCL_VBAT_BCL_GAIN_UPD4	(0x02E8)
132*af3d54b9SSrinivas Kandagatla #define CDC_RX_BCL_VBAT_BCL_GAIN_UPD5	(0x02EC)
133*af3d54b9SSrinivas Kandagatla #define CDC_RX_BCL_VBAT_BCL_GAIN_UPD6	(0x02F0)
134*af3d54b9SSrinivas Kandagatla #define CDC_RX_BCL_VBAT_BCL_GAIN_UPD7	(0x02F4)
135*af3d54b9SSrinivas Kandagatla #define CDC_RX_BCL_VBAT_BCL_GAIN_UPD8	(0x02F8)
136*af3d54b9SSrinivas Kandagatla #define CDC_RX_BCL_VBAT_BCL_GAIN_UPD9	(0x02FC)
137*af3d54b9SSrinivas Kandagatla #define CDC_RX_BCL_VBAT_ATTN1		(0x0300)
138*af3d54b9SSrinivas Kandagatla #define CDC_RX_BCL_VBAT_ATTN2		(0x0304)
139*af3d54b9SSrinivas Kandagatla #define CDC_RX_BCL_VBAT_ATTN3		(0x0308)
140*af3d54b9SSrinivas Kandagatla #define CDC_RX_BCL_VBAT_DECODE_CTL1	(0x030C)
141*af3d54b9SSrinivas Kandagatla #define CDC_RX_BCL_VBAT_DECODE_CTL2	(0x0310)
142*af3d54b9SSrinivas Kandagatla #define CDC_RX_BCL_VBAT_DECODE_CFG1	(0x0314)
143*af3d54b9SSrinivas Kandagatla #define CDC_RX_BCL_VBAT_DECODE_CFG2	(0x0318)
144*af3d54b9SSrinivas Kandagatla #define CDC_RX_BCL_VBAT_DECODE_CFG3	(0x031C)
145*af3d54b9SSrinivas Kandagatla #define CDC_RX_BCL_VBAT_DECODE_CFG4	(0x0320)
146*af3d54b9SSrinivas Kandagatla #define CDC_RX_BCL_VBAT_DECODE_ST	(0x0324)
147*af3d54b9SSrinivas Kandagatla #define CDC_RX_INTR_CTRL_CFG		(0x0340)
148*af3d54b9SSrinivas Kandagatla #define CDC_RX_INTR_CTRL_CLR_COMMIT	(0x0344)
149*af3d54b9SSrinivas Kandagatla #define CDC_RX_INTR_CTRL_PIN1_MASK0	(0x0360)
150*af3d54b9SSrinivas Kandagatla #define CDC_RX_INTR_CTRL_PIN1_STATUS0	(0x0368)
151*af3d54b9SSrinivas Kandagatla #define CDC_RX_INTR_CTRL_PIN1_CLEAR0	(0x0370)
152*af3d54b9SSrinivas Kandagatla #define CDC_RX_INTR_CTRL_PIN2_MASK0	(0x0380)
153*af3d54b9SSrinivas Kandagatla #define CDC_RX_INTR_CTRL_PIN2_STATUS0	(0x0388)
154*af3d54b9SSrinivas Kandagatla #define CDC_RX_INTR_CTRL_PIN2_CLEAR0	(0x0390)
155*af3d54b9SSrinivas Kandagatla #define CDC_RX_INTR_CTRL_LEVEL0		(0x03C0)
156*af3d54b9SSrinivas Kandagatla #define CDC_RX_INTR_CTRL_BYPASS0	(0x03C8)
157*af3d54b9SSrinivas Kandagatla #define CDC_RX_INTR_CTRL_SET0		(0x03D0)
158*af3d54b9SSrinivas Kandagatla #define CDC_RX_RXn_RX_PATH_CTL(n)	(0x0400 + 0x80 * n)
159*af3d54b9SSrinivas Kandagatla #define CDC_RX_RX0_RX_PATH_CTL		(0x0400)
160*af3d54b9SSrinivas Kandagatla #define CDC_RX_PATH_RESET_EN_MASK	BIT(6)
161*af3d54b9SSrinivas Kandagatla #define CDC_RX_PATH_CLK_EN_MASK		BIT(5)
162*af3d54b9SSrinivas Kandagatla #define CDC_RX_PATH_CLK_ENABLE		BIT(5)
163*af3d54b9SSrinivas Kandagatla #define CDC_RX_PATH_PGA_MUTE_MASK	BIT(4)
164*af3d54b9SSrinivas Kandagatla #define CDC_RX_PATH_PGA_MUTE_ENABLE	BIT(4)
165*af3d54b9SSrinivas Kandagatla #define CDC_RX_PATH_PCM_RATE_MASK	GENMASK(3, 0)
166*af3d54b9SSrinivas Kandagatla #define CDC_RX_RXn_RX_PATH_CFG0(n)	(0x0404 + 0x80 * n)
167*af3d54b9SSrinivas Kandagatla #define CDC_RX_RXn_COMP_EN_MASK		BIT(1)
168*af3d54b9SSrinivas Kandagatla #define CDC_RX_RX0_RX_PATH_CFG0		(0x0404)
169*af3d54b9SSrinivas Kandagatla #define CDC_RX_RXn_CLSH_EN_MASK		BIT(6)
170*af3d54b9SSrinivas Kandagatla #define CDC_RX_DLY_ZN_EN_MASK		BIT(3)
171*af3d54b9SSrinivas Kandagatla #define CDC_RX_DLY_ZN_ENABLE		BIT(3)
172*af3d54b9SSrinivas Kandagatla #define CDC_RX_RXn_HD2_EN_MASK		BIT(2)
173*af3d54b9SSrinivas Kandagatla #define CDC_RX_RXn_RX_PATH_CFG1(n)	(0x0408 + 0x80 * n)
174*af3d54b9SSrinivas Kandagatla #define CDC_RX_RXn_SIDETONE_EN_MASK	BIT(4)
175*af3d54b9SSrinivas Kandagatla #define CDC_RX_RX0_RX_PATH_CFG1		(0x0408)
176*af3d54b9SSrinivas Kandagatla #define CDC_RX_RX0_HPH_L_EAR_SEL_MASK	BIT(1)
177*af3d54b9SSrinivas Kandagatla #define CDC_RX_RXn_RX_PATH_CFG2(n)	(0x040C + 0x80 * n)
178*af3d54b9SSrinivas Kandagatla #define CDC_RX_RXn_HPF_CUT_FREQ_MASK	GENMASK(1, 0)
179*af3d54b9SSrinivas Kandagatla #define CDC_RX_RX0_RX_PATH_CFG2		(0x040C)
180*af3d54b9SSrinivas Kandagatla #define CDC_RX_RXn_RX_PATH_CFG3(n)	(0x0410 + 0x80 * n)
181*af3d54b9SSrinivas Kandagatla #define CDC_RX_RX0_RX_PATH_CFG3		(0x0410)
182*af3d54b9SSrinivas Kandagatla #define CDC_RX_DC_COEFF_SEL_MASK	GENMASK(1, 0)
183*af3d54b9SSrinivas Kandagatla #define CDC_RX_DC_COEFF_SEL_TWO		0x2
184*af3d54b9SSrinivas Kandagatla #define CDC_RX_RXn_RX_VOL_CTL(n)	(0x0414 + 0x80 * n)
185*af3d54b9SSrinivas Kandagatla #define CDC_RX_RX0_RX_VOL_CTL		(0x0414)
186*af3d54b9SSrinivas Kandagatla #define CDC_RX_RXn_RX_PATH_MIX_CTL(n)	(0x0418 + 0x80 * n)
187*af3d54b9SSrinivas Kandagatla #define CDC_RX_RXn_MIX_PCM_RATE_MASK	GENMASK(3, 0)
188*af3d54b9SSrinivas Kandagatla #define CDC_RX_RXn_MIX_RESET_MASK	BIT(6)
189*af3d54b9SSrinivas Kandagatla #define CDC_RX_RXn_MIX_RESET		BIT(6)
190*af3d54b9SSrinivas Kandagatla #define CDC_RX_RXn_MIX_CLK_EN_MASK	BIT(5)
191*af3d54b9SSrinivas Kandagatla #define CDC_RX_RX0_RX_PATH_MIX_CTL	(0x0418)
192*af3d54b9SSrinivas Kandagatla #define CDC_RX_RX0_RX_PATH_MIX_CFG	(0x041C)
193*af3d54b9SSrinivas Kandagatla #define CDC_RX_RXn_RX_VOL_MIX_CTL(n)	(0x0420 + 0x80 * n)
194*af3d54b9SSrinivas Kandagatla #define CDC_RX_RX0_RX_VOL_MIX_CTL	(0x0420)
195*af3d54b9SSrinivas Kandagatla #define CDC_RX_RX0_RX_PATH_SEC1		(0x0424)
196*af3d54b9SSrinivas Kandagatla #define CDC_RX_RX0_RX_PATH_SEC2		(0x0428)
197*af3d54b9SSrinivas Kandagatla #define CDC_RX_RX0_RX_PATH_SEC3		(0x042C)
198*af3d54b9SSrinivas Kandagatla #define CDC_RX_RX0_RX_PATH_SEC4		(0x0430)
199*af3d54b9SSrinivas Kandagatla #define CDC_RX_RX0_RX_PATH_SEC7		(0x0434)
200*af3d54b9SSrinivas Kandagatla #define CDC_RX_DSM_OUT_DELAY_SEL_MASK	GENMASK(2, 0)
201*af3d54b9SSrinivas Kandagatla #define CDC_RX_DSM_OUT_DELAY_TWO_SAMPLE	0x2
202*af3d54b9SSrinivas Kandagatla #define CDC_RX_RX0_RX_PATH_MIX_SEC0	(0x0438)
203*af3d54b9SSrinivas Kandagatla #define CDC_RX_RX0_RX_PATH_MIX_SEC1	(0x043C)
204*af3d54b9SSrinivas Kandagatla #define CDC_RX_RXn_RX_PATH_DSM_CTL(n)	(0x0440 + 0x80 * n)
205*af3d54b9SSrinivas Kandagatla #define CDC_RX_RXn_DSM_CLK_EN_MASK	BIT(0)
206*af3d54b9SSrinivas Kandagatla #define CDC_RX_RX0_RX_PATH_DSM_CTL	(0x0440)
207*af3d54b9SSrinivas Kandagatla #define CDC_RX_RX0_RX_PATH_DSM_DATA1	(0x0444)
208*af3d54b9SSrinivas Kandagatla #define CDC_RX_RX0_RX_PATH_DSM_DATA2	(0x0448)
209*af3d54b9SSrinivas Kandagatla #define CDC_RX_RX0_RX_PATH_DSM_DATA3	(0x044C)
210*af3d54b9SSrinivas Kandagatla #define CDC_RX_RX0_RX_PATH_DSM_DATA4	(0x0450)
211*af3d54b9SSrinivas Kandagatla #define CDC_RX_RX0_RX_PATH_DSM_DATA5	(0x0454)
212*af3d54b9SSrinivas Kandagatla #define CDC_RX_RX0_RX_PATH_DSM_DATA6	(0x0458)
213*af3d54b9SSrinivas Kandagatla #define CDC_RX_RX1_RX_PATH_CTL		(0x0480)
214*af3d54b9SSrinivas Kandagatla #define CDC_RX_RX1_RX_PATH_CFG0		(0x0484)
215*af3d54b9SSrinivas Kandagatla #define CDC_RX_RX1_RX_PATH_CFG1		(0x0488)
216*af3d54b9SSrinivas Kandagatla #define CDC_RX_RX1_RX_PATH_CFG2		(0x048C)
217*af3d54b9SSrinivas Kandagatla #define CDC_RX_RX1_RX_PATH_CFG3		(0x0490)
218*af3d54b9SSrinivas Kandagatla #define CDC_RX_RX1_RX_VOL_CTL		(0x0494)
219*af3d54b9SSrinivas Kandagatla #define CDC_RX_RX1_RX_PATH_MIX_CTL	(0x0498)
220*af3d54b9SSrinivas Kandagatla #define CDC_RX_RX1_RX_PATH_MIX_CFG	(0x049C)
221*af3d54b9SSrinivas Kandagatla #define CDC_RX_RX1_RX_VOL_MIX_CTL	(0x04A0)
222*af3d54b9SSrinivas Kandagatla #define CDC_RX_RX1_RX_PATH_SEC1		(0x04A4)
223*af3d54b9SSrinivas Kandagatla #define CDC_RX_RX1_RX_PATH_SEC2		(0x04A8)
224*af3d54b9SSrinivas Kandagatla #define CDC_RX_RX1_RX_PATH_SEC3		(0x04AC)
225*af3d54b9SSrinivas Kandagatla #define CDC_RX_RXn_HD2_ALPHA_MASK	GENMASK(5, 2)
226*af3d54b9SSrinivas Kandagatla #define CDC_RX_RX1_RX_PATH_SEC4		(0x04B0)
227*af3d54b9SSrinivas Kandagatla #define CDC_RX_RX1_RX_PATH_SEC7		(0x04B4)
228*af3d54b9SSrinivas Kandagatla #define CDC_RX_RX1_RX_PATH_MIX_SEC0	(0x04B8)
229*af3d54b9SSrinivas Kandagatla #define CDC_RX_RX1_RX_PATH_MIX_SEC1	(0x04BC)
230*af3d54b9SSrinivas Kandagatla #define CDC_RX_RX1_RX_PATH_DSM_CTL	(0x04C0)
231*af3d54b9SSrinivas Kandagatla #define CDC_RX_RX1_RX_PATH_DSM_DATA1	(0x04C4)
232*af3d54b9SSrinivas Kandagatla #define CDC_RX_RX1_RX_PATH_DSM_DATA2	(0x04C8)
233*af3d54b9SSrinivas Kandagatla #define CDC_RX_RX1_RX_PATH_DSM_DATA3	(0x04CC)
234*af3d54b9SSrinivas Kandagatla #define CDC_RX_RX1_RX_PATH_DSM_DATA4	(0x04D0)
235*af3d54b9SSrinivas Kandagatla #define CDC_RX_RX1_RX_PATH_DSM_DATA5	(0x04D4)
236*af3d54b9SSrinivas Kandagatla #define CDC_RX_RX1_RX_PATH_DSM_DATA6	(0x04D8)
237*af3d54b9SSrinivas Kandagatla #define CDC_RX_RX2_RX_PATH_CTL		(0x0500)
238*af3d54b9SSrinivas Kandagatla #define CDC_RX_RX2_RX_PATH_CFG0		(0x0504)
239*af3d54b9SSrinivas Kandagatla #define CDC_RX_RX2_CLSH_EN_MASK		BIT(4)
240*af3d54b9SSrinivas Kandagatla #define CDC_RX_RX2_DLY_Z_EN_MASK	BIT(3)
241*af3d54b9SSrinivas Kandagatla #define CDC_RX_RX2_RX_PATH_CFG1		(0x0508)
242*af3d54b9SSrinivas Kandagatla #define CDC_RX_RX2_RX_PATH_CFG2		(0x050C)
243*af3d54b9SSrinivas Kandagatla #define CDC_RX_RX2_RX_PATH_CFG3		(0x0510)
244*af3d54b9SSrinivas Kandagatla #define CDC_RX_RX2_RX_VOL_CTL		(0x0514)
245*af3d54b9SSrinivas Kandagatla #define CDC_RX_RX2_RX_PATH_MIX_CTL	(0x0518)
246*af3d54b9SSrinivas Kandagatla #define CDC_RX_RX2_RX_PATH_MIX_CFG	(0x051C)
247*af3d54b9SSrinivas Kandagatla #define CDC_RX_RX2_RX_VOL_MIX_CTL	(0x0520)
248*af3d54b9SSrinivas Kandagatla #define CDC_RX_RX2_RX_PATH_SEC0		(0x0524)
249*af3d54b9SSrinivas Kandagatla #define CDC_RX_RX2_RX_PATH_SEC1		(0x0528)
250*af3d54b9SSrinivas Kandagatla #define CDC_RX_RX2_RX_PATH_SEC2		(0x052C)
251*af3d54b9SSrinivas Kandagatla #define CDC_RX_RX2_RX_PATH_SEC3		(0x0530)
252*af3d54b9SSrinivas Kandagatla #define CDC_RX_RX2_RX_PATH_SEC4		(0x0534)
253*af3d54b9SSrinivas Kandagatla #define CDC_RX_RX2_RX_PATH_SEC5		(0x0538)
254*af3d54b9SSrinivas Kandagatla #define CDC_RX_RX2_RX_PATH_SEC6		(0x053C)
255*af3d54b9SSrinivas Kandagatla #define CDC_RX_RX2_RX_PATH_SEC7		(0x0540)
256*af3d54b9SSrinivas Kandagatla #define CDC_RX_RX2_RX_PATH_MIX_SEC0	(0x0544)
257*af3d54b9SSrinivas Kandagatla #define CDC_RX_RX2_RX_PATH_MIX_SEC1	(0x0548)
258*af3d54b9SSrinivas Kandagatla #define CDC_RX_RX2_RX_PATH_DSM_CTL	(0x054C)
259*af3d54b9SSrinivas Kandagatla #define CDC_RX_IDLE_DETECT_PATH_CTL	(0x0780)
260*af3d54b9SSrinivas Kandagatla #define CDC_RX_IDLE_DETECT_CFG0		(0x0784)
261*af3d54b9SSrinivas Kandagatla #define CDC_RX_IDLE_DETECT_CFG1		(0x0788)
262*af3d54b9SSrinivas Kandagatla #define CDC_RX_IDLE_DETECT_CFG2		(0x078C)
263*af3d54b9SSrinivas Kandagatla #define CDC_RX_IDLE_DETECT_CFG3		(0x0790)
264*af3d54b9SSrinivas Kandagatla #define CDC_RX_COMPANDERn_CTL0(n)	(0x0800 + 0x40 * n)
265*af3d54b9SSrinivas Kandagatla #define CDC_RX_COMPANDERn_CLK_EN_MASK	BIT(0)
266*af3d54b9SSrinivas Kandagatla #define CDC_RX_COMPANDERn_SOFT_RST_MASK	BIT(1)
267*af3d54b9SSrinivas Kandagatla #define CDC_RX_COMPANDERn_HALT_MASK	BIT(2)
268*af3d54b9SSrinivas Kandagatla #define CDC_RX_COMPANDER0_CTL0		(0x0800)
269*af3d54b9SSrinivas Kandagatla #define CDC_RX_COMPANDER0_CTL1		(0x0804)
270*af3d54b9SSrinivas Kandagatla #define CDC_RX_COMPANDER0_CTL2		(0x0808)
271*af3d54b9SSrinivas Kandagatla #define CDC_RX_COMPANDER0_CTL3		(0x080C)
272*af3d54b9SSrinivas Kandagatla #define CDC_RX_COMPANDER0_CTL4		(0x0810)
273*af3d54b9SSrinivas Kandagatla #define CDC_RX_COMPANDER0_CTL5		(0x0814)
274*af3d54b9SSrinivas Kandagatla #define CDC_RX_COMPANDER0_CTL6		(0x0818)
275*af3d54b9SSrinivas Kandagatla #define CDC_RX_COMPANDER0_CTL7		(0x081C)
276*af3d54b9SSrinivas Kandagatla #define CDC_RX_COMPANDER1_CTL0		(0x0840)
277*af3d54b9SSrinivas Kandagatla #define CDC_RX_COMPANDER1_CTL1		(0x0844)
278*af3d54b9SSrinivas Kandagatla #define CDC_RX_COMPANDER1_CTL2		(0x0848)
279*af3d54b9SSrinivas Kandagatla #define CDC_RX_COMPANDER1_CTL3		(0x084C)
280*af3d54b9SSrinivas Kandagatla #define CDC_RX_COMPANDER1_CTL4		(0x0850)
281*af3d54b9SSrinivas Kandagatla #define CDC_RX_COMPANDER1_CTL5		(0x0854)
282*af3d54b9SSrinivas Kandagatla #define CDC_RX_COMPANDER1_CTL6		(0x0858)
283*af3d54b9SSrinivas Kandagatla #define CDC_RX_COMPANDER1_CTL7		(0x085C)
284*af3d54b9SSrinivas Kandagatla #define CDC_RX_COMPANDER1_HPH_LOW_PWR_MODE_MASK	BIT(5)
285*af3d54b9SSrinivas Kandagatla #define CDC_RX_SIDETONE_IIR0_IIR_PATH_CTL	(0x0A00)
286*af3d54b9SSrinivas Kandagatla #define CDC_RX_SIDETONE_IIR0_IIR_GAIN_B1_CTL	(0x0A04)
287*af3d54b9SSrinivas Kandagatla #define CDC_RX_SIDETONE_IIR0_IIR_GAIN_B2_CTL	(0x0A08)
288*af3d54b9SSrinivas Kandagatla #define CDC_RX_SIDETONE_IIR0_IIR_GAIN_B3_CTL	(0x0A0C)
289*af3d54b9SSrinivas Kandagatla #define CDC_RX_SIDETONE_IIR0_IIR_GAIN_B4_CTL	(0x0A10)
290*af3d54b9SSrinivas Kandagatla #define CDC_RX_SIDETONE_IIR0_IIR_GAIN_B5_CTL	(0x0A14)
291*af3d54b9SSrinivas Kandagatla #define CDC_RX_SIDETONE_IIR0_IIR_GAIN_B6_CTL	(0x0A18)
292*af3d54b9SSrinivas Kandagatla #define CDC_RX_SIDETONE_IIR0_IIR_GAIN_B7_CTL	(0x0A1C)
293*af3d54b9SSrinivas Kandagatla #define CDC_RX_SIDETONE_IIR0_IIR_GAIN_B8_CTL	(0x0A20)
294*af3d54b9SSrinivas Kandagatla #define CDC_RX_SIDETONE_IIR0_IIR_CTL		(0x0A24)
295*af3d54b9SSrinivas Kandagatla #define CDC_RX_SIDETONE_IIR0_IIR_GAIN_TIMER_CTL	(0x0A28)
296*af3d54b9SSrinivas Kandagatla #define CDC_RX_SIDETONE_IIR0_IIR_COEF_B1_CTL	(0x0A2C)
297*af3d54b9SSrinivas Kandagatla #define CDC_RX_SIDETONE_IIR0_IIR_COEF_B2_CTL	(0x0A30)
298*af3d54b9SSrinivas Kandagatla #define CDC_RX_SIDETONE_IIR1_IIR_PATH_CTL	(0x0A80)
299*af3d54b9SSrinivas Kandagatla #define CDC_RX_SIDETONE_IIR1_IIR_GAIN_B1_CTL	(0x0A84)
300*af3d54b9SSrinivas Kandagatla #define CDC_RX_SIDETONE_IIR1_IIR_GAIN_B2_CTL	(0x0A88)
301*af3d54b9SSrinivas Kandagatla #define CDC_RX_SIDETONE_IIR1_IIR_GAIN_B3_CTL	(0x0A8C)
302*af3d54b9SSrinivas Kandagatla #define CDC_RX_SIDETONE_IIR1_IIR_GAIN_B4_CTL	(0x0A90)
303*af3d54b9SSrinivas Kandagatla #define CDC_RX_SIDETONE_IIR1_IIR_GAIN_B5_CTL	(0x0A94)
304*af3d54b9SSrinivas Kandagatla #define CDC_RX_SIDETONE_IIR1_IIR_GAIN_B6_CTL	(0x0A98)
305*af3d54b9SSrinivas Kandagatla #define CDC_RX_SIDETONE_IIR1_IIR_GAIN_B7_CTL	(0x0A9C)
306*af3d54b9SSrinivas Kandagatla #define CDC_RX_SIDETONE_IIR1_IIR_GAIN_B8_CTL	(0x0AA0)
307*af3d54b9SSrinivas Kandagatla #define CDC_RX_SIDETONE_IIR1_IIR_CTL		(0x0AA4)
308*af3d54b9SSrinivas Kandagatla #define CDC_RX_SIDETONE_IIR1_IIR_GAIN_TIMER_CTL	(0x0AA8)
309*af3d54b9SSrinivas Kandagatla #define CDC_RX_SIDETONE_IIR1_IIR_COEF_B1_CTL	(0x0AAC)
310*af3d54b9SSrinivas Kandagatla #define CDC_RX_SIDETONE_IIR1_IIR_COEF_B2_CTL	(0x0AB0)
311*af3d54b9SSrinivas Kandagatla #define CDC_RX_IIR_INP_MUX_IIR0_MIX_CFG0	(0x0B00)
312*af3d54b9SSrinivas Kandagatla #define CDC_RX_IIR_INP_MUX_IIR0_MIX_CFG1	(0x0B04)
313*af3d54b9SSrinivas Kandagatla #define CDC_RX_IIR_INP_MUX_IIR0_MIX_CFG2	(0x0B08)
314*af3d54b9SSrinivas Kandagatla #define CDC_RX_IIR_INP_MUX_IIR0_MIX_CFG3	(0x0B0C)
315*af3d54b9SSrinivas Kandagatla #define CDC_RX_IIR_INP_MUX_IIR1_MIX_CFG0	(0x0B10)
316*af3d54b9SSrinivas Kandagatla #define CDC_RX_IIR_INP_MUX_IIR1_MIX_CFG1	(0x0B14)
317*af3d54b9SSrinivas Kandagatla #define CDC_RX_IIR_INP_MUX_IIR1_MIX_CFG2	(0x0B18)
318*af3d54b9SSrinivas Kandagatla #define CDC_RX_IIR_INP_MUX_IIR1_MIX_CFG3	(0x0B1C)
319*af3d54b9SSrinivas Kandagatla #define CDC_RX_SIDETONE_SRC0_ST_SRC_PATH_CTL	(0x0B40)
320*af3d54b9SSrinivas Kandagatla #define CDC_RX_SIDETONE_SRC0_ST_SRC_PATH_CFG1	(0x0B44)
321*af3d54b9SSrinivas Kandagatla #define CDC_RX_SIDETONE_SRC1_ST_SRC_PATH_CTL	(0x0B50)
322*af3d54b9SSrinivas Kandagatla #define CDC_RX_SIDETONE_SRC1_ST_SRC_PATH_CFG1	(0x0B54)
323*af3d54b9SSrinivas Kandagatla #define CDC_RX_EC_REF_HQ0_EC_REF_HQ_PATH_CTL	(0x0C00)
324*af3d54b9SSrinivas Kandagatla #define CDC_RX_EC_REF_HQ0_EC_REF_HQ_CFG0	(0x0C04)
325*af3d54b9SSrinivas Kandagatla #define CDC_RX_EC_REF_HQ1_EC_REF_HQ_PATH_CTL	(0x0C40)
326*af3d54b9SSrinivas Kandagatla #define CDC_RX_EC_REF_HQ1_EC_REF_HQ_CFG0	(0x0C44)
327*af3d54b9SSrinivas Kandagatla #define CDC_RX_EC_REF_HQ2_EC_REF_HQ_PATH_CTL	(0x0C80)
328*af3d54b9SSrinivas Kandagatla #define CDC_RX_EC_REF_HQ2_EC_REF_HQ_CFG0	(0x0C84)
329*af3d54b9SSrinivas Kandagatla #define CDC_RX_EC_ASRC0_CLK_RST_CTL		(0x0D00)
330*af3d54b9SSrinivas Kandagatla #define CDC_RX_EC_ASRC0_CTL0			(0x0D04)
331*af3d54b9SSrinivas Kandagatla #define CDC_RX_EC_ASRC0_CTL1			(0x0D08)
332*af3d54b9SSrinivas Kandagatla #define CDC_RX_EC_ASRC0_FIFO_CTL		(0x0D0C)
333*af3d54b9SSrinivas Kandagatla #define CDC_RX_EC_ASRC0_STATUS_FMIN_CNTR_LSB	(0x0D10)
334*af3d54b9SSrinivas Kandagatla #define CDC_RX_EC_ASRC0_STATUS_FMIN_CNTR_MSB	(0x0D14)
335*af3d54b9SSrinivas Kandagatla #define CDC_RX_EC_ASRC0_STATUS_FMAX_CNTR_LSB	(0x0D18)
336*af3d54b9SSrinivas Kandagatla #define CDC_RX_EC_ASRC0_STATUS_FMAX_CNTR_MSB	(0x0D1C)
337*af3d54b9SSrinivas Kandagatla #define CDC_RX_EC_ASRC0_STATUS_FIFO		(0x0D20)
338*af3d54b9SSrinivas Kandagatla #define CDC_RX_EC_ASRC1_CLK_RST_CTL		(0x0D40)
339*af3d54b9SSrinivas Kandagatla #define CDC_RX_EC_ASRC1_CTL0			(0x0D44)
340*af3d54b9SSrinivas Kandagatla #define CDC_RX_EC_ASRC1_CTL1			(0x0D48)
341*af3d54b9SSrinivas Kandagatla #define CDC_RX_EC_ASRC1_FIFO_CTL		(0x0D4C)
342*af3d54b9SSrinivas Kandagatla #define CDC_RX_EC_ASRC1_STATUS_FMIN_CNTR_LSB	(0x0D50)
343*af3d54b9SSrinivas Kandagatla #define CDC_RX_EC_ASRC1_STATUS_FMIN_CNTR_MSB	(0x0D54)
344*af3d54b9SSrinivas Kandagatla #define CDC_RX_EC_ASRC1_STATUS_FMAX_CNTR_LSB	(0x0D58)
345*af3d54b9SSrinivas Kandagatla #define CDC_RX_EC_ASRC1_STATUS_FMAX_CNTR_MSB	(0x0D5C)
346*af3d54b9SSrinivas Kandagatla #define CDC_RX_EC_ASRC1_STATUS_FIFO		(0x0D60)
347*af3d54b9SSrinivas Kandagatla #define CDC_RX_EC_ASRC2_CLK_RST_CTL		(0x0D80)
348*af3d54b9SSrinivas Kandagatla #define CDC_RX_EC_ASRC2_CTL0			(0x0D84)
349*af3d54b9SSrinivas Kandagatla #define CDC_RX_EC_ASRC2_CTL1			(0x0D88)
350*af3d54b9SSrinivas Kandagatla #define CDC_RX_EC_ASRC2_FIFO_CTL		(0x0D8C)
351*af3d54b9SSrinivas Kandagatla #define CDC_RX_EC_ASRC2_STATUS_FMIN_CNTR_LSB	(0x0D90)
352*af3d54b9SSrinivas Kandagatla #define CDC_RX_EC_ASRC2_STATUS_FMIN_CNTR_MSB	(0x0D94)
353*af3d54b9SSrinivas Kandagatla #define CDC_RX_EC_ASRC2_STATUS_FMAX_CNTR_LSB	(0x0D98)
354*af3d54b9SSrinivas Kandagatla #define CDC_RX_EC_ASRC2_STATUS_FMAX_CNTR_MSB	(0x0D9C)
355*af3d54b9SSrinivas Kandagatla #define CDC_RX_EC_ASRC2_STATUS_FIFO		(0x0DA0)
356*af3d54b9SSrinivas Kandagatla #define CDC_RX_DSD0_PATH_CTL			(0x0F00)
357*af3d54b9SSrinivas Kandagatla #define CDC_RX_DSD0_CFG0			(0x0F04)
358*af3d54b9SSrinivas Kandagatla #define CDC_RX_DSD0_CFG1			(0x0F08)
359*af3d54b9SSrinivas Kandagatla #define CDC_RX_DSD0_CFG2			(0x0F0C)
360*af3d54b9SSrinivas Kandagatla #define CDC_RX_DSD1_PATH_CTL			(0x0F80)
361*af3d54b9SSrinivas Kandagatla #define CDC_RX_DSD1_CFG0			(0x0F84)
362*af3d54b9SSrinivas Kandagatla #define CDC_RX_DSD1_CFG1			(0x0F88)
363*af3d54b9SSrinivas Kandagatla #define CDC_RX_DSD1_CFG2			(0x0F8C)
364*af3d54b9SSrinivas Kandagatla #define RX_MAX_OFFSET				(0x0F8C)
365*af3d54b9SSrinivas Kandagatla 
366*af3d54b9SSrinivas Kandagatla #define MCLK_FREQ		9600000
367*af3d54b9SSrinivas Kandagatla 
368*af3d54b9SSrinivas Kandagatla #define RX_MACRO_RATES (SNDRV_PCM_RATE_8000 | SNDRV_PCM_RATE_16000 |\
369*af3d54b9SSrinivas Kandagatla 			SNDRV_PCM_RATE_32000 | SNDRV_PCM_RATE_48000 |\
370*af3d54b9SSrinivas Kandagatla 			SNDRV_PCM_RATE_96000 | SNDRV_PCM_RATE_192000 |\
371*af3d54b9SSrinivas Kandagatla 			SNDRV_PCM_RATE_384000)
372*af3d54b9SSrinivas Kandagatla /* Fractional Rates */
373*af3d54b9SSrinivas Kandagatla #define RX_MACRO_FRAC_RATES (SNDRV_PCM_RATE_44100 | SNDRV_PCM_RATE_88200 |\
374*af3d54b9SSrinivas Kandagatla 				SNDRV_PCM_RATE_176400 | SNDRV_PCM_RATE_352800)
375*af3d54b9SSrinivas Kandagatla 
376*af3d54b9SSrinivas Kandagatla #define RX_MACRO_FORMATS (SNDRV_PCM_FMTBIT_S16_LE |\
377*af3d54b9SSrinivas Kandagatla 		SNDRV_PCM_FMTBIT_S24_LE |\
378*af3d54b9SSrinivas Kandagatla 		SNDRV_PCM_FMTBIT_S24_3LE | SNDRV_PCM_FMTBIT_S32_LE)
379*af3d54b9SSrinivas Kandagatla 
380*af3d54b9SSrinivas Kandagatla #define RX_MACRO_ECHO_RATES (SNDRV_PCM_RATE_8000 | SNDRV_PCM_RATE_16000 |\
381*af3d54b9SSrinivas Kandagatla 			SNDRV_PCM_RATE_48000)
382*af3d54b9SSrinivas Kandagatla #define RX_MACRO_ECHO_FORMATS (SNDRV_PCM_FMTBIT_S16_LE |\
383*af3d54b9SSrinivas Kandagatla 		SNDRV_PCM_FMTBIT_S24_LE |\
384*af3d54b9SSrinivas Kandagatla 		SNDRV_PCM_FMTBIT_S24_3LE)
385*af3d54b9SSrinivas Kandagatla 
386*af3d54b9SSrinivas Kandagatla #define RX_MACRO_MAX_DMA_CH_PER_PORT 2
387*af3d54b9SSrinivas Kandagatla 
388*af3d54b9SSrinivas Kandagatla #define RX_MACRO_EC_MIX_TX0_MASK 0xf0
389*af3d54b9SSrinivas Kandagatla #define RX_MACRO_EC_MIX_TX1_MASK 0x0f
390*af3d54b9SSrinivas Kandagatla #define RX_MACRO_EC_MIX_TX2_MASK 0x0f
391*af3d54b9SSrinivas Kandagatla 
392*af3d54b9SSrinivas Kandagatla #define COMP_MAX_COEFF 25
393*af3d54b9SSrinivas Kandagatla #define RX_NUM_CLKS_MAX	5
394*af3d54b9SSrinivas Kandagatla 
395*af3d54b9SSrinivas Kandagatla struct comp_coeff_val {
396*af3d54b9SSrinivas Kandagatla 	u8 lsb;
397*af3d54b9SSrinivas Kandagatla 	u8 msb;
398*af3d54b9SSrinivas Kandagatla };
399*af3d54b9SSrinivas Kandagatla 
400*af3d54b9SSrinivas Kandagatla enum {
401*af3d54b9SSrinivas Kandagatla 	HPH_ULP,
402*af3d54b9SSrinivas Kandagatla 	HPH_LOHIFI,
403*af3d54b9SSrinivas Kandagatla 	HPH_MODE_MAX,
404*af3d54b9SSrinivas Kandagatla };
405*af3d54b9SSrinivas Kandagatla 
406*af3d54b9SSrinivas Kandagatla static const struct comp_coeff_val comp_coeff_table[HPH_MODE_MAX][COMP_MAX_COEFF] = {
407*af3d54b9SSrinivas Kandagatla 	{
408*af3d54b9SSrinivas Kandagatla 		{0x40, 0x00},
409*af3d54b9SSrinivas Kandagatla 		{0x4C, 0x00},
410*af3d54b9SSrinivas Kandagatla 		{0x5A, 0x00},
411*af3d54b9SSrinivas Kandagatla 		{0x6B, 0x00},
412*af3d54b9SSrinivas Kandagatla 		{0x7F, 0x00},
413*af3d54b9SSrinivas Kandagatla 		{0x97, 0x00},
414*af3d54b9SSrinivas Kandagatla 		{0xB3, 0x00},
415*af3d54b9SSrinivas Kandagatla 		{0xD5, 0x00},
416*af3d54b9SSrinivas Kandagatla 		{0xFD, 0x00},
417*af3d54b9SSrinivas Kandagatla 		{0x2D, 0x01},
418*af3d54b9SSrinivas Kandagatla 		{0x66, 0x01},
419*af3d54b9SSrinivas Kandagatla 		{0xA7, 0x01},
420*af3d54b9SSrinivas Kandagatla 		{0xF8, 0x01},
421*af3d54b9SSrinivas Kandagatla 		{0x57, 0x02},
422*af3d54b9SSrinivas Kandagatla 		{0xC7, 0x02},
423*af3d54b9SSrinivas Kandagatla 		{0x4B, 0x03},
424*af3d54b9SSrinivas Kandagatla 		{0xE9, 0x03},
425*af3d54b9SSrinivas Kandagatla 		{0xA3, 0x04},
426*af3d54b9SSrinivas Kandagatla 		{0x7D, 0x05},
427*af3d54b9SSrinivas Kandagatla 		{0x90, 0x06},
428*af3d54b9SSrinivas Kandagatla 		{0xD1, 0x07},
429*af3d54b9SSrinivas Kandagatla 		{0x49, 0x09},
430*af3d54b9SSrinivas Kandagatla 		{0x00, 0x0B},
431*af3d54b9SSrinivas Kandagatla 		{0x01, 0x0D},
432*af3d54b9SSrinivas Kandagatla 		{0x59, 0x0F},
433*af3d54b9SSrinivas Kandagatla 	},
434*af3d54b9SSrinivas Kandagatla 	{
435*af3d54b9SSrinivas Kandagatla 		{0x40, 0x00},
436*af3d54b9SSrinivas Kandagatla 		{0x4C, 0x00},
437*af3d54b9SSrinivas Kandagatla 		{0x5A, 0x00},
438*af3d54b9SSrinivas Kandagatla 		{0x6B, 0x00},
439*af3d54b9SSrinivas Kandagatla 		{0x80, 0x00},
440*af3d54b9SSrinivas Kandagatla 		{0x98, 0x00},
441*af3d54b9SSrinivas Kandagatla 		{0xB4, 0x00},
442*af3d54b9SSrinivas Kandagatla 		{0xD5, 0x00},
443*af3d54b9SSrinivas Kandagatla 		{0xFE, 0x00},
444*af3d54b9SSrinivas Kandagatla 		{0x2E, 0x01},
445*af3d54b9SSrinivas Kandagatla 		{0x66, 0x01},
446*af3d54b9SSrinivas Kandagatla 		{0xA9, 0x01},
447*af3d54b9SSrinivas Kandagatla 		{0xF8, 0x01},
448*af3d54b9SSrinivas Kandagatla 		{0x56, 0x02},
449*af3d54b9SSrinivas Kandagatla 		{0xC4, 0x02},
450*af3d54b9SSrinivas Kandagatla 		{0x4F, 0x03},
451*af3d54b9SSrinivas Kandagatla 		{0xF0, 0x03},
452*af3d54b9SSrinivas Kandagatla 		{0xAE, 0x04},
453*af3d54b9SSrinivas Kandagatla 		{0x8B, 0x05},
454*af3d54b9SSrinivas Kandagatla 		{0x8E, 0x06},
455*af3d54b9SSrinivas Kandagatla 		{0xBC, 0x07},
456*af3d54b9SSrinivas Kandagatla 		{0x56, 0x09},
457*af3d54b9SSrinivas Kandagatla 		{0x0F, 0x0B},
458*af3d54b9SSrinivas Kandagatla 		{0x13, 0x0D},
459*af3d54b9SSrinivas Kandagatla 		{0x6F, 0x0F},
460*af3d54b9SSrinivas Kandagatla 	},
461*af3d54b9SSrinivas Kandagatla };
462*af3d54b9SSrinivas Kandagatla 
463*af3d54b9SSrinivas Kandagatla struct rx_macro_reg_mask_val {
464*af3d54b9SSrinivas Kandagatla 	u16 reg;
465*af3d54b9SSrinivas Kandagatla 	u8 mask;
466*af3d54b9SSrinivas Kandagatla 	u8 val;
467*af3d54b9SSrinivas Kandagatla };
468*af3d54b9SSrinivas Kandagatla 
469*af3d54b9SSrinivas Kandagatla enum {
470*af3d54b9SSrinivas Kandagatla 	INTERP_HPHL,
471*af3d54b9SSrinivas Kandagatla 	INTERP_HPHR,
472*af3d54b9SSrinivas Kandagatla 	INTERP_AUX,
473*af3d54b9SSrinivas Kandagatla 	INTERP_MAX
474*af3d54b9SSrinivas Kandagatla };
475*af3d54b9SSrinivas Kandagatla 
476*af3d54b9SSrinivas Kandagatla enum {
477*af3d54b9SSrinivas Kandagatla 	RX_MACRO_RX0,
478*af3d54b9SSrinivas Kandagatla 	RX_MACRO_RX1,
479*af3d54b9SSrinivas Kandagatla 	RX_MACRO_RX2,
480*af3d54b9SSrinivas Kandagatla 	RX_MACRO_RX3,
481*af3d54b9SSrinivas Kandagatla 	RX_MACRO_RX4,
482*af3d54b9SSrinivas Kandagatla 	RX_MACRO_RX5,
483*af3d54b9SSrinivas Kandagatla 	RX_MACRO_PORTS_MAX
484*af3d54b9SSrinivas Kandagatla };
485*af3d54b9SSrinivas Kandagatla 
486*af3d54b9SSrinivas Kandagatla enum {
487*af3d54b9SSrinivas Kandagatla 	RX_MACRO_COMP1, /* HPH_L */
488*af3d54b9SSrinivas Kandagatla 	RX_MACRO_COMP2, /* HPH_R */
489*af3d54b9SSrinivas Kandagatla 	RX_MACRO_COMP_MAX
490*af3d54b9SSrinivas Kandagatla };
491*af3d54b9SSrinivas Kandagatla 
492*af3d54b9SSrinivas Kandagatla enum {
493*af3d54b9SSrinivas Kandagatla 	RX_MACRO_EC0_MUX = 0,
494*af3d54b9SSrinivas Kandagatla 	RX_MACRO_EC1_MUX,
495*af3d54b9SSrinivas Kandagatla 	RX_MACRO_EC2_MUX,
496*af3d54b9SSrinivas Kandagatla 	RX_MACRO_EC_MUX_MAX,
497*af3d54b9SSrinivas Kandagatla };
498*af3d54b9SSrinivas Kandagatla 
499*af3d54b9SSrinivas Kandagatla enum {
500*af3d54b9SSrinivas Kandagatla 	INTn_1_INP_SEL_ZERO = 0,
501*af3d54b9SSrinivas Kandagatla 	INTn_1_INP_SEL_DEC0,
502*af3d54b9SSrinivas Kandagatla 	INTn_1_INP_SEL_DEC1,
503*af3d54b9SSrinivas Kandagatla 	INTn_1_INP_SEL_IIR0,
504*af3d54b9SSrinivas Kandagatla 	INTn_1_INP_SEL_IIR1,
505*af3d54b9SSrinivas Kandagatla 	INTn_1_INP_SEL_RX0,
506*af3d54b9SSrinivas Kandagatla 	INTn_1_INP_SEL_RX1,
507*af3d54b9SSrinivas Kandagatla 	INTn_1_INP_SEL_RX2,
508*af3d54b9SSrinivas Kandagatla 	INTn_1_INP_SEL_RX3,
509*af3d54b9SSrinivas Kandagatla 	INTn_1_INP_SEL_RX4,
510*af3d54b9SSrinivas Kandagatla 	INTn_1_INP_SEL_RX5,
511*af3d54b9SSrinivas Kandagatla };
512*af3d54b9SSrinivas Kandagatla 
513*af3d54b9SSrinivas Kandagatla enum {
514*af3d54b9SSrinivas Kandagatla 	INTn_2_INP_SEL_ZERO = 0,
515*af3d54b9SSrinivas Kandagatla 	INTn_2_INP_SEL_RX0,
516*af3d54b9SSrinivas Kandagatla 	INTn_2_INP_SEL_RX1,
517*af3d54b9SSrinivas Kandagatla 	INTn_2_INP_SEL_RX2,
518*af3d54b9SSrinivas Kandagatla 	INTn_2_INP_SEL_RX3,
519*af3d54b9SSrinivas Kandagatla 	INTn_2_INP_SEL_RX4,
520*af3d54b9SSrinivas Kandagatla 	INTn_2_INP_SEL_RX5,
521*af3d54b9SSrinivas Kandagatla };
522*af3d54b9SSrinivas Kandagatla 
523*af3d54b9SSrinivas Kandagatla enum {
524*af3d54b9SSrinivas Kandagatla 	INTERP_MAIN_PATH,
525*af3d54b9SSrinivas Kandagatla 	INTERP_MIX_PATH,
526*af3d54b9SSrinivas Kandagatla };
527*af3d54b9SSrinivas Kandagatla 
528*af3d54b9SSrinivas Kandagatla struct interp_sample_rate {
529*af3d54b9SSrinivas Kandagatla 	int sample_rate;
530*af3d54b9SSrinivas Kandagatla 	int rate_val;
531*af3d54b9SSrinivas Kandagatla };
532*af3d54b9SSrinivas Kandagatla 
533*af3d54b9SSrinivas Kandagatla static struct interp_sample_rate sr_val_tbl[] = {
534*af3d54b9SSrinivas Kandagatla 	{8000, 0x0}, {16000, 0x1}, {32000, 0x3}, {48000, 0x4}, {96000, 0x5},
535*af3d54b9SSrinivas Kandagatla 	{192000, 0x6}, {384000, 0x7}, {44100, 0x9}, {88200, 0xA},
536*af3d54b9SSrinivas Kandagatla 	{176400, 0xB}, {352800, 0xC},
537*af3d54b9SSrinivas Kandagatla };
538*af3d54b9SSrinivas Kandagatla 
539*af3d54b9SSrinivas Kandagatla enum {
540*af3d54b9SSrinivas Kandagatla 	RX_MACRO_AIF_INVALID = 0,
541*af3d54b9SSrinivas Kandagatla 	RX_MACRO_AIF1_PB,
542*af3d54b9SSrinivas Kandagatla 	RX_MACRO_AIF2_PB,
543*af3d54b9SSrinivas Kandagatla 	RX_MACRO_AIF3_PB,
544*af3d54b9SSrinivas Kandagatla 	RX_MACRO_AIF4_PB,
545*af3d54b9SSrinivas Kandagatla 	RX_MACRO_AIF_ECHO,
546*af3d54b9SSrinivas Kandagatla 	RX_MACRO_MAX_DAIS,
547*af3d54b9SSrinivas Kandagatla };
548*af3d54b9SSrinivas Kandagatla 
549*af3d54b9SSrinivas Kandagatla enum {
550*af3d54b9SSrinivas Kandagatla 	RX_MACRO_AIF1_CAP = 0,
551*af3d54b9SSrinivas Kandagatla 	RX_MACRO_AIF2_CAP,
552*af3d54b9SSrinivas Kandagatla 	RX_MACRO_AIF3_CAP,
553*af3d54b9SSrinivas Kandagatla 	RX_MACRO_MAX_AIF_CAP_DAIS
554*af3d54b9SSrinivas Kandagatla };
555*af3d54b9SSrinivas Kandagatla 
556*af3d54b9SSrinivas Kandagatla struct rx_macro {
557*af3d54b9SSrinivas Kandagatla 	struct device *dev;
558*af3d54b9SSrinivas Kandagatla 	int comp_enabled[RX_MACRO_COMP_MAX];
559*af3d54b9SSrinivas Kandagatla 	/* Main path clock users count */
560*af3d54b9SSrinivas Kandagatla 	int main_clk_users[INTERP_MAX];
561*af3d54b9SSrinivas Kandagatla 	int rx_port_value[RX_MACRO_PORTS_MAX];
562*af3d54b9SSrinivas Kandagatla 	u16 prim_int_users[INTERP_MAX];
563*af3d54b9SSrinivas Kandagatla 	int rx_mclk_users;
564*af3d54b9SSrinivas Kandagatla 	bool reset_swr;
565*af3d54b9SSrinivas Kandagatla 	int clsh_users;
566*af3d54b9SSrinivas Kandagatla 	int rx_mclk_cnt;
567*af3d54b9SSrinivas Kandagatla 	bool is_ear_mode_on;
568*af3d54b9SSrinivas Kandagatla 	bool hph_pwr_mode;
569*af3d54b9SSrinivas Kandagatla 	bool hph_hd2_mode;
570*af3d54b9SSrinivas Kandagatla 	struct snd_soc_component *component;
571*af3d54b9SSrinivas Kandagatla 	unsigned long active_ch_mask[RX_MACRO_MAX_DAIS];
572*af3d54b9SSrinivas Kandagatla 	unsigned long active_ch_cnt[RX_MACRO_MAX_DAIS];
573*af3d54b9SSrinivas Kandagatla 	u16 bit_width[RX_MACRO_MAX_DAIS];
574*af3d54b9SSrinivas Kandagatla 	int is_softclip_on;
575*af3d54b9SSrinivas Kandagatla 	int is_aux_hpf_on;
576*af3d54b9SSrinivas Kandagatla 	int softclip_clk_users;
577*af3d54b9SSrinivas Kandagatla 
578*af3d54b9SSrinivas Kandagatla 	struct regmap *regmap;
579*af3d54b9SSrinivas Kandagatla 	struct clk_bulk_data clks[RX_NUM_CLKS_MAX];
580*af3d54b9SSrinivas Kandagatla 	struct clk_hw hw;
581*af3d54b9SSrinivas Kandagatla };
582*af3d54b9SSrinivas Kandagatla #define to_rx_macro(_hw) container_of(_hw, struct rx_macro, hw)
583*af3d54b9SSrinivas Kandagatla 
584*af3d54b9SSrinivas Kandagatla static const DECLARE_TLV_DB_SCALE(digital_gain, -8400, 100, -8400);
585*af3d54b9SSrinivas Kandagatla 
586*af3d54b9SSrinivas Kandagatla static const char *const rx_macro_hph_pwr_mode_text[] = {
587*af3d54b9SSrinivas Kandagatla 	"ULP", "LOHIFI"
588*af3d54b9SSrinivas Kandagatla };
589*af3d54b9SSrinivas Kandagatla 
590*af3d54b9SSrinivas Kandagatla static const struct soc_enum rx_macro_hph_pwr_mode_enum =
591*af3d54b9SSrinivas Kandagatla 		SOC_ENUM_SINGLE_EXT(2, rx_macro_hph_pwr_mode_text);
592*af3d54b9SSrinivas Kandagatla 
593*af3d54b9SSrinivas Kandagatla static const struct reg_default rx_defaults[] = {
594*af3d54b9SSrinivas Kandagatla 	/* RX Macro */
595*af3d54b9SSrinivas Kandagatla 	{ CDC_RX_TOP_TOP_CFG0, 0x00 },
596*af3d54b9SSrinivas Kandagatla 	{ CDC_RX_TOP_SWR_CTRL, 0x00 },
597*af3d54b9SSrinivas Kandagatla 	{ CDC_RX_TOP_DEBUG, 0x00 },
598*af3d54b9SSrinivas Kandagatla 	{ CDC_RX_TOP_DEBUG_BUS, 0x00 },
599*af3d54b9SSrinivas Kandagatla 	{ CDC_RX_TOP_DEBUG_EN0, 0x00 },
600*af3d54b9SSrinivas Kandagatla 	{ CDC_RX_TOP_DEBUG_EN1, 0x00 },
601*af3d54b9SSrinivas Kandagatla 	{ CDC_RX_TOP_DEBUG_EN2, 0x00 },
602*af3d54b9SSrinivas Kandagatla 	{ CDC_RX_TOP_HPHL_COMP_WR_LSB, 0x00 },
603*af3d54b9SSrinivas Kandagatla 	{ CDC_RX_TOP_HPHL_COMP_WR_MSB, 0x00 },
604*af3d54b9SSrinivas Kandagatla 	{ CDC_RX_TOP_HPHL_COMP_LUT, 0x00 },
605*af3d54b9SSrinivas Kandagatla 	{ CDC_RX_TOP_HPHL_COMP_RD_LSB, 0x00 },
606*af3d54b9SSrinivas Kandagatla 	{ CDC_RX_TOP_HPHL_COMP_RD_MSB, 0x00 },
607*af3d54b9SSrinivas Kandagatla 	{ CDC_RX_TOP_HPHR_COMP_WR_LSB, 0x00 },
608*af3d54b9SSrinivas Kandagatla 	{ CDC_RX_TOP_HPHR_COMP_WR_MSB, 0x00 },
609*af3d54b9SSrinivas Kandagatla 	{ CDC_RX_TOP_HPHR_COMP_LUT, 0x00 },
610*af3d54b9SSrinivas Kandagatla 	{ CDC_RX_TOP_HPHR_COMP_RD_LSB, 0x00 },
611*af3d54b9SSrinivas Kandagatla 	{ CDC_RX_TOP_HPHR_COMP_RD_MSB, 0x00 },
612*af3d54b9SSrinivas Kandagatla 	{ CDC_RX_TOP_DSD0_DEBUG_CFG0, 0x11 },
613*af3d54b9SSrinivas Kandagatla 	{ CDC_RX_TOP_DSD0_DEBUG_CFG1, 0x20 },
614*af3d54b9SSrinivas Kandagatla 	{ CDC_RX_TOP_DSD0_DEBUG_CFG2, 0x00 },
615*af3d54b9SSrinivas Kandagatla 	{ CDC_RX_TOP_DSD0_DEBUG_CFG3, 0x00 },
616*af3d54b9SSrinivas Kandagatla 	{ CDC_RX_TOP_DSD1_DEBUG_CFG0, 0x11 },
617*af3d54b9SSrinivas Kandagatla 	{ CDC_RX_TOP_DSD1_DEBUG_CFG1, 0x20 },
618*af3d54b9SSrinivas Kandagatla 	{ CDC_RX_TOP_DSD1_DEBUG_CFG2, 0x00 },
619*af3d54b9SSrinivas Kandagatla 	{ CDC_RX_TOP_DSD1_DEBUG_CFG3, 0x00 },
620*af3d54b9SSrinivas Kandagatla 	{ CDC_RX_TOP_RX_I2S_CTL, 0x0C },
621*af3d54b9SSrinivas Kandagatla 	{ CDC_RX_TOP_TX_I2S2_CTL, 0x0C },
622*af3d54b9SSrinivas Kandagatla 	{ CDC_RX_TOP_I2S_CLK, 0x0C },
623*af3d54b9SSrinivas Kandagatla 	{ CDC_RX_TOP_I2S_RESET, 0x00 },
624*af3d54b9SSrinivas Kandagatla 	{ CDC_RX_TOP_I2S_MUX, 0x00 },
625*af3d54b9SSrinivas Kandagatla 	{ CDC_RX_CLK_RST_CTRL_MCLK_CONTROL, 0x00 },
626*af3d54b9SSrinivas Kandagatla 	{ CDC_RX_CLK_RST_CTRL_FS_CNT_CONTROL, 0x00 },
627*af3d54b9SSrinivas Kandagatla 	{ CDC_RX_CLK_RST_CTRL_SWR_CONTROL, 0x00 },
628*af3d54b9SSrinivas Kandagatla 	{ CDC_RX_CLK_RST_CTRL_DSD_CONTROL, 0x00 },
629*af3d54b9SSrinivas Kandagatla 	{ CDC_RX_CLK_RST_CTRL_ASRC_SHARE_CONTROL, 0x08 },
630*af3d54b9SSrinivas Kandagatla 	{ CDC_RX_SOFTCLIP_CRC, 0x00 },
631*af3d54b9SSrinivas Kandagatla 	{ CDC_RX_SOFTCLIP_SOFTCLIP_CTRL, 0x38 },
632*af3d54b9SSrinivas Kandagatla 	{ CDC_RX_INP_MUX_RX_INT0_CFG0, 0x00 },
633*af3d54b9SSrinivas Kandagatla 	{ CDC_RX_INP_MUX_RX_INT0_CFG1, 0x00 },
634*af3d54b9SSrinivas Kandagatla 	{ CDC_RX_INP_MUX_RX_INT1_CFG0, 0x00 },
635*af3d54b9SSrinivas Kandagatla 	{ CDC_RX_INP_MUX_RX_INT1_CFG1, 0x00 },
636*af3d54b9SSrinivas Kandagatla 	{ CDC_RX_INP_MUX_RX_INT2_CFG0, 0x00 },
637*af3d54b9SSrinivas Kandagatla 	{ CDC_RX_INP_MUX_RX_INT2_CFG1, 0x00 },
638*af3d54b9SSrinivas Kandagatla 	{ CDC_RX_INP_MUX_RX_MIX_CFG4, 0x00 },
639*af3d54b9SSrinivas Kandagatla 	{ CDC_RX_INP_MUX_RX_MIX_CFG5, 0x00 },
640*af3d54b9SSrinivas Kandagatla 	{ CDC_RX_INP_MUX_SIDETONE_SRC_CFG0, 0x00 },
641*af3d54b9SSrinivas Kandagatla 	{ CDC_RX_CLSH_CRC, 0x00 },
642*af3d54b9SSrinivas Kandagatla 	{ CDC_RX_CLSH_DLY_CTRL, 0x03 },
643*af3d54b9SSrinivas Kandagatla 	{ CDC_RX_CLSH_DECAY_CTRL, 0x02 },
644*af3d54b9SSrinivas Kandagatla 	{ CDC_RX_CLSH_HPH_V_PA, 0x1C },
645*af3d54b9SSrinivas Kandagatla 	{ CDC_RX_CLSH_EAR_V_PA, 0x39 },
646*af3d54b9SSrinivas Kandagatla 	{ CDC_RX_CLSH_HPH_V_HD, 0x0C },
647*af3d54b9SSrinivas Kandagatla 	{ CDC_RX_CLSH_EAR_V_HD, 0x0C },
648*af3d54b9SSrinivas Kandagatla 	{ CDC_RX_CLSH_K1_MSB, 0x01 },
649*af3d54b9SSrinivas Kandagatla 	{ CDC_RX_CLSH_K1_LSB, 0x00 },
650*af3d54b9SSrinivas Kandagatla 	{ CDC_RX_CLSH_K2_MSB, 0x00 },
651*af3d54b9SSrinivas Kandagatla 	{ CDC_RX_CLSH_K2_LSB, 0x80 },
652*af3d54b9SSrinivas Kandagatla 	{ CDC_RX_CLSH_IDLE_CTRL, 0x00 },
653*af3d54b9SSrinivas Kandagatla 	{ CDC_RX_CLSH_IDLE_HPH, 0x00 },
654*af3d54b9SSrinivas Kandagatla 	{ CDC_RX_CLSH_IDLE_EAR, 0x00 },
655*af3d54b9SSrinivas Kandagatla 	{ CDC_RX_CLSH_TEST0, 0x07 },
656*af3d54b9SSrinivas Kandagatla 	{ CDC_RX_CLSH_TEST1, 0x00 },
657*af3d54b9SSrinivas Kandagatla 	{ CDC_RX_CLSH_OVR_VREF, 0x00 },
658*af3d54b9SSrinivas Kandagatla 	{ CDC_RX_CLSH_CLSG_CTL, 0x02 },
659*af3d54b9SSrinivas Kandagatla 	{ CDC_RX_CLSH_CLSG_CFG1, 0x9A },
660*af3d54b9SSrinivas Kandagatla 	{ CDC_RX_CLSH_CLSG_CFG2, 0x10 },
661*af3d54b9SSrinivas Kandagatla 	{ CDC_RX_BCL_VBAT_PATH_CTL, 0x00 },
662*af3d54b9SSrinivas Kandagatla 	{ CDC_RX_BCL_VBAT_CFG, 0x10 },
663*af3d54b9SSrinivas Kandagatla 	{ CDC_RX_BCL_VBAT_ADC_CAL1, 0x00 },
664*af3d54b9SSrinivas Kandagatla 	{ CDC_RX_BCL_VBAT_ADC_CAL2, 0x00 },
665*af3d54b9SSrinivas Kandagatla 	{ CDC_RX_BCL_VBAT_ADC_CAL3, 0x04 },
666*af3d54b9SSrinivas Kandagatla 	{ CDC_RX_BCL_VBAT_PK_EST1, 0xE0 },
667*af3d54b9SSrinivas Kandagatla 	{ CDC_RX_BCL_VBAT_PK_EST2, 0x01 },
668*af3d54b9SSrinivas Kandagatla 	{ CDC_RX_BCL_VBAT_PK_EST3, 0x40 },
669*af3d54b9SSrinivas Kandagatla 	{ CDC_RX_BCL_VBAT_RF_PROC1, 0x2A },
670*af3d54b9SSrinivas Kandagatla 	{ CDC_RX_BCL_VBAT_RF_PROC1, 0x00 },
671*af3d54b9SSrinivas Kandagatla 	{ CDC_RX_BCL_VBAT_TAC1, 0x00 },
672*af3d54b9SSrinivas Kandagatla 	{ CDC_RX_BCL_VBAT_TAC2, 0x18 },
673*af3d54b9SSrinivas Kandagatla 	{ CDC_RX_BCL_VBAT_TAC3, 0x18 },
674*af3d54b9SSrinivas Kandagatla 	{ CDC_RX_BCL_VBAT_TAC4, 0x03 },
675*af3d54b9SSrinivas Kandagatla 	{ CDC_RX_BCL_VBAT_GAIN_UPD1, 0x01 },
676*af3d54b9SSrinivas Kandagatla 	{ CDC_RX_BCL_VBAT_GAIN_UPD2, 0x00 },
677*af3d54b9SSrinivas Kandagatla 	{ CDC_RX_BCL_VBAT_GAIN_UPD3, 0x00 },
678*af3d54b9SSrinivas Kandagatla 	{ CDC_RX_BCL_VBAT_GAIN_UPD4, 0x64 },
679*af3d54b9SSrinivas Kandagatla 	{ CDC_RX_BCL_VBAT_GAIN_UPD5, 0x01 },
680*af3d54b9SSrinivas Kandagatla 	{ CDC_RX_BCL_VBAT_DEBUG1, 0x00 },
681*af3d54b9SSrinivas Kandagatla 	{ CDC_RX_BCL_VBAT_GAIN_UPD_MON, 0x00 },
682*af3d54b9SSrinivas Kandagatla 	{ CDC_RX_BCL_VBAT_GAIN_MON_VAL, 0x00 },
683*af3d54b9SSrinivas Kandagatla 	{ CDC_RX_BCL_VBAT_BAN, 0x0C },
684*af3d54b9SSrinivas Kandagatla 	{ CDC_RX_BCL_VBAT_BCL_GAIN_UPD1, 0x00 },
685*af3d54b9SSrinivas Kandagatla 	{ CDC_RX_BCL_VBAT_BCL_GAIN_UPD2, 0x77 },
686*af3d54b9SSrinivas Kandagatla 	{ CDC_RX_BCL_VBAT_BCL_GAIN_UPD3, 0x01 },
687*af3d54b9SSrinivas Kandagatla 	{ CDC_RX_BCL_VBAT_BCL_GAIN_UPD4, 0x00 },
688*af3d54b9SSrinivas Kandagatla 	{ CDC_RX_BCL_VBAT_BCL_GAIN_UPD5, 0x4B },
689*af3d54b9SSrinivas Kandagatla 	{ CDC_RX_BCL_VBAT_BCL_GAIN_UPD6, 0x00 },
690*af3d54b9SSrinivas Kandagatla 	{ CDC_RX_BCL_VBAT_BCL_GAIN_UPD7, 0x01 },
691*af3d54b9SSrinivas Kandagatla 	{ CDC_RX_BCL_VBAT_BCL_GAIN_UPD8, 0x00 },
692*af3d54b9SSrinivas Kandagatla 	{ CDC_RX_BCL_VBAT_BCL_GAIN_UPD9, 0x00 },
693*af3d54b9SSrinivas Kandagatla 	{ CDC_RX_BCL_VBAT_ATTN1, 0x04 },
694*af3d54b9SSrinivas Kandagatla 	{ CDC_RX_BCL_VBAT_ATTN2, 0x08 },
695*af3d54b9SSrinivas Kandagatla 	{ CDC_RX_BCL_VBAT_ATTN3, 0x0C },
696*af3d54b9SSrinivas Kandagatla 	{ CDC_RX_BCL_VBAT_DECODE_CTL1, 0xE0 },
697*af3d54b9SSrinivas Kandagatla 	{ CDC_RX_BCL_VBAT_DECODE_CTL2, 0x00 },
698*af3d54b9SSrinivas Kandagatla 	{ CDC_RX_BCL_VBAT_DECODE_CFG1, 0x00 },
699*af3d54b9SSrinivas Kandagatla 	{ CDC_RX_BCL_VBAT_DECODE_CFG2, 0x00 },
700*af3d54b9SSrinivas Kandagatla 	{ CDC_RX_BCL_VBAT_DECODE_CFG3, 0x00 },
701*af3d54b9SSrinivas Kandagatla 	{ CDC_RX_BCL_VBAT_DECODE_CFG4, 0x00 },
702*af3d54b9SSrinivas Kandagatla 	{ CDC_RX_BCL_VBAT_DECODE_ST, 0x00 },
703*af3d54b9SSrinivas Kandagatla 	{ CDC_RX_INTR_CTRL_CFG, 0x00 },
704*af3d54b9SSrinivas Kandagatla 	{ CDC_RX_INTR_CTRL_CLR_COMMIT, 0x00 },
705*af3d54b9SSrinivas Kandagatla 	{ CDC_RX_INTR_CTRL_PIN1_MASK0, 0xFF },
706*af3d54b9SSrinivas Kandagatla 	{ CDC_RX_INTR_CTRL_PIN1_STATUS0, 0x00 },
707*af3d54b9SSrinivas Kandagatla 	{ CDC_RX_INTR_CTRL_PIN1_CLEAR0, 0x00 },
708*af3d54b9SSrinivas Kandagatla 	{ CDC_RX_INTR_CTRL_PIN2_MASK0, 0xFF },
709*af3d54b9SSrinivas Kandagatla 	{ CDC_RX_INTR_CTRL_PIN2_STATUS0, 0x00 },
710*af3d54b9SSrinivas Kandagatla 	{ CDC_RX_INTR_CTRL_PIN2_CLEAR0, 0x00 },
711*af3d54b9SSrinivas Kandagatla 	{ CDC_RX_INTR_CTRL_LEVEL0, 0x00 },
712*af3d54b9SSrinivas Kandagatla 	{ CDC_RX_INTR_CTRL_BYPASS0, 0x00 },
713*af3d54b9SSrinivas Kandagatla 	{ CDC_RX_INTR_CTRL_SET0, 0x00 },
714*af3d54b9SSrinivas Kandagatla 	{ CDC_RX_RX0_RX_PATH_CTL, 0x04 },
715*af3d54b9SSrinivas Kandagatla 	{ CDC_RX_RX0_RX_PATH_CFG0, 0x00 },
716*af3d54b9SSrinivas Kandagatla 	{ CDC_RX_RX0_RX_PATH_CFG1, 0x64 },
717*af3d54b9SSrinivas Kandagatla 	{ CDC_RX_RX0_RX_PATH_CFG2, 0x8F },
718*af3d54b9SSrinivas Kandagatla 	{ CDC_RX_RX0_RX_PATH_CFG3, 0x00 },
719*af3d54b9SSrinivas Kandagatla 	{ CDC_RX_RX0_RX_VOL_CTL, 0x00 },
720*af3d54b9SSrinivas Kandagatla 	{ CDC_RX_RX0_RX_PATH_MIX_CTL, 0x04 },
721*af3d54b9SSrinivas Kandagatla 	{ CDC_RX_RX0_RX_PATH_MIX_CFG, 0x7E },
722*af3d54b9SSrinivas Kandagatla 	{ CDC_RX_RX0_RX_VOL_MIX_CTL, 0x00 },
723*af3d54b9SSrinivas Kandagatla 	{ CDC_RX_RX0_RX_PATH_SEC1, 0x08 },
724*af3d54b9SSrinivas Kandagatla 	{ CDC_RX_RX0_RX_PATH_SEC2, 0x00 },
725*af3d54b9SSrinivas Kandagatla 	{ CDC_RX_RX0_RX_PATH_SEC3, 0x00 },
726*af3d54b9SSrinivas Kandagatla 	{ CDC_RX_RX0_RX_PATH_SEC4, 0x00 },
727*af3d54b9SSrinivas Kandagatla 	{ CDC_RX_RX0_RX_PATH_SEC7, 0x00 },
728*af3d54b9SSrinivas Kandagatla 	{ CDC_RX_RX0_RX_PATH_MIX_SEC0, 0x08 },
729*af3d54b9SSrinivas Kandagatla 	{ CDC_RX_RX0_RX_PATH_MIX_SEC1, 0x00 },
730*af3d54b9SSrinivas Kandagatla 	{ CDC_RX_RX0_RX_PATH_DSM_CTL, 0x08 },
731*af3d54b9SSrinivas Kandagatla 	{ CDC_RX_RX0_RX_PATH_DSM_DATA1, 0x00 },
732*af3d54b9SSrinivas Kandagatla 	{ CDC_RX_RX0_RX_PATH_DSM_DATA2, 0x00 },
733*af3d54b9SSrinivas Kandagatla 	{ CDC_RX_RX0_RX_PATH_DSM_DATA3, 0x00 },
734*af3d54b9SSrinivas Kandagatla 	{ CDC_RX_RX0_RX_PATH_DSM_DATA4, 0x55 },
735*af3d54b9SSrinivas Kandagatla 	{ CDC_RX_RX0_RX_PATH_DSM_DATA5, 0x55 },
736*af3d54b9SSrinivas Kandagatla 	{ CDC_RX_RX0_RX_PATH_DSM_DATA6, 0x55 },
737*af3d54b9SSrinivas Kandagatla 	{ CDC_RX_RX1_RX_PATH_CTL, 0x04 },
738*af3d54b9SSrinivas Kandagatla 	{ CDC_RX_RX1_RX_PATH_CFG0, 0x00 },
739*af3d54b9SSrinivas Kandagatla 	{ CDC_RX_RX1_RX_PATH_CFG1, 0x64 },
740*af3d54b9SSrinivas Kandagatla 	{ CDC_RX_RX1_RX_PATH_CFG2, 0x8F },
741*af3d54b9SSrinivas Kandagatla 	{ CDC_RX_RX1_RX_PATH_CFG3, 0x00 },
742*af3d54b9SSrinivas Kandagatla 	{ CDC_RX_RX1_RX_VOL_CTL, 0x00 },
743*af3d54b9SSrinivas Kandagatla 	{ CDC_RX_RX1_RX_PATH_MIX_CTL, 0x04 },
744*af3d54b9SSrinivas Kandagatla 	{ CDC_RX_RX1_RX_PATH_MIX_CFG, 0x7E },
745*af3d54b9SSrinivas Kandagatla 	{ CDC_RX_RX1_RX_VOL_MIX_CTL, 0x00 },
746*af3d54b9SSrinivas Kandagatla 	{ CDC_RX_RX1_RX_PATH_SEC1, 0x08 },
747*af3d54b9SSrinivas Kandagatla 	{ CDC_RX_RX1_RX_PATH_SEC2, 0x00 },
748*af3d54b9SSrinivas Kandagatla 	{ CDC_RX_RX1_RX_PATH_SEC3, 0x00 },
749*af3d54b9SSrinivas Kandagatla 	{ CDC_RX_RX1_RX_PATH_SEC4, 0x00 },
750*af3d54b9SSrinivas Kandagatla 	{ CDC_RX_RX1_RX_PATH_SEC7, 0x00 },
751*af3d54b9SSrinivas Kandagatla 	{ CDC_RX_RX1_RX_PATH_MIX_SEC0, 0x08 },
752*af3d54b9SSrinivas Kandagatla 	{ CDC_RX_RX1_RX_PATH_MIX_SEC1, 0x00 },
753*af3d54b9SSrinivas Kandagatla 	{ CDC_RX_RX1_RX_PATH_DSM_CTL, 0x08 },
754*af3d54b9SSrinivas Kandagatla 	{ CDC_RX_RX1_RX_PATH_DSM_DATA1, 0x00 },
755*af3d54b9SSrinivas Kandagatla 	{ CDC_RX_RX1_RX_PATH_DSM_DATA2, 0x00 },
756*af3d54b9SSrinivas Kandagatla 	{ CDC_RX_RX1_RX_PATH_DSM_DATA3, 0x00 },
757*af3d54b9SSrinivas Kandagatla 	{ CDC_RX_RX1_RX_PATH_DSM_DATA4, 0x55 },
758*af3d54b9SSrinivas Kandagatla 	{ CDC_RX_RX1_RX_PATH_DSM_DATA5, 0x55 },
759*af3d54b9SSrinivas Kandagatla 	{ CDC_RX_RX1_RX_PATH_DSM_DATA6, 0x55 },
760*af3d54b9SSrinivas Kandagatla 	{ CDC_RX_RX2_RX_PATH_CTL, 0x04 },
761*af3d54b9SSrinivas Kandagatla 	{ CDC_RX_RX2_RX_PATH_CFG0, 0x00 },
762*af3d54b9SSrinivas Kandagatla 	{ CDC_RX_RX2_RX_PATH_CFG1, 0x64 },
763*af3d54b9SSrinivas Kandagatla 	{ CDC_RX_RX2_RX_PATH_CFG2, 0x8F },
764*af3d54b9SSrinivas Kandagatla 	{ CDC_RX_RX2_RX_PATH_CFG3, 0x00 },
765*af3d54b9SSrinivas Kandagatla 	{ CDC_RX_RX2_RX_VOL_CTL, 0x00 },
766*af3d54b9SSrinivas Kandagatla 	{ CDC_RX_RX2_RX_PATH_MIX_CTL, 0x04 },
767*af3d54b9SSrinivas Kandagatla 	{ CDC_RX_RX2_RX_PATH_MIX_CFG, 0x7E },
768*af3d54b9SSrinivas Kandagatla 	{ CDC_RX_RX2_RX_VOL_MIX_CTL, 0x00 },
769*af3d54b9SSrinivas Kandagatla 	{ CDC_RX_RX2_RX_PATH_SEC0, 0x04 },
770*af3d54b9SSrinivas Kandagatla 	{ CDC_RX_RX2_RX_PATH_SEC1, 0x08 },
771*af3d54b9SSrinivas Kandagatla 	{ CDC_RX_RX2_RX_PATH_SEC2, 0x00 },
772*af3d54b9SSrinivas Kandagatla 	{ CDC_RX_RX2_RX_PATH_SEC3, 0x00 },
773*af3d54b9SSrinivas Kandagatla 	{ CDC_RX_RX2_RX_PATH_SEC4, 0x00 },
774*af3d54b9SSrinivas Kandagatla 	{ CDC_RX_RX2_RX_PATH_SEC5, 0x00 },
775*af3d54b9SSrinivas Kandagatla 	{ CDC_RX_RX2_RX_PATH_SEC6, 0x00 },
776*af3d54b9SSrinivas Kandagatla 	{ CDC_RX_RX2_RX_PATH_SEC7, 0x00 },
777*af3d54b9SSrinivas Kandagatla 	{ CDC_RX_RX2_RX_PATH_MIX_SEC0, 0x08 },
778*af3d54b9SSrinivas Kandagatla 	{ CDC_RX_RX2_RX_PATH_MIX_SEC1, 0x00 },
779*af3d54b9SSrinivas Kandagatla 	{ CDC_RX_RX2_RX_PATH_DSM_CTL, 0x00 },
780*af3d54b9SSrinivas Kandagatla 	{ CDC_RX_IDLE_DETECT_PATH_CTL, 0x00 },
781*af3d54b9SSrinivas Kandagatla 	{ CDC_RX_IDLE_DETECT_CFG0, 0x07 },
782*af3d54b9SSrinivas Kandagatla 	{ CDC_RX_IDLE_DETECT_CFG1, 0x3C },
783*af3d54b9SSrinivas Kandagatla 	{ CDC_RX_IDLE_DETECT_CFG2, 0x00 },
784*af3d54b9SSrinivas Kandagatla 	{ CDC_RX_IDLE_DETECT_CFG3, 0x00 },
785*af3d54b9SSrinivas Kandagatla 	{ CDC_RX_COMPANDER0_CTL0, 0x60 },
786*af3d54b9SSrinivas Kandagatla 	{ CDC_RX_COMPANDER0_CTL1, 0xDB },
787*af3d54b9SSrinivas Kandagatla 	{ CDC_RX_COMPANDER0_CTL2, 0xFF },
788*af3d54b9SSrinivas Kandagatla 	{ CDC_RX_COMPANDER0_CTL3, 0x35 },
789*af3d54b9SSrinivas Kandagatla 	{ CDC_RX_COMPANDER0_CTL4, 0xFF },
790*af3d54b9SSrinivas Kandagatla 	{ CDC_RX_COMPANDER0_CTL5, 0x00 },
791*af3d54b9SSrinivas Kandagatla 	{ CDC_RX_COMPANDER0_CTL6, 0x01 },
792*af3d54b9SSrinivas Kandagatla 	{ CDC_RX_COMPANDER0_CTL7, 0x28 },
793*af3d54b9SSrinivas Kandagatla 	{ CDC_RX_COMPANDER1_CTL0, 0x60 },
794*af3d54b9SSrinivas Kandagatla 	{ CDC_RX_COMPANDER1_CTL1, 0xDB },
795*af3d54b9SSrinivas Kandagatla 	{ CDC_RX_COMPANDER1_CTL2, 0xFF },
796*af3d54b9SSrinivas Kandagatla 	{ CDC_RX_COMPANDER1_CTL3, 0x35 },
797*af3d54b9SSrinivas Kandagatla 	{ CDC_RX_COMPANDER1_CTL4, 0xFF },
798*af3d54b9SSrinivas Kandagatla 	{ CDC_RX_COMPANDER1_CTL5, 0x00 },
799*af3d54b9SSrinivas Kandagatla 	{ CDC_RX_COMPANDER1_CTL6, 0x01 },
800*af3d54b9SSrinivas Kandagatla 	{ CDC_RX_COMPANDER1_CTL7, 0x28 },
801*af3d54b9SSrinivas Kandagatla 	{ CDC_RX_SIDETONE_IIR0_IIR_PATH_CTL, 0x00 },
802*af3d54b9SSrinivas Kandagatla 	{ CDC_RX_SIDETONE_IIR0_IIR_GAIN_B1_CTL, 0x00 },
803*af3d54b9SSrinivas Kandagatla 	{ CDC_RX_SIDETONE_IIR0_IIR_GAIN_B2_CTL, 0x00 },
804*af3d54b9SSrinivas Kandagatla 	{ CDC_RX_SIDETONE_IIR0_IIR_GAIN_B3_CTL, 0x00 },
805*af3d54b9SSrinivas Kandagatla 	{ CDC_RX_SIDETONE_IIR0_IIR_GAIN_B4_CTL, 0x00 },
806*af3d54b9SSrinivas Kandagatla 	{ CDC_RX_SIDETONE_IIR0_IIR_GAIN_B5_CTL, 0x00 },
807*af3d54b9SSrinivas Kandagatla 	{ CDC_RX_SIDETONE_IIR0_IIR_GAIN_B6_CTL, 0x00 },
808*af3d54b9SSrinivas Kandagatla 	{ CDC_RX_SIDETONE_IIR0_IIR_GAIN_B7_CTL, 0x00 },
809*af3d54b9SSrinivas Kandagatla 	{ CDC_RX_SIDETONE_IIR0_IIR_GAIN_B8_CTL, 0x00 },
810*af3d54b9SSrinivas Kandagatla 	{ CDC_RX_SIDETONE_IIR0_IIR_CTL, 0x40 },
811*af3d54b9SSrinivas Kandagatla 	{ CDC_RX_SIDETONE_IIR0_IIR_GAIN_TIMER_CTL, 0x00 },
812*af3d54b9SSrinivas Kandagatla 	{ CDC_RX_SIDETONE_IIR0_IIR_COEF_B1_CTL, 0x00 },
813*af3d54b9SSrinivas Kandagatla 	{ CDC_RX_SIDETONE_IIR0_IIR_COEF_B2_CTL, 0x00 },
814*af3d54b9SSrinivas Kandagatla 	{ CDC_RX_SIDETONE_IIR1_IIR_PATH_CTL, 0x00 },
815*af3d54b9SSrinivas Kandagatla 	{ CDC_RX_SIDETONE_IIR1_IIR_GAIN_B1_CTL, 0x00 },
816*af3d54b9SSrinivas Kandagatla 	{ CDC_RX_SIDETONE_IIR1_IIR_GAIN_B2_CTL, 0x00 },
817*af3d54b9SSrinivas Kandagatla 	{ CDC_RX_SIDETONE_IIR1_IIR_GAIN_B3_CTL, 0x00 },
818*af3d54b9SSrinivas Kandagatla 	{ CDC_RX_SIDETONE_IIR1_IIR_GAIN_B4_CTL, 0x00 },
819*af3d54b9SSrinivas Kandagatla 	{ CDC_RX_SIDETONE_IIR1_IIR_GAIN_B5_CTL, 0x00 },
820*af3d54b9SSrinivas Kandagatla 	{ CDC_RX_SIDETONE_IIR1_IIR_GAIN_B6_CTL, 0x00 },
821*af3d54b9SSrinivas Kandagatla 	{ CDC_RX_SIDETONE_IIR1_IIR_GAIN_B7_CTL, 0x00 },
822*af3d54b9SSrinivas Kandagatla 	{ CDC_RX_SIDETONE_IIR1_IIR_GAIN_B8_CTL, 0x00 },
823*af3d54b9SSrinivas Kandagatla 	{ CDC_RX_SIDETONE_IIR1_IIR_CTL, 0x40 },
824*af3d54b9SSrinivas Kandagatla 	{ CDC_RX_SIDETONE_IIR1_IIR_GAIN_TIMER_CTL, 0x00 },
825*af3d54b9SSrinivas Kandagatla 	{ CDC_RX_SIDETONE_IIR1_IIR_COEF_B1_CTL, 0x00 },
826*af3d54b9SSrinivas Kandagatla 	{ CDC_RX_SIDETONE_IIR1_IIR_COEF_B2_CTL, 0x00 },
827*af3d54b9SSrinivas Kandagatla 	{ CDC_RX_IIR_INP_MUX_IIR0_MIX_CFG0, 0x00 },
828*af3d54b9SSrinivas Kandagatla 	{ CDC_RX_IIR_INP_MUX_IIR0_MIX_CFG1, 0x00 },
829*af3d54b9SSrinivas Kandagatla 	{ CDC_RX_IIR_INP_MUX_IIR0_MIX_CFG2, 0x00 },
830*af3d54b9SSrinivas Kandagatla 	{ CDC_RX_IIR_INP_MUX_IIR0_MIX_CFG3, 0x00 },
831*af3d54b9SSrinivas Kandagatla 	{ CDC_RX_IIR_INP_MUX_IIR1_MIX_CFG0, 0x00 },
832*af3d54b9SSrinivas Kandagatla 	{ CDC_RX_IIR_INP_MUX_IIR1_MIX_CFG1, 0x00 },
833*af3d54b9SSrinivas Kandagatla 	{ CDC_RX_IIR_INP_MUX_IIR1_MIX_CFG2, 0x00 },
834*af3d54b9SSrinivas Kandagatla 	{ CDC_RX_IIR_INP_MUX_IIR1_MIX_CFG3, 0x00 },
835*af3d54b9SSrinivas Kandagatla 	{ CDC_RX_SIDETONE_SRC0_ST_SRC_PATH_CTL, 0x04 },
836*af3d54b9SSrinivas Kandagatla 	{ CDC_RX_SIDETONE_SRC0_ST_SRC_PATH_CFG1, 0x00 },
837*af3d54b9SSrinivas Kandagatla 	{ CDC_RX_SIDETONE_SRC1_ST_SRC_PATH_CTL, 0x04 },
838*af3d54b9SSrinivas Kandagatla 	{ CDC_RX_SIDETONE_SRC1_ST_SRC_PATH_CFG1, 0x00 },
839*af3d54b9SSrinivas Kandagatla 	{ CDC_RX_EC_REF_HQ0_EC_REF_HQ_PATH_CTL, 0x00 },
840*af3d54b9SSrinivas Kandagatla 	{ CDC_RX_EC_REF_HQ0_EC_REF_HQ_CFG0, 0x01 },
841*af3d54b9SSrinivas Kandagatla 	{ CDC_RX_EC_REF_HQ1_EC_REF_HQ_PATH_CTL, 0x00 },
842*af3d54b9SSrinivas Kandagatla 	{ CDC_RX_EC_REF_HQ1_EC_REF_HQ_CFG0, 0x01 },
843*af3d54b9SSrinivas Kandagatla 	{ CDC_RX_EC_REF_HQ2_EC_REF_HQ_PATH_CTL, 0x00 },
844*af3d54b9SSrinivas Kandagatla 	{ CDC_RX_EC_REF_HQ2_EC_REF_HQ_CFG0, 0x01 },
845*af3d54b9SSrinivas Kandagatla 	{ CDC_RX_EC_ASRC0_CLK_RST_CTL, 0x00 },
846*af3d54b9SSrinivas Kandagatla 	{ CDC_RX_EC_ASRC0_CTL0, 0x00 },
847*af3d54b9SSrinivas Kandagatla 	{ CDC_RX_EC_ASRC0_CTL1, 0x00 },
848*af3d54b9SSrinivas Kandagatla 	{ CDC_RX_EC_ASRC0_FIFO_CTL, 0xA8 },
849*af3d54b9SSrinivas Kandagatla 	{ CDC_RX_EC_ASRC0_STATUS_FMIN_CNTR_LSB, 0x00 },
850*af3d54b9SSrinivas Kandagatla 	{ CDC_RX_EC_ASRC0_STATUS_FMIN_CNTR_MSB, 0x00 },
851*af3d54b9SSrinivas Kandagatla 	{ CDC_RX_EC_ASRC0_STATUS_FMAX_CNTR_LSB, 0x00 },
852*af3d54b9SSrinivas Kandagatla 	{ CDC_RX_EC_ASRC0_STATUS_FMAX_CNTR_MSB, 0x00 },
853*af3d54b9SSrinivas Kandagatla 	{ CDC_RX_EC_ASRC0_STATUS_FIFO, 0x00 },
854*af3d54b9SSrinivas Kandagatla 	{ CDC_RX_EC_ASRC1_CLK_RST_CTL, 0x00 },
855*af3d54b9SSrinivas Kandagatla 	{ CDC_RX_EC_ASRC1_CTL0, 0x00 },
856*af3d54b9SSrinivas Kandagatla 	{ CDC_RX_EC_ASRC1_CTL1, 0x00 },
857*af3d54b9SSrinivas Kandagatla 	{ CDC_RX_EC_ASRC1_FIFO_CTL, 0xA8 },
858*af3d54b9SSrinivas Kandagatla 	{ CDC_RX_EC_ASRC1_STATUS_FMIN_CNTR_LSB, 0x00 },
859*af3d54b9SSrinivas Kandagatla 	{ CDC_RX_EC_ASRC1_STATUS_FMIN_CNTR_MSB, 0x00 },
860*af3d54b9SSrinivas Kandagatla 	{ CDC_RX_EC_ASRC1_STATUS_FMAX_CNTR_LSB, 0x00 },
861*af3d54b9SSrinivas Kandagatla 	{ CDC_RX_EC_ASRC1_STATUS_FMAX_CNTR_MSB, 0x00 },
862*af3d54b9SSrinivas Kandagatla 	{ CDC_RX_EC_ASRC1_STATUS_FIFO, 0x00 },
863*af3d54b9SSrinivas Kandagatla 	{ CDC_RX_EC_ASRC2_CLK_RST_CTL, 0x00 },
864*af3d54b9SSrinivas Kandagatla 	{ CDC_RX_EC_ASRC2_CTL0, 0x00 },
865*af3d54b9SSrinivas Kandagatla 	{ CDC_RX_EC_ASRC2_CTL1, 0x00 },
866*af3d54b9SSrinivas Kandagatla 	{ CDC_RX_EC_ASRC2_FIFO_CTL, 0xA8 },
867*af3d54b9SSrinivas Kandagatla 	{ CDC_RX_EC_ASRC2_STATUS_FMIN_CNTR_LSB, 0x00 },
868*af3d54b9SSrinivas Kandagatla 	{ CDC_RX_EC_ASRC2_STATUS_FMIN_CNTR_MSB, 0x00 },
869*af3d54b9SSrinivas Kandagatla 	{ CDC_RX_EC_ASRC2_STATUS_FMAX_CNTR_LSB, 0x00 },
870*af3d54b9SSrinivas Kandagatla 	{ CDC_RX_EC_ASRC2_STATUS_FMAX_CNTR_MSB, 0x00 },
871*af3d54b9SSrinivas Kandagatla 	{ CDC_RX_EC_ASRC2_STATUS_FIFO, 0x00 },
872*af3d54b9SSrinivas Kandagatla 	{ CDC_RX_DSD0_PATH_CTL, 0x00 },
873*af3d54b9SSrinivas Kandagatla 	{ CDC_RX_DSD0_CFG0, 0x00 },
874*af3d54b9SSrinivas Kandagatla 	{ CDC_RX_DSD0_CFG1, 0x62 },
875*af3d54b9SSrinivas Kandagatla 	{ CDC_RX_DSD0_CFG2, 0x96 },
876*af3d54b9SSrinivas Kandagatla 	{ CDC_RX_DSD1_PATH_CTL, 0x00 },
877*af3d54b9SSrinivas Kandagatla 	{ CDC_RX_DSD1_CFG0, 0x00 },
878*af3d54b9SSrinivas Kandagatla 	{ CDC_RX_DSD1_CFG1, 0x62 },
879*af3d54b9SSrinivas Kandagatla 	{ CDC_RX_DSD1_CFG2, 0x96 },
880*af3d54b9SSrinivas Kandagatla };
881*af3d54b9SSrinivas Kandagatla 
882*af3d54b9SSrinivas Kandagatla static bool rx_is_wronly_register(struct device *dev,
883*af3d54b9SSrinivas Kandagatla 					unsigned int reg)
884*af3d54b9SSrinivas Kandagatla {
885*af3d54b9SSrinivas Kandagatla 	switch (reg) {
886*af3d54b9SSrinivas Kandagatla 	case CDC_RX_BCL_VBAT_GAIN_UPD_MON:
887*af3d54b9SSrinivas Kandagatla 	case CDC_RX_INTR_CTRL_CLR_COMMIT:
888*af3d54b9SSrinivas Kandagatla 	case CDC_RX_INTR_CTRL_PIN1_CLEAR0:
889*af3d54b9SSrinivas Kandagatla 	case CDC_RX_INTR_CTRL_PIN2_CLEAR0:
890*af3d54b9SSrinivas Kandagatla 		return true;
891*af3d54b9SSrinivas Kandagatla 	}
892*af3d54b9SSrinivas Kandagatla 
893*af3d54b9SSrinivas Kandagatla 	return false;
894*af3d54b9SSrinivas Kandagatla }
895*af3d54b9SSrinivas Kandagatla 
896*af3d54b9SSrinivas Kandagatla static bool rx_is_volatile_register(struct device *dev, unsigned int reg)
897*af3d54b9SSrinivas Kandagatla {
898*af3d54b9SSrinivas Kandagatla 	/* Update volatile list for rx/tx macros */
899*af3d54b9SSrinivas Kandagatla 	switch (reg) {
900*af3d54b9SSrinivas Kandagatla 	case CDC_RX_TOP_HPHL_COMP_RD_LSB:
901*af3d54b9SSrinivas Kandagatla 	case CDC_RX_TOP_HPHL_COMP_WR_LSB:
902*af3d54b9SSrinivas Kandagatla 	case CDC_RX_TOP_HPHL_COMP_RD_MSB:
903*af3d54b9SSrinivas Kandagatla 	case CDC_RX_TOP_HPHL_COMP_WR_MSB:
904*af3d54b9SSrinivas Kandagatla 	case CDC_RX_TOP_HPHR_COMP_RD_LSB:
905*af3d54b9SSrinivas Kandagatla 	case CDC_RX_TOP_HPHR_COMP_WR_LSB:
906*af3d54b9SSrinivas Kandagatla 	case CDC_RX_TOP_HPHR_COMP_RD_MSB:
907*af3d54b9SSrinivas Kandagatla 	case CDC_RX_TOP_HPHR_COMP_WR_MSB:
908*af3d54b9SSrinivas Kandagatla 	case CDC_RX_TOP_DSD0_DEBUG_CFG2:
909*af3d54b9SSrinivas Kandagatla 	case CDC_RX_TOP_DSD1_DEBUG_CFG2:
910*af3d54b9SSrinivas Kandagatla 	case CDC_RX_BCL_VBAT_GAIN_MON_VAL:
911*af3d54b9SSrinivas Kandagatla 	case CDC_RX_BCL_VBAT_DECODE_ST:
912*af3d54b9SSrinivas Kandagatla 	case CDC_RX_INTR_CTRL_PIN1_STATUS0:
913*af3d54b9SSrinivas Kandagatla 	case CDC_RX_INTR_CTRL_PIN2_STATUS0:
914*af3d54b9SSrinivas Kandagatla 	case CDC_RX_COMPANDER0_CTL6:
915*af3d54b9SSrinivas Kandagatla 	case CDC_RX_COMPANDER1_CTL6:
916*af3d54b9SSrinivas Kandagatla 	case CDC_RX_EC_ASRC0_STATUS_FMIN_CNTR_LSB:
917*af3d54b9SSrinivas Kandagatla 	case CDC_RX_EC_ASRC0_STATUS_FMIN_CNTR_MSB:
918*af3d54b9SSrinivas Kandagatla 	case CDC_RX_EC_ASRC0_STATUS_FMAX_CNTR_LSB:
919*af3d54b9SSrinivas Kandagatla 	case CDC_RX_EC_ASRC0_STATUS_FMAX_CNTR_MSB:
920*af3d54b9SSrinivas Kandagatla 	case CDC_RX_EC_ASRC0_STATUS_FIFO:
921*af3d54b9SSrinivas Kandagatla 	case CDC_RX_EC_ASRC1_STATUS_FMIN_CNTR_LSB:
922*af3d54b9SSrinivas Kandagatla 	case CDC_RX_EC_ASRC1_STATUS_FMIN_CNTR_MSB:
923*af3d54b9SSrinivas Kandagatla 	case CDC_RX_EC_ASRC1_STATUS_FMAX_CNTR_LSB:
924*af3d54b9SSrinivas Kandagatla 	case CDC_RX_EC_ASRC1_STATUS_FMAX_CNTR_MSB:
925*af3d54b9SSrinivas Kandagatla 	case CDC_RX_EC_ASRC1_STATUS_FIFO:
926*af3d54b9SSrinivas Kandagatla 	case CDC_RX_EC_ASRC2_STATUS_FMIN_CNTR_LSB:
927*af3d54b9SSrinivas Kandagatla 	case CDC_RX_EC_ASRC2_STATUS_FMIN_CNTR_MSB:
928*af3d54b9SSrinivas Kandagatla 	case CDC_RX_EC_ASRC2_STATUS_FMAX_CNTR_LSB:
929*af3d54b9SSrinivas Kandagatla 	case CDC_RX_EC_ASRC2_STATUS_FMAX_CNTR_MSB:
930*af3d54b9SSrinivas Kandagatla 	case CDC_RX_EC_ASRC2_STATUS_FIFO:
931*af3d54b9SSrinivas Kandagatla 		return true;
932*af3d54b9SSrinivas Kandagatla 	}
933*af3d54b9SSrinivas Kandagatla 	return false;
934*af3d54b9SSrinivas Kandagatla }
935*af3d54b9SSrinivas Kandagatla 
936*af3d54b9SSrinivas Kandagatla static bool rx_is_rw_register(struct device *dev, unsigned int reg)
937*af3d54b9SSrinivas Kandagatla {
938*af3d54b9SSrinivas Kandagatla 	switch (reg) {
939*af3d54b9SSrinivas Kandagatla 	case CDC_RX_TOP_TOP_CFG0:
940*af3d54b9SSrinivas Kandagatla 	case CDC_RX_TOP_SWR_CTRL:
941*af3d54b9SSrinivas Kandagatla 	case CDC_RX_TOP_DEBUG:
942*af3d54b9SSrinivas Kandagatla 	case CDC_RX_TOP_DEBUG_BUS:
943*af3d54b9SSrinivas Kandagatla 	case CDC_RX_TOP_DEBUG_EN0:
944*af3d54b9SSrinivas Kandagatla 	case CDC_RX_TOP_DEBUG_EN1:
945*af3d54b9SSrinivas Kandagatla 	case CDC_RX_TOP_DEBUG_EN2:
946*af3d54b9SSrinivas Kandagatla 	case CDC_RX_TOP_HPHL_COMP_WR_LSB:
947*af3d54b9SSrinivas Kandagatla 	case CDC_RX_TOP_HPHL_COMP_WR_MSB:
948*af3d54b9SSrinivas Kandagatla 	case CDC_RX_TOP_HPHL_COMP_LUT:
949*af3d54b9SSrinivas Kandagatla 	case CDC_RX_TOP_HPHR_COMP_WR_LSB:
950*af3d54b9SSrinivas Kandagatla 	case CDC_RX_TOP_HPHR_COMP_WR_MSB:
951*af3d54b9SSrinivas Kandagatla 	case CDC_RX_TOP_HPHR_COMP_LUT:
952*af3d54b9SSrinivas Kandagatla 	case CDC_RX_TOP_DSD0_DEBUG_CFG0:
953*af3d54b9SSrinivas Kandagatla 	case CDC_RX_TOP_DSD0_DEBUG_CFG1:
954*af3d54b9SSrinivas Kandagatla 	case CDC_RX_TOP_DSD0_DEBUG_CFG3:
955*af3d54b9SSrinivas Kandagatla 	case CDC_RX_TOP_DSD1_DEBUG_CFG0:
956*af3d54b9SSrinivas Kandagatla 	case CDC_RX_TOP_DSD1_DEBUG_CFG1:
957*af3d54b9SSrinivas Kandagatla 	case CDC_RX_TOP_DSD1_DEBUG_CFG3:
958*af3d54b9SSrinivas Kandagatla 	case CDC_RX_TOP_RX_I2S_CTL:
959*af3d54b9SSrinivas Kandagatla 	case CDC_RX_TOP_TX_I2S2_CTL:
960*af3d54b9SSrinivas Kandagatla 	case CDC_RX_TOP_I2S_CLK:
961*af3d54b9SSrinivas Kandagatla 	case CDC_RX_TOP_I2S_RESET:
962*af3d54b9SSrinivas Kandagatla 	case CDC_RX_TOP_I2S_MUX:
963*af3d54b9SSrinivas Kandagatla 	case CDC_RX_CLK_RST_CTRL_MCLK_CONTROL:
964*af3d54b9SSrinivas Kandagatla 	case CDC_RX_CLK_RST_CTRL_FS_CNT_CONTROL:
965*af3d54b9SSrinivas Kandagatla 	case CDC_RX_CLK_RST_CTRL_SWR_CONTROL:
966*af3d54b9SSrinivas Kandagatla 	case CDC_RX_CLK_RST_CTRL_DSD_CONTROL:
967*af3d54b9SSrinivas Kandagatla 	case CDC_RX_CLK_RST_CTRL_ASRC_SHARE_CONTROL:
968*af3d54b9SSrinivas Kandagatla 	case CDC_RX_SOFTCLIP_CRC:
969*af3d54b9SSrinivas Kandagatla 	case CDC_RX_SOFTCLIP_SOFTCLIP_CTRL:
970*af3d54b9SSrinivas Kandagatla 	case CDC_RX_INP_MUX_RX_INT0_CFG0:
971*af3d54b9SSrinivas Kandagatla 	case CDC_RX_INP_MUX_RX_INT0_CFG1:
972*af3d54b9SSrinivas Kandagatla 	case CDC_RX_INP_MUX_RX_INT1_CFG0:
973*af3d54b9SSrinivas Kandagatla 	case CDC_RX_INP_MUX_RX_INT1_CFG1:
974*af3d54b9SSrinivas Kandagatla 	case CDC_RX_INP_MUX_RX_INT2_CFG0:
975*af3d54b9SSrinivas Kandagatla 	case CDC_RX_INP_MUX_RX_INT2_CFG1:
976*af3d54b9SSrinivas Kandagatla 	case CDC_RX_INP_MUX_RX_MIX_CFG4:
977*af3d54b9SSrinivas Kandagatla 	case CDC_RX_INP_MUX_RX_MIX_CFG5:
978*af3d54b9SSrinivas Kandagatla 	case CDC_RX_INP_MUX_SIDETONE_SRC_CFG0:
979*af3d54b9SSrinivas Kandagatla 	case CDC_RX_CLSH_CRC:
980*af3d54b9SSrinivas Kandagatla 	case CDC_RX_CLSH_DLY_CTRL:
981*af3d54b9SSrinivas Kandagatla 	case CDC_RX_CLSH_DECAY_CTRL:
982*af3d54b9SSrinivas Kandagatla 	case CDC_RX_CLSH_HPH_V_PA:
983*af3d54b9SSrinivas Kandagatla 	case CDC_RX_CLSH_EAR_V_PA:
984*af3d54b9SSrinivas Kandagatla 	case CDC_RX_CLSH_HPH_V_HD:
985*af3d54b9SSrinivas Kandagatla 	case CDC_RX_CLSH_EAR_V_HD:
986*af3d54b9SSrinivas Kandagatla 	case CDC_RX_CLSH_K1_MSB:
987*af3d54b9SSrinivas Kandagatla 	case CDC_RX_CLSH_K1_LSB:
988*af3d54b9SSrinivas Kandagatla 	case CDC_RX_CLSH_K2_MSB:
989*af3d54b9SSrinivas Kandagatla 	case CDC_RX_CLSH_K2_LSB:
990*af3d54b9SSrinivas Kandagatla 	case CDC_RX_CLSH_IDLE_CTRL:
991*af3d54b9SSrinivas Kandagatla 	case CDC_RX_CLSH_IDLE_HPH:
992*af3d54b9SSrinivas Kandagatla 	case CDC_RX_CLSH_IDLE_EAR:
993*af3d54b9SSrinivas Kandagatla 	case CDC_RX_CLSH_TEST0:
994*af3d54b9SSrinivas Kandagatla 	case CDC_RX_CLSH_TEST1:
995*af3d54b9SSrinivas Kandagatla 	case CDC_RX_CLSH_OVR_VREF:
996*af3d54b9SSrinivas Kandagatla 	case CDC_RX_CLSH_CLSG_CTL:
997*af3d54b9SSrinivas Kandagatla 	case CDC_RX_CLSH_CLSG_CFG1:
998*af3d54b9SSrinivas Kandagatla 	case CDC_RX_CLSH_CLSG_CFG2:
999*af3d54b9SSrinivas Kandagatla 	case CDC_RX_BCL_VBAT_PATH_CTL:
1000*af3d54b9SSrinivas Kandagatla 	case CDC_RX_BCL_VBAT_CFG:
1001*af3d54b9SSrinivas Kandagatla 	case CDC_RX_BCL_VBAT_ADC_CAL1:
1002*af3d54b9SSrinivas Kandagatla 	case CDC_RX_BCL_VBAT_ADC_CAL2:
1003*af3d54b9SSrinivas Kandagatla 	case CDC_RX_BCL_VBAT_ADC_CAL3:
1004*af3d54b9SSrinivas Kandagatla 	case CDC_RX_BCL_VBAT_PK_EST1:
1005*af3d54b9SSrinivas Kandagatla 	case CDC_RX_BCL_VBAT_PK_EST2:
1006*af3d54b9SSrinivas Kandagatla 	case CDC_RX_BCL_VBAT_PK_EST3:
1007*af3d54b9SSrinivas Kandagatla 	case CDC_RX_BCL_VBAT_RF_PROC1:
1008*af3d54b9SSrinivas Kandagatla 	case CDC_RX_BCL_VBAT_RF_PROC2:
1009*af3d54b9SSrinivas Kandagatla 	case CDC_RX_BCL_VBAT_TAC1:
1010*af3d54b9SSrinivas Kandagatla 	case CDC_RX_BCL_VBAT_TAC2:
1011*af3d54b9SSrinivas Kandagatla 	case CDC_RX_BCL_VBAT_TAC3:
1012*af3d54b9SSrinivas Kandagatla 	case CDC_RX_BCL_VBAT_TAC4:
1013*af3d54b9SSrinivas Kandagatla 	case CDC_RX_BCL_VBAT_GAIN_UPD1:
1014*af3d54b9SSrinivas Kandagatla 	case CDC_RX_BCL_VBAT_GAIN_UPD2:
1015*af3d54b9SSrinivas Kandagatla 	case CDC_RX_BCL_VBAT_GAIN_UPD3:
1016*af3d54b9SSrinivas Kandagatla 	case CDC_RX_BCL_VBAT_GAIN_UPD4:
1017*af3d54b9SSrinivas Kandagatla 	case CDC_RX_BCL_VBAT_GAIN_UPD5:
1018*af3d54b9SSrinivas Kandagatla 	case CDC_RX_BCL_VBAT_DEBUG1:
1019*af3d54b9SSrinivas Kandagatla 	case CDC_RX_BCL_VBAT_BAN:
1020*af3d54b9SSrinivas Kandagatla 	case CDC_RX_BCL_VBAT_BCL_GAIN_UPD1:
1021*af3d54b9SSrinivas Kandagatla 	case CDC_RX_BCL_VBAT_BCL_GAIN_UPD2:
1022*af3d54b9SSrinivas Kandagatla 	case CDC_RX_BCL_VBAT_BCL_GAIN_UPD3:
1023*af3d54b9SSrinivas Kandagatla 	case CDC_RX_BCL_VBAT_BCL_GAIN_UPD4:
1024*af3d54b9SSrinivas Kandagatla 	case CDC_RX_BCL_VBAT_BCL_GAIN_UPD5:
1025*af3d54b9SSrinivas Kandagatla 	case CDC_RX_BCL_VBAT_BCL_GAIN_UPD6:
1026*af3d54b9SSrinivas Kandagatla 	case CDC_RX_BCL_VBAT_BCL_GAIN_UPD7:
1027*af3d54b9SSrinivas Kandagatla 	case CDC_RX_BCL_VBAT_BCL_GAIN_UPD8:
1028*af3d54b9SSrinivas Kandagatla 	case CDC_RX_BCL_VBAT_BCL_GAIN_UPD9:
1029*af3d54b9SSrinivas Kandagatla 	case CDC_RX_BCL_VBAT_ATTN1:
1030*af3d54b9SSrinivas Kandagatla 	case CDC_RX_BCL_VBAT_ATTN2:
1031*af3d54b9SSrinivas Kandagatla 	case CDC_RX_BCL_VBAT_ATTN3:
1032*af3d54b9SSrinivas Kandagatla 	case CDC_RX_BCL_VBAT_DECODE_CTL1:
1033*af3d54b9SSrinivas Kandagatla 	case CDC_RX_BCL_VBAT_DECODE_CTL2:
1034*af3d54b9SSrinivas Kandagatla 	case CDC_RX_BCL_VBAT_DECODE_CFG1:
1035*af3d54b9SSrinivas Kandagatla 	case CDC_RX_BCL_VBAT_DECODE_CFG2:
1036*af3d54b9SSrinivas Kandagatla 	case CDC_RX_BCL_VBAT_DECODE_CFG3:
1037*af3d54b9SSrinivas Kandagatla 	case CDC_RX_BCL_VBAT_DECODE_CFG4:
1038*af3d54b9SSrinivas Kandagatla 	case CDC_RX_INTR_CTRL_CFG:
1039*af3d54b9SSrinivas Kandagatla 	case CDC_RX_INTR_CTRL_PIN1_MASK0:
1040*af3d54b9SSrinivas Kandagatla 	case CDC_RX_INTR_CTRL_PIN2_MASK0:
1041*af3d54b9SSrinivas Kandagatla 	case CDC_RX_INTR_CTRL_LEVEL0:
1042*af3d54b9SSrinivas Kandagatla 	case CDC_RX_INTR_CTRL_BYPASS0:
1043*af3d54b9SSrinivas Kandagatla 	case CDC_RX_INTR_CTRL_SET0:
1044*af3d54b9SSrinivas Kandagatla 	case CDC_RX_RX0_RX_PATH_CTL:
1045*af3d54b9SSrinivas Kandagatla 	case CDC_RX_RX0_RX_PATH_CFG0:
1046*af3d54b9SSrinivas Kandagatla 	case CDC_RX_RX0_RX_PATH_CFG1:
1047*af3d54b9SSrinivas Kandagatla 	case CDC_RX_RX0_RX_PATH_CFG2:
1048*af3d54b9SSrinivas Kandagatla 	case CDC_RX_RX0_RX_PATH_CFG3:
1049*af3d54b9SSrinivas Kandagatla 	case CDC_RX_RX0_RX_VOL_CTL:
1050*af3d54b9SSrinivas Kandagatla 	case CDC_RX_RX0_RX_PATH_MIX_CTL:
1051*af3d54b9SSrinivas Kandagatla 	case CDC_RX_RX0_RX_PATH_MIX_CFG:
1052*af3d54b9SSrinivas Kandagatla 	case CDC_RX_RX0_RX_VOL_MIX_CTL:
1053*af3d54b9SSrinivas Kandagatla 	case CDC_RX_RX0_RX_PATH_SEC1:
1054*af3d54b9SSrinivas Kandagatla 	case CDC_RX_RX0_RX_PATH_SEC2:
1055*af3d54b9SSrinivas Kandagatla 	case CDC_RX_RX0_RX_PATH_SEC3:
1056*af3d54b9SSrinivas Kandagatla 	case CDC_RX_RX0_RX_PATH_SEC4:
1057*af3d54b9SSrinivas Kandagatla 	case CDC_RX_RX0_RX_PATH_SEC7:
1058*af3d54b9SSrinivas Kandagatla 	case CDC_RX_RX0_RX_PATH_MIX_SEC0:
1059*af3d54b9SSrinivas Kandagatla 	case CDC_RX_RX0_RX_PATH_MIX_SEC1:
1060*af3d54b9SSrinivas Kandagatla 	case CDC_RX_RX0_RX_PATH_DSM_CTL:
1061*af3d54b9SSrinivas Kandagatla 	case CDC_RX_RX0_RX_PATH_DSM_DATA1:
1062*af3d54b9SSrinivas Kandagatla 	case CDC_RX_RX0_RX_PATH_DSM_DATA2:
1063*af3d54b9SSrinivas Kandagatla 	case CDC_RX_RX0_RX_PATH_DSM_DATA3:
1064*af3d54b9SSrinivas Kandagatla 	case CDC_RX_RX0_RX_PATH_DSM_DATA4:
1065*af3d54b9SSrinivas Kandagatla 	case CDC_RX_RX0_RX_PATH_DSM_DATA5:
1066*af3d54b9SSrinivas Kandagatla 	case CDC_RX_RX0_RX_PATH_DSM_DATA6:
1067*af3d54b9SSrinivas Kandagatla 	case CDC_RX_RX1_RX_PATH_CTL:
1068*af3d54b9SSrinivas Kandagatla 	case CDC_RX_RX1_RX_PATH_CFG0:
1069*af3d54b9SSrinivas Kandagatla 	case CDC_RX_RX1_RX_PATH_CFG1:
1070*af3d54b9SSrinivas Kandagatla 	case CDC_RX_RX1_RX_PATH_CFG2:
1071*af3d54b9SSrinivas Kandagatla 	case CDC_RX_RX1_RX_PATH_CFG3:
1072*af3d54b9SSrinivas Kandagatla 	case CDC_RX_RX1_RX_VOL_CTL:
1073*af3d54b9SSrinivas Kandagatla 	case CDC_RX_RX1_RX_PATH_MIX_CTL:
1074*af3d54b9SSrinivas Kandagatla 	case CDC_RX_RX1_RX_PATH_MIX_CFG:
1075*af3d54b9SSrinivas Kandagatla 	case CDC_RX_RX1_RX_VOL_MIX_CTL:
1076*af3d54b9SSrinivas Kandagatla 	case CDC_RX_RX1_RX_PATH_SEC1:
1077*af3d54b9SSrinivas Kandagatla 	case CDC_RX_RX1_RX_PATH_SEC2:
1078*af3d54b9SSrinivas Kandagatla 	case CDC_RX_RX1_RX_PATH_SEC3:
1079*af3d54b9SSrinivas Kandagatla 	case CDC_RX_RX1_RX_PATH_SEC4:
1080*af3d54b9SSrinivas Kandagatla 	case CDC_RX_RX1_RX_PATH_SEC7:
1081*af3d54b9SSrinivas Kandagatla 	case CDC_RX_RX1_RX_PATH_MIX_SEC0:
1082*af3d54b9SSrinivas Kandagatla 	case CDC_RX_RX1_RX_PATH_MIX_SEC1:
1083*af3d54b9SSrinivas Kandagatla 	case CDC_RX_RX1_RX_PATH_DSM_CTL:
1084*af3d54b9SSrinivas Kandagatla 	case CDC_RX_RX1_RX_PATH_DSM_DATA1:
1085*af3d54b9SSrinivas Kandagatla 	case CDC_RX_RX1_RX_PATH_DSM_DATA2:
1086*af3d54b9SSrinivas Kandagatla 	case CDC_RX_RX1_RX_PATH_DSM_DATA3:
1087*af3d54b9SSrinivas Kandagatla 	case CDC_RX_RX1_RX_PATH_DSM_DATA4:
1088*af3d54b9SSrinivas Kandagatla 	case CDC_RX_RX1_RX_PATH_DSM_DATA5:
1089*af3d54b9SSrinivas Kandagatla 	case CDC_RX_RX1_RX_PATH_DSM_DATA6:
1090*af3d54b9SSrinivas Kandagatla 	case CDC_RX_RX2_RX_PATH_CTL:
1091*af3d54b9SSrinivas Kandagatla 	case CDC_RX_RX2_RX_PATH_CFG0:
1092*af3d54b9SSrinivas Kandagatla 	case CDC_RX_RX2_RX_PATH_CFG1:
1093*af3d54b9SSrinivas Kandagatla 	case CDC_RX_RX2_RX_PATH_CFG2:
1094*af3d54b9SSrinivas Kandagatla 	case CDC_RX_RX2_RX_PATH_CFG3:
1095*af3d54b9SSrinivas Kandagatla 	case CDC_RX_RX2_RX_VOL_CTL:
1096*af3d54b9SSrinivas Kandagatla 	case CDC_RX_RX2_RX_PATH_MIX_CTL:
1097*af3d54b9SSrinivas Kandagatla 	case CDC_RX_RX2_RX_PATH_MIX_CFG:
1098*af3d54b9SSrinivas Kandagatla 	case CDC_RX_RX2_RX_VOL_MIX_CTL:
1099*af3d54b9SSrinivas Kandagatla 	case CDC_RX_RX2_RX_PATH_SEC0:
1100*af3d54b9SSrinivas Kandagatla 	case CDC_RX_RX2_RX_PATH_SEC1:
1101*af3d54b9SSrinivas Kandagatla 	case CDC_RX_RX2_RX_PATH_SEC2:
1102*af3d54b9SSrinivas Kandagatla 	case CDC_RX_RX2_RX_PATH_SEC3:
1103*af3d54b9SSrinivas Kandagatla 	case CDC_RX_RX2_RX_PATH_SEC4:
1104*af3d54b9SSrinivas Kandagatla 	case CDC_RX_RX2_RX_PATH_SEC5:
1105*af3d54b9SSrinivas Kandagatla 	case CDC_RX_RX2_RX_PATH_SEC6:
1106*af3d54b9SSrinivas Kandagatla 	case CDC_RX_RX2_RX_PATH_SEC7:
1107*af3d54b9SSrinivas Kandagatla 	case CDC_RX_RX2_RX_PATH_MIX_SEC0:
1108*af3d54b9SSrinivas Kandagatla 	case CDC_RX_RX2_RX_PATH_MIX_SEC1:
1109*af3d54b9SSrinivas Kandagatla 	case CDC_RX_RX2_RX_PATH_DSM_CTL:
1110*af3d54b9SSrinivas Kandagatla 	case CDC_RX_IDLE_DETECT_PATH_CTL:
1111*af3d54b9SSrinivas Kandagatla 	case CDC_RX_IDLE_DETECT_CFG0:
1112*af3d54b9SSrinivas Kandagatla 	case CDC_RX_IDLE_DETECT_CFG1:
1113*af3d54b9SSrinivas Kandagatla 	case CDC_RX_IDLE_DETECT_CFG2:
1114*af3d54b9SSrinivas Kandagatla 	case CDC_RX_IDLE_DETECT_CFG3:
1115*af3d54b9SSrinivas Kandagatla 	case CDC_RX_COMPANDER0_CTL0:
1116*af3d54b9SSrinivas Kandagatla 	case CDC_RX_COMPANDER0_CTL1:
1117*af3d54b9SSrinivas Kandagatla 	case CDC_RX_COMPANDER0_CTL2:
1118*af3d54b9SSrinivas Kandagatla 	case CDC_RX_COMPANDER0_CTL3:
1119*af3d54b9SSrinivas Kandagatla 	case CDC_RX_COMPANDER0_CTL4:
1120*af3d54b9SSrinivas Kandagatla 	case CDC_RX_COMPANDER0_CTL5:
1121*af3d54b9SSrinivas Kandagatla 	case CDC_RX_COMPANDER0_CTL7:
1122*af3d54b9SSrinivas Kandagatla 	case CDC_RX_COMPANDER1_CTL0:
1123*af3d54b9SSrinivas Kandagatla 	case CDC_RX_COMPANDER1_CTL1:
1124*af3d54b9SSrinivas Kandagatla 	case CDC_RX_COMPANDER1_CTL2:
1125*af3d54b9SSrinivas Kandagatla 	case CDC_RX_COMPANDER1_CTL3:
1126*af3d54b9SSrinivas Kandagatla 	case CDC_RX_COMPANDER1_CTL4:
1127*af3d54b9SSrinivas Kandagatla 	case CDC_RX_COMPANDER1_CTL5:
1128*af3d54b9SSrinivas Kandagatla 	case CDC_RX_COMPANDER1_CTL7:
1129*af3d54b9SSrinivas Kandagatla 	case CDC_RX_SIDETONE_IIR0_IIR_PATH_CTL:
1130*af3d54b9SSrinivas Kandagatla 	case CDC_RX_SIDETONE_IIR0_IIR_GAIN_B1_CTL:
1131*af3d54b9SSrinivas Kandagatla 	case CDC_RX_SIDETONE_IIR0_IIR_GAIN_B2_CTL:
1132*af3d54b9SSrinivas Kandagatla 	case CDC_RX_SIDETONE_IIR0_IIR_GAIN_B3_CTL:
1133*af3d54b9SSrinivas Kandagatla 	case CDC_RX_SIDETONE_IIR0_IIR_GAIN_B4_CTL:
1134*af3d54b9SSrinivas Kandagatla 	case CDC_RX_SIDETONE_IIR0_IIR_GAIN_B5_CTL:
1135*af3d54b9SSrinivas Kandagatla 	case CDC_RX_SIDETONE_IIR0_IIR_GAIN_B6_CTL:
1136*af3d54b9SSrinivas Kandagatla 	case CDC_RX_SIDETONE_IIR0_IIR_GAIN_B7_CTL:
1137*af3d54b9SSrinivas Kandagatla 	case CDC_RX_SIDETONE_IIR0_IIR_GAIN_B8_CTL:
1138*af3d54b9SSrinivas Kandagatla 	case CDC_RX_SIDETONE_IIR0_IIR_CTL:
1139*af3d54b9SSrinivas Kandagatla 	case CDC_RX_SIDETONE_IIR0_IIR_GAIN_TIMER_CTL:
1140*af3d54b9SSrinivas Kandagatla 	case CDC_RX_SIDETONE_IIR0_IIR_COEF_B1_CTL:
1141*af3d54b9SSrinivas Kandagatla 	case CDC_RX_SIDETONE_IIR0_IIR_COEF_B2_CTL:
1142*af3d54b9SSrinivas Kandagatla 	case CDC_RX_SIDETONE_IIR1_IIR_PATH_CTL:
1143*af3d54b9SSrinivas Kandagatla 	case CDC_RX_SIDETONE_IIR1_IIR_GAIN_B1_CTL:
1144*af3d54b9SSrinivas Kandagatla 	case CDC_RX_SIDETONE_IIR1_IIR_GAIN_B2_CTL:
1145*af3d54b9SSrinivas Kandagatla 	case CDC_RX_SIDETONE_IIR1_IIR_GAIN_B3_CTL:
1146*af3d54b9SSrinivas Kandagatla 	case CDC_RX_SIDETONE_IIR1_IIR_GAIN_B4_CTL:
1147*af3d54b9SSrinivas Kandagatla 	case CDC_RX_SIDETONE_IIR1_IIR_GAIN_B5_CTL:
1148*af3d54b9SSrinivas Kandagatla 	case CDC_RX_SIDETONE_IIR1_IIR_GAIN_B6_CTL:
1149*af3d54b9SSrinivas Kandagatla 	case CDC_RX_SIDETONE_IIR1_IIR_GAIN_B7_CTL:
1150*af3d54b9SSrinivas Kandagatla 	case CDC_RX_SIDETONE_IIR1_IIR_GAIN_B8_CTL:
1151*af3d54b9SSrinivas Kandagatla 	case CDC_RX_SIDETONE_IIR1_IIR_CTL:
1152*af3d54b9SSrinivas Kandagatla 	case CDC_RX_SIDETONE_IIR1_IIR_GAIN_TIMER_CTL:
1153*af3d54b9SSrinivas Kandagatla 	case CDC_RX_SIDETONE_IIR1_IIR_COEF_B1_CTL:
1154*af3d54b9SSrinivas Kandagatla 	case CDC_RX_SIDETONE_IIR1_IIR_COEF_B2_CTL:
1155*af3d54b9SSrinivas Kandagatla 	case CDC_RX_IIR_INP_MUX_IIR0_MIX_CFG0:
1156*af3d54b9SSrinivas Kandagatla 	case CDC_RX_IIR_INP_MUX_IIR0_MIX_CFG1:
1157*af3d54b9SSrinivas Kandagatla 	case CDC_RX_IIR_INP_MUX_IIR0_MIX_CFG2:
1158*af3d54b9SSrinivas Kandagatla 	case CDC_RX_IIR_INP_MUX_IIR0_MIX_CFG3:
1159*af3d54b9SSrinivas Kandagatla 	case CDC_RX_IIR_INP_MUX_IIR1_MIX_CFG0:
1160*af3d54b9SSrinivas Kandagatla 	case CDC_RX_IIR_INP_MUX_IIR1_MIX_CFG1:
1161*af3d54b9SSrinivas Kandagatla 	case CDC_RX_IIR_INP_MUX_IIR1_MIX_CFG2:
1162*af3d54b9SSrinivas Kandagatla 	case CDC_RX_IIR_INP_MUX_IIR1_MIX_CFG3:
1163*af3d54b9SSrinivas Kandagatla 	case CDC_RX_SIDETONE_SRC0_ST_SRC_PATH_CTL:
1164*af3d54b9SSrinivas Kandagatla 	case CDC_RX_SIDETONE_SRC0_ST_SRC_PATH_CFG1:
1165*af3d54b9SSrinivas Kandagatla 	case CDC_RX_SIDETONE_SRC1_ST_SRC_PATH_CTL:
1166*af3d54b9SSrinivas Kandagatla 	case CDC_RX_SIDETONE_SRC1_ST_SRC_PATH_CFG1:
1167*af3d54b9SSrinivas Kandagatla 	case CDC_RX_EC_REF_HQ0_EC_REF_HQ_PATH_CTL:
1168*af3d54b9SSrinivas Kandagatla 	case CDC_RX_EC_REF_HQ0_EC_REF_HQ_CFG0:
1169*af3d54b9SSrinivas Kandagatla 	case CDC_RX_EC_REF_HQ1_EC_REF_HQ_PATH_CTL:
1170*af3d54b9SSrinivas Kandagatla 	case CDC_RX_EC_REF_HQ1_EC_REF_HQ_CFG0:
1171*af3d54b9SSrinivas Kandagatla 	case CDC_RX_EC_REF_HQ2_EC_REF_HQ_PATH_CTL:
1172*af3d54b9SSrinivas Kandagatla 	case CDC_RX_EC_REF_HQ2_EC_REF_HQ_CFG0:
1173*af3d54b9SSrinivas Kandagatla 	case CDC_RX_EC_ASRC0_CLK_RST_CTL:
1174*af3d54b9SSrinivas Kandagatla 	case CDC_RX_EC_ASRC0_CTL0:
1175*af3d54b9SSrinivas Kandagatla 	case CDC_RX_EC_ASRC0_CTL1:
1176*af3d54b9SSrinivas Kandagatla 	case CDC_RX_EC_ASRC0_FIFO_CTL:
1177*af3d54b9SSrinivas Kandagatla 	case CDC_RX_EC_ASRC1_CLK_RST_CTL:
1178*af3d54b9SSrinivas Kandagatla 	case CDC_RX_EC_ASRC1_CTL0:
1179*af3d54b9SSrinivas Kandagatla 	case CDC_RX_EC_ASRC1_CTL1:
1180*af3d54b9SSrinivas Kandagatla 	case CDC_RX_EC_ASRC1_FIFO_CTL:
1181*af3d54b9SSrinivas Kandagatla 	case CDC_RX_EC_ASRC2_CLK_RST_CTL:
1182*af3d54b9SSrinivas Kandagatla 	case CDC_RX_EC_ASRC2_CTL0:
1183*af3d54b9SSrinivas Kandagatla 	case CDC_RX_EC_ASRC2_CTL1:
1184*af3d54b9SSrinivas Kandagatla 	case CDC_RX_EC_ASRC2_FIFO_CTL:
1185*af3d54b9SSrinivas Kandagatla 	case CDC_RX_DSD0_PATH_CTL:
1186*af3d54b9SSrinivas Kandagatla 	case CDC_RX_DSD0_CFG0:
1187*af3d54b9SSrinivas Kandagatla 	case CDC_RX_DSD0_CFG1:
1188*af3d54b9SSrinivas Kandagatla 	case CDC_RX_DSD0_CFG2:
1189*af3d54b9SSrinivas Kandagatla 	case CDC_RX_DSD1_PATH_CTL:
1190*af3d54b9SSrinivas Kandagatla 	case CDC_RX_DSD1_CFG0:
1191*af3d54b9SSrinivas Kandagatla 	case CDC_RX_DSD1_CFG1:
1192*af3d54b9SSrinivas Kandagatla 	case CDC_RX_DSD1_CFG2:
1193*af3d54b9SSrinivas Kandagatla 		return true;
1194*af3d54b9SSrinivas Kandagatla 	}
1195*af3d54b9SSrinivas Kandagatla 
1196*af3d54b9SSrinivas Kandagatla 	return false;
1197*af3d54b9SSrinivas Kandagatla }
1198*af3d54b9SSrinivas Kandagatla 
1199*af3d54b9SSrinivas Kandagatla static bool rx_is_writeable_register(struct device *dev, unsigned int reg)
1200*af3d54b9SSrinivas Kandagatla {
1201*af3d54b9SSrinivas Kandagatla 	bool ret;
1202*af3d54b9SSrinivas Kandagatla 
1203*af3d54b9SSrinivas Kandagatla 	ret = rx_is_rw_register(dev, reg);
1204*af3d54b9SSrinivas Kandagatla 	if (!ret)
1205*af3d54b9SSrinivas Kandagatla 		return rx_is_wronly_register(dev, reg);
1206*af3d54b9SSrinivas Kandagatla 
1207*af3d54b9SSrinivas Kandagatla 	return ret;
1208*af3d54b9SSrinivas Kandagatla }
1209*af3d54b9SSrinivas Kandagatla 
1210*af3d54b9SSrinivas Kandagatla static bool rx_is_readable_register(struct device *dev, unsigned int reg)
1211*af3d54b9SSrinivas Kandagatla {
1212*af3d54b9SSrinivas Kandagatla 	switch (reg) {
1213*af3d54b9SSrinivas Kandagatla 	case CDC_RX_TOP_HPHL_COMP_RD_LSB:
1214*af3d54b9SSrinivas Kandagatla 	case CDC_RX_TOP_HPHL_COMP_RD_MSB:
1215*af3d54b9SSrinivas Kandagatla 	case CDC_RX_TOP_HPHR_COMP_RD_LSB:
1216*af3d54b9SSrinivas Kandagatla 	case CDC_RX_TOP_HPHR_COMP_RD_MSB:
1217*af3d54b9SSrinivas Kandagatla 	case CDC_RX_TOP_DSD0_DEBUG_CFG2:
1218*af3d54b9SSrinivas Kandagatla 	case CDC_RX_TOP_DSD1_DEBUG_CFG2:
1219*af3d54b9SSrinivas Kandagatla 	case CDC_RX_BCL_VBAT_GAIN_MON_VAL:
1220*af3d54b9SSrinivas Kandagatla 	case CDC_RX_BCL_VBAT_DECODE_ST:
1221*af3d54b9SSrinivas Kandagatla 	case CDC_RX_INTR_CTRL_PIN1_STATUS0:
1222*af3d54b9SSrinivas Kandagatla 	case CDC_RX_INTR_CTRL_PIN2_STATUS0:
1223*af3d54b9SSrinivas Kandagatla 	case CDC_RX_COMPANDER0_CTL6:
1224*af3d54b9SSrinivas Kandagatla 	case CDC_RX_COMPANDER1_CTL6:
1225*af3d54b9SSrinivas Kandagatla 	case CDC_RX_EC_ASRC0_STATUS_FMIN_CNTR_LSB:
1226*af3d54b9SSrinivas Kandagatla 	case CDC_RX_EC_ASRC0_STATUS_FMIN_CNTR_MSB:
1227*af3d54b9SSrinivas Kandagatla 	case CDC_RX_EC_ASRC0_STATUS_FMAX_CNTR_LSB:
1228*af3d54b9SSrinivas Kandagatla 	case CDC_RX_EC_ASRC0_STATUS_FMAX_CNTR_MSB:
1229*af3d54b9SSrinivas Kandagatla 	case CDC_RX_EC_ASRC0_STATUS_FIFO:
1230*af3d54b9SSrinivas Kandagatla 	case CDC_RX_EC_ASRC1_STATUS_FMIN_CNTR_LSB:
1231*af3d54b9SSrinivas Kandagatla 	case CDC_RX_EC_ASRC1_STATUS_FMIN_CNTR_MSB:
1232*af3d54b9SSrinivas Kandagatla 	case CDC_RX_EC_ASRC1_STATUS_FMAX_CNTR_LSB:
1233*af3d54b9SSrinivas Kandagatla 	case CDC_RX_EC_ASRC1_STATUS_FMAX_CNTR_MSB:
1234*af3d54b9SSrinivas Kandagatla 	case CDC_RX_EC_ASRC1_STATUS_FIFO:
1235*af3d54b9SSrinivas Kandagatla 	case CDC_RX_EC_ASRC2_STATUS_FMIN_CNTR_LSB:
1236*af3d54b9SSrinivas Kandagatla 	case CDC_RX_EC_ASRC2_STATUS_FMIN_CNTR_MSB:
1237*af3d54b9SSrinivas Kandagatla 	case CDC_RX_EC_ASRC2_STATUS_FMAX_CNTR_LSB:
1238*af3d54b9SSrinivas Kandagatla 	case CDC_RX_EC_ASRC2_STATUS_FMAX_CNTR_MSB:
1239*af3d54b9SSrinivas Kandagatla 	case CDC_RX_EC_ASRC2_STATUS_FIFO:
1240*af3d54b9SSrinivas Kandagatla 		return true;
1241*af3d54b9SSrinivas Kandagatla 	}
1242*af3d54b9SSrinivas Kandagatla 
1243*af3d54b9SSrinivas Kandagatla 	return rx_is_rw_register(dev, reg);
1244*af3d54b9SSrinivas Kandagatla }
1245*af3d54b9SSrinivas Kandagatla 
1246*af3d54b9SSrinivas Kandagatla static const struct regmap_config rx_regmap_config = {
1247*af3d54b9SSrinivas Kandagatla 	.name = "rx_macro",
1248*af3d54b9SSrinivas Kandagatla 	.reg_bits = 16,
1249*af3d54b9SSrinivas Kandagatla 	.val_bits = 32, /* 8 but with 32 bit read/write */
1250*af3d54b9SSrinivas Kandagatla 	.reg_stride = 4,
1251*af3d54b9SSrinivas Kandagatla 	.cache_type = REGCACHE_FLAT,
1252*af3d54b9SSrinivas Kandagatla 	.reg_defaults = rx_defaults,
1253*af3d54b9SSrinivas Kandagatla 	.num_reg_defaults = ARRAY_SIZE(rx_defaults),
1254*af3d54b9SSrinivas Kandagatla 	.max_register = RX_MAX_OFFSET,
1255*af3d54b9SSrinivas Kandagatla 	.writeable_reg = rx_is_writeable_register,
1256*af3d54b9SSrinivas Kandagatla 	.volatile_reg = rx_is_volatile_register,
1257*af3d54b9SSrinivas Kandagatla 	.readable_reg = rx_is_readable_register,
1258*af3d54b9SSrinivas Kandagatla };
1259*af3d54b9SSrinivas Kandagatla 
1260*af3d54b9SSrinivas Kandagatla static int rx_macro_set_prim_interpolator_rate(struct snd_soc_dai *dai,
1261*af3d54b9SSrinivas Kandagatla 					       int rate_reg_val, u32 sample_rate)
1262*af3d54b9SSrinivas Kandagatla {
1263*af3d54b9SSrinivas Kandagatla 
1264*af3d54b9SSrinivas Kandagatla 	u8 int_1_mix1_inp;
1265*af3d54b9SSrinivas Kandagatla 	u32 j, port;
1266*af3d54b9SSrinivas Kandagatla 	u16 int_mux_cfg0, int_mux_cfg1;
1267*af3d54b9SSrinivas Kandagatla 	u16 int_fs_reg;
1268*af3d54b9SSrinivas Kandagatla 	u8 inp0_sel, inp1_sel, inp2_sel;
1269*af3d54b9SSrinivas Kandagatla 	struct snd_soc_component *component = dai->component;
1270*af3d54b9SSrinivas Kandagatla 	struct rx_macro *rx = snd_soc_component_get_drvdata(component);
1271*af3d54b9SSrinivas Kandagatla 
1272*af3d54b9SSrinivas Kandagatla 	for_each_set_bit(port, &rx->active_ch_mask[dai->id], RX_MACRO_PORTS_MAX) {
1273*af3d54b9SSrinivas Kandagatla 		int_1_mix1_inp = port;
1274*af3d54b9SSrinivas Kandagatla 		int_mux_cfg0 = CDC_RX_INP_MUX_RX_INT0_CFG0;
1275*af3d54b9SSrinivas Kandagatla 		/*
1276*af3d54b9SSrinivas Kandagatla 		 * Loop through all interpolator MUX inputs and find out
1277*af3d54b9SSrinivas Kandagatla 		 * to which interpolator input, the rx port
1278*af3d54b9SSrinivas Kandagatla 		 * is connected
1279*af3d54b9SSrinivas Kandagatla 		 */
1280*af3d54b9SSrinivas Kandagatla 		for (j = 0; j < INTERP_MAX; j++) {
1281*af3d54b9SSrinivas Kandagatla 			int_mux_cfg1 = int_mux_cfg0 + 4;
1282*af3d54b9SSrinivas Kandagatla 
1283*af3d54b9SSrinivas Kandagatla 			inp0_sel = snd_soc_component_read_field(component, int_mux_cfg0,
1284*af3d54b9SSrinivas Kandagatla 								CDC_RX_INTX_1_MIX_INP0_SEL_MASK);
1285*af3d54b9SSrinivas Kandagatla 			inp1_sel = snd_soc_component_read_field(component, int_mux_cfg0,
1286*af3d54b9SSrinivas Kandagatla 								CDC_RX_INTX_1_MIX_INP1_SEL_MASK);
1287*af3d54b9SSrinivas Kandagatla 			inp2_sel = snd_soc_component_read_field(component, int_mux_cfg1,
1288*af3d54b9SSrinivas Kandagatla 								CDC_RX_INTX_1_MIX_INP2_SEL_MASK);
1289*af3d54b9SSrinivas Kandagatla 
1290*af3d54b9SSrinivas Kandagatla 			if ((inp0_sel == int_1_mix1_inp + INTn_1_INP_SEL_RX0) ||
1291*af3d54b9SSrinivas Kandagatla 			    (inp1_sel == int_1_mix1_inp + INTn_1_INP_SEL_RX0) ||
1292*af3d54b9SSrinivas Kandagatla 			    (inp2_sel == int_1_mix1_inp + INTn_1_INP_SEL_RX0)) {
1293*af3d54b9SSrinivas Kandagatla 				int_fs_reg = CDC_RX_RXn_RX_PATH_CTL(j);
1294*af3d54b9SSrinivas Kandagatla 				/* sample_rate is in Hz */
1295*af3d54b9SSrinivas Kandagatla 				snd_soc_component_update_bits(component, int_fs_reg,
1296*af3d54b9SSrinivas Kandagatla 							      CDC_RX_PATH_PCM_RATE_MASK,
1297*af3d54b9SSrinivas Kandagatla 							      rate_reg_val);
1298*af3d54b9SSrinivas Kandagatla 			}
1299*af3d54b9SSrinivas Kandagatla 			int_mux_cfg0 += 8;
1300*af3d54b9SSrinivas Kandagatla 		}
1301*af3d54b9SSrinivas Kandagatla 	}
1302*af3d54b9SSrinivas Kandagatla 
1303*af3d54b9SSrinivas Kandagatla 	return 0;
1304*af3d54b9SSrinivas Kandagatla }
1305*af3d54b9SSrinivas Kandagatla 
1306*af3d54b9SSrinivas Kandagatla static int rx_macro_set_mix_interpolator_rate(struct snd_soc_dai *dai,
1307*af3d54b9SSrinivas Kandagatla 					      int rate_reg_val, u32 sample_rate)
1308*af3d54b9SSrinivas Kandagatla {
1309*af3d54b9SSrinivas Kandagatla 
1310*af3d54b9SSrinivas Kandagatla 	u8 int_2_inp;
1311*af3d54b9SSrinivas Kandagatla 	u32 j, port;
1312*af3d54b9SSrinivas Kandagatla 	u16 int_mux_cfg1, int_fs_reg;
1313*af3d54b9SSrinivas Kandagatla 	u8 int_mux_cfg1_val;
1314*af3d54b9SSrinivas Kandagatla 	struct snd_soc_component *component = dai->component;
1315*af3d54b9SSrinivas Kandagatla 	struct rx_macro *rx = snd_soc_component_get_drvdata(component);
1316*af3d54b9SSrinivas Kandagatla 
1317*af3d54b9SSrinivas Kandagatla 	for_each_set_bit(port, &rx->active_ch_mask[dai->id], RX_MACRO_PORTS_MAX) {
1318*af3d54b9SSrinivas Kandagatla 		int_2_inp = port;
1319*af3d54b9SSrinivas Kandagatla 
1320*af3d54b9SSrinivas Kandagatla 		int_mux_cfg1 = CDC_RX_INP_MUX_RX_INT0_CFG1;
1321*af3d54b9SSrinivas Kandagatla 		for (j = 0; j < INTERP_MAX; j++) {
1322*af3d54b9SSrinivas Kandagatla 			int_mux_cfg1_val = snd_soc_component_read_field(component, int_mux_cfg1,
1323*af3d54b9SSrinivas Kandagatla 									CDC_RX_INTX_2_SEL_MASK);
1324*af3d54b9SSrinivas Kandagatla 
1325*af3d54b9SSrinivas Kandagatla 			if (int_mux_cfg1_val == int_2_inp + INTn_2_INP_SEL_RX0) {
1326*af3d54b9SSrinivas Kandagatla 				int_fs_reg = CDC_RX_RXn_RX_PATH_MIX_CTL(j);
1327*af3d54b9SSrinivas Kandagatla 				snd_soc_component_update_bits(component, int_fs_reg,
1328*af3d54b9SSrinivas Kandagatla 							      CDC_RX_RXn_MIX_PCM_RATE_MASK,
1329*af3d54b9SSrinivas Kandagatla 							      rate_reg_val);
1330*af3d54b9SSrinivas Kandagatla 			}
1331*af3d54b9SSrinivas Kandagatla 			int_mux_cfg1 += 8;
1332*af3d54b9SSrinivas Kandagatla 		}
1333*af3d54b9SSrinivas Kandagatla 	}
1334*af3d54b9SSrinivas Kandagatla 	return 0;
1335*af3d54b9SSrinivas Kandagatla }
1336*af3d54b9SSrinivas Kandagatla 
1337*af3d54b9SSrinivas Kandagatla static int rx_macro_set_interpolator_rate(struct snd_soc_dai *dai,
1338*af3d54b9SSrinivas Kandagatla 					  u32 sample_rate)
1339*af3d54b9SSrinivas Kandagatla {
1340*af3d54b9SSrinivas Kandagatla 	int rate_val = 0;
1341*af3d54b9SSrinivas Kandagatla 	int i, ret;
1342*af3d54b9SSrinivas Kandagatla 
1343*af3d54b9SSrinivas Kandagatla 	for (i = 0; i < ARRAY_SIZE(sr_val_tbl); i++)
1344*af3d54b9SSrinivas Kandagatla 		if (sample_rate == sr_val_tbl[i].sample_rate)
1345*af3d54b9SSrinivas Kandagatla 			rate_val = sr_val_tbl[i].rate_val;
1346*af3d54b9SSrinivas Kandagatla 
1347*af3d54b9SSrinivas Kandagatla 	ret = rx_macro_set_prim_interpolator_rate(dai, rate_val, sample_rate);
1348*af3d54b9SSrinivas Kandagatla 	if (ret)
1349*af3d54b9SSrinivas Kandagatla 		return ret;
1350*af3d54b9SSrinivas Kandagatla 
1351*af3d54b9SSrinivas Kandagatla 	ret = rx_macro_set_mix_interpolator_rate(dai, rate_val, sample_rate);
1352*af3d54b9SSrinivas Kandagatla 	if (ret)
1353*af3d54b9SSrinivas Kandagatla 		return ret;
1354*af3d54b9SSrinivas Kandagatla 
1355*af3d54b9SSrinivas Kandagatla 	return ret;
1356*af3d54b9SSrinivas Kandagatla }
1357*af3d54b9SSrinivas Kandagatla 
1358*af3d54b9SSrinivas Kandagatla static int rx_macro_hw_params(struct snd_pcm_substream *substream,
1359*af3d54b9SSrinivas Kandagatla 			      struct snd_pcm_hw_params *params,
1360*af3d54b9SSrinivas Kandagatla 			      struct snd_soc_dai *dai)
1361*af3d54b9SSrinivas Kandagatla {
1362*af3d54b9SSrinivas Kandagatla 	struct snd_soc_component *component = dai->component;
1363*af3d54b9SSrinivas Kandagatla 	struct rx_macro *rx = snd_soc_component_get_drvdata(component);
1364*af3d54b9SSrinivas Kandagatla 	int ret;
1365*af3d54b9SSrinivas Kandagatla 
1366*af3d54b9SSrinivas Kandagatla 	switch (substream->stream) {
1367*af3d54b9SSrinivas Kandagatla 	case SNDRV_PCM_STREAM_PLAYBACK:
1368*af3d54b9SSrinivas Kandagatla 		ret = rx_macro_set_interpolator_rate(dai, params_rate(params));
1369*af3d54b9SSrinivas Kandagatla 		if (ret) {
1370*af3d54b9SSrinivas Kandagatla 			dev_err(component->dev, "%s: cannot set sample rate: %u\n",
1371*af3d54b9SSrinivas Kandagatla 				__func__, params_rate(params));
1372*af3d54b9SSrinivas Kandagatla 			return ret;
1373*af3d54b9SSrinivas Kandagatla 		}
1374*af3d54b9SSrinivas Kandagatla 		rx->bit_width[dai->id] = params_width(params);
1375*af3d54b9SSrinivas Kandagatla 		break;
1376*af3d54b9SSrinivas Kandagatla 	default:
1377*af3d54b9SSrinivas Kandagatla 		break;
1378*af3d54b9SSrinivas Kandagatla 	}
1379*af3d54b9SSrinivas Kandagatla 	return 0;
1380*af3d54b9SSrinivas Kandagatla }
1381*af3d54b9SSrinivas Kandagatla 
1382*af3d54b9SSrinivas Kandagatla static int rx_macro_get_channel_map(struct snd_soc_dai *dai,
1383*af3d54b9SSrinivas Kandagatla 				    unsigned int *tx_num, unsigned int *tx_slot,
1384*af3d54b9SSrinivas Kandagatla 				    unsigned int *rx_num, unsigned int *rx_slot)
1385*af3d54b9SSrinivas Kandagatla {
1386*af3d54b9SSrinivas Kandagatla 	struct snd_soc_component *component = dai->component;
1387*af3d54b9SSrinivas Kandagatla 	struct rx_macro *rx = snd_soc_component_get_drvdata(component);
1388*af3d54b9SSrinivas Kandagatla 	u16 val, mask = 0, cnt = 0, temp;
1389*af3d54b9SSrinivas Kandagatla 
1390*af3d54b9SSrinivas Kandagatla 	switch (dai->id) {
1391*af3d54b9SSrinivas Kandagatla 	case RX_MACRO_AIF1_PB:
1392*af3d54b9SSrinivas Kandagatla 	case RX_MACRO_AIF2_PB:
1393*af3d54b9SSrinivas Kandagatla 	case RX_MACRO_AIF3_PB:
1394*af3d54b9SSrinivas Kandagatla 	case RX_MACRO_AIF4_PB:
1395*af3d54b9SSrinivas Kandagatla 		for_each_set_bit(temp, &rx->active_ch_mask[dai->id],
1396*af3d54b9SSrinivas Kandagatla 			 RX_MACRO_PORTS_MAX) {
1397*af3d54b9SSrinivas Kandagatla 			mask |= (1 << temp);
1398*af3d54b9SSrinivas Kandagatla 			if (++cnt == RX_MACRO_MAX_DMA_CH_PER_PORT)
1399*af3d54b9SSrinivas Kandagatla 				break;
1400*af3d54b9SSrinivas Kandagatla 		}
1401*af3d54b9SSrinivas Kandagatla 		/*
1402*af3d54b9SSrinivas Kandagatla 		 * CDC_DMA_RX_0 port drives RX0/RX1 -- ch_mask 0x1/0x2/0x3
1403*af3d54b9SSrinivas Kandagatla 		 * CDC_DMA_RX_1 port drives RX2/RX3 -- ch_mask 0x1/0x2/0x3
1404*af3d54b9SSrinivas Kandagatla 		 * CDC_DMA_RX_2 port drives RX4     -- ch_mask 0x1
1405*af3d54b9SSrinivas Kandagatla 		 * CDC_DMA_RX_3 port drives RX5     -- ch_mask 0x1
1406*af3d54b9SSrinivas Kandagatla 		 * AIFn can pair to any CDC_DMA_RX_n port.
1407*af3d54b9SSrinivas Kandagatla 		 * In general, below convention is used::
1408*af3d54b9SSrinivas Kandagatla 		 * CDC_DMA_RX_0(AIF1)/CDC_DMA_RX_1(AIF2)/
1409*af3d54b9SSrinivas Kandagatla 		 * CDC_DMA_RX_2(AIF3)/CDC_DMA_RX_3(AIF4)
1410*af3d54b9SSrinivas Kandagatla 		 */
1411*af3d54b9SSrinivas Kandagatla 		if (mask & 0x0C)
1412*af3d54b9SSrinivas Kandagatla 			mask = mask >> 2;
1413*af3d54b9SSrinivas Kandagatla 		if ((mask & 0x10) || (mask & 0x20))
1414*af3d54b9SSrinivas Kandagatla 			mask = 0x1;
1415*af3d54b9SSrinivas Kandagatla 		*rx_slot = mask;
1416*af3d54b9SSrinivas Kandagatla 		*rx_num = rx->active_ch_cnt[dai->id];
1417*af3d54b9SSrinivas Kandagatla 		break;
1418*af3d54b9SSrinivas Kandagatla 	case RX_MACRO_AIF_ECHO:
1419*af3d54b9SSrinivas Kandagatla 		val = snd_soc_component_read(component,	CDC_RX_INP_MUX_RX_MIX_CFG4);
1420*af3d54b9SSrinivas Kandagatla 		if (val & RX_MACRO_EC_MIX_TX0_MASK) {
1421*af3d54b9SSrinivas Kandagatla 			mask |= 0x1;
1422*af3d54b9SSrinivas Kandagatla 			cnt++;
1423*af3d54b9SSrinivas Kandagatla 		}
1424*af3d54b9SSrinivas Kandagatla 		if (val & RX_MACRO_EC_MIX_TX1_MASK) {
1425*af3d54b9SSrinivas Kandagatla 			mask |= 0x2;
1426*af3d54b9SSrinivas Kandagatla 			cnt++;
1427*af3d54b9SSrinivas Kandagatla 		}
1428*af3d54b9SSrinivas Kandagatla 		val = snd_soc_component_read(component,
1429*af3d54b9SSrinivas Kandagatla 			CDC_RX_INP_MUX_RX_MIX_CFG5);
1430*af3d54b9SSrinivas Kandagatla 		if (val & RX_MACRO_EC_MIX_TX2_MASK) {
1431*af3d54b9SSrinivas Kandagatla 			mask |= 0x4;
1432*af3d54b9SSrinivas Kandagatla 			cnt++;
1433*af3d54b9SSrinivas Kandagatla 		}
1434*af3d54b9SSrinivas Kandagatla 		*tx_slot = mask;
1435*af3d54b9SSrinivas Kandagatla 		*tx_num = cnt;
1436*af3d54b9SSrinivas Kandagatla 		break;
1437*af3d54b9SSrinivas Kandagatla 	default:
1438*af3d54b9SSrinivas Kandagatla 		dev_err(component->dev, "%s: Invalid AIF\n", __func__);
1439*af3d54b9SSrinivas Kandagatla 		break;
1440*af3d54b9SSrinivas Kandagatla 	}
1441*af3d54b9SSrinivas Kandagatla 	return 0;
1442*af3d54b9SSrinivas Kandagatla }
1443*af3d54b9SSrinivas Kandagatla 
1444*af3d54b9SSrinivas Kandagatla static int rx_macro_digital_mute(struct snd_soc_dai *dai, int mute, int stream)
1445*af3d54b9SSrinivas Kandagatla {
1446*af3d54b9SSrinivas Kandagatla 	struct snd_soc_component *component = dai->component;
1447*af3d54b9SSrinivas Kandagatla 	uint16_t j, reg, mix_reg, dsm_reg;
1448*af3d54b9SSrinivas Kandagatla 	u16 int_mux_cfg0, int_mux_cfg1;
1449*af3d54b9SSrinivas Kandagatla 	u8 int_mux_cfg0_val, int_mux_cfg1_val;
1450*af3d54b9SSrinivas Kandagatla 
1451*af3d54b9SSrinivas Kandagatla 	switch (dai->id) {
1452*af3d54b9SSrinivas Kandagatla 	case RX_MACRO_AIF1_PB:
1453*af3d54b9SSrinivas Kandagatla 	case RX_MACRO_AIF2_PB:
1454*af3d54b9SSrinivas Kandagatla 	case RX_MACRO_AIF3_PB:
1455*af3d54b9SSrinivas Kandagatla 	case RX_MACRO_AIF4_PB:
1456*af3d54b9SSrinivas Kandagatla 	for (j = 0; j < INTERP_MAX; j++) {
1457*af3d54b9SSrinivas Kandagatla 		reg = CDC_RX_RXn_RX_PATH_CTL(j);
1458*af3d54b9SSrinivas Kandagatla 		mix_reg = CDC_RX_RXn_RX_PATH_MIX_CTL(j);
1459*af3d54b9SSrinivas Kandagatla 		dsm_reg = CDC_RX_RXn_RX_PATH_DSM_CTL(j);
1460*af3d54b9SSrinivas Kandagatla 
1461*af3d54b9SSrinivas Kandagatla 		if (mute) {
1462*af3d54b9SSrinivas Kandagatla 			snd_soc_component_update_bits(component, reg,
1463*af3d54b9SSrinivas Kandagatla 						      CDC_RX_PATH_PGA_MUTE_MASK,
1464*af3d54b9SSrinivas Kandagatla 						      CDC_RX_PATH_PGA_MUTE_ENABLE);
1465*af3d54b9SSrinivas Kandagatla 			snd_soc_component_update_bits(component, mix_reg,
1466*af3d54b9SSrinivas Kandagatla 						      CDC_RX_PATH_PGA_MUTE_MASK,
1467*af3d54b9SSrinivas Kandagatla 						      CDC_RX_PATH_PGA_MUTE_ENABLE);
1468*af3d54b9SSrinivas Kandagatla 		} else {
1469*af3d54b9SSrinivas Kandagatla 			snd_soc_component_update_bits(component, reg,
1470*af3d54b9SSrinivas Kandagatla 						      CDC_RX_PATH_PGA_MUTE_MASK, 0x0);
1471*af3d54b9SSrinivas Kandagatla 			snd_soc_component_update_bits(component, mix_reg,
1472*af3d54b9SSrinivas Kandagatla 						      CDC_RX_PATH_PGA_MUTE_MASK, 0x0);
1473*af3d54b9SSrinivas Kandagatla 		}
1474*af3d54b9SSrinivas Kandagatla 
1475*af3d54b9SSrinivas Kandagatla 		if (j == INTERP_AUX)
1476*af3d54b9SSrinivas Kandagatla 			dsm_reg = CDC_RX_RX2_RX_PATH_DSM_CTL;
1477*af3d54b9SSrinivas Kandagatla 
1478*af3d54b9SSrinivas Kandagatla 		int_mux_cfg0 = CDC_RX_INP_MUX_RX_INT0_CFG0 + j * 8;
1479*af3d54b9SSrinivas Kandagatla 		int_mux_cfg1 = int_mux_cfg0 + 4;
1480*af3d54b9SSrinivas Kandagatla 		int_mux_cfg0_val = snd_soc_component_read(component, int_mux_cfg0);
1481*af3d54b9SSrinivas Kandagatla 		int_mux_cfg1_val = snd_soc_component_read(component, int_mux_cfg1);
1482*af3d54b9SSrinivas Kandagatla 
1483*af3d54b9SSrinivas Kandagatla 		if (snd_soc_component_read(component, dsm_reg) & 0x01) {
1484*af3d54b9SSrinivas Kandagatla 			if (int_mux_cfg0_val || (int_mux_cfg1_val & 0xF0))
1485*af3d54b9SSrinivas Kandagatla 				snd_soc_component_update_bits(component, reg, 0x20, 0x20);
1486*af3d54b9SSrinivas Kandagatla 			if (int_mux_cfg1_val & 0x0F) {
1487*af3d54b9SSrinivas Kandagatla 				snd_soc_component_update_bits(component, reg, 0x20, 0x20);
1488*af3d54b9SSrinivas Kandagatla 				snd_soc_component_update_bits(component, mix_reg, 0x20, 0x20);
1489*af3d54b9SSrinivas Kandagatla 			}
1490*af3d54b9SSrinivas Kandagatla 		}
1491*af3d54b9SSrinivas Kandagatla 	}
1492*af3d54b9SSrinivas Kandagatla 		break;
1493*af3d54b9SSrinivas Kandagatla 	default:
1494*af3d54b9SSrinivas Kandagatla 		break;
1495*af3d54b9SSrinivas Kandagatla 	}
1496*af3d54b9SSrinivas Kandagatla 	return 0;
1497*af3d54b9SSrinivas Kandagatla }
1498*af3d54b9SSrinivas Kandagatla 
1499*af3d54b9SSrinivas Kandagatla static struct snd_soc_dai_ops rx_macro_dai_ops = {
1500*af3d54b9SSrinivas Kandagatla 	.hw_params = rx_macro_hw_params,
1501*af3d54b9SSrinivas Kandagatla 	.get_channel_map = rx_macro_get_channel_map,
1502*af3d54b9SSrinivas Kandagatla 	.mute_stream = rx_macro_digital_mute,
1503*af3d54b9SSrinivas Kandagatla };
1504*af3d54b9SSrinivas Kandagatla 
1505*af3d54b9SSrinivas Kandagatla static struct snd_soc_dai_driver rx_macro_dai[] = {
1506*af3d54b9SSrinivas Kandagatla 	{
1507*af3d54b9SSrinivas Kandagatla 		.name = "rx_macro_rx1",
1508*af3d54b9SSrinivas Kandagatla 		.id = RX_MACRO_AIF1_PB,
1509*af3d54b9SSrinivas Kandagatla 		.playback = {
1510*af3d54b9SSrinivas Kandagatla 			.stream_name = "RX_MACRO_AIF1 Playback",
1511*af3d54b9SSrinivas Kandagatla 			.rates = RX_MACRO_RATES | RX_MACRO_FRAC_RATES,
1512*af3d54b9SSrinivas Kandagatla 			.formats = RX_MACRO_FORMATS,
1513*af3d54b9SSrinivas Kandagatla 			.rate_max = 384000,
1514*af3d54b9SSrinivas Kandagatla 			.rate_min = 8000,
1515*af3d54b9SSrinivas Kandagatla 			.channels_min = 1,
1516*af3d54b9SSrinivas Kandagatla 			.channels_max = 2,
1517*af3d54b9SSrinivas Kandagatla 		},
1518*af3d54b9SSrinivas Kandagatla 		.ops = &rx_macro_dai_ops,
1519*af3d54b9SSrinivas Kandagatla 	},
1520*af3d54b9SSrinivas Kandagatla 	{
1521*af3d54b9SSrinivas Kandagatla 		.name = "rx_macro_rx2",
1522*af3d54b9SSrinivas Kandagatla 		.id = RX_MACRO_AIF2_PB,
1523*af3d54b9SSrinivas Kandagatla 		.playback = {
1524*af3d54b9SSrinivas Kandagatla 			.stream_name = "RX_MACRO_AIF2 Playback",
1525*af3d54b9SSrinivas Kandagatla 			.rates = RX_MACRO_RATES | RX_MACRO_FRAC_RATES,
1526*af3d54b9SSrinivas Kandagatla 			.formats = RX_MACRO_FORMATS,
1527*af3d54b9SSrinivas Kandagatla 			.rate_max = 384000,
1528*af3d54b9SSrinivas Kandagatla 			.rate_min = 8000,
1529*af3d54b9SSrinivas Kandagatla 			.channels_min = 1,
1530*af3d54b9SSrinivas Kandagatla 			.channels_max = 2,
1531*af3d54b9SSrinivas Kandagatla 		},
1532*af3d54b9SSrinivas Kandagatla 		.ops = &rx_macro_dai_ops,
1533*af3d54b9SSrinivas Kandagatla 	},
1534*af3d54b9SSrinivas Kandagatla 	{
1535*af3d54b9SSrinivas Kandagatla 		.name = "rx_macro_rx3",
1536*af3d54b9SSrinivas Kandagatla 		.id = RX_MACRO_AIF3_PB,
1537*af3d54b9SSrinivas Kandagatla 		.playback = {
1538*af3d54b9SSrinivas Kandagatla 			.stream_name = "RX_MACRO_AIF3 Playback",
1539*af3d54b9SSrinivas Kandagatla 			.rates = RX_MACRO_RATES | RX_MACRO_FRAC_RATES,
1540*af3d54b9SSrinivas Kandagatla 			.formats = RX_MACRO_FORMATS,
1541*af3d54b9SSrinivas Kandagatla 			.rate_max = 384000,
1542*af3d54b9SSrinivas Kandagatla 			.rate_min = 8000,
1543*af3d54b9SSrinivas Kandagatla 			.channels_min = 1,
1544*af3d54b9SSrinivas Kandagatla 			.channels_max = 2,
1545*af3d54b9SSrinivas Kandagatla 		},
1546*af3d54b9SSrinivas Kandagatla 		.ops = &rx_macro_dai_ops,
1547*af3d54b9SSrinivas Kandagatla 	},
1548*af3d54b9SSrinivas Kandagatla 	{
1549*af3d54b9SSrinivas Kandagatla 		.name = "rx_macro_rx4",
1550*af3d54b9SSrinivas Kandagatla 		.id = RX_MACRO_AIF4_PB,
1551*af3d54b9SSrinivas Kandagatla 		.playback = {
1552*af3d54b9SSrinivas Kandagatla 			.stream_name = "RX_MACRO_AIF4 Playback",
1553*af3d54b9SSrinivas Kandagatla 			.rates = RX_MACRO_RATES | RX_MACRO_FRAC_RATES,
1554*af3d54b9SSrinivas Kandagatla 			.formats = RX_MACRO_FORMATS,
1555*af3d54b9SSrinivas Kandagatla 			.rate_max = 384000,
1556*af3d54b9SSrinivas Kandagatla 			.rate_min = 8000,
1557*af3d54b9SSrinivas Kandagatla 			.channels_min = 1,
1558*af3d54b9SSrinivas Kandagatla 			.channels_max = 2,
1559*af3d54b9SSrinivas Kandagatla 		},
1560*af3d54b9SSrinivas Kandagatla 		.ops = &rx_macro_dai_ops,
1561*af3d54b9SSrinivas Kandagatla 	},
1562*af3d54b9SSrinivas Kandagatla 	{
1563*af3d54b9SSrinivas Kandagatla 		.name = "rx_macro_echo",
1564*af3d54b9SSrinivas Kandagatla 		.id = RX_MACRO_AIF_ECHO,
1565*af3d54b9SSrinivas Kandagatla 		.capture = {
1566*af3d54b9SSrinivas Kandagatla 			.stream_name = "RX_AIF_ECHO Capture",
1567*af3d54b9SSrinivas Kandagatla 			.rates = RX_MACRO_ECHO_RATES,
1568*af3d54b9SSrinivas Kandagatla 			.formats = RX_MACRO_ECHO_FORMATS,
1569*af3d54b9SSrinivas Kandagatla 			.rate_max = 48000,
1570*af3d54b9SSrinivas Kandagatla 			.rate_min = 8000,
1571*af3d54b9SSrinivas Kandagatla 			.channels_min = 1,
1572*af3d54b9SSrinivas Kandagatla 			.channels_max = 3,
1573*af3d54b9SSrinivas Kandagatla 		},
1574*af3d54b9SSrinivas Kandagatla 		.ops = &rx_macro_dai_ops,
1575*af3d54b9SSrinivas Kandagatla 	},
1576*af3d54b9SSrinivas Kandagatla };
1577*af3d54b9SSrinivas Kandagatla 
1578*af3d54b9SSrinivas Kandagatla static void rx_macro_mclk_enable(struct rx_macro *rx, bool mclk_enable)
1579*af3d54b9SSrinivas Kandagatla {
1580*af3d54b9SSrinivas Kandagatla 	struct regmap *regmap = rx->regmap;
1581*af3d54b9SSrinivas Kandagatla 
1582*af3d54b9SSrinivas Kandagatla 	if (mclk_enable) {
1583*af3d54b9SSrinivas Kandagatla 		if (rx->rx_mclk_users == 0) {
1584*af3d54b9SSrinivas Kandagatla 			regmap_update_bits(regmap, CDC_RX_CLK_RST_CTRL_MCLK_CONTROL,
1585*af3d54b9SSrinivas Kandagatla 					   CDC_RX_CLK_MCLK_EN_MASK |
1586*af3d54b9SSrinivas Kandagatla 					   CDC_RX_CLK_MCLK2_EN_MASK,
1587*af3d54b9SSrinivas Kandagatla 					   CDC_RX_CLK_MCLK_ENABLE |
1588*af3d54b9SSrinivas Kandagatla 					   CDC_RX_CLK_MCLK2_ENABLE);
1589*af3d54b9SSrinivas Kandagatla 			regmap_update_bits(regmap, CDC_RX_CLK_RST_CTRL_FS_CNT_CONTROL,
1590*af3d54b9SSrinivas Kandagatla 					   CDC_RX_FS_MCLK_CNT_CLR_MASK, 0x00);
1591*af3d54b9SSrinivas Kandagatla 			regmap_update_bits(regmap, CDC_RX_CLK_RST_CTRL_FS_CNT_CONTROL,
1592*af3d54b9SSrinivas Kandagatla 					   CDC_RX_FS_MCLK_CNT_EN_MASK,
1593*af3d54b9SSrinivas Kandagatla 					   CDC_RX_FS_MCLK_CNT_ENABLE);
1594*af3d54b9SSrinivas Kandagatla 			regcache_mark_dirty(regmap);
1595*af3d54b9SSrinivas Kandagatla 			regcache_sync(regmap);
1596*af3d54b9SSrinivas Kandagatla 		}
1597*af3d54b9SSrinivas Kandagatla 		rx->rx_mclk_users++;
1598*af3d54b9SSrinivas Kandagatla 	} else {
1599*af3d54b9SSrinivas Kandagatla 		if (rx->rx_mclk_users <= 0) {
1600*af3d54b9SSrinivas Kandagatla 			dev_err(rx->dev, "%s: clock already disabled\n", __func__);
1601*af3d54b9SSrinivas Kandagatla 			rx->rx_mclk_users = 0;
1602*af3d54b9SSrinivas Kandagatla 			return;
1603*af3d54b9SSrinivas Kandagatla 		}
1604*af3d54b9SSrinivas Kandagatla 		rx->rx_mclk_users--;
1605*af3d54b9SSrinivas Kandagatla 		if (rx->rx_mclk_users == 0) {
1606*af3d54b9SSrinivas Kandagatla 			regmap_update_bits(regmap, CDC_RX_CLK_RST_CTRL_FS_CNT_CONTROL,
1607*af3d54b9SSrinivas Kandagatla 					   CDC_RX_FS_MCLK_CNT_EN_MASK, 0x0);
1608*af3d54b9SSrinivas Kandagatla 			regmap_update_bits(regmap, CDC_RX_CLK_RST_CTRL_FS_CNT_CONTROL,
1609*af3d54b9SSrinivas Kandagatla 					   CDC_RX_FS_MCLK_CNT_CLR_MASK,
1610*af3d54b9SSrinivas Kandagatla 					   CDC_RX_FS_MCLK_CNT_CLR);
1611*af3d54b9SSrinivas Kandagatla 			regmap_update_bits(regmap, CDC_RX_CLK_RST_CTRL_MCLK_CONTROL,
1612*af3d54b9SSrinivas Kandagatla 					   CDC_RX_CLK_MCLK_EN_MASK |
1613*af3d54b9SSrinivas Kandagatla 					   CDC_RX_CLK_MCLK2_EN_MASK, 0x0);
1614*af3d54b9SSrinivas Kandagatla 		}
1615*af3d54b9SSrinivas Kandagatla 	}
1616*af3d54b9SSrinivas Kandagatla }
1617*af3d54b9SSrinivas Kandagatla 
1618*af3d54b9SSrinivas Kandagatla static inline void rx_macro_enable_clsh_block(struct rx_macro *rx, bool enable)
1619*af3d54b9SSrinivas Kandagatla {
1620*af3d54b9SSrinivas Kandagatla 	if ((enable && ++rx->clsh_users == 1) || (!enable && --rx->clsh_users == 0))
1621*af3d54b9SSrinivas Kandagatla 		snd_soc_component_update_bits(rx->component, CDC_RX_CLSH_CRC,
1622*af3d54b9SSrinivas Kandagatla 					     CDC_RX_CLSH_CLK_EN_MASK, enable);
1623*af3d54b9SSrinivas Kandagatla 	if (rx->clsh_users < 0)
1624*af3d54b9SSrinivas Kandagatla 		rx->clsh_users = 0;
1625*af3d54b9SSrinivas Kandagatla }
1626*af3d54b9SSrinivas Kandagatla 
1627*af3d54b9SSrinivas Kandagatla static int rx_macro_get_compander(struct snd_kcontrol *kcontrol,
1628*af3d54b9SSrinivas Kandagatla 			       struct snd_ctl_elem_value *ucontrol)
1629*af3d54b9SSrinivas Kandagatla {
1630*af3d54b9SSrinivas Kandagatla 	struct snd_soc_component *component =
1631*af3d54b9SSrinivas Kandagatla 				snd_soc_kcontrol_component(kcontrol);
1632*af3d54b9SSrinivas Kandagatla 	int comp = ((struct soc_mixer_control *) kcontrol->private_value)->shift;
1633*af3d54b9SSrinivas Kandagatla 	struct rx_macro *rx = snd_soc_component_get_drvdata(component);
1634*af3d54b9SSrinivas Kandagatla 
1635*af3d54b9SSrinivas Kandagatla 	ucontrol->value.integer.value[0] = rx->comp_enabled[comp];
1636*af3d54b9SSrinivas Kandagatla 	return 0;
1637*af3d54b9SSrinivas Kandagatla }
1638*af3d54b9SSrinivas Kandagatla 
1639*af3d54b9SSrinivas Kandagatla static int rx_macro_set_compander(struct snd_kcontrol *kcontrol,
1640*af3d54b9SSrinivas Kandagatla 			       struct snd_ctl_elem_value *ucontrol)
1641*af3d54b9SSrinivas Kandagatla {
1642*af3d54b9SSrinivas Kandagatla 	struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol);
1643*af3d54b9SSrinivas Kandagatla 	int comp = ((struct soc_mixer_control *)  kcontrol->private_value)->shift;
1644*af3d54b9SSrinivas Kandagatla 	int value = ucontrol->value.integer.value[0];
1645*af3d54b9SSrinivas Kandagatla 	struct rx_macro *rx = snd_soc_component_get_drvdata(component);
1646*af3d54b9SSrinivas Kandagatla 
1647*af3d54b9SSrinivas Kandagatla 	rx->comp_enabled[comp] = value;
1648*af3d54b9SSrinivas Kandagatla 
1649*af3d54b9SSrinivas Kandagatla 	return 0;
1650*af3d54b9SSrinivas Kandagatla }
1651*af3d54b9SSrinivas Kandagatla 
1652*af3d54b9SSrinivas Kandagatla static int rx_macro_get_ear_mode(struct snd_kcontrol *kcontrol,
1653*af3d54b9SSrinivas Kandagatla 			       struct snd_ctl_elem_value *ucontrol)
1654*af3d54b9SSrinivas Kandagatla {
1655*af3d54b9SSrinivas Kandagatla 	struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol);
1656*af3d54b9SSrinivas Kandagatla 	struct rx_macro *rx = snd_soc_component_get_drvdata(component);
1657*af3d54b9SSrinivas Kandagatla 
1658*af3d54b9SSrinivas Kandagatla 	ucontrol->value.integer.value[0] = rx->is_ear_mode_on;
1659*af3d54b9SSrinivas Kandagatla 	return 0;
1660*af3d54b9SSrinivas Kandagatla }
1661*af3d54b9SSrinivas Kandagatla 
1662*af3d54b9SSrinivas Kandagatla static int rx_macro_put_ear_mode(struct snd_kcontrol *kcontrol,
1663*af3d54b9SSrinivas Kandagatla 			       struct snd_ctl_elem_value *ucontrol)
1664*af3d54b9SSrinivas Kandagatla {
1665*af3d54b9SSrinivas Kandagatla 	struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol);
1666*af3d54b9SSrinivas Kandagatla 	struct rx_macro *rx = snd_soc_component_get_drvdata(component);
1667*af3d54b9SSrinivas Kandagatla 
1668*af3d54b9SSrinivas Kandagatla 	rx->is_ear_mode_on = (!ucontrol->value.integer.value[0] ? false : true);
1669*af3d54b9SSrinivas Kandagatla 	return 0;
1670*af3d54b9SSrinivas Kandagatla }
1671*af3d54b9SSrinivas Kandagatla 
1672*af3d54b9SSrinivas Kandagatla static int rx_macro_get_hph_hd2_mode(struct snd_kcontrol *kcontrol,
1673*af3d54b9SSrinivas Kandagatla 			       struct snd_ctl_elem_value *ucontrol)
1674*af3d54b9SSrinivas Kandagatla {
1675*af3d54b9SSrinivas Kandagatla 	struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol);
1676*af3d54b9SSrinivas Kandagatla 	struct rx_macro *rx = snd_soc_component_get_drvdata(component);
1677*af3d54b9SSrinivas Kandagatla 
1678*af3d54b9SSrinivas Kandagatla 	ucontrol->value.integer.value[0] = rx->hph_hd2_mode;
1679*af3d54b9SSrinivas Kandagatla 	return 0;
1680*af3d54b9SSrinivas Kandagatla }
1681*af3d54b9SSrinivas Kandagatla 
1682*af3d54b9SSrinivas Kandagatla static int rx_macro_put_hph_hd2_mode(struct snd_kcontrol *kcontrol,
1683*af3d54b9SSrinivas Kandagatla 			       struct snd_ctl_elem_value *ucontrol)
1684*af3d54b9SSrinivas Kandagatla {
1685*af3d54b9SSrinivas Kandagatla 	struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol);
1686*af3d54b9SSrinivas Kandagatla 	struct rx_macro *rx = snd_soc_component_get_drvdata(component);
1687*af3d54b9SSrinivas Kandagatla 
1688*af3d54b9SSrinivas Kandagatla 	rx->hph_hd2_mode = ucontrol->value.integer.value[0];
1689*af3d54b9SSrinivas Kandagatla 	return 0;
1690*af3d54b9SSrinivas Kandagatla }
1691*af3d54b9SSrinivas Kandagatla 
1692*af3d54b9SSrinivas Kandagatla static int rx_macro_get_hph_pwr_mode(struct snd_kcontrol *kcontrol,
1693*af3d54b9SSrinivas Kandagatla 			       struct snd_ctl_elem_value *ucontrol)
1694*af3d54b9SSrinivas Kandagatla {
1695*af3d54b9SSrinivas Kandagatla 	struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol);
1696*af3d54b9SSrinivas Kandagatla 	struct rx_macro *rx = snd_soc_component_get_drvdata(component);
1697*af3d54b9SSrinivas Kandagatla 
1698*af3d54b9SSrinivas Kandagatla 	ucontrol->value.integer.value[0] = rx->hph_pwr_mode;
1699*af3d54b9SSrinivas Kandagatla 	return 0;
1700*af3d54b9SSrinivas Kandagatla }
1701*af3d54b9SSrinivas Kandagatla 
1702*af3d54b9SSrinivas Kandagatla static int rx_macro_put_hph_pwr_mode(struct snd_kcontrol *kcontrol,
1703*af3d54b9SSrinivas Kandagatla 			       struct snd_ctl_elem_value *ucontrol)
1704*af3d54b9SSrinivas Kandagatla {
1705*af3d54b9SSrinivas Kandagatla 	struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol);
1706*af3d54b9SSrinivas Kandagatla 	struct rx_macro *rx = snd_soc_component_get_drvdata(component);
1707*af3d54b9SSrinivas Kandagatla 
1708*af3d54b9SSrinivas Kandagatla 	rx->hph_pwr_mode = ucontrol->value.integer.value[0];
1709*af3d54b9SSrinivas Kandagatla 	return 0;
1710*af3d54b9SSrinivas Kandagatla }
1711*af3d54b9SSrinivas Kandagatla 
1712*af3d54b9SSrinivas Kandagatla static int rx_macro_soft_clip_enable_get(struct snd_kcontrol *kcontrol,
1713*af3d54b9SSrinivas Kandagatla 					  struct snd_ctl_elem_value *ucontrol)
1714*af3d54b9SSrinivas Kandagatla {
1715*af3d54b9SSrinivas Kandagatla 	struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol);
1716*af3d54b9SSrinivas Kandagatla 	struct rx_macro *rx = snd_soc_component_get_drvdata(component);
1717*af3d54b9SSrinivas Kandagatla 
1718*af3d54b9SSrinivas Kandagatla 	ucontrol->value.integer.value[0] = rx->is_softclip_on;
1719*af3d54b9SSrinivas Kandagatla 
1720*af3d54b9SSrinivas Kandagatla 	return 0;
1721*af3d54b9SSrinivas Kandagatla }
1722*af3d54b9SSrinivas Kandagatla 
1723*af3d54b9SSrinivas Kandagatla static int rx_macro_soft_clip_enable_put(struct snd_kcontrol *kcontrol,
1724*af3d54b9SSrinivas Kandagatla 					  struct snd_ctl_elem_value *ucontrol)
1725*af3d54b9SSrinivas Kandagatla {
1726*af3d54b9SSrinivas Kandagatla 	struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol);
1727*af3d54b9SSrinivas Kandagatla 	struct rx_macro *rx = snd_soc_component_get_drvdata(component);
1728*af3d54b9SSrinivas Kandagatla 
1729*af3d54b9SSrinivas Kandagatla 	rx->is_softclip_on = ucontrol->value.integer.value[0];
1730*af3d54b9SSrinivas Kandagatla 
1731*af3d54b9SSrinivas Kandagatla 	return 0;
1732*af3d54b9SSrinivas Kandagatla }
1733*af3d54b9SSrinivas Kandagatla 
1734*af3d54b9SSrinivas Kandagatla static int rx_macro_aux_hpf_mode_get(struct snd_kcontrol *kcontrol,
1735*af3d54b9SSrinivas Kandagatla 					  struct snd_ctl_elem_value *ucontrol)
1736*af3d54b9SSrinivas Kandagatla {
1737*af3d54b9SSrinivas Kandagatla 	struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol);
1738*af3d54b9SSrinivas Kandagatla 	struct rx_macro *rx = snd_soc_component_get_drvdata(component);
1739*af3d54b9SSrinivas Kandagatla 
1740*af3d54b9SSrinivas Kandagatla 	ucontrol->value.integer.value[0] = rx->is_aux_hpf_on;
1741*af3d54b9SSrinivas Kandagatla 
1742*af3d54b9SSrinivas Kandagatla 	return 0;
1743*af3d54b9SSrinivas Kandagatla }
1744*af3d54b9SSrinivas Kandagatla 
1745*af3d54b9SSrinivas Kandagatla static int rx_macro_aux_hpf_mode_put(struct snd_kcontrol *kcontrol,
1746*af3d54b9SSrinivas Kandagatla 					  struct snd_ctl_elem_value *ucontrol)
1747*af3d54b9SSrinivas Kandagatla {
1748*af3d54b9SSrinivas Kandagatla 	struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol);
1749*af3d54b9SSrinivas Kandagatla 	struct rx_macro *rx = snd_soc_component_get_drvdata(component);
1750*af3d54b9SSrinivas Kandagatla 
1751*af3d54b9SSrinivas Kandagatla 	rx->is_aux_hpf_on = ucontrol->value.integer.value[0];
1752*af3d54b9SSrinivas Kandagatla 
1753*af3d54b9SSrinivas Kandagatla 	return 0;
1754*af3d54b9SSrinivas Kandagatla }
1755*af3d54b9SSrinivas Kandagatla 
1756*af3d54b9SSrinivas Kandagatla static const struct snd_kcontrol_new rx_macro_snd_controls[] = {
1757*af3d54b9SSrinivas Kandagatla 	SOC_SINGLE_S8_TLV("RX_RX0 Digital Volume", CDC_RX_RX0_RX_VOL_CTL,
1758*af3d54b9SSrinivas Kandagatla 			  -84, 40, digital_gain),
1759*af3d54b9SSrinivas Kandagatla 	SOC_SINGLE_S8_TLV("RX_RX1 Digital Volume", CDC_RX_RX1_RX_VOL_CTL,
1760*af3d54b9SSrinivas Kandagatla 			  -84, 40, digital_gain),
1761*af3d54b9SSrinivas Kandagatla 	SOC_SINGLE_S8_TLV("RX_RX2 Digital Volume", CDC_RX_RX2_RX_VOL_CTL,
1762*af3d54b9SSrinivas Kandagatla 			  -84, 40, digital_gain),
1763*af3d54b9SSrinivas Kandagatla 	SOC_SINGLE_S8_TLV("RX_RX0 Mix Digital Volume", CDC_RX_RX0_RX_VOL_MIX_CTL,
1764*af3d54b9SSrinivas Kandagatla 			  -84, 40, digital_gain),
1765*af3d54b9SSrinivas Kandagatla 	SOC_SINGLE_S8_TLV("RX_RX1 Mix Digital Volume", CDC_RX_RX1_RX_VOL_MIX_CTL,
1766*af3d54b9SSrinivas Kandagatla 			  -84, 40, digital_gain),
1767*af3d54b9SSrinivas Kandagatla 	SOC_SINGLE_S8_TLV("RX_RX2 Mix Digital Volume", CDC_RX_RX2_RX_VOL_MIX_CTL,
1768*af3d54b9SSrinivas Kandagatla 			  -84, 40, digital_gain),
1769*af3d54b9SSrinivas Kandagatla 
1770*af3d54b9SSrinivas Kandagatla 	SOC_SINGLE_EXT("RX_COMP1 Switch", SND_SOC_NOPM, RX_MACRO_COMP1, 1, 0,
1771*af3d54b9SSrinivas Kandagatla 		rx_macro_get_compander, rx_macro_set_compander),
1772*af3d54b9SSrinivas Kandagatla 	SOC_SINGLE_EXT("RX_COMP2 Switch", SND_SOC_NOPM, RX_MACRO_COMP2, 1, 0,
1773*af3d54b9SSrinivas Kandagatla 		rx_macro_get_compander, rx_macro_set_compander),
1774*af3d54b9SSrinivas Kandagatla 
1775*af3d54b9SSrinivas Kandagatla 	SOC_SINGLE_EXT("RX_EAR Mode Switch", SND_SOC_NOPM, 0, 1, 0,
1776*af3d54b9SSrinivas Kandagatla 		rx_macro_get_ear_mode, rx_macro_put_ear_mode),
1777*af3d54b9SSrinivas Kandagatla 
1778*af3d54b9SSrinivas Kandagatla 	SOC_SINGLE_EXT("RX_HPH HD2 Mode Switch", SND_SOC_NOPM, 0, 1, 0,
1779*af3d54b9SSrinivas Kandagatla 		rx_macro_get_hph_hd2_mode, rx_macro_put_hph_hd2_mode),
1780*af3d54b9SSrinivas Kandagatla 
1781*af3d54b9SSrinivas Kandagatla 	SOC_ENUM_EXT("RX_HPH PWR Mode", rx_macro_hph_pwr_mode_enum,
1782*af3d54b9SSrinivas Kandagatla 		rx_macro_get_hph_pwr_mode, rx_macro_put_hph_pwr_mode),
1783*af3d54b9SSrinivas Kandagatla 
1784*af3d54b9SSrinivas Kandagatla 	SOC_SINGLE_EXT("RX_Softclip Switch", SND_SOC_NOPM, 0, 1, 0,
1785*af3d54b9SSrinivas Kandagatla 		     rx_macro_soft_clip_enable_get,
1786*af3d54b9SSrinivas Kandagatla 		     rx_macro_soft_clip_enable_put),
1787*af3d54b9SSrinivas Kandagatla 	SOC_SINGLE_EXT("AUX_HPF Switch", SND_SOC_NOPM, 0, 1, 0,
1788*af3d54b9SSrinivas Kandagatla 			rx_macro_aux_hpf_mode_get,
1789*af3d54b9SSrinivas Kandagatla 			rx_macro_aux_hpf_mode_put),
1790*af3d54b9SSrinivas Kandagatla };
1791*af3d54b9SSrinivas Kandagatla 
1792*af3d54b9SSrinivas Kandagatla static int rx_macro_component_probe(struct snd_soc_component *component)
1793*af3d54b9SSrinivas Kandagatla {
1794*af3d54b9SSrinivas Kandagatla 	struct rx_macro *rx = snd_soc_component_get_drvdata(component);
1795*af3d54b9SSrinivas Kandagatla 
1796*af3d54b9SSrinivas Kandagatla 	snd_soc_component_init_regmap(component, rx->regmap);
1797*af3d54b9SSrinivas Kandagatla 
1798*af3d54b9SSrinivas Kandagatla 	snd_soc_component_update_bits(component, CDC_RX_RX0_RX_PATH_SEC7,
1799*af3d54b9SSrinivas Kandagatla 				      CDC_RX_DSM_OUT_DELAY_SEL_MASK,
1800*af3d54b9SSrinivas Kandagatla 				      CDC_RX_DSM_OUT_DELAY_TWO_SAMPLE);
1801*af3d54b9SSrinivas Kandagatla 	snd_soc_component_update_bits(component, CDC_RX_RX1_RX_PATH_SEC7,
1802*af3d54b9SSrinivas Kandagatla 				      CDC_RX_DSM_OUT_DELAY_SEL_MASK,
1803*af3d54b9SSrinivas Kandagatla 				      CDC_RX_DSM_OUT_DELAY_TWO_SAMPLE);
1804*af3d54b9SSrinivas Kandagatla 	snd_soc_component_update_bits(component, CDC_RX_RX2_RX_PATH_SEC7,
1805*af3d54b9SSrinivas Kandagatla 				      CDC_RX_DSM_OUT_DELAY_SEL_MASK,
1806*af3d54b9SSrinivas Kandagatla 				      CDC_RX_DSM_OUT_DELAY_TWO_SAMPLE);
1807*af3d54b9SSrinivas Kandagatla 	snd_soc_component_update_bits(component, CDC_RX_RX0_RX_PATH_CFG3,
1808*af3d54b9SSrinivas Kandagatla 				      CDC_RX_DC_COEFF_SEL_MASK,
1809*af3d54b9SSrinivas Kandagatla 				      CDC_RX_DC_COEFF_SEL_TWO);
1810*af3d54b9SSrinivas Kandagatla 	snd_soc_component_update_bits(component, CDC_RX_RX1_RX_PATH_CFG3,
1811*af3d54b9SSrinivas Kandagatla 				      CDC_RX_DC_COEFF_SEL_MASK,
1812*af3d54b9SSrinivas Kandagatla 				      CDC_RX_DC_COEFF_SEL_TWO);
1813*af3d54b9SSrinivas Kandagatla 	snd_soc_component_update_bits(component, CDC_RX_RX2_RX_PATH_CFG3,
1814*af3d54b9SSrinivas Kandagatla 				      CDC_RX_DC_COEFF_SEL_MASK,
1815*af3d54b9SSrinivas Kandagatla 				      CDC_RX_DC_COEFF_SEL_TWO);
1816*af3d54b9SSrinivas Kandagatla 
1817*af3d54b9SSrinivas Kandagatla 	rx->component = component;
1818*af3d54b9SSrinivas Kandagatla 
1819*af3d54b9SSrinivas Kandagatla 	return 0;
1820*af3d54b9SSrinivas Kandagatla }
1821*af3d54b9SSrinivas Kandagatla 
1822*af3d54b9SSrinivas Kandagatla static int swclk_gate_enable(struct clk_hw *hw)
1823*af3d54b9SSrinivas Kandagatla {
1824*af3d54b9SSrinivas Kandagatla 	struct rx_macro *rx = to_rx_macro(hw);
1825*af3d54b9SSrinivas Kandagatla 
1826*af3d54b9SSrinivas Kandagatla 	rx_macro_mclk_enable(rx, true);
1827*af3d54b9SSrinivas Kandagatla 	if (rx->reset_swr)
1828*af3d54b9SSrinivas Kandagatla 		regmap_update_bits(rx->regmap, CDC_RX_CLK_RST_CTRL_SWR_CONTROL,
1829*af3d54b9SSrinivas Kandagatla 				   CDC_RX_SWR_RESET_MASK,
1830*af3d54b9SSrinivas Kandagatla 				   CDC_RX_SWR_RESET);
1831*af3d54b9SSrinivas Kandagatla 
1832*af3d54b9SSrinivas Kandagatla 	regmap_update_bits(rx->regmap, CDC_RX_CLK_RST_CTRL_SWR_CONTROL,
1833*af3d54b9SSrinivas Kandagatla 			   CDC_RX_SWR_CLK_EN_MASK, 1);
1834*af3d54b9SSrinivas Kandagatla 
1835*af3d54b9SSrinivas Kandagatla 	if (rx->reset_swr)
1836*af3d54b9SSrinivas Kandagatla 		regmap_update_bits(rx->regmap, CDC_RX_CLK_RST_CTRL_SWR_CONTROL,
1837*af3d54b9SSrinivas Kandagatla 				   CDC_RX_SWR_RESET_MASK, 0);
1838*af3d54b9SSrinivas Kandagatla 	rx->reset_swr = false;
1839*af3d54b9SSrinivas Kandagatla 
1840*af3d54b9SSrinivas Kandagatla 	return 0;
1841*af3d54b9SSrinivas Kandagatla }
1842*af3d54b9SSrinivas Kandagatla 
1843*af3d54b9SSrinivas Kandagatla static void swclk_gate_disable(struct clk_hw *hw)
1844*af3d54b9SSrinivas Kandagatla {
1845*af3d54b9SSrinivas Kandagatla 	struct rx_macro *rx = to_rx_macro(hw);
1846*af3d54b9SSrinivas Kandagatla 
1847*af3d54b9SSrinivas Kandagatla 	regmap_update_bits(rx->regmap, CDC_RX_CLK_RST_CTRL_SWR_CONTROL,
1848*af3d54b9SSrinivas Kandagatla 			   CDC_RX_SWR_CLK_EN_MASK, 0);
1849*af3d54b9SSrinivas Kandagatla 
1850*af3d54b9SSrinivas Kandagatla 	rx_macro_mclk_enable(rx, false);
1851*af3d54b9SSrinivas Kandagatla }
1852*af3d54b9SSrinivas Kandagatla 
1853*af3d54b9SSrinivas Kandagatla static int swclk_gate_is_enabled(struct clk_hw *hw)
1854*af3d54b9SSrinivas Kandagatla {
1855*af3d54b9SSrinivas Kandagatla 	struct rx_macro *rx = to_rx_macro(hw);
1856*af3d54b9SSrinivas Kandagatla 	int ret, val;
1857*af3d54b9SSrinivas Kandagatla 
1858*af3d54b9SSrinivas Kandagatla 	regmap_read(rx->regmap, CDC_RX_CLK_RST_CTRL_SWR_CONTROL, &val);
1859*af3d54b9SSrinivas Kandagatla 	ret = val & BIT(0);
1860*af3d54b9SSrinivas Kandagatla 
1861*af3d54b9SSrinivas Kandagatla 	return ret;
1862*af3d54b9SSrinivas Kandagatla }
1863*af3d54b9SSrinivas Kandagatla 
1864*af3d54b9SSrinivas Kandagatla static unsigned long swclk_recalc_rate(struct clk_hw *hw,
1865*af3d54b9SSrinivas Kandagatla 				       unsigned long parent_rate)
1866*af3d54b9SSrinivas Kandagatla {
1867*af3d54b9SSrinivas Kandagatla 	return parent_rate / 2;
1868*af3d54b9SSrinivas Kandagatla }
1869*af3d54b9SSrinivas Kandagatla 
1870*af3d54b9SSrinivas Kandagatla static const struct clk_ops swclk_gate_ops = {
1871*af3d54b9SSrinivas Kandagatla 	.prepare = swclk_gate_enable,
1872*af3d54b9SSrinivas Kandagatla 	.unprepare = swclk_gate_disable,
1873*af3d54b9SSrinivas Kandagatla 	.is_enabled = swclk_gate_is_enabled,
1874*af3d54b9SSrinivas Kandagatla 	.recalc_rate = swclk_recalc_rate,
1875*af3d54b9SSrinivas Kandagatla 
1876*af3d54b9SSrinivas Kandagatla };
1877*af3d54b9SSrinivas Kandagatla 
1878*af3d54b9SSrinivas Kandagatla static struct clk *rx_macro_register_mclk_output(struct rx_macro *rx)
1879*af3d54b9SSrinivas Kandagatla {
1880*af3d54b9SSrinivas Kandagatla 	struct device *dev = rx->dev;
1881*af3d54b9SSrinivas Kandagatla 	struct device_node *np = dev->of_node;
1882*af3d54b9SSrinivas Kandagatla 	const char *parent_clk_name = NULL;
1883*af3d54b9SSrinivas Kandagatla 	const char *clk_name = "lpass-rx-mclk";
1884*af3d54b9SSrinivas Kandagatla 	struct clk_hw *hw;
1885*af3d54b9SSrinivas Kandagatla 	struct clk_init_data init;
1886*af3d54b9SSrinivas Kandagatla 	int ret;
1887*af3d54b9SSrinivas Kandagatla 
1888*af3d54b9SSrinivas Kandagatla 	parent_clk_name = __clk_get_name(rx->clks[2].clk);
1889*af3d54b9SSrinivas Kandagatla 
1890*af3d54b9SSrinivas Kandagatla 	init.name = clk_name;
1891*af3d54b9SSrinivas Kandagatla 	init.ops = &swclk_gate_ops;
1892*af3d54b9SSrinivas Kandagatla 	init.flags = 0;
1893*af3d54b9SSrinivas Kandagatla 	init.parent_names = &parent_clk_name;
1894*af3d54b9SSrinivas Kandagatla 	init.num_parents = 1;
1895*af3d54b9SSrinivas Kandagatla 	rx->hw.init = &init;
1896*af3d54b9SSrinivas Kandagatla 	hw = &rx->hw;
1897*af3d54b9SSrinivas Kandagatla 	ret = clk_hw_register(rx->dev, hw);
1898*af3d54b9SSrinivas Kandagatla 	if (ret)
1899*af3d54b9SSrinivas Kandagatla 		return ERR_PTR(ret);
1900*af3d54b9SSrinivas Kandagatla 
1901*af3d54b9SSrinivas Kandagatla 	of_clk_add_provider(np, of_clk_src_simple_get, hw->clk);
1902*af3d54b9SSrinivas Kandagatla 
1903*af3d54b9SSrinivas Kandagatla 	return NULL;
1904*af3d54b9SSrinivas Kandagatla }
1905*af3d54b9SSrinivas Kandagatla 
1906*af3d54b9SSrinivas Kandagatla static const struct snd_soc_component_driver rx_macro_component_drv = {
1907*af3d54b9SSrinivas Kandagatla 	.name = "RX-MACRO",
1908*af3d54b9SSrinivas Kandagatla 	.probe = rx_macro_component_probe,
1909*af3d54b9SSrinivas Kandagatla 	.controls = rx_macro_snd_controls,
1910*af3d54b9SSrinivas Kandagatla 	.num_controls = ARRAY_SIZE(rx_macro_snd_controls),
1911*af3d54b9SSrinivas Kandagatla };
1912*af3d54b9SSrinivas Kandagatla 
1913*af3d54b9SSrinivas Kandagatla static int rx_macro_probe(struct platform_device *pdev)
1914*af3d54b9SSrinivas Kandagatla {
1915*af3d54b9SSrinivas Kandagatla 	struct device *dev = &pdev->dev;
1916*af3d54b9SSrinivas Kandagatla 	struct rx_macro *rx;
1917*af3d54b9SSrinivas Kandagatla 	void __iomem *base;
1918*af3d54b9SSrinivas Kandagatla 	int ret;
1919*af3d54b9SSrinivas Kandagatla 
1920*af3d54b9SSrinivas Kandagatla 	rx = devm_kzalloc(dev, sizeof(*rx), GFP_KERNEL);
1921*af3d54b9SSrinivas Kandagatla 	if (!rx)
1922*af3d54b9SSrinivas Kandagatla 		return -ENOMEM;
1923*af3d54b9SSrinivas Kandagatla 
1924*af3d54b9SSrinivas Kandagatla 	rx->clks[0].id = "macro";
1925*af3d54b9SSrinivas Kandagatla 	rx->clks[1].id = "dcodec";
1926*af3d54b9SSrinivas Kandagatla 	rx->clks[2].id = "mclk";
1927*af3d54b9SSrinivas Kandagatla 	rx->clks[3].id = "npl";
1928*af3d54b9SSrinivas Kandagatla 	rx->clks[4].id = "fsgen";
1929*af3d54b9SSrinivas Kandagatla 
1930*af3d54b9SSrinivas Kandagatla 	ret = devm_clk_bulk_get(dev, RX_NUM_CLKS_MAX, rx->clks);
1931*af3d54b9SSrinivas Kandagatla 	if (ret) {
1932*af3d54b9SSrinivas Kandagatla 		dev_err(dev, "Error getting RX Clocks (%d)\n", ret);
1933*af3d54b9SSrinivas Kandagatla 		return ret;
1934*af3d54b9SSrinivas Kandagatla 	}
1935*af3d54b9SSrinivas Kandagatla 
1936*af3d54b9SSrinivas Kandagatla 	base = devm_platform_ioremap_resource(pdev, 0);
1937*af3d54b9SSrinivas Kandagatla 	if (IS_ERR(base))
1938*af3d54b9SSrinivas Kandagatla 		return PTR_ERR(base);
1939*af3d54b9SSrinivas Kandagatla 
1940*af3d54b9SSrinivas Kandagatla 	rx->regmap = devm_regmap_init_mmio(dev, base, &rx_regmap_config);
1941*af3d54b9SSrinivas Kandagatla 
1942*af3d54b9SSrinivas Kandagatla 	dev_set_drvdata(dev, rx);
1943*af3d54b9SSrinivas Kandagatla 
1944*af3d54b9SSrinivas Kandagatla 	rx->reset_swr = true;
1945*af3d54b9SSrinivas Kandagatla 	rx->dev = dev;
1946*af3d54b9SSrinivas Kandagatla 
1947*af3d54b9SSrinivas Kandagatla 	/* set MCLK and NPL rates */
1948*af3d54b9SSrinivas Kandagatla 	clk_set_rate(rx->clks[2].clk, MCLK_FREQ);
1949*af3d54b9SSrinivas Kandagatla 	clk_set_rate(rx->clks[3].clk, MCLK_FREQ);
1950*af3d54b9SSrinivas Kandagatla 
1951*af3d54b9SSrinivas Kandagatla 	ret = clk_bulk_prepare_enable(RX_NUM_CLKS_MAX, rx->clks);
1952*af3d54b9SSrinivas Kandagatla 	if (ret)
1953*af3d54b9SSrinivas Kandagatla 		return ret;
1954*af3d54b9SSrinivas Kandagatla 
1955*af3d54b9SSrinivas Kandagatla 	rx_macro_register_mclk_output(rx);
1956*af3d54b9SSrinivas Kandagatla 
1957*af3d54b9SSrinivas Kandagatla 	ret = devm_snd_soc_register_component(dev, &rx_macro_component_drv,
1958*af3d54b9SSrinivas Kandagatla 					      rx_macro_dai,
1959*af3d54b9SSrinivas Kandagatla 					      ARRAY_SIZE(rx_macro_dai));
1960*af3d54b9SSrinivas Kandagatla 	if (ret)
1961*af3d54b9SSrinivas Kandagatla 		clk_bulk_disable_unprepare(RX_NUM_CLKS_MAX, rx->clks);
1962*af3d54b9SSrinivas Kandagatla 
1963*af3d54b9SSrinivas Kandagatla 	return ret;
1964*af3d54b9SSrinivas Kandagatla }
1965*af3d54b9SSrinivas Kandagatla 
1966*af3d54b9SSrinivas Kandagatla static int rx_macro_remove(struct platform_device *pdev)
1967*af3d54b9SSrinivas Kandagatla {
1968*af3d54b9SSrinivas Kandagatla 	struct rx_macro *rx = dev_get_drvdata(&pdev->dev);
1969*af3d54b9SSrinivas Kandagatla 
1970*af3d54b9SSrinivas Kandagatla 	of_clk_del_provider(pdev->dev.of_node);
1971*af3d54b9SSrinivas Kandagatla 	clk_bulk_disable_unprepare(RX_NUM_CLKS_MAX, rx->clks);
1972*af3d54b9SSrinivas Kandagatla 	return 0;
1973*af3d54b9SSrinivas Kandagatla }
1974*af3d54b9SSrinivas Kandagatla 
1975*af3d54b9SSrinivas Kandagatla static const struct of_device_id rx_macro_dt_match[] = {
1976*af3d54b9SSrinivas Kandagatla 	{ .compatible = "qcom,sm8250-lpass-rx-macro" },
1977*af3d54b9SSrinivas Kandagatla 	{ }
1978*af3d54b9SSrinivas Kandagatla };
1979*af3d54b9SSrinivas Kandagatla 
1980*af3d54b9SSrinivas Kandagatla static struct platform_driver rx_macro_driver = {
1981*af3d54b9SSrinivas Kandagatla 	.driver = {
1982*af3d54b9SSrinivas Kandagatla 		.name = "rx_macro",
1983*af3d54b9SSrinivas Kandagatla 		.owner = THIS_MODULE,
1984*af3d54b9SSrinivas Kandagatla 		.of_match_table = rx_macro_dt_match,
1985*af3d54b9SSrinivas Kandagatla 		.suppress_bind_attrs = true,
1986*af3d54b9SSrinivas Kandagatla 	},
1987*af3d54b9SSrinivas Kandagatla 	.probe = rx_macro_probe,
1988*af3d54b9SSrinivas Kandagatla 	.remove = rx_macro_remove,
1989*af3d54b9SSrinivas Kandagatla };
1990*af3d54b9SSrinivas Kandagatla 
1991*af3d54b9SSrinivas Kandagatla module_platform_driver(rx_macro_driver);
1992*af3d54b9SSrinivas Kandagatla 
1993*af3d54b9SSrinivas Kandagatla MODULE_DESCRIPTION("RX macro driver");
1994*af3d54b9SSrinivas Kandagatla MODULE_LICENSE("GPL");
1995