From: Srinivas Kandagatla <srinivas.kandagatla@linaro.org> To: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>, broonie@kernel.org Cc: alsa-devel@alsa-project.org, lgirdwood@gmail.com, linux-kernel@vger.kernel.org, tiwai@suse.com, quic_srivasam@quicinc.com Subject: Re: [PATCH v4] ASoC: codecs: wsa881x: add runtime pm support Date: Thu, 21 Apr 2022 10:31:23 +0100 [thread overview] Message-ID: <8a91822c-d68a-a2d8-6865-3985f2f85c0b@linaro.org> (raw) In-Reply-To: <b1b0a8b9-5fc2-bfe1-dfde-692a0a7ac34a@linux.intel.com> On 20/04/2022 18:59, Pierre-Louis Bossart wrote: > Hi Srini, > >> +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); >> + >> + gpiod_direction_output(wsa881x->sd_n, 1); >> + >> + wait_for_completion_timeout(&slave->initialization_complete, >> + msecs_to_jiffies(WSA881X_PROBE_TIMEOUT)); > > while I was revisiting pm_runtime support, I also saw that this codec driver is the only one that doesn't check for errors > > max98373-sdw.c: time = wait_for_completion_timeout(&slave->initialization_complete, > > rt1308-sdw.c: time = wait_for_completion_timeout(&slave->initialization_complete, > > rt1316-sdw.c: time = wait_for_completion_timeout(&slave->initialization_complete, > > rt5682-sdw.c: time = wait_for_completion_timeout(&slave->initialization_complete, > > rt5682.c: &slave->initialization_complete, > > rt700-sdw.c: time = wait_for_completion_timeout(&slave->initialization_complete, > > rt711-sdca-sdw.c: time = wait_for_completion_timeout(&slave->initialization_complete, > > rt711-sdw.c: time = wait_for_completion_timeout(&slave->initialization_complete, > > rt715-sdw.c: time = wait_for_completion_timeout(&slave->initialization_complete, > > wsa881x.c: wait_for_completion_timeout(&slave->initialization_complete, > > > If the attachment fails for some reason, you probably want to avoid starting regmap syncs that will fail by construction, no? Thanks Pierre for auditing the calls. Yes syncs would fail on reg writes if initialization timeout. Do you already have fix patch to this or do you want me to send one? Am also trying to understand what is the expected behavior in the resume failure cases, should pm attempt to resume the codec after some time, if so returning -ETIMEOUT is the right error code? --srini > >> + >> + regcache_cache_only(regmap, false); >> + regcache_sync(regmap); >> + >> + return 0; >> +}
WARNING: multiple messages have this Message-ID (diff)
From: Srinivas Kandagatla <srinivas.kandagatla@linaro.org> To: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>, broonie@kernel.org Cc: alsa-devel@alsa-project.org, tiwai@suse.com, lgirdwood@gmail.com, quic_srivasam@quicinc.com, linux-kernel@vger.kernel.org Subject: Re: [PATCH v4] ASoC: codecs: wsa881x: add runtime pm support Date: Thu, 21 Apr 2022 10:31:23 +0100 [thread overview] Message-ID: <8a91822c-d68a-a2d8-6865-3985f2f85c0b@linaro.org> (raw) In-Reply-To: <b1b0a8b9-5fc2-bfe1-dfde-692a0a7ac34a@linux.intel.com> On 20/04/2022 18:59, Pierre-Louis Bossart wrote: > Hi Srini, > >> +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); >> + >> + gpiod_direction_output(wsa881x->sd_n, 1); >> + >> + wait_for_completion_timeout(&slave->initialization_complete, >> + msecs_to_jiffies(WSA881X_PROBE_TIMEOUT)); > > while I was revisiting pm_runtime support, I also saw that this codec driver is the only one that doesn't check for errors > > max98373-sdw.c: time = wait_for_completion_timeout(&slave->initialization_complete, > > rt1308-sdw.c: time = wait_for_completion_timeout(&slave->initialization_complete, > > rt1316-sdw.c: time = wait_for_completion_timeout(&slave->initialization_complete, > > rt5682-sdw.c: time = wait_for_completion_timeout(&slave->initialization_complete, > > rt5682.c: &slave->initialization_complete, > > rt700-sdw.c: time = wait_for_completion_timeout(&slave->initialization_complete, > > rt711-sdca-sdw.c: time = wait_for_completion_timeout(&slave->initialization_complete, > > rt711-sdw.c: time = wait_for_completion_timeout(&slave->initialization_complete, > > rt715-sdw.c: time = wait_for_completion_timeout(&slave->initialization_complete, > > wsa881x.c: wait_for_completion_timeout(&slave->initialization_complete, > > > If the attachment fails for some reason, you probably want to avoid starting regmap syncs that will fail by construction, no? Thanks Pierre for auditing the calls. Yes syncs would fail on reg writes if initialization timeout. Do you already have fix patch to this or do you want me to send one? Am also trying to understand what is the expected behavior in the resume failure cases, should pm attempt to resume the codec after some time, if so returning -ETIMEOUT is the right error code? --srini > >> + >> + regcache_cache_only(regmap, false); >> + regcache_sync(regmap); >> + >> + return 0; >> +}
next prev parent reply other threads:[~2022-04-21 9:31 UTC|newest] Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top 2022-02-28 14:42 [PATCH v4] ASoC: codecs: wsa881x: add runtime pm support Srinivas Kandagatla 2022-02-28 14:42 ` Srinivas Kandagatla 2022-02-28 22:23 ` Mark Brown 2022-02-28 22:23 ` Mark Brown 2022-04-20 17:59 ` Pierre-Louis Bossart 2022-04-20 17:59 ` Pierre-Louis Bossart 2022-04-21 9:31 ` Srinivas Kandagatla [this message] 2022-04-21 9:31 ` Srinivas Kandagatla
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=8a91822c-d68a-a2d8-6865-3985f2f85c0b@linaro.org \ --to=srinivas.kandagatla@linaro.org \ --cc=alsa-devel@alsa-project.org \ --cc=broonie@kernel.org \ --cc=lgirdwood@gmail.com \ --cc=linux-kernel@vger.kernel.org \ --cc=pierre-louis.bossart@linux.intel.com \ --cc=quic_srivasam@quicinc.com \ --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: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.