[Intel-gfx] [PATCH v3 2/2] drm/i915/tgl: Fix the read of the DDI that transcoder is attached to

Lucas De Marchi lucas.demarchi at intel.com
Mon Aug 5 22:57:39 UTC 2019


On Fri, Aug 02, 2019 at 02:59:03PM -0700, Jose Souza wrote:
>On TGL this register do not map directly to port, it was already
>handled when setting it(TGL_TRANS_DDI_SELECT_PORT()) but not when
>reading it.
>
>v2:
>Adding TGL_PORT_TRANS_DDI_SELECT() so all future users can reuse it
>(Lucas)
>
>v3: Missed parentheses arround val (Jose)
>
>Cc: Lucas De Marchi <lucas.demarchi at intel.com>
>Signed-off-by: José Roberto de Souza <jose.souza at intel.com>
>---
> drivers/gpu/drm/i915/display/intel_display.c | 3 +--
> drivers/gpu/drm/i915/i915_reg.h              | 1 +
> 2 files changed, 2 insertions(+), 2 deletions(-)
>
>diff --git a/drivers/gpu/drm/i915/display/intel_display.c b/drivers/gpu/drm/i915/display/intel_display.c
>index 9e4ee29fd0fc..68e5d8a9c23d 100644
>--- a/drivers/gpu/drm/i915/display/intel_display.c
>+++ b/drivers/gpu/drm/i915/display/intel_display.c
>@@ -10354,8 +10354,7 @@ static void haswell_get_ddi_port_state(struct intel_crtc *crtc,
> 	tmp = I915_READ(TRANS_DDI_FUNC_CTL(pipe_config->cpu_transcoder));
>
> 	if (INTEL_GEN(dev_priv) >= 12)
>-		port = (tmp & TGL_TRANS_DDI_PORT_MASK) >>
>-			TGL_TRANS_DDI_PORT_SHIFT;
>+		port = TGL_PORT_TRANS_DDI_SELECT(tmp);
> 	else
> 		port = (tmp & TRANS_DDI_PORT_MASK) >> TRANS_DDI_PORT_SHIFT;

I think we actually need a macro to do on >= 12 and another to do it
before. And reading it again, I agree my suggestion of
TGL_PORT_TRANS_DDI_SELECT was not so good.


>
>diff --git a/drivers/gpu/drm/i915/i915_reg.h b/drivers/gpu/drm/i915/i915_reg.h
>index d760830cfd7b..95e2cfdd41b9 100644
>--- a/drivers/gpu/drm/i915/i915_reg.h
>+++ b/drivers/gpu/drm/i915/i915_reg.h
>@@ -9432,6 +9432,7 @@ enum skl_power_gate {
> #define  TGL_TRANS_DDI_PORT_MASK	(0xf << TGL_TRANS_DDI_PORT_SHIFT)
> #define  TRANS_DDI_SELECT_PORT(x)	((x) << TRANS_DDI_PORT_SHIFT)
> #define  TGL_TRANS_DDI_SELECT_PORT(x)	(((x) + 1) << TGL_TRANS_DDI_PORT_SHIFT)
>+#define  TGL_PORT_TRANS_DDI_SELECT(val) (((val) & TGL_TRANS_DDI_PORT_MASK >> TGL_TRANS_DDI_PORT_SHIFT) - 1)

TRANS_DDI_FUNC_CTL_VAL_TO_PORT(val)
TRANS_DDI_FUNC_CTL_PORT_TO_VAL(port)

and then the TGL_* variants... ?

Or "TRANS_DDI_SELECT_*" as prefix...


Lucas De Marchi


> #define  TRANS_DDI_MODE_SELECT_MASK	(7 << 24)
> #define  TRANS_DDI_MODE_SELECT_HDMI	(0 << 24)
> #define  TRANS_DDI_MODE_SELECT_DVI	(1 << 24)
>-- 
>2.22.0
>


More information about the Intel-gfx mailing list