Re: [RFC PATCH] ASoC: Intel: sof_es8336: add Huawei BOD-WXX9 HWSP support
From: Mark Brown
Date: Mon Jun 15 2026 - 09:50:20 EST
On Sun, Jun 14, 2026 at 07:10:28PM +0300, Tagir Garaev wrote:
> Huawei BOD-WXX9 routes the ES8336 HPOL/HPOR outputs to both the
> headphone jack and an internal speaker amplifier. The amplifier is
> represented in ACPI as HWSP0001 and is not controlled by the ES8336
> GPIOs alone.
> +static const struct sof_es8336_hwsp_regval hwsp_speaker_restore_profile[] = {
> + { 0x01, 0x69 },
> + { 0x03, 0x16 },
> + { 0x04, 0x80 },
> + { 0x05, 0x0c },
> + { 0x06, 0x11 },
> + { 0x07, 0x93 },
> + { 0x09, 0x0b },
> + { 0x0b, 0x4b },
> + { 0x0c, 0x00 },
> + { 0x0d, 0x77 },
> + { 0x0f, 0x51 },
> + { 0x10, 0x58 },
> + { 0x58, 0x00 },
> + { 0x59, 0x80 },
> +};
Magic number write sequences in a machine integration... this looks
awfully like it should be either user visible controls or something more
structured. In a chip driver it's usually something the manufacturer
simply does not document but this is a third party thing.
> + } else if (priv->gpio_hwsp) {
> + gpiod_set_raw_value_cansleep(priv->gpio_hwsp, 0);
> + usleep_range(SOF_ES8336_HWSP_MUTE_PULSE_MS * 1000,
> + SOF_ES8336_HWSP_MUTE_PULSE_MS * 1000 + 1000);
> + gpiod_set_raw_value_cansleep(priv->gpio_hwsp, 1);
Why _raw?
> +static void sof_es8336_apply_gpio_mux(struct sof_es8336_private *priv)
> +{
> + struct gpio_desc *speaker_gpio = priv->gpio_speakers;
> + struct gpio_desc *headphone_gpio = priv->gpio_headphone;
> + bool hwsp_enabled = sof_es8336_hwsp_amp_enabled() && priv->hwsp_client;
> + bool hwsp_speaker_on = false;
> + bool speaker_on;
> + bool headphone_on;
> + bool need_enable_delay;
> +
> + if (!priv->gpio_speakers)
> + return;
> +
> + mutex_lock(&priv->gpio_mux_lock);
> +
> + speaker_on = priv->output_active && !priv->hp_jack_present;
> + headphone_on = priv->output_active && priv->hp_jack_present;
Why is this not being done by userspace, it looks like policy is being
encoded into the kernel here? Does having the speaker and headphone
active simultaneously physically work?
Attachment:
signature.asc
Description: PGP signature