soundwire: intel: don't return error when clock stop failed
authorBard Liao <yung-chuan.liao@linux.intel.com>
Thu, 14 Jan 2021 03:02:48 +0000 (11:02 +0800)
committerVinod Koul <vkoul@kernel.org>
Tue, 19 Jan 2021 14:51:21 +0000 (20:21 +0530)
commitee3db942432c9f9410345fb9d56aa8f81fbec862
tree81fddf31194739fe3166d178a376d742f468004c
parent6d5e7af1f6f5924de5dd1ebe97675c2363100878
soundwire: intel: don't return error when clock stop failed

dev->power.runtime_error will be set to the return value of the runtime
suspend callback function, and runtime resume function will return
-EINVAL if dev->power.runtime_error is not 0.

Somehow the codec rarely doesn't return an ACK to the clock prepare
command. If we stop the runtime suspend process and return error, we
will not be able to resume again. Likewise, if the codec lost sync and
did not rejoin, the resume operation will also fail. As a result, the
SoundWire bus can not be used anymore.

This patch suggests to finish the runtime suspend process even if we fail
to stop sdw bus clock. In the case where we do a hardware reset, the codecs
will be reconfigured completely. In the case where we use the regular clock
stop, the codecs keep their state and worst case will fall off the bus and
reattach.

The only drawback is that the power consumption may be higher and
device-initiated interrupts may be lost, but at least audio function can
still work after resume.

Signed-off-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Reviewed-by: Rander Wang <rander.wang@intel.com>
Reviewed-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20210114030248.9005-1-yung-chuan.liao@linux.intel.com
Signed-off-by: Vinod Koul <vkoul@kernel.org>
drivers/soundwire/intel.c