rkisp1-common.c (799B)
1// SPDX-License-Identifier: (GPL-2.0+ OR MIT) 2/* 3 * Rockchip ISP1 Driver - Common definitions 4 * 5 * Copyright (C) 2019 Collabora, Ltd. 6 */ 7 8#include <media/v4l2-rect.h> 9 10#include "rkisp1-common.h" 11 12static const struct v4l2_rect rkisp1_sd_min_crop = { 13 .width = RKISP1_ISP_MIN_WIDTH, 14 .height = RKISP1_ISP_MIN_HEIGHT, 15 .top = 0, 16 .left = 0, 17}; 18 19void rkisp1_sd_adjust_crop_rect(struct v4l2_rect *crop, 20 const struct v4l2_rect *bounds) 21{ 22 v4l2_rect_set_min_size(crop, &rkisp1_sd_min_crop); 23 v4l2_rect_map_inside(crop, bounds); 24} 25 26void rkisp1_sd_adjust_crop(struct v4l2_rect *crop, 27 const struct v4l2_mbus_framefmt *bounds) 28{ 29 struct v4l2_rect crop_bounds = { 30 .left = 0, 31 .top = 0, 32 .width = bounds->width, 33 .height = bounds->height, 34 }; 35 36 rkisp1_sd_adjust_crop_rect(crop, &crop_bounds); 37}