All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/3] ASoC: wm_adsp: Correct wm_coeff_tlv_get handling
@ 2021-06-26 15:59 Charles Keepax
  2021-06-26 15:59 ` [PATCH 2/3] ASoC: wm_adsp: Add CCM_CORE_RESET to Halo start core Charles Keepax
                   ` (3 more replies)
  0 siblings, 4 replies; 7+ messages in thread
From: Charles Keepax @ 2021-06-26 15:59 UTC (permalink / raw)
  To: broonie; +Cc: patches, alsa-devel, lgirdwood

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")
Signed-off-by: Charles Keepax <ckeepax@opensource.cirrus.com>
---
 sound/soc/codecs/wm_adsp.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sound/soc/codecs/wm_adsp.c b/sound/soc/codecs/wm_adsp.c
index 37aa020f23f63..59d876d36cfd8 100644
--- a/sound/soc/codecs/wm_adsp.c
+++ b/sound/soc/codecs/wm_adsp.c
@@ -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;
-- 
2.11.0


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH 2/3] ASoC: wm_adsp: Add CCM_CORE_RESET to Halo start core
  2021-06-26 15:59 [PATCH 1/3] ASoC: wm_adsp: Correct wm_coeff_tlv_get handling Charles Keepax
@ 2021-06-26 15:59 ` Charles Keepax
  2021-06-26 15:59 ` [PATCH 3/3] ASoC: wm_adsp: Remove pointless string comparison Charles Keepax
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 7+ messages in thread
From: Charles Keepax @ 2021-06-26 15:59 UTC (permalink / raw)
  To: broonie; +Cc: patches, alsa-devel, lgirdwood

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.

Signed-off-by: Charles Keepax <ckeepax@opensource.cirrus.com>
---
 sound/soc/codecs/wm_adsp.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/sound/soc/codecs/wm_adsp.c b/sound/soc/codecs/wm_adsp.c
index 59d876d36cfd8..549d98241daec 100644
--- a/sound/soc/codecs/wm_adsp.c
+++ b/sound/soc/codecs/wm_adsp.c
@@ -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)
-- 
2.11.0


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH 3/3] ASoC: wm_adsp: Remove pointless string comparison
  2021-06-26 15:59 [PATCH 1/3] ASoC: wm_adsp: Correct wm_coeff_tlv_get handling Charles Keepax
  2021-06-26 15:59 ` [PATCH 2/3] ASoC: wm_adsp: Add CCM_CORE_RESET to Halo start core Charles Keepax
@ 2021-06-26 15:59 ` Charles Keepax
  2021-06-28 16:58   ` Mark Brown
  2021-06-28 17:02 ` (subset) [PATCH 1/3] ASoC: wm_adsp: Correct wm_coeff_tlv_get handling Mark Brown
  2021-07-12 10:46 ` Mark Brown
  3 siblings, 1 reply; 7+ messages in thread
From: Charles Keepax @ 2021-06-26 15:59 UTC (permalink / raw)
  To: broonie; +Cc: patches, alsa-devel, lgirdwood

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.

Signed-off-by: Charles Keepax <ckeepax@opensource.cirrus.com>
---
 sound/soc/codecs/wm_adsp.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/sound/soc/codecs/wm_adsp.c b/sound/soc/codecs/wm_adsp.c
index 549d98241daec..b395df1eb72d8 100644
--- a/sound/soc/codecs/wm_adsp.c
+++ b/sound/soc/codecs/wm_adsp.c
@@ -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;
 		}
-- 
2.11.0


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH 3/3] ASoC: wm_adsp: Remove pointless string comparison
  2021-06-26 15:59 ` [PATCH 3/3] ASoC: wm_adsp: Remove pointless string comparison Charles Keepax
@ 2021-06-28 16:58   ` Mark Brown
  2021-07-13 12:33     ` Charles Keepax
  0 siblings, 1 reply; 7+ messages in thread
From: Mark Brown @ 2021-06-28 16:58 UTC (permalink / raw)
  To: Charles Keepax; +Cc: patches, alsa-devel, lgirdwood

[-- Attachment #1: Type: text/plain, Size: 286 bytes --]

On Sat, Jun 26, 2021 at 04:59:41PM +0100, Charles Keepax wrote:

> 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...

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: (subset) [PATCH 1/3] ASoC: wm_adsp: Correct wm_coeff_tlv_get handling
  2021-06-26 15:59 [PATCH 1/3] ASoC: wm_adsp: Correct wm_coeff_tlv_get handling Charles Keepax
  2021-06-26 15:59 ` [PATCH 2/3] ASoC: wm_adsp: Add CCM_CORE_RESET to Halo start core Charles Keepax
  2021-06-26 15:59 ` [PATCH 3/3] ASoC: wm_adsp: Remove pointless string comparison Charles Keepax
@ 2021-06-28 17:02 ` Mark Brown
  2021-07-12 10:46 ` Mark Brown
  3 siblings, 0 replies; 7+ messages in thread
From: Mark Brown @ 2021-06-28 17:02 UTC (permalink / raw)
  To: Charles Keepax; +Cc: patches, alsa-devel, Mark Brown, lgirdwood

On Sat, 26 Jun 2021 16:59:39 +0100, Charles Keepax wrote:
> 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

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: (subset) [PATCH 1/3] ASoC: wm_adsp: Correct wm_coeff_tlv_get handling
  2021-06-26 15:59 [PATCH 1/3] ASoC: wm_adsp: Correct wm_coeff_tlv_get handling Charles Keepax
                   ` (2 preceding siblings ...)
  2021-06-28 17:02 ` (subset) [PATCH 1/3] ASoC: wm_adsp: Correct wm_coeff_tlv_get handling Mark Brown
@ 2021-07-12 10:46 ` Mark Brown
  3 siblings, 0 replies; 7+ messages in thread
From: Mark Brown @ 2021-07-12 10:46 UTC (permalink / raw)
  To: Charles Keepax; +Cc: patches, alsa-devel, Mark Brown, lgirdwood

On Sat, 26 Jun 2021 16:59:39 +0100, Charles Keepax wrote:
> 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

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH 3/3] ASoC: wm_adsp: Remove pointless string comparison
  2021-06-28 16:58   ` Mark Brown
@ 2021-07-13 12:33     ` Charles Keepax
  0 siblings, 0 replies; 7+ messages in thread
From: Charles Keepax @ 2021-07-13 12:33 UTC (permalink / raw)
  To: Mark Brown; +Cc: patches, alsa-devel, lgirdwood

On Mon, Jun 28, 2021 at 05:58:37PM +0100, Mark Brown wrote:
> On Sat, Jun 26, 2021 at 04:59:41PM +0100, Charles Keepax wrote:
> 
> > 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

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2021-07-13 12:34 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-26 15:59 [PATCH 1/3] ASoC: wm_adsp: Correct wm_coeff_tlv_get handling Charles Keepax
2021-06-26 15:59 ` [PATCH 2/3] ASoC: wm_adsp: Add CCM_CORE_RESET to Halo start core Charles Keepax
2021-06-26 15:59 ` [PATCH 3/3] ASoC: wm_adsp: Remove pointless string comparison Charles Keepax
2021-06-28 16:58   ` Mark Brown
2021-07-13 12:33     ` Charles Keepax
2021-06-28 17:02 ` (subset) [PATCH 1/3] ASoC: wm_adsp: Correct wm_coeff_tlv_get handling Mark Brown
2021-07-12 10:46 ` Mark Brown

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.