Ben Skeggs 71e9b6
From 9fa9e790eb301bade8fe4ea0fd9ecb72617f0928 Mon Sep 17 00:00:00 2001
Ben Skeggs 71e9b6
From: Francisco Jerez <currojerez@riseup.net>
Ben Skeggs 71e9b6
Date: Thu, 5 Aug 2010 22:57:08 +0200
Ben Skeggs 71e9b6
Subject: [PATCH 3/5] drm-i2c-ch7006-fix
Ben Skeggs 71e9b6
Ben Skeggs 71e9b6
drm/i2c/ch7006: Don't use POWER_LEVEL_FULL_POWER_OFF on early chip versions.
Ben Skeggs 71e9b6
Ben Skeggs 71e9b6
Signed-off-by: Francisco Jerez <currojerez@riseup.net>
Ben Skeggs 71e9b6
---
Ben Skeggs 71e9b6
 drivers/gpu/drm/i2c/ch7006_drv.c  |    1 +
Ben Skeggs 71e9b6
 drivers/gpu/drm/i2c/ch7006_mode.c |    5 ++++-
Ben Skeggs 71e9b6
 drivers/gpu/drm/i2c/ch7006_priv.h |    1 +
Ben Skeggs 71e9b6
 3 files changed, 6 insertions(+), 1 deletions(-)
Ben Skeggs 71e9b6
Ben Skeggs 71e9b6
diff --git a/drivers/gpu/drm/i2c/ch7006_drv.c b/drivers/gpu/drm/i2c/ch7006_drv.c
Ben Skeggs 71e9b6
index 81681a0..8c760c7 100644
Ben Skeggs 71e9b6
--- a/drivers/gpu/drm/i2c/ch7006_drv.c
Ben Skeggs 71e9b6
+++ b/drivers/gpu/drm/i2c/ch7006_drv.c
Ben Skeggs 71e9b6
@@ -454,6 +454,7 @@ static int ch7006_encoder_init(struct i2c_client *client,
Ben Skeggs 71e9b6
 	priv->hmargin = 50;
Ben Skeggs 71e9b6
 	priv->vmargin = 50;
Ben Skeggs 71e9b6
 	priv->last_dpms = -1;
Ben Skeggs 71e9b6
+	priv->chip_version = ch7006_read(client, CH7006_VERSION_ID);
Ben Skeggs 71e9b6
 
Ben Skeggs 71e9b6
 	if (ch7006_tv_norm) {
Ben Skeggs 71e9b6
 		for (i = 0; i < NUM_TV_NORMS; i++) {
Ben Skeggs 71e9b6
diff --git a/drivers/gpu/drm/i2c/ch7006_mode.c b/drivers/gpu/drm/i2c/ch7006_mode.c
Ben Skeggs 71e9b6
index e447dfb..c860f24 100644
Ben Skeggs 71e9b6
--- a/drivers/gpu/drm/i2c/ch7006_mode.c
Ben Skeggs 71e9b6
+++ b/drivers/gpu/drm/i2c/ch7006_mode.c
Ben Skeggs 71e9b6
@@ -316,7 +316,10 @@ void ch7006_setup_power_state(struct drm_encoder *encoder)
Ben Skeggs 71e9b6
 		}
Ben Skeggs 71e9b6
 
Ben Skeggs 71e9b6
 	} else {
Ben Skeggs 71e9b6
-		*power |= bitfs(CH7006_POWER_LEVEL, FULL_POWER_OFF);
Ben Skeggs 71e9b6
+		if (priv->chip_version >= 0x20)
Ben Skeggs 71e9b6
+			*power |= bitfs(CH7006_POWER_LEVEL, FULL_POWER_OFF);
Ben Skeggs 71e9b6
+		else
Ben Skeggs 71e9b6
+			*power |= bitfs(CH7006_POWER_LEVEL, POWER_OFF);
Ben Skeggs 71e9b6
 	}
Ben Skeggs 71e9b6
 }
Ben Skeggs 71e9b6
 
Ben Skeggs 71e9b6
diff --git a/drivers/gpu/drm/i2c/ch7006_priv.h b/drivers/gpu/drm/i2c/ch7006_priv.h
Ben Skeggs 71e9b6
index b06d3d9..9487123 100644
Ben Skeggs 71e9b6
--- a/drivers/gpu/drm/i2c/ch7006_priv.h
Ben Skeggs 71e9b6
+++ b/drivers/gpu/drm/i2c/ch7006_priv.h
Ben Skeggs 71e9b6
@@ -95,6 +95,7 @@ struct ch7006_priv {
Ben Skeggs 71e9b6
 	int flicker;
Ben Skeggs 71e9b6
 	int scale;
Ben Skeggs 71e9b6
 
Ben Skeggs 71e9b6
+	int chip_version;
Ben Skeggs 71e9b6
 	int last_dpms;
Ben Skeggs 71e9b6
 };
Ben Skeggs 71e9b6
 
Ben Skeggs 71e9b6
-- 
Ben Skeggs 71e9b6
1.7.2
Ben Skeggs 71e9b6