linux/drivers/staging/media/imx/imx-ic-prpencvf.c

// SPDX-License-Identifier: GPL-2.0+
/*
 * V4L2 Capture IC Preprocess Subdev for Freescale i.MX5/6 SOC
 *
 * This subdevice handles capture of video frames from the CSI or VDIC,
 * which are routed directly to the Image Converter preprocess tasks,
 * for resizing, colorspace conversion, and rotation.
 *
 * Copyright (c) 2012-2017 Mentor Graphics Inc.
 */
#include <linux/delay.h>
#include <linux/interrupt.h>
#include <linux/module.h>
#include <linux/sched.h>
#include <linux/slab.h>
#include <linux/spinlock.h>
#include <linux/timer.h>
#include <media/v4l2-ctrls.h>
#include <media/v4l2-device.h>
#include <media/v4l2-ioctl.h>
#include <media/v4l2-mc.h>
#include <media/v4l2-subdev.h>
#include <media/imx.h>
#include "imx-media.h"
#include "imx-ic.h"

/*
 * Min/Max supported width and heights.
 *
 * We allow planar output, so we have to align width at the source pad
 * by 16 pixels to meet IDMAC alignment requirements for possible planar
 * output.
 *
 * TODO: move this into pad format negotiation, if capture device
 * has not requested a planar format, we should allow 8 pixel
 * alignment at the source pad.
 */
#define MIN_W_SINK
#define MIN_H_SINK
#define MAX_W_SINK
#define MAX_H_SINK
#define W_ALIGN_SINK
#define H_ALIGN_SINK

#define MAX_W_SRC
#define MAX_H_SRC
#define W_ALIGN_SRC
#define H_ALIGN_SRC

#define S_ALIGN

struct prp_priv {};

static const struct prp_channels {} prp_channel[] =;

static inline struct prp_priv *sd_to_priv(struct v4l2_subdev *sd)
{}

static void prp_put_ipu_resources(struct prp_priv *priv)
{}

static int prp_get_ipu_resources(struct prp_priv *priv)
{}

static void prp_vb2_buf_done(struct prp_priv *priv, struct ipuv3_channel *ch)
{}

static irqreturn_t prp_eof_interrupt(int irq, void *dev_id)
{}

static irqreturn_t prp_nfb4eof_interrupt(int irq, void *dev_id)
{}

/*
 * EOF timeout timer function.
 */
/*
 * EOF timeout timer function. This is an unrecoverable condition
 * without a stream restart.
 */
static void prp_eof_timeout(struct timer_list *t)
{}

static void prp_setup_vb2_buf(struct prp_priv *priv, dma_addr_t *phys)
{}

static void prp_unsetup_vb2_buf(struct prp_priv *priv,
				enum vb2_buffer_state return_status)
{}

static int prp_setup_channel(struct prp_priv *priv,
			     struct ipuv3_channel *channel,
			     enum ipu_rotate_mode rot_mode,
			     dma_addr_t addr0, dma_addr_t addr1,
			     bool rot_swap_width_height)
{}

static int prp_setup_rotation(struct prp_priv *priv)
{}

static void prp_unsetup_rotation(struct prp_priv *priv)
{}

static int prp_setup_norotation(struct prp_priv *priv)
{}

static void prp_unsetup_norotation(struct prp_priv *priv)
{}

static void prp_unsetup(struct prp_priv *priv,
			enum vb2_buffer_state state)
{}

static int prp_start(struct prp_priv *priv)
{}

static void prp_stop(struct prp_priv *priv)
{}

static struct v4l2_mbus_framefmt *
__prp_get_fmt(struct prp_priv *priv, struct v4l2_subdev_state *sd_state,
	      unsigned int pad, enum v4l2_subdev_format_whence which)
{}

/*
 * Applies IC resizer and IDMAC alignment restrictions to output
 * rectangle given the input rectangle, and depending on given
 * rotation mode.
 *
 * The IC resizer cannot downsize more than 4:1. Note also that
 * for 90 or 270 rotation, _both_ output width and height must
 * be aligned by W_ALIGN_SRC, because the intermediate rotation
 * buffer swaps output width/height, and the final output buffer
 * does not.
 *
 * Returns true if the output rectangle was modified.
 */
static bool prp_bound_align_output(struct v4l2_mbus_framefmt *outfmt,
				   struct v4l2_mbus_framefmt *infmt,
				   enum ipu_rotate_mode rot_mode)
{}

/*
 * V4L2 subdev operations.
 */

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

static int prp_get_fmt(struct v4l2_subdev *sd,
		       struct v4l2_subdev_state *sd_state,
		       struct v4l2_subdev_format *sdformat)
{}

static void prp_try_fmt(struct prp_priv *priv,
			struct v4l2_subdev_state *sd_state,
			struct v4l2_subdev_format *sdformat,
			const struct imx_media_pixfmt **cc)
{}

static int prp_set_fmt(struct v4l2_subdev *sd,
		       struct v4l2_subdev_state *sd_state,
		       struct v4l2_subdev_format *sdformat)
{}

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

static int prp_link_setup(struct media_entity *entity,
			  const struct media_pad *local,
			  const struct media_pad *remote, u32 flags)
{}

static int prp_s_ctrl(struct v4l2_ctrl *ctrl)
{}

static const struct v4l2_ctrl_ops prp_ctrl_ops =;

static int prp_init_controls(struct prp_priv *priv)
{}

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

static int prp_get_frame_interval(struct v4l2_subdev *sd,
				  struct v4l2_subdev_state *sd_state,
				  struct v4l2_subdev_frame_interval *fi)
{}

static int prp_set_frame_interval(struct v4l2_subdev *sd,
				  struct v4l2_subdev_state *sd_state,
				  struct v4l2_subdev_frame_interval *fi)
{}

static int prp_registered(struct v4l2_subdev *sd)
{}

static void prp_unregistered(struct v4l2_subdev *sd)
{}

static const struct v4l2_subdev_pad_ops prp_pad_ops =;

static const struct v4l2_subdev_video_ops prp_video_ops =;

static const struct media_entity_operations prp_entity_ops =;

static const struct v4l2_subdev_ops prp_subdev_ops =;

static const struct v4l2_subdev_internal_ops prp_internal_ops =;

static int prp_init(struct imx_ic_priv *ic_priv)
{}

static void prp_remove(struct imx_ic_priv *ic_priv)
{}

struct imx_ic_ops imx_ic_prpencvf_ops =;