]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
ASoC: rt722: reset codec to fix abnormal sound
authorShuming Fan <shumingf@realtek.com>
Tue, 28 Jul 2026 09:01:11 +0000 (17:01 +0800)
committerMark Brown <broonie@kernel.org>
Wed, 29 Jul 2026 22:27:37 +0000 (23:27 +0100)
The audio output may become abnormal after a warm reboot from Windows.
Reset the codec once during hardware initialization to restore it to a known
state and prevent the issue.
BugLink: https://github.com/thesofproject/linux/issues/5845
Signed-off-by: Shuming Fan <shumingf@realtek.com>
Link: https://patch.msgid.link/20260728090111.3676617-1-shumingf@realtek.com
Signed-off-by: Mark Brown <broonie@kernel.org>
sound/soc/codecs/rt722-sdca-sdw.c
sound/soc/codecs/rt722-sdca.c

index e68aa0350a5b9d3212b305b392db978d08c20ae4..7482a9a8d1987b602491b3427d9275991e7bfaf8 100644 (file)
@@ -113,6 +113,7 @@ static int rt722_sdca_mbq_size(struct device *dev, unsigned int reg)
        case 0x2000090 ... 0x2000094:
        case 0x20000b1:
        case 0x20000b4:
+       case 0x3010000:
        case 0x3110000:
        case 0x5300000 ... 0x5300300:
        case 0x5400002:
@@ -196,15 +197,18 @@ static bool rt722_sdca_volatile_register(struct device *dev, unsigned int reg)
        case 0x2000007:
        case 0x200000d:
        case 0x2000019:
+       case 0x200001a:
        case 0x2000020:
        case 0x2000030:
        case 0x2000046:
        case 0x2000067:
        case 0x2000084:
        case 0x2000086:
+       case 0x3010000:
        case 0x3110000:
        case 0x5800003:
        case 0x5810000:
+       case 0x6100008:
        case 0x44011000 ... 0x440115ff:
        case 0x44012000:
        case 0x44012021:
index 1b6729f363fc47b5b442294d6d7150cdc22854e2..6b509eb65d77614605be09d920202c5c3574a1e7 100644 (file)
@@ -1851,6 +1851,17 @@ static void rt722_sdca_jack_preset(struct rt722_sdca_priv *rt722)
        }
 }
 
+static void rt722_sdca_reset(struct rt722_sdca_priv *rt722)
+{
+       rt722_sdca_index_update_bits(rt722, RT722_VENDOR_REG,
+               RT722_LDO1_CTL, RT722_HIDDEN_REG_SW_RESET,
+               RT722_HIDDEN_REG_SW_RESET);
+       rt722_sdca_index_update_bits(rt722, RT722_VENDOR_HDA_CTL,
+               RT722_HDA_LEGACY_RESET_CTL, 0x1, 0x1);
+       if (rt722->hw_vid == RT722_VA)
+               rt722_sdca_index_write(rt722, RT722_VENDOR_REG, RT722_LDO1_CTL, 0xb091);
+}
+
 int rt722_sdca_io_init(struct device *dev, struct sdw_slave *slave)
 {
        struct rt722_sdca_priv *rt722 = dev_get_drvdata(dev);
@@ -1888,6 +1899,9 @@ int rt722_sdca_io_init(struct device *dev, struct sdw_slave *slave)
        rt722->hw_vid = (val & 0x0f00) >> 8;
        dev_dbg(&slave->dev, "%s hw_vid=0x%x\n", __func__, rt722->hw_vid);
 
+       if (!rt722->first_hw_init)
+               rt722_sdca_reset(rt722);
+
        rt722_sdca_dmic_preset(rt722);
        rt722_sdca_amp_preset(rt722);
        rt722_sdca_jack_preset(rt722);