Merge branch 'tda998x-fixes' of git://ftp.arm.linux.org.uk/~rmk/linux-cubox
authorDave Airlie <airlied@gmail.com>
Sat, 5 Jul 2014 21:48:26 +0000 (07:48 +1000)
committerDave Airlie <airlied@gmail.com>
Sat, 5 Jul 2014 21:48:26 +0000 (07:48 +1000)
mode fixes for tda998x.

* 'tda998x-fixes' of git://ftp.arm.linux.org.uk/~rmk/linux-cubox:
  drm/i2c: tda998x: add some basic mode validation
  drm/i2c: tda998x: faster polling for edid
  drm/i2c: tda998x: move drm_i2c_encoder_destroy call

1  2 
drivers/gpu/drm/i2c/tda998x_drv.c

@@@ -568,11 -568,11 +568,11 @@@ static irqreturn_t tda998x_irq_thread(i
  
  static uint8_t tda998x_cksum(uint8_t *buf, size_t bytes)
  {
 -      uint8_t sum = 0;
 +      int sum = 0;
  
        while (bytes--)
 -              sum += *buf++;
 -      return (255 - sum) + 1;
 +              sum -= *buf++;
 +      return sum;
  }
  
  #define HB(x) (x)
@@@ -810,6 -810,12 +810,12 @@@ static in
  tda998x_encoder_mode_valid(struct drm_encoder *encoder,
                          struct drm_display_mode *mode)
  {
+       if (mode->clock > 150000)
+               return MODE_CLOCK_HIGH;
+       if (mode->htotal >= BIT(13))
+               return MODE_BAD_HVALUE;
+       if (mode->vtotal >= BIT(11))
+               return MODE_BAD_VVALUE;
        return MODE_OK;
  }
  
@@@ -1048,8 -1054,8 +1054,8 @@@ read_edid_block(struct drm_encoder *enc
                        return i;
                }
        } else {
-               for (i = 10; i > 0; i--) {
-                       msleep(10);
+               for (i = 100; i > 0; i--) {
+                       msleep(1);
                        ret = reg_read(priv, REG_INT_FLAGS_2);
                        if (ret < 0)
                                return ret;
@@@ -1183,7 -1189,6 +1189,6 @@@ static voi
  tda998x_encoder_destroy(struct drm_encoder *encoder)
  {
        struct tda998x_priv *priv = to_tda998x_priv(encoder);
-       drm_i2c_encoder_destroy(encoder);
  
        /* disable all IRQs and free the IRQ handler */
        cec_write(priv, REG_CEC_RXSHPDINTENA, 0);
  
        if (priv->cec)
                i2c_unregister_device(priv->cec);
+       drm_i2c_encoder_destroy(encoder);
        kfree(priv);
  }