Skip to contentSkip to conversation

drm/i915: pass mode to ELD write vfuncs

PATCH In review Jani Nikula 5 participants 9 messages Oct 16, 2013 – Oct 27, 2013 1 message not in the archive

Subsystems (2)
lore
Share & tools
lore
#1 lore raw

PATCH v2 1/2 drm/i915: pass mode to ELD write vfuncs

In reply to a message not in the archive

This will be needed for setting the HDMI pixel clock for audio config. No functional changes.

v2: Now with a commit message.

---
 drivers/gpu/drm/i915/i915_drv.h      |    3 ++-
 drivers/gpu/drm/i915/intel_display.c |   11 +++++++----
 2 files changed, 9 insertions(+), 5 deletions(-)
drivers/gpu/drm/i915/i915_drv.h +2 -1
index 6106d3d..caee590 100644
@@ -379,7 +379,8 @@ struct drm_i915_display_funcs {
 	void (*crtc_disable)(struct drm_crtc *crtc);
 	void (*off)(struct drm_crtc *crtc);
 	void (*write_eld)(struct drm_connector *connector,
-			  struct drm_crtc *crtc);
+			  struct drm_crtc *crtc,
+			  struct drm_display_mode *mode);
 	void (*fdi_link_train)(struct drm_crtc *crtc);
 	void (*init_clock_gating)(struct drm_device *dev);
 	int (*queue_flip)(struct drm_device *dev, struct drm_crtc *crtc,
drivers/gpu/drm/i915/intel_display.c +7 -4
index 4f1b636..55740f2 100644
@@ -6752,7 +6752,8 @@ static bool intel_eld_uptodate(struct drm_connector *connector,
 }
 
 static void g4x_write_eld(struct drm_connector *connector,
-			  struct drm_crtc *crtc)
+			  struct drm_crtc *crtc,
+			  struct drm_display_mode *mode)
 {
 	struct drm_i915_private *dev_priv = connector->dev->dev_private;
 	uint8_t *eld = connector->eld;
@@ -6792,7 +6793,8 @@ static void g4x_write_eld(struct drm_connector *connector,
 }
 
 static void haswell_write_eld(struct drm_connector *connector,
-				     struct drm_crtc *crtc)
+			      struct drm_crtc *crtc,
+			      struct drm_display_mode *mode)
 {
 	struct drm_i915_private *dev_priv = connector->dev->dev_private;
 	uint8_t *eld = connector->eld;
@@ -6879,7 +6881,8 @@ static void haswell_write_eld(struct drm_connector *connector,
 }
 
 static void ironlake_write_eld(struct drm_connector *connector,
-				     struct drm_crtc *crtc)
+			       struct drm_crtc *crtc,
+			       struct drm_display_mode *mode)
 {
 	struct drm_i915_private *dev_priv = connector->dev->dev_private;
 	uint8_t *eld = connector->eld;
@@ -6974,7 +6977,7 @@ void intel_write_eld(struct drm_encoder *encoder,
 	connector->eld[6] = drm_av_sync_delay(connector, mode) / 2;
 
 	if (dev_priv->display.write_eld)
-		dev_priv->display.write_eld(connector, crtc);
+		dev_priv->display.write_eld(connector, crtc, mode);
 }
 
 static void i845_update_cursor(struct drm_crtc *crtc, u32 base)
Signature · 1 line
1.7.9.5
#2 lore raw

PATCH v2 2/2 drm/i915: set HDMI pixel clock in audio configuration

The HDMI audio expects HDMI pixel clock to be set in the audio configuration. We've currently just set 0, using 25.2 / 1.001 kHz frequency, which fails with some modes.

v2: Now with a commit message.

Reference: http://mid.gmane.org/CAGpEb3Ep1LRZETPxHGRfBDqr5Ts2tAc8gCukWwugUf1U5NYv1g@mail.gmail.com
Reference: http://mid.gmane.org/[email protected]

---
 drivers/gpu/drm/i915/i915_reg.h      |   12 ++++++++-
 drivers/gpu/drm/i915/intel_display.c |   48 +++++++++++++++++++++++++++++++---
 2 files changed, 55 insertions(+), 5 deletions(-)
drivers/gpu/drm/i915/i915_reg.h +11 -1
index 13153c3..3266819 100644
@@ -4875,7 +4875,17 @@
 #define   AUD_CONFIG_LOWER_N_SHIFT		4
 #define   AUD_CONFIG_LOWER_N_VALUE		(0xfff << 4)
 #define   AUD_CONFIG_PIXEL_CLOCK_HDMI_SHIFT	16
-#define   AUD_CONFIG_PIXEL_CLOCK_HDMI		(0xf << 16)
+#define   AUD_CONFIG_PIXEL_CLOCK_HDMI_MASK	(0xf << 16)
+#define   AUD_CONFIG_PIXEL_CLOCK_HDMI_25175	(0 << 16)
+#define   AUD_CONFIG_PIXEL_CLOCK_HDMI_25200	(1 << 16)
+#define   AUD_CONFIG_PIXEL_CLOCK_HDMI_27000	(2 << 16)
+#define   AUD_CONFIG_PIXEL_CLOCK_HDMI_27027	(3 << 16)
+#define   AUD_CONFIG_PIXEL_CLOCK_HDMI_54000	(4 << 16)
+#define   AUD_CONFIG_PIXEL_CLOCK_HDMI_54054	(5 << 16)
+#define   AUD_CONFIG_PIXEL_CLOCK_HDMI_74176	(6 << 16)
+#define   AUD_CONFIG_PIXEL_CLOCK_HDMI_74250	(7 << 16)
+#define   AUD_CONFIG_PIXEL_CLOCK_HDMI_148352	(8 << 16)
+#define   AUD_CONFIG_PIXEL_CLOCK_HDMI_148500	(9 << 16)
 #define   AUD_CONFIG_DISABLE_NCTS		(1 << 3)
 
 /* HSW Audio */
drivers/gpu/drm/i915/intel_display.c +44 -4

66 lines not on this page · raw message

Signature · 6 lines
1.7.9.5

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
#8 lore raw
In reply to Jani Nikula

Mengdong, I meant to CC you on these two patches. Please have a look.

I also screwed up in-reply-to, was meant to be
http://mid.gmane.org/[email protected]

BR,
Jani.

Quoted 71 lines · Jani Nikula

This will be needed for setting the HDMI pixel clock for audio config. No functional changes.

v2: Now with a commit message.

---
 drivers/gpu/drm/i915/i915_drv.h      |    3 ++-
 drivers/gpu/drm/i915/intel_display.c |   11 +++++++----
 2 files changed, 9 insertions(+), 5 deletions(-)
drivers/gpu/drm/i915/i915_drv.h +2 -1
index 6106d3d..caee590 100644
@@ -379,7 +379,8 @@ struct drm_i915_display_funcs {
 	void (*crtc_disable)(struct drm_crtc *crtc);
 	void (*off)(struct drm_crtc *crtc);
 	void (*write_eld)(struct drm_connector *connector,
-			  struct drm_crtc *crtc);
+			  struct drm_crtc *crtc,
+			  struct drm_display_mode *mode);
 	void (*fdi_link_train)(struct drm_crtc *crtc);
 	void (*init_clock_gating)(struct drm_device *dev);
 	int (*queue_flip)(struct drm_device *dev, struct drm_crtc *crtc,
drivers/gpu/drm/i915/intel_display.c +7 -4
index 4f1b636..55740f2 100644
@@ -6752,7 +6752,8 @@ static bool intel_eld_uptodate(struct drm_connector *connector,
 }
 
 static void g4x_write_eld(struct drm_connector *connector,
-			  struct drm_crtc *crtc)
+			  struct drm_crtc *crtc,
+			  struct drm_display_mode *mode)
 {
 	struct drm_i915_private *dev_priv = connector->dev->dev_private;
 	uint8_t *eld = connector->eld;
@@ -6792,7 +6793,8 @@ static void g4x_write_eld(struct drm_connector *connector,
 }
 
 static void haswell_write_eld(struct drm_connector *connector,
-				     struct drm_crtc *crtc)
+			      struct drm_crtc *crtc,
+			      struct drm_display_mode *mode)
 {
 	struct drm_i915_private *dev_priv = connector->dev->dev_private;
 	uint8_t *eld = connector->eld;
@@ -6879,7 +6881,8 @@ static void haswell_write_eld(struct drm_connector *connector,
 }
 
 static void ironlake_write_eld(struct drm_connector *connector,
-				     struct drm_crtc *crtc)
+			       struct drm_crtc *crtc,
+			       struct drm_display_mode *mode)
 {
 	struct drm_i915_private *dev_priv = connector->dev->dev_private;
 	uint8_t *eld = connector->eld;
@@ -6974,7 +6977,7 @@ void intel_write_eld(struct drm_encoder *encoder,
 	connector->eld[6] = drm_av_sync_delay(connector, mode) / 2;
 
 	if (dev_priv->display.write_eld)
-		dev_priv->display.write_eld(connector, crtc);
+		dev_priv->display.write_eld(connector, crtc, mode);
 }
 
 static void i845_update_cursor(struct drm_crtc *crtc, u32 base)
Signature · 1 line
1.7.9.5
Signature · 1 line
Jani Nikula, Intel Open Source Technology Center
Reviewed-by on v2 2/2
#3 lore raw

Re: [PATCH v2 2/2] drm/i915: set HDMI pixel clock in audio configuration

In reply to Jani Nikula
Quoted 120 lines · Jani Nikula

The HDMI audio expects HDMI pixel clock to be set in the audio configuration. We've currently just set 0, using 25.2 / 1.001 kHz frequency, which fails with some modes.

v2: Now with a commit message.

Reference: http://mid.gmane.org/CAGpEb3Ep1LRZETPxHGRfBDqr5Ts2tAc8gCukWwugUf1U5NYv1g@mail.gmail.com
Reference: http://mid.gmane.org/[email protected]

---
 drivers/gpu/drm/i915/i915_reg.h      |   12 ++++++++-
 drivers/gpu/drm/i915/intel_display.c |   48 +++++++++++++++++++++++++++++++---
 2 files changed, 55 insertions(+), 5 deletions(-)
drivers/gpu/drm/i915/i915_reg.h +11 -1
index 13153c3..3266819 100644
@@ -4875,7 +4875,17 @@
 #define   AUD_CONFIG_LOWER_N_SHIFT             4
 #define   AUD_CONFIG_LOWER_N_VALUE             (0xfff << 4)
 #define   AUD_CONFIG_PIXEL_CLOCK_HDMI_SHIFT    16
-#define   AUD_CONFIG_PIXEL_CLOCK_HDMI          (0xf << 16)
+#define   AUD_CONFIG_PIXEL_CLOCK_HDMI_MASK     (0xf << 16)
+#define   AUD_CONFIG_PIXEL_CLOCK_HDMI_25175    (0 << 16)
+#define   AUD_CONFIG_PIXEL_CLOCK_HDMI_25200    (1 << 16)
+#define   AUD_CONFIG_PIXEL_CLOCK_HDMI_27000    (2 << 16)
+#define   AUD_CONFIG_PIXEL_CLOCK_HDMI_27027    (3 << 16)
+#define   AUD_CONFIG_PIXEL_CLOCK_HDMI_54000    (4 << 16)
+#define   AUD_CONFIG_PIXEL_CLOCK_HDMI_54054    (5 << 16)
+#define   AUD_CONFIG_PIXEL_CLOCK_HDMI_74176    (6 << 16)
+#define   AUD_CONFIG_PIXEL_CLOCK_HDMI_74250    (7 << 16)
+#define   AUD_CONFIG_PIXEL_CLOCK_HDMI_148352   (8 << 16)
+#define   AUD_CONFIG_PIXEL_CLOCK_HDMI_148500   (9 << 16)
 #define   AUD_CONFIG_DISABLE_NCTS              (1 << 3)
 
 /* HSW Audio */
drivers/gpu/drm/i915/intel_display.c +44 -5
index 55740f2..a097f84 100644
@@ -6722,6 +6722,44 @@ static int intel_crtc_mode_set(struct drm_crtc *crtc,
        return 0;
 }
 
+static struct {
+       int clock;
+       u32 config;
+} hdmi_audio_clock[] = {
+       { DIV_ROUND_UP(25200 * 1000, 1001), AUD_CONFIG_PIXEL_CLOCK_HDMI_25175 },
+       { 25200, AUD_CONFIG_PIXEL_CLOCK_HDMI_25200 }, /* default per bspec */
+       { 27000, AUD_CONFIG_PIXEL_CLOCK_HDMI_27000 },
+       { 27000 * 1001 / 1000, AUD_CONFIG_PIXEL_CLOCK_HDMI_27027 },
+       { 54000, AUD_CONFIG_PIXEL_CLOCK_HDMI_54000 },
+       { 54000 * 1001 / 1000, AUD_CONFIG_PIXEL_CLOCK_HDMI_54054 },
+       { DIV_ROUND_UP(74250 * 1000, 1001), AUD_CONFIG_PIXEL_CLOCK_HDMI_74176 },
+       { 74250, AUD_CONFIG_PIXEL_CLOCK_HDMI_74250 },
+       { DIV_ROUND_UP(148500 * 1000, 1001), AUD_CONFIG_PIXEL_CLOCK_HDMI_148352 },
+       { 148500, AUD_CONFIG_PIXEL_CLOCK_HDMI_148500 },
+};
+
+/* get AUD_CONFIG_PIXEL_CLOCK_HDMI_* value for mode */
+static u32 audio_config_hdmi_pixel_clock(struct drm_display_mode *mode)
+{
+       int i;
+
+       for (i = 0; i < ARRAY_SIZE(hdmi_audio_clock); i++) {
+               if (mode->clock == hdmi_audio_clock[i].clock)
+                       break;
+       }
+
+       if (i == ARRAY_SIZE(hdmi_audio_clock)) {
+               DRM_DEBUG_KMS("HDMI audio pixel clock setting for %d not found, falling back to defaults\n", mode->clock);
+               i = 1;
+       }
+
+       DRM_DEBUG_KMS("Configuring HDMI audio for pixel clock %d (0x%08x)\n",
+                     hdmi_audio_clock[i].clock,
+                     hdmi_audio_clock[i].config);
+
+       return hdmi_audio_clock[i].config;
+}
+
 static bool intel_eld_uptodate(struct drm_connector *connector,
                               int reg_eldv, uint32_t bits_eldv,
                               int reg_elda, uint32_t bits_elda,
@@ -6847,8 +6885,9 @@ static void haswell_write_eld(struct drm_connector *connector,
                DRM_DEBUG_DRIVER("ELD: DisplayPort detected\n");
                eld[5] |= (1 << 2);     /* Conn_Type, 0x1 = DisplayPort */
                I915_WRITE(aud_config, AUD_CONFIG_N_VALUE_INDEX); /* 0x1 = DP */
-       } else
-               I915_WRITE(aud_config, 0);
+       } else {
+               I915_WRITE(aud_config, audio_config_hdmi_pixel_clock(mode));
+       }
 
        if (intel_eld_uptodate(connector,
                               aud_cntrl_st2, eldv,
@@ -6926,8 +6965,9 @@ static void ironlake_write_eld(struct drm_connector *connector,
                DRM_DEBUG_DRIVER("ELD: DisplayPort detected\n");
                eld[5] |= (1 << 2);     /* Conn_Type, 0x1 = DisplayPort */
                I915_WRITE(aud_config, AUD_CONFIG_N_VALUE_INDEX); /* 0x1 = DP */
-       } else
-               I915_WRITE(aud_config, 0);
+       } else {
+               I915_WRITE(aud_config, audio_config_hdmi_pixel_clock(mode));
+       }
 
        if (intel_eld_uptodate(connector,
                               aud_cntrl_st2, eldv,
--

1.7.9.5

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

Signature · 2 lines
Rodrigo Vivi
Blog: http://blog.vivi.eng.br
Reviewed-by on v2 1/2
#9 lore raw
In reply to Jani Nikula
Quoted 75 lines · Jani Nikula

This will be needed for setting the HDMI pixel clock for audio config. No functional changes.

v2: Now with a commit message.

---
 drivers/gpu/drm/i915/i915_drv.h      |    3 ++-
 drivers/gpu/drm/i915/intel_display.c |   11 +++++++----
 2 files changed, 9 insertions(+), 5 deletions(-)
drivers/gpu/drm/i915/i915_drv.h +2 -1
index 6106d3d..caee590 100644
@@ -379,7 +379,8 @@ struct drm_i915_display_funcs {
        void (*crtc_disable)(struct drm_crtc *crtc);
        void (*off)(struct drm_crtc *crtc);
        void (*write_eld)(struct drm_connector *connector,
-                         struct drm_crtc *crtc);
+                         struct drm_crtc *crtc,
+                         struct drm_display_mode *mode);
        void (*fdi_link_train)(struct drm_crtc *crtc);
        void (*init_clock_gating)(struct drm_device *dev);
        int (*queue_flip)(struct drm_device *dev, struct drm_crtc *crtc,
drivers/gpu/drm/i915/intel_display.c +7 -5
index 4f1b636..55740f2 100644
@@ -6752,7 +6752,8 @@ static bool intel_eld_uptodate(struct drm_connector *connector,
 }
 
 static void g4x_write_eld(struct drm_connector *connector,
-                         struct drm_crtc *crtc)
+                         struct drm_crtc *crtc,
+                         struct drm_display_mode *mode)
 {
        struct drm_i915_private *dev_priv = connector->dev->dev_private;
        uint8_t *eld = connector->eld;
@@ -6792,7 +6793,8 @@ static void g4x_write_eld(struct drm_connector *connector,
 }
 
 static void haswell_write_eld(struct drm_connector *connector,
-                                    struct drm_crtc *crtc)
+                             struct drm_crtc *crtc,
+                             struct drm_display_mode *mode)
 {
        struct drm_i915_private *dev_priv = connector->dev->dev_private;
        uint8_t *eld = connector->eld;
@@ -6879,7 +6881,8 @@ static void haswell_write_eld(struct drm_connector *connector,
 }
 
 static void ironlake_write_eld(struct drm_connector *connector,
-                                    struct drm_crtc *crtc)
+                              struct drm_crtc *crtc,
+                              struct drm_display_mode *mode)
 {
        struct drm_i915_private *dev_priv = connector->dev->dev_private;
        uint8_t *eld = connector->eld;
@@ -6974,7 +6977,7 @@ void intel_write_eld(struct drm_encoder *encoder,
        connector->eld[6] = drm_av_sync_delay(connector, mode) / 2;
 
        if (dev_priv->display.write_eld)
-               dev_priv->display.write_eld(connector, crtc);
+               dev_priv->display.write_eld(connector, crtc, mode);
 }
 
 static void i845_update_cursor(struct drm_crtc *crtc, u32 base)
--

1.7.9.5

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

Signature · 2 lines
Rodrigo Vivi
Blog: http://blog.vivi.eng.br
#4 lore raw

Re: [PATCH v2 2/2] drm/i915: set HDMI pixel clock in audio configuration

In reply to Rodrigo Vivi
Quoted 15 lines · Rodrigo Vivi
Quoted 12 lines · Jani Nikula

The HDMI audio expects HDMI pixel clock to be set in the audio configuration. We've currently just set 0, using 25.2 / 1.001 kHz frequency, which fails with some modes.

v2: Now with a commit message.

Reference: http://mid.gmane.org/CAGpEb3Ep1LRZETPxHGRfBDqr5Ts2tAc8gCukWwugUf1U5NYv1g@mail.gmail.com
Reference: http://mid.gmane.org/[email protected]

Both merged, thanks for patches and review.
-Daniel

Signature · 3 lines
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch
#5 lore raw

Re: [PATCH v2 2/2] drm/i915: set HDMI pixel clock in audio configuration

In reply to Jani Nikula

Although i know it also happens in windows, the one particular thing i am 'fiddling' with is that when i try the receiver with an nvidia or amd apu (ion, e-450 trough hdmi) with my pioneer receiver audio works fine with 44100hz at the 1080p@50/60 modes. Only with intel i need to force upstreaming to 48000hz.

So are we really sure this is a bug with the receiver or still something wrong with the driver / pixel clock issue?

Is there anything else we i do to help ?

Quoted 134 lines · Jani Nikula

The HDMI audio expects HDMI pixel clock to be set in the audio configuration. We've currently just set 0, using 25.2 / 1.001 kHz frequency, which fails with some modes.

v2: Now with a commit message.

Reference:
http://mid.gmane.org/CAGpEb3Ep1LRZETPxHGRfBDqr5Ts2tAc8gCukWwugUf1U5NYv1g@mail.gmail.com
Reference: http://mid.gmane.org/[email protected]

---
 drivers/gpu/drm/i915/i915_reg.h      |   12 ++++++++-
 drivers/gpu/drm/i915/intel_display.c |   48
+++++++++++++++++++++++++++++++---
 2 files changed, 55 insertions(+), 5 deletions(-)
drivers/gpu/drm/i915/i915_reg.h +11 -1
index 13153c3..3266819 100644
@@ -4875,7 +4875,17 @@
 #define   AUD_CONFIG_LOWER_N_SHIFT             4
 #define   AUD_CONFIG_LOWER_N_VALUE             (0xfff << 4)
 #define   AUD_CONFIG_PIXEL_CLOCK_HDMI_SHIFT    16
-#define   AUD_CONFIG_PIXEL_CLOCK_HDMI          (0xf << 16)
+#define   AUD_CONFIG_PIXEL_CLOCK_HDMI_MASK     (0xf << 16)
+#define   AUD_CONFIG_PIXEL_CLOCK_HDMI_25175    (0 << 16)
+#define   AUD_CONFIG_PIXEL_CLOCK_HDMI_25200    (1 << 16)
+#define   AUD_CONFIG_PIXEL_CLOCK_HDMI_27000    (2 << 16)
+#define   AUD_CONFIG_PIXEL_CLOCK_HDMI_27027    (3 << 16)
+#define   AUD_CONFIG_PIXEL_CLOCK_HDMI_54000    (4 << 16)
+#define   AUD_CONFIG_PIXEL_CLOCK_HDMI_54054    (5 << 16)
+#define   AUD_CONFIG_PIXEL_CLOCK_HDMI_74176    (6 << 16)
+#define   AUD_CONFIG_PIXEL_CLOCK_HDMI_74250    (7 << 16)
+#define   AUD_CONFIG_PIXEL_CLOCK_HDMI_148352   (8 << 16)
+#define   AUD_CONFIG_PIXEL_CLOCK_HDMI_148500   (9 << 16)
 #define   AUD_CONFIG_DISABLE_NCTS              (1 << 3)
 
 /* HSW Audio */
drivers/gpu/drm/i915/intel_display.c +11 -0
index 55740f2..a097f84 100644
@@ -6722,6 +6722,44 @@ static int intel_crtc_mode_set(struct drm_crtc
 *crtc,
        return 0;
 }
 
+static struct {
+       int clock;
+       u32 config;
+} hdmi_audio_clock[] = {
+       { DIV_ROUND_UP(25200 * 1000, 1001),
 AUD_CONFIG_PIXEL_CLOCK_HDMI_25175 },
+       { 25200, AUD_CONFIG_PIXEL_CLOCK_HDMI_25200 }, /* default per bspec
 */
+       { 27000, AUD_CONFIG_PIXEL_CLOCK_HDMI_27000 },
+       { 27000 * 1001 / 1000, AUD_CONFIG_PIXEL_CLOCK_HDMI_27027 },
+       { 54000, AUD_CONFIG_PIXEL_CLOCK_HDMI_54000 },
+       { 54000 * 1001 / 1000, AUD_CONFIG_PIXEL_CLOCK_HDMI_54054 },
+       { DIV_ROUND_UP(74250 * 1000, 1001),

AUD_CONFIG_PIXEL_CLOCK_HDMI_74176 },

drivers/gpu/drm/i915/intel_display.c +2 -0
+       { 74250, AUD_CONFIG_PIXEL_CLOCK_HDMI_74250 },
+       { DIV_ROUND_UP(148500 * 1000, 1001),

AUD_CONFIG_PIXEL_CLOCK_HDMI_148352 },

drivers/gpu/drm/i915/intel_display.c +15 -0
+       { 148500, AUD_CONFIG_PIXEL_CLOCK_HDMI_148500 },
+};
+
+/* get AUD_CONFIG_PIXEL_CLOCK_HDMI_* value for mode */
+static u32 audio_config_hdmi_pixel_clock(struct drm_display_mode *mode)
+{
+       int i;
+
+       for (i = 0; i < ARRAY_SIZE(hdmi_audio_clock); i++) {
+               if (mode->clock == hdmi_audio_clock[i].clock)
+                       break;
+       }
+
+       if (i == ARRAY_SIZE(hdmi_audio_clock)) {
+               DRM_DEBUG_KMS("HDMI audio pixel clock setting for %d not

found, falling back to defaults\n", mode->clock);

drivers/gpu/drm/i915/intel_display.c +4 -0
+               i = 1;
+       }
+
+       DRM_DEBUG_KMS("Configuring HDMI audio for pixel clock %d

(0x%08x)\n",

drivers/gpu/drm/i915/intel_display.c +6 -0
+                     hdmi_audio_clock[i].clock,
+                     hdmi_audio_clock[i].config);
+
+       return hdmi_audio_clock[i].config;
+}
+
 static bool intel_eld_uptodate(struct drm_connector *connector,
                               int reg_eldv, uint32_t bits_eldv,
                               int reg_elda, uint32_t bits_elda,
@@ -6847,8 +6885,9 @@ static void haswell_write_eld(struct drm_connector
 *connector,
                DRM_DEBUG_DRIVER("ELD: DisplayPort detected\n");
                eld[5] |= (1 << 2);     /* Conn_Type, 0x1 = DisplayPort */
                I915_WRITE(aud_config, AUD_CONFIG_N_VALUE_INDEX); /* 0x1 =

DP */

drivers/gpu/drm/i915/intel_display.c +2 -2
-       } else
-               I915_WRITE(aud_config, 0);
+       } else {
+               I915_WRITE(aud_config,

audio_config_hdmi_pixel_clock(mode));

drivers/gpu/drm/i915/intel_display.c +1 -0
+       }
 
        if (intel_eld_uptodate(connector,
                               aud_cntrl_st2, eldv,
@@ -6926,8 +6965,9 @@ static void ironlake_write_eld(struct drm_connector
 *connector,
                DRM_DEBUG_DRIVER("ELD: DisplayPort detected\n");
                eld[5] |= (1 << 2);     /* Conn_Type, 0x1 = DisplayPort */
                I915_WRITE(aud_config, AUD_CONFIG_N_VALUE_INDEX); /* 0x1 =

DP */

drivers/gpu/drm/i915/intel_display.c +2 -2
-       } else
-               I915_WRITE(aud_config, 0);
+       } else {
+               I915_WRITE(aud_config,

audio_config_hdmi_pixel_clock(mode));
+ }

if (intel_eld_uptodate(connector,
aud_cntrl_st2, eldv,
--
1.7.9.5

Signature · 8 lines
Met Vriendelijke Groeten

Jasper Smet
Developer

Twitter: josbeir
E-mail: [email protected]
Mobile: 0486/41.75.45

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

#6 lore raw

Re: [PATCH v2 2/2] drm/i915: set HDMI pixel clock in audio configuration

It should also be noted that manually hard-coding the pixel clock value to an obviously incorrect value will also cause the Pioneer receiver to do the right thing (I assume it will ignore the incorrect value and calculate it on the fly) - that would point towards some kind of bug / hardware incompatibility in the Pioneer receiver. But I agree that the receiver *does* work with other hardware that I've tried.

Attempts to contact Pioneer have been fruitless so far. Maybe Intel would have better luck there...

Quoted 166 lines · Jasper Smet

Although i know it also happens in windows, the one particular thing i am 'fiddling' with is that when i try the receiver with an nvidia or amd apu (ion, e-450 trough hdmi) with my pioneer receiver audio works fine with 44100hz at the 1080p@50/60 modes. Only with intel i need to force upstreaming to 48000hz.

So are we really sure this is a bug with the receiver or still something wrong with the driver / pixel clock issue?

Is there anything else we i do to help ?

Quoted 8 lines · Jani Nikula

The HDMI audio expects HDMI pixel clock to be set in the audio configuration. We've currently just set 0, using 25.2 / 1.001 kHz frequency, which fails with some modes.

v2: Now with a commit message.

Reference:

http://mid.gmane.org/CAGpEb3Ep1LRZETPxHGRfBDqr5Ts2tAc8gCukWwugUf1U5NYv1g@mail.gmail.com

Quoted 132 lines

[1]
Reference: http://mid.gmane.org/[email protected]

---
 drivers/gpu/drm/i915/i915_reg.h      |   12 ++++++++- drivers/gpu/drm/i915/intel_display.c |   48
+++++++++++++++++++++++++++++++---

 2 files changed, 55 insertions(+), 5 deletions(-)
drivers/gpu/drm/i915/i915_reg.h +11 -1
index 13153c3..3266819 100644
@@ -4875,7 +4875,17 @@
  #define   AUD_CONFIG_LOWER_N_SHIFT             4
  #define   AUD_CONFIG_LOWER_N_VALUE             (0xfff <<
 4)
  #define   AUD_CONFIG_PIXEL_CLOCK_HDMI_SHIFT    16
-#define   AUD_CONFIG_PIXEL_CLOCK_HDMI          (0xf << 16)
+#define   AUD_CONFIG_PIXEL_CLOCK_HDMI_MASK     (0xf << 16)
+#define   AUD_CONFIG_PIXEL_CLOCK_HDMI_25175    (0 << 16)
+#define   AUD_CONFIG_PIXEL_CLOCK_HDMI_25200    (1 << 16)
+#define   AUD_CONFIG_PIXEL_CLOCK_HDMI_27000    (2 << 16)
+#define   AUD_CONFIG_PIXEL_CLOCK_HDMI_27027    (3 << 16)
+#define   AUD_CONFIG_PIXEL_CLOCK_HDMI_54000    (4 << 16)
+#define   AUD_CONFIG_PIXEL_CLOCK_HDMI_54054    (5 << 16)
+#define   AUD_CONFIG_PIXEL_CLOCK_HDMI_74176    (6 << 16)
+#define   AUD_CONFIG_PIXEL_CLOCK_HDMI_74250    (7 << 16)
+#define   AUD_CONFIG_PIXEL_CLOCK_HDMI_148352   (8 << 16)
+#define   AUD_CONFIG_PIXEL_CLOCK_HDMI_148500   (9 << 16)
  #define   AUD_CONFIG_DISABLE_NCTS              (1 << 3)
 

 /* HSW Audio */

drivers/gpu/drm/i915/intel_display.c +6 -0
index 55740f2..a097f84 100644
@@ -6722,6 +6722,44 @@ static int intel_crtc_mode_set(struct
 drm_crtc *crtc,
         return 0;
  }
 
+static struct {
+       int clock;
+       u32 config;
+} hdmi_audio_clock[] = {
+       { DIV_ROUND_UP(25200 * 1000, 1001),
 AUD_CONFIG_PIXEL_CLOCK_HDMI_25175 },
+       { 25200, AUD_CONFIG_PIXEL_CLOCK_HDMI_25200 }, /* default

per bspec */
+       { 27000, AUD_CONFIG_PIXEL_CLOCK_HDMI_27000 },
+       { 27000 * 1001 / 1000, AUD_CONFIG_PIXEL_CLOCK_HDMI_27027 },
+       { 54000, AUD_CONFIG_PIXEL_CLOCK_HDMI_54000 },
+       { 54000 * 1001 / 1000, AUD_CONFIG_PIXEL_CLOCK_HDMI_54054 },
+       { DIV_ROUND_UP(74250 * 1000, 1001), AUD_CONFIG_PIXEL_CLOCK_HDMI_74176 },
+       { 74250, AUD_CONFIG_PIXEL_CLOCK_HDMI_74250 },
+       { DIV_ROUND_UP(148500 * 1000, 1001), AUD_CONFIG_PIXEL_CLOCK_HDMI_148352 },
+       { 148500, AUD_CONFIG_PIXEL_CLOCK_HDMI_148500 },

drivers/gpu/drm/i915/intel_display.c +4 -0
+};
+
+/* get AUD_CONFIG_PIXEL_CLOCK_HDMI_* value for mode */
+static u32 audio_config_hdmi_pixel_clock(struct drm_display_mode

*mode)

drivers/gpu/drm/i915/intel_display.c +5 -0
+{
+       int i;
+
+       for (i = 0; i < ARRAY_SIZE(hdmi_audio_clock); i++) {
+               if (mode->clock ==

hdmi_audio_clock[i].clock)
+                       break;
+       }
+
+       if (i == ARRAY_SIZE(hdmi_audio_clock)) {
+               DRM_DEBUG_KMS("HDMI audio pixel clock setting for %d not found, falling back to defaultsn", mode->clock);
+               i = 1;
+       }
+
+       DRM_DEBUG_KMS("Configuring HDMI audio for pixel clock %d (0x%08x)n",
+                     hdmi_audio_clock[i].clock,
+                     hdmi_audio_clock[i].config);

drivers/gpu/drm/i915/intel_display.c +4 -0
+
+       return hdmi_audio_clock[i].config;
+}
+

 static bool intel_eld_uptodate(struct drm_connector *connector, int reg_eldv,
uint32_t bits_eldv,
                               int reg_elda,
uint32_t bits_elda,

drivers/gpu/drm/i915/intel_display.c +0 -0
@@ -6847,8 +6885,9 @@ static void haswell_write_eld(struct
 drm_connector *connector,

                DRM_DEBUG_DRIVER("ELD: DisplayPort detectedn");
                eld[5] |= (1 << 2);     /* Conn_Type, 0x1 = DisplayPort */
                I915_WRITE(aud_config, AUD_CONFIG_N_VALUE_INDEX); /* 0x1 = DP */
-       } else
-               I915_WRITE(aud_config, 0);
+       } else {
+               I915_WRITE(aud_config, audio_config_hdmi_pixel_clock(mode));
+       }

        if (intel_eld_uptodate(connector, aud_cntrl_st2, eldv,

drivers/gpu/drm/i915/intel_display.c +0 -0
@@ -6926,8 +6965,9 @@ static void ironlake_write_eld(struct
 drm_connector *connector,

                DRM_DEBUG_DRIVER("ELD: DisplayPort detectedn");
                eld[5] |= (1 << 2);     /* Conn_Type, 0x1 = DisplayPort */
                I915_WRITE(aud_config, AUD_CONFIG_N_VALUE_INDEX); /* 0x1 = DP */
-       } else
-               I915_WRITE(aud_config, 0);
+       } else {
+               I915_WRITE(aud_config, audio_config_hdmi_pixel_clock(mode));
+       }

Quoted 4 lines

        if (intel_eld_uptodate(connector, aud_cntrl_st2, eldv, --
1.7.9.5

--
Met Vriendelijke Groeten

Jasper Smet
Developer

Quoted 8 lines

Twitter: josbeir
E-mail: [email protected]
Mobile: 0486/41.75.45

Links:
------
[1]
http://mid.gmane.org/CAGpEb3Ep1LRZETPxHGRfBDqr5Ts2tAc8gCukWwugUf1U5NYv1g@mail.gmail.com

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

#7 lore raw

Re: [PATCH v2 2/2] drm/i915: set HDMI pixel clock in audio configuration

Quoted 10 lines · David Härdeman

It should also be noted that manually hard-coding the pixel clock value to an obviously incorrect value will also cause the Pioneer receiver to do the right thing (I assume it will ignore the incorrect value and calculate it on the fly) - that would point towards some kind of bug / hardware incompatibility in the Pioneer receiver. But I agree that the receiver *does* work with other hardware that I've tried.

Attempts to contact Pioneer have been fruitless so far. Maybe Intel would have better luck there...

The hw has shipped, so usually that means you're out of luck. Maybe we simply needs to start adding eld quirks to EDIDs ... -Daniel

Quoted 180 lines · Jasper Smet
Quoted 166 lines

Although i know it also happens in windows, the one particular thing i am 'fiddling' with is that when i try the receiver with an nvidia or amd apu (ion, e-450 trough hdmi) with my pioneer receiver audio works fine with 44100hz at the 1080p@50/60 modes. Only with intel i need to force upstreaming to 48000hz.

So are we really sure this is a bug with the receiver or still something wrong with the driver / pixel clock issue?

Is there anything else we i do to help ?

Quoted 8 lines · Jani Nikula

The HDMI audio expects HDMI pixel clock to be set in the audio configuration. We've currently just set 0, using 25.2 / 1.001 kHz frequency, which fails with some modes.

v2: Now with a commit message.

Reference:

http://mid.gmane.org/CAGpEb3Ep1LRZETPxHGRfBDqr5Ts2tAc8gCukWwugUf1U5NYv1g@mail.gmail.com

Quoted 132 lines

[1]
Reference: http://mid.gmane.org/[email protected]

---
 drivers/gpu/drm/i915/i915_reg.h      |   12 ++++++++- drivers/gpu/drm/i915/intel_display.c |   48
+++++++++++++++++++++++++++++++---

 2 files changed, 55 insertions(+), 5 deletions(-)
drivers/gpu/drm/i915/i915_reg.h +11 -1
index 13153c3..3266819 100644
@@ -4875,7 +4875,17 @@
  #define   AUD_CONFIG_LOWER_N_SHIFT             4
  #define   AUD_CONFIG_LOWER_N_VALUE             (0xfff <<
 4)
  #define   AUD_CONFIG_PIXEL_CLOCK_HDMI_SHIFT    16
-#define   AUD_CONFIG_PIXEL_CLOCK_HDMI          (0xf << 16)
+#define   AUD_CONFIG_PIXEL_CLOCK_HDMI_MASK     (0xf << 16)
+#define   AUD_CONFIG_PIXEL_CLOCK_HDMI_25175    (0 << 16)
+#define   AUD_CONFIG_PIXEL_CLOCK_HDMI_25200    (1 << 16)
+#define   AUD_CONFIG_PIXEL_CLOCK_HDMI_27000    (2 << 16)
+#define   AUD_CONFIG_PIXEL_CLOCK_HDMI_27027    (3 << 16)
+#define   AUD_CONFIG_PIXEL_CLOCK_HDMI_54000    (4 << 16)
+#define   AUD_CONFIG_PIXEL_CLOCK_HDMI_54054    (5 << 16)
+#define   AUD_CONFIG_PIXEL_CLOCK_HDMI_74176    (6 << 16)
+#define   AUD_CONFIG_PIXEL_CLOCK_HDMI_74250    (7 << 16)
+#define   AUD_CONFIG_PIXEL_CLOCK_HDMI_148352   (8 << 16)
+#define   AUD_CONFIG_PIXEL_CLOCK_HDMI_148500   (9 << 16)
  #define   AUD_CONFIG_DISABLE_NCTS              (1 << 3)
 

 /* HSW Audio */

drivers/gpu/drm/i915/intel_display.c +6 -0
index 55740f2..a097f84 100644
@@ -6722,6 +6722,44 @@ static int intel_crtc_mode_set(struct
 drm_crtc *crtc,
         return 0;
  }
 
+static struct {
+       int clock;
+       u32 config;
+} hdmi_audio_clock[] = {
+       { DIV_ROUND_UP(25200 * 1000, 1001),
 AUD_CONFIG_PIXEL_CLOCK_HDMI_25175 },
+       { 25200, AUD_CONFIG_PIXEL_CLOCK_HDMI_25200 }, /* default

per bspec */
+       { 27000, AUD_CONFIG_PIXEL_CLOCK_HDMI_27000 },
+       { 27000 * 1001 / 1000, AUD_CONFIG_PIXEL_CLOCK_HDMI_27027 },
+       { 54000, AUD_CONFIG_PIXEL_CLOCK_HDMI_54000 },
+       { 54000 * 1001 / 1000, AUD_CONFIG_PIXEL_CLOCK_HDMI_54054 },
+       { DIV_ROUND_UP(74250 * 1000, 1001), AUD_CONFIG_PIXEL_CLOCK_HDMI_74176 },
+       { 74250, AUD_CONFIG_PIXEL_CLOCK_HDMI_74250 },
+       { DIV_ROUND_UP(148500 * 1000, 1001), AUD_CONFIG_PIXEL_CLOCK_HDMI_148352 },
+       { 148500, AUD_CONFIG_PIXEL_CLOCK_HDMI_148500 },

drivers/gpu/drm/i915/intel_display.c +4 -0
+};
+
+/* get AUD_CONFIG_PIXEL_CLOCK_HDMI_* value for mode */
+static u32 audio_config_hdmi_pixel_clock(struct drm_display_mode

*mode)

drivers/gpu/drm/i915/intel_display.c +5 -0
+{
+       int i;
+
+       for (i = 0; i < ARRAY_SIZE(hdmi_audio_clock); i++) {
+               if (mode->clock ==

hdmi_audio_clock[i].clock)
+                       break;
+       }
+
+       if (i == ARRAY_SIZE(hdmi_audio_clock)) {
+               DRM_DEBUG_KMS("HDMI audio pixel clock setting for %d not found, falling back to defaultsn", mode->clock);
+               i = 1;
+       }
+
+       DRM_DEBUG_KMS("Configuring HDMI audio for pixel clock %d (0x%08x)n",
+                     hdmi_audio_clock[i].clock,
+                     hdmi_audio_clock[i].config);

drivers/gpu/drm/i915/intel_display.c +4 -0
+
+       return hdmi_audio_clock[i].config;
+}
+

 static bool intel_eld_uptodate(struct drm_connector *connector, int reg_eldv,
uint32_t bits_eldv,
                               int reg_elda,
uint32_t bits_elda,

drivers/gpu/drm/i915/intel_display.c +0 -0
@@ -6847,8 +6885,9 @@ static void haswell_write_eld(struct
 drm_connector *connector,

                DRM_DEBUG_DRIVER("ELD: DisplayPort detectedn");
                eld[5] |= (1 << 2);     /* Conn_Type, 0x1 = DisplayPort */
                I915_WRITE(aud_config, AUD_CONFIG_N_VALUE_INDEX); /* 0x1 = DP */
-       } else
-               I915_WRITE(aud_config, 0);
+       } else {
+               I915_WRITE(aud_config, audio_config_hdmi_pixel_clock(mode));
+       }

        if (intel_eld_uptodate(connector, aud_cntrl_st2, eldv,

drivers/gpu/drm/i915/intel_display.c +0 -0
@@ -6926,8 +6965,9 @@ static void ironlake_write_eld(struct
 drm_connector *connector,

                DRM_DEBUG_DRIVER("ELD: DisplayPort detectedn");
                eld[5] |= (1 << 2);     /* Conn_Type, 0x1 = DisplayPort */
                I915_WRITE(aud_config, AUD_CONFIG_N_VALUE_INDEX); /* 0x1 = DP */
-       } else
-               I915_WRITE(aud_config, 0);
+       } else {
+               I915_WRITE(aud_config, audio_config_hdmi_pixel_clock(mode));
+       }

Quoted 4 lines

        if (intel_eld_uptodate(connector, aud_cntrl_st2, eldv, --
1.7.9.5

--
Met Vriendelijke Groeten

Jasper Smet
Developer

Quoted 8 lines

Twitter: josbeir
E-mail: [email protected]
Mobile: 0486/41.75.45

Links:
------
[1]
http://mid.gmane.org/CAGpEb3Ep1LRZETPxHGRfBDqr5Ts2tAc8gCukWwugUf1U5NYv1g@mail.gmail.com

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

Signature · 3 lines
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch