diff mbox series

[1/3] drm/i915/lspcon: Separate out function to get expected mode

Message ID 20240408050558.865396-2-ankit.k.nautiyal@intel.com (mailing list archive)
State New, archived
Headers show
Series Avoid unwanted lspcon init and probe warnings | expand

Commit Message

Nautiyal, Ankit K April 8, 2024, 5:05 a.m. UTC
Reuse code to wake native aux channel and get the expected lspcon
mode.

Signed-off-by: Ankit Nautiyal <ankit.k.nautiyal@intel.com>
---
 drivers/gpu/drm/i915/display/intel_lspcon.c | 18 ++++++++++--------
 1 file changed, 10 insertions(+), 8 deletions(-)

Comments

Jani Nikula April 8, 2024, 9:46 a.m. UTC | #1
On Mon, 08 Apr 2024, Ankit Nautiyal <ankit.k.nautiyal@intel.com> wrote:
> Reuse code to wake native aux channel and get the expected lspcon
> mode.
>
> Signed-off-by: Ankit Nautiyal <ankit.k.nautiyal@intel.com>

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

> ---
>  drivers/gpu/drm/i915/display/intel_lspcon.c | 18 ++++++++++--------
>  1 file changed, 10 insertions(+), 8 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/display/intel_lspcon.c b/drivers/gpu/drm/i915/display/intel_lspcon.c
> index 1d048fa98561..36e8d9fb2bbb 100644
> --- a/drivers/gpu/drm/i915/display/intel_lspcon.c
> +++ b/drivers/gpu/drm/i915/display/intel_lspcon.c
> @@ -240,6 +240,13 @@ static bool lspcon_wake_native_aux_ch(struct intel_lspcon *lspcon)
>  	return true;
>  }
>  
> +static
> +enum drm_lspcon_mode lspcon_get_expected_mode(struct intel_lspcon *lspcon)
> +{
> +	return lspcon_wake_native_aux_ch(lspcon) ?
> +		DRM_LSPCON_MODE_PCON : DRM_LSPCON_MODE_LS;
> +}
> +
>  static bool lspcon_probe(struct intel_lspcon *lspcon)
>  {
>  	int retry;
> @@ -249,9 +256,7 @@ static bool lspcon_probe(struct intel_lspcon *lspcon)
>  	struct i2c_adapter *ddc = &intel_dp->aux.ddc;
>  	enum drm_lspcon_mode expected_mode;
>  
> -	expected_mode = lspcon_wake_native_aux_ch(lspcon) ?
> -			DRM_LSPCON_MODE_PCON : DRM_LSPCON_MODE_LS;
> -
> +	expected_mode = lspcon_get_expected_mode(lspcon);
>  	/* Lets probe the adaptor and check its type */
>  	for (retry = 0; retry < 6; retry++) {
>  		if (retry)
> @@ -713,12 +718,9 @@ void lspcon_resume(struct intel_digital_port *dig_port)
>  		}
>  	}
>  
> -	if (lspcon_wake_native_aux_ch(lspcon)) {
> -		expected_mode = DRM_LSPCON_MODE_PCON;
> +	expected_mode = lspcon_get_expected_mode(lspcon);
> +	if (expected_mode == DRM_LSPCON_MODE_PCON)
>  		lspcon_resume_in_pcon_wa(lspcon);
> -	} else {
> -		expected_mode = DRM_LSPCON_MODE_LS;
> -	}
>  
>  	if (lspcon_wait_mode(lspcon, expected_mode) == DRM_LSPCON_MODE_PCON)
>  		return;
diff mbox series

Patch

diff --git a/drivers/gpu/drm/i915/display/intel_lspcon.c b/drivers/gpu/drm/i915/display/intel_lspcon.c
index 1d048fa98561..36e8d9fb2bbb 100644
--- a/drivers/gpu/drm/i915/display/intel_lspcon.c
+++ b/drivers/gpu/drm/i915/display/intel_lspcon.c
@@ -240,6 +240,13 @@  static bool lspcon_wake_native_aux_ch(struct intel_lspcon *lspcon)
 	return true;
 }
 
+static
+enum drm_lspcon_mode lspcon_get_expected_mode(struct intel_lspcon *lspcon)
+{
+	return lspcon_wake_native_aux_ch(lspcon) ?
+		DRM_LSPCON_MODE_PCON : DRM_LSPCON_MODE_LS;
+}
+
 static bool lspcon_probe(struct intel_lspcon *lspcon)
 {
 	int retry;
@@ -249,9 +256,7 @@  static bool lspcon_probe(struct intel_lspcon *lspcon)
 	struct i2c_adapter *ddc = &intel_dp->aux.ddc;
 	enum drm_lspcon_mode expected_mode;
 
-	expected_mode = lspcon_wake_native_aux_ch(lspcon) ?
-			DRM_LSPCON_MODE_PCON : DRM_LSPCON_MODE_LS;
-
+	expected_mode = lspcon_get_expected_mode(lspcon);
 	/* Lets probe the adaptor and check its type */
 	for (retry = 0; retry < 6; retry++) {
 		if (retry)
@@ -713,12 +718,9 @@  void lspcon_resume(struct intel_digital_port *dig_port)
 		}
 	}
 
-	if (lspcon_wake_native_aux_ch(lspcon)) {
-		expected_mode = DRM_LSPCON_MODE_PCON;
+	expected_mode = lspcon_get_expected_mode(lspcon);
+	if (expected_mode == DRM_LSPCON_MODE_PCON)
 		lspcon_resume_in_pcon_wa(lspcon);
-	} else {
-		expected_mode = DRM_LSPCON_MODE_LS;
-	}
 
 	if (lspcon_wait_mode(lspcon, expected_mode) == DRM_LSPCON_MODE_PCON)
 		return;