diff options
author | Daniel Vetter <daniel.vetter@ffwll.ch> | 2014-09-11 16:46:53 +0400 |
---|---|---|
committer | Daniel Vetter <daniel.vetter@ffwll.ch> | 2014-09-11 16:46:53 +0400 |
commit | 336879b1da97fffc097f77c6d6f818660f2826f0 (patch) | |
tree | 4ddb4d1c5d2b67fb096c72e41d2a03b01a605041 /drivers/media/platform/s5p-mfc/s5p_mfc_ctrl.c | |
parent | 3d3cbd84300e7be1e53083cac0f6f9c12978ecb4 (diff) | |
parent | fdcaa1dbb7c6ed419b10fb8cdb5001ab0a00538f (diff) | |
download | linux-336879b1da97fffc097f77c6d6f818660f2826f0.tar.xz |
Merge remote-tracking branch 'airlied/drm-next' into topic/vblank-rework
Dave asked me to do the backmerge before sending him the revised pull
request, so here we go. Nothing fancy in the conflicts, just a few
things changed right next to each another.
Conflicts:
drivers/gpu/drm/drm_irq.c
Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
Diffstat (limited to 'drivers/media/platform/s5p-mfc/s5p_mfc_ctrl.c')
-rw-r--r-- | drivers/media/platform/s5p-mfc/s5p_mfc_ctrl.c | 49 |
1 files changed, 12 insertions, 37 deletions
diff --git a/drivers/media/platform/s5p-mfc/s5p_mfc_ctrl.c b/drivers/media/platform/s5p-mfc/s5p_mfc_ctrl.c index 6c3f8f743900..ca9f78922832 100644 --- a/drivers/media/platform/s5p-mfc/s5p_mfc_ctrl.c +++ b/drivers/media/platform/s5p-mfc/s5p_mfc_ctrl.c @@ -38,8 +38,7 @@ int s5p_mfc_alloc_firmware(struct s5p_mfc_dev *dev) dev->fw_virt_addr = dma_alloc_coherent(dev->mem_dev_l, dev->fw_size, &dev->bank1, GFP_KERNEL); - if (IS_ERR_OR_NULL(dev->fw_virt_addr)) { - dev->fw_virt_addr = NULL; + if (!dev->fw_virt_addr) { mfc_err("Allocating bitprocessor buffer failed\n"); return -ENOMEM; } @@ -48,7 +47,7 @@ int s5p_mfc_alloc_firmware(struct s5p_mfc_dev *dev) bank2_virt = dma_alloc_coherent(dev->mem_dev_r, 1 << MFC_BASE_ALIGN_ORDER, &bank2_dma_addr, GFP_KERNEL); - if (IS_ERR(dev->fw_virt_addr)) { + if (!bank2_virt) { mfc_err("Allocating bank2 base failed\n"); dma_free_coherent(dev->mem_dev_l, dev->fw_size, dev->fw_virt_addr, dev->bank1); @@ -78,47 +77,23 @@ int s5p_mfc_alloc_firmware(struct s5p_mfc_dev *dev) int s5p_mfc_load_firmware(struct s5p_mfc_dev *dev) { struct firmware *fw_blob; - int err; + int i, err = -EINVAL; /* Firmare has to be present as a separate file or compiled * into kernel. */ mfc_debug_enter(); - err = request_firmware((const struct firmware **)&fw_blob, - dev->variant->fw_name, dev->v4l2_dev.dev); - if (err != 0) { - mfc_err("Firmware is not present in the /lib/firmware directory nor compiled in kernel\n"); - return -EINVAL; - } - if (fw_blob->size > dev->fw_size) { - mfc_err("MFC firmware is too big to be loaded\n"); - release_firmware(fw_blob); - return -ENOMEM; - } - if (!dev->fw_virt_addr) { - mfc_err("MFC firmware is not allocated\n"); - release_firmware(fw_blob); - return -EINVAL; + for (i = MFC_FW_MAX_VERSIONS - 1; i >= 0; i--) { + if (!dev->variant->fw_name[i]) + continue; + err = request_firmware((const struct firmware **)&fw_blob, + dev->variant->fw_name[i], dev->v4l2_dev.dev); + if (!err) { + dev->fw_ver = (enum s5p_mfc_fw_ver) i; + break; + } } - memcpy(dev->fw_virt_addr, fw_blob->data, fw_blob->size); - wmb(); - release_firmware(fw_blob); - mfc_debug_leave(); - return 0; -} - -/* Reload firmware to MFC */ -int s5p_mfc_reload_firmware(struct s5p_mfc_dev *dev) -{ - struct firmware *fw_blob; - int err; - - /* Firmare has to be present as a separate file or compiled - * into kernel. */ - mfc_debug_enter(); - err = request_firmware((const struct firmware **)&fw_blob, - dev->variant->fw_name, dev->v4l2_dev.dev); if (err != 0) { mfc_err("Firmware is not present in the /lib/firmware directory nor compiled in kernel\n"); return -EINVAL; |