linux/drivers/staging/media/imx/imx-media-fim.c

// SPDX-License-Identifier: GPL-2.0+
/*
 * Frame Interval Monitor.
 *
 * Copyright (c) 2016 Mentor Graphics Inc.
 */
#include <linux/delay.h>
#include <linux/irq.h>
#include <linux/module.h>
#include <linux/platform_device.h>
#include <linux/slab.h>
#include <linux/spinlock.h>
#include <media/v4l2-ctrls.h>
#include <media/v4l2-subdev.h>
#include <media/imx.h>
#include "imx-media.h"

enum {};

enum {};

#define FIM_CL_ENABLE_DEF
#define FIM_CL_NUM_DEF
#define FIM_CL_NUM_SKIP_DEF
#define FIM_CL_TOLERANCE_MIN_DEF
#define FIM_CL_TOLERANCE_MAX_DEF

struct imx_media_fim {};

static bool icap_enabled(struct imx_media_fim *fim)
{}

static void update_fim_nominal(struct imx_media_fim *fim,
			       const struct v4l2_fract *fi)
{}

static void reset_fim(struct imx_media_fim *fim, bool curval)
{}

static void send_fim_event(struct imx_media_fim *fim, unsigned long error)
{}

/*
 * Monitor an averaged frame interval. If the average deviates too much
 * from the nominal frame rate, send the frame interval error event. The
 * frame intervals are averaged in order to quiet noise from
 * (presumably random) interrupt latency.
 */
static void frame_interval_monitor(struct imx_media_fim *fim,
				   ktime_t timestamp)
{}

/*
 * In case we are monitoring the first frame interval after streamon
 * (when fim->num_skip = 0), we need a valid fim->last_ts before we
 * can begin. This only applies to the input capture method. It is not
 * possible to accurately measure the first FI after streamon using the
 * EOF method, so fim->num_skip minimum is set to 1 in that case, so this
 * function is a noop when the EOF method is used.
 */
static void fim_acquire_first_ts(struct imx_media_fim *fim)
{}

/* FIM Controls */
static int fim_s_ctrl(struct v4l2_ctrl *ctrl)
{}

static const struct v4l2_ctrl_ops fim_ctrl_ops =;

static const struct v4l2_ctrl_config fim_ctrl[] =;

static const struct v4l2_ctrl_config fim_icap_ctrl[] =;

static int init_fim_controls(struct imx_media_fim *fim)
{}

/*
 * Monitor frame intervals via EOF interrupt. This method is
 * subject to uncertainty errors introduced by interrupt latency.
 *
 * This is a noop if the Input Capture method is being used, since
 * the frame_interval_monitor() is called by the input capture event
 * callback handler in that case.
 */
void imx_media_fim_eof_monitor(struct imx_media_fim *fim, ktime_t timestamp)
{}

/* Called by the subdev in its s_stream callback */
void imx_media_fim_set_stream(struct imx_media_fim *fim,
			      const struct v4l2_fract *fi,
			      bool on)
{}

int imx_media_fim_add_controls(struct imx_media_fim *fim)
{}

/* Called by the subdev in its subdev registered callback */
struct imx_media_fim *imx_media_fim_init(struct v4l2_subdev *sd)
{}

void imx_media_fim_free(struct imx_media_fim *fim)
{}