Lines Matching refs:m_rt
266 static int sdw_program_port_params(struct sdw_master_runtime *m_rt) in sdw_program_port_params() argument
269 struct sdw_bus *bus = m_rt->bus; in sdw_program_port_params()
274 list_for_each_entry(s_rt, &m_rt->slave_rt_list, m_rt_node) { in sdw_program_port_params()
283 list_for_each_entry(p_rt, &m_rt->port_list, port_node) { in sdw_program_port_params()
334 static int sdw_enable_disable_master_ports(struct sdw_master_runtime *m_rt, in sdw_enable_disable_master_ports() argument
339 struct sdw_bus *bus = m_rt->bus; in sdw_enable_disable_master_ports()
375 static int sdw_enable_disable_ports(struct sdw_master_runtime *m_rt, bool en) in sdw_enable_disable_ports() argument
382 list_for_each_entry(s_rt, &m_rt->slave_rt_list, m_rt_node) { in sdw_enable_disable_ports()
384 ret = sdw_enable_disable_slave_ports(m_rt->bus, s_rt, in sdw_enable_disable_ports()
392 list_for_each_entry(m_port, &m_rt->port_list, port_node) { in sdw_enable_disable_ports()
393 ret = sdw_enable_disable_master_ports(m_rt, m_port, en); in sdw_enable_disable_ports()
514 static int sdw_prep_deprep_master_ports(struct sdw_master_runtime *m_rt, in sdw_prep_deprep_master_ports() argument
519 struct sdw_bus *bus = m_rt->bus; in sdw_prep_deprep_master_ports()
549 static int sdw_prep_deprep_ports(struct sdw_master_runtime *m_rt, bool prep) in sdw_prep_deprep_ports() argument
556 list_for_each_entry(s_rt, &m_rt->slave_rt_list, m_rt_node) { in sdw_prep_deprep_ports()
558 ret = sdw_prep_deprep_slave_ports(m_rt->bus, s_rt, in sdw_prep_deprep_ports()
566 list_for_each_entry(p_rt, &m_rt->port_list, port_node) { in sdw_prep_deprep_ports()
567 ret = sdw_prep_deprep_master_ports(m_rt, p_rt, prep); in sdw_prep_deprep_ports()
583 static int sdw_notify_config(struct sdw_master_runtime *m_rt) in sdw_notify_config() argument
586 struct sdw_bus *bus = m_rt->bus; in sdw_notify_config()
596 list_for_each_entry(s_rt, &m_rt->slave_rt_list, m_rt_node) { in sdw_notify_config()
631 struct sdw_master_runtime *m_rt; in sdw_program_params() local
634 list_for_each_entry(m_rt, &bus->m_rt_list, bus_node) { in sdw_program_params()
643 m_rt->stream->state == SDW_STREAM_CONFIGURED) in sdw_program_params()
646 ret = sdw_program_port_params(m_rt); in sdw_program_params()
653 ret = sdw_notify_config(m_rt); in sdw_program_params()
661 if (m_rt->stream->state != SDW_STREAM_ENABLED) in sdw_program_params()
664 ret = sdw_enable_disable_ports(m_rt, true); in sdw_program_params()
779 struct sdw_master_runtime *m_rt; in do_bank_switch() local
788 list_for_each_entry(m_rt, &stream->master_list, stream_node) { in do_bank_switch()
789 bus = m_rt->bus; in do_bank_switch()
826 list_for_each_entry(m_rt, &stream->master_list, stream_node) { in do_bank_switch()
827 bus = m_rt->bus; in do_bank_switch()
865 list_for_each_entry(m_rt, &stream->master_list, stream_node) { in do_bank_switch()
866 bus = m_rt->bus; in do_bank_switch()
877 list_for_each_entry(m_rt, &stream->master_list, stream_node) { in do_bank_switch()
878 bus = m_rt->bus; in do_bank_switch()
929 struct sdw_master_runtime *m_rt; in sdw_slave_port_free() local
932 list_for_each_entry(m_rt, &stream->master_list, stream_node) { in sdw_slave_port_free()
933 list_for_each_entry(s_rt, &m_rt->slave_rt_list, m_rt_node) { in sdw_slave_port_free()
999 static bool sdw_master_port_allocated(struct sdw_master_runtime *m_rt) in sdw_master_port_allocated() argument
1001 return !list_empty(&m_rt->port_list); in sdw_master_port_allocated()
1004 static void sdw_master_port_free(struct sdw_master_runtime *m_rt) in sdw_master_port_free() argument
1008 list_for_each_entry_safe(p_rt, _p_rt, &m_rt->port_list, port_node) { in sdw_master_port_free()
1013 static int sdw_master_port_alloc(struct sdw_master_runtime *m_rt, in sdw_master_port_alloc() argument
1021 p_rt = sdw_port_alloc(&m_rt->port_list); in sdw_master_port_alloc()
1029 static int sdw_master_port_config(struct sdw_master_runtime *m_rt, in sdw_master_port_config() argument
1037 list_for_each_entry(p_rt, &m_rt->port_list, port_node) { in sdw_master_port_config()
1057 struct sdw_master_runtime *m_rt) in sdw_slave_rt_alloc() argument
1068 list_add_tail(&s_rt->m_rt_node, &m_rt->slave_rt_list); in sdw_slave_rt_alloc()
1094 struct sdw_master_runtime *m_rt; in sdw_slave_rt_find() local
1096 list_for_each_entry(m_rt, &stream->master_list, stream_node) { in sdw_slave_rt_find()
1099 &m_rt->slave_rt_list, m_rt_node) { in sdw_slave_rt_find()
1131 struct sdw_master_runtime *m_rt; in sdw_master_rt_find() local
1134 list_for_each_entry(m_rt, &stream->master_list, stream_node) { in sdw_master_rt_find()
1135 if (m_rt->bus == bus) in sdw_master_rt_find()
1136 return m_rt; in sdw_master_rt_find()
1154 struct sdw_master_runtime *m_rt, *walk_m_rt; in sdw_master_rt_alloc() local
1157 m_rt = kzalloc(sizeof(*m_rt), GFP_KERNEL); in sdw_master_rt_alloc()
1158 if (!m_rt) in sdw_master_rt_alloc()
1162 INIT_LIST_HEAD(&m_rt->port_list); in sdw_master_rt_alloc()
1163 INIT_LIST_HEAD(&m_rt->slave_rt_list); in sdw_master_rt_alloc()
1177 list_add(&m_rt->stream_node, insert_after); in sdw_master_rt_alloc()
1179 list_add_tail(&m_rt->bus_node, &bus->m_rt_list); in sdw_master_rt_alloc()
1181 m_rt->bus = bus; in sdw_master_rt_alloc()
1182 m_rt->stream = stream; in sdw_master_rt_alloc()
1184 return m_rt; in sdw_master_rt_alloc()
1196 static int sdw_master_rt_config(struct sdw_master_runtime *m_rt, in sdw_master_rt_config() argument
1199 m_rt->ch_count = stream_config->ch_count; in sdw_master_rt_config()
1200 m_rt->direction = stream_config->direction; in sdw_master_rt_config()
1216 static void sdw_master_rt_free(struct sdw_master_runtime *m_rt, in sdw_master_rt_free() argument
1221 list_for_each_entry_safe(s_rt, _s_rt, &m_rt->slave_rt_list, m_rt_node) { in sdw_master_rt_free()
1226 list_del(&m_rt->stream_node); in sdw_master_rt_free()
1227 list_del(&m_rt->bus_node); in sdw_master_rt_free()
1228 kfree(m_rt); in sdw_master_rt_free()
1320 struct sdw_master_runtime *m_rt; in sdw_acquire_bus_lock() local
1324 list_for_each_entry(m_rt, &stream->master_list, stream_node) { in sdw_acquire_bus_lock()
1325 bus = m_rt->bus; in sdw_acquire_bus_lock()
1342 struct sdw_master_runtime *m_rt; in sdw_release_bus_lock() local
1346 list_for_each_entry_reverse(m_rt, &stream->master_list, stream_node) { in sdw_release_bus_lock()
1347 bus = m_rt->bus; in sdw_release_bus_lock()
1355 struct sdw_master_runtime *m_rt; in _sdw_prepare_stream() local
1362 list_for_each_entry(m_rt, &stream->master_list, stream_node) { in _sdw_prepare_stream()
1363 bus = m_rt->bus; in _sdw_prepare_stream()
1376 bus->params.bandwidth += m_rt->stream->params.rate * in _sdw_prepare_stream()
1377 m_rt->ch_count * m_rt->stream->params.bps; in _sdw_prepare_stream()
1404 list_for_each_entry(m_rt, &stream->master_list, stream_node) { in _sdw_prepare_stream()
1405 bus = m_rt->bus; in _sdw_prepare_stream()
1408 ret = sdw_prep_deprep_ports(m_rt, true); in _sdw_prepare_stream()
1477 struct sdw_master_runtime *m_rt; in _sdw_enable_stream() local
1482 list_for_each_entry(m_rt, &stream->master_list, stream_node) { in _sdw_enable_stream()
1483 bus = m_rt->bus; in _sdw_enable_stream()
1493 ret = sdw_enable_disable_ports(m_rt, true); in _sdw_enable_stream()
1552 struct sdw_master_runtime *m_rt; in _sdw_disable_stream() local
1555 list_for_each_entry(m_rt, &stream->master_list, stream_node) { in _sdw_disable_stream()
1556 struct sdw_bus *bus = m_rt->bus; in _sdw_disable_stream()
1559 ret = sdw_enable_disable_ports(m_rt, false); in _sdw_disable_stream()
1567 list_for_each_entry(m_rt, &stream->master_list, stream_node) { in _sdw_disable_stream()
1568 struct sdw_bus *bus = m_rt->bus; in _sdw_disable_stream()
1585 list_for_each_entry(m_rt, &stream->master_list, stream_node) { in _sdw_disable_stream()
1586 struct sdw_bus *bus = m_rt->bus; in _sdw_disable_stream()
1589 ret = sdw_enable_disable_ports(m_rt, false); in _sdw_disable_stream()
1639 struct sdw_master_runtime *m_rt; in _sdw_deprepare_stream() local
1643 list_for_each_entry(m_rt, &stream->master_list, stream_node) { in _sdw_deprepare_stream()
1644 bus = m_rt->bus; in _sdw_deprepare_stream()
1646 ret = sdw_prep_deprep_ports(m_rt, false); in _sdw_deprepare_stream()
1654 bus->params.bandwidth -= m_rt->stream->params.rate * in _sdw_deprepare_stream()
1655 m_rt->ch_count * m_rt->stream->params.bps; in _sdw_deprepare_stream()
1869 struct sdw_master_runtime *m_rt; in sdw_stream_add_master() local
1891 m_rt = sdw_master_rt_find(bus, stream); in sdw_stream_add_master()
1892 if (!m_rt) { in sdw_stream_add_master()
1893 m_rt = sdw_master_rt_alloc(bus, stream); in sdw_stream_add_master()
1894 if (!m_rt) { in sdw_stream_add_master()
1904 if (!sdw_master_port_allocated(m_rt)) { in sdw_stream_add_master()
1905 ret = sdw_master_port_alloc(m_rt, num_ports); in sdw_stream_add_master()
1912 ret = sdw_master_rt_config(m_rt, stream_config); in sdw_stream_add_master()
1920 ret = sdw_master_port_config(m_rt, port_config); in sdw_stream_add_master()
1929 sdw_master_rt_free(m_rt, stream); in sdw_stream_add_master()
1947 struct sdw_master_runtime *m_rt, *_m_rt; in sdw_stream_remove_master() local
1951 list_for_each_entry_safe(m_rt, _m_rt, in sdw_stream_remove_master()
1953 if (m_rt->bus != bus) in sdw_stream_remove_master()
1956 sdw_master_port_free(m_rt); in sdw_stream_remove_master()
1957 sdw_master_rt_free(m_rt, stream); in sdw_stream_remove_master()
1990 struct sdw_master_runtime *m_rt; in sdw_stream_add_slave() local
2002 m_rt = sdw_master_rt_find(slave->bus, stream); in sdw_stream_add_slave()
2003 if (!m_rt) { in sdw_stream_add_slave()
2008 m_rt = sdw_master_rt_alloc(slave->bus, stream); in sdw_stream_add_slave()
2009 if (!m_rt) { in sdw_stream_add_slave()
2021 s_rt = sdw_slave_rt_alloc(slave, m_rt); in sdw_stream_add_slave()
2038 ret = sdw_master_rt_config(m_rt, stream_config); in sdw_stream_add_slave()
2070 sdw_master_rt_free(m_rt, stream); in sdw_stream_add_slave()