Skip to content

Commit 53ca2ed

Browse files
ShawnCLeejnikula
authored andcommitted
drm: Change limited M/N quirk to constant N quirk.
Some DP dongles in particular seem to be fussy about too large link M/N values. Set specific value for N divider can resolve this issue per dongle vendor's comment. So configure N as constant value (0x8000) to instead of reduce M/N formula when specific DP dongle connected. v2: add more comments for issue description and fix typo. v3: add lost commit messages back for version 2 v4: send patch to both intel-gfx and dri-devel Cc: Jani Nikula <jani.nikula@intel.com> Cc: Cooper Chiou <cooper.chiou@intel.com> Cc: Matt Atwood <matthew.s.atwood@intel.com> Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com> Cc: Dhinakaran Pandiyan <dhinakaran.pandiyan@intel.com> Cc: Clint Taylor <clinton.a.taylor@intel.com> Tested-by: Clint Taylor <clinton.a.taylor@intel.com> Signed-off-by: Lee, Shawn C <shawn.c.lee@intel.com> Signed-off-by: Jani Nikula <jani.nikula@intel.com> Link: https://patchwork.freedesktop.org/patch/msgid/1536733371-25004-3-git-send-email-shawn.c.lee@intel.com
1 parent 0b49bbb commit 53ca2ed

File tree

6 files changed

+25
-27
lines changed

6 files changed

+25
-27
lines changed

drivers/gpu/drm/drm_dp_helper.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1270,7 +1270,7 @@ struct dpcd_quirk {
12701270

12711271
static const struct dpcd_quirk dpcd_quirk_list[] = {
12721272
/* Analogix 7737 needs reduced M and N at HBR2 link rates */
1273-
{ OUI(0x00, 0x22, 0xb9), DEVICE_ID_ANY, true, BIT(DP_DPCD_QUIRK_LIMITED_M_N) },
1273+
{ OUI(0x00, 0x22, 0xb9), DEVICE_ID_ANY, true, BIT(DP_DPCD_QUIRK_CONSTANT_N) },
12741274
};
12751275

12761276
#undef OUI

drivers/gpu/drm/i915/intel_display.c

Lines changed: 13 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -6677,22 +6677,20 @@ intel_reduce_m_n_ratio(uint32_t *num, uint32_t *den)
66776677

66786678
static void compute_m_n(unsigned int m, unsigned int n,
66796679
uint32_t *ret_m, uint32_t *ret_n,
6680-
bool reduce_m_n)
6680+
bool constant_n)
66816681
{
66826682
/*
6683-
* Reduce M/N as much as possible without loss in precision. Several DP
6684-
* dongles in particular seem to be fussy about too large *link* M/N
6685-
* values. The passed in values are more likely to have the least
6686-
* significant bits zero than M after rounding below, so do this first.
6683+
* Several DP dongles in particular seem to be fussy about
6684+
* too large link M/N values. Give N value as 0x8000 that
6685+
* should be acceptable by specific devices. 0x8000 is the
6686+
* specified fixed N value for asynchronous clock mode,
6687+
* which the devices expect also in synchronous clock mode.
66876688
*/
6688-
if (reduce_m_n) {
6689-
while ((m & 1) == 0 && (n & 1) == 0) {
6690-
m >>= 1;
6691-
n >>= 1;
6692-
}
6693-
}
6689+
if (constant_n)
6690+
*ret_n = 0x8000;
6691+
else
6692+
*ret_n = min_t(unsigned int, roundup_pow_of_two(n), DATA_LINK_N_MAX);
66946693

6695-
*ret_n = min_t(unsigned int, roundup_pow_of_two(n), DATA_LINK_N_MAX);
66966694
*ret_m = div_u64((uint64_t) m * *ret_n, n);
66976695
intel_reduce_m_n_ratio(ret_m, ret_n);
66986696
}
@@ -6701,18 +6699,18 @@ void
67016699
intel_link_compute_m_n(int bits_per_pixel, int nlanes,
67026700
int pixel_clock, int link_clock,
67036701
struct intel_link_m_n *m_n,
6704-
bool reduce_m_n)
6702+
bool constant_n)
67056703
{
67066704
m_n->tu = 64;
67076705

67086706
compute_m_n(bits_per_pixel * pixel_clock,
67096707
link_clock * nlanes * 8,
67106708
&m_n->gmch_m, &m_n->gmch_n,
6711-
reduce_m_n);
6709+
constant_n);
67126710

67136711
compute_m_n(pixel_clock, link_clock,
67146712
&m_n->link_m, &m_n->link_n,
6715-
reduce_m_n);
6713+
constant_n);
67166714
}
67176715

67186716
static inline bool intel_panel_use_ssc(struct drm_i915_private *dev_priv)

drivers/gpu/drm/i915/intel_display.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -382,6 +382,6 @@ struct intel_link_m_n {
382382
void intel_link_compute_m_n(int bpp, int nlanes,
383383
int pixel_clock, int link_clock,
384384
struct intel_link_m_n *m_n,
385-
bool reduce_m_n);
385+
bool constant_n);
386386

387387
#endif

drivers/gpu/drm/i915/intel_dp.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1834,8 +1834,8 @@ intel_dp_compute_config(struct intel_encoder *encoder,
18341834
struct intel_connector *intel_connector = intel_dp->attached_connector;
18351835
struct intel_digital_connector_state *intel_conn_state =
18361836
to_intel_digital_connector_state(conn_state);
1837-
bool reduce_m_n = drm_dp_has_quirk(&intel_dp->desc,
1838-
DP_DPCD_QUIRK_LIMITED_M_N);
1837+
bool constant_n = drm_dp_has_quirk(&intel_dp->desc,
1838+
DP_DPCD_QUIRK_CONSTANT_N);
18391839

18401840
if (HAS_PCH_SPLIT(dev_priv) && !HAS_DDI(dev_priv) && port != PORT_A)
18411841
pipe_config->has_pch_encoder = true;
@@ -1900,7 +1900,7 @@ intel_dp_compute_config(struct intel_encoder *encoder,
19001900
adjusted_mode->crtc_clock,
19011901
pipe_config->port_clock,
19021902
&pipe_config->dp_m_n,
1903-
reduce_m_n);
1903+
constant_n);
19041904

19051905
if (intel_connector->panel.downclock_mode != NULL &&
19061906
dev_priv->drrs.type == SEAMLESS_DRRS_SUPPORT) {
@@ -1910,7 +1910,7 @@ intel_dp_compute_config(struct intel_encoder *encoder,
19101910
intel_connector->panel.downclock_mode->clock,
19111911
pipe_config->port_clock,
19121912
&pipe_config->dp_m2_n2,
1913-
reduce_m_n);
1913+
constant_n);
19141914
}
19151915

19161916
if (!HAS_DDI(dev_priv))

drivers/gpu/drm/i915/intel_dp_mst.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,8 @@ static bool intel_dp_mst_compute_config(struct intel_encoder *encoder,
4545
int lane_count, slots;
4646
const struct drm_display_mode *adjusted_mode = &pipe_config->base.adjusted_mode;
4747
int mst_pbn;
48-
bool reduce_m_n = drm_dp_has_quirk(&intel_dp->desc,
49-
DP_DPCD_QUIRK_LIMITED_M_N);
48+
bool constant_n = drm_dp_has_quirk(&intel_dp->desc,
49+
DP_DPCD_QUIRK_CONSTANT_N);
5050

5151
if (adjusted_mode->flags & DRM_MODE_FLAG_DBLSCAN)
5252
return false;
@@ -87,7 +87,7 @@ static bool intel_dp_mst_compute_config(struct intel_encoder *encoder,
8787
adjusted_mode->crtc_clock,
8888
pipe_config->port_clock,
8989
&pipe_config->dp_m_n,
90-
reduce_m_n);
90+
constant_n);
9191

9292
pipe_config->dp_m_n.tu = slots;
9393

include/drm/drm_dp_helper.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1261,12 +1261,12 @@ int drm_dp_read_desc(struct drm_dp_aux *aux, struct drm_dp_desc *desc,
12611261
*/
12621262
enum drm_dp_quirk {
12631263
/**
1264-
* @DP_DPCD_QUIRK_LIMITED_M_N:
1264+
* @DP_DPCD_QUIRK_CONSTANT_N:
12651265
*
12661266
* The device requires main link attributes Mvid and Nvid to be limited
1267-
* to 16 bits.
1267+
* to 16 bits. So will give a constant value (0x8000) for compatability.
12681268
*/
1269-
DP_DPCD_QUIRK_LIMITED_M_N,
1269+
DP_DPCD_QUIRK_CONSTANT_N,
12701270
};
12711271

12721272
/**

0 commit comments

Comments
 (0)