[PATCH] ASoC: wcd938x: Fix event generation for some controls
Currently wcd938x_*_put() unconditionally report that the value of the control changed, resulting in spurious events being generated. Return 0 in that case instead as we should. There is still an issue in the compander control which is a bit more complex.
Signed-off-by: Mark Brown broonie@kernel.org --- sound/soc/codecs/wcd938x.c | 13 +++++++++++++ 1 file changed, 13 insertions(+)
diff --git a/sound/soc/codecs/wcd938x.c b/sound/soc/codecs/wcd938x.c index c1b61b997f69..d956c58298c3 100644 --- a/sound/soc/codecs/wcd938x.c +++ b/sound/soc/codecs/wcd938x.c @@ -2519,6 +2519,9 @@ static int wcd938x_tx_mode_put(struct snd_kcontrol *kcontrol, struct soc_enum *e = (struct soc_enum *)kcontrol->private_value; int path = e->shift_l;
+ if (wcd938x->tx_mode[path] == ucontrol->value.enumerated.item[0]) + return 0; + wcd938x->tx_mode[path] = ucontrol->value.enumerated.item[0];
return 1; @@ -2540,6 +2543,10 @@ static int wcd938x_rx_hph_mode_put(struct snd_kcontrol *kcontrol, { struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol); struct wcd938x_priv *wcd938x = snd_soc_component_get_drvdata(component); + int change; + + if (wcd938x->hph_mode == ucontrol->value.enumerated.item[0]) + return 0;
wcd938x->hph_mode = ucontrol->value.enumerated.item[0];
@@ -2632,6 +2639,9 @@ static int wcd938x_ldoh_put(struct snd_kcontrol *kcontrol, struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol); struct wcd938x_priv *wcd938x = snd_soc_component_get_drvdata(component);
+ if (wcd938x->ldoh == ucontrol->value.integer.value[0]) + return 0; + wcd938x->ldoh = ucontrol->value.integer.value[0];
return 1; @@ -2654,6 +2664,9 @@ static int wcd938x_bcs_put(struct snd_kcontrol *kcontrol, struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol); struct wcd938x_priv *wcd938x = snd_soc_component_get_drvdata(component);
+ if (wcd938x->bcs_dis == ucontrol->value.integer.value[0]) + return 0; + wcd938x->bcs_dis = ucontrol->value.integer.value[0];
return 1;
Hi Mark,
I love your patch! Perhaps something to improve:
[auto build test WARNING on broonie-sound/for-next] [also build test WARNING on v5.18 next-20220603] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in https://git-scm.com/docs/git-format-patch]
url: https://github.com/intel-lab-lkp/linux/commits/Mark-Brown/ASoC-wcd938x-Fix-e... base: https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-next config: x86_64-randconfig-c007 (https://download.01.org/0day-ci/archive/20220605/202206052345.ErWjOII2-lkp@i...) compiler: clang version 15.0.0 (https://github.com/llvm/llvm-project 416a5080d89066029f9889dc23f94de47c2fa895) reproduce (this is a W=1 build): wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross # https://github.com/intel-lab-lkp/linux/commit/77b0604d37f40ad0f56da53a9a38ad... git remote add linux-review https://github.com/intel-lab-lkp/linux git fetch --no-tags linux-review Mark-Brown/ASoC-wcd938x-Fix-event-generation-for-some-controls/20220605-162848 git checkout 77b0604d37f40ad0f56da53a9a38ad0de298fa52 # save the config file mkdir build_dir && cp config build_dir/.config COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=x86_64 SHELL=/bin/bash sound/soc/codecs/
If you fix the issue, kindly add following tag where applicable Reported-by: kernel test robot lkp@intel.com
All warnings (new ones prefixed by >>):
sound/soc/codecs/wcd938x.c:2546:6: warning: unused variable 'change' [-Wunused-variable]
int change; ^ 1 warning generated.
vim +/change +2546 sound/soc/codecs/wcd938x.c
2540 2541 static int wcd938x_rx_hph_mode_put(struct snd_kcontrol *kcontrol, 2542 struct snd_ctl_elem_value *ucontrol) 2543 { 2544 struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol); 2545 struct wcd938x_priv *wcd938x = snd_soc_component_get_drvdata(component);
2546 int change;
2547 2548 if (wcd938x->hph_mode == ucontrol->value.enumerated.item[0]) 2549 return 0; 2550 2551 wcd938x->hph_mode = ucontrol->value.enumerated.item[0]; 2552 2553 return 1; 2554 } 2555
Hi Mark,
I love your patch! Perhaps something to improve:
[auto build test WARNING on broonie-sound/for-next] [also build test WARNING on v5.18 next-20220603] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in https://git-scm.com/docs/git-format-patch]
url: https://github.com/intel-lab-lkp/linux/commits/Mark-Brown/ASoC-wcd938x-Fix-e... base: https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-next config: x86_64-allyesconfig (https://download.01.org/0day-ci/archive/20220606/202206060948.KAZcrRC8-lkp@i...) compiler: gcc-11 (Debian 11.3.0-1) 11.3.0 reproduce (this is a W=1 build): # https://github.com/intel-lab-lkp/linux/commit/77b0604d37f40ad0f56da53a9a38ad... git remote add linux-review https://github.com/intel-lab-lkp/linux git fetch --no-tags linux-review Mark-Brown/ASoC-wcd938x-Fix-event-generation-for-some-controls/20220605-162848 git checkout 77b0604d37f40ad0f56da53a9a38ad0de298fa52 # save the config file mkdir build_dir && cp config build_dir/.config make W=1 O=build_dir ARCH=x86_64 SHELL=/bin/bash sound/soc/codecs/
If you fix the issue, kindly add following tag where applicable Reported-by: kernel test robot lkp@intel.com
All warnings (new ones prefixed by >>):
sound/soc/codecs/wcd938x.c: In function 'wcd938x_rx_hph_mode_put':
sound/soc/codecs/wcd938x.c:2546:13: warning: unused variable 'change' [-Wunused-variable]
2546 | int change; | ^~~~~~
vim +/change +2546 sound/soc/codecs/wcd938x.c
2540 2541 static int wcd938x_rx_hph_mode_put(struct snd_kcontrol *kcontrol, 2542 struct snd_ctl_elem_value *ucontrol) 2543 { 2544 struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol); 2545 struct wcd938x_priv *wcd938x = snd_soc_component_get_drvdata(component);
2546 int change;
2547 2548 if (wcd938x->hph_mode == ucontrol->value.enumerated.item[0]) 2549 return 0; 2550 2551 wcd938x->hph_mode = ucontrol->value.enumerated.item[0]; 2552 2553 return 1; 2554 } 2555
On Fri, 3 Jun 2022 14:25:26 +0200, Mark Brown wrote:
Currently wcd938x_*_put() unconditionally report that the value of the control changed, resulting in spurious events being generated. Return 0 in that case instead as we should. There is still an issue in the compander control which is a bit more complex.
Applied to
https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-next
Thanks!
[1/1] ASoC: wcd938x: Fix event generation for some controls commit: 65c1c99d96f160e3fead8c6ec67b669cbe62320f
All being well this means that it will be integrated into the linux-next tree (usually sometime in the next 24 hours) and sent to Linus during the next merge window (or sooner if it is a bug fix), however if problems are discovered then the patch may be dropped or reverted.
You may get further e-mails resulting from automated or manual testing and review of the tree, please engage with people reporting problems and send followup patches addressing any issues that are reported if needed.
If any updates are required or you are submitting further changes they should be sent as incremental updates against current git, existing patches will not be replaced.
Please add any relevant lists and maintainers to the CCs when replying to this mail.
Thanks, Mark
participants (2)
-
kernel test robot
-
Mark Brown