Commit d65dd852 authored by Helen Koike's avatar Helen Koike Committed by Mauro Carvalho Chehab
Browse files

media: staging: rkisp1: add Rockchip ISP1 base driver



Add base driver for Rockchip Image Signal Processing v1 Unit, with isp
subdevice and sensor biddings.

[fixed compilation and run time errors regarding new v4l2 async API]

Signed-off-by: default avatarJacob Chen <jacob2.chen@rock-chips.com>
Signed-off-by: default avatarShunqian Zheng <zhengsq@rock-chips.com>
Signed-off-by: default avatarYichong Zhong <zyc@rock-chips.com>
Signed-off-by: default avatarJacob Chen <cc@rock-chips.com>
Signed-off-by: default avatarEddie Cai <eddie.cai.linux@gmail.com>
Signed-off-by: default avatarJeffy Chen <jeffy.chen@rock-chips.com>
Signed-off-by: default avatarAllon Huang <allon.huang@rock-chips.com>
Signed-off-by: default avatarTomasz Figa <tfiga@chromium.org>
Signed-off-by: default avatarLaurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: default avatarEzequiel Garcia <ezequiel@collabora.com>
Signed-off-by: default avatarHelen Koike <helen.koike@collabora.com>
Signed-off-by: default avatarHans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab+huawei@kernel.org>
parent 32abcc44
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -40,4 +40,6 @@ source "drivers/staging/media/soc_camera/Kconfig"

source "drivers/staging/media/phy-rockchip-dphy-rx0/Kconfig"

source "drivers/staging/media/rkisp1/Kconfig"

endif
+1 −0
Original line number Diff line number Diff line
@@ -9,3 +9,4 @@ obj-$(CONFIG_VIDEO_HANTRO) += hantro/
obj-$(CONFIG_VIDEO_IPU3_IMGU)	+= ipu3/
obj-$(CONFIG_SOC_CAMERA)	+= soc_camera/
obj-$(CONFIG_PHY_ROCKCHIP_DPHY_RX0)	+= phy-rockchip-dphy-rx0/
obj-$(CONFIG_VIDEO_ROCKCHIP_ISP1)	+= rkisp1/
+17 −0
Original line number Diff line number Diff line
# SPDX-License-Identifier: GPL-2.0-only

config VIDEO_ROCKCHIP_ISP1
	tristate "Rockchip Image Signal Processing v1 Unit driver"
	depends on VIDEO_V4L2 && VIDEO_V4L2_SUBDEV_API
	depends on ARCH_ROCKCHIP || COMPILE_TEST
	select VIDEOBUF2_DMA_CONTIG
	select VIDEOBUF2_VMALLOC
	select V4L2_FWNODE
	select PHY_ROCKCHIP_DPHY_RX0
	default n
	help
	  Enable this to support the Image Signal Processing (ISP) module
	  present in RK3399 SoCs.

	  To compile this driver as a module, choose M here: the module
	  will be called rockchip-isp1.
+4 −0
Original line number Diff line number Diff line
obj-$(CONFIG_VIDEO_ROCKCHIP_ISP1) += rockchip-isp1.o
rockchip-isp1-objs += 	rkisp1-common.o \
			rkisp1-dev.o \
			rkisp1-isp.o
+37 −0
Original line number Diff line number Diff line
// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
/*
 * Rockchip ISP1 Driver - Common definitions
 *
 * Copyright (C) 2019 Collabora, Ltd.
 */

#include <media/v4l2-rect.h>

#include "rkisp1-common.h"

static const struct v4l2_rect rkisp1_sd_min_crop = {
	.width = RKISP1_ISP_MIN_WIDTH,
	.height = RKISP1_ISP_MIN_HEIGHT,
	.top = 0,
	.left = 0,
};

void rkisp1_sd_adjust_crop_rect(struct v4l2_rect *crop,
				const struct v4l2_rect *bounds)
{
	v4l2_rect_set_min_size(crop, &rkisp1_sd_min_crop);
	v4l2_rect_map_inside(crop, bounds);
}

void rkisp1_sd_adjust_crop(struct v4l2_rect *crop,
			   const struct v4l2_mbus_framefmt *bounds)
{
	struct v4l2_rect crop_bounds = {
		.left = 0,
		.top = 0,
		.width = bounds->width,
		.height = bounds->height,
	};

	rkisp1_sd_adjust_crop_rect(crop, &crop_bounds);
}
Loading