ASoC: amd: acp: Support Huawei MateBook D 14 (NBM-WXX9)
Subsystems (3)
v2 cover ASoC: amd: acp: Support Huawei MateBook D 14 (NBM-WXX9)
The Huawei MateBook D 14 AMD (NBM-WXX9) has the same ES8336 + ACP3x audio layout as the already supported BOM-WXX9, but is missing from the DMI tables, so only the DMIC-only driver binds and the speakers do not work.
Patch 1 adds the DMI quirk.
Patch 2 greatly reduces a pop heard every time the speaker output powers up (a faint one is still audible on this machine):
the speaker amplifier GPIO was driven from a SUPPLY widget, which DAPM enables before the codec output. It is independent of patch 1.
Both were tested as an out-of-tree DKMS module on the NBM-WXX9.
Changes in v2:
- Patch 2: only move the speaker amplifier to the endpoint widget. The Headphone widget shares its power-up rank with the ES8316 output drivers, so the reordering did not hold for headphones (Sashiko).
- Patch 2: use braces on both if/else branches (Sashiko).
- Patch 2: add Fixes tag (Sashiko).
- Patch 1: unchanged.
Samuel Leyva (2):
ASoC: amd: acp: Add DMI quirk for Huawei MateBook D 14 (NBM-WXX9)
ASoC: amd: acp: es83xx: Enable speaker amplifier after the codec
output
sound/soc/amd/acp-config.c | 14 +++++++++++ sound/soc/amd/acp/acp3x-es83xx/acp3x-es83xx.c | 24 +++++++++++++------ 2 files changed, 31 insertions(+), 7 deletions(-)
Signature · 1 line
2.56.0
PATCH v2 1/2 ASoC: amd: acp: Add DMI quirk for Huawei MateBook D 14 (NBM-WXX9)
The Huawei MateBook D 14 AMD (NBM-WXX9, Lucienne) uses an Everest ES8336 codec connected to the ACP3x, like the already supported BOM-WXX9. Without a DMI match the ACP falls back to the DMIC-only driver, so the speakers and the headphone jack do not work.
Add the system to the ACP config table and to the acp3x-es83xx quirk table, with the same quirks as BOM-WXX9 (internal DMIC and 48 MHz MCLK).
Tested speakers and internal microphone; the headphone jack could not be tested.
--- sound/soc/amd/acp-config.c | 14 ++++++++++++++ sound/soc/amd/acp/acp3x-es83xx/acp3x-es83xx.c | 8 ++++++++ 2 files changed, 22 insertions(+)
sound/soc/amd/acp-config.c +14 -0
@@ -237,6 +237,20 @@ static const struct config_entry config_table[] = { {} }, }, + { + .flags = FLAG_AMD_LEGACY, + .device = ACP_PCI_DEV_ID, + .dmi_table = (const struct dmi_system_id []) { + { + .matches = { +DMI_EXACT_MATCH (DMI_BOARD_VENDOR ,"HUAWEI" ), +DMI_EXACT_MATCH (DMI_PRODUCT_NAME ,"NBM-WXX9" ), +DMI_EXACT_MATCH (DMI_PRODUCT_VERSION ,"M1010" ), + }, + }, + {} + }, + }, { .flags = FLAG_AMD_LEGACY, .device = ACP_PCI_DEV_ID,
sound/soc/amd/acp/acp3x-es83xx/acp3x-es83xx.c +8 -0
@@ -364,6 +364,14 @@ static const struct dmi_system_id acp3x_es83xx_dmi_table[] = { }, .driver_data = (void *)(ES83XX_ENABLE_DMIC|ES83XX_48_MHZ_MCLK), }, + { + .matches = { +DMI_EXACT_MATCH (DMI_BOARD_VENDOR ,"HUAWEI" ), +DMI_EXACT_MATCH (DMI_PRODUCT_NAME ,"NBM-WXX9" ), + DMI_EXACT_MATCH(DMI_PRODUCT_VERSION, "M1010"), + }, + .driver_data = (void *)(ES83XX_ENABLE_DMIC|ES83XX_48_MHZ_MCLK), + }, { .matches = { DMI_EXACT_MATCH(DMI_BOARD_VENDOR, "HUAWEI"),
Signature · 1 line
2.56.0
PATCH v2 2/2 ASoC: amd: acp: es83xx: Enable speaker amplifier after the codec output
In reply to Samuel LeyvaThe speaker amplifier GPIO is driven from a SUPPLY widget. DAPM powers supplies before the rest of the path, so the amplifier is enabled while the ES8316 headphone driver and charge pump, which also feed the speakers, are still powering up. This results in an audible pop every time the speaker output is powered on.
Move the speaker GPIO handling to the Speaker endpoint widget, which DAPM powers up last and powers down first, and give the codec output a short time to settle before enabling the amplifier.
The headphone path is left unchanged: the Headphone endpoint widget shares its power-up rank with the codec output drivers, so moving it would not guarantee the same ordering, and it could not be tested.
--- sound/soc/amd/acp/acp3x-es83xx/acp3x-es83xx.c | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-)
sound/soc/amd/acp/acp3x-es83xx/acp3x-es83xx.c +9 -7
@@ -18,6 +18,7 @@#include <linux/input.h> #include <linux/io.h> #include <linux/acpi.h> +#include <linux/delay.h> #include <linux/dmi.h> #include <linux/string_choices.h> #include "../acp-mach.h"
@@ -60,6 +61,8 @@ static const struct snd_pcm_hw_constraint_list constraints_channels = {#define ES83xx_12288_KHZ_MCLK_FREQ (48000 * 256)#define ES83xx_48_MHZ_MCLK_FREQ (48000 * 1000) +#define ES83XX_AMP_ON_DELAY_MS 50 +static int acp3x_es83xx_headphone_power_event (struct snd_soc_dapm_widget *w,struct snd_kcontrol *kcontrol,int event); static int acp3x_es83xx_speaker_power_event(struct snd_soc_dapm_widget *w,
@@ -114,7 +117,7 @@ static struct snd_soc_jack_pin es83xx_jack_pins[] = { };static const struct snd_soc_dapm_widget acp3x_es83xx_widgets[] = { -SND_SOC_DAPM_SPK ("Speaker" ,NULL ), +SND_SOC_DAPM_SPK ("Speaker" , acp3x_es83xx_speaker_power_event),SND_SOC_DAPM_HP ("Headphone" ,NULL ),SND_SOC_DAPM_MIC ("Headset Mic" ,NULL ),SND_SOC_DAPM_MIC ("Internal Mic" ,NULL ),
@@ -122,9 +125,6 @@ static const struct snd_soc_dapm_widget acp3x_es83xx_widgets[] = {SND_SOC_DAPM_SUPPLY ("Headphone Power" ,SND_SOC_NOPM ,0 ,0 , acp3x_es83xx_headphone_power_event, SND_SOC_DAPM_PRE_PMD | SND_SOC_DAPM_POST_PMU), -SND_SOC_DAPM_SUPPLY ("Speaker Power" ,SND_SOC_NOPM ,0 ,0 , - acp3x_es83xx_speaker_power_event, - SND_SOC_DAPM_PRE_PMD | SND_SOC_DAPM_POST_PMU), };static const struct snd_soc_dapm_route acp3x_es83xx_audio_map[] = {
@@ -138,7 +138,6 @@ static const struct snd_soc_dapm_route acp3x_es83xx_audio_map[] = {*/ {"Speaker", NULL, "HPOL"}, {"Speaker", NULL, "HPOR"}, - {"Speaker", NULL, "Speaker Power"}, };
@@ -186,10 +185,13 @@ static int acp3x_es83xx_speaker_power_event(struct snd_soc_dapm_widget *w,struct acp3x_es83xx_private *priv =get_mach_priv (card);dev_dbg (priv->codec_dev,"speaker power event: %d\n" , event); -if (SND_SOC_DAPM_EVENT_ON (event)) +if (SND_SOC_DAPM_EVENT_ON (event)) { +/* Let the codec output settle before enabling the amplifier */ +msleep (ES83XX_AMP_ON_DELAY_MS ); priv->speaker_on = true; -else + }else { priv->speaker_on = false; + }gpiod_set_value_cansleep (priv->gpio_speakers, priv->speaker_on);gpiod_set_value_cansleep (priv->gpio_headphone, priv->headphone_on);
Signature · 1 line
2.56.0
Mark Brown
maintainerQuoted 8 lines · Samuel Leyva
ASoC: amd: acp: Support Huawei MateBook D 14 (NBM-WXX9)
The Huawei MateBook D 14 AMD (NBM-WXX9) has the same ES8336 + ACP3x audio layout as the already supported BOM-WXX9, but is missing from the DMI tables, so only the DMIC-only driver binds and the speakers do not work.
[...]
Applied to
https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-7.4
Thanks!
[1/2] ASoC: amd: acp: Add DMI quirk for Huawei MateBook D 14 (NBM-WXX9)
https://git.kernel.org/broonie/sound/c/fd10c1c1d506 [2/2] ASoC: amd: acp: es83xx: Enable speaker amplifier after the codec output https://git.kernel.org/broonie/sound/c/f392763d7335
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