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

soundwire: cadence: fix ACK/NAK handling

The existing code reports a NAK only when ACK=0
This is not aligned with the SoundWire 1.x specifications.

Table 32 in the SoundWire 1.2 specification shows that a Device shall
not set NAK=1 if ACK=1. But Table 33 shows the Combined Response
may very well be NAK=1/ACK=1, e.g. if another Device than the one
addressed reports a parity error.

NAK=1 signals a 'Command_Aborted', regardless of the ACK bit value.

Move the tests for NAK so that the NAK=1/ACK=1 combination is properly
detected according to the specification.

Fixes: 956baa1992f9a ('soundwire: cdns: Add sdw_master_ops and IO transfer support')
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/20210115053738.22630-5-yung-chuan.liao@linux.intel.com
Signed-off-by: Vinod Koul <vkoul@kernel.org>

authored by

Pierre-Louis Bossart and committed by
Vinod Koul
db9d9f94 ec475187

+4 -4
+4 -4
drivers/soundwire/cadence_master.c
··· 484 484 if (!(cdns->response_buf[i] & CDNS_MCP_RESP_ACK)) { 485 485 no_ack = 1; 486 486 dev_dbg_ratelimited(cdns->dev, "Msg Ack not received\n"); 487 - if (cdns->response_buf[i] & CDNS_MCP_RESP_NACK) { 488 - nack = 1; 489 - dev_err_ratelimited(cdns->dev, "Msg NACK received\n"); 490 - } 487 + } 488 + if (cdns->response_buf[i] & CDNS_MCP_RESP_NACK) { 489 + nack = 1; 490 + dev_err_ratelimited(cdns->dev, "Msg NACK received\n"); 491 491 } 492 492 } 493 493