diff mbox series

[07/13] drm/i915/pps: add higher level intel_pps_init() call

Message ID 83bb1fee149aacc4f208719861327a3e04bb63a7.1608648128.git.jani.nikula@intel.com (mailing list archive)
State New, archived
Headers show
Series drm/i915/dp: split out pps and aux | expand

Commit Message

Jani Nikula Dec. 22, 2020, 2:49 p.m. UTC
Add a new init call to be called only once, unlike some of the other
various init calls. This lets us hide more functions within intel_pps.c.

Signed-off-by: Jani Nikula <jani.nikula@intel.com>
---
 drivers/gpu/drm/i915/display/intel_dp.c  |  9 +--------
 drivers/gpu/drm/i915/display/intel_pps.c | 17 +++++++++++++++--
 drivers/gpu/drm/i915/display/intel_pps.h |  3 +--
 3 files changed, 17 insertions(+), 12 deletions(-)

Comments

Gupta, Anshuman Dec. 29, 2020, 6:53 a.m. UTC | #1
On 2020-12-22 at 20:19:47 +0530, Jani Nikula wrote:
> Add a new init call to be called only once, unlike some of the other
> various init calls. This lets us hide more functions within intel_pps.c.
> 
> Signed-off-by: Jani Nikula <jani.nikula@intel.com>
Looks good to me.
Reviewed-by: Anshuman Gupta <anshuman.gupta@intel.com>
> ---
>  drivers/gpu/drm/i915/display/intel_dp.c  |  9 +--------
>  drivers/gpu/drm/i915/display/intel_pps.c | 17 +++++++++++++++--
>  drivers/gpu/drm/i915/display/intel_pps.h |  3 +--
>  3 files changed, 17 insertions(+), 12 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/display/intel_dp.c b/drivers/gpu/drm/i915/display/intel_dp.c
> index 1a34c9351c30..de2642d5be3b 100644
> --- a/drivers/gpu/drm/i915/display/intel_dp.c
> +++ b/drivers/gpu/drm/i915/display/intel_dp.c
> @@ -6586,14 +6586,11 @@ static bool intel_edp_init_connector(struct intel_dp *intel_dp,
>  	struct drm_display_mode *downclock_mode = NULL;
>  	bool has_dpcd;
>  	enum pipe pipe = INVALID_PIPE;
> -	intel_wakeref_t wakeref;
>  	struct edid *edid;
>  
>  	if (!intel_dp_is_edp(intel_dp))
>  		return true;
>  
> -	INIT_DELAYED_WORK(&intel_dp->panel_vdd_work, edp_panel_vdd_work);
> -
>  	/*
>  	 * On IBX/CPT we may get here with LVDS already registered. Since the
>  	 * driver uses the only internal power sequencer available for both
> @@ -6609,11 +6606,7 @@ static bool intel_edp_init_connector(struct intel_dp *intel_dp,
>  		return false;
>  	}
>  
> -	with_intel_pps_lock(intel_dp, wakeref) {
> -		intel_dp_init_panel_power_timestamps(intel_dp);
> -		intel_dp_pps_init(intel_dp);
> -		intel_pps_vdd_sanitize(intel_dp);
> -	}
> +	intel_pps_init(intel_dp);
>  
>  	/* Cache DPCD and EDID for edp. */
>  	has_dpcd = intel_edp_init_dpcd(intel_dp);
> diff --git a/drivers/gpu/drm/i915/display/intel_pps.c b/drivers/gpu/drm/i915/display/intel_pps.c
> index acd6d0092bc6..651c79ce4bdd 100644
> --- a/drivers/gpu/drm/i915/display/intel_pps.c
> +++ b/drivers/gpu/drm/i915/display/intel_pps.c
> @@ -697,7 +697,7 @@ void intel_pps_vdd_off_sync(struct intel_dp *intel_dp)
>  		intel_pps_vdd_off_sync_unlocked(intel_dp);
>  }
>  
> -void edp_panel_vdd_work(struct work_struct *__work)
> +static void edp_panel_vdd_work(struct work_struct *__work)
>  {
>  	struct intel_dp *intel_dp =
>  		container_of(to_delayed_work(__work),
> @@ -1081,7 +1081,7 @@ bool intel_pps_have_power(struct intel_dp *intel_dp)
>  	return have_power;
>  }
>  
> -void intel_dp_init_panel_power_timestamps(struct intel_dp *intel_dp)
> +static void intel_dp_init_panel_power_timestamps(struct intel_dp *intel_dp)
>  {
>  	intel_dp->panel_power_off_time = ktime_get_boottime();
>  	intel_dp->last_power_on = jiffies;
> @@ -1351,3 +1351,16 @@ void intel_dp_pps_init(struct intel_dp *intel_dp)
>  		intel_dp_init_panel_power_sequencer_registers(intel_dp, false);
>  	}
>  }
> +
> +void intel_pps_init(struct intel_dp *intel_dp)
> +{
> +	intel_wakeref_t wakeref;
> +
> +	INIT_DELAYED_WORK(&intel_dp->panel_vdd_work, edp_panel_vdd_work);
> +
> +	with_intel_pps_lock(intel_dp, wakeref) {
> +		intel_dp_init_panel_power_timestamps(intel_dp);
> +		intel_dp_pps_init(intel_dp);
> +		intel_pps_vdd_sanitize(intel_dp);
> +	}
> +}
> diff --git a/drivers/gpu/drm/i915/display/intel_pps.h b/drivers/gpu/drm/i915/display/intel_pps.h
> index 3cab183658c6..53c0fafd1440 100644
> --- a/drivers/gpu/drm/i915/display/intel_pps.h
> +++ b/drivers/gpu/drm/i915/display/intel_pps.h
> @@ -31,7 +31,6 @@ bool intel_pps_vdd_on_unlocked(struct intel_dp *intel_dp);
>  void intel_pps_vdd_off_unlocked(struct intel_dp *intel_dp, bool sync);
>  void intel_pps_on_unlocked(struct intel_dp *intel_dp);
>  void intel_pps_off_unlocked(struct intel_dp *intel_dp);
> -void edp_panel_vdd_work(struct work_struct *__work);
>  
>  void intel_pps_vdd_sanitize(struct intel_dp *intel_dp);
>  void intel_pps_vdd_on(struct intel_dp *intel_dp);
> @@ -42,9 +41,9 @@ bool intel_pps_have_power(struct intel_dp *intel_dp);
>  
>  void wait_panel_power_cycle(struct intel_dp *intel_dp);
>  
> +void intel_pps_init(struct intel_dp *intel_dp);
>  void intel_dp_pps_init(struct intel_dp *intel_dp);
>  void intel_power_sequencer_reset(struct drm_i915_private *i915);
> -void intel_dp_init_panel_power_timestamps(struct intel_dp *intel_dp);
>  
>  void vlv_init_panel_power_sequencer(struct intel_encoder *encoder,
>  				    const struct intel_crtc_state *crtc_state);
> -- 
> 2.20.1
> 
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/intel-gfx
diff mbox series

Patch

diff --git a/drivers/gpu/drm/i915/display/intel_dp.c b/drivers/gpu/drm/i915/display/intel_dp.c
index 1a34c9351c30..de2642d5be3b 100644
--- a/drivers/gpu/drm/i915/display/intel_dp.c
+++ b/drivers/gpu/drm/i915/display/intel_dp.c
@@ -6586,14 +6586,11 @@  static bool intel_edp_init_connector(struct intel_dp *intel_dp,
 	struct drm_display_mode *downclock_mode = NULL;
 	bool has_dpcd;
 	enum pipe pipe = INVALID_PIPE;
-	intel_wakeref_t wakeref;
 	struct edid *edid;
 
 	if (!intel_dp_is_edp(intel_dp))
 		return true;
 
-	INIT_DELAYED_WORK(&intel_dp->panel_vdd_work, edp_panel_vdd_work);
-
 	/*
 	 * On IBX/CPT we may get here with LVDS already registered. Since the
 	 * driver uses the only internal power sequencer available for both
@@ -6609,11 +6606,7 @@  static bool intel_edp_init_connector(struct intel_dp *intel_dp,
 		return false;
 	}
 
-	with_intel_pps_lock(intel_dp, wakeref) {
-		intel_dp_init_panel_power_timestamps(intel_dp);
-		intel_dp_pps_init(intel_dp);
-		intel_pps_vdd_sanitize(intel_dp);
-	}
+	intel_pps_init(intel_dp);
 
 	/* Cache DPCD and EDID for edp. */
 	has_dpcd = intel_edp_init_dpcd(intel_dp);
diff --git a/drivers/gpu/drm/i915/display/intel_pps.c b/drivers/gpu/drm/i915/display/intel_pps.c
index acd6d0092bc6..651c79ce4bdd 100644
--- a/drivers/gpu/drm/i915/display/intel_pps.c
+++ b/drivers/gpu/drm/i915/display/intel_pps.c
@@ -697,7 +697,7 @@  void intel_pps_vdd_off_sync(struct intel_dp *intel_dp)
 		intel_pps_vdd_off_sync_unlocked(intel_dp);
 }
 
-void edp_panel_vdd_work(struct work_struct *__work)
+static void edp_panel_vdd_work(struct work_struct *__work)
 {
 	struct intel_dp *intel_dp =
 		container_of(to_delayed_work(__work),
@@ -1081,7 +1081,7 @@  bool intel_pps_have_power(struct intel_dp *intel_dp)
 	return have_power;
 }
 
-void intel_dp_init_panel_power_timestamps(struct intel_dp *intel_dp)
+static void intel_dp_init_panel_power_timestamps(struct intel_dp *intel_dp)
 {
 	intel_dp->panel_power_off_time = ktime_get_boottime();
 	intel_dp->last_power_on = jiffies;
@@ -1351,3 +1351,16 @@  void intel_dp_pps_init(struct intel_dp *intel_dp)
 		intel_dp_init_panel_power_sequencer_registers(intel_dp, false);
 	}
 }
+
+void intel_pps_init(struct intel_dp *intel_dp)
+{
+	intel_wakeref_t wakeref;
+
+	INIT_DELAYED_WORK(&intel_dp->panel_vdd_work, edp_panel_vdd_work);
+
+	with_intel_pps_lock(intel_dp, wakeref) {
+		intel_dp_init_panel_power_timestamps(intel_dp);
+		intel_dp_pps_init(intel_dp);
+		intel_pps_vdd_sanitize(intel_dp);
+	}
+}
diff --git a/drivers/gpu/drm/i915/display/intel_pps.h b/drivers/gpu/drm/i915/display/intel_pps.h
index 3cab183658c6..53c0fafd1440 100644
--- a/drivers/gpu/drm/i915/display/intel_pps.h
+++ b/drivers/gpu/drm/i915/display/intel_pps.h
@@ -31,7 +31,6 @@  bool intel_pps_vdd_on_unlocked(struct intel_dp *intel_dp);
 void intel_pps_vdd_off_unlocked(struct intel_dp *intel_dp, bool sync);
 void intel_pps_on_unlocked(struct intel_dp *intel_dp);
 void intel_pps_off_unlocked(struct intel_dp *intel_dp);
-void edp_panel_vdd_work(struct work_struct *__work);
 
 void intel_pps_vdd_sanitize(struct intel_dp *intel_dp);
 void intel_pps_vdd_on(struct intel_dp *intel_dp);
@@ -42,9 +41,9 @@  bool intel_pps_have_power(struct intel_dp *intel_dp);
 
 void wait_panel_power_cycle(struct intel_dp *intel_dp);
 
+void intel_pps_init(struct intel_dp *intel_dp);
 void intel_dp_pps_init(struct intel_dp *intel_dp);
 void intel_power_sequencer_reset(struct drm_i915_private *i915);
-void intel_dp_init_panel_power_timestamps(struct intel_dp *intel_dp);
 
 void vlv_init_panel_power_sequencer(struct intel_encoder *encoder,
 				    const struct intel_crtc_state *crtc_state);