1 // SPDX-License-Identifier: (GPL-2.0+ OR MIT)
3 * Rockchip ISP1 Driver - Common definitions
5 * Copyright (C) 2019 Collabora, Ltd.
8 #include <media/v4l2-rect.h>
10 #include "rkisp1-common.h"
12 static const struct v4l2_rect rkisp1_sd_min_crop
= {
13 .width
= RKISP1_ISP_MIN_WIDTH
,
14 .height
= RKISP1_ISP_MIN_HEIGHT
,
19 void rkisp1_sd_adjust_crop_rect(struct v4l2_rect
*crop
,
20 const struct v4l2_rect
*bounds
)
22 v4l2_rect_set_min_size(crop
, &rkisp1_sd_min_crop
);
23 v4l2_rect_map_inside(crop
, bounds
);
26 void rkisp1_sd_adjust_crop(struct v4l2_rect
*crop
,
27 const struct v4l2_mbus_framefmt
*bounds
)
29 struct v4l2_rect crop_bounds
= {
32 .width
= bounds
->width
,
33 .height
= bounds
->height
,
36 rkisp1_sd_adjust_crop_rect(crop
, &crop_bounds
);