linux/drivers/media/pci/intel/ipu6/ipu6-isys.c

// SPDX-License-Identifier: GPL-2.0-only
/*
 * Copyright (C) 2013--2024 Intel Corporation
 */

#include <linux/auxiliary_bus.h>
#include <linux/bitfield.h>
#include <linux/bits.h>
#include <linux/completion.h>
#include <linux/container_of.h>
#include <linux/delay.h>
#include <linux/device.h>
#include <linux/dma-mapping.h>
#include <linux/err.h>
#include <linux/firmware.h>
#include <linux/io.h>
#include <linux/irqreturn.h>
#include <linux/list.h>
#include <linux/module.h>
#include <linux/mutex.h>
#include <linux/pci.h>
#include <linux/pm_runtime.h>
#include <linux/pm_qos.h>
#include <linux/slab.h>
#include <linux/spinlock.h>
#include <linux/string.h>

#include <media/ipu-bridge.h>
#include <media/media-device.h>
#include <media/media-entity.h>
#include <media/v4l2-async.h>
#include <media/v4l2-device.h>
#include <media/v4l2-fwnode.h>

#include "ipu6-bus.h"
#include "ipu6-cpd.h"
#include "ipu6-isys.h"
#include "ipu6-isys-csi2.h"
#include "ipu6-mmu.h"
#include "ipu6-platform-buttress-regs.h"
#include "ipu6-platform-isys-csi2-reg.h"
#include "ipu6-platform-regs.h"

#define IPU6_BUTTRESS_FABIC_CONTROL
#define GDA_ENABLE_IWAKE_INDEX
#define GDA_IWAKE_THRESHOLD_INDEX
#define GDA_IRQ_CRITICAL_THRESHOLD_INDEX
#define GDA_MEMOPEN_THRESHOLD_INDEX
#define DEFAULT_DID_RATIO
#define DEFAULT_IWAKE_THRESHOLD
#define DEFAULT_MEM_OPEN_TIME
#define ONE_THOUSAND_MICROSECOND
/* One page is 2KB, 8 x 16 x 16 = 2048B = 2KB */
#define ISF_DMA_TOP_GDA_PROFERTY_PAGE_SIZE

/* LTR & DID value are 10 bit at most */
#define LTR_DID_VAL_MAX
#define LTR_DEFAULT_VALUE
#define FILL_TIME_DEFAULT_VALUE
#define LTR_DID_PKGC_2R
#define LTR_SCALE_DEFAULT
#define LTR_SCALE_1024NS
#define DID_SCALE_1US
#define DID_SCALE_32US
#define REG_PKGC_PMON_CFG

#define VAL_PKGC_PMON_CFG_RESET
#define VAL_PKGC_PMON_CFG_START

#define IS_PIXEL_BUFFER_PAGES
/*
 * when iwake mode is disabled, the critical threshold is statically set
 * to 75% of the IS pixel buffer, criticalThreshold = (128 * 3) / 4
 */
#define CRITICAL_THRESHOLD_IWAKE_DISABLE

fabric_ctrl;

enum ltr_did_type {};

#define ISYS_PM_QOS_VALUE

static int isys_isr_one(struct ipu6_bus_device *adev);

static int
isys_complete_ext_device_registration(struct ipu6_isys *isys,
				      struct v4l2_subdev *sd,
				      struct ipu6_isys_csi2_config *csi2)
{}

static void isys_stream_init(struct ipu6_isys *isys)
{}

static void isys_csi2_unregister_subdevices(struct ipu6_isys *isys)
{}

static int isys_csi2_register_subdevices(struct ipu6_isys *isys)
{}

static int isys_csi2_create_media_links(struct ipu6_isys *isys)
{}

static void isys_unregister_video_devices(struct ipu6_isys *isys)
{}

static int isys_register_video_devices(struct ipu6_isys *isys)
{}

void isys_setup_hw(struct ipu6_isys *isys)
{}

static void ipu6_isys_csi2_isr(struct ipu6_isys_csi2 *csi2)
{}

irqreturn_t isys_isr(struct ipu6_bus_device *adev)
{}

static void get_lut_ltrdid(struct ipu6_isys *isys, struct ltr_did *pltr_did)
{}

static int set_iwake_register(struct ipu6_isys *isys, u32 index, u32 value)
{}

/*
 * When input system is powered up and before enabling any new sensor capture,
 * or after disabling any sensor capture the following values need to be set:
 * LTR_value = LTR(usec) from calculation;
 * LTR_scale = 2;
 * DID_value = DID(usec) from calculation;
 * DID_scale = 2;
 *
 * When input system is powered down, the LTR and DID values
 * must be returned to the default values:
 * LTR_value = 1023;
 * LTR_scale = 5;
 * DID_value = 1023;
 * DID_scale = 2;
 */
static void set_iwake_ltrdid(struct ipu6_isys *isys, u16 ltr, u16 did,
			     enum ltr_did_type use)
{}

/*
 * Driver may clear register GDA_ENABLE_IWAKE before FW configures the
 * stream for debug purpose. Otherwise driver should not access this register.
 */
static void enable_iwake(struct ipu6_isys *isys, bool enable)
{}

void update_watermark_setting(struct ipu6_isys *isys)
{}

static void isys_iwake_watermark_init(struct ipu6_isys *isys)
{}

static void isys_iwake_watermark_cleanup(struct ipu6_isys *isys)
{}

/* The .bound() notifier callback when a match is found */
static int isys_notifier_bound(struct v4l2_async_notifier *notifier,
			       struct v4l2_subdev *sd,
			       struct v4l2_async_connection *asc)
{}

static int isys_notifier_complete(struct v4l2_async_notifier *notifier)
{}

static const struct v4l2_async_notifier_operations isys_async_ops =;

#define ISYS_MAX_PORTS
static int isys_notifier_init(struct ipu6_isys *isys)
{}

static void isys_notifier_cleanup(struct ipu6_isys *isys)
{}

static int isys_register_devices(struct ipu6_isys *isys)
{}

static void isys_unregister_devices(struct ipu6_isys *isys)
{}

static int isys_runtime_pm_resume(struct device *dev)
{}

static int isys_runtime_pm_suspend(struct device *dev)
{}

static int isys_suspend(struct device *dev)
{}

static int isys_resume(struct device *dev)
{}

static const struct dev_pm_ops isys_pm_ops =;

static void free_fw_msg_bufs(struct ipu6_isys *isys)
{}

static int alloc_fw_msg_bufs(struct ipu6_isys *isys, int amount)
{}

struct isys_fw_msgs *ipu6_get_fw_msg_buf(struct ipu6_isys_stream *stream)
{}

void ipu6_cleanup_fw_msg_bufs(struct ipu6_isys *isys)
{}

void ipu6_put_fw_msg_buf(struct ipu6_isys *isys, u64 data)
{}

static int isys_probe(struct auxiliary_device *auxdev,
		      const struct auxiliary_device_id *auxdev_id)
{}

static void isys_remove(struct auxiliary_device *auxdev)
{}

struct fwmsg {};

static const struct fwmsg fw_msg[] =;

static u32 resp_type_to_index(int type)
{}

static int isys_isr_one(struct ipu6_bus_device *adev)
{}

static const struct ipu6_auxdrv_data ipu6_isys_auxdrv_data =;

static const struct auxiliary_device_id ipu6_isys_id_table[] =;
MODULE_DEVICE_TABLE(auxiliary, ipu6_isys_id_table);

static struct auxiliary_driver isys_driver =;

module_auxiliary_driver();

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