summaryrefslogtreecommitdiff
path: root/drivers/media/platform/s5p-mfc/s5p_mfc_ctrl.c
diff options
context:
space:
mode:
authorArun Kumar K <arun.kk@samsung.com>2014-05-21 06:29:30 -0300
committerMauro Carvalho Chehab <m.chehab@samsung.com>2014-07-22 11:29:52 -0300
commit77ba6b7396047736f37c4f78d1f24f662e655a7e (patch)
treedba9e79468d747d851a96c41d8d5a641db4d7660 /drivers/media/platform/s5p-mfc/s5p_mfc_ctrl.c
parent46075006d98eb59a0f7c8bc04035eb7e40b0a067 (diff)
[media] s5p-mfc: Support multiple firmware sub-versions
For MFC firmwares, improved versions with bug fixes and feature additions are released keeping the firmware version including major and minor number same. The issue came with the release of a new MFCv6 firmware with an interface change. This patch adds the support of accepting multiple firmware binaries for every version with the driver trying to load firmwares starting from latest. This ensures full backward compatibility regardless of which firmware version and kernel version is used. Signed-off-by: Arun Kumar K <arun.kk@samsung.com> Reviewed-by: Tomasz Figa <t.figa@samsung.com> Signed-off-by: Kamil Debski <k.debski@samsung.com> Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
Diffstat (limited to 'drivers/media/platform/s5p-mfc/s5p_mfc_ctrl.c')
-rw-r--r--drivers/media/platform/s5p-mfc/s5p_mfc_ctrl.c15
1 files changed, 12 insertions, 3 deletions
diff --git a/drivers/media/platform/s5p-mfc/s5p_mfc_ctrl.c b/drivers/media/platform/s5p-mfc/s5p_mfc_ctrl.c
index 19f833ee0a55..ca9f78922832 100644
--- a/drivers/media/platform/s5p-mfc/s5p_mfc_ctrl.c
+++ b/drivers/media/platform/s5p-mfc/s5p_mfc_ctrl.c
@@ -77,14 +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);
+ 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;
+ }
+ }
+
if (err != 0) {
mfc_err("Firmware is not present in the /lib/firmware directory nor compiled in kernel\n");
return -EINVAL;