Commit f9c7b7de authored by Detlev Casanova's avatar Detlev Casanova Committed by Hans Verkuil
Browse files

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: default avatarNicolas Dufresne <nicolas.dufresne@collabora.com>
Signed-off-by: default avatarDetlev Casanova <detlev.casanova@collabora.com>
Signed-off-by: default avatarNicolas Dufresne <nicolas.dufresne@collabora.com>
Signed-off-by: default avatarHans Verkuil <hverkuil+cisco@kernel.org>
parent e5640dbb
Loading
Loading
Loading
Loading
+18 −3
Original line number Diff line number Diff line
@@ -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[] = {
+5 −0
Original line number Diff line number Diff line
@@ -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;
};