linux/drivers/media/test-drivers/vivid/vivid-vid-cap.c

// SPDX-License-Identifier: GPL-2.0-only
/*
 * vivid-vid-cap.c - video capture support functions.
 *
 * Copyright 2014 Cisco Systems, Inc. and/or its affiliates. All rights reserved.
 */

#include <linux/errno.h>
#include <linux/kernel.h>
#include <linux/sched.h>
#include <linux/vmalloc.h>
#include <linux/videodev2.h>
#include <linux/v4l2-dv-timings.h>
#include <media/v4l2-common.h>
#include <media/v4l2-event.h>
#include <media/v4l2-dv-timings.h>
#include <media/v4l2-rect.h>

#include "vivid-core.h"
#include "vivid-vid-common.h"
#include "vivid-kthread-cap.h"
#include "vivid-vid-cap.h"

/* Sizes must be in increasing order */
static const struct v4l2_frmsize_discrete webcam_sizes[] =;

/*
 * Intervals must be in increasing order and there must be twice as many
 * elements in this array as there are in webcam_sizes.
 */
static const struct v4l2_fract webcam_intervals[] =;

/* Limit maximum FPS rates for high resolutions */
#define IVAL_COUNT_720P
#define IVAL_COUNT_1080P
#define IVAL_COUNT_2160P

static inline unsigned int webcam_ival_count(const struct vivid_dev *dev,
					     unsigned int frmsize_idx)
{}

static int vid_cap_queue_setup(struct vb2_queue *vq,
		       unsigned *nbuffers, unsigned *nplanes,
		       unsigned sizes[], struct device *alloc_devs[])
{}

static int vid_cap_buf_prepare(struct vb2_buffer *vb)
{}

static void vid_cap_buf_finish(struct vb2_buffer *vb)
{}

static void vid_cap_buf_queue(struct vb2_buffer *vb)
{}

static int vid_cap_start_streaming(struct vb2_queue *vq, unsigned count)
{}

/* abort streaming and wait for last buffer */
static void vid_cap_stop_streaming(struct vb2_queue *vq)
{}

static void vid_cap_buf_request_complete(struct vb2_buffer *vb)
{}

const struct vb2_ops vivid_vid_cap_qops =;

/*
 * Determine the 'picture' quality based on the current TV frequency: either
 * COLOR for a good 'signal', GRAY (grayscale picture) for a slightly off
 * signal or NOISE for no signal.
 */
void vivid_update_quality(struct vivid_dev *dev)
{}

/*
 * Get the current picture quality and the associated afc value.
 */
static enum tpg_quality vivid_get_quality(struct vivid_dev *dev, s32 *afc)
{}

enum tpg_video_aspect vivid_get_video_aspect(const struct vivid_dev *dev)
{}

static enum tpg_pixel_aspect vivid_get_pixel_aspect(const struct vivid_dev *dev)
{}

/*
 * Called whenever the format has to be reset which can occur when
 * changing inputs, standard, timings, etc.
 */
void vivid_update_format_cap(struct vivid_dev *dev, bool keep_controls)
{}

/* Map the field to something that is valid for the current input */
static enum v4l2_field vivid_field_cap(struct vivid_dev *dev, enum v4l2_field field)
{}

static unsigned vivid_colorspace_cap(struct vivid_dev *dev)
{}

static unsigned vivid_xfer_func_cap(struct vivid_dev *dev)
{}

static unsigned vivid_ycbcr_enc_cap(struct vivid_dev *dev)
{}

static unsigned int vivid_hsv_enc_cap(struct vivid_dev *dev)
{}

static unsigned vivid_quantization_cap(struct vivid_dev *dev)
{}

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

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

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

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

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

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

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

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

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

int vivid_vid_cap_g_selection(struct file *file, void *priv,
			      struct v4l2_selection *sel)
{}

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

int vivid_vid_cap_g_pixelaspect(struct file *file, void *priv,
				int type, struct v4l2_fract *f)
{}

static const struct v4l2_audio vivid_audio_inputs[] =;

int vidioc_enum_input(struct file *file, void *priv,
				struct v4l2_input *inp)
{}

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

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

int vidioc_enumaudio(struct file *file, void *fh, struct v4l2_audio *vin)
{}

int vidioc_g_audio(struct file *file, void *fh, struct v4l2_audio *vin)
{}

int vidioc_s_audio(struct file *file, void *fh, const struct v4l2_audio *vin)
{}

int vivid_video_g_frequency(struct file *file, void *fh, struct v4l2_frequency *vf)
{}

int vivid_video_s_frequency(struct file *file, void *fh, const struct v4l2_frequency *vf)
{}

int vivid_video_s_tuner(struct file *file, void *fh, const struct v4l2_tuner *vt)
{}

int vivid_video_g_tuner(struct file *file, void *fh, struct v4l2_tuner *vt)
{}

/* Must remain in sync with the vivid_ctrl_standard_strings array */
const v4l2_std_id vivid_standard[] =;

/* Must remain in sync with the vivid_standard array */
const char * const vivid_ctrl_standard_strings[] =;

int vidioc_querystd(struct file *file, void *priv, v4l2_std_id *id)
{}

int vivid_vid_cap_s_std(struct file *file, void *priv, v4l2_std_id id)
{}

static void find_aspect_ratio(u32 width, u32 height,
			       u32 *num, u32 *denom)
{}

static bool valid_cvt_gtf_timings(struct v4l2_dv_timings *timings)
{}

int vivid_vid_cap_s_dv_timings(struct file *file, void *_fh,
				    struct v4l2_dv_timings *timings)
{}

int vidioc_query_dv_timings(struct file *file, void *_fh,
				    struct v4l2_dv_timings *timings)
{}

void vivid_update_outputs(struct vivid_dev *dev)
{}

void vivid_update_connected_outputs(struct vivid_dev *dev)
{}

int vidioc_s_edid(struct file *file, void *_fh,
			 struct v4l2_edid *edid)
{}

int vidioc_enum_framesizes(struct file *file, void *fh,
					 struct v4l2_frmsizeenum *fsize)
{}

/* timeperframe is arbitrary and continuous */
int vidioc_enum_frameintervals(struct file *file, void *priv,
					     struct v4l2_frmivalenum *fival)
{}

int vivid_vid_cap_g_parm(struct file *file, void *priv,
			  struct v4l2_streamparm *parm)
{}

int vivid_vid_cap_s_parm(struct file *file, void *priv,
			  struct v4l2_streamparm *parm)
{}