linux/drivers/media/platform/rockchip/rkisp1/rkisp1-isp.c

// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
/*
 * Rockchip ISP1 Driver - ISP Subdevice
 *
 * Copyright (C) 2019 Collabora, Ltd.
 *
 * Based on Rockchip ISP1 driver by Rockchip Electronics Co., Ltd.
 * Copyright (C) 2017 Rockchip Electronics Co., Ltd.
 */

#include <linux/iopoll.h>
#include <linux/pm_runtime.h>
#include <linux/regmap.h>
#include <linux/videodev2.h>
#include <linux/vmalloc.h>

#include <media/v4l2-event.h>

#include "rkisp1-common.h"

#define RKISP1_DEF_SINK_PAD_FMT
#define RKISP1_DEF_SRC_PAD_FMT

#define RKISP1_ISP_DEV_NAME

/*
 * NOTE: MIPI controller and input MUX are also configured in this file.
 * This is because ISP Subdev describes not only ISP submodule (input size,
 * format, output size, format), but also a virtual route device.
 */

/*
 * There are many variables named with format/frame in below code,
 * please see here for their meaning.
 * Cropping in the sink pad defines the image region from the sensor.
 * Cropping in the source pad defines the region for the Image Stabilizer (IS)
 *
 * Cropping regions of ISP
 *
 * +---------------------------------------------------------+
 * | Sensor image                                            |
 * | +---------------------------------------------------+   |
 * | | CIF_ISP_ACQ (for black level)                     |   |
 * | | sink pad format                                   |   |
 * | | +--------------------------------------------+    |   |
 * | | |    CIF_ISP_OUT                             |    |   |
 * | | |    sink pad crop                           |    |   |
 * | | |    +---------------------------------+     |    |   |
 * | | |    |   CIF_ISP_IS                    |     |    |   |
 * | | |    |   source pad crop and format    |     |    |   |
 * | | |    +---------------------------------+     |    |   |
 * | | +--------------------------------------------+    |   |
 * | +---------------------------------------------------+   |
 * +---------------------------------------------------------+
 */

/* -----------------------------------------------------------------------------
 * Media block control (i.MX8MP only)
 */

#define ISP_DEWARP_CONTROL

#define ISP_DEWARP_CONTROL_MIPI_CSI2_HS_POLARITY
#define ISP_DEWARP_CONTROL_MIPI_CSI2_VS_SEL_RISING
#define ISP_DEWARP_CONTROL_MIPI_CSI2_VS_SEL_NEGATIVE
#define ISP_DEWARP_CONTROL_MIPI_CSI2_VS_SEL_POSITIVE
#define ISP_DEWARP_CONTROL_MIPI_CSI2_VS_SEL_FALLING
#define ISP_DEWARP_CONTROL_MIPI_CSI2_VS_SEL_MASK
#define ISP_DEWARP_CONTROL_MIPI_ISP2_LEFT_JUST_MODE
#define ISP_DEWARP_CONTROL_MIPI_ISP2_DATA_TYPE(dt)
#define ISP_DEWARP_CONTROL_MIPI_ISP2_DATA_TYPE_MASK

#define ISP_DEWARP_CONTROL_MIPI_CSI1_HS_POLARITY
#define ISP_DEWARP_CONTROL_MIPI_CSI1_VS_SEL_RISING
#define ISP_DEWARP_CONTROL_MIPI_CSI1_VS_SEL_NEGATIVE
#define ISP_DEWARP_CONTROL_MIPI_CSI1_VS_SEL_POSITIVE
#define ISP_DEWARP_CONTROL_MIPI_CSI1_VS_SEL_FALLING
#define ISP_DEWARP_CONTROL_MIPI_CSI1_VS_SEL_MASK
#define ISP_DEWARP_CONTROL_MIPI_ISP1_LEFT_JUST_MODE
#define ISP_DEWARP_CONTROL_MIPI_ISP1_DATA_TYPE(dt)
#define ISP_DEWARP_CONTROL_MIPI_ISP1_DATA_TYPE_MASK

#define ISP_DEWARP_CONTROL_GPR_ISP_1_DISABLE
#define ISP_DEWARP_CONTROL_GPR_ISP_0_DISABLE

static int rkisp1_gasket_enable(struct rkisp1_device *rkisp1,
				struct media_pad *source)
{}

static void rkisp1_gasket_disable(struct rkisp1_device *rkisp1)
{}

/* ----------------------------------------------------------------------------
 * Camera Interface registers configurations
 */

/*
 * Image Stabilization.
 * This should only be called when configuring CIF
 * or at the frame end interrupt
 */
static void rkisp1_config_ism(struct rkisp1_isp *isp,
			      const struct v4l2_subdev_state *sd_state)
{}

/*
 * configure ISP blocks with input format, size......
 */
static int rkisp1_config_isp(struct rkisp1_isp *isp,
			     const struct v4l2_subdev_state *sd_state,
			     enum v4l2_mbus_type mbus_type, u32 mbus_flags)
{}

/* Configure MUX */
static void rkisp1_config_path(struct rkisp1_isp *isp,
			       enum v4l2_mbus_type mbus_type)
{}

/* Hardware configure Entry */
static int rkisp1_config_cif(struct rkisp1_isp *isp,
			     struct v4l2_subdev_state *sd_state,
			     enum v4l2_mbus_type mbus_type, u32 mbus_flags)
{}

static void rkisp1_isp_stop(struct rkisp1_isp *isp)
{}

static void rkisp1_config_clk(struct rkisp1_isp *isp)
{}

static int rkisp1_isp_start(struct rkisp1_isp *isp,
			    const struct v4l2_subdev_state *sd_state,
			    struct media_pad *source)
{}

/* ----------------------------------------------------------------------------
 * Subdev pad operations
 */

static inline struct rkisp1_isp *to_rkisp1_isp(struct v4l2_subdev *sd)
{}

static int rkisp1_isp_enum_mbus_code(struct v4l2_subdev *sd,
				     struct v4l2_subdev_state *sd_state,
				     struct v4l2_subdev_mbus_code_enum *code)
{}

static int rkisp1_isp_enum_frame_size(struct v4l2_subdev *sd,
				      struct v4l2_subdev_state *sd_state,
				      struct v4l2_subdev_frame_size_enum *fse)
{}

static int rkisp1_isp_init_state(struct v4l2_subdev *sd,
				 struct v4l2_subdev_state *sd_state)
{}

static void rkisp1_isp_set_src_fmt(struct rkisp1_isp *isp,
				   struct v4l2_subdev_state *sd_state,
				   struct v4l2_mbus_framefmt *format)
{}

static void rkisp1_isp_set_src_crop(struct rkisp1_isp *isp,
				    struct v4l2_subdev_state *sd_state,
				    struct v4l2_rect *r)
{}

static void rkisp1_isp_set_sink_crop(struct rkisp1_isp *isp,
				     struct v4l2_subdev_state *sd_state,
				     struct v4l2_rect *r)
{}

static void rkisp1_isp_set_sink_fmt(struct rkisp1_isp *isp,
				    struct v4l2_subdev_state *sd_state,
				    struct v4l2_mbus_framefmt *format)
{}

static int rkisp1_isp_set_fmt(struct v4l2_subdev *sd,
			      struct v4l2_subdev_state *sd_state,
			      struct v4l2_subdev_format *fmt)
{}

static int rkisp1_isp_get_selection(struct v4l2_subdev *sd,
				    struct v4l2_subdev_state *sd_state,
				    struct v4l2_subdev_selection *sel)
{}

static int rkisp1_isp_set_selection(struct v4l2_subdev *sd,
				    struct v4l2_subdev_state *sd_state,
				    struct v4l2_subdev_selection *sel)
{}

static int rkisp1_subdev_link_validate(struct media_link *link)
{}

static const struct v4l2_subdev_pad_ops rkisp1_isp_pad_ops =;

/* ----------------------------------------------------------------------------
 * Stream operations
 */

static int rkisp1_isp_s_stream(struct v4l2_subdev *sd, int enable)
{}

static int rkisp1_isp_subs_evt(struct v4l2_subdev *sd, struct v4l2_fh *fh,
			       struct v4l2_event_subscription *sub)
{}

static const struct media_entity_operations rkisp1_isp_media_ops =;

static const struct v4l2_subdev_video_ops rkisp1_isp_video_ops =;

static const struct v4l2_subdev_core_ops rkisp1_isp_core_ops =;

static const struct v4l2_subdev_ops rkisp1_isp_ops =;

static const struct v4l2_subdev_internal_ops rkisp1_isp_internal_ops =;

int rkisp1_isp_register(struct rkisp1_device *rkisp1)
{}

void rkisp1_isp_unregister(struct rkisp1_device *rkisp1)
{}

/* ----------------------------------------------------------------------------
 * Interrupt handlers
 */

static void rkisp1_isp_queue_event_sof(struct rkisp1_isp *isp)
{}

irqreturn_t rkisp1_isp_isr(int irq, void *ctx)
{}