diff mbox series

[v2,16/25] drm/i915/tgl: port to ddc pin mapping

Message ID 20190708231629.9296-17-lucas.demarchi@intel.com (mailing list archive)
State New, archived
Headers show
Series [v2,01/25] drm/i915: Add 4th pipe and transcoder | expand

Commit Message

Lucas De Marchi July 8, 2019, 11:16 p.m. UTC
From: Mahesh Kumar <mahesh1.kumar@intel.com>

Create a helper function to get ddc pin according to port number.

Cc: Anusha Srivatsa <anusha.srivatsa@intel.com>
Signed-off-by: Mahesh Kumar <mahesh1.kumar@intel.com>
Signed-off-by: Lucas De Marchi <lucas.demarchi@intel.com>
---
 drivers/gpu/drm/i915/display/intel_hdmi.c | 16 +++++++++++++++-
 1 file changed, 15 insertions(+), 1 deletion(-)

Comments

Rodrigo Vivi July 9, 2019, 12:11 p.m. UTC | #1
On Mon, Jul 08, 2019 at 04:16:20PM -0700, Lucas De Marchi wrote:
> From: Mahesh Kumar <mahesh1.kumar@intel.com>
> 
> Create a helper function to get ddc pin according to port number.

Could you please explain why we can't simply reuse the icl one?

I couldn't find a new table for tgl on bspec...

> 
> Cc: Anusha Srivatsa <anusha.srivatsa@intel.com>
> Signed-off-by: Mahesh Kumar <mahesh1.kumar@intel.com>
> Signed-off-by: Lucas De Marchi <lucas.demarchi@intel.com>
> ---
>  drivers/gpu/drm/i915/display/intel_hdmi.c | 16 +++++++++++++++-
>  1 file changed, 15 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/i915/display/intel_hdmi.c b/drivers/gpu/drm/i915/display/intel_hdmi.c
> index 0ebec69bbbfc..3b33e7626d7c 100644
> --- a/drivers/gpu/drm/i915/display/intel_hdmi.c
> +++ b/drivers/gpu/drm/i915/display/intel_hdmi.c
> @@ -2981,6 +2981,18 @@ static u8 mcc_port_to_ddc_pin(struct drm_i915_private *dev_priv, enum port port)
>  	return ddc_pin;
>  }
>  
> +static u8 tgp_port_to_ddc_pin(struct drm_i915_private *dev_priv,
> +			      enum port port)
> +{
> +	if (intel_port_is_combophy(dev_priv, port))
> +		return GMBUS_PIN_1_BXT + port;
> +	else if (intel_port_is_tc(dev_priv, port))
> +		return GMBUS_PIN_9_TC1_ICP + intel_port_to_tc(dev_priv, port);

okay, this seems better than the table we have on icl func,
but couldn't we just change the icl one?

> +
> +	WARN(1, "Unknown port:%c\n", port_name(port));
> +	return GMBUS_PIN_2_BXT;
> +}
> +
>  static u8 g4x_port_to_ddc_pin(struct drm_i915_private *dev_priv,
>  			      enum port port)
>  {
> @@ -3017,7 +3029,9 @@ static u8 intel_hdmi_ddc_pin(struct drm_i915_private *dev_priv,
>  		return info->alternate_ddc_pin;
>  	}
>  
> -	if (HAS_PCH_MCC(dev_priv))
> +	if (HAS_PCH_TGP(dev_priv))
> +		ddc_pin = tgp_port_to_ddc_pin(dev_priv, port);
> +	else if (HAS_PCH_MCC(dev_priv))
>  		ddc_pin = mcc_port_to_ddc_pin(dev_priv, port);
>  	else if (HAS_PCH_ICP(dev_priv))
>  		ddc_pin = icl_port_to_ddc_pin(dev_priv, port);
> -- 
> 2.21.0
> 
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Lucas De Marchi July 9, 2019, 4:28 p.m. UTC | #2
On Tue, Jul 09, 2019 at 05:11:08AM -0700, Rodrigo Vivi wrote:
>On Mon, Jul 08, 2019 at 04:16:20PM -0700, Lucas De Marchi wrote:
>> From: Mahesh Kumar <mahesh1.kumar@intel.com>
>>
>> Create a helper function to get ddc pin according to port number.
>
>Could you please explain why we can't simply reuse the icl one?
>
>I couldn't find a new table for tgl on bspec...
>
>>
>> Cc: Anusha Srivatsa <anusha.srivatsa@intel.com>
>> Signed-off-by: Mahesh Kumar <mahesh1.kumar@intel.com>
>> Signed-off-by: Lucas De Marchi <lucas.demarchi@intel.com>
>> ---
>>  drivers/gpu/drm/i915/display/intel_hdmi.c | 16 +++++++++++++++-
>>  1 file changed, 15 insertions(+), 1 deletion(-)
>>
>> diff --git a/drivers/gpu/drm/i915/display/intel_hdmi.c b/drivers/gpu/drm/i915/display/intel_hdmi.c
>> index 0ebec69bbbfc..3b33e7626d7c 100644
>> --- a/drivers/gpu/drm/i915/display/intel_hdmi.c
>> +++ b/drivers/gpu/drm/i915/display/intel_hdmi.c
>> @@ -2981,6 +2981,18 @@ static u8 mcc_port_to_ddc_pin(struct drm_i915_private *dev_priv, enum port port)
>>  	return ddc_pin;
>>  }
>>
>> +static u8 tgp_port_to_ddc_pin(struct drm_i915_private *dev_priv,
>> +			      enum port port)
>> +{
>> +	if (intel_port_is_combophy(dev_priv, port))
>> +		return GMBUS_PIN_1_BXT + port;
>> +	else if (intel_port_is_tc(dev_priv, port))
>> +		return GMBUS_PIN_9_TC1_ICP + intel_port_to_tc(dev_priv, port);
>
>okay, this seems better than the table we have on icl func,
>but couldn't we just change the icl one?

I think initially we had it implemented like in the icl function, and on
tgl we have the additional combo port. With the reworks to use
intel_port_to_tc() I didn't realize this now applies to icl as well.

I will change it in next version.

Thanks
Lucas De Marchi

>
>> +
>> +	WARN(1, "Unknown port:%c\n", port_name(port));
>> +	return GMBUS_PIN_2_BXT;
>> +}
>> +
>>  static u8 g4x_port_to_ddc_pin(struct drm_i915_private *dev_priv,
>>  			      enum port port)
>>  {
>> @@ -3017,7 +3029,9 @@ static u8 intel_hdmi_ddc_pin(struct drm_i915_private *dev_priv,
>>  		return info->alternate_ddc_pin;
>>  	}
>>
>> -	if (HAS_PCH_MCC(dev_priv))
>> +	if (HAS_PCH_TGP(dev_priv))
>> +		ddc_pin = tgp_port_to_ddc_pin(dev_priv, port);
>> +	else if (HAS_PCH_MCC(dev_priv))
>>  		ddc_pin = mcc_port_to_ddc_pin(dev_priv, port);
>>  	else if (HAS_PCH_ICP(dev_priv))
>>  		ddc_pin = icl_port_to_ddc_pin(dev_priv, port);
>> --
>> 2.21.0
>>
>> _______________________________________________
>> 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_hdmi.c b/drivers/gpu/drm/i915/display/intel_hdmi.c
index 0ebec69bbbfc..3b33e7626d7c 100644
--- a/drivers/gpu/drm/i915/display/intel_hdmi.c
+++ b/drivers/gpu/drm/i915/display/intel_hdmi.c
@@ -2981,6 +2981,18 @@  static u8 mcc_port_to_ddc_pin(struct drm_i915_private *dev_priv, enum port port)
 	return ddc_pin;
 }
 
+static u8 tgp_port_to_ddc_pin(struct drm_i915_private *dev_priv,
+			      enum port port)
+{
+	if (intel_port_is_combophy(dev_priv, port))
+		return GMBUS_PIN_1_BXT + port;
+	else if (intel_port_is_tc(dev_priv, port))
+		return GMBUS_PIN_9_TC1_ICP + intel_port_to_tc(dev_priv, port);
+
+	WARN(1, "Unknown port:%c\n", port_name(port));
+	return GMBUS_PIN_2_BXT;
+}
+
 static u8 g4x_port_to_ddc_pin(struct drm_i915_private *dev_priv,
 			      enum port port)
 {
@@ -3017,7 +3029,9 @@  static u8 intel_hdmi_ddc_pin(struct drm_i915_private *dev_priv,
 		return info->alternate_ddc_pin;
 	}
 
-	if (HAS_PCH_MCC(dev_priv))
+	if (HAS_PCH_TGP(dev_priv))
+		ddc_pin = tgp_port_to_ddc_pin(dev_priv, port);
+	else if (HAS_PCH_MCC(dev_priv))
 		ddc_pin = mcc_port_to_ddc_pin(dev_priv, port);
 	else if (HAS_PCH_ICP(dev_priv))
 		ddc_pin = icl_port_to_ddc_pin(dev_priv, port);