[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <aee14e9b-9d5f-f243-5834-88d18b4a65db@linux.intel.com>
Date: Thu, 30 Jun 2022 08:09:39 -0500
From: Pierre-Louis Bossart <pierre-louis.bossart@...ux.intel.com>
To: Srinivas Kandagatla <srinivas.kandagatla@...aro.org>,
broonie@...nel.org
Cc: alsa-devel@...a-project.org, lgirdwood@...il.com, perex@...ex.cz,
tiwai@...e.com, linux-kernel@...r.kernel.org
Subject: Re: [PATCH 1/2] ASoC: codecs: wsa881x: handle timeouts in resume path
On 6/30/22 08:00, Srinivas Kandagatla wrote:
> 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: Pierre-Louis Bossart <pierre-louis.bossart@...ux.intel.com>
> Fixes: 8dd552458361 ("ASoC: codecs: wsa881x: add runtime pm support")
> Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@...aro.org>
For the two patches
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@...ux.intel.com>
> ---
> sound/soc/codecs/wsa881x.c | 10 ++++++++--
> 1 file changed, 8 insertions(+), 2 deletions(-)
>
> diff --git a/sound/soc/codecs/wsa881x.c b/sound/soc/codecs/wsa881x.c
> index dc954b85a988..6c8b1db649b8 100644
> --- a/sound/soc/codecs/wsa881x.c
> +++ b/sound/soc/codecs/wsa881x.c
> @@ -1173,11 +1173,17 @@ static int __maybe_unused wsa881x_runtime_resume(struct device *dev)
> struct sdw_slave *slave = dev_to_sdw_dev(dev);
> struct regmap *regmap = dev_get_regmap(dev, NULL);
> struct wsa881x_priv *wsa881x = dev_get_drvdata(dev);
> + unsigned long time;
>
> gpiod_direction_output(wsa881x->sd_n, 1);
>
> - wait_for_completion_timeout(&slave->initialization_complete,
> - msecs_to_jiffies(WSA881X_PROBE_TIMEOUT));
> + time = wait_for_completion_timeout(&slave->initialization_complete,
> + 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_sync(regmap);
Powered by blists - more mailing lists