soundwire: cadence: add parity error injection through debugfs
authorPierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Tue, 8 Sep 2020 13:45:21 +0000 (21:45 +0800)
committerVinod Koul <vkoul@kernel.org>
Thu, 10 Sep 2020 05:51:05 +0000 (11:21 +0530)
commit32d2a8935bf8faf201ff1a859eeb43ef6e5e438d
tree60d25591d63659cb37339c07b1e3efb580a4ffe4
parenta350aff45b4d33355cdc59b7b76950e39639e32f
soundwire: cadence: add parity error injection through debugfs

The Cadence IP can inject errors, let's make use of this capability to
test Slave parity error checks.

See e.g. example log where both the master and slave detect the parity
error injected on a dummy read command.

cd /sys/kernel/debug/soundwire/master-1/intel-sdw/
echo 1 > cdns-parity-error-injection

[   44.756249] intel-master sdw-master-1: Parity error
[   44.756313] intel-master sdw-master-1: Msg NACK received
[   44.756366] intel-master sdw-master-1: Msg NACKed for Slave 15
[   44.756375] intel-master sdw-master-1: trf on Slave 15 failed:-5
[   44.756382] intel-master sdw-master-1: parity error injection, read: -5
[   44.756649] rt1308 sdw:1:25d:1308:0: Parity error detected

The code makes sure the Master device is resumed, hence the clock
restarted, before sending a parity error.

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Signed-off-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Reviewed-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
Reviewed-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
Link: https://lore.kernel.org/r/20200908134521.6781-8-yung-chuan.liao@linux.intel.com
Signed-off-by: Vinod Koul <vkoul@kernel.org>
drivers/soundwire/cadence_master.c