Path: blob/master/include/media/davinci/vpfe_capture.h
10818 views
/*1* Copyright (C) 2008-2009 Texas Instruments Inc2*3* This program is free software; you can redistribute it and/or modify4* it under the terms of the GNU General Public License as published by5* the Free Software Foundation; either version 2 of the License, or6* (at your option) any later version.7*8* This program is distributed in the hope that it will be useful,9* but WITHOUT ANY WARRANTY; without even the implied warranty of10* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the11* GNU General Public License for more details.12*13* You should have received a copy of the GNU General Public License14* along with this program; if not, write to the Free Software15* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA16*/1718#ifndef _VPFE_CAPTURE_H19#define _VPFE_CAPTURE_H2021#ifdef __KERNEL__2223/* Header files */24#include <media/v4l2-dev.h>25#include <linux/videodev2.h>26#include <linux/clk.h>27#include <linux/i2c.h>28#include <media/v4l2-ioctl.h>29#include <media/v4l2-device.h>30#include <media/videobuf-dma-contig.h>31#include <media/davinci/vpfe_types.h>3233#define VPFE_CAPTURE_NUM_DECODERS 53435/* Macros */36#define VPFE_MAJOR_RELEASE 037#define VPFE_MINOR_RELEASE 038#define VPFE_BUILD 139#define VPFE_CAPTURE_VERSION_CODE ((VPFE_MAJOR_RELEASE << 16) | \40(VPFE_MINOR_RELEASE << 8) | \41VPFE_BUILD)4243#define CAPTURE_DRV_NAME "vpfe-capture"4445struct vpfe_pixel_format {46struct v4l2_fmtdesc fmtdesc;47/* bytes per pixel */48int bpp;49};5051struct vpfe_std_info {52int active_pixels;53int active_lines;54/* current frame format */55int frame_format;56};5758struct vpfe_route {59u32 input;60u32 output;61};6263struct vpfe_subdev_info {64/* Sub device name */65char name[32];66/* Sub device group id */67int grp_id;68/* Number of inputs supported */69int num_inputs;70/* inputs available at the sub device */71struct v4l2_input *inputs;72/* Sub dev routing information for each input */73struct vpfe_route *routes;74/* check if sub dev supports routing */75int can_route;76/* ccdc bus/interface configuration */77struct vpfe_hw_if_param ccdc_if_params;78/* i2c subdevice board info */79struct i2c_board_info board_info;80};8182struct vpfe_config {83/* Number of sub devices connected to vpfe */84int num_subdevs;85/* i2c bus adapter no */86int i2c_adapter_id;87/* information about each subdev */88struct vpfe_subdev_info *sub_devs;89/* evm card info */90char *card_name;91/* ccdc name */92char *ccdc;93/* vpfe clock */94struct clk *vpssclk;95struct clk *slaveclk;96/* Function for Clearing the interrupt */97void (*clr_intr)(int vdint);98};99100struct vpfe_device {101/* V4l2 specific parameters */102/* Identifies video device for this channel */103struct video_device *video_dev;104/* sub devices */105struct v4l2_subdev **sd;106/* vpfe cfg */107struct vpfe_config *cfg;108/* V4l2 device */109struct v4l2_device v4l2_dev;110/* parent device */111struct device *pdev;112/* Used to keep track of state of the priority */113struct v4l2_prio_state prio;114/* number of open instances of the channel */115u32 usrs;116/* Indicates id of the field which is being displayed */117u32 field_id;118/* flag to indicate whether decoder is initialized */119u8 initialized;120/* current interface type */121struct vpfe_hw_if_param vpfe_if_params;122/* ptr to currently selected sub device */123struct vpfe_subdev_info *current_subdev;124/* current input at the sub device */125int current_input;126/* Keeps track of the information about the standard */127struct vpfe_std_info std_info;128/* std index into std table */129int std_index;130/* CCDC IRQs used when CCDC/ISIF output to SDRAM */131unsigned int ccdc_irq0;132unsigned int ccdc_irq1;133/* number of buffers in fbuffers */134u32 numbuffers;135/* List of buffer pointers for storing frames */136u8 *fbuffers[VIDEO_MAX_FRAME];137/* Pointer pointing to current v4l2_buffer */138struct videobuf_buffer *cur_frm;139/* Pointer pointing to next v4l2_buffer */140struct videobuf_buffer *next_frm;141/*142* This field keeps track of type of buffer exchange mechanism143* user has selected144*/145enum v4l2_memory memory;146/* Used to store pixel format */147struct v4l2_format fmt;148/*149* used when IMP is chained to store the crop window which150* is different from the image window151*/152struct v4l2_rect crop;153/* Buffer queue used in video-buf */154struct videobuf_queue buffer_queue;155/* Queue of filled frames */156struct list_head dma_queue;157/* Used in video-buf */158spinlock_t irqlock;159/* IRQ lock for DMA queue */160spinlock_t dma_queue_lock;161/* lock used to access this structure */162struct mutex lock;163/* number of users performing IO */164u32 io_usrs;165/* Indicates whether streaming started */166u8 started;167/*168* offset where second field starts from the starting of the169* buffer for field separated YCbCr formats170*/171u32 field_off;172};173174/* File handle structure */175struct vpfe_fh {176struct vpfe_device *vpfe_dev;177/* Indicates whether this file handle is doing IO */178u8 io_allowed;179/* Used to keep track priority of this instance */180enum v4l2_priority prio;181};182183struct vpfe_config_params {184u8 min_numbuffers;185u8 numbuffers;186u32 min_bufsize;187u32 device_bufsize;188};189190#endif /* End of __KERNEL__ */191/**192* VPFE_CMD_S_CCDC_RAW_PARAMS - EXPERIMENTAL IOCTL to set raw capture params193* This can be used to configure modules such as defect pixel correction,194* color space conversion, culling etc. This is an experimental ioctl that195* will change in future kernels. So use this ioctl with care !196* TODO: This is to be split into multiple ioctls and also explore the197* possibility of extending the v4l2 api to include this198**/199#define VPFE_CMD_S_CCDC_RAW_PARAMS _IOW('V', BASE_VIDIOC_PRIVATE + 1, \200void *)201#endif /* _DAVINCI_VPFE_H */202203204