Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Bard Liao and committed by
Vinod Koul
ee3db942 6d5e7af1

+4 -2
+4 -2
drivers/soundwire/intel.c
··· 1673 1673 1674 1674 } else if (clock_stop_quirks & SDW_INTEL_CLK_STOP_BUS_RESET || 1675 1675 !clock_stop_quirks) { 1676 + bool wake_enable = true; 1677 + 1676 1678 ret = sdw_cdns_clock_stop(cdns, true); 1677 1679 if (ret < 0) { 1678 1680 dev_err(dev, "cannot enable clock stop on suspend\n"); 1679 - return ret; 1681 + wake_enable = false; 1680 1682 } 1681 1683 1682 1684 ret = sdw_cdns_enable_interrupt(cdns, false); ··· 1693 1691 return ret; 1694 1692 } 1695 1693 1696 - intel_shim_wake(sdw, true); 1694 + intel_shim_wake(sdw, wake_enable); 1697 1695 } else { 1698 1696 dev_err(dev, "%s clock_stop_quirks %x unsupported\n", 1699 1697 __func__, clock_stop_quirks);