Lines Matching +full:col +full:- +full:offset
1 // SPDX-License-Identifier: (GPL-2.0-only OR BSD-3-Clause)
2 // Copyright(c) 2015-2020 Intel Corporation.
46 struct sdw_bus_params *b_params = &m_rt->bus->params; in sdw_compute_slave_ports()
48 port_bo = t_data->block_offset; in sdw_compute_slave_ports()
50 list_for_each_entry(s_rt, &m_rt->slave_rt_list, m_rt_node) { in sdw_compute_slave_ports()
51 rate = m_rt->stream->params.rate; in sdw_compute_slave_ports()
52 bps = m_rt->stream->params.bps; in sdw_compute_slave_ports()
53 sample_int = (m_rt->bus->params.curr_dr_freq / rate); in sdw_compute_slave_ports()
56 list_for_each_entry(p_rt, &s_rt->port_list, port_node) { in sdw_compute_slave_ports()
57 ch = sdw_ch_mask_to_ch(p_rt->ch_mask); in sdw_compute_slave_ports()
59 sdw_fill_xport_params(&p_rt->transport_params, in sdw_compute_slave_ports()
60 p_rt->num, false, in sdw_compute_slave_ports()
63 t_data->hstart, in sdw_compute_slave_ports()
64 t_data->hstop, in sdw_compute_slave_ports()
67 sdw_fill_port_params(&p_rt->port_params, in sdw_compute_slave_ports()
68 p_rt->num, bps, in sdw_compute_slave_ports()
70 b_params->s_data_mode); in sdw_compute_slave_ports()
76 if (m_rt->direction == SDW_DATA_DIR_TX && in sdw_compute_slave_ports()
77 m_rt->ch_count == slave_total_ch) { in sdw_compute_slave_ports()
81 * 'mirror mode'. Make sure we reset the port offset for in sdw_compute_slave_ports()
84 port_bo = t_data->block_offset; in sdw_compute_slave_ports()
95 struct sdw_bus *bus = m_rt->bus; in sdw_compute_master_ports()
96 struct sdw_bus_params *b_params = &bus->params; in sdw_compute_master_ports()
100 rate = m_rt->stream->params.rate; in sdw_compute_master_ports()
101 bps = m_rt->stream->params.bps; in sdw_compute_master_ports()
102 ch = m_rt->ch_count; in sdw_compute_master_ports()
103 sample_int = (bus->params.curr_dr_freq / rate); in sdw_compute_master_ports()
105 if (rate != params->rate) in sdw_compute_master_ports()
109 hstart = hstop - params->hwidth + 1; in sdw_compute_master_ports()
112 list_for_each_entry(p_rt, &m_rt->port_list, port_node) { in sdw_compute_master_ports()
114 sdw_fill_xport_params(&p_rt->transport_params, p_rt->num, in sdw_compute_master_ports()
119 sdw_fill_port_params(&p_rt->port_params, in sdw_compute_master_ports()
120 p_rt->num, bps, in sdw_compute_master_ports()
122 b_params->m_data_mode); in sdw_compute_master_ports()
125 if (!(p_rt == list_first_entry(&m_rt->port_list, in sdw_compute_master_ports()
146 int hstop = bus->params.col - 1; in _sdw_compute_port_params()
154 list_for_each_entry(m_rt, &bus->m_rt_list, bus_node) { in _sdw_compute_port_params()
158 block_offset += m_rt->ch_count * in _sdw_compute_port_params()
159 m_rt->stream->params.bps; in _sdw_compute_port_params()
163 hstop = hstop - params[i].hwidth; in _sdw_compute_port_params()
172 int sel_col = bus->params.col; in sdw_compute_group_params()
179 params[i].full_bw = bus->params.curr_dr_freq / params[i].rate; in sdw_compute_group_params()
182 list_for_each_entry(m_rt, &bus->m_rt_list, bus_node) { in sdw_compute_group_params()
183 rate = m_rt->stream->params.rate; in sdw_compute_group_params()
184 bps = m_rt->stream->params.bps; in sdw_compute_group_params()
185 ch = m_rt->ch_count; in sdw_compute_group_params()
195 params[i].payload_bw + params[i].full_bw - 1) / in sdw_compute_group_params()
201 if (column_needed > sel_col - 1) in sdw_compute_group_params()
202 return -EINVAL; in sdw_compute_group_params()
210 int num = group->count; in sdw_add_element_group_count()
214 if (rate == group->rates[i]) in sdw_add_element_group_count()
220 if (group->count >= group->max_size) { in sdw_add_element_group_count()
223 group->max_size += 1; in sdw_add_element_group_count()
224 rates = krealloc(group->rates, in sdw_add_element_group_count()
225 (sizeof(int) * group->max_size), in sdw_add_element_group_count()
228 return -ENOMEM; in sdw_add_element_group_count()
229 group->rates = rates; in sdw_add_element_group_count()
232 group->rates[group->count++] = rate; in sdw_add_element_group_count()
245 group->count = 0; in sdw_get_group_count()
246 group->max_size = SDW_STRM_RATE_GROUPING; in sdw_get_group_count()
247 group->rates = kcalloc(group->max_size, sizeof(int), GFP_KERNEL); in sdw_get_group_count()
248 if (!group->rates) in sdw_get_group_count()
249 return -ENOMEM; in sdw_get_group_count()
251 list_for_each_entry(m_rt, &bus->m_rt_list, bus_node) { in sdw_get_group_count()
252 rate = m_rt->stream->params.rate; in sdw_get_group_count()
253 if (m_rt == list_first_entry(&bus->m_rt_list, in sdw_get_group_count()
256 group->rates[group->count++] = rate; in sdw_get_group_count()
261 kfree(group->rates); in sdw_get_group_count()
290 ret = -ENOMEM; in sdw_compute_port_params()
312 struct sdw_master_prop *prop = &bus->prop; in sdw_select_row_col()
318 if (sdw_rows[r] != prop->default_row || in sdw_select_row_col()
319 sdw_cols[c] != prop->default_col) in sdw_select_row_col()
325 if ((clk_freq - (frame_freq * SDW_FRAME_CTRL_BITS)) < in sdw_select_row_col()
326 bus->params.bandwidth) in sdw_select_row_col()
329 bus->params.row = sdw_rows[r]; in sdw_select_row_col()
330 bus->params.col = sdw_cols[c]; in sdw_select_row_col()
335 return -EINVAL; in sdw_select_row_col()
346 struct sdw_master_prop *mstr_prop = &bus->prop; in sdw_compute_bus_params()
351 if (mstr_prop->num_clk_gears) { in sdw_compute_bus_params()
352 clk_values = mstr_prop->num_clk_gears; in sdw_compute_bus_params()
353 clk_buf = mstr_prop->clk_gears; in sdw_compute_bus_params()
355 } else if (mstr_prop->num_clk_freq) { in sdw_compute_bus_params()
356 clk_values = mstr_prop->num_clk_freq; in sdw_compute_bus_params()
357 clk_buf = mstr_prop->clk_freq; in sdw_compute_bus_params()
363 max_dr_freq = mstr_prop->max_clk_freq * SDW_DOUBLE_RATE_FACTOR; in sdw_compute_bus_params()
373 if (curr_dr_freq <= bus->params.bandwidth) in sdw_compute_bus_params()
386 dev_err(bus->dev, "%s: could not find clock value for bandwidth %d\n", in sdw_compute_bus_params()
387 __func__, bus->params.bandwidth); in sdw_compute_bus_params()
388 return -EINVAL; in sdw_compute_bus_params()
393 dev_err(bus->dev, "%s: could not find frame configuration for bus dr_freq %d\n", in sdw_compute_bus_params()
395 return -EINVAL; in sdw_compute_bus_params()
398 bus->params.curr_dr_freq = curr_dr_freq; in sdw_compute_bus_params()
419 dev_err(bus->dev, "Compute transport params failed: %d\n", ret); in sdw_compute_params()