Intel-GFX Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Lee Shawn C <shawn.c.lee@intel.com>
To: intel-gfx@lists.freedesktop.org
Cc: Cooper Chiou <cooper.chiou@intel.com>
Subject: [Intel-gfx] [PATCH v2] drm/i915/lspcon: enter standby mode to enhance power saving
Date: Wed, 18 Nov 2020 11:30:25 +0800	[thread overview]
Message-ID: <20201118033025.25454-1-shawn.c.lee@intel.com> (raw)
In-Reply-To: <20201116135913.20782-1-shawn.c.lee@intel.com>

After system boot up, LSPCON will be configured as PCON mode.
But it never go into power saving state. Source driver can
do the following. Then LSPCON can enter standby mode
automatically to save more power.

1. At PCON mode, source driver write 0x2 to DPCD 600h.
2. At LS mode, try to disable DP_DUAL_MODE_TMDS_OEN.

v2: fix typo

Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
Cc: Jani Nikula <jani.nikula@linux.intel.com>
Cc: Uma Shankar <uma.shankar@intel.com>
Cc: Cooper Chiou <cooper.chiou@intel.com>
Cc: Khaled Almahallawy <khaled.almahallawy@intel.com>
Signed-off-by: Lee Shawn C <shawn.c.lee@intel.com>
---
 drivers/gpu/drm/i915/display/intel_dp.c     | 7 ++++++-
 drivers/gpu/drm/i915/display/intel_lspcon.c | 8 ++++++++
 drivers/gpu/drm/i915/display/intel_lspcon.h | 1 +
 3 files changed, 15 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/i915/display/intel_dp.c b/drivers/gpu/drm/i915/display/intel_dp.c
index ec8359f03aaf..7dd16d6bd5ba 100644
--- a/drivers/gpu/drm/i915/display/intel_dp.c
+++ b/drivers/gpu/drm/i915/display/intel_dp.c
@@ -6536,6 +6536,7 @@ intel_dp_detect(struct drm_connector *connector,
 	struct drm_i915_private *dev_priv = to_i915(connector->dev);
 	struct intel_dp *intel_dp = intel_attached_dp(to_intel_connector(connector));
 	struct intel_digital_port *dig_port = dp_to_dig_port(intel_dp);
+	struct intel_lspcon *lspcon = dp_to_lspcon(intel_dp);
 	struct intel_encoder *encoder = &dig_port->base;
 	enum drm_connector_status status;
 
@@ -6632,9 +6633,13 @@ intel_dp_detect(struct drm_connector *connector,
 	intel_dp_check_service_irq(intel_dp);
 
 out:
-	if (status != connector_status_connected && !intel_dp->is_mst)
+	if (status != connector_status_connected && !intel_dp->is_mst) {
 		intel_dp_unset_edid(intel_dp);
 
+		if (lspcon && lspcon->active)
+			lspcon_standby(dp_to_dig_port(intel_dp));
+	}
+
 	/*
 	 * Make sure the refs for power wells enabled during detect are
 	 * dropped to avoid a new detect cycle triggered by HPD polling.
diff --git a/drivers/gpu/drm/i915/display/intel_lspcon.c b/drivers/gpu/drm/i915/display/intel_lspcon.c
index e37d45e531df..d9bc052d3bde 100644
--- a/drivers/gpu/drm/i915/display/intel_lspcon.c
+++ b/drivers/gpu/drm/i915/display/intel_lspcon.c
@@ -550,6 +550,14 @@ static bool lspcon_init(struct intel_digital_port *dig_port)
 	return true;
 }
 
+void lspcon_standby(struct intel_digital_port *dig_port)
+{
+	struct intel_dp *dp = &dig_port->dp;
+
+	if (drm_dp_dpcd_writeb(&dp->aux, DP_SET_POWER, DP_SET_POWER_D3) <= 0)
+		DRM_DEBUG_KMS("LSPCON failed to write power state to D3\n");
+}
+
 void lspcon_resume(struct intel_digital_port *dig_port)
 {
 	struct intel_lspcon *lspcon = &dig_port->lspcon;
diff --git a/drivers/gpu/drm/i915/display/intel_lspcon.h b/drivers/gpu/drm/i915/display/intel_lspcon.h
index b03dcb7076d8..658a2e5b22db 100644
--- a/drivers/gpu/drm/i915/display/intel_lspcon.h
+++ b/drivers/gpu/drm/i915/display/intel_lspcon.h
@@ -16,6 +16,7 @@ struct intel_encoder;
 struct intel_lspcon;
 
 void lspcon_resume(struct intel_digital_port *dig_port);
+void lspcon_standby(struct intel_digital_port *dig_port);
 void lspcon_wait_pcon_mode(struct intel_lspcon *lspcon);
 void lspcon_write_infoframe(struct intel_encoder *encoder,
 			    const struct intel_crtc_state *crtc_state,
-- 
2.17.1

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

  parent reply	other threads:[~2020-11-18  3:25 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-16 13:59 [Intel-gfx] [PATCH] drm/i915/lspcon: enter standby mode to enhance power saving Lee Shawn C
2020-11-16 15:20 ` [Intel-gfx] ✓ Fi.CI.BAT: success for " Patchwork
2020-11-16 20:40 ` [Intel-gfx] ✗ Fi.CI.IGT: failure " Patchwork
2020-11-17 16:29 ` [Intel-gfx] [PATCH] " Ville Syrjälä
2020-11-18  3:10   ` Lee, Shawn C
2020-11-18  3:30 ` Lee Shawn C [this message]
2020-11-18  4:27 ` [Intel-gfx] ✓ Fi.CI.BAT: success for drm/i915/lspcon: enter standby mode to enhance power saving (rev2) Patchwork
2020-11-18 11:51 ` [Intel-gfx] ✗ Fi.CI.IGT: failure " Patchwork
2020-11-18 13:21 ` [Intel-gfx] [PATCH v3] drm/i915/lspcon: enter standby mode to enhance power saving Lee Shawn C
2020-11-18 14:26 ` [Intel-gfx] ✗ Fi.CI.BAT: failure for drm/i915/lspcon: enter standby mode to enhance power saving (rev3) Patchwork
2020-11-19  7:29 ` [Intel-gfx] [PATCH v4] drm/i915/lspcon: enter standby mode to enhance power saving Lee Shawn C
2020-11-19 13:30 ` [Intel-gfx] ✗ Fi.CI.BAT: failure for drm/i915/lspcon: enter standby mode to enhance power saving (rev4) Patchwork

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=20201118033025.25454-1-shawn.c.lee@intel.com \
    --to=shawn.c.lee@intel.com \
    --cc=cooper.chiou@intel.com \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox