Skip to content

Commit e4401ab

Browse files
plbossartvinodkoul
authored andcommitted
soundwire: intel: skip suspend/resume/wake when link was not started
The SoundWire Linux devices are created purely based on information provided by platform firmware (e.g. ACPI DSDT table). When the kernel finds a matching driver for the device address (_ADR), the probe will initialize required data structures and initialize pm ops. When the SoundWire link is started at a later point, the physical devices will synchronize on the SoundWire frames and report their attachment status, thereby triggering the enumeration and initialization of device registers. This two-step solution was a conscious design decision to allow e.g. a driver to use sideband mechanisms to turn power rails on. This can also allow OEMs to describe multiple platforms with the same DSDT table, the devices that are not physically present in hardware. The drawback of this approach is a bit of confusion, with more devices than are actually present in hardware. This results in 'ghost' devices, for which the driver successfully probes, but that will not generate any traffic on the bus. suspend-resume transitions are handled by drivers, and skipped when the devices are not physically present. This patch provides a work-around for a second-level of confusion in platform firmware: some platforms only use HDaudio links, but nevertheless expose SoundWire 'ghost' devices. This results in error messages in the Intel driver while trying to suspend/resume these links. The simplest solution is to add a boolean status flag to skip all suspend/resume/wake sequences if the link was never started. Signed-off-by: Pierre-Louis Bossart <[email protected]> Signed-off-by: Bard Liao <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Vinod Koul <[email protected]>
1 parent ea6942d commit e4401ab

File tree

2 files changed

+13
-10
lines changed

2 files changed

+13
-10
lines changed

drivers/soundwire/intel.c

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1525,6 +1525,7 @@ int intel_link_startup(struct auxiliary_device *auxdev)
15251525
if (!(link_flags & SDW_INTEL_MASTER_DISABLE_PM_RUNTIME_IDLE))
15261526
pm_runtime_idle(dev);
15271527

1528+
sdw->startup_done = true;
15281529
return 0;
15291530

15301531
err_interrupt:
@@ -1564,8 +1565,9 @@ int intel_link_process_wakeen_event(struct auxiliary_device *auxdev)
15641565
sdw = dev_get_drvdata(dev);
15651566
bus = &sdw->cdns.bus;
15661567

1567-
if (bus->prop.hw_disabled) {
1568-
dev_dbg(dev, "SoundWire master %d is disabled, ignoring\n", bus->link_id);
1568+
if (bus->prop.hw_disabled || !sdw->startup_done) {
1569+
dev_dbg(dev, "SoundWire master %d is disabled or not-started, ignoring\n",
1570+
bus->link_id);
15691571
return 0;
15701572
}
15711573

@@ -1602,8 +1604,8 @@ static int __maybe_unused intel_suspend(struct device *dev)
16021604
u32 clock_stop_quirks;
16031605
int ret;
16041606

1605-
if (bus->prop.hw_disabled) {
1606-
dev_dbg(dev, "SoundWire master %d is disabled, ignoring\n",
1607+
if (bus->prop.hw_disabled || !sdw->startup_done) {
1608+
dev_dbg(dev, "SoundWire master %d is disabled or not-started, ignoring\n",
16071609
bus->link_id);
16081610
return 0;
16091611
}
@@ -1656,8 +1658,8 @@ static int __maybe_unused intel_suspend_runtime(struct device *dev)
16561658
u32 clock_stop_quirks;
16571659
int ret;
16581660

1659-
if (bus->prop.hw_disabled) {
1660-
dev_dbg(dev, "SoundWire master %d is disabled, ignoring\n",
1661+
if (bus->prop.hw_disabled || !sdw->startup_done) {
1662+
dev_dbg(dev, "SoundWire master %d is disabled or not-started, ignoring\n",
16611663
bus->link_id);
16621664
return 0;
16631665
}
@@ -1721,8 +1723,8 @@ static int __maybe_unused intel_resume(struct device *dev)
17211723
bool multi_link;
17221724
int ret;
17231725

1724-
if (bus->prop.hw_disabled) {
1725-
dev_dbg(dev, "SoundWire master %d is disabled, ignoring\n",
1726+
if (bus->prop.hw_disabled || !sdw->startup_done) {
1727+
dev_dbg(dev, "SoundWire master %d is disabled or not-started, ignoring\n",
17261728
bus->link_id);
17271729
return 0;
17281730
}
@@ -1819,8 +1821,8 @@ static int __maybe_unused intel_resume_runtime(struct device *dev)
18191821
int status;
18201822
int ret;
18211823

1822-
if (bus->prop.hw_disabled) {
1823-
dev_dbg(dev, "SoundWire master %d is disabled, ignoring\n",
1824+
if (bus->prop.hw_disabled || !sdw->startup_done) {
1825+
dev_dbg(dev, "SoundWire master %d is disabled or not-started, ignoring\n",
18241826
bus->link_id);
18251827
return 0;
18261828
}

drivers/soundwire/intel.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ struct sdw_intel {
4141
struct sdw_cdns cdns;
4242
int instance;
4343
struct sdw_intel_link_res *link_res;
44+
bool startup_done;
4445
#ifdef CONFIG_DEBUG_FS
4546
struct dentry *debugfs;
4647
#endif

0 commit comments

Comments
 (0)