File Index
Files and directories
Sign in
FILE

link_dp_dpia_bw.h

File preview with syntax highlighting.

linux-6.19.14/drivers/gpu/drm/amd/display/dc/link/protocols/link_dp_dpia_bw.h C
  1/*
  2 * Copyright 2021 Advanced Micro Devices, Inc.
  3 *
  4 * Permission is hereby granted, free of charge, to any person obtaining a
  5 * copy of this software and associated documentation files (the "Software"),
  6 * to deal in the Software without restriction, including without limitation
  7 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
  8 * and/or sell copies of the Software, and to permit persons to whom the
  9 * Software is furnished to do so, subject to the following conditions:
 10 *
 11 * The above copyright notice and this permission notice shall be included in
 12 * all copies or substantial portions of the Software.
 13 *
 14 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 15 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 16 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
 17 * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
 18 * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
 19 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
 20 * OTHER DEALINGS IN THE SOFTWARE.
 21 *
 22 * Authors: AMD
 23 *
 24 */
 25
 26#ifndef DC_INC_LINK_DP_DPIA_BW_H_
 27#define DC_INC_LINK_DP_DPIA_BW_H_
 28
 29#include "link_service.h"
 30
 31
 32/*
 33 * Host Router BW type
 34 */
 35enum bw_type {
 36	HOST_ROUTER_BW_ESTIMATED,
 37	HOST_ROUTER_BW_ALLOCATED,
 38	HOST_ROUTER_BW_INVALID,
 39};
 40
 41struct usb4_router_validation_set {
 42	bool is_valid;
 43	uint8_t cm_id;
 44	uint8_t dpia_count;
 45	uint32_t required_bw;
 46	uint32_t allocated_bw;
 47	uint32_t estimated_bw;
 48	uint32_t remaining_bw;
 49};
 50
 51/*
 52 * Enable USB4 DP BW allocation mode
 53 *
 54 * @link: pointer to the dc_link struct instance
 55 *
 56 * return: SUCCESS or FAILURE
 57 */
 58bool link_dpia_enable_usb4_dp_bw_alloc_mode(struct dc_link *link);
 59
 60/*
 61 * Allocates only what the stream needs for bw, so if:
 62 * If (stream_req_bw < or > already_allocated_bw_at_HPD)
 63 * => Deallocate Max Bw & then allocate only what the stream needs
 64 *
 65 * @link: pointer to the dc_link struct instance
 66 * @req_bw: Bw requested by the stream
 67 *
 68 */
 69void link_dp_dpia_allocate_usb4_bandwidth_for_stream(struct dc_link *link, int req_bw);
 70
 71/*
 72 * Handle the USB4 BW Allocation related functionality here:
 73 * Plug => Try to allocate max bw from timing parameters supported by the sink
 74 * Unplug => de-allocate bw
 75 *
 76 * @link: pointer to the dc_link struct instance
 77 * @peak_bw: Peak bw used by the link/sink
 78 *
 79 */
 80void dpia_handle_usb4_bandwidth_allocation_for_link(struct dc_link *link, int peak_bw);
 81
 82/*
 83 * Obtain all the DP overheads in dp tunneling for the dpia link
 84 *
 85 * @link: pointer to the dc_link struct instance
 86 *
 87 * return: DP overheads in DP tunneling
 88 */
 89uint32_t link_dpia_get_dp_overhead(const struct dc_link *link);
 90
 91/*
 92 * Handle DP BW allocation status register
 93 *
 94 * @link: pointer to the dc_link struct instance
 95 * @status: content of DP tunneling status register
 96 *
 97 * return: none
 98 */
 99void link_dp_dpia_handle_bw_alloc_status(struct dc_link *link, uint8_t status);
100
101/*
102 * Aggregates the DPIA bandwidth usage for the respective USB4 Router.
103 *
104 * @dc_validation_dpia_set: pointer to the dc_validation_dpia_set
105 * @count: number of DPIA validation sets
106 *
107 * return: true if validation is succeeded
108 */
109bool link_dpia_validate_dp_tunnel_bandwidth(const struct dc_validation_dpia_set *dpia_link_sets, uint8_t count);
110
111#endif /* DC_INC_LINK_DP_DPIA_BW_H_ */
112
~/ Read-only file preview.