diff mbox

[v3] drm/i915: VLV2 - Fix hotplug detect bits

Message ID 1390450952-3039-2-git-send-email-tprevite@gmail.com (mailing list archive)
State New, archived
Headers show

Commit Message

Todd Previte Jan. 23, 2014, 4:22 a.m. UTC
Add new definitions for hotplug live status bits for VLV2 since they're
in reverse order from the gen4x ones.

Changelog:
- Restored gen4 bit definitions
- Added new definitions for VLV2
- Added platform check for IS_VALLEYVIEW() in dp_detect to use the correct
  bit defintions

Signed-off-by: Todd Previte <tprevite@gmail.com>
---
 drivers/gpu/drm/i915/i915_reg.h | 11 ++++++++---
 drivers/gpu/drm/i915/intel_dp.c | 39 +++++++++++++++++++++++++++------------
 2 files changed, 35 insertions(+), 15 deletions(-)

Comments

Jani Nikula Jan. 23, 2014, 6:39 a.m. UTC | #1
On Thu, 23 Jan 2014, Todd Previte <tprevite@gmail.com> wrote:
> Add new definitions for hotplug live status bits for VLV2 since they're
> in reverse order from the gen4x ones.
>
> Changelog:
> - Restored gen4 bit definitions
> - Added new definitions for VLV2
> - Added platform check for IS_VALLEYVIEW() in dp_detect to use the correct
>   bit defintions
>
> Signed-off-by: Todd Previte <tprevite@gmail.com>
> ---
>  drivers/gpu/drm/i915/i915_reg.h | 11 ++++++++---
>  drivers/gpu/drm/i915/intel_dp.c | 39 +++++++++++++++++++++++++++------------
>  2 files changed, 35 insertions(+), 15 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/i915_reg.h b/drivers/gpu/drm/i915/i915_reg.h
> index 2d77b51..0e65717 100644
> --- a/drivers/gpu/drm/i915/i915_reg.h
> +++ b/drivers/gpu/drm/i915/i915_reg.h
> @@ -2083,9 +2083,14 @@
>   * Please check the detailed lore in the commit message for for experimental
>   * evidence.
>   */
> -#define   PORTD_HOTPLUG_LIVE_STATUS               (1 << 29)
> -#define   PORTC_HOTPLUG_LIVE_STATUS               (1 << 28)
> -#define   PORTB_HOTPLUG_LIVE_STATUS               (1 << 27)
> +/* VLV hot plug bits are different */
> +#define   VLV_PORTD_HOTPLUG_LIVE_STATUS	(1 << 27)
> +#define   VLV_PORTC_HOTPLUG_LIVE_STATUS	(1 << 28)
> +#define   VLV_PORTB_HOTPLUG_LIVE_STATUS	(1 << 29)
> +
> +#define   PORTD_HOTPLUG_LIVE_STATUS		(1 << 29)
> +#define   PORTC_HOTPLUG_LIVE_STATUS		(1 << 28)
> +#define   PORTB_HOTPLUG_LIVE_STATUS		(1 << 27)

For future reference, changes unrelated to the commit message are
generally frowned upon; style changes (like the spaces-to-tabs change
for the existing defines) should be kept separate.

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


>  #define   PORTD_HOTPLUG_INT_STATUS		(3 << 21)
>  #define   PORTC_HOTPLUG_INT_STATUS		(3 << 19)
>  #define   PORTB_HOTPLUG_INT_STATUS		(3 << 17)
> diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c
> index 1386efb..1f080b2 100644
> --- a/drivers/gpu/drm/i915/intel_dp.c
> +++ b/drivers/gpu/drm/i915/intel_dp.c
> @@ -2946,18 +2946,33 @@ g4x_dp_detect(struct intel_dp *intel_dp)
>  		return status;
>  	}
>  
> -	switch (intel_dig_port->port) {
> -	case PORT_B:
> -		bit = PORTB_HOTPLUG_LIVE_STATUS;
> -		break;
> -	case PORT_C:
> -		bit = PORTC_HOTPLUG_LIVE_STATUS;
> -		break;
> -	case PORT_D:
> -		bit = PORTD_HOTPLUG_LIVE_STATUS;
> -		break;
> -	default:
> -		return connector_status_unknown;
> +	if (IS_VALLEYVIEW(dev)) {
> +		switch (intel_dig_port->port) {
> +		case PORT_B:
> +			bit = VLV_PORTB_HOTPLUG_LIVE_STATUS;
> +			break;
> +		case PORT_C:
> +			bit = VLV_PORTC_HOTPLUG_LIVE_STATUS;
> +			break;
> +		case PORT_D:
> +			bit = VLV_PORTD_HOTPLUG_LIVE_STATUS;
> +			break;
> +		default:
> +			return connector_status_unknown;
> +	} else {
> +		switch (intel_dig_port->port) {
> +		case PORT_B:
> +			bit = PORTB_HOTPLUG_LIVE_STATUS;
> +			break;
> +		case PORT_C:
> +			bit = PORTC_HOTPLUG_LIVE_STATUS;
> +			break;
> +		case PORT_D:
> +			bit = PORTD_HOTPLUG_LIVE_STATUS;
> +			break;
> +		default:
> +			return connector_status_unknown;
> +		}
>  	}
>  
>  	if ((I915_READ(PORT_HOTPLUG_STAT) & bit) == 0)
> -- 
> 1.8.3.2
>
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Jani Nikula Jan. 23, 2014, 6:41 a.m. UTC | #2
On Thu, 23 Jan 2014, Todd Previte <tprevite@gmail.com> wrote:
> Add new definitions for hotplug live status bits for VLV2 since they're
> in reverse order from the gen4x ones.
>
> Changelog:
> - Restored gen4 bit definitions
> - Added new definitions for VLV2
> - Added platform check for IS_VALLEYVIEW() in dp_detect to use the correct
>   bit defintions
>

Btw this might be a relevant bug report:
https://bugs.freedesktop.org/show_bug.cgi?id=73951

> Signed-off-by: Todd Previte <tprevite@gmail.com>
> ---
>  drivers/gpu/drm/i915/i915_reg.h | 11 ++++++++---
>  drivers/gpu/drm/i915/intel_dp.c | 39 +++++++++++++++++++++++++++------------
>  2 files changed, 35 insertions(+), 15 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/i915_reg.h b/drivers/gpu/drm/i915/i915_reg.h
> index 2d77b51..0e65717 100644
> --- a/drivers/gpu/drm/i915/i915_reg.h
> +++ b/drivers/gpu/drm/i915/i915_reg.h
> @@ -2083,9 +2083,14 @@
>   * Please check the detailed lore in the commit message for for experimental
>   * evidence.
>   */
> -#define   PORTD_HOTPLUG_LIVE_STATUS               (1 << 29)
> -#define   PORTC_HOTPLUG_LIVE_STATUS               (1 << 28)
> -#define   PORTB_HOTPLUG_LIVE_STATUS               (1 << 27)
> +/* VLV hot plug bits are different */
> +#define   VLV_PORTD_HOTPLUG_LIVE_STATUS	(1 << 27)
> +#define   VLV_PORTC_HOTPLUG_LIVE_STATUS	(1 << 28)
> +#define   VLV_PORTB_HOTPLUG_LIVE_STATUS	(1 << 29)
> +
> +#define   PORTD_HOTPLUG_LIVE_STATUS		(1 << 29)
> +#define   PORTC_HOTPLUG_LIVE_STATUS		(1 << 28)
> +#define   PORTB_HOTPLUG_LIVE_STATUS		(1 << 27)
>  #define   PORTD_HOTPLUG_INT_STATUS		(3 << 21)
>  #define   PORTC_HOTPLUG_INT_STATUS		(3 << 19)
>  #define   PORTB_HOTPLUG_INT_STATUS		(3 << 17)
> diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c
> index 1386efb..1f080b2 100644
> --- a/drivers/gpu/drm/i915/intel_dp.c
> +++ b/drivers/gpu/drm/i915/intel_dp.c
> @@ -2946,18 +2946,33 @@ g4x_dp_detect(struct intel_dp *intel_dp)
>  		return status;
>  	}
>  
> -	switch (intel_dig_port->port) {
> -	case PORT_B:
> -		bit = PORTB_HOTPLUG_LIVE_STATUS;
> -		break;
> -	case PORT_C:
> -		bit = PORTC_HOTPLUG_LIVE_STATUS;
> -		break;
> -	case PORT_D:
> -		bit = PORTD_HOTPLUG_LIVE_STATUS;
> -		break;
> -	default:
> -		return connector_status_unknown;
> +	if (IS_VALLEYVIEW(dev)) {
> +		switch (intel_dig_port->port) {
> +		case PORT_B:
> +			bit = VLV_PORTB_HOTPLUG_LIVE_STATUS;
> +			break;
> +		case PORT_C:
> +			bit = VLV_PORTC_HOTPLUG_LIVE_STATUS;
> +			break;
> +		case PORT_D:
> +			bit = VLV_PORTD_HOTPLUG_LIVE_STATUS;
> +			break;
> +		default:
> +			return connector_status_unknown;
> +	} else {
> +		switch (intel_dig_port->port) {
> +		case PORT_B:
> +			bit = PORTB_HOTPLUG_LIVE_STATUS;
> +			break;
> +		case PORT_C:
> +			bit = PORTC_HOTPLUG_LIVE_STATUS;
> +			break;
> +		case PORT_D:
> +			bit = PORTD_HOTPLUG_LIVE_STATUS;
> +			break;
> +		default:
> +			return connector_status_unknown;
> +		}
>  	}
>  
>  	if ((I915_READ(PORT_HOTPLUG_STAT) & bit) == 0)
> -- 
> 1.8.3.2
>
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Todd Previte Jan. 23, 2014, 7:16 a.m. UTC | #3
On 01/22/2014 11:41 PM, Jani Nikula wrote:
> On Thu, 23 Jan 2014, Todd Previte <tprevite@gmail.com> wrote:
>> Add new definitions for hotplug live status bits for VLV2 since they're
>> in reverse order from the gen4x ones.
>>
>> Changelog:
>> - Restored gen4 bit definitions
>> - Added new definitions for VLV2
>> - Added platform check for IS_VALLEYVIEW() in dp_detect to use the correct
>>    bit defintions
>>
> Btw this might be a relevant bug report:
> https://bugs.freedesktop.org/show_bug.cgi?id=73951
Yeah looks like it. I think this patch (well V4 below) should address 
the problem. I'll update the bug momentarily.

-T

>> Signed-off-by: Todd Previte <tprevite@gmail.com>
>> ---
>>   drivers/gpu/drm/i915/i915_reg.h | 11 ++++++++---
>>   drivers/gpu/drm/i915/intel_dp.c | 39 +++++++++++++++++++++++++++------------
>>   2 files changed, 35 insertions(+), 15 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/i915/i915_reg.h b/drivers/gpu/drm/i915/i915_reg.h
>> index 2d77b51..0e65717 100644
>> --- a/drivers/gpu/drm/i915/i915_reg.h
>> +++ b/drivers/gpu/drm/i915/i915_reg.h
>> @@ -2083,9 +2083,14 @@
>>    * Please check the detailed lore in the commit message for for experimental
>>    * evidence.
>>    */
>> -#define   PORTD_HOTPLUG_LIVE_STATUS               (1 << 29)
>> -#define   PORTC_HOTPLUG_LIVE_STATUS               (1 << 28)
>> -#define   PORTB_HOTPLUG_LIVE_STATUS               (1 << 27)
>> +/* VLV hot plug bits are different */
>> +#define   VLV_PORTD_HOTPLUG_LIVE_STATUS	(1 << 27)
>> +#define   VLV_PORTC_HOTPLUG_LIVE_STATUS	(1 << 28)
>> +#define   VLV_PORTB_HOTPLUG_LIVE_STATUS	(1 << 29)
>> +
>> +#define   PORTD_HOTPLUG_LIVE_STATUS		(1 << 29)
>> +#define   PORTC_HOTPLUG_LIVE_STATUS		(1 << 28)
>> +#define   PORTB_HOTPLUG_LIVE_STATUS		(1 << 27)
>>   #define   PORTD_HOTPLUG_INT_STATUS		(3 << 21)
>>   #define   PORTC_HOTPLUG_INT_STATUS		(3 << 19)
>>   #define   PORTB_HOTPLUG_INT_STATUS		(3 << 17)
>> diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c
>> index 1386efb..1f080b2 100644
>> --- a/drivers/gpu/drm/i915/intel_dp.c
>> +++ b/drivers/gpu/drm/i915/intel_dp.c
>> @@ -2946,18 +2946,33 @@ g4x_dp_detect(struct intel_dp *intel_dp)
>>   		return status;
>>   	}
>>   
>> -	switch (intel_dig_port->port) {
>> -	case PORT_B:
>> -		bit = PORTB_HOTPLUG_LIVE_STATUS;
>> -		break;
>> -	case PORT_C:
>> -		bit = PORTC_HOTPLUG_LIVE_STATUS;
>> -		break;
>> -	case PORT_D:
>> -		bit = PORTD_HOTPLUG_LIVE_STATUS;
>> -		break;
>> -	default:
>> -		return connector_status_unknown;
>> +	if (IS_VALLEYVIEW(dev)) {
>> +		switch (intel_dig_port->port) {
>> +		case PORT_B:
>> +			bit = VLV_PORTB_HOTPLUG_LIVE_STATUS;
>> +			break;
>> +		case PORT_C:
>> +			bit = VLV_PORTC_HOTPLUG_LIVE_STATUS;
>> +			break;
>> +		case PORT_D:
>> +			bit = VLV_PORTD_HOTPLUG_LIVE_STATUS;
>> +			break;
>> +		default:
>> +			return connector_status_unknown;
>> +	} else {
>> +		switch (intel_dig_port->port) {
>> +		case PORT_B:
>> +			bit = PORTB_HOTPLUG_LIVE_STATUS;
>> +			break;
>> +		case PORT_C:
>> +			bit = PORTC_HOTPLUG_LIVE_STATUS;
>> +			break;
>> +		case PORT_D:
>> +			bit = PORTD_HOTPLUG_LIVE_STATUS;
>> +			break;
>> +		default:
>> +			return connector_status_unknown;
>> +		}
>>   	}
>>   
>>   	if ((I915_READ(PORT_HOTPLUG_STAT) & bit) == 0)
>> -- 
>> 1.8.3.2
>>
>> _______________________________________________
>> Intel-gfx mailing list
>> Intel-gfx@lists.freedesktop.org
>> http://lists.freedesktop.org/mailman/listinfo/intel-gfx
diff mbox

Patch

diff --git a/drivers/gpu/drm/i915/i915_reg.h b/drivers/gpu/drm/i915/i915_reg.h
index 2d77b51..0e65717 100644
--- a/drivers/gpu/drm/i915/i915_reg.h
+++ b/drivers/gpu/drm/i915/i915_reg.h
@@ -2083,9 +2083,14 @@ 
  * Please check the detailed lore in the commit message for for experimental
  * evidence.
  */
-#define   PORTD_HOTPLUG_LIVE_STATUS               (1 << 29)
-#define   PORTC_HOTPLUG_LIVE_STATUS               (1 << 28)
-#define   PORTB_HOTPLUG_LIVE_STATUS               (1 << 27)
+/* VLV hot plug bits are different */
+#define   VLV_PORTD_HOTPLUG_LIVE_STATUS	(1 << 27)
+#define   VLV_PORTC_HOTPLUG_LIVE_STATUS	(1 << 28)
+#define   VLV_PORTB_HOTPLUG_LIVE_STATUS	(1 << 29)
+
+#define   PORTD_HOTPLUG_LIVE_STATUS		(1 << 29)
+#define   PORTC_HOTPLUG_LIVE_STATUS		(1 << 28)
+#define   PORTB_HOTPLUG_LIVE_STATUS		(1 << 27)
 #define   PORTD_HOTPLUG_INT_STATUS		(3 << 21)
 #define   PORTC_HOTPLUG_INT_STATUS		(3 << 19)
 #define   PORTB_HOTPLUG_INT_STATUS		(3 << 17)
diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c
index 1386efb..1f080b2 100644
--- a/drivers/gpu/drm/i915/intel_dp.c
+++ b/drivers/gpu/drm/i915/intel_dp.c
@@ -2946,18 +2946,33 @@  g4x_dp_detect(struct intel_dp *intel_dp)
 		return status;
 	}
 
-	switch (intel_dig_port->port) {
-	case PORT_B:
-		bit = PORTB_HOTPLUG_LIVE_STATUS;
-		break;
-	case PORT_C:
-		bit = PORTC_HOTPLUG_LIVE_STATUS;
-		break;
-	case PORT_D:
-		bit = PORTD_HOTPLUG_LIVE_STATUS;
-		break;
-	default:
-		return connector_status_unknown;
+	if (IS_VALLEYVIEW(dev)) {
+		switch (intel_dig_port->port) {
+		case PORT_B:
+			bit = VLV_PORTB_HOTPLUG_LIVE_STATUS;
+			break;
+		case PORT_C:
+			bit = VLV_PORTC_HOTPLUG_LIVE_STATUS;
+			break;
+		case PORT_D:
+			bit = VLV_PORTD_HOTPLUG_LIVE_STATUS;
+			break;
+		default:
+			return connector_status_unknown;
+	} else {
+		switch (intel_dig_port->port) {
+		case PORT_B:
+			bit = PORTB_HOTPLUG_LIVE_STATUS;
+			break;
+		case PORT_C:
+			bit = PORTC_HOTPLUG_LIVE_STATUS;
+			break;
+		case PORT_D:
+			bit = PORTD_HOTPLUG_LIVE_STATUS;
+			break;
+		default:
+			return connector_status_unknown;
+		}
 	}
 
 	if ((I915_READ(PORT_HOTPLUG_STAT) & bit) == 0)