mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
To: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>, broonie@kernel.org
Cc: alsa-devel@alsa-project.org, lgirdwood@gmail.com, perex@perex.cz,
	tiwai@suse.com, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 1/2] ASoC: codecs: wsa881x: handle timeouts in resume path
Date: Thu, 30 Jun 2022 08:09:39 -0500	[thread overview]
Message-ID: <aee14e9b-9d5f-f243-5834-88d18b4a65db@linux.intel.com> (raw)
In-Reply-To: <20220630130023.9308-1-srinivas.kandagatla@linaro.org>



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@linux.intel.com>
> Fixes: 8dd552458361 ("ASoC: codecs: wsa881x: add runtime pm support")
> Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>

For the two patches

Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.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);

  parent reply	other threads:[~2022-06-30 13:47 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-30 13:00 Srinivas Kandagatla
2022-06-30 13:00 ` [PATCH 2/2] ASoC: codecs: wsa883x: " Srinivas Kandagatla
2022-06-30 13:09 ` Pierre-Louis Bossart [this message]
2022-06-30 16:55 ` [PATCH 1/2] ASoC: codecs: wsa881x: " Mark Brown

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=aee14e9b-9d5f-f243-5834-88d18b4a65db@linux.intel.com \
    --to=pierre-louis.bossart@linux.intel.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=broonie@kernel.org \
    --cc=lgirdwood@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=perex@perex.cz \
    --cc=srinivas.kandagatla@linaro.org \
    --cc=tiwai@suse.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®