soundwire: intel: add pm_runtime support
authorPierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Mon, 17 Aug 2020 15:29:12 +0000 (23:29 +0800)
committerVinod Koul <vkoul@kernel.org>
Tue, 18 Aug 2020 06:31:04 +0000 (12:01 +0530)
commitebf878eddbb449091078d2ed282aed42a4fcef34
tree46c185125c07260a5258394b0fd9008f766b1737
parent9b3b4b3f2f2af863d2f6dd65afd295a5a673afa2
soundwire: intel: add pm_runtime support

Add basic hooks in DAI .startup and .shutdown callbacks.

The SoundWire IP should be powered between those two calls. The power
dependencies between SoundWire and DSP are handled with the
parent/child relationship, before the SoundWire master device becomes
active the parent device will become active and power-up the shared
rails.

For now the strategy is to rely on complete enumeration when the
device becomes active, so the code is a copy/paste of the sequence for
system suspend/resume. In future patches, the strategy will optionally
be to rely on clock stop if the enumeration time is prohibitive or
when the devices connected to a link can signal a wake.

A module parameter is added to make integration of new Slave devices
easier, to e.g. keep the device active or prevent clock-stop.

Note that we need to we have to disable runtime pm before device
unregister, otherwise we will see "Failed to power up link: -11" error
on module remove test.

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Signed-off-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Link: https://lore.kernel.org/r/20200817152923.3259-2-yung-chuan.liao@linux.intel.com
Signed-off-by: Vinod Koul <vkoul@kernel.org>
drivers/soundwire/intel.c
drivers/soundwire/intel_init.c