linux/drivers/media/platform/davinci/vpif_display.h
<<
>>
Prefs
   1/*
   2 * VPIF display header file
   3 *
   4 * Copyright (C) 2009 Texas Instruments Incorporated - http://www.ti.com/
   5 *
   6 * This program is free software; you can redistribute it and/or
   7 * modify it under the terms of the GNU General Public License as
   8 * published by the Free Software Foundation version 2.
   9 *
  10 * This program is distributed .as is. WITHOUT ANY WARRANTY of any
  11 * kind, whether express or implied; without even the implied warranty
  12 * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  13 * GNU General Public License for more details.
  14 */
  15
  16#ifndef VPIF_DISPLAY_H
  17#define VPIF_DISPLAY_H
  18
  19/* Header files */
  20#include <media/videobuf2-dma-contig.h>
  21#include <media/v4l2-device.h>
  22
  23#include "vpif.h"
  24
  25/* Macros */
  26#define VPIF_DISPLAY_VERSION    "0.0.2"
  27
  28#define VPIF_VALID_FIELD(field) \
  29        (((V4L2_FIELD_ANY == field) || (V4L2_FIELD_NONE == field)) || \
  30        (((V4L2_FIELD_INTERLACED == field) || (V4L2_FIELD_SEQ_TB == field)) || \
  31        (V4L2_FIELD_SEQ_BT == field)))
  32
  33#define VPIF_DISPLAY_MAX_DEVICES        (2)
  34#define VPIF_SLICED_BUF_SIZE            (256)
  35#define VPIF_SLICED_MAX_SERVICES        (3)
  36#define VPIF_VIDEO_INDEX                (0)
  37#define VPIF_VBI_INDEX                  (1)
  38#define VPIF_HBI_INDEX                  (2)
  39
  40/* Setting it to 1 as HBI/VBI support yet to be added , else 3*/
  41#define VPIF_NUMOBJECTS (1)
  42
  43/* Macros */
  44#define ISALIGNED(a)    (0 == ((a) & 7))
  45
  46/* enumerated data types */
  47/* Enumerated data type to give id to each device per channel */
  48enum vpif_channel_id {
  49        VPIF_CHANNEL2_VIDEO = 0,        /* Channel2 Video */
  50        VPIF_CHANNEL3_VIDEO,            /* Channel3 Video */
  51};
  52
  53/* structures */
  54
  55struct video_obj {
  56        enum v4l2_field buf_field;
  57        u32 latest_only;                /* indicate whether to return
  58                                         * most recent displayed frame only */
  59        v4l2_std_id stdid;              /* Currently selected or default
  60                                         * standard */
  61        struct v4l2_dv_timings dv_timings;
  62};
  63
  64struct vpif_disp_buffer {
  65        struct vb2_buffer vb;
  66        struct list_head list;
  67};
  68
  69struct common_obj {
  70        struct vpif_disp_buffer *cur_frm;       /* Pointer pointing to current
  71                                                 * vb2_buffer */
  72        struct vpif_disp_buffer *next_frm;      /* Pointer pointing to next
  73                                                 * vb2_buffer */
  74        struct v4l2_format fmt;                 /* Used to store the format */
  75        struct vb2_queue buffer_queue;          /* Buffer queue used in
  76                                                 * video-buf */
  77        /* allocator-specific contexts for each plane */
  78        struct vb2_alloc_ctx *alloc_ctx;
  79
  80        struct list_head dma_queue;             /* Queue of filled frames */
  81        spinlock_t irqlock;                     /* Used in video-buf */
  82
  83        /* channel specific parameters */
  84        struct mutex lock;                      /* lock used to access this
  85                                                 * structure */
  86        u32 ytop_off;                           /* offset of Y top from the
  87                                                 * starting of the buffer */
  88        u32 ybtm_off;                           /* offset of Y bottom from the
  89                                                 * starting of the buffer */
  90        u32 ctop_off;                           /* offset of C top from the
  91                                                 * starting of the buffer */
  92        u32 cbtm_off;                           /* offset of C bottom from the
  93                                                 * starting of the buffer */
  94        /* Function pointer to set the addresses */
  95        void (*set_addr)(unsigned long, unsigned long,
  96                                unsigned long, unsigned long);
  97        u32 height;
  98        u32 width;
  99};
 100
 101struct channel_obj {
 102        /* V4l2 specific parameters */
 103        struct video_device *video_dev; /* Identifies video device for
 104                                         * this channel */
 105        u32 field_id;                   /* Indicates id of the field
 106                                         * which is being displayed */
 107        u8 initialized;                 /* flag to indicate whether
 108                                         * encoder is initialized */
 109        u32 output_idx;                 /* Current output index */
 110        struct v4l2_subdev *sd;         /* Current output subdev(may be NULL) */
 111
 112        enum vpif_channel_id channel_id;/* Identifies channel */
 113        struct vpif_params vpifparams;
 114        struct common_obj common[VPIF_NUMOBJECTS];
 115        struct video_obj video;
 116};
 117
 118/* vpif device structure */
 119struct vpif_device {
 120        struct v4l2_device v4l2_dev;
 121        struct channel_obj *dev[VPIF_DISPLAY_NUM_CHANNELS];
 122        struct v4l2_subdev **sd;
 123        struct v4l2_async_notifier notifier;
 124        struct vpif_display_config *config;
 125};
 126
 127#endif                          /* VPIF_DISPLAY_H */
 128