Lines Matching +full:spk +full:- +full:mono

1 // SPDX-License-Identifier: GPL-2.0-only
3 // tegra186_dspk.c - Tegra186 DSPK driver
35 ucontrol->value.integer.value[0] = dspk->rx_fifo_th; in tegra186_dspk_get_fifo_th()
45 int value = ucontrol->value.integer.value[0]; in tegra186_dspk_put_fifo_th()
47 if (value == dspk->rx_fifo_th) in tegra186_dspk_put_fifo_th()
50 dspk->rx_fifo_th = value; in tegra186_dspk_put_fifo_th()
61 ucontrol->value.enumerated.item[0] = dspk->osr_val; in tegra186_dspk_get_osr_val()
71 unsigned int value = ucontrol->value.enumerated.item[0]; in tegra186_dspk_put_osr_val()
73 if (value == dspk->osr_val) in tegra186_dspk_put_osr_val()
76 dspk->osr_val = value; in tegra186_dspk_put_osr_val()
87 ucontrol->value.enumerated.item[0] = dspk->lrsel; in tegra186_dspk_get_pol_sel()
97 unsigned int value = ucontrol->value.enumerated.item[0]; in tegra186_dspk_put_pol_sel()
99 if (value == dspk->lrsel) in tegra186_dspk_put_pol_sel()
102 dspk->lrsel = value; in tegra186_dspk_put_pol_sel()
113 ucontrol->value.enumerated.item[0] = dspk->ch_sel; in tegra186_dspk_get_ch_sel()
123 unsigned int value = ucontrol->value.enumerated.item[0]; in tegra186_dspk_put_ch_sel()
125 if (value == dspk->ch_sel) in tegra186_dspk_put_ch_sel()
128 dspk->ch_sel = value; in tegra186_dspk_put_ch_sel()
139 ucontrol->value.enumerated.item[0] = dspk->mono_to_stereo; in tegra186_dspk_get_mono_to_stereo()
149 unsigned int value = ucontrol->value.enumerated.item[0]; in tegra186_dspk_put_mono_to_stereo()
151 if (value == dspk->mono_to_stereo) in tegra186_dspk_put_mono_to_stereo()
154 dspk->mono_to_stereo = value; in tegra186_dspk_put_mono_to_stereo()
165 ucontrol->value.enumerated.item[0] = dspk->stereo_to_mono; in tegra186_dspk_get_stereo_to_mono()
175 unsigned int value = ucontrol->value.enumerated.item[0]; in tegra186_dspk_put_stereo_to_mono()
177 if (value == dspk->stereo_to_mono) in tegra186_dspk_put_stereo_to_mono()
180 dspk->stereo_to_mono = value; in tegra186_dspk_put_stereo_to_mono()
189 regcache_cache_only(dspk->regmap, true); in tegra186_dspk_runtime_suspend()
190 regcache_mark_dirty(dspk->regmap); in tegra186_dspk_runtime_suspend()
192 clk_disable_unprepare(dspk->clk_dspk); in tegra186_dspk_runtime_suspend()
202 err = clk_prepare_enable(dspk->clk_dspk); in tegra186_dspk_runtime_resume()
208 regcache_cache_only(dspk->regmap, false); in tegra186_dspk_runtime_resume()
209 regcache_sync(dspk->regmap); in tegra186_dspk_runtime_resume()
220 struct device *dev = dai->dev; in tegra186_dspk_hw_params()
231 switch (dspk->ch_sel) { in tegra186_dspk_hw_params()
241 return -EINVAL; in tegra186_dspk_hw_params()
255 return -EOPNOTSUPP; in tegra186_dspk_hw_params()
261 max_th = (TEGRA186_DSPK_RX_FIFO_DEPTH / cif_conf.audio_ch) - 1; in tegra186_dspk_hw_params()
263 if (dspk->rx_fifo_th > max_th) in tegra186_dspk_hw_params()
264 dspk->rx_fifo_th = max_th; in tegra186_dspk_hw_params()
266 cif_conf.threshold = dspk->rx_fifo_th; in tegra186_dspk_hw_params()
267 cif_conf.mono_conv = dspk->mono_to_stereo; in tegra186_dspk_hw_params()
268 cif_conf.stereo_conv = dspk->stereo_to_mono; in tegra186_dspk_hw_params()
270 tegra_set_cif(dspk->regmap, TEGRA186_DSPK_RX_CIF_CTRL, in tegra186_dspk_hw_params()
279 dspk_clk = (DSPK_OSR_FACTOR << dspk->osr_val) * srate * DSPK_CLK_RATIO; in tegra186_dspk_hw_params()
281 err = clk_set_rate(dspk->clk_dspk, dspk_clk); in tegra186_dspk_hw_params()
289 regmap_update_bits(dspk->regmap, in tegra186_dspk_hw_params()
297 (dspk->osr_val << DSPK_OSR_SHIFT) | in tegra186_dspk_hw_params()
298 ((dspk->ch_sel + 1) << CH_SEL_SHIFT) | in tegra186_dspk_hw_params()
299 (dspk->lrsel << LRSEL_POL_SHIFT)); in tegra186_dspk_hw_params()
310 .name = "DSPK-CIF",
312 .stream_name = "CIF-Playback",
321 .name = "DSPK-DAP",
323 .stream_name = "DAP-Playback",
337 SND_SOC_DAPM_SPK("SPK", NULL),
341 { "XBAR-Playback", NULL, "XBAR-TX" },
342 { "CIF-Playback", NULL, "XBAR-Playback" },
343 { "RX", NULL, "CIF-Playback" },
344 { "DAP-Playback", NULL, "RX" },
345 { "SPK", NULL, "DAP-Playback" },
392 TEGRA186_DSPK_RX_FIFO_DEPTH - 1, 0,
400 SOC_ENUM_EXT("Mono To Stereo", tegra186_dspk_mono_conv_enum,
403 SOC_ENUM_EXT("Stereo To Mono", tegra186_dspk_stereo_conv_enum,
472 { .compatible = "nvidia,tegra186-dspk" },
479 struct device *dev = &pdev->dev; in tegra186_dspk_platform_probe()
486 return -ENOMEM; in tegra186_dspk_platform_probe()
488 dspk->osr_val = DSPK_OSR_64; in tegra186_dspk_platform_probe()
489 dspk->lrsel = DSPK_LRSEL_LEFT; in tegra186_dspk_platform_probe()
490 dspk->ch_sel = DSPK_CH_SELECT_STEREO; in tegra186_dspk_platform_probe()
491 dspk->mono_to_stereo = 0; /* "Zero" */ in tegra186_dspk_platform_probe()
495 dspk->clk_dspk = devm_clk_get(dev, "dspk"); in tegra186_dspk_platform_probe()
496 if (IS_ERR(dspk->clk_dspk)) { in tegra186_dspk_platform_probe()
498 return PTR_ERR(dspk->clk_dspk); in tegra186_dspk_platform_probe()
505 dspk->regmap = devm_regmap_init_mmio(dev, regs, &tegra186_dspk_regmap); in tegra186_dspk_platform_probe()
506 if (IS_ERR(dspk->regmap)) { in tegra186_dspk_platform_probe()
508 return PTR_ERR(dspk->regmap); in tegra186_dspk_platform_probe()
511 regcache_cache_only(dspk->regmap, true); in tegra186_dspk_platform_probe()
529 pm_runtime_disable(&pdev->dev); in tegra186_dspk_platform_remove()
543 .name = "tegra186-dspk",