mirror of https://gitee.com/openkylin/linux.git
ASoC: max98373-sdw: use first_hw_init flag on resume
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.
BugLink: https://github.com/thesofproject/linux/issues/2637
Fixes: 56a5b7910e
('ASoC: codecs: max98373: add SoundWire support')
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>
Link: https://lore.kernel.org/r/20210607222239.582139-3-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
This commit is contained in:
parent
468a272ca4
commit
bf88117031
|
@ -270,7 +270,7 @@ static __maybe_unused int max98373_resume(struct device *dev)
|
|||
struct max98373_priv *max98373 = dev_get_drvdata(dev);
|
||||
unsigned long time;
|
||||
|
||||
if (!max98373->hw_init)
|
||||
if (!max98373->first_hw_init)
|
||||
return 0;
|
||||
|
||||
if (!slave->unattach_request)
|
||||
|
@ -361,7 +361,7 @@ static int max98373_io_init(struct sdw_slave *slave)
|
|||
struct device *dev = &slave->dev;
|
||||
struct max98373_priv *max98373 = dev_get_drvdata(dev);
|
||||
|
||||
if (max98373->pm_init_once) {
|
||||
if (max98373->first_hw_init) {
|
||||
regcache_cache_only(max98373->regmap, false);
|
||||
regcache_cache_bypass(max98373->regmap, true);
|
||||
}
|
||||
|
@ -369,7 +369,7 @@ static int max98373_io_init(struct sdw_slave *slave)
|
|||
/*
|
||||
* PM runtime is only enabled when a Slave reports as Attached
|
||||
*/
|
||||
if (!max98373->pm_init_once) {
|
||||
if (!max98373->first_hw_init) {
|
||||
/* set autosuspend parameters */
|
||||
pm_runtime_set_autosuspend_delay(dev, 3000);
|
||||
pm_runtime_use_autosuspend(dev);
|
||||
|
@ -461,12 +461,12 @@ static int max98373_io_init(struct sdw_slave *slave)
|
|||
regmap_write(max98373->regmap, MAX98373_R20B5_BDE_EN, 1);
|
||||
regmap_write(max98373->regmap, MAX98373_R20E2_LIMITER_EN, 1);
|
||||
|
||||
if (max98373->pm_init_once) {
|
||||
if (max98373->first_hw_init) {
|
||||
regcache_cache_bypass(max98373->regmap, false);
|
||||
regcache_mark_dirty(max98373->regmap);
|
||||
}
|
||||
|
||||
max98373->pm_init_once = true;
|
||||
max98373->first_hw_init = true;
|
||||
max98373->hw_init = true;
|
||||
|
||||
pm_runtime_mark_last_busy(dev);
|
||||
|
@ -796,7 +796,7 @@ static int max98373_init(struct sdw_slave *slave, struct regmap *regmap)
|
|||
max98373_slot_config(dev, max98373);
|
||||
|
||||
max98373->hw_init = false;
|
||||
max98373->pm_init_once = false;
|
||||
max98373->first_hw_init = false;
|
||||
|
||||
/* codec registration */
|
||||
ret = devm_snd_soc_register_component(dev, &soc_codec_dev_max98373_sdw,
|
||||
|
|
|
@ -226,7 +226,7 @@ struct max98373_priv {
|
|||
/* variables to support soundwire */
|
||||
struct sdw_slave *slave;
|
||||
bool hw_init;
|
||||
bool pm_init_once;
|
||||
bool first_hw_init;
|
||||
int slot;
|
||||
unsigned int rx_mask;
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue