From 47e3d32fc06628ab50b019279b2e09cad314e22f Mon Sep 17 00:00:00 2001 From: sheetal Date: Thu, 17 Jun 2021 15:46:21 +0530 Subject: [PATCH] ASoC: tegra: Add MVC Bypass support - Add "MVC Bypass" kcontrol to enable MVC Bypass mode. - The change is required to verify MVC bypass mode during bring up. Bug 200683609 Change-Id: Ic0f2c947fa2e9bd6e9b429b86ff35e053775ec80 Signed-off-by: sheetal Reviewed-on: https://git-master.nvidia.com/r/c/linux-5.10/+/2546568 Reviewed-by: svcacv Reviewed-by: Sameer Pujar Reviewed-by: Viswanath L Reviewed-by: svc_kernel_abi Reviewed-by: Mohan Kumar D Reviewed-by: Sharad Gupta Reviewed-by: mobile promotions GVS: Gerrit_Virtual_Submit Tested-by: mobile promotions --- sound/soc/tegra/tegra210_mvc.c | 11 +++++++++++ sound/soc/tegra/tegra210_mvc.h | 4 ++++ 2 files changed, 15 insertions(+) diff --git a/sound/soc/tegra/tegra210_mvc.c b/sound/soc/tegra/tegra210_mvc.c index 7062235b..b05c1e70 100644 --- a/sound/soc/tegra/tegra210_mvc.c +++ b/sound/soc/tegra/tegra210_mvc.c @@ -337,6 +337,8 @@ static int tegra210_mvc_get_format(struct snd_kcontrol *kcontrol, ucontrol->value.integer.value[0] = mvc->format_in; else if (strstr(kcontrol->id.name, "Audio Channels")) ucontrol->value.integer.value[0] = mvc->cif_channels; + else if (strstr(kcontrol->id.name, "Bypass")) + ucontrol->value.integer.value[0] = mvc->bypass_mode; return 0; } @@ -353,6 +355,8 @@ static int tegra210_mvc_put_format(struct snd_kcontrol *kcontrol, mvc->format_in = value; else if (strstr(kcontrol->id.name, "Audio Channels")) mvc->cif_channels = value; + else if (strstr(kcontrol->id.name, "Bypass")) + mvc->bypass_mode = value; return 0; } @@ -455,6 +459,11 @@ static int tegra210_mvc_hw_params(struct snd_pcm_substream *substream, /* program duration_inv */ regmap_write(mvc->regmap, TEGRA210_MVC_DURATION_INV, mvc->duration_inv); + /* set bypass mode */ + regmap_update_bits(mvc->regmap, TEGRA210_MVC_CTRL, + TEGRA210_MVC_BYPASS_MODE_MASK, + mvc->bypass_mode << TEGRA210_MVC_BYPASS_MODE_SHIFT); + return err; } @@ -517,6 +526,8 @@ static const struct snd_kcontrol_new tegra210_mvc_vol_ctrl[] = { tegra210_mvc_get_format, tegra210_mvc_put_format), SOC_ENUM_EXT("Audio Bit Format", tegra210_mvc_format_enum, tegra210_mvc_get_format, tegra210_mvc_put_format), + SOC_SINGLE_EXT("Bypass", TEGRA210_MVC_CTRL, 0, 1, 0, + tegra210_mvc_get_format, tegra210_mvc_put_format), }; static struct snd_soc_dai_driver tegra210_mvc_dais[] = { diff --git a/sound/soc/tegra/tegra210_mvc.h b/sound/soc/tegra/tegra210_mvc.h index 9231243b..85b63e57 100644 --- a/sound/soc/tegra/tegra210_mvc.h +++ b/sound/soc/tegra/tegra210_mvc.h @@ -81,6 +81,9 @@ #define TEGRA210_MVC_INIT_VOL_DEFAULT_POLY 0x01000000 #define TEGRA210_MVC_INIT_VOL_DEFAULT_LINEAR 0x00000000 +#define TEGRA210_MVC_BYPASS_MODE_SHIFT 31 +#define TEGRA210_MVC_BYPASS_MODE_MASK (1 << TEGRA210_MVC_BYPASS_MODE_SHIFT) + /* Fields in TEGRA210_MVC ram ctrl */ #define TEGRA210_MVC_CFG_RAM_CTRL_RW_SHIFT 14 #define TEGRA210_MVC_CFG_RAM_CTRL_RW_WRITE (1 << TEGRA210_MVC_CFG_RAM_CTRL_RW_SHIFT) @@ -113,6 +116,7 @@ struct tegra210_mvc { unsigned int cif_channels; unsigned int audio_bits; unsigned int format_in; + bool bypass_mode; }; #endif