Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
18 commits
Select commit Hold shift + click to select a range
5f5c945
ASoC: Intel: sof_sdw: reorder SoundWire codecs in Kconfig
plbossart May 23, 2023
be2ecab
ASoC: SoundWire codecs: return error status in probe
plbossart May 23, 2023
c5eaa4f
soundwire: intel_auxdevice: enable pm_runtime earlier on startup
plbossart May 9, 2023
04ecc92
soundWire: intel_auxdevice: resume 'sdw-master' on startup and system…
plbossart May 9, 2023
86b211a
ASoC: SoundWire codecs: make regmap cache-only in probe
plbossart May 11, 2023
b746961
ASoC: rt711: enable pm_runtime in probe, keep status as 'suspended'
plbossart May 11, 2023
bb07a2b
ASoC: rt711-sdca: enable pm_runtime in probe, keep status as 'suspended'
plbossart May 11, 2023
a83928c
ASoC: rt700: enable pm_runtime in probe, keep status as 'suspended'
plbossart May 22, 2023
d821f65
ASoC: rt1712-sdca: enable pm_runtime in probe, keep status as 'suspe…
plbossart May 23, 2023
1f35f44
ASoC: rt712-sdca-dmic: enable pm_runtime in probe, keep status as 'su…
plbossart May 23, 2023
c39fdcc
ASoC: rt715: enable pm_runtime in probe, keep status as 'suspended'
plbossart May 23, 2023
53ceac7
ASoC: rt715-sdca: enable pm_runtime in probe, keep status as 'suspended'
plbossart May 23, 2023
fbca938
ASoC: rt1308-sdw: enable pm_runtime in probe, keep status as 'suspended'
plbossart May 23, 2023
73246ac
ASoC: rt1316-sdw: enable pm_runtime in probe, keep status as 'suspended'
plbossart May 23, 2023
cb6dac6
ASoC: rt1318-sdw: enable pm_runtime in probe, keep status as 'suspended'
plbossart May 23, 2023
7a3529e
ASoC: rt5682-sdw: enable pm_runtime in probe, keep status as 'suspended'
plbossart May 22, 2023
dd38651
ASoC: max98363: enable pm_runtime in probe, keep status as 'suspended'
plbossart May 22, 2023
741e069
ASoC: max98373-sdw: enable pm_runtime in probe, keep status as 'suspe…
plbossart May 22, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 19 additions & 8 deletions drivers/soundwire/intel_auxdevice.c
Original file line number Diff line number Diff line change
Expand Up @@ -266,13 +266,6 @@ int intel_link_startup(struct auxiliary_device *auxdev)

sdw_intel_debugfs_init(sdw);

/* start bus */
ret = sdw_intel_start_bus(sdw);
if (ret) {
dev_err(dev, "bus start failed: %d\n", ret);
goto err_power_up;
}

/* Enable runtime PM */
if (!(link_flags & SDW_INTEL_MASTER_DISABLE_PM_RUNTIME)) {
pm_runtime_set_autosuspend_delay(dev,
Expand All @@ -282,6 +275,15 @@ int intel_link_startup(struct auxiliary_device *auxdev)

Comment thread
plbossart marked this conversation as resolved.
Resolved
pm_runtime_set_active(dev);
pm_runtime_enable(dev);

pm_runtime_resume(bus->dev);
}

/* start bus */
ret = sdw_intel_start_bus(sdw);
if (ret) {
dev_err(dev, "bus start failed: %d\n", ret);
goto err_pm_runtime;
}

clock_stop_quirks = sdw->link_res->clock_stop_quirks;
Expand Down Expand Up @@ -311,12 +313,18 @@ int intel_link_startup(struct auxiliary_device *auxdev)
* with a delay. A more complete solution would require the
* definition of Master properties.
*/
if (!(link_flags & SDW_INTEL_MASTER_DISABLE_PM_RUNTIME_IDLE))
if (!(link_flags & SDW_INTEL_MASTER_DISABLE_PM_RUNTIME_IDLE)) {
pm_runtime_mark_last_busy(bus->dev);
pm_runtime_mark_last_busy(dev);
pm_runtime_idle(dev);
}

sdw->startup_done = true;
return 0;

err_pm_runtime:
if (!(link_flags & SDW_INTEL_MASTER_DISABLE_PM_RUNTIME))
pm_runtime_disable(dev);
err_power_up:
sdw_intel_link_power_down(sdw);
err_init:
Expand Down Expand Up @@ -570,6 +578,8 @@ static int __maybe_unused intel_resume(struct device *dev)
pm_runtime_mark_last_busy(dev);
pm_runtime_enable(dev);

pm_runtime_resume(bus->dev);

link_flags = md_flags >> (bus->link_id * 8);

if (!(link_flags & SDW_INTEL_MASTER_DISABLE_PM_RUNTIME_IDLE))
Expand Down Expand Up @@ -605,6 +615,7 @@ static int __maybe_unused intel_resume(struct device *dev)
* counters and delay the pm_runtime suspend by several
* seconds, by when all enumeration should be complete.
*/
pm_runtime_mark_last_busy(bus->dev);
pm_runtime_mark_last_busy(dev);

return 0;
Expand Down
41 changes: 24 additions & 17 deletions sound/soc/codecs/max98363.c
Original file line number Diff line number Diff line change
Expand Up @@ -166,28 +166,17 @@ 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
* PM runtime status is marked as 'active' only when a Slave reports as Attached
*/
if (!max98363->first_hw_init) {
/* set autosuspend parameters */
pm_runtime_set_autosuspend_delay(dev, 3000);
pm_runtime_use_autosuspend(dev);

if (!max98363->first_hw_init)
/* update count of parent 'active' children */
pm_runtime_set_active(dev);

/* make sure the device does not suspend immediately */
pm_runtime_mark_last_busy(dev);

pm_runtime_enable(dev);
}

pm_runtime_get_noresume(dev);

ret = regmap_read(max98363->regmap, MAX98363_R21FF_REV_ID, &reg);
Expand Down Expand Up @@ -415,17 +404,35 @@ static int max98363_init(struct sdw_slave *slave, struct regmap *regmap)
max98363->regmap = regmap;
max98363->slave = slave;

regcache_cache_only(max98363->regmap, true);
Comment thread
bardliao marked this conversation as resolved.
Resolved

max98363->hw_init = false;
max98363->first_hw_init = false;

/* codec registration */
ret = devm_snd_soc_register_component(dev, &soc_codec_dev_max98363,
max98363_dai,
ARRAY_SIZE(max98363_dai));
if (ret < 0)
if (ret < 0) {
dev_err(dev, "Failed to register codec: %d\n", ret);
return ret;
}

return ret;
/* set autosuspend parameters */
pm_runtime_set_autosuspend_delay(dev, 3000);
pm_runtime_use_autosuspend(dev);

/* make sure the device does not suspend immediately */
pm_runtime_mark_last_busy(dev);

pm_runtime_enable(dev);

/* important note: the device is NOT tagged as 'active' and will remain
* 'suspended' until the hardware is enumerated/initialized. This is required
* to make sure the ASoC framework use of pm_runtime_get_sync() does not silently
* fail with -EACCESS because of race conditions between card creation and enumeration
*/
return 0;
}

static int max98363_sdw_probe(struct sdw_slave *slave,
Expand Down
47 changes: 26 additions & 21 deletions sound/soc/codecs/max98373-sdw.c
Original file line number Diff line number Diff line change
Expand Up @@ -361,28 +361,17 @@ 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
* PM runtime status is marked as 'active' only when a Slave reports as Attached
*/
if (!max98373->first_hw_init) {
/* set autosuspend parameters */
pm_runtime_set_autosuspend_delay(dev, 3000);
pm_runtime_use_autosuspend(dev);

if (!max98373->first_hw_init)
/* update count of parent 'active' children */
pm_runtime_set_active(dev);

/* make sure the device does not suspend immediately */
pm_runtime_mark_last_busy(dev);

pm_runtime_enable(dev);
}

pm_runtime_get_noresume(dev);

/* Software Reset */
Expand Down Expand Up @@ -753,6 +742,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),
Expand All @@ -773,10 +764,27 @@ static int max98373_init(struct sdw_slave *slave, struct regmap *regmap)
ret = devm_snd_soc_register_component(dev, &soc_codec_dev_max98373_sdw,
max98373_sdw_dai,
ARRAY_SIZE(max98373_sdw_dai));
if (ret < 0)
if (ret < 0) {
dev_err(dev, "Failed to register codec: %d\n", ret);
return ret;
}

return ret;
/* set autosuspend parameters */
pm_runtime_set_autosuspend_delay(dev, 3000);
pm_runtime_use_autosuspend(dev);

/* make sure the device does not suspend immediately */
pm_runtime_mark_last_busy(dev);

pm_runtime_enable(dev);

/* important note: the device is NOT tagged as 'active' and will remain
* 'suspended' until the hardware is enumerated/initialized. This is required
* to make sure the ASoC framework use of pm_runtime_get_sync() does not silently
* fail with -EACCESS because of race conditions between card creation and enumeration
*/

return 0;
}

static int max98373_update_status(struct sdw_slave *slave,
Expand Down Expand Up @@ -834,10 +842,7 @@ static int max98373_sdw_probe(struct sdw_slave *slave,

static int max98373_sdw_remove(struct sdw_slave *slave)
{
struct max98373_priv *max98373 = dev_get_drvdata(&slave->dev);

if (max98373->first_hw_init)
pm_runtime_disable(&slave->dev);
pm_runtime_disable(&slave->dev);

return 0;
}
Expand Down
54 changes: 30 additions & 24 deletions sound/soc/codecs/rt1308-sdw.c
Original file line number Diff line number Diff line change
Expand Up @@ -218,28 +218,17 @@ 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
* PM runtime status is marked as 'active' only when a Slave reports as Attached
*/
if (!rt1308->first_hw_init) {
/* set autosuspend parameters */
pm_runtime_set_autosuspend_delay(&slave->dev, 3000);
pm_runtime_use_autosuspend(&slave->dev);

if (!rt1308->first_hw_init)
/* update count of parent 'active' children */
pm_runtime_set_active(&slave->dev);

/* make sure the device does not suspend immediately */
pm_runtime_mark_last_busy(&slave->dev);

pm_runtime_enable(&slave->dev);
}

pm_runtime_get_noresume(&slave->dev);

/* sw reset */
Expand Down Expand Up @@ -626,6 +615,9 @@ static int rt1308_sdw_component_probe(struct snd_soc_component *component)
rt1308->component = component;
rt1308_sdw_parse_dt(rt1308, &rt1308->sdw_slave->dev);

if (!rt1308->first_hw_init)
return 0;

ret = pm_runtime_resume(component->dev);
if (ret < 0 && ret != -EACCES)
return ret;
Expand Down Expand Up @@ -688,6 +680,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
Expand All @@ -699,10 +693,27 @@ static int rt1308_sdw_init(struct device *dev, struct regmap *regmap,
&soc_component_sdw_rt1308,
rt1308_sdw_dai,
ARRAY_SIZE(rt1308_sdw_dai));
if (ret < 0)
return ret;

dev_dbg(&slave->dev, "%s\n", __func__);
/* set autosuspend parameters */
pm_runtime_set_autosuspend_delay(dev, 3000);
pm_runtime_use_autosuspend(dev);

return ret;
/* make sure the device does not suspend immediately */
pm_runtime_mark_last_busy(dev);

pm_runtime_enable(dev);

/* important note: the device is NOT tagged as 'active' and will remain
* 'suspended' until the hardware is enumerated/initialized. This is required
* to make sure the ASoC framework use of pm_runtime_get_sync() does not silently
* fail with -EACCESS because of race conditions between card creation and enumeration
*/

dev_dbg(dev, "%s\n", __func__);

return 0;
}

static int rt1308_sdw_probe(struct sdw_slave *slave,
Expand All @@ -715,17 +726,12 @@ static int rt1308_sdw_probe(struct sdw_slave *slave,
if (IS_ERR(regmap))
return PTR_ERR(regmap);

rt1308_sdw_init(&slave->dev, regmap, slave);

return 0;
return rt1308_sdw_init(&slave->dev, regmap, slave);
}

static int rt1308_sdw_remove(struct sdw_slave *slave)
{
struct rt1308_sdw_priv *rt1308 = dev_get_drvdata(&slave->dev);

if (rt1308->first_hw_init)
pm_runtime_disable(&slave->dev);
pm_runtime_disable(&slave->dev);

return 0;
}
Expand Down
Loading