Lines Matching +full:tegra210 +full:- +full:adx

1 // SPDX-License-Identifier: GPL-2.0-only
3 // tegra210_adx.c - Tegra210 ADX driver
5 // Copyright (c) 2021-2023 NVIDIA CORPORATION. All rights reserved.
35 static void tegra210_adx_write_map_ram(struct tegra210_adx *adx) in tegra210_adx_write_map_ram() argument
39 regmap_write(adx->regmap, TEGRA210_ADX_CFG_RAM_CTRL, in tegra210_adx_write_map_ram()
45 regmap_write(adx->regmap, TEGRA210_ADX_CFG_RAM_DATA, in tegra210_adx_write_map_ram()
46 adx->map[i]); in tegra210_adx_write_map_ram()
48 regmap_write(adx->regmap, TEGRA210_ADX_IN_BYTE_EN0, adx->byte_mask[0]); in tegra210_adx_write_map_ram()
49 regmap_write(adx->regmap, TEGRA210_ADX_IN_BYTE_EN1, adx->byte_mask[1]); in tegra210_adx_write_map_ram()
55 struct tegra210_adx *adx = snd_soc_dai_get_drvdata(dai); in tegra210_adx_startup() local
59 /* Ensure if ADX status is disabled */ in tegra210_adx_startup()
60 err = regmap_read_poll_timeout_atomic(adx->regmap, TEGRA210_ADX_STATUS, in tegra210_adx_startup()
63 dev_err(dai->dev, "failed to stop ADX, err = %d\n", err); in tegra210_adx_startup()
73 regmap_update_bits(adx->regmap, TEGRA210_ADX_SOFT_RESET, in tegra210_adx_startup()
77 err = regmap_read_poll_timeout(adx->regmap, TEGRA210_ADX_SOFT_RESET, in tegra210_adx_startup()
80 dev_err(dai->dev, "failed to reset ADX, err = %d\n", err); in tegra210_adx_startup()
89 struct tegra210_adx *adx = dev_get_drvdata(dev); in tegra210_adx_runtime_suspend() local
91 regcache_cache_only(adx->regmap, true); in tegra210_adx_runtime_suspend()
92 regcache_mark_dirty(adx->regmap); in tegra210_adx_runtime_suspend()
99 struct tegra210_adx *adx = dev_get_drvdata(dev); in tegra210_adx_runtime_resume() local
101 regcache_cache_only(adx->regmap, false); in tegra210_adx_runtime_resume()
102 regcache_sync(adx->regmap); in tegra210_adx_runtime_resume()
104 tegra210_adx_write_map_ram(adx); in tegra210_adx_runtime_resume()
114 struct tegra210_adx *adx = snd_soc_dai_get_drvdata(dai); in tegra210_adx_set_audio_cif() local
121 return -EINVAL; in tegra210_adx_set_audio_cif()
134 return -EINVAL; in tegra210_adx_set_audio_cif()
142 tegra_set_cif(adx->regmap, reg, &cif_conf); in tegra210_adx_set_audio_cif()
153 TEGRA210_ADX_TX1_CIF_CTRL + ((dai->id - 1) * TEGRA210_ADX_AUDIOCIF_CH_STRIDE)); in tegra210_adx_out_hw_params()
169 struct tegra210_adx *adx = snd_soc_component_get_drvdata(cmpnt); in tegra210_adx_get_byte_map() local
171 unsigned char *bytes_map = (unsigned char *)&adx->map; in tegra210_adx_get_byte_map()
174 mc = (struct soc_mixer_control *)kcontrol->private_value; in tegra210_adx_get_byte_map()
175 enabled = adx->byte_mask[mc->reg / 32] & (1 << (mc->reg % 32)); in tegra210_adx_get_byte_map()
188 ucontrol->value.integer.value[0] = bytes_map[mc->reg]; in tegra210_adx_get_byte_map()
190 ucontrol->value.integer.value[0] = 256; in tegra210_adx_get_byte_map()
199 struct tegra210_adx *adx = snd_soc_component_get_drvdata(cmpnt); in tegra210_adx_put_byte_map() local
200 unsigned char *bytes_map = (unsigned char *)&adx->map; in tegra210_adx_put_byte_map()
201 int value = ucontrol->value.integer.value[0]; in tegra210_adx_put_byte_map()
203 (struct soc_mixer_control *)kcontrol->private_value; in tegra210_adx_put_byte_map()
204 unsigned int mask_val = adx->byte_mask[mc->reg / 32]; in tegra210_adx_put_byte_map()
207 mask_val |= (1 << (mc->reg % 32)); in tegra210_adx_put_byte_map()
209 mask_val &= ~(1 << (mc->reg % 32)); in tegra210_adx_put_byte_map()
211 if (mask_val == adx->byte_mask[mc->reg / 32]) in tegra210_adx_put_byte_map()
215 bytes_map[mc->reg] = value % 256; in tegra210_adx_put_byte_map()
216 adx->byte_mask[mc->reg / 32] = mask_val; in tegra210_adx_put_byte_map()
232 .name = "ADX-RX-CIF", \
234 .stream_name = "RX-CIF-Playback", \
243 .stream_name = "RX-CIF-Capture", \
256 .name = "ADX-TX" #id "-CIF", \
258 .stream_name = "TX" #id "-CIF-Playback",\
267 .stream_name = "TX" #id "-CIF-Capture", \
296 { "XBAR-" sname, NULL, "XBAR-TX" }, \
297 { "RX-CIF-" sname, NULL, "XBAR-" sname }, \
298 { "RX", NULL, "RX-CIF-" sname }, \
300 { "TX" #id "-CIF-" sname, NULL, "TX" #id }, \
301 { "TX" #id " XBAR-" sname, NULL, "TX" #id "-CIF-" sname }, \
302 { "TX" #id " XBAR-RX", NULL, "TX" #id " XBAR-" sname }
309 { "XBAR-" sname, NULL, "XBAR-TX" }, \
310 { "RX-CIF-" sname, NULL, "XBAR-" sname }, \
311 { "RX", NULL, "RX-CIF-" sname }, \
313 { "TX" #id "-CIF-" sname, NULL, "TX" #id }, \
314 { "TX" #id " XBAR-" sname, NULL, "TX" #id "-CIF-" sname }, \
315 { "TX" #id " XBAR-RX", NULL, "TX" #id " XBAR-" sname }
472 { .compatible = "nvidia,tegra210-adx" },
479 struct device *dev = &pdev->dev; in tegra210_adx_platform_probe()
480 struct tegra210_adx *adx; in tegra210_adx_platform_probe() local
484 adx = devm_kzalloc(dev, sizeof(*adx), GFP_KERNEL); in tegra210_adx_platform_probe()
485 if (!adx) in tegra210_adx_platform_probe()
486 return -ENOMEM; in tegra210_adx_platform_probe()
488 dev_set_drvdata(dev, adx); in tegra210_adx_platform_probe()
494 adx->regmap = devm_regmap_init_mmio(dev, regs, in tegra210_adx_platform_probe()
496 if (IS_ERR(adx->regmap)) { in tegra210_adx_platform_probe()
498 return PTR_ERR(adx->regmap); in tegra210_adx_platform_probe()
501 regcache_cache_only(adx->regmap, true); in tegra210_adx_platform_probe()
507 dev_err(dev, "can't register ADX component, err: %d\n", err); in tegra210_adx_platform_probe()
518 pm_runtime_disable(&pdev->dev); in tegra210_adx_platform_remove()
530 .name = "tegra210-adx",
540 MODULE_DESCRIPTION("Tegra210 ADX ASoC driver");