Skip to content

Commit d900d9a

Browse files
Sheetalbroonie
authored andcommitted
ASoC: tegra: Fix SFC conversion for few rates
Sample rate conversions for rates greater than 48kHz are found to be failing. It means x->y conversions fail when either x or y is greater than 48kHz. This happens because, tegra210_sfc_rate_to_idx() returns incorrect index for rates greater than 48kHz. This actually depends on the tegra210_sfc_rates[] array and it is not in sync with frequency values of SFC TX/RX register. To be precise, 64kHz entry is missing in above array defined in the driver. Due to this wrong index is returned and this results in incorrect programming of coefficients. To fix this, align the tegra210_sfc_rates[] array with SFC register specification and thus add 64kHz entry to it. Also, the coefficient table is updated to reflect that none of the conversions are supported for 64kHz. Fixes: b2f74ec ("ASoC: tegra: Add Tegra210 based SFC driver") Cc: stable@vger.kernel.org Signed-off-by: Sheetal <sheetal@nvidia.com> Reviewed-by: Mohan Kumar D <mkumard@nvidia.com> Reviewed-by: Sameer Pujar <spujar@nvidia.com> Link: https://lore.kernel.org/r/Message-Id: <1687433656-7892-2-git-send-email-spujar@nvidia.com> Signed-off-by: Mark Brown <broonie@kernel.org>
1 parent a9e7c96 commit d900d9a

File tree

2 files changed

+32
-3
lines changed

2 files changed

+32
-3
lines changed

sound/soc/tegra/tegra210_sfc.c

Lines changed: 30 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
//
33
// tegra210_sfc.c - Tegra210 SFC driver
44
//
5-
// Copyright (c) 2021 NVIDIA CORPORATION. All rights reserved.
5+
// Copyright (c) 2021-2023 NVIDIA CORPORATION. All rights reserved.
66

77
#include <linux/clk.h>
88
#include <linux/device.h>
@@ -42,6 +42,7 @@ static const int tegra210_sfc_rates[TEGRA210_SFC_NUM_RATES] = {
4242
32000,
4343
44100,
4444
48000,
45+
64000,
4546
88200,
4647
96000,
4748
176400,
@@ -2857,6 +2858,7 @@ static s32 *coef_addr_table[TEGRA210_SFC_NUM_RATES][TEGRA210_SFC_NUM_RATES] = {
28572858
coef_8to32,
28582859
coef_8to44,
28592860
coef_8to48,
2861+
UNSUPP_CONV,
28602862
coef_8to88,
28612863
coef_8to96,
28622864
UNSUPP_CONV,
@@ -2872,6 +2874,7 @@ static s32 *coef_addr_table[TEGRA210_SFC_NUM_RATES][TEGRA210_SFC_NUM_RATES] = {
28722874
coef_11to32,
28732875
coef_11to44,
28742876
coef_11to48,
2877+
UNSUPP_CONV,
28752878
coef_11to88,
28762879
coef_11to96,
28772880
UNSUPP_CONV,
@@ -2887,6 +2890,7 @@ static s32 *coef_addr_table[TEGRA210_SFC_NUM_RATES][TEGRA210_SFC_NUM_RATES] = {
28872890
coef_16to32,
28882891
coef_16to44,
28892892
coef_16to48,
2893+
UNSUPP_CONV,
28902894
coef_16to88,
28912895
coef_16to96,
28922896
coef_16to176,
@@ -2902,6 +2906,7 @@ static s32 *coef_addr_table[TEGRA210_SFC_NUM_RATES][TEGRA210_SFC_NUM_RATES] = {
29022906
coef_22to32,
29032907
coef_22to44,
29042908
coef_22to48,
2909+
UNSUPP_CONV,
29052910
coef_22to88,
29062911
coef_22to96,
29072912
coef_22to176,
@@ -2917,6 +2922,7 @@ static s32 *coef_addr_table[TEGRA210_SFC_NUM_RATES][TEGRA210_SFC_NUM_RATES] = {
29172922
coef_24to32,
29182923
coef_24to44,
29192924
coef_24to48,
2925+
UNSUPP_CONV,
29202926
coef_24to88,
29212927
coef_24to96,
29222928
coef_24to176,
@@ -2932,6 +2938,7 @@ static s32 *coef_addr_table[TEGRA210_SFC_NUM_RATES][TEGRA210_SFC_NUM_RATES] = {
29322938
BYPASS_CONV,
29332939
coef_32to44,
29342940
coef_32to48,
2941+
UNSUPP_CONV,
29352942
coef_32to88,
29362943
coef_32to96,
29372944
coef_32to176,
@@ -2947,6 +2954,7 @@ static s32 *coef_addr_table[TEGRA210_SFC_NUM_RATES][TEGRA210_SFC_NUM_RATES] = {
29472954
coef_44to32,
29482955
BYPASS_CONV,
29492956
coef_44to48,
2957+
UNSUPP_CONV,
29502958
coef_44to88,
29512959
coef_44to96,
29522960
coef_44to176,
@@ -2962,11 +2970,28 @@ static s32 *coef_addr_table[TEGRA210_SFC_NUM_RATES][TEGRA210_SFC_NUM_RATES] = {
29622970
coef_48to32,
29632971
coef_48to44,
29642972
BYPASS_CONV,
2973+
UNSUPP_CONV,
29652974
coef_48to88,
29662975
coef_48to96,
29672976
coef_48to176,
29682977
coef_48to192,
29692978
},
2979+
/* Convertions from 64 kHz */
2980+
{
2981+
UNSUPP_CONV,
2982+
UNSUPP_CONV,
2983+
UNSUPP_CONV,
2984+
UNSUPP_CONV,
2985+
UNSUPP_CONV,
2986+
UNSUPP_CONV,
2987+
UNSUPP_CONV,
2988+
UNSUPP_CONV,
2989+
UNSUPP_CONV,
2990+
UNSUPP_CONV,
2991+
UNSUPP_CONV,
2992+
UNSUPP_CONV,
2993+
UNSUPP_CONV,
2994+
},
29702995
/* Convertions from 88.2 kHz */
29712996
{
29722997
coef_88to8,
@@ -2977,6 +3002,7 @@ static s32 *coef_addr_table[TEGRA210_SFC_NUM_RATES][TEGRA210_SFC_NUM_RATES] = {
29773002
coef_88to32,
29783003
coef_88to44,
29793004
coef_88to48,
3005+
UNSUPP_CONV,
29803006
BYPASS_CONV,
29813007
coef_88to96,
29823008
coef_88to176,
@@ -2991,6 +3017,7 @@ static s32 *coef_addr_table[TEGRA210_SFC_NUM_RATES][TEGRA210_SFC_NUM_RATES] = {
29913017
coef_96to32,
29923018
coef_96to44,
29933019
coef_96to48,
3020+
UNSUPP_CONV,
29943021
coef_96to88,
29953022
BYPASS_CONV,
29963023
coef_96to176,
@@ -3006,6 +3033,7 @@ static s32 *coef_addr_table[TEGRA210_SFC_NUM_RATES][TEGRA210_SFC_NUM_RATES] = {
30063033
coef_176to32,
30073034
coef_176to44,
30083035
coef_176to48,
3036+
UNSUPP_CONV,
30093037
coef_176to88,
30103038
coef_176to96,
30113039
BYPASS_CONV,
@@ -3021,6 +3049,7 @@ static s32 *coef_addr_table[TEGRA210_SFC_NUM_RATES][TEGRA210_SFC_NUM_RATES] = {
30213049
coef_192to32,
30223050
coef_192to44,
30233051
coef_192to48,
3052+
UNSUPP_CONV,
30243053
coef_192to88,
30253054
coef_192to96,
30263055
coef_192to176,

sound/soc/tegra/tegra210_sfc.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
/*
33
* tegra210_sfc.h - Definitions for Tegra210 SFC driver
44
*
5-
* Copyright (c) 2021 NVIDIA CORPORATION. All rights reserved.
5+
* Copyright (c) 2021-2023 NVIDIA CORPORATION. All rights reserved.
66
*
77
*/
88

@@ -47,7 +47,7 @@
4747
#define TEGRA210_SFC_EN_SHIFT 0
4848
#define TEGRA210_SFC_EN (1 << TEGRA210_SFC_EN_SHIFT)
4949

50-
#define TEGRA210_SFC_NUM_RATES 12
50+
#define TEGRA210_SFC_NUM_RATES 13
5151

5252
/* Fields in TEGRA210_SFC_COEF_RAM */
5353
#define TEGRA210_SFC_COEF_RAM_EN BIT(0)

0 commit comments

Comments
 (0)