Lines Matching +full:tegra210 +full:- +full:ahub
1 // SPDX-License-Identifier: GPL-2.0-only
3 // tegra210_amx.c - Tegra210 AMX driver
5 // Copyright (c) 2021-2023 NVIDIA CORPORATION. All rights reserved.
24 * The counter is in terms of AHUB clock cycles. If a frame is not
27 * function of sample rate (8 kHz) and AHUB clock (49.152 MHz).
53 regmap_write(amx->regmap, TEGRA210_AMX_CFG_RAM_CTRL, in tegra210_amx_write_map_ram()
59 regmap_write(amx->regmap, TEGRA210_AMX_CFG_RAM_DATA, in tegra210_amx_write_map_ram()
60 amx->map[i]); in tegra210_amx_write_map_ram()
62 regmap_write(amx->regmap, TEGRA210_AMX_OUT_BYTE_EN0, amx->byte_mask[0]); in tegra210_amx_write_map_ram()
63 regmap_write(amx->regmap, TEGRA210_AMX_OUT_BYTE_EN1, amx->byte_mask[1]); in tegra210_amx_write_map_ram()
74 err = regmap_read_poll_timeout(amx->regmap, TEGRA210_AMX_STATUS, val, in tegra210_amx_startup()
77 dev_err(dai->dev, "failed to stop AMX, err = %d\n", err); in tegra210_amx_startup()
87 regmap_update_bits(amx->regmap, TEGRA210_AMX_SOFT_RESET, in tegra210_amx_startup()
91 err = regmap_read_poll_timeout(amx->regmap, TEGRA210_AMX_SOFT_RESET, in tegra210_amx_startup()
94 dev_err(dai->dev, "failed to reset AMX, err = %d\n", err); in tegra210_amx_startup()
105 regcache_cache_only(amx->regmap, true); in tegra210_amx_runtime_suspend()
106 regcache_mark_dirty(amx->regmap); in tegra210_amx_runtime_suspend()
115 regcache_cache_only(amx->regmap, false); in tegra210_amx_runtime_resume()
116 regcache_sync(amx->regmap); in tegra210_amx_runtime_resume()
118 regmap_update_bits(amx->regmap, in tegra210_amx_runtime_resume()
151 return -EINVAL; in tegra210_amx_set_audio_cif()
159 tegra_set_cif(amx->regmap, reg, &cif_conf); in tegra210_amx_set_audio_cif()
170 if (amx->soc_data->auto_disable) { in tegra210_amx_in_hw_params()
171 regmap_write(amx->regmap, in tegra210_amx_in_hw_params()
172 AMX_CH_REG(dai->id, TEGRA194_AMX_RX1_FRAME_PERIOD), in tegra210_amx_in_hw_params()
174 regmap_write(amx->regmap, TEGRA210_AMX_CYA, 1); in tegra210_amx_in_hw_params()
178 AMX_CH_REG(dai->id, TEGRA210_AMX_RX1_CIF_CTRL)); in tegra210_amx_in_hw_params()
194 (struct soc_mixer_control *)kcontrol->private_value; in tegra210_amx_get_byte_map()
196 unsigned char *bytes_map = (unsigned char *)&amx->map; in tegra210_amx_get_byte_map()
197 int reg = mc->reg; in tegra210_amx_get_byte_map()
201 enabled = amx->byte_mask[1] & (1 << (reg - 32)); in tegra210_amx_get_byte_map()
203 enabled = amx->byte_mask[0] & (1 << reg); in tegra210_amx_get_byte_map()
216 ucontrol->value.integer.value[0] = bytes_map[reg]; in tegra210_amx_get_byte_map()
218 ucontrol->value.integer.value[0] = 256; in tegra210_amx_get_byte_map()
227 (struct soc_mixer_control *)kcontrol->private_value; in tegra210_amx_put_byte_map()
230 unsigned char *bytes_map = (unsigned char *)&amx->map; in tegra210_amx_put_byte_map()
231 int reg = mc->reg; in tegra210_amx_put_byte_map()
232 int value = ucontrol->value.integer.value[0]; in tegra210_amx_put_byte_map()
233 unsigned int mask_val = amx->byte_mask[reg / 32]; in tegra210_amx_put_byte_map()
240 if (mask_val == amx->byte_mask[reg / 32]) in tegra210_amx_put_byte_map()
245 amx->byte_mask[reg / 32] = mask_val; in tegra210_amx_put_byte_map()
261 .name = "AMX-RX-CIF" #id, \
263 .stream_name = "RX" #id "-CIF-Playback",\
272 .stream_name = "RX" #id "-CIF-Capture", \
285 .name = "AMX-TX-CIF", \
287 .stream_name = "TX-CIF-Playback", \
296 .stream_name = "TX-CIF-Capture", \
325 { "RX" #id " XBAR-" sname, NULL, "RX" #id " XBAR-TX" }, \
326 { "RX" #id "-CIF-" sname, NULL, "RX" #id " XBAR-" sname },\
327 { "RX" #id, NULL, "RX" #id "-CIF-" sname }, \
329 { "TX-CIF-" sname, NULL, "TX" }, \
330 { "XBAR-" sname, NULL, "TX-CIF-" sname }, \
331 { "XBAR-RX", NULL, "XBAR-" sname }
526 { .compatible = "nvidia,tegra210-amx", .data = &soc_data_tegra210 },
527 { .compatible = "nvidia,tegra194-amx", .data = &soc_data_tegra194 },
534 struct device *dev = &pdev->dev; in tegra210_amx_platform_probe()
541 return -ENOMEM; in tegra210_amx_platform_probe()
543 amx->soc_data = device_get_match_data(dev); in tegra210_amx_platform_probe()
551 amx->regmap = devm_regmap_init_mmio(dev, regs, in tegra210_amx_platform_probe()
552 amx->soc_data->regmap_conf); in tegra210_amx_platform_probe()
553 if (IS_ERR(amx->regmap)) { in tegra210_amx_platform_probe()
555 return PTR_ERR(amx->regmap); in tegra210_amx_platform_probe()
558 regcache_cache_only(amx->regmap, true); in tegra210_amx_platform_probe()
575 pm_runtime_disable(&pdev->dev); in tegra210_amx_platform_remove()
587 .name = "tegra210-amx",
597 MODULE_DESCRIPTION("Tegra210 AMX ASoC driver");