]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
ASoC: rt1320: run the initialisation preset on the first hardware init
authorSergey Lebedev <lsa.uz@pm.me>
Tue, 4 Aug 2026 22:59:24 +0000 (22:59 +0000)
committerMark Brown <broonie@kernel.org>
Mon, 10 Aug 2026 14:46:13 +0000 (15:46 +0100)
rt1320_io_init() applies the vendor initialisation preset only when the
amplifier's SDCA function status has FUNCTION_NEEDS_INITIALIZATION set:

if ((amp_func_status & FUNCTION_NEEDS_INITIALIZATION)) {

Its two sibling drivers guard the same write differently, also running
the preset on the first hardware init:

  rt712-sdca.c:  if ((amp_func_status & FUNCTION_NEEDS_INITIALIZATION) ||
                     (!rt712->first_hw_init)) {
  rt722-sdca.c:  if ((amp_func_status & FUNCTION_NEEDS_INITIALIZATION) ||
                     (!rt722->first_hw_init)) {

On the Microsoft Surface Pro 11 (Intel) the RT1320 never sets that bit.
Its function status reads back 0x41 on every boot, cold or warm:

  rt1320-sdca sdw:0:0:025d:1320:01: rt1320_io_init amp func_status=0x41

which is NEWLY_ATTACHED | FUNCTION_HAS_BEEN_RESET: the function reports
that it has been reset and does not consider itself in need of
initialisation. Bit 5 is never set, so the preset never runs,
rt1320_vc_preset() and the MCU patch load are skipped, and the amplifier
is left unprogrammed. rt712 and rt722 would have run it via their
first_hw_init fallback.

Add the same fallback. With it rt1320_vc_preset() executes and the
amplifier reports RT1320_KR0_INT_READY=0x1f where previously it did not.

Signed-off-by: Sergey Lebedev <lsa.uz@pm.me>
Link: https://patch.msgid.link/20260804225853.31585-2-lsa.uz@pm.me
Signed-off-by: Mark Brown <broonie@kernel.org>
sound/soc/codecs/rt1320-sdw.c

index 1e930b27c67a8fd32e388644ebc19fb42b9bb3ab..42acb6cef77ac2532f872e1cf64a912060a17316 100644 (file)
@@ -1899,7 +1899,7 @@ static int rt1320_io_init(struct device *dev, struct sdw_slave *slave)
        dev_dbg(dev, "%s amp func_status=0x%x\n", __func__, amp_func_status);
 
        /* initialization write */
-       if ((amp_func_status & FUNCTION_NEEDS_INITIALIZATION)) {
+       if ((amp_func_status & FUNCTION_NEEDS_INITIALIZATION) || !rt1320->first_hw_init) {
                switch (rt1320->dev_id) {
                case RT1320_DEV_ID:
                        if (rt1320->version_id < RT1320_VC)