drivers/media/platform/ti/omap3isp/ispresizer.c
Source file repositories/reference/linux-study-clean/drivers/media/platform/ti/omap3isp/ispresizer.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/media/platform/ti/omap3isp/ispresizer.c- Extension
.c- Size
- 55447 bytes
- Lines
- 1802
- Domain
- Driver Families
- Bucket
- drivers/media
- Inferred role
- Driver Families: implementation source
- Status
- source implementation candidate
Why This File Exists
Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
- Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
- Uses kernel synchronization; read lock ordering, sleepability, and interrupt context assumptions before translating.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/device.hlinux/mm.hlinux/module.hisp.hispreg.hispresizer.h
Detected Declarations
function __resizer_get_formatfunction __resizer_get_cropfunction resizer_set_filtersfunction resizer_set_bilinearfunction resizer_set_ycposfunction resizer_set_phasefunction resizer_set_lumafunction resizer_set_sourcefunction resizer_set_ratiofunction resizer_set_output_sizefunction resizer_set_output_offsetfunction resizer_set_startfunction resizer_set_input_sizefunction resizer_set_input_offsetfunction resizer_set_intypefunction __resizer_set_inaddrfunction overflowsfunction flyfunction omap3isp_resizer_busyfunction resizer_set_inaddrfunction resizer_set_outaddrfunction isp_reg_readlfunction inequalityfunction resizer_set_crop_paramsfunction resizer_configurefunction resizer_enable_oneshotfunction omap3isp_resizer_isr_frame_syncfunction resizer_isr_bufferfunction omap3isp_resizer_isrfunction resizer_video_queuefunction resizer_video_queuefunction resizer_try_cropfunction resizer_get_selectionfunction resizer_set_selectionfunction resizer_max_in_widthfunction resizer_try_formatfunction resizer_enum_mbus_codefunction resizer_enum_frame_sizefunction resizer_get_formatfunction resizer_set_formatfunction resizer_link_validatefunction resizer_init_formatsfunction resizer_link_setupfunction omap3isp_resizer_unregister_entitiesfunction omap3isp_resizer_register_entitiesfunction resizer_init_entitiesfunction omap3isp_resizer_initfunction omap3isp_resizer_cleanup
Annotated Snippet
switch (isp->revision) {
case ISP_REVISION_1_0:
max_width = MAX_4TAP_OUT_WIDTH_ES1;
break;
case ISP_REVISION_2_0:
default:
max_width = MAX_4TAP_OUT_WIDTH_ES2;
break;
case ISP_REVISION_15_0:
max_width = MAX_4TAP_OUT_WIDTH_3630;
break;
}
} else {
switch (isp->revision) {
case ISP_REVISION_1_0:
max_width = MAX_7TAP_OUT_WIDTH_ES1;
break;
case ISP_REVISION_2_0:
default:
max_width = MAX_7TAP_OUT_WIDTH_ES2;
break;
case ISP_REVISION_15_0:
max_width = MAX_7TAP_OUT_WIDTH_3630;
break;
}
}
max_width = min(((input->width - 7) * 256 + 255 - 16 - 32 * sph) / 64
+ 1, max_width);
/*
* The output width must be even, and must be a multiple of 16 bytes
* when upscaling vertically. Clamp the output width to the valid range.
* Take the alignment into account (the maximum width in 7-tap mode on
* ES2 isn't a multiple of 8) and align the result up to make sure it
* won't be smaller than the minimum.
*/
width_alignment = ratio->vert < 256 ? 8 : 2;
output->width = clamp(output->width, min_width,
max_width & ~(width_alignment - 1));
output->width = ALIGN(output->width, width_alignment);
ratio->horz = ((input->width - 7) * 256 + 255 - 16 - 32 * sph)
/ (output->width - 1);
if (ratio->horz > MID_RESIZE_VALUE)
ratio->horz = ((input->width - 7) * 256 + 255 - 32 - 64 * sph)
/ (output->width - 1);
ratio->horz = clamp_t(unsigned int, ratio->horz,
MIN_RESIZE_VALUE, MAX_RESIZE_VALUE);
if (ratio->horz <= MID_RESIZE_VALUE) {
upscaled_width = (output->width - 1) * ratio->horz
+ 32 * sph + 16;
width = (upscaled_width >> 8) + 7;
} else {
upscaled_width = (output->width - 1) * ratio->horz
+ 64 * sph + 32;
width = (upscaled_width >> 8) + 7;
}
/* Center the new crop rectangle. */
input->left += (input->width - width) / 2;
input->top += (input->height - height) / 2;
input->width = width;
input->height = height;
}
/*
* resizer_set_crop_params - Setup hardware with cropping parameters
* @res : resizer private structure
* @input : format on sink pad
* @output : format on source pad
* return none
*/
static void resizer_set_crop_params(struct isp_res_device *res,
const struct v4l2_mbus_framefmt *input,
const struct v4l2_mbus_framefmt *output)
{
resizer_set_ratio(res, &res->ratio);
/* Set chrominance horizontal algorithm */
if (res->ratio.horz >= RESIZE_DIVISOR)
resizer_set_bilinear(res, RSZ_THE_SAME);
else
resizer_set_bilinear(res, RSZ_BILINEAR);
resizer_adjust_bandwidth(res);
Annotation
- Immediate include surface: `linux/device.h`, `linux/mm.h`, `linux/module.h`, `isp.h`, `ispreg.h`, `ispresizer.h`.
- Detected declarations: `function __resizer_get_format`, `function __resizer_get_crop`, `function resizer_set_filters`, `function resizer_set_bilinear`, `function resizer_set_ycpos`, `function resizer_set_phase`, `function resizer_set_luma`, `function resizer_set_source`, `function resizer_set_ratio`, `function resizer_set_output_size`.
- Atlas domain: Driver Families / drivers/media.
- Implementation status: source implementation candidate.
- Synchronization appears in or near this file; preserve lock ordering, sleepability, and interrupt-context constraints.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.