Laurent Pinchart | de1135d | 2011-02-12 18:05:06 -0300 | [diff] [blame] | 1 | /* |
| 2 | * ispresizer.h |
| 3 | * |
| 4 | * TI OMAP3 ISP - Resizer module |
| 5 | * |
| 6 | * Copyright (C) 2010 Nokia Corporation |
| 7 | * Copyright (C) 2009 Texas Instruments, Inc |
| 8 | * |
| 9 | * Contacts: Laurent Pinchart <laurent.pinchart@ideasonboard.com> |
| 10 | * Sakari Ailus <sakari.ailus@iki.fi> |
| 11 | * |
| 12 | * This program is free software; you can redistribute it and/or modify |
| 13 | * it under the terms of the GNU General Public License version 2 as |
| 14 | * published by the Free Software Foundation. |
| 15 | * |
| 16 | * This program is distributed in the hope that it will be useful, but |
| 17 | * WITHOUT ANY WARRANTY; without even the implied warranty of |
| 18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 19 | * General Public License for more details. |
| 20 | * |
| 21 | * You should have received a copy of the GNU General Public License |
| 22 | * along with this program; if not, write to the Free Software |
| 23 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA |
| 24 | * 02110-1301 USA |
| 25 | */ |
| 26 | |
| 27 | #ifndef OMAP3_ISP_RESIZER_H |
| 28 | #define OMAP3_ISP_RESIZER_H |
| 29 | |
| 30 | #include <linux/types.h> |
| 31 | |
| 32 | /* |
| 33 | * Constants for filter coefficents count |
| 34 | */ |
| 35 | #define COEFF_CNT 32 |
| 36 | |
| 37 | /* |
| 38 | * struct isprsz_coef - Structure for resizer filter coeffcients. |
| 39 | * @h_filter_coef_4tap: Horizontal filter coefficients for 8-phase/4-tap |
| 40 | * mode (.5x-4x) |
| 41 | * @v_filter_coef_4tap: Vertical filter coefficients for 8-phase/4-tap |
| 42 | * mode (.5x-4x) |
| 43 | * @h_filter_coef_7tap: Horizontal filter coefficients for 4-phase/7-tap |
| 44 | * mode (.25x-.5x) |
| 45 | * @v_filter_coef_7tap: Vertical filter coefficients for 4-phase/7-tap |
| 46 | * mode (.25x-.5x) |
| 47 | */ |
| 48 | struct isprsz_coef { |
| 49 | u16 h_filter_coef_4tap[32]; |
| 50 | u16 v_filter_coef_4tap[32]; |
| 51 | /* Every 8th value is a dummy value in the following arrays: */ |
| 52 | u16 h_filter_coef_7tap[32]; |
| 53 | u16 v_filter_coef_7tap[32]; |
| 54 | }; |
| 55 | |
| 56 | /* Chrominance horizontal algorithm */ |
| 57 | enum resizer_chroma_algo { |
| 58 | RSZ_THE_SAME = 0, /* Chrominance the same as Luminance */ |
| 59 | RSZ_BILINEAR = 1, /* Chrominance uses bilinear interpolation */ |
| 60 | }; |
| 61 | |
| 62 | /* Resizer input type select */ |
| 63 | enum resizer_colors_type { |
| 64 | RSZ_YUV422 = 0, /* YUV422 color is interleaved */ |
| 65 | RSZ_COLOR8 = 1, /* Color separate data on 8 bits */ |
| 66 | }; |
| 67 | |
| 68 | /* |
| 69 | * Structure for horizontal and vertical resizing value |
| 70 | */ |
| 71 | struct resizer_ratio { |
| 72 | u32 horz; |
| 73 | u32 vert; |
| 74 | }; |
| 75 | |
| 76 | /* |
| 77 | * Structure for luminance enhancer parameters. |
| 78 | */ |
| 79 | struct resizer_luma_yenh { |
| 80 | u8 algo; /* algorithm select. */ |
| 81 | u8 gain; /* maximum gain. */ |
| 82 | u8 slope; /* slope. */ |
| 83 | u8 core; /* core offset. */ |
| 84 | }; |
| 85 | |
| 86 | enum resizer_input_entity { |
| 87 | RESIZER_INPUT_NONE, |
| 88 | RESIZER_INPUT_VP, /* input video port - prev or ccdc */ |
| 89 | RESIZER_INPUT_MEMORY, |
| 90 | }; |
| 91 | |
| 92 | /* Sink and source resizer pads */ |
| 93 | #define RESZ_PAD_SINK 0 |
| 94 | #define RESZ_PAD_SOURCE 1 |
| 95 | #define RESZ_PADS_NUM 2 |
| 96 | |
| 97 | /* |
| 98 | * struct isp_res_device - OMAP3 ISP resizer module |
| 99 | * @crop.request: Crop rectangle requested by the user |
| 100 | * @crop.active: Active crop rectangle (based on hardware requirements) |
| 101 | */ |
| 102 | struct isp_res_device { |
| 103 | struct v4l2_subdev subdev; |
| 104 | struct media_pad pads[RESZ_PADS_NUM]; |
| 105 | struct v4l2_mbus_framefmt formats[RESZ_PADS_NUM]; |
| 106 | |
| 107 | enum resizer_input_entity input; |
| 108 | struct isp_video video_in; |
| 109 | struct isp_video video_out; |
Laurent Pinchart | de1135d | 2011-02-12 18:05:06 -0300 | [diff] [blame] | 110 | |
| 111 | u32 addr_base; /* stored source buffer address in memory mode */ |
| 112 | u32 crop_offset; /* additional offset for crop in memory mode */ |
| 113 | struct resizer_ratio ratio; |
| 114 | int pm_state; |
| 115 | unsigned int applycrop:1; |
| 116 | enum isp_pipeline_stream_state state; |
| 117 | wait_queue_head_t wait; |
| 118 | atomic_t stopping; |
| 119 | |
| 120 | struct { |
| 121 | struct v4l2_rect request; |
| 122 | struct v4l2_rect active; |
| 123 | } crop; |
| 124 | }; |
| 125 | |
| 126 | struct isp_device; |
| 127 | |
| 128 | int omap3isp_resizer_init(struct isp_device *isp); |
| 129 | void omap3isp_resizer_cleanup(struct isp_device *isp); |
| 130 | |
| 131 | int omap3isp_resizer_register_entities(struct isp_res_device *res, |
| 132 | struct v4l2_device *vdev); |
| 133 | void omap3isp_resizer_unregister_entities(struct isp_res_device *res); |
| 134 | void omap3isp_resizer_isr_frame_sync(struct isp_res_device *res); |
| 135 | void omap3isp_resizer_isr(struct isp_res_device *isp_res); |
| 136 | |
| 137 | void omap3isp_resizer_max_rate(struct isp_res_device *res, |
| 138 | unsigned int *max_rate); |
| 139 | |
| 140 | void omap3isp_resizer_suspend(struct isp_res_device *isp_res); |
| 141 | |
| 142 | void omap3isp_resizer_resume(struct isp_res_device *isp_res); |
| 143 | |
| 144 | int omap3isp_resizer_busy(struct isp_res_device *isp_res); |
| 145 | |
| 146 | #endif /* OMAP3_ISP_RESIZER_H */ |