From aa1f1ad2924472334e4e46a7e1e3700dd320b61b Mon Sep 17 00:00:00 2001 From: Mohan Kumar Date: Wed, 21 Aug 2019 14:05:56 +0530 Subject: [PATCH] ASoC: tegra-alt: Remove on fly curve change support on the fly curve type change needs hw soft reset or MVC disable and enable programming sequence to be followed with re-programming all the required register. Current driver code support is not fully compliant with the IAS programming sequence. So to better handling remove the on fly curve type support from the mvc driver. Bug 200532059 Change-Id: I55a44134b07d1ddfebf103796d47930158ff770d Signed-off-by: Mohan Kumar Reviewed-on: https://git-master.nvidia.com/r/2180060 (cherry picked from commit 608bcd2adf33b3f1daa5dad37441295351ea6e0c) Reviewed-on: https://git-master.nvidia.com/r/2184303 GVS: Gerrit_Virtual_Submit Reviewed-by: Asha Talambedu Reviewed-by: Ravindra Lokhande Reviewed-by: mobile promotions Tested-by: mobile promotions --- sound/soc/tegra-alt/tegra210_mvc_alt.c | 37 ++++++-------------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/sound/soc/tegra-alt/tegra210_mvc_alt.c b/sound/soc/tegra-alt/tegra210_mvc_alt.c index c755035a..b1b33f81 100644 --- a/sound/soc/tegra-alt/tegra210_mvc_alt.c +++ b/sound/soc/tegra-alt/tegra210_mvc_alt.c @@ -226,42 +226,15 @@ static int tegra210_mvc_put_curve_type(struct snd_kcontrol *kcontrol, { struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol); struct tegra210_mvc *mvc = snd_soc_codec_get_drvdata(codec); - unsigned int reg = TEGRA210_MVC_CTRL; - int ret = 0; - /* if no change in curve type, do nothing */ - if (mvc->curve_type == ucontrol->value.integer.value[0]) - return ret; - - pm_runtime_get_sync(codec->dev); - - /* change curve type */ - ret |= regmap_update_bits(mvc->regmap, reg, - TEGRA210_MVC_CURVE_TYPE_MASK, - ucontrol->value.integer.value[0] << - TEGRA210_MVC_CURVE_TYPE_SHIFT); mvc->curve_type = ucontrol->value.integer.value[0]; - - ret = tegra210_mvc_soft_reset(mvc); - if (ret < 0) { - dev_err(codec->dev, "SOFT_RESET error: %d\n", ret); - return ret; - } - /* change volume to default init for new curve type */ - if (ucontrol->value.integer.value[0] == CURVE_POLY) + if (mvc->curve_type == CURVE_POLY) mvc->volume = TEGRA210_MVC_INIT_VOL_DEFAULT_POLY; else mvc->volume = TEGRA210_MVC_INIT_VOL_DEFAULT_LINEAR; - regmap_write(mvc->regmap, TEGRA210_MVC_TARGET_VOL, mvc->volume); - ret |= regmap_update_bits(mvc->regmap, TEGRA210_MVC_SWITCH, - TEGRA210_MVC_VOLUME_SWITCH_MASK, - TEGRA210_MVC_VOLUME_SWITCH_TRIGGER); - - pm_runtime_put(codec->dev); - - return ret; + return 0; } static int tegra210_mvc_get_audio_bits(struct snd_kcontrol *kcontrol, @@ -409,6 +382,12 @@ static int tegra210_mvc_hw_params(struct snd_pcm_substream *substream, TEGRA210_MVC_PER_CHAN_CTRL_EN_MASK, ~(TEGRA210_MVC_PER_CHAN_CTRL_EN_MASK)); + /* change curve type */ + ret = regmap_update_bits(mvc->regmap, TEGRA210_MVC_CTRL, + TEGRA210_MVC_CURVE_TYPE_MASK, + mvc->curve_type << + TEGRA210_MVC_CURVE_TYPE_SHIFT); + /* init the default volume=1 for MVC */ regmap_write(mvc->regmap, TEGRA210_MVC_INIT_VOL, mvc->volume);