Skip to contentSkip to conversation

ASoC: rt722: reset codec to fix abnormal sound

PATCH Superseded [email protected] 2 participants 4 messages Jul 28 – Jul 30

Subsystems (3)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ASoC: rt722: reset codec to fix abnormal sound

From: Shuming Fan <[email protected]>

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.

---
 sound/soc/codecs/rt722-sdca-sdw.c |  4 ++++
 sound/soc/codecs/rt722-sdca.c     | 14 ++++++++++++++
 2 files changed, 18 insertions(+)
sound/soc/codecs/rt722-sdca-sdw.c +4 -0
index 05e8e23f1f43..5bc9aed58d14 100644
@@ -114,6 +114,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:
@@ -197,15 +198,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:
sound/soc/codecs/rt722-sdca.c +14 -0
index decf9407ab6d..a26253864d48 100644
@@ -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);
Signature · 1 line
2.54.0
maintainer
#1 lore raw
Quoted 5 lines · On Tue, Jul 28, 2026 at 05:01:11PM +0800, [email protected] wrote:

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.

sound/soc/codecs/rt722-sdca.c int rt722_sdca_io_init(struct device *dev, struct sdw_slave *slave) · line 1907

Quoted 9 lines
sound/soc/codecs/rt722-sdca.c +3 -0
@@ -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);

Slirhgly separate issue but you probably need a _jack_init() after the reset - your other devices do that, I think there's some races there.

#2 lore raw
Quoted 10 lines
Quoted 1 line

The audio output may become abnormal after a warm reboot from

Windows.

Review int rt722_sdca_io_init(struct device *dev, struct

Quoted 4 lines

Reset the codec once during hardware initialization to restore it to a known state and prevent the issue.

(quoted diff) +0 -0
@@ -1888,6 +1899,9 @@ int rt722_sdca_io_init(struct device *dev, struct

sdw_slave *slave)

Quoted 3 lines
sound/soc/codecs/rt722-sdca.c +0 -0
 	rt722->hw_vid = (val & 0x0f00) >> 8;
 	dev_dbg(&slave->dev, "%s hw_vid=0x%x\n", __func__, rt722->hw_vid);
 
Quoted 9 lines

sound/soc/codecs/rt722-sdca.c int rt722_sdca_io_init(struct device *dev, struct sdw_slave *slave) · line 1907

Quoted 6 lines
sound/soc/codecs/rt722-sdca.c +3 -0
+	if (!rt722->first_hw_init)
+		rt722_sdca_reset(rt722);
+
 	rt722_sdca_dmic_preset(rt722);
 	rt722_sdca_amp_preset(rt722);
 	rt722_sdca_jack_preset(rt722);

Slirhgly separate issue but you probably need a _jack_init() after the reset - your other devices do that, I think there's some races there.

Understood. I'll add _jack_init() after the reset to avoid its settings being reset by the reset.

maintainer
#3 lore raw
In reply to [email protected]
Quoted 1 line · On Tue, 28 Jul 2026 17:01:11 +0800, [email protected] wrote:

ASoC: rt722: reset codec to fix abnormal sound

Applied to

https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-7.2

Thanks!

[1/1] ASoC: rt722: reset codec to fix abnormal sound

      https://git.kernel.org/broonie/sound/c/d0ecbedd6a70

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