Lines Matching refs:tunnel_state

1383 	struct drm_dp_tunnel_state *tunnel_state;  in add_tunnel_state()  local
1389 tunnel_state = kzalloc(sizeof(*tunnel_state), GFP_KERNEL); in add_tunnel_state()
1390 if (!tunnel_state) in add_tunnel_state()
1393 tunnel_state->group_state = group_state; in add_tunnel_state()
1395 drm_dp_tunnel_ref_get(tunnel, &tunnel_state->tunnel_ref); in add_tunnel_state()
1397 INIT_LIST_HEAD(&tunnel_state->node); in add_tunnel_state()
1398 list_add(&tunnel_state->node, &group_state->tunnel_states); in add_tunnel_state()
1400 return tunnel_state; in add_tunnel_state()
1403 static void free_tunnel_state(struct drm_dp_tunnel_state *tunnel_state) in free_tunnel_state() argument
1405 tun_dbg_atomic(tunnel_state->tunnel_ref.tunnel, in free_tunnel_state()
1407 tunnel_state->tunnel_ref.tunnel); in free_tunnel_state()
1409 list_del(&tunnel_state->node); in free_tunnel_state()
1411 kfree(tunnel_state->stream_bw); in free_tunnel_state()
1412 drm_dp_tunnel_ref_put(&tunnel_state->tunnel_ref); in free_tunnel_state()
1414 kfree(tunnel_state); in free_tunnel_state()
1419 struct drm_dp_tunnel_state *tunnel_state; in free_group_state() local
1422 for_each_tunnel_state_safe(group_state, tunnel_state, tunnel_state_tmp) in free_group_state()
1423 free_tunnel_state(tunnel_state); in free_group_state()
1432 struct drm_dp_tunnel_state *tunnel_state; in get_tunnel_state() local
1434 for_each_tunnel_state(group_state, tunnel_state) in get_tunnel_state()
1435 if (tunnel_state->tunnel_ref.tunnel == tunnel) in get_tunnel_state()
1436 return tunnel_state; in get_tunnel_state()
1445 struct drm_dp_tunnel_state *tunnel_state; in get_or_add_tunnel_state() local
1447 tunnel_state = get_tunnel_state(group_state, tunnel); in get_or_add_tunnel_state()
1448 if (tunnel_state) in get_or_add_tunnel_state()
1449 return tunnel_state; in get_or_add_tunnel_state()
1458 struct drm_dp_tunnel_state *tunnel_state; in tunnel_group_duplicate_state() local
1468 for_each_tunnel_state(to_group_state(obj->state), tunnel_state) { in tunnel_group_duplicate_state()
1472 tunnel_state->tunnel_ref.tunnel); in tunnel_group_duplicate_state()
1476 new_tunnel_state->stream_mask = tunnel_state->stream_mask; in tunnel_group_duplicate_state()
1477 new_tunnel_state->stream_bw = kmemdup(tunnel_state->stream_bw, in tunnel_group_duplicate_state()
1478 sizeof(*tunnel_state->stream_bw) * in tunnel_group_duplicate_state()
1479 hweight32(tunnel_state->stream_mask), in tunnel_group_duplicate_state()
1519 struct drm_dp_tunnel_state *tunnel_state; in drm_dp_tunnel_atomic_get_state() local
1525 tunnel_state = get_or_add_tunnel_state(group_state, tunnel); in drm_dp_tunnel_atomic_get_state()
1526 if (!tunnel_state) in drm_dp_tunnel_atomic_get_state()
1529 return tunnel_state; in drm_dp_tunnel_atomic_get_state()
1609 const struct drm_dp_tunnel_state *tunnel_state; in check_unique_stream_ids() local
1612 for_each_tunnel_state(group_state, tunnel_state) { in check_unique_stream_ids()
1614 tunnel_state->stream_mask & stream_mask, in check_unique_stream_ids()
1616 tunnel_state->tunnel_ref.tunnel->name, in check_unique_stream_ids()
1617 tunnel_state->stream_mask, in check_unique_stream_ids()
1620 stream_mask |= tunnel_state->stream_mask; in check_unique_stream_ids()
1634 static int resize_bw_array(struct drm_dp_tunnel_state *tunnel_state, in resize_bw_array() argument
1652 tunnel_state->stream_bw[stream_id_to_idx(old_mask, id)]; in resize_bw_array()
1654 kfree(tunnel_state->stream_bw); in resize_bw_array()
1655 tunnel_state->stream_bw = new_bws; in resize_bw_array()
1656 tunnel_state->stream_mask = new_mask; in resize_bw_array()
1661 static int set_stream_bw(struct drm_dp_tunnel_state *tunnel_state, in set_stream_bw() argument
1666 err = resize_bw_array(tunnel_state, in set_stream_bw()
1667 tunnel_state->stream_mask, in set_stream_bw()
1668 tunnel_state->stream_mask | BIT(stream_id)); in set_stream_bw()
1672 tunnel_state->stream_bw[stream_id_to_idx(tunnel_state->stream_mask, stream_id)] = bw; in set_stream_bw()
1677 static int clear_stream_bw(struct drm_dp_tunnel_state *tunnel_state, in clear_stream_bw() argument
1680 if (!(tunnel_state->stream_mask & ~BIT(stream_id))) { in clear_stream_bw()
1681 free_tunnel_state(tunnel_state); in clear_stream_bw()
1685 return resize_bw_array(tunnel_state, in clear_stream_bw()
1686 tunnel_state->stream_mask, in clear_stream_bw()
1687 tunnel_state->stream_mask & ~BIT(stream_id)); in clear_stream_bw()
1706 struct drm_dp_tunnel_state *tunnel_state; in drm_dp_tunnel_atomic_set_stream_bw() local
1710 stream_id > BITS_PER_TYPE(tunnel_state->stream_mask))) in drm_dp_tunnel_atomic_set_stream_bw()
1722 tunnel_state = get_tunnel_state(new_group_state, tunnel); in drm_dp_tunnel_atomic_set_stream_bw()
1723 if (!tunnel_state) in drm_dp_tunnel_atomic_set_stream_bw()
1726 return clear_stream_bw(tunnel_state, stream_id); in drm_dp_tunnel_atomic_set_stream_bw()
1729 tunnel_state = get_or_add_tunnel_state(new_group_state, tunnel); in drm_dp_tunnel_atomic_set_stream_bw()
1730 if (drm_WARN_ON(state->dev, !tunnel_state)) in drm_dp_tunnel_atomic_set_stream_bw()
1733 err = set_stream_bw(tunnel_state, stream_id, bw); in drm_dp_tunnel_atomic_set_stream_bw()
1752 int drm_dp_tunnel_atomic_get_required_bw(const struct drm_dp_tunnel_state *tunnel_state) in drm_dp_tunnel_atomic_get_required_bw() argument
1757 if (!tunnel_state || !tunnel_state->stream_mask) in drm_dp_tunnel_atomic_get_required_bw()
1760 for (i = 0; i < hweight32(tunnel_state->stream_mask); i++) in drm_dp_tunnel_atomic_get_required_bw()
1761 tunnel_bw += tunnel_state->stream_bw[i]; in drm_dp_tunnel_atomic_get_required_bw()
1783 struct drm_dp_tunnel_state *tunnel_state; in drm_dp_tunnel_atomic_get_group_streams_in_state() local
1790 for_each_tunnel_state(group_state, tunnel_state) in drm_dp_tunnel_atomic_get_group_streams_in_state()
1791 *stream_mask |= tunnel_state->stream_mask; in drm_dp_tunnel_atomic_get_group_streams_in_state()