linux-media.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/3] Support for multiple MFC FW sub-versions
@ 2014-05-20 10:17 Arun Kumar K
  2014-05-20 10:17 ` [PATCH 1/3] [media] s5p-mfc: Remove duplicate function s5p_mfc_reload_firmware Arun Kumar K
                   ` (3 more replies)
  0 siblings, 4 replies; 7+ messages in thread
From: Arun Kumar K @ 2014-05-20 10:17 UTC (permalink / raw)
  To: linux-media, linux-samsung-soc
  Cc: k.debski, s.nawrocki, posciak, avnd.kiran, arunkk.samsung

This patchset is for supporting multple firmware sub-versions
for MFC. Newer firmwares come with changed interfaces and fixes
without any change in the fw version number.
So this implementation is as per Tomasz Figa's suggestion [1].
[1] http://permalink.gmane.org/gmane.linux.kernel.samsung-soc/31735

Arun Kumar K (3):
  [media] s5p-mfc: Remove duplicate function s5p_mfc_reload_firmware
  [media] s5p-mfc: Support multiple firmware sub-versions
  [media] s5p-mfc: Add init buffer cmd to MFCV6

 drivers/media/platform/s5p-mfc/s5p_mfc.c        |   11 +++---
 drivers/media/platform/s5p-mfc/s5p_mfc_common.h |   11 +++++-
 drivers/media/platform/s5p-mfc/s5p_mfc_ctrl.c   |   44 ++++++-----------------
 drivers/media/platform/s5p-mfc/s5p_mfc_opr_v6.c |    6 ++--
 4 files changed, 30 insertions(+), 42 deletions(-)

-- 
1.7.9.5


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH 1/3] [media] s5p-mfc: Remove duplicate function s5p_mfc_reload_firmware
  2014-05-20 10:17 [PATCH 0/3] Support for multiple MFC FW sub-versions Arun Kumar K
@ 2014-05-20 10:17 ` Arun Kumar K
  2014-05-20 10:17 ` [PATCH 2/3] [media] s5p-mfc: Support multiple firmware sub-versions Arun Kumar K
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 7+ messages in thread
From: Arun Kumar K @ 2014-05-20 10:17 UTC (permalink / raw)
  To: linux-media, linux-samsung-soc
  Cc: k.debski, s.nawrocki, posciak, avnd.kiran, arunkk.samsung

The function s5p_mfc_reload_firmware is exactly same as
s5p_mfc_load_firmware. So removing the duplicate function.

Signed-off-by: Arun Kumar K <arun.kk@samsung.com>
---
 drivers/media/platform/s5p-mfc/s5p_mfc.c      |    2 +-
 drivers/media/platform/s5p-mfc/s5p_mfc_ctrl.c |   33 -------------------------
 2 files changed, 1 insertion(+), 34 deletions(-)

diff --git a/drivers/media/platform/s5p-mfc/s5p_mfc.c b/drivers/media/platform/s5p-mfc/s5p_mfc.c
index 9ed0985..8da4c23 100644
--- a/drivers/media/platform/s5p-mfc/s5p_mfc.c
+++ b/drivers/media/platform/s5p-mfc/s5p_mfc.c
@@ -162,7 +162,7 @@ static void s5p_mfc_watchdog_worker(struct work_struct *work)
 	/* Double check if there is at least one instance running.
 	 * If no instance is in memory than no firmware should be present */
 	if (dev->num_inst > 0) {
-		ret = s5p_mfc_reload_firmware(dev);
+		ret = s5p_mfc_load_firmware(dev);
 		if (ret) {
 			mfc_err("Failed to reload FW\n");
 			goto unlock;
diff --git a/drivers/media/platform/s5p-mfc/s5p_mfc_ctrl.c b/drivers/media/platform/s5p-mfc/s5p_mfc_ctrl.c
index 6c3f8f7..c97c7c8 100644
--- a/drivers/media/platform/s5p-mfc/s5p_mfc_ctrl.c
+++ b/drivers/media/platform/s5p-mfc/s5p_mfc_ctrl.c
@@ -107,39 +107,6 @@ int s5p_mfc_load_firmware(struct s5p_mfc_dev *dev)
 	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;
-	}
-	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;
-	}
-	memcpy(dev->fw_virt_addr, fw_blob->data, fw_blob->size);
-	wmb();
-	release_firmware(fw_blob);
-	mfc_debug_leave();
-	return 0;
-}
-
 /* Release firmware memory */
 int s5p_mfc_release_firmware(struct s5p_mfc_dev *dev)
 {
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH 2/3] [media] s5p-mfc: Support multiple firmware sub-versions
  2014-05-20 10:17 [PATCH 0/3] Support for multiple MFC FW sub-versions Arun Kumar K
  2014-05-20 10:17 ` [PATCH 1/3] [media] s5p-mfc: Remove duplicate function s5p_mfc_reload_firmware Arun Kumar K
@ 2014-05-20 10:17 ` Arun Kumar K
  2014-05-20 11:45   ` Sachin Kamat
  2014-05-20 10:17 ` [PATCH 3/3] [media] s5p-mfc: Add init buffer cmd to MFCV6 Arun Kumar K
  2014-05-20 18:03 ` [PATCH 0/3] Support for multiple MFC FW sub-versions Tomasz Figa
  3 siblings, 1 reply; 7+ messages in thread
From: Arun Kumar K @ 2014-05-20 10:17 UTC (permalink / raw)
  To: linux-media, linux-samsung-soc
  Cc: k.debski, s.nawrocki, posciak, avnd.kiran, arunkk.samsung

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>
---
 drivers/media/platform/s5p-mfc/s5p_mfc.c        |    9 +++++----
 drivers/media/platform/s5p-mfc/s5p_mfc_common.h |   11 ++++++++++-
 drivers/media/platform/s5p-mfc/s5p_mfc_ctrl.c   |   15 ++++++++++++---
 3 files changed, 27 insertions(+), 8 deletions(-)

diff --git a/drivers/media/platform/s5p-mfc/s5p_mfc.c b/drivers/media/platform/s5p-mfc/s5p_mfc.c
index 8da4c23..514e7ec 100644
--- a/drivers/media/platform/s5p-mfc/s5p_mfc.c
+++ b/drivers/media/platform/s5p-mfc/s5p_mfc.c
@@ -1343,7 +1343,7 @@ static struct s5p_mfc_variant mfc_drvdata_v5 = {
 	.port_num	= MFC_NUM_PORTS,
 	.buf_size	= &buf_size_v5,
 	.buf_align	= &mfc_buf_align_v5,
-	.fw_name	= "s5p-mfc.fw",
+	.fw_name[0]	= "s5p-mfc.fw",
 };
 
 struct s5p_mfc_buf_size_v6 mfc_buf_size_v6 = {
@@ -1370,7 +1370,8 @@ static struct s5p_mfc_variant mfc_drvdata_v6 = {
 	.port_num	= MFC_NUM_PORTS_V6,
 	.buf_size	= &buf_size_v6,
 	.buf_align	= &mfc_buf_align_v6,
-	.fw_name        = "s5p-mfc-v6.fw",
+	.fw_name[0]     = "s5p-mfc-v6.fw",
+	.fw_name[1]     = "s5p-mfc-v6-v2.fw",
 };
 
 struct s5p_mfc_buf_size_v6 mfc_buf_size_v7 = {
@@ -1397,7 +1398,7 @@ static struct s5p_mfc_variant mfc_drvdata_v7 = {
 	.port_num	= MFC_NUM_PORTS_V7,
 	.buf_size	= &buf_size_v7,
 	.buf_align	= &mfc_buf_align_v7,
-	.fw_name        = "s5p-mfc-v7.fw",
+	.fw_name[0]     = "s5p-mfc-v7.fw",
 };
 
 struct s5p_mfc_buf_size_v6 mfc_buf_size_v8 = {
@@ -1424,7 +1425,7 @@ static struct s5p_mfc_variant mfc_drvdata_v8 = {
 	.port_num	= MFC_NUM_PORTS_V8,
 	.buf_size	= &buf_size_v8,
 	.buf_align	= &mfc_buf_align_v8,
-	.fw_name        = "s5p-mfc-v8.fw",
+	.fw_name[0]     = "s5p-mfc-v8.fw",
 };
 
 static struct platform_device_id mfc_driver_ids[] = {
diff --git a/drivers/media/platform/s5p-mfc/s5p_mfc_common.h b/drivers/media/platform/s5p-mfc/s5p_mfc_common.h
index 89681c3..de60185 100644
--- a/drivers/media/platform/s5p-mfc/s5p_mfc_common.h
+++ b/drivers/media/platform/s5p-mfc/s5p_mfc_common.h
@@ -38,6 +38,8 @@
 #define MFC_BANK2_ALIGN_ORDER	13
 #define MFC_BASE_ALIGN_ORDER	17
 
+#define MFC_FW_MAX_VERSIONS	2
+
 #include <media/videobuf2-dma-contig.h>
 
 static inline dma_addr_t s5p_mfc_mem_cookie(void *a, void *b)
@@ -163,6 +165,11 @@ enum s5p_mfc_decode_arg {
 	MFC_DEC_RES_CHANGE,
 };
 
+enum s5p_mfc_fw_ver {
+	MFC_FW_V1,
+	MFC_FW_V2,
+};
+
 #define MFC_BUF_FLAG_USED	(1 << 0)
 #define MFC_BUF_FLAG_EOS	(1 << 1)
 
@@ -225,7 +232,7 @@ struct s5p_mfc_variant {
 	u32 version_bit;
 	struct s5p_mfc_buf_size *buf_size;
 	struct s5p_mfc_buf_align *buf_align;
-	char	*fw_name;
+	char	*fw_name[MFC_FW_MAX_VERSIONS];
 };
 
 /**
@@ -287,6 +294,7 @@ struct s5p_mfc_priv_buf {
  * @warn_start:		hardware error code from which warnings start
  * @mfc_ops:		ops structure holding HW operation function pointers
  * @mfc_cmds:		cmd structure holding HW commands function pointers
+ * @fw_ver:		loaded firmware sub-version
  *
  */
 struct s5p_mfc_dev {
@@ -331,6 +339,7 @@ struct s5p_mfc_dev {
 	struct s5p_mfc_hw_ops *mfc_ops;
 	struct s5p_mfc_hw_cmds *mfc_cmds;
 	const struct s5p_mfc_regs *mfc_regs;
+	enum s5p_mfc_fw_ver fw_ver;
 };
 
 /**
diff --git a/drivers/media/platform/s5p-mfc/s5p_mfc_ctrl.c b/drivers/media/platform/s5p-mfc/s5p_mfc_ctrl.c
index c97c7c8..7aabcdb 100644
--- a/drivers/media/platform/s5p-mfc/s5p_mfc_ctrl.c
+++ b/drivers/media/platform/s5p-mfc/s5p_mfc_ctrl.c
@@ -78,14 +78,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 err = -EINVAL, i;
 
 	/* 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;
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH 3/3] [media] s5p-mfc: Add init buffer cmd to MFCV6
  2014-05-20 10:17 [PATCH 0/3] Support for multiple MFC FW sub-versions Arun Kumar K
  2014-05-20 10:17 ` [PATCH 1/3] [media] s5p-mfc: Remove duplicate function s5p_mfc_reload_firmware Arun Kumar K
  2014-05-20 10:17 ` [PATCH 2/3] [media] s5p-mfc: Support multiple firmware sub-versions Arun Kumar K
@ 2014-05-20 10:17 ` Arun Kumar K
  2014-05-20 18:03 ` [PATCH 0/3] Support for multiple MFC FW sub-versions Tomasz Figa
  3 siblings, 0 replies; 7+ messages in thread
From: Arun Kumar K @ 2014-05-20 10:17 UTC (permalink / raw)
  To: linux-media, linux-samsung-soc
  Cc: k.debski, s.nawrocki, posciak, avnd.kiran, arunkk.samsung

Latest MFC v6 firmware requires tile mode and loop filter
setting to be done as part of Init buffer command, in sync
with v7. This patch adds this support for new v6 firmware.

Signed-off-by: Arun Kumar K <arun.kk@samsung.com>
Signed-off-by: Kiran AVND <avnd.kiran@samsung.com>
---
 drivers/media/platform/s5p-mfc/s5p_mfc_opr_v6.c |    6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/media/platform/s5p-mfc/s5p_mfc_opr_v6.c b/drivers/media/platform/s5p-mfc/s5p_mfc_opr_v6.c
index 4f5e0ea..c1c12f8 100644
--- a/drivers/media/platform/s5p-mfc/s5p_mfc_opr_v6.c
+++ b/drivers/media/platform/s5p-mfc/s5p_mfc_opr_v6.c
@@ -48,6 +48,8 @@
 #define WRITEL(data, reg) \
 	(WARN_ON_ONCE(!(reg)) ? 0 : writel((data), (reg)))
 
+#define IS_MFCV6_V2(dev) (!IS_MFCV7_PLUS(dev) && dev->fw_ver == MFC_FW_V2)
+
 /* Allocate temporary buffers for decoding */
 static int s5p_mfc_alloc_dec_temp_buffers_v6(struct s5p_mfc_ctx *ctx)
 {
@@ -1352,7 +1354,7 @@ static int s5p_mfc_init_decode_v6(struct s5p_mfc_ctx *ctx)
 		WRITEL(ctx->display_delay, mfc_regs->d_display_delay);
 	}
 
-	if (IS_MFCV7_PLUS(dev)) {
+	if (IS_MFCV7_PLUS(dev) || IS_MFCV6_V2(dev)) {
 		WRITEL(reg, mfc_regs->d_dec_options);
 		reg = 0;
 	}
@@ -1367,7 +1369,7 @@ static int s5p_mfc_init_decode_v6(struct s5p_mfc_ctx *ctx)
 	if (ctx->dst_fmt->fourcc == V4L2_PIX_FMT_NV12MT_16X16)
 		reg |= (0x1 << S5P_FIMV_D_OPT_TILE_MODE_SHIFT_V6);
 
-	if (IS_MFCV7_PLUS(dev))
+	if (IS_MFCV7_PLUS(dev) || IS_MFCV6_V2(dev))
 		WRITEL(reg, mfc_regs->d_init_buffer_options);
 	else
 		WRITEL(reg, mfc_regs->d_dec_options);
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH 2/3] [media] s5p-mfc: Support multiple firmware sub-versions
  2014-05-20 10:17 ` [PATCH 2/3] [media] s5p-mfc: Support multiple firmware sub-versions Arun Kumar K
@ 2014-05-20 11:45   ` Sachin Kamat
  2014-05-21  9:15     ` Arun Kumar K
  0 siblings, 1 reply; 7+ messages in thread
From: Sachin Kamat @ 2014-05-20 11:45 UTC (permalink / raw)
  To: Arun Kumar K
  Cc: linux-media, linux-samsung-soc, Kamil Debski, Sylwester Nawrocki,
	Pawel Osciak, Kiran Avnd, Arun Kumar

Hi Arun,

On 20 May 2014 15:47, Arun Kumar K <arun.kk@samsung.com> wrote:
> 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>
> ---
>  drivers/media/platform/s5p-mfc/s5p_mfc.c        |    9 +++++----
>  drivers/media/platform/s5p-mfc/s5p_mfc_common.h |   11 ++++++++++-
>  drivers/media/platform/s5p-mfc/s5p_mfc_ctrl.c   |   15 ++++++++++++---
>  3 files changed, 27 insertions(+), 8 deletions(-)
>
> diff --git a/drivers/media/platform/s5p-mfc/s5p_mfc.c b/drivers/media/platform/s5p-mfc/s5p_mfc.c
> index 8da4c23..514e7ec 100644
> --- a/drivers/media/platform/s5p-mfc/s5p_mfc.c
> +++ b/drivers/media/platform/s5p-mfc/s5p_mfc.c
> @@ -1343,7 +1343,7 @@ static struct s5p_mfc_variant mfc_drvdata_v5 = {
>         .port_num       = MFC_NUM_PORTS,
>         .buf_size       = &buf_size_v5,
>         .buf_align      = &mfc_buf_align_v5,
> -       .fw_name        = "s5p-mfc.fw",
> +       .fw_name[0]     = "s5p-mfc.fw",
>  };
>
>  struct s5p_mfc_buf_size_v6 mfc_buf_size_v6 = {
> @@ -1370,7 +1370,8 @@ static struct s5p_mfc_variant mfc_drvdata_v6 = {
>         .port_num       = MFC_NUM_PORTS_V6,
>         .buf_size       = &buf_size_v6,
>         .buf_align      = &mfc_buf_align_v6,
> -       .fw_name        = "s5p-mfc-v6.fw",
> +       .fw_name[0]     = "s5p-mfc-v6.fw",
> +       .fw_name[1]     = "s5p-mfc-v6-v2.fw",

Probably a simple 1 line comment about the difference between the
versions would help.

>  };
>
>  struct s5p_mfc_buf_size_v6 mfc_buf_size_v7 = {
> @@ -1397,7 +1398,7 @@ static struct s5p_mfc_variant mfc_drvdata_v7 = {
>         .port_num       = MFC_NUM_PORTS_V7,
>         .buf_size       = &buf_size_v7,
>         .buf_align      = &mfc_buf_align_v7,
> -       .fw_name        = "s5p-mfc-v7.fw",
> +       .fw_name[0]     = "s5p-mfc-v7.fw",
>  };
>
>  struct s5p_mfc_buf_size_v6 mfc_buf_size_v8 = {
> @@ -1424,7 +1425,7 @@ static struct s5p_mfc_variant mfc_drvdata_v8 = {
>         .port_num       = MFC_NUM_PORTS_V8,
>         .buf_size       = &buf_size_v8,
>         .buf_align      = &mfc_buf_align_v8,
> -       .fw_name        = "s5p-mfc-v8.fw",
> +       .fw_name[0]     = "s5p-mfc-v8.fw",
>  };
>
>  static struct platform_device_id mfc_driver_ids[] = {
> diff --git a/drivers/media/platform/s5p-mfc/s5p_mfc_common.h b/drivers/media/platform/s5p-mfc/s5p_mfc_common.h
> index 89681c3..de60185 100644
> --- a/drivers/media/platform/s5p-mfc/s5p_mfc_common.h
> +++ b/drivers/media/platform/s5p-mfc/s5p_mfc_common.h
> @@ -38,6 +38,8 @@
>  #define MFC_BANK2_ALIGN_ORDER  13
>  #define MFC_BASE_ALIGN_ORDER   17
>
> +#define MFC_FW_MAX_VERSIONS    2
> +
>  #include <media/videobuf2-dma-contig.h>
>
>  static inline dma_addr_t s5p_mfc_mem_cookie(void *a, void *b)
> @@ -163,6 +165,11 @@ enum s5p_mfc_decode_arg {
>         MFC_DEC_RES_CHANGE,
>  };
>
> +enum s5p_mfc_fw_ver {
> +       MFC_FW_V1,
> +       MFC_FW_V2,
> +};
> +
>  #define MFC_BUF_FLAG_USED      (1 << 0)
>  #define MFC_BUF_FLAG_EOS       (1 << 1)
>
> @@ -225,7 +232,7 @@ struct s5p_mfc_variant {
>         u32 version_bit;
>         struct s5p_mfc_buf_size *buf_size;
>         struct s5p_mfc_buf_align *buf_align;
> -       char    *fw_name;
> +       char    *fw_name[MFC_FW_MAX_VERSIONS];
>  };
>
>  /**
> @@ -287,6 +294,7 @@ struct s5p_mfc_priv_buf {
>   * @warn_start:                hardware error code from which warnings start
>   * @mfc_ops:           ops structure holding HW operation function pointers
>   * @mfc_cmds:          cmd structure holding HW commands function pointers
> + * @fw_ver:            loaded firmware sub-version
>   *
>   */
>  struct s5p_mfc_dev {
> @@ -331,6 +339,7 @@ struct s5p_mfc_dev {
>         struct s5p_mfc_hw_ops *mfc_ops;
>         struct s5p_mfc_hw_cmds *mfc_cmds;
>         const struct s5p_mfc_regs *mfc_regs;
> +       enum s5p_mfc_fw_ver fw_ver;
>  };
>
>  /**
> diff --git a/drivers/media/platform/s5p-mfc/s5p_mfc_ctrl.c b/drivers/media/platform/s5p-mfc/s5p_mfc_ctrl.c
> index c97c7c8..7aabcdb 100644
> --- a/drivers/media/platform/s5p-mfc/s5p_mfc_ctrl.c
> +++ b/drivers/media/platform/s5p-mfc/s5p_mfc_ctrl.c
> @@ -78,14 +78,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 err = -EINVAL, i;

nit: Please use either
            int i, err = -EINVAL;
or
            int i;
            int 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;

Where is this getting used?


-- 
With warm regards,
Sachin

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH 0/3] Support for multiple MFC FW sub-versions
  2014-05-20 10:17 [PATCH 0/3] Support for multiple MFC FW sub-versions Arun Kumar K
                   ` (2 preceding siblings ...)
  2014-05-20 10:17 ` [PATCH 3/3] [media] s5p-mfc: Add init buffer cmd to MFCV6 Arun Kumar K
@ 2014-05-20 18:03 ` Tomasz Figa
  3 siblings, 0 replies; 7+ messages in thread
From: Tomasz Figa @ 2014-05-20 18:03 UTC (permalink / raw)
  To: Arun Kumar K, linux-media, linux-samsung-soc
  Cc: k.debski, s.nawrocki, posciak, avnd.kiran, arunkk.samsung

Hi Arun,

On 20.05.2014 12:17, Arun Kumar K wrote:
> This patchset is for supporting multple firmware sub-versions
> for MFC. Newer firmwares come with changed interfaces and fixes
> without any change in the fw version number.
> So this implementation is as per Tomasz Figa's suggestion [1].
> [1] http://permalink.gmane.org/gmane.linux.kernel.samsung-soc/31735
> 
> Arun Kumar K (3):
>   [media] s5p-mfc: Remove duplicate function s5p_mfc_reload_firmware
>   [media] s5p-mfc: Support multiple firmware sub-versions
>   [media] s5p-mfc: Add init buffer cmd to MFCV6
> 
>  drivers/media/platform/s5p-mfc/s5p_mfc.c        |   11 +++---
>  drivers/media/platform/s5p-mfc/s5p_mfc_common.h |   11 +++++-
>  drivers/media/platform/s5p-mfc/s5p_mfc_ctrl.c   |   44 ++++++-----------------
>  drivers/media/platform/s5p-mfc/s5p_mfc_opr_v6.c |    6 ++--
>  4 files changed, 30 insertions(+), 42 deletions(-)
> 

The whole series looks good.

Reviewed-by: Tomasz Figa <t.figa@samsung.com>

Best regards,
Tomasz

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH 2/3] [media] s5p-mfc: Support multiple firmware sub-versions
  2014-05-20 11:45   ` Sachin Kamat
@ 2014-05-21  9:15     ` Arun Kumar K
  0 siblings, 0 replies; 7+ messages in thread
From: Arun Kumar K @ 2014-05-21  9:15 UTC (permalink / raw)
  To: Sachin Kamat
  Cc: linux-media, linux-samsung-soc, Kamil Debski, Sylwester Nawrocki,
	Pawel Osciak, Kiran Avnd

Hi Sachin,

On Tue, May 20, 2014 at 5:15 PM, Sachin Kamat <sachin.kamat@linaro.org> wrote:
> Hi Arun,
>
> On 20 May 2014 15:47, Arun Kumar K <arun.kk@samsung.com> wrote:
>> 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>
>> ---
>>  drivers/media/platform/s5p-mfc/s5p_mfc.c        |    9 +++++----
>>  drivers/media/platform/s5p-mfc/s5p_mfc_common.h |   11 ++++++++++-
>>  drivers/media/platform/s5p-mfc/s5p_mfc_ctrl.c   |   15 ++++++++++++---
>>  3 files changed, 27 insertions(+), 8 deletions(-)
>>
>> diff --git a/drivers/media/platform/s5p-mfc/s5p_mfc.c b/drivers/media/platform/s5p-mfc/s5p_mfc.c
>> index 8da4c23..514e7ec 100644
>> --- a/drivers/media/platform/s5p-mfc/s5p_mfc.c
>> +++ b/drivers/media/platform/s5p-mfc/s5p_mfc.c
>> @@ -1343,7 +1343,7 @@ static struct s5p_mfc_variant mfc_drvdata_v5 = {
>>         .port_num       = MFC_NUM_PORTS,
>>         .buf_size       = &buf_size_v5,
>>         .buf_align      = &mfc_buf_align_v5,
>> -       .fw_name        = "s5p-mfc.fw",
>> +       .fw_name[0]     = "s5p-mfc.fw",
>>  };
>>
>>  struct s5p_mfc_buf_size_v6 mfc_buf_size_v6 = {
>> @@ -1370,7 +1370,8 @@ static struct s5p_mfc_variant mfc_drvdata_v6 = {
>>         .port_num       = MFC_NUM_PORTS_V6,
>>         .buf_size       = &buf_size_v6,
>>         .buf_align      = &mfc_buf_align_v6,
>> -       .fw_name        = "s5p-mfc-v6.fw",
>> +       .fw_name[0]     = "s5p-mfc-v6.fw",
>> +       .fw_name[1]     = "s5p-mfc-v6-v2.fw",
>
> Probably a simple 1 line comment about the difference between the
> versions would help.
>

Ok will add.

>>  };
>>
>>  struct s5p_mfc_buf_size_v6 mfc_buf_size_v7 = {
>> @@ -1397,7 +1398,7 @@ static struct s5p_mfc_variant mfc_drvdata_v7 = {
>>         .port_num       = MFC_NUM_PORTS_V7,
>>         .buf_size       = &buf_size_v7,
>>         .buf_align      = &mfc_buf_align_v7,
>> -       .fw_name        = "s5p-mfc-v7.fw",
>> +       .fw_name[0]     = "s5p-mfc-v7.fw",
>>  };
>>
>>  struct s5p_mfc_buf_size_v6 mfc_buf_size_v8 = {
>> @@ -1424,7 +1425,7 @@ static struct s5p_mfc_variant mfc_drvdata_v8 = {
>>         .port_num       = MFC_NUM_PORTS_V8,
>>         .buf_size       = &buf_size_v8,
>>         .buf_align      = &mfc_buf_align_v8,
>> -       .fw_name        = "s5p-mfc-v8.fw",
>> +       .fw_name[0]     = "s5p-mfc-v8.fw",
>>  };
>>
>>  static struct platform_device_id mfc_driver_ids[] = {
>> diff --git a/drivers/media/platform/s5p-mfc/s5p_mfc_common.h b/drivers/media/platform/s5p-mfc/s5p_mfc_common.h
>> index 89681c3..de60185 100644
>> --- a/drivers/media/platform/s5p-mfc/s5p_mfc_common.h
>> +++ b/drivers/media/platform/s5p-mfc/s5p_mfc_common.h
>> @@ -38,6 +38,8 @@
>>  #define MFC_BANK2_ALIGN_ORDER  13
>>  #define MFC_BASE_ALIGN_ORDER   17
>>
>> +#define MFC_FW_MAX_VERSIONS    2
>> +
>>  #include <media/videobuf2-dma-contig.h>
>>
>>  static inline dma_addr_t s5p_mfc_mem_cookie(void *a, void *b)
>> @@ -163,6 +165,11 @@ enum s5p_mfc_decode_arg {
>>         MFC_DEC_RES_CHANGE,
>>  };
>>
>> +enum s5p_mfc_fw_ver {
>> +       MFC_FW_V1,
>> +       MFC_FW_V2,
>> +};
>> +
>>  #define MFC_BUF_FLAG_USED      (1 << 0)
>>  #define MFC_BUF_FLAG_EOS       (1 << 1)
>>
>> @@ -225,7 +232,7 @@ struct s5p_mfc_variant {
>>         u32 version_bit;
>>         struct s5p_mfc_buf_size *buf_size;
>>         struct s5p_mfc_buf_align *buf_align;
>> -       char    *fw_name;
>> +       char    *fw_name[MFC_FW_MAX_VERSIONS];
>>  };
>>
>>  /**
>> @@ -287,6 +294,7 @@ struct s5p_mfc_priv_buf {
>>   * @warn_start:                hardware error code from which warnings start
>>   * @mfc_ops:           ops structure holding HW operation function pointers
>>   * @mfc_cmds:          cmd structure holding HW commands function pointers
>> + * @fw_ver:            loaded firmware sub-version
>>   *
>>   */
>>  struct s5p_mfc_dev {
>> @@ -331,6 +339,7 @@ struct s5p_mfc_dev {
>>         struct s5p_mfc_hw_ops *mfc_ops;
>>         struct s5p_mfc_hw_cmds *mfc_cmds;
>>         const struct s5p_mfc_regs *mfc_regs;
>> +       enum s5p_mfc_fw_ver fw_ver;
>>  };
>>
>>  /**
>> diff --git a/drivers/media/platform/s5p-mfc/s5p_mfc_ctrl.c b/drivers/media/platform/s5p-mfc/s5p_mfc_ctrl.c
>> index c97c7c8..7aabcdb 100644
>> --- a/drivers/media/platform/s5p-mfc/s5p_mfc_ctrl.c
>> +++ b/drivers/media/platform/s5p-mfc/s5p_mfc_ctrl.c
>> @@ -78,14 +78,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 err = -EINVAL, i;
>
> nit: Please use either
>             int i, err = -EINVAL;
> or
>             int i;
>             int err = -EINVAL;
>

Ok

>>
>>         /* 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;
>
> Where is this getting used?
>

Its used in the next patch in the series for init buffer options.

Regards
Arun

>
> --
> With warm regards,
> Sachin

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2014-05-21  9:15 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-05-20 10:17 [PATCH 0/3] Support for multiple MFC FW sub-versions Arun Kumar K
2014-05-20 10:17 ` [PATCH 1/3] [media] s5p-mfc: Remove duplicate function s5p_mfc_reload_firmware Arun Kumar K
2014-05-20 10:17 ` [PATCH 2/3] [media] s5p-mfc: Support multiple firmware sub-versions Arun Kumar K
2014-05-20 11:45   ` Sachin Kamat
2014-05-21  9:15     ` Arun Kumar K
2014-05-20 10:17 ` [PATCH 3/3] [media] s5p-mfc: Add init buffer cmd to MFCV6 Arun Kumar K
2014-05-20 18:03 ` [PATCH 0/3] Support for multiple MFC FW sub-versions Tomasz Figa

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).