Re: [Intel-gfx] [PATCH 19/24] drm/i915: detect digital outputs on Haswell

2012-05-01 Thread Jesse Barnes
On Mon, 30 Apr 2012 21:33:42 -0300
Eugeni Dodonov eug...@dodonov.net wrote:

 On Mon, Apr 30, 2012 at 21:27, Jesse Barnes jbar...@virtuousgeek.orgwrote:
 
  We really really need to get the port detection working on HSW using
  the VBT.
 
 
 It is not that easy from what I've seen. VBT can give some hints on which
 ports can support only DP or HDMI, but it does not answers all the cases.
 So the best solution seems to be running a DP AUX query when we got an
 output, and if it succeeds - it is a DP; otherwise, it is HDMI.
 
 So my idea here is:
  - add both HDMI and DP connectors for each available port (those we can
 get via VBT and from the GPU variant - some variants don't have specific
 DDIs in hardware, and VBT can further say which DDI are incapable of
 driving HDMI when present)
  - add an intel_ddi_detect routine for .detect of each of them
  - the intel_ddi_detect would try doing the DP AUX test, and dispatch
 either intel_hdmi_detect or intel_dp_detect accordingly.
 
 Once the DP code will be ready, we'll put this in place. But for now, only
 HDMI works anyway, and I don't have any DP monitor around to play with :).
 
 Does this looks reasonable?

I had wanted to avoid every HSW system looking like it had a bunch of
HDMI and DP ports, when it really only has one of each or something.

-- 
Jesse Barnes, Intel Open Source Technology Center
___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx


Re: [Intel-gfx] [PATCH 19/24] drm/i915: detect digital outputs on Haswell

2012-05-01 Thread Keith Packard
On Tue, 1 May 2012 08:01:08 -0700, Jesse Barnes jbar...@virtuousgeek.org 
wrote:

 I had wanted to avoid every HSW system looking like it had a bunch of
 HDMI and DP ports, when it really only has one of each or something.

Every DP port is also an HDMI port when a DP to HDMI converter is
plugged in.

-- 
keith.pack...@intel.com


pgpJ41qlOy7cv.pgp
Description: PGP signature
___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx


Re: [Intel-gfx] [PATCH 19/24] drm/i915: detect digital outputs on Haswell

2012-04-30 Thread Jesse Barnes
On Thu, 26 Apr 2012 15:21:14 -0300
Eugeni Dodonov eugeni.dodo...@intel.com wrote:

 Digital port detection on Haswell is indicated by the presence of a bit in
 DDI_BUF_CTL for port A, and by a different register for ports B, C and D.
 So we check for those bits during the initialization time and let the hdmi
 function know about those.
 
 Note that this bit does not indicates whether the output is DP or HDMI.
 However, the DDI buffers can be programmed in a way that is shared between
 DP/HDMI and FDI/HDMI except for PORT E.
 
 So for now, we detect those digital outputs as being HDMI, but proper DP
 support is still pending.
 
 Note that DDI A can only drive eDP, so we do not handle it here for hdmi
 initialization.
 
 v2: simplify Haswell handling logic
 
 v3: use generic function for handling digital outputs.
 
 Signed-off-by: Eugeni Dodonov eugeni.dodo...@intel.com
 ---
  drivers/gpu/drm/i915/intel_ddi.c |   29 +
  drivers/gpu/drm/i915/intel_display.c |   21 -
  drivers/gpu/drm/i915/intel_drv.h |1 +
  3 files changed, 50 insertions(+), 1 deletion(-)
 
 diff --git a/drivers/gpu/drm/i915/intel_ddi.c 
 b/drivers/gpu/drm/i915/intel_ddi.c
 index 93436caa..cd6fbaa 100644
 --- a/drivers/gpu/drm/i915/intel_ddi.c
 +++ b/drivers/gpu/drm/i915/intel_ddi.c
 @@ -230,3 +230,32 @@ void ddi_fdi_link_train(struct drm_crtc *crtc)
   if (IS_HASWELL(dev))
   hsw_fdi_link_train(crtc);
  }
 +
 +/* For DDI connections, it is possible to support different outputs over the
 + * same DDI port, such as HDMI or DP or even VGA via FDI. So we don't know by
 + * the time the output is detected what exactly is on the other end of it. 
 This
 + * function aims at providing support for this detection and proper output
 + * configuration.
 + */
 +void intel_ddi_init(struct drm_device *dev, enum port port)
 +{
 + /* For now, we don't do any proper output detection and assume that we
 +  * handle HDMI only */
 +
 + switch(port){
 + case PORT_A:
 + /* We don't handle eDP and DP yet */
 + DRM_DEBUG_DRIVER(Found digital output on DDI port A\n);
 + break;
 + /* Assume that the  ports B, C and D are working in HDMI mode for now */
 + case PORT_B:
 + case PORT_C:
 + case PORT_D:
 + intel_hdmi_init(dev, DDI_BUF_CTL(port));
 + break;
 + default:
 + DRM_DEBUG_DRIVER(No handlers defined for port %d, skipping DDI 
 initialization\n,
 + port);
 + break;
 + }
 +}

We really really need to get the port detection working on HSW using
the VBT.

-- 
Jesse Barnes, Intel Open Source Technology Center
___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx


Re: [Intel-gfx] [PATCH 19/24] drm/i915: detect digital outputs on Haswell

2012-04-30 Thread Eugeni Dodonov
On Mon, Apr 30, 2012 at 21:27, Jesse Barnes jbar...@virtuousgeek.orgwrote:

 We really really need to get the port detection working on HSW using
 the VBT.


It is not that easy from what I've seen. VBT can give some hints on which
ports can support only DP or HDMI, but it does not answers all the cases.
So the best solution seems to be running a DP AUX query when we got an
output, and if it succeeds - it is a DP; otherwise, it is HDMI.

So my idea here is:
 - add both HDMI and DP connectors for each available port (those we can
get via VBT and from the GPU variant - some variants don't have specific
DDIs in hardware, and VBT can further say which DDI are incapable of
driving HDMI when present)
 - add an intel_ddi_detect routine for .detect of each of them
 - the intel_ddi_detect would try doing the DP AUX test, and dispatch
either intel_hdmi_detect or intel_dp_detect accordingly.

Once the DP code will be ready, we'll put this in place. But for now, only
HDMI works anyway, and I don't have any DP monitor around to play with :).

Does this looks reasonable?

-- 
Eugeni Dodonov
http://eugeni.dodonov.net/
___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx


[Intel-gfx] [PATCH 19/24] drm/i915: detect digital outputs on Haswell

2012-04-26 Thread Eugeni Dodonov
Digital port detection on Haswell is indicated by the presence of a bit in
DDI_BUF_CTL for port A, and by a different register for ports B, C and D.
So we check for those bits during the initialization time and let the hdmi
function know about those.

Note that this bit does not indicates whether the output is DP or HDMI.
However, the DDI buffers can be programmed in a way that is shared between
DP/HDMI and FDI/HDMI except for PORT E.

So for now, we detect those digital outputs as being HDMI, but proper DP
support is still pending.

Note that DDI A can only drive eDP, so we do not handle it here for hdmi
initialization.

v2: simplify Haswell handling logic

v3: use generic function for handling digital outputs.

Signed-off-by: Eugeni Dodonov eugeni.dodo...@intel.com
---
 drivers/gpu/drm/i915/intel_ddi.c |   29 +
 drivers/gpu/drm/i915/intel_display.c |   21 -
 drivers/gpu/drm/i915/intel_drv.h |1 +
 3 files changed, 50 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/i915/intel_ddi.c b/drivers/gpu/drm/i915/intel_ddi.c
index 93436caa..cd6fbaa 100644
--- a/drivers/gpu/drm/i915/intel_ddi.c
+++ b/drivers/gpu/drm/i915/intel_ddi.c
@@ -230,3 +230,32 @@ void ddi_fdi_link_train(struct drm_crtc *crtc)
if (IS_HASWELL(dev))
hsw_fdi_link_train(crtc);
 }
+
+/* For DDI connections, it is possible to support different outputs over the
+ * same DDI port, such as HDMI or DP or even VGA via FDI. So we don't know by
+ * the time the output is detected what exactly is on the other end of it. This
+ * function aims at providing support for this detection and proper output
+ * configuration.
+ */
+void intel_ddi_init(struct drm_device *dev, enum port port)
+{
+   /* For now, we don't do any proper output detection and assume that we
+* handle HDMI only */
+
+   switch(port){
+   case PORT_A:
+   /* We don't handle eDP and DP yet */
+   DRM_DEBUG_DRIVER(Found digital output on DDI port A\n);
+   break;
+   /* Assume that the  ports B, C and D are working in HDMI mode for now */
+   case PORT_B:
+   case PORT_C:
+   case PORT_D:
+   intel_hdmi_init(dev, DDI_BUF_CTL(port));
+   break;
+   default:
+   DRM_DEBUG_DRIVER(No handlers defined for port %d, skipping DDI 
initialization\n,
+   port);
+   break;
+   }
+}
diff --git a/drivers/gpu/drm/i915/intel_display.c 
b/drivers/gpu/drm/i915/intel_display.c
index bc7c255..b1d5bfc 100644
--- a/drivers/gpu/drm/i915/intel_display.c
+++ b/drivers/gpu/drm/i915/intel_display.c
@@ -6707,7 +6707,26 @@ static void intel_setup_outputs(struct drm_device *dev)
 
intel_crt_init(dev);
 
-   if (HAS_PCH_SPLIT(dev)) {
+   if (IS_HASWELL(dev)) {
+   int found;
+
+   /* Haswell uses DDI functions to detect digital outputs */
+   found = I915_READ(DDI_BUF_CTL_A)  DDI_INIT_DISPLAY_DETECTED;
+   /* DDI A only supports eDP */
+   if (found)
+   intel_ddi_init(dev, PORT_A);
+
+   /* DDI B, C and D detection is indicated by the SFUSE_STRAP
+* register */
+   found = I915_READ(SFUSE_STRAP);
+
+   if (found  SFUSE_STRAP_DDIB_DETECTED)
+   intel_ddi_init(dev, PORT_B);
+   if (found  SFUSE_STRAP_DDIC_DETECTED)
+   intel_ddi_init(dev, PORT_C);
+   if (found  SFUSE_STRAP_DDID_DETECTED)
+   intel_ddi_init(dev, PORT_D);
+   } else if (HAS_PCH_SPLIT(dev)) {
int found;
 
if (I915_READ(HDMIB)  PORT_DETECTED) {
diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/intel_drv.h
index df3536f..6543720 100644
--- a/drivers/gpu/drm/i915/intel_drv.h
+++ b/drivers/gpu/drm/i915/intel_drv.h
@@ -444,6 +444,7 @@ extern void intel_write_eld(struct drm_encoder *encoder,
 extern void intel_cpt_verify_modeset(struct drm_device *dev, int pipe);
 extern void intel_prepare_ddi(struct drm_device *dev);
 extern void ddi_fdi_link_train(struct drm_crtc *crtc);
+extern void intel_ddi_init(struct drm_device *dev, enum port port);
 
 /* For use by IVB LP watermark workaround in intel_sprite.c */
 extern void intel_update_watermarks(struct drm_device *dev);
-- 
1.7.10

___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx