#define pr_fmt(fmt) …
#include <linux/types.h>
#include <linux/completion.h>
#include <linux/delay.h>
#include <linux/phy/phy.h>
#include <linux/phy/phy-dp.h>
#include <linux/pm_opp.h>
#include <drm/display/drm_dp_helper.h>
#include <drm/drm_fixed.h>
#include <drm/drm_print.h>
#include "dp_reg.h"
#include "dp_ctrl.h"
#include "dp_link.h"
#define DP_KHZ_TO_HZ …
#define IDLE_PATTERN_COMPLETION_TIMEOUT_JIFFIES …
#define PSR_OPERATION_COMPLETION_TIMEOUT_JIFFIES …
#define WAIT_FOR_VIDEO_READY_TIMEOUT_JIFFIES …
#define DP_CTRL_INTR_READY_FOR_VIDEO …
#define DP_CTRL_INTR_IDLE_PATTERN_SENT …
#define MR_LINK_TRAINING1 …
#define MR_LINK_SYMBOL_ERM …
#define MR_LINK_PRBS7 …
#define MR_LINK_CUSTOM80 …
#define MR_LINK_TRAINING4 …
enum { … };
struct dp_tu_calc_input { … };
struct dp_vc_tu_mapping_table { … };
struct dp_ctrl_private { … };
static int dp_aux_link_configure(struct drm_dp_aux *aux,
struct dp_link_info *link)
{ … }
void dp_ctrl_push_idle(struct dp_ctrl *dp_ctrl)
{ … }
static void dp_ctrl_config_ctrl(struct dp_ctrl_private *ctrl)
{ … }
static void dp_ctrl_configure_source_params(struct dp_ctrl_private *ctrl)
{ … }
struct tu_algo_data { … };
static int _tu_param_compare(s64 a, s64 b)
{ … }
static void dp_panel_update_tu_timings(struct dp_tu_calc_input *in,
struct tu_algo_data *tu)
{ … }
static void _tu_valid_boundary_calc(struct tu_algo_data *tu)
{ … }
static void _dp_ctrl_calc_tu(struct dp_ctrl_private *ctrl,
struct dp_tu_calc_input *in,
struct dp_vc_tu_mapping_table *tu_table)
{ … }
static void dp_ctrl_calc_tu_parameters(struct dp_ctrl_private *ctrl,
struct dp_vc_tu_mapping_table *tu_table)
{ … }
static void dp_ctrl_setup_tr_unit(struct dp_ctrl_private *ctrl)
{ … }
static int dp_ctrl_wait4video_ready(struct dp_ctrl_private *ctrl)
{ … }
static int dp_ctrl_set_vx_px(struct dp_ctrl_private *ctrl,
u8 v_level, u8 p_level)
{ … }
static int dp_ctrl_update_vx_px(struct dp_ctrl_private *ctrl)
{ … }
static bool dp_ctrl_train_pattern_set(struct dp_ctrl_private *ctrl,
u8 pattern)
{ … }
static int dp_ctrl_read_link_status(struct dp_ctrl_private *ctrl,
u8 *link_status)
{ … }
static int dp_ctrl_link_train_1(struct dp_ctrl_private *ctrl,
int *training_step)
{ … }
static int dp_ctrl_link_rate_down_shift(struct dp_ctrl_private *ctrl)
{ … }
static int dp_ctrl_link_lane_down_shift(struct dp_ctrl_private *ctrl)
{ … }
static void dp_ctrl_clear_training_pattern(struct dp_ctrl_private *ctrl)
{ … }
static int dp_ctrl_link_train_2(struct dp_ctrl_private *ctrl,
int *training_step)
{ … }
static int dp_ctrl_link_train(struct dp_ctrl_private *ctrl,
int *training_step)
{ … }
static int dp_ctrl_setup_main_link(struct dp_ctrl_private *ctrl,
int *training_step)
{ … }
int dp_ctrl_core_clk_enable(struct dp_ctrl *dp_ctrl)
{ … }
void dp_ctrl_core_clk_disable(struct dp_ctrl *dp_ctrl)
{ … }
static int dp_ctrl_link_clk_enable(struct dp_ctrl *dp_ctrl)
{ … }
static void dp_ctrl_link_clk_disable(struct dp_ctrl *dp_ctrl)
{ … }
static int dp_ctrl_enable_mainlink_clocks(struct dp_ctrl_private *ctrl)
{ … }
void dp_ctrl_reset_irq_ctrl(struct dp_ctrl *dp_ctrl, bool enable)
{ … }
void dp_ctrl_config_psr(struct dp_ctrl *dp_ctrl)
{ … }
void dp_ctrl_set_psr(struct dp_ctrl *dp_ctrl, bool enter)
{ … }
void dp_ctrl_phy_init(struct dp_ctrl *dp_ctrl)
{ … }
void dp_ctrl_phy_exit(struct dp_ctrl *dp_ctrl)
{ … }
static int dp_ctrl_reinitialize_mainlink(struct dp_ctrl_private *ctrl)
{ … }
static int dp_ctrl_deinitialize_mainlink(struct dp_ctrl_private *ctrl)
{ … }
static int dp_ctrl_link_maintenance(struct dp_ctrl_private *ctrl)
{ … }
static bool dp_ctrl_send_phy_test_pattern(struct dp_ctrl_private *ctrl)
{ … }
static int dp_ctrl_process_phy_test_request(struct dp_ctrl_private *ctrl)
{ … }
void dp_ctrl_handle_sink_request(struct dp_ctrl *dp_ctrl)
{ … }
static bool dp_ctrl_clock_recovery_any_ok(
const u8 link_status[DP_LINK_STATUS_SIZE],
int lane_count)
{ … }
static bool dp_ctrl_channel_eq_ok(struct dp_ctrl_private *ctrl)
{ … }
int dp_ctrl_on_link(struct dp_ctrl *dp_ctrl)
{ … }
static int dp_ctrl_link_retrain(struct dp_ctrl_private *ctrl)
{ … }
int dp_ctrl_on_stream(struct dp_ctrl *dp_ctrl, bool force_link_train)
{ … }
void dp_ctrl_off_link_stream(struct dp_ctrl *dp_ctrl)
{ … }
void dp_ctrl_off_link(struct dp_ctrl *dp_ctrl)
{ … }
void dp_ctrl_off(struct dp_ctrl *dp_ctrl)
{ … }
irqreturn_t dp_ctrl_isr(struct dp_ctrl *dp_ctrl)
{ … }
static const char *core_clks[] = …;
static const char *ctrl_clks[] = …;
static int dp_ctrl_clk_init(struct dp_ctrl *dp_ctrl)
{ … }
struct dp_ctrl *dp_ctrl_get(struct device *dev, struct dp_link *link,
struct dp_panel *panel, struct drm_dp_aux *aux,
struct dp_catalog *catalog,
struct phy *phy)
{ … }