Skip to contentSkip to conversation

ASoC: wm_adsp: Correct wm_coeff_tlv_get handling

PATCH In review Charles Keepax 2 participants 7 messages Jun 26, 2021 – Jul 13, 2021

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/3 ASoC: wm_adsp: Correct wm_coeff_tlv_get handling

When wm_coeff_tlv_get was updated it was accidentally switch to the _raw version of the helper causing it to ignore the current DSP state it should be checking. Switch the code back to the correct helper so that users can't read the controls when they arn't available.

Fixes 73ecf1a673d3 ("ASoC: wm_adsp: Correct cache handling of new kernel control API")
---
 sound/soc/codecs/wm_adsp.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
sound/soc/codecs/wm_adsp.c +1 -1
index 37aa020f23f63..59d876d36cfd8 100644
@@ -1213,7 +1213,7 @@ static int wm_coeff_tlv_get(struct snd_kcontrol *kctl,
 
 	mutex_lock(&ctl->dsp->pwr_lock);
 
-	ret = wm_coeff_read_ctrl_raw(ctl, ctl->cache, size);
+	ret = wm_coeff_read_ctrl(ctl, ctl->cache, size);
 
 	if (!ret && copy_to_user(bytes, ctl->cache, size))
 		ret = -EFAULT;
Signature · 1 line
2.11.0
#1 lore raw

PATCH 2/3 ASoC: wm_adsp: Add CCM_CORE_RESET to Halo start core

When starting the Halo core it is advised to also write the core reset bit, this ensures the part starts up in the appropriate state. Omitting this doesn't cause issues on most parts but cs40l25 requires it and it is advised on all Halo parts.

---
 sound/soc/codecs/wm_adsp.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
sound/soc/codecs/wm_adsp.c +3 -1
index 59d876d36cfd8..549d98241daec 100644
@@ -282,6 +282,7 @@
 /*
  * HALO_CCM_CORE_CONTROL
  */
+#define HALO_CORE_RESET                     0x00000200
 #define HALO_CORE_EN                        0x00000001
 
 /*
@@ -3333,7 +3334,8 @@ static int wm_halo_start_core(struct wm_adsp *dsp)
 {
 	return regmap_update_bits(dsp->regmap,
 				  dsp->base + HALO_CCM_CORE_CONTROL,
-				  HALO_CORE_EN, HALO_CORE_EN);
+				  HALO_CORE_RESET | HALO_CORE_EN,
+				  HALO_CORE_RESET | HALO_CORE_EN);
 }
 
 static void wm_halo_stop_core(struct wm_adsp *dsp)
Signature · 1 line
2.11.0
#2 lore raw

PATCH 3/3 ASoC: wm_adsp: Remove pointless string comparison

In reply to Charles Keepax

The control fw_name is always directly assigned from the wm_adsp_fw_text array, so it isn't necessary to compare the actual strings just the pointer values.

---
 sound/soc/codecs/wm_adsp.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)
sound/soc/codecs/wm_adsp.c +3 -4
index 549d98241daec..b395df1eb72d8 100644
@@ -2030,10 +2030,9 @@ static struct wm_coeff_ctl *wm_adsp_get_ctl(struct wm_adsp *dsp,
 		if (!pos->subname)
 			continue;
 		if (strncmp(pos->subname, name, pos->subname_len) == 0 &&
-		    strncmp(pos->fw_name, fw_txt,
-			    SNDRV_CTL_ELEM_ID_NAME_MAXLEN) == 0 &&
-				pos->alg_region.alg == alg &&
-				pos->alg_region.type == type) {
+		    pos->fw_name == fw_txt &&
+		    pos->alg_region.alg == alg &&
+		    pos->alg_region.type == type) {
 			rslt = pos;
 			break;
 		}
Signature · 1 line
2.11.0
maintainer
#3 lore raw

Re: [PATCH 3/3] ASoC: wm_adsp: Remove pointless string comparison

Quoted 3 lines · Charles Keepax

The control fw_name is always directly assigned from the wm_adsp_fw_text array, so it isn't necessary to compare the actual strings just the pointer values.

This feels like it's asking for trouble in the future...

#4 lore raw

Re: [PATCH 3/3] ASoC: wm_adsp: Remove pointless string comparison

Quoted 7 lines · Mark Brown
Quoted 3 lines · Charles Keepax

The control fw_name is always directly assigned from the wm_adsp_fw_text array, so it isn't necessary to compare the actual strings just the pointer values.

This feels like it's asking for trouble in the future...

Thanks for applying anyway, apologies for my slow reply been off work. We already have the same optimisation in other places so at least this way its all broken in the same way if we hit an issue in the future :-)

Thanks,
Charles

maintainer
#5 lore raw

Re: (subset) [PATCH 1/3] ASoC: wm_adsp: Correct wm_coeff_tlv_get handling

In reply to Charles Keepax
Quoted 4 lines · Charles Keepax

When wm_coeff_tlv_get was updated it was accidentally switch to the _raw version of the helper causing it to ignore the current DSP state it should be checking. Switch the code back to the correct helper so that users can't read the controls when they arn't available.

Applied to

https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-next

Thanks!

[1/3] ASoC: wm_adsp: Correct wm_coeff_tlv_get handling

      commit: dd6fb8ff2210f74b056bf9234d0605e8c26a8ac0
[2/3] ASoC: wm_adsp: Add CCM_CORE_RESET to Halo start core
      commit: e588332271b9cde6252dac8973b77e580cd639bd

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

maintainer
#6 lore raw

Re: (subset) [PATCH 1/3] ASoC: wm_adsp: Correct wm_coeff_tlv_get handling

In reply to Charles Keepax
Quoted 4 lines · Charles Keepax

When wm_coeff_tlv_get was updated it was accidentally switch to the _raw version of the helper causing it to ignore the current DSP state it should be checking. Switch the code back to the correct helper so that users can't read the controls when they arn't available.

Applied to

https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-next

Thanks!

[3/3] ASoC: wm_adsp: Remove pointless string comparison

      commit: 2ba907894f9e69b68e5934b57afb744482a72984

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