117 lines · c
1/* SPDX-License-Identifier: GPL-2.0-only */2/*3 * VPIF display header file4 *5 * Copyright (C) 2009 Texas Instruments Incorporated - https://www.ti.com/6 */7 8#ifndef VPIF_DISPLAY_H9#define VPIF_DISPLAY_H10 11/* Header files */12#include <media/videobuf2-dma-contig.h>13#include <media/v4l2-device.h>14 15#include "vpif.h"16 17/* Macros */18#define VPIF_DISPLAY_VERSION "0.0.2"19 20#define VPIF_VALID_FIELD(field) \21 (((V4L2_FIELD_ANY == field) || (V4L2_FIELD_NONE == field)) || \22 (((V4L2_FIELD_INTERLACED == field) || (V4L2_FIELD_SEQ_TB == field)) || \23 (V4L2_FIELD_SEQ_BT == field)))24 25#define VPIF_DISPLAY_MAX_DEVICES (2)26#define VPIF_SLICED_BUF_SIZE (256)27#define VPIF_SLICED_MAX_SERVICES (3)28#define VPIF_VIDEO_INDEX (0)29#define VPIF_VBI_INDEX (1)30#define VPIF_HBI_INDEX (2)31 32/* Setting it to 1 as HBI/VBI support yet to be added , else 3*/33#define VPIF_NUMOBJECTS (1)34 35/* Macros */36#define ISALIGNED(a) (0 == ((a) & 7))37 38/* enumerated data types */39/* Enumerated data type to give id to each device per channel */40enum vpif_channel_id {41 VPIF_CHANNEL2_VIDEO = 0, /* Channel2 Video */42 VPIF_CHANNEL3_VIDEO, /* Channel3 Video */43};44 45/* structures */46 47struct video_obj {48 enum v4l2_field buf_field;49 u32 latest_only; /* indicate whether to return50 * most recent displayed frame only */51 v4l2_std_id stdid; /* Currently selected or default52 * standard */53 struct v4l2_dv_timings dv_timings;54};55 56struct vpif_disp_buffer {57 struct vb2_v4l2_buffer vb;58 struct list_head list;59};60 61struct common_obj {62 struct vpif_disp_buffer *cur_frm; /* Pointer pointing to current63 * vb2_buffer */64 struct vpif_disp_buffer *next_frm; /* Pointer pointing to next65 * vb2_buffer */66 struct v4l2_format fmt; /* Used to store the format */67 struct vb2_queue buffer_queue; /* Buffer queue used in vb2 */68 69 struct list_head dma_queue; /* Queue of filled frames */70 spinlock_t irqlock; /* Used for video buffer71 * handling */72 73 /* channel specific parameters */74 struct mutex lock; /* lock used to access this75 * structure */76 u32 ytop_off; /* offset of Y top from the77 * starting of the buffer */78 u32 ybtm_off; /* offset of Y bottom from the79 * starting of the buffer */80 u32 ctop_off; /* offset of C top from the81 * starting of the buffer */82 u32 cbtm_off; /* offset of C bottom from the83 * starting of the buffer */84 /* Function pointer to set the addresses */85 void (*set_addr)(unsigned long, unsigned long,86 unsigned long, unsigned long);87 u32 height;88 u32 width;89};90 91struct channel_obj {92 /* V4l2 specific parameters */93 struct video_device video_dev; /* Identifies video device for94 * this channel */95 u32 field_id; /* Indicates id of the field96 * which is being displayed */97 u8 initialized; /* flag to indicate whether98 * encoder is initialized */99 u32 output_idx; /* Current output index */100 struct v4l2_subdev *sd; /* Current output subdev(may be NULL) */101 102 enum vpif_channel_id channel_id;/* Identifies channel */103 struct vpif_params vpifparams;104 struct common_obj common[VPIF_NUMOBJECTS];105 struct video_obj video;106};107 108/* vpif device structure */109struct vpif_device {110 struct v4l2_device v4l2_dev;111 struct channel_obj *dev[VPIF_DISPLAY_NUM_CHANNELS];112 struct v4l2_subdev **sd;113 struct vpif_display_config *config;114};115 116#endif /* VPIF_DISPLAY_H */117