Skip to content

Commit 3385c51

Browse files
jernejskmchehab
authored andcommitted
media: hantro: Convert imx8m_vpu_g2_irq to helper
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]>
1 parent 3c5b218 commit 3385c51

File tree

3 files changed

+20
-19
lines changed

3 files changed

+20
-19
lines changed

drivers/staging/media/hantro/hantro_g2.c

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,3 +24,21 @@ void hantro_g2_check_idle(struct hantro_dev *vpu)
2424
}
2525
}
2626
}
27+
28+
irqreturn_t hantro_g2_irq(int irq, void *dev_id)
29+
{
30+
struct hantro_dev *vpu = dev_id;
31+
enum vb2_buffer_state state;
32+
u32 status;
33+
34+
status = vdpu_read(vpu, G2_REG_INTERRUPT);
35+
state = (status & G2_REG_INTERRUPT_DEC_RDY_INT) ?
36+
VB2_BUF_STATE_DONE : VB2_BUF_STATE_ERROR;
37+
38+
vdpu_write(vpu, 0, G2_REG_INTERRUPT);
39+
vdpu_write(vpu, G2_REG_CONFIG_DEC_CLK_GATE_E, G2_REG_CONFIG);
40+
41+
hantro_irq_done(vpu, state);
42+
43+
return IRQ_HANDLED;
44+
}

drivers/staging/media/hantro/hantro_hw.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -425,5 +425,6 @@ void hantro_g2_vp9_dec_done(struct hantro_ctx *ctx);
425425
int hantro_vp9_dec_init(struct hantro_ctx *ctx);
426426
void hantro_vp9_dec_exit(struct hantro_ctx *ctx);
427427
void hantro_g2_check_idle(struct hantro_dev *vpu);
428+
irqreturn_t hantro_g2_irq(int irq, void *dev_id);
428429

429430
#endif /* HANTRO_HW_H_ */

drivers/staging/media/hantro/imx8m_vpu_hw.c

Lines changed: 1 addition & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -191,24 +191,6 @@ static irqreturn_t imx8m_vpu_g1_irq(int irq, void *dev_id)
191191
return IRQ_HANDLED;
192192
}
193193

194-
static irqreturn_t imx8m_vpu_g2_irq(int irq, void *dev_id)
195-
{
196-
struct hantro_dev *vpu = dev_id;
197-
enum vb2_buffer_state state;
198-
u32 status;
199-
200-
status = vdpu_read(vpu, G2_REG_INTERRUPT);
201-
state = (status & G2_REG_INTERRUPT_DEC_RDY_INT) ?
202-
VB2_BUF_STATE_DONE : VB2_BUF_STATE_ERROR;
203-
204-
vdpu_write(vpu, 0, G2_REG_INTERRUPT);
205-
vdpu_write(vpu, G2_REG_CONFIG_DEC_CLK_GATE_E, G2_REG_CONFIG);
206-
207-
hantro_irq_done(vpu, state);
208-
209-
return IRQ_HANDLED;
210-
}
211-
212194
static int imx8mq_vpu_hw_init(struct hantro_dev *vpu)
213195
{
214196
vpu->ctrl_base = vpu->reg_bases[vpu->variant->num_regs - 1];
@@ -280,7 +262,7 @@ static const struct hantro_irq imx8mq_irqs[] = {
280262
};
281263

282264
static const struct hantro_irq imx8mq_g2_irqs[] = {
283-
{ "g2", imx8m_vpu_g2_irq },
265+
{ "g2", hantro_g2_irq },
284266
};
285267

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

0 commit comments

Comments
 (0)