* [PATCH 1/2] ASoC: codecs: wsa881x: handle timeouts in resume path
@ 2022-06-30 13:00 Srinivas Kandagatla
2022-06-30 13:00 ` [PATCH 2/2] ASoC: codecs: wsa883x: " Srinivas Kandagatla
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Srinivas Kandagatla @ 2022-06-30 13:00 UTC (permalink / raw)
To: broonie
Cc: alsa-devel, lgirdwood, perex, tiwai, linux-kernel,
Srinivas Kandagatla, Pierre-Louis Bossart
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>
---
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);
--
2.25.1
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH 2/2] ASoC: codecs: wsa883x: handle timeouts in resume path
2022-06-30 13:00 [PATCH 1/2] ASoC: codecs: wsa881x: handle timeouts in resume path Srinivas Kandagatla
@ 2022-06-30 13:00 ` Srinivas Kandagatla
2022-06-30 13:09 ` [PATCH 1/2] ASoC: codecs: wsa881x: " Pierre-Louis Bossart
2022-06-30 16:55 ` Mark Brown
2 siblings, 0 replies; 4+ messages in thread
From: Srinivas Kandagatla @ 2022-06-30 13:00 UTC (permalink / raw)
To: broonie
Cc: alsa-devel, lgirdwood, perex, tiwai, linux-kernel,
Srinivas Kandagatla, Pierre-Louis Bossart
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: 43b8c7dc85a1 ("ASoC: codecs: add wsa883x amplifier support")
Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
---
sound/soc/codecs/wsa883x.c | 11 +++++++++--
1 file changed, 9 insertions(+), 2 deletions(-)
diff --git a/sound/soc/codecs/wsa883x.c b/sound/soc/codecs/wsa883x.c
index e8f519e89213..40c7d64a9c41 100644
--- a/sound/soc/codecs/wsa883x.c
+++ b/sound/soc/codecs/wsa883x.c
@@ -1455,6 +1455,7 @@ static int __maybe_unused wsa883x_runtime_resume(struct device *dev)
struct sdw_slave *slave = dev_to_sdw_dev(dev);
struct regmap *regmap = dev_get_regmap(dev, NULL);
struct wsa883x_priv *wsa883x = dev_get_drvdata(dev);
+ unsigned long time;
int ret;
ret = regulator_enable(wsa883x->vdd);
@@ -1465,8 +1466,14 @@ static int __maybe_unused wsa883x_runtime_resume(struct device *dev)
gpiod_direction_output(wsa883x->sd_n, 1);
- wait_for_completion_timeout(&slave->initialization_complete,
- msecs_to_jiffies(WSA883X_PROBE_TIMEOUT));
+ time = wait_for_completion_timeout(&slave->initialization_complete,
+ msecs_to_jiffies(WSA883X_PROBE_TIMEOUT));
+ if (!time) {
+ dev_err(dev, "Initialization not complete, timed out\n");
+ gpiod_direction_output(wsa883x->sd_n, 0);
+ regulator_disable(wsa883x->vdd);
+ return -ETIMEDOUT;
+ }
usleep_range(20000, 20010);
regcache_cache_only(regmap, false);
--
2.25.1
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH 1/2] ASoC: codecs: wsa881x: handle timeouts in resume path
2022-06-30 13:00 [PATCH 1/2] ASoC: codecs: wsa881x: handle timeouts in resume path Srinivas Kandagatla
2022-06-30 13:00 ` [PATCH 2/2] ASoC: codecs: wsa883x: " Srinivas Kandagatla
@ 2022-06-30 13:09 ` Pierre-Louis Bossart
2022-06-30 16:55 ` Mark Brown
2 siblings, 0 replies; 4+ messages in thread
From: Pierre-Louis Bossart @ 2022-06-30 13:09 UTC (permalink / raw)
To: Srinivas Kandagatla, broonie
Cc: alsa-devel, lgirdwood, perex, tiwai, linux-kernel
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);
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH 1/2] ASoC: codecs: wsa881x: handle timeouts in resume path
2022-06-30 13:00 [PATCH 1/2] ASoC: codecs: wsa881x: handle timeouts in resume path Srinivas Kandagatla
2022-06-30 13:00 ` [PATCH 2/2] ASoC: codecs: wsa883x: " Srinivas Kandagatla
2022-06-30 13:09 ` [PATCH 1/2] ASoC: codecs: wsa881x: " Pierre-Louis Bossart
@ 2022-06-30 16:55 ` Mark Brown
2 siblings, 0 replies; 4+ messages in thread
From: Mark Brown @ 2022-06-30 16:55 UTC (permalink / raw)
To: srinivas.kandagatla
Cc: perex, linux-kernel, tiwai, alsa-devel, lgirdwood, pierre-louis.bossart
On Thu, 30 Jun 2022 14:00:22 +0100, 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.
>
>
> [...]
Applied to
https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-next
Thanks!
[1/2] ASoC: codecs: wsa881x: handle timeouts in resume path
commit: cf6af24b54903f9f70c29b3e5b19cb72cc862d60
[2/2] ASoC: codecs: wsa883x: handle timeouts in resume path
commit: 0df73e1a9f7b1152ace21b6406138f7487239128
All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.
You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.
If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.
Please add any relevant lists and maintainers to the CCs when replying
to this mail.
Thanks,
Mark
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2022-06-30 16:55 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-06-30 13:00 [PATCH 1/2] ASoC: codecs: wsa881x: handle timeouts in resume path Srinivas Kandagatla
2022-06-30 13:00 ` [PATCH 2/2] ASoC: codecs: wsa883x: " Srinivas Kandagatla
2022-06-30 13:09 ` [PATCH 1/2] ASoC: codecs: wsa881x: " Pierre-Louis Bossart
2022-06-30 16:55 ` Mark Brown
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®