Lines Matching +full:fixed +full:- +full:factor +full:- +full:clock

4  * TI OMAP3 ISP - Resizer module
24 * 02110-1301 USA
55 * "TRM ES3.1, table 12-46"
72 * 7-tap mode is for scale factors 0.25x to 0.5x.
73 * 4-tap mode is for scale factors 0.5x to 4.0x.
77 /* For 8-phase 4-tap horizontal filter: */
88 /* For 8-phase 4-tap vertical filter: */
99 /* For 4-phase 7-tap horizontal filter: */
107 /* For 4-phase 7-tap vertical filter: */
115 * The dummy padding is required in 7-tap mode because of how the
122 * __resizer_get_format - helper function for getting resizer format
136 return &res->formats[pad]; in __resizer_get_format()
140 * __resizer_get_crop - helper function for getting resizer crop rectangle
152 return &res->crop.request; in __resizer_get_crop()
156 * resizer_set_filters - Set resizer filters
185 * resizer_set_bilinear - Chrominance horizontal algorithm select
207 * resizer_set_ycpos - Luminance and chrominance order
231 * resizer_set_phase - Setup horizontal and vertical starting phase
253 * resizer_set_luma - Setup luminance enhancer parameters
259 * 0x1: [-1 2 -1]/2 high-pass filter
260 * 0x2: [-1 -2 6 -2 -1]/4 high-pass filter
272 * Y += HPF(Y) x max(GAIN, (HPF(Y) - CORE) x SLOP + 8) >> 4.
280 rgval = (luma->algo << ISPRSZ_YENH_ALGO_SHIFT) in resizer_set_luma()
282 rgval |= (luma->gain << ISPRSZ_YENH_GAIN_SHIFT) in resizer_set_luma()
284 rgval |= (luma->slope << ISPRSZ_YENH_SLOP_SHIFT) in resizer_set_luma()
286 rgval |= (luma->core << ISPRSZ_YENH_CORE_SHIFT) in resizer_set_luma()
293 * resizer_set_source - Input source select
314 * resizer_set_ratio - Setup horizontal and vertical resizing value
329 rgval |= ((ratio->horz - 1) << ISPRSZ_CNT_HRSZ_SHIFT) in resizer_set_ratio()
331 rgval |= ((ratio->vert - 1) << ISPRSZ_CNT_VRSZ_SHIFT) in resizer_set_ratio()
336 if (ratio->horz > MID_RESIZE_VALUE) in resizer_set_ratio()
342 if (ratio->vert > MID_RESIZE_VALUE) in resizer_set_ratio()
351 * resizer_set_dst_size - Setup the output height and width
361 * a multiple of 16-bytes if the vertical resizing factor
370 dev_dbg(isp->dev, "Output size[w/h]: %dx%d\n", width, height); in resizer_set_output_size()
379 * resizer_set_output_offset - Setup memory offset for the output lines.
383 * The 5 LSBs are forced to be zeros by the hardware to align on a 32-byte
384 * boundary; the 5 LSBs are read-only. For optimal use of SDRAM bandwidth,
385 * the SDRAM line offset must be set on a 256-byte boundary
395 * resizer_set_start - Setup vertical and horizontal start position
407 * to <= 15 for YUV 16-bit data and <= 31 for 8-bit color separate data
423 * resizer_set_input_size - Setup the input size
434 dev_dbg(isp->dev, "Input size[w/h]: %dx%d\n", width, height); in resizer_set_input_size()
445 * resizer_set_src_offs - Setup the memory offset for the input lines
449 * The 5 LSBs are forced to be zeros by the hardware to align on a 32-byte
450 * boundary; the 5 LSBs are read-only. This field must be programmed to be
461 * resizer_set_intype - Input type select
479 * __resizer_set_inaddr - Helper function for set input address
493 * functional clock or 100 MP/s, whichever is lower. According to the TRM
497 * output data rate to the functional clock or 200 MP/s, whichever is lower,
503 * max intermediate rate <= L3 clock * input height / output height
504 * max intermediate rate <= L3 clock / 2
517 struct isp_pipeline *pipe = to_isp_pipeline(&res->subdev.entity); in omap3isp_resizer_max_rate()
518 const struct v4l2_mbus_framefmt *ofmt = &res->formats[RESZ_PAD_SOURCE]; in omap3isp_resizer_max_rate()
519 unsigned long limit = min(pipe->l3_ick, 200000000UL); in omap3isp_resizer_max_rate()
520 unsigned long clock; in omap3isp_resizer_max_rate() local
522 clock = div_u64((u64)limit * res->crop.active.height, ofmt->height); in omap3isp_resizer_max_rate()
523 clock = min(clock, limit / 2); in omap3isp_resizer_max_rate()
524 *max_rate = div_u64((u64)clock * res->crop.active.width, ofmt->width); in omap3isp_resizer_max_rate()
530 * requirements. If the application real-time requirements can cope with slower
545 * requests. The maximum number of 256-byte requests per second can be computed
552 * The number of cycles per second is controlled by the L3 clock, leading to
558 struct isp_pipeline *pipe = to_isp_pipeline(&res->subdev.entity); in resizer_adjust_bandwidth()
560 unsigned long l3_ick = pipe->l3_ick; in resizer_adjust_bandwidth()
570 if (res->input != RESIZER_INPUT_MEMORY) { in resizer_adjust_bandwidth()
576 switch (isp->revision) { in resizer_adjust_bandwidth()
592 cycles_per_request = div_u64((u64)l3_ick / 2 * 256 + pipe->max_rate - 1, in resizer_adjust_bandwidth()
593 pipe->max_rate); in resizer_adjust_bandwidth()
601 timeperframe = &pipe->max_timeperframe; in resizer_adjust_bandwidth()
603 requests_per_frame = DIV_ROUND_UP(res->crop.active.width * 2, 256) in resizer_adjust_bandwidth()
604 * res->crop.active.height; in resizer_adjust_bandwidth()
605 cycles_per_frame = div_u64((u64)l3_ick * timeperframe->numerator, in resizer_adjust_bandwidth()
606 timeperframe->denominator); in resizer_adjust_bandwidth()
613 dev_dbg(isp->dev, "%s: cycles per request = %u\n", __func__, value); in resizer_adjust_bandwidth()
620 * omap3isp_resizer_busy - Checks if ISP resizer is busy.
633 * resizer_set_inaddr - Sets the memory address of the input frame.
638 res->addr_base = addr; in resizer_set_inaddr()
641 if (res->crop_offset) in resizer_set_inaddr()
642 addr += res->crop_offset & ~0x1f; in resizer_set_inaddr()
650 * Note: For SBL efficiency reasons the address should be on a 256-byte
666 * resizer_print_status - Prints the values of the resizer module registers.
669 dev_dbg(isp->dev, "###RSZ " #name "=0x%08x\n", \
676 dev_dbg(isp->dev, "-------------Resizer Register dump----------\n"); in resizer_print_status()
689 dev_dbg(isp->dev, "--------------------------------------------\n"); in resizer_print_status()
693 * resizer_calc_ratios - Helper function for calculate resizer ratios
701 * has a fixed number of phases that depend on the resizing ratio. As the ratio
707 * - 8-phase, 4-tap mode (RSZ = 64 ~ 512)
708 * iw = (32 * sph + (ow - 1) * hrsz + 16) >> 8 + 7
709 * ih = (32 * spv + (oh - 1) * vrsz + 16) >> 8 + 4
710 * - 4-phase, 7-tap mode (RSZ = 513 ~ 1024)
711 * iw = (64 * sph + (ow - 1) * hrsz + 32) >> 8 + 7
712 * ih = (64 * spv + (oh - 1) * vrsz + 32) >> 8 + 7
721 * inequality (taking the 4-tap mode width equation as an example)
723 * iw >= (32 * sph + (ow - 1) * hrsz + 16) >> 8 - 7
727 * iw - 7 >= (32 * sph + (ow - 1) * hrsz + 16) >> 8
728 * (iw - 7) << 8 >= 32 * sph + (ow - 1) * hrsz + 16 - b
729 * ((iw - 7) << 8) + b >= 32 * sph + (ow - 1) * hrsz + 16
739 * - 8-phase, 4-tap mode
740 * hrsz = ((iw - 7) * 256 + 255 - 16 - 32 * sph) / (ow - 1)
741 * vrsz = ((ih - 4) * 256 + 255 - 16 - 32 * spv) / (oh - 1)
742 * - 4-phase, 7-tap mode
743 * hrsz = ((iw - 7) * 256 + 255 - 32 - 64 * sph) / (ow - 1)
744 * vrsz = ((ih - 7) * 256 + 255 - 32 - 64 * spv) / (oh - 1)
750 * the ratio, depends on the ratio, we start with the 4-tap mode equations to
751 * compute an approximation of the ratio, and switch to the 7-tap mode equations
754 * As the 7-tap mode equations will return a ratio smaller than or equal to the
755 * 4-tap mode equations, the resulting ratio could become lower than or equal to
758 * 4-tap mode equations ensure that, in case of values resulting in a 'ratio
763 * auto-cropping the input more than required to satisfy the TRM equations. The
764 * minimum output size is achieved with a scaling factor of 1024. It is thus
765 * computed using the 7-tap equations.
767 * min ow = ((iw - 7) * 256 - 32 - 64 * sph) / 1024 + 1
768 * min oh = ((ih - 7) * 256 - 32 - 64 * spv) / 1024 + 1
770 * Similarly, the maximum output size is achieved with a scaling factor of 64
771 * and computed using the 4-tap equations.
773 * max ow = ((iw - 7) * 256 + 255 - 16 - 32 * sph) / 64 + 1
774 * max oh = ((ih - 4) * 256 + 255 - 16 - 32 * spv) / 64 + 1
782 * ratio will thus result in a resizing factor slightly larger than the
816 min_height = ((input->height - 7) * 256 - 32 - 64 * spv) / 1024 + 1; in resizer_calc_ratios()
818 max_height = ((input->height - 4) * 256 + 255 - 16 - 32 * spv) / 64 + 1; in resizer_calc_ratios()
820 output->height = clamp(output->height, min_height, max_height); in resizer_calc_ratios()
822 ratio->vert = ((input->height - 4) * 256 + 255 - 16 - 32 * spv) in resizer_calc_ratios()
823 / (output->height - 1); in resizer_calc_ratios()
824 if (ratio->vert > MID_RESIZE_VALUE) in resizer_calc_ratios()
825 ratio->vert = ((input->height - 7) * 256 + 255 - 32 - 64 * spv) in resizer_calc_ratios()
826 / (output->height - 1); in resizer_calc_ratios()
827 ratio->vert = clamp_t(unsigned int, ratio->vert, in resizer_calc_ratios()
830 if (ratio->vert <= MID_RESIZE_VALUE) { in resizer_calc_ratios()
831 upscaled_height = (output->height - 1) * ratio->vert in resizer_calc_ratios()
835 upscaled_height = (output->height - 1) * ratio->vert in resizer_calc_ratios()
844 min_width = ((input->width - 7) * 256 - 32 - 64 * sph) / 1024 + 1; in resizer_calc_ratios()
847 if (ratio->vert <= MID_RESIZE_VALUE) { in resizer_calc_ratios()
848 switch (isp->revision) { in resizer_calc_ratios()
863 switch (isp->revision) { in resizer_calc_ratios()
878 max_width = min(((input->width - 7) * 256 + 255 - 16 - 32 * sph) / 64 in resizer_calc_ratios()
884 * Take the alignment into account (the maximum width in 7-tap mode on in resizer_calc_ratios()
888 width_alignment = ratio->vert < 256 ? 8 : 2; in resizer_calc_ratios()
889 output->width = clamp(output->width, min_width, in resizer_calc_ratios()
890 max_width & ~(width_alignment - 1)); in resizer_calc_ratios()
891 output->width = ALIGN(output->width, width_alignment); in resizer_calc_ratios()
893 ratio->horz = ((input->width - 7) * 256 + 255 - 16 - 32 * sph) in resizer_calc_ratios()
894 / (output->width - 1); in resizer_calc_ratios()
895 if (ratio->horz > MID_RESIZE_VALUE) in resizer_calc_ratios()
896 ratio->horz = ((input->width - 7) * 256 + 255 - 32 - 64 * sph) in resizer_calc_ratios()
897 / (output->width - 1); in resizer_calc_ratios()
898 ratio->horz = clamp_t(unsigned int, ratio->horz, in resizer_calc_ratios()
901 if (ratio->horz <= MID_RESIZE_VALUE) { in resizer_calc_ratios()
902 upscaled_width = (output->width - 1) * ratio->horz in resizer_calc_ratios()
906 upscaled_width = (output->width - 1) * ratio->horz in resizer_calc_ratios()
912 input->left += (input->width - width) / 2; in resizer_calc_ratios()
913 input->top += (input->height - height) / 2; in resizer_calc_ratios()
914 input->width = width; in resizer_calc_ratios()
915 input->height = height; in resizer_calc_ratios()
919 * resizer_set_crop_params - Setup hardware with cropping parameters
929 resizer_set_ratio(res, &res->ratio); in resizer_set_crop_params()
932 if (res->ratio.horz >= RESIZE_DIVISOR) in resizer_set_crop_params()
939 if (res->input == RESIZER_INPUT_MEMORY) { in resizer_set_crop_params()
941 res->crop_offset = (res->crop.active.top * input->width + in resizer_set_crop_params()
942 res->crop.active.left) * 2; in resizer_set_crop_params()
947 resizer_set_start(res, (res->crop_offset / 2) & 0xf, 0); in resizer_set_crop_params()
954 res->addr_base + (res->crop_offset & ~0x1f)); in resizer_set_crop_params()
961 resizer_set_start(res, res->crop.active.left * 2, in resizer_set_crop_params()
962 res->crop.active.top); in resizer_set_crop_params()
969 resizer_set_input_size(res, res->crop.active.width, in resizer_set_crop_params()
970 res->crop.active.height); in resizer_set_crop_params()
978 resizer_set_source(res, res->input); in resizer_configure()
980 informat = &res->formats[RESZ_PAD_SINK]; in resizer_configure()
981 outformat = &res->formats[RESZ_PAD_SOURCE]; in resizer_configure()
984 if (res->input == RESIZER_INPUT_VP) in resizer_configure()
987 resizer_set_input_offset(res, ALIGN(informat->width, 0x10) * 2); in resizer_configure()
991 resizer_set_ycpos(res, informat->code); in resizer_configure()
996 resizer_set_output_offset(res, ALIGN(outformat->width * 2, 32)); in resizer_configure()
997 resizer_set_output_size(res, outformat->width, outformat->height); in resizer_configure()
1002 /* -----------------------------------------------------------------------------
1022 if (res->state == ISP_PIPELINE_STREAM_CONTINUOUS && in omap3isp_resizer_isr_frame_sync()
1023 res->video_out.dmaqueue_flags & ISP_VIDEO_DMAQUEUE_QUEUED) { in omap3isp_resizer_isr_frame_sync()
1025 isp_video_dmaqueue_flags_clr(&res->video_out); in omap3isp_resizer_isr_frame_sync()
1031 struct isp_pipeline *pipe = to_isp_pipeline(&res->subdev.entity); in resizer_isr_buffer()
1035 if (res->state == ISP_PIPELINE_STREAM_STOPPED) in resizer_isr_buffer()
1041 buffer = omap3isp_video_buffer_next(&res->video_out); in resizer_isr_buffer()
1043 resizer_set_outaddr(res, buffer->isp_addr); in resizer_isr_buffer()
1047 pipe->state |= ISP_PIPELINE_IDLE_OUTPUT; in resizer_isr_buffer()
1049 if (res->input == RESIZER_INPUT_MEMORY) { in resizer_isr_buffer()
1050 buffer = omap3isp_video_buffer_next(&res->video_in); in resizer_isr_buffer()
1052 resizer_set_inaddr(res, buffer->isp_addr); in resizer_isr_buffer()
1053 pipe->state |= ISP_PIPELINE_IDLE_INPUT; in resizer_isr_buffer()
1056 if (res->state == ISP_PIPELINE_STREAM_SINGLESHOT) { in resizer_isr_buffer()
1070 * omap3isp_resizer_isr - ISP resizer interrupt handler
1072 * Manage the resizer video buffers and configure shadowed and busy-locked
1079 if (omap3isp_module_sync_is_stopping(&res->wait, &res->stopping)) in omap3isp_resizer_isr()
1082 if (res->applycrop) { in omap3isp_resizer_isr()
1088 res->applycrop = 0; in omap3isp_resizer_isr()
1094 /* -----------------------------------------------------------------------------
1101 struct isp_res_device *res = &video->isp->isp_res; in resizer_video_queue()
1103 if (video->type == V4L2_BUF_TYPE_VIDEO_OUTPUT) in resizer_video_queue()
1104 resizer_set_inaddr(res, buffer->isp_addr); in resizer_video_queue()
1118 if (video->type == V4L2_BUF_TYPE_VIDEO_CAPTURE) in resizer_video_queue()
1119 resizer_set_outaddr(res, buffer->isp_addr); in resizer_video_queue()
1128 /* -----------------------------------------------------------------------------
1133 * resizer_set_stream - Enable/Disable streaming on resizer subdev
1145 struct isp_video *video_out = &res->video_out; in resizer_set_stream()
1149 if (res->state == ISP_PIPELINE_STREAM_STOPPED) { in resizer_set_stream()
1161 if (video_out->dmaqueue_flags & ISP_VIDEO_DMAQUEUE_QUEUED) { in resizer_set_stream()
1168 if (res->input == RESIZER_INPUT_MEMORY) in resizer_set_stream()
1176 if (omap3isp_module_sync_idle(&sd->entity, &res->wait, in resizer_set_stream()
1177 &res->stopping)) in resizer_set_stream()
1178 dev_dbg(dev, "%s: module stop timeout.\n", sd->name); in resizer_set_stream()
1186 res->state = enable; in resizer_set_stream()
1191 * resizer_g_crop - handle get crop subdev operation
1206 if (crop->pad != RESZ_PAD_SINK) in resizer_g_crop()
1207 return -EINVAL; in resizer_g_crop()
1209 format = __resizer_get_format(res, fh, RESZ_PAD_SOURCE, crop->which); in resizer_g_crop()
1210 crop->rect = *__resizer_get_crop(res, fh, crop->which); in resizer_g_crop()
1211 resizer_calc_ratios(res, &crop->rect, format, &ratio); in resizer_g_crop()
1217 * resizer_try_crop - mangles crop parameters.
1227 * cannot exceed +/-4.0. in resizer_try_crop()
1230 ((32 * sph + (source->width - 1) * 64 + 16) >> 8) + 7; in resizer_try_crop()
1232 ((32 * spv + (source->height - 1) * 64 + 16) >> 8) + 4; in resizer_try_crop()
1234 ((64 * sph + (source->width - 1) * 1024 + 32) >> 8) + 7; in resizer_try_crop()
1236 ((64 * spv + (source->height - 1) * 1024 + 32) >> 8) + 7; in resizer_try_crop()
1238 crop->width = clamp_t(u32, crop->width, min_width, max_width); in resizer_try_crop()
1239 crop->height = clamp_t(u32, crop->height, min_height, max_height); in resizer_try_crop()
1242 crop->left = clamp_t(u32, crop->left, 0, sink->width - MIN_IN_WIDTH); in resizer_try_crop()
1243 crop->width = clamp_t(u32, crop->width, MIN_IN_WIDTH, in resizer_try_crop()
1244 sink->width - crop->left); in resizer_try_crop()
1245 crop->top = clamp_t(u32, crop->top, 0, sink->height - MIN_IN_HEIGHT); in resizer_try_crop()
1246 crop->height = clamp_t(u32, crop->height, MIN_IN_HEIGHT, in resizer_try_crop()
1247 sink->height - crop->top); in resizer_try_crop()
1251 * resizer_s_crop - handle set crop subdev operation
1256 * return -EINVAL or zero when succeed
1267 if (crop->pad != RESZ_PAD_SINK) in resizer_s_crop()
1268 return -EINVAL; in resizer_s_crop()
1271 crop->which); in resizer_s_crop()
1273 crop->which); in resizer_s_crop()
1275 dev_dbg(isp->dev, "%s: L=%d,T=%d,W=%d,H=%d,which=%d\n", __func__, in resizer_s_crop()
1276 crop->rect.left, crop->rect.top, crop->rect.width, in resizer_s_crop()
1277 crop->rect.height, crop->which); in resizer_s_crop()
1279 dev_dbg(isp->dev, "%s: input=%dx%d, output=%dx%d\n", __func__, in resizer_s_crop()
1280 format_sink->width, format_sink->height, in resizer_s_crop()
1281 format_source->width, format_source->height); in resizer_s_crop()
1283 resizer_try_crop(format_sink, format_source, &crop->rect); in resizer_s_crop()
1284 *__resizer_get_crop(res, fh, crop->which) = crop->rect; in resizer_s_crop()
1285 resizer_calc_ratios(res, &crop->rect, format_source, &ratio); in resizer_s_crop()
1287 if (crop->which == V4L2_SUBDEV_FORMAT_TRY) in resizer_s_crop()
1290 res->ratio = ratio; in resizer_s_crop()
1291 res->crop.active = crop->rect; in resizer_s_crop()
1297 if (res->state != ISP_PIPELINE_STREAM_STOPPED) in resizer_s_crop()
1298 res->applycrop = 1; in resizer_s_crop()
1313 if (res->input == RESIZER_INPUT_MEMORY) { in resizer_max_in_width()
1316 if (isp->revision == ISP_REVISION_1_0) in resizer_max_in_width()
1324 * resizer_try_format - Handle try format by pad subdev method
1342 if (fmt->code != V4L2_MBUS_FMT_YUYV8_1X16 && in resizer_try_format()
1343 fmt->code != V4L2_MBUS_FMT_UYVY8_1X16) in resizer_try_format()
1344 fmt->code = V4L2_MBUS_FMT_YUYV8_1X16; in resizer_try_format()
1346 fmt->width = clamp_t(u32, fmt->width, MIN_IN_WIDTH, in resizer_try_format()
1348 fmt->height = clamp_t(u32, fmt->height, MIN_IN_HEIGHT, in resizer_try_format()
1354 fmt->code = format->code; in resizer_try_format()
1361 fmt->colorspace = V4L2_COLORSPACE_JPEG; in resizer_try_format()
1362 fmt->field = V4L2_FIELD_NONE; in resizer_try_format()
1366 * resizer_enum_mbus_code - Handle pixel format enumeration
1370 * return -EINVAL or zero on success
1379 if (code->pad == RESZ_PAD_SINK) { in resizer_enum_mbus_code()
1380 if (code->index >= ARRAY_SIZE(resizer_formats)) in resizer_enum_mbus_code()
1381 return -EINVAL; in resizer_enum_mbus_code()
1383 code->code = resizer_formats[code->index]; in resizer_enum_mbus_code()
1385 if (code->index != 0) in resizer_enum_mbus_code()
1386 return -EINVAL; in resizer_enum_mbus_code()
1390 code->code = format->code; in resizer_enum_mbus_code()
1403 if (fse->index != 0) in resizer_enum_frame_size()
1404 return -EINVAL; in resizer_enum_frame_size()
1406 format.code = fse->code; in resizer_enum_frame_size()
1409 resizer_try_format(res, fh, fse->pad, &format, V4L2_SUBDEV_FORMAT_TRY); in resizer_enum_frame_size()
1410 fse->min_width = format.width; in resizer_enum_frame_size()
1411 fse->min_height = format.height; in resizer_enum_frame_size()
1413 if (format.code != fse->code) in resizer_enum_frame_size()
1414 return -EINVAL; in resizer_enum_frame_size()
1416 format.code = fse->code; in resizer_enum_frame_size()
1417 format.width = -1; in resizer_enum_frame_size()
1418 format.height = -1; in resizer_enum_frame_size()
1419 resizer_try_format(res, fh, fse->pad, &format, V4L2_SUBDEV_FORMAT_TRY); in resizer_enum_frame_size()
1420 fse->max_width = format.width; in resizer_enum_frame_size()
1421 fse->max_height = format.height; in resizer_enum_frame_size()
1427 * resizer_get_format - Handle get format by pads subdev method
1431 * return -EINVAL or zero on success
1439 format = __resizer_get_format(res, fh, fmt->pad, fmt->which); in resizer_get_format()
1441 return -EINVAL; in resizer_get_format()
1443 fmt->format = *format; in resizer_get_format()
1448 * resizer_set_format - Handle set format by pads subdev method
1452 * return -EINVAL or zero on success
1461 format = __resizer_get_format(res, fh, fmt->pad, fmt->which); in resizer_set_format()
1463 return -EINVAL; in resizer_set_format()
1465 resizer_try_format(res, fh, fmt->pad, &fmt->format, fmt->which); in resizer_set_format()
1466 *format = fmt->format; in resizer_set_format()
1468 if (fmt->pad == RESZ_PAD_SINK) { in resizer_set_format()
1470 crop = __resizer_get_crop(res, fh, fmt->which); in resizer_set_format()
1471 crop->left = 0; in resizer_set_format()
1472 crop->top = 0; in resizer_set_format()
1473 crop->width = fmt->format.width; in resizer_set_format()
1474 crop->height = fmt->format.height; in resizer_set_format()
1478 fmt->which); in resizer_set_format()
1479 *format = fmt->format; in resizer_set_format()
1481 fmt->which); in resizer_set_format()
1484 if (fmt->which == V4L2_SUBDEV_FORMAT_ACTIVE) { in resizer_set_format()
1489 res->crop.active = res->crop.request; in resizer_set_format()
1490 resizer_calc_ratios(res, &res->crop.active, format, in resizer_set_format()
1491 &res->ratio); in resizer_set_format()
1498 * resizer_init_formats - Initialize formats on all pads
1548 /* -----------------------------------------------------------------------------
1553 * resizer_link_setup - Setup resizer connections.
1558 * return -EINVAL or zero on success
1567 switch (local->index | media_entity_type(remote->entity)) { in resizer_link_setup()
1571 if (res->input == RESIZER_INPUT_VP) in resizer_link_setup()
1572 return -EBUSY; in resizer_link_setup()
1573 res->input = RESIZER_INPUT_MEMORY; in resizer_link_setup()
1575 if (res->input == RESIZER_INPUT_MEMORY) in resizer_link_setup()
1576 res->input = RESIZER_INPUT_NONE; in resizer_link_setup()
1583 if (res->input == RESIZER_INPUT_MEMORY) in resizer_link_setup()
1584 return -EBUSY; in resizer_link_setup()
1585 res->input = RESIZER_INPUT_VP; in resizer_link_setup()
1587 if (res->input == RESIZER_INPUT_VP) in resizer_link_setup()
1588 res->input = RESIZER_INPUT_NONE; in resizer_link_setup()
1597 return -EINVAL; in resizer_link_setup()
1610 v4l2_device_unregister_subdev(&res->subdev); in omap3isp_resizer_unregister_entities()
1611 omap3isp_video_unregister(&res->video_in); in omap3isp_resizer_unregister_entities()
1612 omap3isp_video_unregister(&res->video_out); in omap3isp_resizer_unregister_entities()
1621 ret = v4l2_device_register_subdev(vdev, &res->subdev); in omap3isp_resizer_register_entities()
1625 ret = omap3isp_video_register(&res->video_in, vdev); in omap3isp_resizer_register_entities()
1629 ret = omap3isp_video_register(&res->video_out, vdev); in omap3isp_resizer_register_entities()
1640 /* -----------------------------------------------------------------------------
1645 * resizer_init_entities - Initialize resizer subdev and media entity.
1647 * return -ENOMEM or zero on success
1651 struct v4l2_subdev *sd = &res->subdev; in resizer_init_entities()
1652 struct media_pad *pads = res->pads; in resizer_init_entities()
1653 struct media_entity *me = &sd->entity; in resizer_init_entities()
1656 res->input = RESIZER_INPUT_NONE; in resizer_init_entities()
1659 sd->internal_ops = &resizer_v4l2_internal_ops; in resizer_init_entities()
1660 strlcpy(sd->name, "OMAP3 ISP resizer", sizeof(sd->name)); in resizer_init_entities()
1661 sd->grp_id = 1 << 16; /* group ID for isp subdevs */ in resizer_init_entities()
1663 sd->flags |= V4L2_SUBDEV_FL_HAS_DEVNODE; in resizer_init_entities()
1668 me->ops = &resizer_media_ops; in resizer_init_entities()
1675 res->video_in.type = V4L2_BUF_TYPE_VIDEO_OUTPUT; in resizer_init_entities()
1676 res->video_in.ops = &resizer_video_ops; in resizer_init_entities()
1677 res->video_in.isp = to_isp_device(res); in resizer_init_entities()
1678 res->video_in.capture_mem = PAGE_ALIGN(4096 * 4096) * 2 * 3; in resizer_init_entities()
1679 res->video_in.bpl_alignment = 32; in resizer_init_entities()
1680 res->video_out.type = V4L2_BUF_TYPE_VIDEO_CAPTURE; in resizer_init_entities()
1681 res->video_out.ops = &resizer_video_ops; in resizer_init_entities()
1682 res->video_out.isp = to_isp_device(res); in resizer_init_entities()
1683 res->video_out.capture_mem = PAGE_ALIGN(4096 * 4096) * 2 * 3; in resizer_init_entities()
1684 res->video_out.bpl_alignment = 32; in resizer_init_entities()
1686 ret = omap3isp_video_init(&res->video_in, "resizer"); in resizer_init_entities()
1690 ret = omap3isp_video_init(&res->video_out, "resizer"); in resizer_init_entities()
1695 ret = media_entity_create_link(&res->video_in.video.entity, 0, in resizer_init_entities()
1696 &res->subdev.entity, RESZ_PAD_SINK, 0); in resizer_init_entities()
1700 ret = media_entity_create_link(&res->subdev.entity, RESZ_PAD_SOURCE, in resizer_init_entities()
1701 &res->video_out.video.entity, 0, 0); in resizer_init_entities()
1708 omap3isp_video_cleanup(&res->video_out); in resizer_init_entities()
1710 omap3isp_video_cleanup(&res->video_in); in resizer_init_entities()
1712 media_entity_cleanup(&res->subdev.entity); in resizer_init_entities()
1717 * isp_resizer_init - Resizer initialization.
1719 * return -ENOMEM or zero on success
1723 struct isp_res_device *res = &isp->isp_res; in omap3isp_resizer_init()
1725 init_waitqueue_head(&res->wait); in omap3isp_resizer_init()
1726 atomic_set(&res->stopping, 0); in omap3isp_resizer_init()
1732 struct isp_res_device *res = &isp->isp_res; in omap3isp_resizer_cleanup()
1734 omap3isp_video_cleanup(&res->video_in); in omap3isp_resizer_cleanup()
1735 omap3isp_video_cleanup(&res->video_out); in omap3isp_resizer_cleanup()
1736 media_entity_cleanup(&res->subdev.entity); in omap3isp_resizer_cleanup()