interrupts = <GIC_SPI 48 IRQ_TYPE_LEVEL_HIGH>;
clocks = <&clk_gates9 8>, <&clk_gates9 7>;
clock-names = "aclk_iep", "hclk_iep";
+ version = <1>;
status = "okay";
};
interrupts = <GIC_SPI 17 IRQ_TYPE_LEVEL_HIGH>;
clocks = <&clk_gates15 2>, <&clk_gates15 3>;
clock-names = "aclk_iep", "hclk_iep";
+ version = <0>;
status = "okay";
};
interrupts = <GIC_SPI 17 IRQ_TYPE_LEVEL_HIGH>;
clocks = <&clk_gates16 2>, <&clk_gates16 3>;
clock-names = "aclk_iep", "hclk_iep";
+ version = <2>;
status = "okay";
};
#ifndef _IEP_H_
#define _IEP_H_
+/* Capability for current iep version
+using by userspace to determine iep features */
+struct IEP_CAP {
+ u8 scaling_supported;
+ u8 i4_deinterlace_supported;
+ u8 i2_deinterlace_supported;
+ u8 compression_noise_reduction_supported;
+ u8 sampling_noise_reduction_supported;
+ u8 hsb_enhancement_supported;
+ u8 cg_enhancement_supported;
+ u8 direct_path_supported;
+ u16 max_dynamic_width;
+ u16 max_dynamic_height;
+ u16 max_static_width;
+ u16 max_static_height;
+ u8 max_enhance_radius;
+};
+
#define IEP_IOC_MAGIC 'i'
#define IEP_SET_PARAMETER_REQ _IOW(IEP_IOC_MAGIC, 1, unsigned long)
#define IEP_SET_PARAMETER _IOW(IEP_IOC_MAGIC, 8, unsigned long)
#define IEP_RELEASE_CURRENT_TASK _IOW(IEP_IOC_MAGIC, 9, unsigned long)
#define IEP_GET_IOMMU_STATE _IOR(IEP_IOC_MAGIC,10, unsigned long)
+#define IEP_QUERY_CAP _IOR(IEP_IOC_MAGIC,11, struct IEP_CAP)
#ifdef CONFIG_COMPAT
#define COMPAT_IEP_SET_PARAMETER_REQ _IOW(IEP_IOC_MAGIC, 1, u32)
#define COMPAT_IEP_SET_PARAMETER _IOW(IEP_IOC_MAGIC, 8, u32)
#define COMPAT_IEP_RELEASE_CURRENT_TASK _IOW(IEP_IOC_MAGIC, 9, u32)
#define COMPAT_IEP_GET_IOMMU_STATE _IOR(IEP_IOC_MAGIC,10, u32)
+#define COMPAT_IEP_QUERY_CAP _IOR(IEP_IOC_MAGIC,11, struct IEP_CAP)
#endif
/* Driver information */
#define iep_debug(level, fmt, args...) \
do { \
if (debug >= level) \
- pr_info("%s:%d: " fmt, \
+ pr_info("%s:%d: " fmt, \
__func__, __LINE__, ##args); \
} while (0)
#else
u8 alpha_swap; /* not be used */
};
-
struct IEP_MSG {
struct iep_img src;
struct iep_img dst;
- struct iep_img src1;
+ struct iep_img src1;
struct iep_img dst1;
struct iep_img src_itemp;
atomic_t iep_int;
atomic_t mmu_page_fault;
atomic_t mmu_bus_error;
+
+ /* capability for this iep device */
+ struct IEP_CAP cap;
};
struct iep_drvdata *iep_drvdata1 = NULL;
}
}
break;
+ case IEP_QUERY_CAP:
+ if (copy_to_user((void __user *)arg, &iep_drvdata1->cap,
+ sizeof(struct IEP_CAP))) {
+ IEP_ERR("error: copy_to_user failed\n");
+ return -EFAULT;
+ }
+ break;
default:
IEP_ERR("unknown ioctl cmd!\n");
ret = -EINVAL;
}
}
break;
+ case COMPAT_IEP_QUERY_CAP:
+ if (copy_to_user((void __user *)arg, &iep_drvdata1->cap,
+ sizeof(struct IEP_CAP))) {
+ IEP_ERR("error: copy_to_user failed\n");
+ return -EFAULT;
+ }
+ break;
default:
IEP_ERR("unknown ioctl cmd!\n");
ret = -EINVAL;
struct iep_drvdata *data;
int ret = 0;
struct resource *res = NULL;
+ u32 version;
#if defined(CONFIG_IEP_IOMMU)
u32 iommu_en = 0;
struct device *mmu_dev = NULL;
mutex_init(&iep_service.mutex);
+ if (of_property_read_u32(np, "version", &version)) {
+ version = 0;
+ }
+
+ data->cap.scaling_supported = 0;
+ data->cap.i4_deinterlace_supported = 1;
+ data->cap.i2_deinterlace_supported = 1;
+ data->cap.compression_noise_reduction_supported = 1;
+ data->cap.sampling_noise_reduction_supported = 1;
+ data->cap.hsb_enhancement_supported = 1;
+ data->cap.cg_enhancement_supported = 1;
+ data->cap.direct_path_supported = 1;
+ data->cap.max_dynamic_width = 1920;
+ data->cap.max_dynamic_height = 1088;
+ data->cap.max_static_width = 8192;
+ data->cap.max_static_height = 8192;
+ data->cap.max_enhance_radius = 3;
+
+ switch (version) {
+ case 0:
+ data->cap.scaling_supported = 1;
+ break;
+ case 1:
+ data->cap.compression_noise_reduction_supported = 0;
+ data->cap.sampling_noise_reduction_supported = 0;
+ if (soc_is_rk3126b()) {
+ data->cap.i4_deinterlace_supported = 0;
+ data->cap.hsb_enhancement_supported = 0;
+ data->cap.cg_enhancement_supported = 0;
+ }
+ break;
+ case 2:
+ data->cap.max_dynamic_width = 4096;
+ data->cap.max_dynamic_height = 2340;
+ data->cap.max_enhance_radius = 2;
+ break;
+ default:
+ ;
+ }
+
platform_set_drvdata(pdev, data);
ret = misc_register(&iep_dev);