disp: msm: dp: add support for voltage swing level 3

Currently, the max voltage swing supported is level 2. This change
adds support for voltage swing level 3 in the dp driver.

Change-Id: Idf1dbb4e74edff924067130a5edea869f392bf38
Signed-off-by: Sudarsan Ramesh <sudarame@codeaurora.org>
This commit is contained in:
Sudarsan Ramesh
2021-05-12 16:03:52 -04:00
parent 72f7dfe428
commit 71a264056d
4 changed files with 30 additions and 16 deletions

View File

@@ -198,12 +198,12 @@ static int dp_ctrl_update_sink_vx_px(struct dp_ctrl_private *ctrl)
u8 size = min_t(u8, sizeof(buf), ctrl->link->link_params.lane_count);
u32 max_level_reached = 0;
if (v_level == DP_LINK_VOLTAGE_MAX) {
if (v_level == ctrl->link->phy_params.max_v_level) {
DP_DEBUG("max voltage swing level reached %d\n", v_level);
max_level_reached |= DP_TRAIN_MAX_SWING_REACHED;
}
if (p_level == DP_LINK_PRE_EMPHASIS_MAX) {
if (p_level == ctrl->link->phy_params.max_p_level) {
DP_DEBUG("max pre-emphasis level reached %d\n", p_level);
max_level_reached |= DP_TRAIN_MAX_PRE_EMPHASIS_REACHED;
}
@@ -374,7 +374,7 @@ static int dp_ctrl_link_training_1(struct dp_ctrl_private *ctrl)
else
break;
if (ctrl->link->phy_params.v_level == DP_LINK_VOLTAGE_MAX) {
if (ctrl->link->phy_params.v_level == ctrl->link->phy_params.max_v_level) {
pr_err_ratelimited("max v_level reached\n");
break;
}

View File

@@ -1890,6 +1890,7 @@ static void dp_display_deinit_sub_modules(struct dp_display_private *dp)
static int dp_init_sub_modules(struct dp_display_private *dp)
{
int rc = 0;
u32 dp_core_revision = 0;
bool hdcp_disabled;
struct device *dev = &dp->pdev->dev;
struct dp_hpd_cb *cb = &dp->hpd_cb;
@@ -1933,6 +1934,8 @@ static int dp_init_sub_modules(struct dp_display_private *dp)
goto error_catalog;
}
dp_core_revision = dp_catalog_get_dp_core_version(dp->catalog);
dp->aux = dp_aux_get(dev, &dp->catalog->aux, dp->parser,
dp->aux_switch_node, dp->aux_bridge);
if (IS_ERR(dp->aux)) {
@@ -1950,7 +1953,7 @@ static int dp_init_sub_modules(struct dp_display_private *dp)
pll_in.aux = dp->aux;
pll_in.parser = dp->parser;
pll_in.dp_core_revision = dp_catalog_get_dp_core_version(dp->catalog);
pll_in.dp_core_revision = dp_core_revision;
dp->pll = dp_pll_get(&pll_in);
if (IS_ERR(dp->pll)) {
@@ -1982,7 +1985,7 @@ static int dp_init_sub_modules(struct dp_display_private *dp)
goto error_link;
}
dp->link = dp_link_get(dev, dp->aux);
dp->link = dp_link_get(dev, dp->aux, dp_core_revision);
if (IS_ERR(dp->link)) {
rc = PTR_ERR(dp->link);
DP_ERR("failed to initialize link, rc = %d\n", rc);

View File

@@ -1,6 +1,6 @@
// SPDX-License-Identifier: GPL-2.0-only
/*
* Copyright (c) 2012-2020, The Linux Foundation. All rights reserved.
* Copyright (c) 2012-2021, The Linux Foundation. All rights reserved.
*
* Copyright (c) 2009 Keith Packard
*
@@ -1427,15 +1427,18 @@ static int dp_link_adjust_levels(struct dp_link *dp_link, u8 *link_status)
print_hex_dump_debug("[drm-dp] Req (VxPx): ",
DUMP_PREFIX_NONE, 8, 2, buf, sizeof(buf), false);
DP_DEBUG("Current (VxPx): 0x%x, 0x%x\n",
dp_link->phy_params.v_level, dp_link->phy_params.p_level);
/**
* Adjust the voltage swing and pre-emphasis level combination to within
* the allowable range.
*/
if (dp_link->phy_params.v_level > DP_LINK_VOLTAGE_MAX)
dp_link->phy_params.v_level = DP_LINK_VOLTAGE_MAX;
if (dp_link->phy_params.v_level > dp_link->phy_params.max_v_level)
dp_link->phy_params.v_level = dp_link->phy_params.max_v_level;
if (dp_link->phy_params.p_level > DP_LINK_PRE_EMPHASIS_MAX)
dp_link->phy_params.p_level = DP_LINK_PRE_EMPHASIS_MAX;
if (dp_link->phy_params.p_level > dp_link->phy_params.max_p_level)
dp_link->phy_params.p_level = dp_link->phy_params.max_p_level;
if ((dp_link->phy_params.p_level > DP_LINK_PRE_EMPHASIS_LEVEL_1)
&& (dp_link->phy_params.v_level == DP_LINK_VOLTAGE_LEVEL_2))
@@ -1445,7 +1448,7 @@ static int dp_link_adjust_levels(struct dp_link *dp_link, u8 *link_status)
&& (dp_link->phy_params.v_level == DP_LINK_VOLTAGE_LEVEL_1))
dp_link->phy_params.p_level = DP_LINK_PRE_EMPHASIS_LEVEL_2;
DP_DEBUG("Set (VxPx): %x%x\n",
DP_DEBUG("Set (VxPx): 0x%x, 0x%x\n",
dp_link->phy_params.v_level, dp_link->phy_params.p_level);
return 0;
@@ -1619,7 +1622,7 @@ int dp_link_configure(struct drm_dp_aux *aux, struct drm_dp_link *link)
return 0;
}
struct dp_link *dp_link_get(struct device *dev, struct dp_aux *aux)
struct dp_link *dp_link_get(struct device *dev, struct dp_aux *aux, u32 dp_core_revision)
{
int rc = 0;
struct dp_link_private *link;
@@ -1642,6 +1645,13 @@ struct dp_link *dp_link_get(struct device *dev, struct dp_aux *aux)
dp_link = &link->dp_link;
if (dp_core_revision >= 0x10020003)
dp_link->phy_params.max_v_level = DP_LINK_VOLTAGE_LEVEL_3;
else
dp_link->phy_params.max_v_level = DP_LINK_VOLTAGE_LEVEL_2;
dp_link->phy_params.max_p_level = DP_LINK_PRE_EMPHASIS_LEVEL_3;
dp_link->process_request = dp_link_process_request;
dp_link->get_test_bits_depth = dp_link_get_test_bits_depth;
dp_link->get_colorimetry_config = dp_link_get_colorimetry_config;

View File

@@ -1,6 +1,6 @@
/* SPDX-License-Identifier: GPL-2.0-only */
/*
* Copyright (c) 2012-2019, The Linux Foundation. All rights reserved.
* Copyright (c) 2012-2021, The Linux Foundation. All rights reserved.
*
* Copyright (c) 2008 Keith Packard
*
@@ -55,7 +55,7 @@ enum dp_link_voltage_level {
DP_LINK_VOLTAGE_LEVEL_0,
DP_LINK_VOLTAGE_LEVEL_1,
DP_LINK_VOLTAGE_LEVEL_2,
DP_LINK_VOLTAGE_MAX = DP_LINK_VOLTAGE_LEVEL_2,
DP_LINK_VOLTAGE_LEVEL_3,
};
enum dp_link_preemaphasis_level {
@@ -63,7 +63,6 @@ enum dp_link_preemaphasis_level {
DP_LINK_PRE_EMPHASIS_LEVEL_1,
DP_LINK_PRE_EMPHASIS_LEVEL_2,
DP_LINK_PRE_EMPHASIS_LEVEL_3,
DP_LINK_PRE_EMPHASIS_MAX = DP_LINK_PRE_EMPHASIS_LEVEL_3,
};
struct dp_link_sink_count {
@@ -112,6 +111,8 @@ struct dp_link_phy_params {
u32 phy_test_pattern_sel;
u8 v_level;
u8 p_level;
u8 max_v_level;
u8 max_p_level;
};
struct dp_link_params {
@@ -232,7 +233,7 @@ static inline u32 dp_link_bit_depth_to_bpp(u32 tbd)
*
* return: a pointer to dp_link struct
*/
struct dp_link *dp_link_get(struct device *dev, struct dp_aux *aux);
struct dp_link *dp_link_get(struct device *dev, struct dp_aux *aux, u32 dp_core_revision);
/**
* dp_link_put() - releases the dp test module's resources