Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions Documentation/driver-api/soundwire/bra.rst
Original file line number Diff line number Diff line change
Expand Up @@ -89,12 +89,12 @@ transmission or programming errors, each BRA packet provides:
transmitted as the last-but-one byte in the packet, prior to the
footer response.

The header response can be one of
The header response can be one of:
(a) Ack
(b) Nak
(c) Not Ready

The footer response can be one of
The footer response can be one of:
(1) Ack
(2) Nak (CRC failure)
(3) Good (operation completed)
Expand All @@ -112,7 +112,7 @@ to start on a new SoundWire Row, and the scale of data may vary.
+---+--------------------------------------------+
+ | |
+ | BRA HEADER |
+ | |
+ | |
+ +--------------------------------------------+
+ C | HEADER CRC |
+ O +--------------------------------------------+
Expand Down Expand Up @@ -184,7 +184,7 @@ consumed/produced by these FIFOs is not symmetrical, as a result
hardware typically inserts markers to help software and hardware
interpret raw data

Each packet will typically have
Each packet will typically have:

(1) a 'Start of Packet' indicator.

Expand Down Expand Up @@ -240,15 +240,15 @@ One possible strategy to speed-up all initialization tasks would be to
start a BRA transfer for firmware download, then deal with all the
"regular" read/writes in parallel with the command channel, and last
to wait for the BRA transfers to complete. This would allow for a
degree of overlap instead of a purely sequential solution. As a
results, the BRA API must support async transfers and expose a
separate wait function.
degree of overlap instead of a purely sequential solution. As such,
the BRA API must support async transfers and expose a separate wait
function.


Peripheral/bus interface
------------------------

The bus interface for BPT/BRA is made of two functions
The bus interface for BPT/BRA is made of two functions:

- sdw_bpt_send_async(bpt_message)

Expand Down
32 changes: 10 additions & 22 deletions drivers/soundwire/cadence_master.c
Original file line number Diff line number Diff line change
Expand Up @@ -2044,6 +2044,13 @@ static const u8 sdw_crc8_lookup_msb[CRC8_TABLE_SIZE] = {
#define SDW_CDNS_BRA_FOOTER_RESP 1 /* defined by MIPI */
#define SDW_CDNS_BRA_FOOTER_RESP_PAD 1 /* Cadence only */

#define SDW_CDNS_WRITE_PDI1_BUFFER_SIZE \
((SDW_CDNS_BRA_HDR_RESP + SDW_CDNS_BRA_HDR_RESP_PAD + \
SDW_CDNS_BRA_FOOTER_RESP + SDW_CDNS_BRA_FOOTER_RESP_PAD) * 2)

#define SDW_CDNS_READ_PDI0_BUFFER_SIZE \
((SDW_CDNS_BRA_HDR + SDW_CDNS_BRA_HDR_CRC + SDW_CDNS_BRA_HDR_CRC_PAD) * 2)

static unsigned int sdw_cdns_bra_actual_data_size(unsigned int allocated_bytes_per_frame)
{
unsigned int total;
Expand Down Expand Up @@ -2074,25 +2081,6 @@ static unsigned int sdw_cdns_write_pdi0_buffer_size(unsigned int actual_data_siz
return total * 2;
}

static unsigned int sdw_cdns_write_pdi1_buffer_size(unsigned int actual_data_size)
{
unsigned int total;

total = SDW_CDNS_BRA_HDR_RESP + SDW_CDNS_BRA_HDR_RESP_PAD +
SDW_CDNS_BRA_FOOTER_RESP + SDW_CDNS_BRA_FOOTER_RESP_PAD;

return total * 2;
}

static unsigned int sdw_cdns_read_pdi0_buffer_size(unsigned int actual_data_size)
{
unsigned int total;

total = SDW_CDNS_BRA_HDR + SDW_CDNS_BRA_HDR_CRC + SDW_CDNS_BRA_HDR_CRC_PAD;

return total * 2;
}

static unsigned int sdw_cdns_read_pdi1_buffer_size(unsigned int actual_data_size)
{
unsigned int total;
Expand Down Expand Up @@ -2151,7 +2139,7 @@ int sdw_cdns_bpt_find_buffer_sizes(int command, /* 0: write, 1: read */
*num_frames = DIV_ROUND_UP(data_bytes, actual_bpt_bytes);

pdi0_tx_size = sdw_cdns_write_pdi0_buffer_size(actual_bpt_bytes);
pdi1_rx_size = sdw_cdns_write_pdi1_buffer_size(actual_bpt_bytes);
pdi1_rx_size = SDW_CDNS_WRITE_PDI1_BUFFER_SIZE;

*pdi0_buffer_size = pdi0_tx_size * *num_frames;
*pdi1_buffer_size = pdi1_rx_size * *num_frames;
Expand All @@ -2162,15 +2150,15 @@ int sdw_cdns_bpt_find_buffer_sizes(int command, /* 0: write, 1: read */
*/
*num_frames = data_bytes / actual_bpt_bytes;

pdi0_tx_size = sdw_cdns_read_pdi0_buffer_size(actual_bpt_bytes);
pdi0_tx_size = SDW_CDNS_READ_PDI0_BUFFER_SIZE;
pdi1_rx_size = sdw_cdns_read_pdi1_buffer_size(actual_bpt_bytes);

*pdi0_buffer_size = pdi0_tx_size * *num_frames;
*pdi1_buffer_size = pdi1_rx_size * *num_frames;

remainder = data_bytes % actual_bpt_bytes;
if (remainder) {
pdi0_tx_size = sdw_cdns_read_pdi0_buffer_size(remainder);
pdi0_tx_size = SDW_CDNS_READ_PDI0_BUFFER_SIZE;
pdi1_rx_size = sdw_cdns_read_pdi1_buffer_size(remainder);

*num_frames = *num_frames + 1;
Expand Down
Loading