Lines Matching full:dspk

4 // tegra186_dspk.c - Tegra186 DSPK driver
32 struct tegra186_dspk *dspk = snd_soc_component_get_drvdata(codec); in tegra186_dspk_get_fifo_th() local
34 ucontrol->value.integer.value[0] = dspk->rx_fifo_th; in tegra186_dspk_get_fifo_th()
43 struct tegra186_dspk *dspk = snd_soc_component_get_drvdata(codec); in tegra186_dspk_put_fifo_th() local
46 if (value == dspk->rx_fifo_th) in tegra186_dspk_put_fifo_th()
49 dspk->rx_fifo_th = value; in tegra186_dspk_put_fifo_th()
58 struct tegra186_dspk *dspk = snd_soc_component_get_drvdata(codec); in tegra186_dspk_get_osr_val() local
60 ucontrol->value.enumerated.item[0] = dspk->osr_val; in tegra186_dspk_get_osr_val()
69 struct tegra186_dspk *dspk = snd_soc_component_get_drvdata(codec); in tegra186_dspk_put_osr_val() local
72 if (value == dspk->osr_val) in tegra186_dspk_put_osr_val()
75 dspk->osr_val = value; in tegra186_dspk_put_osr_val()
84 struct tegra186_dspk *dspk = snd_soc_component_get_drvdata(codec); in tegra186_dspk_get_pol_sel() local
86 ucontrol->value.enumerated.item[0] = dspk->lrsel; in tegra186_dspk_get_pol_sel()
95 struct tegra186_dspk *dspk = snd_soc_component_get_drvdata(codec); in tegra186_dspk_put_pol_sel() local
98 if (value == dspk->lrsel) in tegra186_dspk_put_pol_sel()
101 dspk->lrsel = value; in tegra186_dspk_put_pol_sel()
110 struct tegra186_dspk *dspk = snd_soc_component_get_drvdata(codec); in tegra186_dspk_get_ch_sel() local
112 ucontrol->value.enumerated.item[0] = dspk->ch_sel; in tegra186_dspk_get_ch_sel()
121 struct tegra186_dspk *dspk = snd_soc_component_get_drvdata(codec); in tegra186_dspk_put_ch_sel() local
124 if (value == dspk->ch_sel) in tegra186_dspk_put_ch_sel()
127 dspk->ch_sel = value; in tegra186_dspk_put_ch_sel()
136 struct tegra186_dspk *dspk = snd_soc_component_get_drvdata(codec); in tegra186_dspk_get_mono_to_stereo() local
138 ucontrol->value.enumerated.item[0] = dspk->mono_to_stereo; in tegra186_dspk_get_mono_to_stereo()
147 struct tegra186_dspk *dspk = snd_soc_component_get_drvdata(codec); in tegra186_dspk_put_mono_to_stereo() local
150 if (value == dspk->mono_to_stereo) in tegra186_dspk_put_mono_to_stereo()
153 dspk->mono_to_stereo = value; in tegra186_dspk_put_mono_to_stereo()
162 struct tegra186_dspk *dspk = snd_soc_component_get_drvdata(codec); in tegra186_dspk_get_stereo_to_mono() local
164 ucontrol->value.enumerated.item[0] = dspk->stereo_to_mono; in tegra186_dspk_get_stereo_to_mono()
173 struct tegra186_dspk *dspk = snd_soc_component_get_drvdata(codec); in tegra186_dspk_put_stereo_to_mono() local
176 if (value == dspk->stereo_to_mono) in tegra186_dspk_put_stereo_to_mono()
179 dspk->stereo_to_mono = value; in tegra186_dspk_put_stereo_to_mono()
186 struct tegra186_dspk *dspk = dev_get_drvdata(dev); in tegra186_dspk_runtime_suspend() local
188 regcache_cache_only(dspk->regmap, true); in tegra186_dspk_runtime_suspend()
189 regcache_mark_dirty(dspk->regmap); in tegra186_dspk_runtime_suspend()
191 clk_disable_unprepare(dspk->clk_dspk); in tegra186_dspk_runtime_suspend()
198 struct tegra186_dspk *dspk = dev_get_drvdata(dev); in tegra186_dspk_runtime_resume() local
201 err = clk_prepare_enable(dspk->clk_dspk); in tegra186_dspk_runtime_resume()
203 dev_err(dev, "failed to enable DSPK clock, err: %d\n", err); in tegra186_dspk_runtime_resume()
207 regcache_cache_only(dspk->regmap, false); in tegra186_dspk_runtime_resume()
208 regcache_sync(dspk->regmap); in tegra186_dspk_runtime_resume()
217 struct tegra186_dspk *dspk = snd_soc_dai_get_drvdata(dai); in tegra186_dspk_hw_params() local
230 switch (dspk->ch_sel) { in tegra186_dspk_hw_params()
239 dev_err(dev, "Invalid DSPK client channels\n"); in tegra186_dspk_hw_params()
262 if (dspk->rx_fifo_th > max_th) in tegra186_dspk_hw_params()
263 dspk->rx_fifo_th = max_th; in tegra186_dspk_hw_params()
265 cif_conf.threshold = dspk->rx_fifo_th; in tegra186_dspk_hw_params()
266 cif_conf.mono_conv = dspk->mono_to_stereo; in tegra186_dspk_hw_params()
267 cif_conf.stereo_conv = dspk->stereo_to_mono; in tegra186_dspk_hw_params()
269 tegra_set_cif(dspk->regmap, TEGRA186_DSPK_RX_CIF_CTRL, in tegra186_dspk_hw_params()
273 * DSPK clock and PDM codec clock should be synchronous with 4:1 ratio, in tegra186_dspk_hw_params()
278 dspk_clk = (DSPK_OSR_FACTOR << dspk->osr_val) * srate * DSPK_CLK_RATIO; in tegra186_dspk_hw_params()
280 err = clk_set_rate(dspk->clk_dspk, dspk_clk); in tegra186_dspk_hw_params()
282 dev_err(dev, "can't set DSPK clock rate %u, err: %d\n", in tegra186_dspk_hw_params()
288 regmap_update_bits(dspk->regmap, in tegra186_dspk_hw_params()
296 (dspk->osr_val << DSPK_OSR_SHIFT) | in tegra186_dspk_hw_params()
297 ((dspk->ch_sel + 1) << CH_SEL_SHIFT) | in tegra186_dspk_hw_params()
298 (dspk->lrsel << LRSEL_POL_SHIFT)); in tegra186_dspk_hw_params()
309 .name = "DSPK-CIF",
320 .name = "DSPK-DAP",
471 { .compatible = "nvidia,tegra186-dspk" },
479 struct tegra186_dspk *dspk; in tegra186_dspk_platform_probe() local
483 dspk = devm_kzalloc(dev, sizeof(*dspk), GFP_KERNEL); in tegra186_dspk_platform_probe()
484 if (!dspk) in tegra186_dspk_platform_probe()
487 dspk->osr_val = DSPK_OSR_64; in tegra186_dspk_platform_probe()
488 dspk->lrsel = DSPK_LRSEL_LEFT; in tegra186_dspk_platform_probe()
489 dspk->ch_sel = DSPK_CH_SELECT_STEREO; in tegra186_dspk_platform_probe()
490 dspk->mono_to_stereo = 0; /* "Zero" */ in tegra186_dspk_platform_probe()
492 dev_set_drvdata(dev, dspk); in tegra186_dspk_platform_probe()
494 dspk->clk_dspk = devm_clk_get(dev, "dspk"); in tegra186_dspk_platform_probe()
495 if (IS_ERR(dspk->clk_dspk)) { in tegra186_dspk_platform_probe()
496 dev_err(dev, "can't retrieve DSPK clock\n"); in tegra186_dspk_platform_probe()
497 return PTR_ERR(dspk->clk_dspk); in tegra186_dspk_platform_probe()
504 dspk->regmap = devm_regmap_init_mmio(dev, regs, &tegra186_dspk_regmap); in tegra186_dspk_platform_probe()
505 if (IS_ERR(dspk->regmap)) { in tegra186_dspk_platform_probe()
507 return PTR_ERR(dspk->regmap); in tegra186_dspk_platform_probe()
510 regcache_cache_only(dspk->regmap, true); in tegra186_dspk_platform_probe()
516 dev_err(dev, "can't register DSPK component, err: %d\n", in tegra186_dspk_platform_probe()
540 .name = "tegra186-dspk",
551 MODULE_DESCRIPTION("Tegra186 ASoC DSPK driver");