Commit 92cc5158 authored by Paul Kocialkowski's avatar Paul Kocialkowski Committed by Mauro Carvalho Chehab

media: sun6i-csi: Pass and store csi device directly in video code

The video structure is part of the main csi device structure, so pass
pointers to that top-level structure directly. This makes it easier to
navigate and access other elements. No functional change intended.
Signed-off-by: default avatarPaul Kocialkowski <paul.kocialkowski@bootlin.com>
Reviewed-by: default avatarMaxime Ripard <maxime@cerno.tech>
Signed-off-by: default avatarHans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@kernel.org>
parent ab2e8d5d
...@@ -706,7 +706,7 @@ static int sun6i_csi_v4l2_setup(struct sun6i_csi_device *csi_dev) ...@@ -706,7 +706,7 @@ static int sun6i_csi_v4l2_setup(struct sun6i_csi_device *csi_dev)
/* Video */ /* Video */
ret = sun6i_video_setup(&csi_dev->video, csi_dev); ret = sun6i_video_setup(csi_dev);
if (ret) if (ret)
goto error_v4l2_device; goto error_v4l2_device;
...@@ -735,7 +735,7 @@ static int sun6i_csi_v4l2_setup(struct sun6i_csi_device *csi_dev) ...@@ -735,7 +735,7 @@ static int sun6i_csi_v4l2_setup(struct sun6i_csi_device *csi_dev)
v4l2_async_nf_cleanup(notifier); v4l2_async_nf_cleanup(notifier);
error_video: error_video:
sun6i_video_cleanup(&csi_dev->video); sun6i_video_cleanup(csi_dev);
error_v4l2_device: error_v4l2_device:
v4l2_device_unregister(&v4l2->v4l2_dev); v4l2_device_unregister(&v4l2->v4l2_dev);
...@@ -756,7 +756,7 @@ static void sun6i_csi_v4l2_cleanup(struct sun6i_csi_device *csi_dev) ...@@ -756,7 +756,7 @@ static void sun6i_csi_v4l2_cleanup(struct sun6i_csi_device *csi_dev)
media_device_unregister(&v4l2->media_dev); media_device_unregister(&v4l2->media_dev);
v4l2_async_nf_unregister(&v4l2->notifier); v4l2_async_nf_unregister(&v4l2->notifier);
v4l2_async_nf_cleanup(&v4l2->notifier); v4l2_async_nf_cleanup(&v4l2->notifier);
sun6i_video_cleanup(&csi_dev->video); sun6i_video_cleanup(csi_dev);
v4l2_device_unregister(&v4l2->v4l2_dev); v4l2_device_unregister(&v4l2->v4l2_dev);
v4l2_ctrl_handler_free(&v4l2->ctrl_handler); v4l2_ctrl_handler_free(&v4l2->ctrl_handler);
media_device_cleanup(&v4l2->media_dev); media_device_cleanup(&v4l2->media_dev);
...@@ -787,7 +787,7 @@ static irqreturn_t sun6i_csi_interrupt(int irq, void *private) ...@@ -787,7 +787,7 @@ static irqreturn_t sun6i_csi_interrupt(int irq, void *private)
} }
if (status & CSI_CH_INT_STA_FD_PD) if (status & CSI_CH_INT_STA_FD_PD)
sun6i_video_frame_done(&csi_dev->video); sun6i_video_frame_done(csi_dev);
regmap_write(regmap, CSI_CH_INT_STA_REG, status); regmap_write(regmap, CSI_CH_INT_STA_REG, status);
......
...@@ -100,7 +100,8 @@ static int sun6i_video_queue_setup(struct vb2_queue *queue, ...@@ -100,7 +100,8 @@ static int sun6i_video_queue_setup(struct vb2_queue *queue,
unsigned int sizes[], unsigned int sizes[],
struct device *alloc_devs[]) struct device *alloc_devs[])
{ {
struct sun6i_video *video = vb2_get_drv_priv(queue); struct sun6i_csi_device *csi_dev = vb2_get_drv_priv(queue);
struct sun6i_video *video = &csi_dev->video;
unsigned int size = video->format.fmt.pix.sizeimage; unsigned int size = video->format.fmt.pix.sizeimage;
if (*planes_count) if (*planes_count)
...@@ -114,8 +115,8 @@ static int sun6i_video_queue_setup(struct vb2_queue *queue, ...@@ -114,8 +115,8 @@ static int sun6i_video_queue_setup(struct vb2_queue *queue,
static int sun6i_video_buffer_prepare(struct vb2_buffer *buffer) static int sun6i_video_buffer_prepare(struct vb2_buffer *buffer)
{ {
struct sun6i_video *video = vb2_get_drv_priv(buffer->vb2_queue); struct sun6i_csi_device *csi_dev = vb2_get_drv_priv(buffer->vb2_queue);
struct sun6i_csi_device *csi_dev = video->csi_dev; struct sun6i_video *video = &csi_dev->video;
struct v4l2_device *v4l2_dev = &csi_dev->v4l2.v4l2_dev; struct v4l2_device *v4l2_dev = &csi_dev->v4l2.v4l2_dev;
struct vb2_v4l2_buffer *v4l2_buffer = to_vb2_v4l2_buffer(buffer); struct vb2_v4l2_buffer *v4l2_buffer = to_vb2_v4l2_buffer(buffer);
struct sun6i_csi_buffer *csi_buffer = struct sun6i_csi_buffer *csi_buffer =
...@@ -138,7 +139,8 @@ static int sun6i_video_buffer_prepare(struct vb2_buffer *buffer) ...@@ -138,7 +139,8 @@ static int sun6i_video_buffer_prepare(struct vb2_buffer *buffer)
static void sun6i_video_buffer_queue(struct vb2_buffer *buffer) static void sun6i_video_buffer_queue(struct vb2_buffer *buffer)
{ {
struct sun6i_video *video = vb2_get_drv_priv(buffer->vb2_queue); struct sun6i_csi_device *csi_dev = vb2_get_drv_priv(buffer->vb2_queue);
struct sun6i_video *video = &csi_dev->video;
struct vb2_v4l2_buffer *v4l2_buffer = to_vb2_v4l2_buffer(buffer); struct vb2_v4l2_buffer *v4l2_buffer = to_vb2_v4l2_buffer(buffer);
struct sun6i_csi_buffer *csi_buffer = struct sun6i_csi_buffer *csi_buffer =
container_of(v4l2_buffer, struct sun6i_csi_buffer, v4l2_buffer); container_of(v4l2_buffer, struct sun6i_csi_buffer, v4l2_buffer);
...@@ -153,7 +155,8 @@ static void sun6i_video_buffer_queue(struct vb2_buffer *buffer) ...@@ -153,7 +155,8 @@ static void sun6i_video_buffer_queue(struct vb2_buffer *buffer)
static int sun6i_video_start_streaming(struct vb2_queue *queue, static int sun6i_video_start_streaming(struct vb2_queue *queue,
unsigned int count) unsigned int count)
{ {
struct sun6i_video *video = vb2_get_drv_priv(queue); struct sun6i_csi_device *csi_dev = vb2_get_drv_priv(queue);
struct sun6i_video *video = &csi_dev->video;
struct video_device *video_dev = &video->video_dev; struct video_device *video_dev = &video->video_dev;
struct sun6i_csi_buffer *buf; struct sun6i_csi_buffer *buf;
struct sun6i_csi_buffer *next_buf; struct sun6i_csi_buffer *next_buf;
...@@ -185,7 +188,7 @@ static int sun6i_video_start_streaming(struct vb2_queue *queue, ...@@ -185,7 +188,7 @@ static int sun6i_video_start_streaming(struct vb2_queue *queue,
config.width = video->format.fmt.pix.width; config.width = video->format.fmt.pix.width;
config.height = video->format.fmt.pix.height; config.height = video->format.fmt.pix.height;
ret = sun6i_csi_update_config(video->csi_dev, &config); ret = sun6i_csi_update_config(csi_dev, &config);
if (ret < 0) if (ret < 0)
goto error_media_pipeline; goto error_media_pipeline;
...@@ -194,9 +197,9 @@ static int sun6i_video_start_streaming(struct vb2_queue *queue, ...@@ -194,9 +197,9 @@ static int sun6i_video_start_streaming(struct vb2_queue *queue,
buf = list_first_entry(&video->dma_queue, buf = list_first_entry(&video->dma_queue,
struct sun6i_csi_buffer, list); struct sun6i_csi_buffer, list);
buf->queued_to_csi = true; buf->queued_to_csi = true;
sun6i_csi_update_buf_addr(video->csi_dev, buf->dma_addr); sun6i_csi_update_buf_addr(csi_dev, buf->dma_addr);
sun6i_csi_set_stream(video->csi_dev, true); sun6i_csi_set_stream(csi_dev, true);
/* /*
* CSI will lookup the next dma buffer for next frame before the * CSI will lookup the next dma buffer for next frame before the
...@@ -217,7 +220,7 @@ static int sun6i_video_start_streaming(struct vb2_queue *queue, ...@@ -217,7 +220,7 @@ static int sun6i_video_start_streaming(struct vb2_queue *queue,
*/ */
next_buf = list_next_entry(buf, list); next_buf = list_next_entry(buf, list);
next_buf->queued_to_csi = true; next_buf->queued_to_csi = true;
sun6i_csi_update_buf_addr(video->csi_dev, next_buf->dma_addr); sun6i_csi_update_buf_addr(csi_dev, next_buf->dma_addr);
spin_unlock_irqrestore(&video->dma_queue_lock, flags); spin_unlock_irqrestore(&video->dma_queue_lock, flags);
...@@ -228,7 +231,7 @@ static int sun6i_video_start_streaming(struct vb2_queue *queue, ...@@ -228,7 +231,7 @@ static int sun6i_video_start_streaming(struct vb2_queue *queue,
return 0; return 0;
error_stream: error_stream:
sun6i_csi_set_stream(video->csi_dev, false); sun6i_csi_set_stream(csi_dev, false);
error_media_pipeline: error_media_pipeline:
video_device_pipeline_stop(video_dev); video_device_pipeline_stop(video_dev);
...@@ -246,7 +249,8 @@ static int sun6i_video_start_streaming(struct vb2_queue *queue, ...@@ -246,7 +249,8 @@ static int sun6i_video_start_streaming(struct vb2_queue *queue,
static void sun6i_video_stop_streaming(struct vb2_queue *queue) static void sun6i_video_stop_streaming(struct vb2_queue *queue)
{ {
struct sun6i_video *video = vb2_get_drv_priv(queue); struct sun6i_csi_device *csi_dev = vb2_get_drv_priv(queue);
struct sun6i_video *video = &csi_dev->video;
struct v4l2_subdev *subdev; struct v4l2_subdev *subdev;
unsigned long flags; unsigned long flags;
struct sun6i_csi_buffer *buf; struct sun6i_csi_buffer *buf;
...@@ -255,7 +259,7 @@ static void sun6i_video_stop_streaming(struct vb2_queue *queue) ...@@ -255,7 +259,7 @@ static void sun6i_video_stop_streaming(struct vb2_queue *queue)
if (subdev) if (subdev)
v4l2_subdev_call(subdev, video, s_stream, 0); v4l2_subdev_call(subdev, video, s_stream, 0);
sun6i_csi_set_stream(video->csi_dev, false); sun6i_csi_set_stream(csi_dev, false);
video_device_pipeline_stop(&video->video_dev); video_device_pipeline_stop(&video->video_dev);
...@@ -267,8 +271,9 @@ static void sun6i_video_stop_streaming(struct vb2_queue *queue) ...@@ -267,8 +271,9 @@ static void sun6i_video_stop_streaming(struct vb2_queue *queue)
spin_unlock_irqrestore(&video->dma_queue_lock, flags); spin_unlock_irqrestore(&video->dma_queue_lock, flags);
} }
void sun6i_video_frame_done(struct sun6i_video *video) void sun6i_video_frame_done(struct sun6i_csi_device *csi_dev)
{ {
struct sun6i_video *video = &csi_dev->video;
struct sun6i_csi_buffer *buf; struct sun6i_csi_buffer *buf;
struct sun6i_csi_buffer *next_buf; struct sun6i_csi_buffer *next_buf;
struct vb2_v4l2_buffer *v4l2_buffer; struct vb2_v4l2_buffer *v4l2_buffer;
...@@ -278,7 +283,7 @@ void sun6i_video_frame_done(struct sun6i_video *video) ...@@ -278,7 +283,7 @@ void sun6i_video_frame_done(struct sun6i_video *video)
buf = list_first_entry(&video->dma_queue, buf = list_first_entry(&video->dma_queue,
struct sun6i_csi_buffer, list); struct sun6i_csi_buffer, list);
if (list_is_last(&buf->list, &video->dma_queue)) { if (list_is_last(&buf->list, &video->dma_queue)) {
dev_dbg(video->csi_dev->dev, "Frame dropped!\n"); dev_dbg(csi_dev->dev, "Frame dropped!\n");
goto complete; goto complete;
} }
...@@ -290,8 +295,8 @@ void sun6i_video_frame_done(struct sun6i_video *video) ...@@ -290,8 +295,8 @@ void sun6i_video_frame_done(struct sun6i_video *video)
*/ */
if (!next_buf->queued_to_csi) { if (!next_buf->queued_to_csi) {
next_buf->queued_to_csi = true; next_buf->queued_to_csi = true;
sun6i_csi_update_buf_addr(video->csi_dev, next_buf->dma_addr); sun6i_csi_update_buf_addr(csi_dev, next_buf->dma_addr);
dev_dbg(video->csi_dev->dev, "Frame dropped!\n"); dev_dbg(csi_dev->dev, "Frame dropped!\n");
goto complete; goto complete;
} }
...@@ -305,9 +310,9 @@ void sun6i_video_frame_done(struct sun6i_video *video) ...@@ -305,9 +310,9 @@ void sun6i_video_frame_done(struct sun6i_video *video)
if (!list_is_last(&next_buf->list, &video->dma_queue)) { if (!list_is_last(&next_buf->list, &video->dma_queue)) {
next_buf = list_next_entry(next_buf, list); next_buf = list_next_entry(next_buf, list);
next_buf->queued_to_csi = true; next_buf->queued_to_csi = true;
sun6i_csi_update_buf_addr(video->csi_dev, next_buf->dma_addr); sun6i_csi_update_buf_addr(csi_dev, next_buf->dma_addr);
} else { } else {
dev_dbg(video->csi_dev->dev, "Next frame will be dropped!\n"); dev_dbg(csi_dev->dev, "Next frame will be dropped!\n");
} }
complete: complete:
...@@ -330,9 +335,8 @@ static const struct vb2_ops sun6i_video_queue_ops = { ...@@ -330,9 +335,8 @@ static const struct vb2_ops sun6i_video_queue_ops = {
static int sun6i_video_querycap(struct file *file, void *private, static int sun6i_video_querycap(struct file *file, void *private,
struct v4l2_capability *capability) struct v4l2_capability *capability)
{ {
struct sun6i_video *video = video_drvdata(file); struct sun6i_csi_device *csi_dev = video_drvdata(file);
struct sun6i_csi_device *csi_dev = video->csi_dev; struct video_device *video_dev = &csi_dev->video.video_dev;
struct video_device *video_dev = &video->video_dev;
strscpy(capability->driver, SUN6I_CSI_NAME, sizeof(capability->driver)); strscpy(capability->driver, SUN6I_CSI_NAME, sizeof(capability->driver));
strscpy(capability->card, video_dev->name, sizeof(capability->card)); strscpy(capability->card, video_dev->name, sizeof(capability->card));
...@@ -358,7 +362,8 @@ static int sun6i_video_enum_fmt(struct file *file, void *private, ...@@ -358,7 +362,8 @@ static int sun6i_video_enum_fmt(struct file *file, void *private,
static int sun6i_video_g_fmt(struct file *file, void *private, static int sun6i_video_g_fmt(struct file *file, void *private,
struct v4l2_format *format) struct v4l2_format *format)
{ {
struct sun6i_video *video = video_drvdata(file); struct sun6i_csi_device *csi_dev = video_drvdata(file);
struct sun6i_video *video = &csi_dev->video;
*format = video->format; *format = video->format;
...@@ -413,7 +418,8 @@ static int sun6i_video_format_set(struct sun6i_video *video, ...@@ -413,7 +418,8 @@ static int sun6i_video_format_set(struct sun6i_video *video,
static int sun6i_video_s_fmt(struct file *file, void *private, static int sun6i_video_s_fmt(struct file *file, void *private,
struct v4l2_format *format) struct v4l2_format *format)
{ {
struct sun6i_video *video = video_drvdata(file); struct sun6i_csi_device *csi_dev = video_drvdata(file);
struct sun6i_video *video = &csi_dev->video;
if (vb2_is_busy(&video->queue)) if (vb2_is_busy(&video->queue))
return -EBUSY; return -EBUSY;
...@@ -424,7 +430,8 @@ static int sun6i_video_s_fmt(struct file *file, void *private, ...@@ -424,7 +430,8 @@ static int sun6i_video_s_fmt(struct file *file, void *private,
static int sun6i_video_try_fmt(struct file *file, void *private, static int sun6i_video_try_fmt(struct file *file, void *private,
struct v4l2_format *format) struct v4l2_format *format)
{ {
struct sun6i_video *video = video_drvdata(file); struct sun6i_csi_device *csi_dev = video_drvdata(file);
struct sun6i_video *video = &csi_dev->video;
return sun6i_video_format_try(video, format); return sun6i_video_format_try(video, format);
} }
...@@ -489,7 +496,8 @@ static const struct v4l2_ioctl_ops sun6i_video_ioctl_ops = { ...@@ -489,7 +496,8 @@ static const struct v4l2_ioctl_ops sun6i_video_ioctl_ops = {
static int sun6i_video_open(struct file *file) static int sun6i_video_open(struct file *file)
{ {
struct sun6i_video *video = video_drvdata(file); struct sun6i_csi_device *csi_dev = video_drvdata(file);
struct sun6i_video *video = &csi_dev->video;
int ret = 0; int ret = 0;
if (mutex_lock_interruptible(&video->lock)) if (mutex_lock_interruptible(&video->lock))
...@@ -505,7 +513,7 @@ static int sun6i_video_open(struct file *file) ...@@ -505,7 +513,7 @@ static int sun6i_video_open(struct file *file)
/* Power on at first open. */ /* Power on at first open. */
if (v4l2_fh_is_singular_file(file)) { if (v4l2_fh_is_singular_file(file)) {
ret = sun6i_csi_set_power(video->csi_dev, true); ret = sun6i_csi_set_power(csi_dev, true);
if (ret < 0) if (ret < 0)
goto error_v4l2_fh; goto error_v4l2_fh;
} }
...@@ -525,7 +533,8 @@ static int sun6i_video_open(struct file *file) ...@@ -525,7 +533,8 @@ static int sun6i_video_open(struct file *file)
static int sun6i_video_close(struct file *file) static int sun6i_video_close(struct file *file)
{ {
struct sun6i_video *video = video_drvdata(file); struct sun6i_csi_device *csi_dev = video_drvdata(file);
struct sun6i_video *video = &csi_dev->video;
bool last_close; bool last_close;
mutex_lock(&video->lock); mutex_lock(&video->lock);
...@@ -537,7 +546,7 @@ static int sun6i_video_close(struct file *file) ...@@ -537,7 +546,7 @@ static int sun6i_video_close(struct file *file)
/* Power off at last close. */ /* Power off at last close. */
if (last_close) if (last_close)
sun6i_csi_set_power(video->csi_dev, false); sun6i_csi_set_power(csi_dev, false);
mutex_unlock(&video->lock); mutex_unlock(&video->lock);
...@@ -574,15 +583,16 @@ static int sun6i_video_link_validate(struct media_link *link) ...@@ -574,15 +583,16 @@ static int sun6i_video_link_validate(struct media_link *link)
{ {
struct video_device *vdev = container_of(link->sink->entity, struct video_device *vdev = container_of(link->sink->entity,
struct video_device, entity); struct video_device, entity);
struct sun6i_video *video = video_get_drvdata(vdev); struct sun6i_csi_device *csi_dev = video_get_drvdata(vdev);
struct sun6i_video *video = &csi_dev->video;
struct v4l2_subdev_format source_fmt; struct v4l2_subdev_format source_fmt;
int ret; int ret;
video->mbus_code = 0; video->mbus_code = 0;
if (!media_pad_remote_pad_first(link->sink->entity->pads)) { if (!media_pad_remote_pad_first(link->sink->entity->pads)) {
dev_info(video->csi_dev->dev, dev_info(csi_dev->dev, "video node %s pad not connected\n",
"video node %s pad not connected\n", vdev->name); vdev->name);
return -ENOLINK; return -ENOLINK;
} }
...@@ -590,10 +600,10 @@ static int sun6i_video_link_validate(struct media_link *link) ...@@ -590,10 +600,10 @@ static int sun6i_video_link_validate(struct media_link *link)
if (ret < 0) if (ret < 0)
return ret; return ret;
if (!sun6i_csi_is_format_supported(video->csi_dev, if (!sun6i_csi_is_format_supported(csi_dev,
video->format.fmt.pix.pixelformat, video->format.fmt.pix.pixelformat,
source_fmt.format.code)) { source_fmt.format.code)) {
dev_err(video->csi_dev->dev, dev_err(csi_dev->dev,
"Unsupported pixformat: 0x%x with mbus code: 0x%x!\n", "Unsupported pixformat: 0x%x with mbus code: 0x%x!\n",
video->format.fmt.pix.pixelformat, video->format.fmt.pix.pixelformat,
source_fmt.format.code); source_fmt.format.code);
...@@ -602,7 +612,7 @@ static int sun6i_video_link_validate(struct media_link *link) ...@@ -602,7 +612,7 @@ static int sun6i_video_link_validate(struct media_link *link)
if (source_fmt.format.width != video->format.fmt.pix.width || if (source_fmt.format.width != video->format.fmt.pix.width ||
source_fmt.format.height != video->format.fmt.pix.height) { source_fmt.format.height != video->format.fmt.pix.height) {
dev_err(video->csi_dev->dev, dev_err(csi_dev->dev,
"Wrong width or height %ux%u (%ux%u expected)\n", "Wrong width or height %ux%u (%ux%u expected)\n",
video->format.fmt.pix.width, video->format.fmt.pix.height, video->format.fmt.pix.width, video->format.fmt.pix.height,
source_fmt.format.width, source_fmt.format.height); source_fmt.format.width, source_fmt.format.height);
...@@ -620,9 +630,9 @@ static const struct media_entity_operations sun6i_video_media_ops = { ...@@ -620,9 +630,9 @@ static const struct media_entity_operations sun6i_video_media_ops = {
/* Video */ /* Video */
int sun6i_video_setup(struct sun6i_video *video, int sun6i_video_setup(struct sun6i_csi_device *csi_dev)
struct sun6i_csi_device *csi_dev)
{ {
struct sun6i_video *video = &csi_dev->video;
struct v4l2_device *v4l2_dev = &csi_dev->v4l2.v4l2_dev; struct v4l2_device *v4l2_dev = &csi_dev->v4l2.v4l2_dev;
struct video_device *video_dev = &video->video_dev; struct video_device *video_dev = &video->video_dev;
struct vb2_queue *queue = &video->queue; struct vb2_queue *queue = &video->queue;
...@@ -631,8 +641,6 @@ int sun6i_video_setup(struct sun6i_video *video, ...@@ -631,8 +641,6 @@ int sun6i_video_setup(struct sun6i_video *video,
struct v4l2_pix_format *pix_format = &format.fmt.pix; struct v4l2_pix_format *pix_format = &format.fmt.pix;
int ret; int ret;
video->csi_dev = csi_dev;
/* Media Entity */ /* Media Entity */
video_dev->entity.ops = &sun6i_video_media_ops; video_dev->entity.ops = &sun6i_video_media_ops;
...@@ -664,7 +672,7 @@ int sun6i_video_setup(struct sun6i_video *video, ...@@ -664,7 +672,7 @@ int sun6i_video_setup(struct sun6i_video *video,
queue->timestamp_flags = V4L2_BUF_FLAG_TIMESTAMP_MONOTONIC; queue->timestamp_flags = V4L2_BUF_FLAG_TIMESTAMP_MONOTONIC;
queue->lock = &video->lock; queue->lock = &video->lock;
queue->dev = csi_dev->dev; queue->dev = csi_dev->dev;
queue->drv_priv = video; queue->drv_priv = csi_dev;
/* Make sure non-dropped frame. */ /* Make sure non-dropped frame. */
queue->min_buffers_needed = 3; queue->min_buffers_needed = 3;
...@@ -697,7 +705,7 @@ int sun6i_video_setup(struct sun6i_video *video, ...@@ -697,7 +705,7 @@ int sun6i_video_setup(struct sun6i_video *video,
video_dev->queue = queue; video_dev->queue = queue;
video_dev->lock = &video->lock; video_dev->lock = &video->lock;
video_set_drvdata(video_dev, video); video_set_drvdata(video_dev, csi_dev);
ret = video_register_device(video_dev, VFL_TYPE_VIDEO, -1); ret = video_register_device(video_dev, VFL_TYPE_VIDEO, -1);
if (ret < 0) { if (ret < 0) {
...@@ -716,8 +724,9 @@ int sun6i_video_setup(struct sun6i_video *video, ...@@ -716,8 +724,9 @@ int sun6i_video_setup(struct sun6i_video *video,
return ret; return ret;
} }
void sun6i_video_cleanup(struct sun6i_video *video) void sun6i_video_cleanup(struct sun6i_csi_device *csi_dev)
{ {
struct sun6i_video *video = &csi_dev->video;
struct video_device *video_dev = &video->video_dev; struct video_device *video_dev = &video->video_dev;
vb2_video_unregister_device(video_dev); vb2_video_unregister_device(video_dev);
......
...@@ -14,8 +14,6 @@ ...@@ -14,8 +14,6 @@
struct sun6i_csi_device; struct sun6i_csi_device;
struct sun6i_video { struct sun6i_video {
struct sun6i_csi_device *csi_dev;
struct video_device video_dev; struct video_device video_dev;
struct vb2_queue queue; struct vb2_queue queue;
struct mutex lock; /* Queue lock. */ struct mutex lock; /* Queue lock. */
...@@ -29,10 +27,9 @@ struct sun6i_video { ...@@ -29,10 +27,9 @@ struct sun6i_video {
unsigned int sequence; unsigned int sequence;
}; };
int sun6i_video_setup(struct sun6i_video *video, int sun6i_video_setup(struct sun6i_csi_device *csi_dev);
struct sun6i_csi_device *csi_dev); void sun6i_video_cleanup(struct sun6i_csi_device *csi_dev);
void sun6i_video_cleanup(struct sun6i_video *video);
void sun6i_video_frame_done(struct sun6i_video *video); void sun6i_video_frame_done(struct sun6i_csi_device *csi_dev);
#endif /* __SUN6I_VIDEO_H__ */ #endif /* __SUN6I_VIDEO_H__ */
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment