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()
1186 return m_rt; in sdw_master_rt_alloc()
1198 static int sdw_master_rt_config(struct sdw_master_runtime *m_rt, in sdw_master_rt_config() argument
1201 m_rt->ch_count = stream_config->ch_count; in sdw_master_rt_config()
1202 m_rt->direction = stream_config->direction; in sdw_master_rt_config()
1218 static void sdw_master_rt_free(struct sdw_master_runtime *m_rt, in sdw_master_rt_free() argument
1222 struct sdw_bus *bus = m_rt->bus; in sdw_master_rt_free()
1224 list_for_each_entry_safe(s_rt, _s_rt, &m_rt->slave_rt_list, m_rt_node) { in sdw_master_rt_free()
1229 list_del(&m_rt->stream_node); in sdw_master_rt_free()
1230 list_del(&m_rt->bus_node); in sdw_master_rt_free()
1231 kfree(m_rt); in sdw_master_rt_free()
1325 struct sdw_master_runtime *m_rt; in sdw_acquire_bus_lock() local
1329 list_for_each_entry(m_rt, &stream->master_list, stream_node) { in sdw_acquire_bus_lock()
1330 bus = m_rt->bus; in sdw_acquire_bus_lock()
1347 struct sdw_master_runtime *m_rt; in sdw_release_bus_lock() local
1351 list_for_each_entry_reverse(m_rt, &stream->master_list, stream_node) { in sdw_release_bus_lock()
1352 bus = m_rt->bus; in sdw_release_bus_lock()
1360 struct sdw_master_runtime *m_rt; in _sdw_prepare_stream() local
1367 list_for_each_entry(m_rt, &stream->master_list, stream_node) { in _sdw_prepare_stream()
1368 bus = m_rt->bus; in _sdw_prepare_stream()
1381 bus->params.bandwidth += m_rt->stream->params.rate * in _sdw_prepare_stream()
1382 m_rt->ch_count * m_rt->stream->params.bps; in _sdw_prepare_stream()
1409 list_for_each_entry(m_rt, &stream->master_list, stream_node) { in _sdw_prepare_stream()
1410 bus = m_rt->bus; in _sdw_prepare_stream()
1413 ret = sdw_prep_deprep_ports(m_rt, true); in _sdw_prepare_stream()
1482 struct sdw_master_runtime *m_rt; in _sdw_enable_stream() local
1487 list_for_each_entry(m_rt, &stream->master_list, stream_node) { in _sdw_enable_stream()
1488 bus = m_rt->bus; in _sdw_enable_stream()
1498 ret = sdw_enable_disable_ports(m_rt, true); in _sdw_enable_stream()
1557 struct sdw_master_runtime *m_rt; in _sdw_disable_stream() local
1560 list_for_each_entry(m_rt, &stream->master_list, stream_node) { in _sdw_disable_stream()
1561 struct sdw_bus *bus = m_rt->bus; in _sdw_disable_stream()
1564 ret = sdw_enable_disable_ports(m_rt, false); in _sdw_disable_stream()
1572 list_for_each_entry(m_rt, &stream->master_list, stream_node) { in _sdw_disable_stream()
1573 struct sdw_bus *bus = m_rt->bus; in _sdw_disable_stream()
1590 list_for_each_entry(m_rt, &stream->master_list, stream_node) { in _sdw_disable_stream()
1591 struct sdw_bus *bus = m_rt->bus; in _sdw_disable_stream()
1594 ret = sdw_enable_disable_ports(m_rt, false); in _sdw_disable_stream()
1644 struct sdw_master_runtime *m_rt; in _sdw_deprepare_stream() local
1648 list_for_each_entry(m_rt, &stream->master_list, stream_node) { in _sdw_deprepare_stream()
1649 bus = m_rt->bus; in _sdw_deprepare_stream()
1651 ret = sdw_prep_deprep_ports(m_rt, false); in _sdw_deprepare_stream()
1659 bus->params.bandwidth -= m_rt->stream->params.rate * in _sdw_deprepare_stream()
1660 m_rt->ch_count * m_rt->stream->params.bps; in _sdw_deprepare_stream()
1874 struct sdw_master_runtime *m_rt; in sdw_stream_add_master() local
1896 m_rt = sdw_master_rt_find(bus, stream); in sdw_stream_add_master()
1897 if (!m_rt) { in sdw_stream_add_master()
1898 m_rt = sdw_master_rt_alloc(bus, stream); in sdw_stream_add_master()
1899 if (!m_rt) { in sdw_stream_add_master()
1909 if (!sdw_master_port_allocated(m_rt)) { in sdw_stream_add_master()
1910 ret = sdw_master_port_alloc(m_rt, num_ports); in sdw_stream_add_master()
1917 ret = sdw_master_rt_config(m_rt, stream_config); in sdw_stream_add_master()
1925 ret = sdw_master_port_config(m_rt, port_config); in sdw_stream_add_master()
1934 sdw_master_rt_free(m_rt, stream); in sdw_stream_add_master()
1952 struct sdw_master_runtime *m_rt, *_m_rt; in sdw_stream_remove_master() local
1956 list_for_each_entry_safe(m_rt, _m_rt, in sdw_stream_remove_master()
1958 if (m_rt->bus != bus) in sdw_stream_remove_master()
1961 sdw_master_port_free(m_rt); in sdw_stream_remove_master()
1962 sdw_master_rt_free(m_rt, stream); in sdw_stream_remove_master()
1995 struct sdw_master_runtime *m_rt; in sdw_stream_add_slave() local
2007 m_rt = sdw_master_rt_find(slave->bus, stream); in sdw_stream_add_slave()
2008 if (!m_rt) { in sdw_stream_add_slave()
2013 m_rt = sdw_master_rt_alloc(slave->bus, stream); in sdw_stream_add_slave()
2014 if (!m_rt) { in sdw_stream_add_slave()
2026 s_rt = sdw_slave_rt_alloc(slave, m_rt); in sdw_stream_add_slave()
2043 ret = sdw_master_rt_config(m_rt, stream_config); in sdw_stream_add_slave()
2075 sdw_master_rt_free(m_rt, stream); in sdw_stream_add_slave()