mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-08-28 00:35:00 -04:00
ASoC: codecs: lpass-{tx,wsa}-macro: fix enum kcontrol accesses
Dawid Wróbel <me@dawidwrobel.com> says: Both drivers access enumerated controls through value.integer.value[0] instead of value.enumerated.item[0]. The same bug was fixed in rx-macro and va-macro in 2022 (bcfe5f76cc,0ea5eff7c6); tx-macro and wsa-macro were missed. On 64-bit kernels with CONFIG_SND_CTL_DEBUG this trips the elem value sanity check, and every read of the affected controls fails with -EINVAL. Reproduced and fixed on a Xiaomi Mi Pad 5 Pro (SM8250) for tx-macro. wsa-macro is compile-tested only — that codec is not instantiated on this hardware. Link: https://patch.msgid.link/20260730-worktree-lpass-tx-macro-enum-fix-v2-0-6d091c736116@dawidwrobel.com
This commit is contained in:
@@ -1075,7 +1075,7 @@ static int tx_macro_dec_mode_get(struct snd_kcontrol *kcontrol,
|
||||
struct soc_enum *e = (struct soc_enum *)kcontrol->private_value;
|
||||
int path = e->shift_l;
|
||||
|
||||
ucontrol->value.integer.value[0] = tx->dec_mode[path];
|
||||
ucontrol->value.enumerated.item[0] = tx->dec_mode[path];
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -1084,7 +1084,7 @@ static int tx_macro_dec_mode_put(struct snd_kcontrol *kcontrol,
|
||||
struct snd_ctl_elem_value *ucontrol)
|
||||
{
|
||||
struct snd_soc_component *component = snd_kcontrol_chip(kcontrol);
|
||||
int value = ucontrol->value.integer.value[0];
|
||||
int value = ucontrol->value.enumerated.item[0];
|
||||
struct soc_enum *e = (struct soc_enum *)kcontrol->private_value;
|
||||
int path = e->shift_l;
|
||||
struct tx_macro *tx = snd_soc_component_get_drvdata(component);
|
||||
|
||||
@@ -2064,7 +2064,7 @@ static int wsa_macro_ear_spkr_pa_gain_get(struct snd_kcontrol *kcontrol,
|
||||
struct snd_soc_component *component = snd_kcontrol_chip(kcontrol);
|
||||
struct wsa_macro *wsa = snd_soc_component_get_drvdata(component);
|
||||
|
||||
ucontrol->value.integer.value[0] = wsa->ear_spkr_gain;
|
||||
ucontrol->value.enumerated.item[0] = wsa->ear_spkr_gain;
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -2075,7 +2075,7 @@ static int wsa_macro_ear_spkr_pa_gain_put(struct snd_kcontrol *kcontrol,
|
||||
struct snd_soc_component *component = snd_kcontrol_chip(kcontrol);
|
||||
struct wsa_macro *wsa = snd_soc_component_get_drvdata(component);
|
||||
|
||||
wsa->ear_spkr_gain = ucontrol->value.integer.value[0];
|
||||
wsa->ear_spkr_gain = ucontrol->value.enumerated.item[0];
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -2088,7 +2088,7 @@ static int wsa_macro_rx_mux_get(struct snd_kcontrol *kcontrol,
|
||||
snd_soc_dapm_to_component(widget->dapm);
|
||||
struct wsa_macro *wsa = snd_soc_component_get_drvdata(component);
|
||||
|
||||
ucontrol->value.integer.value[0] =
|
||||
ucontrol->value.enumerated.item[0] =
|
||||
wsa->rx_port_value[widget->shift];
|
||||
return 0;
|
||||
}
|
||||
@@ -2101,7 +2101,7 @@ static int wsa_macro_rx_mux_put(struct snd_kcontrol *kcontrol,
|
||||
snd_soc_dapm_to_component(widget->dapm);
|
||||
struct soc_enum *e = (struct soc_enum *)kcontrol->private_value;
|
||||
struct snd_soc_dapm_update *update = NULL;
|
||||
u32 rx_port_value = ucontrol->value.integer.value[0];
|
||||
u32 rx_port_value = ucontrol->value.enumerated.item[0];
|
||||
u32 bit_input;
|
||||
u32 aif_rst;
|
||||
unsigned int dai_id;
|
||||
|
||||
Reference in New Issue
Block a user