Vaibhav Hiremath | 5c7ab63 | 2010-04-11 10:41:49 -0300 | [diff] [blame] | 1 | /* |
| 2 | * omap_voutdef.h |
| 3 | * |
| 4 | * Copyright (C) 2010 Texas Instruments. |
| 5 | * |
| 6 | * This file is licensed under the terms of the GNU General Public License |
| 7 | * version 2. This program is licensed "as is" without any warranty of any |
| 8 | * kind, whether express or implied. |
| 9 | */ |
| 10 | |
| 11 | #ifndef OMAP_VOUTDEF_H |
| 12 | #define OMAP_VOUTDEF_H |
| 13 | |
Tomi Valkeinen | a0b38cc | 2011-05-11 14:05:07 +0300 | [diff] [blame^] | 14 | #include <video/omapdss.h> |
Vaibhav Hiremath | 5c7ab63 | 2010-04-11 10:41:49 -0300 | [diff] [blame] | 15 | |
| 16 | #define YUYV_BPP 2 |
| 17 | #define RGB565_BPP 2 |
| 18 | #define RGB24_BPP 3 |
| 19 | #define RGB32_BPP 4 |
| 20 | #define TILE_SIZE 32 |
| 21 | #define YUYV_VRFB_BPP 2 |
| 22 | #define RGB_VRFB_BPP 1 |
| 23 | #define MAX_CID 3 |
| 24 | #define MAC_VRFB_CTXS 4 |
| 25 | #define MAX_VOUT_DEV 2 |
| 26 | #define MAX_OVLS 3 |
| 27 | #define MAX_DISPLAYS 3 |
| 28 | #define MAX_MANAGERS 3 |
| 29 | |
| 30 | /* Enum for Rotation |
| 31 | * DSS understands rotation in 0, 1, 2, 3 context |
| 32 | * while V4L2 driver understands it as 0, 90, 180, 270 |
| 33 | */ |
| 34 | enum dss_rotation { |
| 35 | dss_rotation_0_degree = 0, |
| 36 | dss_rotation_90_degree = 1, |
| 37 | dss_rotation_180_degree = 2, |
| 38 | dss_rotation_270_degree = 3, |
| 39 | }; |
| 40 | /* |
| 41 | * This structure is used to store the DMA transfer parameters |
| 42 | * for VRFB hidden buffer |
| 43 | */ |
| 44 | struct vid_vrfb_dma { |
| 45 | int dev_id; |
| 46 | int dma_ch; |
| 47 | int req_status; |
| 48 | int tx_status; |
| 49 | wait_queue_head_t wait; |
| 50 | }; |
| 51 | |
| 52 | struct omapvideo_info { |
| 53 | int id; |
| 54 | int num_overlays; |
| 55 | struct omap_overlay *overlays[MAX_OVLS]; |
| 56 | }; |
| 57 | |
| 58 | struct omap2video_device { |
| 59 | struct mutex mtx; |
| 60 | |
| 61 | int state; |
| 62 | |
| 63 | struct v4l2_device v4l2_dev; |
| 64 | struct omap_vout_device *vouts[MAX_VOUT_DEV]; |
| 65 | |
| 66 | int num_displays; |
| 67 | struct omap_dss_device *displays[MAX_DISPLAYS]; |
| 68 | int num_overlays; |
| 69 | struct omap_overlay *overlays[MAX_OVLS]; |
| 70 | int num_managers; |
| 71 | struct omap_overlay_manager *managers[MAX_MANAGERS]; |
| 72 | }; |
| 73 | |
| 74 | /* per-device data structure */ |
| 75 | struct omap_vout_device { |
| 76 | |
| 77 | struct omapvideo_info vid_info; |
| 78 | struct video_device *vfd; |
| 79 | struct omap2video_device *vid_dev; |
| 80 | int vid; |
| 81 | int opened; |
| 82 | |
| 83 | /* we don't allow to change image fmt/size once buffer has |
| 84 | * been allocated |
| 85 | */ |
| 86 | int buffer_allocated; |
| 87 | /* allow to reuse previously allocated buffer which is big enough */ |
| 88 | int buffer_size; |
| 89 | /* keep buffer info across opens */ |
| 90 | unsigned long buf_virt_addr[VIDEO_MAX_FRAME]; |
| 91 | unsigned long buf_phy_addr[VIDEO_MAX_FRAME]; |
| 92 | enum omap_color_mode dss_mode; |
| 93 | |
| 94 | /* we don't allow to request new buffer when old buffers are |
| 95 | * still mmaped |
| 96 | */ |
| 97 | int mmap_count; |
| 98 | |
| 99 | spinlock_t vbq_lock; /* spinlock for videobuf queues */ |
| 100 | unsigned long field_count; /* field counter for videobuf_buffer */ |
| 101 | |
| 102 | /* non-NULL means streaming is in progress. */ |
| 103 | bool streaming; |
| 104 | |
| 105 | struct v4l2_pix_format pix; |
| 106 | struct v4l2_rect crop; |
| 107 | struct v4l2_window win; |
| 108 | struct v4l2_framebuffer fbuf; |
| 109 | |
| 110 | /* Lock to protect the shared data structures in ioctl */ |
| 111 | struct mutex lock; |
| 112 | |
| 113 | /* V4L2 control structure for different control id */ |
| 114 | struct v4l2_control control[MAX_CID]; |
| 115 | enum dss_rotation rotation; |
| 116 | bool mirror; |
| 117 | int flicker_filter; |
| 118 | /* V4L2 control structure for different control id */ |
| 119 | |
| 120 | int bpp; /* bytes per pixel */ |
| 121 | int vrfb_bpp; /* bytes per pixel with respect to VRFB */ |
| 122 | |
| 123 | struct vid_vrfb_dma vrfb_dma_tx; |
| 124 | unsigned int smsshado_phy_addr[MAC_VRFB_CTXS]; |
| 125 | unsigned int smsshado_virt_addr[MAC_VRFB_CTXS]; |
| 126 | struct vrfb vrfb_context[MAC_VRFB_CTXS]; |
| 127 | bool vrfb_static_allocation; |
| 128 | unsigned int smsshado_size; |
| 129 | unsigned char pos; |
| 130 | |
| 131 | int ps, vr_ps, line_length, first_int, field_id; |
| 132 | enum v4l2_memory memory; |
| 133 | struct videobuf_buffer *cur_frm, *next_frm; |
| 134 | struct list_head dma_queue; |
| 135 | u8 *queued_buf_addr[VIDEO_MAX_FRAME]; |
| 136 | u32 cropped_offset; |
| 137 | s32 tv_field1_offset; |
| 138 | void *isr_handle; |
| 139 | |
| 140 | /* Buffer queue variables */ |
| 141 | struct omap_vout_device *vout; |
| 142 | enum v4l2_buf_type type; |
| 143 | struct videobuf_queue vbq; |
| 144 | int io_allowed; |
| 145 | |
| 146 | }; |
| 147 | #endif /* ifndef OMAP_VOUTDEF_H */ |