media: sun8i-di: Fix coefficient writes
[ Upstream commit 794b581f8c6eb7b60fe468ccb96dd3cd38ff779f ] Currently coefficients are applied only once, since they don't change. However, this is done before enable bit is set and thus it doesn't get applied properly. Fix that by applying coefficients after enable bit is set. While this means that it will be done evey time, it doesn't bring much time penalty. Fixes: a4260ea49547 ("media: sun4i: Add H3 deinterlace driver") Signed-off-by: Jernej Skrabec <jernej.skrabec@gmail.com> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl> Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
parent
409fe626f9
commit
920a2b171d
1 changed files with 21 additions and 21 deletions
|
@ -66,6 +66,7 @@ static void deinterlace_device_run(void *priv)
|
||||||
struct vb2_v4l2_buffer *src, *dst;
|
struct vb2_v4l2_buffer *src, *dst;
|
||||||
unsigned int hstep, vstep;
|
unsigned int hstep, vstep;
|
||||||
dma_addr_t addr;
|
dma_addr_t addr;
|
||||||
|
int i;
|
||||||
|
|
||||||
src = v4l2_m2m_next_src_buf(ctx->fh.m2m_ctx);
|
src = v4l2_m2m_next_src_buf(ctx->fh.m2m_ctx);
|
||||||
dst = v4l2_m2m_next_dst_buf(ctx->fh.m2m_ctx);
|
dst = v4l2_m2m_next_dst_buf(ctx->fh.m2m_ctx);
|
||||||
|
@ -160,6 +161,26 @@ static void deinterlace_device_run(void *priv)
|
||||||
deinterlace_write(dev, DEINTERLACE_CH1_HORZ_FACT, hstep);
|
deinterlace_write(dev, DEINTERLACE_CH1_HORZ_FACT, hstep);
|
||||||
deinterlace_write(dev, DEINTERLACE_CH1_VERT_FACT, vstep);
|
deinterlace_write(dev, DEINTERLACE_CH1_VERT_FACT, vstep);
|
||||||
|
|
||||||
|
/* neutral filter coefficients */
|
||||||
|
deinterlace_set_bits(dev, DEINTERLACE_FRM_CTRL,
|
||||||
|
DEINTERLACE_FRM_CTRL_COEF_ACCESS);
|
||||||
|
readl_poll_timeout(dev->base + DEINTERLACE_STATUS, val,
|
||||||
|
val & DEINTERLACE_STATUS_COEF_STATUS, 2, 40);
|
||||||
|
|
||||||
|
for (i = 0; i < 32; i++) {
|
||||||
|
deinterlace_write(dev, DEINTERLACE_CH0_HORZ_COEF0 + i * 4,
|
||||||
|
DEINTERLACE_IDENTITY_COEF);
|
||||||
|
deinterlace_write(dev, DEINTERLACE_CH0_VERT_COEF + i * 4,
|
||||||
|
DEINTERLACE_IDENTITY_COEF);
|
||||||
|
deinterlace_write(dev, DEINTERLACE_CH1_HORZ_COEF0 + i * 4,
|
||||||
|
DEINTERLACE_IDENTITY_COEF);
|
||||||
|
deinterlace_write(dev, DEINTERLACE_CH1_VERT_COEF + i * 4,
|
||||||
|
DEINTERLACE_IDENTITY_COEF);
|
||||||
|
}
|
||||||
|
|
||||||
|
deinterlace_clr_set_bits(dev, DEINTERLACE_FRM_CTRL,
|
||||||
|
DEINTERLACE_FRM_CTRL_COEF_ACCESS, 0);
|
||||||
|
|
||||||
deinterlace_clr_set_bits(dev, DEINTERLACE_FIELD_CTRL,
|
deinterlace_clr_set_bits(dev, DEINTERLACE_FIELD_CTRL,
|
||||||
DEINTERLACE_FIELD_CTRL_FIELD_CNT_MSK,
|
DEINTERLACE_FIELD_CTRL_FIELD_CNT_MSK,
|
||||||
DEINTERLACE_FIELD_CTRL_FIELD_CNT(ctx->field));
|
DEINTERLACE_FIELD_CTRL_FIELD_CNT(ctx->field));
|
||||||
|
@ -248,7 +269,6 @@ static irqreturn_t deinterlace_irq(int irq, void *data)
|
||||||
static void deinterlace_init(struct deinterlace_dev *dev)
|
static void deinterlace_init(struct deinterlace_dev *dev)
|
||||||
{
|
{
|
||||||
u32 val;
|
u32 val;
|
||||||
int i;
|
|
||||||
|
|
||||||
deinterlace_write(dev, DEINTERLACE_BYPASS,
|
deinterlace_write(dev, DEINTERLACE_BYPASS,
|
||||||
DEINTERLACE_BYPASS_CSC);
|
DEINTERLACE_BYPASS_CSC);
|
||||||
|
@ -285,26 +305,6 @@ static void deinterlace_init(struct deinterlace_dev *dev)
|
||||||
deinterlace_clr_set_bits(dev, DEINTERLACE_CHROMA_DIFF,
|
deinterlace_clr_set_bits(dev, DEINTERLACE_CHROMA_DIFF,
|
||||||
DEINTERLACE_CHROMA_DIFF_TH_MSK,
|
DEINTERLACE_CHROMA_DIFF_TH_MSK,
|
||||||
DEINTERLACE_CHROMA_DIFF_TH(5));
|
DEINTERLACE_CHROMA_DIFF_TH(5));
|
||||||
|
|
||||||
/* neutral filter coefficients */
|
|
||||||
deinterlace_set_bits(dev, DEINTERLACE_FRM_CTRL,
|
|
||||||
DEINTERLACE_FRM_CTRL_COEF_ACCESS);
|
|
||||||
readl_poll_timeout(dev->base + DEINTERLACE_STATUS, val,
|
|
||||||
val & DEINTERLACE_STATUS_COEF_STATUS, 2, 40);
|
|
||||||
|
|
||||||
for (i = 0; i < 32; i++) {
|
|
||||||
deinterlace_write(dev, DEINTERLACE_CH0_HORZ_COEF0 + i * 4,
|
|
||||||
DEINTERLACE_IDENTITY_COEF);
|
|
||||||
deinterlace_write(dev, DEINTERLACE_CH0_VERT_COEF + i * 4,
|
|
||||||
DEINTERLACE_IDENTITY_COEF);
|
|
||||||
deinterlace_write(dev, DEINTERLACE_CH1_HORZ_COEF0 + i * 4,
|
|
||||||
DEINTERLACE_IDENTITY_COEF);
|
|
||||||
deinterlace_write(dev, DEINTERLACE_CH1_VERT_COEF + i * 4,
|
|
||||||
DEINTERLACE_IDENTITY_COEF);
|
|
||||||
}
|
|
||||||
|
|
||||||
deinterlace_clr_set_bits(dev, DEINTERLACE_FRM_CTRL,
|
|
||||||
DEINTERLACE_FRM_CTRL_COEF_ACCESS, 0);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline struct deinterlace_ctx *deinterlace_file2ctx(struct file *file)
|
static inline struct deinterlace_ctx *deinterlace_file2ctx(struct file *file)
|
||||||
|
|
Loading…
Add table
Reference in a new issue