diff mbox series

drm/i915/hdmi: Initialize SCDC registers according to spec

Message ID 1539375285-1489-1-git-send-email-clinton.a.taylor@intel.com (mailing list archive)
State New, archived
Headers show
Series drm/i915/hdmi: Initialize SCDC registers according to spec | expand

Commit Message

Clint Taylor Oct. 12, 2018, 8:14 p.m. UTC
From: Clint Taylor <clinton.a.taylor@intel.com>

Initialize SCDC Source Version and TDMS_Config_0 registers to nominal
values during intel_hdmi_detect(). The i915 driver currently doesn't
implement features that require polling of the status update bits. Once
FRL, DSC, or Source Test is enabled in the driver the status flags will
need to be read by the source according to specification.

Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
Signed-off-by: Clint Taylor <clinton.a.taylor@intel.com>
---
 drivers/gpu/drm/i915/intel_hdmi.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)

Comments

Ville Syrjälä Oct. 15, 2018, 1:41 p.m. UTC | #1
On Fri, Oct 12, 2018 at 01:14:45PM -0700, clinton.a.taylor@intel.com wrote:
> From: Clint Taylor <clinton.a.taylor@intel.com>
> 
> Initialize SCDC Source Version and TDMS_Config_0 registers to nominal
> values during intel_hdmi_detect(). The i915 driver currently doesn't
> implement features that require polling of the status update bits. Once
> FRL, DSC, or Source Test is enabled in the driver the status flags will
> need to be read by the source according to specification.
> 
> Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
> Signed-off-by: Clint Taylor <clinton.a.taylor@intel.com>
> ---
>  drivers/gpu/drm/i915/intel_hdmi.c | 12 ++++++++++++
>  1 file changed, 12 insertions(+)
> 
> diff --git a/drivers/gpu/drm/i915/intel_hdmi.c b/drivers/gpu/drm/i915/intel_hdmi.c
> index 2c53efc..ab3eac5 100644
> --- a/drivers/gpu/drm/i915/intel_hdmi.c
> +++ b/drivers/gpu/drm/i915/intel_hdmi.c
> @@ -1910,6 +1910,8 @@ bool intel_hdmi_compute_config(struct intel_encoder *encoder,
>  	struct drm_i915_private *dev_priv = to_i915(connector->dev);
>  	struct intel_hdmi *intel_hdmi = intel_attached_hdmi(connector);
>  	struct intel_encoder *encoder = &hdmi_to_dig_port(intel_hdmi)->base;
> +	struct i2c_adapter *adapter =
> +		intel_gmbus_get_adapter(dev_priv, intel_hdmi->ddc_bus);
>  
>  	DRM_DEBUG_KMS("[CONNECTOR:%d:%s]\n",
>  		      connector->base.id, connector->name);
> @@ -1925,6 +1927,16 @@ bool intel_hdmi_compute_config(struct intel_encoder *encoder,
>  	if (intel_hdmi_set_edid(connector))
>  		status = connector_status_connected;
>  
> +	if (connector->display_info.hdmi.scdc.supported) {
> +		/* SCDC source version HDMI 2.1 Sec. 10.4.1.2 */
> +		if (drm_scdc_writeb(adapter, SCDC_SOURCE_VERSION, 0x01) < 0)
> +			DRM_DEBUG_KMS("Unable to set SCDC Source Version register\n");
> +
> +		/* Clear SCDC CONFIG_0 HDMI 2.1 Sec. 10.4.1.6 - RR_Enable Polling Only */
> +		if (drm_scdc_writeb(adapter, SCDC_CONFIG_0, 0x00) < 0)
> +			DRM_DEBUG_KMS("Unable to set SCDC CONFIG_0 register\n");
> +	}

I'd probably put this into intel_hdmi_set_edid() so that we'll do it for
the ->force() path as well. Or maybe a separate function called from
both places.

> +
>  out:
>  	intel_display_power_put(dev_priv, POWER_DOMAIN_GMBUS);
>  
> -- 
> 1.9.1
Clint Taylor Oct. 15, 2018, 4:30 p.m. UTC | #2
On 10/15/2018 06:41 AM, Ville Syrjälä wrote:
> On Fri, Oct 12, 2018 at 01:14:45PM -0700, clinton.a.taylor@intel.com wrote:
>> From: Clint Taylor <clinton.a.taylor@intel.com>
>>
>> Initialize SCDC Source Version and TDMS_Config_0 registers to nominal
>> values during intel_hdmi_detect(). The i915 driver currently doesn't
>> implement features that require polling of the status update bits. Once
>> FRL, DSC, or Source Test is enabled in the driver the status flags will
>> need to be read by the source according to specification.
>>
>> Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
>> Signed-off-by: Clint Taylor <clinton.a.taylor@intel.com>
>> ---
>>   drivers/gpu/drm/i915/intel_hdmi.c | 12 ++++++++++++
>>   1 file changed, 12 insertions(+)
>>
>> diff --git a/drivers/gpu/drm/i915/intel_hdmi.c b/drivers/gpu/drm/i915/intel_hdmi.c
>> index 2c53efc..ab3eac5 100644
>> --- a/drivers/gpu/drm/i915/intel_hdmi.c
>> +++ b/drivers/gpu/drm/i915/intel_hdmi.c
>> @@ -1910,6 +1910,8 @@ bool intel_hdmi_compute_config(struct intel_encoder *encoder,
>>   	struct drm_i915_private *dev_priv = to_i915(connector->dev);
>>   	struct intel_hdmi *intel_hdmi = intel_attached_hdmi(connector);
>>   	struct intel_encoder *encoder = &hdmi_to_dig_port(intel_hdmi)->base;
>> +	struct i2c_adapter *adapter =
>> +		intel_gmbus_get_adapter(dev_priv, intel_hdmi->ddc_bus);
>>   
>>   	DRM_DEBUG_KMS("[CONNECTOR:%d:%s]\n",
>>   		      connector->base.id, connector->name);
>> @@ -1925,6 +1927,16 @@ bool intel_hdmi_compute_config(struct intel_encoder *encoder,
>>   	if (intel_hdmi_set_edid(connector))
>>   		status = connector_status_connected;
>>   
>> +	if (connector->display_info.hdmi.scdc.supported) {
>> +		/* SCDC source version HDMI 2.1 Sec. 10.4.1.2 */
>> +		if (drm_scdc_writeb(adapter, SCDC_SOURCE_VERSION, 0x01) < 0)
>> +			DRM_DEBUG_KMS("Unable to set SCDC Source Version register\n");
>> +
>> +		/* Clear SCDC CONFIG_0 HDMI 2.1 Sec. 10.4.1.6 - RR_Enable Polling Only */
>> +		if (drm_scdc_writeb(adapter, SCDC_CONFIG_0, 0x00) < 0)
>> +			DRM_DEBUG_KMS("Unable to set SCDC CONFIG_0 register\n");
>> +	}
> I'd probably put this into intel_hdmi_set_edid() so that we'll do it for
> the ->force() path as well. Or maybe a separate function called from
> both places.
intel_hdmi_set_edid() doesn't actually decode the edid block that it 
reads. This means
display_info.hdmi.scdc.supported isn't from the new EDID block. I have a 
patch in my sandbox to send the new EDID block to DRM to be decoded.

-Clint

>> +
>>   out:
>>   	intel_display_power_put(dev_priv, POWER_DOMAIN_GMBUS);
>>   
>> -- 
>> 1.9.1
diff mbox series

Patch

diff --git a/drivers/gpu/drm/i915/intel_hdmi.c b/drivers/gpu/drm/i915/intel_hdmi.c
index 2c53efc..ab3eac5 100644
--- a/drivers/gpu/drm/i915/intel_hdmi.c
+++ b/drivers/gpu/drm/i915/intel_hdmi.c
@@ -1910,6 +1910,8 @@  bool intel_hdmi_compute_config(struct intel_encoder *encoder,
 	struct drm_i915_private *dev_priv = to_i915(connector->dev);
 	struct intel_hdmi *intel_hdmi = intel_attached_hdmi(connector);
 	struct intel_encoder *encoder = &hdmi_to_dig_port(intel_hdmi)->base;
+	struct i2c_adapter *adapter =
+		intel_gmbus_get_adapter(dev_priv, intel_hdmi->ddc_bus);
 
 	DRM_DEBUG_KMS("[CONNECTOR:%d:%s]\n",
 		      connector->base.id, connector->name);
@@ -1925,6 +1927,16 @@  bool intel_hdmi_compute_config(struct intel_encoder *encoder,
 	if (intel_hdmi_set_edid(connector))
 		status = connector_status_connected;
 
+	if (connector->display_info.hdmi.scdc.supported) {
+		/* SCDC source version HDMI 2.1 Sec. 10.4.1.2 */
+		if (drm_scdc_writeb(adapter, SCDC_SOURCE_VERSION, 0x01) < 0)
+			DRM_DEBUG_KMS("Unable to set SCDC Source Version register\n");
+
+		/* Clear SCDC CONFIG_0 HDMI 2.1 Sec. 10.4.1.6 - RR_Enable Polling Only */
+		if (drm_scdc_writeb(adapter, SCDC_CONFIG_0, 0x00) < 0)
+			DRM_DEBUG_KMS("Unable to set SCDC CONFIG_0 register\n");
+	}
+
 out:
 	intel_display_power_put(dev_priv, POWER_DOMAIN_GMBUS);