Lines Matching full:da7213

3  * DA7213 ALSA SoC Codec Driver
27 #include <sound/da7213.h>
28 #include "da7213.h"
217 struct da7213_priv *da7213 = snd_soc_component_get_drvdata(component); in da7213_volsw_locked_get() local
220 mutex_lock(&da7213->ctrl_lock); in da7213_volsw_locked_get()
222 mutex_unlock(&da7213->ctrl_lock); in da7213_volsw_locked_get()
231 struct da7213_priv *da7213 = snd_soc_component_get_drvdata(component); in da7213_volsw_locked_put() local
234 mutex_lock(&da7213->ctrl_lock); in da7213_volsw_locked_put()
236 mutex_unlock(&da7213->ctrl_lock); in da7213_volsw_locked_put()
245 struct da7213_priv *da7213 = snd_soc_component_get_drvdata(component); in da7213_enum_locked_get() local
248 mutex_lock(&da7213->ctrl_lock); in da7213_enum_locked_get()
250 mutex_unlock(&da7213->ctrl_lock); in da7213_enum_locked_get()
259 struct da7213_priv *da7213 = snd_soc_component_get_drvdata(component); in da7213_enum_locked_put() local
262 mutex_lock(&da7213->ctrl_lock); in da7213_enum_locked_put()
264 mutex_unlock(&da7213->ctrl_lock); in da7213_enum_locked_put()
359 struct da7213_priv *da7213 = snd_soc_component_get_drvdata(component); in da7213_alc_calib() local
401 if (da7213->alc_calib_auto) in da7213_alc_calib()
423 struct da7213_priv *da7213 = snd_soc_component_get_drvdata(component); in da7213_put_mixin_gain() local
429 if ((!ret) && (da7213->alc_en)) in da7213_put_mixin_gain()
439 struct da7213_priv *da7213 = snd_soc_component_get_drvdata(component); in da7213_put_alc_sw() local
444 if (!da7213->alc_en) { in da7213_put_alc_sw()
446 da7213->alc_en = true; in da7213_put_alc_sw()
449 da7213->alc_en = false; in da7213_put_alc_sw()
460 struct da7213_priv *da7213 = snd_soc_component_get_drvdata(component); in da7213_tonegen_freq_get() local
467 mutex_lock(&da7213->ctrl_lock); in da7213_tonegen_freq_get()
468 ret = regmap_raw_read(da7213->regmap, reg, &val, sizeof(val)); in da7213_tonegen_freq_get()
469 mutex_unlock(&da7213->ctrl_lock); in da7213_tonegen_freq_get()
487 struct da7213_priv *da7213 = snd_soc_component_get_drvdata(component); in da7213_tonegen_freq_put() local
501 mutex_lock(&da7213->ctrl_lock); in da7213_tonegen_freq_put()
502 ret = regmap_raw_read(da7213->regmap, reg, &val_old, sizeof(val_old)); in da7213_tonegen_freq_put()
504 ret = regmap_raw_write(da7213->regmap, reg, in da7213_tonegen_freq_put()
506 mutex_unlock(&da7213->ctrl_lock); in da7213_tonegen_freq_put()
901 struct da7213_priv *da7213 = snd_soc_component_get_drvdata(component); in da7213_dai_event() local
909 if (da7213->master) in da7213_dai_event()
960 if (da7213->master) in da7213_dai_event()
1324 struct da7213_priv *da7213 = snd_soc_component_get_drvdata(component); in da7213_hw_params() local
1332 if (da7213->fmt != DA7213_DAI_FORMAT_DSP) { in da7213_hw_params()
1368 da7213->out_rate = DA7213_PLL_FREQ_OUT_98304000; in da7213_hw_params()
1372 da7213->out_rate = DA7213_PLL_FREQ_OUT_90316800; in da7213_hw_params()
1376 da7213->out_rate = DA7213_PLL_FREQ_OUT_98304000; in da7213_hw_params()
1380 da7213->out_rate = DA7213_PLL_FREQ_OUT_98304000; in da7213_hw_params()
1384 da7213->out_rate = DA7213_PLL_FREQ_OUT_90316800; in da7213_hw_params()
1388 da7213->out_rate = DA7213_PLL_FREQ_OUT_98304000; in da7213_hw_params()
1392 da7213->out_rate = DA7213_PLL_FREQ_OUT_90316800; in da7213_hw_params()
1396 da7213->out_rate = DA7213_PLL_FREQ_OUT_98304000; in da7213_hw_params()
1400 da7213->out_rate = DA7213_PLL_FREQ_OUT_90316800; in da7213_hw_params()
1404 da7213->out_rate = DA7213_PLL_FREQ_OUT_98304000; in da7213_hw_params()
1423 struct da7213_priv *da7213 = snd_soc_component_get_drvdata(component); in da7213_set_dai_fmt() local
1430 da7213->master = true; in da7213_set_dai_fmt()
1433 da7213->master = false; in da7213_set_dai_fmt()
1489 da7213->fmt = DA7213_DAI_FORMAT_I2S_MODE; in da7213_set_dai_fmt()
1493 da7213->fmt = DA7213_DAI_FORMAT_LEFT_J; in da7213_set_dai_fmt()
1497 da7213->fmt = DA7213_DAI_FORMAT_RIGHT_J; in da7213_set_dai_fmt()
1502 da7213->fmt = DA7213_DAI_FORMAT_DSP; in da7213_set_dai_fmt()
1506 da7213->fmt = DA7213_DAI_FORMAT_DSP; in da7213_set_dai_fmt()
1552 struct da7213_priv *da7213 = snd_soc_component_get_drvdata(component); in da7213_set_component_sysclk() local
1555 if ((da7213->clk_src == clk_id) && (da7213->mclk_rate == freq)) in da7213_set_component_sysclk()
1579 da7213->clk_src = clk_id; in da7213_set_component_sysclk()
1581 if (da7213->mclk) { in da7213_set_component_sysclk()
1582 freq = clk_round_rate(da7213->mclk, freq); in da7213_set_component_sysclk()
1583 ret = clk_set_rate(da7213->mclk, freq); in da7213_set_component_sysclk()
1591 da7213->mclk_rate = freq; in da7213_set_component_sysclk()
1601 struct da7213_priv *da7213 = snd_soc_component_get_drvdata(component); in _da7213_set_component_pll() local
1609 if (da7213->mclk_rate == 32768) { in _da7213_set_component_pll()
1610 if (!da7213->master) { in _da7213_set_component_pll()
1623 if (da7213->mclk_rate < 5000000) { in _da7213_set_component_pll()
1626 da7213->mclk_rate); in _da7213_set_component_pll()
1628 } else if (da7213->mclk_rate <= 9000000) { in _da7213_set_component_pll()
1631 } else if (da7213->mclk_rate <= 18000000) { in _da7213_set_component_pll()
1634 } else if (da7213->mclk_rate <= 36000000) { in _da7213_set_component_pll()
1637 } else if (da7213->mclk_rate <= 54000000) { in _da7213_set_component_pll()
1643 da7213->mclk_rate); in _da7213_set_component_pll()
1646 freq_ref = (da7213->mclk_rate / indiv); in _da7213_set_component_pll()
1665 if (da7213->mclk_rate != 32768) { in _da7213_set_component_pll()
1712 struct da7213_priv *da7213 = snd_soc_component_get_drvdata(component); in da7213_set_component_pll() local
1713 da7213->fixed_clk_auto_pll = false; in da7213_set_component_pll()
1745 .name = "da7213-hifi",
1768 struct da7213_priv *da7213 = snd_soc_component_get_drvdata(component); in da7213_set_auto_pll() local
1771 if (!da7213->fixed_clk_auto_pll) in da7213_set_auto_pll()
1774 da7213->mclk_rate = clk_get_rate(da7213->mclk); in da7213_set_auto_pll()
1778 if (da7213->master) in da7213_set_auto_pll()
1784 switch (da7213->out_rate) { in da7213_set_auto_pll()
1786 if (da7213->mclk_rate == 11289600 || in da7213_set_auto_pll()
1787 da7213->mclk_rate == 22579200 || in da7213_set_auto_pll()
1788 da7213->mclk_rate == 45158400) in da7213_set_auto_pll()
1792 if (da7213->mclk_rate == 12288000 || in da7213_set_auto_pll()
1793 da7213->mclk_rate == 24576000 || in da7213_set_auto_pll()
1794 da7213->mclk_rate == 49152000) in da7213_set_auto_pll()
1807 da7213->mclk_rate, da7213->out_rate); in da7213_set_auto_pll()
1813 struct da7213_priv *da7213 = snd_soc_component_get_drvdata(component); in da7213_set_bias_level() local
1822 if (da7213->mclk) { in da7213_set_bias_level()
1823 ret = clk_prepare_enable(da7213->mclk); in da7213_set_bias_level()
1842 if (da7213->mclk) { in da7213_set_bias_level()
1844 clk_disable_unprepare(da7213->mclk); in da7213_set_bias_level()
1861 { .compatible = "dlg,da7213", },
1977 struct da7213_priv *da7213 = snd_soc_component_get_drvdata(component); in da7213_probe() local
1984 da7213->alc_calib_auto = true; in da7213_probe()
2041 da7213->pdata = dev_get_platdata(component->dev); in da7213_probe()
2042 if (!da7213->pdata) in da7213_probe()
2043 da7213->pdata = da7213_fw_to_pdata(component); in da7213_probe()
2046 if (da7213->pdata) { in da7213_probe()
2047 struct da7213_platform_data *pdata = da7213->pdata; in da7213_probe()
2104 da7213->mclk = devm_clk_get_optional(component->dev, "mclk"); in da7213_probe()
2105 if (IS_ERR(da7213->mclk)) in da7213_probe()
2106 return PTR_ERR(da7213->mclk); in da7213_probe()
2107 if (da7213->mclk) in da7213_probe()
2111 da7213->fixed_clk_auto_pll = true; in da7213_probe()
2147 struct da7213_priv *da7213 = data; in da7213_power_off() local
2148 regulator_bulk_disable(DA7213_NUM_SUPPLIES, da7213->supplies); in da7213_power_off()
2158 struct da7213_priv *da7213; in da7213_i2c_probe() local
2161 da7213 = devm_kzalloc(&i2c->dev, sizeof(*da7213), GFP_KERNEL); in da7213_i2c_probe()
2162 if (!da7213) in da7213_i2c_probe()
2165 i2c_set_clientdata(i2c, da7213); in da7213_i2c_probe()
2169 da7213->supplies[i].supply = da7213_supply_names[i]; in da7213_i2c_probe()
2172 da7213->supplies); in da7213_i2c_probe()
2178 ret = regulator_bulk_enable(DA7213_NUM_SUPPLIES, da7213->supplies); in da7213_i2c_probe()
2182 ret = devm_add_action_or_reset(&i2c->dev, da7213_power_off, da7213); in da7213_i2c_probe()
2186 da7213->regmap = devm_regmap_init_i2c(i2c, &da7213_regmap_config); in da7213_i2c_probe()
2187 if (IS_ERR(da7213->regmap)) { in da7213_i2c_probe()
2188 ret = PTR_ERR(da7213->regmap); in da7213_i2c_probe()
2201 dev_err(&i2c->dev, "Failed to register da7213 component: %d\n", in da7213_i2c_probe()
2214 struct da7213_priv *da7213 = dev_get_drvdata(dev); in da7213_runtime_suspend() local
2216 regcache_cache_only(da7213->regmap, true); in da7213_runtime_suspend()
2217 regcache_mark_dirty(da7213->regmap); in da7213_runtime_suspend()
2218 regulator_bulk_disable(DA7213_NUM_SUPPLIES, da7213->supplies); in da7213_runtime_suspend()
2225 struct da7213_priv *da7213 = dev_get_drvdata(dev); in da7213_runtime_resume() local
2228 ret = regulator_bulk_enable(DA7213_NUM_SUPPLIES, da7213->supplies); in da7213_runtime_resume()
2231 regcache_cache_only(da7213->regmap, false); in da7213_runtime_resume()
2232 regcache_sync(da7213->regmap); in da7213_runtime_resume()
2241 { "da7213" },
2249 .name = "da7213",
2261 MODULE_DESCRIPTION("ASoC DA7213 Codec driver");