Skip to content

Commit f9c7b7d

Browse files
cazouHans Verkuil
authored andcommitted
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>
1 parent e5640db commit f9c7b7d

2 files changed

Lines changed: 23 additions & 3 deletions

File tree

drivers/media/platform/rockchip/rkvdec/rkvdec.c

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1222,10 +1222,9 @@ static void rkvdec_iommu_restore(struct rkvdec_dev *rkvdec)
12221222
}
12231223
}
12241224

1225-
static irqreturn_t rkvdec_irq_handler(int irq, void *priv)
1225+
static irqreturn_t rk3399_irq_handler(struct rkvdec_ctx *ctx)
12261226
{
1227-
struct rkvdec_dev *rkvdec = priv;
1228-
struct rkvdec_ctx *ctx = v4l2_m2m_get_curr_priv(rkvdec->m2m_dev);
1227+
struct rkvdec_dev *rkvdec = ctx->dev;
12291228
enum vb2_buffer_state state;
12301229
u32 status;
12311230

@@ -1246,6 +1245,15 @@ static irqreturn_t rkvdec_irq_handler(int irq, void *priv)
12461245
return IRQ_HANDLED;
12471246
}
12481247

1248+
static irqreturn_t rkvdec_irq_handler(int irq, void *priv)
1249+
{
1250+
struct rkvdec_dev *rkvdec = priv;
1251+
struct rkvdec_ctx *ctx = v4l2_m2m_get_curr_priv(rkvdec->m2m_dev);
1252+
const struct rkvdec_variant *variant = rkvdec->variant;
1253+
1254+
return variant->ops->irq_handler(ctx);
1255+
}
1256+
12491257
static void rkvdec_watchdog_func(struct work_struct *work)
12501258
{
12511259
struct rkvdec_dev *rkvdec;
@@ -1261,23 +1269,30 @@ static void rkvdec_watchdog_func(struct work_struct *work)
12611269
}
12621270
}
12631271

1272+
static const struct rkvdec_variant_ops rk3399_variant_ops = {
1273+
.irq_handler = rk3399_irq_handler,
1274+
};
1275+
12641276
static const struct rkvdec_variant rk3288_rkvdec_variant = {
12651277
.num_regs = 68,
12661278
.coded_fmts = rk3288_coded_fmts,
12671279
.num_coded_fmts = ARRAY_SIZE(rk3288_coded_fmts),
1280+
.ops = &rk3399_variant_ops,
12681281
};
12691282

12701283
static const struct rkvdec_variant rk3328_rkvdec_variant = {
12711284
.num_regs = 109,
12721285
.coded_fmts = rkvdec_coded_fmts,
12731286
.num_coded_fmts = ARRAY_SIZE(rkvdec_coded_fmts),
1287+
.ops = &rk3399_variant_ops,
12741288
.quirks = RKVDEC_QUIRK_DISABLE_QOS,
12751289
};
12761290

12771291
static const struct rkvdec_variant rk3399_rkvdec_variant = {
12781292
.num_regs = 78,
12791293
.coded_fmts = rkvdec_coded_fmts,
12801294
.num_coded_fmts = ARRAY_SIZE(rkvdec_coded_fmts),
1295+
.ops = &rk3399_variant_ops,
12811296
};
12821297

12831298
static const struct of_device_id of_rkvdec_match[] = {

drivers/media/platform/rockchip/rkvdec/rkvdec.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,12 +67,17 @@ vb2_to_rkvdec_decoded_buf(struct vb2_buffer *buf)
6767
base.vb.vb2_buf);
6868
}
6969

70+
struct rkvdec_variant_ops {
71+
irqreturn_t (*irq_handler)(struct rkvdec_ctx *ctx);
72+
};
73+
7074
struct rkvdec_variant {
7175
unsigned int num_regs;
7276
const struct rkvdec_coded_fmt_desc *coded_fmts;
7377
size_t num_coded_fmts;
7478
const struct rcb_size_info *rcb_sizes;
7579
size_t num_rcb_sizes;
80+
const struct rkvdec_variant_ops *ops;
7681
unsigned int quirks;
7782
};
7883

0 commit comments

Comments
 (0)