]> git.proxmox.com Git - mirror_ubuntu-jammy-kernel.git/commitdiff
ASoC: tegra: Fix wrong value type in I2S
authorSameer Pujar <spujar@nvidia.com>
Thu, 18 Nov 2021 07:06:57 +0000 (12:36 +0530)
committerPaolo Pisati <paolo.pisati@canonical.com>
Thu, 9 Dec 2021 10:10:41 +0000 (11:10 +0100)
BugLink: https://bugs.launchpad.net/bugs/1953731
commit 8a2c2fa0c5331445c801e9241f2bb4e0e2a895a8 upstream.

The enum controls are expected to use enumerated value type.
Update relevant references in control get/put callbacks.

Fixes: c0bfa98349d1 ("ASoC: tegra: Add Tegra210 based I2S 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-3-git-send-email-spujar@nvidia.com
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
sound/soc/tegra/tegra210_i2s.c

index 45f31ccb49d89ee2fc195e64e1e89a180c45f862..5c304612769fa757583b9de1b28a0f9c5869ac3a 100644 (file)
@@ -317,24 +317,27 @@ static int tegra210_i2s_get_control(struct snd_kcontrol *kcontrol,
 {
        struct snd_soc_component *compnt = snd_soc_kcontrol_component(kcontrol);
        struct tegra210_i2s *i2s = snd_soc_component_get_drvdata(compnt);
-       long *uctl_val = &ucontrol->value.integer.value[0];
 
        if (strstr(kcontrol->id.name, "Loopback"))
-               *uctl_val = i2s->loopback;
+               ucontrol->value.integer.value[0] = i2s->loopback;
        else if (strstr(kcontrol->id.name, "FSYNC Width"))
-               *uctl_val = i2s->fsync_width;
+               ucontrol->value.integer.value[0] = i2s->fsync_width;
        else if (strstr(kcontrol->id.name, "Capture Stereo To Mono"))
-               *uctl_val = i2s->stereo_to_mono[I2S_TX_PATH];
+               ucontrol->value.enumerated.item[0] =
+                       i2s->stereo_to_mono[I2S_TX_PATH];
        else if (strstr(kcontrol->id.name, "Capture Mono To Stereo"))
-               *uctl_val = i2s->mono_to_stereo[I2S_TX_PATH];
+               ucontrol->value.enumerated.item[0] =
+                       i2s->mono_to_stereo[I2S_TX_PATH];
        else if (strstr(kcontrol->id.name, "Playback Stereo To Mono"))
-               *uctl_val = i2s->stereo_to_mono[I2S_RX_PATH];
+               ucontrol->value.enumerated.item[0] =
+                       i2s->stereo_to_mono[I2S_RX_PATH];
        else if (strstr(kcontrol->id.name, "Playback Mono To Stereo"))
-               *uctl_val = i2s->mono_to_stereo[I2S_RX_PATH];
+               ucontrol->value.enumerated.item[0] =
+                       i2s->mono_to_stereo[I2S_RX_PATH];
        else if (strstr(kcontrol->id.name, "Playback FIFO Threshold"))
-               *uctl_val = i2s->rx_fifo_th;
+               ucontrol->value.integer.value[0] = i2s->rx_fifo_th;
        else if (strstr(kcontrol->id.name, "BCLK Ratio"))
-               *uctl_val = i2s->bclk_ratio;
+               ucontrol->value.integer.value[0] = i2s->bclk_ratio;
 
        return 0;
 }
@@ -344,10 +347,9 @@ static int tegra210_i2s_put_control(struct snd_kcontrol *kcontrol,
 {
        struct snd_soc_component *compnt = snd_soc_kcontrol_component(kcontrol);
        struct tegra210_i2s *i2s = snd_soc_component_get_drvdata(compnt);
-       int value = ucontrol->value.integer.value[0];
 
        if (strstr(kcontrol->id.name, "Loopback")) {
-               i2s->loopback = value;
+               i2s->loopback = ucontrol->value.integer.value[0];
 
                regmap_update_bits(i2s->regmap, TEGRA210_I2S_CTRL,
                                   I2S_CTRL_LPBK_MASK,
@@ -362,24 +364,28 @@ static int tegra210_i2s_put_control(struct snd_kcontrol *kcontrol,
                 * cases mixer control is used to update custom values. A value
                 * of "N" here means, width is "N + 1" bit clock wide.
                 */
-               i2s->fsync_width = value;
+               i2s->fsync_width = ucontrol->value.integer.value[0];
 
                regmap_update_bits(i2s->regmap, TEGRA210_I2S_CTRL,
                                   I2S_CTRL_FSYNC_WIDTH_MASK,
                                   i2s->fsync_width << I2S_FSYNC_WIDTH_SHIFT);
 
        } else if (strstr(kcontrol->id.name, "Capture Stereo To Mono")) {
-               i2s->stereo_to_mono[I2S_TX_PATH] = value;
+               i2s->stereo_to_mono[I2S_TX_PATH] =
+                       ucontrol->value.enumerated.item[0];
        } else if (strstr(kcontrol->id.name, "Capture Mono To Stereo")) {
-               i2s->mono_to_stereo[I2S_TX_PATH] = value;
+               i2s->mono_to_stereo[I2S_TX_PATH] =
+                       ucontrol->value.enumerated.item[0];
        } else if (strstr(kcontrol->id.name, "Playback Stereo To Mono")) {
-               i2s->stereo_to_mono[I2S_RX_PATH] = value;
+               i2s->stereo_to_mono[I2S_RX_PATH] =
+                       ucontrol->value.enumerated.item[0];
        } else if (strstr(kcontrol->id.name, "Playback Mono To Stereo")) {
-               i2s->mono_to_stereo[I2S_RX_PATH] = value;
+               i2s->mono_to_stereo[I2S_RX_PATH] =
+                       ucontrol->value.enumerated.item[0];
        } else if (strstr(kcontrol->id.name, "Playback FIFO Threshold")) {
-               i2s->rx_fifo_th = value;
+               i2s->rx_fifo_th = ucontrol->value.integer.value[0];
        } else if (strstr(kcontrol->id.name, "BCLK Ratio")) {
-               i2s->bclk_ratio = value;
+               i2s->bclk_ratio = ucontrol->value.integer.value[0];
        }
 
        return 0;