All of lore.kernel.org
 help / color / mirror / Atom feed
From: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
To: alsa-devel@alsa-project.org
Cc: Oder Chiou <oder_chiou@realtek.com>,
	Jack Yu <jack.yu@realtek.com>,
	Ryan Lee <ryans.lee@maximintegrated.com>,
	Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>,
	tiwai@suse.de,
	Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>,
	broonie@kernel.org, Shuming Fan <shumingf@realtek.com>,
	Bard liao <yung-chuan.liao@linux.intel.com>,
	Bard Liao <bard.liao@intel.com>
Subject: [PATCH 09/15] ASoC: rt715-sdca-sdw: use first_hw_init flag on resume
Date: Mon,  7 Jun 2021 17:22:33 -0500	[thread overview]
Message-ID: <20210607222239.582139-10-pierre-louis.bossart@linux.intel.com> (raw)
In-Reply-To: <20210607222239.582139-1-pierre-louis.bossart@linux.intel.com>

The intent of the status check on resume was to verify if a SoundWire
peripheral reported ATTACHED before waiting for the initialization to
complete. This is required to avoid timeouts that will happen with
'ghost' devices that are exposed in the platform firmware but are not
populated in hardware.

Unfortunately we used 'hw_init' instead of 'first_hw_init'. Due to
another error, the resume operation never timed out, but the volume
settings were not properly restored.

This patch renames the status flag to 'first_hw_init' for consistency
with other drivers (was 'first_init')

BugLink: https://github.com/thesofproject/linux/issues/2908
BugLink: https://github.com/thesofproject/linux/issues/2637
Fixes: 20d17057f0a8c ('ASoC: rt715-sdca: Add RT715 sdca vendor-specific driver')
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
Reviewed-by: Bard Liao <bard.liao@intel.com>
---
 sound/soc/codecs/rt715-sdca-sdw.c | 2 +-
 sound/soc/codecs/rt715-sdca.c     | 6 +++---
 sound/soc/codecs/rt715-sdca.h     | 2 +-
 3 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/sound/soc/codecs/rt715-sdca-sdw.c b/sound/soc/codecs/rt715-sdca-sdw.c
index 1350798406f0..7646bbe739f1 100644
--- a/sound/soc/codecs/rt715-sdca-sdw.c
+++ b/sound/soc/codecs/rt715-sdca-sdw.c
@@ -224,7 +224,7 @@ static int __maybe_unused rt715_dev_resume(struct device *dev)
 	struct rt715_sdca_priv *rt715 = dev_get_drvdata(dev);
 	unsigned long time;
 
-	if (!rt715->hw_init)
+	if (!rt715->first_hw_init)
 		return 0;
 
 	if (!slave->unattach_request)
diff --git a/sound/soc/codecs/rt715-sdca.c b/sound/soc/codecs/rt715-sdca.c
index 7db76c19e048..d82166f1a378 100644
--- a/sound/soc/codecs/rt715-sdca.c
+++ b/sound/soc/codecs/rt715-sdca.c
@@ -997,7 +997,7 @@ int rt715_sdca_init(struct device *dev, struct regmap *mbq_regmap,
 	 * HW init will be performed when device reports present
 	 */
 	rt715->hw_init = false;
-	rt715->first_init = false;
+	rt715->first_hw_init = false;
 
 	ret = devm_snd_soc_register_component(dev,
 			&soc_codec_dev_rt715_sdca,
@@ -1018,7 +1018,7 @@ int rt715_sdca_io_init(struct device *dev, struct sdw_slave *slave)
 	/*
 	 * PM runtime is only enabled when a Slave reports as Attached
 	 */
-	if (!rt715->first_init) {
+	if (!rt715->first_hw_init) {
 		/* set autosuspend parameters */
 		pm_runtime_set_autosuspend_delay(&slave->dev, 3000);
 		pm_runtime_use_autosuspend(&slave->dev);
@@ -1031,7 +1031,7 @@ int rt715_sdca_io_init(struct device *dev, struct sdw_slave *slave)
 
 		pm_runtime_enable(&slave->dev);
 
-		rt715->first_init = true;
+		rt715->first_hw_init = true;
 	}
 
 	pm_runtime_get_noresume(&slave->dev);
diff --git a/sound/soc/codecs/rt715-sdca.h b/sound/soc/codecs/rt715-sdca.h
index 85ce4d95e5eb..0c1fdd5bc7ca 100644
--- a/sound/soc/codecs/rt715-sdca.h
+++ b/sound/soc/codecs/rt715-sdca.h
@@ -27,7 +27,7 @@ struct rt715_sdca_priv {
 	enum sdw_slave_status status;
 	struct sdw_bus_params params;
 	bool hw_init;
-	bool first_init;
+	bool first_hw_init;
 	int l_is_unmute;
 	int r_is_unmute;
 	int hw_sdw_ver;
-- 
2.25.1


  parent reply	other threads:[~2021-06-07 22:28 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-07 22:22 [PATCH 00/15] ASoC: fixes for SoundWire codec drivers Pierre-Louis Bossart
2021-06-07 22:22 ` [PATCH 01/15] ASoC: max98373-sdw: add missing memory allocation check Pierre-Louis Bossart
2021-06-07 22:22 ` [PATCH 02/15] ASoC: max98373-sdw: use first_hw_init flag on resume Pierre-Louis Bossart
2021-06-07 22:22 ` [PATCH 03/15] ASoC: rt1308-sdw: " Pierre-Louis Bossart
2021-06-07 22:22 ` [PATCH 04/15] ASoC: rt1316-sdw: " Pierre-Louis Bossart
2021-06-07 22:22 ` [PATCH 05/15] ASoC: rt5682-sdw: " Pierre-Louis Bossart
2021-06-07 22:22 ` [PATCH 06/15] ASoC: rt700-sdw: " Pierre-Louis Bossart
2021-06-07 22:22 ` [PATCH 07/15] ASoC: rt711-sdca-sdw: " Pierre-Louis Bossart
2021-06-07 22:22 ` [PATCH 08/15] ASoC: rt711-sdw: " Pierre-Louis Bossart
2021-06-07 22:22 ` Pierre-Louis Bossart [this message]
2021-06-07 22:22 ` [PATCH 10/15] ASoC: rt715-sdw: " Pierre-Louis Bossart
2021-06-07 22:22 ` [PATCH 11/15] ASoC: rt715-sdca: fix clock stop prepare timeout issue Pierre-Louis Bossart
2021-06-07 22:22 ` [PATCH 12/15] ASoC: rt5682: Fix a problem with error handling in the io init function of the soundwire Pierre-Louis Bossart
2021-06-07 22:22 ` [PATCH 13/15] ASoC: rt5682-sdw: set regcache_cache_only false before reading RT5682_DEVICE_ID Pierre-Louis Bossart
2021-06-07 22:22 ` [PATCH 14/15] ASoC: rt711-sdca-sdw: add readable for SDW_SDCA_CTL() registers Pierre-Louis Bossart
2021-06-07 22:22 ` [PATCH 15/15] ASoC: rt711-sdca: handle mbq_regmap in rt711_sdca_io_init Pierre-Louis Bossart
2021-06-08 16:06 ` [PATCH 00/15] ASoC: fixes for SoundWire codec drivers 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=20210607222239.582139-10-pierre-louis.bossart@linux.intel.com \
    --to=pierre-louis.bossart@linux.intel.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=bard.liao@intel.com \
    --cc=broonie@kernel.org \
    --cc=guennadi.liakhovetski@linux.intel.com \
    --cc=jack.yu@realtek.com \
    --cc=oder_chiou@realtek.com \
    --cc=ryans.lee@maximintegrated.com \
    --cc=shumingf@realtek.com \
    --cc=tiwai@suse.de \
    --cc=yung-chuan.liao@linux.intel.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 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.