Skip to content

Commit 92806b6

Browse files
committed
Revert "ASoC: rt1320: wait codec init in hw_params"
This reverts commit 2334b9b. 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 1d72380 commit 92806b6

1 file changed

Lines changed: 10 additions & 22 deletions

File tree

sound/soc/codecs/rt1320-sdw.c

Lines changed: 10 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -774,7 +774,6 @@ static int rt1320_update_status(struct sdw_slave *slave,
774774
enum sdw_slave_status status)
775775
{
776776
struct rt1320_sdw_priv *rt1320 = dev_get_drvdata(&slave->dev);
777-
int ret;
778777

779778
if (status == SDW_SLAVE_UNATTACHED)
780779
rt1320->hw_init = false;
@@ -787,20 +786,7 @@ static int rt1320_update_status(struct sdw_slave *slave,
787786
return 0;
788787

789788
/* perform I/O transfers required for Slave initialization */
790-
ret = rt1320_io_init(&slave->dev, slave);
791-
if (ret < 0) {
792-
dev_err(&slave->dev, "IO init failed: %d\n", ret);
793-
return ret;
794-
}
795-
796-
if (slave->unattach_request) {
797-
regcache_cache_only(rt1320->regmap, false);
798-
regcache_sync(rt1320->regmap);
799-
regcache_cache_only(rt1320->mbq_regmap, false);
800-
regcache_sync(rt1320->mbq_regmap);
801-
}
802-
803-
return ret;
789+
return rt1320_io_init(&slave->dev, slave);
804790
}
805791

806792
static int rt1320_pde11_event(struct snd_soc_dapm_widget *w,
@@ -1197,8 +1183,6 @@ static void rt1320_sdw_shutdown(struct snd_pcm_substream *substream,
11971183
snd_soc_dai_set_dma_data(dai, substream, NULL);
11981184
}
11991185

1200-
#define RT1320_PROBE_TIMEOUT 5000
1201-
12021186
static int rt1320_sdw_hw_params(struct snd_pcm_substream *substream,
12031187
struct snd_pcm_hw_params *params, struct snd_soc_dai *dai)
12041188
{
@@ -1241,10 +1225,6 @@ static int rt1320_sdw_hw_params(struct snd_pcm_substream *substream,
12411225
return -EINVAL;
12421226
}
12431227

1244-
retval = sdw_slave_wait_for_initialization(rt1320->sdw_slave, RT1320_PROBE_TIMEOUT);
1245-
if (retval < 0)
1246-
return retval;
1247-
12481228
if (dai->id == RT1320_AIF1)
12491229
retval = sdw_stream_add_slave(rt1320->sdw_slave, &stream_config,
12501230
&port_config, 1, sdw_stream);
@@ -1505,18 +1485,26 @@ static int rt1320_dev_suspend(struct device *dev)
15051485
return 0;
15061486
}
15071487

1488+
#define RT1320_PROBE_TIMEOUT 5000
1489+
15081490
static int rt1320_dev_resume(struct device *dev)
15091491
{
15101492
struct sdw_slave *slave = dev_to_sdw_dev(dev);
15111493
struct rt1320_sdw_priv *rt1320 = dev_get_drvdata(dev);
1494+
unsigned long time;
15121495

15131496
if (!rt1320->first_hw_init)
15141497
return 0;
15151498

15161499
if (!slave->unattach_request)
15171500
goto regmap_sync;
15181501

1519-
return 0;
1502+
time = wait_for_completion_timeout(&slave->initialization_complete,
1503+
msecs_to_jiffies(RT1320_PROBE_TIMEOUT));
1504+
if (!time) {
1505+
dev_err(&slave->dev, "%s: Initialization not complete, timed out\n", __func__);
1506+
return -ETIMEDOUT;
1507+
}
15201508

15211509
regmap_sync:
15221510
slave->unattach_request = 0;

0 commit comments

Comments
 (0)