From: Jeonghee Kim Date: Mon, 23 Apr 2018 05:08:20 +0000 (+0900) Subject: media: mfc: get MFC H/W version from DT X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=2f5fd09b37e097afbd035f25a1b003a7d43a4447;p=GitHub%2FLineageOS%2Fandroid_kernel_motorola_exynos9610.git media: mfc: get MFC H/W version from DT Change-Id: I7a54a29b7fa11588a9bce93757120662ea1c7378 Signed-off-by: Jeonghee Kim --- diff --git a/drivers/media/platform/exynos/mfc/s5p_mfc_common.h b/drivers/media/platform/exynos/mfc/s5p_mfc_common.h index 2d6b28fde6fe..e5857e9e8a66 100644 --- a/drivers/media/platform/exynos/mfc/s5p_mfc_common.h +++ b/drivers/media/platform/exynos/mfc/s5p_mfc_common.h @@ -176,17 +176,17 @@ #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)) @@ -212,68 +212,4 @@ (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 */ diff --git a/drivers/media/platform/exynos/mfc/s5p_mfc_ctrl.c b/drivers/media/platform/exynos/mfc/s5p_mfc_ctrl.c index 03422ec28cd7..94028fa7dcdc 100644 --- a/drivers/media/platform/exynos/mfc/s5p_mfc_ctrl.c +++ b/drivers/media/platform/exynos/mfc/s5p_mfc_ctrl.c @@ -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; } diff --git a/drivers/media/platform/exynos/mfc/s5p_mfc_data_struct.h b/drivers/media/platform/exynos/mfc/s5p_mfc_data_struct.h index 2134b7fb1cf5..dabf52f9b266 100644 --- a/drivers/media/platform/exynos/mfc/s5p_mfc_data_struct.h +++ b/drivers/media/platform/exynos/mfc/s5p_mfc_data_struct.h @@ -50,33 +50,6 @@ #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 diff --git a/drivers/media/platform/exynos/mfc/s5p_mfc_dec.c b/drivers/media/platform/exynos/mfc/s5p_mfc_dec.c index 001e3b3aedfe..3a11ce8cb7a2 100644 --- a/drivers/media/platform/exynos/mfc/s5p_mfc_dec.c +++ b/drivers/media/platform/exynos/mfc/s5p_mfc_dec.c @@ -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; diff --git a/drivers/media/platform/exynos/mfc/s5p_mfc_enc.c b/drivers/media/platform/exynos/mfc/s5p_mfc_enc.c index 55392d0a607d..3ad33ca64a48 100644 --- a/drivers/media/platform/exynos/mfc/s5p_mfc_enc.c +++ b/drivers/media/platform/exynos/mfc/s5p_mfc_enc.c @@ -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;