Merge branch 'fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/evalenti/linux...
[sfrench/cifs-2.6.git] / drivers / media / platform / mtk-vpu / mtk_vpu.c
index c9bf58c978780c727d4ec0f8595fdd8627eada17..463b69c934bef04db809db84d665382591e75e80 100644 (file)
@@ -134,6 +134,8 @@ struct vpu_wdt {
  *
  * @signaled:          the signal of vpu initialization completed
  * @fw_ver:            VPU firmware version
+ * @dec_capability:    decoder capability which is not used for now and
+ *                     the value is reserved for future use
  * @enc_capability:    encoder capability which is not used for now and
  *                     the value is reserved for future use
  * @wq:                        wait queue for VPU initialization status
@@ -141,6 +143,7 @@ struct vpu_wdt {
 struct vpu_run {
        u32 signaled;
        char fw_ver[VPU_FW_VER_LEN];
+       unsigned int    dec_capability;
        unsigned int    enc_capability;
        wait_queue_head_t wq;
 };
@@ -415,6 +418,14 @@ int vpu_wdt_reg_handler(struct platform_device *pdev,
 }
 EXPORT_SYMBOL_GPL(vpu_wdt_reg_handler);
 
+unsigned int vpu_get_vdec_hw_capa(struct platform_device *pdev)
+{
+       struct mtk_vpu *vpu = platform_get_drvdata(pdev);
+
+       return vpu->run.dec_capability;
+}
+EXPORT_SYMBOL_GPL(vpu_get_vdec_hw_capa);
+
 unsigned int vpu_get_venc_hw_capa(struct platform_device *pdev)
 {
        struct mtk_vpu *vpu = platform_get_drvdata(pdev);
@@ -523,9 +534,9 @@ static int load_requested_vpu(struct mtk_vpu *vpu,
 
 int vpu_load_firmware(struct platform_device *pdev)
 {
-       struct mtk_vpu *vpu = platform_get_drvdata(pdev);
+       struct mtk_vpu *vpu;
        struct device *dev = &pdev->dev;
-       struct vpu_run *run = &vpu->run;
+       struct vpu_run *run;
        const struct firmware *vpu_fw = NULL;
        int ret;
 
@@ -534,6 +545,9 @@ int vpu_load_firmware(struct platform_device *pdev)
                return -EINVAL;
        }
 
+       vpu = platform_get_drvdata(pdev);
+       run = &vpu->run;
+
        mutex_lock(&vpu->vpu_mutex);
        if (vpu->fw_loaded) {
                mutex_unlock(&vpu->vpu_mutex);
@@ -600,6 +614,7 @@ static void vpu_init_ipi_handler(void *data, unsigned int len, void *priv)
 
        vpu->run.signaled = run->signaled;
        strncpy(vpu->run.fw_ver, run->fw_ver, VPU_FW_VER_LEN);
+       vpu->run.dec_capability = run->dec_capability;
        vpu->run.enc_capability = run->enc_capability;
        wake_up_interruptible(&vpu->run.wq);
 }
@@ -674,7 +689,7 @@ static int vpu_alloc_ext_mem(struct mtk_vpu *vpu, u32 fw_type)
                                               GFP_KERNEL);
        if (!vpu->extmem[fw_type].va) {
                dev_err(dev, "Failed to allocate the extended program memory\n");
-               return PTR_ERR(vpu->extmem[fw_type].va);
+               return -ENOMEM;
        }
 
        /* Disable extend0. Enable extend1 */