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