[PATCH 2/3 v3] drm: bridge/dw-hdmi: Enable ISCR1, ISCR2 and ACP packets

From: Jose Abreu
Date: Thu Aug 04 2016 - 06:46:51 EST


Currently ISCR and ACP packets are not being sent causing
HDMI compliance tests like CTS 7-19 HDMI 1.4b to fail.

With this pacth the mentioned packets are activated when
needed.

Verified using HDMI compliance equipment.

Signed-off-by: Jose Abreu <joabreu@xxxxxxxxxxxx>
Cc: Carlos Palminha <palminha@xxxxxxxxxxxx>
Cc: Archit Taneja <architt@xxxxxxxxxxxxxx>
Cc: David Airlie <airlied@xxxxxxxx>
Cc: Russell King <rmk+kernel@xxxxxxxxxxxxxxxx>
Cc: Fabio Estevam <fabio.estevam@xxxxxxxxxxxxx>
Cc: Daniel Vetter <daniel.vetter@xxxxxxxx>
Cc: Takashi Iwai <tiwai@xxxxxxx>
Cc: Vladimir Zapolskiy <vladimir_zapolskiy@xxxxxxxxxx>
Cc: Thierry Reding <treding@xxxxxxxxxx>
Cc: dri-devel@xxxxxxxxxxxxxxxxxxxxx
Cc: linux-kernel@xxxxxxxxxxxxxxx
---

This patch was only introduced in v3.

drivers/gpu/drm/bridge/dw-hdmi.c | 21 +++++++++++++++++++++
1 file changed, 21 insertions(+)

diff --git a/drivers/gpu/drm/bridge/dw-hdmi.c b/drivers/gpu/drm/bridge/dw-hdmi.c
index b5fac27..9122a20 100644
--- a/drivers/gpu/drm/bridge/dw-hdmi.c
+++ b/drivers/gpu/drm/bridge/dw-hdmi.c
@@ -127,6 +127,7 @@ struct dw_hdmi {
void __iomem *regs;
bool sink_is_hdmi;
bool sink_has_audio;
+ bool sink_supports_ai;

struct mutex mutex; /* for state below and previous_mode */
enum drm_connector_force force; /* mutex-protected force state */
@@ -216,6 +217,21 @@ static void hdmi_set_cts_n(struct dw_hdmi *hdmi, unsigned int cts,
hdmi_writeb(hdmi, (n >> 8) & 0xff, HDMI_AUD_N2);
hdmi_writeb(hdmi, n & 0xff, HDMI_AUD_N1);

+ /* Set ISCR1, ISCR2, and ACP packets to automatic scheduling */
+ if (hdmi->sink_supports_ai) {
+ dev_dbg(hdmi->dev, "sink supports AI packets\n");
+ hdmi_writeb(hdmi, 0x06, HDMI_FC_ISCR1_0);
+ hdmi_writeb(hdmi, 0x03, HDMI_FC_DATAUTO0);
+ hdmi_writeb(hdmi, 0x01, HDMI_FC_DATAUTO1);
+ hdmi_writeb(hdmi, 0x11, HDMI_FC_DATAUTO2);
+ } else {
+ dev_dbg(hdmi->dev, "sink does not support AI packets\n");
+ hdmi_writeb(hdmi, 0x00, HDMI_FC_ISCR1_0);
+ hdmi_writeb(hdmi, 0x00, HDMI_FC_DATAUTO0);
+ hdmi_writeb(hdmi, 0x00, HDMI_FC_DATAUTO1);
+ hdmi_writeb(hdmi, 0x00, HDMI_FC_DATAUTO2);
+ }
+
/* Set Frame Composer Audio Sample sampling frequency */
if (hdmi->dev_type == DWC_HDMI) {
u8 val = 0x0;
@@ -1474,8 +1490,13 @@ static int dw_hdmi_connector_get_modes(struct drm_connector *connector)
/* Store the ELD */
drm_edid_to_eld(connector, edid);
kfree(edid);
+
+ hdmi->sink_supports_ai = connector->eld[5] & (0x1 << 1);
} else {
dev_dbg(hdmi->dev, "failed to get edid\n");
+ hdmi->sink_is_hdmi = false;
+ hdmi->sink_has_audio = false;
+ hdmi->sink_supports_ai = false;
}

return ret;
--
2.1.4