Skip to content

Commit 961f16c

Browse files
committed
ASoC: rt71320: don't wait codec init in resume
Move regmap sync to rt1320_update_status() when unattach_request is set, and only do regmap sync in resume when no reattach needed. The change can shorten the resume time. Signed-off-by: Bard Liao <yung-chuan.liao@linux.intel.com>
1 parent 6b11212 commit 961f16c

File tree

1 file changed

+12
-8
lines changed

1 file changed

+12
-8
lines changed

sound/soc/codecs/rt1320-sdw.c

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -759,6 +759,7 @@ static int rt1320_update_status(struct sdw_slave *slave,
759759
enum sdw_slave_status status)
760760
{
761761
struct rt1320_sdw_priv *rt1320 = dev_get_drvdata(&slave->dev);
762+
int ret;
762763

763764
if (status == SDW_SLAVE_UNATTACHED)
764765
rt1320->hw_init = false;
@@ -771,7 +772,16 @@ static int rt1320_update_status(struct sdw_slave *slave,
771772
return 0;
772773

773774
/* perform I/O transfers required for Slave initialization */
774-
return rt1320_io_init(&slave->dev, slave);
775+
ret = rt1320_io_init(&slave->dev, slave);
776+
777+
if (slave->unattach_request) {
778+
regcache_cache_only(rt1320->regmap, false);
779+
regcache_sync(rt1320->regmap);
780+
regcache_cache_only(rt1320->mbq_regmap, false);
781+
regcache_sync(rt1320->mbq_regmap);
782+
}
783+
784+
return ret;
775785
}
776786

777787
static int rt1320_pde11_event(struct snd_soc_dapm_widget *w,
@@ -1476,20 +1486,14 @@ static int rt1320_dev_resume(struct device *dev)
14761486
{
14771487
struct sdw_slave *slave = dev_to_sdw_dev(dev);
14781488
struct rt1320_sdw_priv *rt1320 = dev_get_drvdata(dev);
1479-
unsigned long time;
14801489

14811490
if (!rt1320->first_hw_init)
14821491
return 0;
14831492

14841493
if (!slave->unattach_request)
14851494
goto regmap_sync;
14861495

1487-
time = wait_for_completion_timeout(&slave->initialization_complete,
1488-
msecs_to_jiffies(RT1320_PROBE_TIMEOUT));
1489-
if (!time) {
1490-
dev_err(&slave->dev, "%s: Initialization not complete, timed out\n", __func__);
1491-
return -ETIMEDOUT;
1492-
}
1496+
return 0;
14931497

14941498
regmap_sync:
14951499
slave->unattach_request = 0;

0 commit comments

Comments
 (0)