Commit cf6af24b authored by Srinivas Kandagatla's avatar Srinivas Kandagatla Committed by Mark Brown

ASoC: codecs: wsa881x: handle timeouts in resume path

Currently we do not check if SoundWire slave initialization timeout
expired before continuing to access its registers.

Its possible that the registers are not accessible if timeout is
expired. Handle this by returning timeout in resume path.
Reported-by: default avatarPierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Fixes: 8dd55245 ("ASoC: codecs: wsa881x: add runtime pm support")
Signed-off-by: default avatarSrinivas Kandagatla <srinivas.kandagatla@linaro.org>
Reviewed-by: default avatarPierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20220630130023.9308-1-srinivas.kandagatla@linaro.orgSigned-off-by: default avatarMark Brown <broonie@kernel.org>
parent f3762ddf
...@@ -1173,11 +1173,17 @@ static int __maybe_unused wsa881x_runtime_resume(struct device *dev) ...@@ -1173,11 +1173,17 @@ static int __maybe_unused wsa881x_runtime_resume(struct device *dev)
struct sdw_slave *slave = dev_to_sdw_dev(dev); struct sdw_slave *slave = dev_to_sdw_dev(dev);
struct regmap *regmap = dev_get_regmap(dev, NULL); struct regmap *regmap = dev_get_regmap(dev, NULL);
struct wsa881x_priv *wsa881x = dev_get_drvdata(dev); struct wsa881x_priv *wsa881x = dev_get_drvdata(dev);
unsigned long time;
gpiod_direction_output(wsa881x->sd_n, 1); gpiod_direction_output(wsa881x->sd_n, 1);
wait_for_completion_timeout(&slave->initialization_complete, time = wait_for_completion_timeout(&slave->initialization_complete,
msecs_to_jiffies(WSA881X_PROBE_TIMEOUT)); msecs_to_jiffies(WSA881X_PROBE_TIMEOUT));
if (!time) {
dev_err(dev, "Initialization not complete, timed out\n");
gpiod_direction_output(wsa881x->sd_n, 0);
return -ETIMEDOUT;
}
regcache_cache_only(regmap, false); regcache_cache_only(regmap, false);
regcache_sync(regmap); regcache_sync(regmap);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment