---
 drivers/gpu/drm/i2c/ch7006_drv.c |   26 ++++++++++++++++++++++++--
 1 files changed, 24 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/i2c/ch7006_drv.c b/drivers/gpu/drm/i2c/ch7006_drv.c
index 7df4b86..a890652 100644
--- a/drivers/gpu/drm/i2c/ch7006_drv.c
+++ b/drivers/gpu/drm/i2c/ch7006_drv.c
@@ -287,6 +287,8 @@ static int ch7006_encoder_set_property(struct drm_encoder 
*encoder,
        struct ch7006_priv *priv = to_ch7006_priv(encoder);
        struct ch7006_state *state = &priv->state;
        struct drm_mode_config *conf = &encoder->dev->mode_config;
+       struct drm_crtc *crtc = encoder->crtc;
+       bool modes_changed = false;
 
        ch7006_dbg(client, "\n");
 
@@ -314,9 +316,12 @@ static int ch7006_encoder_set_property(struct drm_encoder 
*encoder,
                ch7006_load_reg(client, state, CH7006_VPOS);
 
        } else if (property == conf->tv_mode_property) {
+               if (connector->dpms != DRM_MODE_DPMS_OFF)
+                       return -EINVAL;
+
                priv->norm = val;
 
-               drm_helper_probe_single_connector_modes(connector, 0, 0);
+               modes_changed = true;
 
        } else if (property == conf->tv_brightness_property) {
                priv->brightness = val;
@@ -340,14 +345,31 @@ static int ch7006_encoder_set_property(struct drm_encoder 
*encoder,
                ch7006_load_reg(client, state, CH7006_FFILTER);
 
        } else if (property == priv->scale_property) {
+               if (connector->dpms != DRM_MODE_DPMS_OFF)
+                       return -EINVAL;
+
                priv->scale = val;
 
-               drm_helper_probe_single_connector_modes(connector, 0, 0);
+               modes_changed = true;
 
        } else {
                return -EINVAL;
        }
 
+       if (modes_changed) {
+               drm_helper_probe_single_connector_modes(connector, 0, 0);
+
+               /* Disable the crtc to ensure a full modeset is
+                * performed whenever it's turned on again. */
+               if (crtc) {
+                       struct drm_mode_set modeset = {
+                               .crtc = crtc,
+                       };
+
+                       crtc->funcs->set_config(&modeset);
+               }
+       }
+
        return 0;
 }
 
-- 
1.6.3.3

_______________________________________________
Nouveau mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/nouveau

Reply via email to