Devicetree
 help / color / mirror / Atom feed
* [PATCH v3] ASoC: codecs: nau8360: Block DSP path selection when firmware load fails
@ 2026-09-08  3:03 Neo Chang
  2026-09-08  3:17 ` sashiko-bot
  2026-09-08 13:31 ` Mark Brown
  0 siblings, 2 replies; 3+ messages in thread
From: Neo Chang @ 2026-09-08  3:03 UTC (permalink / raw)
  To: broonie
  Cc: lgirdwood, perex, robh, krzk+dt, linux-sound, devicetree,
	alsa-devel, neo.chang70, kchsu0, sjlin0, Neo Chang

Block the DSP path selection if the firmware fails to load to prevent
invalid routing states.

If the firmware is not ready, nau8360_dac_mux_put_enum() will print
a warning and return 0. This rejects the invalid userspace request
and maintains the original hardware state without
causing audio wrong status.

Signed-off-by: Neo Chang <YLCHANG2@nuvoton.com>
---
Changes in v3:
- Abandoned the bypass fallback in nau8360_load_fw_work().
- Added check in nau8360_dac_mux_put_enum() to explicitly block DSP path
  selection and return 0 when firmware is not ready.
 
Changes in v2:
- Replaced snd_soc_component_write() with snd_soc_component_update_bits()
  in the fallback logic to prevent overwriting other bits.

v1:
- ASoC: codecs: nau8360: Set DAC path to bypass mode when DSP firmware
  load fails

 sound/soc/codecs/nau8360.c | 5 +++++
 sound/soc/codecs/nau8360.h | 6 ++++++
 2 files changed, 11 insertions(+)

diff --git a/sound/soc/codecs/nau8360.c b/sound/soc/codecs/nau8360.c
index 89b8ee80d6c8..57a5023fe7b7 100644
--- a/sound/soc/codecs/nau8360.c
+++ b/sound/soc/codecs/nau8360.c
@@ -719,6 +719,11 @@ static int nau8360_dac_mux_put_enum(struct snd_kcontrol *kcontrol,
 		return ret;
 	}
 
+	if (item[0] == NAU8360_DAC_SRC_DSP && !nau8360->load_fw_done) {
+		dev_warn(nau8360->dev, "Cannot enable DSP: Firmware not ready or disabled\n");
+		return ret;
+	}
+
 	mutex_lock(&nau8360->lock);
 
 	ret = snd_soc_dapm_put_enum_double(kcontrol, ucontrol);
diff --git a/sound/soc/codecs/nau8360.h b/sound/soc/codecs/nau8360.h
index cc640ba8c838..71396747c0fa 100644
--- a/sound/soc/codecs/nau8360.h
+++ b/sound/soc/codecs/nau8360.h
@@ -870,6 +870,12 @@ enum {
 	NAU8360_TDM_TXN,
 };
 
+/* DAC Source Path*/
+enum {
+	NAU8360_DAC_SRC_HW1 = 0,
+	NAU8360_DAC_SRC_DSP,
+};
+
 /* PLL Source */
 enum {
 	NAU8360_PLL_MCLK,
-- 
2.25.1


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

end of thread, other threads:[~2026-09-08 13:31 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-09-08  3:03 [PATCH v3] ASoC: codecs: nau8360: Block DSP path selection when firmware load fails Neo Chang
2026-09-08  3:17 ` sashiko-bot
2026-09-08 13:31 ` Mark Brown

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox