Path: blob/master/drivers/media/video/davinci/vpif_display.h
17683 views
/*1* DM646x display header file2*3* Copyright (C) 2009 Texas Instruments Incorporated - http://www.ti.com/4*5* This program is free software; you can redistribute it and/or6* modify it under the terms of the GNU General Public License as7* published by the Free Software Foundation version 2.8*9* This program is distributed .as is. WITHOUT ANY WARRANTY of any10* kind, whether express or implied; without even the implied warranty11* of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the12* GNU General Public License for more details.13*/1415#ifndef DAVINCIHD_DISPLAY_H16#define DAVINCIHD_DISPLAY_H1718/* Header files */19#include <linux/videodev2.h>20#include <linux/version.h>21#include <media/v4l2-common.h>22#include <media/v4l2-device.h>23#include <media/videobuf-core.h>24#include <media/videobuf-dma-contig.h>2526#include "vpif.h"2728/* Macros */29#define VPIF_MAJOR_RELEASE (0)30#define VPIF_MINOR_RELEASE (0)31#define VPIF_BUILD (1)3233#define VPIF_DISPLAY_VERSION_CODE \34((VPIF_MAJOR_RELEASE << 16) | (VPIF_MINOR_RELEASE << 8) | VPIF_BUILD)3536#define VPIF_VALID_FIELD(field) \37(((V4L2_FIELD_ANY == field) || (V4L2_FIELD_NONE == field)) || \38(((V4L2_FIELD_INTERLACED == field) || (V4L2_FIELD_SEQ_TB == field)) || \39(V4L2_FIELD_SEQ_BT == field)))4041#define VPIF_DISPLAY_MAX_DEVICES (2)42#define VPIF_SLICED_BUF_SIZE (256)43#define VPIF_SLICED_MAX_SERVICES (3)44#define VPIF_VIDEO_INDEX (0)45#define VPIF_VBI_INDEX (1)46#define VPIF_HBI_INDEX (2)4748/* Setting it to 1 as HBI/VBI support yet to be added , else 3*/49#define VPIF_NUMOBJECTS (1)5051/* Macros */52#define ISALIGNED(a) (0 == ((a) & 7))5354/* enumerated data types */55/* Enumerated data type to give id to each device per channel */56enum vpif_channel_id {57VPIF_CHANNEL2_VIDEO = 0, /* Channel2 Video */58VPIF_CHANNEL3_VIDEO, /* Channel3 Video */59};6061/* structures */6263struct video_obj {64enum v4l2_field buf_field;65u32 latest_only; /* indicate whether to return66* most recent displayed frame only */67v4l2_std_id stdid; /* Currently selected or default68* standard */69u32 dv_preset;70struct v4l2_bt_timings bt_timings;71u32 output_id; /* Current output id */72};7374struct vbi_obj {75int num_services;76struct vpif_vbi_params vbiparams; /* vpif parameters for the raw77* vbi data */78};7980struct common_obj {81/* Buffer specific parameters */82u8 *fbuffers[VIDEO_MAX_FRAME]; /* List of buffer pointers for83* storing frames */84u32 numbuffers; /* number of buffers */85struct videobuf_buffer *cur_frm; /* Pointer pointing to current86* videobuf_buffer */87struct videobuf_buffer *next_frm; /* Pointer pointing to next88* videobuf_buffer */89enum v4l2_memory memory; /* This field keeps track of90* type of buffer exchange91* method user has selected */92struct v4l2_format fmt; /* Used to store the format */93struct videobuf_queue buffer_queue; /* Buffer queue used in94* video-buf */95struct list_head dma_queue; /* Queue of filled frames */96spinlock_t irqlock; /* Used in video-buf */9798/* channel specific parameters */99struct mutex lock; /* lock used to access this100* structure */101u32 io_usrs; /* number of users performing102* IO */103u8 started; /* Indicates whether streaming104* started */105u32 ytop_off; /* offset of Y top from the106* starting of the buffer */107u32 ybtm_off; /* offset of Y bottom from the108* starting of the buffer */109u32 ctop_off; /* offset of C top from the110* starting of the buffer */111u32 cbtm_off; /* offset of C bottom from the112* starting of the buffer */113/* Function pointer to set the addresses */114void (*set_addr) (unsigned long, unsigned long,115unsigned long, unsigned long);116u32 height;117u32 width;118};119120struct channel_obj {121/* V4l2 specific parameters */122struct video_device *video_dev; /* Identifies video device for123* this channel */124struct v4l2_prio_state prio; /* Used to keep track of state of125* the priority */126atomic_t usrs; /* number of open instances of127* the channel */128u32 field_id; /* Indicates id of the field129* which is being displayed */130u8 initialized; /* flag to indicate whether131* encoder is initialized */132133enum vpif_channel_id channel_id;/* Identifies channel */134struct vpif_params vpifparams;135struct common_obj common[VPIF_NUMOBJECTS];136struct video_obj video;137struct vbi_obj vbi;138};139140/* File handle structure */141struct vpif_fh {142struct channel_obj *channel; /* pointer to channel object for143* opened device */144u8 io_allowed[VPIF_NUMOBJECTS]; /* Indicates whether this file handle145* is doing IO */146enum v4l2_priority prio; /* Used to keep track priority of147* this instance */148u8 initialized; /* Used to keep track of whether this149* file handle has initialized150* channel or not */151};152153/* vpif device structure */154struct vpif_device {155struct v4l2_device v4l2_dev;156struct channel_obj *dev[VPIF_DISPLAY_NUM_CHANNELS];157struct v4l2_subdev **sd;158159};160161struct vpif_config_params {162u32 min_bufsize[VPIF_DISPLAY_NUM_CHANNELS];163u32 channel_bufsize[VPIF_DISPLAY_NUM_CHANNELS];164u8 numbuffers[VPIF_DISPLAY_NUM_CHANNELS];165u8 min_numbuffers;166};167168/* Struct which keeps track of the line numbers for the sliced vbi service */169struct vpif_service_line {170u16 service_id;171u16 service_line[2];172u16 enc_service_id;173u8 bytestowrite;174};175176#endif /* DAVINCIHD_DISPLAY_H */177178179