[PATCH 10/19] drm/gma500: Unify *_intel_lvds_prepare()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The functions are identical so unify them.

Signed-off-by: Patrik Jakobsson <patrik.r.jakobsson@xxxxxxxxx>
---
 drivers/gpu/drm/gma500/cdv_intel_lvds.c | 20 +-------------------
 drivers/gpu/drm/gma500/gma_lvds.c       | 18 ++++++++++++++++++
 drivers/gpu/drm/gma500/gma_lvds.h       |  1 +
 drivers/gpu/drm/gma500/oaktrail_lvds.c  | 18 +-----------------
 drivers/gpu/drm/gma500/psb_intel_lvds.c | 20 +-------------------
 5 files changed, 22 insertions(+), 55 deletions(-)

diff --git a/drivers/gpu/drm/gma500/cdv_intel_lvds.c b/drivers/gpu/drm/gma500/cdv_intel_lvds.c
index 65532308f1e7..4f0754b8c0b0 100644
--- a/drivers/gpu/drm/gma500/cdv_intel_lvds.c
+++ b/drivers/gpu/drm/gma500/cdv_intel_lvds.c
@@ -39,24 +39,6 @@
 #define PSB_BACKLIGHT_PWM_CTL_SHIFT	(16)
 #define PSB_BACKLIGHT_PWM_POLARITY_BIT_CLEAR (0xFFFE)
 
-static void cdv_intel_lvds_prepare(struct drm_encoder *encoder)
-{
-	struct drm_device *dev = encoder->dev;
-	struct drm_psb_private *dev_priv = to_drm_psb_private(dev);
-	struct psb_intel_mode_device *mode_dev = &dev_priv->mode_dev;
-
-	if (!gma_power_begin(dev, true))
-		return;
-
-	mode_dev->saveBLC_PWM_CTL = REG_READ(BLC_PWM_CTL);
-	mode_dev->backlight_duty_cycle = (mode_dev->saveBLC_PWM_CTL &
-					  BACKLIGHT_DUTY_CYCLE_MASK);
-
-	gma_lvds_set_power(dev, false);
-
-	gma_power_end(dev);
-}
-
 static void cdv_intel_lvds_commit(struct drm_encoder *encoder)
 {
 	struct drm_device *dev = encoder->dev;
@@ -207,7 +189,7 @@ static const struct drm_encoder_helper_funcs
 					cdv_intel_lvds_helper_funcs = {
 	.dpms = gma_lvds_encoder_dpms,
 	.mode_fixup = gma_lvds_mode_fixup,
-	.prepare = cdv_intel_lvds_prepare,
+	.prepare = gma_lvds_prepare,
 	.mode_set = cdv_intel_lvds_mode_set,
 	.commit = cdv_intel_lvds_commit,
 };
diff --git a/drivers/gpu/drm/gma500/gma_lvds.c b/drivers/gpu/drm/gma500/gma_lvds.c
index 32ecf5835828..d0a97eeac38b 100644
--- a/drivers/gpu/drm/gma500/gma_lvds.c
+++ b/drivers/gpu/drm/gma500/gma_lvds.c
@@ -268,3 +268,21 @@ bool gma_lvds_mode_fixup(struct drm_encoder *encoder,
 	return true;
 }
 
+void gma_lvds_prepare(struct drm_encoder *encoder)
+{
+	struct drm_device *dev = encoder->dev;
+	struct drm_psb_private *dev_priv = to_drm_psb_private(dev);
+	struct psb_intel_mode_device *mode_dev = &dev_priv->mode_dev;
+
+	if (!gma_power_begin(dev, true))
+		return;
+
+	mode_dev->saveBLC_PWM_CTL = REG_READ(BLC_PWM_CTL);
+	mode_dev->backlight_duty_cycle = (mode_dev->saveBLC_PWM_CTL &
+					  BACKLIGHT_DUTY_CYCLE_MASK);
+
+	gma_lvds_set_power(dev, false);
+
+	gma_power_end(dev);
+}
+
diff --git a/drivers/gpu/drm/gma500/gma_lvds.h b/drivers/gpu/drm/gma500/gma_lvds.h
index 950ab7b88ad6..c1a7b3611d27 100644
--- a/drivers/gpu/drm/gma500/gma_lvds.h
+++ b/drivers/gpu/drm/gma500/gma_lvds.h
@@ -33,5 +33,6 @@ void gma_lvds_restore(struct drm_connector *connector);
 bool gma_lvds_mode_fixup(struct drm_encoder *encoder,
 			 const struct drm_display_mode *mode,
 			 struct drm_display_mode *adjusted_mode);
+void gma_lvds_prepare(struct drm_encoder *encoder);
 
 #endif
diff --git a/drivers/gpu/drm/gma500/oaktrail_lvds.c b/drivers/gpu/drm/gma500/oaktrail_lvds.c
index 16699b0fbbc9..dba0ca4b73a0 100644
--- a/drivers/gpu/drm/gma500/oaktrail_lvds.c
+++ b/drivers/gpu/drm/gma500/oaktrail_lvds.c
@@ -105,22 +105,6 @@ static void oaktrail_lvds_mode_set(struct drm_encoder *encoder,
 	gma_power_end(dev);
 }
 
-static void oaktrail_lvds_prepare(struct drm_encoder *encoder)
-{
-	struct drm_device *dev = encoder->dev;
-	struct drm_psb_private *dev_priv = to_drm_psb_private(dev);
-	struct psb_intel_mode_device *mode_dev = &dev_priv->mode_dev;
-
-	if (!gma_power_begin(dev, true))
-		return;
-
-	mode_dev->saveBLC_PWM_CTL = REG_READ(BLC_PWM_CTL);
-	mode_dev->backlight_duty_cycle = (mode_dev->saveBLC_PWM_CTL &
-					  BACKLIGHT_DUTY_CYCLE_MASK);
-	gma_lvds_set_power(dev, false);
-	gma_power_end(dev);
-}
-
 static void oaktrail_lvds_commit(struct drm_encoder *encoder)
 {
 	struct drm_device *dev = encoder->dev;
@@ -135,7 +119,7 @@ static void oaktrail_lvds_commit(struct drm_encoder *encoder)
 static const struct drm_encoder_helper_funcs oaktrail_lvds_helper_funcs = {
 	.dpms = gma_lvds_encoder_dpms,
 	.mode_fixup = gma_lvds_mode_fixup,
-	.prepare = oaktrail_lvds_prepare,
+	.prepare = gma_lvds_prepare,
 	.mode_set = oaktrail_lvds_mode_set,
 	.commit = oaktrail_lvds_commit,
 };
diff --git a/drivers/gpu/drm/gma500/psb_intel_lvds.c b/drivers/gpu/drm/gma500/psb_intel_lvds.c
index 317bd1fcfa2a..e4258205a262 100644
--- a/drivers/gpu/drm/gma500/psb_intel_lvds.c
+++ b/drivers/gpu/drm/gma500/psb_intel_lvds.c
@@ -132,24 +132,6 @@ void psb_intel_lvds_set_brightness(struct drm_device *dev, int level)
 		psb_lvds_pwm_set_brightness(dev, level);
 }
 
-static void psb_intel_lvds_prepare(struct drm_encoder *encoder)
-{
-	struct drm_device *dev = encoder->dev;
-	struct drm_psb_private *dev_priv = to_drm_psb_private(dev);
-	struct psb_intel_mode_device *mode_dev = &dev_priv->mode_dev;
-
-	if (!gma_power_begin(dev, true))
-		return;
-
-	mode_dev->saveBLC_PWM_CTL = REG_READ(BLC_PWM_CTL);
-	mode_dev->backlight_duty_cycle = (mode_dev->saveBLC_PWM_CTL &
-					  BACKLIGHT_DUTY_CYCLE_MASK);
-
-	gma_lvds_set_power(dev, false);
-
-	gma_power_end(dev);
-}
-
 static void psb_intel_lvds_commit(struct drm_encoder *encoder)
 {
 	struct drm_device *dev = encoder->dev;
@@ -303,7 +285,7 @@ int psb_intel_lvds_set_property(struct drm_connector *connector,
 static const struct drm_encoder_helper_funcs psb_intel_lvds_helper_funcs = {
 	.dpms = gma_lvds_encoder_dpms,
 	.mode_fixup = gma_lvds_mode_fixup,
-	.prepare = psb_intel_lvds_prepare,
+	.prepare = gma_lvds_prepare,
 	.mode_set = psb_intel_lvds_mode_set,
 	.commit = psb_intel_lvds_commit,
 };
-- 
2.36.1




[Index of Archives]     [Linux DRI Users]     [Linux Intel Graphics]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux