mirror of
git://nv-tegra.nvidia.com/linux-nv-oot.git
synced 2025-12-22 17:25:35 +03:00
ASoC: tegra: Fix wrong value type in DMIC
commit 559d234569a998a4004de1bd1f12da5487fb826e upstream.
The enum controls are expected to use enumerated value type.
Update relevant references in control get/put callbacks.
Fixes: 8c8ff982e9e2 ("ASoC: tegra: Add Tegra210 based DMIC driver")
Suggested-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Sameer Pujar <spujar@nvidia.com>
Reviewed-by: Takashi Iwai <tiwai@suse.de>
Link: https://lore.kernel.org/r/1637219231-406-4-git-send-email-spujar@nvidia.com
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
//
|
||||
// tegra210_dmic.c - Tegra210 DMIC driver
|
||||
//
|
||||
// Copyright (c) 2020-2021 NVIDIA CORPORATION. All rights reserved.
|
||||
// Copyright (c) 2020 NVIDIA CORPORATION. All rights reserved.
|
||||
|
||||
#include <linux/clk.h>
|
||||
#include <linux/device.h>
|
||||
@@ -69,12 +69,6 @@ static int __maybe_unused tegra210_dmic_runtime_resume(struct device *dev)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static const unsigned int tegra210_dmic_fmts[] = {
|
||||
0,
|
||||
TEGRA_ACIF_BITS_16,
|
||||
TEGRA_ACIF_BITS_32,
|
||||
};
|
||||
|
||||
static int tegra210_dmic_hw_params(struct snd_pcm_substream *substream,
|
||||
struct snd_pcm_hw_params *params,
|
||||
struct snd_soc_dai *dai)
|
||||
@@ -90,8 +84,6 @@ static int tegra210_dmic_hw_params(struct snd_pcm_substream *substream,
|
||||
channels = params_channels(params);
|
||||
|
||||
cif_conf.audio_ch = channels;
|
||||
if (dmic->audio_ch_override)
|
||||
cif_conf.audio_ch = dmic->audio_ch_override;
|
||||
|
||||
switch (dmic->ch_select) {
|
||||
case DMIC_CH_SELECT_LEFT:
|
||||
@@ -107,8 +99,6 @@ static int tegra210_dmic_hw_params(struct snd_pcm_substream *substream,
|
||||
}
|
||||
|
||||
srate = params_rate(params);
|
||||
if (dmic->srate_override)
|
||||
srate = dmic->srate_override;
|
||||
|
||||
/*
|
||||
* DMIC clock rate is a multiple of 'Over Sampling Ratio' and
|
||||
@@ -149,7 +139,6 @@ static int tegra210_dmic_hw_params(struct snd_pcm_substream *substream,
|
||||
case SNDRV_PCM_FORMAT_S16_LE:
|
||||
cif_conf.audio_bits = TEGRA_ACIF_BITS_16;
|
||||
break;
|
||||
case SNDRV_PCM_FORMAT_S24_LE:
|
||||
case SNDRV_PCM_FORMAT_S32_LE:
|
||||
cif_conf.audio_bits = TEGRA_ACIF_BITS_32;
|
||||
break;
|
||||
@@ -158,10 +147,6 @@ static int tegra210_dmic_hw_params(struct snd_pcm_substream *substream,
|
||||
return -EOPNOTSUPP;
|
||||
}
|
||||
|
||||
if (dmic->audio_bits_override)
|
||||
cif_conf.audio_bits =
|
||||
tegra210_dmic_fmts[dmic->audio_bits_override];
|
||||
|
||||
cif_conf.client_bits = TEGRA_ACIF_BITS_24;
|
||||
cif_conf.mono_conv = dmic->mono_to_stereo;
|
||||
cif_conf.stereo_conv = dmic->stereo_to_mono;
|
||||
@@ -180,21 +165,15 @@ static int tegra210_dmic_get_control(struct snd_kcontrol *kcontrol,
|
||||
if (strstr(kcontrol->id.name, "Boost Gain Volume"))
|
||||
ucontrol->value.integer.value[0] = dmic->boost_gain;
|
||||
else if (strstr(kcontrol->id.name, "Channel Select"))
|
||||
ucontrol->value.integer.value[0] = dmic->ch_select;
|
||||
ucontrol->value.enumerated.item[0] = dmic->ch_select;
|
||||
else if (strstr(kcontrol->id.name, "Mono To Stereo"))
|
||||
ucontrol->value.integer.value[0] = dmic->mono_to_stereo;
|
||||
ucontrol->value.enumerated.item[0] = dmic->mono_to_stereo;
|
||||
else if (strstr(kcontrol->id.name, "Stereo To Mono"))
|
||||
ucontrol->value.integer.value[0] = dmic->stereo_to_mono;
|
||||
else if (strstr(kcontrol->id.name, "Audio Bit Format"))
|
||||
ucontrol->value.integer.value[0] = dmic->audio_bits_override;
|
||||
else if (strstr(kcontrol->id.name, "Sample Rate"))
|
||||
ucontrol->value.integer.value[0] = dmic->srate_override;
|
||||
else if (strstr(kcontrol->id.name, "Audio Channels"))
|
||||
ucontrol->value.integer.value[0] = dmic->audio_ch_override;
|
||||
ucontrol->value.enumerated.item[0] = dmic->stereo_to_mono;
|
||||
else if (strstr(kcontrol->id.name, "OSR Value"))
|
||||
ucontrol->value.integer.value[0] = dmic->osr_val;
|
||||
ucontrol->value.enumerated.item[0] = dmic->osr_val;
|
||||
else if (strstr(kcontrol->id.name, "LR Polarity Select"))
|
||||
ucontrol->value.integer.value[0] = dmic->lrsel;
|
||||
ucontrol->value.enumerated.item[0] = dmic->lrsel;
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -204,26 +183,19 @@ static int tegra210_dmic_put_control(struct snd_kcontrol *kcontrol,
|
||||
{
|
||||
struct snd_soc_component *comp = snd_soc_kcontrol_component(kcontrol);
|
||||
struct tegra210_dmic *dmic = snd_soc_component_get_drvdata(comp);
|
||||
int value = ucontrol->value.integer.value[0];
|
||||
|
||||
if (strstr(kcontrol->id.name, "Boost Gain Volume"))
|
||||
dmic->boost_gain = value;
|
||||
dmic->boost_gain = ucontrol->value.integer.value[0];
|
||||
else if (strstr(kcontrol->id.name, "Channel Select"))
|
||||
dmic->ch_select = ucontrol->value.integer.value[0];
|
||||
dmic->ch_select = ucontrol->value.enumerated.item[0];
|
||||
else if (strstr(kcontrol->id.name, "Mono To Stereo"))
|
||||
dmic->mono_to_stereo = value;
|
||||
dmic->mono_to_stereo = ucontrol->value.enumerated.item[0];
|
||||
else if (strstr(kcontrol->id.name, "Stereo To Mono"))
|
||||
dmic->stereo_to_mono = value;
|
||||
else if (strstr(kcontrol->id.name, "Audio Bit Format"))
|
||||
dmic->audio_bits_override = value;
|
||||
else if (strstr(kcontrol->id.name, "Sample Rate"))
|
||||
dmic->srate_override = value;
|
||||
else if (strstr(kcontrol->id.name, "Audio Channels"))
|
||||
dmic->audio_ch_override = value;
|
||||
dmic->stereo_to_mono = ucontrol->value.enumerated.item[0];
|
||||
else if (strstr(kcontrol->id.name, "OSR Value"))
|
||||
dmic->osr_val = value;
|
||||
dmic->osr_val = ucontrol->value.enumerated.item[0];
|
||||
else if (strstr(kcontrol->id.name, "LR Polarity Select"))
|
||||
dmic->lrsel = value;
|
||||
dmic->lrsel = ucontrol->value.enumerated.item[0];
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -232,14 +204,6 @@ static const struct snd_soc_dai_ops tegra210_dmic_dai_ops = {
|
||||
.hw_params = tegra210_dmic_hw_params,
|
||||
};
|
||||
|
||||
/*
|
||||
* Three DAIs are exposed
|
||||
* 1. "CIF" DAI for connecting with XBAR
|
||||
* 2. "DAP" DAI for connecting with CODEC
|
||||
* 3. "DUMMY_SOURCE" can be used when no external
|
||||
* codec connection is available. In such case
|
||||
* "DAP" is connected with "DUMMY_SOURCE"
|
||||
*/
|
||||
static struct snd_soc_dai_driver tegra210_dmic_dais[] = {
|
||||
{
|
||||
.name = "DMIC-CIF",
|
||||
@@ -254,13 +218,8 @@ static struct snd_soc_dai_driver tegra210_dmic_dais[] = {
|
||||
},
|
||||
{
|
||||
.name = "DMIC-DAP",
|
||||
#if IS_ENABLED(CONFIG_TEGRA_DPCM)
|
||||
.capture = {
|
||||
.stream_name = "DAP-Capture",
|
||||
#else
|
||||
.playback = {
|
||||
.stream_name = "DAP-Playback",
|
||||
#endif
|
||||
.channels_min = 1,
|
||||
.channels_max = 2,
|
||||
.rates = SNDRV_PCM_RATE_8000_48000,
|
||||
@@ -270,17 +229,6 @@ static struct snd_soc_dai_driver tegra210_dmic_dais[] = {
|
||||
.ops = &tegra210_dmic_dai_ops,
|
||||
.symmetric_rates = 1,
|
||||
},
|
||||
{
|
||||
.name = "DUMMY_SOURCE",
|
||||
.capture = {
|
||||
.stream_name = "Dummy-Capture",
|
||||
.channels_min = 1,
|
||||
.channels_max = 2,
|
||||
.rates = SNDRV_PCM_RATE_8000_48000,
|
||||
.formats = SNDRV_PCM_FMTBIT_S16_LE |
|
||||
SNDRV_PCM_FMTBIT_S32_LE,
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
static const struct snd_soc_dapm_widget tegra210_dmic_widgets[] = {
|
||||
@@ -289,17 +237,11 @@ static const struct snd_soc_dapm_widget tegra210_dmic_widgets[] = {
|
||||
};
|
||||
|
||||
static const struct snd_soc_dapm_route tegra210_dmic_routes[] = {
|
||||
#if IS_ENABLED(CONFIG_TEGRA_DPCM)
|
||||
{ "XBAR-RX", NULL, "XBAR-Capture" },
|
||||
{ "XBAR-Capture", NULL, "CIF-Capture" },
|
||||
{ "CIF-Capture", NULL, "TX" },
|
||||
{ "TX", NULL, "DAP-Capture" },
|
||||
{ "DAP-Capture", NULL, "MIC" },
|
||||
#else
|
||||
{ "CIF-Capture", NULL, "TX" },
|
||||
{ "TX", NULL, "DAP-Playback" },
|
||||
{ "Dummy-Capture", NULL, "MIC" },
|
||||
#endif
|
||||
};
|
||||
|
||||
static const char * const tegra210_dmic_ch_select[] = {
|
||||
@@ -326,16 +268,6 @@ static const struct soc_enum tegra210_dmic_stereo_conv_enum =
|
||||
SOC_ENUM_SINGLE(0, 0, ARRAY_SIZE(tegra210_dmic_stereo_conv_text),
|
||||
tegra210_dmic_stereo_conv_text);
|
||||
|
||||
static const char * const tegra210_dmic_format_text[] = {
|
||||
"None",
|
||||
"16",
|
||||
"32",
|
||||
};
|
||||
|
||||
static const struct soc_enum tegra210_dmic_format_enum =
|
||||
SOC_ENUM_SINGLE(0, 0, ARRAY_SIZE(tegra210_dmic_format_text),
|
||||
tegra210_dmic_format_text);
|
||||
|
||||
static const char * const tegra210_dmic_osr_text[] = {
|
||||
"OSR_64", "OSR_128", "OSR_256",
|
||||
};
|
||||
@@ -363,12 +295,6 @@ static const struct snd_kcontrol_new tegra210_dmic_controls[] = {
|
||||
SOC_ENUM_EXT("Stereo To Mono",
|
||||
tegra210_dmic_stereo_conv_enum, tegra210_dmic_get_control,
|
||||
tegra210_dmic_put_control),
|
||||
SOC_ENUM_EXT("Audio Bit Format", tegra210_dmic_format_enum,
|
||||
tegra210_dmic_get_control, tegra210_dmic_put_control),
|
||||
SOC_SINGLE_EXT("Sample Rate", 0, 0, 48000, 0, tegra210_dmic_get_control,
|
||||
tegra210_dmic_put_control),
|
||||
SOC_SINGLE_EXT("Audio Channels", 0, 0, 2, 0, tegra210_dmic_get_control,
|
||||
tegra210_dmic_put_control),
|
||||
SOC_ENUM_EXT("OSR Value", tegra210_dmic_osr_enum,
|
||||
tegra210_dmic_get_control, tegra210_dmic_put_control),
|
||||
SOC_ENUM_EXT("LR Polarity Select", tegra210_dmic_lrsel_enum,
|
||||
@@ -382,7 +308,6 @@ static const struct snd_soc_component_driver tegra210_dmic_compnt = {
|
||||
.num_dapm_routes = ARRAY_SIZE(tegra210_dmic_routes),
|
||||
.controls = tegra210_dmic_controls,
|
||||
.num_controls = ARRAY_SIZE(tegra210_dmic_controls),
|
||||
.non_legacy_dai_naming = 1,
|
||||
};
|
||||
|
||||
static bool tegra210_dmic_wr_reg(struct device *dev, unsigned int reg)
|
||||
|
||||
Reference in New Issue
Block a user