]> git.proxmox.com Git - mirror_ubuntu-zesty-kernel.git/commitdiff
Merge branch 'drm-tda998x-devel' of git://ftp.arm.linux.org.uk/~rmk/linux-arm into...
authorDave Airlie <airlied@redhat.com>
Thu, 28 May 2015 23:19:59 +0000 (09:19 +1000)
committerDave Airlie <airlied@redhat.com>
Thu, 28 May 2015 23:19:59 +0000 (09:19 +1000)
warning fix for tda998x

* 'drm-tda998x-devel' of git://ftp.arm.linux.org.uk/~rmk/linux-arm:
  drm/i2c: tda998x: fix compiler warning for ssize_t

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

index 011e1cac3e4ce0b17e1d3fa2a5bd31a1ad38b3ff,290a69d2315a4d0ca250e5de0ed5e9722ed3f26e..fe1599d75f14e39b2a39364b78d088d4715c368f
@@@ -33,8 -33,6 +33,8 @@@
  struct tda998x_priv {
        struct i2c_client *cec;
        struct i2c_client *hdmi;
 +      struct mutex mutex;
 +      struct delayed_work dwork;
        uint16_t rev;
        uint8_t current_page;
        int dpms;
@@@ -405,10 -403,9 +405,10 @@@ reg_read_range(struct tda998x_priv *pri
        uint8_t addr = REG2ADDR(reg);
        int ret;
  
 +      mutex_lock(&priv->mutex);
        ret = set_page(priv, reg);
        if (ret < 0)
 -              return ret;
 +              goto out;
  
        ret = i2c_master_send(client, &addr, sizeof(addr));
        if (ret < 0)
        if (ret < 0)
                goto fail;
  
 -      return ret;
 +      goto out;
  
  fail:
        dev_err(&client->dev, "Error %d reading from 0x%x\n", ret, reg);
 +out:
 +      mutex_unlock(&priv->mutex);
        return ret;
  }
  
@@@ -437,16 -432,13 +437,16 @@@ reg_write_range(struct tda998x_priv *pr
        buf[0] = REG2ADDR(reg);
        memcpy(&buf[1], p, cnt);
  
 +      mutex_lock(&priv->mutex);
        ret = set_page(priv, reg);
        if (ret < 0)
 -              return;
 +              goto out;
  
        ret = i2c_master_send(client, buf, cnt + 1);
        if (ret < 0)
                dev_err(&client->dev, "Error %d writing to 0x%x\n", ret, reg);
 +out:
 +      mutex_unlock(&priv->mutex);
  }
  
  static int
@@@ -468,16 -460,13 +468,16 @@@ reg_write(struct tda998x_priv *priv, ui
        uint8_t buf[] = {REG2ADDR(reg), val};
        int ret;
  
 +      mutex_lock(&priv->mutex);
        ret = set_page(priv, reg);
        if (ret < 0)
 -              return;
 +              goto out;
  
        ret = i2c_master_send(client, buf, sizeof(buf));
        if (ret < 0)
                dev_err(&client->dev, "Error %d writing to 0x%x\n", ret, reg);
 +out:
 +      mutex_unlock(&priv->mutex);
  }
  
  static void
@@@ -487,16 -476,13 +487,16 @@@ reg_write16(struct tda998x_priv *priv, 
        uint8_t buf[] = {REG2ADDR(reg), val >> 8, val};
        int ret;
  
 +      mutex_lock(&priv->mutex);
        ret = set_page(priv, reg);
        if (ret < 0)
 -              return;
 +              goto out;
  
        ret = i2c_master_send(client, buf, sizeof(buf));
        if (ret < 0)
                dev_err(&client->dev, "Error %d writing to 0x%x\n", ret, reg);
 +out:
 +      mutex_unlock(&priv->mutex);
  }
  
  static void
@@@ -551,17 -537,6 +551,17 @@@ tda998x_reset(struct tda998x_priv *priv
        reg_write(priv, REG_MUX_VP_VIP_OUT, 0x24);
  }
  
 +/* handle HDMI connect/disconnect */
 +static void tda998x_hpd(struct work_struct *work)
 +{
 +      struct delayed_work *dwork = to_delayed_work(work);
 +      struct tda998x_priv *priv =
 +                      container_of(dwork, struct tda998x_priv, dwork);
 +
 +      if (priv->encoder && priv->encoder->dev)
 +              drm_kms_helper_hotplug_event(priv->encoder->dev);
 +}
 +
  /*
   * only 2 interrupts may occur: screen plug/unplug and EDID read
   */
@@@ -585,7 -560,8 +585,7 @@@ static irqreturn_t tda998x_irq_thread(i
                priv->wq_edid_wait = 0;
                wake_up(&priv->wq_edid);
        } else if (cec != 0) {                  /* HPD change */
 -              if (priv->encoder && priv->encoder->dev)
 -                      drm_helper_hpd_irq_event(priv->encoder->dev);
 +              schedule_delayed_work(&priv->dwork, HZ/10);
        }
        return IRQ_HANDLED;
  }
@@@ -644,7 -620,8 +644,8 @@@ tda998x_write_avi(struct tda998x_priv *
  
        len = hdmi_avi_infoframe_pack(&frame, buf, sizeof(buf));
        if (len < 0) {
-               dev_err(&priv->hdmi->dev, "hdmi_avi_infoframe_pack() failed: %d\n", len);
+               dev_err(&priv->hdmi->dev,
+                       "hdmi_avi_infoframe_pack() failed: %zd\n", len);
                return;
        }
  
@@@ -1147,10 -1124,8 +1148,10 @@@ static void tda998x_destroy(struct tda9
        /* disable all IRQs and free the IRQ handler */
        cec_write(priv, REG_CEC_RXSHPDINTENA, 0);
        reg_clear(priv, REG_INT_FLAGS_2, INT_FLAGS_2_EDID_BLK_RD);
 -      if (priv->hdmi->irq)
 +      if (priv->hdmi->irq) {
                free_irq(priv->hdmi->irq, priv);
 +              cancel_delayed_work_sync(&priv->dwork);
 +      }
  
        i2c_unregister_device(priv->cec);
  }
@@@ -1234,7 -1209,6 +1235,7 @@@ static int tda998x_create(struct i2c_cl
        struct device_node *np = client->dev.of_node;
        u32 video;
        int rev_lo, rev_hi, ret;
 +      unsigned short cec_addr;
  
        priv->vip_cntrl_0 = VIP_CNTRL_0_SWAP_A(2) | VIP_CNTRL_0_SWAP_B(3);
        priv->vip_cntrl_1 = VIP_CNTRL_1_SWAP_C(0) | VIP_CNTRL_1_SWAP_D(1);
  
        priv->current_page = 0xff;
        priv->hdmi = client;
 -      priv->cec = i2c_new_dummy(client->adapter, 0x34);
 +      /* CEC I2C address bound to TDA998x I2C addr by configuration pins */
 +      cec_addr = 0x34 + (client->addr & 0x03);
 +      priv->cec = i2c_new_dummy(client->adapter, cec_addr);
        if (!priv->cec)
                return -ENODEV;
  
        priv->dpms = DRM_MODE_DPMS_OFF;
  
 +      mutex_init(&priv->mutex);       /* protect the page access */
 +
        /* wake up the device: */
        cec_write(priv, REG_CEC_ENAMODS,
                        CEC_ENAMODS_EN_RXSENS | CEC_ENAMODS_EN_HDMI);
        if (client->irq) {
                int irqf_trigger;
  
 -              /* init read EDID waitqueue */
 +              /* init read EDID waitqueue and HDP work */
                init_waitqueue_head(&priv->wq_edid);
 +              INIT_DELAYED_WORK(&priv->dwork, tda998x_hpd);
  
                /* clear pending interrupts */
                reg_read(priv, REG_INT_FLAGS_0);