These functions are identical so unify them Signed-off-by: Patrik Jakobsson <patrik.r.jakobsson@xxxxxxxxx> --- drivers/gpu/drm/gma500/cdv_intel_lvds.c | 15 +-------------- drivers/gpu/drm/gma500/gma_lvds.c | 15 ++++++++++++++- drivers/gpu/drm/gma500/gma_lvds.h | 2 +- drivers/gpu/drm/gma500/oaktrail_lvds.c | 13 +------------ drivers/gpu/drm/gma500/psb_intel_lvds.c | 15 +-------------- 5 files changed, 18 insertions(+), 42 deletions(-) diff --git a/drivers/gpu/drm/gma500/cdv_intel_lvds.c b/drivers/gpu/drm/gma500/cdv_intel_lvds.c index 4f0754b8c0b0..77a5d167c508 100644 --- a/drivers/gpu/drm/gma500/cdv_intel_lvds.c +++ b/drivers/gpu/drm/gma500/cdv_intel_lvds.c @@ -39,19 +39,6 @@ #define PSB_BACKLIGHT_PWM_CTL_SHIFT (16) #define PSB_BACKLIGHT_PWM_POLARITY_BIT_CLEAR (0xFFFE) -static void cdv_intel_lvds_commit(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 (mode_dev->backlight_duty_cycle == 0) - mode_dev->backlight_duty_cycle = - gma_lvds_get_max_backlight(dev); - - gma_lvds_set_power(dev, true); -} - static void cdv_intel_lvds_mode_set(struct drm_encoder *encoder, struct drm_display_mode *mode, struct drm_display_mode *adjusted_mode) @@ -191,7 +178,7 @@ static const struct drm_encoder_helper_funcs .mode_fixup = gma_lvds_mode_fixup, .prepare = gma_lvds_prepare, .mode_set = cdv_intel_lvds_mode_set, - .commit = cdv_intel_lvds_commit, + .commit = gma_lvds_commit, }; static const struct drm_connector_helper_funcs diff --git a/drivers/gpu/drm/gma500/gma_lvds.c b/drivers/gpu/drm/gma500/gma_lvds.c index d0a97eeac38b..6364d3aef064 100644 --- a/drivers/gpu/drm/gma500/gma_lvds.c +++ b/drivers/gpu/drm/gma500/gma_lvds.c @@ -62,7 +62,7 @@ static void gma_lvds_set_backlight(struct drm_device *dev, int level) /* * Sets the power state for the panel. */ -void gma_lvds_set_power(struct drm_device *dev, bool on) +static void gma_lvds_set_power(struct drm_device *dev, bool on) { struct drm_psb_private *dev_priv = to_drm_psb_private(dev); u32 pp_status; @@ -286,3 +286,16 @@ void gma_lvds_prepare(struct drm_encoder *encoder) gma_power_end(dev); } +void gma_lvds_commit(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 (mode_dev->backlight_duty_cycle == 0) + mode_dev->backlight_duty_cycle = + gma_lvds_get_max_backlight(dev); + + gma_lvds_set_power(dev, true); +} + diff --git a/drivers/gpu/drm/gma500/gma_lvds.h b/drivers/gpu/drm/gma500/gma_lvds.h index c1a7b3611d27..c2c8fe5b5aac 100644 --- a/drivers/gpu/drm/gma500/gma_lvds.h +++ b/drivers/gpu/drm/gma500/gma_lvds.h @@ -24,7 +24,6 @@ struct gma_lvds_priv { }; u32 gma_lvds_get_max_backlight(struct drm_device *dev); -void gma_lvds_set_power(struct drm_device *dev, bool on); enum drm_mode_status gma_lvds_mode_valid(struct drm_connector *connector, struct drm_display_mode *mode); void gma_lvds_encoder_dpms(struct drm_encoder *encoder, int mode); @@ -34,5 +33,6 @@ 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); +void gma_lvds_commit(struct drm_encoder *encoder); #endif diff --git a/drivers/gpu/drm/gma500/oaktrail_lvds.c b/drivers/gpu/drm/gma500/oaktrail_lvds.c index dba0ca4b73a0..85cab0f7028a 100644 --- a/drivers/gpu/drm/gma500/oaktrail_lvds.c +++ b/drivers/gpu/drm/gma500/oaktrail_lvds.c @@ -105,23 +105,12 @@ static void oaktrail_lvds_mode_set(struct drm_encoder *encoder, gma_power_end(dev); } -static void oaktrail_lvds_commit(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 (mode_dev->backlight_duty_cycle == 0) - mode_dev->backlight_duty_cycle = gma_lvds_get_max_backlight(dev); - gma_lvds_set_power(dev, true); -} - static const struct drm_encoder_helper_funcs oaktrail_lvds_helper_funcs = { .dpms = gma_lvds_encoder_dpms, .mode_fixup = gma_lvds_mode_fixup, .prepare = gma_lvds_prepare, .mode_set = oaktrail_lvds_mode_set, - .commit = oaktrail_lvds_commit, + .commit = gma_lvds_commit, }; /* Returns the panel fixed mode from configuration. */ diff --git a/drivers/gpu/drm/gma500/psb_intel_lvds.c b/drivers/gpu/drm/gma500/psb_intel_lvds.c index e4258205a262..fbb72be6e017 100644 --- a/drivers/gpu/drm/gma500/psb_intel_lvds.c +++ b/drivers/gpu/drm/gma500/psb_intel_lvds.c @@ -132,19 +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_commit(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 (mode_dev->backlight_duty_cycle == 0) - mode_dev->backlight_duty_cycle = - gma_lvds_get_max_backlight(dev); - - gma_lvds_set_power(dev, true); -} - static void psb_intel_lvds_mode_set(struct drm_encoder *encoder, struct drm_display_mode *mode, struct drm_display_mode *adjusted_mode) @@ -287,7 +274,7 @@ static const struct drm_encoder_helper_funcs psb_intel_lvds_helper_funcs = { .mode_fixup = gma_lvds_mode_fixup, .prepare = gma_lvds_prepare, .mode_set = psb_intel_lvds_mode_set, - .commit = psb_intel_lvds_commit, + .commit = gma_lvds_commit, }; const struct drm_connector_helper_funcs -- 2.36.1