Lines Matching +full:spk +full:- +full:mono
1 // SPDX-License-Identifier: GPL-2.0-only
2 // SPDX-FileCopyrightText: Copyright (c) 2020-2024 NVIDIA CORPORATION & AFFILIATES. All rights rese…
4 // tegra186_dspk.c - Tegra186 DSPK driver
34 ucontrol->value.integer.value[0] = dspk->rx_fifo_th; in tegra186_dspk_get_fifo_th()
44 int value = ucontrol->value.integer.value[0]; in tegra186_dspk_put_fifo_th()
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()
60 ucontrol->value.enumerated.item[0] = dspk->osr_val; in tegra186_dspk_get_osr_val()
70 unsigned int value = ucontrol->value.enumerated.item[0]; in tegra186_dspk_put_osr_val()
72 if (value == dspk->osr_val) in tegra186_dspk_put_osr_val()
75 dspk->osr_val = value; in tegra186_dspk_put_osr_val()
86 ucontrol->value.enumerated.item[0] = dspk->lrsel; in tegra186_dspk_get_pol_sel()
96 unsigned int value = ucontrol->value.enumerated.item[0]; in tegra186_dspk_put_pol_sel()
98 if (value == dspk->lrsel) in tegra186_dspk_put_pol_sel()
101 dspk->lrsel = value; in tegra186_dspk_put_pol_sel()
112 ucontrol->value.enumerated.item[0] = dspk->ch_sel; in tegra186_dspk_get_ch_sel()
122 unsigned int value = ucontrol->value.enumerated.item[0]; in tegra186_dspk_put_ch_sel()
124 if (value == dspk->ch_sel) in tegra186_dspk_put_ch_sel()
127 dspk->ch_sel = value; in tegra186_dspk_put_ch_sel()
138 ucontrol->value.enumerated.item[0] = dspk->mono_to_stereo; in tegra186_dspk_get_mono_to_stereo()
148 unsigned int value = ucontrol->value.enumerated.item[0]; in tegra186_dspk_put_mono_to_stereo()
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()
164 ucontrol->value.enumerated.item[0] = dspk->stereo_to_mono; in tegra186_dspk_get_stereo_to_mono()
174 unsigned int value = ucontrol->value.enumerated.item[0]; in tegra186_dspk_put_stereo_to_mono()
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()
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()
201 err = clk_prepare_enable(dspk->clk_dspk); 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()
219 struct device *dev = dai->dev; in tegra186_dspk_hw_params()
230 switch (dspk->ch_sel) { in tegra186_dspk_hw_params()
240 return -EINVAL; in tegra186_dspk_hw_params()
254 return -EOPNOTSUPP; in tegra186_dspk_hw_params()
260 max_th = (TEGRA186_DSPK_RX_FIFO_DEPTH / cif_conf.audio_ch) - 1; 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()
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()
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",
311 .stream_name = "CIF-Playback",
320 .name = "DSPK-DAP",
322 .stream_name = "DAP-Playback",
336 SND_SOC_DAPM_SPK("SPK", NULL),
340 { "XBAR-Playback", NULL, "XBAR-TX" },
341 { "CIF-Playback", NULL, "XBAR-Playback" },
342 { "RX", NULL, "CIF-Playback" },
343 { "DAP-Playback", NULL, "RX" },
344 { "SPK", NULL, "DAP-Playback" },
391 TEGRA186_DSPK_RX_FIFO_DEPTH - 1, 0,
399 SOC_ENUM_EXT("Mono To Stereo", tegra186_dspk_mono_conv_enum,
402 SOC_ENUM_EXT("Stereo To Mono", tegra186_dspk_stereo_conv_enum,
471 { .compatible = "nvidia,tegra186-dspk" },
478 struct device *dev = &pdev->dev; in tegra186_dspk_platform_probe()
485 return -ENOMEM; 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()
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()
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()
528 pm_runtime_disable(&pdev->dev); in tegra186_dspk_platform_remove()
540 .name = "tegra186-dspk",