mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-05 18:41:58 +09:00
media: rockchip: fec: reset fec for each frame
Signed-off-by: Xu Hongfei <xuhf@rock-chips.com> Change-Id: I15945f9d957bca72c8e553a6c85f7fd0f62b2876
This commit is contained in:
@@ -250,8 +250,12 @@ static int fec_running(struct file *file, struct rkfec_in_out *buf)
|
||||
buf->out_fourcc, buf->out_fourcc >> 8,
|
||||
buf->out_fourcc >> 16, buf->out_fourcc >> 24);
|
||||
|
||||
|
||||
//clk tosee
|
||||
if (hw->fec_ver == RKFEC_V20) {
|
||||
if (hw->soft_reset)
|
||||
hw->soft_reset(hw);
|
||||
else
|
||||
dev_warn(hw->dev, "soft_reset not implemented\n");
|
||||
}
|
||||
|
||||
init_completion(&ofl->cmpl);
|
||||
|
||||
@@ -467,6 +471,12 @@ static long rkfec_ofl_ioctl(struct file *file, void *fh,
|
||||
|
||||
ofl->pm_need_wait = true;
|
||||
|
||||
v4l2_dbg(4, rkfec_debug, &ofl->v4l2_dev, "%s cmd:%d", __func__, cmd);
|
||||
|
||||
if (mutex_lock_interruptible(&ofl->ioctl_lock)) {
|
||||
return -ERESTARTSYS;
|
||||
}
|
||||
|
||||
if (!arg) {
|
||||
ret = -EINVAL;
|
||||
goto out;
|
||||
@@ -497,6 +507,7 @@ out:
|
||||
complete(&ofl->pm_cmpl);
|
||||
|
||||
ofl->pm_need_wait = false;
|
||||
mutex_unlock(&ofl->ioctl_lock);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -583,7 +594,7 @@ int rkfec_register_offline(struct rkfec_hw_dev *hw)
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
mutex_init(&ofl->apilock);
|
||||
mutex_init(&ofl->ioctl_lock);
|
||||
ofl->vfd = offline_videodev;
|
||||
vfd = &ofl->vfd;
|
||||
vfd->device_caps = V4L2_CAP_STREAMING;
|
||||
@@ -607,7 +618,7 @@ int rkfec_register_offline(struct rkfec_hw_dev *hw)
|
||||
v4l2_info(&ofl->v4l2_dev, "%s success\n", __func__);
|
||||
return 0;
|
||||
unreg_v4l2:
|
||||
mutex_destroy(&ofl->apilock);
|
||||
mutex_destroy(&ofl->ioctl_lock);
|
||||
v4l2_device_unregister(v4l2_dev);
|
||||
return ret;
|
||||
}
|
||||
@@ -617,7 +628,7 @@ void rkfec_unregister_offline(struct rkfec_hw_dev *hw)
|
||||
struct rkfec_offline_dev *ofl = &hw->ofl_dev;
|
||||
|
||||
rkfec_offline_proc_cleanup(&hw->ofl_dev);
|
||||
mutex_destroy(&ofl->apilock);
|
||||
mutex_destroy(&ofl->ioctl_lock);
|
||||
video_unregister_device(&ofl->vfd);
|
||||
v4l2_device_unregister(&ofl->v4l2_dev);
|
||||
}
|
||||
|
||||
@@ -69,7 +69,7 @@ struct rkfec_offline_dev {
|
||||
struct rkfec_hw_dev *hw;
|
||||
struct v4l2_device v4l2_dev;
|
||||
struct video_device vfd;
|
||||
struct mutex apilock;
|
||||
struct mutex ioctl_lock;
|
||||
struct completion cmpl;
|
||||
struct completion pm_cmpl;
|
||||
struct list_head list;
|
||||
|
||||
@@ -22,11 +22,6 @@ static void rkfec_soft_reset(struct rkfec_hw_dev *hw)
|
||||
u32 val;
|
||||
|
||||
/* reset */
|
||||
val = SYS_SOFT_RST_FBCE | SYS_SOFT_RST_ACLK;
|
||||
writel(val, hw->base_addr + RKFEC_CLK_DIS);
|
||||
udelay(10);
|
||||
writel(~val, hw->base_addr + RKFEC_CLK_DIS);
|
||||
|
||||
if (hw->reset) {
|
||||
reset_control_assert(hw->reset);
|
||||
udelay(20);
|
||||
@@ -41,8 +36,7 @@ static void rkfec_soft_reset(struct rkfec_hw_dev *hw)
|
||||
}
|
||||
|
||||
/* clk_dis */
|
||||
val = SYS_FEC_LGC_CKG_DIS | SYS_FEC_RAM_CKG_DIS;
|
||||
writel(val, hw->base_addr + RKFEC_CLK_DIS);
|
||||
writel(0, hw->base_addr + RKFEC_CLK_DIS);
|
||||
|
||||
/* int en */
|
||||
val = FRM_END_P_FEC;
|
||||
@@ -195,6 +189,7 @@ static int rkfec_hw_probe(struct platform_device *pdev)
|
||||
dev_set_drvdata(dev, hw_dev);
|
||||
hw_dev->dev = dev;
|
||||
hw_dev->match_data = match_data;
|
||||
hw_dev->fec_ver = match_data->fec_ver;
|
||||
|
||||
res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
|
||||
if (!res) {
|
||||
@@ -259,7 +254,7 @@ static int rkfec_hw_probe(struct platform_device *pdev)
|
||||
|
||||
hw_dev->reset = devm_reset_control_array_get(dev, false, false);
|
||||
if (IS_ERR(hw_dev->reset)) {
|
||||
dev_info(dev, "failed to get cru reset\n");
|
||||
dev_info(dev, "failed to get cru reset, error = %ld\n", PTR_ERR(hw_dev->reset));
|
||||
hw_dev->reset = NULL;
|
||||
}
|
||||
|
||||
@@ -278,6 +273,7 @@ static int rkfec_hw_probe(struct platform_device *pdev)
|
||||
if (hw_dev->is_mmu && !is_mem_reserved)
|
||||
hw_dev->is_dma_config = false;
|
||||
hw_dev->mem_ops = &vb2_cma_sg_memops;
|
||||
hw_dev->soft_reset = rkfec_soft_reset;
|
||||
|
||||
rkfec_register_offline(hw_dev);
|
||||
|
||||
|
||||
@@ -70,6 +70,9 @@ struct rkfec_hw_dev {
|
||||
bool is_dma_sg_ops;
|
||||
bool is_shutdown;
|
||||
bool is_suspend;
|
||||
enum rkfec_fec_ver fec_ver;
|
||||
|
||||
void (*soft_reset)(struct rkfec_hw_dev *hw);
|
||||
};
|
||||
|
||||
#ifndef IS_LINUX_VERSION_AT_LEAST_6_1
|
||||
|
||||
Reference in New Issue
Block a user