| 
									
										
										
										
											2009-06-09 05:55:37 -03:00
										 |  |  | /*
 | 
					
						
							| 
									
										
										
										
											2012-04-13 04:44:00 -03:00
										 |  |  |  * VPIF display header file | 
					
						
							| 
									
										
										
										
											2009-06-09 05:55:37 -03:00
										 |  |  |  * | 
					
						
							|  |  |  |  * Copyright (C) 2009 Texas Instruments Incorporated - http://www.ti.com/
 | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  * 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 version 2. | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  * This program is distributed .as is. WITHOUT ANY WARRANTY of any | 
					
						
							|  |  |  |  * kind, whether express or implied; without even the implied warranty | 
					
						
							|  |  |  |  * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the | 
					
						
							|  |  |  |  * GNU General Public License for more details. | 
					
						
							|  |  |  |  */ | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-05-16 10:33:29 -03:00
										 |  |  | #ifndef VPIF_DISPLAY_H
 | 
					
						
							|  |  |  | #define VPIF_DISPLAY_H
 | 
					
						
							| 
									
										
										
										
											2009-06-09 05:55:37 -03:00
										 |  |  | 
 | 
					
						
							|  |  |  | /* Header files */ | 
					
						
							| 
									
										
										
										
											2012-06-28 09:28:36 -03:00
										 |  |  | #include <media/videobuf2-dma-contig.h>
 | 
					
						
							| 
									
										
										
										
											2013-04-19 05:53:29 -03:00
										 |  |  | #include <media/v4l2-device.h>
 | 
					
						
							| 
									
										
										
										
											2009-06-09 05:55:37 -03:00
										 |  |  | 
 | 
					
						
							|  |  |  | #include "vpif.h"
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | /* Macros */ | 
					
						
							| 
									
										
										
										
											2011-06-25 11:28:37 -03:00
										 |  |  | #define VPIF_DISPLAY_VERSION	"0.0.2"
 | 
					
						
							| 
									
										
										
										
											2009-06-09 05:55:37 -03:00
										 |  |  | 
 | 
					
						
							|  |  |  | #define VPIF_VALID_FIELD(field) \
 | 
					
						
							|  |  |  | 	(((V4L2_FIELD_ANY == field) || (V4L2_FIELD_NONE == field)) || \ | 
					
						
							|  |  |  | 	(((V4L2_FIELD_INTERLACED == field) || (V4L2_FIELD_SEQ_TB == field)) || \ | 
					
						
							|  |  |  | 	(V4L2_FIELD_SEQ_BT == field))) | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #define VPIF_DISPLAY_MAX_DEVICES	(2)
 | 
					
						
							|  |  |  | #define VPIF_SLICED_BUF_SIZE		(256)
 | 
					
						
							|  |  |  | #define VPIF_SLICED_MAX_SERVICES	(3)
 | 
					
						
							|  |  |  | #define VPIF_VIDEO_INDEX		(0)
 | 
					
						
							|  |  |  | #define VPIF_VBI_INDEX			(1)
 | 
					
						
							|  |  |  | #define VPIF_HBI_INDEX			(2)
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | /* Setting it to 1 as HBI/VBI support yet to be added , else 3*/ | 
					
						
							|  |  |  | #define VPIF_NUMOBJECTS	(1)
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | /* Macros */ | 
					
						
							|  |  |  | #define ISALIGNED(a)    (0 == ((a) & 7))
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | /* enumerated data types */ | 
					
						
							|  |  |  | /* Enumerated data type to give id to each device per channel */ | 
					
						
							|  |  |  | enum vpif_channel_id { | 
					
						
							|  |  |  | 	VPIF_CHANNEL2_VIDEO = 0,	/* Channel2 Video */ | 
					
						
							|  |  |  | 	VPIF_CHANNEL3_VIDEO,		/* Channel3 Video */ | 
					
						
							|  |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | /* structures */ | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | struct video_obj { | 
					
						
							|  |  |  | 	enum v4l2_field buf_field; | 
					
						
							|  |  |  | 	u32 latest_only;		/* indicate whether to return
 | 
					
						
							|  |  |  | 					 * most recent displayed frame only */ | 
					
						
							|  |  |  | 	v4l2_std_id stdid;		/* Currently selected or default
 | 
					
						
							|  |  |  | 					 * standard */ | 
					
						
							| 
									
										
										
										
											2012-09-18 07:18:47 -03:00
										 |  |  | 	struct v4l2_dv_timings dv_timings; | 
					
						
							| 
									
										
										
										
											2009-06-09 05:55:37 -03:00
										 |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-06-28 09:28:36 -03:00
										 |  |  | struct vpif_disp_buffer { | 
					
						
							|  |  |  | 	struct vb2_buffer vb; | 
					
						
							|  |  |  | 	struct list_head list; | 
					
						
							|  |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-06-09 05:55:37 -03:00
										 |  |  | struct common_obj { | 
					
						
							| 
									
										
										
										
											2012-06-28 09:28:36 -03:00
										 |  |  | 	struct vpif_disp_buffer *cur_frm;	/* Pointer pointing to current
 | 
					
						
							|  |  |  | 						 * vb2_buffer */ | 
					
						
							|  |  |  | 	struct vpif_disp_buffer *next_frm;	/* Pointer pointing to next
 | 
					
						
							|  |  |  | 						 * vb2_buffer */ | 
					
						
							| 
									
										
										
										
											2009-06-09 05:55:37 -03:00
										 |  |  | 	struct v4l2_format fmt;			/* Used to store the format */ | 
					
						
							| 
									
										
										
										
											2012-06-28 09:28:36 -03:00
										 |  |  | 	struct vb2_queue buffer_queue;		/* Buffer queue used in
 | 
					
						
							| 
									
										
										
										
											2009-06-09 05:55:37 -03:00
										 |  |  | 						 * video-buf */ | 
					
						
							| 
									
										
										
										
											2012-06-28 09:28:36 -03:00
										 |  |  | 	/* allocator-specific contexts for each plane */ | 
					
						
							|  |  |  | 	struct vb2_alloc_ctx *alloc_ctx; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-06-09 05:55:37 -03:00
										 |  |  | 	struct list_head dma_queue;		/* Queue of filled frames */ | 
					
						
							|  |  |  | 	spinlock_t irqlock;			/* Used in video-buf */ | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	/* channel specific parameters */ | 
					
						
							|  |  |  | 	struct mutex lock;			/* lock used to access this
 | 
					
						
							|  |  |  | 						 * structure */ | 
					
						
							|  |  |  | 	u32 ytop_off;				/* offset of Y top from the
 | 
					
						
							|  |  |  | 						 * starting of the buffer */ | 
					
						
							|  |  |  | 	u32 ybtm_off;				/* offset of Y bottom from the
 | 
					
						
							|  |  |  | 						 * starting of the buffer */ | 
					
						
							|  |  |  | 	u32 ctop_off;				/* offset of C top from the
 | 
					
						
							|  |  |  | 						 * starting of the buffer */ | 
					
						
							|  |  |  | 	u32 cbtm_off;				/* offset of C bottom from the
 | 
					
						
							|  |  |  | 						 * starting of the buffer */ | 
					
						
							|  |  |  | 	/* Function pointer to set the addresses */ | 
					
						
							| 
									
										
										
										
											2014-05-16 10:33:29 -03:00
										 |  |  | 	void (*set_addr)(unsigned long, unsigned long, | 
					
						
							| 
									
										
										
										
											2009-06-09 05:55:37 -03:00
										 |  |  | 				unsigned long, unsigned long); | 
					
						
							|  |  |  | 	u32 height; | 
					
						
							|  |  |  | 	u32 width; | 
					
						
							|  |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | struct channel_obj { | 
					
						
							|  |  |  | 	/* V4l2 specific parameters */ | 
					
						
							|  |  |  | 	struct video_device *video_dev;	/* Identifies video device for
 | 
					
						
							|  |  |  | 					 * this channel */ | 
					
						
							|  |  |  | 	u32 field_id;			/* Indicates id of the field
 | 
					
						
							|  |  |  | 					 * which is being displayed */ | 
					
						
							|  |  |  | 	u8 initialized;			/* flag to indicate whether
 | 
					
						
							|  |  |  | 					 * encoder is initialized */ | 
					
						
							| 
									
										
										
										
											2012-09-20 09:06:23 -03:00
										 |  |  | 	u32 output_idx;			/* Current output index */ | 
					
						
							| 
									
										
										
										
											2012-09-20 09:06:31 -03:00
										 |  |  | 	struct v4l2_subdev *sd;		/* Current output subdev(may be NULL) */ | 
					
						
							| 
									
										
										
										
											2009-06-09 05:55:37 -03:00
										 |  |  | 
 | 
					
						
							|  |  |  | 	enum vpif_channel_id channel_id;/* Identifies channel */ | 
					
						
							|  |  |  | 	struct vpif_params vpifparams; | 
					
						
							|  |  |  | 	struct common_obj common[VPIF_NUMOBJECTS]; | 
					
						
							|  |  |  | 	struct video_obj video; | 
					
						
							|  |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | /* vpif device structure */ | 
					
						
							|  |  |  | struct vpif_device { | 
					
						
							|  |  |  | 	struct v4l2_device v4l2_dev; | 
					
						
							|  |  |  | 	struct channel_obj *dev[VPIF_DISPLAY_NUM_CHANNELS]; | 
					
						
							|  |  |  | 	struct v4l2_subdev **sd; | 
					
						
							| 
									
										
										
										
											2013-06-25 11:17:35 -03:00
										 |  |  | 	struct v4l2_async_notifier notifier; | 
					
						
							|  |  |  | 	struct vpif_display_config *config; | 
					
						
							| 
									
										
										
										
											2009-06-09 05:55:37 -03:00
										 |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-05-16 10:33:29 -03:00
										 |  |  | #endif				/* VPIF_DISPLAY_H */
 |