diff mbox series

[v2] ASoC: codecs: lpass-va-macro: set the default codec version for sm8250

Message ID 20240816091210.50172-1-srinivas.kandagatla@linaro.org
State Superseded
Headers show
Series [v2] ASoC: codecs: lpass-va-macro: set the default codec version for sm8250 | expand

Commit Message

Srinivas Kandagatla Aug. 16, 2024, 9:12 a.m. UTC
From: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>

sm8250 and sc7280 have lpass codec version 1.0, as these are very old
platforms, they do not have a reliable way to get the codec version
from core_id registers.

On codec versions below 2.0, even though the core_id registers are
available to read, the values of these registers are not unique to be
able to determine the version of the codec dynamically.

Add the version info into of_data, so that driver does not need to use
core_id registers to get version number for such situations.

Fixes: 378918d59181 ("ASoC: codecs: lpass-macro: add helpers to get codec version")
Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
---
Changes since v1:
	- updated commit text to add more details

 sound/soc/codecs/lpass-va-macro.c | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

Comments

Amit Pundir Aug. 17, 2024, 3:33 p.m. UTC | #1
On Fri, 16 Aug 2024 at 14:42, <srinivas.kandagatla@linaro.org> wrote:
>
> From: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
>
> sm8250 and sc7280 have lpass codec version 1.0, as these are very old
> platforms, they do not have a reliable way to get the codec version
> from core_id registers.
>
> On codec versions below 2.0, even though the core_id registers are
> available to read, the values of these registers are not unique to be
> able to determine the version of the codec dynamically.
>
> Add the version info into of_data, so that driver does not need to use
> core_id registers to get version number for such situations.
>

Thank you Srini for this patch. This (along with the DT patch [1])
fixes the HDMI audio regression on RB5.

Tested-by: Amit Pundir <amit.pundir@linaro.org>

[1] https://lore.kernel.org/all/20240815170542.20754-1-srinivas.kandagatla@linaro.org/

> Fixes: 378918d59181 ("ASoC: codecs: lpass-macro: add helpers to get codec version")
> Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
> ---
> Changes since v1:
>         - updated commit text to add more details
>
>  sound/soc/codecs/lpass-va-macro.c | 11 ++++++++++-
>  1 file changed, 10 insertions(+), 1 deletion(-)
>
> diff --git a/sound/soc/codecs/lpass-va-macro.c b/sound/soc/codecs/lpass-va-macro.c
> index 8454193ed22a..e95d1f29ef18 100644
> --- a/sound/soc/codecs/lpass-va-macro.c
> +++ b/sound/soc/codecs/lpass-va-macro.c
> @@ -228,11 +228,13 @@ struct va_macro {
>  struct va_macro_data {
>         bool has_swr_master;
>         bool has_npl_clk;
> +       int version;
>  };
>
>  static const struct va_macro_data sm8250_va_data = {
>         .has_swr_master = false,
>         .has_npl_clk = false,
> +       .version = LPASS_CODEC_VERSION_1_0,
>  };
>
>  static const struct va_macro_data sm8450_va_data = {
> @@ -1587,7 +1589,14 @@ static int va_macro_probe(struct platform_device *pdev)
>                         goto err_npl;
>         }
>
> -       va_macro_set_lpass_codec_version(va);
> +       /**
> +        * old version of codecs do not have a reliable way to determine the
> +        * version from registers, get them from soc specific data
> +        */
> +       if (data->version)
> +               lpass_macro_set_codec_version(data->version);
> +       else /* read version from register */
> +               va_macro_set_lpass_codec_version(va);
>
>         if (va->has_swr_master) {
>                 /* Set default CLK div to 1 */
> --
> 2.25.1
>
Dmitry Baryshkov Aug. 30, 2024, 8:07 a.m. UTC | #2
On Fri, Aug 16, 2024 at 10:12:10AM GMT, srinivas.kandagatla@linaro.org wrote:
> From: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
> 
> sm8250 and sc7280 have lpass codec version 1.0, as these are very old
> platforms, they do not have a reliable way to get the codec version
> from core_id registers.
> 
> On codec versions below 2.0, even though the core_id registers are
> available to read, the values of these registers are not unique to be
> able to determine the version of the codec dynamically.
> 
> Add the version info into of_data, so that driver does not need to use
> core_id registers to get version number for such situations.
> 
> Fixes: 378918d59181 ("ASoC: codecs: lpass-macro: add helpers to get codec version")
> Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
> ---
> Changes since v1:
> 	- updated commit text to add more details
> 
>  sound/soc/codecs/lpass-va-macro.c | 11 ++++++++++-
>  1 file changed, 10 insertions(+), 1 deletion(-)
> 

Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
Bryan O'Donoghue Aug. 30, 2024, 8:37 a.m. UTC | #3
On 16/08/2024 10:12, srinivas.kandagatla@linaro.org wrote:
> From: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
> 
> sm8250 and sc7280 have lpass codec version 1.0, as these are very old
> platforms, they do not have a reliable way to get the codec version
> from core_id registers.
> 
> On codec versions below 2.0, even though the core_id registers are
> available to read, the values of these registers are not unique to be
> able to determine the version of the codec dynamically.
> 
> Add the version info into of_data, so that driver does not need to use
> core_id registers to get version number for such situations.
> 
> Fixes: 378918d59181 ("ASoC: codecs: lpass-macro: add helpers to get codec version")
> Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>

Seems to be fixing the reset I've been seeing on rb5

Tested-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
Dmitry Baryshkov Aug. 30, 2024, 10:56 a.m. UTC | #4
On Fri, Aug 30, 2024 at 09:37:39AM GMT, Bryan O'Donoghue wrote:
> On 16/08/2024 10:12, srinivas.kandagatla@linaro.org wrote:
> > From: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
> > 
> > sm8250 and sc7280 have lpass codec version 1.0, as these are very old
> > platforms, they do not have a reliable way to get the codec version
> > from core_id registers.
> > 
> > On codec versions below 2.0, even though the core_id registers are
> > available to read, the values of these registers are not unique to be
> > able to determine the version of the codec dynamically.
> > 
> > Add the version info into of_data, so that driver does not need to use
> > core_id registers to get version number for such situations.
> > 
> > Fixes: 378918d59181 ("ASoC: codecs: lpass-macro: add helpers to get codec version")
> > Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
> 
> Seems to be fixing the reset I've been seeing on rb5

Let's hope this patch can find its way into v6.11

> Tested-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
Mark Brown Aug. 30, 2024, 7:30 p.m. UTC | #5
On Fri, 16 Aug 2024 10:12:10 +0100, srinivas.kandagatla@linaro.org wrote:
> sm8250 and sc7280 have lpass codec version 1.0, as these are very old
> platforms, they do not have a reliable way to get the codec version
> from core_id registers.
> 
> On codec versions below 2.0, even though the core_id registers are
> available to read, the values of these registers are not unique to be
> able to determine the version of the codec dynamically.
> 
> [...]

Applied to

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

Thanks!

[1/1] ASoC: codecs: lpass-va-macro: set the default codec version for sm8250
      commit: 77212f300bfd6fb3edaabd1daf863cabb521854a

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
diff mbox series

Patch

diff --git a/sound/soc/codecs/lpass-va-macro.c b/sound/soc/codecs/lpass-va-macro.c
index 8454193ed22a..e95d1f29ef18 100644
--- a/sound/soc/codecs/lpass-va-macro.c
+++ b/sound/soc/codecs/lpass-va-macro.c
@@ -228,11 +228,13 @@  struct va_macro {
 struct va_macro_data {
 	bool has_swr_master;
 	bool has_npl_clk;
+	int version;
 };
 
 static const struct va_macro_data sm8250_va_data = {
 	.has_swr_master = false,
 	.has_npl_clk = false,
+	.version = LPASS_CODEC_VERSION_1_0,
 };
 
 static const struct va_macro_data sm8450_va_data = {
@@ -1587,7 +1589,14 @@  static int va_macro_probe(struct platform_device *pdev)
 			goto err_npl;
 	}
 
-	va_macro_set_lpass_codec_version(va);
+	/**
+	 * old version of codecs do not have a reliable way to determine the
+	 * version from registers, get them from soc specific data
+	 */
+	if (data->version)
+		lpass_macro_set_codec_version(data->version);
+	else /* read version from register */
+		va_macro_set_lpass_codec_version(va);
 
 	if (va->has_swr_master) {
 		/* Set default CLK div to 1 */