Package: src:linux
Version: 7.1.3-1~bpo13+1
Severity: normal
Tags: patch
X-Debbugs-Cc: [email protected]

Dear Maintainer,

Debian's arm64 kernel config enables the neighbouring Everest codecs but not
ES8328/ES8388:

    CONFIG_SND_SOC_ES8316=m
    CONFIG_SND_SOC_ES8326=m
    # CONFIG_SND_SOC_ES8328_I2C is not set
    # CONFIG_SND_SOC_ES8328_SPI is not set

The ES8388 is the analog audio codec on a number of shipping Rockchip RK3588
boards - including the Orange Pi 5B, which is supported by the mainline device
tree Debian ships. On those boards nothing binds to the codec, so the 3.5mm
headphone jack produces no output at all: HDMI audio works, analog does not.

Everything else in the chain is already correct and present in Debian's kernel,
which is what makes this a one-line config gap rather than a porting problem:

  * the devicetree node is in-tree and correct:
        audio-codec@10 { compatible = "everest,es8388", "everest,es8328"; ... }
  * the I2C device is created at boot:
        /sys/bus/i2c/devices/6-0010  name=es8388
  * the I2S controller is enabled (i2s@fddf0000, status = "okay")
  * snd_soc_rockchip_i2s_tdm, snd_soc_simple_card and snd_soc_simple_card_utils
    are all built and loaded

The only missing piece is the codec driver, so the sound card never registers
and the platform device sits in deferred probe indefinitely:

    $ cat /sys/kernel/debug/devices_deferred
    analog-sound        asoc-simple-card: parse error

    $ dmesg | grep analog-sound
    platform analog-sound: deferred probe pending: asoc-simple-card: parse error

    $ cat /proc/asound/cards
     0 [hdmi0          ]: simple-card - hdmi0
                          hdmi0

The driver's I2C glue already matches this hardware exactly
(sound/soc/codecs/es8328-i2c.c):

    static const struct of_device_id es8328_of_match[] = {
            { .compatible = "everest,es8328", },
            { .compatible = "everest,es8388", },
            { }
    };

Verification: building sound/soc/codecs/es8328.c and es8328-i2c.c unmodified
from stable v7.1.3, out-of-tree against linux-headers-7.1.3+deb13-arm64, and
loading the two modules resolves it immediately on an Orange Pi 5B:

    $ cat /proc/asound/cards
     0 [hdmi0          ]: simple-card - hdmi0
                          hdmi0
     1 [rockchipes8388 ]: simple-card - rockchip,es8388
                          rockchip,es8388

    dmesg: input: rockchip,es8388 Headphones as .../sound/card1/input17

Headphone jack-detect registers as well, and the deferred-probe entry clears.

Prior art: Armbian enable this driver for the same SoC family. Their
rockchip-rk3588 kernel config (config/kernel/linux-rockchip-rk3588-edge.config
in armbian/build) carries:

    CONFIG_SND_SOC_ES8328=m
    CONFIG_SND_SOC_ES8328_I2C=m
    CONFIG_SND_SOC_ES8328_SPI=m

alongside the same ES8316/ES8326 that Debian already builds. So this is not a
novel request or an unusual hardware combination - it is a codec another
distribution already ships for these boards, and which Debian's own devicetrees
describe.

Requested change - enable the I2C variant for arm64 (the SPI variant is not
needed for these boards, though Armbian enable both):

    CONFIG_SND_SOC_ES8328_I2C=m

Size cost, measured on arm64 (stripped, xz-compressed, as shipped):

    snd-soc-es8328.ko.xz          16100 bytes
    snd-soc-es8328-i2c.ko.xz       1612 bytes
                                  ------------
                                  17712 bytes

For comparison, the two codecs already enabled for arm64 in this family:

    snd-soc-es8316.ko.xz          17168 bytes
    snd-soc-es8326.ko.xz          20016 bytes

So the whole request is roughly one ES8316's worth of module, and it would give
working analog audio out of the box on RK3588 hardware Debian already supports
via its devicetrees.

Reported against trixie-backports 7.1.3-1~bpo13+1; the same setting is absent
from the trixie kernel config, so it likely applies there too.

Proposed patch. This follows the existing pattern for this codec family: they 
are
disabled in the common config and re-enabled per architecture where the hardware
exists. debian/config/config has

    # CONFIG_SND_SOC_ES8316 is not set
    # CONFIG_SND_SOC_ES8328_I2C is not set
    # CONFIG_SND_SOC_ES8328_SPI is not set

and debian/config/arm64/config already overrides the first of those. Adding the
I2C variant beside it keeps the block alphabetical:

--- a/debian/config/arm64/config
+++ b/debian/config/arm64/config
@@ -2774,7 +2774,8 @@
 CONFIG_SND_SOC_BT_SCO=m
 CONFIG_SND_SOC_CROS_EC_CODEC=m
 CONFIG_SND_SOC_DMIC=m
 CONFIG_SND_SOC_ES8316=m
+CONFIG_SND_SOC_ES8328_I2C=m
 CONFIG_SND_SOC_GTM601=m
 CONFIG_SND_SOC_MSM8916_WCD_ANALOG=m
 CONFIG_SND_SOC_MSM8916_WCD_DIGITAL=m

CONFIG_SND_SOC_ES8328 itself needs no entry - sound/soc/codecs/Kconfig has
SND_SOC_ES8328_I2C "select SND_SOC_ES8328", so the core is pulled in
automatically. arm64 only, since that is where the affected boards are; the SPI
variant is not needed.

(Line numbers are against debian/latest as of this report; the hunk is a single
added line in the alphabetised sound/soc/codecs/Kconfig block.)

-- System Information:
Debian Release: 13 (trixie)
  APT prefers trixie-backports
Architecture: arm64 (aarch64)
Kernel: Linux 7.1.3+deb13-arm64
Hardware: Xunlong Orange Pi 5B (Rockchip RK3588S)

defcom5-rockchip

Reply via email to