#ifndef _DRM_DP_MST_HELPER_H_
#define _DRM_DP_MST_HELPER_H_
#include <linux/types.h>
#include <drm/display/drm_dp_helper.h>
#include <drm/drm_atomic.h>
#include <drm/drm_fixed.h>
#if IS_ENABLED(CONFIG_DRM_DEBUG_DP_MST_TOPOLOGY_REFS)
#include <linux/stackdepot.h>
#include <linux/timekeeping.h>
enum drm_dp_mst_topology_ref_type { … };
struct drm_dp_mst_topology_ref_history { … };
#endif
enum drm_dp_mst_payload_allocation { … };
struct drm_dp_mst_branch;
struct drm_dp_mst_port { … };
struct drm_dp_sideband_msg_hdr { … };
struct drm_dp_sideband_msg_rx { … };
struct drm_dp_mst_branch { … };
struct drm_dp_nak_reply { … };
struct drm_dp_link_address_ack_reply { … };
struct drm_dp_remote_dpcd_read_ack_reply { … };
struct drm_dp_remote_dpcd_write_ack_reply { … };
struct drm_dp_remote_dpcd_write_nak_reply { … };
struct drm_dp_remote_i2c_read_ack_reply { … };
struct drm_dp_remote_i2c_read_nak_reply { … };
struct drm_dp_remote_i2c_write_ack_reply { … };
struct drm_dp_query_stream_enc_status_ack_reply { … };
#define DRM_DP_MAX_SDP_STREAMS …
struct drm_dp_allocate_payload { … };
struct drm_dp_allocate_payload_ack_reply { … };
struct drm_dp_connection_status_notify { … };
struct drm_dp_remote_dpcd_read { … };
struct drm_dp_remote_dpcd_write { … };
#define DP_REMOTE_I2C_READ_MAX_TRANSACTIONS …
struct drm_dp_remote_i2c_read { … };
struct drm_dp_remote_i2c_write { … };
struct drm_dp_query_stream_enc_status { … };
struct drm_dp_port_number_req { … };
struct drm_dp_enum_path_resources_ack_reply { … };
struct drm_dp_port_number_rep { … };
struct drm_dp_query_payload { … };
struct drm_dp_resource_status_notify { … };
struct drm_dp_query_payload_ack_reply { … };
struct drm_dp_sideband_msg_req_body { … };
struct drm_dp_sideband_msg_reply_body { … };
#define DRM_DP_SIDEBAND_TX_QUEUED …
#define DRM_DP_SIDEBAND_TX_START_SEND …
#define DRM_DP_SIDEBAND_TX_SENT …
#define DRM_DP_SIDEBAND_TX_RX …
#define DRM_DP_SIDEBAND_TX_TIMEOUT …
struct drm_dp_sideband_msg_tx { … };
struct drm_dp_mst_topology_mgr;
struct drm_dp_mst_topology_cbs { … };
#define to_dp_mst_topology_state(x) …
struct drm_dp_mst_atomic_payload { … };
struct drm_dp_mst_topology_state { … };
#define to_dp_mst_topology_mgr(x) …
struct drm_dp_mst_topology_mgr { … };
int drm_dp_mst_topology_mgr_init(struct drm_dp_mst_topology_mgr *mgr,
struct drm_device *dev, struct drm_dp_aux *aux,
int max_dpcd_transaction_bytes,
int max_payloads, int conn_base_id);
void drm_dp_mst_topology_mgr_destroy(struct drm_dp_mst_topology_mgr *mgr);
enum drm_dp_mst_mode { … };
enum drm_dp_mst_mode drm_dp_read_mst_cap(struct drm_dp_aux *aux, const u8 dpcd[DP_RECEIVER_CAP_SIZE]);
int drm_dp_mst_topology_mgr_set_mst(struct drm_dp_mst_topology_mgr *mgr, bool mst_state);
int drm_dp_mst_hpd_irq_handle_event(struct drm_dp_mst_topology_mgr *mgr,
const u8 *esi,
u8 *ack,
bool *handled);
void drm_dp_mst_hpd_irq_send_new_request(struct drm_dp_mst_topology_mgr *mgr);
int
drm_dp_mst_detect_port(struct drm_connector *connector,
struct drm_modeset_acquire_ctx *ctx,
struct drm_dp_mst_topology_mgr *mgr,
struct drm_dp_mst_port *port);
const struct drm_edid *drm_dp_mst_edid_read(struct drm_connector *connector,
struct drm_dp_mst_topology_mgr *mgr,
struct drm_dp_mst_port *port);
struct edid *drm_dp_mst_get_edid(struct drm_connector *connector,
struct drm_dp_mst_topology_mgr *mgr,
struct drm_dp_mst_port *port);
fixed20_12 drm_dp_get_vc_payload_bw(const struct drm_dp_mst_topology_mgr *mgr,
int link_rate, int link_lane_count);
int drm_dp_calc_pbn_mode(int clock, int bpp);
void drm_dp_mst_update_slots(struct drm_dp_mst_topology_state *mst_state, uint8_t link_encoding_cap);
int drm_dp_add_payload_part1(struct drm_dp_mst_topology_mgr *mgr,
struct drm_dp_mst_topology_state *mst_state,
struct drm_dp_mst_atomic_payload *payload);
int drm_dp_add_payload_part2(struct drm_dp_mst_topology_mgr *mgr,
struct drm_dp_mst_atomic_payload *payload);
void drm_dp_remove_payload_part1(struct drm_dp_mst_topology_mgr *mgr,
struct drm_dp_mst_topology_state *mst_state,
struct drm_dp_mst_atomic_payload *payload);
void drm_dp_remove_payload_part2(struct drm_dp_mst_topology_mgr *mgr,
struct drm_dp_mst_topology_state *mst_state,
const struct drm_dp_mst_atomic_payload *old_payload,
struct drm_dp_mst_atomic_payload *new_payload);
int drm_dp_check_act_status(struct drm_dp_mst_topology_mgr *mgr);
void drm_dp_mst_dump_topology(struct seq_file *m,
struct drm_dp_mst_topology_mgr *mgr);
void drm_dp_mst_topology_mgr_suspend(struct drm_dp_mst_topology_mgr *mgr);
int __must_check
drm_dp_mst_topology_mgr_resume(struct drm_dp_mst_topology_mgr *mgr,
bool sync);
ssize_t drm_dp_mst_dpcd_read(struct drm_dp_aux *aux,
unsigned int offset, void *buffer, size_t size);
ssize_t drm_dp_mst_dpcd_write(struct drm_dp_aux *aux,
unsigned int offset, void *buffer, size_t size);
int drm_dp_mst_connector_late_register(struct drm_connector *connector,
struct drm_dp_mst_port *port);
void drm_dp_mst_connector_early_unregister(struct drm_connector *connector,
struct drm_dp_mst_port *port);
struct drm_dp_mst_topology_state *
drm_atomic_get_mst_topology_state(struct drm_atomic_state *state,
struct drm_dp_mst_topology_mgr *mgr);
struct drm_dp_mst_topology_state *
drm_atomic_get_old_mst_topology_state(struct drm_atomic_state *state,
struct drm_dp_mst_topology_mgr *mgr);
struct drm_dp_mst_topology_state *
drm_atomic_get_new_mst_topology_state(struct drm_atomic_state *state,
struct drm_dp_mst_topology_mgr *mgr);
struct drm_dp_mst_atomic_payload *
drm_atomic_get_mst_payload_state(struct drm_dp_mst_topology_state *state,
struct drm_dp_mst_port *port);
bool drm_dp_mst_port_downstream_of_parent(struct drm_dp_mst_topology_mgr *mgr,
struct drm_dp_mst_port *port,
struct drm_dp_mst_port *parent);
int __must_check
drm_dp_atomic_find_time_slots(struct drm_atomic_state *state,
struct drm_dp_mst_topology_mgr *mgr,
struct drm_dp_mst_port *port, int pbn);
int drm_dp_mst_atomic_enable_dsc(struct drm_atomic_state *state,
struct drm_dp_mst_port *port,
int pbn, bool enable);
int __must_check
drm_dp_mst_add_affected_dsc_crtcs(struct drm_atomic_state *state,
struct drm_dp_mst_topology_mgr *mgr);
int __must_check
drm_dp_atomic_release_time_slots(struct drm_atomic_state *state,
struct drm_dp_mst_topology_mgr *mgr,
struct drm_dp_mst_port *port);
void drm_dp_mst_atomic_wait_for_dependencies(struct drm_atomic_state *state);
int __must_check drm_dp_mst_atomic_setup_commit(struct drm_atomic_state *state);
int drm_dp_send_power_updown_phy(struct drm_dp_mst_topology_mgr *mgr,
struct drm_dp_mst_port *port, bool power_up);
int drm_dp_send_query_stream_enc_status(struct drm_dp_mst_topology_mgr *mgr,
struct drm_dp_mst_port *port,
struct drm_dp_query_stream_enc_status_ack_reply *status);
int __must_check drm_dp_mst_atomic_check_mgr(struct drm_atomic_state *state,
struct drm_dp_mst_topology_mgr *mgr,
struct drm_dp_mst_topology_state *mst_state,
struct drm_dp_mst_port **failing_port);
int __must_check drm_dp_mst_atomic_check(struct drm_atomic_state *state);
int __must_check drm_dp_mst_root_conn_atomic_check(struct drm_connector_state *new_conn_state,
struct drm_dp_mst_topology_mgr *mgr);
void drm_dp_mst_get_port_malloc(struct drm_dp_mst_port *port);
void drm_dp_mst_put_port_malloc(struct drm_dp_mst_port *port);
static inline
bool drm_dp_mst_port_is_logical(struct drm_dp_mst_port *port)
{ … }
struct drm_dp_aux *drm_dp_mst_aux_for_parent(struct drm_dp_mst_port *port);
struct drm_dp_aux *drm_dp_mst_dsc_aux_for_port(struct drm_dp_mst_port *port);
static inline struct drm_dp_mst_topology_state *
to_drm_dp_mst_topology_state(struct drm_private_state *state)
{ … }
extern const struct drm_private_state_funcs drm_dp_mst_topology_state_funcs;
static inline bool
__drm_dp_mst_state_iter_get(struct drm_atomic_state *state,
struct drm_dp_mst_topology_mgr **mgr,
struct drm_dp_mst_topology_state **old_state,
struct drm_dp_mst_topology_state **new_state,
int i)
{ … }
#define for_each_oldnew_mst_mgr_in_state(__state, mgr, old_state, new_state, __i) …
#define for_each_old_mst_mgr_in_state(__state, mgr, old_state, __i) …
#define for_each_new_mst_mgr_in_state(__state, mgr, new_state, __i) …
#endif