Skip to content

Commit 1d72380

Browse files
committed
Revert "ASoC: rt721: wait codec init in hw_params"
This reverts commit bf9d692. We should ensure the device is fully operational when it is resumed. Signed-off-by: Bard Liao <yung-chuan.liao@linux.intel.com>
1 parent ead98f0 commit 1d72380

2 files changed

Lines changed: 13 additions & 22 deletions

File tree

sound/soc/codecs/rt721-sdca-sdw.c

Lines changed: 13 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,6 @@ static int rt721_sdca_update_status(struct sdw_slave *slave,
190190
enum sdw_slave_status status)
191191
{
192192
struct rt721_sdca_priv *rt721 = dev_get_drvdata(&slave->dev);
193-
int ret;
194193

195194
if (status == SDW_SLAVE_UNATTACHED)
196195
rt721->hw_init = false;
@@ -218,20 +217,7 @@ static int rt721_sdca_update_status(struct sdw_slave *slave,
218217
return 0;
219218

220219
/* perform I/O transfers required for Slave initialization */
221-
ret = rt721_sdca_io_init(&slave->dev, slave);
222-
if (ret < 0) {
223-
dev_err(&slave->dev, "IO init failed: %d\n", ret);
224-
return ret;
225-
}
226-
227-
if (slave->unattach_request) {
228-
regcache_cache_only(rt721->regmap, false);
229-
regcache_sync(rt721->regmap);
230-
regcache_cache_only(rt721->mbq_regmap, false);
231-
regcache_sync(rt721->mbq_regmap);
232-
}
233-
234-
return ret;
220+
return rt721_sdca_io_init(&slave->dev, slave);
235221
}
236222

237223
static int rt721_sdca_read_prop(struct sdw_slave *slave)
@@ -497,10 +483,13 @@ static int rt721_sdca_dev_system_suspend(struct device *dev)
497483
return rt721_sdca_dev_suspend(dev);
498484
}
499485

486+
#define RT721_PROBE_TIMEOUT 5000
487+
500488
static int rt721_sdca_dev_resume(struct device *dev)
501489
{
502490
struct sdw_slave *slave = dev_to_sdw_dev(dev);
503491
struct rt721_sdca_priv *rt721 = dev_get_drvdata(dev);
492+
unsigned long time;
504493

505494
if (!rt721->first_hw_init)
506495
return 0;
@@ -515,7 +504,15 @@ static int rt721_sdca_dev_resume(struct device *dev)
515504
mutex_unlock(&rt721->disable_irq_lock);
516505
goto regmap_sync;
517506
}
518-
return 0;
507+
508+
time = wait_for_completion_timeout(&slave->initialization_complete,
509+
msecs_to_jiffies(RT721_PROBE_TIMEOUT));
510+
if (!time) {
511+
dev_err(&slave->dev, "Initialization not complete, timed out\n");
512+
sdw_show_ping_status(slave->bus, true);
513+
514+
return -ETIMEDOUT;
515+
}
519516

520517
regmap_sync:
521518
slave->unattach_request = 0;

sound/soc/codecs/rt721-sdca.c

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1261,8 +1261,6 @@ static void rt721_sdca_shutdown(struct snd_pcm_substream *substream,
12611261
snd_soc_dai_set_dma_data(dai, substream, NULL);
12621262
}
12631263

1264-
#define RT721_PROBE_TIMEOUT 5000
1265-
12661264
static int rt721_sdca_pcm_hw_params(struct snd_pcm_substream *substream,
12671265
struct snd_pcm_hw_params *params,
12681266
struct snd_soc_dai *dai)
@@ -1317,10 +1315,6 @@ static int rt721_sdca_pcm_hw_params(struct snd_pcm_substream *substream,
13171315
port_config.ch_mask = GENMASK(num_channels - 1, 0);
13181316
port_config.num = port;
13191317

1320-
retval = sdw_slave_wait_for_initialization(rt721->slave, RT721_PROBE_TIMEOUT);
1321-
if (retval < 0)
1322-
return retval;
1323-
13241318
retval = sdw_stream_add_slave(rt721->slave, &stream_config,
13251319
&port_config, 1, sdw_stream);
13261320
if (retval) {

0 commit comments

Comments
 (0)