diff mbox

[4/5] drm/i915: Parse VBT data for lspcon

Message ID 1464686746-5099-5-git-send-email-shashank.sharma@intel.com (mailing list archive)
State New, archived
Headers show

Commit Message

Sharma, Shashank May 31, 2016, 9:25 a.m. UTC
Many GEN9 boards come with on-board lspcon cards.
Fot these boards, VBT configuration should properly point out
if a particular port contains lspcon device, so that driver can
initialize it properly.

This patch adds a utility function, which checks the VBT flag
for lspcon bit, and tells us if a port is configured to have a
lspcon device or not.

Signed-off-by: Shashank Sharma <shashank.sharma@intel.com>
---
 drivers/gpu/drm/i915/i915_drv.h   |  3 +++
 drivers/gpu/drm/i915/intel_bios.c | 44 +++++++++++++++++++++++++++++++++++++++
 2 files changed, 47 insertions(+)

Comments

Ville Syrjala May 31, 2016, 4:32 p.m. UTC | #1
On Tue, May 31, 2016 at 02:55:45PM +0530, Shashank Sharma wrote:
> Many GEN9 boards come with on-board lspcon cards.
> Fot these boards, VBT configuration should properly point out
> if a particular port contains lspcon device, so that driver can
> initialize it properly.
> 
> This patch adds a utility function, which checks the VBT flag
> for lspcon bit, and tells us if a port is configured to have a
> lspcon device or not.
> 
> Signed-off-by: Shashank Sharma <shashank.sharma@intel.com>
> ---
>  drivers/gpu/drm/i915/i915_drv.h   |  3 +++
>  drivers/gpu/drm/i915/intel_bios.c | 44 +++++++++++++++++++++++++++++++++++++++
>  2 files changed, 47 insertions(+)
> 
> diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
> index e4c8e34..32ddde5 100644
> --- a/drivers/gpu/drm/i915/i915_drv.h
> +++ b/drivers/gpu/drm/i915/i915_drv.h
> @@ -3622,6 +3622,9 @@ bool intel_bios_is_port_dp_dual_mode(struct drm_i915_private *dev_priv, enum por
>  bool intel_bios_is_dsi_present(struct drm_i915_private *dev_priv, enum port *port);
>  bool intel_bios_is_port_hpd_inverted(struct drm_i915_private *dev_priv,
>  				     enum port port);
> +bool intel_bios_is_lspcon_present(struct drm_i915_private *dev_priv,
> +				enum port port);
> +
>  
>  /* intel_opregion.c */
>  #ifdef CONFIG_ACPI
> diff --git a/drivers/gpu/drm/i915/intel_bios.c b/drivers/gpu/drm/i915/intel_bios.c
> index 624e755..501b57f 100644
> --- a/drivers/gpu/drm/i915/intel_bios.c
> +++ b/drivers/gpu/drm/i915/intel_bios.c
> @@ -1715,3 +1715,47 @@ intel_bios_is_port_hpd_inverted(struct drm_i915_private *dev_priv,
>  
>  	return false;
>  }
> +
> +/**
> + * intel_bios_is_lspcon_present - if LSPCON is attached on %port
> + * @dev_priv:	i915 device instance
> + * @port:	port to check
> + *
> + * Return true if LSPCON is present on this port
> + */
> +bool
> +intel_bios_is_lspcon_present(struct drm_i915_private *dev_priv,
> +				enum port port)
> +{
> +	int i;
> +
> +	if (WARN_ON_ONCE(!IS_GEN9(dev_priv)))
> +		return false;
> +
> +	for (i = 0; i < dev_priv->vbt.child_dev_num; i++) {
> +		if (!dev_priv->vbt.child_dev[i].common.lspcon)
> +			continue;
> +
> +		switch (dev_priv->vbt.child_dev[i].common.dvo_port) {
> +		case DVO_PORT_DPA:
> +		case DVO_PORT_HDMIA:
> +			if (port == PORT_A)
> +				return true;
> +			break;
> +		case DVO_PORT_DPB:
> +		case DVO_PORT_HDMIB:
> +			if (port == PORT_B)
> +				return true;
> +			break;
> +		case DVO_PORT_DPC:
> +		case DVO_PORT_HDMIC:
> +			if (port == PORT_C)
> +				return true;
> +			break;

With just A/B/C this looks like it's expecting only BXT, but you're
checking for gen9 here. What's the deal?

> +		default:
> +			break;
> +		}
> +	}
> +
> +	return false;
> +}
> -- 
> 1.9.1
Sharma, Shashank June 1, 2016, 9:35 a.m. UTC | #2
Regards
Shashank

On 5/31/2016 10:02 PM, Ville Syrjälä wrote:
> On Tue, May 31, 2016 at 02:55:45PM +0530, Shashank Sharma wrote:
>> Many GEN9 boards come with on-board lspcon cards.
>> Fot these boards, VBT configuration should properly point out
>> if a particular port contains lspcon device, so that driver can
>> initialize it properly.
>>
>> This patch adds a utility function, which checks the VBT flag
>> for lspcon bit, and tells us if a port is configured to have a
>> lspcon device or not.
>>
>> Signed-off-by: Shashank Sharma <shashank.sharma@intel.com>
>> ---
>>   drivers/gpu/drm/i915/i915_drv.h   |  3 +++
>>   drivers/gpu/drm/i915/intel_bios.c | 44 +++++++++++++++++++++++++++++++++++++++
>>   2 files changed, 47 insertions(+)
>>
>> diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
>> index e4c8e34..32ddde5 100644
>> --- a/drivers/gpu/drm/i915/i915_drv.h
>> +++ b/drivers/gpu/drm/i915/i915_drv.h
>> @@ -3622,6 +3622,9 @@ bool intel_bios_is_port_dp_dual_mode(struct drm_i915_private *dev_priv, enum por
>>   bool intel_bios_is_dsi_present(struct drm_i915_private *dev_priv, enum port *port);
>>   bool intel_bios_is_port_hpd_inverted(struct drm_i915_private *dev_priv,
>>   				     enum port port);
>> +bool intel_bios_is_lspcon_present(struct drm_i915_private *dev_priv,
>> +				enum port port);
>> +
>>
>>   /* intel_opregion.c */
>>   #ifdef CONFIG_ACPI
>> diff --git a/drivers/gpu/drm/i915/intel_bios.c b/drivers/gpu/drm/i915/intel_bios.c
>> index 624e755..501b57f 100644
>> --- a/drivers/gpu/drm/i915/intel_bios.c
>> +++ b/drivers/gpu/drm/i915/intel_bios.c
>> @@ -1715,3 +1715,47 @@ intel_bios_is_port_hpd_inverted(struct drm_i915_private *dev_priv,
>>
>>   	return false;
>>   }
>> +
>> +/**
>> + * intel_bios_is_lspcon_present - if LSPCON is attached on %port
>> + * @dev_priv:	i915 device instance
>> + * @port:	port to check
>> + *
>> + * Return true if LSPCON is present on this port
>> + */
>> +bool
>> +intel_bios_is_lspcon_present(struct drm_i915_private *dev_priv,
>> +				enum port port)
>> +{
>> +	int i;
>> +
>> +	if (WARN_ON_ONCE(!IS_GEN9(dev_priv)))
>> +		return false;
>> +
>> +	for (i = 0; i < dev_priv->vbt.child_dev_num; i++) {
>> +		if (!dev_priv->vbt.child_dev[i].common.lspcon)
>> +			continue;
>> +
>> +		switch (dev_priv->vbt.child_dev[i].common.dvo_port) {
>> +		case DVO_PORT_DPA:
>> +		case DVO_PORT_HDMIA:
>> +			if (port == PORT_A)
>> +				return true;
>> +			break;
>> +		case DVO_PORT_DPB:
>> +		case DVO_PORT_HDMIB:
>> +			if (port == PORT_B)
>> +				return true;
>> +			break;
>> +		case DVO_PORT_DPC:
>> +		case DVO_PORT_HDMIC:
>> +			if (port == PORT_C)
>> +				return true;
>> +			break;
>
> With just A/B/C this looks like it's expecting only BXT, but you're
> checking for gen9 here. What's the deal?
>
Guilty, just copy-pasted from above function :), will add other ports 
too. Its supposed to work with Gen9.
>> +		default:
>> +			break;
>> +		}
>> +	}
>> +
>> +	return false;
>> +}
>> --
>> 1.9.1
>
diff mbox

Patch

diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
index e4c8e34..32ddde5 100644
--- a/drivers/gpu/drm/i915/i915_drv.h
+++ b/drivers/gpu/drm/i915/i915_drv.h
@@ -3622,6 +3622,9 @@  bool intel_bios_is_port_dp_dual_mode(struct drm_i915_private *dev_priv, enum por
 bool intel_bios_is_dsi_present(struct drm_i915_private *dev_priv, enum port *port);
 bool intel_bios_is_port_hpd_inverted(struct drm_i915_private *dev_priv,
 				     enum port port);
+bool intel_bios_is_lspcon_present(struct drm_i915_private *dev_priv,
+				enum port port);
+
 
 /* intel_opregion.c */
 #ifdef CONFIG_ACPI
diff --git a/drivers/gpu/drm/i915/intel_bios.c b/drivers/gpu/drm/i915/intel_bios.c
index 624e755..501b57f 100644
--- a/drivers/gpu/drm/i915/intel_bios.c
+++ b/drivers/gpu/drm/i915/intel_bios.c
@@ -1715,3 +1715,47 @@  intel_bios_is_port_hpd_inverted(struct drm_i915_private *dev_priv,
 
 	return false;
 }
+
+/**
+ * intel_bios_is_lspcon_present - if LSPCON is attached on %port
+ * @dev_priv:	i915 device instance
+ * @port:	port to check
+ *
+ * Return true if LSPCON is present on this port
+ */
+bool
+intel_bios_is_lspcon_present(struct drm_i915_private *dev_priv,
+				enum port port)
+{
+	int i;
+
+	if (WARN_ON_ONCE(!IS_GEN9(dev_priv)))
+		return false;
+
+	for (i = 0; i < dev_priv->vbt.child_dev_num; i++) {
+		if (!dev_priv->vbt.child_dev[i].common.lspcon)
+			continue;
+
+		switch (dev_priv->vbt.child_dev[i].common.dvo_port) {
+		case DVO_PORT_DPA:
+		case DVO_PORT_HDMIA:
+			if (port == PORT_A)
+				return true;
+			break;
+		case DVO_PORT_DPB:
+		case DVO_PORT_HDMIB:
+			if (port == PORT_B)
+				return true;
+			break;
+		case DVO_PORT_DPC:
+		case DVO_PORT_HDMIC:
+			if (port == PORT_C)
+				return true;
+			break;
+		default:
+			break;
+		}
+	}
+
+	return false;
+}