Re: [PATCH v2 14/17] drm/i915/pps: refactor init abstractions

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 2021-01-08 at 19:44:22 +0200, Jani Nikula wrote:
> Once you realize there is no need to hold the pps mutex when calling
> pps_init_timestamps() in intel_pps_init(), we can reuse
> intel_pps_encoder_reset() which has the same code.
> 
> Since intel_dp_pps_init() is only called from one place now, move it
> inline to remove one "init" function altogether.
> 
> Finally, remove some initialization from
> vlv_initial_power_sequencer_setup() and do it in the caller to highlight
> the similarity, not the difference, in the platforms.
> 
> Signed-off-by: Jani Nikula <jani.nikula@xxxxxxxxx>
> ---
>  drivers/gpu/drm/i915/display/intel_pps.c | 33 +++++++-----------------
>  1 file changed, 10 insertions(+), 23 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/display/intel_pps.c b/drivers/gpu/drm/i915/display/intel_pps.c
> index 58eff6289d12..b4d026ca3313 100644
> --- a/drivers/gpu/drm/i915/display/intel_pps.c
> +++ b/drivers/gpu/drm/i915/display/intel_pps.c
> @@ -305,9 +305,6 @@ vlv_initial_power_sequencer_setup(struct intel_dp *intel_dp)
>  		    dig_port->base.base.base.id,
>  		    dig_port->base.base.name,
>  		    pipe_name(intel_dp->pps_pipe));
> -
> -	pps_init_delays(intel_dp);
> -	pps_init_registers(intel_dp, false);
>  }
>  
>  void intel_pps_reset_all(struct drm_i915_private *dev_priv)
> @@ -1342,20 +1339,9 @@ static void pps_init_registers(struct intel_dp *intel_dp, bool force_disable_vdd
>  		    (intel_de_read(dev_priv, regs.pp_ctrl) & BXT_POWER_CYCLE_DELAY_MASK));
>  }
>  
> -static void intel_dp_pps_init(struct intel_dp *intel_dp)
> -{
> -	struct drm_i915_private *dev_priv = dp_to_i915(intel_dp);
> -
> -	if (IS_VALLEYVIEW(dev_priv) || IS_CHERRYVIEW(dev_priv)) {
> -		vlv_initial_power_sequencer_setup(intel_dp);
> -	} else {
> -		pps_init_delays(intel_dp);
> -		pps_init_registers(intel_dp, false);
> -	}
> -}
> -
>  void intel_pps_encoder_reset(struct intel_dp *intel_dp)
>  {
> +	struct drm_i915_private *i915 = dp_to_i915(intel_dp);
>  	intel_wakeref_t wakeref;
>  
>  	if (!intel_dp_is_edp(intel_dp))
> @@ -1366,20 +1352,21 @@ void intel_pps_encoder_reset(struct intel_dp *intel_dp)
>  		 * Reinit the power sequencer, in case BIOS did something nasty
		IMHO above comment would need a improvement, or nuke it ?
		as intel_pps_encoder_reset() will also get called from intel_pps_init()	
		unlike only while resuming from suspend.
		Thanks,
		Anshuman Gupta.
>  		 * with it.
>  		 */
> -		intel_dp_pps_init(intel_dp);
> +		if (IS_VALLEYVIEW(i915) || IS_CHERRYVIEW(i915))
> +			vlv_initial_power_sequencer_setup(intel_dp);
> +
> +		pps_init_delays(intel_dp);
> +		pps_init_registers(intel_dp, false);
> +
>  		intel_pps_vdd_sanitize(intel_dp);
>  	}
>  }
>  
>  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) {
> -		pps_init_timestamps(intel_dp);
> -		intel_dp_pps_init(intel_dp);
> -		intel_pps_vdd_sanitize(intel_dp);
> -	}
> +	pps_init_timestamps(intel_dp);
> +
> +	intel_pps_encoder_reset(intel_dp);
>  }
> -- 
> 2.20.1
> 
_______________________________________________
Intel-gfx mailing list
Intel-gfx@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/intel-gfx



[Index of Archives]     [AMD Graphics]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux