mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-10-29 23:53:32 +00:00
ASoC: SoundWire codecs: make regmap cache-only in probe
The SoundWire bus may start after the probe where the SoundWire ASoC components are registered. This creates a time window where the card can be created and the registers be accessed. As discussed on the mailing list, we can't really control when codecs are enumerated and initialized, but we can make sure the access to the codecs is cached until the hardware is accessible. This patch configures regcache_cache_only() with a 'true' parameter in the probe function, and a 'false' parameter in the io_init routine. The rt5682 is handled through a different patch due to its specific cache handling. Link: https://lore.kernel.org/alsa-devel/20230503144102.242240-1-krzysztof.kozlowski@linaro.org/ Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com> Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com> Reviewed-by: Rander Wang <rander.wang@intel.com> Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com> Link: https://lore.kernel.org/r/20230802153629.53576-3-pierre-louis.bossart@linux.intel.com Signed-off-by: Mark Brown <broonie@kernel.org>
This commit is contained in:
parent
3f3d66ba99
commit
49ae74abc7
12 changed files with 53 additions and 23 deletions
|
@ -160,10 +160,9 @@ static int max98363_io_init(struct sdw_slave *slave)
|
|||
struct max98363_priv *max98363 = dev_get_drvdata(dev);
|
||||
int ret, reg;
|
||||
|
||||
if (max98363->first_hw_init) {
|
||||
regcache_cache_only(max98363->regmap, false);
|
||||
regcache_cache_only(max98363->regmap, false);
|
||||
if (max98363->first_hw_init)
|
||||
regcache_cache_bypass(max98363->regmap, true);
|
||||
}
|
||||
|
||||
/*
|
||||
* PM runtime is only enabled when a Slave reports as Attached
|
||||
|
@ -409,6 +408,8 @@ static int max98363_init(struct sdw_slave *slave, struct regmap *regmap)
|
|||
max98363->regmap = regmap;
|
||||
max98363->slave = slave;
|
||||
|
||||
regcache_cache_only(max98363->regmap, true);
|
||||
|
||||
max98363->hw_init = false;
|
||||
max98363->first_hw_init = false;
|
||||
|
||||
|
|
|
@ -361,10 +361,9 @@ static int max98373_io_init(struct sdw_slave *slave)
|
|||
struct device *dev = &slave->dev;
|
||||
struct max98373_priv *max98373 = dev_get_drvdata(dev);
|
||||
|
||||
if (max98373->first_hw_init) {
|
||||
regcache_cache_only(max98373->regmap, false);
|
||||
regcache_cache_only(max98373->regmap, false);
|
||||
if (max98373->first_hw_init)
|
||||
regcache_cache_bypass(max98373->regmap, true);
|
||||
}
|
||||
|
||||
/*
|
||||
* PM runtime is only enabled when a Slave reports as Attached
|
||||
|
@ -753,6 +752,8 @@ static int max98373_init(struct sdw_slave *slave, struct regmap *regmap)
|
|||
max98373->regmap = regmap;
|
||||
max98373->slave = slave;
|
||||
|
||||
regcache_cache_only(max98373->regmap, true);
|
||||
|
||||
max98373->cache_num = ARRAY_SIZE(max98373_sdw_cache_reg);
|
||||
max98373->cache = devm_kcalloc(dev, max98373->cache_num,
|
||||
sizeof(*max98373->cache),
|
||||
|
|
|
@ -218,10 +218,9 @@ static int rt1308_io_init(struct device *dev, struct sdw_slave *slave)
|
|||
if (rt1308->hw_init)
|
||||
return 0;
|
||||
|
||||
if (rt1308->first_hw_init) {
|
||||
regcache_cache_only(rt1308->regmap, false);
|
||||
regcache_cache_only(rt1308->regmap, false);
|
||||
if (rt1308->first_hw_init)
|
||||
regcache_cache_bypass(rt1308->regmap, true);
|
||||
}
|
||||
|
||||
/*
|
||||
* PM runtime is only enabled when a Slave reports as Attached
|
||||
|
@ -688,6 +687,8 @@ static int rt1308_sdw_init(struct device *dev, struct regmap *regmap,
|
|||
rt1308->sdw_slave = slave;
|
||||
rt1308->regmap = regmap;
|
||||
|
||||
regcache_cache_only(rt1308->regmap, true);
|
||||
|
||||
/*
|
||||
* Mark hw_init to false
|
||||
* HW init will be performed when device reports present
|
||||
|
|
|
@ -272,8 +272,8 @@ static int rt1316_io_init(struct device *dev, struct sdw_slave *slave)
|
|||
if (rt1316->hw_init)
|
||||
return 0;
|
||||
|
||||
regcache_cache_only(rt1316->regmap, false);
|
||||
if (rt1316->first_hw_init) {
|
||||
regcache_cache_only(rt1316->regmap, false);
|
||||
regcache_cache_bypass(rt1316->regmap, true);
|
||||
} else {
|
||||
/*
|
||||
|
@ -674,6 +674,8 @@ static int rt1316_sdw_init(struct device *dev, struct regmap *regmap,
|
|||
rt1316->sdw_slave = slave;
|
||||
rt1316->regmap = regmap;
|
||||
|
||||
regcache_cache_only(rt1316->regmap, true);
|
||||
|
||||
/*
|
||||
* Mark hw_init to false
|
||||
* HW init will be performed when device reports present
|
||||
|
|
|
@ -408,8 +408,8 @@ static int rt1318_io_init(struct device *dev, struct sdw_slave *slave)
|
|||
if (rt1318->hw_init)
|
||||
return 0;
|
||||
|
||||
regcache_cache_only(rt1318->regmap, false);
|
||||
if (rt1318->first_hw_init) {
|
||||
regcache_cache_only(rt1318->regmap, false);
|
||||
regcache_cache_bypass(rt1318->regmap, true);
|
||||
} else {
|
||||
/*
|
||||
|
@ -752,6 +752,8 @@ static int rt1318_sdw_init(struct device *dev, struct regmap *regmap,
|
|||
rt1318->sdw_slave = slave;
|
||||
rt1318->regmap = regmap;
|
||||
|
||||
regcache_cache_only(rt1318->regmap, true);
|
||||
|
||||
/*
|
||||
* Mark hw_init to false
|
||||
* HW init will be performed when device reports present
|
||||
|
|
|
@ -1099,6 +1099,8 @@ int rt700_init(struct device *dev, struct regmap *sdw_regmap,
|
|||
rt700->sdw_regmap = sdw_regmap;
|
||||
rt700->regmap = regmap;
|
||||
|
||||
regcache_cache_only(rt700->regmap, true);
|
||||
|
||||
mutex_init(&rt700->disable_irq_lock);
|
||||
|
||||
INIT_DELAYED_WORK(&rt700->jack_detect_work,
|
||||
|
@ -1132,10 +1134,9 @@ int rt700_io_init(struct device *dev, struct sdw_slave *slave)
|
|||
if (rt700->hw_init)
|
||||
return 0;
|
||||
|
||||
if (rt700->first_hw_init) {
|
||||
regcache_cache_only(rt700->regmap, false);
|
||||
regcache_cache_only(rt700->regmap, false);
|
||||
if (rt700->first_hw_init)
|
||||
regcache_cache_bypass(rt700->regmap, true);
|
||||
}
|
||||
|
||||
/*
|
||||
* PM runtime is only enabled when a Slave reports as Attached
|
||||
|
|
|
@ -1406,6 +1406,9 @@ int rt711_sdca_init(struct device *dev, struct regmap *regmap,
|
|||
rt711->regmap = regmap;
|
||||
rt711->mbq_regmap = mbq_regmap;
|
||||
|
||||
regcache_cache_only(rt711->regmap, true);
|
||||
regcache_cache_only(rt711->mbq_regmap, true);
|
||||
|
||||
mutex_init(&rt711->calibrate_mutex);
|
||||
mutex_init(&rt711->disable_irq_lock);
|
||||
|
||||
|
@ -1500,10 +1503,11 @@ int rt711_sdca_io_init(struct device *dev, struct sdw_slave *slave)
|
|||
if (rt711->hw_init)
|
||||
return 0;
|
||||
|
||||
regcache_cache_only(rt711->regmap, false);
|
||||
regcache_cache_only(rt711->mbq_regmap, false);
|
||||
|
||||
if (rt711->first_hw_init) {
|
||||
regcache_cache_only(rt711->regmap, false);
|
||||
regcache_cache_bypass(rt711->regmap, true);
|
||||
regcache_cache_only(rt711->mbq_regmap, false);
|
||||
regcache_cache_bypass(rt711->mbq_regmap, true);
|
||||
} else {
|
||||
/*
|
||||
|
|
|
@ -1183,6 +1183,8 @@ int rt711_init(struct device *dev, struct regmap *sdw_regmap,
|
|||
rt711->sdw_regmap = sdw_regmap;
|
||||
rt711->regmap = regmap;
|
||||
|
||||
regcache_cache_only(rt711->regmap, true);
|
||||
|
||||
mutex_init(&rt711->calibrate_mutex);
|
||||
mutex_init(&rt711->disable_irq_lock);
|
||||
|
||||
|
@ -1219,10 +1221,9 @@ int rt711_io_init(struct device *dev, struct sdw_slave *slave)
|
|||
if (rt711->hw_init)
|
||||
return 0;
|
||||
|
||||
if (rt711->first_hw_init) {
|
||||
regcache_cache_only(rt711->regmap, false);
|
||||
regcache_cache_only(rt711->regmap, false);
|
||||
if (rt711->first_hw_init)
|
||||
regcache_cache_bypass(rt711->regmap, true);
|
||||
}
|
||||
|
||||
/*
|
||||
* PM runtime is only enabled when a Slave reports as Attached
|
||||
|
|
|
@ -182,10 +182,10 @@ static int rt712_sdca_dmic_io_init(struct device *dev, struct sdw_slave *slave)
|
|||
if (rt712->hw_init)
|
||||
return 0;
|
||||
|
||||
regcache_cache_only(rt712->regmap, false);
|
||||
regcache_cache_only(rt712->mbq_regmap, false);
|
||||
if (rt712->first_hw_init) {
|
||||
regcache_cache_only(rt712->regmap, false);
|
||||
regcache_cache_bypass(rt712->regmap, true);
|
||||
regcache_cache_only(rt712->mbq_regmap, false);
|
||||
regcache_cache_bypass(rt712->mbq_regmap, true);
|
||||
} else {
|
||||
/*
|
||||
|
@ -777,6 +777,9 @@ static int rt712_sdca_dmic_init(struct device *dev, struct regmap *regmap,
|
|||
rt712->regmap = regmap;
|
||||
rt712->mbq_regmap = mbq_regmap;
|
||||
|
||||
regcache_cache_only(rt712->regmap, true);
|
||||
regcache_cache_only(rt712->mbq_regmap, true);
|
||||
|
||||
/*
|
||||
* Mark hw_init to false
|
||||
* HW init will be performed when device reports present
|
||||
|
|
|
@ -1183,6 +1183,9 @@ int rt712_sdca_init(struct device *dev, struct regmap *regmap,
|
|||
rt712->regmap = regmap;
|
||||
rt712->mbq_regmap = mbq_regmap;
|
||||
|
||||
regcache_cache_only(rt712->regmap, true);
|
||||
regcache_cache_only(rt712->mbq_regmap, true);
|
||||
|
||||
mutex_init(&rt712->calibrate_mutex);
|
||||
mutex_init(&rt712->disable_irq_lock);
|
||||
|
||||
|
@ -1224,10 +1227,10 @@ int rt712_sdca_io_init(struct device *dev, struct sdw_slave *slave)
|
|||
if (rt712->hw_init)
|
||||
return 0;
|
||||
|
||||
regcache_cache_only(rt712->regmap, false);
|
||||
regcache_cache_only(rt712->mbq_regmap, false);
|
||||
if (rt712->first_hw_init) {
|
||||
regcache_cache_only(rt712->regmap, false);
|
||||
regcache_cache_bypass(rt712->regmap, true);
|
||||
regcache_cache_only(rt712->mbq_regmap, false);
|
||||
regcache_cache_bypass(rt712->mbq_regmap, true);
|
||||
} else {
|
||||
/*
|
||||
|
|
|
@ -977,6 +977,10 @@ int rt715_sdca_init(struct device *dev, struct regmap *mbq_regmap,
|
|||
rt715->regmap = regmap;
|
||||
rt715->mbq_regmap = mbq_regmap;
|
||||
rt715->hw_sdw_ver = slave->id.sdw_version;
|
||||
|
||||
regcache_cache_only(rt715->regmap, true);
|
||||
regcache_cache_only(rt715->mbq_regmap, true);
|
||||
|
||||
/*
|
||||
* Mark hw_init to false
|
||||
* HW init will be performed when device reports present
|
||||
|
@ -1000,6 +1004,9 @@ int rt715_sdca_io_init(struct device *dev, struct sdw_slave *slave)
|
|||
if (rt715->hw_init)
|
||||
return 0;
|
||||
|
||||
regcache_cache_only(rt715->regmap, false);
|
||||
regcache_cache_only(rt715->mbq_regmap, false);
|
||||
|
||||
/*
|
||||
* PM runtime is only enabled when a Slave reports as Attached
|
||||
*/
|
||||
|
|
|
@ -984,6 +984,8 @@ int rt715_init(struct device *dev, struct regmap *sdw_regmap,
|
|||
rt715->regmap = regmap;
|
||||
rt715->sdw_regmap = sdw_regmap;
|
||||
|
||||
regcache_cache_only(rt715->regmap, true);
|
||||
|
||||
/*
|
||||
* Mark hw_init to false
|
||||
* HW init will be performed when device reports present
|
||||
|
@ -1006,6 +1008,8 @@ int rt715_io_init(struct device *dev, struct sdw_slave *slave)
|
|||
if (rt715->hw_init)
|
||||
return 0;
|
||||
|
||||
regcache_cache_only(rt715->regmap, false);
|
||||
|
||||
/*
|
||||
* PM runtime is only enabled when a Slave reports as Attached
|
||||
*/
|
||||
|
|
Loading…
Reference in a new issue