diff mbox

[RFC,6/6] drm/i915: Modify refs to intel dp timestamps

Message ID 1412694584-743-7-git-send-email-vandana.kannan@intel.com (mailing list archive)
State New, archived
Headers show

Commit Message

vandana.kannan@intel.com Oct. 7, 2014, 3:09 p.m. UTC
Moving timestamp values to intel_panel as part of moving all refs of PPS to
intel_panel.

Signed-off-by: Vandana Kannan <vandana.kannan@intel.com>
---
 drivers/gpu/drm/i915/intel_dp.c    | 31 ++++++++++++++++---------------
 drivers/gpu/drm/i915/intel_drv.h   | 12 ++++++++----
 drivers/gpu/drm/i915/intel_panel.c |  9 +++++++++
 3 files changed, 33 insertions(+), 19 deletions(-)
diff mbox

Patch

diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c
index 36c6b3b..4959c86 100644
--- a/drivers/gpu/drm/i915/intel_dp.c
+++ b/drivers/gpu/drm/i915/intel_dp.c
@@ -1326,7 +1326,8 @@  static void wait_panel_power_cycle(struct intel_dp *intel_dp)
 
 	/* When we disable the VDD override bit last we have to do the manual
 	 * wait. */
-	wait_remaining_ms_from_jiffies(intel_dp->last_power_cycle,
+	wait_remaining_ms_from_jiffies(
+			intel_connector->panel.pps.last_power_cycle,
 			intel_connector->panel.pps.panel_power_cycle_delay);
 
 	wait_panel_status(intel_dp, IDLE_CYCLE_MASK, IDLE_CYCLE_VALUE);
@@ -1335,14 +1336,18 @@  static void wait_panel_power_cycle(struct intel_dp *intel_dp)
 static void wait_backlight_on(struct intel_dp *intel_dp)
 {
 	struct intel_connector *intel_connector = intel_dp->attached_connector;
-	wait_remaining_ms_from_jiffies(intel_dp->last_power_on,
+
+	wait_remaining_ms_from_jiffies(
+			intel_connector->panel.pps.last_power_on,
 			intel_connector->panel.pps.backlight_on_delay);
 }
 
 static void edp_wait_backlight_off(struct intel_dp *intel_dp)
 {
 	struct intel_connector *intel_connector = intel_dp->attached_connector;
-	wait_remaining_ms_from_jiffies(intel_dp->last_backlight_off,
+
+	wait_remaining_ms_from_jiffies(
+			intel_connector->panel.pps.last_backlight_off,
 			intel_connector->panel.pps.backlight_off_delay);
 }
 
@@ -1448,6 +1453,7 @@  static void edp_panel_vdd_off_sync(struct intel_dp *intel_dp)
 	struct intel_digital_port *intel_dig_port =
 		dp_to_dig_port(intel_dp);
 	struct intel_encoder *intel_encoder = &intel_dig_port->base;
+	struct intel_connector *intel_connector = intel_dp->attached_connector;
 	enum intel_display_power_domain power_domain;
 	u32 pp;
 	u32 pp_stat_reg, pp_ctrl_reg;
@@ -1475,7 +1481,7 @@  static void edp_panel_vdd_off_sync(struct intel_dp *intel_dp)
 	I915_READ(pp_stat_reg), I915_READ(pp_ctrl_reg));
 
 	if ((pp & POWER_TARGET_ON) == 0)
-		intel_dp->last_power_cycle = jiffies;
+		intel_connector->panel.pps.last_power_cycle = jiffies;
 
 	power_domain = intel_display_port_power_domain(intel_encoder);
 	intel_display_power_put(dev_priv, power_domain);
@@ -1552,6 +1558,7 @@  void intel_edp_panel_on(struct intel_dp *intel_dp)
 {
 	struct drm_device *dev = intel_dp_to_dev(intel_dp);
 	struct drm_i915_private *dev_priv = dev->dev_private;
+	struct intel_connector *intel_connector = intel_dp->attached_connector;
 	u32 pp;
 	u32 pp_ctrl_reg;
 
@@ -1586,7 +1593,7 @@  void intel_edp_panel_on(struct intel_dp *intel_dp)
 	POSTING_READ(pp_ctrl_reg);
 
 	wait_panel_on(intel_dp);
-	intel_dp->last_power_on = jiffies;
+	intel_connector->panel.pps.last_power_on = jiffies;
 
 	if (IS_GEN5(dev)) {
 		pp |= PANEL_POWER_RESET; /* restore panel reset bit */
@@ -1602,6 +1609,7 @@  void intel_edp_panel_off(struct intel_dp *intel_dp)
 {
 	struct intel_digital_port *intel_dig_port = dp_to_dig_port(intel_dp);
 	struct intel_encoder *intel_encoder = &intel_dig_port->base;
+	struct intel_connector *intel_connector = intel_dp->attached_connector;
 	struct drm_device *dev = intel_dp_to_dev(intel_dp);
 	struct drm_i915_private *dev_priv = dev->dev_private;
 	enum intel_display_power_domain power_domain;
@@ -1630,7 +1638,7 @@  void intel_edp_panel_off(struct intel_dp *intel_dp)
 	I915_WRITE(pp_ctrl_reg, pp);
 	POSTING_READ(pp_ctrl_reg);
 
-	intel_dp->last_power_cycle = jiffies;
+	intel_connector->panel.pps.last_power_cycle = jiffies;
 	wait_panel_off(intel_dp);
 
 	/* We got a reference when we enabled the VDD. */
@@ -1687,6 +1695,7 @@  static void _intel_edp_backlight_off(struct intel_dp *intel_dp)
 {
 	struct drm_device *dev = intel_dp_to_dev(intel_dp);
 	struct drm_i915_private *dev_priv = dev->dev_private;
+	struct intel_connector *intel_connector = intel_dp->attached_connector;
 	u32 pp;
 	u32 pp_ctrl_reg;
 
@@ -1705,7 +1714,7 @@  static void _intel_edp_backlight_off(struct intel_dp *intel_dp)
 
 	pps_unlock(intel_dp);
 
-	intel_dp->last_backlight_off = jiffies;
+	intel_connector->panel.pps.last_backlight_off = jiffies;
 	edp_wait_backlight_off(intel_dp);
 }
 
@@ -4647,13 +4656,6 @@  intel_dp_add_properties(struct intel_dp *intel_dp, struct drm_connector *connect
 	}
 }
 
-static void intel_dp_init_panel_power_timestamps(struct intel_dp *intel_dp)
-{
-	intel_dp->last_power_cycle = jiffies;
-	intel_dp->last_power_on = jiffies;
-	intel_dp->last_backlight_off = jiffies;
-}
-
 void intel_dp_set_drrs_state(struct drm_device *dev, int refresh_rate)
 {
 	struct drm_i915_private *dev_priv = dev->dev_private;
@@ -4854,7 +4856,6 @@  static bool intel_edp_init_connector(struct intel_dp *intel_dp,
 	}
 
 	pps_lock(intel_dp);
-	intel_dp_init_panel_power_timestamps(intel_dp);
 	intel_panel_setup_panel_power_sequencer(intel_connector);
 	intel_panel_set_pps_registers(intel_connector, port);
 	pps_unlock(intel_dp);
diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/intel_drv.h
index 687d581..1718510 100644
--- a/drivers/gpu/drm/i915/intel_drv.h
+++ b/drivers/gpu/drm/i915/intel_drv.h
@@ -191,6 +191,10 @@  struct intel_panel {
 		int panel_power_cycle_delay;
 		int backlight_on_delay;
 		int backlight_off_delay;
+		/* timestamps */
+		unsigned long last_power_cycle;
+		unsigned long last_power_on;
+		unsigned long last_backlight_off;
 	} pps;
 };
 
@@ -578,16 +582,16 @@  struct intel_dp {
 	uint8_t downstream_ports[DP_MAX_DOWNSTREAM_PORTS];
 	struct drm_dp_aux aux;
 	uint8_t train_set[4];
-	int panel_power_up_delay;
+	/*int panel_power_up_delay;
 	int panel_power_down_delay;
 	int panel_power_cycle_delay;
 	int backlight_on_delay;
-	int backlight_off_delay;
+	int backlight_off_delay;*/
 	struct delayed_work panel_vdd_work;
 	bool want_panel_vdd;
-	unsigned long last_power_cycle;
+	/*unsigned long last_power_cycle;
 	unsigned long last_power_on;
-	unsigned long last_backlight_off;
+	unsigned long last_backlight_off;*/
 
 	struct notifier_block edp_notifier;
 
diff --git a/drivers/gpu/drm/i915/intel_panel.c b/drivers/gpu/drm/i915/intel_panel.c
index 9f7cb7a..6104273 100644
--- a/drivers/gpu/drm/i915/intel_panel.c
+++ b/drivers/gpu/drm/i915/intel_panel.c
@@ -1427,6 +1427,13 @@  static struct edp_power_seq vlv_setup_pps(struct intel_connector *connector)
 				pp_off_reg, pp_div_reg);
 }
 
+static void intel_panel_init_pps_timestamps(struct intel_panel *panel)
+{
+	panel->pps.last_power_cycle = jiffies;
+	panel->pps.last_power_on = jiffies;
+	panel->pps.last_backlight_off = jiffies;
+}
+
 void intel_panel_setup_panel_power_sequencer(struct intel_connector *connector)
 {
 	struct drm_device *dev = connector->base.dev;
@@ -1434,6 +1441,8 @@  void intel_panel_setup_panel_power_sequencer(struct intel_connector *connector)
 	struct intel_panel *panel = &connector->panel;
 	struct edp_power_seq cur, spec, vbt, final;
 
+	intel_panel_init_pps_timestamps(panel);
+
 	/* Get chip specific register values */
 	cur = dev_priv->display.setup_panel_power_seq(connector);