All of lore.kernel.org
 help / color / mirror / Atom feed
From: Siva Chandra <sivachandra@chromium.org>
To: intel-gfx@lists.freedesktop.org
Subject: [PATCH] drm/i915: Add a DRM property "psr"
Date: Tue, 18 Mar 2014 12:51:07 -0700	[thread overview]
Message-ID: <1395172267-9203-1-git-send-email-sivachandra@chromium.org> (raw)

This property helps one turn PSR "on" and "off" via xrandr.
The default value is same as that of the module param i915.enable_psr.

Signed-off-by: Siva Chandra <sivachandra@google.com>
---
 drivers/gpu/drm/i915/i915_drv.h |  6 ++++++
 drivers/gpu/drm/i915/intel_dp.c | 37 +++++++++++++++++++++++++++++++++++++
 2 files changed, 43 insertions(+)

diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
index 70fbe90..83e6303 100644
--- a/drivers/gpu/drm/i915/i915_drv.h
+++ b/drivers/gpu/drm/i915/i915_drv.h
@@ -1607,6 +1607,7 @@ typedef struct drm_i915_private {
 
 	struct drm_property *broadcast_rgb_property;
 	struct drm_property *force_audio_property;
+	struct drm_property *psr_property;
 
 	uint32_t hw_context_size;
 	struct list_head context_list;
@@ -1661,6 +1662,11 @@ enum hdmi_force_audio {
 	HDMI_AUDIO_ON,			/* force turn on HDMI audio */
 };
 
+enum psr_state {
+	EDP_PSR_ON,
+	EDP_PSR_OFF
+};
+
 #define I915_GTT_OFFSET_NONE ((u32)-1)
 
 struct drm_i915_gem_object_ops {
diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c
index 59ee4dc..c4546fa 100644
--- a/drivers/gpu/drm/i915/intel_dp.c
+++ b/drivers/gpu/drm/i915/intel_dp.c
@@ -3197,6 +3197,33 @@ static int intel_dp_get_modes(struct drm_connector *connector)
 	return 0;
 }
 
+static const struct drm_prop_enum_list psr_names[] = {
+	{ EDP_PSR_ON, "on" },
+	{ EDP_PSR_OFF, "off" }
+};
+
+static void intel_attach_psr_property(struct drm_connector *connector)
+{
+	struct drm_device *dev = connector->dev;
+	struct drm_i915_private *dev_priv = dev->dev_private;
+	struct drm_property *prop;
+
+	prop = dev_priv->psr_property;
+	if (prop == NULL) {
+		prop = drm_property_create_enum(
+			dev,
+			i915.enable_psr ? EDP_PSR_ON : EDP_PSR_OFF,
+			"psr",
+			psr_names,
+			ARRAY_SIZE(psr_names));
+		if (prop == NULL)
+			return;
+
+		dev_priv->psr_property = prop;
+	}
+	drm_object_attach_property(&connector->base, prop, 0);
+}
+
 static bool
 intel_dp_detect_audio(struct drm_connector *connector)
 {
@@ -3302,6 +3329,15 @@ intel_dp_set_property(struct drm_connector *connector,
 		goto done;
 	}
 
+	if (is_edp(intel_dp) && property == dev_priv->psr_property) {
+		if (val == EDP_PSR_ON)
+			intel_edp_psr_enable(intel_dp);
+		else
+			intel_edp_psr_disable(intel_dp);
+
+		return 0;
+	}
+
 	return -EINVAL;
 
 done:
@@ -3424,6 +3460,7 @@ intel_dp_add_properties(struct intel_dp *intel_dp, struct drm_connector *connect
 {
 	struct intel_connector *intel_connector = to_intel_connector(connector);
 
+	intel_attach_psr_property(connector);
 	intel_attach_force_audio_property(connector);
 	intel_attach_broadcast_rgb_property(connector);
 	intel_dp->color_range_auto = true;
-- 
1.9.0.279.gdc9e3eb

             reply	other threads:[~2014-03-18 19:51 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-03-18 19:51 Siva Chandra [this message]
2014-03-18 20:06 ` [PATCH] drm/i915: Add a DRM property "psr" Jesse Barnes
2014-03-18 20:53   ` Siva Chandra
2014-03-19  8:44     ` Daniel Vetter
2014-03-19 15:03       ` Damien Lespiau
2014-03-19 17:04         ` Siva Chandra
2014-03-20 10:52           ` Jani Nikula
2014-03-20 13:17             ` Siva Chandra
2014-03-20 13:25               ` Jani Nikula
2014-03-20 13:31                 ` Siva Chandra
2014-03-20 14:49                   ` Jani Nikula
2014-03-20 15:16                     ` Ville Syrjälä
2014-03-21 21:10                     ` Siva Chandra
2014-03-19 15:32       ` Jani Nikula
2014-03-19 16:59         ` Siva Chandra

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=1395172267-9203-1-git-send-email-sivachandra@chromium.org \
    --to=sivachandra@chromium.org \
    --cc=intel-gfx@lists.freedesktop.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.