Skip to content

Commit 8e123fc

Browse files
committed
Revert "ASoC: rt722: wait codec init in hw_params"
This reverts commit 8cec2a5. 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 fefa736 commit 8e123fc

2 files changed

Lines changed: 12 additions & 20 deletions

File tree

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

Lines changed: 12 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,6 @@ static int rt722_sdca_update_status(struct sdw_slave *slave,
209209
enum sdw_slave_status status)
210210
{
211211
struct rt722_sdca_priv *rt722 = dev_get_drvdata(&slave->dev);
212-
int ret;
213212

214213
if (status == SDW_SLAVE_UNATTACHED)
215214
rt722->hw_init = false;
@@ -237,18 +236,7 @@ static int rt722_sdca_update_status(struct sdw_slave *slave,
237236
return 0;
238237

239238
/* perform I/O transfers required for Slave initialization */
240-
ret = rt722_sdca_io_init(&slave->dev, slave);
241-
if (ret < 0) {
242-
dev_err(&slave->dev, "IO init failed: %d\n", ret);
243-
return ret;
244-
}
245-
246-
if (slave->unattach_request) {
247-
regcache_cache_only(rt722->regmap, false);
248-
regcache_sync(rt722->regmap);
249-
}
250-
251-
return ret;
239+
return rt722_sdca_io_init(&slave->dev, slave);
252240
}
253241

254242
static int rt722_sdca_read_prop(struct sdw_slave *slave)
@@ -507,10 +495,13 @@ static int rt722_sdca_dev_system_suspend(struct device *dev)
507495
return rt722_sdca_dev_suspend(dev);
508496
}
509497

498+
#define RT722_PROBE_TIMEOUT 5000
499+
510500
static int rt722_sdca_dev_resume(struct device *dev)
511501
{
512502
struct sdw_slave *slave = dev_to_sdw_dev(dev);
513503
struct rt722_sdca_priv *rt722 = dev_get_drvdata(dev);
504+
unsigned long time;
514505

515506
if (!rt722->first_hw_init)
516507
return 0;
@@ -526,7 +517,14 @@ static int rt722_sdca_dev_resume(struct device *dev)
526517
goto regmap_sync;
527518
}
528519

529-
return 0;
520+
time = wait_for_completion_timeout(&slave->initialization_complete,
521+
msecs_to_jiffies(RT722_PROBE_TIMEOUT));
522+
if (!time) {
523+
dev_err(&slave->dev, "Initialization not complete, timed out\n");
524+
sdw_show_ping_status(slave->bus, true);
525+
526+
return -ETIMEDOUT;
527+
}
530528

531529
regmap_sync:
532530
slave->unattach_request = 0;

sound/soc/codecs/rt722-sdca.c

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1114,8 +1114,6 @@ static void rt722_sdca_shutdown(struct snd_pcm_substream *substream,
11141114
snd_soc_dai_set_dma_data(dai, substream, NULL);
11151115
}
11161116

1117-
#define RT722_PROBE_TIMEOUT 5000
1118-
11191117
static int rt722_sdca_pcm_hw_params(struct snd_pcm_substream *substream,
11201118
struct snd_pcm_hw_params *params,
11211119
struct snd_soc_dai *dai)
@@ -1170,10 +1168,6 @@ static int rt722_sdca_pcm_hw_params(struct snd_pcm_substream *substream,
11701168
port_config.ch_mask = GENMASK(num_channels - 1, 0);
11711169
port_config.num = port;
11721170

1173-
retval = sdw_slave_wait_for_initialization(rt722->slave, RT722_PROBE_TIMEOUT);
1174-
if (retval < 0)
1175-
return retval;
1176-
11771171
retval = sdw_stream_add_slave(rt722->slave, &stream_config,
11781172
&port_config, 1, sdw_stream);
11791173
if (retval) {

0 commit comments

Comments
 (0)