Commit fc96d58c authored by Sergio Aguirre's avatar Sergio Aguirre Committed by Mauro Carvalho Chehab
Browse files

[media] v4l: omap4iss: Add support for OMAP4 camera interface - Video devices

This adds a very simplistic driver to utilize the CSI2A interface inside
the ISS subsystem in OMAP4, and dump the data to memory.
Check Documentation/video4linux/omap4_camera.txt for details.
This commit adds video devices support.
Signed-off-by: default avatarSergio Aguirre <>
Signed-off-by: default avatarLaurent Pinchart <>
Acked-by: default avatarHans Verkuil <>
Signed-off-by: default avatarMauro Carvalho Chehab <>
parent 59f0ad80
This diff is collapsed.
* TI OMAP4 ISS V4L2 Driver - Generic video node
* Copyright (C) 2012 Texas Instruments, Inc.
* Author: Sergio Aguirre <>
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
#include <linux/v4l2-mediabus.h>
#include <media/media-entity.h>
#include <media/v4l2-dev.h>
#include <media/v4l2-fh.h>
#include <media/videobuf2-core.h>
#include <media/videobuf2-dma-contig.h>
#define ISS_VIDEO_DRIVER_NAME "issvideo"
struct iss_device;
struct iss_video;
struct v4l2_mbus_framefmt;
struct v4l2_pix_format;
* struct iss_format_info - ISS media bus format information
* @code: V4L2 media bus format code
* @truncated: V4L2 media bus format code for the same format truncated to 10
* bits. Identical to @code if the format is 10 bits wide or less.
* @uncompressed: V4L2 media bus format code for the corresponding uncompressed
* format. Identical to @code if the format is not DPCM compressed.
* @flavor: V4L2 media bus format code for the same pixel layout but
* shifted to be 8 bits per pixel. =0 if format is not shiftable.
* @pixelformat: V4L2 pixel format FCC identifier
* @bpp: Bits per pixel
struct iss_format_info {
enum v4l2_mbus_pixelcode code;
enum v4l2_mbus_pixelcode truncated;
enum v4l2_mbus_pixelcode uncompressed;
enum v4l2_mbus_pixelcode flavor;
u32 pixelformat;
unsigned int bpp;
enum iss_pipeline_stream_state {
enum iss_pipeline_state {
/* The stream has been started on the input video node. */
/* The stream has been started on the output video node. */
/* At least one buffer is queued on the input video node. */
/* At least one buffer is queued on the output video node. */
/* The input entity is idle, ready to be started. */
/* The output entity is idle, ready to be started. */
/* The pipeline is currently streaming. */
* struct iss_pipeline - An OMAP4 ISS hardware pipeline
* @error: A hardware error occurred during capture
struct iss_pipeline {
struct media_pipeline pipe;
spinlock_t lock; /* Pipeline state and queue flags */
unsigned int state;
enum iss_pipeline_stream_state stream_state;
struct iss_video *input;
struct iss_video *output;
atomic_t frame_number;
bool do_propagation; /* of frame number */
bool error;
struct v4l2_fract max_timeperframe;
struct v4l2_subdev *external;
unsigned int external_rate;
int external_bpp;
#define to_iss_pipeline(__e) \
container_of((__e)->pipe, struct iss_pipeline, pipe)
static inline int iss_pipeline_ready(struct iss_pipeline *pipe)
return pipe->state == (ISS_PIPELINE_STREAM_INPUT |
* struct iss_buffer - ISS buffer
* @buffer: ISS video buffer
* @iss_addr: Physical address of the buffer.
struct iss_buffer {
/* common v4l buffer stuff -- must be first */
struct vb2_buffer vb;
struct list_head list;
dma_addr_t iss_addr;
#define to_iss_buffer(buf) container_of(buf, struct iss_buffer, buffer)
enum iss_video_dmaqueue_flags {
/* Set if DMA queue becomes empty when ISS_PIPELINE_STREAM_CONTINUOUS */
/* Set when queuing buffer to an empty DMA queue */
#define iss_video_dmaqueue_flags_clr(video) \
({ (video)->dmaqueue_flags = 0; })
* struct iss_video_operations - ISS video operations
* @queue: Resume streaming when a buffer is queued. Called on VIDIOC_QBUF
* if there was no buffer previously queued.
struct iss_video_operations {
int(*queue)(struct iss_video *video, struct iss_buffer *buffer);
struct iss_video {
struct video_device video;
enum v4l2_buf_type type;
struct media_pad pad;
struct mutex mutex; /* format and crop settings */
atomic_t active;
struct iss_device *iss;
unsigned int capture_mem;
unsigned int bpl_alignment; /* alignment value */
unsigned int bpl_zero_padding; /* whether the alignment is optional */
unsigned int bpl_max; /* maximum bytes per line value */
unsigned int bpl_value; /* bytes per line value */
unsigned int bpl_padding; /* padding at end of line */
/* Entity video node streaming */
unsigned int streaming:1;
/* Pipeline state */
struct iss_pipeline pipe;
struct mutex stream_lock; /* pipeline and stream states */
/* Video buffers queue */
struct vb2_queue *queue;
spinlock_t qlock; /* Spinlock for dmaqueue */
struct list_head dmaqueue;
enum iss_video_dmaqueue_flags dmaqueue_flags;
struct vb2_alloc_ctx *alloc_ctx;
const struct iss_video_operations *ops;
#define to_iss_video(vdev) container_of(vdev, struct iss_video, video)
struct iss_video_fh {
struct v4l2_fh vfh;
struct iss_video *video;
struct vb2_queue queue;
struct v4l2_format format;
struct v4l2_fract timeperframe;
#define to_iss_video_fh(fh) container_of(fh, struct iss_video_fh, vfh)
#define iss_video_queue_to_iss_video_fh(q) \
container_of(q, struct iss_video_fh, queue)
int omap4iss_video_init(struct iss_video *video, const char *name);
void omap4iss_video_cleanup(struct iss_video *video);
int omap4iss_video_register(struct iss_video *video,
struct v4l2_device *vdev);
void omap4iss_video_unregister(struct iss_video *video);
struct iss_buffer *omap4iss_video_buffer_next(struct iss_video *video);
struct media_pad *omap4iss_video_remote_pad(struct iss_video *video);
const struct iss_format_info *
omap4iss_video_format_info(enum v4l2_mbus_pixelcode code);
#endif /* OMAP4_ISS_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