From ae473fa8b41f023bfd1dc64fa560b7a4dfd7cfd2 Mon Sep 17 00:00:00 2001 From: Sameer Pujar Date: Tue, 13 Jul 2021 16:48:49 +0530 Subject: [PATCH] ASoC: tegra: OPE DAPM path uses wrong regmap OPE enable is not happening even though the DAPM path is complete. This seems to happen because ASoC core does not use correct regmap interface for the DAPM route listed by driver. The driver makes use of multiple regmap interfaces (one each for OPE, PEQ and MBDRC). The core populates component regmap using dev_get_regmap(), which actually returns the last registered interface in the OPE driver probe() call. Since the same callback function is not available in later versions of kernel for component driver, use component probe() call to setup the regmap. Bug 200750067 Jira EMA-393 Change-Id: Ib509a9f95f4c152c2210f88975a1f7572d79ba08 Signed-off-by: Sameer Pujar Reviewed-on: http://git-master/r/1318570 (cherry picked from commit 545ee019fc4a7c5b0b92a488cd3d16dbbcefbba9 in partial and updated logic for it to work on newer kernel) Reviewed-on: https://git-master.nvidia.com/r/c/linux-5.10/+/2558375 Reviewed-by: svcacv Reviewed-by: svc_kernel_abi Reviewed-by: Mohan Kumar D Reviewed-by: Sheetal . Reviewed-by: Sharad Gupta Reviewed-by: Viswanath L Reviewed-by: mobile promotions Tested-by: Sheetal . Tested-by: mobile promotions GVS: Gerrit_Virtual_Submit --- sound/soc/tegra/tegra210_ope.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/sound/soc/tegra/tegra210_ope.c b/sound/soc/tegra/tegra210_ope.c index 5aed85b5..dad152c6 100644 --- a/sound/soc/tegra/tegra210_ope.c +++ b/sound/soc/tegra/tegra210_ope.c @@ -125,9 +125,24 @@ static int tegra210_ope_hw_params(struct snd_pcm_substream *substream, static int tegra210_ope_codec_probe(struct snd_soc_component *cmpnt) { + struct tegra210_ope *ope = dev_get_drvdata(cmpnt->dev); + tegra210_peq_codec_init(cmpnt); tegra210_mbdrc_codec_init(cmpnt); + /* + * The OPE, PEQ and MBDRC functionalities are combined under one + * device registered by OPE driver. However there are separate + * regmap interfaces for each of these. ASoC core depends on + * dev_get_regmap() to populate the regmap field for a given ASoC + * component. Due to multiple regmap interfaces, it always uses + * the last registered interface in probe(). The DAPM routes in + * the current driver depend on OPE regmap. So to avoid dependency + * on probe order and to allow DAPM paths to use correct regmap + * below explicit assignment is done. + */ + snd_soc_component_init_regmap(cmpnt, ope->regmap); + return 0; }