mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-08 03:40:35 +09:00
IEP: add capabilities query interface
add capabilities query interface for userspace to query iep device feature in current soc. Change-Id: I377e686b2ce0357aa75445e4e47e9e4883a077ae Signed-off-by: alpha.lin <alpha.lin@rock-chips.com>
This commit is contained in:
committed by
Gerrit Code Review
parent
c8c06956fb
commit
cfaf327bab
@@ -829,6 +829,7 @@
|
||||
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";
|
||||
};
|
||||
|
||||
|
||||
@@ -1116,6 +1116,7 @@
|
||||
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";
|
||||
};
|
||||
|
||||
|
||||
@@ -1221,6 +1221,7 @@
|
||||
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";
|
||||
};
|
||||
|
||||
|
||||
@@ -1,6 +1,24 @@
|
||||
#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)
|
||||
@@ -13,6 +31,7 @@
|
||||
#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)
|
||||
@@ -25,6 +44,7 @@
|
||||
#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 */
|
||||
@@ -36,7 +56,7 @@
|
||||
#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
|
||||
@@ -170,12 +190,11 @@ struct iep_img
|
||||
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;
|
||||
|
||||
@@ -77,6 +77,9 @@ struct iep_drvdata {
|
||||
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;
|
||||
@@ -800,6 +803,13 @@ static long iep_ioctl(struct file *filp, uint32_t cmd, unsigned long arg)
|
||||
}
|
||||
}
|
||||
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;
|
||||
@@ -886,6 +896,13 @@ static long compat_iep_ioctl(struct file *filp, uint32_t cmd,
|
||||
}
|
||||
}
|
||||
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;
|
||||
@@ -987,6 +1004,7 @@ static int iep_drv_probe(struct platform_device *pdev)
|
||||
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;
|
||||
@@ -1070,6 +1088,46 @@ static int iep_drv_probe(struct platform_device *pdev)
|
||||
|
||||
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);
|
||||
|
||||
Reference in New Issue
Block a user