linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: Johan Jonker <jbx6244@gmail.com>
To: heiko@sntech.de
Cc: mark.rutland@arm.com, devicetree@vger.kernel.org,
	airlied@linux.ie, hjc@rock-chips.com,
	dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org,
	linux-rockchip@lists.infradead.org, robh+dt@kernel.org,
	daniel@ffwll.ch, linux-arm-kernel@lists.infradead.org
Subject: [PATCH v5 5/5] drm: rockchip: add fixed screen size DVI-D support for rk3066 hdmi
Date: Thu, 21 Mar 2019 01:14:40 +0100	[thread overview]
Message-ID: <20190321001440.31057-6-jbx6244@gmail.com> (raw)
In-Reply-To: <20190321001440.31057-1-jbx6244@gmail.com>

Add fixed screen size DVI-D support
for rk3066 hdmi with an extra patch.

Signed-off-by: Johan Jonker <jbx6244@gmail.com>
---
 drivers/gpu/drm/rockchip/rk3066_hdmi.c | 25 ++++++++++++++++++++++++-
 1 file changed, 24 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/rockchip/rk3066_hdmi.c b/drivers/gpu/drm/rockchip/rk3066_hdmi.c
index ff8f86152..f656da769 100644
--- a/drivers/gpu/drm/rockchip/rk3066_hdmi.c
+++ b/drivers/gpu/drm/rockchip/rk3066_hdmi.c
@@ -349,11 +349,12 @@ static int rk3066_hdmi_setup(struct rk3066_hdmi *hdmi,
 	if (hdmi->hdmi_data.sink_is_hdmi) {
 		hdmi_modb(hdmi, HDMI_HDCP_CTRL, HDMI_VIDEO_MODE_MASK,
 			  HDMI_VIDEO_MODE_HDMI);
-		rk3066_hdmi_config_avi(hdmi, mode);
 	} else {
 		hdmi_modb(hdmi, HDMI_HDCP_CTRL, HDMI_VIDEO_MODE_MASK, 0);
 	}
 
+	rk3066_hdmi_config_avi(hdmi, mode);
+
 	rk3066_hdmi_config_phy(hdmi);
 
 	rk3066_hdmi_set_power_mode(hdmi, HDMI_SYS_POWER_MODE_E);
@@ -462,15 +463,26 @@ rk3066_hdmi_connector_detect(struct drm_connector *connector, bool force)
 		connector_status_connected : connector_status_disconnected;
 }
 
+static const struct drm_display_mode edid_cea_modes[] = {
+	/* 4 - 1280x720@60Hz 16:9 */
+	{ DRM_MODE("1280x720", DRM_MODE_TYPE_DRIVER, 74250, 1280, 1390,
+		   1430, 1650, 0, 720, 725, 730, 750, 0,
+		   DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC),
+	  .vrefresh = 60, .picture_aspect_ratio = HDMI_PICTURE_ASPECT_16_9, },
+};
+
 static int rk3066_hdmi_connector_get_modes(struct drm_connector *connector)
 {
 	struct rk3066_hdmi *hdmi = to_rk3066_hdmi(connector);
+	struct drm_display_mode *mode = NULL;
 	struct edid *edid;
 	int ret = 0;
 
 	if (!hdmi->ddc)
 		return 0;
 
+	hdmi->hdmi_data.sink_is_hdmi = false;
+
 	edid = drm_get_edid(connector, hdmi->ddc);
 	if (edid) {
 		hdmi->hdmi_data.sink_is_hdmi = drm_detect_hdmi_monitor(edid);
@@ -479,6 +491,17 @@ static int rk3066_hdmi_connector_get_modes(struct drm_connector *connector)
 		kfree(edid);
 	}
 
+	if ((ret == 0) || (hdmi->hdmi_data.sink_is_hdmi == false)) {
+		hdmi->hdmi_data.sink_is_hdmi = false;
+
+		mode = drm_mode_duplicate(hdmi->drm_dev, &edid_cea_modes[0]);
+		if (!mode)
+			return ret;
+		mode->type |= DRM_MODE_TYPE_PREFERRED;
+		drm_mode_probed_add(connector, mode);
+		ret++;
+	}
+
 	return ret;
 }
 
-- 
2.11.0


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

  parent reply	other threads:[~2019-03-21  0:16 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-03-21  0:14 [PATCH v5 0/5] Enable rk3066 VOP and HDMI for MK808 Johan Jonker
2019-03-21  0:14 ` [PATCH v5 1/5] drm: rockchip: introduce rk3066 hdmi Johan Jonker
2019-03-21  0:14 ` [PATCH v5 2/5] ARM: dts: rockchip: add rk3066 hdmi nodes Johan Jonker
2019-03-21  0:14 ` [PATCH v5 3/5] ARM: dts: rockchip: rk3066a-mk808: enable vop0 and " Johan Jonker
2019-03-21  0:14 ` [PATCH v5 4/5] dt-bindings: display: rockchip: add document for rk3066 hdmi Johan Jonker
2019-03-21  0:14 ` Johan Jonker [this message]
2019-03-31 16:19   ` [PATCH v5 5/5] drm: rockchip: add fixed screen size DVI-D support " Heiko Stuebner

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190321001440.31057-6-jbx6244@gmail.com \
    --to=jbx6244@gmail.com \
    --cc=airlied@linux.ie \
    --cc=daniel@ffwll.ch \
    --cc=devicetree@vger.kernel.org \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=heiko@sntech.de \
    --cc=hjc@rock-chips.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-rockchip@lists.infradead.org \
    --cc=mark.rutland@arm.com \
    --cc=robh+dt@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).