Skip to content

Commit

Permalink
media: hantro: Convert imx8m_vpu_g2_irq to helper
Browse files Browse the repository at this point in the history
It turns out that imx8m_vpu_g2_irq() doesn't depend on any platform
specifics and can be used with other G2 platform drivers too.

Move it to common code.

Signed-off-by: Jernej Skrabec <[email protected]>
Reviewed-by: Andrzej Pietrasiewicz <[email protected]>
Reviewed-by: Ezequiel Garcia <[email protected]>
Signed-off-by: Hans Verkuil <[email protected]>
Signed-off-by: Mauro Carvalho Chehab <[email protected]>
  • Loading branch information
jernejsk authored and mchehab committed Dec 16, 2021
1 parent 3c5b218 commit 3385c51
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 19 deletions.
18 changes: 18 additions & 0 deletions drivers/staging/media/hantro/hantro_g2.c
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,21 @@ void hantro_g2_check_idle(struct hantro_dev *vpu)
}
}
}

irqreturn_t hantro_g2_irq(int irq, void *dev_id)
{
struct hantro_dev *vpu = dev_id;
enum vb2_buffer_state state;
u32 status;

status = vdpu_read(vpu, G2_REG_INTERRUPT);
state = (status & G2_REG_INTERRUPT_DEC_RDY_INT) ?
VB2_BUF_STATE_DONE : VB2_BUF_STATE_ERROR;

vdpu_write(vpu, 0, G2_REG_INTERRUPT);
vdpu_write(vpu, G2_REG_CONFIG_DEC_CLK_GATE_E, G2_REG_CONFIG);

hantro_irq_done(vpu, state);

return IRQ_HANDLED;
}
1 change: 1 addition & 0 deletions drivers/staging/media/hantro/hantro_hw.h
Original file line number Diff line number Diff line change
Expand Up @@ -425,5 +425,6 @@ void hantro_g2_vp9_dec_done(struct hantro_ctx *ctx);
int hantro_vp9_dec_init(struct hantro_ctx *ctx);
void hantro_vp9_dec_exit(struct hantro_ctx *ctx);
void hantro_g2_check_idle(struct hantro_dev *vpu);
irqreturn_t hantro_g2_irq(int irq, void *dev_id);

#endif /* HANTRO_HW_H_ */
20 changes: 1 addition & 19 deletions drivers/staging/media/hantro/imx8m_vpu_hw.c
Original file line number Diff line number Diff line change
Expand Up @@ -191,24 +191,6 @@ static irqreturn_t imx8m_vpu_g1_irq(int irq, void *dev_id)
return IRQ_HANDLED;
}

static irqreturn_t imx8m_vpu_g2_irq(int irq, void *dev_id)
{
struct hantro_dev *vpu = dev_id;
enum vb2_buffer_state state;
u32 status;

status = vdpu_read(vpu, G2_REG_INTERRUPT);
state = (status & G2_REG_INTERRUPT_DEC_RDY_INT) ?
VB2_BUF_STATE_DONE : VB2_BUF_STATE_ERROR;

vdpu_write(vpu, 0, G2_REG_INTERRUPT);
vdpu_write(vpu, G2_REG_CONFIG_DEC_CLK_GATE_E, G2_REG_CONFIG);

hantro_irq_done(vpu, state);

return IRQ_HANDLED;
}

static int imx8mq_vpu_hw_init(struct hantro_dev *vpu)
{
vpu->ctrl_base = vpu->reg_bases[vpu->variant->num_regs - 1];
Expand Down Expand Up @@ -280,7 +262,7 @@ static const struct hantro_irq imx8mq_irqs[] = {
};

static const struct hantro_irq imx8mq_g2_irqs[] = {
{ "g2", imx8m_vpu_g2_irq },
{ "g2", hantro_g2_irq },
};

static const char * const imx8mq_clk_names[] = { "g1", "g2", "bus" };
Expand Down

0 comments on commit 3385c51

Please sign in to comment.