diff mbox

[v2] drm/i915: Standardize port type for DVO encoders

Message ID 1473887010-26301-1-git-send-email-dhinakaran.pandiyan@intel.com (mailing list archive)
State New, archived
Headers show

Commit Message

Dhinakaran Pandiyan Sept. 14, 2016, 9:03 p.m. UTC
Changing the return type from 'char' to 'enum port' in
intel_dvo_port_name() makes it easier to later move the port information to
intel_encoder. In addition, the port type conforms to what we have
elsewhere.

Removing the last conditional that handles invalid port because dvo_reg is
intialized to valid values for all DVO devices at definition.

v2: Changed return type, for real (Jani)

Signed-off-by: Dhinakaran Pandiyan <dhinakaran.pandiyan@intel.com>
---
 drivers/gpu/drm/i915/intel_dvo.c | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

Comments

Dhinakaran Pandiyan Sept. 15, 2016, 12:10 a.m. UTC | #1
This version of the patch has been included in the series "Prep. for DP
audio MST support" since the helper is used by the patch that stores
port in struct intel_encoder.

On Wed, 2016-09-14 at 14:03 -0700, Dhinakaran Pandiyan wrote:
> Changing the return type from 'char' to 'enum port' in

> intel_dvo_port_name() makes it easier to later move the port information to

> intel_encoder. In addition, the port type conforms to what we have

> elsewhere.

> 

> Removing the last conditional that handles invalid port because dvo_reg is

> intialized to valid values for all DVO devices at definition.

> 

> v2: Changed return type, for real (Jani)

> 

> Signed-off-by: Dhinakaran Pandiyan <dhinakaran.pandiyan@intel.com>

> ---

>  drivers/gpu/drm/i915/intel_dvo.c | 14 +++++++-------

>  1 file changed, 7 insertions(+), 7 deletions(-)

> 

> diff --git a/drivers/gpu/drm/i915/intel_dvo.c b/drivers/gpu/drm/i915/intel_dvo.c

> index 2e452c5..6489755 100644

> --- a/drivers/gpu/drm/i915/intel_dvo.c

> +++ b/drivers/gpu/drm/i915/intel_dvo.c

> @@ -412,16 +412,14 @@ intel_dvo_get_current_mode(struct drm_connector *connector)

>  	return mode;

>  }

>  

> -static char intel_dvo_port_name(i915_reg_t dvo_reg)

> +static enum port intel_dvo_port(i915_reg_t dvo_reg)

>  {

>  	if (i915_mmio_reg_equal(dvo_reg, DVOA))

> -		return 'A';

> +		return PORT_A;

>  	else if (i915_mmio_reg_equal(dvo_reg, DVOB))

> -		return 'B';

> -	else if (i915_mmio_reg_equal(dvo_reg, DVOC))

> -		return 'C';

> +		return PORT_B;

>  	else

> -		return '?';

> +		return PORT_C;

>  }

>  

>  void intel_dvo_init(struct drm_device *dev)

> @@ -464,6 +462,7 @@ void intel_dvo_init(struct drm_device *dev)

>  		bool dvoinit;

>  		enum pipe pipe;

>  		uint32_t dpll[I915_MAX_PIPES];

> +		enum port port;

>  

>  		/* Allow the I2C driver info to specify the GPIO to be used in

>  		 * special cases, but otherwise default to what's defined

> @@ -511,9 +510,10 @@ void intel_dvo_init(struct drm_device *dev)

>  		if (!dvoinit)

>  			continue;

>  

> +		port = intel_dvo_port(dvo->dvo_reg);

>  		drm_encoder_init(dev, &intel_encoder->base,

>  				 &intel_dvo_enc_funcs, encoder_type,

> -				 "DVO %c", intel_dvo_port_name(dvo->dvo_reg));

> +				 "DVO %c", port_name(port));

>  

>  		intel_encoder->type = INTEL_OUTPUT_DVO;

>  		intel_encoder->crtc_mask = (1 << 0) | (1 << 1);
diff mbox

Patch

diff --git a/drivers/gpu/drm/i915/intel_dvo.c b/drivers/gpu/drm/i915/intel_dvo.c
index 2e452c5..6489755 100644
--- a/drivers/gpu/drm/i915/intel_dvo.c
+++ b/drivers/gpu/drm/i915/intel_dvo.c
@@ -412,16 +412,14 @@  intel_dvo_get_current_mode(struct drm_connector *connector)
 	return mode;
 }
 
-static char intel_dvo_port_name(i915_reg_t dvo_reg)
+static enum port intel_dvo_port(i915_reg_t dvo_reg)
 {
 	if (i915_mmio_reg_equal(dvo_reg, DVOA))
-		return 'A';
+		return PORT_A;
 	else if (i915_mmio_reg_equal(dvo_reg, DVOB))
-		return 'B';
-	else if (i915_mmio_reg_equal(dvo_reg, DVOC))
-		return 'C';
+		return PORT_B;
 	else
-		return '?';
+		return PORT_C;
 }
 
 void intel_dvo_init(struct drm_device *dev)
@@ -464,6 +462,7 @@  void intel_dvo_init(struct drm_device *dev)
 		bool dvoinit;
 		enum pipe pipe;
 		uint32_t dpll[I915_MAX_PIPES];
+		enum port port;
 
 		/* Allow the I2C driver info to specify the GPIO to be used in
 		 * special cases, but otherwise default to what's defined
@@ -511,9 +510,10 @@  void intel_dvo_init(struct drm_device *dev)
 		if (!dvoinit)
 			continue;
 
+		port = intel_dvo_port(dvo->dvo_reg);
 		drm_encoder_init(dev, &intel_encoder->base,
 				 &intel_dvo_enc_funcs, encoder_type,
-				 "DVO %c", intel_dvo_port_name(dvo->dvo_reg));
+				 "DVO %c", port_name(port));
 
 		intel_encoder->type = INTEL_OUTPUT_DVO;
 		intel_encoder->crtc_mask = (1 << 0) | (1 << 1);