From 2e000ca873d24456f1d6ea7f613f51385c151837 Mon Sep 17 00:00:00 2001 From: Sheetal Date: Tue, 1 Oct 2024 05:52:36 +0000 Subject: [PATCH] ASoC: tegra: Fix ASRC ratio restore issue "alsactl restore" was not able to restore the value goes beyond the signed int range for Ratio control. As Ratio control expected 64bit Integer, change the type and bits to 64 for "ASRC1 Ratio" controls. Bug 4870215 Change-Id: I96967968af151fa7b00d1d63bacade4c4d1ccce4 Signed-off-by: Sheetal Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3221692 Reviewed-by: Hirak Biswas GVS: buildbot_gerritrpt Reviewed-by: svcacv Reviewed-by: Sameer Pujar Reviewed-by: Mohan kumar --- .../soc/tegra-virt-alt/tegra_asoc_util_virt_alt.c | 14 ++++++++++++++ .../soc/tegra-virt-alt/tegra_asoc_util_virt_alt.h | 14 +++++++++----- 2 files changed, 23 insertions(+), 5 deletions(-) diff --git a/sound/soc/tegra-virt-alt/tegra_asoc_util_virt_alt.c b/sound/soc/tegra-virt-alt/tegra_asoc_util_virt_alt.c index afdeb541..b1a9d263 100644 --- a/sound/soc/tegra-virt-alt/tegra_asoc_util_virt_alt.c +++ b/sound/soc/tegra-virt-alt/tegra_asoc_util_virt_alt.c @@ -700,6 +700,20 @@ int tegra186_virt_asrc_set_ratio(struct snd_kcontrol *kcontrol, } EXPORT_SYMBOL(tegra186_virt_asrc_set_ratio); +int tegra186_virt_ratio_param_info(struct snd_kcontrol *kcontrol, + struct snd_ctl_elem_info *uinfo) +{ + struct soc_mreg_control *mc = + (struct soc_mreg_control *)kcontrol->private_value; + uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER64; + uinfo->count = 1; + uinfo->value.integer.min = mc->min; + uinfo->value.integer.max = mc->max; + + return 0; +} +EXPORT_SYMBOL(tegra186_virt_ratio_param_info); + int tegra186_virt_asrc_get_ratio_source(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) { diff --git a/sound/soc/tegra-virt-alt/tegra_asoc_util_virt_alt.h b/sound/soc/tegra-virt-alt/tegra_asoc_util_virt_alt.h index 035497db..f063d513 100644 --- a/sound/soc/tegra-virt-alt/tegra_asoc_util_virt_alt.h +++ b/sound/soc/tegra-virt-alt/tegra_asoc_util_virt_alt.h @@ -1,6 +1,6 @@ -/* SPDX-License-Identifier: GPL-2.0-only */ -/* - * Copyright (c) 2021-2022 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +/* SPDX-License-Identifier: GPL-2.0-only + * + * SPDX-FileCopyrightText: Copyright (c) 2021-2024 NVIDIA CORPORATION. All rights reserved. */ #ifndef __LINUX_VIRT_UTIL_H @@ -84,10 +84,11 @@ #define SOC_SINGLE_EXT_FRAC(xname, xregbase, xmax, xget, xput) \ { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = (xname), \ - .info = snd_soc_info_xr_sx, .get = xget, \ + .info = tegra186_virt_ratio_param_info, \ + .get = xget, \ .put = xput, \ .private_value = (unsigned long)&(struct soc_mreg_control) \ - {.regbase = xregbase, .regcount = 1, .nbits = 32, \ + {.regbase = xregbase, .regcount = 1, .nbits = 64, \ .invert = 0, .min = 0, .max = xmax} } #define ASRC_RATIO_CTRL_DECL(ename, reg) \ @@ -316,6 +317,9 @@ int tegra186_virt_asrc_get_ratio(struct snd_kcontrol *kcontrol, int tegra186_virt_asrc_set_ratio(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol); +int tegra186_virt_ratio_param_info(struct snd_kcontrol *kcontrol, + struct snd_ctl_elem_info *uinfo); + int tegra186_virt_asrc_get_ratio_source(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol); int tegra186_virt_asrc_set_ratio_source(struct snd_kcontrol *kcontrol,