Skip to contentSkip to conversation

ASoC: nau8822: add spk boost and spk btl options

PATCH In review Benjamin Marty 3 participants 3 messages Oct 14, 2022 – Oct 16, 2022

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 ASoC: nau8822: add spk boost and spk btl options

These two options are required to use the Speaker output on this codec to its full potential, when wiring up the Speaker in an BTL configuration.

The Speaker Boost flag is explained in the Datasheet on page 80. The Speaker BTL flag is explained in the Datasheet on page 78.

---
 sound/soc/codecs/nau8822.c | 6 ++++++
 1 file changed, 6 insertions(+)
sound/soc/codecs/nau8822.c +6 -0
index 1aef281a9972..812b8254f9a0 100644
@@ -379,6 +379,12 @@ static const struct snd_kcontrol_new nau8822_snd_controls[] = {
 		NAU8822_REG_DAC_CONTROL, 5, 1, 0),
 	SOC_SINGLE("ADC 128x Oversampling Switch",
 		NAU8822_REG_ADC_CONTROL, 5, 1, 0),
+
+	SOC_SINGLE("Speaker Gain Boost Control",
+		NAU8822_REG_OUTPUT_CONTROL, 2, 1, 0),
+
+	SOC_SINGLE("Speaker BTL Configuration",
+		NAU8822_REG_RIGHT_SPEAKER_CONTROL, 4, 1, 0),
 };
 
 /* LMAIN and RMAIN Mixer */
Signature · 1 line
2.38.0
maintainer
#1 lore raw
Quoted 2 lines · Benjamin Marty

The Speaker Boost flag is explained in the Datasheet on page 80. The Speaker BTL flag is explained in the Datasheet on page 78.

Not according to

https://www.nuvoton.com/resource-files/NAU8822LDataSheetRev1.9.pdf

where the page numbers changed. It's better to actually describe things directly... In any case, as Francesco said things that depend on the physical design of the board should be in firmware description not user controllable, users can't meaningfully change them at runtime and there is only ever one correct setting for a given system.

sound/soc/codecs/nau8822.c static const struct snd_kcontrol_new nau8822_snd_controls[] = { · line 384

Quoted 2 lines
sound/soc/codecs/nau8822.c +2 -0
+	SOC_SINGLE("Speaker Gain Boost Control",
+		NAU8822_REG_OUTPUT_CONTROL, 2, 1, 0),

This looks on the edge of what could be user controllable since while the datasheet does recommend settings based on supply voltage it looks like it's just a gain control so you could reasonably use it at runtime in spite of what the datasheet recommends. However if it is being exposed it should end in Volume as per control-names.rst and ideally have TLV information.

sound/soc/codecs/nau8822.c static const struct snd_kcontrol_new nau8822_snd_controls[] = { · line 387

Quoted 2 lines
sound/soc/codecs/nau8822.c +2 -0
+	SOC_SINGLE("Speaker BTL Configuration",
+		NAU8822_REG_RIGHT_SPEAKER_CONTROL, 4, 1, 0),

Like Francesco says this should be done in firmware configuration since especially in the case where there is a BTL speaker there really only is one correct setting for the system. I guess you might for some reason want to invert the signal on a non-BTL system but it's hard to see what the use case might be.

#2 lore raw
In reply to Benjamin Marty
Quoted 8 lines · Benjamin Marty
sound/soc/codecs/nau8822.c +0 -0
index 1aef281a9972..812b8254f9a0 100644
@@ -379,6 +379,12 @@ static const struct snd_kcontrol_new nau8822_snd_controls[] = {
 		NAU8822_REG_DAC_CONTROL, 5, 1, 0),
 	SOC_SINGLE("ADC 128x Oversampling Switch",
 		NAU8822_REG_ADC_CONTROL, 5, 1, 0),

<snip>

sound/soc/codecs/nau8822.c static const struct snd_kcontrol_new nau8822_snd_controls[] = { · line 387

Quoted 2 lines
sound/soc/codecs/nau8822.c +2 -0
+	SOC_SINGLE("Speaker BTL Configuration",
+		NAU8822_REG_RIGHT_SPEAKER_CONTROL, 4, 1, 0),

We proposed the exact same change and it was not considered fine [1], this is considered a system property and should be configured from something like a device tree.

I would appreciate if you could add me in cc on any follow-up patch on that, thanks.

Francesco

[1] https://lore.kernel.org/all/[email protected]/