mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-08-31 14:04:27 -04:00
soundwire: intel: handle Peripheral bra_block_alignment
The data pre frame size should be a multiple of bra_block_alignment. Signed-off-by: Bard Liao <yung-chuan.liao@linux.intel.com> Reviewed-by: Péter Ujfalusi <peter.ujfalusi@linux.intel.com> Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.dev> Link: https://patch.msgid.link/20260728124639.1484973-4-yung-chuan.liao@linux.intel.com Signed-off-by: Vinod Koul <vkoul@kernel.org>
This commit is contained in:
@@ -2135,6 +2135,7 @@ EXPORT_SYMBOL(sdw_cdns_bpt_find_bandwidth);
|
||||
int sdw_cdns_bpt_find_buffer_sizes(int command, /* 0: write, 1: read */
|
||||
int row, int col, unsigned int data_bytes,
|
||||
unsigned int requested_bytes_per_frame,
|
||||
unsigned int bra_block_alignment,
|
||||
unsigned int *data_per_frame, unsigned int *pdi0_buffer_size,
|
||||
unsigned int *pdi1_buffer_size, unsigned int *num_frames)
|
||||
{
|
||||
@@ -2159,6 +2160,16 @@ int sdw_cdns_bpt_find_buffer_sizes(int command, /* 0: write, 1: read */
|
||||
if (requested_bytes_per_frame < actual_bpt_bytes)
|
||||
actual_bpt_bytes = requested_bytes_per_frame;
|
||||
|
||||
if (bra_block_alignment) {
|
||||
/* align to a multiple of bra_block_alignment */
|
||||
if (actual_bpt_bytes < bra_block_alignment) {
|
||||
pr_err("effective bytes per frame %u is smaller than block alignment %u\n",
|
||||
actual_bpt_bytes, bra_block_alignment);
|
||||
return -EINVAL;
|
||||
}
|
||||
actual_bpt_bytes -= (actual_bpt_bytes % bra_block_alignment);
|
||||
}
|
||||
|
||||
*data_per_frame = actual_bpt_bytes;
|
||||
|
||||
if (data_bytes < actual_bpt_bytes)
|
||||
|
||||
@@ -218,6 +218,7 @@ int sdw_cdns_bpt_find_bandwidth(int command, /* 0: write, 1: read */
|
||||
int sdw_cdns_bpt_find_buffer_sizes(int command, /* 0: write, 1: read */
|
||||
int row, int col, unsigned int data_bytes,
|
||||
unsigned int requested_bytes_per_frame,
|
||||
unsigned int bra_block_alignment,
|
||||
unsigned int *data_per_frame, unsigned int *pdi0_buffer_size,
|
||||
unsigned int *pdi1_buffer_size, unsigned int *num_frames);
|
||||
|
||||
|
||||
@@ -173,6 +173,7 @@ static int intel_ace2x_bpt_open_stream(struct sdw_intel *sdw, struct sdw_slave *
|
||||
ret = sdw_cdns_bpt_find_buffer_sizes(command, cdns->bus.params.row,
|
||||
cdns->bus.params.col,
|
||||
msg->sec[i].len, SDW_BPT_MSG_MAX_BYTES,
|
||||
slave->prop.bra_block_alignment,
|
||||
&data_per_frame, &pdi0_buffer_size_,
|
||||
&pdi1_buffer_size_, &num_frames_);
|
||||
if (ret < 0)
|
||||
@@ -197,6 +198,7 @@ static int intel_ace2x_bpt_open_stream(struct sdw_intel *sdw, struct sdw_slave *
|
||||
ret = sdw_cdns_bpt_find_buffer_sizes(command, cdns->bus.params.row,
|
||||
cdns->bus.params.col,
|
||||
data_per_frame, SDW_BPT_MSG_MAX_BYTES,
|
||||
slave->prop.bra_block_alignment,
|
||||
&data_per_frame, &pdi0_buf_size_pre_frame,
|
||||
&pdi1_buf_size_pre_frame, &fake_num_frames);
|
||||
if (ret < 0)
|
||||
|
||||
Reference in New Issue
Block a user