Lines Matching +full:slim +full:- +full:ifc +full:- +full:dev

1 // SPDX-License-Identifier: GPL-2.0
5 #include <linux/clk-provider.h>
21 #include <sound/soc-dapm.h>
23 #include "wcd-clsh-v2.h"
135 {"RX INT" #id "_1 MIX1 INP0", "RX0", "SLIM RX0"}, \
136 {"RX INT" #id "_1 MIX1 INP0", "RX1", "SLIM RX1"}, \
137 {"RX INT" #id "_1 MIX1 INP0", "RX2", "SLIM RX2"}, \
138 {"RX INT" #id "_1 MIX1 INP0", "RX3", "SLIM RX3"}, \
139 {"RX INT" #id "_1 MIX1 INP0", "RX4", "SLIM RX4"}, \
140 {"RX INT" #id "_1 MIX1 INP0", "RX5", "SLIM RX5"}, \
141 {"RX INT" #id "_1 MIX1 INP0", "RX6", "SLIM RX6"}, \
142 {"RX INT" #id "_1 MIX1 INP0", "RX7", "SLIM RX7"}, \
145 {"RX INT" #id "_1 MIX1 INP1", "RX0", "SLIM RX0"}, \
146 {"RX INT" #id "_1 MIX1 INP1", "RX1", "SLIM RX1"}, \
147 {"RX INT" #id "_1 MIX1 INP1", "RX2", "SLIM RX2"}, \
148 {"RX INT" #id "_1 MIX1 INP1", "RX3", "SLIM RX3"}, \
149 {"RX INT" #id "_1 MIX1 INP1", "RX4", "SLIM RX4"}, \
150 {"RX INT" #id "_1 MIX1 INP1", "RX5", "SLIM RX5"}, \
151 {"RX INT" #id "_1 MIX1 INP1", "RX6", "SLIM RX6"}, \
152 {"RX INT" #id "_1 MIX1 INP1", "RX7", "SLIM RX7"}, \
155 {"RX INT" #id "_1 MIX1 INP2", "RX0", "SLIM RX0"}, \
156 {"RX INT" #id "_1 MIX1 INP2", "RX1", "SLIM RX1"}, \
157 {"RX INT" #id "_1 MIX1 INP2", "RX2", "SLIM RX2"}, \
158 {"RX INT" #id "_1 MIX1 INP2", "RX3", "SLIM RX3"}, \
159 {"RX INT" #id "_1 MIX1 INP2", "RX4", "SLIM RX4"}, \
160 {"RX INT" #id "_1 MIX1 INP2", "RX5", "SLIM RX5"}, \
161 {"RX INT" #id "_1 MIX1 INP2", "RX6", "SLIM RX6"}, \
162 {"RX INT" #id "_1 MIX1 INP2", "RX7", "SLIM RX7"}, \
168 {"RX INT" #id "_2 MUX", "RX0", "SLIM RX0"}, \
169 {"RX INT" #id "_2 MUX", "RX1", "SLIM RX1"}, \
170 {"RX INT" #id "_2 MUX", "RX2", "SLIM RX2"}, \
171 {"RX INT" #id "_2 MUX", "RX3", "SLIM RX3"}, \
172 {"RX INT" #id "_2 MUX", "RX4", "SLIM RX4"}, \
173 {"RX INT" #id "_2 MUX", "RX5", "SLIM RX5"}, \
174 {"RX INT" #id "_2 MUX", "RX6", "SLIM RX6"}, \
175 {"RX INT" #id "_2 MUX", "RX7", "SLIM RX7"}, \
190 {"SLIM RX"#id" MUX", "AIF1_PB", "AIF1 PB"}, \
191 {"SLIM RX"#id" MUX", "AIF2_PB", "AIF2 PB"}, \
192 {"SLIM RX"#id" MUX", "AIF3_PB", "AIF3 PB"}, \
193 {"SLIM RX"#id" MUX", "AIF4_PB", "AIF4 PB"}, \
194 {"SLIM RX"#id, NULL, "SLIM RX"#id" MUX"}
221 {"IIR" #id " INP0 MUX", "RX0", "SLIM RX0"}, \
222 {"IIR" #id " INP0 MUX", "RX1", "SLIM RX1"}, \
223 {"IIR" #id " INP0 MUX", "RX2", "SLIM RX2"}, \
224 {"IIR" #id " INP0 MUX", "RX3", "SLIM RX3"}, \
225 {"IIR" #id " INP0 MUX", "RX4", "SLIM RX4"}, \
226 {"IIR" #id " INP0 MUX", "RX5", "SLIM RX5"}, \
227 {"IIR" #id " INP0 MUX", "RX6", "SLIM RX6"}, \
228 {"IIR" #id " INP0 MUX", "RX7", "SLIM RX7"}, \
239 {"IIR" #id " INP1 MUX", "RX0", "SLIM RX0"}, \
240 {"IIR" #id " INP1 MUX", "RX1", "SLIM RX1"}, \
241 {"IIR" #id " INP1 MUX", "RX2", "SLIM RX2"}, \
242 {"IIR" #id " INP1 MUX", "RX3", "SLIM RX3"}, \
243 {"IIR" #id " INP1 MUX", "RX4", "SLIM RX4"}, \
244 {"IIR" #id " INP1 MUX", "RX5", "SLIM RX5"}, \
245 {"IIR" #id " INP1 MUX", "RX6", "SLIM RX6"}, \
246 {"IIR" #id " INP1 MUX", "RX7", "SLIM RX7"}, \
257 {"IIR" #id " INP2 MUX", "RX0", "SLIM RX0"}, \
258 {"IIR" #id " INP2 MUX", "RX1", "SLIM RX1"}, \
259 {"IIR" #id " INP2 MUX", "RX2", "SLIM RX2"}, \
260 {"IIR" #id " INP2 MUX", "RX3", "SLIM RX3"}, \
261 {"IIR" #id " INP2 MUX", "RX4", "SLIM RX4"}, \
262 {"IIR" #id " INP2 MUX", "RX5", "SLIM RX5"}, \
263 {"IIR" #id " INP2 MUX", "RX6", "SLIM RX6"}, \
264 {"IIR" #id " INP2 MUX", "RX7", "SLIM RX7"}, \
275 {"IIR" #id " INP3 MUX", "RX0", "SLIM RX0"}, \
276 {"IIR" #id " INP3 MUX", "RX1", "SLIM RX1"}, \
277 {"IIR" #id " INP3 MUX", "RX2", "SLIM RX2"}, \
278 {"IIR" #id " INP3 MUX", "RX3", "SLIM RX3"}, \
279 {"IIR" #id " INP3 MUX", "RX4", "SLIM RX4"}, \
280 {"IIR" #id " INP3 MUX", "RX5", "SLIM RX5"}, \
281 {"IIR" #id " INP3 MUX", "RX6", "SLIM RX6"}, \
282 {"IIR" #id " INP3 MUX", "RX7", "SLIM RX7"}
285 {"AIF1_CAP Mixer", "SLIM TX" #id, "SLIM TX" #id }, \
286 {"AIF2_CAP Mixer", "SLIM TX" #id, "SLIM TX" #id }, \
287 {"AIF3_CAP Mixer", "SLIM TX" #id, "SLIM TX" #id }, \
288 {"SLIM TX" #id, NULL, "CDC_IF TX" #id " MUX"}
416 COMPANDER_5, /* LO3_SE - not used in Tavil */
417 COMPANDER_6, /* LO4_SE - not used in Tavil */
497 .name = "WCD9335-IFC-DEV",
517 struct device *dev; member
554 static const DECLARE_TLV_DB_SCALE(digital_gain, -8400, 100, -8400);
570 "Class H Invalid", "Class-H Hi-Fi", "Class-H Low Power", "Class-AB",
571 "Class-H Hi-Fi Low Power"
1188 if (sido_src == wcd->sido_input_src) in wcd934x_set_sido_input_src()
1192 regmap_update_bits(wcd->regmap, WCD934X_ANA_BUCK_CTL, in wcd934x_set_sido_input_src()
1195 regmap_update_bits(wcd->regmap, WCD934X_ANA_BUCK_CTL, in wcd934x_set_sido_input_src()
1198 regmap_update_bits(wcd->regmap, WCD934X_ANA_RCO, in wcd934x_set_sido_input_src()
1201 regmap_update_bits(wcd->regmap, WCD934X_ANA_BUCK_CTL, in wcd934x_set_sido_input_src()
1205 regmap_update_bits(wcd->regmap, WCD934X_ANA_BUCK_CTL, in wcd934x_set_sido_input_src()
1209 regmap_update_bits(wcd->regmap, WCD934X_ANA_BUCK_CTL, in wcd934x_set_sido_input_src()
1214 regmap_update_bits(wcd->regmap, WCD934X_ANA_RCO, in wcd934x_set_sido_input_src()
1219 wcd->sido_input_src = sido_src; in wcd934x_set_sido_input_src()
1226 mutex_lock(&wcd->sysclk_mutex); in wcd934x_enable_ana_bias_and_sysclk()
1228 if (++wcd->sysclk_users != 1) { in wcd934x_enable_ana_bias_and_sysclk()
1229 mutex_unlock(&wcd->sysclk_mutex); in wcd934x_enable_ana_bias_and_sysclk()
1232 mutex_unlock(&wcd->sysclk_mutex); in wcd934x_enable_ana_bias_and_sysclk()
1234 regmap_update_bits(wcd->regmap, WCD934X_ANA_BIAS, in wcd934x_enable_ana_bias_and_sysclk()
1237 regmap_update_bits(wcd->regmap, WCD934X_ANA_BIAS, in wcd934x_enable_ana_bias_and_sysclk()
1241 * 1ms delay is required after pre-charge is enabled in wcd934x_enable_ana_bias_and_sysclk()
1245 regmap_update_bits(wcd->regmap, WCD934X_ANA_BIAS, in wcd934x_enable_ana_bias_and_sysclk()
1247 regmap_update_bits(wcd->regmap, WCD934X_ANA_BIAS, in wcd934x_enable_ana_bias_and_sysclk()
1255 regmap_update_bits(wcd->regmap, WCD934X_CLK_SYS_MCLK_PRG, in wcd934x_enable_ana_bias_and_sysclk()
1258 regmap_update_bits(wcd->regmap, WCD934X_CLK_SYS_MCLK_PRG, in wcd934x_enable_ana_bias_and_sysclk()
1261 regmap_update_bits(wcd->regmap, WCD934X_CLK_SYS_MCLK_PRG, in wcd934x_enable_ana_bias_and_sysclk()
1264 regmap_update_bits(wcd->regmap, WCD934X_CLK_SYS_MCLK_PRG, in wcd934x_enable_ana_bias_and_sysclk()
1266 regmap_update_bits(wcd->regmap, in wcd934x_enable_ana_bias_and_sysclk()
1270 regmap_update_bits(wcd->regmap, in wcd934x_enable_ana_bias_and_sysclk()
1274 regmap_update_bits(wcd->regmap, WCD934X_CODEC_RPM_CLK_GATE, in wcd934x_enable_ana_bias_and_sysclk()
1289 mutex_lock(&wcd->sysclk_mutex); in wcd934x_disable_ana_bias_and_syclk()
1290 if (--wcd->sysclk_users != 0) { in wcd934x_disable_ana_bias_and_syclk()
1291 mutex_unlock(&wcd->sysclk_mutex); in wcd934x_disable_ana_bias_and_syclk()
1294 mutex_unlock(&wcd->sysclk_mutex); in wcd934x_disable_ana_bias_and_syclk()
1296 regmap_update_bits(wcd->regmap, WCD934X_CLK_SYS_MCLK_PRG, in wcd934x_disable_ana_bias_and_syclk()
1301 regmap_update_bits(wcd->regmap, WCD934X_ANA_BIAS, in wcd934x_disable_ana_bias_and_syclk()
1303 regmap_update_bits(wcd->regmap, WCD934X_ANA_BIAS, in wcd934x_disable_ana_bias_and_syclk()
1314 ret = clk_prepare_enable(wcd->extclk); in __wcd934x_cdc_mclk_enable()
1317 dev_err(wcd->dev, "%s: ext clk enable failed\n", in __wcd934x_cdc_mclk_enable()
1325 regmap_read(wcd->regmap, WCD934X_CDC_CLK_RST_CTRL_SWR_CONTROL, in __wcd934x_cdc_mclk_enable()
1333 clk_disable_unprepare(wcd->extclk); in __wcd934x_cdc_mclk_enable()
1342 struct snd_soc_component *comp = snd_soc_dapm_to_component(w->dapm); in wcd934x_codec_enable_mclk()
1343 struct wcd934x_codec *wcd = dev_get_drvdata(comp->dev); in wcd934x_codec_enable_mclk()
1362 regmap = wcd->regmap; in wcd934x_get_version()
1392 wcd->version = ver; in wcd934x_get_version()
1393 dev_info(wcd->dev, "WCD934X Minor:0x%x Version:0x%x\n", id_minor, ver); in wcd934x_get_version()
1404 regmap_update_bits(wcd->regmap, in wcd934x_enable_efuse_sensing()
1408 regmap_update_bits(wcd->regmap, in wcd934x_enable_efuse_sensing()
1419 rc = regmap_read(wcd->regmap, in wcd934x_enable_efuse_sensing()
1432 regmap_update_bits(wcd->regmap, in wcd934x_swrm_clock()
1437 regmap_update_bits(wcd->regmap, in wcd934x_swrm_clock()
1449 struct snd_soc_component *comp = dai->component; in wcd934x_set_prim_interpolator_rate()
1450 struct wcd934x_codec *wcd = dev_get_drvdata(comp->dev); in wcd934x_set_prim_interpolator_rate()
1455 list_for_each_entry(ch, &wcd->dai[dai->id].slim_ch_list, list) { in wcd934x_set_prim_interpolator_rate()
1456 inp = ch->shift + INTn_1_INP_SEL_RX0; in wcd934x_set_prim_interpolator_rate()
1459 * to which interpolator input, the slim rx port in wcd934x_set_prim_interpolator_rate()
1488 dev_err(wcd->dev, in wcd934x_set_prim_interpolator_rate()
1506 struct snd_soc_component *component = dai->component; in wcd934x_set_mix_interpolator_rate()
1507 struct wcd934x_codec *wcd = dev_get_drvdata(component->dev); in wcd934x_set_mix_interpolator_rate()
1511 list_for_each_entry(ch, &wcd->dai[dai->id].slim_ch_list, list) { in wcd934x_set_mix_interpolator_rate()
1520 if (val == (ch->shift + INTn_2_INP_SEL_RX0)) { in wcd934x_set_mix_interpolator_rate()
1528 dev_err(component->dev, in wcd934x_set_mix_interpolator_rate()
1530 dai->id); in wcd934x_set_mix_interpolator_rate()
1531 return -EINVAL; in wcd934x_set_mix_interpolator_rate()
1558 dev_err(dai->dev, "Unsupported sample rate: %d\n", sample_rate); in wcd934x_set_interpolator_rate()
1559 return -EINVAL; in wcd934x_set_interpolator_rate()
1577 struct snd_soc_component *comp = dai->component; in wcd934x_set_decimator_rate()
1582 int decimator = -1; in wcd934x_set_decimator_rate()
1584 list_for_each_entry(ch, &wcd->dai[dai->id].slim_ch_list, list) { in wcd934x_set_decimator_rate()
1585 tx_port = ch->port; in wcd934x_set_decimator_rate()
1586 /* Find the SB TX MUX input - which decimator is connected */ in wcd934x_set_decimator_rate()
1595 shift = ((tx_port - 4) << 1); in wcd934x_set_decimator_rate()
1600 shift = ((tx_port - 8) << 1); in wcd934x_set_decimator_rate()
1614 dev_err(wcd->dev, "Invalid SLIM TX%u port DAI ID:%d\n", in wcd934x_set_decimator_rate()
1615 tx_port, dai->id); in wcd934x_set_decimator_rate()
1616 return -EINVAL; in wcd934x_set_decimator_rate()
1634 decimator = tx_mux_sel - 1; in wcd934x_set_decimator_rate()
1641 dev_err(wcd->dev, "ERROR: Invalid tx_port: %d\n", in wcd934x_set_decimator_rate()
1643 return -EINVAL; in wcd934x_set_decimator_rate()
1659 struct list_head *slim_ch_list = &dai_data->slim_ch_list; in wcd934x_slim_set_hw_params()
1660 struct slim_stream_config *cfg = &dai_data->sconfig; in wcd934x_slim_set_hw_params()
1665 cfg->ch_count = 0; in wcd934x_slim_set_hw_params()
1666 cfg->direction = direction; in wcd934x_slim_set_hw_params()
1667 cfg->port_mask = 0; in wcd934x_slim_set_hw_params()
1671 cfg->ch_count++; in wcd934x_slim_set_hw_params()
1672 payload |= 1 << ch->shift; in wcd934x_slim_set_hw_params()
1673 cfg->port_mask |= BIT(ch->port); in wcd934x_slim_set_hw_params()
1676 cfg->chs = kcalloc(cfg->ch_count, sizeof(unsigned int), GFP_KERNEL); in wcd934x_slim_set_hw_params()
1677 if (!cfg->chs) in wcd934x_slim_set_hw_params()
1678 return -ENOMEM; in wcd934x_slim_set_hw_params()
1682 cfg->chs[i++] = ch->ch_num; in wcd934x_slim_set_hw_params()
1685 ret = regmap_write(wcd->if_regmap, in wcd934x_slim_set_hw_params()
1686 WCD934X_SLIM_PGD_RX_PORT_MULTI_CHNL_0(ch->port), in wcd934x_slim_set_hw_params()
1693 ret = regmap_write(wcd->if_regmap, in wcd934x_slim_set_hw_params()
1694 WCD934X_SLIM_PGD_RX_PORT_CFG(ch->port), in wcd934x_slim_set_hw_params()
1699 ret = regmap_write(wcd->if_regmap, in wcd934x_slim_set_hw_params()
1700 WCD934X_SLIM_PGD_TX_PORT_MULTI_CHNL_0(ch->port), in wcd934x_slim_set_hw_params()
1706 ret = regmap_write(wcd->if_regmap, in wcd934x_slim_set_hw_params()
1707 WCD934X_SLIM_PGD_TX_PORT_MULTI_CHNL_1(ch->port), in wcd934x_slim_set_hw_params()
1713 ret = regmap_write(wcd->if_regmap, in wcd934x_slim_set_hw_params()
1714 WCD934X_SLIM_PGD_TX_PORT_CFG(ch->port), in wcd934x_slim_set_hw_params()
1722 dai_data->sruntime = slim_stream_allocate(wcd->sdev, "WCD934x-SLIM"); in wcd934x_slim_set_hw_params()
1727 dev_err(wcd->dev, "Error Setting slim hw params\n"); in wcd934x_slim_set_hw_params()
1728 kfree(cfg->chs); in wcd934x_slim_set_hw_params()
1729 cfg->chs = NULL; in wcd934x_slim_set_hw_params()
1741 wcd = snd_soc_component_get_drvdata(dai->component); in wcd934x_hw_params()
1743 switch (substream->stream) { in wcd934x_hw_params()
1747 dev_err(wcd->dev, "cannot set sample rate: %u\n", in wcd934x_hw_params()
1753 wcd->dai[dai->id].sconfig.bps = params_width(params); in wcd934x_hw_params()
1756 dev_err(wcd->dev, "Invalid format 0x%x\n", in wcd934x_hw_params()
1758 return -EINVAL; in wcd934x_hw_params()
1786 dev_err(wcd->dev, "Invalid TX sample rate: %d\n", in wcd934x_hw_params()
1788 return -EINVAL; in wcd934x_hw_params()
1795 dev_err(wcd->dev, "Cannot set TX Decimator rate\n"); in wcd934x_hw_params()
1800 wcd->dai[dai->id].sconfig.bps = params_width(params); in wcd934x_hw_params()
1803 dev_err(wcd->dev, "Invalid format 0x%x\n", in wcd934x_hw_params()
1805 return -EINVAL; in wcd934x_hw_params()
1809 dev_err(wcd->dev, "Invalid stream type %d\n", in wcd934x_hw_params()
1810 substream->stream); in wcd934x_hw_params()
1811 return -EINVAL; in wcd934x_hw_params()
1814 wcd->dai[dai->id].sconfig.rate = params_rate(params); in wcd934x_hw_params()
1815 wcd934x_slim_set_hw_params(wcd, &wcd->dai[dai->id], substream->stream); in wcd934x_hw_params()
1826 wcd = snd_soc_component_get_drvdata(dai->component); in wcd934x_hw_free()
1828 dai_data = &wcd->dai[dai->id]; in wcd934x_hw_free()
1830 kfree(dai_data->sconfig.chs); in wcd934x_hw_free()
1842 wcd = snd_soc_component_get_drvdata(dai->component); in wcd934x_trigger()
1844 dai_data = &wcd->dai[dai->id]; in wcd934x_trigger()
1850 cfg = &dai_data->sconfig; in wcd934x_trigger()
1851 slim_stream_prepare(dai_data->sruntime, cfg); in wcd934x_trigger()
1852 slim_stream_enable(dai_data->sruntime); in wcd934x_trigger()
1857 slim_stream_unprepare(dai_data->sruntime); in wcd934x_trigger()
1858 slim_stream_disable(dai_data->sruntime); in wcd934x_trigger()
1874 wcd = snd_soc_component_get_drvdata(dai->component); in wcd934x_set_channel_map()
1877 dev_err(wcd->dev, "Invalid tx_slot=%p, rx_slot=%p\n", in wcd934x_set_channel_map()
1879 return -EINVAL; in wcd934x_set_channel_map()
1882 wcd->num_rx_port = rx_num; in wcd934x_set_channel_map()
1884 wcd->rx_chs[i].ch_num = rx_slot[i]; in wcd934x_set_channel_map()
1885 INIT_LIST_HEAD(&wcd->rx_chs[i].list); in wcd934x_set_channel_map()
1888 wcd->num_tx_port = tx_num; in wcd934x_set_channel_map()
1890 wcd->tx_chs[i].ch_num = tx_slot[i]; in wcd934x_set_channel_map()
1891 INIT_LIST_HEAD(&wcd->tx_chs[i].list); in wcd934x_set_channel_map()
1905 wcd = snd_soc_component_get_drvdata(dai->component); in wcd934x_get_channel_map()
1907 switch (dai->id) { in wcd934x_get_channel_map()
1913 dev_err(wcd->dev, "Invalid rx_slot %p or rx_num %p\n", in wcd934x_get_channel_map()
1915 return -EINVAL; in wcd934x_get_channel_map()
1918 list_for_each_entry(ch, &wcd->dai[dai->id].slim_ch_list, list) in wcd934x_get_channel_map()
1919 rx_slot[i++] = ch->ch_num; in wcd934x_get_channel_map()
1927 dev_err(wcd->dev, "Invalid tx_slot %p or tx_num %p\n", in wcd934x_get_channel_map()
1929 return -EINVAL; in wcd934x_get_channel_map()
1932 list_for_each_entry(ch, &wcd->dai[dai->id].slim_ch_list, list) in wcd934x_get_channel_map()
1933 tx_slot[i++] = ch->ch_num; in wcd934x_get_channel_map()
1938 dev_err(wcd->dev, "Invalid DAI ID %x\n", dai->id); in wcd934x_get_channel_map()
2069 regmap_read(wcd->regmap, WCD934X_CDC_CLK_RST_CTRL_SWR_CONTROL, &val); in swclk_gate_is_enabled()
2091 struct clk *parent = wcd->extclk; in wcd934x_register_mclk_output()
2092 struct device *dev = wcd->dev; in wcd934x_register_mclk_output() local
2093 struct device_node *np = dev->parent->of_node; in wcd934x_register_mclk_output()
2100 if (of_property_read_u32(np, "clock-frequency", &wcd->rate)) in wcd934x_register_mclk_output()
2105 of_property_read_string(np, "clock-output-names", &clk_name); in wcd934x_register_mclk_output()
2112 wcd->hw.init = &init; in wcd934x_register_mclk_output()
2114 hw = &wcd->hw; in wcd934x_register_mclk_output()
2115 ret = clk_hw_register(wcd->dev->parent, hw); in wcd934x_register_mclk_output()
2119 of_clk_add_provider(np, of_clk_src_simple_get, hw->clk); in wcd934x_register_mclk_output()
2124 static int wcd934x_get_micbias_val(struct device *dev, const char *micbias) in wcd934x_get_micbias_val() argument
2128 if (of_property_read_u32(dev->parent->of_node, micbias, &mv)) { in wcd934x_get_micbias_val()
2129 dev_err(dev, "%s value not found, using default\n", micbias); in wcd934x_get_micbias_val()
2137 dev_err(dev, "%s value not in valid range, using default\n", in wcd934x_get_micbias_val()
2142 return (mv - 1000) / 50; in wcd934x_get_micbias_val()
2148 struct wcd934x_codec *wcd = dev_get_drvdata(comp->dev); in wcd934x_init_dmic()
2151 vout_ctl_1 = wcd934x_get_micbias_val(comp->dev, in wcd934x_init_dmic()
2152 "qcom,micbias1-microvolt"); in wcd934x_init_dmic()
2153 vout_ctl_2 = wcd934x_get_micbias_val(comp->dev, in wcd934x_init_dmic()
2154 "qcom,micbias2-microvolt"); in wcd934x_init_dmic()
2155 vout_ctl_3 = wcd934x_get_micbias_val(comp->dev, in wcd934x_init_dmic()
2156 "qcom,micbias3-microvolt"); in wcd934x_init_dmic()
2157 vout_ctl_4 = wcd934x_get_micbias_val(comp->dev, in wcd934x_init_dmic()
2158 "qcom,micbias4-microvolt"); in wcd934x_init_dmic()
2169 if (wcd->rate == WCD934X_MCLK_CLK_9P6MHZ) in wcd934x_init_dmic()
2174 wcd->dmic_sample_rate = def_dmic_rate; in wcd934x_init_dmic()
2185 struct regmap *rm = wcd->regmap; in wcd934x_hw_init()
2197 struct wcd934x_codec *wcd = dev_get_drvdata(component->dev); in wcd934x_comp_init()
2218 regmap_read(wcd->if_regmap, i, &val); in wcd934x_slim_irq_handler()
2228 port_id = j - 16; in wcd934x_slim_irq_handler()
2231 regmap_read(wcd->if_regmap, in wcd934x_slim_irq_handler()
2240 regmap_read(wcd->if_regmap, reg, &int_val); in wcd934x_slim_irq_handler()
2244 dev_err_ratelimited(wcd->dev, in wcd934x_slim_irq_handler()
2249 dev_err_ratelimited(wcd->dev, in wcd934x_slim_irq_handler()
2262 wcd->if_regmap, reg, &int_val); in wcd934x_slim_irq_handler()
2265 regmap_write(wcd->if_regmap, in wcd934x_slim_irq_handler()
2271 dev_err_ratelimited(wcd->dev, in wcd934x_slim_irq_handler()
2275 regmap_write(wcd->if_regmap, in wcd934x_slim_irq_handler()
2286 struct wcd934x_codec *wcd = dev_get_drvdata(component->dev); in wcd934x_comp_probe()
2289 snd_soc_component_init_regmap(component, wcd->regmap); in wcd934x_comp_probe()
2290 wcd->component = component; in wcd934x_comp_probe()
2292 /* Class-H Init*/ in wcd934x_comp_probe()
2293 wcd->clsh_ctrl = wcd_clsh_ctrl_alloc(component, wcd->version); in wcd934x_comp_probe()
2294 if (IS_ERR(wcd->clsh_ctrl)) in wcd934x_comp_probe()
2295 return PTR_ERR(wcd->clsh_ctrl); in wcd934x_comp_probe()
2297 /* Default HPH Mode to Class-H Low HiFi */ in wcd934x_comp_probe()
2298 wcd->hph_mode = CLS_H_LOHIFI; in wcd934x_comp_probe()
2303 INIT_LIST_HEAD(&wcd->dai[i].slim_ch_list); in wcd934x_comp_probe()
2311 struct wcd934x_codec *wcd = dev_get_drvdata(comp->dev); in wcd934x_comp_remove()
2313 wcd_clsh_ctrl_free(wcd->clsh_ctrl); in wcd934x_comp_remove()
2320 struct wcd934x_codec *wcd = dev_get_drvdata(comp->dev); in wcd934x_comp_set_sysclk()
2323 wcd->rate = freq; in wcd934x_comp_set_sysclk()
2325 if (wcd->rate == WCD934X_MCLK_CLK_12P288MHZ) in wcd934x_comp_set_sysclk()
2332 return clk_set_rate(wcd->extclk, freq); in wcd934x_comp_set_sysclk()
2377 /* Mask top 2 bits, 7-8 are reserved */ in set_iir_band_coeff()
2388 (struct wcd_iir_filter_ctl *)kcontrol->private_value; in wcd934x_put_iir_band_audio_mixer()
2389 struct soc_bytes_ext *params = &ctl->bytes_ext; in wcd934x_put_iir_band_audio_mixer()
2390 int iir_idx = ctl->iir_idx; in wcd934x_put_iir_band_audio_mixer()
2391 int band_idx = ctl->band_idx; in wcd934x_put_iir_band_audio_mixer()
2395 memcpy(&coeff[0], ucontrol->value.bytes.data, params->max); in wcd934x_put_iir_band_audio_mixer()
2417 (struct wcd_iir_filter_ctl *)kcontrol->private_value; in wcd934x_get_iir_band_audio_mixer()
2418 struct soc_bytes_ext *params = &ctl->bytes_ext; in wcd934x_get_iir_band_audio_mixer()
2419 int iir_idx = ctl->iir_idx; in wcd934x_get_iir_band_audio_mixer()
2420 int band_idx = ctl->band_idx; in wcd934x_get_iir_band_audio_mixer()
2429 memcpy(ucontrol->value.bytes.data, &coeff[0], params->max); in wcd934x_get_iir_band_audio_mixer()
2438 (struct wcd_iir_filter_ctl *)kcontrol->private_value; in wcd934x_iir_filter_info()
2439 struct soc_bytes_ext *params = &ctl->bytes_ext; in wcd934x_iir_filter_info()
2441 ucontrol->type = SNDRV_CTL_ELEM_TYPE_BYTES; in wcd934x_iir_filter_info()
2442 ucontrol->count = params->max; in wcd934x_iir_filter_info()
2451 int comp = ((struct soc_mixer_control *)kc->private_value)->shift; in wcd934x_compander_get()
2452 struct wcd934x_codec *wcd = dev_get_drvdata(component->dev); in wcd934x_compander_get()
2454 ucontrol->value.integer.value[0] = wcd->comp_enabled[comp]; in wcd934x_compander_get()
2463 struct wcd934x_codec *wcd = dev_get_drvdata(component->dev); in wcd934x_compander_set()
2464 int comp = ((struct soc_mixer_control *)kc->private_value)->shift; in wcd934x_compander_set()
2465 int value = ucontrol->value.integer.value[0]; in wcd934x_compander_set()
2468 wcd->comp_enabled[comp] = value; in wcd934x_compander_set()
2501 struct wcd934x_codec *wcd = dev_get_drvdata(component->dev); in wcd934x_rx_hph_mode_get()
2503 ucontrol->value.enumerated.item[0] = wcd->hph_mode; in wcd934x_rx_hph_mode_get()
2512 struct wcd934x_codec *wcd = dev_get_drvdata(component->dev); in wcd934x_rx_hph_mode_put()
2515 mode_val = ucontrol->value.enumerated.item[0]; in wcd934x_rx_hph_mode_put()
2518 dev_err(wcd->dev, "Invalid HPH Mode, default to ClSH HiFi\n"); in wcd934x_rx_hph_mode_put()
2521 wcd->hph_mode = mode_val; in wcd934x_rx_hph_mode_put()
2531 struct wcd934x_codec *wcd = dev_get_drvdata(dapm->dev); in slim_rx_mux_get()
2533 ucontrol->value.enumerated.item[0] = wcd->rx_port_value[w->shift]; in slim_rx_mux_get()
2542 struct wcd934x_codec *wcd = dev_get_drvdata(w->dapm->dev); in slim_rx_mux_put()
2543 struct soc_enum *e = (struct soc_enum *)kc->private_value; in slim_rx_mux_put()
2545 u32 port_id = w->shift; in slim_rx_mux_put()
2547 if (wcd->rx_port_value[port_id] == ucontrol->value.enumerated.item[0]) in slim_rx_mux_put()
2550 wcd->rx_port_value[port_id] = ucontrol->value.enumerated.item[0]; in slim_rx_mux_put()
2552 switch (wcd->rx_port_value[port_id]) { in slim_rx_mux_put()
2554 list_del_init(&wcd->rx_chs[port_id].list); in slim_rx_mux_put()
2557 list_add_tail(&wcd->rx_chs[port_id].list, in slim_rx_mux_put()
2558 &wcd->dai[AIF1_PB].slim_ch_list); in slim_rx_mux_put()
2561 list_add_tail(&wcd->rx_chs[port_id].list, in slim_rx_mux_put()
2562 &wcd->dai[AIF2_PB].slim_ch_list); in slim_rx_mux_put()
2565 list_add_tail(&wcd->rx_chs[port_id].list, in slim_rx_mux_put()
2566 &wcd->dai[AIF3_PB].slim_ch_list); in slim_rx_mux_put()
2569 list_add_tail(&wcd->rx_chs[port_id].list, in slim_rx_mux_put()
2570 &wcd->dai[AIF4_PB].slim_ch_list); in slim_rx_mux_put()
2573 dev_err(wcd->dev, "Unknown AIF %d\n", in slim_rx_mux_put()
2574 wcd->rx_port_value[port_id]); in slim_rx_mux_put()
2578 snd_soc_dapm_mux_update_power(w->dapm, kc, wcd->rx_port_value[port_id], in slim_rx_mux_put()
2583 return -EINVAL; in slim_rx_mux_put()
2589 struct soc_enum *e = (struct soc_enum *)kc->private_value; in wcd934x_int_dem_inp_mux_put()
2594 val = ucontrol->value.enumerated.item[0]; in wcd934x_int_dem_inp_mux_put()
2595 if (e->reg == WCD934X_CDC_RX0_RX_PATH_SEC0) in wcd934x_int_dem_inp_mux_put()
2597 else if (e->reg == WCD934X_CDC_RX1_RX_PATH_SEC0) in wcd934x_int_dem_inp_mux_put()
2599 else if (e->reg == WCD934X_CDC_RX2_RX_PATH_SEC0) in wcd934x_int_dem_inp_mux_put()
2602 return -EINVAL; in wcd934x_int_dem_inp_mux_put()
2623 struct soc_enum *e = (struct soc_enum *)kcontrol->private_value; in wcd934x_dec_enum_put()
2630 val = ucontrol->value.enumerated.item[0]; in wcd934x_dec_enum_put()
2631 if (val > e->items - 1) in wcd934x_dec_enum_put()
2632 return -EINVAL; in wcd934x_dec_enum_put()
2634 switch (e->reg) { in wcd934x_dec_enum_put()
2636 if (e->shift_l == 0) in wcd934x_dec_enum_put()
2638 else if (e->shift_l == 2) in wcd934x_dec_enum_put()
2640 else if (e->shift_l == 4) in wcd934x_dec_enum_put()
2644 if (e->shift_l == 0) in wcd934x_dec_enum_put()
2646 else if (e->shift_l == 2) in wcd934x_dec_enum_put()
2650 if (e->shift_l == 0) in wcd934x_dec_enum_put()
2652 else if (e->shift_l == 2) in wcd934x_dec_enum_put()
2656 if (e->shift_l == 0) in wcd934x_dec_enum_put()
2658 else if (e->shift_l == 2) in wcd934x_dec_enum_put()
2662 dev_err(comp->dev, "%s: e->reg: 0x%x not expected\n", in wcd934x_dec_enum_put()
2663 __func__, e->reg); in wcd934x_dec_enum_put()
2664 return -EINVAL; in wcd934x_dec_enum_put()
2797 SOC_DAPM_ENUM_EXT("SLIM RX0 Mux", slim_rx_mux_enum,
2799 SOC_DAPM_ENUM_EXT("SLIM RX1 Mux", slim_rx_mux_enum,
2801 SOC_DAPM_ENUM_EXT("SLIM RX2 Mux", slim_rx_mux_enum,
2803 SOC_DAPM_ENUM_EXT("SLIM RX3 Mux", slim_rx_mux_enum,
2805 SOC_DAPM_ENUM_EXT("SLIM RX4 Mux", slim_rx_mux_enum,
2807 SOC_DAPM_ENUM_EXT("SLIM RX5 Mux", slim_rx_mux_enum,
2809 SOC_DAPM_ENUM_EXT("SLIM RX6 Mux", slim_rx_mux_enum,
2811 SOC_DAPM_ENUM_EXT("SLIM RX7 Mux", slim_rx_mux_enum,
3008 struct wcd934x_codec *wcd = dev_get_drvdata(dapm->dev); in slim_tx_mixer_get()
3010 (struct soc_mixer_control *)kc->private_value; in slim_tx_mixer_get()
3011 int port_id = mixer->shift; in slim_tx_mixer_get()
3013 ucontrol->value.integer.value[0] = wcd->tx_port_value[port_id]; in slim_tx_mixer_get()
3022 struct wcd934x_codec *wcd = dev_get_drvdata(widget->dapm->dev); in slim_tx_mixer_put()
3025 (struct soc_mixer_control *)kc->private_value; in slim_tx_mixer_put()
3026 int enable = ucontrol->value.integer.value[0]; in slim_tx_mixer_put()
3027 int dai_id = widget->shift; in slim_tx_mixer_put()
3028 int port_id = mixer->shift; in slim_tx_mixer_put()
3031 if (enable == wcd->tx_port_value[port_id]) in slim_tx_mixer_put()
3034 wcd->tx_port_value[port_id] = enable; in slim_tx_mixer_put()
3037 list_add_tail(&wcd->tx_chs[port_id].list, in slim_tx_mixer_put()
3038 &wcd->dai[dai_id].slim_ch_list); in slim_tx_mixer_put()
3040 list_del_init(&wcd->tx_chs[port_id].list); in slim_tx_mixer_put()
3042 snd_soc_dapm_mixer_update_power(widget->dapm, kc, enable, update); in slim_tx_mixer_put()
3048 SOC_SINGLE_EXT("SLIM TX0", SND_SOC_NOPM, WCD934X_TX0, 1, 0,
3050 SOC_SINGLE_EXT("SLIM TX1", SND_SOC_NOPM, WCD934X_TX1, 1, 0,
3052 SOC_SINGLE_EXT("SLIM TX2", SND_SOC_NOPM, WCD934X_TX2, 1, 0,
3054 SOC_SINGLE_EXT("SLIM TX3", SND_SOC_NOPM, WCD934X_TX3, 1, 0,
3056 SOC_SINGLE_EXT("SLIM TX4", SND_SOC_NOPM, WCD934X_TX4, 1, 0,
3058 SOC_SINGLE_EXT("SLIM TX5", SND_SOC_NOPM, WCD934X_TX5, 1, 0,
3060 SOC_SINGLE_EXT("SLIM TX6", SND_SOC_NOPM, WCD934X_TX6, 1, 0,
3062 SOC_SINGLE_EXT("SLIM TX7", SND_SOC_NOPM, WCD934X_TX7, 1, 0,
3064 SOC_SINGLE_EXT("SLIM TX8", SND_SOC_NOPM, WCD934X_TX8, 1, 0,
3066 SOC_SINGLE_EXT("SLIM TX9", SND_SOC_NOPM, WCD934X_TX9, 1, 0,
3068 SOC_SINGLE_EXT("SLIM TX10", SND_SOC_NOPM, WCD934X_TX10, 1, 0,
3070 SOC_SINGLE_EXT("SLIM TX11", SND_SOC_NOPM, WCD934X_TX11, 1, 0,
3072 SOC_SINGLE_EXT("SLIM TX13", SND_SOC_NOPM, WCD934X_TX13, 1, 0,
3077 SOC_SINGLE_EXT("SLIM TX0", SND_SOC_NOPM, WCD934X_TX0, 1, 0,
3079 SOC_SINGLE_EXT("SLIM TX1", SND_SOC_NOPM, WCD934X_TX1, 1, 0,
3081 SOC_SINGLE_EXT("SLIM TX2", SND_SOC_NOPM, WCD934X_TX2, 1, 0,
3083 SOC_SINGLE_EXT("SLIM TX3", SND_SOC_NOPM, WCD934X_TX3, 1, 0,
3085 SOC_SINGLE_EXT("SLIM TX4", SND_SOC_NOPM, WCD934X_TX4, 1, 0,
3087 SOC_SINGLE_EXT("SLIM TX5", SND_SOC_NOPM, WCD934X_TX5, 1, 0,
3089 SOC_SINGLE_EXT("SLIM TX6", SND_SOC_NOPM, WCD934X_TX6, 1, 0,
3091 SOC_SINGLE_EXT("SLIM TX7", SND_SOC_NOPM, WCD934X_TX7, 1, 0,
3093 SOC_SINGLE_EXT("SLIM TX8", SND_SOC_NOPM, WCD934X_TX8, 1, 0,
3095 SOC_SINGLE_EXT("SLIM TX9", SND_SOC_NOPM, WCD934X_TX9, 1, 0,
3097 SOC_SINGLE_EXT("SLIM TX10", SND_SOC_NOPM, WCD934X_TX10, 1, 0,
3099 SOC_SINGLE_EXT("SLIM TX11", SND_SOC_NOPM, WCD934X_TX11, 1, 0,
3101 SOC_SINGLE_EXT("SLIM TX13", SND_SOC_NOPM, WCD934X_TX13, 1, 0,
3106 SOC_SINGLE_EXT("SLIM TX0", SND_SOC_NOPM, WCD934X_TX0, 1, 0,
3108 SOC_SINGLE_EXT("SLIM TX1", SND_SOC_NOPM, WCD934X_TX1, 1, 0,
3110 SOC_SINGLE_EXT("SLIM TX2", SND_SOC_NOPM, WCD934X_TX2, 1, 0,
3112 SOC_SINGLE_EXT("SLIM TX3", SND_SOC_NOPM, WCD934X_TX3, 1, 0,
3114 SOC_SINGLE_EXT("SLIM TX4", SND_SOC_NOPM, WCD934X_TX4, 1, 0,
3116 SOC_SINGLE_EXT("SLIM TX5", SND_SOC_NOPM, WCD934X_TX5, 1, 0,
3118 SOC_SINGLE_EXT("SLIM TX6", SND_SOC_NOPM, WCD934X_TX6, 1, 0,
3120 SOC_SINGLE_EXT("SLIM TX7", SND_SOC_NOPM, WCD934X_TX7, 1, 0,
3122 SOC_SINGLE_EXT("SLIM TX8", SND_SOC_NOPM, WCD934X_TX8, 1, 0,
3124 SOC_SINGLE_EXT("SLIM TX9", SND_SOC_NOPM, WCD934X_TX9, 1, 0,
3126 SOC_SINGLE_EXT("SLIM TX10", SND_SOC_NOPM, WCD934X_TX10, 1, 0,
3128 SOC_SINGLE_EXT("SLIM TX11", SND_SOC_NOPM, WCD934X_TX11, 1, 0,
3130 SOC_SINGLE_EXT("SLIM TX13", SND_SOC_NOPM, WCD934X_TX13, 1, 0,
3150 -84, 40, digital_gain), /* -84dB min - 40dB max */
3152 -84, 40, digital_gain),
3154 -84, 40, digital_gain),
3156 -84, 40, digital_gain),
3158 -84, 40, digital_gain),
3160 -84, 40, digital_gain),
3162 -84, 40, digital_gain),
3165 -84, 40, digital_gain),
3168 -84, 40, digital_gain),
3171 -84, 40, digital_gain),
3174 -84, 40, digital_gain),
3177 -84, 40, digital_gain),
3180 -84, 40, digital_gain),
3183 -84, 40, digital_gain),
3186 -84, 40, digital_gain),
3188 -84, 40, digital_gain),
3190 -84, 40, digital_gain),
3192 -84, 40, digital_gain),
3194 -84, 40, digital_gain),
3196 -84, 40, digital_gain),
3198 -84, 40, digital_gain),
3200 -84, 40, digital_gain),
3202 -84, 40, digital_gain),
3205 WCD934X_CDC_SIDETONE_IIR0_IIR_GAIN_B1_CTL, -84, 40,
3208 WCD934X_CDC_SIDETONE_IIR0_IIR_GAIN_B2_CTL, -84, 40,
3211 WCD934X_CDC_SIDETONE_IIR0_IIR_GAIN_B3_CTL, -84, 40,
3214 WCD934X_CDC_SIDETONE_IIR0_IIR_GAIN_B4_CTL, -84, 40,
3217 WCD934X_CDC_SIDETONE_IIR1_IIR_GAIN_B1_CTL, -84, 40,
3220 WCD934X_CDC_SIDETONE_IIR1_IIR_GAIN_B2_CTL, -84, 40,
3223 WCD934X_CDC_SIDETONE_IIR1_IIR_GAIN_B3_CTL, -84, 40,
3226 WCD934X_CDC_SIDETONE_IIR1_IIR_GAIN_B4_CTL, -84, 40,
3309 struct wcd934x_codec *wcd = dev_get_drvdata(component->dev); in wcd934x_codec_enable_int_port()
3312 list_for_each_entry(ch, &dai->slim_ch_list, list) { in wcd934x_codec_enable_int_port()
3313 if (ch->port >= WCD934X_RX_START) { in wcd934x_codec_enable_int_port()
3314 port_num = ch->port - WCD934X_RX_START; in wcd934x_codec_enable_int_port()
3317 port_num = ch->port; in wcd934x_codec_enable_int_port()
3321 regmap_read(wcd->if_regmap, reg, &val); in wcd934x_codec_enable_int_port()
3323 regmap_write(wcd->if_regmap, reg, in wcd934x_codec_enable_int_port()
3331 struct snd_soc_component *comp = snd_soc_dapm_to_component(w->dapm); in wcd934x_codec_enable_slim()
3333 struct wcd_slim_codec_dai_data *dai = &wcd->dai[w->shift]; in wcd934x_codec_enable_slim()
3421 struct wcd934x_codec *wcd = dev_get_drvdata(comp->dev); in wcd934x_config_compander()
3429 compander = interp_n - 1; in wcd934x_config_compander()
3430 if (!wcd->comp_enabled[compander]) in wcd934x_config_compander()
3478 struct snd_soc_component *comp = snd_soc_dapm_to_component(w->dapm); in wcd934x_codec_enable_interp_clk()
3479 int interp_idx = w->shift; in wcd934x_codec_enable_interp_clk()
3519 struct snd_soc_component *comp = snd_soc_dapm_to_component(w->dapm); in wcd934x_codec_enable_mix_path()
3525 (w->shift * WCD934X_RX_PATH_CTL_OFFSET); in wcd934x_codec_enable_mix_path()
3527 (w->shift * WCD934X_RX_PATH_CTL_OFFSET); in wcd934x_codec_enable_mix_path()
3550 struct snd_soc_component *comp = snd_soc_dapm_to_component(w->dapm); in wcd934x_codec_set_iir_gain()
3551 int reg = w->reg; in wcd934x_codec_set_iir_gain()
3585 struct snd_soc_component *comp = snd_soc_dapm_to_component(w->dapm); in wcd934x_codec_enable_main_path()
3588 gain_reg = WCD934X_CDC_RX0_RX_VOL_CTL + (w->shift * in wcd934x_codec_enable_main_path()
3604 struct snd_soc_component *comp = snd_soc_dapm_to_component(w->dapm); in wcd934x_codec_ear_dac_event()
3605 struct wcd934x_codec *wcd = dev_get_drvdata(comp->dev); in wcd934x_codec_ear_dac_event()
3613 wcd_clsh_ctrl_set_state(wcd->clsh_ctrl, WCD_CLSH_EVENT_PRE_DAC, in wcd934x_codec_ear_dac_event()
3618 wcd_clsh_ctrl_set_state(wcd->clsh_ctrl, WCD_CLSH_EVENT_POST_PA, in wcd934x_codec_ear_dac_event()
3630 struct snd_soc_component *comp = snd_soc_dapm_to_component(w->dapm); in wcd934x_codec_hphl_dac_event()
3631 struct wcd934x_codec *wcd = dev_get_drvdata(comp->dev); in wcd934x_codec_hphl_dac_event()
3632 int hph_mode = wcd->hph_mode; in wcd934x_codec_hphl_dac_event()
3643 return -EINVAL; in wcd934x_codec_hphl_dac_event()
3655 wcd_clsh_ctrl_set_state(wcd->clsh_ctrl, WCD_CLSH_EVENT_PRE_DAC, in wcd934x_codec_hphl_dac_event()
3662 wcd_clsh_ctrl_set_state(wcd->clsh_ctrl, WCD_CLSH_EVENT_POST_PA, in wcd934x_codec_hphl_dac_event()
3682 struct snd_soc_component *comp = snd_soc_dapm_to_component(w->dapm); in wcd934x_codec_hphr_dac_event()
3683 struct wcd934x_codec *wcd = dev_get_drvdata(comp->dev); in wcd934x_codec_hphr_dac_event()
3684 int hph_mode = wcd->hph_mode; in wcd934x_codec_hphr_dac_event()
3693 return -EINVAL; in wcd934x_codec_hphr_dac_event()
3705 wcd_clsh_ctrl_set_state(wcd->clsh_ctrl, WCD_CLSH_EVENT_PRE_DAC, in wcd934x_codec_hphr_dac_event()
3713 wcd_clsh_ctrl_set_state(wcd->clsh_ctrl, WCD_CLSH_EVENT_POST_PA, in wcd934x_codec_hphr_dac_event()
3731 struct snd_soc_component *comp = snd_soc_dapm_to_component(w->dapm); in wcd934x_codec_lineout_dac_event()
3732 struct wcd934x_codec *wcd = dev_get_drvdata(comp->dev); in wcd934x_codec_lineout_dac_event()
3736 wcd_clsh_ctrl_set_state(wcd->clsh_ctrl, WCD_CLSH_EVENT_PRE_DAC, in wcd934x_codec_lineout_dac_event()
3740 wcd_clsh_ctrl_set_state(wcd->clsh_ctrl, WCD_CLSH_EVENT_POST_PA, in wcd934x_codec_lineout_dac_event()
3752 struct snd_soc_component *comp = snd_soc_dapm_to_component(w->dapm); in wcd934x_codec_enable_hphl_pa()
3813 struct snd_soc_component *comp = snd_soc_dapm_to_component(w->dapm); in wcd934x_codec_enable_hphr_pa()
3887 adc_mux_index - 4; in wcd934x_get_dmic_sample_rate()
3893 & 0xF8) >> 3) - 1; in wcd934x_get_dmic_sample_rate()
3907 if (wcd->dmic_sample_rate <= in wcd934x_get_dmic_sample_rate()
3909 dmic_fs = wcd->dmic_sample_rate; in wcd934x_get_dmic_sample_rate()
3915 dmic_fs = wcd->dmic_sample_rate; in wcd934x_get_dmic_sample_rate()
3934 dev_err(comp->dev, in wcd934x_get_dmic_clk_val()
3961 dev_err(comp->dev, in wcd934x_get_dmic_clk_val()
3974 struct snd_soc_component *comp = snd_soc_dapm_to_component(w->dapm); in wcd934x_codec_enable_dmic()
3975 struct wcd934x_codec *wcd = dev_get_drvdata(comp->dev); in wcd934x_codec_enable_dmic()
3985 wname = strpbrk(w->name, "012345"); in wcd934x_codec_enable_dmic()
3987 dev_err(comp->dev, "%s: widget not found\n", __func__); in wcd934x_codec_enable_dmic()
3988 return -EINVAL; in wcd934x_codec_enable_dmic()
3993 dev_err(comp->dev, "%s: Invalid DMIC line on the codec\n", in wcd934x_codec_enable_dmic()
3995 return -EINVAL; in wcd934x_codec_enable_dmic()
4001 dmic_clk_cnt = &wcd->dmic_0_1_clk_cnt; in wcd934x_codec_enable_dmic()
4006 dmic_clk_cnt = &wcd->dmic_2_3_clk_cnt; in wcd934x_codec_enable_dmic()
4011 dmic_clk_cnt = &wcd->dmic_4_5_clk_cnt; in wcd934x_codec_enable_dmic()
4015 dev_err(comp->dev, "%s: Invalid DMIC Selection\n", in wcd934x_codec_enable_dmic()
4017 return -EINVAL; in wcd934x_codec_enable_dmic()
4024 dmic_rate_val = wcd934x_get_dmic_clk_val(comp, wcd->rate, in wcd934x_codec_enable_dmic()
4038 (*dmic_clk_cnt)--; in wcd934x_codec_enable_dmic()
4074 (adc_mux_n - 4); in wcd934x_codec_find_amic_input()
4078 adc_mux_n - 4; in wcd934x_codec_find_amic_input()
4084 adc_mux_n - 4; in wcd934x_codec_find_amic_input()
4087 ((adc_mux_n == 8) ? (adc_mux_n - 8) : in wcd934x_codec_find_amic_input()
4088 (adc_mux_n - 9)); in wcd934x_codec_find_amic_input()
4092 adc_mux_n - 4; in wcd934x_codec_find_amic_input()
4098 adc_mux_n - 4; in wcd934x_codec_find_amic_input()
4104 adc_mux_n - 4; in wcd934x_codec_find_amic_input()
4140 struct snd_soc_component *comp = snd_soc_dapm_to_component(w->dapm); in wcd934x_codec_enable_dec()
4151 widget_name = kstrndup(w->name, 15, GFP_KERNEL); in wcd934x_codec_enable_dec()
4153 return -ENOMEM; in wcd934x_codec_enable_dec()
4158 dev_err(comp->dev, "%s: Invalid decimator = %s\n", in wcd934x_codec_enable_dec()
4159 __func__, w->name); in wcd934x_codec_enable_dec()
4160 ret = -EINVAL; in wcd934x_codec_enable_dec()
4167 dev_err(comp->dev, "%s: decimator index not found\n", in wcd934x_codec_enable_dec()
4169 ret = -EINVAL; in wcd934x_codec_enable_dec()
4175 dev_err(comp->dev, "%s: Invalid decimator = %s\n", in wcd934x_codec_enable_dec()
4177 ret = -EINVAL; in wcd934x_codec_enable_dec()
4307 struct snd_soc_component *comp = snd_soc_dapm_to_component(w->dapm); in wcd934x_codec_enable_adc()
4311 wcd934x_codec_set_tx_hold(comp, w->reg, true); in wcd934x_codec_enable_adc()
4348 SND_SOC_DAPM_MUX("SLIM RX0 MUX", SND_SOC_NOPM, WCD934X_RX0, 0,
4350 SND_SOC_DAPM_MUX("SLIM RX1 MUX", SND_SOC_NOPM, WCD934X_RX1, 0,
4352 SND_SOC_DAPM_MUX("SLIM RX2 MUX", SND_SOC_NOPM, WCD934X_RX2, 0,
4354 SND_SOC_DAPM_MUX("SLIM RX3 MUX", SND_SOC_NOPM, WCD934X_RX3, 0,
4356 SND_SOC_DAPM_MUX("SLIM RX4 MUX", SND_SOC_NOPM, WCD934X_RX4, 0,
4358 SND_SOC_DAPM_MUX("SLIM RX5 MUX", SND_SOC_NOPM, WCD934X_RX5, 0,
4360 SND_SOC_DAPM_MUX("SLIM RX6 MUX", SND_SOC_NOPM, WCD934X_RX6, 0,
4362 SND_SOC_DAPM_MUX("SLIM RX7 MUX", SND_SOC_NOPM, WCD934X_RX7, 0,
4365 SND_SOC_DAPM_MIXER("SLIM RX0", SND_SOC_NOPM, 0, 0, NULL, 0),
4366 SND_SOC_DAPM_MIXER("SLIM RX1", SND_SOC_NOPM, 0, 0, NULL, 0),
4367 SND_SOC_DAPM_MIXER("SLIM RX2", SND_SOC_NOPM, 0, 0, NULL, 0),
4368 SND_SOC_DAPM_MIXER("SLIM RX3", SND_SOC_NOPM, 0, 0, NULL, 0),
4369 SND_SOC_DAPM_MIXER("SLIM RX4", SND_SOC_NOPM, 0, 0, NULL, 0),
4370 SND_SOC_DAPM_MIXER("SLIM RX5", SND_SOC_NOPM, 0, 0, NULL, 0),
4371 SND_SOC_DAPM_MIXER("SLIM RX6", SND_SOC_NOPM, 0, 0, NULL, 0),
4372 SND_SOC_DAPM_MIXER("SLIM RX7", SND_SOC_NOPM, 0, 0, NULL, 0),
4680 SND_SOC_DAPM_MIXER("SLIM TX0", SND_SOC_NOPM, 0, 0, NULL, 0),
4681 SND_SOC_DAPM_MIXER("SLIM TX1", SND_SOC_NOPM, 0, 0, NULL, 0),
4682 SND_SOC_DAPM_MIXER("SLIM TX2", SND_SOC_NOPM, 0, 0, NULL, 0),
4683 SND_SOC_DAPM_MIXER("SLIM TX3", SND_SOC_NOPM, 0, 0, NULL, 0),
4684 SND_SOC_DAPM_MIXER("SLIM TX4", SND_SOC_NOPM, 0, 0, NULL, 0),
4685 SND_SOC_DAPM_MIXER("SLIM TX5", SND_SOC_NOPM, 0, 0, NULL, 0),
4686 SND_SOC_DAPM_MIXER("SLIM TX6", SND_SOC_NOPM, 0, 0, NULL, 0),
4687 SND_SOC_DAPM_MIXER("SLIM TX7", SND_SOC_NOPM, 0, 0, NULL, 0),
4688 SND_SOC_DAPM_MIXER("SLIM TX8", SND_SOC_NOPM, 0, 0, NULL, 0),
4689 SND_SOC_DAPM_MIXER("SLIM TX9", SND_SOC_NOPM, 0, 0, NULL, 0),
4690 SND_SOC_DAPM_MIXER("SLIM TX10", SND_SOC_NOPM, 0, 0, NULL, 0),
4691 SND_SOC_DAPM_MIXER("SLIM TX11", SND_SOC_NOPM, 0, 0, NULL, 0),
4692 SND_SOC_DAPM_MIXER("SLIM TX13", SND_SOC_NOPM, 0, 0, NULL, 0),
4827 /* RX0-RX7 */
4972 struct device *dev = &wcd->sdev->dev; in wcd934x_codec_parse_data() local
4975 ifc_dev_np = of_parse_phandle(dev->of_node, "slim-ifc-dev", 0); in wcd934x_codec_parse_data()
4977 dev_err(dev, "No Interface device found\n"); in wcd934x_codec_parse_data()
4978 return -EINVAL; in wcd934x_codec_parse_data()
4981 wcd->sidev = of_slim_get_device(wcd->sdev->ctrl, ifc_dev_np); in wcd934x_codec_parse_data()
4982 if (!wcd->sidev) { in wcd934x_codec_parse_data()
4983 dev_err(dev, "Unable to get SLIM Interface device\n"); in wcd934x_codec_parse_data()
4984 return -EINVAL; in wcd934x_codec_parse_data()
4987 slim_get_logical_addr(wcd->sidev); in wcd934x_codec_parse_data()
4988 wcd->if_regmap = regmap_init_slimbus(wcd->sidev, in wcd934x_codec_parse_data()
4990 if (IS_ERR(wcd->if_regmap)) { in wcd934x_codec_parse_data()
4991 dev_err(dev, "Failed to allocate ifc register map\n"); in wcd934x_codec_parse_data()
4992 return PTR_ERR(wcd->if_regmap); in wcd934x_codec_parse_data()
4995 of_property_read_u32(dev->parent->of_node, "qcom,dmic-sample-rate", in wcd934x_codec_parse_data()
4996 &wcd->dmic_sample_rate); in wcd934x_codec_parse_data()
5003 struct wcd934x_ddata *data = dev_get_drvdata(pdev->dev.parent); in wcd934x_codec_probe()
5005 struct device *dev = &pdev->dev; in wcd934x_codec_probe() local
5008 wcd = devm_kzalloc(&pdev->dev, sizeof(*wcd), GFP_KERNEL); in wcd934x_codec_probe()
5010 return -ENOMEM; in wcd934x_codec_probe()
5012 wcd->dev = dev; in wcd934x_codec_probe()
5013 wcd->regmap = data->regmap; in wcd934x_codec_probe()
5014 wcd->extclk = data->extclk; in wcd934x_codec_probe()
5015 wcd->sdev = to_slim_device(data->dev); in wcd934x_codec_probe()
5016 mutex_init(&wcd->sysclk_mutex); in wcd934x_codec_probe()
5020 dev_err(wcd->dev, "Failed to get SLIM IRQ\n"); in wcd934x_codec_probe()
5025 regmap_update_bits(wcd->regmap, WCD934X_CODEC_RPM_CLK_MCLK_CFG, in wcd934x_codec_probe()
5028 memcpy(wcd->rx_chs, wcd934x_rx_chs, sizeof(wcd934x_rx_chs)); in wcd934x_codec_probe()
5029 memcpy(wcd->tx_chs, wcd934x_tx_chs, sizeof(wcd934x_tx_chs)); in wcd934x_codec_probe()
5031 irq = regmap_irq_get_virq(data->irq_data, WCD934X_IRQ_SLIMBUS); in wcd934x_codec_probe()
5033 dev_err(wcd->dev, "Failed to get SLIM IRQ\n"); in wcd934x_codec_probe()
5037 ret = devm_request_threaded_irq(dev, irq, NULL, in wcd934x_codec_probe()
5040 "slim", wcd); in wcd934x_codec_probe()
5042 dev_err(dev, "Failed to request slimbus irq\n"); in wcd934x_codec_probe()
5049 return devm_snd_soc_register_component(dev, &wcd934x_component_drv, in wcd934x_codec_probe()
5056 .name = "wcd934x-codec",
5066 .name = "wcd934x-codec",
5070 MODULE_ALIAS("platform:wcd934x-codec");