ASoC: ti: j721e-evm: Small fixes and code cleanup
Subsystems (3)
cover ASoC: ti: j721e-evm: Small fixes and code cleanup
Hi,
I have found two issues with the machine driver which for some reason did not caused errors but they are certainly bugs.
The last patch is just to convert the IDs from define to enum.
Regards,
Peter
---
Peter Ujfalusi (3):
ASoC: ti: j721e-evm: Fix unbalanced domain activity tracking during
startup
ASoC: ti: j721e-evm: Check for not initialized parent_clk_id
ASoC: ti: j721e-evm: Convert the audio domain IDs to enum
sound/soc/ti/j721e-evm.c | 48 ++++++++++++++++++++++++---------------- 1 file changed, 29 insertions(+), 19 deletions(-)
Signature · 1 line
2.32.0
PATCH 1/3 ASoC: ti: j721e-evm: Fix unbalanced domain activity tracking during startup
In case of an error within j721e_audio_startup() the domain->active must be decremented to avoid unbalanced counter.
--- sound/soc/ti/j721e-evm.c | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-)
sound/soc/ti/j721e-evm.c +11 -5
@@ -278,23 +278,29 @@ static int j721e_audio_startup(struct snd_pcm_substream *substream) j721e_rule_rate, &priv->rate_range, SNDRV_PCM_HW_PARAM_RATE, -1); -mutex_unlock (&priv->mutex);if (ret) -return ret; + goto out;/* Reset TDM slots to 32 */ ret =snd_soc_dai_set_tdm_slot (cpu_dai,0x3 ,0x3 ,2 ,32 );if (ret && ret != -ENOTSUPP ) -return ret; + goto out;for_each_rtd_codec_dais (rtd, i, codec_dai) { ret =snd_soc_dai_set_tdm_slot (codec_dai,0x3 ,0x3 ,2 ,32 );if (ret && ret != -ENOTSUPP ) -return ret; + goto out; } -return 0 ; +if (ret == -ENOTSUPP ) + ret =0 ; +out: +if (ret) + domain->active--; +mutex_unlock (&priv->mutex); + +return ret; } static int j721e_audio_hw_params(struct snd_pcm_substream *substream,
Signature · 1 line
2.32.0
PATCH 2/3 ASoC: ti: j721e-evm: Check for not initialized parent_clk_id
In reply to Peter UjfalusiDuring probe the parent_clk_id is set to -1 which should not be used to array index within hsdiv_rates[].
--- sound/soc/ti/j721e-evm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
sound/soc/ti/j721e-evm.c +1 -1
@@ -197,7 +197,7 @@ static int j721e_configure_refclk(struct j721e_priv *priv,return ret; } -if (priv->hsdiv_rates[domain->parent_clk_id] != scki) { +if (domain->parent_clk_id ==-1 || priv->hsdiv_rates[domain->parent_clk_id] != scki) { dev_dbg(priv->dev, "%s configuration for %u Hz: %s, %dxFS (SCKI: %u Hz)\n", audio_domain == J721E_AUDIO_DOMAIN_CPB ? "CPB" : "IVI",
Signature · 1 line
2.32.0
PATCH 3/3 ASoC: ti: j721e-evm: Convert the audio domain IDs to enum
In reply to Peter UjfalusiConvert the J721E_AUDIO_DOMAIN_* from defines to enum to make it possible to extend the number of domains in the future.
--- sound/soc/ti/j721e-evm.c | 30 +++++++++++++++++------------- 1 file changed, 17 insertions(+), 13 deletions(-)
sound/soc/ti/j721e-evm.c +17 -13
@@ -23,8 +23,11 @@*/ #define J721E_CODEC_CONF_COUNT 5 -#define J721E_AUDIO_DOMAIN_CPB 0 -#define J721E_AUDIO_DOMAIN_IVI 1 +enum j721e_audio_domain_id { +J721E_AUDIO_DOMAIN_CPB =0 , +J721E_AUDIO_DOMAIN_IVI , +J721E_AUDIO_DOMAIN_LAST , +};#define J721E_CLK_PARENT_48000 0#define J721E_CLK_PARENT_44100 1
@@ -78,7 +81,7 @@ struct j721e_priv {u32 pll_rates[2 ];unsigned int hsdiv_rates[2 ]; -struct j721e_audio_domain audio_domains[2 ]; +struct j721e_audio_domain audio_domains[J721E_AUDIO_DOMAIN_LAST ];struct mutex mutex; };
@@ -199,9 +202,8 @@ static int j721e_configure_refclk(struct j721e_priv *priv,if (domain->parent_clk_id ==-1 || priv->hsdiv_rates[domain->parent_clk_id] != scki) {dev_dbg (priv->dev, -"%s configuration for %u Hz: %s, %dxFS (SCKI: %u Hz)\n" , - audio_domain ==J721E_AUDIO_DOMAIN_CPB ?"CPB" :"IVI" , - rate, +"domain%u configuration for %u Hz: %s, %dxFS (SCKI: %u Hz)\n" , + audio_domain, rate, clk_id ==J721E_CLK_PARENT_48000 ?"PLL4" :"PLL15" , ratios_for_pcm3168a[i], scki);
@@ -263,10 +265,11 @@ static int j721e_audio_startup(struct snd_pcm_substream *substream) domain->active++; -if (priv->audio_domains[J721E_AUDIO_DOMAIN_CPB ].rate) - active_rate = priv->audio_domains[J721E_AUDIO_DOMAIN_CPB ].rate; -else - active_rate = priv->audio_domains[J721E_AUDIO_DOMAIN_IVI ].rate; +for (i =0 ; i <J721E_AUDIO_DOMAIN_LAST ; i++) { + active_rate = priv->audio_domains[i].rate; +if (active_rate) +break ; + }if (active_rate) ret = snd_pcm_hw_constraint_single(substream->runtime,
@@ -825,7 +828,7 @@ static int j721e_soc_probe(struct platform_device *pdev)struct snd_soc_card *card;const struct of_device_id *match;struct j721e_priv *priv; -int link_cnt, conf_cnt, ret; +int link_cnt, conf_cnt, ret, i;if (!node) {dev_err (&pdev->dev,"of node is missing.\n" );
@@ -849,8 +852,9 @@ static int j721e_soc_probe(struct platform_device *pdev)if (!priv->dai_links)return -ENOMEM ; - priv->audio_domains[J721E_AUDIO_DOMAIN_CPB ].parent_clk_id =-1 ; - priv->audio_domains[J721E_AUDIO_DOMAIN_IVI ].parent_clk_id =-1 ; +for (i =0 ; i <J721E_AUDIO_DOMAIN_LAST ; i++) + priv->audio_domains[i].parent_clk_id =-1 ; + priv->dev = &pdev->dev; card = &priv->card; card->dev = &pdev->dev;
Signature · 1 line
2.32.0
Mark Brown
maintainerRe: (subset) [PATCH 0/3] ASoC: ti: j721e-evm: Small fixes and code cleanup
In reply to Peter UjfalusiQuoted 7 lines · Peter Ujfalusi
I have found two issues with the machine driver which for some reason did not caused errors but they are certainly bugs.
The last patch is just to convert the IDs from define to enum.
Regards,
Peter
Applied to
https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-next
Thanks!
[1/3] ASoC: ti: j721e-evm: Fix unbalanced domain activity tracking during startup
commit: 78d2a05ef22e7b5863b01e073dd6a06b3979bb00
[2/3] ASoC: ti: j721e-evm: Check for not initialized parent_clk_id
commit: 82d28b67f780910f816fe1cfb0f676fc38c4cbb3All 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
Mark Brown
maintainerRe: (subset) [PATCH 0/3] ASoC: ti: j721e-evm: Small fixes and code cleanup
In reply to Peter UjfalusiQuoted 7 lines · Peter Ujfalusi
I have found two issues with the machine driver which for some reason did not caused errors but they are certainly bugs.
The last patch is just to convert the IDs from define to enum.
Regards,
Peter
Applied to
https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-next
Thanks!
[3/3] ASoC: ti: j721e-evm: Convert the audio domain IDs to enum
commit: cfc9d37ab79ff19d44a17195e57b2828084d5896
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