Skip to content

Commit 283f407

Browse files
committed
soundwire: add bpt_hstop in struct sdw_bus
To allow BPT and audio stream work simultaneously, we need to record the hstop of the BPT stream. And use column bpt_hstop + 1 to the last column for audio streams. No function changed since bus->bpt_hstop is set to bus->params.col - 1 for now. Will update bus->audio_stream_hstart in the follow up commit. Signed-off-by: Bard Liao <yung-chuan.liao@linux.intel.com>
1 parent 06cf176 commit 283f407

3 files changed

Lines changed: 10 additions & 7 deletions

File tree

drivers/soundwire/generic_bandwidth_allocation.c

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -97,9 +97,9 @@ static void sdw_compute_dp0_slave_ports(struct sdw_master_runtime *m_rt)
9797
list_for_each_entry(p_rt, &s_rt->port_list, port_node) {
9898
sdw_fill_xport_params(&p_rt->transport_params, p_rt->num, false,
9999
SDW_BLK_GRP_CNT_1, bus->params.col, 0, 0, 1,
100-
bus->params.col - 1, SDW_BLK_PKG_PER_PORT, 0x0);
100+
bus->bpt_hstop, SDW_BLK_PKG_PER_PORT, 0x0);
101101

102-
sdw_fill_port_params(&p_rt->port_params, p_rt->num, bus->params.col - 1,
102+
sdw_fill_port_params(&p_rt->port_params, p_rt->num, bus->bpt_hstop,
103103
SDW_PORT_FLOW_MODE_ISOCH, SDW_PORT_DATA_MODE_NORMAL);
104104
}
105105
}
@@ -113,9 +113,9 @@ static void sdw_compute_dp0_master_ports(struct sdw_master_runtime *m_rt)
113113
list_for_each_entry(p_rt, &m_rt->port_list, port_node) {
114114
sdw_fill_xport_params(&p_rt->transport_params, p_rt->num, false,
115115
SDW_BLK_GRP_CNT_1, bus->params.col, 0, 0, 1,
116-
bus->params.col - 1, SDW_BLK_PKG_PER_PORT, 0x0);
116+
bus->bpt_hstop, SDW_BLK_PKG_PER_PORT, 0x0);
117117

118-
sdw_fill_port_params(&p_rt->port_params, p_rt->num, bus->params.col - 1,
118+
sdw_fill_port_params(&p_rt->port_params, p_rt->num, bus->bpt_hstop,
119119
SDW_PORT_FLOW_MODE_ISOCH, SDW_PORT_DATA_MODE_NORMAL);
120120
}
121121
}
@@ -695,6 +695,7 @@ int sdw_compute_params(struct sdw_bus *bus, struct sdw_stream_runtime *stream)
695695
if (ret < 0)
696696
return ret;
697697

698+
bus->bpt_hstop = bus->params.col - 1;
698699
if (stream->type == SDW_STREAM_BPT) {
699700
sdw_compute_dp0_port_params(bus);
700701
return 0;

drivers/soundwire/intel_ace2x.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ static int intel_ace2x_bpt_open_stream(struct sdw_intel *sdw, struct sdw_slave *
153153
command = (msg->flags & SDW_MSG_FLAG_WRITE) ? 0 : 1;
154154

155155
ret = sdw_cdns_bpt_find_bandwidth(command, cdns->bus.params.row,
156-
cdns->bus.params.col,
156+
cdns->bus.bpt_hstop + 1,
157157
prop->default_frame_rate,
158158
&tx_dma_bandwidth, &rx_dma_bandwidth);
159159
if (ret < 0)
@@ -166,7 +166,7 @@ static int intel_ace2x_bpt_open_stream(struct sdw_intel *sdw, struct sdw_slave *
166166
/* Add up pdi buffer size and frame numbers of each BPT sections */
167167
for (i = 0; i < msg->sections; i++) {
168168
ret = sdw_cdns_bpt_find_buffer_sizes(command, cdns->bus.params.row,
169-
cdns->bus.params.col,
169+
cdns->bus.bpt_hstop + 1,
170170
msg->sec[i].len, SDW_BPT_MSG_MAX_BYTES,
171171
&data_per_frame, &pdi0_buffer_size_,
172172
&pdi1_buffer_size_, &num_frames_);
@@ -190,7 +190,7 @@ static int intel_ace2x_bpt_open_stream(struct sdw_intel *sdw, struct sdw_slave *
190190
if (command) { /* read */
191191
/* Get buffer size of a full frame */
192192
ret = sdw_cdns_bpt_find_buffer_sizes(command, cdns->bus.params.row,
193-
cdns->bus.params.col,
193+
cdns->bus.bpt_hstop + 1,
194194
data_per_frame, SDW_BPT_MSG_MAX_BYTES,
195195
&data_per_frame, &pdi0_buf_size_pre_frame,
196196
&pdi1_buf_size_pre_frame, &fake_num_frames);

include/linux/soundwire/sdw.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -985,6 +985,7 @@ struct sdw_stream_runtime {
985985
* @stream_refcount: number of streams currently using this bus
986986
* @btp_stream_refcount: number of BTP streams currently using this bus (should
987987
* be zero or one, multiple streams per link is not supported).
988+
* @bpt_hstop: The hstop of the BPT stream.
988989
* @bpt_stream: pointer stored to handle BTP streams.
989990
* @ops: Master callback ops
990991
* @port_ops: Master port callback ops
@@ -1025,6 +1026,7 @@ struct sdw_bus {
10251026
struct sdw_bus_params params;
10261027
int stream_refcount;
10271028
int bpt_stream_refcount;
1029+
int bpt_hstop;
10281030
struct sdw_stream_runtime *bpt_stream;
10291031
const struct sdw_master_ops *ops;
10301032
const struct sdw_master_port_ops *port_ops;

0 commit comments

Comments
 (0)