Skip to contentSkip to conversation

ASoC: tegra: Add error logging for probe and callback failures

PATCH In review Sheetal 2 participants 6 messages Apr 1

Subsystems (3)
lore
Share & tools
lore

Sheetal

author
#0 lore raw

v4 cover ASoC: tegra: Add error logging for probe and callback failures

Resend pending v3 patches with fixes and add remaining dev_err_probe() conversions.

Patch 1 replaces v3 patch 03/14 (ADMAIF).
Patch 2 replaces v3 patch 09/14 (OPE/PEQ/MBDRC).
Patch 3 is new - adds regmap init conversions across 10 drivers. Patch 4 is new - adds clock error conversions in tegra_asoc_machine.

Changes since v3:
- [patch 1] Drop redundant dev_err_probe() on tegra_isomgr_adma_register() since it already logs internally. Drop redundant dev_err() at its call site. Add regmap init dev_err_probe() conversion.
- [patch 2] Drop redundant dev_err_probe() wrapping at PEQ/MBDRC init call sites since the called functions already log. Drop redundant dev_err() at those call sites in ope_probe(). Add regmap init, of_get_child_by_name and of_address_to_resource dev_err_probe() conversions.
- [patch 3] New. Use dev_err_probe() for regmap init failures in ASRC, DSPK, ADX, AHUB, AMX, DMIC, I2S, Mixer, MVC and SFC.
- [patch 4] New. Use dev_err_probe() for clk_set_rate and clk_prepare_enable failures in tegra_asoc_machine probe.

Sheetal (4):
ASoC: tegra: Add error logging in tegra210_admaif driver
ASoC: tegra: Use dev_err_probe() in OPE, PEQ and MBDRC drivers
ASoC: tegra: Use dev_err_probe() for regmap init failures
ASoC: tegra: Use dev_err_probe() in tegra_asoc_machine probe

 sound/soc/tegra/tegra186_asrc.c         |  7 +++----
 sound/soc/tegra/tegra186_dspk.c         |  7 +++----
 sound/soc/tegra/tegra210_admaif.c       | 24 +++++++++++-------------
 sound/soc/tegra/tegra210_adx.c          |  7 +++----
 sound/soc/tegra/tegra210_ahub.c         |  7 +++----
 sound/soc/tegra/tegra210_amx.c          |  7 +++----
 sound/soc/tegra/tegra210_dmic.c         |  7 +++----
 sound/soc/tegra/tegra210_i2s.c          |  7 +++----
 sound/soc/tegra/tegra210_mbdrc.c        | 19 ++++++++++---------
 sound/soc/tegra/tegra210_mixer.c        |  7 +++----
 sound/soc/tegra/tegra210_mvc.c          |  7 +++----
 sound/soc/tegra/tegra210_ope.c          | 26 ++++++++++----------------
 sound/soc/tegra/tegra210_peq.c          | 19 ++++++++++---------
 sound/soc/tegra/tegra210_sfc.c          |  7 +++----
 sound/soc/tegra/tegra_asoc_machine.c    | 21 ++++++++++-----------
 15 files changed, 82 insertions(+), 99 deletions(-)
Signature · 1 line
2.17.1
author
#1 lore raw

PATCH v4 1/4 ASoC: tegra: Add error logging in tegra210_admaif driver

Log errors in the Tegra210 ADMAIF probe and runtime callback paths. Drop redundant dev_err() at tegra_isomgr_adma_register() call site since it already logs errors internally.

---
 sound/soc/tegra/tegra210_admaif.c | 24 +++++++++++-------------
 1 file changed, 11 insertions(+), 13 deletions(-)
sound/soc/tegra/tegra210_admaif.c +11 -13
index 0976779d29f2..a1b2c3d4e5f6 100644
@@ -408,6 +408,7 @@ static int tegra_admaif_start(struct snd_soc_dai *dai, int direction)
 		reg = CH_RX_REG(TEGRA_ADMAIF_RX_ENABLE, dai->id);
 		break;
 	default:
+		dev_err(dai->dev, "invalid stream direction: %d\n", direction);
 		return -EINVAL;
 	}
 
@@ -441,6 +442,7 @@ static int tegra_admaif_stop(struct snd_soc_dai *dai, int direction)
 		reset_reg = CH_RX_REG(TEGRA_ADMAIF_RX_SOFT_RESET, dai->id);
 		break;
 	default:
+		dev_err(dai->dev, "invalid stream direction: %d\n", direction);
 		return -EINVAL;
 	}
 
@@ -489,6 +491,7 @@ static int tegra_admaif_trigger(struct snd_pcm_substream *substream, int cmd,
 	case SNDRV_PCM_TRIGGER_SUSPEND:
 		return tegra_admaif_stop(dai, substream->stream);
 	default:
+		dev_err(dai->dev, "invalid trigger command: %d\n", cmd);
 		return -EINVAL;
 	}
 }
@@ -958,10 +961,9 @@ static int tegra_admaif_probe(struct platform_device *pdev)
 
 	admaif->regmap = devm_regmap_init_mmio(&pdev->dev, regs,
 					       admaif->soc_data->regmap_conf);
-	if (IS_ERR(admaif->regmap)) {
-		dev_err(&pdev->dev, "regmap init failed\n");
-		return PTR_ERR(admaif->regmap);
-	}
+	if (IS_ERR(admaif->regmap))
+		return dev_err_probe(&pdev->dev, PTR_ERR(admaif->regmap),
+				     "regmap init failed\n");
 
 	regcache_cache_only(admaif->regmap, true);
 
@@ -968,7 +970,5 @@ static int tegra_admaif_probe(struct platform_device *pdev)
 	err = tegra_isomgr_adma_register(&pdev->dev);
-	if (err) {
-		dev_err(&pdev->dev, "Failed to add interconnect path\n");
-		return err;
-	}
+	if (err)
+		return err;
 
 	regmap_update_bits(admaif->regmap, admaif->soc_data->global_base +
@@ -1009,11 +1009,9 @@ static int tegra_admaif_probe(struct platform_device *pdev)
 					      admaif->soc_data->cmpnt,
 					      admaif->soc_data->dais,
 					      admaif->soc_data->num_ch);
-	if (err) {
-		dev_err(&pdev->dev,
-			"can't register ADMAIF component, err: %d\n", err);
-		return err;
-	}
+	if (err)
+		return dev_err_probe(&pdev->dev, err,
+				     "can't register ADMAIF component\n");
 
 	pm_runtime_enable(&pdev->dev);
 
Signature · 1 line
2.17.1
author
#2 lore raw

PATCH v4 2/4 ASoC: tegra: Use dev_err_probe() in OPE, PEQ and MBDRC drivers

In reply to Sheetal

Log errors in the Tegra210 OPE, PEQ and MBDRC probe paths using dev_err_probe(). Drop redundant dev_err() at tegra210_peq_regmap_init() and tegra210_mbdrc_regmap_init() call sites in ope_probe() since these functions already log errors internally.

---
 sound/soc/tegra/tegra210_mbdrc.c | 19 ++++++++++---------
 sound/soc/tegra/tegra210_ope.c   | 26 ++++++++++----------------
 sound/soc/tegra/tegra210_peq.c   | 19 ++++++++++---------
 3 files changed, 30 insertions(+), 34 deletions(-)
sound/soc/tegra/tegra210_mbdrc.c +8 -9
index 6a268dbb7197..b1c2d3e4f5a6 100644
@@ -988,14 +988,14 @@ int tegra210_mbdrc_regmap_init(struct platform_device *pdev)
 
 	child = of_get_child_by_name(dev->of_node, "dynamic-range-compressor");
 	if (!child)
-		return -ENODEV;
+		return dev_err_probe(dev, -ENODEV,
+				     "missing 'dynamic-range-compressor' DT child node\n");
 
 	err = of_address_to_resource(child, 0, &mem);
 	of_node_put(child);
-	if (err < 0) {
-		dev_err(dev, "fail to get MBDRC resource\n");
-		return err;
-	}
+	if (err < 0)
+		return dev_err_probe(dev, err,
+				     "failed to get MBDRC resource\n");
 
 	mem.flags = IORESOURCE_MEM;
 	regs = devm_ioremap_resource(dev, &mem);
@@ -1004,10 +1004,9 @@ int tegra210_mbdrc_regmap_init(struct platform_device *pdev)
 
 	ope->mbdrc_regmap = devm_regmap_init_mmio(dev, regs,
 						  &tegra210_mbdrc_regmap_cfg);
-	if (IS_ERR(ope->mbdrc_regmap)) {
-		dev_err(dev, "regmap init failed\n");
-		return PTR_ERR(ope->mbdrc_regmap);
-	}
+	if (IS_ERR(ope->mbdrc_regmap))
+		return dev_err_probe(dev, PTR_ERR(ope->mbdrc_regmap),
+				     "MBDRC regmap init failed\n");
 
 	regcache_cache_only(ope->mbdrc_regmap, true);
 
sound/soc/tegra/tegra210_ope.c +10 -16
index a440888dcdbd..c1d2e3f4a5b6 100644
@@ -318,10 +318,9 @@ static int tegra210_ope_probe(struct platform_device *pdev)
 
 	ope->regmap = devm_regmap_init_mmio(dev, regs,
 					    &tegra210_ope_regmap_config);
-	if (IS_ERR(ope->regmap)) {
-		dev_err(dev, "regmap init failed\n");
-		return PTR_ERR(ope->regmap);
-	}
+	if (IS_ERR(ope->regmap))
+		return dev_err_probe(dev, PTR_ERR(ope->regmap),
+				     "regmap init failed\n");
 
 	regcache_cache_only(ope->regmap, true);
 
@@ -328,14 +327,10 @@ static int tegra210_ope_probe(struct platform_device *pdev)
 	dev_set_drvdata(dev, ope);
 
 	err = tegra210_peq_regmap_init(pdev);
-	if (err < 0) {
-		dev_err(dev, "PEQ init failed\n");
-		return err;
-	}
+	if (err < 0)
+		return err;
 
 	err = tegra210_mbdrc_regmap_init(pdev);
-	if (err < 0) {
-		dev_err(dev, "MBDRC init failed\n");
-		return err;
-	}
+	if (err < 0)
+		return err;
 
@@ -342,10 +337,9 @@ static int tegra210_ope_probe(struct platform_device *pdev)
 	err = devm_snd_soc_register_component(dev, &tegra210_ope_cmpnt,
 					      tegra210_ope_dais,
 					      ARRAY_SIZE(tegra210_ope_dais));
-	if (err) {
-		dev_err(dev, "can't register OPE component, err: %d\n", err);
-		return err;
-	}
+	if (err)
+		return dev_err_probe(dev, err,
+				     "can't register OPE component\n");
 
 	pm_runtime_enable(dev);
 
sound/soc/tegra/tegra210_peq.c +8 -9
index 2f72e9d541dc..d1e2f3a4b5c6 100644
@@ -408,14 +408,14 @@ int tegra210_peq_regmap_init(struct platform_device *pdev)
 
 	child = of_get_child_by_name(dev->of_node, "equalizer");
 	if (!child)
-		return -ENODEV;
+		return dev_err_probe(dev, -ENODEV,
+				     "missing 'equalizer' DT child node\n");
 
 	err = of_address_to_resource(child, 0, &mem);
 	of_node_put(child);
-	if (err < 0) {
-		dev_err(dev, "fail to get PEQ resource\n");
-		return err;
-	}
+	if (err < 0)
+		return dev_err_probe(dev, err,
+				     "failed to get PEQ resource\n");
 
 	mem.flags = IORESOURCE_MEM;
 	regs = devm_ioremap_resource(dev, &mem);
@@ -423,10 +423,9 @@ int tegra210_peq_regmap_init(struct platform_device *pdev)
 		return PTR_ERR(regs);
 	ope->peq_regmap = devm_regmap_init_mmio(dev, regs,
 						&tegra210_peq_regmap_config);
-	if (IS_ERR(ope->peq_regmap)) {
-		dev_err(dev, "regmap init failed\n");
-		return PTR_ERR(ope->peq_regmap);
-	}
+	if (IS_ERR(ope->peq_regmap))
+		return dev_err_probe(dev, PTR_ERR(ope->peq_regmap),
+				     "PEQ regmap init failed\n");
 
 	regcache_cache_only(ope->peq_regmap, true);
 
Signature · 1 line
2.17.1
author
#3 lore raw

PATCH v4 3/4 ASoC: tegra: Use dev_err_probe() for regmap init failures

In reply to Sheetal

Use dev_err_probe() for regmap init failures in Tegra audio driver probe paths.

---
 sound/soc/tegra/tegra186_asrc.c  | 7 +++----
 sound/soc/tegra/tegra186_dspk.c  | 7 +++----
 sound/soc/tegra/tegra210_adx.c   | 7 +++----
 sound/soc/tegra/tegra210_ahub.c  | 7 +++----
 sound/soc/tegra/tegra210_amx.c   | 7 +++----
 sound/soc/tegra/tegra210_dmic.c  | 7 +++----
 sound/soc/tegra/tegra210_i2s.c   | 7 +++----
 sound/soc/tegra/tegra210_mixer.c | 7 +++----
 sound/soc/tegra/tegra210_mvc.c   | 7 +++----
 sound/soc/tegra/tegra210_sfc.c   | 7 +++----
 10 files changed, 30 insertions(+), 40 deletions(-)
sound/soc/tegra/tegra186_asrc.c +3 -4
index 98e911e2ed74..a2b3c4d5e6f7 100644
@@ -989,10 +989,9 @@ static int tegra186_asrc_platform_probe(struct platform_device *pdev)
 
 	asrc->regmap = devm_regmap_init_mmio(dev, regs,
 					     &tegra186_asrc_regmap_config);
-	if (IS_ERR(asrc->regmap)) {
-		dev_err(dev, "regmap init failed\n");
-		return PTR_ERR(asrc->regmap);
-	}
+	if (IS_ERR(asrc->regmap))
+		return dev_err_probe(dev, PTR_ERR(asrc->regmap),
+				     "regmap init failed\n");
 
 	asrc->soc_data = of_device_get_match_data(&pdev->dev);
 
sound/soc/tegra/tegra186_dspk.c +3 -4
index 1aa94c98294a..b3c4d5e6f7a8 100644
@@ -505,10 +505,9 @@ static int tegra186_dspk_platform_probe(struct platform_device *pdev)
 		return PTR_ERR(regs);
 
 	dspk->regmap = devm_regmap_init_mmio(dev, regs, &tegra186_dspk_regmap);
-	if (IS_ERR(dspk->regmap)) {
-		dev_err(dev, "regmap init failed\n");
-		return PTR_ERR(dspk->regmap);
-	}
+	if (IS_ERR(dspk->regmap))
+		return dev_err_probe(dev, PTR_ERR(dspk->regmap),
+				     "regmap init failed\n");
 
 	regcache_cache_only(dspk->regmap, true);
 
sound/soc/tegra/tegra210_adx.c +3 -4
index d7d075fd54b2..c4d5e6f7a8b9 100644
@@ -697,10 +697,9 @@ static int tegra210_adx_platform_probe(struct platform_device *pdev)
 
 	adx->regmap = devm_regmap_init_mmio(dev, regs,
 					    soc_data->regmap_conf);
-	if (IS_ERR(adx->regmap)) {
-		dev_err(dev, "regmap init failed\n");
-		return PTR_ERR(adx->regmap);
-	}
+	if (IS_ERR(adx->regmap))
+		return dev_err_probe(dev, PTR_ERR(adx->regmap),
+				     "regmap init failed\n");
 
 	regcache_cache_only(adx->regmap, true);
 
sound/soc/tegra/tegra210_ahub.c +3 -4
index 4626dd0a4d55..d5e6f7a8b9c0 100644
@@ -2275,10 +2275,9 @@ static int tegra_ahub_probe(struct platform_device *pdev)
 
 	ahub->regmap = devm_regmap_init_mmio(&pdev->dev, regs,
 					     ahub->soc_data->regmap_config);
-	if (IS_ERR(ahub->regmap)) {
-		dev_err(&pdev->dev, "regmap init failed\n");
-		return PTR_ERR(ahub->regmap);
-	}
+	if (IS_ERR(ahub->regmap))
+		return dev_err_probe(&pdev->dev, PTR_ERR(ahub->regmap),
+				     "regmap init failed\n");
 
 	regcache_cache_only(ahub->regmap, true);
 
sound/soc/tegra/tegra210_amx.c +3 -4
index 1b7fb84a0f34..e6f7a8b9c0d1 100644
@@ -745,10 +745,9 @@ static int tegra210_amx_platform_probe(struct platform_device *pdev)
 
 	amx->regmap = devm_regmap_init_mmio(dev, regs,
 					    amx->soc_data->regmap_conf);
-	if (IS_ERR(amx->regmap)) {
-		dev_err(dev, "regmap init failed\n");
-		return PTR_ERR(amx->regmap);
-	}
+	if (IS_ERR(amx->regmap))
+		return dev_err_probe(dev, PTR_ERR(amx->regmap),
+				     "regmap init failed\n");
 
 	regcache_cache_only(amx->regmap, true);
 
sound/soc/tegra/tegra210_dmic.c +3 -4
index 5a4bd5cef30a..f7a8b9c0d1e2 100644
@@ -517,10 +517,9 @@ static int tegra210_dmic_probe(struct platform_device *pdev)
 
 	dmic->regmap = devm_regmap_init_mmio(dev, regs,
 					     &tegra210_dmic_regmap_config);
-	if (IS_ERR(dmic->regmap)) {
-		dev_err(dev, "regmap init failed\n");
-		return PTR_ERR(dmic->regmap);
-	}
+	if (IS_ERR(dmic->regmap))
+		return dev_err_probe(dev, PTR_ERR(dmic->regmap),
+				     "regmap init failed\n");
 
 	regcache_cache_only(dmic->regmap, true);
 
sound/soc/tegra/tegra210_i2s.c +3 -4
index 7bf76c9b640f..a8b9c0d1e2f3 100644
@@ -1093,10 +1093,9 @@ static int tegra210_i2s_probe(struct platform_device *pdev)
 
 	i2s->regmap = devm_regmap_init_mmio(dev, regs,
 					    i2s->soc_data->regmap_conf);
-	if (IS_ERR(i2s->regmap)) {
-		dev_err(dev, "regmap init failed\n");
-		return PTR_ERR(i2s->regmap);
-	}
+	if (IS_ERR(i2s->regmap))
+		return dev_err_probe(dev, PTR_ERR(i2s->regmap),
+				     "regmap init failed\n");
 
 	tegra210_parse_client_convert(dev);
 
sound/soc/tegra/tegra210_mixer.c +3 -4
index d9318aaaf32e..b9c0d1e2f3a4 100644
@@ -814,10 +814,9 @@ static int tegra210_mixer_platform_probe(struct platform_device *pdev)
 
 	mixer->regmap = devm_regmap_init_mmio(dev, regs,
 					      &tegra210_mixer_regmap_config);
-	if (IS_ERR(mixer->regmap)) {
-		dev_err(dev, "regmap init failed\n");
-		return PTR_ERR(mixer->regmap);
-	}
+	if (IS_ERR(mixer->regmap))
+		return dev_err_probe(dev, PTR_ERR(mixer->regmap),
+				     "regmap init failed\n");
 
 	regcache_cache_only(mixer->regmap, true);
 
sound/soc/tegra/tegra210_mvc.c +3 -4
index 11bd0ea22797..c0d1e2f3a4b5 100644
@@ -731,10 +731,9 @@ static int tegra210_mvc_platform_probe(struct platform_device *pdev)
 
 	mvc->regmap = devm_regmap_init_mmio(dev, regs,
 					    &tegra210_mvc_regmap_config);
-	if (IS_ERR(mvc->regmap)) {
-		dev_err(dev, "regmap init failed\n");
-		return PTR_ERR(mvc->regmap);
-	}
+	if (IS_ERR(mvc->regmap))
+		return dev_err_probe(dev, PTR_ERR(mvc->regmap),
+				     "regmap init failed\n");
 
 	regcache_cache_only(mvc->regmap, true);
 
sound/soc/tegra/tegra210_sfc.c +3 -4
index 0f342fae058f..d1e2f3a4b5c6 100644
@@ -3598,10 +3598,9 @@ static int tegra210_sfc_platform_probe(struct platform_device *pdev)
 
 	sfc->regmap = devm_regmap_init_mmio(dev, regs,
 					    &tegra210_sfc_regmap_config);
-	if (IS_ERR(sfc->regmap)) {
-		dev_err(dev, "regmap init failed\n");
-		return PTR_ERR(sfc->regmap);
-	}
+	if (IS_ERR(sfc->regmap))
+		return dev_err_probe(dev, PTR_ERR(sfc->regmap),
+				     "regmap init failed\n");
 
 	regcache_cache_only(sfc->regmap, true);
 
Signature · 1 line
2.17.1
author
#4 lore raw

PATCH v4 4/4 ASoC: tegra: Use dev_err_probe() in tegra_asoc_machine probe

In reply to Sheetal

Use dev_err_probe() for clock errors in the tegra_asoc_machine probe path.

---
 sound/soc/tegra/tegra_asoc_machine.c | 21 ++++++++++-----------
 1 file changed, 9 insertions(+), 12 deletions(-)
sound/soc/tegra/tegra_asoc_machine.c +9 -12
index d7245a10bba1..e1f2a3b4c5d6 100644
@@ -591,16 +591,14 @@ int tegra_asoc_machine_probe(struct platform_device *pdev)
 		 * host controller and the external codec
 		 */
 		err = clk_set_rate(machine->clk_pll_a, 73728000);
-		if (err) {
-			dev_err(dev, "Can't set pll_a rate: %d\n", err);
-			return err;
-		}
+		if (err)
+			return dev_err_probe(dev, err,
+					     "can't set pll_a rate\n");
 
 		err = clk_set_rate(machine->clk_pll_a_out0, 24576000);
-		if (err) {
-			dev_err(dev, "Can't set pll_a_out0 rate: %d\n", err);
-			return err;
-		}
+		if (err)
+			return dev_err_probe(dev, err,
+					     "can't set pll_a_out0 rate\n");
 
 		machine->set_baseclock = 73728000;
 		machine->set_mclk = 24576000;
@@ -612,10 +610,9 @@ int tegra_asoc_machine_probe(struct platform_device *pdev)
 	 * only needed for audio.
 	 */
 	err = clk_prepare_enable(machine->clk_cdev1);
-	if (err) {
-		dev_err(dev, "Can't enable cdev1: %d\n", err);
-		return err;
-	}
+	if (err)
+		return dev_err_probe(dev, err,
+				     "can't enable cdev1\n");
 
 	err = devm_snd_soc_register_card(dev, card);
 	if (err)
Signature · 1 line
2.17.1
maintainer
#5 lore raw
In reply to Sheetal
Quoted 11 lines · Sheetal

ASoC: tegra: Add error logging for probe and callback failures

Resend pending v3 patches with fixes and add remaining dev_err_probe() conversions.

Patch 1 replaces v3 patch 03/14 (ADMAIF).
Patch 2 replaces v3 patch 09/14 (OPE/PEQ/MBDRC).
Patch 3 is new - adds regmap init conversions across 10 drivers. Patch 4 is new - adds clock error conversions in tegra_asoc_machine.

[...]

Applied to

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

Thanks!

[1/4] ASoC: tegra: Add error logging in tegra210_admaif driver

      https://git.kernel.org/broonie/sound/c/00d6070ec02c
[2/4] ASoC: tegra: Use dev_err_probe() in OPE, PEQ and MBDRC drivers
      https://git.kernel.org/broonie/sound/c/2333abb25c7e
[3/4] ASoC: tegra: Use dev_err_probe() for regmap init failures
      https://git.kernel.org/broonie/sound/c/4a8fe27e122e
[4/4] ASoC: tegra: Use dev_err_probe() in tegra_asoc_machine probe
      https://git.kernel.org/broonie/sound/c/b015ef4eaeff

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