mirror of
git://nv-tegra.nvidia.com/linux-nv-oot.git
synced 2025-12-22 09:11:26 +03:00
ASoC: tegra-alt: Dump APE register for debugging
Add support with a mixer control using which APE register status can be dumped from userspace during an error or while debugging. Bug 200307023 Change-Id: I489bdaeeec16975a872b9b145a1672f3f4ef1928 Reviewed-on:http://git-master/r/#/c/1478879 Signed-off-by: Mohan Kumar <mkumard@nvidia.com> Reviewed-on: http://git-master/r/1499107 Reviewed-by: Automatic_Commit_Validation_User GVS: Gerrit_Virtual_Submit Reviewed-by: svccoveritychecker <svccoveritychecker@nvidia.com> Reviewed-by: Dipesh Gandhi <dipeshg@nvidia.com> Reviewed-by: Ravindra Lokhande <rlokhande@nvidia.com>
This commit is contained in:
committed by
Sameer Pujar
parent
e1e49b52f6
commit
654d951c76
@@ -589,6 +589,78 @@ static int tegra_admaif_put_format(struct snd_kcontrol *kcontrol,
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void tegra_admaif_reg_dump(struct tegra_admaif *admaif)
|
||||
{
|
||||
int i, stride;
|
||||
int ret;
|
||||
int tx_offset = admaif->soc_data->reg_offsets.tx_enable;
|
||||
|
||||
ret = pm_runtime_get_sync(admaif->dev->parent);
|
||||
if (ret < 0) {
|
||||
dev_err(admaif->dev, "parent get_sync failed: %d\n", ret);
|
||||
return;
|
||||
}
|
||||
|
||||
pr_info("=========ADMAIF reg dump=========\n");
|
||||
|
||||
for (i = 0; i < admaif->soc_data->num_ch; i++) {
|
||||
stride = (i * TEGRA_ADMAIF_CHANNEL_REG_STRIDE);
|
||||
pr_info("RX%d_Enable = %#x\n", i+1,
|
||||
readl(admaif->base_addr +
|
||||
TEGRA_ADMAIF_XBAR_RX_ENABLE + stride));
|
||||
pr_info("RX%d_STATUS = %#x\n", i+1,
|
||||
readl(admaif->base_addr +
|
||||
TEGRA_ADMAIF_XBAR_RX_STATUS + stride));
|
||||
pr_info("RX%d_CIF_CTRL = %#x\n", i+1,
|
||||
readl(admaif->base_addr +
|
||||
TEGRA_ADMAIF_CHAN_ACIF_RX_CTRL + stride));
|
||||
pr_info("RX%d_FIFO_CTRL = %#x\n", i+1,
|
||||
readl(admaif->base_addr +
|
||||
TEGRA_ADMAIF_XBAR_RX_FIFO_CTRL + stride));
|
||||
pr_info("TX%d_Enable = %#x\n", i+1,
|
||||
readl(admaif->base_addr + tx_offset +
|
||||
stride));
|
||||
pr_info("TX%d_STATUS = %#x\n", i+1,
|
||||
readl(admaif->base_addr + tx_offset +
|
||||
TEGRA_ADMAIF_XBAR_TX_STATUS + stride));
|
||||
pr_info("TX%d_CIF_CTRL = %#x\n", i+1,
|
||||
readl(admaif->base_addr + tx_offset +
|
||||
TEGRA_ADMAIF_CHAN_ACIF_TX_CTRL + stride));
|
||||
pr_info("TX%d_FIFO_CTRL = %#x\n", i+1,
|
||||
readl(admaif->base_addr + tx_offset +
|
||||
TEGRA_ADMAIF_XBAR_TX_FIFO_CTRL + stride));
|
||||
}
|
||||
pm_runtime_put_sync(admaif->dev->parent);
|
||||
}
|
||||
static int tegra210_ape_dump_reg_get(struct snd_kcontrol *kcontrol,
|
||||
struct snd_ctl_elem_value *ucontrol)
|
||||
{
|
||||
struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
|
||||
struct tegra_admaif *admaif = snd_soc_codec_get_drvdata(codec);
|
||||
|
||||
ucontrol->value.integer.value[0] = admaif->reg_dump_flag;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int tegra210_ape_dump_reg_put(struct snd_kcontrol *kcontrol,
|
||||
struct snd_ctl_elem_value *ucontrol)
|
||||
{
|
||||
struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
|
||||
struct tegra_admaif *admaif = snd_soc_codec_get_drvdata(codec);
|
||||
|
||||
admaif->reg_dump_flag = ucontrol->value.integer.value[0];
|
||||
|
||||
if (admaif->reg_dump_flag) {
|
||||
#if IS_ENABLED(CONFIG_TEGRA210_ADMA)
|
||||
tegra_adma_dump_ch_reg();
|
||||
#endif
|
||||
tegra_admaif_reg_dump(admaif);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int tegra_admaif_dai_probe(struct snd_soc_dai *dai)
|
||||
{
|
||||
struct tegra_admaif *admaif = snd_soc_dai_get_drvdata(dai);
|
||||
@@ -893,6 +965,8 @@ static struct snd_kcontrol_new tegra210_admaif_controls[] = {
|
||||
TEGRA_ADMAIF_TX_CIF_CTRL(8),
|
||||
TEGRA_ADMAIF_TX_CIF_CTRL(9),
|
||||
TEGRA_ADMAIF_TX_CIF_CTRL(10),
|
||||
SOC_SINGLE_EXT("APE Reg Dump", SND_SOC_NOPM, 0, 1, 0,
|
||||
tegra210_ape_dump_reg_get, tegra210_ape_dump_reg_put),
|
||||
};
|
||||
|
||||
static struct snd_kcontrol_new tegra186_admaif_controls[] = {
|
||||
@@ -956,6 +1030,8 @@ static struct snd_kcontrol_new tegra186_admaif_controls[] = {
|
||||
TEGRA_ADMAIF_TX_CIF_CTRL(18),
|
||||
TEGRA_ADMAIF_TX_CIF_CTRL(19),
|
||||
TEGRA_ADMAIF_TX_CIF_CTRL(20),
|
||||
SOC_SINGLE_EXT("APE Reg Dump", SND_SOC_NOPM, 0, 1, 0,
|
||||
tegra210_ape_dump_reg_get, tegra210_ape_dump_reg_put),
|
||||
};
|
||||
|
||||
static int tegra_admaif_codec_probe(struct snd_soc_codec *codec)
|
||||
@@ -1052,6 +1128,7 @@ static int tegra_admaif_probe(struct platform_device *pdev)
|
||||
}
|
||||
|
||||
admaif->refcnt = 0;
|
||||
admaif->dev = &pdev->dev;
|
||||
|
||||
admaif->soc_data = (struct tegra_admaif_soc_data *)match->data;
|
||||
admaif->is_shutdown = false;
|
||||
@@ -1117,6 +1194,7 @@ static int tegra_admaif_probe(struct platform_device *pdev)
|
||||
goto err;
|
||||
}
|
||||
|
||||
admaif->base_addr = regs;
|
||||
admaif->regmap = devm_regmap_init_mmio(&pdev->dev, regs,
|
||||
admaif->soc_data->regmap_conf);
|
||||
if (IS_ERR(admaif->regmap)) {
|
||||
|
||||
Reference in New Issue
Block a user