linux/drivers/media/pci/intel/ivsc/mei_csi.c

// SPDX-License-Identifier: GPL-2.0-only
/*
 * Copyright (C) 2023 Intel Corporation. All rights reserved.
 * Intel Visual Sensing Controller CSI Linux driver
 */

/*
 * To set ownership of CSI-2 link and to configure CSI-2 link, there
 * are specific commands, which are sent via MEI protocol. The send
 * command function uses "completion" as a synchronization mechanism.
 * The response for command is received via a mei callback which wakes
 * up the caller. There can be only one outstanding command at a time.
 */

#include <linux/completion.h>
#include <linux/delay.h>
#include <linux/kernel.h>
#include <linux/math64.h>
#include <linux/mei_cl_bus.h>
#include <linux/module.h>
#include <linux/mutex.h>
#include <linux/pci.h>
#include <linux/pm_runtime.h>
#include <linux/slab.h>
#include <linux/units.h>
#include <linux/uuid.h>
#include <linux/workqueue.h>

#include <media/ipu-bridge.h>
#include <media/ipu6-pci-table.h>
#include <media/v4l2-async.h>
#include <media/v4l2-ctrls.h>
#include <media/v4l2-fwnode.h>
#include <media/v4l2-subdev.h>

#define MEI_CSI_ENTITY_NAME

#define MEI_CSI_LINK_FREQ_400MHZ

/* the 5s used here is based on experiment */
#define CSI_CMD_TIMEOUT
/* to setup CSI-2 link an extra delay needed and determined experimentally */
#define CSI_FW_READY_DELAY_MS
/* link frequency unit is 100kHz */
#define CSI_LINK_FREQ(x)

/*
 * identify the command id supported by firmware
 * IPC, as well as the privacy notification id
 * used when processing privacy event.
 */
enum csi_cmd_id {};

/* CSI-2 link ownership definition */
enum csi_link_owner {};

/* privacy status definition */
enum ivsc_privacy_status {};

enum csi_pads {};

/* configuration of the CSI-2 link between host and IVSC */
struct csi_link_cfg {} __packed;

/* CSI command structure */
struct csi_cmd {} __packed;

/* CSI notification structure */
struct csi_notif {} __packed;

struct mei_csi {};

static const struct v4l2_mbus_framefmt mei_csi_format_mbus_default =;

static s64 link_freq_menu_items[] =;

static inline struct mei_csi *notifier_to_csi(struct v4l2_async_notifier *n)
{}

static inline struct mei_csi *sd_to_csi(struct v4l2_subdev *sd)
{}

static inline struct mei_csi *ctrl_to_csi(struct v4l2_ctrl *ctrl)
{}

/* send a command to firmware and mutex must be held by caller */
static int mei_csi_send(struct mei_csi *csi, u8 *buf, size_t len)
{}

/* set CSI-2 link ownership */
static int csi_set_link_owner(struct mei_csi *csi, enum csi_link_owner owner)
{}

/* configure CSI-2 link between host and IVSC */
static int csi_set_link_cfg(struct mei_csi *csi)
{}

/* callback for receive */
static void mei_csi_rx(struct mei_cl_device *cldev)
{}

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

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

static int mei_csi_set_fmt(struct v4l2_subdev *sd,
			   struct v4l2_subdev_state *sd_state,
			   struct v4l2_subdev_format *format)
{}

static int mei_csi_g_volatile_ctrl(struct v4l2_ctrl *ctrl)
{}

static const struct v4l2_ctrl_ops mei_csi_ctrl_ops =;

static const struct v4l2_subdev_video_ops mei_csi_video_ops =;

static const struct v4l2_subdev_pad_ops mei_csi_pad_ops =;

static const struct v4l2_subdev_ops mei_csi_subdev_ops =;

static const struct v4l2_subdev_internal_ops mei_csi_internal_ops =;

static const struct media_entity_operations mei_csi_entity_ops =;

static int mei_csi_notify_bound(struct v4l2_async_notifier *notifier,
				struct v4l2_subdev *subdev,
				struct v4l2_async_connection *asd)
{}

static void mei_csi_notify_unbind(struct v4l2_async_notifier *notifier,
				  struct v4l2_subdev *subdev,
				  struct v4l2_async_connection *asd)
{}

static const struct v4l2_async_notifier_operations mei_csi_notify_ops =;

static int mei_csi_init_controls(struct mei_csi *csi)
{}

static int mei_csi_parse_firmware(struct mei_csi *csi)
{}

static int mei_csi_probe(struct mei_cl_device *cldev,
			 const struct mei_cl_device_id *id)
{}

static void mei_csi_remove(struct mei_cl_device *cldev)
{}

#define MEI_CSI_UUID

static const struct mei_cl_device_id mei_csi_tbl[] =;
MODULE_DEVICE_TABLE(mei, mei_csi_tbl);

static struct mei_cl_driver mei_csi_driver =;

module_mei_cl_driver();

MODULE_IMPORT_NS();
MODULE_AUTHOR();
MODULE_AUTHOR();
MODULE_DESCRIPTION();
MODULE_LICENSE();