media: mfc: get MFC H/W version from DT
authorJeonghee Kim <jhhhh.kim@samsung.com>
Mon, 23 Apr 2018 05:08:20 +0000 (14:08 +0900)
committerCosmin Tanislav <demonsingur@gmail.com>
Mon, 22 Apr 2024 17:22:22 +0000 (20:22 +0300)
Change-Id: I7a54a29b7fa11588a9bce93757120662ea1c7378
Signed-off-by: Jeonghee Kim <jhhhh.kim@samsung.com>
drivers/media/platform/exynos/mfc/s5p_mfc_common.h
drivers/media/platform/exynos/mfc/s5p_mfc_ctrl.c
drivers/media/platform/exynos/mfc/s5p_mfc_data_struct.h
drivers/media/platform/exynos/mfc/s5p_mfc_dec.c
drivers/media/platform/exynos/mfc/s5p_mfc_enc.c

index 2d6b28fde6fe3dd69dcf1443168f447fa23c1e5b..e5857e9e8a66a5bc1ed161857896f24878aedb33 100644 (file)
 #define        ENC_SET_COLOR_ASPECT            (1 << 9)
 #define        ENC_SET_HP_BITRATE_CONTROL      (1 << 10)
 
-#define MFC_VER_MAJOR(dev)     ((s5p_mfc_version(dev) >> 8) & 0xFF)
-#define MFC_VER_MINOR(dev)     (s5p_mfc_version(dev) & 0xFF)
+#define MFC_VER_MAJOR(dev)     ((dev->pdata->ip_ver >> 8) & 0xFF)
+#define MFC_VER_MINOR(dev)     (dev->pdata->ip_ver & 0xFF)
 
 /*
  * Version Description
  */
-#define IS_MFCV10X(dev)                ((s5p_mfc_version(dev) == 0xA0) || \
-                               (s5p_mfc_version(dev) == 0xA01))
-#define IS_MFCV11X(dev)                (s5p_mfc_version(dev) == 0x1100)
-#define IS_MFCV12X(dev)                (s5p_mfc_version(dev) == 0x1200)
-#define IS_MFCV13X(dev)                (s5p_mfc_version(dev) == 0x1300)
+#define IS_MFCV10X(dev)                ((dev->pdata->ip_ver == 0xA0) || \
+                               (dev->pdata->ip_ver == 0xA01))
+#define IS_MFCV11X(dev)                (dev->pdata->ip_ver == 0x1100)
+#define IS_MFCV12X(dev)                (dev->pdata->ip_ver == 0x1200)
+#define IS_MFCV13X(dev)                (dev->pdata->ip_ver == 0x1300)
 #define FROM_MFCV11X(dev)      (IS_MFCV11X(dev) || IS_MFCV12X(dev) || \
                                        IS_MFCV13X(dev))
 #define FROM_MFCV10X(dev)      (IS_MFCV10X(dev) || FROM_MFCV11X(dev))
                                        (dev->fw.date >= 0x171023))
 #define FW_HAS_HP_BITRATE_CONTROL(dev) (FROM_MFCV11X(dev) &&           \
                                        (dev->fw.date >= 0x180314))
-
-static inline unsigned int s5p_mfc_version(struct s5p_mfc_dev *dev)
-{
-       unsigned int version = 0;
-
-       switch (dev->pdata->ip_ver) {
-       case IP_VER_MFC_4P_0:
-       case IP_VER_MFC_4P_1:
-       case IP_VER_MFC_4P_2:
-               version = 0x51;
-               break;
-       case IP_VER_MFC_5G_0:
-               version = 0x61;
-               break;
-       case IP_VER_MFC_5G_1:
-       case IP_VER_MFC_5A_0:
-       case IP_VER_MFC_5A_1:
-               version = 0x65;
-               break;
-       case IP_VER_MFC_6A_0:
-       case IP_VER_MFC_6A_1:
-               version = 0x72;
-               break;
-       case IP_VER_MFC_6A_2:
-               version = 0x723;
-               break;
-       case IP_VER_MFC_7A_0:
-               version = 0x80;
-               break;
-       case IP_VER_MFC_8I_0:
-               version = 0x90;
-               break;
-       case IP_VER_MFC_6I_0:
-               version = 0x78;
-               break;
-       case IP_VER_MFC_8J_0:
-               version = 0xA0;
-               break;
-       case IP_VER_MFC_8J_1:
-               version = 0xA01;
-               break;
-       case IP_VER_MFC_8K_0:
-               version = 0x1100;
-               break;
-       case IP_VER_MFC_7K_0:
-               version = 0x1120;
-               break;
-       case IP_VER_MFC_9L_0:
-               version = 0x1200;
-               break;
-       case IP_VER_MFC_9R_0:
-               version = 0x1202;
-               break;
-       case IP_VER_MFC_9M_0:
-               version = 0x1021;
-               break;
-       case IP_VER_MFC_9M_1:
-               version = 0x1300;
-               break;
-       }
-
-       return version;
-}
-
 #endif /* __S5P_MFC_COMMON_H */
index 03422ec28cd78161a248908c4bbdd45e14e248f9..94028fa7dcdcef5e9de028456fe8bda40af5f2e8 100644 (file)
@@ -119,9 +119,9 @@ static int mfc_init_hw(struct s5p_mfc_dev *dev, enum mfc_buf_usage_type buf_type
        dev->fw.date = s5p_mfc_get_fw_ver_all();
        /* Check MFC version and F/W version */
        fw_ver = s5p_mfc_get_mfc_version();
-       if (fw_ver != s5p_mfc_version(dev)) {
+       if (fw_ver != dev->pdata->ip_ver) {
                mfc_err_dev("Invalid F/W version(0x%x) for MFC H/W(0x%x)\n",
-                               fw_ver, s5p_mfc_version(dev));
+                               fw_ver, dev->pdata->ip_ver);
                ret = -EIO;
                goto err_init_hw;
        }
index 2134b7fb1cf52f8a819d68484191b72e3c983d0c..dabf52f9b266d37c283f59d3639c079362acd6df 100644 (file)
 #define MAX_NUM_IMAGES_IN_VB           8
 #define MAX_NUM_BUFCON_BUFS            32
 
-/*
- *  MFC version
- */
-enum mfc_ip_version {
-       IP_VER_MFC_4P_0,
-       IP_VER_MFC_4P_1,
-       IP_VER_MFC_4P_2,
-       IP_VER_MFC_5G_0,
-       IP_VER_MFC_5G_1,
-       IP_VER_MFC_5A_0,
-       IP_VER_MFC_5A_1,
-       IP_VER_MFC_6A_0,
-       IP_VER_MFC_6A_1,
-       IP_VER_MFC_6A_2,
-       IP_VER_MFC_7A_0,
-       IP_VER_MFC_8I_0,
-       IP_VER_MFC_6I_0,
-       IP_VER_MFC_8J_0,
-       IP_VER_MFC_8J_1,
-       IP_VER_MFC_8K_0,
-       IP_VER_MFC_7K_0,
-       IP_VER_MFC_9L_0,
-       IP_VER_MFC_9R_0,
-       IP_VER_MFC_9M_0,
-       IP_VER_MFC_9M_1,
-};
-
 /*
  *  MFC region id for smc
  */
@@ -400,7 +373,7 @@ struct s5p_mfc_qos {
 #endif
 
 struct s5p_mfc_platdata {
-       enum mfc_ip_version ip_ver;
+       int ip_ver;
        int clock_rate;
        int min_rate;
 #ifdef CONFIG_MFC_USE_BUS_DEVFREQ
index 001e3b3aedfe85c0504950424434d6304a0f028c..3a11ce8cb7a23ba87f155c305a9a4befdaa2a3c8 100644 (file)
@@ -976,7 +976,7 @@ static int mfc_dec_get_ctrl_val(struct s5p_mfc_ctx *ctx, struct v4l2_control *ct
                ctrl->value = s5p_mfc_qos_get_framerate(ctx);
                break;
        case V4L2_CID_MPEG_MFC_GET_VERSION_INFO:
-               ctrl->value = s5p_mfc_version(dev);
+               ctrl->value = dev->pdata->ip_ver;
                break;
        case V4L2_CID_MPEG_VIDEO_QOS_RATIO:
                ctrl->value = ctx->qos_ratio;
index 55392d0a607dd529c676f73253264a156e1c05f2..3ad33ca64a482022e0a5806345d945c7023458a1 100644 (file)
@@ -824,7 +824,7 @@ static int mfc_enc_get_ctrl_val(struct s5p_mfc_ctx *ctx, struct v4l2_control *ct
                }
                break;
        case V4L2_CID_MPEG_MFC_GET_VERSION_INFO:
-               ctrl->value = s5p_mfc_version(dev);
+               ctrl->value = dev->pdata->ip_ver;
                break;
        case V4L2_CID_MPEG_MFC_GET_DRIVER_INFO:
                ctrl->value = MFC_DRIVER_INFO;