diff --git a/drivers/soundwire/bus.c b/drivers/soundwire/bus.c index c7b623875cc571..48627b53155598 100644 --- a/drivers/soundwire/bus.c +++ b/drivers/soundwire/bus.c @@ -801,7 +801,7 @@ static void sdw_modify_slave_status(struct sdw_slave *slave, if (status == SDW_SLAVE_UNATTACHED) { dev_dbg(&slave->dev, - "%s: initializing completion for Slave %d\n", + "%s: initializing enumeration and init completion for Slave %d\n", __func__, slave->dev_num); init_completion(&slave->enumeration_complete); @@ -810,7 +810,7 @@ static void sdw_modify_slave_status(struct sdw_slave *slave, } else if ((status == SDW_SLAVE_ATTACHED) && (slave->status == SDW_SLAVE_UNATTACHED)) { dev_dbg(&slave->dev, - "%s: signaling completion for Slave %d\n", + "%s: signaling enumeration completion for Slave %d\n", __func__, slave->dev_num); complete(&slave->enumeration_complete); @@ -1463,6 +1463,8 @@ static int sdw_handle_slave_alerts(struct sdw_slave *slave) bool parity_check; bool parity_quirk; + dev_dbg(&slave->dev, "%s: start\n", __func__); + sdw_modify_slave_status(slave, SDW_SLAVE_ALERT); ret = pm_runtime_get_sync(&slave->dev); @@ -1499,6 +1501,8 @@ static int sdw_handle_slave_alerts(struct sdw_slave *slave) } do { + dev_dbg(&slave->dev, "Interrupt loop count: %d\n", count); + slave_notify = false; /* @@ -1510,12 +1514,20 @@ static int sdw_handle_slave_alerts(struct sdw_slave *slave) parity_quirk = !slave->first_interrupt_done && (slave->prop.quirks & SDW_SLAVE_QUIRKS_INVALID_INITIAL_PARITY); + dev_dbg(&slave->dev, + "Parity: SDW_SCP_INT1 0x%02x INT1_MASK 0x%02x first_interrupt_done %d\n", + buf, slave->prop.scp_int1_mask, slave->first_interrupt_done); + if (parity_check && !parity_quirk) dev_err(&slave->dev, "Parity error detected\n"); clear |= SDW_SCP_INT1_PARITY; } if (buf & SDW_SCP_INT1_BUS_CLASH) { + dev_dbg(&slave->dev, + "Bus Clash: SDW_SCP_INT1 0x%02x INT1_MASK 0x%02x first_interrupt_done %d\n", + buf, slave->prop.scp_int1_mask, slave->first_interrupt_done); + if (slave->prop.scp_int1_mask & SDW_SCP_INT1_BUS_CLASH) dev_err(&slave->dev, "Bus clash detected\n"); clear |= SDW_SCP_INT1_BUS_CLASH; @@ -1529,6 +1541,10 @@ static int sdw_handle_slave_alerts(struct sdw_slave *slave) */ if (buf & SDW_SCP_INT1_IMPL_DEF) { + dev_dbg(&slave->dev, + "Imp-def interrupt: SDW_SCP_INT1 0x%02x INT1_MASK 0x%02x first_interrupt_done %d\n", + buf, slave->prop.scp_int1_mask, slave->first_interrupt_done); + if (slave->prop.scp_int1_mask & SDW_SCP_INT1_IMPL_DEF) { dev_dbg(&slave->dev, "Slave impl defined interrupt\n"); slave_notify = true; @@ -1594,7 +1610,10 @@ static int sdw_handle_slave_alerts(struct sdw_slave *slave) } /* at this point all initial interrupt sources were handled */ - slave->first_interrupt_done = true; + if (!slave->first_interrupt_done) { + slave->first_interrupt_done = true; + dev_dbg(&slave->dev, "first_interrupt_done set to true\n"); + } /* * Read status again to ensure no new interrupts arrived @@ -1650,6 +1669,8 @@ static int sdw_handle_slave_alerts(struct sdw_slave *slave) pm_runtime_mark_last_busy(&slave->dev); pm_runtime_put_autosuspend(&slave->dev); + dev_dbg(&slave->dev, "%s: done\n", __func__); + return ret; } @@ -1657,6 +1678,7 @@ static int sdw_update_slave_status(struct sdw_slave *slave, enum sdw_slave_status status) { unsigned long time; + int ret; if (!slave->probed) { /* @@ -1678,7 +1700,11 @@ static int sdw_update_slave_status(struct sdw_slave *slave, if (!slave->ops || !slave->ops->update_status) return 0; - return slave->ops->update_status(slave, status); + dev_dbg(&slave->dev, "update_status starting\n"); + ret = slave->ops->update_status(slave, status); + dev_dbg(&slave->dev, "update_status done\n"); + + return ret; } /** @@ -1748,6 +1774,12 @@ int sdw_handle_slave_status(struct sdw_bus *bus, break; case SDW_SLAVE_ALERT: + if (slave->status != SDW_SLAVE_ATTACHED) { + dev_err(&slave->dev, + "Slave %d reports alert but was not attached before\n", i); + break; + } + ret = sdw_handle_slave_alerts(slave); if (ret) dev_err(&slave->dev, @@ -1785,8 +1817,13 @@ int sdw_handle_slave_status(struct sdw_bus *bus, if (ret) dev_err(&slave->dev, "Update Slave status failed:%d\n", ret); - if (attached_initializing) + if (attached_initializing) { + dev_dbg(&slave->dev, + "%s: signaling initialization completion for Slave %d\n", + __func__, slave->dev_num); + complete(&slave->initialization_complete); + } } return ret; @@ -1814,6 +1851,7 @@ void sdw_clear_slave_status(struct sdw_bus *bus, u32 request) if (slave->status != SDW_SLAVE_UNATTACHED) { sdw_modify_slave_status(slave, SDW_SLAVE_UNATTACHED); slave->first_interrupt_done = false; + dev_dbg(&slave->dev, "first_interrupt_done set to false\n"); } /* keep track of request, used in pm_runtime resume */ diff --git a/drivers/soundwire/intel.c b/drivers/soundwire/intel.c index b664cae9be260f..1f804418529b16 100644 --- a/drivers/soundwire/intel.c +++ b/drivers/soundwire/intel.c @@ -1720,6 +1720,8 @@ static int __maybe_unused intel_resume(struct device *dev) return 0; } + dev_dbg(dev, "%s: start\n", __func__); + link_flags = md_flags >> (bus->link_id * 8); multi_link = !(link_flags & SDW_INTEL_MASTER_DISABLE_MULTI_LINK); @@ -1795,6 +1797,9 @@ static int __maybe_unused intel_resume(struct device *dev) */ pm_runtime_mark_last_busy(dev); + dev_dbg(dev, "%s: done\n", __func__); + + return ret; } @@ -1816,6 +1821,8 @@ static int intel_resume_runtime(struct device *dev) return 0; } + dev_dbg(dev, "%s: start\n", __func__); + link_flags = md_flags >> (bus->link_id * 8); multi_link = !(link_flags & SDW_INTEL_MASTER_DISABLE_MULTI_LINK); @@ -1968,6 +1975,8 @@ static int intel_resume_runtime(struct device *dev) ret = -EINVAL; } + dev_dbg(dev, "%s: done\n", __func__); + return ret; } diff --git a/drivers/soundwire/master.c b/drivers/soundwire/master.c index 9b05c9e25ebe48..7434888f1358bb 100644 --- a/drivers/soundwire/master.c +++ b/drivers/soundwire/master.c @@ -107,7 +107,36 @@ static void sdw_master_device_release(struct device *dev) kfree(md); } +static int __maybe_unused sdw_master_device_suspend(struct device *dev) +{ + dev_dbg(dev, "%s: start\n", __func__); + + dev_dbg(dev, "%s: done\n", __func__); + + return 0; +} + +static int __maybe_unused sdw_master_device_resume(struct device *dev) +{ + dev_dbg(dev, "%s: start\n", __func__); + + if (pm_runtime_suspended(dev)) { + dev_dbg(dev, "%s: pm_runtime status was suspended, forcing active\n", __func__); + + /* follow required sequence from runtime_pm.rst */ + pm_runtime_disable(dev); + pm_runtime_set_active(dev); + pm_runtime_mark_last_busy(dev); + pm_runtime_enable(dev); + } + + dev_dbg(dev, "%s: done\n", __func__); + + return 0; +} + static const struct dev_pm_ops master_dev_pm = { + SET_SYSTEM_SLEEP_PM_OPS(sdw_master_device_suspend, sdw_master_device_resume) SET_RUNTIME_PM_OPS(pm_generic_runtime_suspend, pm_generic_runtime_resume, NULL) }; diff --git a/sound/soc/codecs/max98373-sdw.c b/sound/soc/codecs/max98373-sdw.c index ad2d5d6a2fe413..990c4e657bf6d2 100644 --- a/sound/soc/codecs/max98373-sdw.c +++ b/sound/soc/codecs/max98373-sdw.c @@ -259,12 +259,22 @@ static __maybe_unused int max98373_resume(struct device *dev) struct max98373_priv *max98373 = dev_get_drvdata(dev); unsigned long time; - if (!max98373->hw_init) + dev_dbg(dev, "%s: start\n", __func__); + + if (!max98373->hw_init) { + dev_dbg(dev, "%s: done - hw_init not necessary\n", + __func__); return 0; + } if (!slave->unattach_request) goto regmap_sync; + + slave->unattach_request = 0; + + dev_dbg(dev, "%s: wait_for_completion start\n", __func__); + time = wait_for_completion_timeout(&slave->initialization_complete, msecs_to_jiffies(MAX98373_PROBE_TIMEOUT)); if (!time) { @@ -272,16 +282,46 @@ static __maybe_unused int max98373_resume(struct device *dev) return -ETIMEDOUT; } + dev_dbg(dev, "%s: wait_for_completion start\n", __func__); + regmap_sync: - slave->unattach_request = 0; + dev_dbg(dev, "%s: regmap_sync\n", __func__); + regcache_cache_only(max98373->regmap, false); regcache_sync(max98373->regmap); + pm_runtime_mark_last_busy(dev); + + dev_dbg(dev, "%s: done\n", __func__); + return 0; } +static __maybe_unused int max98373_system_resume(struct device *dev) +{ + int ret; + + dev_dbg(dev, "%s: start\n", __func__); + + if (pm_runtime_suspended(dev)) { + dev_dbg(dev, "%s: pm_runtime status was suspended, forcing active\n", __func__); + + /* follow required sequence from runtime_pm.rst */ + pm_runtime_disable(dev); + pm_runtime_set_active(dev); + pm_runtime_mark_last_busy(dev); + pm_runtime_enable(dev); + } + + ret = max98373_resume(dev); + + dev_dbg(dev, "%s: done\n", __func__); + + return ret; +} + static const struct dev_pm_ops max98373_pm = { - SET_SYSTEM_SLEEP_PM_OPS(max98373_suspend, max98373_resume) + SET_SYSTEM_SLEEP_PM_OPS(max98373_suspend, max98373_system_resume) SET_RUNTIME_PM_OPS(max98373_suspend, max98373_resume, NULL) }; @@ -294,6 +334,7 @@ static int max98373_read_prop(struct sdw_slave *slave) struct sdw_dpn_prop *dpn; prop->scp_int1_mask = SDW_SCP_INT1_BUS_CLASH | SDW_SCP_INT1_PARITY; + prop->quirks = SDW_SLAVE_QUIRKS_INVALID_INITIAL_PARITY; /* BITMAP: 00001000 Dataport 3 is active */ prop->source_ports = BIT(3); diff --git a/sound/soc/codecs/rt1308-sdw.c b/sound/soc/codecs/rt1308-sdw.c index afd2c3b687ccb0..767a6211a1da3b 100644 --- a/sound/soc/codecs/rt1308-sdw.c +++ b/sound/soc/codecs/rt1308-sdw.c @@ -715,6 +715,8 @@ static int __maybe_unused rt1308_dev_resume(struct device *dev) if (!slave->unattach_request) goto regmap_sync; + slave->unattach_request = 0; + time = wait_for_completion_timeout(&slave->initialization_complete, msecs_to_jiffies(RT1308_PROBE_TIMEOUT)); if (!time) { @@ -723,7 +725,6 @@ static int __maybe_unused rt1308_dev_resume(struct device *dev) } regmap_sync: - slave->unattach_request = 0; regcache_cache_only(rt1308->regmap, false); regcache_sync_region(rt1308->regmap, 0xc000, 0xcfff); diff --git a/sound/soc/codecs/rt1316-sdw.c b/sound/soc/codecs/rt1316-sdw.c index a68a2e11a7f0b5..219eec4a1b51e2 100644 --- a/sound/soc/codecs/rt1316-sdw.c +++ b/sound/soc/codecs/rt1316-sdw.c @@ -719,6 +719,8 @@ static int __maybe_unused rt1316_dev_resume(struct device *dev) if (!slave->unattach_request) goto regmap_sync; + slave->unattach_request = 0; + time = wait_for_completion_timeout(&slave->initialization_complete, msecs_to_jiffies(RT1316_PROBE_TIMEOUT)); if (!time) { @@ -727,7 +729,6 @@ static int __maybe_unused rt1316_dev_resume(struct device *dev) } regmap_sync: - slave->unattach_request = 0; regcache_cache_only(rt1316->regmap, false); regcache_sync(rt1316->regmap); diff --git a/sound/soc/codecs/rt5682-sdw.c b/sound/soc/codecs/rt5682-sdw.c index 35c9d2be9eeb3a..6baffcbf74ecf0 100644 --- a/sound/soc/codecs/rt5682-sdw.c +++ b/sound/soc/codecs/rt5682-sdw.c @@ -741,6 +741,8 @@ static int __maybe_unused rt5682_dev_resume(struct device *dev) if (!slave->unattach_request) goto regmap_sync; + slave->unattach_request = 0; + time = wait_for_completion_timeout(&slave->initialization_complete, msecs_to_jiffies(RT5682_PROBE_TIMEOUT)); if (!time) { @@ -749,7 +751,6 @@ static int __maybe_unused rt5682_dev_resume(struct device *dev) } regmap_sync: - slave->unattach_request = 0; regcache_cache_only(rt5682->regmap, false); regcache_sync(rt5682->regmap); diff --git a/sound/soc/codecs/rt700-sdw.c b/sound/soc/codecs/rt700-sdw.c index 4001612dfd7378..ac0e68e9aff672 100644 --- a/sound/soc/codecs/rt700-sdw.c +++ b/sound/soc/codecs/rt700-sdw.c @@ -504,6 +504,8 @@ static int __maybe_unused rt700_dev_resume(struct device *dev) if (!slave->unattach_request) goto regmap_sync; + slave->unattach_request = 0; + time = wait_for_completion_timeout(&slave->initialization_complete, msecs_to_jiffies(RT700_PROBE_TIMEOUT)); if (!time) { @@ -512,7 +514,6 @@ static int __maybe_unused rt700_dev_resume(struct device *dev) } regmap_sync: - slave->unattach_request = 0; regcache_cache_only(rt700->regmap, false); regcache_sync_region(rt700->regmap, 0x3000, 0x8fff); regcache_sync_region(rt700->regmap, 0x752010, 0x75206b); diff --git a/sound/soc/codecs/rt711-sdca-sdw.c b/sound/soc/codecs/rt711-sdca-sdw.c index 0603ebb00ab731..872793f5c1c485 100644 --- a/sound/soc/codecs/rt711-sdca-sdw.c +++ b/sound/soc/codecs/rt711-sdca-sdw.c @@ -9,6 +9,7 @@ #include #include #include +#include #include #include @@ -381,12 +382,85 @@ static int __maybe_unused rt711_sdca_dev_resume(struct device *dev) struct rt711_sdca_priv *rt711 = dev_get_drvdata(dev); unsigned long time; - if (!rt711->hw_init) + dev_dbg(&slave->dev, "%s: start\n", __func__); + + if (pm_runtime_suspended(dev)) { + dev_dbg(dev, "%s: pm_runtime status was suspended, forcing active\n", __func__); + + /* follow required sequence from runtime_pm.rst */ + pm_runtime_disable(dev); + pm_runtime_set_active(dev); + pm_runtime_mark_last_busy(dev); + pm_runtime_enable(dev); + } + + if (!rt711->hw_init) { + dev_dbg(&slave->dev, "%s: done - hw_init not necessary\n", + __func__); + return 0; + } + + if (!slave->unattach_request) + goto regmap_sync; + + slave->unattach_request = 0; + + dev_dbg(&slave->dev, "%s: wait_for_completion start\n", __func__); + + time = wait_for_completion_timeout(&slave->initialization_complete, + msecs_to_jiffies(RT711_PROBE_TIMEOUT)); + if (!time) { + dev_err(&slave->dev, "Initialization not complete, timed out\n"); + return -ETIMEDOUT; + } + + dev_dbg(&slave->dev, "%s: wait_for_completion done\n", __func__); + +regmap_sync: + dev_dbg(&slave->dev, "%s: regmap_sync\n", __func__); + + regcache_cache_only(rt711->regmap, false); + regcache_sync(rt711->regmap); + regcache_cache_only(rt711->mbq_regmap, false); + regcache_sync(rt711->mbq_regmap); + + pm_runtime_mark_last_busy(dev); + + dev_dbg(&slave->dev, "%s: done\n", __func__); + + return 0; +} + +static int __maybe_unused rt711_sdca_dev_suspend_runtime(struct device *dev) +{ + int ret; + + dev_dbg(dev, "%s: start\n", __func__); + ret = rt711_sdca_dev_suspend(dev); + dev_dbg(dev, "%s: done\n", __func__); + + return ret; +} + +static int __maybe_unused rt711_sdca_dev_resume_runtime(struct device *dev) +{ + struct sdw_slave *slave = dev_to_sdw_dev(dev); + struct rt711_sdca_priv *rt711 = dev_get_drvdata(dev); + unsigned long time; + + dev_dbg(&slave->dev, "%s: start\n", __func__); + + if (!rt711->hw_init) { + dev_dbg(&slave->dev, "%s: done - hw_init not necessary\n", + __func__); return 0; + } if (!slave->unattach_request) goto regmap_sync; + dev_dbg(&slave->dev, "%s: wait_for_completion start\n", __func__); + time = wait_for_completion_timeout(&slave->initialization_complete, msecs_to_jiffies(RT711_PROBE_TIMEOUT)); if (!time) { @@ -394,18 +468,26 @@ static int __maybe_unused rt711_sdca_dev_resume(struct device *dev) return -ETIMEDOUT; } + dev_dbg(&slave->dev, "%s: wait_for_completion done\n", __func__); + regmap_sync: + dev_dbg(&slave->dev, "%s: regmap_sync\n", __func__); slave->unattach_request = 0; regcache_cache_only(rt711->regmap, false); regcache_sync(rt711->regmap); regcache_cache_only(rt711->mbq_regmap, false); regcache_sync(rt711->mbq_regmap); + + pm_runtime_mark_last_busy(dev); + + dev_dbg(&slave->dev, "%s: done\n", __func__); + return 0; } static const struct dev_pm_ops rt711_sdca_pm = { SET_SYSTEM_SLEEP_PM_OPS(rt711_sdca_dev_suspend, rt711_sdca_dev_resume) - SET_RUNTIME_PM_OPS(rt711_sdca_dev_suspend, rt711_sdca_dev_resume, NULL) + SET_RUNTIME_PM_OPS(rt711_sdca_dev_suspend_runtime, rt711_sdca_dev_resume_runtime, NULL) }; static struct sdw_driver rt711_sdca_sdw_driver = { diff --git a/sound/soc/codecs/rt711-sdw.c b/sound/soc/codecs/rt711-sdw.c index 2beb4286d997bf..a78dc972f2423d 100644 --- a/sound/soc/codecs/rt711-sdw.c +++ b/sound/soc/codecs/rt711-sdw.c @@ -9,6 +9,7 @@ #include #include #include +#include #include #include #include @@ -501,12 +502,84 @@ static int __maybe_unused rt711_dev_resume(struct device *dev) struct rt711_priv *rt711 = dev_get_drvdata(dev); unsigned long time; - if (!rt711->hw_init) + dev_dbg(&slave->dev, "%s: start\n", __func__); + + if (pm_runtime_suspended(dev)) { + dev_dbg(dev, "%s: pm_runtime status was suspended, forcing active\n", __func__); + + /* follow required sequence from runtime_pm.rst */ + pm_runtime_disable(dev); + pm_runtime_set_active(dev); + pm_runtime_mark_last_busy(dev); + pm_runtime_enable(dev); + } + + if (!rt711->hw_init) { + dev_dbg(&slave->dev, "%s: done - hw_init not necessary\n", + __func__); + return 0; + } + + if (!slave->unattach_request) + goto regmap_sync; + + slave->unattach_request = 0; + + dev_dbg(&slave->dev, "%s: wait_for_completion start\n", __func__); + + time = wait_for_completion_timeout(&slave->initialization_complete, + msecs_to_jiffies(RT711_PROBE_TIMEOUT)); + if (!time) { + dev_err(&slave->dev, "Initialization not complete, timed out\n"); + return -ETIMEDOUT; + } + + dev_dbg(&slave->dev, "%s: wait_for_completion done\n", __func__); + +regmap_sync: + dev_dbg(&slave->dev, "%s: regmap_sync\n", __func__); + + regcache_cache_only(rt711->regmap, false); + regcache_sync_region(rt711->regmap, 0x3000, 0x8fff); + regcache_sync_region(rt711->regmap, 0x752009, 0x752091); + + pm_runtime_mark_last_busy(dev); + + dev_dbg(&slave->dev, "%s: done\n", __func__); + + return 0; +} + +static int __maybe_unused rt711_dev_suspend_runtime(struct device *dev) +{ + int ret; + + dev_dbg(dev, "%s: start\n", __func__); + ret = rt711_dev_suspend(dev); + dev_dbg(dev, "%s: done\n", __func__); + + return ret; +} + +static int __maybe_unused rt711_dev_resume_runtime(struct device *dev) +{ + struct sdw_slave *slave = dev_to_sdw_dev(dev); + struct rt711_priv *rt711 = dev_get_drvdata(dev); + unsigned long time; + + dev_dbg(&slave->dev, "%s: start\n", __func__); + + if (!rt711->hw_init) { + dev_dbg(&slave->dev, "%s: done - hw_init not necessary\n", + __func__); return 0; + } if (!slave->unattach_request) goto regmap_sync; + dev_dbg(&slave->dev, "%s: wait_for_completion start\n", __func__); + time = wait_for_completion_timeout(&slave->initialization_complete, msecs_to_jiffies(RT711_PROBE_TIMEOUT)); if (!time) { @@ -514,18 +587,26 @@ static int __maybe_unused rt711_dev_resume(struct device *dev) return -ETIMEDOUT; } + dev_dbg(&slave->dev, "%s: wait_for_completion done\n", __func__); + regmap_sync: + dev_dbg(&slave->dev, "%s: regmap_sync\n", __func__); + slave->unattach_request = 0; regcache_cache_only(rt711->regmap, false); regcache_sync_region(rt711->regmap, 0x3000, 0x8fff); regcache_sync_region(rt711->regmap, 0x752009, 0x752091); + pm_runtime_mark_last_busy(dev); + + dev_dbg(&slave->dev, "%s: done\n", __func__); + return 0; } static const struct dev_pm_ops rt711_pm = { SET_SYSTEM_SLEEP_PM_OPS(rt711_dev_suspend, rt711_dev_resume) - SET_RUNTIME_PM_OPS(rt711_dev_suspend, rt711_dev_resume, NULL) + SET_RUNTIME_PM_OPS(rt711_dev_suspend_runtime, rt711_dev_resume_runtime, NULL) }; static struct sdw_driver rt711_sdw_driver = { diff --git a/sound/soc/codecs/rt711.c b/sound/soc/codecs/rt711.c index 5771c02c34596f..0ef61a0d054ea0 100644 --- a/sound/soc/codecs/rt711.c +++ b/sound/soc/codecs/rt711.c @@ -544,9 +544,12 @@ static int rt711_set_amp_gain_put(struct snd_kcontrol *kcontrol, break; } + mutex_lock(&rt711->calibrate_mutex); if (dapm->bias_level <= SND_SOC_BIAS_STANDBY) regmap_write(rt711->regmap, RT711_SET_AUDIO_POWER_STATE, AC_PWRST_D3); + mutex_unlock(&rt711->calibrate_mutex); + return 0; } diff --git a/sound/soc/codecs/rt715-sdca-sdw.c b/sound/soc/codecs/rt715-sdca-sdw.c index bcced85876b05a..3c3bd3cbcc6ef7 100644 --- a/sound/soc/codecs/rt715-sdca-sdw.c +++ b/sound/soc/codecs/rt715-sdca-sdw.c @@ -230,6 +230,8 @@ static int __maybe_unused rt715_dev_resume(struct device *dev) if (!slave->unattach_request) goto regmap_sync; + slave->unattach_request = 0; + time = wait_for_completion_timeout(&slave->enumeration_complete, msecs_to_jiffies(RT715_PROBE_TIMEOUT)); if (!time) { @@ -238,7 +240,6 @@ static int __maybe_unused rt715_dev_resume(struct device *dev) } regmap_sync: - slave->unattach_request = 0; regcache_cache_only(rt715->regmap, false); regcache_sync_region(rt715->regmap, SDW_SDCA_CTL(FUN_JACK_CODEC, RT715_SDCA_ST_EN, RT715_SDCA_ST_CTRL, diff --git a/sound/soc/codecs/rt715-sdw.c b/sound/soc/codecs/rt715-sdw.c index 71dd3b97a45904..798c95b0872f3e 100644 --- a/sound/soc/codecs/rt715-sdw.c +++ b/sound/soc/codecs/rt715-sdw.c @@ -547,6 +547,8 @@ static int __maybe_unused rt715_dev_resume(struct device *dev) if (!slave->unattach_request) goto regmap_sync; + slave->unattach_request = 0; + time = wait_for_completion_timeout(&slave->initialization_complete, msecs_to_jiffies(RT715_PROBE_TIMEOUT)); if (!time) { @@ -555,7 +557,6 @@ static int __maybe_unused rt715_dev_resume(struct device *dev) } regmap_sync: - slave->unattach_request = 0; regcache_cache_only(rt715->regmap, false); regcache_sync_region(rt715->regmap, 0x3000, 0x8fff); regcache_sync_region(rt715->regmap, 0x752039, 0x752039);