diff mbox series

[7/8] drm/i915/pps: Extract pps_units_to_msecs()

Message ID 20241106215859.25446-8-ville.syrjala@linux.intel.com (mailing list archive)
State New
Headers show
Series drm/i915/pps: Some PPS cleanups | expand

Commit Message

Ville Syrjala Nov. 6, 2024, 9:58 p.m. UTC
From: Ville Syrjälä <ville.syrjala@linux.intel.com>

Add pps_units_to_msecs() as the counterpart to msecs_pps_units_to().

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
---
 drivers/gpu/drm/i915/display/intel_pps.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

Comments

Jani Nikula Nov. 7, 2024, 9:20 a.m. UTC | #1
On Wed, 06 Nov 2024, Ville Syrjala <ville.syrjala@linux.intel.com> wrote:
> From: Ville Syrjälä <ville.syrjala@linux.intel.com>
>
> Add pps_units_to_msecs() as the counterpart to msecs_pps_units_to().
>
> Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>

Reviewed-by: Jani Nikula <jani.nikula@intel.com>

> ---
>  drivers/gpu/drm/i915/display/intel_pps.c | 8 +++++++-
>  1 file changed, 7 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/i915/display/intel_pps.c b/drivers/gpu/drm/i915/display/intel_pps.c
> index 5be2903c6aaf..378a525eec16 100644
> --- a/drivers/gpu/drm/i915/display/intel_pps.c
> +++ b/drivers/gpu/drm/i915/display/intel_pps.c
> @@ -1468,6 +1468,12 @@ static int msecs_to_pps_units(int msecs)
>  	return msecs * 10;
>  }
>  
> +static int pps_units_to_msecs(int val)
> +{
> +	/* PPS uses 100us units */
> +	return DIV_ROUND_UP(val, 10);
> +}
> +
>  static void pps_init_delays_bios(struct intel_dp *intel_dp,
>  				 struct intel_pps_delays *bios)
>  {
> @@ -1554,7 +1560,7 @@ static void pps_init_delays(struct intel_dp *intel_dp)
>  	assign_final(power_cycle);
>  #undef assign_final
>  
> -#define get_delay(field)	(DIV_ROUND_UP(final->field, 10))
> +#define get_delay(field)	pps_units_to_msecs(final->field)
>  	intel_dp->pps.panel_power_up_delay = get_delay(power_up);
>  	intel_dp->pps.backlight_on_delay = get_delay(backlight_on);
>  	intel_dp->pps.backlight_off_delay = get_delay(backlight_off);
diff mbox series

Patch

diff --git a/drivers/gpu/drm/i915/display/intel_pps.c b/drivers/gpu/drm/i915/display/intel_pps.c
index 5be2903c6aaf..378a525eec16 100644
--- a/drivers/gpu/drm/i915/display/intel_pps.c
+++ b/drivers/gpu/drm/i915/display/intel_pps.c
@@ -1468,6 +1468,12 @@  static int msecs_to_pps_units(int msecs)
 	return msecs * 10;
 }
 
+static int pps_units_to_msecs(int val)
+{
+	/* PPS uses 100us units */
+	return DIV_ROUND_UP(val, 10);
+}
+
 static void pps_init_delays_bios(struct intel_dp *intel_dp,
 				 struct intel_pps_delays *bios)
 {
@@ -1554,7 +1560,7 @@  static void pps_init_delays(struct intel_dp *intel_dp)
 	assign_final(power_cycle);
 #undef assign_final
 
-#define get_delay(field)	(DIV_ROUND_UP(final->field, 10))
+#define get_delay(field)	pps_units_to_msecs(final->field)
 	intel_dp->pps.panel_power_up_delay = get_delay(power_up);
 	intel_dp->pps.backlight_on_delay = get_delay(backlight_on);
 	intel_dp->pps.backlight_off_delay = get_delay(backlight_off);