linux/drivers/media/platform/samsung/exynos4-is/fimc-capture.c

// SPDX-License-Identifier: GPL-2.0-only
/*
 * Samsung S5P/EXYNOS4 SoC series camera interface (camera capture) driver
 *
 * Copyright (C) 2010 - 2012 Samsung Electronics Co., Ltd.
 * Sylwester Nawrocki <[email protected]>
 */

#include <linux/module.h>
#include <linux/kernel.h>
#include <linux/types.h>
#include <linux/errno.h>
#include <linux/bug.h>
#include <linux/interrupt.h>
#include <linux/device.h>
#include <linux/pm_runtime.h>
#include <linux/list.h>
#include <linux/slab.h>

#include <linux/videodev2.h>
#include <media/v4l2-device.h>
#include <media/v4l2-ioctl.h>
#include <media/v4l2-mem2mem.h>
#include <media/v4l2-rect.h>
#include <media/videobuf2-v4l2.h>
#include <media/videobuf2-dma-contig.h>

#include "common.h"
#include "fimc-core.h"
#include "fimc-reg.h"
#include "media-dev.h"

static int fimc_capture_hw_init(struct fimc_dev *fimc)
{}

/*
 * Reinitialize the driver so it is ready to start the streaming again.
 * Set fimc->state to indicate stream off and the hardware shut down state.
 * If not suspending (@suspend is false), return any buffers to videobuf2.
 * Otherwise put any owned buffers onto the pending buffers queue, so they
 * can be re-spun when the device is being resumed. Also perform FIMC
 * software reset and disable streaming on the whole pipeline if required.
 */
static int fimc_capture_state_cleanup(struct fimc_dev *fimc, bool suspend)
{}

static int fimc_stop_capture(struct fimc_dev *fimc, bool suspend)
{}

/**
 * fimc_capture_config_update - apply the camera interface configuration
 * @ctx: FIMC capture context
 *
 * To be called from within the interrupt handler with fimc.slock
 * spinlock held. It updates the camera pixel crop, rotation and
 * image flip in H/W.
 */
static int fimc_capture_config_update(struct fimc_ctx *ctx)
{}

void fimc_capture_irq_handler(struct fimc_dev *fimc, int deq_buf)
{}


static int start_streaming(struct vb2_queue *q, unsigned int count)
{}

static void stop_streaming(struct vb2_queue *q)
{}

int fimc_capture_suspend(struct fimc_dev *fimc)
{}

static void buffer_queue(struct vb2_buffer *vb);

int fimc_capture_resume(struct fimc_dev *fimc)
{}

static int queue_setup(struct vb2_queue *vq,
		       unsigned int *num_buffers, unsigned int *num_planes,
		       unsigned int sizes[], struct device *alloc_devs[])
{}

static int buffer_prepare(struct vb2_buffer *vb)
{}

static void buffer_queue(struct vb2_buffer *vb)
{}

static const struct vb2_ops fimc_capture_qops =;

static int fimc_capture_set_default_format(struct fimc_dev *fimc);

static int fimc_capture_open(struct file *file)
{}

static int fimc_capture_release(struct file *file)
{}

static const struct v4l2_file_operations fimc_capture_fops =;

/*
 * Format and crop negotiation helpers
 */

static const struct fimc_fmt *fimc_capture_try_format(struct fimc_ctx *ctx,
						      u32 *width, u32 *height,
						      u32 *code, u32 *fourcc, int pad)
{}

static void fimc_capture_try_selection(struct fimc_ctx *ctx,
				       struct v4l2_rect *r,
				       int target)
{}

/*
 * The video node ioctl operations
 */
static int fimc_cap_querycap(struct file *file, void *priv,
					struct v4l2_capability *cap)
{}

static int fimc_cap_enum_fmt(struct file *file, void *priv,
			     struct v4l2_fmtdesc *f)
{}

static struct media_entity *fimc_pipeline_get_head(struct media_entity *me)
{}

/**
 * fimc_pipeline_try_format - negotiate and/or set formats at pipeline
 *                            elements
 * @ctx: FIMC capture context
 * @tfmt: media bus format to try/set on subdevs
 * @fmt_id: fimc pixel format id corresponding to returned @tfmt (output)
 * @set: true to set format on subdevs, false to try only
 */
static int fimc_pipeline_try_format(struct fimc_ctx *ctx,
				    struct v4l2_mbus_framefmt *tfmt,
				    const struct fimc_fmt **fmt_id,
				    bool set)
{}

/**
 * fimc_get_sensor_frame_desc - query the sensor for media bus frame parameters
 * @sensor: pointer to the sensor subdev
 * @plane_fmt: provides plane sizes corresponding to the frame layout entries
 * @num_planes: number of planes
 * @try: true to set the frame parameters, false to query only
 *
 * This function is used by this driver only for compressed/blob data formats.
 */
static int fimc_get_sensor_frame_desc(struct v4l2_subdev *sensor,
				      struct v4l2_plane_pix_format *plane_fmt,
				      unsigned int num_planes, bool try)
{}

static int fimc_cap_g_fmt_mplane(struct file *file, void *fh,
				 struct v4l2_format *f)
{}

/*
 * Try or set format on the fimc.X.capture video node and additionally
 * on the whole pipeline if @try is false.
 * Locking: the caller must _not_ hold the graph mutex.
 */
static int __video_try_or_set_format(struct fimc_dev *fimc,
				     struct v4l2_format *f, bool try,
				     const struct fimc_fmt **inp_fmt,
				     const struct fimc_fmt **out_fmt)
{}

static int fimc_cap_try_fmt_mplane(struct file *file, void *fh,
				   struct v4l2_format *f)
{}

static void fimc_capture_mark_jpeg_xfer(struct fimc_ctx *ctx,
					enum fimc_color_fmt color)
{}

static int __fimc_capture_set_format(struct fimc_dev *fimc,
				     struct v4l2_format *f)
{}

static int fimc_cap_s_fmt_mplane(struct file *file, void *priv,
				 struct v4l2_format *f)
{}

static int fimc_cap_enum_input(struct file *file, void *priv,
			       struct v4l2_input *i)
{}

static int fimc_cap_s_input(struct file *file, void *priv, unsigned int i)
{}

static int fimc_cap_g_input(struct file *file, void *priv, unsigned int *i)
{}

/**
 * fimc_pipeline_validate - check for formats inconsistencies
 *                          between source and sink pad of each link
 * @fimc:	the FIMC device this context applies to
 *
 * Return 0 if all formats match or -EPIPE otherwise.
 */
static int fimc_pipeline_validate(struct fimc_dev *fimc)
{}

static int fimc_cap_streamon(struct file *file, void *priv,
			     enum v4l2_buf_type type)
{}

static int fimc_cap_streamoff(struct file *file, void *priv,
			    enum v4l2_buf_type type)
{}

static int fimc_cap_reqbufs(struct file *file, void *priv,
			    struct v4l2_requestbuffers *reqbufs)
{}

static int fimc_cap_g_selection(struct file *file, void *fh,
				struct v4l2_selection *s)
{}

static int fimc_cap_s_selection(struct file *file, void *fh,
				struct v4l2_selection *s)
{}

static const struct v4l2_ioctl_ops fimc_capture_ioctl_ops =;

/* Capture subdev media entity operations */
static int fimc_link_setup(struct media_entity *entity,
			   const struct media_pad *local,
			   const struct media_pad *remote, u32 flags)
{}

static const struct media_entity_operations fimc_sd_media_ops =;

/**
 * fimc_sensor_notify - v4l2_device notification from a sensor subdev
 * @sd: pointer to a subdev generating the notification
 * @notification: the notification type, must be S5P_FIMC_TX_END_NOTIFY
 * @arg: pointer to an u32 type integer that stores the frame payload value
 *
 * The End Of Frame notification sent by sensor subdev in its still capture
 * mode. If there is only a single VSYNC generated by the sensor at the
 * beginning of a frame transmission, FIMC does not issue the LastIrq
 * (end of frame) interrupt. And this notification is used to complete the
 * frame capture and returning a buffer to user-space. Subdev drivers should
 * call this notification from their last 'End of frame capture' interrupt.
 */
void fimc_sensor_notify(struct v4l2_subdev *sd, unsigned int notification,
			void *arg)
{}

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

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

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

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

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

static const struct v4l2_subdev_pad_ops fimc_subdev_pad_ops =;

static const struct v4l2_subdev_ops fimc_subdev_ops =;

/* Set default format at the sensor and host interface */
static int fimc_capture_set_default_format(struct fimc_dev *fimc)
{}

/* fimc->lock must be already initialized */
static int fimc_register_capture_device(struct fimc_dev *fimc,
				 struct v4l2_device *v4l2_dev)
{}

static int fimc_capture_subdev_registered(struct v4l2_subdev *sd)
{}

static void fimc_capture_subdev_unregistered(struct v4l2_subdev *sd)
{}

static const struct v4l2_subdev_internal_ops fimc_capture_sd_internal_ops =;

int fimc_initialize_capture_subdev(struct fimc_dev *fimc)
{}

void fimc_unregister_capture_subdev(struct fimc_dev *fimc)
{}