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.
40 struct sdw_bus_params *b_params = &m_rt->bus->params; in sdw_compute_slave_ports()
42 port_bo = t_data->block_offset; in sdw_compute_slave_ports()
44 list_for_each_entry(s_rt, &m_rt->slave_rt_list, m_rt_node) { in sdw_compute_slave_ports()
45 rate = m_rt->stream->params.rate; in sdw_compute_slave_ports()
46 bps = m_rt->stream->params.bps; in sdw_compute_slave_ports()
47 sample_int = (m_rt->bus->params.curr_dr_freq / rate); in sdw_compute_slave_ports()
50 list_for_each_entry(p_rt, &s_rt->port_list, port_node) { in sdw_compute_slave_ports()
51 ch = hweight32(p_rt->ch_mask); in sdw_compute_slave_ports()
53 sdw_fill_xport_params(&p_rt->transport_params, in sdw_compute_slave_ports()
54 p_rt->num, false, in sdw_compute_slave_ports()
57 t_data->hstart, in sdw_compute_slave_ports()
58 t_data->hstop, in sdw_compute_slave_ports()
61 sdw_fill_port_params(&p_rt->port_params, in sdw_compute_slave_ports()
62 p_rt->num, bps, in sdw_compute_slave_ports()
64 b_params->s_data_mode); in sdw_compute_slave_ports()
70 if (m_rt->direction == SDW_DATA_DIR_TX && in sdw_compute_slave_ports()
71 m_rt->ch_count == slave_total_ch) { in sdw_compute_slave_ports()
75 * 'mirror mode'. Make sure we reset the port offset for in sdw_compute_slave_ports()
78 port_bo = t_data->block_offset; in sdw_compute_slave_ports()
90 struct sdw_bus *bus = m_rt->bus; in sdw_compute_master_ports()
91 struct sdw_bus_params *b_params = &bus->params; in sdw_compute_master_ports()
95 rate = m_rt->stream->params.rate; in sdw_compute_master_ports()
96 bps = m_rt->stream->params.bps; in sdw_compute_master_ports()
97 ch = m_rt->ch_count; in sdw_compute_master_ports()
98 sample_int = (bus->params.curr_dr_freq / rate); in sdw_compute_master_ports()
100 if (rate != params->rate) in sdw_compute_master_ports()
104 hstart = hstop - params->hwidth + 1; in sdw_compute_master_ports()
107 list_for_each_entry(p_rt, &m_rt->port_list, port_node) { in sdw_compute_master_ports()
109 sdw_fill_xport_params(&p_rt->transport_params, p_rt->num, in sdw_compute_master_ports()
114 sdw_fill_port_params(&p_rt->port_params, in sdw_compute_master_ports()
115 p_rt->num, bps, in sdw_compute_master_ports()
117 b_params->m_data_mode); in sdw_compute_master_ports()
120 if (!(p_rt == list_first_entry(&m_rt->port_list, in sdw_compute_master_ports()
141 int hstop = bus->params.col - 1; in _sdw_compute_port_params()
148 list_for_each_entry(m_rt, &bus->m_rt_list, bus_node) { in _sdw_compute_port_params()
152 hstop = hstop - params[i].hwidth; in _sdw_compute_port_params()
161 int sel_col = bus->params.col; in sdw_compute_group_params()
168 params[i].full_bw = bus->params.curr_dr_freq / params[i].rate; in sdw_compute_group_params()
171 list_for_each_entry(m_rt, &bus->m_rt_list, bus_node) { in sdw_compute_group_params()
172 rate = m_rt->stream->params.rate; in sdw_compute_group_params()
173 bps = m_rt->stream->params.bps; in sdw_compute_group_params()
174 ch = m_rt->ch_count; in sdw_compute_group_params()
184 params[i].payload_bw + params[i].full_bw - 1) / in sdw_compute_group_params()
190 if (column_needed > sel_col - 1) in sdw_compute_group_params()
191 return -EINVAL; in sdw_compute_group_params()
199 int num = group->count; in sdw_add_element_group_count()
203 if (rate == group->rates[i]) in sdw_add_element_group_count()
209 if (group->count >= group->max_size) { in sdw_add_element_group_count()
212 group->max_size += 1; in sdw_add_element_group_count()
213 rates = krealloc(group->rates, in sdw_add_element_group_count()
214 (sizeof(int) * group->max_size), in sdw_add_element_group_count()
217 return -ENOMEM; in sdw_add_element_group_count()
218 group->rates = rates; in sdw_add_element_group_count()
221 group->rates[group->count++] = rate; in sdw_add_element_group_count()
234 group->count = 0; in sdw_get_group_count()
235 group->max_size = SDW_STRM_RATE_GROUPING; in sdw_get_group_count()
236 group->rates = kcalloc(group->max_size, sizeof(int), GFP_KERNEL); in sdw_get_group_count()
237 if (!group->rates) in sdw_get_group_count()
238 return -ENOMEM; in sdw_get_group_count()
240 list_for_each_entry(m_rt, &bus->m_rt_list, bus_node) { in sdw_get_group_count()
241 rate = m_rt->stream->params.rate; in sdw_get_group_count()
242 if (m_rt == list_first_entry(&bus->m_rt_list, in sdw_get_group_count()
245 group->rates[group->count++] = rate; in sdw_get_group_count()
250 kfree(group->rates); in sdw_get_group_count()
279 ret = -ENOMEM; in sdw_compute_port_params()
301 struct sdw_master_prop *prop = &bus->prop; in sdw_select_row_col()
307 if (sdw_rows[r] != prop->default_row || in sdw_select_row_col()
308 sdw_cols[c] != prop->default_col) in sdw_select_row_col()
314 if ((clk_freq - (frame_freq * SDW_FRAME_CTRL_BITS)) < in sdw_select_row_col()
315 bus->params.bandwidth) in sdw_select_row_col()
318 bus->params.row = sdw_rows[r]; in sdw_select_row_col()
319 bus->params.col = sdw_cols[c]; in sdw_select_row_col()
324 return -EINVAL; in sdw_select_row_col()
335 struct sdw_master_prop *mstr_prop = &bus->prop; in sdw_compute_bus_params()
340 if (mstr_prop->num_clk_gears) { in sdw_compute_bus_params()
341 clk_values = mstr_prop->num_clk_gears; in sdw_compute_bus_params()
342 clk_buf = mstr_prop->clk_gears; in sdw_compute_bus_params()
344 } else if (mstr_prop->num_clk_freq) { in sdw_compute_bus_params()
345 clk_values = mstr_prop->num_clk_freq; in sdw_compute_bus_params()
346 clk_buf = mstr_prop->clk_freq; in sdw_compute_bus_params()
354 curr_dr_freq = bus->params.max_dr_freq; in sdw_compute_bus_params()
357 (bus->params.max_dr_freq >> clk_buf[i]) : in sdw_compute_bus_params()
360 if (curr_dr_freq <= bus->params.bandwidth) in sdw_compute_bus_params()
373 dev_err(bus->dev, "%s: could not find clock value for bandwidth %d\n", in sdw_compute_bus_params()
374 __func__, bus->params.bandwidth); in sdw_compute_bus_params()
375 return -EINVAL; in sdw_compute_bus_params()
380 dev_err(bus->dev, "%s: could not find frame configuration for bus dr_freq %d\n", in sdw_compute_bus_params()
382 return -EINVAL; in sdw_compute_bus_params()
385 bus->params.curr_dr_freq = curr_dr_freq; in sdw_compute_bus_params()
406 dev_err(bus->dev, "Compute transport params failed: %d\n", ret); in sdw_compute_params()