media: ti-vpe: cal: support 8 DMA contexts
The current driver only ever needs 2 DMA contexts (one per PHY), but we need to use more of the 8 contexts to add support for multiple streams. Change the code so that we allocate DMA contexts as needed, which at this time is 1 per PHY, but could be up to 8. Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
This commit is contained in:
parent
2e7e09a902
commit
75e7e58bfa
2 changed files with 14 additions and 22 deletions
|
@ -658,7 +658,7 @@ static irqreturn_t cal_irq(int irq_cal, void *data)
|
||||||
/* Clear Interrupt status */
|
/* Clear Interrupt status */
|
||||||
cal_write(cal, CAL_HL_IRQSTATUS(1), status);
|
cal_write(cal, CAL_HL_IRQSTATUS(1), status);
|
||||||
|
|
||||||
for (i = 0; i < ARRAY_SIZE(cal->ctx); ++i) {
|
for (i = 0; i < cal->num_contexts; ++i) {
|
||||||
if (status & CAL_HL_IRQ_WDMA_END_MASK(i))
|
if (status & CAL_HL_IRQ_WDMA_END_MASK(i))
|
||||||
cal_irq_wdma_end(cal->ctx[i]);
|
cal_irq_wdma_end(cal->ctx[i]);
|
||||||
}
|
}
|
||||||
|
@ -672,7 +672,7 @@ static irqreturn_t cal_irq(int irq_cal, void *data)
|
||||||
/* Clear Interrupt status */
|
/* Clear Interrupt status */
|
||||||
cal_write(cal, CAL_HL_IRQSTATUS(2), status);
|
cal_write(cal, CAL_HL_IRQSTATUS(2), status);
|
||||||
|
|
||||||
for (i = 0; i < ARRAY_SIZE(cal->ctx); ++i) {
|
for (i = 0; i < cal->num_contexts; ++i) {
|
||||||
if (status & CAL_HL_IRQ_WDMA_START_MASK(i))
|
if (status & CAL_HL_IRQ_WDMA_START_MASK(i))
|
||||||
cal_irq_wdma_start(cal->ctx[i]);
|
cal_irq_wdma_start(cal->ctx[i]);
|
||||||
}
|
}
|
||||||
|
@ -742,10 +742,7 @@ static int cal_async_notifier_complete(struct v4l2_async_notifier *notifier)
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
for (i = 0; i < ARRAY_SIZE(cal->ctx); ++i) {
|
for (i = 0; i < cal->num_contexts; ++i) {
|
||||||
if (!cal->ctx[i])
|
|
||||||
continue;
|
|
||||||
|
|
||||||
ret = cal_ctx_v4l2_register(cal->ctx[i]);
|
ret = cal_ctx_v4l2_register(cal->ctx[i]);
|
||||||
if (ret)
|
if (ret)
|
||||||
goto err_ctx_unreg;
|
goto err_ctx_unreg;
|
||||||
|
@ -865,10 +862,8 @@ static void cal_media_unregister(struct cal_dev *cal)
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
|
|
||||||
/* Unregister all the V4L2 video devices. */
|
/* Unregister all the V4L2 video devices. */
|
||||||
for (i = 0; i < ARRAY_SIZE(cal->ctx); i++) {
|
for (i = 0; i < cal->num_contexts; i++)
|
||||||
if (cal->ctx[i])
|
|
||||||
cal_ctx_v4l2_unregister(cal->ctx[i]);
|
cal_ctx_v4l2_unregister(cal->ctx[i]);
|
||||||
}
|
|
||||||
|
|
||||||
cal_async_notifier_unregister(cal);
|
cal_async_notifier_unregister(cal);
|
||||||
media_device_unregister(&cal->mdev);
|
media_device_unregister(&cal->mdev);
|
||||||
|
@ -915,10 +910,8 @@ static void cal_media_cleanup(struct cal_dev *cal)
|
||||||
{
|
{
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
|
|
||||||
for (i = 0; i < ARRAY_SIZE(cal->ctx); i++) {
|
for (i = 0; i < cal->num_contexts; i++)
|
||||||
if (cal->ctx[i])
|
|
||||||
cal_ctx_v4l2_cleanup(cal->ctx[i]);
|
cal_ctx_v4l2_cleanup(cal->ctx[i]);
|
||||||
}
|
|
||||||
|
|
||||||
v4l2_device_unregister(&cal->v4l2_dev);
|
v4l2_device_unregister(&cal->v4l2_dev);
|
||||||
media_device_cleanup(&cal->mdev);
|
media_device_cleanup(&cal->mdev);
|
||||||
|
@ -1067,7 +1060,6 @@ static int cal_init_camerarx_regmap(struct cal_dev *cal)
|
||||||
static int cal_probe(struct platform_device *pdev)
|
static int cal_probe(struct platform_device *pdev)
|
||||||
{
|
{
|
||||||
struct cal_dev *cal;
|
struct cal_dev *cal;
|
||||||
struct cal_ctx *ctx;
|
|
||||||
bool connected = false;
|
bool connected = false;
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
int ret;
|
int ret;
|
||||||
|
@ -1157,6 +1149,8 @@ static int cal_probe(struct platform_device *pdev)
|
||||||
ret = -ENODEV;
|
ret = -ENODEV;
|
||||||
goto error_context;
|
goto error_context;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
cal->num_contexts++;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Register the media device. */
|
/* Register the media device. */
|
||||||
|
@ -1167,11 +1161,8 @@ static int cal_probe(struct platform_device *pdev)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
error_context:
|
error_context:
|
||||||
for (i = 0; i < ARRAY_SIZE(cal->ctx); i++) {
|
for (i = 0; i < cal->num_contexts; i++)
|
||||||
ctx = cal->ctx[i];
|
cal_ctx_v4l2_cleanup(cal->ctx[i]);
|
||||||
if (ctx)
|
|
||||||
cal_ctx_v4l2_cleanup(ctx);
|
|
||||||
}
|
|
||||||
|
|
||||||
error_camerarx:
|
error_camerarx:
|
||||||
for (i = 0; i < cal->data->num_csi2_phy; i++)
|
for (i = 0; i < cal->data->num_csi2_phy; i++)
|
||||||
|
|
|
@ -29,7 +29,7 @@
|
||||||
#include <media/videobuf2-v4l2.h>
|
#include <media/videobuf2-v4l2.h>
|
||||||
|
|
||||||
#define CAL_MODULE_NAME "cal"
|
#define CAL_MODULE_NAME "cal"
|
||||||
#define CAL_NUM_CONTEXT 2
|
#define CAL_MAX_NUM_CONTEXT 8
|
||||||
#define CAL_NUM_CSI2_PORTS 2
|
#define CAL_NUM_CSI2_PORTS 2
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -182,7 +182,8 @@ struct cal_dev {
|
||||||
/* Camera Core Module handle */
|
/* Camera Core Module handle */
|
||||||
struct cal_camerarx *phy[CAL_NUM_CSI2_PORTS];
|
struct cal_camerarx *phy[CAL_NUM_CSI2_PORTS];
|
||||||
|
|
||||||
struct cal_ctx *ctx[CAL_NUM_CONTEXT];
|
u32 num_contexts;
|
||||||
|
struct cal_ctx *ctx[CAL_MAX_NUM_CONTEXT];
|
||||||
|
|
||||||
struct media_device mdev;
|
struct media_device mdev;
|
||||||
struct v4l2_device v4l2_dev;
|
struct v4l2_device v4l2_dev;
|
||||||
|
|
Loading…
Add table
Reference in a new issue