linux/drivers/gpu/drm/amd/display/dc/link/link_detection.c

/*
 * Copyright 2022 Advanced Micro Devices, Inc.
 *
 * Permission is hereby granted, free of charge, to any person obtaining a
 * copy of this software and associated documentation files (the "Software"),
 * to deal in the Software without restriction, including without limitation
 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
 * and/or sell copies of the Software, and to permit persons to whom the
 * Software is furnished to do so, subject to the following conditions:
 *
 * The above copyright notice and this permission notice shall be included in
 * all copies or substantial portions of the Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
 * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
 * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
 * OTHER DEALINGS IN THE SOFTWARE.
 *
 * Authors: AMD
 *
 */

/* FILE POLICY AND INTENDED USAGE:
 * This file manages link detection states and receiver states by using various
 * link protocols. It also provides helper functions to interpret certain
 * capabilities or status based on the states it manages or retrieve them
 * directly from connected receivers.
 */

#include "link_dpms.h"
#include "link_detection.h"
#include "link_hwss.h"
#include "protocols/link_edp_panel_control.h"
#include "protocols/link_ddc.h"
#include "protocols/link_hpd.h"
#include "protocols/link_dpcd.h"
#include "protocols/link_dp_capability.h"
#include "protocols/link_dp_dpia.h"
#include "protocols/link_dp_phy.h"
#include "protocols/link_dp_training.h"
#include "protocols/link_dp_dpia_bw.h"
#include "accessories/link_dp_trace.h"

#include "link_enc_cfg.h"
#include "dm_helpers.h"
#include "clk_mgr.h"

#define DC_LOGGER
#define DC_LOGGER_INIT(logger)

#define LINK_INFO(...)
/*
 * Some receivers fail to train on first try and are good
 * on subsequent tries. 2 retries should be plenty. If we
 * don't have a successful training then we don't expect to
 * ever get one.
 */
#define LINK_TRAINING_MAX_VERIFY_RETRY

static const u8 DP_SINK_BRANCH_DEV_NAME_7580[] =;

static const u8 dp_hdmi_dongle_signature_str[] =;

static enum ddc_transaction_type get_ddc_transaction_type(enum signal_type sink_signal)
{}

static enum signal_type get_basic_signal_type(struct graphics_object_id encoder,
					      struct graphics_object_id downstream)
{}

/*
 * @brief
 * Detect output sink type
 */
static enum signal_type link_detect_sink_signal_type(struct dc_link *link,
					 enum dc_detect_reason reason)
{}

static enum signal_type decide_signal_from_strap_and_dongle_type(enum display_dongle_type dongle_type,
								 struct audio_support *audio_support)
{}

static void read_scdc_caps(struct ddc_service *ddc_service,
		struct dc_sink *sink)
{}

static bool i2c_read(
	struct ddc_service *ddc,
	uint32_t address,
	uint8_t *buffer,
	uint32_t len)
{}

enum {};

static void query_dp_dual_mode_adaptor(
	struct ddc_service *ddc,
	struct display_sink_capability *sink_cap)
{}

static enum signal_type dp_passive_dongle_detection(struct ddc_service *ddc,
						    struct display_sink_capability *sink_cap,
						    struct audio_support *audio_support)
{}

static void link_disconnect_sink(struct dc_link *link)
{}

static void link_disconnect_remap(struct dc_sink *prev_sink, struct dc_link *link)
{}

static void query_hdcp_capability(enum signal_type signal, struct dc_link *link)
{}
static void read_current_link_settings_on_detect(struct dc_link *link)
{}

static bool detect_dp(struct dc_link *link,
		      struct display_sink_capability *sink_caps,
		      enum dc_detect_reason reason)
{}

static bool is_same_edid(struct dc_edid *old_edid, struct dc_edid *new_edid)
{}

static bool wait_for_entering_dp_alt_mode(struct dc_link *link)
{}

static void apply_dpia_mst_dsc_always_on_wa(struct dc_link *link)
{}

static void revert_dpia_mst_dsc_always_on_wa(struct dc_link *link)
{}

static bool discover_dp_mst_topology(struct dc_link *link, enum dc_detect_reason reason)
{}

bool link_reset_cur_dp_mst_topology(struct dc_link *link)
{}

static bool should_prepare_phy_clocks_for_link_verification(const struct dc *dc,
		enum dc_detect_reason reason)
{}

static void prepare_phy_clocks_for_destructive_link_verification(const struct dc *dc)
{}

static void restore_phy_clocks_for_destructive_link_verification(const struct dc *dc)
{}

static void verify_link_capability_destructive(struct dc_link *link,
		struct dc_sink *sink,
		enum dc_detect_reason reason)
{}

static void verify_link_capability_non_destructive(struct dc_link *link)
{}

static bool should_verify_link_capability_destructively(struct dc_link *link,
		enum dc_detect_reason reason)
{}

static void verify_link_capability(struct dc_link *link, struct dc_sink *sink,
		enum dc_detect_reason reason)
{}

/*
 * detect_link_and_local_sink() - Detect if a sink is attached to a given link
 *
 * link->local_sink is created or destroyed as needed.
 *
 * This does not create remote sinks.
 */
static bool detect_link_and_local_sink(struct dc_link *link,
				  enum dc_detect_reason reason)
{}

/*
 * link_detect_connection_type() - Determine if there is a sink connected
 *
 * @type: Returned connection type
 * Does not detect downstream devices, such as MST sinks
 * or display connected through active dongles
 */
bool link_detect_connection_type(struct dc_link *link, enum dc_connection_type *type)
{}

bool link_detect(struct dc_link *link, enum dc_detect_reason reason)
{}

void link_clear_dprx_states(struct dc_link *link)
{}

bool link_is_hdcp14(struct dc_link *link, enum signal_type signal)
{}

bool link_is_hdcp22(struct dc_link *link, enum signal_type signal)
{}

const struct dc_link_status *link_get_status(const struct dc_link *link)
{}


static bool link_add_remote_sink_helper(struct dc_link *dc_link, struct dc_sink *sink)
{}

struct dc_sink *link_add_remote_sink(
		struct dc_link *link,
		const uint8_t *edid,
		int len,
		struct dc_sink_init_data *init_data)
{}

void link_remove_remote_sink(struct dc_link *link, struct dc_sink *sink)
{}