ASoC: rt721: Reset codec to fix abnormal sound

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.

Signed-off-by: Oder Chiou <oder_chiou@realtek.com>
Link: https://patch.msgid.link/20260916101803.2301508-1-oder_chiou@realtek.com
Signed-off-by: Mark Brown <broonie@kernel.org>
This commit is contained in:
Oder Chiou 2026-09-16 18:18:03 +08:00 committed by Mark Brown
parent 576725ded0
commit a5e22cba35
No known key found for this signature in database
GPG Key ID: 24D68B725D5487D0
2 changed files with 20 additions and 0 deletions

View File

@ -70,6 +70,7 @@ static bool rt721_sdca_mbq_readable_register(struct device *dev, unsigned int re
case 0x0310100:
case 0x2000000 ... 0x2000003:
case 0x2000013:
case 0x2000026:
case 0x200002c:
case 0x200003c:
case 0x2000046:
@ -142,6 +143,7 @@ static bool rt721_sdca_mbq_volatile_register(struct device *dev, unsigned int re
case 0x200000d:
case 0x2000019:
case 0x2000020:
case 0x2000026:
case 0x200002c:
case 0x2000030:
case 0x2000046:
@ -155,6 +157,7 @@ static bool rt721_sdca_mbq_volatile_register(struct device *dev, unsigned int re
case 0x5810039:
case 0x5b10018:
case 0x5b10019:
case 0x6100006:
return true;
default:
return false;

View File

@ -1497,6 +1497,15 @@ int rt721_sdca_init(struct device *dev, struct regmap *regmap,
&soc_sdca_dev_rt721, rt721_sdca_dai, ARRAY_SIZE(rt721_sdca_dai));
}
static void rt721_sdca_reset(struct rt721_sdca_priv *rt721)
{
rt_sdca_index_update_bits(rt721->mbq_regmap, RT721_VENDOR_REG,
RT721_VD_HIDDEN_CTRL, RT721_HIDDEN_REG_SW_RESET,
RT721_HIDDEN_REG_SW_RESET);
rt_sdca_index_update_bits(rt721->mbq_regmap, RT721_HDA_SDCA_FLOAT,
RT721_HDA_LEGACY_RESET_CTL, 0x1, 0x1);
}
int rt721_sdca_io_init(struct device *dev, struct sdw_slave *slave)
{
struct rt721_sdca_priv *rt721 = dev_get_drvdata(dev);
@ -1530,9 +1539,17 @@ int rt721_sdca_io_init(struct device *dev, struct sdw_slave *slave)
}
pm_runtime_get_noresume(&slave->dev);
if (!rt721->first_hw_init)
rt721_sdca_reset(rt721);
rt721_sdca_dmic_preset(rt721);
rt721_sdca_amp_preset(rt721);
rt721_sdca_jack_preset(rt721);
if (rt721->hs_jack && (!rt721->first_hw_init))
rt721_sdca_jack_init(rt721);
if (rt721->first_hw_init) {
regcache_cache_bypass(rt721->regmap, false);
regcache_mark_dirty(rt721->regmap);