media: rkvdec: Support per-variant interrupt handler

Prepare for supporting different variants with different interrupt
managers.

To support other variants specific function type later, introduce the
rkvdec_variant_ops struct.

Tested-by: Diederik de Haas <didi.debian@cknow.org>  # Rock 5B
Reviewed-by: Nicolas Dufresne <nicolas.dufresne@collabora.com>
Signed-off-by: Detlev Casanova <detlev.casanova@collabora.com>
Signed-off-by: Nicolas Dufresne <nicolas.dufresne@collabora.com>
Signed-off-by: Hans Verkuil <hverkuil+cisco@kernel.org>
This commit is contained in:
Detlev Casanova 2026-01-09 11:15:27 -05:00 committed by Hans Verkuil
parent e5640dbb99
commit f9c7b7deef
2 changed files with 23 additions and 3 deletions

View File

@ -1222,10 +1222,9 @@ static void rkvdec_iommu_restore(struct rkvdec_dev *rkvdec)
}
}
static irqreturn_t rkvdec_irq_handler(int irq, void *priv)
static irqreturn_t rk3399_irq_handler(struct rkvdec_ctx *ctx)
{
struct rkvdec_dev *rkvdec = priv;
struct rkvdec_ctx *ctx = v4l2_m2m_get_curr_priv(rkvdec->m2m_dev);
struct rkvdec_dev *rkvdec = ctx->dev;
enum vb2_buffer_state state;
u32 status;
@ -1246,6 +1245,15 @@ static irqreturn_t rkvdec_irq_handler(int irq, void *priv)
return IRQ_HANDLED;
}
static irqreturn_t rkvdec_irq_handler(int irq, void *priv)
{
struct rkvdec_dev *rkvdec = priv;
struct rkvdec_ctx *ctx = v4l2_m2m_get_curr_priv(rkvdec->m2m_dev);
const struct rkvdec_variant *variant = rkvdec->variant;
return variant->ops->irq_handler(ctx);
}
static void rkvdec_watchdog_func(struct work_struct *work)
{
struct rkvdec_dev *rkvdec;
@ -1261,16 +1269,22 @@ static void rkvdec_watchdog_func(struct work_struct *work)
}
}
static const struct rkvdec_variant_ops rk3399_variant_ops = {
.irq_handler = rk3399_irq_handler,
};
static const struct rkvdec_variant rk3288_rkvdec_variant = {
.num_regs = 68,
.coded_fmts = rk3288_coded_fmts,
.num_coded_fmts = ARRAY_SIZE(rk3288_coded_fmts),
.ops = &rk3399_variant_ops,
};
static const struct rkvdec_variant rk3328_rkvdec_variant = {
.num_regs = 109,
.coded_fmts = rkvdec_coded_fmts,
.num_coded_fmts = ARRAY_SIZE(rkvdec_coded_fmts),
.ops = &rk3399_variant_ops,
.quirks = RKVDEC_QUIRK_DISABLE_QOS,
};
@ -1278,6 +1292,7 @@ static const struct rkvdec_variant rk3399_rkvdec_variant = {
.num_regs = 78,
.coded_fmts = rkvdec_coded_fmts,
.num_coded_fmts = ARRAY_SIZE(rkvdec_coded_fmts),
.ops = &rk3399_variant_ops,
};
static const struct of_device_id of_rkvdec_match[] = {

View File

@ -67,12 +67,17 @@ vb2_to_rkvdec_decoded_buf(struct vb2_buffer *buf)
base.vb.vb2_buf);
}
struct rkvdec_variant_ops {
irqreturn_t (*irq_handler)(struct rkvdec_ctx *ctx);
};
struct rkvdec_variant {
unsigned int num_regs;
const struct rkvdec_coded_fmt_desc *coded_fmts;
size_t num_coded_fmts;
const struct rcb_size_info *rcb_sizes;
size_t num_rcb_sizes;
const struct rkvdec_variant_ops *ops;
unsigned int quirks;
};